@reticlehq/core 2.2.0 → 2.3.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 (99) hide show
  1. package/dist/brand.d.ts +0 -1
  2. package/dist/brand.js +0 -1
  3. package/dist/consequence.d.ts +0 -1
  4. package/dist/consequence.js +0 -1
  5. package/dist/constants.d.ts +30 -25
  6. package/dist/constants.js +33 -23
  7. package/dist/daemon-registry.d.ts +0 -1
  8. package/dist/daemon-registry.js +0 -1
  9. package/dist/desktop-contract.cjs +11 -0
  10. package/dist/desktop-contract.d.cts +6 -0
  11. package/dist/desktop-contract.d.ts +58 -0
  12. package/dist/desktop-contract.js +59 -0
  13. package/dist/event-payloads.d.ts +60 -3
  14. package/dist/event-payloads.js +35 -4
  15. package/dist/event-priority.d.ts +25 -0
  16. package/dist/event-priority.js +45 -0
  17. package/dist/findings.d.ts +124 -0
  18. package/dist/findings.js +122 -0
  19. package/dist/flow-constants.d.ts +0 -1
  20. package/dist/flow-constants.js +0 -1
  21. package/dist/flow-types.d.ts +9 -1
  22. package/dist/flow-types.js +0 -1
  23. package/dist/index.d.ts +8 -1
  24. package/dist/index.js +8 -1
  25. package/dist/journal.d.ts +0 -1
  26. package/dist/journal.js +0 -1
  27. package/dist/messages.d.ts +16 -11
  28. package/dist/messages.js +0 -1
  29. package/dist/net.d.ts +41 -0
  30. package/dist/net.js +40 -0
  31. package/dist/notices.d.ts +0 -1
  32. package/dist/notices.js +0 -1
  33. package/dist/redaction.d.ts +0 -1
  34. package/dist/redaction.js +1 -2
  35. package/dist/schema/event-message.json +3 -1
  36. package/dist/schema/event-type.json +3 -1
  37. package/dist/schema/reticle-event.json +3 -1
  38. package/dist/schema/reticle-message.json +3 -1
  39. package/dist/security.d.ts +20 -1
  40. package/dist/security.js +45 -1
  41. package/dist/session-constants.d.ts +0 -1
  42. package/dist/session-constants.js +0 -1
  43. package/dist/state-select.d.ts +0 -1
  44. package/dist/state-select.js +32 -1
  45. package/dist/telemetry-feedback.d.ts +265 -0
  46. package/dist/telemetry-feedback.js +163 -0
  47. package/dist/telemetry-session.d.ts +524 -0
  48. package/dist/telemetry-session.js +245 -0
  49. package/dist/telemetry.d.ts +1463 -0
  50. package/dist/telemetry.js +375 -0
  51. package/dist/toon.d.ts +0 -1
  52. package/dist/toon.js +0 -1
  53. package/dist/types.d.ts +9 -2
  54. package/dist/types.js +0 -1
  55. package/dist/upgrade.d.ts +16 -3
  56. package/dist/upgrade.js +14 -2
  57. package/dist/verification-run.d.ts +4 -5
  58. package/dist/verification-run.js +0 -1
  59. package/dist/verified-constants.d.ts +104 -0
  60. package/dist/verified-constants.js +102 -0
  61. package/package.json +7 -3
  62. package/dist/brand.d.ts.map +0 -1
  63. package/dist/brand.js.map +0 -1
  64. package/dist/consequence.d.ts.map +0 -1
  65. package/dist/consequence.js.map +0 -1
  66. package/dist/constants.d.ts.map +0 -1
  67. package/dist/constants.js.map +0 -1
  68. package/dist/daemon-registry.d.ts.map +0 -1
  69. package/dist/daemon-registry.js.map +0 -1
  70. package/dist/event-payloads.d.ts.map +0 -1
  71. package/dist/event-payloads.js.map +0 -1
  72. package/dist/flow-constants.d.ts.map +0 -1
  73. package/dist/flow-constants.js.map +0 -1
  74. package/dist/flow-types.d.ts.map +0 -1
  75. package/dist/flow-types.js.map +0 -1
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js.map +0 -1
  78. package/dist/journal.d.ts.map +0 -1
  79. package/dist/journal.js.map +0 -1
  80. package/dist/messages.d.ts.map +0 -1
  81. package/dist/messages.js.map +0 -1
  82. package/dist/notices.d.ts.map +0 -1
  83. package/dist/notices.js.map +0 -1
  84. package/dist/redaction.d.ts.map +0 -1
  85. package/dist/redaction.js.map +0 -1
  86. package/dist/security.d.ts.map +0 -1
  87. package/dist/security.js.map +0 -1
  88. package/dist/session-constants.d.ts.map +0 -1
  89. package/dist/session-constants.js.map +0 -1
  90. package/dist/state-select.d.ts.map +0 -1
  91. package/dist/state-select.js.map +0 -1
  92. package/dist/toon.d.ts.map +0 -1
  93. package/dist/toon.js.map +0 -1
  94. package/dist/types.d.ts.map +0 -1
  95. package/dist/types.js.map +0 -1
  96. package/dist/upgrade.d.ts.map +0 -1
  97. package/dist/upgrade.js.map +0 -1
  98. package/dist/verification-run.d.ts.map +0 -1
  99. package/dist/verification-run.js.map +0 -1
@@ -0,0 +1,163 @@
1
+ /**
2
+ * The FEEDBACK and IDENTITY contract — the only two things Reticle ever sends that a person wrote.
3
+ *
4
+ * Split out of `telemetry.ts` because they are a different privacy class from everything else there.
5
+ * The rest of telemetry is counters and enums that cannot describe anyone; these two carry authored
6
+ * text and a self-declared identity, they are never emitted passively, and they each have their own
7
+ * consent story. Keeping them in one file makes that boundary something you can see rather than
8
+ * something you have to remember — and it keeps the event contract under the size cap.
9
+ *
10
+ * Neither is ever populated by inference. A `Feedback` exists because an agent called
11
+ * `reticle_feedback` or a human ran `reticle feedback`; an `Identity` exists because a human ran
12
+ * `reticle identify`. There is no code path to either that a person did not start.
13
+ */
14
+ import { z } from 'zod';
15
+ /** Who authored the feedback. Agents report failures; humans also rate the experience. */
16
+ export const FeedbackSource = {
17
+ AGENT: 'agent',
18
+ HUMAN: 'human',
19
+ };
20
+ /**
21
+ * What kind of report this is. The first three are the agent's vocabulary — they name the three ways
22
+ * Reticle fails an agent, and keeping them distinct is the whole point: a BUG is our defect, a GAP is
23
+ * a thing we cannot see at all, and an AMBIGUITY is a verdict the agent could not act on. Lumping
24
+ * them into "it didn't work" would destroy the only signal that says what to build next.
25
+ */
26
+ export const FeedbackKind = {
27
+ /** A tool misbehaved: wrong result, crash, or a contract it did not honor. */
28
+ BUG: 'bug',
29
+ /** Reticle could not observe something the agent needed — a blind spot, not a defect. */
30
+ GAP: 'gap',
31
+ /** The verification ran but its verdict was not decidable — pass/fail could not be told apart. */
32
+ AMBIGUITY: 'ambiguity',
33
+ /**
34
+ * "I wish Reticle could do X." Something that does not exist and would have helped.
35
+ *
36
+ * Reticle is built FOR agents, so the agent is the user whose wishes matter most — and it is the
37
+ * one user who never gets asked. It hits a limitation, works around it, finishes the task, and the
38
+ * wish evaporates with the context window. This is the channel for it, and it is deliberately as
39
+ * easy to file as a bug: the friction that stops people reporting failures stops them twice as
40
+ * hard for something that is merely a nice-to-have.
41
+ */
42
+ FEATURE_REQUEST: 'feature_request',
43
+ /**
44
+ * Something that EXISTS but is awkward — too many calls, a confusing shape, a slow path.
45
+ *
46
+ * Kept separate from a feature request because the responses differ completely: one is "build the
47
+ * missing thing", the other is "the thing is there and the ergonomics are wrong". Collapsing them
48
+ * would hide the second inside the first, and the second is usually cheaper and higher-impact.
49
+ */
50
+ IMPROVEMENT: 'improvement',
51
+ /** A human's overall take on using Reticle (carries `rating`). */
52
+ EXPERIENCE: 'experience',
53
+ };
54
+ /** Which shell the verified app runs in. Mirrors the SDK's own `PAGE_HEALTH` runtime report. */
55
+ export const AppRuntime = {
56
+ WEB: 'web',
57
+ ELECTRON: 'electron',
58
+ TAURI: 'tauri',
59
+ };
60
+ /** The rendering engine behind the connected page — coarse on purpose (three values, not a UA string). */
61
+ export const BrowserEngine = {
62
+ BLINK: 'blink',
63
+ GECKO: 'gecko',
64
+ WEBKIT: 'webkit',
65
+ };
66
+ /** How Reticle reaches the page: a driven CDP browser, or the SDK inside the human's own browser. */
67
+ export const PageDriver = {
68
+ CDP: 'cdp',
69
+ SDK: 'sdk',
70
+ };
71
+ /** Where the MCP server is registered — a user-level install serves every project, a project-level one doesn't. */
72
+ export const McpScope = {
73
+ USER: 'user',
74
+ PROJECT: 'project',
75
+ };
76
+ export const FEEDBACK_TEXT_MAX = 4000;
77
+ export const FEEDBACK_TRACE_MAX = 8000;
78
+ export const FEEDBACK_RATING_MIN = 1;
79
+ export const FEEDBACK_RATING_MAX = 5;
80
+ /** Cap for the structured why/impact/workaround fields — prose, but bounded prose. */
81
+ export const FEEDBACK_FIELD_MAX = 1000;
82
+ /**
83
+ * The feedback body. Everything here is either author-written (`text`, `trace`, `rating`) or
84
+ * environment context detected locally (`stack`, `runtime`, `engine`, …) — the context is what turns
85
+ * "a tool broke" into "a tool breaks on Tauri + SvelteKit", which is the difference between a
86
+ * complaint and a work item.
87
+ *
88
+ * `text`/`trace` are the ONLY free-text fields Reticle ever sends. They are opt-in by action (nothing
89
+ * is scraped — someone typed or wrote them), capped, and redacted client-side before the wire.
90
+ */
91
+ export const FeedbackSchema = z.object({
92
+ source: z.nativeEnum(FeedbackSource),
93
+ kind: z.nativeEnum(FeedbackKind),
94
+ /** The author's account. For an agent: what failed and why (its RCA). For a human: their words. */
95
+ text: z.string().min(1).max(FEEDBACK_TEXT_MAX),
96
+ /** Agent-side only: the call/response trail that led to the failure, so the RCA is reproducible. */
97
+ trace: z.string().max(FEEDBACK_TRACE_MAX).optional(),
98
+ /** Human-side only: 1–5. The single number that trends without reading a word. */
99
+ rating: z.number().int().min(FEEDBACK_RATING_MIN).max(FEEDBACK_RATING_MAX).optional(),
100
+ /**
101
+ * WHY it is wanted — the goal behind the request, not the request itself.
102
+ *
103
+ * The most common way a feature request wastes everyone's time is arriving as a solution with the
104
+ * problem stripped off. "Add a `waitForIdle` tool" is a guess about implementation; "I need to know
105
+ * the page stopped changing before I assert" is a requirement, and it may already have an answer.
106
+ */
107
+ need: z.string().max(FEEDBACK_FIELD_MAX).optional(),
108
+ /** What measurably gets better — fewer calls, fewer retries, a verdict that stops being ambiguous. */
109
+ impact: z.string().max(FEEDBACK_FIELD_MAX).optional(),
110
+ /**
111
+ * How the author works around it TODAY. Usually the most valuable field in the whole report.
112
+ *
113
+ * A workaround is evidence rather than opinion: it shows what the agent actually did, proves the
114
+ * need is real enough to have cost it something, and frequently reveals that the missing feature is
115
+ * a worse fix than removing whatever forced the workaround.
116
+ */
117
+ currentApproach: z.string().max(FEEDBACK_FIELD_MAX).optional(),
118
+ /**
119
+ * The MODEL the agent is running, self-reported.
120
+ *
121
+ * Not obtainable any other way: MCP's `clientInfo` carries a client name and version and has no
122
+ * concept of a model, so the transport cannot tell us. The agent knows, and this report is already
123
+ * something the agent authored — so asking is both the only mechanism and a reliable one.
124
+ *
125
+ * It matters more than it looks: a limitation that blocks a smaller model may be a docs problem
126
+ * rather than a missing feature, and a request from a frontier model is evidence the surface itself
127
+ * is short. Without it, every request looks the same.
128
+ */
129
+ model: z.string().min(1).max(64).optional(),
130
+ /** The MCP client's own version, alongside its name — so "cursor 0.42 specifically" is answerable. */
131
+ clientVersion: z.string().min(1).max(32).optional(),
132
+ /** The framework detected in the project (`next`, `vite`, `sveltekit`, `vue`, `astro`, …). */
133
+ stack: z.string().min(1).max(64).optional(),
134
+ /**
135
+ * The MAJOR version of that framework ("15", "19"). Major only, deliberately: it is what actually
136
+ * segments a bug ("breaks on React 19" is a work item; "breaks on 19.0.0-rc.1-canary" is noise),
137
+ * and a full version string is high-cardinality enough to start narrowing down who sent it.
138
+ */
139
+ stackMajor: z.number().int().nonnegative().optional(),
140
+ runtime: z.nativeEnum(AppRuntime).optional(),
141
+ engine: z.nativeEnum(BrowserEngine).optional(),
142
+ driver: z.nativeEnum(PageDriver).optional(),
143
+ /** The MCP client on the other end (`claude-code`, `cursor`, …) — self-reported at initialize. */
144
+ client: z.string().min(1).max(64).optional(),
145
+ mcpScope: z.nativeEnum(McpScope).optional(),
146
+ });
147
+ /** What Reticle is being used for. Self-declared; never inferred. */
148
+ export const UsageContextKind = {
149
+ COMPANY: 'company',
150
+ SIDE_PROJECT: 'side_project',
151
+ OPEN_SOURCE: 'open_source',
152
+ LEARNING: 'learning',
153
+ };
154
+ /**
155
+ * A self-declared identity. The ONLY personal data Reticle ever transmits, and it transmits it only
156
+ * because someone typed `reticle identify`. Every field is optional except the context, so a user can
157
+ * say "this is a company" without saying which, or name the company without leaving an email.
158
+ */
159
+ export const IdentitySchema = z.object({
160
+ context: z.nativeEnum(UsageContextKind),
161
+ company: z.string().min(1).max(128).optional(),
162
+ email: z.string().min(3).max(254).optional(),
163
+ });
@@ -0,0 +1,524 @@
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 declare const ErrorShapeSchema: z.ZodObject<{
18
+ /** Stable group key — the same defect from any machine shares it. */
19
+ fingerprint: z.ZodString;
20
+ /** How many times it happened this session. */
21
+ count: z.ZodNumber;
22
+ /** The message with every variable part stripped. The dictionary entry for the fingerprint. */
23
+ message: z.ZodString;
24
+ /** Which tool produced it — the same message from two tools is usually two different bugs. */
25
+ tool: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ message: string;
28
+ count: number;
29
+ fingerprint: string;
30
+ tool?: string | undefined;
31
+ }, {
32
+ message: string;
33
+ count: number;
34
+ fingerprint: string;
35
+ tool?: string | undefined;
36
+ }>;
37
+ export type ErrorShape = z.infer<typeof ErrorShapeSchema>;
38
+ /**
39
+ * Whether the project has git, and whether anyone has pushed it.
40
+ *
41
+ * The distinction matters for more than curiosity: `projectId` can only identify the SAME project
42
+ * across two machines when it is derived from a shared git origin. A repo nobody has pushed has
43
+ * nothing shared to hash, so its fingerprint falls back to the local directory path.
44
+ */
45
+ export declare const GitState: {
46
+ /** No `.git` anywhere above the project — Reticle is running in a plain directory. */
47
+ readonly NONE: "none";
48
+ /** `git init` was run, but there is no origin remote. Nobody else can be working on this copy. */
49
+ readonly LOCAL_ONLY: "local_only";
50
+ /** There is an origin remote — the project is pushed and can be shared. */
51
+ readonly REMOTE: "remote";
52
+ };
53
+ export type GitState = (typeof GitState)[keyof typeof GitState];
54
+ /**
55
+ * Which forge hosts the repo. Public forges are named; everything else is `self_hosted` WITHOUT its
56
+ * hostname, because an internal git host is usually `git.<company>.com` and reporting it would
57
+ * identify the company outright. The bucket carries the signal that actually matters — self-hosted
58
+ * git is a strong enterprise tell.
59
+ */
60
+ export declare const RepoForge: {
61
+ readonly GITHUB: "github";
62
+ readonly GITLAB: "gitlab";
63
+ readonly BITBUCKET: "bitbucket";
64
+ readonly AZURE: "azure";
65
+ readonly SOURCEHUT: "sourcehut";
66
+ readonly CODEBERG: "codeberg";
67
+ readonly SELF_HOSTED: "self_hosted";
68
+ };
69
+ export type RepoForge = (typeof RepoForge)[keyof typeof RepoForge];
70
+ /**
71
+ * What the machine looked like at a moment worth remembering — a crash, or the end of a session.
72
+ *
73
+ * Sampled at MOMENTS, never per tool call: `os.loadavg()` and `process.memoryUsage()` are cheap but
74
+ * not free, and taking them 200 times a session to answer "was the machine struggling" would be
75
+ * paying a continuous cost for a question only asked about the bad moments. Absolute numbers in MB
76
+ * rather than percentages, because "2 GB free of 8" and "2 GB free of 64" are different worlds.
77
+ */
78
+ export declare const MachineSnapshotSchema: z.ZodObject<{
79
+ /** Resident set size of the daemon itself — our footprint, the one we can actually fix. */
80
+ rssMb: z.ZodNumber;
81
+ heapUsedMb: z.ZodNumber;
82
+ /** Free and total system memory. A machine at 200 MB free explains a lot of otherwise-weird bugs. */
83
+ freeMemMb: z.ZodNumber;
84
+ totalMemMb: z.ZodNumber;
85
+ /** 1-minute load average, ×100 so it stays an integer. Zero on Windows, which does not report it. */
86
+ load1x100: z.ZodNumber;
87
+ cpuCount: z.ZodNumber;
88
+ }, "strip", z.ZodTypeAny, {
89
+ rssMb: number;
90
+ heapUsedMb: number;
91
+ freeMemMb: number;
92
+ totalMemMb: number;
93
+ load1x100: number;
94
+ cpuCount: number;
95
+ }, {
96
+ rssMb: number;
97
+ heapUsedMb: number;
98
+ freeMemMb: number;
99
+ totalMemMb: number;
100
+ load1x100: number;
101
+ cpuCount: number;
102
+ }>;
103
+ export type MachineSnapshot = z.infer<typeof MachineSnapshotSchema>;
104
+ /** Per-tool wall-clock. `count` lives in `toolCounts`; these are the two numbers it does not carry. */
105
+ export declare const ToolTimingSchema: z.ZodObject<{
106
+ /** Total ms spent inside this tool. Divided by its count, the average; summed, the time in Reticle. */
107
+ totalMs: z.ZodNumber;
108
+ /** The single worst call. An average hides the 30-second outlier that made someone give up. */
109
+ maxMs: z.ZodNumber;
110
+ }, "strip", z.ZodTypeAny, {
111
+ totalMs: number;
112
+ maxMs: number;
113
+ }, {
114
+ totalMs: number;
115
+ maxMs: number;
116
+ }>;
117
+ export type ToolTiming = z.infer<typeof ToolTimingSchema>;
118
+ /**
119
+ * Attempts, successes and failure reasons for one kind of connection.
120
+ *
121
+ * The first version of this counted only successes — and counted them inconsistently, incrementing
122
+ * before the await on one path and after it on another, so the CDP number was attempts and the others
123
+ * were successes and nobody could have told from the data. A connection metric that cannot express
124
+ * FAILURE is close to useless: the whole question is how often people cannot get a browser.
125
+ */
126
+ export declare const ConnectionStatsSchema: z.ZodObject<{
127
+ attempts: z.ZodNumber;
128
+ successes: z.ZodNumber;
129
+ /** Failure reasons with counts — our own classified vocabulary, never a raw error string. */
130
+ failures: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ attempts: number;
133
+ successes: number;
134
+ failures?: Record<string, number> | undefined;
135
+ }, {
136
+ attempts: number;
137
+ successes: number;
138
+ failures?: Record<string, number> | undefined;
139
+ }>;
140
+ export type ConnectionStats = z.infer<typeof ConnectionStatsSchema>;
141
+ /**
142
+ * Why a browser/lease connection failed, classified into causes we can act on.
143
+ *
144
+ * A raw message would be both high-cardinality and unsafe (it can carry a URL or a path). These are
145
+ * the distinct THINGS THAT GO WRONG, each with a different fix: a missing Chromium is a docs problem,
146
+ * a refused CDP url is a configuration problem, a pool timeout is a capacity problem.
147
+ */
148
+ export declare const ConnectFailure: {
149
+ /** Playwright's browser binary was never downloaded — `npx playwright install`. */
150
+ readonly CHROMIUM_MISSING: "chromium_missing";
151
+ /** `playwright` itself is not installed; the optional dependency was skipped. */
152
+ readonly PLAYWRIGHT_MISSING: "playwright_missing";
153
+ /** Nothing listening on the CDP endpoint, or it refused us. */
154
+ readonly CDP_UNREACHABLE: "cdp_unreachable";
155
+ /** The browser launched but died, or was closed underneath us. */
156
+ readonly BROWSER_CRASHED: "browser_crashed";
157
+ /** Waited for a pool slot and never got one. A capacity signal, not an error. */
158
+ readonly POOL_TIMEOUT: "pool_timeout";
159
+ /** Classified as nothing we recognize — the bucket to watch, since a big one means a blind spot. */
160
+ readonly OTHER: "other";
161
+ };
162
+ export type ConnectFailure = (typeof ConnectFailure)[keyof typeof ConnectFailure];
163
+ /**
164
+ * One session, rolled up. This replaces the per-tool-call event entirely — see the volume note on
165
+ * `TelemetryEventKind`. The histogram is the point: `{reticle_act: 40, reticle_assert: 12}` says the
166
+ * session was a real verification loop, where 52 separate rows would have said only that 52 things
167
+ * happened. Counts, never payloads: no arguments, no results, no selectors.
168
+ */
169
+ export declare const SessionSummarySchema: z.ZodObject<{
170
+ /** How long the daemon was up, ms. */
171
+ durationMs: z.ZodNumber;
172
+ /** Total MCP tool calls served. */
173
+ toolCalls: z.ZodNumber;
174
+ /**
175
+ * Calls per tool name — `{ "reticle_act": 40 }`. Tool names are a fixed, low-cardinality set we
176
+ * define ourselves, so this is safe to send whole and is queryable in HogQL with JSONExtract.
177
+ */
178
+ toolCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
179
+ /** Tool calls that ended in an error, and the distinct error shapes behind them. */
180
+ toolErrors: z.ZodNumber;
181
+ /**
182
+ * The distinct error shapes seen, with counts, messages-with-variables-stripped, and the tool that
183
+ * produced each. Bounded, so a pathological loop cannot grow it without limit.
184
+ */
185
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
186
+ /** Stable group key — the same defect from any machine shares it. */
187
+ fingerprint: z.ZodString;
188
+ /** How many times it happened this session. */
189
+ count: z.ZodNumber;
190
+ /** The message with every variable part stripped. The dictionary entry for the fingerprint. */
191
+ message: z.ZodString;
192
+ /** Which tool produced it — the same message from two tools is usually two different bugs. */
193
+ tool: z.ZodOptional<z.ZodString>;
194
+ }, "strip", z.ZodTypeAny, {
195
+ message: string;
196
+ count: number;
197
+ fingerprint: string;
198
+ tool?: string | undefined;
199
+ }, {
200
+ message: string;
201
+ count: number;
202
+ fingerprint: string;
203
+ tool?: string | undefined;
204
+ }>, "many">>;
205
+ /**
206
+ * Failures reported by the IN-PAGE half of Reticle. Half the product runs in the browser and had no
207
+ * error reporting at all — every SDK catch block swallowed silently, so a broken observer just made
208
+ * the product quieter and nobody found out.
209
+ */
210
+ sdkFailures: z.ZodOptional<z.ZodNumber>;
211
+ /** The distinct SDK failure shapes, with the module that reported each. */
212
+ sdkErrors: z.ZodOptional<z.ZodArray<z.ZodObject<{
213
+ /** Stable group key — the same defect from any machine shares it. */
214
+ fingerprint: z.ZodString;
215
+ /** How many times it happened this session. */
216
+ count: z.ZodNumber;
217
+ /** The message with every variable part stripped. The dictionary entry for the fingerprint. */
218
+ message: z.ZodString;
219
+ /** Which tool produced it — the same message from two tools is usually two different bugs. */
220
+ tool: z.ZodOptional<z.ZodString>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ message: string;
223
+ count: number;
224
+ fingerprint: string;
225
+ tool?: string | undefined;
226
+ }, {
227
+ message: string;
228
+ count: number;
229
+ fingerprint: string;
230
+ tool?: string | undefined;
231
+ }>, "many">>;
232
+ /** Verifications that produced a verdict during the session. */
233
+ verifications: z.ZodNumber;
234
+ /** Defects found in the app under test — the outcome number, not an activity number. */
235
+ bugsFound: z.ZodOptional<z.ZodNumber>;
236
+ /** Those bugs by kind, so the headline number can always be broken down rather than asserted. */
237
+ bugKinds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
238
+ /**
239
+ * Which PARAMETERS agents actually passed, per tool: `{"reticle_act": {"ref": 40, "action:click": 31}}`.
240
+ *
241
+ * Names only, with one narrow exception for parameters whose values are enums we define ourselves
242
+ * (`action:click`). Never a raw value: `reticle_act`'s `args` carries the text being typed into the
243
+ * app, which on a login form is a password. See argument-shape.ts for the allowlist.
244
+ */
245
+ toolParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
246
+ /**
247
+ * Browser/lease connections by kind, with attempts AND failures. Replaces a bare success counter
248
+ * that could not express the only interesting outcome.
249
+ */
250
+ connections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
251
+ attempts: z.ZodNumber;
252
+ successes: z.ZodNumber;
253
+ /** Failure reasons with counts — our own classified vocabulary, never a raw error string. */
254
+ failures: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
255
+ }, "strip", z.ZodTypeAny, {
256
+ attempts: number;
257
+ successes: number;
258
+ failures?: Record<string, number> | undefined;
259
+ }, {
260
+ attempts: number;
261
+ successes: number;
262
+ failures?: Record<string, number> | undefined;
263
+ }>>>;
264
+ /** Wall-clock per tool. With `toolCounts` this gives average, worst, and total time in Reticle. */
265
+ toolTiming: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
266
+ /** Total ms spent inside this tool. Divided by its count, the average; summed, the time in Reticle. */
267
+ totalMs: z.ZodNumber;
268
+ /** The single worst call. An average hides the 30-second outlier that made someone give up. */
269
+ maxMs: z.ZodNumber;
270
+ }, "strip", z.ZodTypeAny, {
271
+ totalMs: number;
272
+ maxMs: number;
273
+ }, {
274
+ totalMs: number;
275
+ maxMs: number;
276
+ }>>>;
277
+ /**
278
+ * Total ms spent inside tool calls. The headline answer to "how much time does verification cost",
279
+ * and comparable against `durationMs` to see what fraction of a session Reticle was actually busy.
280
+ */
281
+ busyMs: z.ZodOptional<z.ZodNumber>;
282
+ /**
283
+ * Time spent waiting on the BROWSER, and how many commands that was. Subtracted from `busyMs` this
284
+ * separates Reticle's own overhead from the app's — opposite fixes, previously indistinguishable.
285
+ */
286
+ browserMs: z.ZodOptional<z.ZodNumber>;
287
+ browserCommands: z.ZodOptional<z.ZodNumber>;
288
+ /** The most tool calls in flight at once — parallel agents, or one agent fanning out. */
289
+ peakConcurrentTools: z.ZodOptional<z.ZodNumber>;
290
+ /** Calls for a tool name that does not exist. A non-zero value means our surface is confusing. */
291
+ unknownToolCalls: z.ZodOptional<z.ZodNumber>;
292
+ /** The machine at shutdown — was it starved while all this was happening? */
293
+ machine: z.ZodOptional<z.ZodObject<{
294
+ /** Resident set size of the daemon itself — our footprint, the one we can actually fix. */
295
+ rssMb: z.ZodNumber;
296
+ heapUsedMb: z.ZodNumber;
297
+ /** Free and total system memory. A machine at 200 MB free explains a lot of otherwise-weird bugs. */
298
+ freeMemMb: z.ZodNumber;
299
+ totalMemMb: z.ZodNumber;
300
+ /** 1-minute load average, ×100 so it stays an integer. Zero on Windows, which does not report it. */
301
+ load1x100: z.ZodNumber;
302
+ cpuCount: z.ZodNumber;
303
+ }, "strip", z.ZodTypeAny, {
304
+ rssMb: number;
305
+ heapUsedMb: number;
306
+ freeMemMb: number;
307
+ totalMemMb: number;
308
+ load1x100: number;
309
+ cpuCount: number;
310
+ }, {
311
+ rssMb: number;
312
+ heapUsedMb: number;
313
+ freeMemMb: number;
314
+ totalMemMb: number;
315
+ load1x100: number;
316
+ cpuCount: number;
317
+ }>>;
318
+ /** Distinct MCP clients seen (`claude-code`, `cursor`), so multi-agent use is visible. */
319
+ clients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
320
+ /** Was this a clean shutdown, or a periodic flush of a still-running session? */
321
+ final: z.ZodBoolean;
322
+ }, "strip", z.ZodTypeAny, {
323
+ durationMs: number;
324
+ toolCalls: number;
325
+ toolCounts: Record<string, number>;
326
+ toolErrors: number;
327
+ verifications: number;
328
+ final: boolean;
329
+ errors?: {
330
+ message: string;
331
+ count: number;
332
+ fingerprint: string;
333
+ tool?: string | undefined;
334
+ }[] | undefined;
335
+ sdkFailures?: number | undefined;
336
+ sdkErrors?: {
337
+ message: string;
338
+ count: number;
339
+ fingerprint: string;
340
+ tool?: string | undefined;
341
+ }[] | undefined;
342
+ bugsFound?: number | undefined;
343
+ bugKinds?: Record<string, number> | undefined;
344
+ toolParams?: Record<string, Record<string, number>> | undefined;
345
+ connections?: Record<string, {
346
+ attempts: number;
347
+ successes: number;
348
+ failures?: Record<string, number> | undefined;
349
+ }> | undefined;
350
+ toolTiming?: Record<string, {
351
+ totalMs: number;
352
+ maxMs: number;
353
+ }> | undefined;
354
+ busyMs?: number | undefined;
355
+ browserMs?: number | undefined;
356
+ browserCommands?: number | undefined;
357
+ peakConcurrentTools?: number | undefined;
358
+ unknownToolCalls?: number | undefined;
359
+ machine?: {
360
+ rssMb: number;
361
+ heapUsedMb: number;
362
+ freeMemMb: number;
363
+ totalMemMb: number;
364
+ load1x100: number;
365
+ cpuCount: number;
366
+ } | undefined;
367
+ clients?: string[] | undefined;
368
+ }, {
369
+ durationMs: number;
370
+ toolCalls: number;
371
+ toolCounts: Record<string, number>;
372
+ toolErrors: number;
373
+ verifications: number;
374
+ final: boolean;
375
+ errors?: {
376
+ message: string;
377
+ count: number;
378
+ fingerprint: string;
379
+ tool?: string | undefined;
380
+ }[] | undefined;
381
+ sdkFailures?: number | undefined;
382
+ sdkErrors?: {
383
+ message: string;
384
+ count: number;
385
+ fingerprint: string;
386
+ tool?: string | undefined;
387
+ }[] | undefined;
388
+ bugsFound?: number | undefined;
389
+ bugKinds?: Record<string, number> | undefined;
390
+ toolParams?: Record<string, Record<string, number>> | undefined;
391
+ connections?: Record<string, {
392
+ attempts: number;
393
+ successes: number;
394
+ failures?: Record<string, number> | undefined;
395
+ }> | undefined;
396
+ toolTiming?: Record<string, {
397
+ totalMs: number;
398
+ maxMs: number;
399
+ }> | undefined;
400
+ busyMs?: number | undefined;
401
+ browserMs?: number | undefined;
402
+ browserCommands?: number | undefined;
403
+ peakConcurrentTools?: number | undefined;
404
+ unknownToolCalls?: number | undefined;
405
+ machine?: {
406
+ rssMb: number;
407
+ heapUsedMb: number;
408
+ freeMemMb: number;
409
+ totalMemMb: number;
410
+ load1x100: number;
411
+ cpuCount: number;
412
+ } | undefined;
413
+ clients?: string[] | undefined;
414
+ }>;
415
+ export type SessionSummary = z.infer<typeof SessionSummarySchema>;
416
+ /**
417
+ * Coarse size buckets. A bucket answers "is this a toy or a real codebase" — which is the actual
418
+ * question — while an exact file count starts to be a fingerprint, especially combined with the
419
+ * stack and the framework version.
420
+ */
421
+ export declare const ProjectSize: {
422
+ readonly TINY: "tiny";
423
+ readonly SMALL: "small";
424
+ readonly MEDIUM: "medium";
425
+ readonly LARGE: "large";
426
+ readonly HUGE: "huge";
427
+ };
428
+ export type ProjectSize = (typeof ProjectSize)[keyof typeof ProjectSize];
429
+ /**
430
+ * The shape of the project and how much of Reticle it actually uses.
431
+ *
432
+ * `featureDepth` is the one to watch: someone running 40 saved flows with visual baselines and a
433
+ * checked-in contract is a different company from someone who called `reticle_snapshot` twice. Both
434
+ * look identical in a DAU chart, and only one of them is retained.
435
+ */
436
+ export declare const ProjectProfileSchema: z.ZodObject<{
437
+ /** Framework detected from package.json (`next`, `vite`, `vue`, `astro`, …). */
438
+ stack: z.ZodOptional<z.ZodString>;
439
+ /** Its MAJOR version only — "breaks on React 19" is a work item, a full semver is a fingerprint. */
440
+ stackMajor: z.ZodOptional<z.ZodNumber>;
441
+ size: z.ZodOptional<z.ZodNativeEnum<{
442
+ readonly TINY: "tiny";
443
+ readonly SMALL: "small";
444
+ readonly MEDIUM: "medium";
445
+ readonly LARGE: "large";
446
+ readonly HUGE: "huge";
447
+ }>>;
448
+ /** True when the repo has workspaces — monorepos exercise very different code paths. */
449
+ monorepo: z.ZodOptional<z.ZodBoolean>;
450
+ /** No git / git init but unpushed / pushed to a remote. */
451
+ git: z.ZodNativeEnum<{
452
+ /** No `.git` anywhere above the project — Reticle is running in a plain directory. */
453
+ readonly NONE: "none";
454
+ /** `git init` was run, but there is no origin remote. Nobody else can be working on this copy. */
455
+ readonly LOCAL_ONLY: "local_only";
456
+ /** There is an origin remote — the project is pushed and can be shared. */
457
+ readonly REMOTE: "remote";
458
+ }>;
459
+ /** Which forge, bucketed. Absent unless `git` is `remote`. Never the hostname of a private host. */
460
+ forge: z.ZodOptional<z.ZodNativeEnum<{
461
+ readonly GITHUB: "github";
462
+ readonly GITLAB: "gitlab";
463
+ readonly BITBUCKET: "bitbucket";
464
+ readonly AZURE: "azure";
465
+ readonly SOURCEHUT: "sourcehut";
466
+ readonly CODEBERG: "codeberg";
467
+ readonly SELF_HOSTED: "self_hosted";
468
+ }>>;
469
+ /**
470
+ * How long this project has existed, in whole WEEKS, from its first commit. Answers "are people
471
+ * adopting Reticle on greenfield spikes or on mature codebases" — the single most useful thing to
472
+ * know about who this is for. Weeks, not a date: a date plus a stack narrows to a specific repo.
473
+ */
474
+ ageWeeks: z.ZodOptional<z.ZodNumber>;
475
+ /** Saved flows on disk — the deterministic-replay suite. 0 means replay was never adopted. */
476
+ flowCount: z.ZodNumber;
477
+ /** Saved text baselines. */
478
+ baselineCount: z.ZodNumber;
479
+ /** Saved pixel baselines — visual regression adoption. */
480
+ visualBaselineCount: z.ZodNumber;
481
+ /** Recorded verification-run artifacts — CI/OEM consumption. */
482
+ runCount: z.ZodNumber;
483
+ /** A git-checked `.reticle/contract.json` — the team declared a testable surface on purpose. */
484
+ hasContract: z.ZodBoolean;
485
+ /** Fail-to-pass bug capsules — the deepest feature in the product. */
486
+ capsuleCount: z.ZodNumber;
487
+ /** Which of Reticle's feature FAMILIES this project has ever touched. The activation metric. */
488
+ featuresUsed: z.ZodArray<z.ZodString, "many">;
489
+ /** 0–1: the fraction of shipped feature families in use. One number for "are they getting value". */
490
+ featureDepth: z.ZodNumber;
491
+ }, "strip", z.ZodTypeAny, {
492
+ git: "none" | "local_only" | "remote";
493
+ flowCount: number;
494
+ baselineCount: number;
495
+ visualBaselineCount: number;
496
+ runCount: number;
497
+ hasContract: boolean;
498
+ capsuleCount: number;
499
+ featuresUsed: string[];
500
+ featureDepth: number;
501
+ stack?: string | undefined;
502
+ stackMajor?: number | undefined;
503
+ size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
504
+ monorepo?: boolean | undefined;
505
+ forge?: "github" | "gitlab" | "bitbucket" | "azure" | "sourcehut" | "codeberg" | "self_hosted" | undefined;
506
+ ageWeeks?: number | undefined;
507
+ }, {
508
+ git: "none" | "local_only" | "remote";
509
+ flowCount: number;
510
+ baselineCount: number;
511
+ visualBaselineCount: number;
512
+ runCount: number;
513
+ hasContract: boolean;
514
+ capsuleCount: number;
515
+ featuresUsed: string[];
516
+ featureDepth: number;
517
+ stack?: string | undefined;
518
+ stackMajor?: number | undefined;
519
+ size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
520
+ monorepo?: boolean | undefined;
521
+ forge?: "github" | "gitlab" | "bitbucket" | "azure" | "sourcehut" | "codeberg" | "self_hosted" | undefined;
522
+ ageWeeks?: number | undefined;
523
+ }>;
524
+ export type ProjectProfile = z.infer<typeof ProjectProfileSchema>;