aicomputer 0.1.21 → 0.2.0

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
@@ -1,169 +1,88 @@
1
- # `aicomputer`
1
+ # aicomputer
2
2
 
3
- Agent Computer CLI for creating, opening, and managing computers from the terminal.
3
+ TypeScript SDK for Agent Computer.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -g aicomputer
8
+ pnpm add aicomputer
9
9
  ```
10
10
 
11
- On macOS and Linux, the npm install and update flow also installs the CLI-managed
12
- Mutagen binary used by `computer mount`.
11
+ ## Authenticate
13
12
 
14
- Upgrade the installed CLI later with:
13
+ ```ts
14
+ import { AgentComputer } from "aicomputer";
15
15
 
16
- ```bash
17
- computer upgrade
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
- ## Private Repo Rollout
21
+ ## Quickstart
54
22
 
55
- To keep Nix distribution aligned with the npm CLI release flow for this private repo:
23
+ ```ts
24
+ import { AgentComputer } from "aicomputer";
56
25
 
57
- 1. Create a Cachix cache for the CLI.
58
- 2. Add a GitHub Actions repository variable named `CACHIX_CACHE` with that cache name.
59
- 3. Add a GitHub Actions repository secret named `CACHIX_AUTH_TOKEN` with a write token for that cache.
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
- The release workflow will:
30
+ const computer = await client.computers.create({
31
+ displayName: "Quickstart computer",
32
+ });
63
33
 
64
- - build the CLI with `npm ci`
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
- Consumers should add the binary cache to their Nix config:
36
+ const result = await computer.commands.run(["node", "--version"]);
37
+ console.log(result.stdout.trim());
71
38
 
72
- ```nix
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
- ## Usage
42
+ ## Run a command
85
43
 
86
- After installing, use the `computer` command:
87
-
88
- ```bash
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
- `computer login` authenticates the CLI against Agent Computer. Use
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
- Run `computer ssh` without a handle in an interactive terminal to pick from your available machines.
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
- Run `computer ssh --setup` once to register your SSH key and add a global alias:
126
-
127
- ```bash
128
- ssh agentcomputer.ai
129
- ssh my-box@agentcomputer.ai
60
+ await server.wait({ rejectOnNonZero: false });
130
61
  ```
131
62
 
132
- Use `computer ssh <handle> <ssh args>` when you want the CLI to resolve
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
- ```bash
138
- computer ssh my-box -N -L 3000:localhost:3000
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
- `computer ssh` now launches through `autossh` by default. Nix installs package
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
- Use `computer ssh <handle> --tmux` when you want reconnects to reattach to the
148
- same remote shell session instead of dropping you into a fresh shell. The flag
149
- attaches to `tmux new-session -A -s agentcomputer`, so it is meant for
150
- interactive shells, not `-N` tunnels or other non-interactive SSH flows.
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
- Run `computer mount` to start the mount controller in the foreground and mirror
153
- all SSH-ready machine homes under `~/agentcomputer/<handle>`.
154
- On macOS, the foreground command also opens Finder to `~/agentcomputer` after
155
- the controller starts.
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
- Use `computer agent` to inspect agents on one machine and manage remote sessions. Use `computer acp serve` when you want to expose one remote session through a local ACP bridge.
85
+ ## Docs
168
86
 
169
- You can also run without a global install via `npx aicomputer <command>`.
87
+ - Web docs: `https://agentcomputer.ai/docs/typescript-sdk`
88
+ - Generated API reference is published from the package source into the docs site.
package/dist/index.d.ts CHANGED
@@ -1 +1,381 @@
1
- #!/usr/bin/env node
1
+ import { ComputerImageResponse, AccessSessionResponse, createPublicApiClient, ListPublishedPortsResponse, PublishedPortResponse, PublishedPortMutationResponse, ListSharesResponse, ShareResponse, ListSnapshotsResponse, SnapshotResponse, ComputerResponse, ComputerConnectionResponse, CreateSSHCertificateRequest, SSHCertificateResponse, CreateComputerRequest, ListSSHKeysResponse, CreateSSHKeyRequest, SSHKeyEnvelope, PublicApiClientOptions, AccessTokenProvider, MeResponse, UsageEnvelope, ResolveShareResponse, CreateAccessSessionRequest, AccessSessionEnvelope, OperationResponse } from '@microagentcomputer/public-api-client';
2
+ export { AccessSessionEnvelope, AccessSessionResponse, AccessTokenProvider, ComputerConnectionResponse, ComputerImageResponse, ComputerMutationResponse, ComputerResponse, CreateAccessSessionRequest, CreateComputerRequest, CreateEmailShareRequest, CreateLinkShareRequest, CreatePublishedPortRequest, CreateSSHCertificateRequest, CreateSSHKeyRequest, ExecCommandRequest, ExecCommandResponse, MeResponse, OperationResponse, PublicApiError, PublishedPortResponse, ResolveShareResponse, RestoreSnapshotRequest, SSHCertificateResponse, ShareResponse, SnapshotResponse, UpdateComputerRequest, UsageEnvelope } from '@microagentcomputer/public-api-client';
3
+
4
+ type LowLevelClient = ReturnType<typeof createPublicApiClient>;
5
+ type ComputerState = ComputerResponse["state"];
6
+ type ComputerSource = CreateComputerRequest["source"];
7
+ type ComputerCapability = "process" | "files" | "git" | (string & {});
8
+ type WaitOptions = {
9
+ pollIntervalMs?: number;
10
+ timeoutMs?: number;
11
+ signal?: AbortSignal;
12
+ };
13
+ type AgentComputerOptions = Omit<PublicApiClientOptions, "accessToken" | "baseUrl"> & {
14
+ baseUrl?: string;
15
+ apiKey?: AccessTokenProvider;
16
+ accessToken?: AccessTokenProvider;
17
+ defaultPollIntervalMs?: number;
18
+ defaultOperationTimeoutMs?: number;
19
+ defaultComputerStateTimeoutMs?: number;
20
+ defaultConnectRequestTimeoutMs?: number;
21
+ };
22
+ type ComputerCreateOptions = {
23
+ handle?: string;
24
+ displayName?: string;
25
+ source?: ComputerSource;
26
+ sizePreset?: string;
27
+ authorizedKeys?: string[];
28
+ };
29
+ type ComputerEnsureOptions = ComputerCreateOptions & {
30
+ id?: string;
31
+ start?: boolean;
32
+ updateMetadata?: boolean;
33
+ };
34
+ type ComputerUpdateOptions = {
35
+ displayName?: string;
36
+ };
37
+ type CommandRunOptions = {
38
+ cwd?: string;
39
+ env?: Record<string, string>;
40
+ timeoutMs?: number;
41
+ requestTimeoutMs?: number;
42
+ user?: string;
43
+ signal?: AbortSignal;
44
+ };
45
+ type CommandStartOptions = CommandRunOptions & {
46
+ tag?: string;
47
+ stdin?: boolean;
48
+ onStdout?: CommandOutputHandler;
49
+ onStderr?: CommandOutputHandler;
50
+ onExit?: (result: CommandResult) => void;
51
+ };
52
+ type PtyStartOptions = Omit<CommandRunOptions, "timeoutMs"> & {
53
+ cols?: number;
54
+ rows?: number;
55
+ tag?: string;
56
+ onData?: PtyOutputHandler;
57
+ onExit?: (result: PtyResult) => void;
58
+ };
59
+ type ExecSessionCreateOptions = {
60
+ ttlSeconds?: number;
61
+ signal?: AbortSignal;
62
+ };
63
+ type CommandSelector = number | string | {
64
+ pid: number;
65
+ } | {
66
+ tag: string;
67
+ };
68
+ type CommandSignal = "SIGTERM" | "SIGKILL";
69
+ type CommandOutputHandler = (chunk: string, raw: Uint8Array) => void;
70
+ type PtyOutputHandler = (chunk: string, raw: Uint8Array) => void;
71
+ type CommandInfo = {
72
+ pid: number;
73
+ tag?: string;
74
+ cmd: string;
75
+ args: string[];
76
+ envs: Record<string, string>;
77
+ cwd?: string;
78
+ };
79
+ type CommandResult = {
80
+ pid: number;
81
+ tag?: string;
82
+ stdout: string;
83
+ stderr: string;
84
+ exitCode: number;
85
+ status: string;
86
+ error?: string;
87
+ };
88
+ type PtyResult = {
89
+ pid: number;
90
+ tag?: string;
91
+ output: string;
92
+ exitCode: number;
93
+ status: string;
94
+ error?: string;
95
+ };
96
+ type ShareLinkOptions = {
97
+ expiresAt?: string;
98
+ allowBrowser?: boolean;
99
+ allowVnc?: boolean;
100
+ signal?: AbortSignal;
101
+ };
102
+ type ShareEmailOptions = ShareLinkOptions & {
103
+ email: string;
104
+ };
105
+ type PublishPortOptions = {
106
+ port: number;
107
+ name?: string;
108
+ signal?: AbortSignal;
109
+ };
110
+ type SnapshotRestoreOptions = {
111
+ handle?: string;
112
+ displayName?: string;
113
+ authorizedKeys?: string[];
114
+ signal?: AbortSignal;
115
+ };
116
+ declare class AgentComputer {
117
+ readonly images: ComputerImagesClient;
118
+ readonly computers: ComputersClient;
119
+ readonly snapshots: SnapshotsClient;
120
+ readonly sshKeys: SSHKeysClient;
121
+ private readonly client;
122
+ private readonly fetchImpl;
123
+ private readonly defaultPollIntervalMs;
124
+ private readonly defaultOperationTimeoutMs;
125
+ private readonly defaultComputerStateTimeoutMs;
126
+ private readonly defaultConnectRequestTimeoutMs;
127
+ constructor(options?: AgentComputerOptions);
128
+ me(signal?: AbortSignal): Promise<MeResponse>;
129
+ usage(signal?: AbortSignal): Promise<UsageEnvelope>;
130
+ resolveShare(shareToken: string, signal?: AbortSignal): Promise<ResolveShareResponse>;
131
+ redeemShare(shareToken: string, body?: Partial<CreateAccessSessionRequest>, signal?: AbortSignal): Promise<AccessSessionEnvelope>;
132
+ waitForOperation(operationOrId: string | Pick<OperationResponse, "id">, options?: WaitOptions): Promise<OperationResponse>;
133
+ waitForComputerState(computerId: string, targetState: ComputerState, options?: WaitOptions): Promise<Computer>;
134
+ computer(idOrHandle: string): Promise<Computer>;
135
+ /** @internal */
136
+ internalClient(): LowLevelClient;
137
+ /** @internal */
138
+ internalFetch(): typeof fetch;
139
+ /** @internal */
140
+ internalDefaultPollIntervalMs(): number;
141
+ /** @internal */
142
+ internalDefaultComputerStateTimeoutMs(): number;
143
+ /** @internal */
144
+ internalDefaultOperationTimeoutMs(): number;
145
+ /** @internal */
146
+ internalDefaultConnectRequestTimeoutMs(): number;
147
+ }
148
+ declare class ComputerImagesClient {
149
+ private readonly sdk;
150
+ constructor(sdk: AgentComputer);
151
+ list(signal?: AbortSignal): Promise<ComputerImageResponse[]>;
152
+ get(imageId: string, signal?: AbortSignal): Promise<ComputerImageResponse>;
153
+ getDefault(signal?: AbortSignal): Promise<ComputerImageResponse>;
154
+ }
155
+ declare class ComputersClient {
156
+ private readonly sdk;
157
+ constructor(sdk: AgentComputer);
158
+ list(signal?: AbortSignal): Promise<Computer[]>;
159
+ get(computerId: string, signal?: AbortSignal): Promise<Computer>;
160
+ getByHandle(handle: string, signal?: AbortSignal): Promise<Computer | null>;
161
+ resolve(idOrHandle: string, signal?: AbortSignal): Promise<Computer>;
162
+ create(options?: ComputerCreateOptions, signal?: AbortSignal): Promise<Computer>;
163
+ ensure(options?: ComputerEnsureOptions, signal?: AbortSignal): Promise<Computer>;
164
+ private defaultSource;
165
+ }
166
+ declare class Computer {
167
+ private readonly sdk;
168
+ private computer;
169
+ readonly commands: ComputerCommandsClient;
170
+ readonly pty: ComputerPtyClient;
171
+ readonly files: ComputerFilesClient;
172
+ readonly git: ComputerGitClient;
173
+ readonly ports: ComputerPortsClient;
174
+ readonly shares: ComputerSharesClient;
175
+ readonly snapshots: ComputerSnapshotsClient;
176
+ constructor(sdk: AgentComputer, computer: ComputerResponse);
177
+ get raw(): ComputerResponse;
178
+ get id(): string;
179
+ get handle(): string;
180
+ get displayName(): string;
181
+ get state(): ComputerState;
182
+ get sourceKind(): ComputerResponse["source_kind"];
183
+ get sourceSnapshotId(): string | null | undefined;
184
+ get createdAt(): string;
185
+ get updatedAt(): string;
186
+ get deletedAt(): string | null | undefined;
187
+ get primaryUrl(): string;
188
+ get failureReason(): string | null | undefined;
189
+ internalSdk(): AgentComputer;
190
+ refresh(signal?: AbortSignal): Promise<Computer>;
191
+ update(options: ComputerUpdateOptions, signal?: AbortSignal): Promise<Computer>;
192
+ start(signal?: AbortSignal): Promise<Computer>;
193
+ stop(signal?: AbortSignal): Promise<Computer>;
194
+ delete(signal?: AbortSignal): Promise<void>;
195
+ ensureRunning(options?: WaitOptions): Promise<Computer>;
196
+ ensureStopped(options?: WaitOptions): Promise<Computer>;
197
+ waitUntilRunning(options?: WaitOptions): Promise<Computer>;
198
+ waitUntilStopped(options?: WaitOptions): Promise<Computer>;
199
+ getConnection(signal?: AbortSignal): Promise<ComputerConnectionResponse>;
200
+ createBrowserAccess(options?: ExecSessionCreateOptions): Promise<AccessSessionResponse>;
201
+ createVNCAccess(options?: ExecSessionCreateOptions): Promise<AccessSessionResponse>;
202
+ createSSHCertificate(body: CreateSSHCertificateRequest, signal?: AbortSignal): Promise<SSHCertificateResponse>;
203
+ execCapabilities(signal?: AbortSignal): Promise<readonly string[]>;
204
+ supportsCapability(capability: ComputerCapability, signal?: AbortSignal): Promise<boolean>;
205
+ requireCapability(capability: "files" | "git", signal?: AbortSignal): Promise<readonly string[]>;
206
+ waitForPort(port: number, options?: WaitOptions): Promise<PublishedPortResponse>;
207
+ waitForUrl(url: string, options?: WaitOptions): Promise<Response>;
208
+ waitForProcess(selectorOrPredicate: CommandSelector | ((command: CommandInfo) => boolean), options?: WaitOptions): Promise<CommandInfo>;
209
+ waitForFile(path: string, options?: WaitOptions): Promise<void>;
210
+ }
211
+ declare class ExecTransportError extends Error {
212
+ readonly status?: number;
213
+ readonly code?: string;
214
+ readonly details?: unknown;
215
+ constructor(message: string, options?: {
216
+ status?: number;
217
+ code?: string;
218
+ details?: unknown;
219
+ });
220
+ }
221
+ declare class UnsupportedCapabilityError extends Error {
222
+ readonly capability: "files" | "git";
223
+ readonly availableCapabilities: readonly string[];
224
+ constructor(capability: "files" | "git", availableCapabilities?: readonly string[]);
225
+ }
226
+ declare class CommandExitError extends Error {
227
+ readonly result: CommandResult;
228
+ constructor(result: CommandResult);
229
+ }
230
+ type ExecGatewayMethod = "List" | "Start" | "Connect" | "Update" | "SendInput" | "SendSignal" | "CloseStdin";
231
+ declare class ExecGatewayConnection {
232
+ private readonly client;
233
+ private readonly fetchImpl;
234
+ private readonly computerId;
235
+ readonly session: AccessSessionResponse;
236
+ constructor(client: LowLevelClient, fetchImpl: typeof fetch, computerId: string, session: AccessSessionResponse);
237
+ close(signal?: AbortSignal): Promise<void>;
238
+ requestJson<T>(method: ExecGatewayMethod, body: unknown, options?: {
239
+ signal?: AbortSignal;
240
+ requestTimeoutMs?: number;
241
+ }): Promise<T>;
242
+ openStream(method: "Start" | "Connect", body: unknown, options?: {
243
+ signal?: AbortSignal;
244
+ requestTimeoutMs?: number;
245
+ }): Promise<ReadableStreamDefaultReader<Uint8Array>>;
246
+ private endpoint;
247
+ private authorizationHeader;
248
+ private request;
249
+ }
250
+ declare class CommandHandle {
251
+ private readonly commands;
252
+ private readonly gateway;
253
+ private readonly reader;
254
+ private readonly selector;
255
+ private readonly stdoutChunks;
256
+ private readonly stderrChunks;
257
+ private readonly pidPromise;
258
+ private readonly resultPromise;
259
+ private pidResolve;
260
+ private pidReject;
261
+ private resolvedPid?;
262
+ private closed;
263
+ constructor(commands: ComputerCommandsClient, gateway: ExecGatewayConnection, reader: ReadableStreamDefaultReader<Uint8Array>, initialSelector: CommandSelector | undefined, handlers?: Pick<CommandStartOptions, "onStdout" | "onStderr" | "onExit">);
264
+ get pid(): number;
265
+ get stdout(): string;
266
+ get stderr(): string;
267
+ wait(options?: {
268
+ rejectOnNonZero?: boolean;
269
+ }): Promise<CommandResult>;
270
+ disconnect(): Promise<void>;
271
+ kill(signal?: CommandSignal, requestSignal?: AbortSignal): Promise<void>;
272
+ sendStdin(data: string | Uint8Array, requestSignal?: AbortSignal): Promise<void>;
273
+ closeStdin(requestSignal?: AbortSignal): Promise<void>;
274
+ awaitPid(): Promise<number>;
275
+ private currentSelector;
276
+ private consume;
277
+ }
278
+ declare class PtySession {
279
+ private readonly commands;
280
+ private readonly gateway;
281
+ private readonly reader;
282
+ private readonly selector;
283
+ private readonly outputChunks;
284
+ private readonly pidPromise;
285
+ private readonly resultPromise;
286
+ private pidResolve;
287
+ private pidReject;
288
+ private resolvedPid?;
289
+ private closed;
290
+ constructor(commands: ComputerCommandsClient, gateway: ExecGatewayConnection, reader: ReadableStreamDefaultReader<Uint8Array>, initialSelector: CommandSelector | undefined, handlers?: Pick<PtyStartOptions, "onData" | "onExit">);
291
+ get pid(): number;
292
+ get output(): string;
293
+ wait(options?: {
294
+ rejectOnNonZero?: boolean;
295
+ }): Promise<PtyResult>;
296
+ sendInput(data: string | Uint8Array, requestSignal?: AbortSignal): Promise<void>;
297
+ resize(cols: number, rows: number, requestSignal?: AbortSignal): Promise<void>;
298
+ kill(signal?: CommandSignal, requestSignal?: AbortSignal): Promise<void>;
299
+ disconnect(): Promise<void>;
300
+ awaitPid(): Promise<number>;
301
+ private currentSelector;
302
+ private consume;
303
+ }
304
+ declare class ComputerCommandsClient {
305
+ private readonly computer;
306
+ constructor(computer: Computer);
307
+ run(command: string | readonly string[], options?: CommandRunOptions): Promise<CommandResult>;
308
+ start(command: string | readonly string[], options?: CommandStartOptions): Promise<CommandHandle>;
309
+ connect(selector: CommandSelector, options?: Omit<CommandStartOptions, "stdin">): Promise<CommandHandle>;
310
+ list(signal?: AbortSignal): Promise<CommandInfo[]>;
311
+ sendStdin(selector: CommandSelector, data: string | Uint8Array, signal?: AbortSignal): Promise<void>;
312
+ sendPtyInput(selector: CommandSelector, data: string | Uint8Array, signal?: AbortSignal): Promise<void>;
313
+ closeStdin(selector: CommandSelector, signal?: AbortSignal): Promise<void>;
314
+ kill(selector: CommandSelector, signalName?: CommandSignal, signal?: AbortSignal): Promise<void>;
315
+ resizePty(selector: CommandSelector, cols: number, rows: number, signal?: AbortSignal): Promise<void>;
316
+ private sendProcessInput;
317
+ /** @internal */
318
+ createGateway(options: {
319
+ signal?: AbortSignal;
320
+ requestTimeoutMs?: number;
321
+ }): Promise<ExecGatewayConnection>;
322
+ }
323
+ declare class ComputerPtyClient {
324
+ private readonly computer;
325
+ constructor(computer: Computer);
326
+ create(options?: PtyStartOptions): Promise<PtySession>;
327
+ start(command: string | readonly string[], options?: PtyStartOptions): Promise<PtySession>;
328
+ attach(selector: CommandSelector, options?: Pick<PtyStartOptions, "requestTimeoutMs" | "signal" | "onData" | "onExit">): Promise<PtySession>;
329
+ connect(selector: CommandSelector, options?: Pick<PtyStartOptions, "requestTimeoutMs" | "signal" | "onData" | "onExit">): Promise<PtySession>;
330
+ }
331
+ declare class ComputerFilesClient {
332
+ private readonly computer;
333
+ constructor(computer: Computer);
334
+ readText(path: string, signal?: AbortSignal): Promise<string>;
335
+ writeText(path: string, content: string, signal?: AbortSignal): Promise<void>;
336
+ remove(path: string, signal?: AbortSignal): Promise<void>;
337
+ }
338
+ declare class ComputerGitClient {
339
+ private readonly computer;
340
+ constructor(computer: Computer);
341
+ status(signal?: AbortSignal): Promise<string>;
342
+ clone(repoUrl: string, signal?: AbortSignal): Promise<void>;
343
+ pull(signal?: AbortSignal): Promise<void>;
344
+ }
345
+ declare class ComputerPortsClient {
346
+ private readonly computer;
347
+ constructor(computer: Computer);
348
+ list(signal?: AbortSignal): Promise<ListPublishedPortsResponse["ports"]>;
349
+ publish(options: PublishPortOptions): Promise<PublishedPortResponse>;
350
+ delete(port: number, signal?: AbortSignal): Promise<PublishedPortMutationResponse["port"]>;
351
+ }
352
+ declare class ComputerSharesClient {
353
+ private readonly computer;
354
+ constructor(computer: Computer);
355
+ list(signal?: AbortSignal): Promise<ListSharesResponse["shares"]>;
356
+ createLink(options?: ShareLinkOptions): Promise<ShareResponse>;
357
+ createEmail(options: ShareEmailOptions): Promise<ShareResponse>;
358
+ delete(shareId: string, signal?: AbortSignal): Promise<void>;
359
+ }
360
+ declare class ComputerSnapshotsClient {
361
+ private readonly computer;
362
+ constructor(computer: Computer);
363
+ list(signal?: AbortSignal): Promise<ListSnapshotsResponse["snapshots"]>;
364
+ create(signal?: AbortSignal): Promise<SnapshotResponse>;
365
+ }
366
+ declare class SnapshotsClient {
367
+ private readonly sdk;
368
+ constructor(sdk: AgentComputer);
369
+ get(snapshotId: string, signal?: AbortSignal): Promise<SnapshotResponse>;
370
+ delete(snapshotId: string, signal?: AbortSignal): Promise<SnapshotResponse>;
371
+ restore(snapshotId: string, options?: SnapshotRestoreOptions): Promise<Computer>;
372
+ }
373
+ declare class SSHKeysClient {
374
+ private readonly sdk;
375
+ constructor(sdk: AgentComputer);
376
+ list(signal?: AbortSignal): Promise<ListSSHKeysResponse["ssh_keys"]>;
377
+ create(body: CreateSSHKeyRequest, signal?: AbortSignal): Promise<SSHKeyEnvelope["ssh_key"]>;
378
+ delete(sshKeyId: string, signal?: AbortSignal): Promise<void>;
379
+ }
380
+
381
+ export { AgentComputer, type AgentComputerOptions, CommandExitError, CommandHandle, type CommandInfo, type CommandOutputHandler, type CommandResult, type CommandRunOptions, type CommandSelector, type CommandSignal, type CommandStartOptions, Computer, type ComputerCapability, ComputerCommandsClient, type ComputerCreateOptions, type ComputerEnsureOptions, ComputerFilesClient, ComputerGitClient, ComputerImagesClient, ComputerPortsClient, ComputerPtyClient, ComputerSharesClient, ComputerSnapshotsClient, type ComputerSource, type ComputerState, type ComputerUpdateOptions, ComputersClient, type ExecSessionCreateOptions, ExecTransportError, type PtyOutputHandler, type PtyResult, PtySession, type PtyStartOptions, type PublishPortOptions, SSHKeysClient, type ShareEmailOptions, type ShareLinkOptions, type SnapshotRestoreOptions, SnapshotsClient, UnsupportedCapabilityError, type WaitOptions };