@reticlehq/core 2.14.0 → 3.1.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 (143) hide show
  1. package/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
  2. package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +89 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +95 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact.d.ts → artifacts/impact.d.ts} +119 -103
  20. package/dist/{impact.js → artifacts/impact.js} +14 -5
  21. package/dist/{journal.d.ts → artifacts/journal.d.ts} +51 -7
  22. package/dist/{journal.js → artifacts/journal.js} +38 -2
  23. package/dist/artifacts/step-effect.d.ts +29 -0
  24. package/dist/artifacts/step-effect.js +28 -0
  25. package/dist/hooks/hook-events.d.ts +311 -0
  26. package/dist/hooks/hook-events.js +127 -0
  27. package/dist/hooks/hooks-entry.d.ts +9 -0
  28. package/dist/hooks/hooks-entry.js +9 -0
  29. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  30. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  31. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  32. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  33. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  34. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  35. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  36. package/dist/index.d.ts +56 -43
  37. package/dist/index.js +65 -45
  38. package/dist/onboarding.d.ts +114 -0
  39. package/dist/onboarding.js +141 -0
  40. package/dist/realm/registry.d.ts +212 -0
  41. package/dist/realm/registry.js +302 -0
  42. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
  43. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  44. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  45. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  46. package/dist/schema/command-name.json +31 -0
  47. package/dist/schema/event-payloads.json +791 -0
  48. package/dist/schema/hello-message.json +70 -2
  49. package/dist/schema/reticle-message.json +70 -2
  50. package/dist/telemetry-entry.d.ts +1 -1
  51. package/dist/telemetry-entry.js +1 -1
  52. package/dist/telemetry-feedback.d.ts +15 -16
  53. package/dist/telemetry-feedback.js +11 -12
  54. package/dist/telemetry-license.d.ts +1 -1
  55. package/dist/telemetry-license.js +1 -1
  56. package/dist/telemetry-refusal.d.ts +11 -11
  57. package/dist/telemetry-refusal.js +7 -8
  58. package/dist/telemetry-session.d.ts +51 -59
  59. package/dist/telemetry-session.js +47 -55
  60. package/dist/telemetry.d.ts +243 -214
  61. package/dist/telemetry.js +83 -98
  62. package/dist/tour-entry.d.ts +10 -0
  63. package/dist/tour-entry.js +10 -0
  64. package/dist/tour.d.ts +125 -0
  65. package/dist/tour.js +165 -0
  66. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
  67. package/dist/{consequence.js → verdict/consequence.js} +9 -31
  68. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  69. package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
  70. package/dist/{findings.js → verdict/findings.js} +103 -49
  71. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
  72. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
  73. package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
  74. package/dist/{intent.js → verdict/intent.js} +11 -22
  75. package/dist/verdict/revision.d.ts +44 -0
  76. package/dist/verdict/revision.js +53 -0
  77. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  78. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  79. package/dist/{security.js → verdict/security.js} +12 -21
  80. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
  81. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  82. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +25 -13
  83. package/dist/{verified-constants.js → verdict/verified-constants.js} +25 -13
  84. package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
  85. package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
  86. package/dist/wire/channel.d.ts +46 -0
  87. package/dist/wire/channel.js +95 -0
  88. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +91 -28
  89. package/dist/{constants.js → wire/constants/constants.js} +105 -28
  90. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  91. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  92. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  93. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  94. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +68 -13
  95. package/dist/{event-payloads.js → wire/event-payloads.js} +21 -3
  96. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  97. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  98. package/dist/{global-press.js → wire/global-press.js} +1 -1
  99. package/dist/{messages.d.ts → wire/messages.d.ts} +239 -48
  100. package/dist/{messages.js → wire/messages.js} +68 -5
  101. package/dist/wire/narrow.d.ts +39 -0
  102. package/dist/wire/narrow.js +45 -0
  103. package/dist/{net.d.ts → wire/net.d.ts} +12 -13
  104. package/dist/{net.js → wire/net.js} +12 -13
  105. package/dist/wire/platform.d.ts +37 -0
  106. package/dist/wire/platform.js +36 -0
  107. package/dist/{redaction.js → wire/redaction.js} +12 -12
  108. package/dist/wire/tool-names.d.ts +133 -0
  109. package/dist/wire/tool-names.js +142 -0
  110. package/dist/{toon.js → wire/toon.js} +1 -1
  111. package/dist/{types.d.ts → wire/types.d.ts} +77 -76
  112. package/dist/{types.js → wire/types.js} +4 -3
  113. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  114. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  115. package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
  116. package/dist/{notices.js → words/notices.js} +8 -12
  117. package/package.json +16 -7
  118. package/dist/flow-types.d.ts +0 -1711
  119. package/dist/flow-types.js +0 -247
  120. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
  121. package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
  122. package/dist/{brand.js → identity/brand.js} +0 -0
  123. package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  124. package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  125. package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  126. package/dist/{project-id.js → identity/project-id.js} +0 -0
  127. package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  128. package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  129. package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  130. package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  131. package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  132. package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  133. package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
  134. package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
  135. package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  136. package/dist/{state-select.js → wire/state-select.js} +0 -0
  137. package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  138. package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  139. package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  140. package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  141. package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  142. package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
  143. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -37,6 +37,17 @@ export declare const STATUS_PATH = "/status";
37
37
  */
38
38
  export declare const DRIVE_PATH = "/drive";
39
39
  export declare const RETICLE_PROTOCOL_VERSION = 1;
40
+ /**
41
+ * The oldest protocol version this build still talks to.
42
+ *
43
+ * A range rather than a single number. An exact door refuses a peer one version out, which is
44
+ * correct when both sides ship together and wrong the moment anything else implements this -- an
45
+ * SDK a user has not upgraded yet is not an incompatible SDK.
46
+ *
47
+ * Equal to the current version today, so nothing changes yet. It exists so that raising the current
48
+ * version is a decision about what to keep supporting, rather than an automatic break.
49
+ */
50
+ export declare const RETICLE_MIN_PROTOCOL_VERSION = 1;
40
51
  /**
41
52
  * The host a CLIENT names when it dials the bridge, as opposed to the address the bridge BINDS.
42
53
  *
@@ -67,6 +78,15 @@ export declare function bridgeWsUrl(port?: number, host?: string): string;
67
78
  export declare const RETICLE_URL_PARAM: {
68
79
  readonly SESSION: "__reticle_session";
69
80
  readonly PROJECT: "__reticle_project";
81
+ /**
82
+ * "Reticle opened this page for itself" — and nothing more.
83
+ *
84
+ * Deliberately NOT the session stamp. `resolveConnectIdentity` reads SESSION as the session id
85
+ * when the app names none, so marking a drive with it would rename every driven session to one
86
+ * shared constant and make two concurrent drives collide. This carries the one fact the page
87
+ * needs (nobody is sitting in front of it) without touching identity.
88
+ */
89
+ readonly OPENED: "__reticle_opened";
70
90
  };
71
91
  /** The loopback bind address. The daemon/bridge bind here by default — never expose Reticle off-host. */
72
92
  export declare const LOOPBACK_HOST = "127.0.0.1";
@@ -144,6 +164,20 @@ export declare const ReticleEnv: {
144
164
  readonly RECONNECT_ATTEMPTS: "RETICLE_RECONNECT_ATTEMPTS";
145
165
  /** Quiet window before an abandoned MCP stdio proxy exits; `0` disables the watcher. */
146
166
  readonly MCP_PROXY_IDLE: "RETICLE_MCP_PROXY_IDLE_MS";
167
+ /**
168
+ * API key for the harness — the model that drives the app when no coding agent is in the loop.
169
+ *
170
+ * The standard Anthropic name, on purpose: a machine that can already run a coding agent can
171
+ * already run the harness, with nothing to configure. Absent ⇒ the harness is simply unavailable
172
+ * and every other part of Reticle is unaffected.
173
+ */
174
+ readonly HARNESS_KEY: "ANTHROPIC_API_KEY";
175
+ /** Model the harness drives with. Defaults to a small one — see `DEFAULT_HARNESS_MODEL`. */
176
+ readonly HARNESS_MODEL: "RETICLE_HARNESS_MODEL";
177
+ /** Base URL for the harness's model API, for a proxy or a gateway. */
178
+ readonly HARNESS_BASE_URL: "RETICLE_HARNESS_BASE_URL";
179
+ /** Hard ceiling on harness model turns in one drive. Bounds cost, not value. */
180
+ readonly HARNESS_MAX_STEPS: "RETICLE_HARNESS_MAX_STEPS";
147
181
  };
148
182
  /** Hard transport bounds shared by the browser and bridge. */
149
183
  export declare const TRANSPORT_LIMITS: {
@@ -151,25 +185,17 @@ export declare const TRANSPORT_LIMITS: {
151
185
  /**
152
186
  * Inbound events per second before the bridge SAMPLES rather than records everything.
153
187
  *
154
- * This was 1000, and an ordinary React app with an active query cache blew through it: the
155
- * reporter's FIRST `act_and_wait` of the session came back `unknown` with `unclean_capture` and a
156
- * four-figure drop count, and setting the env override to twenty times the default fixed it (#316).
157
- * Reticle was right to refuse the verdict — a sampled window cannot support one, and the guard that
158
- * catches false greens is blindest exactly there — but landing that on the first drive after an
159
- * install, recoverable only by knowing an environment variable exists and inventing a number for
160
- * it, is the worst possible place to spend the honesty.
161
- *
162
- * 20000 is the value that was measured to work on the page that reported it. The cap exists to stop
163
- * a PATHOLOGICAL page (an animation loop firing DOM mutations every frame), not to throttle a busy
164
- * one, and the ceiling it has to defend is cheap: the daemon is on the same machine and a typical
165
- * event is a few hundred bytes, so this is single-digit MB/s over loopback.
188
+ * The cap exists to stop a PATHOLOGICAL page (an animation loop firing DOM mutations every frame),
189
+ * not to throttle a busy one: an ordinary React app with an active query cache passes 1000/s, and a
190
+ * sampled window cannot support a verdict, so too low a cap answers `unknown` with
191
+ * `unclean_capture` on the first `act_and_wait` after an install (#316).
166
192
  *
167
- * Raising it does not raise what a runaway page can make the bridge HOLD, and that separation is
168
- * what makes the change safe. Memory is bounded independently by the ring buffer, which evicts on
169
- * `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant, reached through that alias) as well as on
170
- * a count and an age. Grep for `MAX_BUFFER_BYTES` alone and it looks like a constant nobody reads,
171
- * which is exactly the wrong conclusion to draw before touching this number: the rate cap defends
172
- * parse cost, the ring buffer defends memory, and they are not substitutes.
193
+ * The ceiling it defends is cheap — the daemon is on the same machine and a typical event is a few
194
+ * hundred bytes, so 20000/s is single-digit MB/s over loopback. Raising it does not raise what a
195
+ * runaway page can make the bridge HOLD: memory is bounded independently by the ring buffer, which
196
+ * evicts on `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant through that alias) as well as on
197
+ * a count and an age. The rate cap defends parse cost, the ring buffer defends memory, and they are
198
+ * not substitutes.
173
199
  */
174
200
  readonly MAX_MESSAGES_PER_SECOND: 20000;
175
201
  readonly MAX_SESSIONS: 32;
@@ -180,6 +206,7 @@ export declare const TRANSPORT_LIMITS: {
180
206
  readonly MAX_URL_LENGTH: 4096;
181
207
  readonly MAX_TITLE_LENGTH: 512;
182
208
  readonly MAX_ADAPTERS: 32;
209
+ readonly MAX_CONTRACT_NAMES: 128;
183
210
  readonly MAX_ADAPTER_NAME_LENGTH: 128;
184
211
  readonly MAX_TOKEN_LENGTH: 512;
185
212
  readonly MAX_COMMAND_ID_LENGTH: 128;
@@ -222,8 +249,8 @@ export declare const ReticleDir: {
222
249
  /**
223
250
  * the user's own record of what Reticle has done for them — .reticle/impact.json.
224
251
  *
225
- * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers our
226
- * questions about the product; this answers the user's question about their own work.
252
+ * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers questions
253
+ * about the product; this answers the user's question about their own work.
227
254
  */
228
255
  readonly IMPACT_FILE: "impact.json";
229
256
  /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
@@ -266,6 +293,17 @@ export declare const ReticleDir: {
266
293
  readonly ISSUES_FILE: "issues.json";
267
294
  /** Per-flow assertion tiers recorded on each PASSING replay — the gate's anti-downgrade baseline. */
268
295
  readonly TIERS_FILE: "assertion-tiers.json";
296
+ /**
297
+ * what to run when something happens — .reticle/hooks.json. Git-checked on purpose: a hook is a
298
+ * decision the whole team shares, the same way a git hook or a package script is, and one that
299
+ * only exists on the machine that wrote it is a rule nobody else is following.
300
+ *
301
+ * It names COMMANDS, so it is exactly as trusted as `package.json` scripts in the same repository
302
+ * and no more: opening a repo does not run them, and Reticle runs one only when the event it is
303
+ * attached to actually happens. The event payload is handed over on stdin, never interpolated into
304
+ * the command line, so a defect's own text can never become part of a command.
305
+ */
306
+ readonly HOOKS_FILE: "hooks.json";
269
307
  /**
270
308
  * Auto-provisioned bridge pairing token, stored at ~/.reticle/pairing-token (mode 0600). Written by
271
309
  * the daemon, read Node-side by the build plugins to inject into connect. A browser sandbox cannot
@@ -328,9 +366,7 @@ export declare const ContractReadError: {
328
366
  readonly MALFORMED: "contract-malformed";
329
367
  };
330
368
  export type ContractReadError = (typeof ContractReadError)[keyof typeof ContractReadError];
331
- /** On-disk artifact constants (project/flow/replay/recorder/heal/annotation) live here. */
332
- export * from './flow-constants.js';
333
- /** Bounds for the per-session ring buffer (see plan/02-architecture.md). */
369
+ /** Bounds for the per-session ring buffer. */
334
370
  export declare const RING_BUFFER_DEFAULTS: {
335
371
  readonly MAX_EVENTS: 2000;
336
372
  readonly MAX_AGE_MS: 60000;
@@ -559,7 +595,7 @@ export declare const DriveErrorCode: {
559
595
  export type DriveErrorCode = (typeof DriveErrorCode)[keyof typeof DriveErrorCode];
560
596
  /** Human-facing message when the optional playwright dep is absent. */
561
597
  export declare const DRIVE_PLAYWRIGHT_MISSING_MSG = "reticle drive needs the optional 'playwright' package \u2014 install it: pnpm add -D playwright && npx playwright install chromium";
562
- /** Actions the executor can perform against a ref (plan/03 + plan/05). */
598
+ /** Actions the executor can perform against a ref. */
563
599
  /**
564
600
  * The console levels an agent can filter by, DERIVED from the console EventTypes rather than
565
601
  * retyped. `reticle_console { level }` matches by building `console.${level}`, so any list written
@@ -584,7 +620,34 @@ export declare const ActionType: {
584
620
  readonly PRESS: "press";
585
621
  readonly UPLOAD: "upload";
586
622
  readonly SCROLL_INTO_VIEW: "scrollIntoView";
623
+ /**
624
+ * Scroll a container (or the document) by a delta, in either axis and EITHER DIRECTION.
625
+ *
626
+ * `scrollIntoView` puts a known element on screen; this is the gesture for looking around when you
627
+ * do not know what you are looking for yet — back up to what scrolled past, or move sideways on a
628
+ * wide table. Until now the only scroll available stepped DOWN, so a page could be walked in one
629
+ * direction and never back, and `inspect` reported `scrollLeft`/`scrollWidth` that nothing could act on.
630
+ */
631
+ readonly SCROLL: "scroll";
587
632
  readonly DRAG: "drag";
633
+ /**
634
+ * A TOUCH tap: pointerdown(touch) → touchstart → touchend → pointerup → click.
635
+ *
636
+ * Not a click with another name. A handler bound to `touchstart`, or one that branches on
637
+ * `event.pointerType`, never runs for a mouse click — so mobile-web behaviour, swipe/press
638
+ * affordances and touch-only controls were undriveable. `args.holdMs` makes it a LONG PRESS, the
639
+ * gesture behind context menus and reorder handles on touch.
640
+ */
641
+ readonly TAP: "tap";
642
+ /**
643
+ * Page zoom, as a fraction (1 = 100%).
644
+ *
645
+ * Real browser zoom is not scriptable from inside the page, so this needs a driven browser and
646
+ * REFUSES without one rather than faking it with CSS — see the note on `hover`, which refuses for
647
+ * the same reason. A layout that breaks at 200% is a real and common defect; a CSS transform that
648
+ * merely looks like zoom would report it caught while the layout viewport never changed.
649
+ */
650
+ readonly ZOOM: "zoom";
588
651
  readonly WEBMCP: "webmcp";
589
652
  };
590
653
  export type ActionType = (typeof ActionType)[keyof typeof ActionType];
@@ -620,7 +683,7 @@ export interface ComponentStateResult {
620
683
  note: string;
621
684
  };
622
685
  }
623
- /** Element states the assertion engine can check (plan/06). */
686
+ /** Element states the assertion engine can check. */
624
687
  export declare const ElementState: {
625
688
  readonly VISIBLE: "visible";
626
689
  readonly HIDDEN: "hidden";
@@ -640,7 +703,7 @@ export declare const ElementState: {
640
703
  readonly IN_VIEWPORT: "inViewport";
641
704
  };
642
705
  export type ElementState = (typeof ElementState)[keyof typeof ElementState];
643
- /** Query strategies, aligned with Testing Library semantics (plan/04). */
706
+ /** Query strategies, aligned with Testing Library semantics. */
644
707
  export declare const QueryBy: {
645
708
  readonly ROLE: "role";
646
709
  readonly TEXT: "text";
@@ -680,7 +743,7 @@ export declare const ReticleCommand: {
680
743
  /**
681
744
  * Bridge -> browser: the user's own impact record, so the HUD can show what Reticle has done for
682
745
  * them without the page asking for it. `args: { snapshot: ImpactSnapshot }`. Local data on a
683
- * local socket - it is the same file the report is stored in, not a fetch to us.
746
+ * local socket - it is the same file the report is stored in, not a network fetch.
684
747
  */
685
748
  readonly IMPACT: "impact";
686
749
  /**
@@ -711,7 +774,7 @@ export declare const PresenterMode: {
711
774
  readonly ACTING: "acting";
712
775
  };
713
776
  export type PresenterMode = (typeof PresenterMode)[keyof typeof PresenterMode];
714
- /** Snapshot rendering modes (plan/04). */
777
+ /** Snapshot rendering modes. */
715
778
  export declare const SnapshotMode: {
716
779
  readonly FULL: "full";
717
780
  readonly INTERACTIVE: "interactive";
@@ -37,6 +37,17 @@ export const STATUS_PATH = '/status';
37
37
  */
38
38
  export const DRIVE_PATH = '/drive';
39
39
  export const RETICLE_PROTOCOL_VERSION = 1;
40
+ /**
41
+ * The oldest protocol version this build still talks to.
42
+ *
43
+ * A range rather than a single number. An exact door refuses a peer one version out, which is
44
+ * correct when both sides ship together and wrong the moment anything else implements this -- an
45
+ * SDK a user has not upgraded yet is not an incompatible SDK.
46
+ *
47
+ * Equal to the current version today, so nothing changes yet. It exists so that raising the current
48
+ * version is a decision about what to keep supporting, rather than an automatic break.
49
+ */
50
+ export const RETICLE_MIN_PROTOCOL_VERSION = 1;
40
51
  /**
41
52
  * The host a CLIENT names when it dials the bridge, as opposed to the address the bridge BINDS.
42
53
  *
@@ -69,6 +80,15 @@ export function bridgeWsUrl(port = RETICLE_DEFAULT_PORT, host = RETICLE_CLIENT_H
69
80
  export const RETICLE_URL_PARAM = {
70
81
  SESSION: '__reticle_session',
71
82
  PROJECT: '__reticle_project',
83
+ /**
84
+ * "Reticle opened this page for itself" — and nothing more.
85
+ *
86
+ * Deliberately NOT the session stamp. `resolveConnectIdentity` reads SESSION as the session id
87
+ * when the app names none, so marking a drive with it would rename every driven session to one
88
+ * shared constant and make two concurrent drives collide. This carries the one fact the page
89
+ * needs (nobody is sitting in front of it) without touching identity.
90
+ */
91
+ OPENED: '__reticle_opened',
72
92
  };
73
93
  /** The loopback bind address. The daemon/bridge bind here by default — never expose Reticle off-host. */
74
94
  export const LOOPBACK_HOST = '127.0.0.1';
@@ -146,6 +166,20 @@ export const ReticleEnv = {
146
166
  RECONNECT_ATTEMPTS: 'RETICLE_RECONNECT_ATTEMPTS',
147
167
  /** Quiet window before an abandoned MCP stdio proxy exits; `0` disables the watcher. */
148
168
  MCP_PROXY_IDLE: 'RETICLE_MCP_PROXY_IDLE_MS',
169
+ /**
170
+ * API key for the harness — the model that drives the app when no coding agent is in the loop.
171
+ *
172
+ * The standard Anthropic name, on purpose: a machine that can already run a coding agent can
173
+ * already run the harness, with nothing to configure. Absent ⇒ the harness is simply unavailable
174
+ * and every other part of Reticle is unaffected.
175
+ */
176
+ HARNESS_KEY: 'ANTHROPIC_API_KEY',
177
+ /** Model the harness drives with. Defaults to a small one — see `DEFAULT_HARNESS_MODEL`. */
178
+ HARNESS_MODEL: 'RETICLE_HARNESS_MODEL',
179
+ /** Base URL for the harness's model API, for a proxy or a gateway. */
180
+ HARNESS_BASE_URL: 'RETICLE_HARNESS_BASE_URL',
181
+ /** Hard ceiling on harness model turns in one drive. Bounds cost, not value. */
182
+ HARNESS_MAX_STEPS: 'RETICLE_HARNESS_MAX_STEPS',
149
183
  };
150
184
  /** Hard transport bounds shared by the browser and bridge. */
151
185
  export const TRANSPORT_LIMITS = {
@@ -153,25 +187,17 @@ export const TRANSPORT_LIMITS = {
153
187
  /**
154
188
  * Inbound events per second before the bridge SAMPLES rather than records everything.
155
189
  *
156
- * This was 1000, and an ordinary React app with an active query cache blew through it: the
157
- * reporter's FIRST `act_and_wait` of the session came back `unknown` with `unclean_capture` and a
158
- * four-figure drop count, and setting the env override to twenty times the default fixed it (#316).
159
- * Reticle was right to refuse the verdict — a sampled window cannot support one, and the guard that
160
- * catches false greens is blindest exactly there — but landing that on the first drive after an
161
- * install, recoverable only by knowing an environment variable exists and inventing a number for
162
- * it, is the worst possible place to spend the honesty.
163
- *
164
- * 20000 is the value that was measured to work on the page that reported it. The cap exists to stop
165
- * a PATHOLOGICAL page (an animation loop firing DOM mutations every frame), not to throttle a busy
166
- * one, and the ceiling it has to defend is cheap: the daemon is on the same machine and a typical
167
- * event is a few hundred bytes, so this is single-digit MB/s over loopback.
190
+ * The cap exists to stop a PATHOLOGICAL page (an animation loop firing DOM mutations every frame),
191
+ * not to throttle a busy one: an ordinary React app with an active query cache passes 1000/s, and a
192
+ * sampled window cannot support a verdict, so too low a cap answers `unknown` with
193
+ * `unclean_capture` on the first `act_and_wait` after an install (#316).
168
194
  *
169
- * Raising it does not raise what a runaway page can make the bridge HOLD, and that separation is
170
- * what makes the change safe. Memory is bounded independently by the ring buffer, which evicts on
171
- * `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant, reached through that alias) as well as on
172
- * a count and an age. Grep for `MAX_BUFFER_BYTES` alone and it looks like a constant nobody reads,
173
- * which is exactly the wrong conclusion to draw before touching this number: the rate cap defends
174
- * parse cost, the ring buffer defends memory, and they are not substitutes.
195
+ * The ceiling it defends is cheap — the daemon is on the same machine and a typical event is a few
196
+ * hundred bytes, so 20000/s is single-digit MB/s over loopback. Raising it does not raise what a
197
+ * runaway page can make the bridge HOLD: memory is bounded independently by the ring buffer, which
198
+ * evicts on `RING_BUFFER_DEFAULTS.MAX_BYTES` (this same constant through that alias) as well as on
199
+ * a count and an age. The rate cap defends parse cost, the ring buffer defends memory, and they are
200
+ * not substitutes.
175
201
  */
176
202
  MAX_MESSAGES_PER_SECOND: 20000,
177
203
  MAX_SESSIONS: 32,
@@ -182,6 +208,21 @@ export const TRANSPORT_LIMITS = {
182
208
  MAX_URL_LENGTH: 4096,
183
209
  MAX_TITLE_LENGTH: 512,
184
210
  MAX_ADAPTERS: 32,
211
+ /*
212
+ * The cap on ONE vocabulary in `contractParts` — the commands, events or actions a peer says it
213
+ * speaks.
214
+ *
215
+ * Its own number, and the reason is an outage this nearly shipped. `contractParts` reused
216
+ * `MAX_ADAPTERS` (32), and this implementation's own event vocabulary is larger than that. The
217
+ * field had never had a producer, so nothing had ever tried: the first build to actually send it
218
+ * had every HELLO rejected by the schema and NO SESSION COULD CONNECT AT ALL. The unit gate is
219
+ * blind to it — the schema accepts the shape in isolation, and only a real page talking to a real
220
+ * daemon fails — so the e2e battery is what caught it.
221
+ *
222
+ * 128 leaves the vocabularies room to roughly triple. A cap here is still worth having: this
223
+ * arrives on an unauthenticated HELLO, so it is an untrusted list and the bound is chosen here.
224
+ */
225
+ MAX_CONTRACT_NAMES: 128,
185
226
  MAX_ADAPTER_NAME_LENGTH: 128,
186
227
  MAX_TOKEN_LENGTH: 512,
187
228
  MAX_COMMAND_ID_LENGTH: 128,
@@ -224,8 +265,8 @@ export const ReticleDir = {
224
265
  /**
225
266
  * the user's own record of what Reticle has done for them — .reticle/impact.json.
226
267
  *
227
- * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers our
228
- * questions about the product; this answers the user's question about their own work.
268
+ * Local only, never uploaded, and deliberately NOT part of telemetry: telemetry answers questions
269
+ * about the product; this answers the user's question about their own work.
229
270
  */
230
271
  IMPACT_FILE: 'impact.json',
231
272
  /** what changes were SUPPOSED to make true —.reticle/intent.json (git-checked, reviewed) */
@@ -268,6 +309,17 @@ export const ReticleDir = {
268
309
  ISSUES_FILE: 'issues.json',
269
310
  /** Per-flow assertion tiers recorded on each PASSING replay — the gate's anti-downgrade baseline. */
270
311
  TIERS_FILE: 'assertion-tiers.json',
312
+ /**
313
+ * what to run when something happens — .reticle/hooks.json. Git-checked on purpose: a hook is a
314
+ * decision the whole team shares, the same way a git hook or a package script is, and one that
315
+ * only exists on the machine that wrote it is a rule nobody else is following.
316
+ *
317
+ * It names COMMANDS, so it is exactly as trusted as `package.json` scripts in the same repository
318
+ * and no more: opening a repo does not run them, and Reticle runs one only when the event it is
319
+ * attached to actually happens. The event payload is handed over on stdin, never interpolated into
320
+ * the command line, so a defect's own text can never become part of a command.
321
+ */
322
+ HOOKS_FILE: 'hooks.json',
271
323
  /**
272
324
  * Auto-provisioned bridge pairing token, stored at ~/.reticle/pairing-token (mode 0600). Written by
273
325
  * the daemon, read Node-side by the build plugins to inject into connect. A browser sandbox cannot
@@ -336,9 +388,7 @@ export const ContractReadError = {
336
388
  MISSING: 'contract-missing', // no .reticle/contract.json on disk
337
389
  MALFORMED: 'contract-malformed', // present but not valid JSON / fails schema
338
390
  };
339
- /** On-disk artifact constants (project/flow/replay/recorder/heal/annotation) live here. */
340
- export * from './flow-constants.js';
341
- /** Bounds for the per-session ring buffer (see plan/02-architecture.md). */
391
+ /** Bounds for the per-session ring buffer. */
342
392
  export const RING_BUFFER_DEFAULTS = {
343
393
  MAX_EVENTS: 2000,
344
394
  MAX_AGE_MS: 60_000,
@@ -560,7 +610,7 @@ export const DriveErrorCode = {
560
610
  };
561
611
  /** Human-facing message when the optional playwright dep is absent. */
562
612
  export const DRIVE_PLAYWRIGHT_MISSING_MSG = "reticle drive needs the optional 'playwright' package — install it: pnpm add -D playwright && npx playwright install chromium";
563
- /** Actions the executor can perform against a ref (plan/03 + plan/05). */
613
+ /** Actions the executor can perform against a ref. */
564
614
  /**
565
615
  * The console levels an agent can filter by, DERIVED from the console EventTypes rather than
566
616
  * retyped. `reticle_console { level }` matches by building `console.${level}`, so any list written
@@ -590,7 +640,34 @@ export const ActionType = {
590
640
  PRESS: 'press',
591
641
  UPLOAD: 'upload',
592
642
  SCROLL_INTO_VIEW: 'scrollIntoView',
643
+ /**
644
+ * Scroll a container (or the document) by a delta, in either axis and EITHER DIRECTION.
645
+ *
646
+ * `scrollIntoView` puts a known element on screen; this is the gesture for looking around when you
647
+ * do not know what you are looking for yet — back up to what scrolled past, or move sideways on a
648
+ * wide table. Until now the only scroll available stepped DOWN, so a page could be walked in one
649
+ * direction and never back, and `inspect` reported `scrollLeft`/`scrollWidth` that nothing could act on.
650
+ */
651
+ SCROLL: 'scroll',
593
652
  DRAG: 'drag',
653
+ /**
654
+ * A TOUCH tap: pointerdown(touch) → touchstart → touchend → pointerup → click.
655
+ *
656
+ * Not a click with another name. A handler bound to `touchstart`, or one that branches on
657
+ * `event.pointerType`, never runs for a mouse click — so mobile-web behaviour, swipe/press
658
+ * affordances and touch-only controls were undriveable. `args.holdMs` makes it a LONG PRESS, the
659
+ * gesture behind context menus and reorder handles on touch.
660
+ */
661
+ TAP: 'tap',
662
+ /**
663
+ * Page zoom, as a fraction (1 = 100%).
664
+ *
665
+ * Real browser zoom is not scriptable from inside the page, so this needs a driven browser and
666
+ * REFUSES without one rather than faking it with CSS — see the note on `hover`, which refuses for
667
+ * the same reason. A layout that breaks at 200% is a real and common defect; a CSS transform that
668
+ * merely looks like zoom would report it caught while the layout viewport never changed.
669
+ */
670
+ ZOOM: 'zoom',
594
671
  WEBMCP: 'webmcp',
595
672
  };
596
673
  /** Why an action's settle wait ended without a real animation frame. */
@@ -602,7 +679,7 @@ export const SettleReason = {
602
679
  export const ComponentStateReason = {
603
680
  UNAVAILABLE: 'component-state-unavailable',
604
681
  };
605
- /** Element states the assertion engine can check (plan/06). */
682
+ /** Element states the assertion engine can check. */
606
683
  export const ElementState = {
607
684
  VISIBLE: 'visible',
608
685
  HIDDEN: 'hidden',
@@ -621,7 +698,7 @@ export const ElementState = {
621
698
  */
622
699
  IN_VIEWPORT: 'inViewport',
623
700
  };
624
- /** Query strategies, aligned with Testing Library semantics (plan/04). */
701
+ /** Query strategies, aligned with Testing Library semantics. */
625
702
  export const QueryBy = {
626
703
  ROLE: 'role',
627
704
  TEXT: 'text',
@@ -660,7 +737,7 @@ export const ReticleCommand = {
660
737
  /**
661
738
  * Bridge -> browser: the user's own impact record, so the HUD can show what Reticle has done for
662
739
  * them without the page asking for it. `args: { snapshot: ImpactSnapshot }`. Local data on a
663
- * local socket - it is the same file the report is stored in, not a fetch to us.
740
+ * local socket - it is the same file the report is stored in, not a network fetch.
664
741
  */
665
742
  IMPACT: 'impact',
666
743
  /**
@@ -689,7 +766,7 @@ export const PresenterMode = {
689
766
  READING: 'reading',
690
767
  ACTING: 'acting',
691
768
  };
692
- /** Snapshot rendering modes (plan/04). */
769
+ /** Snapshot rendering modes. */
693
770
  export const SnapshotMode = {
694
771
  FULL: 'full',
695
772
  INTERACTIVE: 'interactive',
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Session lifecycle, health, control, and lease constants. Split out of constants.ts to keep each
3
- * file under the cohesion cap; re-exported from the package index, so importers are unaffected.
2
+ * Session lifecycle, health, control, and lease constants. Re-exported from the package index.
4
3
  */
5
4
  /**
6
5
  * Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
@@ -28,6 +27,14 @@ export declare const HumanControlKind: {
28
27
  readonly MESSAGE: "message";
29
28
  /** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
30
29
  readonly REPLAY: "replay";
30
+ /**
31
+ * Human asked the panel to push to the dashboard NOW, rather than waiting for the sync timer.
32
+ *
33
+ * The timer already keeps the dashboard current on its own, so this is not how sync happens — it
34
+ * is how somebody watching the panel stops wondering whether it is happening. Carries nothing:
35
+ * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
36
+ */
37
+ readonly SYNC: "sync";
31
38
  };
32
39
  export type HumanControlKind = (typeof HumanControlKind)[keyof typeof HumanControlKind];
33
40
  /**
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Session lifecycle, health, control, and lease constants. Split out of constants.ts to keep each
3
- * file under the cohesion cap; re-exported from the package index, so importers are unaffected.
2
+ * Session lifecycle, health, control, and lease constants. Re-exported from the package index.
4
3
  */
5
4
  /**
6
5
  * Live-control: per-session lifecycle state (server-owned). The presenter panel mirrors it.
@@ -29,6 +28,14 @@ export const HumanControlKind = {
29
28
  MESSAGE: 'message',
30
29
  /** Human clicked ▶ on a saved flow in the panel — replay it (no agent). `text` carries the name. */
31
30
  REPLAY: 'replay',
31
+ /**
32
+ * Human asked the panel to push to the dashboard NOW, rather than waiting for the sync timer.
33
+ *
34
+ * The timer already keeps the dashboard current on its own, so this is not how sync happens — it
35
+ * is how somebody watching the panel stops wondering whether it is happening. Carries nothing:
36
+ * what to send is the daemon's question, and a panel that named artifacts could disagree with it.
37
+ */
38
+ SYNC: 'sync',
32
39
  };
33
40
  /**
34
41
  * Human review marks: the durability tier of the anchor that pins a mark to an element. Mirrors the
@@ -1,4 +1,4 @@
1
- import { VisualReason } from './constants.js';
1
+ import { VisualReason } from './constants/constants.js';
2
2
  /**
3
3
  * The desktop wiring contract — the single source of truth for the strings that let an Electron
4
4
  * app's three worlds recognise each other.
@@ -1,4 +1,4 @@
1
- import { EventType } from './constants.js';
1
+ import { EventType } from './constants/constants.js';
2
2
  /**
3
3
  * The high-volume, low-signal floor. These fire continuously on any live page and are the ONLY
4
4
  * thing that should be sacrificed when a buffer is full. Everything else is scarce evidence a