@reticlehq/core 2.9.0 → 2.11.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.
@@ -7,6 +7,17 @@ export declare const RETICLE_WS_PATH = "/reticle";
7
7
  /** Agent↔server MCP wire paths — served by the daemon HTTP plane, forwarded by the stdio proxy. */
8
8
  export declare const MCP_SSE_PATH = "/mcp/sse";
9
9
  export declare const MCP_MESSAGE_PATH = "/mcp/message";
10
+ /**
11
+ * The name this MCP server answers to — in its own `serverInfo` handshake, and in the registration
12
+ * an installer writes into an agent's config. Those must be the same string or the agent registers
13
+ * one server and talks to another.
14
+ *
15
+ * It lives here because it is an identity that crosses the wire, not an installer detail. It used to
16
+ * live in `init/`, which made the MCP handshake — squarely on the library path — reach into the
17
+ * install-time surface for a single string, and dragged that whole subtree along behind it for any
18
+ * consumer embedding the engine as a library.
19
+ */
20
+ export declare const MCP_SERVER_NAME = "reticle";
10
21
  /**
11
22
  * SSE event name the daemon writes to every open MCP stream immediately before it shuts itself down.
12
23
  *
package/dist/constants.js CHANGED
@@ -7,6 +7,17 @@ export const RETICLE_WS_PATH = '/reticle';
7
7
  /** Agent↔server MCP wire paths — served by the daemon HTTP plane, forwarded by the stdio proxy. */
8
8
  export const MCP_SSE_PATH = '/mcp/sse';
9
9
  export const MCP_MESSAGE_PATH = '/mcp/message';
10
+ /**
11
+ * The name this MCP server answers to — in its own `serverInfo` handshake, and in the registration
12
+ * an installer writes into an agent's config. Those must be the same string or the agent registers
13
+ * one server and talks to another.
14
+ *
15
+ * It lives here because it is an identity that crosses the wire, not an installer detail. It used to
16
+ * live in `init/`, which made the MCP handshake — squarely on the library path — reach into the
17
+ * install-time surface for a single string, and dragged that whole subtree along behind it for any
18
+ * consumer embedding the engine as a library.
19
+ */
20
+ export const MCP_SERVER_NAME = 'reticle';
10
21
  /**
11
22
  * SSE event name the daemon writes to every open MCP stream immediately before it shuts itself down.
12
23
  *
@@ -141,6 +141,42 @@ export type ContradictionKind = (typeof ContradictionKind)[keyof typeof Contradi
141
141
  export declare const ABSENCE_DERIVED_CONTRADICTIONS: ReadonlySet<ContradictionKind>;
142
142
  /** True when this kind was inferred from absence rather than positively observed. */
143
143
  export declare function isAbsenceDerived(kind: string): boolean;
144
+ /**
145
+ * How much authority a finding carries — the distinction above, said out loud on the finding itself.
146
+ *
147
+ * The rule already turns on this: an OBSERVED contradiction outranks a passing assertion and answers
148
+ * `no`, an ABSENCE_DERIVED one downgrades to `unknown`. But the findings all arrive looking alike, so
149
+ * an agent handed three of them cannot tell which one decided the verdict and which is a note about
150
+ * when Reticle stopped looking. Two facts of very different strength, reported in one voice.
151
+ */
152
+ export declare const FindingTier: {
153
+ /**
154
+ * Positively observed evidence AGAINST the action: a request came back 500 while the UI advanced, a
155
+ * signal fired carrying data the DOM disagrees with, a written field echoed a different value.
156
+ * Something happened, and it is incompatible with the action having worked.
157
+ */
158
+ readonly OBSERVED: "observed";
159
+ /**
160
+ * Inferred from something NOT having happened yet, in a window whose end Reticle chose. It may
161
+ * become true a moment later. It is a statement about our timing at least as much as about the app.
162
+ */
163
+ readonly ABSENCE_DERIVED: "absence-derived";
164
+ };
165
+ export type FindingTier = (typeof FindingTier)[keyof typeof FindingTier];
166
+ /**
167
+ * The tier of a finding, DERIVED from its kind.
168
+ *
169
+ * Deliberately a lookup rather than a field an oracle sets. An oracle that stated its own tier would
170
+ * be grading its own homework, and the one thing every author of a new rule is sure of is that their
171
+ * finding is important. The kind decides, in one place, where the verdict rule already reads it.
172
+ *
173
+ * An unrecognised kind is OBSERVED, and that default is doing real work rather than being a fallback.
174
+ * A rule registered by a consumer emits kinds deliberately absent from this vocabulary — that is what
175
+ * keeps somebody's private finding names out of the free product — and those findings still have to
176
+ * be tierable. OBSERVED is the honest answer: an unknown kind has made no claim about a window whose
177
+ * end Reticle chose, so downgrading it would invent a caveat on its author's behalf.
178
+ */
179
+ export declare function tierOfFinding(kind: string): FindingTier;
144
180
  /**
145
181
  * HTTP methods that CHANGE server state. Several contradiction rules are restricted to these on
146
182
  * purpose: a GET that fires without moving the UI is a prefetch, but a POST that does is a lost
package/dist/findings.js CHANGED
@@ -148,6 +148,43 @@ export const ABSENCE_DERIVED_CONTRADICTIONS = new Set([
148
148
  export function isAbsenceDerived(kind) {
149
149
  return ABSENCE_DERIVED_CONTRADICTIONS.has(kind);
150
150
  }
151
+ /**
152
+ * How much authority a finding carries — the distinction above, said out loud on the finding itself.
153
+ *
154
+ * The rule already turns on this: an OBSERVED contradiction outranks a passing assertion and answers
155
+ * `no`, an ABSENCE_DERIVED one downgrades to `unknown`. But the findings all arrive looking alike, so
156
+ * an agent handed three of them cannot tell which one decided the verdict and which is a note about
157
+ * when Reticle stopped looking. Two facts of very different strength, reported in one voice.
158
+ */
159
+ export const FindingTier = {
160
+ /**
161
+ * Positively observed evidence AGAINST the action: a request came back 500 while the UI advanced, a
162
+ * signal fired carrying data the DOM disagrees with, a written field echoed a different value.
163
+ * Something happened, and it is incompatible with the action having worked.
164
+ */
165
+ OBSERVED: 'observed',
166
+ /**
167
+ * Inferred from something NOT having happened yet, in a window whose end Reticle chose. It may
168
+ * become true a moment later. It is a statement about our timing at least as much as about the app.
169
+ */
170
+ ABSENCE_DERIVED: 'absence-derived',
171
+ };
172
+ /**
173
+ * The tier of a finding, DERIVED from its kind.
174
+ *
175
+ * Deliberately a lookup rather than a field an oracle sets. An oracle that stated its own tier would
176
+ * be grading its own homework, and the one thing every author of a new rule is sure of is that their
177
+ * finding is important. The kind decides, in one place, where the verdict rule already reads it.
178
+ *
179
+ * An unrecognised kind is OBSERVED, and that default is doing real work rather than being a fallback.
180
+ * A rule registered by a consumer emits kinds deliberately absent from this vocabulary — that is what
181
+ * keeps somebody's private finding names out of the free product — and those findings still have to
182
+ * be tierable. OBSERVED is the honest answer: an unknown kind has made no claim about a window whose
183
+ * end Reticle chose, so downgrading it would invent a caveat on its author's behalf.
184
+ */
185
+ export function tierOfFinding(kind) {
186
+ return isAbsenceDerived(kind) ? FindingTier.ABSENCE_DERIVED : FindingTier.OBSERVED;
187
+ }
151
188
  /**
152
189
  * HTTP methods that CHANGE server state. Several contradiction rules are restricted to these on
153
190
  * purpose: a GET that fires without moving the UI is a prefetch, but a POST that does is a lost
package/dist/index.d.ts CHANGED
@@ -28,6 +28,8 @@ export * from './notices.js';
28
28
  export * from './journal.js';
29
29
  export * from './browser-misdirect.js';
30
30
  export * from './daemon-registry.js';
31
+ export * from './project-registry.js';
32
+ export * from './instrumentation-gap.js';
31
33
  export * from './security.js';
32
34
  export * from './redaction.js';
33
35
  export * from './state-select.js';
@@ -35,6 +37,7 @@ export * from './toon.js';
35
37
  export * from './upgrade.js';
36
38
  export * from './telemetry.js';
37
39
  export * from './telemetry-session.js';
40
+ export * from './telemetry-license.js';
38
41
  export * from './telemetry-feedback.js';
39
42
  export * from './impact.js';
40
43
  export * from './impact-savings.js';
package/dist/index.js CHANGED
@@ -32,6 +32,8 @@ export * from './journal.js';
32
32
  export * from './browser-misdirect.js';
33
33
  // ── INTERNAL cross-package plumbing (shared impl; not a stable outside API — may change in a minor) ─
34
34
  export * from './daemon-registry.js'; // daemon discovery, used by the vite plugin + server
35
+ export * from './project-registry.js'; // projectId -> directory, so a cross-repo daemon can still resolve
36
+ export * from './instrumentation-gap.js'; // what Reticle could not see, and the change that would let it
35
37
  export * from './security.js'; // sanitize/serialize helpers shared by browser + server
36
38
  export * from './redaction.js'; // isSensitiveKey / scrubKnownSecrets — the shared redaction rules
37
39
  export * from './state-select.js'; // selectPath / capDepth — shared by browser SDK + server fallback
@@ -39,6 +41,7 @@ export * from './toon.js'; // TOON encoding used by the server's result encoder
39
41
  export * from './upgrade.js'; // self-update policy shared by the CLI
40
42
  export * from './telemetry.js';
41
43
  export * from './telemetry-session.js'; // the session/project rollup payloads
44
+ export * from './telemetry-license.js'; // LicenseActivation — shared by the licence gate and telemetry
42
45
  export * from './telemetry-feedback.js'; // the two things a PERSON writes: feedback + a self-declared identity // anonymous adoption telemetry wire contract (DAU/WAU/MAU/installs)
43
46
  export * from './impact.js'; // the user's own record of what Reticle has done for them (local only)
44
47
  export * from './impact-savings.js'; // the savings model - one file, so every claim is derivable there
@@ -0,0 +1,83 @@
1
+ /**
2
+ * What Reticle could not see, and the one change that would let it.
3
+ *
4
+ * Reticle answers "could I see it?" — and answers it honestly: an unobservable channel downgrades a
5
+ * verdict rather than passing it. That is a safety property and it is why a green verdict here means
6
+ * something. What it has never answered is the other half: **what would I need in order to see it?**
7
+ *
8
+ * The difference matters because of who is driving. The decision-maker is an agent, and an agent
9
+ * cannot be relied on to remember to instrument an app — nobody can. But an agent WILL act on a cost
10
+ * it is paying right now, if it is handed the file, the line, and the change. So an absence in the
11
+ * app stops being a silent weakness in the verdict and becomes a piece of work, at the moment the
12
+ * agent is trying to finish.
13
+ *
14
+ * ## The rule that keeps this from becoming noise
15
+ *
16
+ * A gap is reported ONLY when a verdict came back weaker than it would otherwise have been, BECAUSE
17
+ * of an absence in the app. Never as a survey of everything uninstrumented on the page.
18
+ *
19
+ * A gap nobody hit is a backlog, not a finding, and this product does not need another surface
20
+ * producing findings nobody reads. The test for whether a gap belongs here is: *did this absence
21
+ * change the answer the agent just got?* If not, it does not fire.
22
+ */
23
+ /** The kinds of absence that can weaken a verdict. Each names a capability the app did not provide. */
24
+ export declare const InstrumentationGapKind: {
25
+ /**
26
+ * An element was driven and carries no source mapping, so no `file:line` can be reported for it.
27
+ *
28
+ * The cheapest gap to close and the one with the widest blast radius: source mapping is what turns
29
+ * "a control did not react" into "this control, at this line, did not react".
30
+ */
31
+ readonly NO_SOURCE_MAPPING: "no-source-mapping";
32
+ /** A `state` predicate ran and the app registers no store, so the deterministic channel is absent. */
33
+ readonly NO_STORE_REGISTERED: "no-store-registered";
34
+ /**
35
+ * An action changed the DOM and no signal fired for it.
36
+ *
37
+ * The app moved and did not say so, which means the strongest evidence class Reticle has — the app
38
+ * asserting its own success — is unavailable for this action, and every verdict about it has to
39
+ * fall back to inference from the DOM.
40
+ */
41
+ readonly NO_SIGNAL_ON_MUTATION: "no-signal-on-mutation";
42
+ /** The route changed and no route signal fired, so route consequences cannot be asserted. */
43
+ readonly NO_ROUTE_SIGNAL: "no-route-signal";
44
+ /** A control was driven that the declared capability contract does not mention. */
45
+ readonly UNDECLARED_CONTROL: "undeclared-control";
46
+ };
47
+ export type InstrumentationGapKind = (typeof InstrumentationGapKind)[keyof typeof InstrumentationGapKind];
48
+ export interface InstrumentationGap {
49
+ kind: InstrumentationGapKind;
50
+ /** What could not be seen, in the agent's terms. */
51
+ missing: string;
52
+ /** Why it weakened THIS verdict — the cost being paid right now, not a general principle. */
53
+ cost: string;
54
+ /** The single change that would close it. */
55
+ fix: string;
56
+ /** `file:line` when source mapping is present. Absent is itself usually the gap. */
57
+ source?: string;
58
+ /** The control the gap is about, when it is about one. */
59
+ ref?: string;
60
+ }
61
+ /** The one-line remedy for a gap kind. */
62
+ export declare function fixForGap(kind: InstrumentationGapKind): string;
63
+ /**
64
+ * Build a gap, with its remedy attached.
65
+ *
66
+ * `missing` and `cost` are the caller's — only the emit site knows which control, which store, and
67
+ * what the verdict would otherwise have said. `fix` never is.
68
+ */
69
+ export declare function instrumentationGap(kind: InstrumentationGapKind, missing: string, cost: string, detail?: {
70
+ source?: string;
71
+ ref?: string;
72
+ }): InstrumentationGap;
73
+ /**
74
+ * Collapse gaps that say the same thing.
75
+ *
76
+ * An `act_sequence` over eight unmapped controls is ONE missing build plugin, not eight findings. A
77
+ * list that scales with the page rather than with the number of distinct things to fix is the exact
78
+ * shape that trains an agent to stop reading these.
79
+ *
80
+ * Deduped on kind plus the specific thing named, so two different unregistered stores stay two gaps
81
+ * while one store hit twice stays one.
82
+ */
83
+ export declare function dedupeGaps(gaps: readonly InstrumentationGap[]): InstrumentationGap[];
Binary file
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Which directory a projectId lives in, on this machine.
4
+ *
5
+ * Config discovery answers the same question by walking out from the daemon's own working directory,
6
+ * which is right whenever the daemon and the app share a tree. It cannot answer it at all when they
7
+ * do not — a daemon started in one repo, driving an app in a sibling checkout, will never find that
8
+ * app's `.reticle.json` however far it walks. That is not an edge case: an editor starts a
9
+ * user-scoped MCP server wherever it likes, so it is the default arrangement.
10
+ *
11
+ * `init` holds both halves at the moment it runs — the directory it is initialising and the
12
+ * projectId it has just written into that directory's `.reticle.json`. Recording the pair once makes
13
+ * every later session resolvable from anywhere on the machine.
14
+ *
15
+ * This is a CACHE, not a source of truth. `.reticle.json` on disk remains the authority; an entry
16
+ * here is a hint about where to look. So every operation fails soft: a malformed file is an empty
17
+ * registry, never a throw, because taking a daemon down over a stale cache would trade a small
18
+ * problem for a large one.
19
+ *
20
+ * The contract lives in core for the same reason the daemon registry does — it is shared by a writer
21
+ * (`init`, the CLI) and a reader (the daemon's artifact-root resolution), and a filename or a shape
22
+ * that drifts between the two is a defect neither side can see.
23
+ */
24
+ /** Sibling of `daemon-<port>.json` in `~/.reticle`. One file, all projects. */
25
+ export declare const PROJECT_REGISTRY_FILE = "projects.json";
26
+ export declare const ProjectRegistryEntrySchema: z.ZodObject<{
27
+ /** Absolute path to the directory whose `.reticle.json` declares this project. */
28
+ directory: z.ZodString;
29
+ /** When this pairing was last confirmed. Lets a future prune drop entries nobody has opened. */
30
+ lastSeenAt: z.ZodNumber;
31
+ }, "strip", z.ZodTypeAny, {
32
+ directory: string;
33
+ lastSeenAt: number;
34
+ }, {
35
+ directory: string;
36
+ lastSeenAt: number;
37
+ }>;
38
+ export type ProjectRegistryEntry = z.infer<typeof ProjectRegistryEntrySchema>;
39
+ export declare const ProjectRegistrySchema: z.ZodObject<{
40
+ version: z.ZodLiteral<1>;
41
+ projects: z.ZodRecord<z.ZodString, z.ZodObject<{
42
+ /** Absolute path to the directory whose `.reticle.json` declares this project. */
43
+ directory: z.ZodString;
44
+ /** When this pairing was last confirmed. Lets a future prune drop entries nobody has opened. */
45
+ lastSeenAt: z.ZodNumber;
46
+ }, "strip", z.ZodTypeAny, {
47
+ directory: string;
48
+ lastSeenAt: number;
49
+ }, {
50
+ directory: string;
51
+ lastSeenAt: number;
52
+ }>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ version: 1;
55
+ projects: Record<string, {
56
+ directory: string;
57
+ lastSeenAt: number;
58
+ }>;
59
+ }, {
60
+ version: 1;
61
+ projects: Record<string, {
62
+ directory: string;
63
+ lastSeenAt: number;
64
+ }>;
65
+ }>;
66
+ export type ProjectRegistry = z.infer<typeof ProjectRegistrySchema>;
67
+ /** A project the resolver may consider. Structurally identical to config discovery's `FoundConfig`
68
+ * on purpose: both sources feed one code path, so neither becomes the privileged one. */
69
+ export interface ProjectCandidate {
70
+ projectId: string;
71
+ directory: string;
72
+ }
73
+ export declare function emptyProjectRegistry(): ProjectRegistry;
74
+ /**
75
+ * Record where a project lives. Pure — returns a new registry, takes its clock as an argument.
76
+ *
77
+ * Keyed on the id, so a project that moved (renamed, re-cloned, moved to another disk) replaces its
78
+ * old path rather than leaving it behind as a competing answer. A second stale answer is exactly
79
+ * what makes the resolver refuse, so letting them accumulate would break resolution for the project
80
+ * that moved most recently — the one most likely to be in use.
81
+ */
82
+ export declare function rememberProject(registry: ProjectRegistry, projectId: string, directory: string, now: number): ProjectRegistry;
83
+ /** Every remembered project, in the shape the artifact-root resolver consumes. */
84
+ export declare function projectCandidates(registry: ProjectRegistry): ProjectCandidate[];
85
+ /** Parse a registry file's contents, failing soft to empty. Never throws. */
86
+ export declare function parseProjectRegistry(raw: unknown): ProjectRegistry;
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Which directory a projectId lives in, on this machine.
4
+ *
5
+ * Config discovery answers the same question by walking out from the daemon's own working directory,
6
+ * which is right whenever the daemon and the app share a tree. It cannot answer it at all when they
7
+ * do not — a daemon started in one repo, driving an app in a sibling checkout, will never find that
8
+ * app's `.reticle.json` however far it walks. That is not an edge case: an editor starts a
9
+ * user-scoped MCP server wherever it likes, so it is the default arrangement.
10
+ *
11
+ * `init` holds both halves at the moment it runs — the directory it is initialising and the
12
+ * projectId it has just written into that directory's `.reticle.json`. Recording the pair once makes
13
+ * every later session resolvable from anywhere on the machine.
14
+ *
15
+ * This is a CACHE, not a source of truth. `.reticle.json` on disk remains the authority; an entry
16
+ * here is a hint about where to look. So every operation fails soft: a malformed file is an empty
17
+ * registry, never a throw, because taking a daemon down over a stale cache would trade a small
18
+ * problem for a large one.
19
+ *
20
+ * The contract lives in core for the same reason the daemon registry does — it is shared by a writer
21
+ * (`init`, the CLI) and a reader (the daemon's artifact-root resolution), and a filename or a shape
22
+ * that drifts between the two is a defect neither side can see.
23
+ */
24
+ /** Sibling of `daemon-<port>.json` in `~/.reticle`. One file, all projects. */
25
+ export const PROJECT_REGISTRY_FILE = 'projects.json';
26
+ export const ProjectRegistryEntrySchema = z.object({
27
+ /** Absolute path to the directory whose `.reticle.json` declares this project. */
28
+ directory: z.string().min(1),
29
+ /** When this pairing was last confirmed. Lets a future prune drop entries nobody has opened. */
30
+ lastSeenAt: z.number(),
31
+ });
32
+ export const ProjectRegistrySchema = z.object({
33
+ version: z.literal(1),
34
+ projects: z.record(z.string(), ProjectRegistryEntrySchema),
35
+ });
36
+ export function emptyProjectRegistry() {
37
+ return { version: 1, projects: {} };
38
+ }
39
+ /**
40
+ * Record where a project lives. Pure — returns a new registry, takes its clock as an argument.
41
+ *
42
+ * Keyed on the id, so a project that moved (renamed, re-cloned, moved to another disk) replaces its
43
+ * old path rather than leaving it behind as a competing answer. A second stale answer is exactly
44
+ * what makes the resolver refuse, so letting them accumulate would break resolution for the project
45
+ * that moved most recently — the one most likely to be in use.
46
+ */
47
+ export function rememberProject(registry, projectId, directory, now) {
48
+ if (0 === projectId.length || 0 === directory.length)
49
+ return registry;
50
+ return {
51
+ version: 1,
52
+ projects: { ...registry.projects, [projectId]: { directory, lastSeenAt: now } },
53
+ };
54
+ }
55
+ /** Every remembered project, in the shape the artifact-root resolver consumes. */
56
+ export function projectCandidates(registry) {
57
+ return Object.entries(registry.projects).map(([projectId, entry]) => ({
58
+ projectId,
59
+ directory: entry.directory,
60
+ }));
61
+ }
62
+ /** Parse a registry file's contents, failing soft to empty. Never throws. */
63
+ export function parseProjectRegistry(raw) {
64
+ const parsed = ProjectRegistrySchema.safeParse(raw);
65
+ return parsed.success ? parsed.data : emptyProjectRegistry();
66
+ }
@@ -49,7 +49,19 @@ export declare const FeedbackKind: {
49
49
  * would hide the second inside the first, and the second is usually cheaper and higher-impact.
50
50
  */
51
51
  readonly IMPROVEMENT: "improvement";
52
- /** A human's overall take on using Reticle (carries `rating`). */
52
+ /**
53
+ * "This worked, and here is what it did." An overall take on using Reticle, carrying `rating`.
54
+ *
55
+ * Filed by a human at a terminal OR by an agent mid-task, and the agent case is the one that was
56
+ * missing: every other kind an agent can file is a complaint, so the corpus could only ever grow
57
+ * into a defect list. Nothing in it said which parts were worth protecting when we changed them,
58
+ * which is the question a refactor actually needs answered.
59
+ *
60
+ * A score alone is close to worthless here and the tool says so: a model asked for a number will
61
+ * produce an agreeable one, and an agreeable number is indistinguishable from an earned one once
62
+ * both are in the same column. What makes a report usable is the `text` naming the concrete
63
+ * moment, which is also the only part that can be quoted or acted on.
64
+ */
53
65
  readonly EXPERIENCE: "experience";
54
66
  };
55
67
  export type FeedbackKind = (typeof FeedbackKind)[keyof typeof FeedbackKind];
@@ -146,7 +158,19 @@ export declare const FeedbackSchema: z.ZodObject<{
146
158
  * would hide the second inside the first, and the second is usually cheaper and higher-impact.
147
159
  */
148
160
  readonly IMPROVEMENT: "improvement";
149
- /** A human's overall take on using Reticle (carries `rating`). */
161
+ /**
162
+ * "This worked, and here is what it did." An overall take on using Reticle, carrying `rating`.
163
+ *
164
+ * Filed by a human at a terminal OR by an agent mid-task, and the agent case is the one that was
165
+ * missing: every other kind an agent can file is a complaint, so the corpus could only ever grow
166
+ * into a defect list. Nothing in it said which parts were worth protecting when we changed them,
167
+ * which is the question a refactor actually needs answered.
168
+ *
169
+ * A score alone is close to worthless here and the tool says so: a model asked for a number will
170
+ * produce an agreeable one, and an agreeable number is indistinguishable from an earned one once
171
+ * both are in the same column. What makes a report usable is the `text` naming the concrete
172
+ * moment, which is also the only part that can be quoted or acted on.
173
+ */
150
174
  readonly EXPERIENCE: "experience";
151
175
  }>;
152
176
  /** The author's account. For an agent: what failed and why (its RCA). For a human: their words. */
@@ -48,7 +48,19 @@ export const FeedbackKind = {
48
48
  * would hide the second inside the first, and the second is usually cheaper and higher-impact.
49
49
  */
50
50
  IMPROVEMENT: 'improvement',
51
- /** A human's overall take on using Reticle (carries `rating`). */
51
+ /**
52
+ * "This worked, and here is what it did." An overall take on using Reticle, carrying `rating`.
53
+ *
54
+ * Filed by a human at a terminal OR by an agent mid-task, and the agent case is the one that was
55
+ * missing: every other kind an agent can file is a complaint, so the corpus could only ever grow
56
+ * into a defect list. Nothing in it said which parts were worth protecting when we changed them,
57
+ * which is the question a refactor actually needs answered.
58
+ *
59
+ * A score alone is close to worthless here and the tool says so: a model asked for a number will
60
+ * produce an agreeable one, and an agreeable number is indistinguishable from an earned one once
61
+ * both are in the same column. What makes a report usable is the `text` naming the concrete
62
+ * moment, which is also the only part that can be quoted or acted on.
63
+ */
52
64
  EXPERIENCE: 'experience',
53
65
  };
54
66
  /** Which shell the verified app runs in. Mirrors the SDK's own `PAGE_HEALTH` runtime report. */
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Enterprise activation, as the wire reports it.
3
+ *
4
+ * Its own file rather than another block in `telemetry.ts`: this vocabulary is shared by the LICENCE
5
+ * GATE (`describeLicense` types its report against it) and by the telemetry that reports the gate's
6
+ * outcome, and those are the two sides a copied enum silently drifts between. Keeping it at the bottom
7
+ * of the graph is what lets both import the same list instead of each keeping their own.
8
+ */
9
+ /**
10
+ * How enterprise activation resolved on the machine that sent an event. The closed list, defined HERE
11
+ * so the license gate and the telemetry that reports it cannot drift apart: `describeLicense` in the
12
+ * server types its report against this rather than re-listing the strings (rule 4 — a copied
13
+ * vocabulary is a correctness hazard the moment it is a number somebody reads).
14
+ *
15
+ * This is a STATUS, never an identity. It says whether a key verified, not whose key it is; the
16
+ * separate `licenseId` carries the opaque id, and the organisation NAME never goes on the wire at all.
17
+ */
18
+ export declare const LicenseActivation: {
19
+ /** A valid, unexpired, correctly-signed key covering this build. */
20
+ readonly ACTIVE: "active";
21
+ /** An issuer key is baked but no license key is set — an unlicensed install of a release build. */
22
+ readonly MISSING: "missing";
23
+ /** A key was present and rejected: malformed, wrong issuer, or a tampered payload. */
24
+ readonly INVALID: "invalid";
25
+ /**
26
+ * A key that verified but whose expiry has passed. The renewal signal: this arriving from a machine
27
+ * that used to report `active` is a lapse we can see BEFORE the customer reports it, and it is the
28
+ * whole reason status is reported separately from identity — a lapsed customer stops sending
29
+ * `licenseId`, so on identity alone a lapse and a churn look identical.
30
+ */
31
+ readonly EXPIRED: "expired";
32
+ /** No issuer key configured at all: a source build or a dev checkout, where features run free. */
33
+ readonly EVAL: "eval";
34
+ };
35
+ export type LicenseActivation = (typeof LicenseActivation)[keyof typeof LicenseActivation];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Enterprise activation, as the wire reports it.
3
+ *
4
+ * Its own file rather than another block in `telemetry.ts`: this vocabulary is shared by the LICENCE
5
+ * GATE (`describeLicense` types its report against it) and by the telemetry that reports the gate's
6
+ * outcome, and those are the two sides a copied enum silently drifts between. Keeping it at the bottom
7
+ * of the graph is what lets both import the same list instead of each keeping their own.
8
+ */
9
+ /**
10
+ * How enterprise activation resolved on the machine that sent an event. The closed list, defined HERE
11
+ * so the license gate and the telemetry that reports it cannot drift apart: `describeLicense` in the
12
+ * server types its report against this rather than re-listing the strings (rule 4 — a copied
13
+ * vocabulary is a correctness hazard the moment it is a number somebody reads).
14
+ *
15
+ * This is a STATUS, never an identity. It says whether a key verified, not whose key it is; the
16
+ * separate `licenseId` carries the opaque id, and the organisation NAME never goes on the wire at all.
17
+ */
18
+ export const LicenseActivation = {
19
+ /** A valid, unexpired, correctly-signed key covering this build. */
20
+ ACTIVE: 'active',
21
+ /** An issuer key is baked but no license key is set — an unlicensed install of a release build. */
22
+ MISSING: 'missing',
23
+ /** A key was present and rejected: malformed, wrong issuer, or a tampered payload. */
24
+ INVALID: 'invalid',
25
+ /**
26
+ * A key that verified but whose expiry has passed. The renewal signal: this arriving from a machine
27
+ * that used to report `active` is a lapse we can see BEFORE the customer reports it, and it is the
28
+ * whole reason status is reported separately from identity — a lapsed customer stops sending
29
+ * `licenseId`, so on identity alone a lapse and a churn look identical.
30
+ */
31
+ EXPIRED: 'expired',
32
+ /** No issuer key configured at all: a source build or a dev checkout, where features run free. */
33
+ EVAL: 'eval',
34
+ };
@@ -124,24 +124,6 @@ export declare const TelemetryEventKind: {
124
124
  * is a real rate rather than an inference, and a reconnecting page cannot inflate it.
125
125
  */
126
126
  readonly APP_INSTRUMENTED: "app_instrumented";
127
- /**
128
- * A daemon has been up long enough that no app is going to arrive on its own.
129
- *
130
- * The exact counterpart of `app_instrumented`, and the reason it has to exist: that event only
131
- * fires on SUCCESS, so the far larger population — daemons that never get an app at all — is
132
- * measurable today only by the ABSENCE of an event, and an absence cannot distinguish "nothing
133
- * was wired" from "the process died before it could tell us" from "we never sent it".
134
- *
135
- * The funnel breaks here and nowhere else, so this is the one silence worth turning into a signal.
136
- * Fired ONCE per daemon run, and never after an app has connected, so a daemon that starts slowly
137
- * and then works reports nothing.
138
- *
139
- * Read it against `agentAttached`: a stalled daemon with no agent is a person who installed and
140
- * walked away, which is not a defect. A stalled daemon WITH an agent attached is the failure this
141
- * product currently has — the tools are there, something is asking for them, and there is no app
142
- * on the other end.
143
- */
144
- readonly INSTRUMENTATION_STALLED: "instrumentation_stalled";
145
127
  /**
146
128
  * The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
147
129
  * completely invisible in the field.
@@ -311,6 +293,7 @@ export declare const VerificationSchema: z.ZodObject<{
311
293
  readonly ALREADY_TRUE: "already_true";
312
294
  readonly UNCLEAN_CAPTURE: "unclean_capture";
313
295
  readonly VACUOUS_GRADE: "vacuous_grade";
296
+ readonly NOTHING_DECLARED: "nothing_declared";
314
297
  readonly OUTCOME_PENDING: "outcome_pending";
315
298
  readonly OUTCOME_UNREAD: "outcome_unread";
316
299
  readonly UNSETTLED: "unsettled";
@@ -341,7 +324,7 @@ export declare const VerificationSchema: z.ZodObject<{
341
324
  passed: boolean;
342
325
  falseGreenCaught: boolean;
343
326
  durationMs?: number | undefined;
344
- reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
327
+ reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
345
328
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
346
329
  browser?: string | undefined;
347
330
  uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
@@ -351,7 +334,7 @@ export declare const VerificationSchema: z.ZodObject<{
351
334
  passed: boolean;
352
335
  falseGreenCaught: boolean;
353
336
  durationMs?: number | undefined;
354
- reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
337
+ reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
355
338
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
356
339
  browser?: string | undefined;
357
340
  uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
@@ -501,7 +484,7 @@ export declare const CrashSchema: z.ZodObject<{
501
484
  message?: string | undefined;
502
485
  errorType?: string | undefined;
503
486
  tool?: string | undefined;
504
- port?: "other" | "reticle" | undefined;
487
+ port?: "reticle" | "other" | undefined;
505
488
  fingerprint?: string | undefined;
506
489
  machine?: {
507
490
  rssMb: number;
@@ -524,7 +507,7 @@ export declare const CrashSchema: z.ZodObject<{
524
507
  message?: string | undefined;
525
508
  errorType?: string | undefined;
526
509
  tool?: string | undefined;
527
- port?: "other" | "reticle" | undefined;
510
+ port?: "reticle" | "other" | undefined;
528
511
  fingerprint?: string | undefined;
529
512
  machine?: {
530
513
  rssMb: number;
@@ -692,7 +675,7 @@ export declare const BugFoundSchema: z.ZodObject<{
692
675
  }, "strip", z.ZodTypeAny, {
693
676
  kind: string;
694
677
  source: "replay" | "contradiction" | "crawl" | "assertion";
695
- attribution: "app" | "reticle" | "request" | "unclassified";
678
+ attribution: "reticle" | "app" | "request" | "unclassified";
696
679
  falseGreen: boolean;
697
680
  repeat: boolean;
698
681
  tool?: string | undefined;
@@ -700,7 +683,7 @@ export declare const BugFoundSchema: z.ZodObject<{
700
683
  }, {
701
684
  kind: string;
702
685
  source: "replay" | "contradiction" | "crawl" | "assertion";
703
- attribution: "app" | "reticle" | "request" | "unclassified";
686
+ attribution: "reticle" | "app" | "request" | "unclassified";
704
687
  falseGreen: boolean;
705
688
  repeat: boolean;
706
689
  tool?: string | undefined;
@@ -820,35 +803,6 @@ export declare const AppInstrumentationSchema: z.ZodObject<{
820
803
  agentAttached: boolean;
821
804
  }>;
822
805
  export type AppInstrumentation = z.infer<typeof AppInstrumentationSchema>;
823
- /**
824
- * The shape of a daemon that waited and got nothing.
825
- *
826
- * Deliberately the same three facts as `AppInstrumentation` rather than a richer payload, so the
827
- * success and failure cases are directly comparable: the only difference between them should be
828
- * which event carries them. `msWaited` is the counterpart of `msToFirstApp`.
829
- *
830
- * What it does NOT carry is any attempt to say WHY, because at this point the daemon does not know.
831
- * Whether a dev server is listening is a live probe, and running one on a timer to enrich a metric
832
- * would be collecting for the metric's sake. The diagnosis belongs where a human or an agent asks
833
- * for it, not here.
834
- */
835
- export declare const InstrumentationStallSchema: z.ZodObject<{
836
- /** Whether `reticle init` had been run in this directory (a projectId is stamped). */
837
- initialized: z.ZodBoolean;
838
- /** Whether an MCP client is attached. The difference between an idle install and a broken one. */
839
- agentAttached: z.ZodBoolean;
840
- /** How long the daemon has been up with no app on the other end. */
841
- msWaited: z.ZodNumber;
842
- }, "strip", z.ZodTypeAny, {
843
- initialized: boolean;
844
- agentAttached: boolean;
845
- msWaited: number;
846
- }, {
847
- initialized: boolean;
848
- agentAttached: boolean;
849
- msWaited: number;
850
- }>;
851
- export type InstrumentationStall = z.infer<typeof InstrumentationStallSchema>;
852
806
  /**
853
807
  * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
854
808
  * different facts: `first` says the session lost its tools at all, `budget_spent` says the proxy
@@ -1200,24 +1154,6 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1200
1154
  * is a real rate rather than an inference, and a reconnecting page cannot inflate it.
1201
1155
  */
1202
1156
  readonly APP_INSTRUMENTED: "app_instrumented";
1203
- /**
1204
- * A daemon has been up long enough that no app is going to arrive on its own.
1205
- *
1206
- * The exact counterpart of `app_instrumented`, and the reason it has to exist: that event only
1207
- * fires on SUCCESS, so the far larger population — daemons that never get an app at all — is
1208
- * measurable today only by the ABSENCE of an event, and an absence cannot distinguish "nothing
1209
- * was wired" from "the process died before it could tell us" from "we never sent it".
1210
- *
1211
- * The funnel breaks here and nowhere else, so this is the one silence worth turning into a signal.
1212
- * Fired ONCE per daemon run, and never after an app has connected, so a daemon that starts slowly
1213
- * and then works reports nothing.
1214
- *
1215
- * Read it against `agentAttached`: a stalled daemon with no agent is a person who installed and
1216
- * walked away, which is not a defect. A stalled daemon WITH an agent attached is the failure this
1217
- * product currently has — the tools are there, something is asking for them, and there is no app
1218
- * on the other end.
1219
- */
1220
- readonly INSTRUMENTATION_STALLED: "instrumentation_stalled";
1221
1157
  /**
1222
1158
  * The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
1223
1159
  * completely invisible in the field.
@@ -1777,6 +1713,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1777
1713
  readonly ALREADY_TRUE: "already_true";
1778
1714
  readonly UNCLEAN_CAPTURE: "unclean_capture";
1779
1715
  readonly VACUOUS_GRADE: "vacuous_grade";
1716
+ readonly NOTHING_DECLARED: "nothing_declared";
1780
1717
  readonly OUTCOME_PENDING: "outcome_pending";
1781
1718
  readonly OUTCOME_UNREAD: "outcome_unread";
1782
1719
  readonly UNSETTLED: "unsettled";
@@ -1807,7 +1744,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1807
1744
  passed: boolean;
1808
1745
  falseGreenCaught: boolean;
1809
1746
  durationMs?: number | undefined;
1810
- reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
1747
+ reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
1811
1748
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
1812
1749
  browser?: string | undefined;
1813
1750
  uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
@@ -1817,7 +1754,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1817
1754
  passed: boolean;
1818
1755
  falseGreenCaught: boolean;
1819
1756
  durationMs?: number | undefined;
1820
- reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
1757
+ reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
1821
1758
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
1822
1759
  browser?: string | undefined;
1823
1760
  uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
@@ -1945,7 +1882,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1945
1882
  message?: string | undefined;
1946
1883
  errorType?: string | undefined;
1947
1884
  tool?: string | undefined;
1948
- port?: "other" | "reticle" | undefined;
1885
+ port?: "reticle" | "other" | undefined;
1949
1886
  fingerprint?: string | undefined;
1950
1887
  machine?: {
1951
1888
  rssMb: number;
@@ -1968,7 +1905,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1968
1905
  message?: string | undefined;
1969
1906
  errorType?: string | undefined;
1970
1907
  tool?: string | undefined;
1971
- port?: "other" | "reticle" | undefined;
1908
+ port?: "reticle" | "other" | undefined;
1972
1909
  fingerprint?: string | undefined;
1973
1910
  machine?: {
1974
1911
  rssMb: number;
@@ -2149,7 +2086,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2149
2086
  }, "strip", z.ZodTypeAny, {
2150
2087
  kind: string;
2151
2088
  source: "replay" | "contradiction" | "crawl" | "assertion";
2152
- attribution: "app" | "reticle" | "request" | "unclassified";
2089
+ attribution: "reticle" | "app" | "request" | "unclassified";
2153
2090
  falseGreen: boolean;
2154
2091
  repeat: boolean;
2155
2092
  tool?: string | undefined;
@@ -2157,7 +2094,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2157
2094
  }, {
2158
2095
  kind: string;
2159
2096
  source: "replay" | "contradiction" | "crawl" | "assertion";
2160
- attribution: "app" | "reticle" | "request" | "unclassified";
2097
+ attribution: "reticle" | "app" | "request" | "unclassified";
2161
2098
  falseGreen: boolean;
2162
2099
  repeat: boolean;
2163
2100
  tool?: string | undefined;
@@ -2283,23 +2220,6 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2283
2220
  initialized: boolean;
2284
2221
  agentAttached: boolean;
2285
2222
  }>>;
2286
- /** Only on `instrumentation_stalled`: the install's second half not happening. */
2287
- stall: z.ZodOptional<z.ZodObject<{
2288
- /** Whether `reticle init` had been run in this directory (a projectId is stamped). */
2289
- initialized: z.ZodBoolean;
2290
- /** Whether an MCP client is attached. The difference between an idle install and a broken one. */
2291
- agentAttached: z.ZodBoolean;
2292
- /** How long the daemon has been up with no app on the other end. */
2293
- msWaited: z.ZodNumber;
2294
- }, "strip", z.ZodTypeAny, {
2295
- initialized: boolean;
2296
- agentAttached: boolean;
2297
- msWaited: number;
2298
- }, {
2299
- initialized: boolean;
2300
- agentAttached: boolean;
2301
- msWaited: number;
2302
- }>>;
2303
2223
  /**
2304
2224
  * Only on `reticle_installed` / `init_completed`: which published route brought this install in.
2305
2225
  *
@@ -2322,8 +2242,32 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2322
2242
  /** No marker, or one this list does not name. The honest answer, and expected to dominate. */
2323
2243
  readonly UNKNOWN: "unknown";
2324
2244
  }>>;
2245
+ /**
2246
+ * Enterprise activation, on EVERY event. Two scalars rather than a block, for the same reason
2247
+ * `installSource` is one: they describe the install, not any single event, and they have to be
2248
+ * present on the events that show whether a licensed customer got anywhere.
2249
+ *
2250
+ * `licenseId` is the signed license id — an opaque uuid that resolves to a company only against the
2251
+ * issuance ledger we hold locally, so the analytics backend never learns a customer list. The
2252
+ * organisation NAME is deliberately absent: it is free text somebody typed at signing time, and
2253
+ * rule 3 is names-never-values.
2254
+ *
2255
+ * `licenseId` is present only when activation is `active`; `licenseStatus` rides whenever an issuer
2256
+ * key is baked, including the failure states, which is what makes a lapse distinguishable from a
2257
+ * churn. The PLAN is deliberately not here: the issuance ledger already holds it against this same
2258
+ * id, so it would be a per-event cost for something the join that resolves the id resolves anyway.
2259
+ */
2260
+ licenseId: z.ZodOptional<z.ZodString>;
2261
+ /** How activation resolved. Absent on a build with no issuer key baked, i.e. every OSS install. */
2262
+ licenseStatus: z.ZodOptional<z.ZodNativeEnum<{
2263
+ readonly ACTIVE: "active";
2264
+ readonly MISSING: "missing";
2265
+ readonly INVALID: "invalid";
2266
+ readonly EXPIRED: "expired";
2267
+ readonly EVAL: "eval";
2268
+ }>>;
2325
2269
  }, "strip", z.ZodTypeAny, {
2326
- event: "reticle_installed" | "cli_command_run" | "daemon_started" | "daemon_stopped" | "session_progress" | "verification_completed" | "project_profiled" | "version_changed" | "runtime_crashed" | "feedback_submitted" | "identified" | "mcp_client_connected" | "app_instrumented" | "instrumentation_stalled" | "mcp_connection_lost" | "init_completed" | "bug_found" | "tool_refused";
2270
+ event: "reticle_installed" | "cli_command_run" | "daemon_started" | "daemon_stopped" | "session_progress" | "verification_completed" | "project_profiled" | "version_changed" | "runtime_crashed" | "feedback_submitted" | "identified" | "mcp_client_connected" | "app_instrumented" | "mcp_connection_lost" | "init_completed" | "bug_found" | "tool_refused";
2327
2271
  version: string;
2328
2272
  ci: boolean;
2329
2273
  v: 3;
@@ -2336,7 +2280,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2336
2280
  bug?: {
2337
2281
  kind: string;
2338
2282
  source: "replay" | "contradiction" | "crawl" | "assertion";
2339
- attribution: "app" | "reticle" | "request" | "unclassified";
2283
+ attribution: "reticle" | "app" | "request" | "unclassified";
2340
2284
  falseGreen: boolean;
2341
2285
  repeat: boolean;
2342
2286
  tool?: string | undefined;
@@ -2452,7 +2396,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2452
2396
  passed: boolean;
2453
2397
  falseGreenCaught: boolean;
2454
2398
  durationMs?: number | undefined;
2455
- reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
2399
+ reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
2456
2400
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
2457
2401
  browser?: string | undefined;
2458
2402
  uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
@@ -2468,7 +2412,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2468
2412
  message?: string | undefined;
2469
2413
  errorType?: string | undefined;
2470
2414
  tool?: string | undefined;
2471
- port?: "other" | "reticle" | undefined;
2415
+ port?: "reticle" | "other" | undefined;
2472
2416
  fingerprint?: string | undefined;
2473
2417
  machine?: {
2474
2418
  rssMb: number;
@@ -2520,14 +2464,11 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2520
2464
  initialized: boolean;
2521
2465
  agentAttached: boolean;
2522
2466
  } | undefined;
2523
- stall?: {
2524
- initialized: boolean;
2525
- agentAttached: boolean;
2526
- msWaited: number;
2527
- } | undefined;
2528
2467
  installSource?: "unknown" | "skill_file" | "npx_skill" | "plugin" | "docs_site" | "readme" | "cli_direct" | undefined;
2468
+ licenseId?: string | undefined;
2469
+ licenseStatus?: "active" | "missing" | "invalid" | "expired" | "eval" | undefined;
2529
2470
  }, {
2530
- event: "reticle_installed" | "cli_command_run" | "daemon_started" | "daemon_stopped" | "session_progress" | "verification_completed" | "project_profiled" | "version_changed" | "runtime_crashed" | "feedback_submitted" | "identified" | "mcp_client_connected" | "app_instrumented" | "instrumentation_stalled" | "mcp_connection_lost" | "init_completed" | "bug_found" | "tool_refused";
2471
+ event: "reticle_installed" | "cli_command_run" | "daemon_started" | "daemon_stopped" | "session_progress" | "verification_completed" | "project_profiled" | "version_changed" | "runtime_crashed" | "feedback_submitted" | "identified" | "mcp_client_connected" | "app_instrumented" | "mcp_connection_lost" | "init_completed" | "bug_found" | "tool_refused";
2531
2472
  version: string;
2532
2473
  ci: boolean;
2533
2474
  v: 3;
@@ -2540,7 +2481,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2540
2481
  bug?: {
2541
2482
  kind: string;
2542
2483
  source: "replay" | "contradiction" | "crawl" | "assertion";
2543
- attribution: "app" | "reticle" | "request" | "unclassified";
2484
+ attribution: "reticle" | "app" | "request" | "unclassified";
2544
2485
  falseGreen: boolean;
2545
2486
  repeat: boolean;
2546
2487
  tool?: string | undefined;
@@ -2656,7 +2597,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2656
2597
  passed: boolean;
2657
2598
  falseGreenCaught: boolean;
2658
2599
  durationMs?: number | undefined;
2659
- reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
2600
+ reason?: "inconclusive" | "observation_lost" | "assertion_failed" | "contradicted" | "already_true" | "unclean_capture" | "vacuous_grade" | "nothing_declared" | "outcome_pending" | "outcome_unread" | "unsettled" | "evidence_incomplete" | "proved" | "absence_blind_spot" | undefined;
2660
2601
  brand?: "other" | "chrome" | "edge" | "arc" | "dia" | "brave" | "opera" | "firefox" | "safari" | undefined;
2661
2602
  browser?: string | undefined;
2662
2603
  uncleanLoss?: "buffer_loss" | "transport_gap" | "blind_spot" | "other" | undefined;
@@ -2672,7 +2613,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2672
2613
  message?: string | undefined;
2673
2614
  errorType?: string | undefined;
2674
2615
  tool?: string | undefined;
2675
- port?: "other" | "reticle" | undefined;
2616
+ port?: "reticle" | "other" | undefined;
2676
2617
  fingerprint?: string | undefined;
2677
2618
  machine?: {
2678
2619
  rssMb: number;
@@ -2724,11 +2665,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2724
2665
  initialized: boolean;
2725
2666
  agentAttached: boolean;
2726
2667
  } | undefined;
2727
- stall?: {
2728
- initialized: boolean;
2729
- agentAttached: boolean;
2730
- msWaited: number;
2731
- } | undefined;
2732
2668
  installSource?: "unknown" | "skill_file" | "npx_skill" | "plugin" | "docs_site" | "readme" | "cli_direct" | undefined;
2669
+ licenseId?: string | undefined;
2670
+ licenseStatus?: "active" | "missing" | "invalid" | "expired" | "eval" | undefined;
2733
2671
  }>;
2734
2672
  export type TelemetryEvent = z.infer<typeof TelemetryEventSchema>;
package/dist/telemetry.js CHANGED
@@ -20,6 +20,7 @@ import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } fr
20
20
  import { BrowserBrand, FeedbackSchema } from './telemetry-feedback.js';
21
21
  import { CaptureLoss, VerifiedReason } from './verified-constants.js';
22
22
  import { IdentitySchema } from './telemetry-feedback.js';
23
+ import { LicenseActivation } from './telemetry-license.js';
23
24
  /** Bump when the event shape changes so the analytics side can segment old senders. */
24
25
  export const TELEMETRY_EVENT_VERSION = 3;
25
26
  /**
@@ -128,24 +129,6 @@ export const TelemetryEventKind = {
128
129
  * is a real rate rather than an inference, and a reconnecting page cannot inflate it.
129
130
  */
130
131
  APP_INSTRUMENTED: 'app_instrumented',
131
- /**
132
- * A daemon has been up long enough that no app is going to arrive on its own.
133
- *
134
- * The exact counterpart of `app_instrumented`, and the reason it has to exist: that event only
135
- * fires on SUCCESS, so the far larger population — daemons that never get an app at all — is
136
- * measurable today only by the ABSENCE of an event, and an absence cannot distinguish "nothing
137
- * was wired" from "the process died before it could tell us" from "we never sent it".
138
- *
139
- * The funnel breaks here and nowhere else, so this is the one silence worth turning into a signal.
140
- * Fired ONCE per daemon run, and never after an app has connected, so a daemon that starts slowly
141
- * and then works reports nothing.
142
- *
143
- * Read it against `agentAttached`: a stalled daemon with no agent is a person who installed and
144
- * walked away, which is not a defect. A stalled daemon WITH an agent attached is the failure this
145
- * product currently has — the tools are there, something is asking for them, and there is no app
146
- * on the other end.
147
- */
148
- INSTRUMENTATION_STALLED: 'instrumentation_stalled',
149
132
  /**
150
133
  * The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
151
134
  * completely invisible in the field.
@@ -212,7 +195,6 @@ const SESSION_SCOPED = new Set([
212
195
  TelemetryEventKind.SESSION_PROGRESS,
213
196
  TelemetryEventKind.MCP_CLIENT_CONNECTED,
214
197
  TelemetryEventKind.APP_INSTRUMENTED,
215
- TelemetryEventKind.INSTRUMENTATION_STALLED,
216
198
  TelemetryEventKind.PROJECT_PROFILED,
217
199
  TelemetryEventKind.VERIFICATION_COMPLETED,
218
200
  TelemetryEventKind.BUG_FOUND,
@@ -632,26 +614,6 @@ export const AppInstrumentationSchema = z.object({
632
614
  /** How long the daemon had been up. Large values mean Reticle sat there with nothing wired. */
633
615
  msToFirstApp: z.number().int().nonnegative(),
634
616
  });
635
- /**
636
- * The shape of a daemon that waited and got nothing.
637
- *
638
- * Deliberately the same three facts as `AppInstrumentation` rather than a richer payload, so the
639
- * success and failure cases are directly comparable: the only difference between them should be
640
- * which event carries them. `msWaited` is the counterpart of `msToFirstApp`.
641
- *
642
- * What it does NOT carry is any attempt to say WHY, because at this point the daemon does not know.
643
- * Whether a dev server is listening is a live probe, and running one on a timer to enrich a metric
644
- * would be collecting for the metric's sake. The diagnosis belongs where a human or an agent asks
645
- * for it, not here.
646
- */
647
- export const InstrumentationStallSchema = z.object({
648
- /** Whether `reticle init` had been run in this directory (a projectId is stamped). */
649
- initialized: z.boolean(),
650
- /** Whether an MCP client is attached. The difference between an idle install and a broken one. */
651
- agentAttached: z.boolean(),
652
- /** How long the daemon has been up with no app on the other end. */
653
- msWaited: z.number().int().nonnegative(),
654
- });
655
617
  /**
656
618
  * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
657
619
  * different facts: `first` says the session lost its tools at all, `budget_spent` says the proxy
@@ -907,8 +869,6 @@ export const TelemetryEventSchema = z.object({
907
869
  outage: McpOutageSchema.optional(),
908
870
  /** Only on `app_instrumented`: the install's second half finally happening. */
909
871
  instrumentation: AppInstrumentationSchema.optional(),
910
- /** Only on `instrumentation_stalled`: the install's second half not happening. */
911
- stall: InstrumentationStallSchema.optional(),
912
872
  /**
913
873
  * Only on `reticle_installed` / `init_completed`: which published route brought this install in.
914
874
  *
@@ -916,4 +876,22 @@ export const TelemetryEventSchema = z.object({
916
876
  * common, and because there is exactly one fact to carry. Absent on every other kind.
917
877
  */
918
878
  installSource: z.nativeEnum(InstallSource).optional(),
879
+ /**
880
+ * Enterprise activation, on EVERY event. Two scalars rather than a block, for the same reason
881
+ * `installSource` is one: they describe the install, not any single event, and they have to be
882
+ * present on the events that show whether a licensed customer got anywhere.
883
+ *
884
+ * `licenseId` is the signed license id — an opaque uuid that resolves to a company only against the
885
+ * issuance ledger we hold locally, so the analytics backend never learns a customer list. The
886
+ * organisation NAME is deliberately absent: it is free text somebody typed at signing time, and
887
+ * rule 3 is names-never-values.
888
+ *
889
+ * `licenseId` is present only when activation is `active`; `licenseStatus` rides whenever an issuer
890
+ * key is baked, including the failure states, which is what makes a lapse distinguishable from a
891
+ * churn. The PLAN is deliberately not here: the issuance ledger already holds it against this same
892
+ * id, so it would be a per-event cost for something the join that resolves the id resolves anyway.
893
+ */
894
+ licenseId: z.string().min(1).max(64).optional(),
895
+ /** How activation resolved. Absent on a build with no issuer key baked, i.e. every OSS install. */
896
+ licenseStatus: z.nativeEnum(LicenseActivation).optional(),
919
897
  });
package/dist/types.d.ts CHANGED
@@ -630,12 +630,43 @@ export type RunRecord = z.infer<typeof RunRecordSchema>;
630
630
  export declare const ProjectLearnedSchema: z.ZodObject<{
631
631
  flows: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
632
632
  routes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
633
+ /**
634
+ * The highest observability this project has ever reached — of the controls a session drove, the
635
+ * share Reticle could fully observe.
636
+ *
637
+ * Kept so a LATER run can be told it fell. A coverage figure with no floor under it is one that
638
+ * gets gamed, and the cheapest way to stop a gap firing is to stop asserting the thing that
639
+ * revealed it — so the number and its guard ship together or neither is worth having. Same
640
+ * reasoning as the assertion-tier ledger, which records what a flow asserted the last time it
641
+ * PASSED for exactly this reason.
642
+ *
643
+ * Optional and additive: absent means "no best yet", which is the honest state of every project
644
+ * that predates this field, and is why the file version does not move.
645
+ */
646
+ bestObservability: z.ZodOptional<z.ZodObject<{
647
+ percent: z.ZodNumber;
648
+ at: z.ZodNumber;
649
+ }, "strip", z.ZodTypeAny, {
650
+ at: number;
651
+ percent: number;
652
+ }, {
653
+ at: number;
654
+ percent: number;
655
+ }>>;
633
656
  }, "strip", z.ZodTypeAny, {
634
657
  flows?: string[] | undefined;
635
658
  routes?: string[] | undefined;
659
+ bestObservability?: {
660
+ at: number;
661
+ percent: number;
662
+ } | undefined;
636
663
  }, {
637
664
  flows?: string[] | undefined;
638
665
  routes?: string[] | undefined;
666
+ bestObservability?: {
667
+ at: number;
668
+ percent: number;
669
+ } | undefined;
639
670
  }>;
640
671
  export type ProjectLearned = z.infer<typeof ProjectLearnedSchema>;
641
672
  /** The on-disk project.json envelope: versioned learned-map + chronological runs. */
@@ -644,12 +675,43 @@ export declare const ProjectFileSchema: z.ZodObject<{
644
675
  learned: z.ZodOptional<z.ZodObject<{
645
676
  flows: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
646
677
  routes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
678
+ /**
679
+ * The highest observability this project has ever reached — of the controls a session drove, the
680
+ * share Reticle could fully observe.
681
+ *
682
+ * Kept so a LATER run can be told it fell. A coverage figure with no floor under it is one that
683
+ * gets gamed, and the cheapest way to stop a gap firing is to stop asserting the thing that
684
+ * revealed it — so the number and its guard ship together or neither is worth having. Same
685
+ * reasoning as the assertion-tier ledger, which records what a flow asserted the last time it
686
+ * PASSED for exactly this reason.
687
+ *
688
+ * Optional and additive: absent means "no best yet", which is the honest state of every project
689
+ * that predates this field, and is why the file version does not move.
690
+ */
691
+ bestObservability: z.ZodOptional<z.ZodObject<{
692
+ percent: z.ZodNumber;
693
+ at: z.ZodNumber;
694
+ }, "strip", z.ZodTypeAny, {
695
+ at: number;
696
+ percent: number;
697
+ }, {
698
+ at: number;
699
+ percent: number;
700
+ }>>;
647
701
  }, "strip", z.ZodTypeAny, {
648
702
  flows?: string[] | undefined;
649
703
  routes?: string[] | undefined;
704
+ bestObservability?: {
705
+ at: number;
706
+ percent: number;
707
+ } | undefined;
650
708
  }, {
651
709
  flows?: string[] | undefined;
652
710
  routes?: string[] | undefined;
711
+ bestObservability?: {
712
+ at: number;
713
+ percent: number;
714
+ } | undefined;
653
715
  }>>;
654
716
  runs: z.ZodArray<z.ZodObject<{
655
717
  kind: z.ZodNativeEnum<{
@@ -722,6 +784,10 @@ export declare const ProjectFileSchema: z.ZodObject<{
722
784
  learned?: {
723
785
  flows?: string[] | undefined;
724
786
  routes?: string[] | undefined;
787
+ bestObservability?: {
788
+ at: number;
789
+ percent: number;
790
+ } | undefined;
725
791
  } | undefined;
726
792
  }, {
727
793
  runs: {
@@ -741,6 +807,10 @@ export declare const ProjectFileSchema: z.ZodObject<{
741
807
  learned?: {
742
808
  flows?: string[] | undefined;
743
809
  routes?: string[] | undefined;
810
+ bestObservability?: {
811
+ at: number;
812
+ percent: number;
813
+ } | undefined;
744
814
  } | undefined;
745
815
  }>;
746
816
  export type ProjectFile = z.infer<typeof ProjectFileSchema>;
package/dist/types.js CHANGED
@@ -115,6 +115,20 @@ export const RunRecordSchema = z.object({
115
115
  export const ProjectLearnedSchema = z.object({
116
116
  flows: z.array(z.string()).optional(),
117
117
  routes: z.array(z.string()).optional(),
118
+ /**
119
+ * The highest observability this project has ever reached — of the controls a session drove, the
120
+ * share Reticle could fully observe.
121
+ *
122
+ * Kept so a LATER run can be told it fell. A coverage figure with no floor under it is one that
123
+ * gets gamed, and the cheapest way to stop a gap firing is to stop asserting the thing that
124
+ * revealed it — so the number and its guard ship together or neither is worth having. Same
125
+ * reasoning as the assertion-tier ledger, which records what a flow asserted the last time it
126
+ * PASSED for exactly this reason.
127
+ *
128
+ * Optional and additive: absent means "no best yet", which is the honest state of every project
129
+ * that predates this field, and is why the file version does not move.
130
+ */
131
+ bestObservability: z.object({ percent: z.number(), at: z.number() }).optional(),
118
132
  });
119
133
  /** The on-disk project.json envelope: versioned learned-map + chronological runs. */
120
134
  export const ProjectFileSchema = z.object({
@@ -19,6 +19,20 @@ export declare const Verified: {
19
19
  readonly NO: "no";
20
20
  /** Not determinable from this evidence — vacuous grade, dirty capture, or never settled. */
21
21
  readonly UNKNOWN: "unknown";
22
+ /**
23
+ * The engine saw the whole window, ran every oracle, and found nothing wrong — but nothing was
24
+ * declared to prove, so this is not verification.
25
+ *
26
+ * Distinct from `unknown`, which used to carry both this and "I could not see". The two need
27
+ * opposite responses: this one says ASSERT SOMETHING, the other says LOOK AGAIN WITH BETTER
28
+ * COVERAGE, and collapsing them into one word sent people to fix the wrong thing.
29
+ *
30
+ * Two properties keep it honest, and both are enforced rather than documented: it requires a
31
+ * SETTLED window, so it cannot be earned by returning early, and it is never `yes`, so it cannot be
32
+ * mistaken for proof. Without the first it would be the green-forever button that an
33
+ * always-available "nothing was wrong" always becomes.
34
+ */
35
+ readonly NO_FAULT: "no-fault";
22
36
  };
23
37
  export type Verified = (typeof Verified)[keyof typeof Verified];
24
38
  /**
@@ -62,8 +76,13 @@ export declare const VerifiedReason: {
62
76
  readonly ALREADY_TRUE: "already_true";
63
77
  /** The capture was not clean, so a green would only describe what happened to be observed. */
64
78
  readonly UNCLEAN_CAPTURE: "unclean_capture";
65
- /** Nothing was asserted at a real grade — the assertion could not have failed. */
79
+ /**
80
+ * Nothing was asserted at a real grade — the assertion could not have failed — AND the window did
81
+ * not settle, so the engine cannot even say it looked at the whole thing.
82
+ */
66
83
  readonly VACUOUS_GRADE: "vacuous_grade";
84
+ /** Nothing was asserted at a real grade, but the window settled and no channel reported a problem. */
85
+ readonly NOTHING_DECLARED: "nothing_declared";
67
86
  /** A write answered 202 Accepted: the outcome does not exist yet. */
68
87
  readonly OUTCOME_PENDING: "outcome_pending";
69
88
  /** A 2xx whose body was never recorded, so the one channel that could disagree was closed. */
@@ -19,6 +19,20 @@ export const Verified = {
19
19
  NO: 'no',
20
20
  /** Not determinable from this evidence — vacuous grade, dirty capture, or never settled. */
21
21
  UNKNOWN: 'unknown',
22
+ /**
23
+ * The engine saw the whole window, ran every oracle, and found nothing wrong — but nothing was
24
+ * declared to prove, so this is not verification.
25
+ *
26
+ * Distinct from `unknown`, which used to carry both this and "I could not see". The two need
27
+ * opposite responses: this one says ASSERT SOMETHING, the other says LOOK AGAIN WITH BETTER
28
+ * COVERAGE, and collapsing them into one word sent people to fix the wrong thing.
29
+ *
30
+ * Two properties keep it honest, and both are enforced rather than documented: it requires a
31
+ * SETTLED window, so it cannot be earned by returning early, and it is never `yes`, so it cannot be
32
+ * mistaken for proof. Without the first it would be the green-forever button that an
33
+ * always-available "nothing was wrong" always becomes.
34
+ */
35
+ NO_FAULT: 'no-fault',
22
36
  };
23
37
  /**
24
38
  * WHY a verdict came out the way it did — the deciding clause of the rule, named.
@@ -61,8 +75,13 @@ export const VerifiedReason = {
61
75
  ALREADY_TRUE: 'already_true',
62
76
  /** The capture was not clean, so a green would only describe what happened to be observed. */
63
77
  UNCLEAN_CAPTURE: 'unclean_capture',
64
- /** Nothing was asserted at a real grade — the assertion could not have failed. */
78
+ /**
79
+ * Nothing was asserted at a real grade — the assertion could not have failed — AND the window did
80
+ * not settle, so the engine cannot even say it looked at the whole thing.
81
+ */
65
82
  VACUOUS_GRADE: 'vacuous_grade',
83
+ /** Nothing was asserted at a real grade, but the window settled and no channel reported a problem. */
84
+ NOTHING_DECLARED: 'nothing_declared',
66
85
  /** A write answered 202 Accepted: the outcome does not exist yet. */
67
86
  OUTCOME_PENDING: 'outcome_pending',
68
87
  /** A 2xx whose body was never recorded, so the one channel that could disagree was closed. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "description": "The Reticle foundation: the shared wire contract — types, zod schemas, constants, messages, and the isomorphic kernel that every Reticle package (browser SDK, server, kits, test harness) imports. Depends only on zod.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",