@beeuni/agent-tunnel 0.1.0 → 0.1.2
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 +74 -14
- package/dist/agent-cli.js +464 -249
- package/package.json +1 -12
package/README.md
CHANGED
|
@@ -26,11 +26,36 @@ Connecting the same computer again reuses its entry. The agent sends a SHA-256
|
|
|
26
26
|
hash of the hardware ID (IOPlatformUUID, `/etc/machine-id`, or `MachineGuid`);
|
|
27
27
|
the raw ID never leaves the computer.
|
|
28
28
|
|
|
29
|
-
After approval,
|
|
29
|
+
After approval, `connect` in a terminal installs the background service, the
|
|
30
|
+
same way the desktop app does, and prints the commands that pause, resume,
|
|
31
|
+
and remove it. It asks no question. `--foreground` keeps the connection in the
|
|
32
|
+
terminal instead. A script without a TTY, or `--json`, stays in the foreground
|
|
33
|
+
unless it passes `--daemon`.
|
|
34
|
+
|
|
35
|
+
## One runtime with the desktop app (macOS)
|
|
36
|
+
|
|
37
|
+
When the Beeuni desktop app is installed (`/Applications/Beeuni.app` or
|
|
38
|
+
`~/Applications/Beeuni.app`), the service a CLI install writes runs on the
|
|
39
|
+
app's own agent and driver: `Beeuni.app/Contents/MacOS/Beeuni` with
|
|
40
|
+
`ELECTRON_RUN_AS_NODE=1` and `Contents/Resources/agent-tunnel/agent-cli.js`.
|
|
41
|
+
A CLI install and an app install are then the same connection. macOS grants
|
|
42
|
+
Accessibility and Screen Recording to Beeuni once, never to `node` or a
|
|
43
|
+
terminal, and **Your computer** in the app controls it.
|
|
44
|
+
|
|
45
|
+
This CLI is the one control surface of the computer. The desktop app runs
|
|
46
|
+
these same commands (`status --json`, `access`, `keep-awake`, `stop`,
|
|
47
|
+
`start`, `logout`) and never edits the agent's files itself. A change made
|
|
48
|
+
in the app, in the terminal, or through Beeuni is the same change. Without the app,
|
|
49
|
+
the service runs on `node`, and Computer Use needs a separately installed
|
|
50
|
+
`cua-driver`.
|
|
51
|
+
|
|
52
|
+
The service restarts itself when its code changes on disk (an app update or
|
|
53
|
+
a new vendored bundle). macOS refuses every permission to a process whose
|
|
54
|
+
binary was replaced under it, so a stale process would lose Computer Use.
|
|
30
55
|
|
|
31
56
|
## Run in the background
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
The service is the default for a person at a terminal. A script installs it with `--daemon`:
|
|
34
59
|
|
|
35
60
|
```bash
|
|
36
61
|
npx --yes @beeuni/agent-tunnel@latest connect \
|
|
@@ -61,8 +86,8 @@ The agent itself never stops on its own:
|
|
|
61
86
|
- A handshake that does not reach `auth_ok` within 20 s is dropped and retried.
|
|
62
87
|
- No saved credential: it waits and checks `config.json` every 60 s.
|
|
63
88
|
|
|
64
|
-
It changes the computer's sleep settings only
|
|
65
|
-
|
|
89
|
+
It changes the computer's sleep settings only while `keep-awake` is on (see
|
|
90
|
+
"Access control").
|
|
66
91
|
|
|
67
92
|
## Manage the background service
|
|
68
93
|
|
|
@@ -82,9 +107,11 @@ which removes the machine and its accounts in Beeuni. It then clears the local
|
|
|
82
107
|
credential and removes the service. If Beeuni cannot be reached, the local
|
|
83
108
|
sign-out still completes; `logout --json` then reports `"serverUnpaired": false`.
|
|
84
109
|
|
|
85
|
-
`service-status --json` prints the pairing,
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
`status --json` (and its alias `service-status --json`) prints the pairing,
|
|
111
|
+
the approved `capabilities`, the service (`installed`, `active`, `enabled` =
|
|
112
|
+
not paused, `upToDate` = the unit matches what `install-service` writes now),
|
|
113
|
+
the live connection `state` (a process that died without saying so reads as
|
|
114
|
+
`offline`), and `access` (the same object `access --json` prints).
|
|
88
115
|
|
|
89
116
|
Credentials are stored in `~/.agent-tunnel/config.json`. Agent Tunnel requires
|
|
90
117
|
the file to be regular, owned by the current user, and mode `0600` on POSIX.
|
|
@@ -101,7 +128,7 @@ Remote API URLs must use HTTPS. Plain HTTP is accepted only for `localhost`,
|
|
|
101
128
|
| `config.json` | Credential and local limits, mode `0600`. |
|
|
102
129
|
| `state.json` | `{ tunnelId, apiUrl, status: online\|offline\|connecting\|rejected\|standby, since, agentVersion, pid }`, rewritten atomically on every connection change. No credential. |
|
|
103
130
|
| `access.json` | `{ mode: ask\|always\|off, grantedUntil, deniedUntil, keepAwake }`, mode `0600`. See "Access control". |
|
|
104
|
-
| `access-request.json` | `{ id, requestedAt, capability, method }`: the call waiting for the owner. |
|
|
131
|
+
| `access-request.json` | `{ id, requestedAt, capability, method, change? }`: the call, or the wider access asked for through Beeuni (`change`), waiting for the owner. |
|
|
105
132
|
| `desktop-app.json` | Written by the Beeuni desktop app: how to start it to show an access prompt. |
|
|
106
133
|
| `logs/` | Service output. |
|
|
107
134
|
|
|
@@ -113,8 +140,22 @@ service definition carries `AGENT_TUNNEL_HOME` into the service environment.
|
|
|
113
140
|
|
|
114
141
|
## Access control
|
|
115
142
|
|
|
116
|
-
The machine decides, before every call, whether an agent may use it.
|
|
117
|
-
|
|
143
|
+
The machine decides, before every call, whether an agent may use it. Change
|
|
144
|
+
it with the CLI:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx --yes @beeuni/agent-tunnel@latest access # show it
|
|
148
|
+
npx --yes @beeuni/agent-tunnel@latest access ask # or always, off
|
|
149
|
+
npx --yes @beeuni/agent-tunnel@latest access --allow-for 60 # in ask: allow for 60 minutes (max 1440)
|
|
150
|
+
npx --yes @beeuni/agent-tunnel@latest access --revoke # end the current allowance
|
|
151
|
+
npx --yes @beeuni/agent-tunnel@latest access --deny # answer the waiting request with No
|
|
152
|
+
npx --yes @beeuni/agent-tunnel@latest keep-awake on # or off (macOS and Linux)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Every command takes `--json` and prints `{ mode, grantedUntil, deniedUntil,
|
|
156
|
+
keepAwake, keepAwakeSupported, pendingRequest }`. A wrong mode or duration
|
|
157
|
+
exits `1` and changes nothing. The person at the terminal is the computer's
|
|
158
|
+
owner, so these commands also widen access.
|
|
118
159
|
|
|
119
160
|
| `mode` | Effect |
|
|
120
161
|
| --- | --- |
|
|
@@ -122,17 +163,36 @@ The machine decides, before every call, whether an agent may use it.
|
|
|
122
163
|
| `ask` | A call runs while `grantedUntil` is in the future (at most 24 h ahead). Otherwise the agent writes `access-request.json`, starts the desktop app if it is not running, and holds the call for 20 s. A grant runs it. No answer returns `-32010 computer_access_pending`. A denial sets `deniedUntil` 10 minutes ahead and returns `-32011 computer_access_denied`; calls fail at once until then. |
|
|
123
164
|
| `off` | Every call returns `-32012 computer_access_off`. |
|
|
124
165
|
|
|
166
|
+
**Through Beeuni.** The owner can also change access from the Beeuni web app
|
|
167
|
+
or the desktop app's window (`POST /v1/tunnel/connections/:id/access`, user
|
|
168
|
+
credentials only; no agent or session token reaches it). Beeuni relays the
|
|
169
|
+
change to the agent as `tunnel.access.set`:
|
|
170
|
+
|
|
171
|
+
- A narrowing (`ask`, `off`, `--revoke`, `--deny`, keep awake) applies at once,
|
|
172
|
+
even while access is `off`.
|
|
173
|
+
- A widening (`always`, or a longer allowance) needs the owner on the computer.
|
|
174
|
+
The agent writes it to `access-request.json` with `change`, and the desktop
|
|
175
|
+
app shows a native **Allow** / **Cancel** dialog. **Allow** runs the matching
|
|
176
|
+
`access` command; **Cancel** runs `access --deny`, which declines the change
|
|
177
|
+
without refusing calls. The relayed call waits up to 20 s and otherwise fails
|
|
178
|
+
with `-32014 computer_access_unconfirmed`. A computer without the desktop
|
|
179
|
+
app fails at once, naming the command to run on it.
|
|
180
|
+
|
|
125
181
|
A pairing made from the Beeuni desktop app starts in `ask`: the app shows the
|
|
126
182
|
prompt. A pairing made with this CLI alone starts in `always`, because nothing
|
|
127
183
|
on the machine could answer a prompt. This is a deliberate deviation from
|
|
128
184
|
"new pairings default to ask". Every new pairing resets `access.json`, so a
|
|
129
185
|
grant or `always` from an earlier pairing never carries over, and `logout`
|
|
130
186
|
deletes it. The agent home (`config.json`, `access.json`, `desktop-app.json`)
|
|
131
|
-
is always a blocked path: no file or shell call can change these files.
|
|
132
|
-
|
|
133
|
-
|
|
187
|
+
is always a blocked path: no file or shell call can change these files.
|
|
188
|
+
|
|
189
|
+
The agent reports its state to Beeuni as the signed notification
|
|
190
|
+
`tunnel.access.state` on connect and on every change: the access fields, the
|
|
191
|
+
waiting request, and `desktopPermissions` (`{ accessibility, screenRecording }`
|
|
192
|
+
as macOS answers for the agent process itself, checked every 60 s). Beeuni
|
|
193
|
+
shows exactly this.
|
|
134
194
|
|
|
135
|
-
`
|
|
195
|
+
`keep-awake on` keeps the computer from sleeping while the agent runs:
|
|
136
196
|
`caffeinate -s` on macOS (on AC power only), `systemd-inhibit --what=sleep` on
|
|
137
197
|
Linux. Windows is not supported.
|
|
138
198
|
|