@reticlehq/computer 3.11.0 → 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/README.md CHANGED
@@ -50,6 +50,26 @@ Three steps. The application needs no project and no set-up of its own.
50
50
 
51
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
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
+
53
73
  ## Use it
54
74
 
55
75
  Give the terminal Accessibility permission: System Settings, Privacy & Security, Accessibility.
package/bin/attach.mjs CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  doctorReport,
30
30
  electronWarning,
31
31
  helperLaunch,
32
+ makeRunnable,
32
33
  isElectron,
33
34
  joinedAnswer,
34
35
  macHud,
@@ -104,7 +105,9 @@ const findApp = (app) => {
104
105
  */
105
106
  const hudProgram = `${native}build/reticle-hud`;
106
107
  const buildOne = (program, from, stdio) => {
107
- if (existsSync(program) && statSync(program).mtimeMs >= statSync(from).mtimeMs) return true;
108
+ if (existsSync(program) && statSync(program).mtimeMs >= statSync(from).mtimeMs) {
109
+ return makeRunnable(program);
110
+ }
108
111
  mkdirSync(`${native}build`, { recursive: true });
109
112
  try {
110
113
  execFileSync('swiftc', ['-O', from, '-o', program], { stdio });
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export { ActKind, ActRefusal, Delivery } from './driver.js';
18
18
  export type { ActOutcome, ActRequest, SettingChange, UiDriver, UiRead } from './driver.js';
19
19
  export { MacDriver, servingHelper } from './mac/mac-driver.js';
20
20
  export { PIXELS_CHANGED_SIGNAL } from './driver.js';
21
- export { helperLaunch, WINDOWS_HELPER_SCRIPT } from './win/helper-launch.js';
21
+ export { helperLaunch, makeRunnable, WINDOWS_HELPER_SCRIPT } from './win/helper-launch.js';
22
22
  export type { HelperLaunch } from './win/helper-launch.js';
23
23
  export type { MacDriverInput, RunHelper } from './mac/mac-driver.js';
24
24
  export { CLIPBOARD_CHANGED_SIGNAL, DISK_WROTE_SIGNAL, FILE_SIGNAL_PREFIX, HUMAN_DONE, PEER_ACTIONS, PEER_COMMANDS, PeerCommands, SETTINGS_CHANGED_SIGNAL, } from './peer/commands.js';
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export { CU_SURFACE, CuChannel, CuSummary } from './channels.js';
13
13
  export { ActKind, ActRefusal, Delivery } from './driver.js';
14
14
  export { MacDriver, servingHelper } from './mac/mac-driver.js';
15
15
  export { PIXELS_CHANGED_SIGNAL } from './driver.js';
16
- export { helperLaunch, WINDOWS_HELPER_SCRIPT } from './win/helper-launch.js';
16
+ export { helperLaunch, makeRunnable, WINDOWS_HELPER_SCRIPT } from './win/helper-launch.js';
17
17
  export { CLIPBOARD_CHANGED_SIGNAL, DISK_WROTE_SIGNAL, FILE_SIGNAL_PREFIX, HUMAN_DONE, PEER_ACTIONS, PEER_COMMANDS, PeerCommands, SETTINGS_CHANGED_SIGNAL, } from './peer/commands.js';
18
18
  export { connectPeer } from './peer/peer.js';
19
19
  export { OWNER_SETTINGS_FILE, STOPPED_FILE, attachPlan, electronWarning, isElectron, joinedAnswer, pickApp, withOwnerLimits, } from './attach.js';
@@ -8,3 +8,9 @@ export declare const WINDOWS_HELPER_SCRIPT = "reticle-uia.ps1";
8
8
  export declare const LINUX_HELPER_SCRIPT = "reticle-atspi.py";
9
9
  /** The helper for `platform` (a value of `process.platform`), or undefined when there is none. */
10
10
  export declare function helperLaunch(platform: string, nativeDir: string): HelperLaunch | undefined;
11
+ /**
12
+ * Gives a program the execute bit when it has none, and says if it can run. The published package
13
+ * loses the bit: pnpm keeps it only for the files in `bin`. False when the file is not there, or
14
+ * when this user cannot change it.
15
+ */
16
+ export declare function makeRunnable(file: string): boolean;
@@ -4,6 +4,7 @@
4
4
  * shape, so the same driver (`MacDriver`) and the same reader work on both. Linux runs
5
5
  * `reticle-atspi.py` in Python, which reads AT-SPI, the accessibility bus of the Linux desktop.
6
6
  */
7
+ import { accessSync, chmodSync, constants } from 'node:fs';
7
8
  import { join } from 'node:path';
8
9
  export const WINDOWS_HELPER_SCRIPT = 'reticle-uia.ps1';
9
10
  const POWERSHELL = 'powershell.exe';
@@ -32,3 +33,25 @@ export function helperLaunch(platform, nativeDir) {
32
33
  }
33
34
  return undefined;
34
35
  }
36
+ /**
37
+ * Gives a program the execute bit when it has none, and says if it can run. The published package
38
+ * loses the bit: pnpm keeps it only for the files in `bin`. False when the file is not there, or
39
+ * when this user cannot change it.
40
+ */
41
+ export function makeRunnable(file) {
42
+ try {
43
+ accessSync(file, constants.X_OK);
44
+ return true;
45
+ }
46
+ catch {
47
+ // Not runnable yet: give it the bit below.
48
+ }
49
+ try {
50
+ chmodSync(file, 0o755);
51
+ accessSync(file, constants.X_OK);
52
+ return true;
53
+ }
54
+ catch {
55
+ return false;
56
+ }
57
+ }
@@ -2,11 +2,21 @@
2
2
  # helper's needs. `reticle-computer --sandbox linux` builds it once and runs the application in
3
3
  # it, so the agent works on its own screen and the person keeps theirs. Add your own applications
4
4
  # with a Dockerfile that starts FROM this image.
5
- FROM ubuntu:24.04
5
+ # Pinned by digest, so a rebuild gets the same base image. Update the digest with the tag.
6
+ FROM ubuntu:24.04@sha256:562111b88caa79c71391c0c4d3c2114a7d5c35915c20561fd893cb1e07929e6b
6
7
  ENV DEBIAN_FRONTEND=noninteractive
7
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
9
  python3 python3-gi python3-gi-cairo gir1.2-atspi-2.0 gir1.2-gtk-3.0 at-spi2-core libatk-adaptor \
9
- xvfb xauth xdotool xprintidle dbus dbus-x11 curl ca-certificates \
10
- && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
11
- && apt-get install -y --no-install-recommends nodejs \
10
+ xvfb xauth xdotool xprintidle dbus dbus-x11 curl ca-certificates xz-utils \
12
11
  && rm -rf /var/lib/apt/lists/*
12
+ # Node from nodejs.org, checked against its published SHA-256 before it is unpacked. No script
13
+ # from the network runs.
14
+ ARG NODE_VERSION=22.23.5
15
+ RUN arch="$(dpkg --print-architecture)" \
16
+ && case "$arch" in amd64) node_arch=x64 ;; arm64) node_arch=arm64 ;; *) echo "no Node for $arch" >&2; exit 1 ;; esac \
17
+ && file="node-v${NODE_VERSION}-linux-${node_arch}.tar.xz" \
18
+ && curl -fsSLO "https://nodejs.org/dist/v${NODE_VERSION}/${file}" \
19
+ && curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt" | grep " ${file}\$" | sha256sum -c - \
20
+ && tar -xJf "$file" -C /usr/local --strip-components=1 --no-same-owner \
21
+ && rm "$file" \
22
+ && node --version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reticlehq/computer",
3
- "version": "3.11.0",
3
+ "version": "3.11.1",
4
4
  "description": "Reticle realm adapter for computer use: reads an application through the operating system's accessibility tree, acts on it, and reports what each action changed. Needs no code inside the subject.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,9 +15,9 @@
15
15
  "dependencies": {
16
16
  "ws": "^8.22.1",
17
17
  "zod": "^4.6.6",
18
- "@reticlehq/terminal": "3.11.0",
19
- "@reticlehq/core": "3.11.0",
20
- "open-verification": "1.2.0"
18
+ "open-verification": "1.2.0",
19
+ "@reticlehq/terminal": "3.11.1",
20
+ "@reticlehq/core": "3.11.1"
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "author": "Reticle contributors",