@reticlehq/core 2.10.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.
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';
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
@@ -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
+ }
@@ -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.
@@ -821,35 +803,6 @@ export declare const AppInstrumentationSchema: z.ZodObject<{
821
803
  agentAttached: boolean;
822
804
  }>;
823
805
  export type AppInstrumentation = z.infer<typeof AppInstrumentationSchema>;
824
- /**
825
- * The shape of a daemon that waited and got nothing.
826
- *
827
- * Deliberately the same three facts as `AppInstrumentation` rather than a richer payload, so the
828
- * success and failure cases are directly comparable: the only difference between them should be
829
- * which event carries them. `msWaited` is the counterpart of `msToFirstApp`.
830
- *
831
- * What it does NOT carry is any attempt to say WHY, because at this point the daemon does not know.
832
- * Whether a dev server is listening is a live probe, and running one on a timer to enrich a metric
833
- * would be collecting for the metric's sake. The diagnosis belongs where a human or an agent asks
834
- * for it, not here.
835
- */
836
- export declare const InstrumentationStallSchema: z.ZodObject<{
837
- /** Whether `reticle init` had been run in this directory (a projectId is stamped). */
838
- initialized: z.ZodBoolean;
839
- /** Whether an MCP client is attached. The difference between an idle install and a broken one. */
840
- agentAttached: z.ZodBoolean;
841
- /** How long the daemon has been up with no app on the other end. */
842
- msWaited: z.ZodNumber;
843
- }, "strip", z.ZodTypeAny, {
844
- initialized: boolean;
845
- agentAttached: boolean;
846
- msWaited: number;
847
- }, {
848
- initialized: boolean;
849
- agentAttached: boolean;
850
- msWaited: number;
851
- }>;
852
- export type InstrumentationStall = z.infer<typeof InstrumentationStallSchema>;
853
806
  /**
854
807
  * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
855
808
  * different facts: `first` says the session lost its tools at all, `budget_spent` says the proxy
@@ -1201,24 +1154,6 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1201
1154
  * is a real rate rather than an inference, and a reconnecting page cannot inflate it.
1202
1155
  */
1203
1156
  readonly APP_INSTRUMENTED: "app_instrumented";
1204
- /**
1205
- * A daemon has been up long enough that no app is going to arrive on its own.
1206
- *
1207
- * The exact counterpart of `app_instrumented`, and the reason it has to exist: that event only
1208
- * fires on SUCCESS, so the far larger population — daemons that never get an app at all — is
1209
- * measurable today only by the ABSENCE of an event, and an absence cannot distinguish "nothing
1210
- * was wired" from "the process died before it could tell us" from "we never sent it".
1211
- *
1212
- * The funnel breaks here and nowhere else, so this is the one silence worth turning into a signal.
1213
- * Fired ONCE per daemon run, and never after an app has connected, so a daemon that starts slowly
1214
- * and then works reports nothing.
1215
- *
1216
- * Read it against `agentAttached`: a stalled daemon with no agent is a person who installed and
1217
- * walked away, which is not a defect. A stalled daemon WITH an agent attached is the failure this
1218
- * product currently has — the tools are there, something is asking for them, and there is no app
1219
- * on the other end.
1220
- */
1221
- readonly INSTRUMENTATION_STALLED: "instrumentation_stalled";
1222
1157
  /**
1223
1158
  * The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
1224
1159
  * completely invisible in the field.
@@ -2285,23 +2220,6 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2285
2220
  initialized: boolean;
2286
2221
  agentAttached: boolean;
2287
2222
  }>>;
2288
- /** Only on `instrumentation_stalled`: the install's second half not happening. */
2289
- stall: z.ZodOptional<z.ZodObject<{
2290
- /** Whether `reticle init` had been run in this directory (a projectId is stamped). */
2291
- initialized: z.ZodBoolean;
2292
- /** Whether an MCP client is attached. The difference between an idle install and a broken one. */
2293
- agentAttached: z.ZodBoolean;
2294
- /** How long the daemon has been up with no app on the other end. */
2295
- msWaited: z.ZodNumber;
2296
- }, "strip", z.ZodTypeAny, {
2297
- initialized: boolean;
2298
- agentAttached: boolean;
2299
- msWaited: number;
2300
- }, {
2301
- initialized: boolean;
2302
- agentAttached: boolean;
2303
- msWaited: number;
2304
- }>>;
2305
2223
  /**
2306
2224
  * Only on `reticle_installed` / `init_completed`: which published route brought this install in.
2307
2225
  *
@@ -2349,7 +2267,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2349
2267
  readonly EVAL: "eval";
2350
2268
  }>>;
2351
2269
  }, "strip", z.ZodTypeAny, {
2352
- 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";
2353
2271
  version: string;
2354
2272
  ci: boolean;
2355
2273
  v: 3;
@@ -2546,16 +2464,11 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2546
2464
  initialized: boolean;
2547
2465
  agentAttached: boolean;
2548
2466
  } | undefined;
2549
- stall?: {
2550
- initialized: boolean;
2551
- agentAttached: boolean;
2552
- msWaited: number;
2553
- } | undefined;
2554
2467
  installSource?: "unknown" | "skill_file" | "npx_skill" | "plugin" | "docs_site" | "readme" | "cli_direct" | undefined;
2555
2468
  licenseId?: string | undefined;
2556
2469
  licenseStatus?: "active" | "missing" | "invalid" | "expired" | "eval" | undefined;
2557
2470
  }, {
2558
- 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";
2559
2472
  version: string;
2560
2473
  ci: boolean;
2561
2474
  v: 3;
@@ -2752,11 +2665,6 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2752
2665
  initialized: boolean;
2753
2666
  agentAttached: boolean;
2754
2667
  } | undefined;
2755
- stall?: {
2756
- initialized: boolean;
2757
- agentAttached: boolean;
2758
- msWaited: number;
2759
- } | undefined;
2760
2668
  installSource?: "unknown" | "skill_file" | "npx_skill" | "plugin" | "docs_site" | "readme" | "cli_direct" | undefined;
2761
2669
  licenseId?: string | undefined;
2762
2670
  licenseStatus?: "active" | "missing" | "invalid" | "expired" | "eval" | undefined;
package/dist/telemetry.js CHANGED
@@ -129,24 +129,6 @@ export const TelemetryEventKind = {
129
129
  * is a real rate rather than an inference, and a reconnecting page cannot inflate it.
130
130
  */
131
131
  APP_INSTRUMENTED: 'app_instrumented',
132
- /**
133
- * A daemon has been up long enough that no app is going to arrive on its own.
134
- *
135
- * The exact counterpart of `app_instrumented`, and the reason it has to exist: that event only
136
- * fires on SUCCESS, so the far larger population — daemons that never get an app at all — is
137
- * measurable today only by the ABSENCE of an event, and an absence cannot distinguish "nothing
138
- * was wired" from "the process died before it could tell us" from "we never sent it".
139
- *
140
- * The funnel breaks here and nowhere else, so this is the one silence worth turning into a signal.
141
- * Fired ONCE per daemon run, and never after an app has connected, so a daemon that starts slowly
142
- * and then works reports nothing.
143
- *
144
- * Read it against `agentAttached`: a stalled daemon with no agent is a person who installed and
145
- * walked away, which is not a defect. A stalled daemon WITH an agent attached is the failure this
146
- * product currently has — the tools are there, something is asking for them, and there is no app
147
- * on the other end.
148
- */
149
- INSTRUMENTATION_STALLED: 'instrumentation_stalled',
150
132
  /**
151
133
  * The agent LOST its Reticle tools — the worst thing this product does to anyone, and until now
152
134
  * completely invisible in the field.
@@ -213,7 +195,6 @@ const SESSION_SCOPED = new Set([
213
195
  TelemetryEventKind.SESSION_PROGRESS,
214
196
  TelemetryEventKind.MCP_CLIENT_CONNECTED,
215
197
  TelemetryEventKind.APP_INSTRUMENTED,
216
- TelemetryEventKind.INSTRUMENTATION_STALLED,
217
198
  TelemetryEventKind.PROJECT_PROFILED,
218
199
  TelemetryEventKind.VERIFICATION_COMPLETED,
219
200
  TelemetryEventKind.BUG_FOUND,
@@ -633,26 +614,6 @@ export const AppInstrumentationSchema = z.object({
633
614
  /** How long the daemon had been up. Large values mean Reticle sat there with nothing wired. */
634
615
  msToFirstApp: z.number().int().nonnegative(),
635
616
  });
636
- /**
637
- * The shape of a daemon that waited and got nothing.
638
- *
639
- * Deliberately the same three facts as `AppInstrumentation` rather than a richer payload, so the
640
- * success and failure cases are directly comparable: the only difference between them should be
641
- * which event carries them. `msWaited` is the counterpart of `msToFirstApp`.
642
- *
643
- * What it does NOT carry is any attempt to say WHY, because at this point the daemon does not know.
644
- * Whether a dev server is listening is a live probe, and running one on a timer to enrich a metric
645
- * would be collecting for the metric's sake. The diagnosis belongs where a human or an agent asks
646
- * for it, not here.
647
- */
648
- export const InstrumentationStallSchema = z.object({
649
- /** Whether `reticle init` had been run in this directory (a projectId is stamped). */
650
- initialized: z.boolean(),
651
- /** Whether an MCP client is attached. The difference between an idle install and a broken one. */
652
- agentAttached: z.boolean(),
653
- /** How long the daemon has been up with no app on the other end. */
654
- msWaited: z.number().int().nonnegative(),
655
- });
656
617
  /**
657
618
  * WHICH stage of an MCP outage this is. Reported at most twice per proxy process, and the two are
658
619
  * different facts: `first` says the session lost its tools at all, `budget_spent` says the proxy
@@ -908,8 +869,6 @@ export const TelemetryEventSchema = z.object({
908
869
  outage: McpOutageSchema.optional(),
909
870
  /** Only on `app_instrumented`: the install's second half finally happening. */
910
871
  instrumentation: AppInstrumentationSchema.optional(),
911
- /** Only on `instrumentation_stalled`: the install's second half not happening. */
912
- stall: InstrumentationStallSchema.optional(),
913
872
  /**
914
873
  * Only on `reticle_installed` / `init_completed`: which published route brought this install in.
915
874
  *
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({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/core",
3
- "version": "2.10.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",