@reticlehq/core 3.2.0 → 3.3.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 (77) hide show
  1. package/dist/artifacts/flow-composition.d.ts +3 -2
  2. package/dist/artifacts/flow-constants.d.ts +49 -2
  3. package/dist/artifacts/flow-constants.js +49 -2
  4. package/dist/artifacts/flow-expect-flat.d.ts +260 -0
  5. package/dist/artifacts/flow-expect-flat.js +284 -0
  6. package/dist/artifacts/flow-mutation-target.d.ts +0 -1
  7. package/dist/artifacts/flow-mutation-target.js +26 -2
  8. package/dist/artifacts/flow-step-tool.d.ts +2 -0
  9. package/dist/artifacts/flow-types.d.ts +1074 -1228
  10. package/dist/artifacts/flow-types.js +96 -140
  11. package/dist/artifacts/impact.d.ts +48 -20
  12. package/dist/artifacts/impact.js +11 -0
  13. package/dist/artifacts/journal.d.ts +33 -6
  14. package/dist/artifacts/journal.js +13 -0
  15. package/dist/hooks/hook-events.d.ts +18 -18
  16. package/dist/hud-entry.d.ts +9 -0
  17. package/dist/hud-entry.js +9 -0
  18. package/dist/identity/source-constants.d.ts +11 -0
  19. package/dist/identity/source-constants.js +11 -0
  20. package/dist/index.d.ts +8 -0
  21. package/dist/index.js +24 -1
  22. package/dist/onboarding.d.ts +2 -2
  23. package/dist/realm/registry.d.ts +0 -8
  24. package/dist/realm/registry.js +1 -11
  25. package/dist/schema/event-message.json +3 -1
  26. package/dist/schema/event-payloads.json +69 -0
  27. package/dist/schema/event-type.json +3 -1
  28. package/dist/schema/reticle-event.json +3 -1
  29. package/dist/schema/reticle-message.json +3 -1
  30. package/dist/source-constants.cjs +1 -0
  31. package/dist/source-constants.d.cts +1 -0
  32. package/dist/telemetry-feedback.d.ts +6 -6
  33. package/dist/telemetry-refusal.d.ts +2 -2
  34. package/dist/telemetry-session.d.ts +25 -2
  35. package/dist/telemetry-session.js +13 -0
  36. package/dist/telemetry.d.ts +121 -94
  37. package/dist/verdict/consequence.d.ts +10 -0
  38. package/dist/verdict/consequence.js +13 -0
  39. package/dist/verdict/intent.d.ts +36 -12
  40. package/dist/verdict/intent.js +66 -10
  41. package/dist/verdict/predicate-tree.d.ts +47 -0
  42. package/dist/verdict/predicate-tree.js +146 -0
  43. package/dist/verdict/predicate.d.ts +129 -0
  44. package/dist/verdict/predicate.js +394 -0
  45. package/dist/verdict/property-assertion.d.ts +191 -0
  46. package/dist/verdict/property-assertion.js +42 -0
  47. package/dist/verdict/security.js +16 -4
  48. package/dist/verdict/verdict-attribution.d.ts +52 -0
  49. package/dist/verdict/verdict-attribution.js +87 -0
  50. package/dist/verdict/verification-run.d.ts +98 -84
  51. package/dist/verdict/verification-run.js +8 -1
  52. package/dist/verdict/verified-constants.d.ts +9 -0
  53. package/dist/verdict/verified-constants.js +9 -0
  54. package/dist/wire/constants/constants.d.ts +20 -98
  55. package/dist/wire/constants/constants.js +22 -97
  56. package/dist/wire/constants/discovery.d.ts +25 -0
  57. package/dist/wire/constants/discovery.js +25 -0
  58. package/dist/wire/constants/event-types.d.ts +122 -0
  59. package/dist/wire/constants/event-types.js +121 -0
  60. package/dist/wire/constants/hud-controls.d.ts +19 -0
  61. package/dist/wire/constants/hud-controls.js +95 -0
  62. package/dist/wire/constants/hud-use.d.ts +27 -0
  63. package/dist/wire/constants/hud-use.js +24 -0
  64. package/dist/wire/constants/session-constants.d.ts +10 -0
  65. package/dist/wire/constants/session-constants.js +10 -0
  66. package/dist/wire/event-payloads.d.ts +66 -10
  67. package/dist/wire/event-payloads.js +18 -1
  68. package/dist/wire/messages.d.ts +89 -48
  69. package/dist/wire/messages.js +17 -0
  70. package/dist/wire/net.d.ts +18 -0
  71. package/dist/wire/net.js +24 -0
  72. package/dist/wire/state-select.d.ts +2 -1
  73. package/dist/wire/state-select.js +56 -3
  74. package/dist/wire/toon.js +28 -7
  75. package/dist/wire/types.d.ts +91 -66
  76. package/dist/wire/types.js +23 -1
  77. package/package.json +5 -1
@@ -202,7 +202,14 @@ export const RunFlowResultSchema = z.object({
202
202
  });
203
203
  /** A standalone assertion not tied to a flow. `evidence` is opaque (narrowed per kind by the caller). */
204
204
  export const RunCheckSchema = z.object({
205
- kind: z.preprocess((given) => ('string' === typeof given ? (OLD_CHECK_KIND_SPELLING[given] ?? given) : given), z.nativeEnum(PredicateKind)),
205
+ /**
206
+ * Which source of truth answering this claim required.
207
+ *
208
+ * Optional, because a check folded from a journal written before the kind was recorded has none,
209
+ * and the only alternatives are refusing the whole run or filling in a kind nobody observed. An
210
+ * absent field says nobody wrote it down; a present one is what the predicate actually read.
211
+ */
212
+ kind: z.preprocess((given) => ('string' === typeof given ? (OLD_CHECK_KIND_SPELLING[given] ?? given) : given), z.nativeEnum(PredicateKind).optional()),
206
213
  predicate: z.string(),
207
214
  status: z.preprocess((given) => ('string' === typeof given ? (OLD_CHECK_STATUS_SPELLING[given] ?? given) : given), z.nativeEnum(Verified)),
208
215
  evidence: z.unknown().optional(),
@@ -61,6 +61,15 @@ export declare const VerifiedReason: {
61
61
  * to produce the same empty answer. Saying `no` to the second blames the app for a gap in the
62
62
  * tooling, and is the confident wrong answer this whole mechanism exists to remove.
63
63
  */
64
+ /**
65
+ * The page SDK and the daemon are on different wire contracts, so the evidence behind this claim
66
+ * cannot be trusted -- `reticle_session` already warns that under skew "dispatched/settled may be
67
+ * silent no-ops", which is a statement about the EVIDENCE, not about the app.
68
+ *
69
+ * UNKNOWN rather than NO, because nothing was disproved. Reported from the field as a `yes` with
70
+ * exit 0 printed beside an evidence block that named the skew in the same payload.
71
+ */
72
+ readonly VERSION_SKEW: "version_skew";
64
73
  readonly CAPABILITY_ABSENT: "capability-absent";
65
74
  /** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
66
75
  readonly INCONCLUSIVE: "inconclusive";
@@ -60,6 +60,15 @@ export const VerifiedReason = {
60
60
  * to produce the same empty answer. Saying `no` to the second blames the app for a gap in the
61
61
  * tooling, and is the confident wrong answer this whole mechanism exists to remove.
62
62
  */
63
+ /**
64
+ * The page SDK and the daemon are on different wire contracts, so the evidence behind this claim
65
+ * cannot be trusted -- `reticle_session` already warns that under skew "dispatched/settled may be
66
+ * silent no-ops", which is a statement about the EVIDENCE, not about the app.
67
+ *
68
+ * UNKNOWN rather than NO, because nothing was disproved. Reported from the field as a `yes` with
69
+ * exit 0 printed beside an evidence block that named the skew in the same payload.
70
+ */
71
+ VERSION_SKEW: 'version_skew',
63
72
  CAPABILITY_ABSENT: 'capability-absent',
64
73
  /** The assertion was never EVALUATED — under-specified call, or nothing instrumented to read. */
65
74
  INCONCLUSIVE: 'inconclusive',
@@ -331,6 +331,14 @@ export declare const ReticleDir: {
331
331
  readonly RUNS_SUBDIR: "runs";
332
332
  /** fail-to-pass bug capsules —.reticle/capsules/<id>.json (a minimal failing flow + its evidence). */
333
333
  readonly CAPSULES_SUBDIR: "capsules";
334
+ /**
335
+ * Where a feedback report refused delivery is copied — .reticle/feedback/.
336
+ *
337
+ * Named here rather than at the writer because the partition over this object is what decides
338
+ * whether a name Reticle creates is committed, ignored, or swept. It was spelled as a free string
339
+ * in three separate files, so the guard could not see it and nobody was ever asked.
340
+ */
341
+ readonly FEEDBACK_SUBDIR: "feedback";
334
342
  /** durable causal journal —.reticle/sessions/<id>/{events,actions}.jsonl (the substrate). */
335
343
  readonly SESSIONS_SUBDIR: "sessions";
336
344
  /** append-only event ledger inside a session dir (one ReticleEvent per line). */
@@ -390,6 +398,16 @@ export declare const ReticleDir: {
390
398
  */
391
399
  readonly PAIRING_TOKEN_FILE: "pairing-token";
392
400
  };
401
+ /**
402
+ * The names INSIDE `.reticle/intent/` — kept apart from `ReticleDir`, which lists what `.reticle/`
403
+ * itself holds and is what the retention tiers classify.
404
+ */
405
+ export declare const IntentDir: {
406
+ /** One per subject: `.reticle/intent/<subject>/intent.json`. A flow's name is its subject. */
407
+ readonly SHARD_FILE: "intent.json";
408
+ /** Derived from the shards: `.reticle/intent/index.json`, one line per intent. */
409
+ readonly INDEX_FILE: "index.json";
410
+ };
393
411
  /**
394
412
  * Structured reasons a screenshot/visual-diff could not produce a verdict (never
395
413
  * thrown as free strings). The visual layer is OPT-IN and CDP/Playwright-driven — it is NEVER
@@ -445,110 +463,14 @@ export declare const ContractReadError: {
445
463
  readonly MALFORMED: "contract-malformed";
446
464
  };
447
465
  export type ContractReadError = (typeof ContractReadError)[keyof typeof ContractReadError];
466
+ import { EventType } from './event-types.js';
467
+ export { EventType };
448
468
  /** Bounds for the per-session ring buffer. */
449
469
  export declare const RING_BUFFER_DEFAULTS: {
450
470
  readonly MAX_EVENTS: 2000;
451
471
  readonly MAX_AGE_MS: 60000;
452
472
  readonly MAX_BYTES: number;
453
473
  };
454
- /** Normalized event types pushed into the ring buffer. */
455
- export declare const EventType: {
456
- readonly DOM_ADDED: "dom.added";
457
- readonly DOM_REMOVED: "dom.removed";
458
- readonly DOM_ATTR: "dom.attr";
459
- readonly DOM_TEXT: "dom.text";
460
- readonly NET_REQUEST: "net.request";
461
- readonly NET_PENDING: "net.pending";
462
- /** An SSE (EventSource) or WebSocket frame — a message on a long-lived streaming connection. */
463
- readonly NET_STREAM: "net.stream";
464
- /** A web-perf metric a screenshot can't verify: LCP, cumulative layout shift, or a long task. */
465
- readonly PERF: "perf";
466
- readonly ROUTE_CHANGE: "route.change";
467
- readonly CONSOLE_LOG: "console.log";
468
- readonly CONSOLE_WARN: "console.warn";
469
- readonly CONSOLE_ERROR: "console.error";
470
- readonly CONSOLE_INFO: "console.info";
471
- readonly CONSOLE_DEBUG: "console.debug";
472
- readonly ERROR_UNCAUGHT: "error.uncaught";
473
- readonly VISIBLE_SHOWN: "visible.shown";
474
- readonly ANIM_START: "anim.start";
475
- readonly ANIM_END: "anim.end";
476
- readonly SCROLL_POSITION: "scroll.position";
477
- readonly REVEAL_SHOWN: "reveal.shown";
478
- readonly SIGNAL: "signal";
479
- readonly STATE_CHANGE: "state.change";
480
- /** a write to localStorage/sessionStorage/cookies — `data: { area, key, old?, new? }` (values redacted). */
481
- readonly STORAGE_CHANGE: "storage.change";
482
- /** page-level visibility/focus health (distinct from element-level VISIBLE_*). */
483
- readonly PAGE_HEALTH: "page.health";
484
- /**
485
- * synthetic: the page called window.open, so the consequence of what was just clicked may live in
486
- * another browsing context this one cannot observe (an OAuth popup is the archetype).
487
- * `data: { href }` — the URL the page asked to open, when it named one.
488
- */
489
- readonly CONTEXT_OPENED: "context.opened";
490
- /**
491
- * The app opened a native `alert`/`confirm`/`prompt` while Reticle was driving it.
492
- *
493
- * Recorded because Reticle ANSWERS these rather than letting them block — a native dialog halts
494
- * the main thread, and the SDK's own message pump is on that thread, so one `confirm` behind a
495
- * driven click made the tab permanently unresponsive with no recovery from inside the session.
496
- * Answering silently would trade a wedge for an invisible one, so the question the app asked, and
497
- * the answer given, ride out as an event.
498
- */
499
- readonly DIALOG_OPENED: "dialog.opened";
500
- /** aggregated React commits over a throttle window (dev builds) — `data: { commits }`. Commit storms /
501
- * wasted re-renders show up here without a per-render flood. */
502
- readonly RENDER_COMMIT: "render.commit";
503
- /** element focus moved — `data: { to, from, toBody }`. Focus dropping to body after an act is a regression. */
504
- readonly FOCUS_CHANGE: "focus.change";
505
- /** browser → bridge: a human recording compiled in-page. */
506
- readonly FLOW_RECORDED: "flow.recorded";
507
- /** synthetic: browser transport queue overflowed; events were dropped. `data: { dropped: number }`. */
508
- readonly TRANSPORT_OVERFLOW: "transport.overflow";
509
- /**
510
- * synthetic: a per-channel cap truncated a batch (e.g. a DOM mutation flood). `data: { channel, dropped }`.
511
- * Marks downstream rollups/envelopes as built on incomplete data — a ledger that lies at scale is worse
512
- * than no ledger, so truncation is never silent.
513
- */
514
- readonly TRUNCATED: "truncated";
515
- /**
516
- * synthetic: the SDK detected a region it CANNOT observe (a cross-origin iframe, a closed shadow root).
517
- * `data: { kind: BlindSpotKind, count }`. Surfaced on results as `coverage: partial` so a green never
518
- * implies it saw everything.
519
- */
520
- readonly BLIND_SPOT: "blind-spot";
521
- /** synthetic: the SDK ITSELF failed (an observer threw). `data: { site, message, errorType }`.
522
- * Rides the existing bridge — no outbound request. See browser/observers/sdk-failure.ts. */
523
- readonly SDK_FAILED: "sdk.failed";
524
- /**
525
- * synthetic (driven only): CDP/Playwright-authoritative network detail for a response the in-page
526
- * fetch/XHR wrapper also saw — full response headers + authoritative status/mimeType the page-side
527
- * wrapper can't reach. `data: { url, method?, status, headers, resourceType? }`. Merged onto the
528
- * matching in-page NET_REQUEST so the driven view never loses fidelity to an outside-in tool.
529
- */
530
- readonly NET_DETAIL: "net.detail";
531
- /**
532
- * Live-control: browser → bridge. A human acted on the presenter panel.
533
- * `data: { kind: HumanControlKind; text?: string }`. Rides the existing EventMessage.
534
- */
535
- readonly HUMAN_CONTROL: "human.control";
536
- /**
537
- * Human review: browser → bridge. A human pinned a mistake to an element on the running page
538
- * (the "annotate the bug where you see it" loop). `data` narrows to HumanMarkDataSchema — a note
539
- * plus a re-resolvable element anchor (and its source file:line when the framework stamped one) so
540
- * the agent that drains the mark knows exactly which element and which source to fix.
541
- */
542
- readonly HUMAN_MARK: "human.mark";
543
- /**
544
- * The app produced a FILE — a Blob handed to `URL.createObjectURL`, usually saved by clicking an
545
- * anchor with `download`. `data: { filename?, mimeType, bytes, lines?, preview? }`. The one artifact
546
- * class no outside-the-browser tool can inspect: it never crosses the network, so there is no
547
- * request to intercept. See `observers/download.ts` for the defect that motivated it.
548
- */
549
- readonly DOWNLOAD: "download";
550
- };
551
- export type EventType = (typeof EventType)[keyof typeof EventType];
552
474
  /**
553
475
  * Named phenomena the perception layer detects deterministically over the journal — capsules and
554
476
  * deviation reports lead with these names, not raw events. The library grows in later releases; the
@@ -353,6 +353,14 @@ export const ReticleDir = {
353
353
  RUNS_SUBDIR: 'runs',
354
354
  /** fail-to-pass bug capsules —.reticle/capsules/<id>.json (a minimal failing flow + its evidence). */
355
355
  CAPSULES_SUBDIR: 'capsules',
356
+ /**
357
+ * Where a feedback report refused delivery is copied — .reticle/feedback/.
358
+ *
359
+ * Named here rather than at the writer because the partition over this object is what decides
360
+ * whether a name Reticle creates is committed, ignored, or swept. It was spelled as a free string
361
+ * in three separate files, so the guard could not see it and nobody was ever asked.
362
+ */
363
+ FEEDBACK_SUBDIR: 'feedback',
356
364
  /** durable causal journal —.reticle/sessions/<id>/{events,actions}.jsonl (the substrate). */
357
365
  SESSIONS_SUBDIR: 'sessions',
358
366
  /** append-only event ledger inside a session dir (one ReticleEvent per line). */
@@ -412,6 +420,16 @@ export const ReticleDir = {
412
420
  */
413
421
  PAIRING_TOKEN_FILE: 'pairing-token',
414
422
  };
423
+ /**
424
+ * The names INSIDE `.reticle/intent/` — kept apart from `ReticleDir`, which lists what `.reticle/`
425
+ * itself holds and is what the retention tiers classify.
426
+ */
427
+ export const IntentDir = {
428
+ /** One per subject: `.reticle/intent/<subject>/intent.json`. A flow's name is its subject. */
429
+ SHARD_FILE: 'intent.json',
430
+ /** Derived from the shards: `.reticle/intent/index.json`, one line per intent. */
431
+ INDEX_FILE: 'index.json',
432
+ };
415
433
  /**
416
434
  * Structured reasons a screenshot/visual-diff could not produce a verdict (never
417
435
  * thrown as free strings). The visual layer is OPT-IN and CDP/Playwright-driven — it is NEVER
@@ -473,109 +491,16 @@ export const ContractReadError = {
473
491
  MISSING: 'contract-missing', // no .reticle/contract.json on disk
474
492
  MALFORMED: 'contract-malformed', // present but not valid JSON / fails schema
475
493
  };
494
+ // The event vocabulary lives beside this file and is re-exported here, so `EventType` stays one
495
+ // import path for every consumer. See event-types.ts for why it moved.
496
+ import { EventType } from './event-types.js';
497
+ export { EventType };
476
498
  /** Bounds for the per-session ring buffer. */
477
499
  export const RING_BUFFER_DEFAULTS = {
478
500
  MAX_EVENTS: 2000,
479
501
  MAX_AGE_MS: 60_000,
480
502
  MAX_BYTES: TRANSPORT_LIMITS.MAX_BUFFER_BYTES,
481
503
  };
482
- /** Normalized event types pushed into the ring buffer. */
483
- export const EventType = {
484
- DOM_ADDED: 'dom.added',
485
- DOM_REMOVED: 'dom.removed',
486
- DOM_ATTR: 'dom.attr',
487
- DOM_TEXT: 'dom.text',
488
- NET_REQUEST: 'net.request',
489
- NET_PENDING: 'net.pending',
490
- /** An SSE (EventSource) or WebSocket frame — a message on a long-lived streaming connection. */
491
- NET_STREAM: 'net.stream',
492
- /** A web-perf metric a screenshot can't verify: LCP, cumulative layout shift, or a long task. */
493
- PERF: 'perf',
494
- ROUTE_CHANGE: 'route.change',
495
- CONSOLE_LOG: 'console.log',
496
- CONSOLE_WARN: 'console.warn',
497
- CONSOLE_ERROR: 'console.error',
498
- CONSOLE_INFO: 'console.info',
499
- CONSOLE_DEBUG: 'console.debug',
500
- ERROR_UNCAUGHT: 'error.uncaught',
501
- VISIBLE_SHOWN: 'visible.shown',
502
- ANIM_START: 'anim.start',
503
- ANIM_END: 'anim.end',
504
- SCROLL_POSITION: 'scroll.position',
505
- REVEAL_SHOWN: 'reveal.shown',
506
- SIGNAL: 'signal',
507
- STATE_CHANGE: 'state.change',
508
- /** a write to localStorage/sessionStorage/cookies — `data: { area, key, old?, new? }` (values redacted). */
509
- STORAGE_CHANGE: 'storage.change',
510
- /** page-level visibility/focus health (distinct from element-level VISIBLE_*). */
511
- PAGE_HEALTH: 'page.health',
512
- /**
513
- * synthetic: the page called window.open, so the consequence of what was just clicked may live in
514
- * another browsing context this one cannot observe (an OAuth popup is the archetype).
515
- * `data: { href }` — the URL the page asked to open, when it named one.
516
- */
517
- CONTEXT_OPENED: 'context.opened',
518
- /**
519
- * The app opened a native `alert`/`confirm`/`prompt` while Reticle was driving it.
520
- *
521
- * Recorded because Reticle ANSWERS these rather than letting them block — a native dialog halts
522
- * the main thread, and the SDK's own message pump is on that thread, so one `confirm` behind a
523
- * driven click made the tab permanently unresponsive with no recovery from inside the session.
524
- * Answering silently would trade a wedge for an invisible one, so the question the app asked, and
525
- * the answer given, ride out as an event.
526
- */
527
- DIALOG_OPENED: 'dialog.opened',
528
- /** aggregated React commits over a throttle window (dev builds) — `data: { commits }`. Commit storms /
529
- * wasted re-renders show up here without a per-render flood. */
530
- RENDER_COMMIT: 'render.commit',
531
- /** element focus moved — `data: { to, from, toBody }`. Focus dropping to body after an act is a regression. */
532
- FOCUS_CHANGE: 'focus.change',
533
- /** browser → bridge: a human recording compiled in-page. */
534
- FLOW_RECORDED: 'flow.recorded',
535
- /** synthetic: browser transport queue overflowed; events were dropped. `data: { dropped: number }`. */
536
- TRANSPORT_OVERFLOW: 'transport.overflow',
537
- /**
538
- * synthetic: a per-channel cap truncated a batch (e.g. a DOM mutation flood). `data: { channel, dropped }`.
539
- * Marks downstream rollups/envelopes as built on incomplete data — a ledger that lies at scale is worse
540
- * than no ledger, so truncation is never silent.
541
- */
542
- TRUNCATED: 'truncated',
543
- /**
544
- * synthetic: the SDK detected a region it CANNOT observe (a cross-origin iframe, a closed shadow root).
545
- * `data: { kind: BlindSpotKind, count }`. Surfaced on results as `coverage: partial` so a green never
546
- * implies it saw everything.
547
- */
548
- BLIND_SPOT: 'blind-spot',
549
- /** synthetic: the SDK ITSELF failed (an observer threw). `data: { site, message, errorType }`.
550
- * Rides the existing bridge — no outbound request. See browser/observers/sdk-failure.ts. */
551
- SDK_FAILED: 'sdk.failed',
552
- /**
553
- * synthetic (driven only): CDP/Playwright-authoritative network detail for a response the in-page
554
- * fetch/XHR wrapper also saw — full response headers + authoritative status/mimeType the page-side
555
- * wrapper can't reach. `data: { url, method?, status, headers, resourceType? }`. Merged onto the
556
- * matching in-page NET_REQUEST so the driven view never loses fidelity to an outside-in tool.
557
- */
558
- NET_DETAIL: 'net.detail',
559
- /**
560
- * Live-control: browser → bridge. A human acted on the presenter panel.
561
- * `data: { kind: HumanControlKind; text?: string }`. Rides the existing EventMessage.
562
- */
563
- HUMAN_CONTROL: 'human.control',
564
- /**
565
- * Human review: browser → bridge. A human pinned a mistake to an element on the running page
566
- * (the "annotate the bug where you see it" loop). `data` narrows to HumanMarkDataSchema — a note
567
- * plus a re-resolvable element anchor (and its source file:line when the framework stamped one) so
568
- * the agent that drains the mark knows exactly which element and which source to fix.
569
- */
570
- HUMAN_MARK: 'human.mark',
571
- /**
572
- * The app produced a FILE — a Blob handed to `URL.createObjectURL`, usually saved by clicking an
573
- * anchor with `download`. `data: { filename?, mimeType, bytes, lines?, preview? }`. The one artifact
574
- * class no outside-the-browser tool can inspect: it never crosses the network, so there is no
575
- * request to intercept. See `observers/download.ts` for the defect that motivated it.
576
- */
577
- DOWNLOAD: 'download',
578
- };
579
504
  /**
580
505
  * Named phenomena the perception layer detects deterministically over the journal — capsules and
581
506
  * deviation reports lead with these names, not raw events. The library grows in later releases; the
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The invitation to talk to the people building Reticle.
3
+ *
4
+ * One link and one set of words for every surface that offers it — the CLI report, the session end,
5
+ * the in-page panel, the moment Reticle failed somebody, and the agent's instructions — so changing
6
+ * the booking link is a one-line edit and no surface can drift to a dead one.
7
+ *
8
+ * Always for the HUMAN. The agent's wording asks it to OFFER the link and never to act on it: an agent
9
+ * that books a call or submits an email on somebody's behalf is the outbound instruction a careful
10
+ * evaluator reads as a reason not to install.
11
+ */
12
+ /** The booking link published on reticle.sh. */
13
+ export declare const DISCOVERY_CALL_URL = "https://calendar.app.google/h9NRDbBBQetyTzWM6";
14
+ /** Where a person writes to the founder directly. */
15
+ export declare const FOUNDER_EMAIL = "hey@reticle.sh";
16
+ /** A mailto for that address, subject filled so the note is findable in the inbox. A literal: see first-load-size. */
17
+ export declare const FOUNDER_MAILTO = "mailto:hey@reticle.sh?subject=Reticle%20feedback";
18
+ /** How somebody leaves an email instead — opt-in, saved locally, undone with `--forget`. */
19
+ export declare const DISCOVERY_EMAIL_COMMAND = "npx @reticlehq/server identify --context company --email you@company.com";
20
+ export declare const DiscoveryInvite: {
21
+ /** Shown to the person using Reticle. */
22
+ readonly HUMAN: "Stuck, or want Reticle to work differently? Talk to the founder: https://calendar.app.google/h9NRDbBBQetyTzWM6 · or leave your email: npx @reticlehq/server identify --context company --email you@company.com";
23
+ /** Read by the agent, which passes it on rather than acting on it. */
24
+ readonly AGENT: "If the person you are working with is stuck or Reticle got in their way, offer them a call with the founder (https://calendar.app.google/h9NRDbBBQetyTzWM6) or the email command (npx @reticlehq/server identify --context company --email you@company.com). Offer it; never book a call or submit an email for them.";
25
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The invitation to talk to the people building Reticle.
3
+ *
4
+ * One link and one set of words for every surface that offers it — the CLI report, the session end,
5
+ * the in-page panel, the moment Reticle failed somebody, and the agent's instructions — so changing
6
+ * the booking link is a one-line edit and no surface can drift to a dead one.
7
+ *
8
+ * Always for the HUMAN. The agent's wording asks it to OFFER the link and never to act on it: an agent
9
+ * that books a call or submits an email on somebody's behalf is the outbound instruction a careful
10
+ * evaluator reads as a reason not to install.
11
+ */
12
+ /** The booking link published on reticle.sh. */
13
+ export const DISCOVERY_CALL_URL = 'https://calendar.app.google/h9NRDbBBQetyTzWM6';
14
+ /** Where a person writes to the founder directly. */
15
+ export const FOUNDER_EMAIL = 'hey@reticle.sh';
16
+ /** A mailto for that address, subject filled so the note is findable in the inbox. A literal: see first-load-size. */
17
+ export const FOUNDER_MAILTO = 'mailto:hey@reticle.sh?subject=Reticle%20feedback';
18
+ /** How somebody leaves an email instead — opt-in, saved locally, undone with `--forget`. */
19
+ export const DISCOVERY_EMAIL_COMMAND = 'npx @reticlehq/server identify --context company --email you@company.com';
20
+ export const DiscoveryInvite = {
21
+ /** Shown to the person using Reticle. */
22
+ HUMAN: `Stuck, or want Reticle to work differently? Talk to the founder: ${DISCOVERY_CALL_URL} · or leave your email: ${DISCOVERY_EMAIL_COMMAND}`,
23
+ /** Read by the agent, which passes it on rather than acting on it. */
24
+ AGENT: `If the person you are working with is stuck or Reticle got in their way, offer them a call with the founder (${DISCOVERY_CALL_URL}) or the email command (${DISCOVERY_EMAIL_COMMAND}). Offer it; never book a call or submit an email for them.`,
25
+ };
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The event vocabulary: every normalized type the ring buffer can hold.
3
+ *
4
+ * Split out of `constants.ts` when that file crossed the 1000-line cap while gaining a channel for
5
+ * form fields. Cohesive on its own terms, and the most-read list in the contract: this is the set an
6
+ * observer produces, a predicate reasons over and a replayed step's digest counts, and each member
7
+ * carries the argument for why that channel exists at all.
8
+ *
9
+ * Re-exported from `constants.ts`, so `EventType` stays one import path for everyone outside core.
10
+ */
11
+ export declare const EventType: {
12
+ readonly DOM_ADDED: "dom.added";
13
+ readonly DOM_REMOVED: "dom.removed";
14
+ readonly DOM_ATTR: "dom.attr";
15
+ readonly DOM_TEXT: "dom.text";
16
+ readonly NET_REQUEST: "net.request";
17
+ readonly NET_PENDING: "net.pending";
18
+ /** An SSE (EventSource) or WebSocket frame — a message on a long-lived streaming connection. */
19
+ readonly NET_STREAM: "net.stream";
20
+ /** A web-perf metric a screenshot can't verify: LCP, cumulative layout shift, or a long task. */
21
+ readonly PERF: "perf";
22
+ readonly ROUTE_CHANGE: "route.change";
23
+ readonly CONSOLE_LOG: "console.log";
24
+ readonly CONSOLE_WARN: "console.warn";
25
+ readonly CONSOLE_ERROR: "console.error";
26
+ readonly CONSOLE_INFO: "console.info";
27
+ readonly CONSOLE_DEBUG: "console.debug";
28
+ readonly ERROR_UNCAUGHT: "error.uncaught";
29
+ readonly VISIBLE_SHOWN: "visible.shown";
30
+ readonly ANIM_START: "anim.start";
31
+ readonly ANIM_END: "anim.end";
32
+ readonly SCROLL_POSITION: "scroll.position";
33
+ readonly REVEAL_SHOWN: "reveal.shown";
34
+ readonly SIGNAL: "signal";
35
+ readonly STATE_CHANGE: "state.change";
36
+ /** a write to localStorage/sessionStorage/cookies — `data: { area, key, old?, new? }` (values redacted). */
37
+ readonly STORAGE_CHANGE: "storage.change";
38
+ /** page-level visibility/focus health (distinct from element-level VISIBLE_*). */
39
+ readonly PAGE_HEALTH: "page.health";
40
+ /**
41
+ * synthetic: the page called window.open, so the consequence of what was just clicked may live in
42
+ * another browsing context this one cannot observe (an OAuth popup is the archetype).
43
+ * `data: { href }` — the URL the page asked to open, when it named one.
44
+ */
45
+ readonly CONTEXT_OPENED: "context.opened";
46
+ /**
47
+ * The app opened a native `alert`/`confirm`/`prompt` while Reticle was driving it.
48
+ *
49
+ * Recorded because Reticle ANSWERS these rather than letting them block — a native dialog halts
50
+ * the main thread, and the SDK's own message pump is on that thread, so one `confirm` behind a
51
+ * driven click made the tab permanently unresponsive with no recovery from inside the session.
52
+ * Answering silently would trade a wedge for an invisible one, so the question the app asked, and
53
+ * the answer given, ride out as an event.
54
+ */
55
+ readonly DIALOG_OPENED: "dialog.opened";
56
+ /** aggregated React commits over a throttle window (dev builds) — `data: { commits }`. Commit storms /
57
+ * wasted re-renders show up here without a per-render flood. */
58
+ readonly RENDER_COMMIT: "render.commit";
59
+ /** element focus moved — `data: { to, from, toBody }`. Focus dropping to body after an act is a regression. */
60
+ readonly FOCUS_CHANGE: "focus.change";
61
+ /**
62
+ * a form field's value moved — `data: { field, kind, value?, redacted?, length }`.
63
+ *
64
+ * The DOM observer never saw this: `value` is in its attribute allowlist, but React and every
65
+ * controlled input set the PROPERTY, so `MutationObserver` does not fire. `value` is omitted and
66
+ * `redacted` set for a password, a sensitive name, or a payment autocomplete hint; `length` is
67
+ * always present, because "it was wiped" is assertable without carrying anybody's data.
68
+ */
69
+ readonly FIELD_CHANGE: "field.change";
70
+ /** browser → bridge: a human recording compiled in-page. */
71
+ readonly FLOW_RECORDED: "flow.recorded";
72
+ /** synthetic: browser transport queue overflowed; events were dropped. `data: { dropped: number }`. */
73
+ readonly TRANSPORT_OVERFLOW: "transport.overflow";
74
+ /**
75
+ * synthetic: a per-channel cap truncated a batch (e.g. a DOM mutation flood). `data: { channel, dropped }`.
76
+ * Marks downstream rollups/envelopes as built on incomplete data — a ledger that lies at scale is worse
77
+ * than no ledger, so truncation is never silent.
78
+ */
79
+ readonly TRUNCATED: "truncated";
80
+ /**
81
+ * synthetic: the SDK detected a region it CANNOT observe (a cross-origin iframe, a closed shadow root).
82
+ * `data: { kind: BlindSpotKind, count }`. Surfaced on results as `coverage: partial` so a green never
83
+ * implies it saw everything.
84
+ */
85
+ readonly BLIND_SPOT: "blind-spot";
86
+ /** synthetic: the SDK ITSELF failed (an observer threw). `data: { site, message, errorType }`.
87
+ * Rides the existing bridge — no outbound request. See browser/observers/sdk-failure.ts. */
88
+ readonly SDK_FAILED: "sdk.failed";
89
+ /**
90
+ * synthetic (driven only): CDP/Playwright-authoritative network detail for a response the in-page
91
+ * fetch/XHR wrapper also saw — full response headers + authoritative status/mimeType the page-side
92
+ * wrapper can't reach. `data: { url, method?, status, headers, resourceType? }`. Merged onto the
93
+ * matching in-page NET_REQUEST so the driven view never loses fidelity to an outside-in tool.
94
+ */
95
+ readonly NET_DETAIL: "net.detail";
96
+ /**
97
+ * Live-control: browser → bridge. A human acted on the presenter panel.
98
+ * `data: { kind: HumanControlKind; text?: string }`. Rides the existing EventMessage.
99
+ */
100
+ readonly HUMAN_CONTROL: "human.control";
101
+ /**
102
+ * Human review: browser → bridge. A human pinned a mistake to an element on the running page
103
+ * (the "annotate the bug where you see it" loop). `data` narrows to HumanMarkDataSchema — a note
104
+ * plus a re-resolvable element anchor (and its source file:line when the framework stamped one) so
105
+ * the agent that drains the mark knows exactly which element and which source to fix.
106
+ */
107
+ readonly HUMAN_MARK: "human.mark";
108
+ /**
109
+ * The app produced a FILE — a Blob handed to `URL.createObjectURL`, usually saved by clicking an
110
+ * anchor with `download`. `data: { filename?, mimeType, bytes, lines?, preview? }`. The one artifact
111
+ * class no outside-the-browser tool can inspect: it never crosses the network, so there is no
112
+ * request to intercept. See `observers/download.ts` for the defect that motivated it.
113
+ */
114
+ readonly DOWNLOAD: "download";
115
+ /**
116
+ * Browser -> bridge: a person used the HUD — pressed a control, or the HUD changed how it sits.
117
+ * `data` narrows to HudUseDataSchema: names only. Telemetry, not evidence: the session takes it
118
+ * off the wire before the buffer, so no verdict, settle or agent read ever sees it.
119
+ */
120
+ readonly HUD_USED: "hud.used";
121
+ };
122
+ export type EventType = (typeof EventType)[keyof typeof EventType];
@@ -0,0 +1,121 @@
1
+ /**
2
+ * The event vocabulary: every normalized type the ring buffer can hold.
3
+ *
4
+ * Split out of `constants.ts` when that file crossed the 1000-line cap while gaining a channel for
5
+ * form fields. Cohesive on its own terms, and the most-read list in the contract: this is the set an
6
+ * observer produces, a predicate reasons over and a replayed step's digest counts, and each member
7
+ * carries the argument for why that channel exists at all.
8
+ *
9
+ * Re-exported from `constants.ts`, so `EventType` stays one import path for everyone outside core.
10
+ */
11
+ export const EventType = {
12
+ DOM_ADDED: 'dom.added',
13
+ DOM_REMOVED: 'dom.removed',
14
+ DOM_ATTR: 'dom.attr',
15
+ DOM_TEXT: 'dom.text',
16
+ NET_REQUEST: 'net.request',
17
+ NET_PENDING: 'net.pending',
18
+ /** An SSE (EventSource) or WebSocket frame — a message on a long-lived streaming connection. */
19
+ NET_STREAM: 'net.stream',
20
+ /** A web-perf metric a screenshot can't verify: LCP, cumulative layout shift, or a long task. */
21
+ PERF: 'perf',
22
+ ROUTE_CHANGE: 'route.change',
23
+ CONSOLE_LOG: 'console.log',
24
+ CONSOLE_WARN: 'console.warn',
25
+ CONSOLE_ERROR: 'console.error',
26
+ CONSOLE_INFO: 'console.info',
27
+ CONSOLE_DEBUG: 'console.debug',
28
+ ERROR_UNCAUGHT: 'error.uncaught',
29
+ VISIBLE_SHOWN: 'visible.shown',
30
+ ANIM_START: 'anim.start',
31
+ ANIM_END: 'anim.end',
32
+ SCROLL_POSITION: 'scroll.position',
33
+ REVEAL_SHOWN: 'reveal.shown',
34
+ SIGNAL: 'signal',
35
+ STATE_CHANGE: 'state.change',
36
+ /** a write to localStorage/sessionStorage/cookies — `data: { area, key, old?, new? }` (values redacted). */
37
+ STORAGE_CHANGE: 'storage.change',
38
+ /** page-level visibility/focus health (distinct from element-level VISIBLE_*). */
39
+ PAGE_HEALTH: 'page.health',
40
+ /**
41
+ * synthetic: the page called window.open, so the consequence of what was just clicked may live in
42
+ * another browsing context this one cannot observe (an OAuth popup is the archetype).
43
+ * `data: { href }` — the URL the page asked to open, when it named one.
44
+ */
45
+ CONTEXT_OPENED: 'context.opened',
46
+ /**
47
+ * The app opened a native `alert`/`confirm`/`prompt` while Reticle was driving it.
48
+ *
49
+ * Recorded because Reticle ANSWERS these rather than letting them block — a native dialog halts
50
+ * the main thread, and the SDK's own message pump is on that thread, so one `confirm` behind a
51
+ * driven click made the tab permanently unresponsive with no recovery from inside the session.
52
+ * Answering silently would trade a wedge for an invisible one, so the question the app asked, and
53
+ * the answer given, ride out as an event.
54
+ */
55
+ DIALOG_OPENED: 'dialog.opened',
56
+ /** aggregated React commits over a throttle window (dev builds) — `data: { commits }`. Commit storms /
57
+ * wasted re-renders show up here without a per-render flood. */
58
+ RENDER_COMMIT: 'render.commit',
59
+ /** element focus moved — `data: { to, from, toBody }`. Focus dropping to body after an act is a regression. */
60
+ FOCUS_CHANGE: 'focus.change',
61
+ /**
62
+ * a form field's value moved — `data: { field, kind, value?, redacted?, length }`.
63
+ *
64
+ * The DOM observer never saw this: `value` is in its attribute allowlist, but React and every
65
+ * controlled input set the PROPERTY, so `MutationObserver` does not fire. `value` is omitted and
66
+ * `redacted` set for a password, a sensitive name, or a payment autocomplete hint; `length` is
67
+ * always present, because "it was wiped" is assertable without carrying anybody's data.
68
+ */
69
+ FIELD_CHANGE: 'field.change',
70
+ /** browser → bridge: a human recording compiled in-page. */
71
+ FLOW_RECORDED: 'flow.recorded',
72
+ /** synthetic: browser transport queue overflowed; events were dropped. `data: { dropped: number }`. */
73
+ TRANSPORT_OVERFLOW: 'transport.overflow',
74
+ /**
75
+ * synthetic: a per-channel cap truncated a batch (e.g. a DOM mutation flood). `data: { channel, dropped }`.
76
+ * Marks downstream rollups/envelopes as built on incomplete data — a ledger that lies at scale is worse
77
+ * than no ledger, so truncation is never silent.
78
+ */
79
+ TRUNCATED: 'truncated',
80
+ /**
81
+ * synthetic: the SDK detected a region it CANNOT observe (a cross-origin iframe, a closed shadow root).
82
+ * `data: { kind: BlindSpotKind, count }`. Surfaced on results as `coverage: partial` so a green never
83
+ * implies it saw everything.
84
+ */
85
+ BLIND_SPOT: 'blind-spot',
86
+ /** synthetic: the SDK ITSELF failed (an observer threw). `data: { site, message, errorType }`.
87
+ * Rides the existing bridge — no outbound request. See browser/observers/sdk-failure.ts. */
88
+ SDK_FAILED: 'sdk.failed',
89
+ /**
90
+ * synthetic (driven only): CDP/Playwright-authoritative network detail for a response the in-page
91
+ * fetch/XHR wrapper also saw — full response headers + authoritative status/mimeType the page-side
92
+ * wrapper can't reach. `data: { url, method?, status, headers, resourceType? }`. Merged onto the
93
+ * matching in-page NET_REQUEST so the driven view never loses fidelity to an outside-in tool.
94
+ */
95
+ NET_DETAIL: 'net.detail',
96
+ /**
97
+ * Live-control: browser → bridge. A human acted on the presenter panel.
98
+ * `data: { kind: HumanControlKind; text?: string }`. Rides the existing EventMessage.
99
+ */
100
+ HUMAN_CONTROL: 'human.control',
101
+ /**
102
+ * Human review: browser → bridge. A human pinned a mistake to an element on the running page
103
+ * (the "annotate the bug where you see it" loop). `data` narrows to HumanMarkDataSchema — a note
104
+ * plus a re-resolvable element anchor (and its source file:line when the framework stamped one) so
105
+ * the agent that drains the mark knows exactly which element and which source to fix.
106
+ */
107
+ HUMAN_MARK: 'human.mark',
108
+ /**
109
+ * The app produced a FILE — a Blob handed to `URL.createObjectURL`, usually saved by clicking an
110
+ * anchor with `download`. `data: { filename?, mimeType, bytes, lines?, preview? }`. The one artifact
111
+ * class no outside-the-browser tool can inspect: it never crosses the network, so there is no
112
+ * request to intercept. See `observers/download.ts` for the defect that motivated it.
113
+ */
114
+ DOWNLOAD: 'download',
115
+ /**
116
+ * Browser -> bridge: a person used the HUD — pressed a control, or the HUD changed how it sits.
117
+ * `data` narrows to HudUseDataSchema: names only. Telemetry, not evidence: the session takes it
118
+ * off the wire before the buffer, so no verdict, settle or agent read ever sees it.
119
+ */
120
+ HUD_USED: 'hud.used',
121
+ };