@reticlehq/core 2.7.0 → 2.9.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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Names that exist ONLY to say where the browser API actually lives.
3
+ *
4
+ * `@reticlehq/core` is the wire contract — zod schemas and constants, no DOM anywhere in it — but it
5
+ * is the package whose name reads like "the thing you install", so agents and hand-written snippets
6
+ * keep reaching for `import { install, reticle } from '@reticlehq/core'`. Reported from the field:
7
+ * that import took a Vite app down with a blank page and `SyntaxError: The requested module does not
8
+ * provide an export named 'install'`, which names neither the mistake nor the fix.
9
+ *
10
+ * Renaming the package would be worse than the problem. Exporting the names, so the module still
11
+ * loads and the first call says where to go, costs three lines and turns a dead end into a sentence.
12
+ */
13
+ declare function browserApiIsElsewhere(): never;
14
+ /** Not the SDK. Throws with the package that has it — see the note above. */
15
+ export declare const install: typeof browserApiIsElsewhere;
16
+ /** Not the SDK. Throws with the package that has it — see the note above. */
17
+ export declare const connect: typeof browserApiIsElsewhere;
18
+ /** Not the SDK instance (that is `@reticlehq/browser`'s). Every call says so. */
19
+ export declare const reticle: {
20
+ readonly connect: typeof browserApiIsElsewhere;
21
+ readonly install: typeof browserApiIsElsewhere;
22
+ };
23
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Names that exist ONLY to say where the browser API actually lives.
3
+ *
4
+ * `@reticlehq/core` is the wire contract — zod schemas and constants, no DOM anywhere in it — but it
5
+ * is the package whose name reads like "the thing you install", so agents and hand-written snippets
6
+ * keep reaching for `import { install, reticle } from '@reticlehq/core'`. Reported from the field:
7
+ * that import took a Vite app down with a blank page and `SyntaxError: The requested module does not
8
+ * provide an export named 'install'`, which names neither the mistake nor the fix.
9
+ *
10
+ * Renaming the package would be worse than the problem. Exporting the names, so the module still
11
+ * loads and the first call says where to go, costs three lines and turns a dead end into a sentence.
12
+ */
13
+ const WRONG_PACKAGE = '@reticlehq/core is the wire contract (schemas + constants) and has no browser API. The SDK that ' +
14
+ 'connects a page lives in @reticlehq/browser (or @reticlehq/react, which re-exports it), and it ' +
15
+ 'is normally wired for you by @reticlehq/vite-plugin or @reticlehq/next — run `npx ' +
16
+ '@reticlehq/server init` and let it do the wiring.';
17
+ function browserApiIsElsewhere() {
18
+ throw new Error(WRONG_PACKAGE);
19
+ }
20
+ /** Not the SDK. Throws with the package that has it — see the note above. */
21
+ export const install = browserApiIsElsewhere;
22
+ /** Not the SDK. Throws with the package that has it — see the note above. */
23
+ export const connect = browserApiIsElsewhere;
24
+ /** Not the SDK instance (that is `@reticlehq/browser`'s). Every call says so. */
25
+ export const reticle = {
26
+ connect: browserApiIsElsewhere,
27
+ install: browserApiIsElsewhere,
28
+ };
@@ -7,8 +7,24 @@ 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
+ * SSE event name the daemon writes to every open MCP stream immediately before it shuts itself down.
12
+ *
13
+ * A stream that simply ends looks identical from the proxy whether the daemon retired on schedule or
14
+ * died under it, so every planned shutdown was counted as an outage the agent suffered. The proxy
15
+ * cannot infer the difference — the daemon is the only thing that knows, and this is it saying so.
16
+ * A custom event name rather than a `message`: the proxy forwards `message` frames to the client
17
+ * verbatim, and this is addressed to the proxy, not to the agent.
18
+ */
19
+ export declare const MCP_SHUTDOWN_EVENT = "reticle-shutdown";
10
20
  /** Local-only daemon introspection — `reticle status` GETs this for sessions + health at a glance. */
11
21
  export declare const STATUS_PATH = "/status";
22
+ /**
23
+ * Local-only drive request — `reticle drive <url>` POSTs `{url}` here when a daemon already owns the
24
+ * bridge port, and gets back the pooled session that daemon opened. The CLI asks instead of binding,
25
+ * so the two never fight over the port. Same trust tier as STATUS_PATH.
26
+ */
27
+ export declare const DRIVE_PATH = "/drive";
12
28
  export declare const RETICLE_PROTOCOL_VERSION = 1;
13
29
  /**
14
30
  * The one place the bridge WebSocket URL is built. The SDK connect default, the vite/next snippet
@@ -105,7 +121,30 @@ export declare const ReticleEnv: {
105
121
  /** Hard transport bounds shared by the browser and bridge. */
106
122
  export declare const TRANSPORT_LIMITS: {
107
123
  readonly MAX_MESSAGE_BYTES: number;
108
- readonly MAX_MESSAGES_PER_SECOND: 1000;
124
+ /**
125
+ * Inbound events per second before the bridge SAMPLES rather than records everything.
126
+ *
127
+ * This was 1000, and an ordinary React app with an active query cache blew through it: the
128
+ * reporter's FIRST `act_and_wait` of the session came back `unknown` with `unclean_capture` and a
129
+ * four-figure drop count, and setting the env override to twenty times the default fixed it (#316).
130
+ * Reticle was right to refuse the verdict — a sampled window cannot support one, and the guard that
131
+ * catches false greens is blindest exactly there — but landing that on the first drive after an
132
+ * install, recoverable only by knowing an environment variable exists and inventing a number for
133
+ * it, is the worst possible place to spend the honesty.
134
+ *
135
+ * 20000 is the value that was measured to work on the page that reported it. The cap exists to stop
136
+ * a PATHOLOGICAL page (an animation loop firing DOM mutations every frame), not to throttle a busy
137
+ * one, and the ceiling it has to defend is cheap: the daemon is on the same machine and a typical
138
+ * event is a few hundred bytes, so this is single-digit MB/s over loopback.
139
+ *
140
+ * Raising it does not raise what a runaway page can make the bridge HOLD, and that separation is
141
+ * what makes the change safe. Memory is bounded independently by the ring buffer, which evicts on
142
+ * `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant, reached through that alias) as well as on
143
+ * a count and an age. Grep for `MAX_BUFFER_BYTES` alone and it looks like a constant nobody reads,
144
+ * which is exactly the wrong conclusion to draw before touching this number: the rate cap defends
145
+ * parse cost, the ring buffer defends memory, and they are not substitutes.
146
+ */
147
+ readonly MAX_MESSAGES_PER_SECOND: 20000;
109
148
  readonly MAX_SESSIONS: 32;
110
149
  readonly MAX_PENDING_CONNECTIONS: 16;
111
150
  readonly HELLO_TIMEOUT_MS: 5000;
@@ -153,6 +192,13 @@ export declare const ReticleDir: {
153
192
  readonly BASELINES_SUBDIR: "baselines";
154
193
  /** cross-run memory — outcomes of past runs (the "did it behave like last time?" file). */
155
194
  readonly PROJECT_FILE: "project.json";
195
+ /**
196
+ * the user's own record of what Reticle has done for them — .reticle/impact.json.
197
+ *
198
+ * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers our
199
+ * questions about the product; this answers the user's question about their own work.
200
+ */
201
+ readonly IMPACT_FILE: "impact.json";
156
202
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
157
203
  readonly VISUAL_SUBDIR: "visual";
158
204
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -191,6 +237,7 @@ export declare const VisualReason: {
191
237
  readonly BASELINE_MISSING: "baseline-missing";
192
238
  readonly DIMENSION_MISMATCH: "dimension-mismatch";
193
239
  readonly FULL_PAGE_UNSUPPORTED: "full-page-unsupported";
240
+ readonly NOT_COMPOSITED: "window-not-composited";
194
241
  };
195
242
  export type VisualReason = (typeof VisualReason)[keyof typeof VisualReason];
196
243
  /** Actionable companion to NO_PROVIDER — the visual layer needs a driven browser. */
@@ -515,6 +562,14 @@ export declare const ElementState: {
515
562
  readonly EXPANDED: "expanded";
516
563
  readonly FOCUSED: "focused";
517
564
  readonly PRESENT: "present";
565
+ /**
566
+ * Inside the viewport right now (getBoundingClientRect intersects the window). Distinct from
567
+ * `visible`, which folds only aria-hidden/[hidden]/display/visibility/opacity and so is already
568
+ * true for content below the fold of a scrolling container. Without this, `scrollIntoView` is
569
+ * ungradeable: the target satisfied `visible`/`present` before the scroll, so act_and_wait
570
+ * returns already_true. (#398)
571
+ */
572
+ readonly IN_VIEWPORT: "inViewport";
518
573
  };
519
574
  export type ElementState = (typeof ElementState)[keyof typeof ElementState];
520
575
  /** Query strategies, aligned with Testing Library semantics (plan/04). */
@@ -554,6 +609,12 @@ export declare const ReticleCommand: {
554
609
  * AGENT-driven pause/end keeps the presenter in sync. `args: { state, text? }`.
555
610
  */
556
611
  readonly PRESENTER: "presenter";
612
+ /**
613
+ * Bridge -> browser: the user's own impact record, so the HUD can show what Reticle has done for
614
+ * them without the page asking for it. `args: { snapshot: ImpactSnapshot }`. Local data on a
615
+ * local socket - it is the same file the report is stored in, not a fetch to us.
616
+ */
617
+ readonly IMPACT: "impact";
557
618
  /**
558
619
  * Ask the DESKTOP shell to photograph its own window and return `{ png: <base64> }`.
559
620
  *
package/dist/constants.js CHANGED
@@ -7,8 +7,24 @@ 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
+ * SSE event name the daemon writes to every open MCP stream immediately before it shuts itself down.
12
+ *
13
+ * A stream that simply ends looks identical from the proxy whether the daemon retired on schedule or
14
+ * died under it, so every planned shutdown was counted as an outage the agent suffered. The proxy
15
+ * cannot infer the difference — the daemon is the only thing that knows, and this is it saying so.
16
+ * A custom event name rather than a `message`: the proxy forwards `message` frames to the client
17
+ * verbatim, and this is addressed to the proxy, not to the agent.
18
+ */
19
+ export const MCP_SHUTDOWN_EVENT = 'reticle-shutdown';
10
20
  /** Local-only daemon introspection — `reticle status` GETs this for sessions + health at a glance. */
11
21
  export const STATUS_PATH = '/status';
22
+ /**
23
+ * Local-only drive request — `reticle drive <url>` POSTs `{url}` here when a daemon already owns the
24
+ * bridge port, and gets back the pooled session that daemon opened. The CLI asks instead of binding,
25
+ * so the two never fight over the port. Same trust tier as STATUS_PATH.
26
+ */
27
+ export const DRIVE_PATH = '/drive';
12
28
  export const RETICLE_PROTOCOL_VERSION = 1;
13
29
  /**
14
30
  * The one place the bridge WebSocket URL is built. The SDK connect default, the vite/next snippet
@@ -107,7 +123,30 @@ export const ReticleEnv = {
107
123
  /** Hard transport bounds shared by the browser and bridge. */
108
124
  export const TRANSPORT_LIMITS = {
109
125
  MAX_MESSAGE_BYTES: 1024 * 1024,
110
- MAX_MESSAGES_PER_SECOND: 1000,
126
+ /**
127
+ * Inbound events per second before the bridge SAMPLES rather than records everything.
128
+ *
129
+ * This was 1000, and an ordinary React app with an active query cache blew through it: the
130
+ * reporter's FIRST `act_and_wait` of the session came back `unknown` with `unclean_capture` and a
131
+ * four-figure drop count, and setting the env override to twenty times the default fixed it (#316).
132
+ * Reticle was right to refuse the verdict — a sampled window cannot support one, and the guard that
133
+ * catches false greens is blindest exactly there — but landing that on the first drive after an
134
+ * install, recoverable only by knowing an environment variable exists and inventing a number for
135
+ * it, is the worst possible place to spend the honesty.
136
+ *
137
+ * 20000 is the value that was measured to work on the page that reported it. The cap exists to stop
138
+ * a PATHOLOGICAL page (an animation loop firing DOM mutations every frame), not to throttle a busy
139
+ * one, and the ceiling it has to defend is cheap: the daemon is on the same machine and a typical
140
+ * event is a few hundred bytes, so this is single-digit MB/s over loopback.
141
+ *
142
+ * Raising it does not raise what a runaway page can make the bridge HOLD, and that separation is
143
+ * what makes the change safe. Memory is bounded independently by the ring buffer, which evicts on
144
+ * `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant, reached through that alias) as well as on
145
+ * a count and an age. Grep for `MAX_BUFFER_BYTES` alone and it looks like a constant nobody reads,
146
+ * which is exactly the wrong conclusion to draw before touching this number: the rate cap defends
147
+ * parse cost, the ring buffer defends memory, and they are not substitutes.
148
+ */
149
+ MAX_MESSAGES_PER_SECOND: 20000,
111
150
  MAX_SESSIONS: 32,
112
151
  MAX_PENDING_CONNECTIONS: 16,
113
152
  HELLO_TIMEOUT_MS: 5000,
@@ -155,6 +194,13 @@ export const ReticleDir = {
155
194
  BASELINES_SUBDIR: 'baselines',
156
195
  /** cross-run memory — outcomes of past runs (the "did it behave like last time?" file). */
157
196
  PROJECT_FILE: 'project.json',
197
+ /**
198
+ * the user's own record of what Reticle has done for them — .reticle/impact.json.
199
+ *
200
+ * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers our
201
+ * questions about the product; this answers the user's question about their own work.
202
+ */
203
+ IMPACT_FILE: 'impact.json',
158
204
  /** opt-in pixel baselines —.reticle/visual/<name>.png + <name>.diff.png. */
159
205
  VISUAL_SUBDIR: 'visual',
160
206
  /** verification-run artifacts —.reticle/runs/<runId>.json (the OEM/CI-consumable verdict). */
@@ -196,6 +242,12 @@ export const VisualReason = {
196
242
  // quietly downgraded: a caller who asked for the whole scroll height and silently got the visible
197
243
  // part would bank a baseline that says nothing about the content below the fold.
198
244
  FULL_PAGE_UNSUPPORTED: 'full-page-unsupported',
245
+ // The shell answered, and the window had no composited frame to photograph yet. Distinct from
246
+ // CAPTURE_FAILED on purpose: the capture ran and the window was empty, which is a timing fact
247
+ // about the window rather than a failure of the capture path. Electron's `capturePage()` returns
248
+ // an empty image rather than an error in that state, so without a name of its own it arrived as
249
+ // an unexplained no-image and read identically to a dead window and to a thrown error.
250
+ NOT_COMPOSITED: 'window-not-composited',
199
251
  };
200
252
  /** Actionable companion to NO_PROVIDER — the visual layer needs a driven browser. */
201
253
  export const VISUAL_NO_PROVIDER_RECOMMENDATION = 'visual capture needs a driven browser — start with `reticle drive <url>` or set RETICLE_CDP_URL; the always-on SDK does not ship a screenshotter';
@@ -492,6 +544,14 @@ export const ElementState = {
492
544
  EXPANDED: 'expanded',
493
545
  FOCUSED: 'focused',
494
546
  PRESENT: 'present',
547
+ /**
548
+ * Inside the viewport right now (getBoundingClientRect intersects the window). Distinct from
549
+ * `visible`, which folds only aria-hidden/[hidden]/display/visibility/opacity and so is already
550
+ * true for content below the fold of a scrolling container. Without this, `scrollIntoView` is
551
+ * ungradeable: the target satisfied `visible`/`present` before the scroll, so act_and_wait
552
+ * returns already_true. (#398)
553
+ */
554
+ IN_VIEWPORT: 'inViewport',
495
555
  };
496
556
  /** Query strategies, aligned with Testing Library semantics (plan/04). */
497
557
  export const QueryBy = {
@@ -529,6 +589,12 @@ export const ReticleCommand = {
529
589
  * AGENT-driven pause/end keeps the presenter in sync. `args: { state, text? }`.
530
590
  */
531
591
  PRESENTER: 'presenter',
592
+ /**
593
+ * Bridge -> browser: the user's own impact record, so the HUD can show what Reticle has done for
594
+ * them without the page asking for it. `args: { snapshot: ImpactSnapshot }`. Local data on a
595
+ * local socket - it is the same file the report is stored in, not a fetch to us.
596
+ */
597
+ IMPACT: 'impact',
532
598
  /**
533
599
  * Ask the DESKTOP shell to photograph its own window and return `{ png: <base64> }`.
534
600
  *
@@ -15,6 +15,13 @@
15
15
  * Derived on purpose. A hand-maintained contract number is one somebody eventually forgets to bump,
16
16
  * and a forgotten bump is silent skew — the failure this exists to end.
17
17
  */
18
+ /**
19
+ * FNV-1a, 32-bit. Chosen over a crypto hash because this runs in the PAGE: `crypto.subtle` is async
20
+ * and unavailable on insecure origins, and a dependency is not worth 40 lines. Collisions do not
21
+ * matter here — the comparison is equality between two builds of the same project, not a security
22
+ * boundary.
23
+ */
24
+ export declare function fnv1a(input: string): string;
18
25
  /**
19
26
  * Hash a named vocabulary. Keys and values are sorted, so declaration order — which changes for
20
27
  * cosmetic reasons — never moves the fingerprint, while a renamed, added or removed name always does.
@@ -22,7 +22,7 @@ import { ActionType, EventType, MessageKind, ReticleCommand } from './constants.
22
22
  * matter here — the comparison is equality between two builds of the same project, not a security
23
23
  * boundary.
24
24
  */
25
- function fnv1a(input) {
25
+ export function fnv1a(input) {
26
26
  let hash = 0x811c9dc5;
27
27
  for (let i = 0; i < input.length; i++) {
28
28
  hash ^= input.charCodeAt(i);
@@ -8,4 +8,5 @@ exports.RETICLE_CAPTURE_CHANNEL = "__reticle:capture";
8
8
  exports.RETICLE_CAPTURE_FILE_PREFIX = "reticle-capture-";
9
9
  exports.RETICLE_TAURI_CAPTURE_COMMAND = "reticle_capture";
10
10
  exports.RETICLE_FULL_PAGE_UNSUPPORTED = "full-page-unsupported";
11
+ exports.RETICLE_NOT_COMPOSITED = "window-not-composited";
11
12
  Object.freeze(exports);
@@ -4,3 +4,4 @@ export declare const RETICLE_CAPTURE_CHANNEL: "__reticle:capture";
4
4
  export declare const RETICLE_CAPTURE_FILE_PREFIX: "reticle-capture-";
5
5
  export declare const RETICLE_TAURI_CAPTURE_COMMAND: "reticle_capture";
6
6
  export declare const RETICLE_FULL_PAGE_UNSUPPORTED: "full-page-unsupported";
7
+ export declare const RETICLE_NOT_COMPOSITED: "window-not-composited";
@@ -43,6 +43,15 @@ export declare const RETICLE_TAURI_CAPTURE_COMMAND = "reticle_capture";
43
43
  * preload (CommonJS) and the daemon must agree on it without sharing a module graph.
44
44
  */
45
45
  export declare const RETICLE_FULL_PAGE_UNSUPPORTED: string;
46
+ /**
47
+ * What a shell answers when the window had no composited frame to photograph.
48
+ *
49
+ * Electron's `capturePage()` returns an EMPTY image in that state rather than an error, and the
50
+ * handler used to turn that into the same bare null it returned for a dead window and for any thrown
51
+ * error. Three different problems, one silence: the tool reported no bytes and no reason, which cost
52
+ * a CI investigation and gives a user hitting it nothing to act on.
53
+ */
54
+ export declare const RETICLE_NOT_COMPOSITED: string;
46
55
  /**
47
56
  * Every value the generated CommonJS shim must expose, as `name → value`.
48
57
  *
@@ -55,4 +64,5 @@ export declare const DESKTOP_CONTRACT: {
55
64
  readonly RETICLE_CAPTURE_FILE_PREFIX: "reticle-capture-";
56
65
  readonly RETICLE_TAURI_CAPTURE_COMMAND: "reticle_capture";
57
66
  readonly RETICLE_FULL_PAGE_UNSUPPORTED: string;
67
+ readonly RETICLE_NOT_COMPOSITED: string;
58
68
  };
@@ -44,6 +44,15 @@ export const RETICLE_TAURI_CAPTURE_COMMAND = 'reticle_capture';
44
44
  * preload (CommonJS) and the daemon must agree on it without sharing a module graph.
45
45
  */
46
46
  export const RETICLE_FULL_PAGE_UNSUPPORTED = VisualReason.FULL_PAGE_UNSUPPORTED;
47
+ /**
48
+ * What a shell answers when the window had no composited frame to photograph.
49
+ *
50
+ * Electron's `capturePage()` returns an EMPTY image in that state rather than an error, and the
51
+ * handler used to turn that into the same bare null it returned for a dead window and for any thrown
52
+ * error. Three different problems, one silence: the tool reported no bytes and no reason, which cost
53
+ * a CI investigation and gives a user hitting it nothing to act on.
54
+ */
55
+ export const RETICLE_NOT_COMPOSITED = VisualReason.NOT_COMPOSITED;
47
56
  /**
48
57
  * Every value the generated CommonJS shim must expose, as `name → value`.
49
58
  *
@@ -56,4 +65,5 @@ export const DESKTOP_CONTRACT = {
56
65
  RETICLE_CAPTURE_FILE_PREFIX,
57
66
  RETICLE_TAURI_CAPTURE_COMMAND,
58
67
  RETICLE_FULL_PAGE_UNSUPPORTED,
68
+ RETICLE_NOT_COMPOSITED,
59
69
  };
@@ -501,13 +501,14 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
501
501
  readonly WRAPPED_NETWORK: "wrapped-network";
502
502
  readonly UNOBSERVED_IPC: "unobserved-ipc";
503
503
  readonly VERDICTLESS_SEND: "verdictless-send";
504
+ readonly UNWATCHED_STATE: "unwatched-state";
504
505
  }>;
505
506
  count: z.ZodNumber;
506
507
  }, "strip", z.ZodTypeAny, {
507
- kind: "closed-shadow-root" | "rate-limited" | "cross-origin-iframe" | "uninstrumented-frame" | "virtualized-unmounted" | "wrapped-network" | "unobserved-ipc" | "verdictless-send";
508
+ kind: "closed-shadow-root" | "rate-limited" | "cross-origin-iframe" | "uninstrumented-frame" | "virtualized-unmounted" | "wrapped-network" | "unobserved-ipc" | "verdictless-send" | "unwatched-state";
508
509
  count: number;
509
510
  }, {
510
- kind: "closed-shadow-root" | "rate-limited" | "cross-origin-iframe" | "uninstrumented-frame" | "virtualized-unmounted" | "wrapped-network" | "unobserved-ipc" | "verdictless-send";
511
+ kind: "closed-shadow-root" | "rate-limited" | "cross-origin-iframe" | "uninstrumented-frame" | "virtualized-unmounted" | "wrapped-network" | "unobserved-ipc" | "verdictless-send" | "unwatched-state";
511
512
  count: number;
512
513
  }>;
513
514
  "sdk.failed": z.ZodObject<{
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A stable, privacy-safe fingerprint for a finding — so the same defect can be recognised across
3
+ * sessions without sending any app-specific data over the wire.
4
+ *
5
+ * The hash travels in `bug_found`; the inputs (route, selector) never do. Same pattern as
6
+ * `projectId`: hash the identifying bits, send only the hash, let the analytics side group by it.
7
+ */
8
+ export interface FindingIdentity {
9
+ /** The classified kind from Reticle's findings vocabulary (`signal-contradicted`, `console-error`, …). */
10
+ kind: string;
11
+ /** How Reticle found it (`contradiction`, `crawl`, `assertion`, `replay`). */
12
+ source: string;
13
+ /** The route the app was on when this was found. Hashed, never sent raw. */
14
+ route?: string;
15
+ }
16
+ /**
17
+ * Produce a short hex fingerprint that identifies a finding stably across sessions.
18
+ *
19
+ * Same inputs = same output, regardless of when or where it runs. A changed route or a changed
20
+ * kind = a different fingerprint = a different defect. The analytics side can then answer "was this
21
+ * fixed?" by checking whether a fingerprint stops appearing.
22
+ */
23
+ export declare function fingerprintFinding(identity: FindingIdentity): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A stable, privacy-safe fingerprint for a finding — so the same defect can be recognised across
3
+ * sessions without sending any app-specific data over the wire.
4
+ *
5
+ * The hash travels in `bug_found`; the inputs (route, selector) never do. Same pattern as
6
+ * `projectId`: hash the identifying bits, send only the hash, let the analytics side group by it.
7
+ */
8
+ import { fnv1a } from './contract-fingerprint.js';
9
+ /**
10
+ * Produce a short hex fingerprint that identifies a finding stably across sessions.
11
+ *
12
+ * Same inputs = same output, regardless of when or where it runs. A changed route or a changed
13
+ * kind = a different fingerprint = a different defect. The analytics side can then answer "was this
14
+ * fixed?" by checking whether a fingerprint stops appearing.
15
+ */
16
+ export function fingerprintFinding(identity) {
17
+ const canonical = [identity.kind, identity.source, identity.route ?? ''].join('\x00');
18
+ return fnv1a(canonical);
19
+ }
@@ -44,6 +44,8 @@ export declare const PROJECT_RUN_CAP: {
44
44
  readonly PER_NAME: 50;
45
45
  readonly TOTAL: 200;
46
46
  };
47
+ /** Maximum distinct route identities retained in project.json. */
48
+ export declare const PROJECT_ROUTE_CAP = 200;
47
49
  /** Schema version stamped onto on-disk flow files (.reticle/flows/<name>.json). */
48
50
  export declare const FLOW_FILE_VERSION = 1;
49
51
  /** How a flow step is anchored to the live DOM at replay time (semantic, never a volatile ref). */
@@ -41,6 +41,8 @@ export const PROJECT_RUN_CAP = {
41
41
  PER_NAME: 50,
42
42
  TOTAL: 200,
43
43
  };
44
+ /** Maximum distinct route identities retained in project.json. */
45
+ export const PROJECT_ROUTE_CAP = 200;
44
46
  /** Schema version stamped onto on-disk flow files (.reticle/flows/<name>.json). */
45
47
  export const FLOW_FILE_VERSION = 1;
46
48
  /** How a flow step is anchored to the live DOM at replay time (semantic, never a volatile ref). */
@@ -409,6 +409,16 @@ export interface FlowReplayResult {
409
409
  code: string;
410
410
  message: string;
411
411
  };
412
+ /**
413
+ * Set on an `ok` replay whose flow cannot fail: it asserts no observable consequence, or has no
414
+ * steps at all. The replay genuinely completed, so the status stays `ok` — but a bare `ok` read
415
+ * as proof the feature works is exactly the false confidence `flow-risk.ts` argues against, and
416
+ * `reticle_flow_verify` already refuses to count these as passes. This carries the same reason,
417
+ * from the same function, to the single-flow caller who would otherwise never see it.
418
+ */
419
+ unverifiable?: {
420
+ reason: string;
421
+ };
412
422
  /**
413
423
  * The confident rebind proposals aggregated across drifted steps (additive,
414
424
  * optional — present only when at least one drifted step has a confident nearest match).
@@ -0,0 +1,17 @@
1
+ import type { ImpactCounts, ImpactSavings } from './impact.js';
2
+ /** What the two numbers are measured against, shown beside them in the report. */
3
+ export declare const IMPACT_BASIS: {
4
+ readonly TOKENS: "vs an agent reading the app through screenshots";
5
+ readonly MINUTES: "vs one re-prompt cycle per defect caught";
6
+ };
7
+ /**
8
+ * Estimate what the recorded work saved.
9
+ *
10
+ * Tokens: every verdict-bearing call replaced a look the agent would otherwise have taken as a
11
+ * screenshot. The tokens Reticle actually returned are subtracted, so the figure is a NET saving
12
+ * and can never exceed the modelled cost of the runs it replaced.
13
+ *
14
+ * Minutes: only DEFECTS count. A pass saves nothing by itself - the run was going to pass either
15
+ * way; what a false green costs is the round trip, and that is what catching it returns.
16
+ */
17
+ export declare function estimateImpactSavings(counts: ImpactCounts): ImpactSavings;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The savings model: one file, so every claim Reticle makes about its own worth is derivable here
3
+ * and nowhere else.
4
+ *
5
+ * A saving is a counterfactual - a comparison against a run that did not happen - so each constant
6
+ * below carries the run it stands for. Change a number here and the claim changes everywhere; there
7
+ * is deliberately no second place to tune one.
8
+ */
9
+ /**
10
+ * Tokens an agent spends to LOOK at an app it cannot see from the inside: a screenshot into
11
+ * context, plus the prose it writes reasoning about the pixels. Screenshots dominate - an image
12
+ * costs on the order of a thousand tokens before anything is understood from it.
13
+ *
14
+ * Reticle's answer to the same question is a semantic snapshot, and what that cost is not modelled:
15
+ * it is COUNTED, per call, and subtracted below.
16
+ */
17
+ const TOKENS_PER_SCREENSHOT_LOOK = 1600;
18
+ /**
19
+ * Minutes a false green costs when it escapes: the agent reports done, a person tries it, finds it
20
+ * broken, writes the correction, and the agent goes round again. Deliberately conservative - one
21
+ * short cycle, not the afternoon a shipped regression can take.
22
+ */
23
+ const MINUTES_PER_REPROMPT_CYCLE = 4;
24
+ /** What the two numbers are measured against, shown beside them in the report. */
25
+ export const IMPACT_BASIS = {
26
+ TOKENS: 'vs an agent reading the app through screenshots',
27
+ MINUTES: 'vs one re-prompt cycle per defect caught',
28
+ };
29
+ /**
30
+ * Estimate what the recorded work saved.
31
+ *
32
+ * Tokens: every verdict-bearing call replaced a look the agent would otherwise have taken as a
33
+ * screenshot. The tokens Reticle actually returned are subtracted, so the figure is a NET saving
34
+ * and can never exceed the modelled cost of the runs it replaced.
35
+ *
36
+ * Minutes: only DEFECTS count. A pass saves nothing by itself - the run was going to pass either
37
+ * way; what a false green costs is the round trip, and that is what catching it returns.
38
+ */
39
+ export function estimateImpactSavings(counts) {
40
+ const looksReplaced = counts.verdicts;
41
+ const grossTokens = looksReplaced * TOKENS_PER_SCREENSHOT_LOOK;
42
+ const netTokens = Math.max(0, grossTokens - counts.tokensReturned);
43
+ return {
44
+ tokens: { value: netTokens, basis: IMPACT_BASIS.TOKENS },
45
+ minutes: { value: counts.failed * MINUTES_PER_REPROMPT_CYCLE, basis: IMPACT_BASIS.MINUTES },
46
+ };
47
+ }