@reticlehq/browser 2.0.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 (191) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +17 -0
  3. package/dist/actions/actions-dom.d.ts +29 -0
  4. package/dist/actions/actions-dom.d.ts.map +1 -0
  5. package/dist/actions/actions-dom.js +153 -0
  6. package/dist/actions/actions-dom.js.map +1 -0
  7. package/dist/actions/actions.d.ts +92 -0
  8. package/dist/actions/actions.d.ts.map +1 -0
  9. package/dist/actions/actions.js +348 -0
  10. package/dist/actions/actions.js.map +1 -0
  11. package/dist/actions/scroll.d.ts +19 -0
  12. package/dist/actions/scroll.d.ts.map +1 -0
  13. package/dist/actions/scroll.js +44 -0
  14. package/dist/actions/scroll.js.map +1 -0
  15. package/dist/commands/commands.d.ts +5 -0
  16. package/dist/commands/commands.d.ts.map +1 -0
  17. package/dist/commands/commands.js +246 -0
  18. package/dist/commands/commands.js.map +1 -0
  19. package/dist/dom/a11y.d.ts +20 -0
  20. package/dist/dom/a11y.d.ts.map +1 -0
  21. package/dist/dom/a11y.js +263 -0
  22. package/dist/dom/a11y.js.map +1 -0
  23. package/dist/dom/auto-anchor.d.ts +66 -0
  24. package/dist/dom/auto-anchor.d.ts.map +1 -0
  25. package/dist/dom/auto-anchor.js +75 -0
  26. package/dist/dom/auto-anchor.js.map +1 -0
  27. package/dist/dom/dom-ignore.d.ts +7 -0
  28. package/dist/dom/dom-ignore.d.ts.map +1 -0
  29. package/dist/dom/dom-ignore.js +21 -0
  30. package/dist/dom/dom-ignore.js.map +1 -0
  31. package/dist/dom/query.d.ts +6 -0
  32. package/dist/dom/query.d.ts.map +1 -0
  33. package/dist/dom/query.js +236 -0
  34. package/dist/dom/query.js.map +1 -0
  35. package/dist/dom/refs.d.ts +15 -0
  36. package/dist/dom/refs.d.ts.map +1 -0
  37. package/dist/dom/refs.js +36 -0
  38. package/dist/dom/refs.js.map +1 -0
  39. package/dist/dom/snapshot.d.ts +22 -0
  40. package/dist/dom/snapshot.d.ts.map +1 -0
  41. package/dist/dom/snapshot.js +171 -0
  42. package/dist/dom/snapshot.js.map +1 -0
  43. package/dist/dom/theme.d.ts +26 -0
  44. package/dist/dom/theme.d.ts.map +1 -0
  45. package/dist/dom/theme.js +90 -0
  46. package/dist/dom/theme.js.map +1 -0
  47. package/dist/index.d.ts +25 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +32 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/observers/animation.d.ts +4 -0
  52. package/dist/observers/animation.d.ts.map +1 -0
  53. package/dist/observers/animation.js +35 -0
  54. package/dist/observers/animation.js.map +1 -0
  55. package/dist/observers/console.d.ts +4 -0
  56. package/dist/observers/console.d.ts.map +1 -0
  57. package/dist/observers/console.js +58 -0
  58. package/dist/observers/console.js.map +1 -0
  59. package/dist/observers/dom.d.ts +4 -0
  60. package/dist/observers/dom.d.ts.map +1 -0
  61. package/dist/observers/dom.js +96 -0
  62. package/dist/observers/dom.js.map +1 -0
  63. package/dist/observers/health.d.ts +8 -0
  64. package/dist/observers/health.d.ts.map +1 -0
  65. package/dist/observers/health.js +33 -0
  66. package/dist/observers/health.js.map +1 -0
  67. package/dist/observers/network.d.ts +11 -0
  68. package/dist/observers/network.d.ts.map +1 -0
  69. package/dist/observers/network.js +128 -0
  70. package/dist/observers/network.js.map +1 -0
  71. package/dist/observers/route.d.ts +4 -0
  72. package/dist/observers/route.d.ts.map +1 -0
  73. package/dist/observers/route.js +56 -0
  74. package/dist/observers/route.js.map +1 -0
  75. package/dist/observers/scroll.d.ts +4 -0
  76. package/dist/observers/scroll.d.ts.map +1 -0
  77. package/dist/observers/scroll.js +42 -0
  78. package/dist/observers/scroll.js.map +1 -0
  79. package/dist/observers/types.d.ts +6 -0
  80. package/dist/observers/types.d.ts.map +1 -0
  81. package/dist/observers/types.js +2 -0
  82. package/dist/observers/types.js.map +1 -0
  83. package/dist/presenter/overlay.d.ts +12 -0
  84. package/dist/presenter/overlay.d.ts.map +1 -0
  85. package/dist/presenter/overlay.js +31 -0
  86. package/dist/presenter/overlay.js.map +1 -0
  87. package/dist/presenter/presenter-config.d.ts +86 -0
  88. package/dist/presenter/presenter-config.d.ts.map +1 -0
  89. package/dist/presenter/presenter-config.js +51 -0
  90. package/dist/presenter/presenter-config.js.map +1 -0
  91. package/dist/presenter/presenter-controls.d.ts +74 -0
  92. package/dist/presenter/presenter-controls.d.ts.map +1 -0
  93. package/dist/presenter/presenter-controls.js +360 -0
  94. package/dist/presenter/presenter-controls.js.map +1 -0
  95. package/dist/presenter/presenter-effects.d.ts +14 -0
  96. package/dist/presenter/presenter-effects.d.ts.map +1 -0
  97. package/dist/presenter/presenter-effects.js +40 -0
  98. package/dist/presenter/presenter-effects.js.map +1 -0
  99. package/dist/presenter/presenter-glow.d.ts +43 -0
  100. package/dist/presenter/presenter-glow.d.ts.map +1 -0
  101. package/dist/presenter/presenter-glow.js +126 -0
  102. package/dist/presenter/presenter-glow.js.map +1 -0
  103. package/dist/presenter/presenter-log.d.ts +43 -0
  104. package/dist/presenter/presenter-log.d.ts.map +1 -0
  105. package/dist/presenter/presenter-log.js +118 -0
  106. package/dist/presenter/presenter-log.js.map +1 -0
  107. package/dist/presenter/presenter-run-state.d.ts +48 -0
  108. package/dist/presenter/presenter-run-state.d.ts.map +1 -0
  109. package/dist/presenter/presenter-run-state.js +37 -0
  110. package/dist/presenter/presenter-run-state.js.map +1 -0
  111. package/dist/presenter/presenter-styles.d.ts +7 -0
  112. package/dist/presenter/presenter-styles.d.ts.map +1 -0
  113. package/dist/presenter/presenter-styles.js +118 -0
  114. package/dist/presenter/presenter-styles.js.map +1 -0
  115. package/dist/presenter/presenter-tally.d.ts +20 -0
  116. package/dist/presenter/presenter-tally.d.ts.map +1 -0
  117. package/dist/presenter/presenter-tally.js +38 -0
  118. package/dist/presenter/presenter-tally.js.map +1 -0
  119. package/dist/presenter/presenter-verbs.d.ts +2 -0
  120. package/dist/presenter/presenter-verbs.d.ts.map +1 -0
  121. package/dist/presenter/presenter-verbs.js +29 -0
  122. package/dist/presenter/presenter-verbs.js.map +1 -0
  123. package/dist/presenter/presenter.d.ts +89 -0
  124. package/dist/presenter/presenter.d.ts.map +1 -0
  125. package/dist/presenter/presenter.js +428 -0
  126. package/dist/presenter/presenter.js.map +1 -0
  127. package/dist/recorder/recorder-styles.d.ts +12 -0
  128. package/dist/recorder/recorder-styles.d.ts.map +1 -0
  129. package/dist/recorder/recorder-styles.js +45 -0
  130. package/dist/recorder/recorder-styles.js.map +1 -0
  131. package/dist/recorder/recorder.d.ts +60 -0
  132. package/dist/recorder/recorder.d.ts.map +1 -0
  133. package/dist/recorder/recorder.js +436 -0
  134. package/dist/recorder/recorder.js.map +1 -0
  135. package/dist/registry/adapters.d.ts +31 -0
  136. package/dist/registry/adapters.d.ts.map +1 -0
  137. package/dist/registry/adapters.js +47 -0
  138. package/dist/registry/adapters.js.map +1 -0
  139. package/dist/registry/capabilities.d.ts +25 -0
  140. package/dist/registry/capabilities.d.ts.map +1 -0
  141. package/dist/registry/capabilities.js +48 -0
  142. package/dist/registry/capabilities.js.map +1 -0
  143. package/dist/registry/commit-and-signal.d.ts +9 -0
  144. package/dist/registry/commit-and-signal.d.ts.map +1 -0
  145. package/dist/registry/commit-and-signal.js +12 -0
  146. package/dist/registry/commit-and-signal.js.map +1 -0
  147. package/dist/registry/domains.d.ts +15 -0
  148. package/dist/registry/domains.d.ts.map +1 -0
  149. package/dist/registry/domains.js +19 -0
  150. package/dist/registry/domains.js.map +1 -0
  151. package/dist/registry/emitter.d.ts +28 -0
  152. package/dist/registry/emitter.d.ts.map +1 -0
  153. package/dist/registry/emitter.js +27 -0
  154. package/dist/registry/emitter.js.map +1 -0
  155. package/dist/registry/stores.d.ts +9 -0
  156. package/dist/registry/stores.d.ts.map +1 -0
  157. package/dist/registry/stores.js +30 -0
  158. package/dist/registry/stores.js.map +1 -0
  159. package/dist/reticle-presenter-helpers.d.ts +19 -0
  160. package/dist/reticle-presenter-helpers.d.ts.map +1 -0
  161. package/dist/reticle-presenter-helpers.js +81 -0
  162. package/dist/reticle-presenter-helpers.js.map +1 -0
  163. package/dist/reticle.d.ts +113 -0
  164. package/dist/reticle.d.ts.map +1 -0
  165. package/dist/reticle.js +379 -0
  166. package/dist/reticle.js.map +1 -0
  167. package/dist/review/annotator.d.ts +36 -0
  168. package/dist/review/annotator.d.ts.map +1 -0
  169. package/dist/review/annotator.js +321 -0
  170. package/dist/review/annotator.js.map +1 -0
  171. package/dist/review/mark-anchor.d.ts +23 -0
  172. package/dist/review/mark-anchor.d.ts.map +1 -0
  173. package/dist/review/mark-anchor.js +74 -0
  174. package/dist/review/mark-anchor.js.map +1 -0
  175. package/dist/security/serialization.d.ts +6 -0
  176. package/dist/security/serialization.d.ts.map +1 -0
  177. package/dist/security/serialization.js +103 -0
  178. package/dist/security/serialization.js.map +1 -0
  179. package/dist/timers/clock.d.ts +6 -0
  180. package/dist/timers/clock.d.ts.map +1 -0
  181. package/dist/timers/clock.js +80 -0
  182. package/dist/timers/clock.js.map +1 -0
  183. package/dist/timers/native-timers.d.ts +37 -0
  184. package/dist/timers/native-timers.d.ts.map +1 -0
  185. package/dist/timers/native-timers.js +79 -0
  186. package/dist/timers/native-timers.js.map +1 -0
  187. package/dist/transport/transport.d.ts +54 -0
  188. package/dist/transport/transport.d.ts.map +1 -0
  189. package/dist/transport/transport.js +182 -0
  190. package/dist/transport/transport.js.map +1 -0
  191. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Reticle Labs
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @reticlehq/browser
2
+
3
+ Browser SDK for [Reticle](https://github.com/reticlehq/reticle) — the proof layer for AI agents, embedded in your running web app. Embed it (dev only); it instruments the DOM, network, routes, console, animations, and scroll, and answers the agent's look/act/observe commands over a local bridge.
4
+
5
+ ```bash
6
+ npm i -D @reticlehq/browser
7
+ ```
8
+
9
+ ```ts
10
+ import { reticle } from '@reticlehq/browser';
11
+ if (import.meta.env.DEV) reticle.connect({ session: 'my-app' });
12
+
13
+ // surface non-DOM events too:
14
+ reticle.signal('webhook:received', { provider: 'stripe' });
15
+ ```
16
+
17
+ Pair with [`@reticlehq/server`](https://www.npmjs.com/package/@reticlehq/server) (the bridge + MCP server) and optionally [`@reticlehq/react`](https://www.npmjs.com/package/@reticlehq/react) for component/source mapping. See the [main README](https://github.com/reticlehq/reticle) for the full picture. Dev-only, localhost-only by default. MIT.
@@ -0,0 +1,29 @@
1
+ interface ClickGeometry {
2
+ occluded: boolean;
3
+ occludedBy: string | null;
4
+ scrolledIntoView: boolean;
5
+ }
6
+ export declare const NO_GEOMETRY: ClickGeometry;
7
+ /**
8
+ * Full click as a real user produces it: pointerdown -> mousedown -> focus -> pointerup -> mouseup
9
+ * -> click. A bare `click` event skips pointer- and focus-gated handlers. Returns the click event's
10
+ * `defaultPrevented` so the probe is unchanged. Focus only moves for focusable targets (tabIndex>=0),
11
+ * so a plain <div> click still reports focusMoved=null.
12
+ */
13
+ export declare function fireClickSequence(el: HTMLElement): boolean;
14
+ /**
15
+ * Click-like geometry honesty: scroll an off-viewport target into view, then hit-test the click
16
+ * point. Synthetic dispatch always reaches the target regardless — this is purely so the agent
17
+ * learns when the target is off-screen or visually blocked instead of getting a false "it worked".
18
+ */
19
+ export declare function clickGeometry(el: HTMLElement): ClickGeometry;
20
+ export declare function firePointer(el: Element, type: string, relatedTarget?: EventTarget | null): void;
21
+ /** Enter/leave pointer events are non-bubbling per spec; keep them so to avoid double-firing. */
22
+ export declare function firePointerNonBubbling(el: Element, type: string, relatedTarget?: EventTarget | null): void;
23
+ /**
24
+ * Pointer-based drag (dnd-kit / react-beautiful-dnd) + best-effort HTML5 DnD. Async: yields a
25
+ * frame between phases so React commits state between steps (fixes stale-closure handlers).
26
+ */
27
+ export declare function dragElement(source: HTMLElement, target: HTMLElement | null, data: unknown): Promise<boolean>;
28
+ export {};
29
+ //# sourceMappingURL=actions-dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions-dom.d.ts","sourceRoot":"","sources":["../../src/actions/actions-dom.ts"],"names":[],"mappings":"AAGA,UAAU,aAAa;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AACD,eAAO,MAAM,WAAW,EAAE,aAIzB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAY1D;AAwCD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,GAAG,aAAa,CAW5D;AAED,wBAAgB,WAAW,CACzB,EAAE,EAAE,OAAO,EACX,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,WAAW,GAAG,IAAW,GACvC,IAAI,CAMN;AAED,iGAAiG;AACjG,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,OAAO,EACX,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,WAAW,GAAG,IAAW,GACvC,IAAI,CAMN;AAgBD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,GAAG,IAAI,EAC1B,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,OAAO,CAAC,CAgClB"}
@@ -0,0 +1,153 @@
1
+ import { refs } from '../dom/refs.js';
2
+ import { nativeFrame } from '../timers/native-timers.js';
3
+ export const NO_GEOMETRY = {
4
+ occluded: false,
5
+ occludedBy: null,
6
+ scrolledIntoView: false,
7
+ };
8
+ /**
9
+ * Full click as a real user produces it: pointerdown -> mousedown -> focus -> pointerup -> mouseup
10
+ * -> click. A bare `click` event skips pointer- and focus-gated handlers. Returns the click event's
11
+ * `defaultPrevented` so the probe is unchanged. Focus only moves for focusable targets (tabIndex>=0),
12
+ * so a plain <div> click still reports focusMoved=null.
13
+ */
14
+ export function fireClickSequence(el) {
15
+ const doc = el.ownerDocument;
16
+ const from = doc.activeElement ?? doc.body;
17
+ firePointer(el, 'pointerdown', from);
18
+ el.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, cancelable: true }));
19
+ if (el.tabIndex >= 0 && typeof el.focus === 'function')
20
+ el.focus();
21
+ firePointer(el, 'pointerup', from);
22
+ el.dispatchEvent(new MouseEvent('mouseup', { bubbles: true, cancelable: true }));
23
+ const notPrevented = el.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
24
+ return !notPrevented;
25
+ }
26
+ /** A box has layout we can reason about (jsdom returns an all-zero box — nothing to hit-test). */
27
+ function isMeasurable(rect) {
28
+ return rect.width > 0 || rect.height > 0;
29
+ }
30
+ /** The center of `rect` falls outside the visible viewport. */
31
+ function isOffViewport(el, rect) {
32
+ const win = el.ownerDocument.defaultView;
33
+ if (win === null)
34
+ return false;
35
+ const cx = rect.left + rect.width / 2;
36
+ const cy = rect.top + rect.height / 2;
37
+ return cx < 0 || cy < 0 || cx > win.innerWidth || cy > win.innerHeight;
38
+ }
39
+ /** True if the node (or an ancestor) is Reticle's own injected UI — it must never count as an occluder. */
40
+ function isReticleUi(node) {
41
+ for (let n = node; n !== null; n = n.parentElement) {
42
+ for (const attr of Array.from(n.attributes)) {
43
+ if (attr.name.startsWith('data-reticle'))
44
+ return true;
45
+ }
46
+ }
47
+ return false;
48
+ }
49
+ /** Hit-test the center: occluded iff the top NON-Reticle element is a foreign subtree (not target/ancestor/descendant). */
50
+ function hitTest(el, rect) {
51
+ const doc = el.ownerDocument;
52
+ if (typeof doc.elementFromPoint !== 'function')
53
+ return { occluded: false, occludedBy: null };
54
+ const top = doc.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);
55
+ // null ⇒ no layout / detached (jsdom): we cannot tell, so never false-positive occlusion.
56
+ // Reticle's own HUD must never read as an occluder.
57
+ if (top === null || isReticleUi(top))
58
+ return { occluded: false, occludedBy: null };
59
+ const lands = top === el || el.contains(top) || top.contains(el);
60
+ return lands
61
+ ? { occluded: false, occludedBy: null }
62
+ : { occluded: true, occludedBy: refs.refFor(top) };
63
+ }
64
+ /**
65
+ * Click-like geometry honesty: scroll an off-viewport target into view, then hit-test the click
66
+ * point. Synthetic dispatch always reaches the target regardless — this is purely so the agent
67
+ * learns when the target is off-screen or visually blocked instead of getting a false "it worked".
68
+ */
69
+ export function clickGeometry(el) {
70
+ if (typeof el.getBoundingClientRect !== 'function')
71
+ return NO_GEOMETRY;
72
+ let rect = el.getBoundingClientRect();
73
+ if (!isMeasurable(rect))
74
+ return NO_GEOMETRY;
75
+ let scrolledIntoView = false;
76
+ if (isOffViewport(el, rect) && typeof el.scrollIntoView === 'function') {
77
+ el.scrollIntoView({ block: 'center', inline: 'center' });
78
+ scrolledIntoView = true;
79
+ rect = el.getBoundingClientRect();
80
+ }
81
+ return { ...hitTest(el, rect), scrolledIntoView };
82
+ }
83
+ export function firePointer(el, type, relatedTarget = null) {
84
+ if (typeof PointerEvent === 'function') {
85
+ el.dispatchEvent(new PointerEvent(type, { bubbles: true, cancelable: true, relatedTarget }));
86
+ }
87
+ else {
88
+ el.dispatchEvent(new MouseEvent(type, { bubbles: true, cancelable: true, relatedTarget }));
89
+ }
90
+ }
91
+ /** Enter/leave pointer events are non-bubbling per spec; keep them so to avoid double-firing. */
92
+ export function firePointerNonBubbling(el, type, relatedTarget = null) {
93
+ if (typeof PointerEvent === 'function') {
94
+ el.dispatchEvent(new PointerEvent(type, { bubbles: false, cancelable: true, relatedTarget }));
95
+ }
96
+ else {
97
+ el.dispatchEvent(new MouseEvent(type, { bubbles: false, cancelable: true, relatedTarget }));
98
+ }
99
+ }
100
+ function makeDataTransfer(data) {
101
+ if (typeof DataTransfer !== 'function')
102
+ return null;
103
+ const dt = new DataTransfer();
104
+ // data: { mime, value } or [{ mime, value }, …]
105
+ const entries = Array.isArray(data) ? data : data !== undefined ? [data] : [];
106
+ for (const entry of entries) {
107
+ if (typeof entry === 'object' && entry !== null) {
108
+ const e = entry;
109
+ if (typeof e.mime === 'string' && typeof e.value === 'string')
110
+ dt.setData(e.mime, e.value);
111
+ }
112
+ }
113
+ return dt;
114
+ }
115
+ /**
116
+ * Pointer-based drag (dnd-kit / react-beautiful-dnd) + best-effort HTML5 DnD. Async: yields a
117
+ * frame between phases so React commits state between steps (fixes stale-closure handlers).
118
+ */
119
+ export async function dragElement(source, target, data) {
120
+ const dest = target ?? source;
121
+ const fire = (el, type) => {
122
+ if (typeof PointerEvent === 'function' && type.startsWith('pointer')) {
123
+ el.dispatchEvent(new PointerEvent(type, { bubbles: true, cancelable: true }));
124
+ }
125
+ else {
126
+ el.dispatchEvent(new MouseEvent(type, { bubbles: true, cancelable: true }));
127
+ }
128
+ };
129
+ fire(source, 'pointerdown');
130
+ fire(source, 'mousedown');
131
+ await nativeFrame();
132
+ fire(dest, 'pointermove');
133
+ fire(dest, 'mousemove');
134
+ await nativeFrame();
135
+ fire(dest, 'pointerup');
136
+ fire(dest, 'mouseup');
137
+ let dropPrevented = false;
138
+ if (typeof DragEvent === 'function') {
139
+ const dataTransfer = makeDataTransfer(data);
140
+ const init = { bubbles: true, cancelable: true };
141
+ if (dataTransfer !== null)
142
+ init.dataTransfer = dataTransfer;
143
+ source.dispatchEvent(new DragEvent('dragstart', init));
144
+ await nativeFrame();
145
+ dest.dispatchEvent(new DragEvent('dragenter', init));
146
+ dest.dispatchEvent(new DragEvent('dragover', init));
147
+ await nativeFrame();
148
+ dropPrevented = !dest.dispatchEvent(new DragEvent('drop', init));
149
+ source.dispatchEvent(new DragEvent('dragend', init));
150
+ }
151
+ return dropPrevented;
152
+ }
153
+ //# sourceMappingURL=actions-dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions-dom.js","sourceRoot":"","sources":["../../src/actions/actions-dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBA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AAC,CAAC;IACxB,MAAM,WAAW,EAAE,CAAC;IACpB,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACxB,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAEtB,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QACpC,MAAM,YAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QAChE,IAAI,YAAY,KAAK,IAAI;YAAE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAC5D,MAAM,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QACvD,MAAM,WAAW,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;QACpD,MAAM,WAAW,EAAE,CAAC;QACpB,aAAa,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { SettleReason } from '@reticlehq/core';
2
+ /**
3
+ * Best-effort evidence of whether/why an action landed, so the agent can separate
4
+ * "my action missed" vs "app didn't react" vs "tool didn't dispatch". All probes are
5
+ * cheap and best-effort (see docs/usage.md §3).
6
+ */
7
+ interface ActionEffect {
8
+ /** We reached dispatch (no throw before it). Typed `true`: if we never dispatch we throw. */
9
+ dispatched: true;
10
+ /** Ref resolved to a still-connected element at read time. */
11
+ targetMatched: boolean;
12
+ /** a11y isVisible(el) at the start of the action. */
13
+ visible: boolean;
14
+ /** Not disabled / aria-disabled at the start of the action. */
15
+ enabled: boolean;
16
+ /** The primary cancelable event's dispatchEvent returned false (handler called preventDefault). */
17
+ defaultPrevented: boolean;
18
+ /** "<prevRef>-><newRef>" if document.activeElement changed, else null. body counts as null. */
19
+ focusMoved: string | null;
20
+ /** fill/type/clear only: input value before !== after; else false. */
21
+ valueChanged: boolean;
22
+ /** Mutation records counted by a short-lived MutationObserver (one microtask + rAF window). */
23
+ domMutatedWithin: number;
24
+ /**
25
+ * Click-like only: the center hit-tested to a foreign element (an overlay is on top). Synthetic
26
+ * dispatch STILL delivered the event to the target, but a real user could not click it — treat
27
+ * the target as visually blocked. `false` when not click-like or not hit-testable (no layout).
28
+ */
29
+ occluded: boolean;
30
+ /** Ref of the element actually on top at the click point when `occluded`, else null. */
31
+ occludedBy: string | null;
32
+ /** Click-like only: the target was off-viewport, so it was scrolled into view before dispatch. */
33
+ scrolledIntoView: boolean;
34
+ }
35
+ interface ActionResult {
36
+ ok: true;
37
+ ref: string;
38
+ action: string;
39
+ /** We reached dispatch without throwing. Mirror of effect.dispatched for top-level reads. */
40
+ dispatched: boolean;
41
+ /** A real animation frame fired within the settle budget (false = fallback timer fired). */
42
+ settled: boolean;
43
+ /** Why settle did not complete on a real frame: SettleReason.TIMEOUT when the budget fallback fired, else null. */
44
+ settleReason: SettleReason | null;
45
+ effect: ActionEffect;
46
+ /** data-testid of the resolved element, when present — lets the server compile a ref-stable replay step. */
47
+ testid?: string;
48
+ /**
49
+ * Auto-anchor fallback (attached ONLY when there is no testid): the element's nearest component
50
+ * name + source location, so the server can compile a stable `component` anchor instead of a
51
+ * degraded role one — addressing the element across replays with zero hand-added testids.
52
+ */
53
+ component?: string;
54
+ source?: {
55
+ file: string;
56
+ line: number;
57
+ column?: number;
58
+ };
59
+ /** Best-effort caveat the agent should heed (e.g. synthetic hover may not fire enter/leave). */
60
+ warning?: string;
61
+ }
62
+ /**
63
+ * Execute a single action against a ref and probe for best-effort evidence of effect.
64
+ * Always async: the MutationObserver read needs a microtask + rAF after dispatch.
65
+ */
66
+ export declare function executeAction(ref: string, action: string, args?: Record<string, unknown>): Promise<ActionResult>;
67
+ /** Best-effort WebMCP passthrough: call a navigator.modelContext tool if the site exposes one. */
68
+ export declare function dispatchWebMcp(tool: string, params: Record<string, unknown>, confirmDangerous?: boolean): Promise<unknown>;
69
+ export interface ActionStep {
70
+ ref: string;
71
+ action: string;
72
+ args?: Record<string, unknown>;
73
+ }
74
+ interface SequenceStepResult {
75
+ ref: string;
76
+ action: string;
77
+ /** per-step dispatch/settle outcome (see ActionResult). */
78
+ dispatched: boolean;
79
+ settled: boolean;
80
+ settleReason: SettleReason | null;
81
+ testid?: string;
82
+ /** best-effort caveat for this step (e.g. synthetic hover may not fire enter/leave). */
83
+ warning?: string;
84
+ }
85
+ export declare function executeSequence(steps: ActionStep[]): Promise<{
86
+ ok: true;
87
+ count: number;
88
+ effects: ActionEffect[];
89
+ steps: SequenceStepResult[];
90
+ }>;
91
+ export {};
92
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/actions/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,YAAY,EACb,MAAM,iBAAiB,CAAC;AAMzB;;;;GAIG;AACH,UAAU,YAAY;IACpB,6FAA6F;IAC7F,UAAU,EAAE,IAAI,CAAC;IACjB,8DAA8D;IAC9D,aAAa,EAAE,OAAO,CAAC;IACvB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;IACjB,mGAAmG;IACnG,gBAAgB,EAAE,OAAO,CAAC;IAC1B,+FAA+F;IAC/F,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,sEAAsE;I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