@reticlehq/core 2.11.0 → 2.13.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 (58) hide show
  1. package/dist/constants.d.ts +40 -0
  2. package/dist/constants.js +41 -1
  3. package/dist/dev-server-registry.d.ts +85 -0
  4. package/dist/dev-server-registry.js +120 -0
  5. package/dist/document-identity.d.ts +39 -0
  6. package/dist/document-identity.js +53 -0
  7. package/dist/edit-epoch.d.ts +36 -0
  8. package/dist/edit-epoch.js +40 -0
  9. package/dist/event-payloads.d.ts +24 -4
  10. package/dist/event-payloads.js +13 -1
  11. package/dist/findings.d.ts +62 -0
  12. package/dist/findings.js +75 -0
  13. package/dist/flow-types.d.ts +88 -0
  14. package/dist/flow-types.js +22 -0
  15. package/dist/impact.d.ts +176 -0
  16. package/dist/impact.js +36 -0
  17. package/dist/index.d.ts +8 -0
  18. package/dist/index.js +9 -0
  19. package/dist/instrumentation-gap.d.ts +59 -1
  20. package/dist/instrumentation-gap.js +0 -0
  21. package/dist/intent.d.ts +332 -0
  22. package/dist/intent.js +133 -0
  23. package/dist/journal.d.ts +33 -0
  24. package/dist/journal.js +20 -0
  25. package/dist/messages.d.ts +84 -10
  26. package/dist/messages.js +20 -0
  27. package/dist/net.d.ts +34 -0
  28. package/dist/net.js +86 -0
  29. package/dist/no-session-reason.d.ts +35 -0
  30. package/dist/no-session-reason.js +34 -0
  31. package/dist/notices.d.ts +79 -6
  32. package/dist/notices.js +83 -6
  33. package/dist/run-context.d.ts +122 -0
  34. package/dist/run-context.js +118 -0
  35. package/dist/schema/event-message.json +10 -0
  36. package/dist/schema/event-type.json +1 -0
  37. package/dist/schema/reticle-event.json +10 -0
  38. package/dist/schema/reticle-message.json +10 -0
  39. package/dist/security.d.ts +8 -2
  40. package/dist/security.js +37 -3
  41. package/dist/session-constants.d.ts +8 -0
  42. package/dist/session-constants.js +8 -0
  43. package/dist/source-constants.cjs +9 -0
  44. package/dist/source-constants.d.cts +4 -0
  45. package/dist/telemetry-license.d.ts +12 -0
  46. package/dist/telemetry-license.js +12 -0
  47. package/dist/telemetry-refusal.d.ts +94 -0
  48. package/dist/telemetry-refusal.js +61 -0
  49. package/dist/telemetry-session.d.ts +151 -2
  50. package/dist/telemetry-session.js +114 -0
  51. package/dist/telemetry.d.ts +167 -95
  52. package/dist/telemetry.js +46 -44
  53. package/dist/types.d.ts +9 -0
  54. package/dist/unreachable-notice.d.ts +19 -0
  55. package/dist/unreachable-notice.js +26 -0
  56. package/dist/verified-constants.d.ts +8 -0
  57. package/dist/verified-constants.js +10 -0
  58. package/package.json +6 -2
@@ -108,6 +108,7 @@ export declare const ReticleEventSchema: z.ZodObject<{
108
108
  readonly STATE_CHANGE: "state.change";
109
109
  readonly STORAGE_CHANGE: "storage.change";
110
110
  readonly PAGE_HEALTH: "page.health";
111
+ readonly CONTEXT_OPENED: "context.opened";
111
112
  readonly RENDER_COMMIT: "render.commit";
112
113
  readonly FOCUS_CHANGE: "focus.change";
113
114
  readonly FLOW_RECORDED: "flow.recorded";
@@ -138,10 +139,27 @@ export declare const ReticleEventSchema: z.ZodObject<{
138
139
  attribution: z.ZodOptional<z.ZodNativeEnum<{
139
140
  readonly WINDOW: "window";
140
141
  }>>;
142
+ /**
143
+ * The document this was observed under. Minted once per real document; a full navigation replaces
144
+ * both. Lets evidence from a superseded document be excluded rather than counted against an action
145
+ * taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
146
+ * "current" rather than "foreign" — see `isSameDocument`.
147
+ */
148
+ documentId: z.ZodOptional<z.ZodString>;
149
+ /**
150
+ * The round of source edits this was observed under — a counter the SDK advances once per applied
151
+ * hot update. A hot update replaces modules and re-renders INSIDE the same document, so
152
+ * `documentId` cannot see it; this is the edit-shaped half of the same question.
153
+ *
154
+ * Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
155
+ * rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
156
+ * update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
157
+ */
158
+ editEpoch: z.ZodOptional<z.ZodNumber>;
141
159
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
142
160
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
143
161
  }, "strip", z.ZodTypeAny, {
144
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
162
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
145
163
  t: number;
146
164
  sessionId: string;
147
165
  data: Record<string, unknown>;
@@ -149,14 +167,18 @@ export declare const ReticleEventSchema: z.ZodObject<{
149
167
  seq?: number | undefined;
150
168
  actionId?: string | undefined;
151
169
  attribution?: "window" | undefined;
170
+ documentId?: string | undefined;
171
+ editEpoch?: number | undefined;
152
172
  }, {
153
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
173
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
154
174
  t: number;
155
175
  sessionId: string;
156
176
  ref?: string | undefined;
157
177
  seq?: number | undefined;
158
178
  actionId?: string | undefined;
159
179
  attribution?: "window" | undefined;
180
+ documentId?: string | undefined;
181
+ editEpoch?: number | undefined;
160
182
  data?: Record<string, unknown> | undefined;
161
183
  }>;
162
184
  export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
@@ -309,6 +331,7 @@ export declare const EventMessageSchema: z.ZodObject<{
309
331
  readonly STATE_CHANGE: "state.change";
310
332
  readonly STORAGE_CHANGE: "storage.change";
311
333
  readonly PAGE_HEALTH: "page.health";
334
+ readonly CONTEXT_OPENED: "context.opened";
312
335
  readonly RENDER_COMMIT: "render.commit";
313
336
  readonly FOCUS_CHANGE: "focus.change";
314
337
  readonly FLOW_RECORDED: "flow.recorded";
@@ -339,10 +362,27 @@ export declare const EventMessageSchema: z.ZodObject<{
339
362
  attribution: z.ZodOptional<z.ZodNativeEnum<{
340
363
  readonly WINDOW: "window";
341
364
  }>>;
365
+ /**
366
+ * The document this was observed under. Minted once per real document; a full navigation replaces
367
+ * both. Lets evidence from a superseded document be excluded rather than counted against an action
368
+ * taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
369
+ * "current" rather than "foreign" — see `isSameDocument`.
370
+ */
371
+ documentId: z.ZodOptional<z.ZodString>;
372
+ /**
373
+ * The round of source edits this was observed under — a counter the SDK advances once per applied
374
+ * hot update. A hot update replaces modules and re-renders INSIDE the same document, so
375
+ * `documentId` cannot see it; this is the edit-shaped half of the same question.
376
+ *
377
+ * Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
378
+ * rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
379
+ * update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
380
+ */
381
+ editEpoch: z.ZodOptional<z.ZodNumber>;
342
382
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
343
383
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
344
384
  }, "strip", z.ZodTypeAny, {
345
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
385
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
346
386
  t: number;
347
387
  sessionId: string;
348
388
  data: Record<string, unknown>;
@@ -350,19 +390,23 @@ export declare const EventMessageSchema: z.ZodObject<{
350
390
  seq?: number | undefined;
351
391
  actionId?: string | undefined;
352
392
  attribution?: "window" | undefined;
393
+ documentId?: string | undefined;
394
+ editEpoch?: number | undefined;
353
395
  }, {
354
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
396
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
355
397
  t: number;
356
398
  sessionId: string;
357
399
  ref?: string | undefined;
358
400
  seq?: number | undefined;
359
401
  actionId?: string | undefined;
360
402
  attribution?: "window" | undefined;
403
+ documentId?: string | undefined;
404
+ editEpoch?: number | undefined;
361
405
  data?: Record<string, unknown> | undefined;
362
406
  }>;
363
407
  }, "strip", z.ZodTypeAny, {
364
408
  event: {
365
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
409
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
366
410
  t: number;
367
411
  sessionId: string;
368
412
  data: Record<string, unknown>;
@@ -370,17 +414,21 @@ export declare const EventMessageSchema: z.ZodObject<{
370
414
  seq?: number | undefined;
371
415
  actionId?: string | undefined;
372
416
  attribution?: "window" | undefined;
417
+ documentId?: string | undefined;
418
+ editEpoch?: number | undefined;
373
419
  };
374
420
  kind: "event";
375
421
  }, {
376
422
  event: {
377
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
423
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
378
424
  t: number;
379
425
  sessionId: string;
380
426
  ref?: string | undefined;
381
427
  seq?: number | undefined;
382
428
  actionId?: string | undefined;
383
429
  attribution?: "window" | undefined;
430
+ documentId?: string | undefined;
431
+ editEpoch?: number | undefined;
384
432
  data?: Record<string, unknown> | undefined;
385
433
  };
386
434
  kind: "event";
@@ -525,6 +573,7 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
525
573
  readonly STATE_CHANGE: "state.change";
526
574
  readonly STORAGE_CHANGE: "storage.change";
527
575
  readonly PAGE_HEALTH: "page.health";
576
+ readonly CONTEXT_OPENED: "context.opened";
528
577
  readonly RENDER_COMMIT: "render.commit";
529
578
  readonly FOCUS_CHANGE: "focus.change";
530
579
  readonly FLOW_RECORDED: "flow.recorded";
@@ -555,10 +604,27 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
555
604
  attribution: z.ZodOptional<z.ZodNativeEnum<{
556
605
  readonly WINDOW: "window";
557
606
  }>>;
607
+ /**
608
+ * The document this was observed under. Minted once per real document; a full navigation replaces
609
+ * both. Lets evidence from a superseded document be excluded rather than counted against an action
610
+ * taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
611
+ * "current" rather than "foreign" — see `isSameDocument`.
612
+ */
613
+ documentId: z.ZodOptional<z.ZodString>;
614
+ /**
615
+ * The round of source edits this was observed under — a counter the SDK advances once per applied
616
+ * hot update. A hot update replaces modules and re-renders INSIDE the same document, so
617
+ * `documentId` cannot see it; this is the edit-shaped half of the same question.
618
+ *
619
+ * Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
620
+ * rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
621
+ * update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
622
+ */
623
+ editEpoch: z.ZodOptional<z.ZodNumber>;
558
624
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
559
625
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
560
626
  }, "strip", z.ZodTypeAny, {
561
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
627
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
562
628
  t: number;
563
629
  sessionId: string;
564
630
  data: Record<string, unknown>;
@@ -566,19 +632,23 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
566
632
  seq?: number | undefined;
567
633
  actionId?: string | undefined;
568
634
  attribution?: "window" | undefined;
635
+ documentId?: string | undefined;
636
+ editEpoch?: number | undefined;
569
637
  }, {
570
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
638
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
571
639
  t: number;
572
640
  sessionId: string;
573
641
  ref?: string | undefined;
574
642
  seq?: number | undefined;
575
643
  actionId?: string | undefined;
576
644
  attribution?: "window" | undefined;
645
+ documentId?: string | undefined;
646
+ editEpoch?: number | undefined;
577
647
  data?: Record<string, unknown> | undefined;
578
648
  }>;
579
649
  }, "strip", z.ZodTypeAny, {
580
650
  event: {
581
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
651
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
582
652
  t: number;
583
653
  sessionId: string;
584
654
  data: Record<string, unknown>;
@@ -586,17 +656,21 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
586
656
  seq?: number | undefined;
587
657
  actionId?: string | undefined;
588
658
  attribution?: "window" | undefined;
659
+ documentId?: string | undefined;
660
+ editEpoch?: number | undefined;
589
661
  };
590
662
  kind: "event";
591
663
  }, {
592
664
  event: {
593
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
665
+ type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
594
666
  t: number;
595
667
  sessionId: string;
596
668
  ref?: string | undefined;
597
669
  seq?: number | undefined;
598
670
  actionId?: string | undefined;
599
671
  attribution?: "window" | undefined;
672
+ documentId?: string | undefined;
673
+ editEpoch?: number | undefined;
600
674
  data?: Record<string, unknown> | undefined;
601
675
  };
602
676
  kind: "event";
package/dist/messages.js CHANGED
@@ -2,8 +2,11 @@ import { z } from 'zod';
2
2
  import { EventAttribution, EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants.js';
3
3
  import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
4
4
  import { MAX_WIRE_REDACT_KEYS, MAX_WIRE_REDACT_KEY_LENGTH } from './redaction.js';
5
+ import { DOCUMENT_ID_LENGTH } from './document-identity.js';
6
+ import { NO_EDITS_OBSERVED } from './edit-epoch.js';
5
7
  const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
6
8
  const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
9
+ const documentIdSchema = z.string().min(1).max(DOCUMENT_ID_LENGTH);
7
10
  /**
8
11
  * Live-control: the narrowed payload of a HUMAN_CONTROL event. The server safeParses
9
12
  * `event.data` against this at the inbound boundary (unknown → narrowed; never `any`).
@@ -62,6 +65,23 @@ export const ReticleEventSchema = z.object({
62
65
  actionId: refSchema.optional(),
63
66
  /** How `actionId` was derived. Present iff `actionId` is. */
64
67
  attribution: z.nativeEnum(EventAttribution).optional(),
68
+ /**
69
+ * The document this was observed under. Minted once per real document; a full navigation replaces
70
+ * both. Lets evidence from a superseded document be excluded rather than counted against an action
71
+ * taken now. Optional for back-compat with SDKs that predate it, which is why absence is read as
72
+ * "current" rather than "foreign" — see `isSameDocument`.
73
+ */
74
+ documentId: documentIdSchema.optional(),
75
+ /**
76
+ * The round of source edits this was observed under — a counter the SDK advances once per applied
77
+ * hot update. A hot update replaces modules and re-renders INSIDE the same document, so
78
+ * `documentId` cannot see it; this is the edit-shaped half of the same question.
79
+ *
80
+ * Optional, and absent while nothing has hot-updated, which is why absence is read as "current"
81
+ * rather than "foreign" — see `isSameEditEpoch`. Most pages have no channel that could report an
82
+ * update at all, so a stamp of `NO_EDITS_OBSERVED` would be wire spent on the word "unknown".
83
+ */
84
+ editEpoch: z.number().int().min(NO_EDITS_OBSERVED).optional(),
65
85
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
66
86
  data: z.record(z.unknown()).default({}),
67
87
  });
package/dist/net.d.ts CHANGED
@@ -79,3 +79,37 @@ export type DevToolingChannel = (typeof DevToolingChannel)[keyof typeof DevTooli
79
79
  * exclusion is disclosed alongside the verdict.
80
80
  */
81
81
  export declare function isDevToolingUrl(url: string | undefined): boolean;
82
+ /**
83
+ * Is this call to somebody ELSE's site — an analytics beacon, a vendor SDK bootstrap, a CDN ping?
84
+ *
85
+ * The axis a verdict needs and never had. A contradiction is a statement about the app under test,
86
+ * and a failed third-party request says nothing about whether the caller's action worked: reported
87
+ * from several apps, any analytics package installed was enough to grade a correct drive
88
+ * `contradicted`, and on one app every assertion came back that way forever.
89
+ *
90
+ * Deliberately NOT a vendor list. `DevToolingChannel` above states why a list is the wrong shape
91
+ * here: widening it until it can swallow an app endpoint turns a false negative into a false GREEN.
92
+ * An origin comparison has no list to widen — it asks one structural question about the page itself.
93
+ *
94
+ * Ports are deliberately ignored: a dev app on :3000 talking to its API on :8787 is the ordinary
95
+ * local setup, and grading that as a stranger's traffic would silence the detector on our own bench.
96
+ *
97
+ * Absence of `appUrl` disables the axis entirely — the same rule the document scoping follows, so a
98
+ * caller who cannot say which page is under test gets exactly the behaviour it had before this.
99
+ */
100
+ export declare function isThirdPartyUrl(url: string | undefined, appUrl: string | undefined): boolean;
101
+ /**
102
+ * The unredacted URL, kept so a grader can match `urlContains` against the path the app actually
103
+ * requested. `url` is what is rendered to the agent and stored as the displayed value; this field
104
+ * is the match haystack and must not be projected back into a transcript.
105
+ *
106
+ * Redaction runs at emit time and there is otherwise no raw copy. Public REST segments that happen
107
+ * to follow a sensitive name (`/auth/token/refresh-context`, `/verify/CERT_INFY_10`) are rewritten
108
+ * to `[REDACTED]`, so matching only `url` reports "the request did not happen".
109
+ */
110
+ export declare const URL_RAW = "urlRaw";
111
+ /**
112
+ * The URL a filter or predicate should match against: the raw request when the observer kept one,
113
+ * otherwise the displayed (possibly redacted) `url`.
114
+ */
115
+ export declare function urlForMatch(data: Record<string, unknown>): string;
package/dist/net.js CHANGED
@@ -82,3 +82,89 @@ export function isDevToolingUrl(url) {
82
82
  return false;
83
83
  return DEV_TOOLING_PATTERNS.some((pattern) => url.includes(pattern));
84
84
  }
85
+ /**
86
+ * Schemes whose "host" is not a host at all — the app's own machinery, never somebody else's server.
87
+ *
88
+ * `ipc://` is a desktop command (see IPC_URL_SCHEME), `data:`/`blob:` are bytes the page itself made.
89
+ * None of them can be third-party, so the axis below declines to judge them.
90
+ */
91
+ const FIRST_PARTY_PROTOCOLS = ['http:', 'https:'];
92
+ /** How many trailing labels of a hostname stand in for the registrable domain. */
93
+ const REGISTRABLE_LABELS = 2;
94
+ function hostOf(url, base) {
95
+ try {
96
+ const parsed = new URL(url, base);
97
+ if (!FIRST_PARTY_PROTOCOLS.includes(parsed.protocol))
98
+ return undefined;
99
+ return parsed.hostname.toLowerCase();
100
+ }
101
+ catch {
102
+ return undefined;
103
+ }
104
+ }
105
+ /**
106
+ * The registrable domain, approximated by the last two labels.
107
+ *
108
+ * ponytail: no public-suffix list. `foo.co.uk` and `bar.co.uk` read as the same site, which keeps a
109
+ * third-party call classified as first-party — i.e. it preserves today's behaviour rather than
110
+ * inventing a new one. The opposite approximation (hostname equality alone) would have broken the
111
+ * far more common `app.example.com` calling `api.example.com`, which is the app's OWN backend, and
112
+ * silenced the detector where it earns its keep. Swap in a PSL if a real app is ever mis-graded.
113
+ */
114
+ function registrableDomain(host) {
115
+ const labels = host.split('.');
116
+ if (labels.length <= REGISTRABLE_LABELS)
117
+ return host;
118
+ // An IPv4 literal has four labels and no registrable domain — compare it whole.
119
+ if (/^[0-9.]+$/.test(host))
120
+ return host;
121
+ return labels.slice(-REGISTRABLE_LABELS).join('.');
122
+ }
123
+ /**
124
+ * Is this call to somebody ELSE's site — an analytics beacon, a vendor SDK bootstrap, a CDN ping?
125
+ *
126
+ * The axis a verdict needs and never had. A contradiction is a statement about the app under test,
127
+ * and a failed third-party request says nothing about whether the caller's action worked: reported
128
+ * from several apps, any analytics package installed was enough to grade a correct drive
129
+ * `contradicted`, and on one app every assertion came back that way forever.
130
+ *
131
+ * Deliberately NOT a vendor list. `DevToolingChannel` above states why a list is the wrong shape
132
+ * here: widening it until it can swallow an app endpoint turns a false negative into a false GREEN.
133
+ * An origin comparison has no list to widen — it asks one structural question about the page itself.
134
+ *
135
+ * Ports are deliberately ignored: a dev app on :3000 talking to its API on :8787 is the ordinary
136
+ * local setup, and grading that as a stranger's traffic would silence the detector on our own bench.
137
+ *
138
+ * Absence of `appUrl` disables the axis entirely — the same rule the document scoping follows, so a
139
+ * caller who cannot say which page is under test gets exactly the behaviour it had before this.
140
+ */
141
+ export function isThirdPartyUrl(url, appUrl) {
142
+ if (url === undefined || appUrl === undefined)
143
+ return false;
144
+ const target = hostOf(url, appUrl);
145
+ const app = hostOf(appUrl, appUrl);
146
+ if (target === undefined || app === undefined)
147
+ return false;
148
+ return registrableDomain(target) !== registrableDomain(app);
149
+ }
150
+ /**
151
+ * The unredacted URL, kept so a grader can match `urlContains` against the path the app actually
152
+ * requested. `url` is what is rendered to the agent and stored as the displayed value; this field
153
+ * is the match haystack and must not be projected back into a transcript.
154
+ *
155
+ * Redaction runs at emit time and there is otherwise no raw copy. Public REST segments that happen
156
+ * to follow a sensitive name (`/auth/token/refresh-context`, `/verify/CERT_INFY_10`) are rewritten
157
+ * to `[REDACTED]`, so matching only `url` reports "the request did not happen".
158
+ */
159
+ export const URL_RAW = 'urlRaw';
160
+ /**
161
+ * The URL a filter or predicate should match against: the raw request when the observer kept one,
162
+ * otherwise the displayed (possibly redacted) `url`.
163
+ */
164
+ export function urlForMatch(data) {
165
+ const raw = data[URL_RAW];
166
+ if ('string' === typeof raw && 0 < raw.length)
167
+ return raw;
168
+ const url = data['url'];
169
+ return 'string' === typeof url ? url : '';
170
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * WHY an install has produced no session — the closed vocabulary, on its own.
3
+ *
4
+ * Split out of telemetry.ts when that file crossed the 1000-line cap. It belongs apart regardless:
5
+ * telemetry.ts is the wire contract, and this is the taxonomy the no-session DIAGNOSIS owns, read
6
+ * by `explainNoSession`, the session manager and the refusal reporter alike.
7
+ *
8
+ * `no_session` is the largest refusal cohort, and on its own it is a set difference: the daemon
9
+ * started, no app connected, and nothing says which of several opposite situations that was.
10
+ * "Restarted the dev server and it still did not connect" and "never started the app" need
11
+ * opposite fixes and arrived as the same silence (#615).
12
+ *
13
+ * Derived from `explainNoSession`'s branches rather than classified beside them, so the code and
14
+ * the sentence the user is shown cannot drift apart. A reason describing a diagnosis nobody
15
+ * received would be worse than none.
16
+ */
17
+ export declare const NoSessionReason: {
18
+ /** Connected before; the session that went was a pooled lease that aged out. */
19
+ readonly LEASE_EXPIRED: "lease_expired";
20
+ /** Connected before; the tab was closed, navigated away, or hard-reloaded. */
21
+ readonly TAB_GONE: "tab_gone";
22
+ /** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
23
+ readonly APP_NOT_REOPENED: "app_not_reopened";
24
+ /** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
25
+ readonly CONFIG_ELSEWHERE: "config_elsewhere";
26
+ /** Nothing listening on the scanned ports AND no config here. The weakest position, and common. */
27
+ readonly NO_LISTENER_NO_CONFIG: "no_listener_no_config";
28
+ /** Nothing listening, but the project is wired. The dev server is the missing half. */
29
+ readonly NO_LISTENER: "no_listener";
30
+ /** Something is listening, but there is no config in this directory. */
31
+ readonly NO_CONFIG: "no_config";
32
+ /** Wired, listening, and still nothing arrived: the SDK is not reaching this daemon. */
33
+ readonly SDK_NOT_REACHING_DAEMON: "sdk_not_reaching_daemon";
34
+ };
35
+ export type NoSessionReason = (typeof NoSessionReason)[keyof typeof NoSessionReason];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * WHY an install has produced no session — the closed vocabulary, on its own.
3
+ *
4
+ * Split out of telemetry.ts when that file crossed the 1000-line cap. It belongs apart regardless:
5
+ * telemetry.ts is the wire contract, and this is the taxonomy the no-session DIAGNOSIS owns, read
6
+ * by `explainNoSession`, the session manager and the refusal reporter alike.
7
+ *
8
+ * `no_session` is the largest refusal cohort, and on its own it is a set difference: the daemon
9
+ * started, no app connected, and nothing says which of several opposite situations that was.
10
+ * "Restarted the dev server and it still did not connect" and "never started the app" need
11
+ * opposite fixes and arrived as the same silence (#615).
12
+ *
13
+ * Derived from `explainNoSession`'s branches rather than classified beside them, so the code and
14
+ * the sentence the user is shown cannot drift apart. A reason describing a diagnosis nobody
15
+ * received would be worse than none.
16
+ */
17
+ export const NoSessionReason = {
18
+ /** Connected before; the session that went was a pooled lease that aged out. */
19
+ LEASE_EXPIRED: 'lease_expired',
20
+ /** Connected before; the tab was closed, navigated away, or hard-reloaded. */
21
+ TAB_GONE: 'tab_gone',
22
+ /** This project has connected before, but not to this daemon run. Usually a restart with no reopen. */
23
+ APP_NOT_REOPENED: 'app_not_reopened',
24
+ /** A `.reticle.json` exists OUTSIDE this daemon's directory: a scope problem, not an install one. */
25
+ CONFIG_ELSEWHERE: 'config_elsewhere',
26
+ /** Nothing listening on the scanned ports AND no config here. The weakest position, and common. */
27
+ NO_LISTENER_NO_CONFIG: 'no_listener_no_config',
28
+ /** Nothing listening, but the project is wired. The dev server is the missing half. */
29
+ NO_LISTENER: 'no_listener',
30
+ /** Something is listening, but there is no config in this directory. */
31
+ NO_CONFIG: 'no_config',
32
+ /** Wired, listening, and still nothing arrived: the SDK is not reaching this daemon. */
33
+ SDK_NOT_REACHING_DAEMON: 'sdk_not_reaching_daemon',
34
+ };
package/dist/notices.d.ts CHANGED
@@ -30,10 +30,27 @@ export declare const BUFFER_EVICTION_WARNING = "event buffer evicted older event
30
30
  * Thrown when a tool needs a live browser session and none is connected. Names the #1 real cause in a
31
31
  * multi-repo / multi-agent setup — a PORT MISMATCH between the app's SDK and the daemon — so the agent
32
32
  * checks the wiring instead of only the "is the SDK enabled?" dead end.
33
+ *
34
+ * It used to end by naming `reticle_wait_ready`, which is retired (see RETIRED_FROM_SURFACE) and
35
+ * answers `unknown tool`. This is the most-thrown error in the product — `resolve` raises it on
36
+ * every tool call while nothing is connected — so the one sentence carrying the ACTION sent the
37
+ * reader to a tool that does not exist, at the moment they had least idea what to do next.
38
+ *
39
+ * `reticle_sessions` is the live answer and a strictly better one: it returns the ranked diagnosis
40
+ * (which of the causes above this actually is, plus the port scan and a next action) rather than
41
+ * blocking and telling you nothing. It is the same tool `#unknownSessionError` already points at,
42
+ * so the two no-session paths now agree.
33
43
  */
34
- export declare const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port \u2014 a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. reticle_wait_ready blocks briefly for a session to appear.";
44
+ export declare const NO_SESSION_CONNECTED_ERROR = "no browser session connected. Two things to check: (1) your app is running with @reticlehq/browser enabled, and (2) it points at THIS daemon's port \u2014 a mismatch between the app's reticle({ port }) / VITE_RETICLE_WS_URL and the daemon's RETICLE_PORT is the usual cause. Call reticle_sessions for the diagnosis \u2014 it names which of these it is, and what to do next \u2014 rather than retrying this call.";
35
45
  /** Surfaced on act/assert results when the target tab is throttled. */
36
46
  export declare const THROTTLED_WARNING = "tab throttled; timer/rAF/pointer gestures may silently no-op; refocus before driving";
47
+ /**
48
+ * Prefixed onto a wait/assert miss when the session is throttled. A background tab is starved by
49
+ * the browser, so a timeout there is not evidence the UI is absent — it may never have rendered.
50
+ * `inconclusive` on the verdict (this string) is what stops that miss being graded as a product
51
+ * failure. The CLI escape hatch is named second; an MCP-only agent has no shell.
52
+ */
53
+ export declare const THROTTLED_STARVED_NOTE: string;
37
54
  /**
38
55
  * Pushed to the panel when the last agent's MCP connection drops — the agent (any of
39
56
  * Codex/OpenCode/Claude/Hermes) has stopped or is waiting on you. Tells the human, who is
@@ -63,9 +80,65 @@ export declare const AGENT_ASK_NOTICE = "Agent needs your input \u2014 answer in
63
80
  */
64
81
  export declare const YIELD_WITHOUT_SESSION_NOTE: string;
65
82
  /**
66
- * Actionable companion to THROTTLED_WARNING. Surfaced on act/assert results and
67
- * reticle_sessions rows when a tab is hidden/throttled and may be un-focusable/un-recoverable from
68
- * the in-page SDK + CDP path. Points at the `reticle drive` escape hatch (a guaranteed scriptable
69
- * context). Reticle cannot bring such a tab to front or recover it, so it names the limit instead.
83
+ * What leasing COSTS, said once and appended to every recommendation that offers it.
84
+ *
85
+ * A lease is a separate pooled context. It is the highest-value path in the product for autonomous
86
+ * work — and it is invisible to the person sitting in front of the app, because the HUD lives in
87
+ * THEIR tab. Recommending it without saying so produced exactly the failure it invites: an agent
88
+ * took the advice, drove fifteen calls into a context nobody could see, and the developer watching
89
+ * an empty HUD asked why nothing was running. The product looked broken while working correctly.
90
+ *
91
+ * The tradeoff is the whole content of the hint. An agent that knows a human is watching should
92
+ * spend a slower tab to stay visible; one working alone should lease and not think about it.
93
+ */
94
+ export declare const LEASE_IS_INVISIBLE_NOTE = "note that a lease is a SEPARATE context: the human watching this tab sees nothing of what you do there, so prefer this tab while someone is following along";
95
+ /**
96
+ * A tab that is HIDDEN — backgrounded, or in another window.
97
+ *
98
+ * The genuinely risky case, and the one this recommendation was written for. A background tab has
99
+ * its timers and rAF clamped hard, so synthetic events can land on a page that never advances, and
100
+ * Reticle cannot bring it to the front. Naming the limit is the honest move.
101
+ *
102
+ * Names the escape hatch the AGENT can take first (`reticle_lease` through `reticle_run`, since
103
+ * lease is not on the default surface) and leaves `reticle drive` as the human-side equivalent: an
104
+ * MCP-only agent has no shell, so a CLI sentence is advice it cannot follow.
105
+ */
106
+ /**
107
+ * A DESKTOP window that has gone to the background, which is a different problem with a different fix.
108
+ *
109
+ * The web answer — acquire a lease, or run `reticle drive <url>` — is unavailable here and saying it
110
+ * is worse than saying nothing. A lease opens a headless BROWSER context; an Electron or Tauri app's
111
+ * window IS the client, and a browser pointed at the same dev-server URL is a different program with
112
+ * no main process, no preload and no Rust commands. Driven on MarkText, a shipped Electron editor:
113
+ * its window went behind, the session reported hidden+throttled, and the only advice offered was the
114
+ * one thing that could not be done — while the thing that works, bringing the window forward, went
115
+ * unsaid.
116
+ *
117
+ * No `reticle_lease` and no `reticle drive` in this sentence, deliberately. Both are checked by test.
118
+ */
119
+ export declare const DESKTOP_WINDOW_BACKGROUNDED = "this app window is in the background, and a backgrounded webview clamps its timers and rAF \u2014 a synthetic action can land on a page that never advances. Bring the app window to the front and retry. A lease is NOT the answer for a desktop app: it opens a browser context, which has none of this app's IPC or commands.";
120
+ export declare const HIDDEN_TAB_RECOMMENDATION: string;
121
+ /**
122
+ * A tab that is NOT hidden but has gone quiet — the `throttled` flag without `hidden`.
123
+ *
124
+ * Worth being exact, because the flag's name oversells it: `throttled` is `hidden || stale`, and
125
+ * stale only means no health heartbeat arrived inside the window. For a tab that is not hidden that
126
+ * usually means nothing worse than a quiet page, and such a tab is very often driveable.
127
+ *
128
+ * Split out because the old single message treated this as equivalent to hidden and it is not.
129
+ * Measured in the field: a session flagged throttled took a sign-in and two clean net-grade verdicts
130
+ * with no retries, while the recommendation had already sent the agent into a lease the watching
131
+ * human could not see. One flag produced advice that cost the product's main trust surface and
132
+ * bought nothing.
133
+ *
134
+ * So this reports the uncertainty honestly — it MAY be slow, timing-sensitive work is what suffers —
135
+ * and offers the precise instrument for that (`refuseWhenThrottled`) rather than a different
136
+ * browser.
137
+ */
138
+ export declare const THROTTLED_TAB_RECOMMENDATION: string;
139
+ /**
140
+ * @deprecated Use {@link HIDDEN_TAB_RECOMMENDATION} or {@link THROTTLED_TAB_RECOMMENDATION}.
141
+ * Retained so an older consumer pinned to this name still compiles; it is the hidden-tab wording,
142
+ * which is the case the single message was actually correct for.
70
143
  */
71
- export declare const UNSCRIPTABLE_TAB_RECOMMENDATION = "tab hidden/throttled and may be un-focusable from here; refocus it, or run `reticle drive <url>` for a guaranteed scriptable context";
144
+ export declare const UNSCRIPTABLE_TAB_RECOMMENDATION: string;