@agentorg/computer 0.0.2 → 0.0.4

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
@@ -15,7 +15,16 @@ agentcomputer create --access terminal --browser --workspace ~/some/folder
15
15
 
16
16
  That prints the computer's `computerID`, its endpoints and its `accessToken`, once. Give an MCP client the `computer` and `browser` URLs, with the token as `Authorization: Bearer <token>`.
17
17
 
18
- **This version has no isolation.** A computer is processes of whoever started the service. With `--access terminal` it can reach everything that user can. Run it only where that's safe.
18
+ **By default a computer has no isolation.** It's processes of whoever started the service, and with `--access terminal` it can reach everything that user can. Use `--isolation container` wherever that isn't safe.
19
+
20
+ ## Isolation
21
+
22
+ `agentcomputer serve --isolation container` makes each computer a container of its own, which needs Docker on the same machine. The service follows your `DOCKER_HOST` or current context and never changes them.
23
+
24
+ - The image holds AgentExec, Playwright MCP and a headless Chromium. It is `ghcr.io/uniac-ai/agentcomputer/computer` at the service's version; `--image` names another.
25
+ - `--workspace` is mounted at `/workspace`, read-only at `--access read`, and nothing else of the machine is visible. Docker has to be able to share that folder. Without `--workspace`, the service makes one.
26
+ - It runs as the user who started the service, with no capabilities.
27
+ - `stop` stops the container and keeps it, so what was installed in it is there at `start`. `kill` removes it. Starting a stopped computer uses the image it was made from.
19
28
 
20
29
  ## Access
21
30
 
@@ -44,7 +53,7 @@ The file tools stay inside the workspace. That's a check, not a boundary. Below
44
53
 
45
54
  With no `--workspace`, the service makes a folder, which goes when the computer is killed. A folder you name is never deleted. A computer with a `--timeout` stops when it runs out, and its folder stays.
46
55
 
47
- The service listens on loopback. It refuses any other address, because it has no TLS yet.
56
+ The service listens on loopback unless you give it TLS; see [Across a network](#across-a-network).
48
57
 
49
58
  The data folder is `--data`, else `$AGENTCOMPUTER_DATA`, else `$XDG_DATA_HOME/agentcomputer`, else `~/.local/share/agentcomputer`. It holds `control-token` and `server.json`, which the commands read.
50
59
 
@@ -89,14 +98,59 @@ It reads the control token from `AGENTCOMPUTER_API_KEY` and the address from `AG
89
98
 
90
99
  `files.write` makes a new file or fills an empty one; `files.edit` changes one that has content. `files.read` returns the whole text, or fails if a line is longer than the tool can return.
91
100
 
101
+ ## Across a network
102
+
103
+ The service listens on loopback unless you give it TLS:
104
+
105
+ ```sh
106
+ agentcomputer serve --listen 0.0.0.0:7878 \
107
+ --tls-cert cert.pem --tls-key key.pem --public-url https://computers.example.com:7878
108
+ ```
109
+
110
+ `--tls-proxy` is the other way, when a proxy in front of it terminates TLS. It then listens in the clear, so keep that hop private. `--public-url` is the address clients reach it at, which the endpoints it gives out are built from. It's required with `--tls-proxy` and when listening on a wildcard address. Certificates are read at start, so restart it to renew one.
111
+
112
+ A client using a private certificate authority trusts it through `NODE_EXTRA_CA_CERTS`.
113
+
114
+ ### The service as a container
115
+
116
+ `ghcr.io/uniac-ai/agentcomputer/service` holds the service and the Docker client, for container isolation on a server:
117
+
118
+ ```sh
119
+ docker run -d --name agentcomputer --network host \
120
+ --user "$(id -u):$(id -g)" --group-add "$(stat -c %g /var/run/docker.sock)" \
121
+ -v /var/run/docker.sock:/var/run/docker.sock \
122
+ -v /srv/agentcomputer:/srv/agentcomputer \
123
+ ghcr.io/uniac-ai/agentcomputer/service:VERSION \
124
+ serve --isolation container --data /srv/agentcomputer --listen 0.0.0.0:7878 \
125
+ --tls-cert /srv/agentcomputer/cert.pem --tls-key /srv/agentcomputer/key.pem \
126
+ --public-url https://computers.example.com:7878
127
+ ```
128
+
129
+ - Its data folder, and any `--workspace`, have to be mounted at the same path inside as outside, because Docker reads those paths on the machine.
130
+ - `--network host` is how it reaches each computer's port on the machine's loopback, so this needs Linux.
131
+ - The socket gives it full control of that machine's Docker. Whoever holds the control token can make computers, but not reach the socket.
132
+
133
+ ## Live sessions
134
+
135
+ A computer at `--access terminal` has two surfaces you can open live, as a WebSocket:
136
+
137
+ - **`commands`** (protocol `commands@1`): each of the agent's commands as it runs, read-only. Each message is one JSON event: `start` (with `cmd` and `workdir`), `output` (with `stream` and `text`) or `exit` (with `exitCode`). Each carries the command's `id`, which is the `session_id` the agent sees. Those already heard come first.
138
+ - **`terminal`** (protocol `pty@1`): a shell of your own in its workspace, as its user, beside the agent's commands rather than in them. Every socket on it shares one shell, and a new one is sent what it wrote before. Each binary message is one byte of type, then its payload: `0` is output from the shell, or input to it; `1` is a resize, `{"columns":100,"rows":30}`. In `watch` mode what you send is dropped.
139
+
140
+ `POST /v1/computers/{computerID}/live` with `{ "surface": "terminal", "mode": "operate" }` gives a ticket: a `url` to open once within a minute, which needs no token. A request with an `Origin` header is refused unless `serve --allow-origin` names that origin, so a page can't open one. The SDK does the same with `computer.pty.connect({ onData })` and `computer.commands.watch(onEvent)`, and the CLI with `agentcomputer live <id> --surface terminal --mode operate`.
141
+
142
+ The terminal needs [node-pty](https://github.com/microsoft/node-pty), an optional dependency installed beside the program. It comes prebuilt for macOS. On Linux it's compiled at install, which npm only does when told: `npm install -g @agentorg/computer --allow-scripts=node-pty`, with a C++ toolchain. Without it, the computer's `surfaces` say why the terminal isn't there. The computer image has it.
143
+
92
144
  ## Known limits
93
145
 
94
- - Each browser's Playwright MCP listens on a loopback port with no token of its own, so another user on the same machine could reach it directly. Don't run this on a machine you share.
95
- - A browser that stops shows the computer as `failed`. Stop it and start it again.
146
+ - With no isolation, each browser's Playwright MCP listens on a loopback port with no token of its own, so another user on the same machine could reach it directly. Don't run that on a machine you share.
147
+ - A container has no CPU or memory limit, and its network is Docker's default, so it reaches the internet and anything else Docker's network does.
148
+ - In a container the browser runs without its own sandbox, which needs privileges a computer doesn't have. The container is the boundary.
149
+ - A browser that stops, or a container that ends by itself, shows the computer as `failed`. Stop it and start it again.
96
150
 
97
151
  ## Tests
98
152
 
99
- `npm test` runs the built service through the official MCP client, with a stand-in for Playwright, and one scenario through HTTP, MCP, the SDK and the CLI that fails if any operation in the schema isn't reached by each. After changing `openapi.yaml`, `npm run generate` writes what comes from it; CI fails if that changes anything. Set `AGENTCOMPUTER_BROWSER_PATH` to a browser program to run the real one too.
153
+ `npm test` runs the built service through the official MCP client, with a stand-in for Playwright, and one scenario through HTTP, MCP, the SDK and the CLI that fails if any operation in the schema isn't reached by each. Set `AGENTCOMPUTER_TEST_IMAGE` to a built image (`npm run build`, then `docker build .`) to run the same suite on containers, and `AGENTCOMPUTER_TEST_SERVICE_IMAGE` to one from `Dockerfile.service` to run the service itself as a container, with `AGENTCOMPUTER_TEST_ROOT` naming a folder Docker can mount if the temporary one isn't. After changing `openapi.yaml`, `npm run generate` writes what comes from it; CI fails if that changes anything. Set `AGENTCOMPUTER_BROWSER_PATH` to a browser program to run the real one too.
100
154
 
101
155
  ## Licence
102
156
 
@@ -1,4 +1,4 @@
1
- @agentorg/exec 0.0.2 (Apache-2.0)
1
+ @agentorg/exec 0.0.3 (Apache-2.0)
2
2
 
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -1271,6 +1271,31 @@ SOFTWARE.
1271
1271
 
1272
1272
  ========================================================================
1273
1273
 
1274
+ ws 8.22.2 (MIT)
1275
+
1276
+ Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
1277
+ Copyright (c) 2013 Arnout Kazemier and contributors
1278
+ Copyright (c) 2016 Luigi Pinca and contributors
1279
+
1280
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
1281
+ this software and associated documentation files (the "Software"), to deal in
1282
+ the Software without restriction, including without limitation the rights to
1283
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1284
+ the Software, and to permit persons to whom the Software is furnished to do so,
1285
+ subject to the following conditions:
1286
+
1287
+ The above copyright notice and this permission notice shall be included in all
1288
+ copies or substantial portions of the Software.
1289
+
1290
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1291
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1292
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1293
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1294
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1295
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1296
+
1297
+ ========================================================================
1298
+
1274
1299
  zod 4.6.7 (MIT)
1275
1300
 
1276
1301
  MIT License