@reticlehq/core 2.2.1 → 2.4.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 (104) hide show
  1. package/dist/brand.d.ts +0 -1
  2. package/dist/brand.js +0 -1
  3. package/dist/consequence.d.ts +0 -1
  4. package/dist/consequence.js +0 -1
  5. package/dist/constants.d.ts +30 -33
  6. package/dist/constants.js +33 -31
  7. package/dist/daemon-registry.d.ts +0 -1
  8. package/dist/daemon-registry.js +0 -1
  9. package/dist/desktop-contract.cjs +11 -0
  10. package/dist/desktop-contract.d.cts +6 -0
  11. package/dist/desktop-contract.d.ts +58 -0
  12. package/dist/desktop-contract.js +59 -0
  13. package/dist/event-payloads.d.ts +62 -5
  14. package/dist/event-payloads.js +35 -4
  15. package/dist/event-priority.d.ts +25 -0
  16. package/dist/event-priority.js +45 -0
  17. package/dist/findings.d.ts +124 -0
  18. package/dist/findings.js +122 -0
  19. package/dist/flow-constants.d.ts +0 -1
  20. package/dist/flow-constants.js +0 -1
  21. package/dist/flow-types.d.ts +26 -2
  22. package/dist/flow-types.js +0 -1
  23. package/dist/index.d.ts +8 -1
  24. package/dist/index.js +9 -2
  25. package/dist/journal.d.ts +0 -1
  26. package/dist/journal.js +0 -1
  27. package/dist/messages.d.ts +40 -11
  28. package/dist/messages.js +14 -1
  29. package/dist/net.d.ts +41 -0
  30. package/dist/net.js +40 -0
  31. package/dist/notices.d.ts +0 -1
  32. package/dist/notices.js +0 -1
  33. package/dist/redaction.d.ts +64 -1
  34. package/dist/redaction.js +119 -3
  35. package/dist/schema/event-message.json +3 -1
  36. package/dist/schema/event-type.json +3 -1
  37. package/dist/schema/hello-message.json +9 -0
  38. package/dist/schema/reticle-event.json +3 -1
  39. package/dist/schema/reticle-message.json +12 -1
  40. package/dist/security.d.ts +20 -1
  41. package/dist/security.js +45 -1
  42. package/dist/session-constants.d.ts +0 -1
  43. package/dist/session-constants.js +0 -1
  44. package/dist/source-constants.d.ts +26 -0
  45. package/dist/source-constants.js +26 -0
  46. package/dist/state-select.d.ts +10 -1
  47. package/dist/state-select.js +56 -8
  48. package/dist/telemetry-feedback.d.ts +265 -0
  49. package/dist/telemetry-feedback.js +163 -0
  50. package/dist/telemetry-session.d.ts +524 -0
  51. package/dist/telemetry-session.js +245 -0
  52. package/dist/telemetry.d.ts +1410 -37
  53. package/dist/telemetry.js +338 -18
  54. package/dist/toon.d.ts +0 -1
  55. package/dist/toon.js +0 -1
  56. package/dist/types.d.ts +15 -8
  57. package/dist/types.js +0 -1
  58. package/dist/upgrade.d.ts +0 -1
  59. package/dist/upgrade.js +0 -1
  60. package/dist/verification-run.d.ts +14 -15
  61. package/dist/verification-run.js +0 -1
  62. package/dist/verified-constants.d.ts +104 -0
  63. package/dist/verified-constants.js +102 -0
  64. package/package.json +7 -3
  65. package/dist/brand.d.ts.map +0 -1
  66. package/dist/brand.js.map +0 -1
  67. package/dist/consequence.d.ts.map +0 -1
  68. package/dist/consequence.js.map +0 -1
  69. package/dist/constants.d.ts.map +0 -1
  70. package/dist/constants.js.map +0 -1
  71. package/dist/daemon-registry.d.ts.map +0 -1
  72. package/dist/daemon-registry.js.map +0 -1
  73. package/dist/event-payloads.d.ts.map +0 -1
  74. package/dist/event-payloads.js.map +0 -1
  75. package/dist/flow-constants.d.ts.map +0 -1
  76. package/dist/flow-constants.js.map +0 -1
  77. package/dist/flow-types.d.ts.map +0 -1
  78. package/dist/flow-types.js.map +0 -1
  79. package/dist/index.d.ts.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/journal.d.ts.map +0 -1
  82. package/dist/journal.js.map +0 -1
  83. package/dist/messages.d.ts.map +0 -1
  84. package/dist/messages.js.map +0 -1
  85. package/dist/notices.d.ts.map +0 -1
  86. package/dist/notices.js.map +0 -1
  87. package/dist/redaction.d.ts.map +0 -1
  88. package/dist/redaction.js.map +0 -1
  89. package/dist/security.d.ts.map +0 -1
  90. package/dist/security.js.map +0 -1
  91. package/dist/session-constants.d.ts.map +0 -1
  92. package/dist/session-constants.js.map +0 -1
  93. package/dist/state-select.d.ts.map +0 -1
  94. package/dist/state-select.js.map +0 -1
  95. package/dist/telemetry.d.ts.map +0 -1
  96. package/dist/telemetry.js.map +0 -1
  97. package/dist/toon.d.ts.map +0 -1
  98. package/dist/toon.js.map +0 -1
  99. package/dist/types.d.ts.map +0 -1
  100. package/dist/types.js.map +0 -1
  101. package/dist/upgrade.d.ts.map +0 -1
  102. package/dist/upgrade.js.map +0 -1
  103. package/dist/verification-run.d.ts.map +0 -1
  104. package/dist/verification-run.js.map +0 -1
package/dist/brand.d.ts CHANGED
@@ -47,4 +47,3 @@ export declare const asFlowName: (value: string) => FlowName;
47
47
  /** Mint a SessionId — call ONLY behind isValidSessionId, or on a literal in a test. */
48
48
  export declare const asSessionId: (value: string) => SessionId;
49
49
  export {};
50
- //# sourceMappingURL=brand.d.ts.map
package/dist/brand.js CHANGED
@@ -18,4 +18,3 @@ export const asRef = (value) => value;
18
18
  export const asFlowName = (value) => value;
19
19
  /** Mint a SessionId — call ONLY behind isValidSessionId, or on a literal in a test. */
20
20
  export const asSessionId = (value) => value;
21
- //# sourceMappingURL=brand.js.map
@@ -28,4 +28,3 @@ export declare function isPresenceKind(kind: string): boolean;
28
28
  export declare function flowExpectHasConsequence(expect: FlowExpect | undefined): boolean;
29
29
  /** True when a FlowExpect checks ONLY element presence — no consequence field is set. */
30
30
  export declare function flowExpectIsPresenceOnly(expect: FlowExpect | undefined): boolean;
31
- //# sourceMappingURL=consequence.d.ts.map
@@ -42,4 +42,3 @@ export function flowExpectHasConsequence(expect) {
42
42
  export function flowExpectIsPresenceOnly(expect) {
43
43
  return expect !== undefined && expect.element !== undefined && !flowExpectHasConsequence(expect);
44
44
  }
45
- //# sourceMappingURL=consequence.js.map
@@ -47,6 +47,14 @@ export declare const ReticleEnv: {
47
47
  readonly CDP_URL: "RETICLE_CDP_URL";
48
48
  /** Max simultaneous leased headless contexts in the browser pool (resource cap). */
49
49
  readonly MAX_CONTEXTS: "RETICLE_MAX_CONTEXTS";
50
+ /**
51
+ * Inbound events per second before the bridge starts SAMPLING (never disconnecting).
52
+ *
53
+ * Raise it for a legitimately busy app — a streaming dashboard, a live grid — rather than accept
54
+ * partial coverage. Free and local: the daemon runs on the same machine, so a higher ceiling costs
55
+ * nothing to anyone.
56
+ */
57
+ readonly MAX_MESSAGES_PER_SECOND: "RETICLE_MAX_MESSAGES_PER_SECOND";
50
58
  /** Bearer token required by the optional `reticle serve --http` verify endpoint. */
51
59
  readonly VERIFY_TOKEN: "RETICLE_VERIFY_TOKEN";
52
60
  /** Ms of continuous idleness (no agent, no browser session, no lease) before the daemon self-exits;
@@ -89,14 +97,6 @@ export declare const TRANSPORT_LIMITS: {
89
97
  };
90
98
  /** Replacement used when sensitive data is removed before crossing the bridge. */
91
99
  export declare const REDACTED_VALUE = "[REDACTED]";
92
- /**
93
- * The attribute the build plugin stamps on JSX host elements as `file:line:column`, so the browser SDK
94
- * and the React adapter can map a DOM node back to its source file (the source-pointer feature, needed
95
- * on React 19 which dropped _debugSource). Read here by both packages — it was duplicated as a local
96
- * const in dom/source.ts AND dom/query.ts and inlined as a literal in the React adapter. The stamper
97
- * (@reticlehq/babel-plugin, separate build tooling) stamps this same literal and MUST match it.
98
- */
99
- export declare const DATA_RETICLE_SOURCE_ATTR = "data-reticle-source";
100
100
  /** Explicit opt-in argument required for potentially destructive actions. */
101
101
  export declare const DANGEROUS_ACTION_CONFIRM_ARG = "confirmDangerous";
102
102
  /** Schema version stamped onto compiled replay programs. */
@@ -146,6 +146,7 @@ export declare const VisualReason: {
146
146
  readonly CAPTURE_FAILED: "capture-failed";
147
147
  readonly BASELINE_MISSING: "baseline-missing";
148
148
  readonly DIMENSION_MISMATCH: "dimension-mismatch";
149
+ readonly FULL_PAGE_UNSUPPORTED: "full-page-unsupported";
149
150
  };
150
151
  export type VisualReason = (typeof VisualReason)[keyof typeof VisualReason];
151
152
  /** Actionable companion to NO_PROVIDER — the visual layer needs a driven browser. */
@@ -156,12 +157,6 @@ export declare const VISUAL_PIXEL_THRESHOLD = 0.1;
156
157
  * Autonomous "smart monkey" anomaly classes reticle_crawl reports after clicking a
157
158
  * reachable control. Named so the agent (and tests) branch on cause, never on message text.
158
159
  */
159
- export declare const CrawlAnomalyKind: {
160
- readonly CONSOLE_ERROR: "console-error";
161
- readonly FAILED_REQUEST: "failed-request";
162
- readonly DEAD_CONTROL: "dead-control";
163
- };
164
- export type CrawlAnomalyKind = (typeof CrawlAnomalyKind)[keyof typeof CrawlAnomalyKind];
165
160
  /**
166
161
  * Bounds for reticle_scroll_to — how many viewport scrolls to try before giving up on
167
162
  * a virtualized/windowed list (which only renders visible rows, so a plain reticle_query misses
@@ -254,6 +249,9 @@ export declare const EventType: {
254
249
  * implies it saw everything.
255
250
  */
256
251
  readonly BLIND_SPOT: "blind-spot";
252
+ /** synthetic: the SDK ITSELF failed (an observer threw). `data: { site, message, errorType }`.
253
+ * Rides the existing bridge — no outbound request. See browser/observers/sdk-failure.ts. */
254
+ readonly SDK_FAILED: "sdk.failed";
257
255
  /**
258
256
  * synthetic (driven only): CDP/Playwright-authoritative network detail for a response the in-page
259
257
  * fetch/XHR wrapper also saw — full response headers + authoritative status/mimeType the page-side
@@ -273,6 +271,13 @@ export declare const EventType: {
273
271
  * the agent that drains the mark knows exactly which element and which source to fix.
274
272
  */
275
273
  readonly HUMAN_MARK: "human.mark";
274
+ /**
275
+ * The app produced a FILE — a Blob handed to `URL.createObjectURL`, usually saved by clicking an
276
+ * anchor with `download`. `data: { filename?, mimeType, bytes, lines?, preview? }`. The one artifact
277
+ * class no outside-the-browser tool can inspect: it never crosses the network, so there is no
278
+ * request to intercept. See `observers/download.ts` for the defect that motivated it.
279
+ */
280
+ readonly DOWNLOAD: "download";
276
281
  };
277
282
  export type EventType = (typeof EventType)[keyof typeof EventType];
278
283
  /**
@@ -302,6 +307,8 @@ export declare const RETICLE_HYDRATION_SIGNAL = "reticle:hydration-complete";
302
307
  * stop the SDK's owned-store matching.
303
308
  */
304
309
  export declare const RETICLE_RENDERS_STORE = "__reticle_renders";
310
+ /** Global the render pre-hook parks its commit buffer on (see the vite plugin's RENDER_PREHOOK_SOURCE). */
311
+ export declare const RETICLE_RENDER_PREHOOK = "__reticleRenderPreHook";
305
312
  /**
306
313
  * Signal the React adapter fires when an error boundary catches (dev-only). Carried on the signal channel
307
314
  * (the SDK's public emit surface) so the server sees a boundary that swallowed — the purest "looks fine,
@@ -321,24 +328,6 @@ export declare const TruncationChannel: {
321
328
  readonly DOM: "dom";
322
329
  };
323
330
  export type TruncationChannel = (typeof TruncationChannel)[keyof typeof TruncationChannel];
324
- /**
325
- * A region the SDK cannot see into — surfaced (never hidden) so a result's coverage reads honestly.
326
- * Crosses the wire in a BLIND_SPOT event's `kind`, so it lives in core (the contract), not the server.
327
- */
328
- export declare const BlindSpotKind: {
329
- readonly CLOSED_SHADOW_ROOT: "closed-shadow-root";
330
- readonly CROSS_ORIGIN_IFRAME: "cross-origin-iframe";
331
- readonly VIRTUALIZED_UNMOUNTED: "virtualized-unmounted";
332
- /**
333
- * Something wrapped `fetch` before we did, so the request we record is not necessarily the request
334
- * that leaves. Wrappers chain outermost-first: anything installed EARLIER sits below us and mutates
335
- * after we have read `init.body`. An interceptor initialised before connect(), or a polyfill, does
336
- * exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it is
337
- * declared instead, and a verdict over it reports partial coverage rather than implying we saw the wire.
338
- */
339
- readonly WRAPPED_NETWORK: "wrapped-network";
340
- };
341
- export type BlindSpotKind = (typeof BlindSpotKind)[keyof typeof BlindSpotKind];
342
331
  /**
343
332
  * How an event was linked to the action it is attributed to. `window` means the SDK stamped the
344
333
  * currently-active action's id onto every event observed between that action's dispatch and its
@@ -497,6 +486,15 @@ export declare const ReticleCommand: {
497
486
  * AGENT-driven pause/end keeps the presenter in sync. `args: { state, text? }`.
498
487
  */
499
488
  readonly PRESENTER: "presenter";
489
+ /**
490
+ * Ask the DESKTOP shell to photograph its own window and return `{ png: <base64> }`.
491
+ *
492
+ * A desktop webview has no CDP endpoint, so pixels must come from the runtime itself. Electron's
493
+ * `webContents.capturePage()` reads the window's backing store, which is why this beats capturing
494
+ * a screen region: it is correct even when the window is behind the editor, and needs no
495
+ * screen-recording permission. Answered only when the app installed the capture helper.
496
+ */
497
+ readonly CAPTURE: "capture";
500
498
  /** Navigate the page to a new URL. `args: { url: string }`. */
501
499
  readonly NAVIGATE: "navigate";
502
500
  /** Reload the page. `args: { hard?: boolean }` — hard clears the cache via location replace trick. */
@@ -531,4 +529,3 @@ export declare const MessageKind: {
531
529
  readonly EVENT: "event";
532
530
  };
533
531
  export type MessageKind = (typeof MessageKind)[keyof typeof MessageKind];
534
- //# sourceMappingURL=constants.d.ts.map
package/dist/constants.js CHANGED
@@ -49,6 +49,14 @@ export const ReticleEnv = {
49
49
  CDP_URL: 'RETICLE_CDP_URL',
50
50
  /** Max simultaneous leased headless contexts in the browser pool (resource cap). */
51
51
  MAX_CONTEXTS: 'RETICLE_MAX_CONTEXTS',
52
+ /**
53
+ * Inbound events per second before the bridge starts SAMPLING (never disconnecting).
54
+ *
55
+ * Raise it for a legitimately busy app — a streaming dashboard, a live grid — rather than accept
56
+ * partial coverage. Free and local: the daemon runs on the same machine, so a higher ceiling costs
57
+ * nothing to anyone.
58
+ */
59
+ MAX_MESSAGES_PER_SECOND: 'RETICLE_MAX_MESSAGES_PER_SECOND',
52
60
  /** Bearer token required by the optional `reticle serve --http` verify endpoint. */
53
61
  VERIFY_TOKEN: 'RETICLE_VERIFY_TOKEN',
54
62
  /** Ms of continuous idleness (no agent, no browser session, no lease) before the daemon self-exits;
@@ -91,14 +99,6 @@ export const TRANSPORT_LIMITS = {
91
99
  };
92
100
  /** Replacement used when sensitive data is removed before crossing the bridge. */
93
101
  export const REDACTED_VALUE = '[REDACTED]';
94
- /**
95
- * The attribute the build plugin stamps on JSX host elements as `file:line:column`, so the browser SDK
96
- * and the React adapter can map a DOM node back to its source file (the source-pointer feature, needed
97
- * on React 19 which dropped _debugSource). Read here by both packages — it was duplicated as a local
98
- * const in dom/source.ts AND dom/query.ts and inlined as a literal in the React adapter. The stamper
99
- * (@reticlehq/babel-plugin, separate build tooling) stamps this same literal and MUST match it.
100
- */
101
- export const DATA_RETICLE_SOURCE_ATTR = 'data-reticle-source';
102
102
  /** Explicit opt-in argument required for potentially destructive actions. */
103
103
  export const DANGEROUS_ACTION_CONFIRM_ARG = 'confirmDangerous';
104
104
  /** Schema version stamped onto compiled replay programs. */
@@ -148,6 +148,10 @@ export const VisualReason = {
148
148
  CAPTURE_FAILED: 'capture-failed', // the page could not be screenshotted
149
149
  BASELINE_MISSING: 'baseline-missing', // reticle_visual_diff with no saved baseline of that name
150
150
  DIMENSION_MISMATCH: 'dimension-mismatch', // current vs baseline differ in size — can't pixel-diff
151
+ // { fullPage } asked of a shell that can only photograph the viewport. Reported rather than
152
+ // quietly downgraded: a caller who asked for the whole scroll height and silently got the visible
153
+ // part would bank a baseline that says nothing about the content below the fold.
154
+ FULL_PAGE_UNSUPPORTED: 'full-page-unsupported',
151
155
  };
152
156
  /** Actionable companion to NO_PROVIDER — the visual layer needs a driven browser. */
153
157
  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';
@@ -157,11 +161,6 @@ export const VISUAL_PIXEL_THRESHOLD = 0.1;
157
161
  * Autonomous "smart monkey" anomaly classes reticle_crawl reports after clicking a
158
162
  * reachable control. Named so the agent (and tests) branch on cause, never on message text.
159
163
  */
160
- export const CrawlAnomalyKind = {
161
- CONSOLE_ERROR: 'console-error', // the click logged a console.error / uncaught error
162
- FAILED_REQUEST: 'failed-request', // it fired a request that returned >= 400
163
- DEAD_CONTROL: 'dead-control', // it dispatched but the app did NOTHING (no DOM/net/route/signal)
164
- };
165
164
  /**
166
165
  * Bounds for reticle_scroll_to — how many viewport scrolls to try before giving up on
167
166
  * a virtualized/windowed list (which only renders visible rows, so a plain reticle_query misses
@@ -253,6 +252,9 @@ export const EventType = {
253
252
  * implies it saw everything.
254
253
  */
255
254
  BLIND_SPOT: 'blind-spot',
255
+ /** synthetic: the SDK ITSELF failed (an observer threw). `data: { site, message, errorType }`.
256
+ * Rides the existing bridge — no outbound request. See browser/observers/sdk-failure.ts. */
257
+ SDK_FAILED: 'sdk.failed',
256
258
  /**
257
259
  * synthetic (driven only): CDP/Playwright-authoritative network detail for a response the in-page
258
260
  * fetch/XHR wrapper also saw — full response headers + authoritative status/mimeType the page-side
@@ -272,6 +274,13 @@ export const EventType = {
272
274
  * the agent that drains the mark knows exactly which element and which source to fix.
273
275
  */
274
276
  HUMAN_MARK: 'human.mark',
277
+ /**
278
+ * The app produced a FILE — a Blob handed to `URL.createObjectURL`, usually saved by clicking an
279
+ * anchor with `download`. `data: { filename?, mimeType, bytes, lines?, preview? }`. The one artifact
280
+ * class no outside-the-browser tool can inspect: it never crosses the network, so there is no
281
+ * request to intercept. See `observers/download.ts` for the defect that motivated it.
282
+ */
283
+ DOWNLOAD: 'download',
275
284
  };
276
285
  /**
277
286
  * Named phenomena the perception layer detects deterministically over the journal — capsules and
@@ -299,6 +308,8 @@ export const RETICLE_HYDRATION_SIGNAL = 'reticle:hydration-complete';
299
308
  * stop the SDK's owned-store matching.
300
309
  */
301
310
  export const RETICLE_RENDERS_STORE = '__reticle_renders';
311
+ /** Global the render pre-hook parks its commit buffer on (see the vite plugin's RENDER_PREHOOK_SOURCE). */
312
+ export const RETICLE_RENDER_PREHOOK = '__reticleRenderPreHook';
302
313
  /**
303
314
  * Signal the React adapter fires when an error boundary catches (dev-only). Carried on the signal channel
304
315
  * (the SDK's public emit surface) so the server sees a boundary that swallowed — the purest "looks fine,
@@ -317,23 +328,6 @@ export const RETICLE_HYDRATION_ERROR_SIGNAL = 'reticle:hydration-error';
317
328
  export const TruncationChannel = {
318
329
  DOM: 'dom',
319
330
  };
320
- /**
321
- * A region the SDK cannot see into — surfaced (never hidden) so a result's coverage reads honestly.
322
- * Crosses the wire in a BLIND_SPOT event's `kind`, so it lives in core (the contract), not the server.
323
- */
324
- export const BlindSpotKind = {
325
- CLOSED_SHADOW_ROOT: 'closed-shadow-root',
326
- CROSS_ORIGIN_IFRAME: 'cross-origin-iframe',
327
- VIRTUALIZED_UNMOUNTED: 'virtualized-unmounted',
328
- /**
329
- * Something wrapped `fetch` before we did, so the request we record is not necessarily the request
330
- * that leaves. Wrappers chain outermost-first: anything installed EARLIER sits below us and mutates
331
- * after we have read `init.body`. An interceptor initialised before connect(), or a polyfill, does
332
- * exactly that. Unfixable from inside the page — there is no "patch last" primitive — so it is
333
- * declared instead, and a verdict over it reports partial coverage rather than implying we saw the wire.
334
- */
335
- WRAPPED_NETWORK: 'wrapped-network',
336
- };
337
331
  /**
338
332
  * How an event was linked to the action it is attributed to. `window` means the SDK stamped the
339
333
  * currently-active action's id onto every event observed between that action's dispatch and its
@@ -470,6 +464,15 @@ export const ReticleCommand = {
470
464
  * AGENT-driven pause/end keeps the presenter in sync. `args: { state, text? }`.
471
465
  */
472
466
  PRESENTER: 'presenter',
467
+ /**
468
+ * Ask the DESKTOP shell to photograph its own window and return `{ png: <base64> }`.
469
+ *
470
+ * A desktop webview has no CDP endpoint, so pixels must come from the runtime itself. Electron's
471
+ * `webContents.capturePage()` reads the window's backing store, which is why this beats capturing
472
+ * a screen region: it is correct even when the window is behind the editor, and needs no
473
+ * screen-recording permission. Answered only when the app installed the capture helper.
474
+ */
475
+ CAPTURE: 'capture',
473
476
  /** Navigate the page to a new URL. `args: { url: string }`. */
474
477
  NAVIGATE: 'navigate',
475
478
  /** Reload the page. `args: { hard?: boolean }` — hard clears the cache via location replace trick. */
@@ -500,4 +503,3 @@ export const MessageKind = {
500
503
  COMMAND_RESULT: 'command_result',
501
504
  EVENT: 'event',
502
505
  };
503
- //# sourceMappingURL=constants.js.map
@@ -33,4 +33,3 @@ export type DaemonRegistryEntry = z.infer<typeof DaemonRegistryEntrySchema>;
33
33
  * mismatched daemon — a wrong auto-connect is worse than the honest default).
34
34
  */
35
35
  export declare function pickDaemonPort(entries: readonly DaemonRegistryEntry[], projectId: string | undefined, isAlive: (pid: number) => boolean): number | null;
36
- //# sourceMappingURL=daemon-registry.d.ts.map
@@ -45,4 +45,3 @@ export function pickDaemonPort(entries, projectId, isAlive) {
45
45
  .sort((a, b) => a - b);
46
46
  return matches[0] ?? null;
47
47
  }
48
- //# sourceMappingURL=daemon-registry.js.map
@@ -0,0 +1,11 @@
1
+ // GENERATED by scripts/gen-desktop-contract.mjs — do not edit.
2
+ //
3
+ // The CommonJS view of the desktop wiring contract, for an Electron preload/main process that
4
+ // cannot import the ESM build. Edit src/desktop-contract.ts and rebuild @reticlehq/core.
5
+ 'use strict';
6
+ exports.RETICLE_IPC_GLOBAL = "__reticleIpc";
7
+ exports.RETICLE_CAPTURE_CHANNEL = "__reticle:capture";
8
+ exports.RETICLE_CAPTURE_FILE_PREFIX = "reticle-capture-";
9
+ exports.RETICLE_TAURI_CAPTURE_COMMAND = "reticle_capture";
10
+ exports.RETICLE_FULL_PAGE_UNSUPPORTED = "full-page-unsupported";
11
+ Object.freeze(exports);
@@ -0,0 +1,6 @@
1
+ // GENERATED by scripts/gen-desktop-contract.mjs — do not edit.
2
+ export declare const RETICLE_IPC_GLOBAL: "__reticleIpc";
3
+ export declare const RETICLE_CAPTURE_CHANNEL: "__reticle:capture";
4
+ export declare const RETICLE_CAPTURE_FILE_PREFIX: "reticle-capture-";
5
+ export declare const RETICLE_TAURI_CAPTURE_COMMAND: "reticle_capture";
6
+ export declare const RETICLE_FULL_PAGE_UNSUPPORTED: "full-page-unsupported";
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The desktop wiring contract — the single source of truth for the strings that let an Electron
3
+ * app's three worlds recognise each other.
4
+ *
5
+ * Those worlds cannot share a module graph. A sandboxed Electron preload is CommonJS and cannot load
6
+ * the ESM SDK build; the daemon runs in a separate process entirely. So these values were previously
7
+ * hand-copied into six files, and a rename in any one of them broke desktop SILENTLY — IPC stopped
8
+ * being observed, or screenshots stopped working, and every test still passed.
9
+ *
10
+ * They live here because `@reticlehq/core` is where anything crossing the browser ↔ bridge ↔ agent
11
+ * boundary is defined. The CommonJS side does not copy them: `scripts/gen-desktop-contract.mjs`
12
+ * emits `dist/desktop-contract.cjs` from THIS file at build time, so the preload requires the same
13
+ * values it would have imported. One definition, two module systems, no drift possible.
14
+ */
15
+ /**
16
+ * The `window` property the Electron preload exposes and the renderer-side SDK reads.
17
+ *
18
+ * Namespaced and underscore-prefixed so it cannot collide with an app's own globals.
19
+ */
20
+ export declare const RETICLE_IPC_GLOBAL = "__reticleIpc";
21
+ /** The ipcMain channel the capture helper answers, invoked by the preload on the SDK's behalf. */
22
+ export declare const RETICLE_CAPTURE_CHANNEL = "__reticle:capture";
23
+ /**
24
+ * Filename prefix for a screenshot the main process writes to the OS temp directory.
25
+ *
26
+ * The daemon refuses to read a capture whose path does not sit in the temp dir AND carry this
27
+ * prefix — the path arrives from the page, and the daemon must not become a file-read oracle for
28
+ * whatever a compromised renderer names.
29
+ */
30
+ export declare const RETICLE_CAPTURE_FILE_PREFIX = "reticle-capture-";
31
+ /**
32
+ * The Tauri command name `reticle-tauri` registers, invoked by the SDK when no preload is present.
33
+ *
34
+ * Tauri has no preload stage — there is no place to install a capture global before app code runs.
35
+ * So the SDK invokes this command directly through Tauri's own internals, which means a Tauri app
36
+ * gets screenshots by adding ONE Rust command and nothing at all on the JavaScript side.
37
+ */
38
+ export declare const RETICLE_TAURI_CAPTURE_COMMAND = "reticle_capture";
39
+ /**
40
+ * What a shell answers when asked for `fullPage` it cannot produce.
41
+ *
42
+ * Shared with `VisualReason.FULL_PAGE_UNSUPPORTED` rather than re-spelled, because the Electron
43
+ * preload (CommonJS) and the daemon must agree on it without sharing a module graph.
44
+ */
45
+ export declare const RETICLE_FULL_PAGE_UNSUPPORTED: string;
46
+ /**
47
+ * Every value the generated CommonJS shim must expose, as `name → value`.
48
+ *
49
+ * The generator walks THIS record rather than a hand-written list, so adding a constant above and
50
+ * exporting it here is all it takes for the preload to see it — there is no second place to update.
51
+ */
52
+ export declare const DESKTOP_CONTRACT: {
53
+ readonly RETICLE_IPC_GLOBAL: "__reticleIpc";
54
+ readonly RETICLE_CAPTURE_CHANNEL: "__reticle:capture";
55
+ readonly RETICLE_CAPTURE_FILE_PREFIX: "reticle-capture-";
56
+ readonly RETICLE_TAURI_CAPTURE_COMMAND: "reticle_capture";
57
+ readonly RETICLE_FULL_PAGE_UNSUPPORTED: string;
58
+ };
@@ -0,0 +1,59 @@
1
+ import { VisualReason } from './constants.js';
2
+ /**
3
+ * The desktop wiring contract — the single source of truth for the strings that let an Electron
4
+ * app's three worlds recognise each other.
5
+ *
6
+ * Those worlds cannot share a module graph. A sandboxed Electron preload is CommonJS and cannot load
7
+ * the ESM SDK build; the daemon runs in a separate process entirely. So these values were previously
8
+ * hand-copied into six files, and a rename in any one of them broke desktop SILENTLY — IPC stopped
9
+ * being observed, or screenshots stopped working, and every test still passed.
10
+ *
11
+ * They live here because `@reticlehq/core` is where anything crossing the browser ↔ bridge ↔ agent
12
+ * boundary is defined. The CommonJS side does not copy them: `scripts/gen-desktop-contract.mjs`
13
+ * emits `dist/desktop-contract.cjs` from THIS file at build time, so the preload requires the same
14
+ * values it would have imported. One definition, two module systems, no drift possible.
15
+ */
16
+ /**
17
+ * The `window` property the Electron preload exposes and the renderer-side SDK reads.
18
+ *
19
+ * Namespaced and underscore-prefixed so it cannot collide with an app's own globals.
20
+ */
21
+ export const RETICLE_IPC_GLOBAL = '__reticleIpc';
22
+ /** The ipcMain channel the capture helper answers, invoked by the preload on the SDK's behalf. */
23
+ export const RETICLE_CAPTURE_CHANNEL = '__reticle:capture';
24
+ /**
25
+ * Filename prefix for a screenshot the main process writes to the OS temp directory.
26
+ *
27
+ * The daemon refuses to read a capture whose path does not sit in the temp dir AND carry this
28
+ * prefix — the path arrives from the page, and the daemon must not become a file-read oracle for
29
+ * whatever a compromised renderer names.
30
+ */
31
+ export const RETICLE_CAPTURE_FILE_PREFIX = 'reticle-capture-';
32
+ /**
33
+ * The Tauri command name `reticle-tauri` registers, invoked by the SDK when no preload is present.
34
+ *
35
+ * Tauri has no preload stage — there is no place to install a capture global before app code runs.
36
+ * So the SDK invokes this command directly through Tauri's own internals, which means a Tauri app
37
+ * gets screenshots by adding ONE Rust command and nothing at all on the JavaScript side.
38
+ */
39
+ export const RETICLE_TAURI_CAPTURE_COMMAND = 'reticle_capture';
40
+ /**
41
+ * What a shell answers when asked for `fullPage` it cannot produce.
42
+ *
43
+ * Shared with `VisualReason.FULL_PAGE_UNSUPPORTED` rather than re-spelled, because the Electron
44
+ * preload (CommonJS) and the daemon must agree on it without sharing a module graph.
45
+ */
46
+ export const RETICLE_FULL_PAGE_UNSUPPORTED = VisualReason.FULL_PAGE_UNSUPPORTED;
47
+ /**
48
+ * Every value the generated CommonJS shim must expose, as `name → value`.
49
+ *
50
+ * The generator walks THIS record rather than a hand-written list, so adding a constant above and
51
+ * exporting it here is all it takes for the preload to see it — there is no second place to update.
52
+ */
53
+ export const DESKTOP_CONTRACT = {
54
+ RETICLE_IPC_GLOBAL,
55
+ RETICLE_CAPTURE_CHANNEL,
56
+ RETICLE_CAPTURE_FILE_PREFIX,
57
+ RETICLE_TAURI_CAPTURE_COMMAND,
58
+ RETICLE_FULL_PAGE_UNSUPPORTED,
59
+ };
@@ -19,15 +19,26 @@ import { EventType } from './constants.js';
19
19
  * object — the browser imports the members, the schema derives its z.nativeEnum from the same object —
20
20
  * so emitter and validator are one source. Co-located with the schemas (kept constants.ts under its cap).
21
21
  */
22
+ /**
23
+ * `FETCH` is a response whose BODY is still arriving after the request itself resolved.
24
+ *
25
+ * `fetch` settles at HEADERS, so a streamed response is reported complete while the server is still
26
+ * writing. Measured on a Next.js App Router page: the RSC payload's NET_REQUEST landed 16 ms in, the
27
+ * shell rendered, and the Suspense boundary's content arrived 889 ms later — a window in which
28
+ * nothing at all was observed, so `settled` passed while the fallback was still on screen.
29
+ */
22
30
  export declare const StreamTransport: {
23
31
  readonly SSE: "sse";
24
32
  readonly WS: "ws";
33
+ readonly FETCH: "fetch";
25
34
  };
26
35
  export type StreamTransport = (typeof StreamTransport)[keyof typeof StreamTransport];
36
+ /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
27
37
  export declare const StreamDirection: {
28
38
  readonly OPEN: "open";
29
39
  readonly IN: "in";
30
40
  readonly OUT: "out";
41
+ readonly CLOSE: "close";
31
42
  };
32
43
  export type StreamDirection = (typeof StreamDirection)[keyof typeof StreamDirection];
33
44
  export declare const ScrollDirection: {
@@ -134,36 +145,64 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
134
145
  transport: z.ZodNativeEnum<{
135
146
  readonly SSE: "sse";
136
147
  readonly WS: "ws";
148
+ readonly FETCH: "fetch";
137
149
  }>;
138
150
  direction: z.ZodNativeEnum<{
139
151
  readonly OPEN: "open";
140
152
  readonly IN: "in";
141
153
  readonly OUT: "out";
154
+ readonly CLOSE: "close";
142
155
  }>;
143
156
  url: z.ZodString;
144
157
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
145
158
  transport: z.ZodNativeEnum<{
146
159
  readonly SSE: "sse";
147
160
  readonly WS: "ws";
161
+ readonly FETCH: "fetch";
148
162
  }>;
149
163
  direction: z.ZodNativeEnum<{
150
164
  readonly OPEN: "open";
151
165
  readonly IN: "in";
152
166
  readonly OUT: "out";
167
+ readonly CLOSE: "close";
153
168
  }>;
154
169
  url: z.ZodString;
155
170
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
156
171
  transport: z.ZodNativeEnum<{
157
172
  readonly SSE: "sse";
158
173
  readonly WS: "ws";
174
+ readonly FETCH: "fetch";
159
175
  }>;
160
176
  direction: z.ZodNativeEnum<{
161
177
  readonly OPEN: "open";
162
178
  readonly IN: "in";
163
179
  readonly OUT: "out";
180
+ readonly CLOSE: "close";
164
181
  }>;
165
182
  url: z.ZodString;
166
183
  }, z.ZodTypeAny, "passthrough">>;
184
+ download: z.ZodObject<{
185
+ mimeType: z.ZodString;
186
+ bytes: z.ZodNumber;
187
+ filename: z.ZodOptional<z.ZodString>;
188
+ lines: z.ZodOptional<z.ZodNumber>;
189
+ preview: z.ZodOptional<z.ZodString>;
190
+ previewTruncated: z.ZodOptional<z.ZodBoolean>;
191
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
192
+ mimeType: z.ZodString;
193
+ bytes: z.ZodNumber;
194
+ filename: z.ZodOptional<z.ZodString>;
195
+ lines: z.ZodOptional<z.ZodNumber>;
196
+ preview: z.ZodOptional<z.ZodString>;
197
+ previewTruncated: z.ZodOptional<z.ZodBoolean>;
198
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
199
+ mimeType: z.ZodString;
200
+ bytes: z.ZodNumber;
201
+ filename: z.ZodOptional<z.ZodString>;
202
+ lines: z.ZodOptional<z.ZodNumber>;
203
+ preview: z.ZodOptional<z.ZodString>;
204
+ previewTruncated: z.ZodOptional<z.ZodBoolean>;
205
+ }, z.ZodTypeAny, "passthrough">>;
167
206
  perf: z.ZodObject<{
168
207
  metric: z.ZodNativeEnum<{
169
208
  readonly LCP: "lcp";
@@ -173,12 +212,12 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
173
212
  value: z.ZodNumber;
174
213
  at: z.ZodNumber;
175
214
  }, "strip", z.ZodTypeAny, {
176
- value: number;
177
215
  at: number;
216
+ value: number;
178
217
  metric: "lcp" | "cls" | "longtask";
179
218
  }, {
180
- value: number;
181
219
  at: number;
220
+ value: number;
182
221
  metric: "lcp" | "cls" | "longtask";
183
222
  }>;
184
223
  "route.change": z.ZodObject<{
@@ -407,18 +446,37 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
407
446
  "blind-spot": z.ZodObject<{
408
447
  kind: z.ZodNativeEnum<{
409
448
  readonly CLOSED_SHADOW_ROOT: "closed-shadow-root";
449
+ readonly RATE_LIMITED: "rate-limited";
410
450
  readonly CROSS_ORIGIN_IFRAME: "cross-origin-iframe";
451
+ readonly UNINSTRUMENTED_FRAME: "uninstrumented-frame";
411
452
  readonly VIRTUALIZED_UNMOUNTED: "virtualized-unmounted";
412
453
  readonly WRAPPED_NETWORK: "wrapped-network";
454
+ readonly UNOBSERVED_IPC: "unobserved-ipc";
455
+ readonly VERDICTLESS_SEND: "verdictless-send";
413
456
  }>;
414
457
  count: z.ZodNumber;
415
458
  }, "strip", z.ZodTypeAny, {
416
- kind: "closed-shadow-root" | "cross-origin-iframe" | "virtualized-unmounted" | "wrapped-network";
459
+ kind: "closed-shadow-root" | "rate-limited" | "cross-origin-iframe" | "uninstrumented-frame" | "virtualized-unmounted" | "wrapped-network" | "unobserved-ipc" | "verdictless-send";
417
460
  count: number;
418
461
  }, {
419
- kind: "closed-shadow-root" | "cross-origin-iframe" | "virtualized-unmounted" | "wrapped-network";
462
+ kind: "closed-shadow-root" | "rate-limited" | "cross-origin-iframe" | "uninstrumented-frame" | "virtualized-unmounted" | "wrapped-network" | "unobserved-ipc" | "verdictless-send";
420
463
  count: number;
421
464
  }>;
465
+ "sdk.failed": z.ZodObject<{
466
+ /** WHERE in the SDK — a fixed vocabulary of our own module names, never a user path. */
467
+ site: z.ZodString;
468
+ /** The error message. Stripped of variables server-side before it is ever reported onward. */
469
+ message: z.ZodString;
470
+ errorType: z.ZodOptional<z.ZodString>;
471
+ }, "strip", z.ZodTypeAny, {
472
+ message: string;
473
+ site: string;
474
+ errorType?: string | undefined;
475
+ }, {
476
+ message: string;
477
+ site: string;
478
+ errorType?: string | undefined;
479
+ }>;
422
480
  "net.detail": z.ZodObject<{
423
481
  url: z.ZodString;
424
482
  method: z.ZodOptional<z.ZodString>;
@@ -499,4 +557,3 @@ export declare const EVENT_PAYLOAD_SCHEMAS: {
499
557
  };
500
558
  /** Narrow an event's `data` against its type's payload schema. Unknown in, typed-or-error out. */
501
559
  export declare function parseEventPayload(type: EventType, data: unknown): z.SafeParseReturnType<unknown, unknown>;
502
- //# sourceMappingURL=event-payloads.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { EventType, PerfMetric, BlindSpotKind } from './constants.js';
2
+ import { EventType, PerfMetric } from './constants.js';
3
+ import { BlindSpotKind } from './verified-constants.js';
3
4
  import { HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
4
5
  /**
5
6
  * Per-event-type payload schemas — the typed replacement for the envelope's open `data` record.
@@ -20,11 +21,34 @@ import { HumanControlDataSchema, HumanMarkDataSchema } from './messages.js';
20
21
  * object — the browser imports the members, the schema derives its z.nativeEnum from the same object —
21
22
  * so emitter and validator are one source. Co-located with the schemas (kept constants.ts under its cap).
22
23
  */
23
- export const StreamTransport = { SSE: 'sse', WS: 'ws' };
24
- export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out' };
24
+ /**
25
+ * `FETCH` is a response whose BODY is still arriving after the request itself resolved.
26
+ *
27
+ * `fetch` settles at HEADERS, so a streamed response is reported complete while the server is still
28
+ * writing. Measured on a Next.js App Router page: the RSC payload's NET_REQUEST landed 16 ms in, the
29
+ * shell rendered, and the Suspense boundary's content arrived 889 ms later — a window in which
30
+ * nothing at all was observed, so `settled` passed while the fallback was still on screen.
31
+ */
32
+ export const StreamTransport = { SSE: 'sse', WS: 'ws', FETCH: 'fetch' };
33
+ /** `CLOSE` pairs with `OPEN`: until it arrives, the body is still being written. */
34
+ export const StreamDirection = { OPEN: 'open', IN: 'in', OUT: 'out', CLOSE: 'close' };
25
35
  export const ScrollDirection = { UP: 'up', DOWN: 'down' };
26
36
  export const StorageArea = { LOCAL: 'local', SESSION: 'session', COOKIE: 'cookie' };
27
37
  const elementLabel = z.object({ role: z.string().optional(), name: z.string().optional() });
38
+ /**
39
+ * A file the app produced. `preview`/`lines` are present only when body capture is on, for the same
40
+ * reason request bodies are gated: an export is exactly where a customer list lives.
41
+ */
42
+ const downloadSchema = z
43
+ .object({
44
+ mimeType: z.string(),
45
+ bytes: z.number(),
46
+ filename: z.string().optional(),
47
+ lines: z.number().optional(),
48
+ preview: z.string().optional(),
49
+ previewTruncated: z.boolean().optional(),
50
+ })
51
+ .passthrough();
28
52
  const netStreamSchema = z
29
53
  .object({
30
54
  transport: z.nativeEnum(StreamTransport),
@@ -63,6 +87,7 @@ export const EVENT_PAYLOAD_SCHEMAS = {
63
87
  initiator: z.string(),
64
88
  }),
65
89
  [EventType.NET_STREAM]: netStreamSchema,
90
+ [EventType.DOWNLOAD]: downloadSchema,
66
91
  [EventType.PERF]: z.object({
67
92
  metric: z.nativeEnum(PerfMetric),
68
93
  value: z.number(),
@@ -119,6 +144,13 @@ export const EVENT_PAYLOAD_SCHEMAS = {
119
144
  [EventType.TRANSPORT_OVERFLOW]: z.object({ dropped: z.number() }),
120
145
  [EventType.TRUNCATED]: z.object({ channel: z.string(), dropped: z.number() }),
121
146
  [EventType.BLIND_SPOT]: z.object({ kind: z.nativeEnum(BlindSpotKind), count: z.number() }),
147
+ [EventType.SDK_FAILED]: z.object({
148
+ /** WHERE in the SDK — a fixed vocabulary of our own module names, never a user path. */
149
+ site: z.string().max(64),
150
+ /** The error message. Stripped of variables server-side before it is ever reported onward. */
151
+ message: z.string().max(500),
152
+ errorType: z.string().max(64).optional(),
153
+ }),
122
154
  [EventType.NET_DETAIL]: z
123
155
  .object({
124
156
  url: z.string(),
@@ -135,4 +167,3 @@ export const EVENT_PAYLOAD_SCHEMAS = {
135
167
  export function parseEventPayload(type, data) {
136
168
  return EVENT_PAYLOAD_SCHEMAS[type].safeParse(data);
137
169
  }
138
- //# sourceMappingURL=event-payloads.js.map