aicomputer 0.1.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 +88 -0
- package/dist/index.d.ts +380 -0
- package/dist/index.js +1856 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# agentcomputer
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for Agent Computer.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add agentcomputer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Authenticate
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { AgentComputer } from "agentcomputer";
|
|
15
|
+
|
|
16
|
+
const client = new AgentComputer({
|
|
17
|
+
apiKey: process.env.AGENTCOMPUTER_API_KEY!,
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quickstart
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { AgentComputer } from "agentcomputer";
|
|
25
|
+
|
|
26
|
+
const client = new AgentComputer({
|
|
27
|
+
apiKey: process.env.AGENTCOMPUTER_API_KEY!,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const computer = await client.computers.create({
|
|
31
|
+
displayName: "Quickstart computer",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
await computer.ensureRunning();
|
|
35
|
+
|
|
36
|
+
const result = await computer.commands.run(["node", "--version"]);
|
|
37
|
+
console.log(result.stdout.trim());
|
|
38
|
+
|
|
39
|
+
await computer.ensureStopped();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Run a command
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const result = await computer.commands.run(["python3", "-c", "print('hello')"]);
|
|
46
|
+
console.log(result.exitCode, result.stdout);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For long-lived commands, use the typed command handle:
|
|
50
|
+
|
|
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
|
+
);
|
|
59
|
+
|
|
60
|
+
await server.wait({ rejectOnNonZero: false });
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Publish a port
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
await computer.waitForPort(3000);
|
|
67
|
+
const published = await computer.ports.publish({ port: 3000, name: "app" });
|
|
68
|
+
console.log(published.public_url);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## PTY sessions
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const shell = await computer.pty.create({
|
|
75
|
+
cols: 120,
|
|
76
|
+
rows: 32,
|
|
77
|
+
onData: (chunk) => process.stdout.write(chunk),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
await shell.sendInput("uname -a\n");
|
|
81
|
+
await shell.resize(140, 40);
|
|
82
|
+
await shell.kill();
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Docs
|
|
86
|
+
|
|
87
|
+
- Web docs: `https://micro.agentcomputer.ai/docs/typescript-sdk`
|
|
88
|
+
- Generated API reference is published from the package source into the docs site.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
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
|
+
authorizedKeys?: string[];
|
|
27
|
+
};
|
|
28
|
+
type ComputerEnsureOptions = ComputerCreateOptions & {
|
|
29
|
+
id?: string;
|
|
30
|
+
start?: boolean;
|
|
31
|
+
updateMetadata?: boolean;
|
|
32
|
+
};
|
|
33
|
+
type ComputerUpdateOptions = {
|
|
34
|
+
displayName?: string;
|
|
35
|
+
};
|
|
36
|
+
type CommandRunOptions = {
|
|
37
|
+
cwd?: string;
|
|
38
|
+
env?: Record<string, string>;
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
requestTimeoutMs?: number;
|
|
41
|
+
user?: string;
|
|
42
|
+
signal?: AbortSignal;
|
|
43
|
+
};
|
|
44
|
+
type CommandStartOptions = CommandRunOptions & {
|
|
45
|
+
tag?: string;
|
|
46
|
+
stdin?: boolean;
|
|
47
|
+
onStdout?: CommandOutputHandler;
|
|
48
|
+
onStderr?: CommandOutputHandler;
|
|
49
|
+
onExit?: (result: CommandResult) => void;
|
|
50
|
+
};
|
|
51
|
+
type PtyStartOptions = Omit<CommandRunOptions, "timeoutMs"> & {
|
|
52
|
+
cols?: number;
|
|
53
|
+
rows?: number;
|
|
54
|
+
tag?: string;
|
|
55
|
+
onData?: PtyOutputHandler;
|
|
56
|
+
onExit?: (result: PtyResult) => void;
|
|
57
|
+
};
|
|
58
|
+
type ExecSessionCreateOptions = {
|
|
59
|
+
ttlSeconds?: number;
|
|
60
|
+
signal?: AbortSignal;
|
|
61
|
+
};
|
|
62
|
+
type CommandSelector = number | string | {
|
|
63
|
+
pid: number;
|
|
64
|
+
} | {
|
|
65
|
+
tag: string;
|
|
66
|
+
};
|
|
67
|
+
type CommandSignal = "SIGTERM" | "SIGKILL";
|
|
68
|
+
type CommandOutputHandler = (chunk: string, raw: Uint8Array) => void;
|
|
69
|
+
type PtyOutputHandler = (chunk: string, raw: Uint8Array) => void;
|
|
70
|
+
type CommandInfo = {
|
|
71
|
+
pid: number;
|
|
72
|
+
tag?: string;
|
|
73
|
+
cmd: string;
|
|
74
|
+
args: string[];
|
|
75
|
+
envs: Record<string, string>;
|
|
76
|
+
cwd?: string;
|
|
77
|
+
};
|
|
78
|
+
type CommandResult = {
|
|
79
|
+
pid: number;
|
|
80
|
+
tag?: string;
|
|
81
|
+
stdout: string;
|
|
82
|
+
stderr: string;
|
|
83
|
+
exitCode: number;
|
|
84
|
+
status: string;
|
|
85
|
+
error?: string;
|
|
86
|
+
};
|
|
87
|
+
type PtyResult = {
|
|
88
|
+
pid: number;
|
|
89
|
+
tag?: string;
|
|
90
|
+
output: string;
|
|
91
|
+
exitCode: number;
|
|
92
|
+
status: string;
|
|
93
|
+
error?: string;
|
|
94
|
+
};
|
|
95
|
+
type ShareLinkOptions = {
|
|
96
|
+
expiresAt?: string;
|
|
97
|
+
allowBrowser?: boolean;
|
|
98
|
+
allowVnc?: boolean;
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
};
|
|
101
|
+
type ShareEmailOptions = ShareLinkOptions & {
|
|
102
|
+
email: string;
|
|
103
|
+
};
|
|
104
|
+
type PublishPortOptions = {
|
|
105
|
+
port: number;
|
|
106
|
+
name?: string;
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
};
|
|
109
|
+
type SnapshotRestoreOptions = {
|
|
110
|
+
handle?: string;
|
|
111
|
+
displayName?: string;
|
|
112
|
+
authorizedKeys?: string[];
|
|
113
|
+
signal?: AbortSignal;
|
|
114
|
+
};
|
|
115
|
+
declare class AgentComputer {
|
|
116
|
+
readonly images: ComputerImagesClient;
|
|
117
|
+
readonly computers: ComputersClient;
|
|
118
|
+
readonly snapshots: SnapshotsClient;
|
|
119
|
+
readonly sshKeys: SSHKeysClient;
|
|
120
|
+
private readonly client;
|
|
121
|
+
private readonly fetchImpl;
|
|
122
|
+
private readonly defaultPollIntervalMs;
|
|
123
|
+
private readonly defaultOperationTimeoutMs;
|
|
124
|
+
private readonly defaultComputerStateTimeoutMs;
|
|
125
|
+
private readonly defaultConnectRequestTimeoutMs;
|
|
126
|
+
constructor(options?: AgentComputerOptions);
|
|
127
|
+
me(signal?: AbortSignal): Promise<MeResponse>;
|
|
128
|
+
usage(signal?: AbortSignal): Promise<UsageEnvelope>;
|
|
129
|
+
resolveShare(shareToken: string, signal?: AbortSignal): Promise<ResolveShareResponse>;
|
|
130
|
+
redeemShare(shareToken: string, body?: Partial<CreateAccessSessionRequest>, signal?: AbortSignal): Promise<AccessSessionEnvelope>;
|
|
131
|
+
waitForOperation(operationOrId: string | Pick<OperationResponse, "id">, options?: WaitOptions): Promise<OperationResponse>;
|
|
132
|
+
waitForComputerState(computerId: string, targetState: ComputerState, options?: WaitOptions): Promise<Computer>;
|
|
133
|
+
computer(idOrHandle: string): Promise<Computer>;
|
|
134
|
+
/** @internal */
|
|
135
|
+
internalClient(): LowLevelClient;
|
|
136
|
+
/** @internal */
|
|
137
|
+
internalFetch(): typeof fetch;
|
|
138
|
+
/** @internal */
|
|
139
|
+
internalDefaultPollIntervalMs(): number;
|
|
140
|
+
/** @internal */
|
|
141
|
+
internalDefaultComputerStateTimeoutMs(): number;
|
|
142
|
+
/** @internal */
|
|
143
|
+
internalDefaultOperationTimeoutMs(): number;
|
|
144
|
+
/** @internal */
|
|
145
|
+
internalDefaultConnectRequestTimeoutMs(): number;
|
|
146
|
+
}
|
|
147
|
+
declare class ComputerImagesClient {
|
|
148
|
+
private readonly sdk;
|
|
149
|
+
constructor(sdk: AgentComputer);
|
|
150
|
+
list(signal?: AbortSignal): Promise<ComputerImageResponse[]>;
|
|
151
|
+
get(imageId: string, signal?: AbortSignal): Promise<ComputerImageResponse>;
|
|
152
|
+
getDefault(signal?: AbortSignal): Promise<ComputerImageResponse>;
|
|
153
|
+
}
|
|
154
|
+
declare class ComputersClient {
|
|
155
|
+
private readonly sdk;
|
|
156
|
+
constructor(sdk: AgentComputer);
|
|
157
|
+
list(signal?: AbortSignal): Promise<Computer[]>;
|
|
158
|
+
get(computerId: string, signal?: AbortSignal): Promise<Computer>;
|
|
159
|
+
getByHandle(handle: string, signal?: AbortSignal): Promise<Computer | null>;
|
|
160
|
+
resolve(idOrHandle: string, signal?: AbortSignal): Promise<Computer>;
|
|
161
|
+
create(options?: ComputerCreateOptions, signal?: AbortSignal): Promise<Computer>;
|
|
162
|
+
ensure(options?: ComputerEnsureOptions, signal?: AbortSignal): Promise<Computer>;
|
|
163
|
+
private defaultSource;
|
|
164
|
+
}
|
|
165
|
+
declare class Computer {
|
|
166
|
+
private readonly sdk;
|
|
167
|
+
private computer;
|
|
168
|
+
readonly commands: ComputerCommandsClient;
|
|
169
|
+
readonly pty: ComputerPtyClient;
|
|
170
|
+
readonly files: ComputerFilesClient;
|
|
171
|
+
readonly git: ComputerGitClient;
|
|
172
|
+
readonly ports: ComputerPortsClient;
|
|
173
|
+
readonly shares: ComputerSharesClient;
|
|
174
|
+
readonly snapshots: ComputerSnapshotsClient;
|
|
175
|
+
constructor(sdk: AgentComputer, computer: ComputerResponse);
|
|
176
|
+
get raw(): ComputerResponse;
|
|
177
|
+
get id(): string;
|
|
178
|
+
get handle(): string;
|
|
179
|
+
get displayName(): string;
|
|
180
|
+
get state(): ComputerState;
|
|
181
|
+
get sourceKind(): ComputerResponse["source_kind"];
|
|
182
|
+
get sourceSnapshotId(): string | null | undefined;
|
|
183
|
+
get createdAt(): string;
|
|
184
|
+
get updatedAt(): string;
|
|
185
|
+
get deletedAt(): string | null | undefined;
|
|
186
|
+
get primaryUrl(): string;
|
|
187
|
+
get failureReason(): string | null | undefined;
|
|
188
|
+
internalSdk(): AgentComputer;
|
|
189
|
+
refresh(signal?: AbortSignal): Promise<Computer>;
|
|
190
|
+
update(options: ComputerUpdateOptions, signal?: AbortSignal): Promise<Computer>;
|
|
191
|
+
start(signal?: AbortSignal): Promise<Computer>;
|
|
192
|
+
stop(signal?: AbortSignal): Promise<Computer>;
|
|
193
|
+
delete(signal?: AbortSignal): Promise<void>;
|
|
194
|
+
ensureRunning(options?: WaitOptions): Promise<Computer>;
|
|
195
|
+
ensureStopped(options?: WaitOptions): Promise<Computer>;
|
|
196
|
+
waitUntilRunning(options?: WaitOptions): Promise<Computer>;
|
|
197
|
+
waitUntilStopped(options?: WaitOptions): Promise<Computer>;
|
|
198
|
+
getConnection(signal?: AbortSignal): Promise<ComputerConnectionResponse>;
|
|
199
|
+
createBrowserAccess(options?: ExecSessionCreateOptions): Promise<AccessSessionResponse>;
|
|
200
|
+
createVNCAccess(options?: ExecSessionCreateOptions): Promise<AccessSessionResponse>;
|
|
201
|
+
createSSHCertificate(body: CreateSSHCertificateRequest, signal?: AbortSignal): Promise<SSHCertificateResponse>;
|
|
202
|
+
execCapabilities(signal?: AbortSignal): Promise<readonly string[]>;
|
|
203
|
+
supportsCapability(capability: ComputerCapability, signal?: AbortSignal): Promise<boolean>;
|
|
204
|
+
requireCapability(capability: "files" | "git", signal?: AbortSignal): Promise<readonly string[]>;
|
|
205
|
+
waitForPort(port: number, options?: WaitOptions): Promise<PublishedPortResponse>;
|
|
206
|
+
waitForUrl(url: string, options?: WaitOptions): Promise<Response>;
|
|
207
|
+
waitForProcess(selectorOrPredicate: CommandSelector | ((command: CommandInfo) => boolean), options?: WaitOptions): Promise<CommandInfo>;
|
|
208
|
+
waitForFile(path: string, options?: WaitOptions): Promise<void>;
|
|
209
|
+
}
|
|
210
|
+
declare class ExecTransportError extends Error {
|
|
211
|
+
readonly status?: number;
|
|
212
|
+
readonly code?: string;
|
|
213
|
+
readonly details?: unknown;
|
|
214
|
+
constructor(message: string, options?: {
|
|
215
|
+
status?: number;
|
|
216
|
+
code?: string;
|
|
217
|
+
details?: unknown;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
declare class UnsupportedCapabilityError extends Error {
|
|
221
|
+
readonly capability: "files" | "git";
|
|
222
|
+
readonly availableCapabilities: readonly string[];
|
|
223
|
+
constructor(capability: "files" | "git", availableCapabilities?: readonly string[]);
|
|
224
|
+
}
|
|
225
|
+
declare class CommandExitError extends Error {
|
|
226
|
+
readonly result: CommandResult;
|
|
227
|
+
constructor(result: CommandResult);
|
|
228
|
+
}
|
|
229
|
+
type ExecGatewayMethod = "List" | "Start" | "Connect" | "Update" | "SendInput" | "SendSignal" | "CloseStdin";
|
|
230
|
+
declare class ExecGatewayConnection {
|
|
231
|
+
private readonly client;
|
|
232
|
+
private readonly fetchImpl;
|
|
233
|
+
private readonly computerId;
|
|
234
|
+
readonly session: AccessSessionResponse;
|
|
235
|
+
constructor(client: LowLevelClient, fetchImpl: typeof fetch, computerId: string, session: AccessSessionResponse);
|
|
236
|
+
close(signal?: AbortSignal): Promise<void>;
|
|
237
|
+
requestJson<T>(method: ExecGatewayMethod, body: unknown, options?: {
|
|
238
|
+
signal?: AbortSignal;
|
|
239
|
+
requestTimeoutMs?: number;
|
|
240
|
+
}): Promise<T>;
|
|
241
|
+
openStream(method: "Start" | "Connect", body: unknown, options?: {
|
|
242
|
+
signal?: AbortSignal;
|
|
243
|
+
requestTimeoutMs?: number;
|
|
244
|
+
}): Promise<ReadableStreamDefaultReader<Uint8Array>>;
|
|
245
|
+
private endpoint;
|
|
246
|
+
private authorizationHeader;
|
|
247
|
+
private request;
|
|
248
|
+
}
|
|
249
|
+
declare class CommandHandle {
|
|
250
|
+
private readonly commands;
|
|
251
|
+
private readonly gateway;
|
|
252
|
+
private readonly reader;
|
|
253
|
+
private readonly selector;
|
|
254
|
+
private readonly stdoutChunks;
|
|
255
|
+
private readonly stderrChunks;
|
|
256
|
+
private readonly pidPromise;
|
|
257
|
+
private readonly resultPromise;
|
|
258
|
+
private pidResolve;
|
|
259
|
+
private pidReject;
|
|
260
|
+
private resolvedPid?;
|
|
261
|
+
private closed;
|
|
262
|
+
constructor(commands: ComputerCommandsClient, gateway: ExecGatewayConnection, reader: ReadableStreamDefaultReader<Uint8Array>, initialSelector: CommandSelector | undefined, handlers?: Pick<CommandStartOptions, "onStdout" | "onStderr" | "onExit">);
|
|
263
|
+
get pid(): number;
|
|
264
|
+
get stdout(): string;
|
|
265
|
+
get stderr(): string;
|
|
266
|
+
wait(options?: {
|
|
267
|
+
rejectOnNonZero?: boolean;
|
|
268
|
+
}): Promise<CommandResult>;
|
|
269
|
+
disconnect(): Promise<void>;
|
|
270
|
+
kill(signal?: CommandSignal, requestSignal?: AbortSignal): Promise<void>;
|
|
271
|
+
sendStdin(data: string | Uint8Array, requestSignal?: AbortSignal): Promise<void>;
|
|
272
|
+
closeStdin(requestSignal?: AbortSignal): Promise<void>;
|
|
273
|
+
awaitPid(): Promise<number>;
|
|
274
|
+
private currentSelector;
|
|
275
|
+
private consume;
|
|
276
|
+
}
|
|
277
|
+
declare class PtySession {
|
|
278
|
+
private readonly commands;
|
|
279
|
+
private readonly gateway;
|
|
280
|
+
private readonly reader;
|
|
281
|
+
private readonly selector;
|
|
282
|
+
private readonly outputChunks;
|
|
283
|
+
private readonly pidPromise;
|
|
284
|
+
private readonly resultPromise;
|
|
285
|
+
private pidResolve;
|
|
286
|
+
private pidReject;
|
|
287
|
+
private resolvedPid?;
|
|
288
|
+
private closed;
|
|
289
|
+
constructor(commands: ComputerCommandsClient, gateway: ExecGatewayConnection, reader: ReadableStreamDefaultReader<Uint8Array>, initialSelector: CommandSelector | undefined, handlers?: Pick<PtyStartOptions, "onData" | "onExit">);
|
|
290
|
+
get pid(): number;
|
|
291
|
+
get output(): string;
|
|
292
|
+
wait(options?: {
|
|
293
|
+
rejectOnNonZero?: boolean;
|
|
294
|
+
}): Promise<PtyResult>;
|
|
295
|
+
sendInput(data: string | Uint8Array, requestSignal?: AbortSignal): Promise<void>;
|
|
296
|
+
resize(cols: number, rows: number, requestSignal?: AbortSignal): Promise<void>;
|
|
297
|
+
kill(signal?: CommandSignal, requestSignal?: AbortSignal): Promise<void>;
|
|
298
|
+
disconnect(): Promise<void>;
|
|
299
|
+
awaitPid(): Promise<number>;
|
|
300
|
+
private currentSelector;
|
|
301
|
+
private consume;
|
|
302
|
+
}
|
|
303
|
+
declare class ComputerCommandsClient {
|
|
304
|
+
private readonly computer;
|
|
305
|
+
constructor(computer: Computer);
|
|
306
|
+
run(command: string | readonly string[], options?: CommandRunOptions): Promise<CommandResult>;
|
|
307
|
+
start(command: string | readonly string[], options?: CommandStartOptions): Promise<CommandHandle>;
|
|
308
|
+
connect(selector: CommandSelector, options?: Omit<CommandStartOptions, "stdin">): Promise<CommandHandle>;
|
|
309
|
+
list(signal?: AbortSignal): Promise<CommandInfo[]>;
|
|
310
|
+
sendStdin(selector: CommandSelector, data: string | Uint8Array, signal?: AbortSignal): Promise<void>;
|
|
311
|
+
sendPtyInput(selector: CommandSelector, data: string | Uint8Array, signal?: AbortSignal): Promise<void>;
|
|
312
|
+
closeStdin(selector: CommandSelector, signal?: AbortSignal): Promise<void>;
|
|
313
|
+
kill(selector: CommandSelector, signalName?: CommandSignal, signal?: AbortSignal): Promise<void>;
|
|
314
|
+
resizePty(selector: CommandSelector, cols: number, rows: number, signal?: AbortSignal): Promise<void>;
|
|
315
|
+
private sendProcessInput;
|
|
316
|
+
/** @internal */
|
|
317
|
+
createGateway(options: {
|
|
318
|
+
signal?: AbortSignal;
|
|
319
|
+
requestTimeoutMs?: number;
|
|
320
|
+
}): Promise<ExecGatewayConnection>;
|
|
321
|
+
}
|
|
322
|
+
declare class ComputerPtyClient {
|
|
323
|
+
private readonly computer;
|
|
324
|
+
constructor(computer: Computer);
|
|
325
|
+
create(options?: PtyStartOptions): Promise<PtySession>;
|
|
326
|
+
start(command: string | readonly string[], options?: PtyStartOptions): Promise<PtySession>;
|
|
327
|
+
attach(selector: CommandSelector, options?: Pick<PtyStartOptions, "requestTimeoutMs" | "signal" | "onData" | "onExit">): Promise<PtySession>;
|
|
328
|
+
connect(selector: CommandSelector, options?: Pick<PtyStartOptions, "requestTimeoutMs" | "signal" | "onData" | "onExit">): Promise<PtySession>;
|
|
329
|
+
}
|
|
330
|
+
declare class ComputerFilesClient {
|
|
331
|
+
private readonly computer;
|
|
332
|
+
constructor(computer: Computer);
|
|
333
|
+
readText(path: string, signal?: AbortSignal): Promise<string>;
|
|
334
|
+
writeText(path: string, content: string, signal?: AbortSignal): Promise<void>;
|
|
335
|
+
remove(path: string, signal?: AbortSignal): Promise<void>;
|
|
336
|
+
}
|
|
337
|
+
declare class ComputerGitClient {
|
|
338
|
+
private readonly computer;
|
|
339
|
+
constructor(computer: Computer);
|
|
340
|
+
status(signal?: AbortSignal): Promise<string>;
|
|
341
|
+
clone(repoUrl: string, signal?: AbortSignal): Promise<void>;
|
|
342
|
+
pull(signal?: AbortSignal): Promise<void>;
|
|
343
|
+
}
|
|
344
|
+
declare class ComputerPortsClient {
|
|
345
|
+
private readonly computer;
|
|
346
|
+
constructor(computer: Computer);
|
|
347
|
+
list(signal?: AbortSignal): Promise<ListPublishedPortsResponse["ports"]>;
|
|
348
|
+
publish(options: PublishPortOptions): Promise<PublishedPortResponse>;
|
|
349
|
+
delete(port: number, signal?: AbortSignal): Promise<PublishedPortMutationResponse["port"]>;
|
|
350
|
+
}
|
|
351
|
+
declare class ComputerSharesClient {
|
|
352
|
+
private readonly computer;
|
|
353
|
+
constructor(computer: Computer);
|
|
354
|
+
list(signal?: AbortSignal): Promise<ListSharesResponse["shares"]>;
|
|
355
|
+
createLink(options?: ShareLinkOptions): Promise<ShareResponse>;
|
|
356
|
+
createEmail(options: ShareEmailOptions): Promise<ShareResponse>;
|
|
357
|
+
delete(shareId: string, signal?: AbortSignal): Promise<void>;
|
|
358
|
+
}
|
|
359
|
+
declare class ComputerSnapshotsClient {
|
|
360
|
+
private readonly computer;
|
|
361
|
+
constructor(computer: Computer);
|
|
362
|
+
list(signal?: AbortSignal): Promise<ListSnapshotsResponse["snapshots"]>;
|
|
363
|
+
create(signal?: AbortSignal): Promise<SnapshotResponse>;
|
|
364
|
+
}
|
|
365
|
+
declare class SnapshotsClient {
|
|
366
|
+
private readonly sdk;
|
|
367
|
+
constructor(sdk: AgentComputer);
|
|
368
|
+
get(snapshotId: string, signal?: AbortSignal): Promise<SnapshotResponse>;
|
|
369
|
+
delete(snapshotId: string, signal?: AbortSignal): Promise<SnapshotResponse>;
|
|
370
|
+
restore(snapshotId: string, options?: SnapshotRestoreOptions): Promise<Computer>;
|
|
371
|
+
}
|
|
372
|
+
declare class SSHKeysClient {
|
|
373
|
+
private readonly sdk;
|
|
374
|
+
constructor(sdk: AgentComputer);
|
|
375
|
+
list(signal?: AbortSignal): Promise<ListSSHKeysResponse["ssh_keys"]>;
|
|
376
|
+
create(body: CreateSSHKeyRequest, signal?: AbortSignal): Promise<SSHKeyEnvelope["ssh_key"]>;
|
|
377
|
+
delete(sshKeyId: string, signal?: AbortSignal): Promise<void>;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
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 };
|