aicomputer 0.1.22 → 0.2.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 +55 -136
- package/dist/index.d.ts +499 -1
- package/dist/index.js +1938 -4957
- package/package.json +24 -31
- package/dist/chunk-3ZF7JRBW.js +0 -270
- package/dist/chunk-5Y2NWK5I.js +0 -14
- package/dist/chunk-E7QD4MHI.js +0 -279
- package/dist/chunk-G7UQLVUZ.js +0 -75
- package/dist/chunk-GD42GHW3.js +0 -183
- package/dist/chunk-GGBVVRLL.js +0 -32
- package/dist/chunk-HDZTFK4U.js +0 -544
- package/dist/chunk-JMRAYXUO.js +0 -62
- package/dist/chunk-KXLTHWW3.js +0 -184
- package/dist/chunk-LGJN26BQ.js +0 -242
- package/dist/chunk-TPFE3CC6.js +0 -367
- package/dist/lib/autossh-runtime.d.ts +0 -21
- package/dist/lib/autossh-runtime.js +0 -23
- package/dist/lib/mount-config.d.ts +0 -79
- package/dist/lib/mount-config.js +0 -40
- package/dist/lib/mount-host.d.ts +0 -13
- package/dist/lib/mount-host.js +0 -10
- package/dist/lib/mount-mutagen.d.ts +0 -39
- package/dist/lib/mount-mutagen.js +0 -25
- package/dist/lib/mount-reconcile.d.ts +0 -30
- package/dist/lib/mount-reconcile.js +0 -17
- package/dist/lib/mutagen-runtime.d.ts +0 -20
- package/dist/lib/mutagen-runtime.js +0 -19
- package/dist/lib/ssh-access.d.ts +0 -74
- package/dist/lib/ssh-access.js +0 -25
- package/dist/lib/ssh-config.d.ts +0 -14
- package/dist/lib/ssh-config.js +0 -10
- package/dist/lib/upgrade-version.d.ts +0 -10
- package/dist/lib/upgrade-version.js +0 -8
- package/scripts/postinstall.mjs +0 -48
package/README.md
CHANGED
|
@@ -1,169 +1,88 @@
|
|
|
1
|
-
#
|
|
1
|
+
# aicomputer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for Agent Computer.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
pnpm add aicomputer
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
Mutagen binary used by `computer mount`.
|
|
11
|
+
## Authenticate
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
```ts
|
|
14
|
+
import { AgentComputer } from "aicomputer";
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Or run it directly with Nix:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
nix run github:getcompanion-ai/agentcomputer?dir=apps/cli -- login
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
For local testing from this checkout, prefer:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
nix run path:./apps/cli -- --version
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
To declare it in a flake-based Nix config:
|
|
33
|
-
|
|
34
|
-
```nix
|
|
35
|
-
{
|
|
36
|
-
inputs.agentcomputer-cli = {
|
|
37
|
-
url = "github:getcompanion-ai/agentcomputer?dir=apps/cli";
|
|
38
|
-
inputs.nixpkgs.follows = "nixpkgs";
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
home.packages = [
|
|
43
|
-
agentcomputer-cli.packages.${pkgs.system}.default
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
# or
|
|
47
|
-
|
|
48
|
-
environment.systemPackages = [
|
|
49
|
-
agentcomputer-cli.packages.${pkgs.system}.default
|
|
50
|
-
];
|
|
16
|
+
const client = new AgentComputer({
|
|
17
|
+
apiKey: process.env.AGENTCOMPUTER_API_KEY!,
|
|
18
|
+
});
|
|
51
19
|
```
|
|
52
20
|
|
|
53
|
-
##
|
|
21
|
+
## Quickstart
|
|
54
22
|
|
|
55
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import { AgentComputer } from "aicomputer";
|
|
56
25
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
4. Run the `CLI Release` workflow or push a `cli-v*` tag.
|
|
26
|
+
const client = new AgentComputer({
|
|
27
|
+
apiKey: process.env.AGENTCOMPUTER_API_KEY!,
|
|
28
|
+
});
|
|
61
29
|
|
|
62
|
-
|
|
30
|
+
const computer = await client.computers.create({
|
|
31
|
+
displayName: "Quickstart computer",
|
|
32
|
+
});
|
|
63
33
|
|
|
64
|
-
|
|
65
|
-
- build the Nix package
|
|
66
|
-
- sync `apps/cli/package-lock.json` and `apps/cli/package.nix` when the CLI version changes
|
|
67
|
-
- publish the npm package
|
|
68
|
-
- push the built Nix closure to the configured Cachix cache
|
|
34
|
+
await computer.ensureRunning();
|
|
69
35
|
|
|
70
|
-
|
|
36
|
+
const result = await computer.commands.run(["node", "--version"]);
|
|
37
|
+
console.log(result.stdout.trim());
|
|
71
38
|
|
|
72
|
-
|
|
73
|
-
nix.settings = {
|
|
74
|
-
substituters = [
|
|
75
|
-
"https://cache.nixos.org"
|
|
76
|
-
"https://<your-cache>.cachix.org"
|
|
77
|
-
];
|
|
78
|
-
trusted-public-keys = [
|
|
79
|
-
"<your-cache>.cachix.org-1:<your-public-key>"
|
|
80
|
-
];
|
|
81
|
-
};
|
|
39
|
+
await computer.ensureStopped();
|
|
82
40
|
```
|
|
83
41
|
|
|
84
|
-
##
|
|
42
|
+
## Run a command
|
|
85
43
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
computer login
|
|
90
|
-
computer upgrade
|
|
91
|
-
computer login --api-key <ac_live_...>
|
|
92
|
-
computer claude-login
|
|
93
|
-
computer codex-login
|
|
94
|
-
computer whoami
|
|
95
|
-
computer create my-box
|
|
96
|
-
computer power-off my-box
|
|
97
|
-
computer power-on my-box
|
|
98
|
-
computer open my-box
|
|
99
|
-
computer ssh
|
|
100
|
-
computer ssh my-box
|
|
101
|
-
computer ssh my-box --tmux
|
|
102
|
-
computer ssh --setup
|
|
103
|
-
computer ssh my-box -N -L 3000:localhost:3000
|
|
104
|
-
computer mount
|
|
105
|
-
computer mount --background
|
|
106
|
-
computer mount status
|
|
107
|
-
computer agent agents my-box
|
|
108
|
-
computer agent sessions list my-box
|
|
109
|
-
computer agent prompt my-box "inspect /home/node" --agent codex
|
|
110
|
-
computer acp serve my-box --agent codex
|
|
44
|
+
```ts
|
|
45
|
+
const result = await computer.commands.run(["python3", "-c", "print('hello')"]);
|
|
46
|
+
console.log(result.exitCode, result.stdout);
|
|
111
47
|
```
|
|
112
48
|
|
|
113
|
-
|
|
114
|
-
`computer claude-login` and `computer codex-login` to install Claude Code or
|
|
115
|
-
Codex credentials onto a machine after the CLI is already logged in. Use
|
|
116
|
-
`computer upgrade` to update a global npm install or the matching Nix profile
|
|
117
|
-
entry.
|
|
118
|
-
|
|
119
|
-
Use `computer power-off` to stop a managed worker without deleting its durable
|
|
120
|
-
home volume. Use `computer power-on` to recreate the runtime against the same
|
|
121
|
-
stored machine and home state.
|
|
49
|
+
For long-lived commands, use the typed command handle:
|
|
122
50
|
|
|
123
|
-
|
|
51
|
+
```ts
|
|
52
|
+
const server = await computer.commands.start(
|
|
53
|
+
["python3", "-m", "http.server", "3000"],
|
|
54
|
+
{
|
|
55
|
+
onStdout: (chunk) => process.stdout.write(chunk),
|
|
56
|
+
onStderr: (chunk) => process.stderr.write(chunk),
|
|
57
|
+
},
|
|
58
|
+
);
|
|
124
59
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
ssh agentcomputer.ai
|
|
129
|
-
ssh my-box@agentcomputer.ai
|
|
60
|
+
await server.wait({ rejectOnNonZero: false });
|
|
130
61
|
```
|
|
131
62
|
|
|
132
|
-
|
|
133
|
-
the machine and identity while still passing standard SSH tunnel flags through
|
|
134
|
-
to the underlying client. Long-running SSH sessions and forwarded tunnels stay
|
|
135
|
-
on the same resilient path:
|
|
63
|
+
## Publish a port
|
|
136
64
|
|
|
137
|
-
```
|
|
138
|
-
computer
|
|
65
|
+
```ts
|
|
66
|
+
await computer.waitForPort(3000);
|
|
67
|
+
const published = await computer.ports.publish({ port: 3000, name: "app" });
|
|
68
|
+
console.log(published.public_url);
|
|
139
69
|
```
|
|
140
70
|
|
|
141
|
-
|
|
142
|
-
`ssh`, `scp`, and `autossh` together. Global npm installs on macOS and Linux
|
|
143
|
-
provision Agent Computer's bundled `autossh` copy during postinstall and retry
|
|
144
|
-
that install on first SSH use if npm scripts were skipped. npm users still need
|
|
145
|
-
local OpenSSH client tools available.
|
|
71
|
+
## PTY sessions
|
|
146
72
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
73
|
+
```ts
|
|
74
|
+
const shell = await computer.pty.create({
|
|
75
|
+
cols: 120,
|
|
76
|
+
rows: 32,
|
|
77
|
+
onData: (chunk) => process.stdout.write(chunk),
|
|
78
|
+
});
|
|
151
79
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Run `computer mount --background` to start the same controller detached from
|
|
158
|
-
your terminal. It prints the controller PID immediately so you can inspect it
|
|
159
|
-
later with `computer mount status`.
|
|
160
|
-
|
|
161
|
-
This uses the same SSH setup as `computer ssh --setup`. For npm installs on
|
|
162
|
-
macOS and Linux, the CLI auto-installs its bundled Mutagen copy and will retry
|
|
163
|
-
that install on first mount if npm scripts were skipped. You still need the
|
|
164
|
-
OpenSSH client tools (`ssh` and `scp`) available locally. The temporary
|
|
165
|
-
`~/agentcomputer` root is removed when the command exits.
|
|
80
|
+
await shell.sendInput("uname -a\n");
|
|
81
|
+
await shell.resize(140, 40);
|
|
82
|
+
await shell.kill();
|
|
83
|
+
```
|
|
166
84
|
|
|
167
|
-
|
|
85
|
+
## Docs
|
|
168
86
|
|
|
169
|
-
|
|
87
|
+
- Web docs: `https://agentcomputer.ai/docs/typescript-sdk`
|
|
88
|
+
- Generated API reference is published from the package source into the docs site.
|