@reticlehq/computer 0.0.0-stage → 3.11.1
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.
- package/LICENSE +202 -0
- package/NOTICE +12 -0
- package/README.md +237 -2
- package/bin/attach.mjs +333 -0
- package/dist/attach.d.ts +105 -0
- package/dist/attach.js +234 -0
- package/dist/channels.d.ts +42 -0
- package/dist/channels.js +46 -0
- package/dist/computer-realm.d.ts +54 -0
- package/dist/computer-realm.js +487 -0
- package/dist/doctor.d.ts +32 -0
- package/dist/doctor.js +42 -0
- package/dist/driver.d.ts +227 -0
- package/dist/driver.js +73 -0
- package/dist/effect.d.ts +60 -0
- package/dist/effect.js +158 -0
- package/dist/files.d.ts +16 -0
- package/dist/files.js +40 -0
- package/dist/hud/port.d.ts +44 -0
- package/dist/hud/port.js +6 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +22 -0
- package/dist/lines.d.ts +34 -0
- package/dist/lines.js +80 -0
- package/dist/mac/from-ax.d.ts +27 -0
- package/dist/mac/from-ax.js +275 -0
- package/dist/mac/mac-driver.d.ts +42 -0
- package/dist/mac/mac-driver.js +355 -0
- package/dist/mac/mac-hud.d.ts +10 -0
- package/dist/mac/mac-hud.js +142 -0
- package/dist/peer/act-effect.d.ts +9 -0
- package/dist/peer/act-effect.js +13 -0
- package/dist/peer/commands.d.ts +87 -0
- package/dist/peer/commands.js +811 -0
- package/dist/peer/form.d.ts +62 -0
- package/dist/peer/form.js +103 -0
- package/dist/peer/link-switch.d.ts +12 -0
- package/dist/peer/link-switch.js +38 -0
- package/dist/peer/peer.d.ts +43 -0
- package/dist/peer/peer.js +216 -0
- package/dist/peer/pointer.d.ts +97 -0
- package/dist/peer/pointer.js +289 -0
- package/dist/peer/scroll.d.ts +12 -0
- package/dist/peer/scroll.js +157 -0
- package/dist/peer/seen.d.ts +18 -0
- package/dist/peer/seen.js +61 -0
- package/dist/peer/select.d.ts +27 -0
- package/dist/peer/select.js +78 -0
- package/dist/peer/window.d.ts +25 -0
- package/dist/peer/window.js +111 -0
- package/dist/ui-node.d.ts +93 -0
- package/dist/ui-node.js +192 -0
- package/dist/win/helper-launch.d.ts +16 -0
- package/dist/win/helper-launch.js +57 -0
- package/native/linux/Dockerfile +22 -0
- package/native/linux/reticle-atspi.py +933 -0
- package/native/linux/sandbox.mjs +127 -0
- package/native/mac/build/reticle-ax +0 -0
- package/native/mac/build/reticle-hud +0 -0
- package/native/mac/hud.swift +749 -0
- package/native/mac/reticle-ax.swift +1786 -0
- package/native/win/reticle-uia.ps1 +620 -0
- package/package.json +65 -3
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/NOTICE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Reticle
|
|
2
|
+
Copyright 2026 Reticle Labs
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Reticle Labs.
|
|
5
|
+
Licensed under the Apache License, Version 2.0.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Heroicons (presenter HUD)
|
|
10
|
+
Copyright (c) Tailwind Labs, Inc.
|
|
11
|
+
Licensed under the MIT License.
|
|
12
|
+
https://github.com/tailwindlabs/heroicons
|
package/README.md
CHANGED
|
@@ -1,3 +1,238 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @reticlehq/computer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Reticle realm for a desktop application. An agent reads the application, acts on it, and gets back what the action changed. There is no SDK in the application and nothing to install in it.
|
|
4
|
+
|
|
5
|
+
It runs on macOS (AX), Windows (UI Automation) and Linux (AT-SPI, on X11). The sections below say where a platform differs.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
- **It reads the application through the accessibility tree of the operating system.** The agent gets one line for each element that is on the screen: `- button "Save" (ref=e5)`. This is the same format that the web realm gives for a page.
|
|
10
|
+
- **Each action reports its effect.** After an action the realm reads again and says what appeared, what went away and what changed. An action that changed nothing is a result of its own: `cu.ui.no-effect`.
|
|
11
|
+
- **An effect is a change to what is on the screen.** An element with no size, such as an item of a closed menu, is not compared. The answer counts those changes apart, as `changedOffScreen`.
|
|
12
|
+
- **An element has the identifier its maker gave it.** The accessibility identifier of a native element, or the `id` of an element in a web view, is given as its test id. A saved flow then finds the element by it, also when several elements have the same role and name. An identifier that the toolkit made by itself is left out. With no identifier, a replay that finds two such elements presses none of them.
|
|
13
|
+
- **A change the application makes by itself is not an effect.** A clock or a tip that rotates changes with no action. The peer learns such a place from its looks between actions. A change there during an action is counted apart, as `changedByItself`. A place is one element: its parent, its role and its corner as seen from its parent, so it is the same place after the window was moved. When three or more places in one parent change by themselves, as the rows of a list that grows, the whole parent is such a place.
|
|
14
|
+
- **It acts only where a person can act.** Before a press, the realm asks the operating system which element is on top at that place. If another view or another window covers the target, the realm refuses and names what is on top.
|
|
15
|
+
- **It does not use the pointer or the keyboard of the person at the machine, unless a caller asks.** A press is an accessibility action. Text is typed with key events that go to the application, not to the screen. A caller that needs the real pointer or real keys asks for the foreground on that one action; see "The foreground".
|
|
16
|
+
- **It counts the bytes the application wrote to disk.** The operating system keeps the count, so the application cannot change it. The count is for the application's process and the processes it started. An action that wrote bytes with no change in a watched folder wrote somewhere else, and the realm then answers "not known" and does not blame the application. A count that did not move says that those processes wrote nothing. It does not prove that no file was written: a helper that the system runs for the application is not counted, and a process that the application started is not counted after it ends.
|
|
17
|
+
- **It reads the settings of the application.** A setting that an action changed is reported with its key and its values, as a `settings.changed` signal over the tools. It is often not on the screen and in no file that is watched. An application in a sandbox keeps its settings where the realm cannot read them; the realm then says nothing about settings, and that is not "no setting changed".
|
|
18
|
+
- **It sees that an action put something on the clipboard.** It reads only that the clipboard changed, never what is on it. Over the tools it is a `clipboard.changed` signal.
|
|
19
|
+
- **It can watch folders.** A file that an action writes becomes a `file.written` signal. A claim can then name the file, and not only the words that the application shows.
|
|
20
|
+
|
|
21
|
+
## What the person at the machine sees
|
|
22
|
+
|
|
23
|
+
The realm acts in the background, so the pointer of the person does not move. Two things on the screen say what the realm does:
|
|
24
|
+
|
|
25
|
+
- **A pointer of the realm's own.** An arrow, as a mouse has, in the colour of Reticle. It goes to the element the realm acts on, and a ring spreads from its tip when the realm acts: a light ring for an action, a red one for an action that was refused. A click goes through it.
|
|
26
|
+
- **The HUD, as in a browser.** The same parts in the same places, with the same colours and mark. At rest it is one circle at the bottom right, with the mark and a ring in the colour of the state: blue while the realm acts, amber while it waits or is paused, red after a refusal. A press opens it: the mark and the name, a row with the dot of the state, the action that runs and the two buttons, the last actions with what each one did, and a toolbar. **Pause** stops the realm: no action is done until the person presses the button again, and the agent is told why. **Stop** ends it: the realm does no more actions and leaves the application, as Ctrl-C on the command does.
|
|
27
|
+
- **A glow round the window the realm works in**, as the glow at the edge of a page in a browser: blue while an action runs, red when it was refused. It goes away a moment after the action.
|
|
28
|
+
|
|
29
|
+
The realm does not read its own window and does not act on it, so an agent cannot press the button of the person.
|
|
30
|
+
|
|
31
|
+
### Limits that only the person sets
|
|
32
|
+
|
|
33
|
+
An agent starts the command, so an agent picks its flags. The limits of the person at the machine are in a file of their own, `~/.reticle/computer.json`, and no flag lifts them:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{ "backgroundOnly": true, "hud": true }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`backgroundOnly` forbids the real pointer and real keys. `hud` keeps the window and the pointer of the realm on the screen, also with `--no-hud`. After **Stop** in the window, the command writes `~/.reticle/computer.stopped`, and no application is joined until the person removes that file. A program with a shell can change a file, so these files say what the person wants; they are not a wall.
|
|
40
|
+
|
|
41
|
+
The window never takes the keyboard, and the person can move it. Give `--no-hud` on a machine with nobody at it.
|
|
42
|
+
|
|
43
|
+
## For an agent
|
|
44
|
+
|
|
45
|
+
Three steps. The application needs no project and no set-up of its own.
|
|
46
|
+
|
|
47
|
+
1. See what is open: `reticle-computer --list` prints `{"apps":[{"name","process"}]}`.
|
|
48
|
+
2. Join one, and leave the command running: `reticle-computer --app "<name>"`. It waits for the Reticle daemon when there is none yet, and then prints one line of JSON: `{"joined":true,"sessionId":"…","needsSessionId":true,"next":[…]}`. `next` says what to call. Add `--open` to start an application that is not open; it starts behind the application in front. When the person works in a full-screen Space, that window is on another Space and cannot be read: the answer then has `readable: false` and `why`, which says how to bring the application to the front.
|
|
49
|
+
3. Use the tools you have for a web page. `reticle_look { action: "page" }` gives the window. `reticle_act_and_wait { ref, action, until }` acts and proves the consequence.
|
|
50
|
+
|
|
51
|
+
Give the `sessionId` of that line on each call; `next` shows the calls with it. You set no switch for an Electron application: the command sets it. When an action is refused, the refusal says what to do: for a double-click, a hover, a drag or the menu bar, it says to send the action again with `args: { foreground: true }`.
|
|
52
|
+
|
|
53
|
+
### Open and close it from the agent
|
|
54
|
+
|
|
55
|
+
An agent connected to Reticle can open the realm with a tool call, and close it after:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
reticle_run({ tool: 'reticle_open_realm', args: { realm: 'computer', app: 'Mail', launch: true } });
|
|
59
|
+
// → { ok: true, sessionId: "cu-mail-…" }
|
|
60
|
+
reticle_run({ tool: 'reticle_close_realm', args: { sessionId: 'cu-mail-…' } });
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`realm: "browser"` with `match` joins a tab of the person's browser, as `reticle_attach_tab` does.
|
|
64
|
+
|
|
65
|
+
A tool call does not show the approval prompt that an agent shows before a terminal command. So an agent can open only an application that the person listed in `~/.reticle/computer-open.json`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{ "open": ["Mail", "Notes"] }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
An application that is not listed is refused, and nothing starts. The refusal tells the agent to ask you. If you agree, the agent adds that one application to the list, through its own approval prompt for a file change. The list has a file of its own, so the agent never writes `computer.json`, which holds your limits. `close` ends only a session that the same agent opened. When the agent leaves, every realm it opened is closed after 30 seconds, unless the agent comes back first. The other limits in the file, and **Stop**, still apply.
|
|
72
|
+
|
|
73
|
+
## Use it
|
|
74
|
+
|
|
75
|
+
Give the terminal Accessibility permission: System Settings, Privacy & Security, Accessibility.
|
|
76
|
+
|
|
77
|
+
Start the Reticle daemon, then join a running application to it:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
reticle-computer --app Notes --watch ~/Documents/out
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The command waits for the daemon for 30 seconds when it is not there yet.
|
|
84
|
+
|
|
85
|
+
The command needs the Xcode command-line tools the first time, because it compiles its helper. It stays open until you stop it.
|
|
86
|
+
|
|
87
|
+
Give the name you see in the Dock, or the name of the process: `--app "Visual Studio Code"` and `--app Code` are the same application. When no application has that name, the command names the ones that are near it, or the ones that are open.
|
|
88
|
+
|
|
89
|
+
When it does not work, ask it why:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
reticle-computer --app Notes --doctor
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
It checks the permission, the helper, the application and its windows, and the daemon. For each one that is wrong it says what to do.
|
|
96
|
+
|
|
97
|
+
The application is now a Reticle session. The tools an agent already has for a web page work on it:
|
|
98
|
+
|
|
99
|
+
- `reticle_look { action: "page" }` gives the tree.
|
|
100
|
+
- `reticle_act_and_wait { ref, action, until }` acts and proves the consequence in one call.
|
|
101
|
+
- `reticle_act { steps }` does several actions in one call.
|
|
102
|
+
|
|
103
|
+
A desktop application is in no project: give the `sessionId` that the command prints on each call. Its runs and flows stay on this machine. To put it in a project, give `--project <folder>` with the folder that has the `.reticle.json`; its runs and flows then go to that project. When a browser tab of the same project is connected too, still give the `sessionId`: a call with none goes to the session the daemon heard from last.
|
|
104
|
+
|
|
105
|
+
To prove that a file was written, name the file:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{ "until": { "kind": "signal", "name": "file.written", "dataMatches": { "file": "note.txt" } } }
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
When no folder is watched, a claim can still ask if the application wrote to disk at all. The operating system counts the bytes:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{ "until": { "kind": "signal", "name": "disk.wrote" } }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
With `"count": 0` the same claim says that the application's own processes wrote nothing. That is weak evidence: a helper of the system can write for the application.
|
|
118
|
+
|
|
119
|
+
## Actions
|
|
120
|
+
|
|
121
|
+
| Tool action | What the realm does |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `click` | Presses the element. On a row of a table, chooses the row. |
|
|
124
|
+
| `fill` | Puts a value in the element, then reads it. A text field that did not take the value (a field in a web view) gets keys: all its text is selected, and the value is typed. The action fails if the field still holds another value. |
|
|
125
|
+
| `type` | Sends one key event for each character. A text field that takes the keyboard selects its text first, so the typed text replaces it. |
|
|
126
|
+
| `press` | Sends one key with its modifiers: `Return`, `Meta+s`. |
|
|
127
|
+
| `clear` | A `fill` with no text. |
|
|
128
|
+
| `check`, `uncheck` | Presses a checkbox or a radio button, then reads its state. Sends nothing when the box is in that state already, and says so (`alreadyAtValue`). Fails when the box did not change. |
|
|
129
|
+
| `submit` | Sends the Return key to the element. |
|
|
130
|
+
| `select` | For a pop-up: presses it, reads its choices, and presses the one named in `value`. When that choice is not there, it closes the pop-up and names the choices that are. A list in a web view does not name its choices: the realm types the name into the list, reads the value, and puts the old choice back when the keys went to another one. |
|
|
131
|
+
| `scroll` | Moves the scroll bar. See below. |
|
|
132
|
+
| `click` with `args.button: "right"` | Asks the element for the menu that a right-click gives. No pointer is used. |
|
|
133
|
+
| `dblclick`, `hover`, `drag`, `focus` | Use the real pointer, or bring the application to the front. Only with `args.foreground: true`. See "The foreground" below. |
|
|
134
|
+
| `click` with `args.clickCount: 3`, `args.button: "middle"`, `args.holdMs`, `args.modifiers` | A triple-click (a line or a paragraph), the middle button, a long press, and keys held through the click. Only with `args.foreground: true`. |
|
|
135
|
+
| `drag` with `args.path` | Walks the pointer through each point of the last picture, as a brush or a lasso does. |
|
|
136
|
+
| `scroll` with `args.dx` | Turns the real wheel to the side. Only with `args.foreground: true`. |
|
|
137
|
+
|
|
138
|
+
Other actions are refused by name.
|
|
139
|
+
|
|
140
|
+
### The foreground
|
|
141
|
+
|
|
142
|
+
The realm works in the background: it does not take the pointer or the keyboard of the person at the machine, and the application stays where it is. Some things cannot be done that way: a double-click, a hover, a drag, a click on a control that takes only a real click, and the menu bar of an application that is not in front.
|
|
143
|
+
|
|
144
|
+
For those, give `args.foreground: true` on the action. The realm then brings the application to the front, moves the real pointer to the element and does the gesture as a person does. After it, the pointer and the application that was in front are put back. A `hover` and a `focus` leave things as they are, because what they are for is gone when the pointer or the application goes away.
|
|
145
|
+
|
|
146
|
+
- `click` with `foreground: true` is a real click. With `button: "right"` too, it is a real right-click.
|
|
147
|
+
- `drag` needs `args.to`: `{ ref }` for the middle of another element, or `{ x, y }` on the screen.
|
|
148
|
+
- `type` and `press` with `foreground: true` send real keys. A panel that the system draws for the application, such as the save panel, takes `fill` and `click` in the background, and takes a key only as a real key. A real key goes to whatever application has the keyboard, so the realm sends one only when the system says that the joined application has it. When it has not, no key is sent and the action is refused: use `focus` first.
|
|
149
|
+
- `focus` brings the application to the front and gives the element the keyboard. After it, the menu bar is on the screen and can be read and pressed.
|
|
150
|
+
|
|
151
|
+
The realm waits until the person at the machine has not typed or moved the pointer for a moment. When they do not stop in five seconds, it refuses the action and takes nothing.
|
|
152
|
+
|
|
153
|
+
An action that needs the foreground and did not get it is refused, and the refusal says how to ask. Join with `--background-only` and the realm never does it, whatever a caller asks.
|
|
154
|
+
|
|
155
|
+
A `scroll` moves the scroll bar of the scroll area that holds the element, and sends no wheel event. `fraction` is the place of the bar, 0 to 1. `dy` moves the bar one step in its direction: the realm does not know the height of the content, so it cannot scroll by pixels. A page in a Chromium browser has no scroll bar in its tree. There the realm sends one key to the application (`End`, `Home`, `PageDown` or `PageUp`), and the answer says `by: "key"` and names the key; it gives no `fraction`, because the place of the content is then not known. Both ways work while another application is in front. To scroll several times in one call, send the scrolls as the `steps` of `reticle_act_sequence`: a feed is then read once after them, and not once for each scroll.
|
|
156
|
+
|
|
157
|
+
### An application that gives no elements
|
|
158
|
+
|
|
159
|
+
A canvas, a game and some custom controls give nothing to read. For those:
|
|
160
|
+
|
|
161
|
+
1. `reticle_screenshot` takes a picture of the application's own window. It is the window alone, also when another window is over it. The terminal needs the Screen Recording permission for it.
|
|
162
|
+
2. `click`, `dblclick` or `hover` on the window, with `args: { foreground: true, at: { x, y } }`, acts at that point of the picture, in the pixels of the picture.
|
|
163
|
+
|
|
164
|
+
A picture proves little by itself. Name a file, a setting or the clipboard in `until` where the action has such an effect.
|
|
165
|
+
|
|
166
|
+
## An application with no elements
|
|
167
|
+
|
|
168
|
+
A canvas, a game or a remote desktop draws its own window and gives no elements. On macOS a picture of it (`reticle_screenshot`) comes with `texts`: each word in the picture, with its box `[x, y, width, height]` in the pixels of the picture. Apple Vision reads them on the machine; nothing leaves it. Click a word with `args.point` at the middle of its box. The answer counts the words it left out in `textsCut`.
|
|
169
|
+
|
|
170
|
+
## A desktop of its own for the agent
|
|
171
|
+
|
|
172
|
+
On your own machine the agent and you share one screen: a step that needs the real pointer takes yours. Two ways keep them apart.
|
|
173
|
+
|
|
174
|
+
- **Background only.** Put `{ "backgroundOnly": true }` in `~/.reticle/computer.json`. The agent never uses your pointer or keyboard. It presses, fills and chooses through the accessibility interface, and on macOS it sends keys to the application's process. A step that needs the real pointer (a drag, a point of a picture, a hover) is refused with the reason. The windows of its applications are still on your screen.
|
|
175
|
+
- **A Linux sandbox.** `reticle-computer --sandbox linux --app <name> --open "<command>"` starts a container with an X screen in memory, starts the application there, and joins the daemon of your machine. The agent works on that screen, with its own pointer and keys; your screen does not change. `reticle-computer --sandbox stop` ends it. It needs Docker. The image is built once from `native/linux/Dockerfile`; start your own image `FROM` it to add applications.
|
|
176
|
+
|
|
177
|
+
To join a daemon on another machine yourself, for example from a virtual machine, give `--host <address>` (or `RETICLE_HOST`) and the pairing token in `RETICLE_TOKEN`.
|
|
178
|
+
|
|
179
|
+
## Limits
|
|
180
|
+
|
|
181
|
+
Read these before you rely on a result.
|
|
182
|
+
|
|
183
|
+
- **macOS is the most complete.** Windows reads through UI Automation (`native/win/reticle-uia.ps1`, run by PowerShell, which Windows has). Linux reads through AT-SPI (`native/linux/reticle-atspi.py`). It needs Python 3 with PyGObject, the AT-SPI and GTK typelibs, and `xdotool` (`python3-gi gir1.2-atspi-2.0 gir1.2-gtk-3.0 xdotool` on Debian and Ubuntu). Real pointer and keys need an X session: a Wayland session, the default of current Ubuntu and Fedora, takes no input from a program. There the realm still reads every application and acts through the accessibility interface (press, fill), and it refuses a step that needs the real pointer with the reason and what to do. With `xprintidle` installed it waits while the person at the machine is typing; without it there is no such check. `native/linux/atspicheck.mjs` checks the Linux helper against a GTK application, and CI runs it on an X screen in memory.
|
|
184
|
+
- **The screen must not be locked.** With the screen locked, macOS gives no window of any application. The realm says that the screen is locked; it does not say that the application has no window.
|
|
185
|
+
- **Only the Space that is in front.** The accessibility interface lists the windows on the Space that the person looks at. An application on another Space reads as an application with no window. The realm says how many windows are not on the screen.
|
|
186
|
+
- **A web view inside a native application is read.** The system web view (WebKit) gives its page as elements with no switch to set: headings, fields, buttons, links. It was tried on a small test application and on this repository's Tauri fixture (`apps/tauri-smoke`): the realm read the page, typed in a field, added an item and followed two route changes, with nothing set in the application. The first read of an application waits until two reads agree, because a web view makes its tree when it is first asked.
|
|
187
|
+
- **The bridge must have a pairing token.** With a token, the realm dials with no Origin header. A page in a browser cannot do that, so the bridge knows that the signals of this session are things the realm saw. With no token, the session is joined, and a signal with nothing else changing is not proof.
|
|
188
|
+
- **The realm reads one application.** It reads the elements, the settings and the disk count of the application it joined, and the folders you name. Of another application it reports only the name and the role of an element, when that application covers the target. It reports that the clipboard changed, and never what is on it.
|
|
189
|
+
- **The menu bar needs the application in front.** The menu bar of an application that is not in front is not on the screen. It is not read and cannot be pressed. A menu in the window (a pull-down button) works in any case.
|
|
190
|
+
- **An application that gives no accessibility tree is read as a picture.** A canvas and a game have no elements; see "An application that gives no elements". The realm then acts at a point, with the real pointer, and it cannot say what changed in the picture. A browser can give very little until a switch is set in it, and this realm does not set that switch.
|
|
191
|
+
- **Some native applications give part of their tree only to a screen reader.** Numbers gives its sheet as an empty scroll area. The command sets the switch that a screen reader sets (`AXEnhancedUserInterface`), keeps it only when the tree grows, and sets it back when you stop. With it, every cell of the sheet is read with its value, and an empty cell has a ref.
|
|
192
|
+
- **An Electron application needs its switch for a press.** It shows its elements with no switch, answers "done" to a press, and does nothing. The command sets the accessibility switch that Electron documents for such tools, and sets it back when you stop. Give `--no-electron-switch` to leave the application as it is; the command then says that a press will do nothing. The switch is not in effect at once: for two or three seconds the application still loses a press. The command waits until the tree of the application has changed, and joins after that. The switch costs the application some speed. A command that is killed with no warning (`kill -9`) cannot set it back: the switch then stays on until the application is closed. This was measured on Electron 45.
|
|
193
|
+
- **A large window is slow to read.** The cost is for each element. A table is read only for the rows on the screen, and its line says how many rows are not shown.
|
|
194
|
+
- **An action with its proof takes about 350 ms through the tools.** The peer calls an action finished after 150 ms with no change, and it goes on looking: a change that comes later is sent when it comes. A caller of the realm class looks once, so it waits for 500 ms with no change; `RETICLE_AX_QUIET_MS` sets that time.
|
|
195
|
+
|
|
196
|
+
- **A read takes time with the size of the tree, and the answer does not.** Measured in Chrome on a feed page of this folder: 33 ms for a tree of 374 elements, and 63 ms for 874 elements after twenty scrolls. The lines an agent gets stayed at 56 (about 2 KB), because the posts that are scrolled out are not shown. So a long page costs the realm some time, and it costs the agent no more words. On a page of about 10,000 elements a read took 590 ms and a press with its proof took 2.4 s: the realm reads the whole tree before the action and until the page is quiet after it. The realm does not leave out the parts of a page that are scrolled out when it reads: an element with a fixed place on the screen, as a dialog, can be a child of a part that is scrolled out, and it would then be lost.
|
|
197
|
+
- **The realm trusts the place that an application gives for an element.** Some applications give a wrong place on a second display with a high resolution. The question "is this element on top" is then asked at the wrong place, and the realm refuses the action. It does not act on a guess.
|
|
198
|
+
- **Shortcuts use the key places of a US keyboard.**
|
|
199
|
+
- **A drag, a hover, a double-click and a real click take the pointer.** They work only with `args.foreground: true`. The tooltip of an element, which is what a person most often hovers for, is in the answer to `reticle_look { action: "element" }` as `help`: the realm reads it from the tree.
|
|
200
|
+
- **The save panel keeps its folder.** The realm fills the name and presses Save in the background. It cannot go to another folder that way: a whole path in the name field does not move the panel, and the system then writes a file whose name is that path, with a colon for each slash. To choose a folder a person types a key, and a key reaches the panel only as a real key, with the application in front. The key that opens "Go to the folder" works that way; typing the folder into that sheet is not proved yet.
|
|
201
|
+
- **The realm does not see paint.** "Can a person reach this element" is a question to the operating system about what element is at a point. It is not a look at the screen. A control that another view paints over, with nothing in the accessibility tree to say so, is still "reachable" for the realm, and a person does not see it. The fixture of this package had that defect, and every check passed. Take `reticle_screenshot` and look at the window when what a person sees is part of the claim.
|
|
202
|
+
- **The tree alone proves little.** The application draws the tree, so a text on the screen is the application's own word. Watch a folder and name the file when the action writes one.
|
|
203
|
+
|
|
204
|
+
## Check it
|
|
205
|
+
|
|
206
|
+
`native/mac/selfcheck.mjs` builds a small application and drives it through the realm. It opens a small window for a few seconds and does not take the keyboard.
|
|
207
|
+
|
|
208
|
+
`native/mac/ambientcheck.mjs` starts the same application with a clock that counts by itself, and drives it through the peer. It checks that a button that does nothing is not given the clock as its effect, and that a real effect is still counted.
|
|
209
|
+
|
|
210
|
+
`native/mac/electroncheck.mjs` starts a small Electron application and drives it through the peer. It checks that a press does nothing and says why with the switch off, that a press works with the switch on, and that a slow effect belongs to its own press. It is skipped when Electron is not installed.
|
|
211
|
+
|
|
212
|
+
`conformance/computer-journey.mjs` (run it with `node` from the root of the repository) does two whole journeys through a real bridge and the tools an agent has, and each step must be proved. On the Electron application it fills a field, adds a note, chooses from a list and checks a box. On the native application it fills a field and exports it, and the proof is the file on disk. It saves each journey as a flow, opens a new application, and replays the flow with no model; the replay of the export must write the file in a new folder. Last, the Harness drives the native application with a model that is a script: the check is on the Harness, its prompt for a desktop application and the tools as it calls them, and it costs nothing.
|
|
213
|
+
|
|
214
|
+
`conformance/computer-calculator.mjs` does a whole task on an application that Reticle did not write: the system Calculator works out 7 × 6. Each of the four presses is proved by what the display then shows. The task is saved as a flow, Calculator is closed and opened again, and the flow replays with no model. Then the Harness drives Calculator with a model that is a script: it gets the prompt for a desktop application, and each of its four presses is proved. It does not run when Calculator is open already.
|
|
215
|
+
|
|
216
|
+
`conformance/computer-browser.mjs` does a form in Google Chrome, on a page of this folder: it fills a field and presses a button, the press is proved by the note that comes on the page, and the saved flow replays with no model in a new Chrome. Chrome runs with a profile of that run. With `--safari` the same journey runs in Safari, which needs no switch. `conformance/computer-join.mjs` joins Chrome through `reticle-computer --app`, the command an agent runs, and proves a press: the command must set the switch by itself. A Chromium browser needs the same accessibility switch as an Electron application, and a second one: with the first alone, Chrome answers "done" to a press and the page gets no click. The join sets both. Chrome takes about four seconds before a press reaches the page, and the join waits for that.
|
|
217
|
+
|
|
218
|
+
A press after which the realm saw nothing (no change on the screen, on disk, in a setting or on the clipboard) carries `effect.note`. It says that `dispatched` is not `done`: an application can take a press and do nothing with it.
|
|
219
|
+
|
|
220
|
+
`native/mac/savepanelcheck.mjs` checks the save panel of the system, which most applications use to write a file. The realm reads the panel, fills the name and presses its Save, all in the background, and the proof is the file on disk.
|
|
221
|
+
|
|
222
|
+
`native/mac/hudcheck.mjs` checks the window of the realm: it shows the action and its effect, and Pause stops the realm. The check presses Pause as a person does: a second realm reads the window and presses its button.
|
|
223
|
+
|
|
224
|
+
`native/mac/pointercheck.mjs` (`pnpm --filter @reticlehq/computer check:pointer`) checks the real pointer: a click, a double-click, a triple-click, a right-click, a middle click, a long press, a drag, a hover, and the wheel down and to the side. It takes the pointer for a few seconds. The same command then runs `native/mac/keyscheck.mjs`: an application that was opened in the background comes to the front, and real keys go to it. It takes the keyboard for a few seconds. Last, `native/mac/pixelcheck.mjs` draws a stroke on a canvas of the fixture: no element changes, and the realm must report the pixels that changed and their box. Then `native/mac/dropcheck.mjs` drags a file from a Finder window onto the fixture's canvas: the fixture must name the file it got. The drop point is in a picture of the whole screen, because the canvas is in another application. Finder can open the window scrolled to the left in column view, so the check turns the wheel to the right until it sees the file, as a person does. It opens one Finder window on a folder of its own and closes only that one.
|
|
225
|
+
|
|
226
|
+
`native/mac/photocheck.mjs` (`check:photo`) edits a photo in Preview: it rotates it from the Tools menu, draws a stroke with the markup tool, and saves it. The saved file must be turned and must hold the stroke. It does not run when Preview is open already. The same command then runs `native/mac/videocheck.mjs`: it trims a 10-second clip in QuickTime Player by dragging the two handles, exports it at 480p into a folder it chooses in the save panel, and the exported movie must be as long as the part kept. It makes the clip and measures the export with AVFoundation, and does not run when QuickTime Player is open already. Last, `native/mac/numberscheck.mjs` opens a sheet of costs in Numbers, changes a price, adds a row with a total as a formula, and exports the sheet as CSV. The total in the file must be the one Numbers computed.
|
|
227
|
+
|
|
228
|
+
The first three, the check of the window and the check of the save panel, one after the other, on a Mac with the Accessibility permission:
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
pnpm --filter @reticlehq/computer check:live
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`native/mac/measure.mjs` prints how long a read, a press and a refusal take on the same small application. It asserts nothing: use it to compare two builds on one machine.
|
|
235
|
+
|
|
236
|
+
`pnpm gate:conformance:computer` runs the scenarios of the Open Verification Protocol against the realm, with the same small application as the subject. It is not part of `pnpm gate:conformance`, which runs on Linux. One scenario fails today: the realm has no rule for a success message with no effect behind it, so it gives the right verdict with a weaker ground.
|
|
237
|
+
|
|
238
|
+
The check needs a quiet screen. When another window is over the small window, the realm refuses the action, and the check fails for that reason.
|