@reticlehq/core 2.10.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/constants.d.ts +22 -0
  2. package/dist/constants.js +23 -1
  3. package/dist/document-identity.d.ts +39 -0
  4. package/dist/document-identity.js +53 -0
  5. package/dist/edit-epoch.d.ts +36 -0
  6. package/dist/edit-epoch.js +40 -0
  7. package/dist/event-payloads.d.ts +18 -4
  8. package/dist/event-payloads.js +11 -1
  9. package/dist/findings.d.ts +62 -0
  10. package/dist/findings.js +75 -0
  11. package/dist/flow-types.d.ts +70 -0
  12. package/dist/flow-types.js +22 -0
  13. package/dist/index.d.ts +7 -0
  14. package/dist/index.js +7 -0
  15. package/dist/instrumentation-gap.d.ts +141 -0
  16. package/dist/instrumentation-gap.js +164 -0
  17. package/dist/intent.d.ts +332 -0
  18. package/dist/intent.js +133 -0
  19. package/dist/journal.d.ts +33 -0
  20. package/dist/journal.js +20 -0
  21. package/dist/messages.d.ts +84 -10
  22. package/dist/messages.js +20 -0
  23. package/dist/notices.d.ts +5 -3
  24. package/dist/notices.js +5 -3
  25. package/dist/project-registry.d.ts +86 -0
  26. package/dist/project-registry.js +66 -0
  27. package/dist/run-context.d.ts +122 -0
  28. package/dist/run-context.js +118 -0
  29. package/dist/schema/event-message.json +10 -0
  30. package/dist/schema/event-type.json +1 -0
  31. package/dist/schema/reticle-event.json +10 -0
  32. package/dist/schema/reticle-message.json +10 -0
  33. package/dist/security.js +17 -1
  34. package/dist/source-constants.cjs +9 -0
  35. package/dist/source-constants.d.cts +4 -0
  36. package/dist/telemetry-session.d.ts +2 -2
  37. package/dist/telemetry.d.ts +6 -98
  38. package/dist/telemetry.js +0 -41
  39. package/dist/types.d.ts +70 -0
  40. package/dist/types.js +14 -0
  41. package/dist/unreachable-notice.d.ts +19 -0
  42. package/dist/unreachable-notice.js +26 -0
  43. package/package.json +6 -2
@@ -0,0 +1,118 @@
1
+ /**
2
+ * What a run has established, held so the agent can ASK for it back.
3
+ *
4
+ * Verification is multi-step, and the only thing holding the thread together is the agent's own
5
+ * context window. When that compacts, or the turn ends, or a sub-agent takes over, the thread is
6
+ * gone and the work restarts. The shape of that shows in the field without needing the theory: long
7
+ * runs of the same read-only call, an agent searching by exhaustion because it no longer remembers
8
+ * what it already saw.
9
+ *
10
+ * ## Pulled, never pushed
11
+ *
12
+ * An earlier version of this rode along on every tool response. It cost +136% on a verdict and was
13
+ * cut, because the agent still had most of that context most of the time: we paid on every call to
14
+ * duplicate what it already knew. The asymmetry that makes the feature work is not that Reticle
15
+ * remembers MORE, it is that Reticle's copy does not degrade at the moment the agent's does. So the
16
+ * agent asks, at the moment it knows its own memory is gone, and pays once.
17
+ *
18
+ * That inversion is why nothing here returns `undefined` for an empty run. A push had to stay silent
19
+ * when it had nothing to say; a pull was asked a question, and "nothing established yet" is the
20
+ * answer the asker needs.
21
+ *
22
+ * ## Two rules stop it becoming the thing it prevents
23
+ *
24
+ * **It must shrink, not grow.** Superseding facts REPLACE rather than append, and both blocks are
25
+ * capped. A context object that accumulates is a token bomb, and read-only payloads are already the
26
+ * largest thing this product emits.
27
+ *
28
+ * **Memory that can be wrong is worse than no memory.** A stale established fact is precisely the
29
+ * false-green mechanism this product exists to prevent, and stale refs are already the most common
30
+ * error an agent sees from us. So every fact carries the document AND the edit epoch it was observed
31
+ * under, and is dropped the moment either moves: no grace period, no probably-fine. The comparison
32
+ * is `isSameDocument`/`isSameEditEpoch` rather than a third rule written beside them.
33
+ *
34
+ * ## What may never go in
35
+ *
36
+ * Only what Reticle OBSERVED. Never what the agent intends, plans, or believes: that is not ours to
37
+ * hold, it is unbounded, and a verification tool that remembers what an agent was thinking is
38
+ * inventing evidence. `remaining` is the one forward-looking field and it is derived mechanically
39
+ * from declared bindings, so it remains a report of a fact — which bindings are undischarged — and
40
+ * not a prediction.
41
+ */
42
+ import { isSameDocument } from './document-identity.js';
43
+ import { isSameEditEpoch } from './edit-epoch.js';
44
+ import { IntentState } from './intent.js';
45
+ /**
46
+ * How many rows either block may carry.
47
+ *
48
+ * A decision written down in one place, because the whole feature is a bet that this answer costs
49
+ * fewer tokens than the re-derivation it prevents, and a cap that drifts makes that bet
50
+ * unmeasurable. Twelve is enough to hold the refs, routes and verdicts a single verification thread
51
+ * works with, and small enough that the answer stays a briefing rather than a second payload.
52
+ *
53
+ * One number for both blocks on purpose: two caps is two things to keep in step, and nothing has
54
+ * ever suggested proofs and observations deserve different budgets.
55
+ */
56
+ export const RUN_ESTABLISHED_CAP = 12;
57
+ /** Is this evidence still describing the page and the source revision in force? */
58
+ function isCurrent(evidence, currentDocumentId, currentEditEpoch) {
59
+ return (isSameDocument(evidence.doc, currentDocumentId) &&
60
+ isSameEditEpoch(evidence.epoch, currentEditEpoch));
61
+ }
62
+ /**
63
+ * Drop what a navigation or an edit invalidated, supersede what was re-observed, keep the most
64
+ * recent within the cap.
65
+ *
66
+ * One fold with a key function rather than two, because `established` and `proven` obey the same
67
+ * three rules and a second copy is a second place for them to drift apart.
68
+ */
69
+ function foldScoped(existing, incoming, keyOf, currentDocumentId, currentEditEpoch) {
70
+ const current = (row) => isCurrent(row, currentDocumentId, currentEditEpoch);
71
+ // Supersede WITHIN the batch as well as against the prior set. `buildRunContext` folds against an
72
+ // empty prior set, so a rule that only ever applied to `existing` never applied at all there — and
73
+ // the envelope's whole contract is that `key` is the subject and re-observing it replaces rather
74
+ // than appends. A driven session showed the same ref twice and the same claim three times:
75
+ // duplicates in the one payload whose entire purpose is a cheap context restore.
76
+ //
77
+ // Last wins, because the newest reading is the true one. Insertion order is preserved from the
78
+ // LAST occurrence, so a re-observed subject moves to the recent end where the cap protects it.
79
+ const fresh = new Map();
80
+ for (const row of incoming) {
81
+ if (!current(row))
82
+ continue;
83
+ const key = keyOf(row);
84
+ fresh.delete(key);
85
+ fresh.set(key, row);
86
+ }
87
+ const superseded = new Set(fresh.keys());
88
+ const kept = existing.filter((row) => current(row) && !superseded.has(keyOf(row)));
89
+ // Oldest first, so trimming from the front drops the least recent. `slice` on the tail keeps the
90
+ // newest, which is the half a next step is most likely to need.
91
+ return [...kept, ...fresh.values()].slice(-RUN_ESTABLISHED_CAP);
92
+ }
93
+ /** Fold new observations into the established set. See `foldScoped`. */
94
+ export function foldEstablished(existing, incoming, currentDocumentId, currentEditEpoch) {
95
+ return foldScoped(existing, incoming, (f) => f.key, currentDocumentId, currentEditEpoch);
96
+ }
97
+ /** Fold new verdicts into the proven set, keyed on the claim. See `foldScoped`. */
98
+ export function foldProven(existing, incoming, currentDocumentId, currentEditEpoch) {
99
+ return foldScoped(existing, incoming, (p) => p.claim, currentDocumentId, currentEditEpoch);
100
+ }
101
+ /**
102
+ * The declared intents no verdict has discharged yet.
103
+ *
104
+ * Derived, never inferred. This reports a property of the ledger — which bindings remain unproved —
105
+ * and says nothing about what the agent means to do next.
106
+ */
107
+ export function remainingFor(intents) {
108
+ return intents.filter((i) => IntentState.PROVED !== i.state).map((i) => i.statement);
109
+ }
110
+ /** Assemble the answer. Always answers: an empty run has an empty context, and that is the truth. */
111
+ export function buildRunContext(input) {
112
+ return {
113
+ step: input.step,
114
+ established: foldEstablished([], input.established, input.currentDocumentId, input.currentEditEpoch),
115
+ proven: foldProven([], input.proven, input.currentDocumentId, input.currentEditEpoch),
116
+ remaining: remainingFor(input.intents),
117
+ };
118
+ }
@@ -41,6 +41,7 @@
41
41
  "state.change",
42
42
  "storage.change",
43
43
  "page.health",
44
+ "context.opened",
44
45
  "render.commit",
45
46
  "focus.change",
46
47
  "flow.recorded",
@@ -76,6 +77,15 @@
76
77
  "window"
77
78
  ]
78
79
  },
80
+ "documentId": {
81
+ "type": "string",
82
+ "minLength": 1,
83
+ "maxLength": 8
84
+ },
85
+ "editEpoch": {
86
+ "type": "integer",
87
+ "minimum": 0
88
+ },
79
89
  "data": {
80
90
  "type": "object",
81
91
  "additionalProperties": {},
@@ -28,6 +28,7 @@
28
28
  "state.change",
29
29
  "storage.change",
30
30
  "page.health",
31
+ "context.opened",
31
32
  "render.commit",
32
33
  "focus.change",
33
34
  "flow.recorded",
@@ -34,6 +34,7 @@
34
34
  "state.change",
35
35
  "storage.change",
36
36
  "page.health",
37
+ "context.opened",
37
38
  "render.commit",
38
39
  "focus.change",
39
40
  "flow.recorded",
@@ -69,6 +70,15 @@
69
70
  "window"
70
71
  ]
71
72
  },
73
+ "documentId": {
74
+ "type": "string",
75
+ "minLength": 1,
76
+ "maxLength": 8
77
+ },
78
+ "editEpoch": {
79
+ "type": "integer",
80
+ "minimum": 0
81
+ },
72
82
  "data": {
73
83
  "type": "object",
74
84
  "additionalProperties": {},
@@ -174,6 +174,7 @@
174
174
  "state.change",
175
175
  "storage.change",
176
176
  "page.health",
177
+ "context.opened",
177
178
  "render.commit",
178
179
  "focus.change",
179
180
  "flow.recorded",
@@ -207,6 +208,15 @@
207
208
  "window"
208
209
  ]
209
210
  },
211
+ "documentId": {
212
+ "type": "string",
213
+ "minLength": 1,
214
+ "maxLength": 8
215
+ },
216
+ "editEpoch": {
217
+ "type": "integer",
218
+ "minimum": 0
219
+ },
210
220
  "data": {
211
221
  "type": "object",
212
222
  "additionalProperties": {},
package/dist/security.js CHANGED
@@ -15,7 +15,23 @@
15
15
  * charge somebody's card — so this narrows the trigger without lowering money coverage. Both
16
16
  * directions are pinned in security.test.ts.
17
17
  */
18
- const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|logout|log out|sign out|close account|cancel subscription|purchase|buy|pay|payment|place order|confirm order|deploy|publish|send money|send funds|transfer|withdraw|refund)\b/i;
18
+ /**
19
+ * Labels that read as irreversible: something is destroyed, or money moves.
20
+ *
21
+ * `deploy` and `publish` were here and are not. The guard's contract — written at the top of
22
+ * act-danger.ts — is "a money-moving or destructive control", and a deploy is neither: nothing is
23
+ * destroyed, nothing is paid, and the thing it produces did not exist before. Consequential is a
24
+ * wider net than this list is allowed to be, or half the buttons in a dev tool sit behind a
25
+ * permission flag.
26
+ *
27
+ * Removed on measurement, not taste. Three benchmark runs against an app with a "New deploy" button
28
+ * lost their ENTIRE turn budget to the refusal. Improving its wording did not rescue the last one:
29
+ * the agent spent its remaining turns weighing a bug report about the block and looking for a
30
+ * webmcp workaround. A guard that costs a whole run on a control it was never written to catch is
31
+ * not protecting anybody — it is training agents to route around it, which is worse than not having
32
+ * it, because the routing-around generalises to the buttons that DO matter.
33
+ */
34
+ const DANGEROUS_ACTION = /\b(delete|remove|destroy|erase|drop|terminate|revoke|reset|logout|log out|sign out|close account|cancel subscription|purchase|buy|pay|payment|place order|confirm order|send money|send funds|transfer|withdraw|refund)\b/i;
19
35
  /** The hostnames that ARE loopback outright, with no parsing: the name, and IPv6 ::1 both ways. */
20
36
  const LOOPBACK_HOSTNAMES = ['localhost', '::1', '0:0:0:0:0:0:0:1'];
21
37
  /** IPv4 loopback is the whole 127.0.0.0/8 block, so the first octet is the entire test. */
@@ -0,0 +1,9 @@
1
+ // GENERATED by scripts/gen-source-constants.mjs — do not edit.
2
+ //
3
+ // The CommonJS view of source-constants, for build tooling (@reticlehq/babel-plugin) that
4
+ // cannot import the ESM build. Edit src/source-constants.ts and rebuild @reticlehq/core.
5
+ 'use strict';
6
+ exports.DATA_RETICLE_SOURCE_ATTR = "data-reticle-source";
7
+ exports.RETICLE_ROOT_GLOBAL = "__RETICLE_ROOT__";
8
+ exports.RETICLE_SDK_VERSION_GLOBAL = "__RETICLE_SDK_VERSION__";
9
+ Object.freeze(exports);
@@ -0,0 +1,4 @@
1
+ // GENERATED by scripts/gen-source-constants.mjs — do not edit.
2
+ export declare const DATA_RETICLE_SOURCE_ATTR: "data-reticle-source";
3
+ export declare const RETICLE_ROOT_GLOBAL: "__RETICLE_ROOT__";
4
+ export declare const RETICLE_SDK_VERSION_GLOBAL: "__RETICLE_SDK_VERSION__";
@@ -513,7 +513,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
513
513
  clientVersions?: Record<string, string> | undefined;
514
514
  appConnects?: number | undefined;
515
515
  msToFirstApp?: number | undefined;
516
- endReason?: "never_used" | "explored" | "abandoned" | "verified" | "client_left" | undefined;
516
+ endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
517
517
  feedbackPrompted?: number | undefined;
518
518
  errorClasses?: Record<string, number> | undefined;
519
519
  errorsRecovered?: number | undefined;
@@ -574,7 +574,7 @@ export declare const SessionSummarySchema: z.ZodObject<{
574
574
  clientVersions?: Record<string, string> | undefined;
575
575
  appConnects?: number | undefined;
576
576
  msToFirstApp?: number | undefined;
577
- endReason?: "never_used" | "explored" | "abandoned" | "verified" | "client_left" | undefined;
577
+ endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
578
578
  feedbackPrompted?: number | undefined;
579
579
  errorClasses?: Record<string, number> | undefined;
580
580
  errorsRecovered?: number | undefined;
@@ -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.
@@ -1573,7 +1508,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1573
1508
  clientVersions?: Record<string, string> | undefined;
1574
1509
  appConnects?: number | undefined;
1575
1510
  msToFirstApp?: number | undefined;
1576
- endReason?: "never_used" | "explored" | "abandoned" | "verified" | "client_left" | undefined;
1511
+ endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
1577
1512
  feedbackPrompted?: number | undefined;
1578
1513
  errorClasses?: Record<string, number> | undefined;
1579
1514
  errorsRecovered?: number | undefined;
@@ -1634,7 +1569,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1634
1569
  clientVersions?: Record<string, string> | undefined;
1635
1570
  appConnects?: number | undefined;
1636
1571
  msToFirstApp?: number | undefined;
1637
- endReason?: "never_used" | "explored" | "abandoned" | "verified" | "client_left" | undefined;
1572
+ endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
1638
1573
  feedbackPrompted?: number | undefined;
1639
1574
  errorClasses?: Record<string, number> | undefined;
1640
1575
  errorsRecovered?: number | undefined;
@@ -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;
@@ -2440,7 +2358,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2440
2358
  clientVersions?: Record<string, string> | undefined;
2441
2359
  appConnects?: number | undefined;
2442
2360
  msToFirstApp?: number | undefined;
2443
- endReason?: "never_used" | "explored" | "abandoned" | "verified" | "client_left" | undefined;
2361
+ endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
2444
2362
  feedbackPrompted?: number | undefined;
2445
2363
  errorClasses?: Record<string, number> | undefined;
2446
2364
  errorsRecovered?: number | undefined;
@@ -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;
@@ -2646,7 +2559,7 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2646
2559
  clientVersions?: Record<string, string> | undefined;
2647
2560
  appConnects?: number | undefined;
2648
2561
  msToFirstApp?: number | undefined;
2649
- endReason?: "never_used" | "explored" | "abandoned" | "verified" | "client_left" | undefined;
2562
+ endReason?: "verified" | "never_used" | "explored" | "abandoned" | "client_left" | undefined;
2650
2563
  feedbackPrompted?: number | undefined;
2651
2564
  errorClasses?: Record<string, number> | undefined;
2652
2565
  errorsRecovered?: number | undefined;
@@ -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({