@agentorg/computer 0.0.17 → 0.0.19
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 +62 -33
- package/dist/THIRD_PARTY_LICENSES.txt +1 -1
- package/dist/agentcomputer.js +1059 -233
- package/dist/sdk.js +27 -7
- package/dist/types/generated/schema.d.ts +102 -9
- package/dist/types/sdk.d.ts +14 -1
- package/package.json +5 -2
package/dist/sdk.js
CHANGED
|
@@ -24595,6 +24595,19 @@ var ComputerError = class extends Error {
|
|
|
24595
24595
|
}
|
|
24596
24596
|
};
|
|
24597
24597
|
var seconds = (ms) => Math.max(1, Math.ceil(ms / 1e3));
|
|
24598
|
+
function requestOf(opts) {
|
|
24599
|
+
const { access, browser, name, timeoutMs, metadata, apiKey, apiUrl } = opts;
|
|
24600
|
+
return {
|
|
24601
|
+
connection: { ...apiKey ? { apiKey } : {}, ...apiUrl ? { apiUrl } : {} },
|
|
24602
|
+
body: {
|
|
24603
|
+
access,
|
|
24604
|
+
browser: browser ?? false,
|
|
24605
|
+
...name === void 0 ? {} : { name },
|
|
24606
|
+
...timeoutMs === void 0 ? {} : { timeout: seconds(timeoutMs) },
|
|
24607
|
+
...metadata === void 0 ? {} : { metadata }
|
|
24608
|
+
}
|
|
24609
|
+
};
|
|
24610
|
+
}
|
|
24598
24611
|
function apiOf(opts = {}) {
|
|
24599
24612
|
const apiKey = opts.apiKey ?? process.env.AGENTCOMPUTER_API_KEY;
|
|
24600
24613
|
if (!apiKey) throw new ComputerError(401, "Pass apiKey, or set AGENTCOMPUTER_API_KEY.");
|
|
@@ -24794,23 +24807,30 @@ var Computer = class _Computer {
|
|
|
24794
24807
|
this.files = new Files(this.#computer);
|
|
24795
24808
|
}
|
|
24796
24809
|
static async create(opts) {
|
|
24797
|
-
const {
|
|
24798
|
-
const
|
|
24810
|
+
const { isolation, workspace, copyFrom } = opts;
|
|
24811
|
+
const { connection, body } = requestOf(opts);
|
|
24799
24812
|
const created = answered(
|
|
24800
24813
|
await apiOf(connection).POST("/v1/computers", {
|
|
24801
24814
|
body: {
|
|
24802
|
-
|
|
24803
|
-
browser: browser ?? false,
|
|
24815
|
+
...body,
|
|
24804
24816
|
...isolation === void 0 ? {} : { isolation },
|
|
24805
24817
|
...workspace === void 0 ? {} : { workspace },
|
|
24806
|
-
...
|
|
24807
|
-
...timeoutMs === void 0 ? {} : { timeout: seconds(timeoutMs) },
|
|
24808
|
-
...metadata === void 0 ? {} : { metadata }
|
|
24818
|
+
...copyFrom === void 0 ? {} : { copyFrom }
|
|
24809
24819
|
}
|
|
24810
24820
|
})
|
|
24811
24821
|
);
|
|
24812
24822
|
return new _Computer(connection, created, created.accessToken);
|
|
24813
24823
|
}
|
|
24824
|
+
/** This computer, attached whole. Killing it detaches it and removes nothing of the machine's. */
|
|
24825
|
+
static async attach(opts) {
|
|
24826
|
+
const { connection, body } = requestOf(opts);
|
|
24827
|
+
const attached = answered(
|
|
24828
|
+
await apiOf(connection).POST("/v1/computers/attach", {
|
|
24829
|
+
body: { ...body, workspace: opts.workspace }
|
|
24830
|
+
})
|
|
24831
|
+
);
|
|
24832
|
+
return new _Computer(connection, attached, attached.accessToken);
|
|
24833
|
+
}
|
|
24814
24834
|
/** A computer made earlier. Its token was shown when it was made, and only then. */
|
|
24815
24835
|
static async connect(computerID, opts) {
|
|
24816
24836
|
const { accessToken, ...connection } = opts;
|
|
@@ -11,7 +11,7 @@ export interface paths {
|
|
|
11
11
|
path?: never;
|
|
12
12
|
cookie?: never;
|
|
13
13
|
};
|
|
14
|
-
/** What this service
|
|
14
|
+
/** What this service offers: this computer, the kinds of computer it can make, and the browsers that can go with each, every one ready or not and why. */
|
|
15
15
|
get: operations["getInfo"];
|
|
16
16
|
put?: never;
|
|
17
17
|
post?: never;
|
|
@@ -39,6 +39,23 @@ export interface paths {
|
|
|
39
39
|
patch?: never;
|
|
40
40
|
trace?: never;
|
|
41
41
|
};
|
|
42
|
+
"/v1/computers/attach": {
|
|
43
|
+
parameters: {
|
|
44
|
+
query?: never;
|
|
45
|
+
header?: never;
|
|
46
|
+
path?: never;
|
|
47
|
+
cookie?: never;
|
|
48
|
+
};
|
|
49
|
+
get?: never;
|
|
50
|
+
put?: never;
|
|
51
|
+
/** Attach this computer, the machine the service runs on, whole: its files and commands reach all of it, as whoever started the service. Each call attaches it as a computer of its own, with its own id and token. Killing one detaches it and removes nothing of the machine's. Refused with 409 by a service that other machines can reach, which doesn't offer it. */
|
|
52
|
+
post: operations["attachComputer"];
|
|
53
|
+
delete?: never;
|
|
54
|
+
options?: never;
|
|
55
|
+
head?: never;
|
|
56
|
+
patch?: never;
|
|
57
|
+
trace?: never;
|
|
58
|
+
};
|
|
42
59
|
"/v1/computers/{computerID}": {
|
|
43
60
|
parameters: {
|
|
44
61
|
query?: never;
|
|
@@ -207,13 +224,28 @@ export interface components {
|
|
|
207
224
|
browser: boolean;
|
|
208
225
|
/** @description The full path of a folder that exists, on the service's machine. With none, the service makes a folder, which goes when the computer is killed. A folder named here never does. */
|
|
209
226
|
workspace?: string;
|
|
210
|
-
/** @description
|
|
227
|
+
/** @description The full path of a folder on the service's machine. The workspace the service makes starts with a copy of what is in it, taken once when the computer is made; the folder itself is never mounted or changed. Links are copied as they are, and sockets, pipes and devices are left out. Use it instead of workspace; it needs access other than none. */
|
|
228
|
+
copyFrom?: string;
|
|
229
|
+
/** @description How it is isolated, which it keeps for as long as it exists: container, the default. One with no isolation is no longer made, and asking for one is refused: attach this computer instead. */
|
|
211
230
|
isolation?: components["schemas"]["Isolation"];
|
|
212
231
|
timeout?: components["schemas"]["Timeout"];
|
|
213
232
|
metadata?: components["schemas"]["Metadata"];
|
|
214
233
|
};
|
|
234
|
+
AttachComputer: {
|
|
235
|
+
name?: string;
|
|
236
|
+
access: components["schemas"]["Access"];
|
|
237
|
+
/**
|
|
238
|
+
* @description Whether it has a headless browser of its own. With access none, it must.
|
|
239
|
+
* @default false
|
|
240
|
+
*/
|
|
241
|
+
browser: boolean;
|
|
242
|
+
/** @description Its work folder: the full path of a folder that exists. Commands and relative paths start there and its agent is told to work there, but nothing keeps its files inside it. Detaching never removes it. */
|
|
243
|
+
workspace: string;
|
|
244
|
+
timeout?: components["schemas"]["Timeout"];
|
|
245
|
+
metadata?: components["schemas"]["Metadata"];
|
|
246
|
+
};
|
|
215
247
|
/**
|
|
216
|
-
* @description none: processes of whoever started the service. container: a container of its own, which needs Docker on the service's machine.
|
|
248
|
+
* @description none: processes of whoever started the service, which only this computer has now; a computer made with no isolation before can't start again. container: a container of its own, which needs Docker on the service's machine.
|
|
217
249
|
* @enum {string}
|
|
218
250
|
*/
|
|
219
251
|
Isolation: "none" | "container";
|
|
@@ -231,7 +263,9 @@ export interface components {
|
|
|
231
263
|
access: components["schemas"]["Access"];
|
|
232
264
|
/** @description The isolation it was made in. It is never run in another. */
|
|
233
265
|
isolation: components["schemas"]["Isolation"];
|
|
234
|
-
/** @description
|
|
266
|
+
/** @description Whether it is this computer, attached rather than made: the service's machine, whole, acting as whoever started the service, with no isolation. False with isolation none marks a computer made with no isolation by an earlier version, which can't start again; its workspace is kept. */
|
|
267
|
+
attached: boolean;
|
|
268
|
+
/** @description The version of the program it ran at its last start. For this computer it is the service's `version` (see `getInfo`). In a container it is the version inside its image, and null for a container made before 0.0.17, which doesn't say, until it is made again. It is kept from its last start, so a stopped computer's can be older than the service's until it starts. Compare it with the service's to show that a computer runs an older program. */
|
|
235
269
|
version: string | null;
|
|
236
270
|
browser: boolean;
|
|
237
271
|
workspace: string | null;
|
|
@@ -452,7 +486,7 @@ export interface components {
|
|
|
452
486
|
/** @constant */
|
|
453
487
|
type: "reading";
|
|
454
488
|
/**
|
|
455
|
-
* @description Whose numbers these are. computer:
|
|
489
|
+
* @description Whose numbers these are. computer: the computer's own, as a container's are. machine: the whole machine's, as this computer's are, which it shares with whatever else runs there; and a container's where it can't read its own.
|
|
456
490
|
* @enum {string}
|
|
457
491
|
*/
|
|
458
492
|
scope: "computer" | "machine";
|
|
@@ -559,12 +593,42 @@ export interface components {
|
|
|
559
593
|
line: string;
|
|
560
594
|
}[];
|
|
561
595
|
};
|
|
596
|
+
Readiness: {
|
|
597
|
+
ready: boolean;
|
|
598
|
+
/** @description Why it isn't ready, in a line a person reads. Only when it isn't. */
|
|
599
|
+
reason?: string;
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* @description What a computer offers its agent and the person: what it is, its terminals, its files and its screen.
|
|
603
|
+
* @enum {string}
|
|
604
|
+
*/
|
|
605
|
+
Capability: "about" | "terminal" | "files" | "screen";
|
|
606
|
+
CapabilityState: components["schemas"]["Readiness"] & {
|
|
607
|
+
capability: components["schemas"]["Capability"];
|
|
608
|
+
};
|
|
609
|
+
/**
|
|
610
|
+
* @description headless: a headless browser with a profile of its own, beside the computer, which a person watches and controls through its live view.
|
|
611
|
+
* @enum {string}
|
|
612
|
+
*/
|
|
613
|
+
BrowserKind: "headless";
|
|
614
|
+
BrowserState: components["schemas"]["Readiness"] & {
|
|
615
|
+
kind: components["schemas"]["BrowserKind"];
|
|
616
|
+
};
|
|
617
|
+
Offer: components["schemas"]["Readiness"] & {
|
|
618
|
+
/** @description What such a computer has, each ready or not. */
|
|
619
|
+
capabilities: components["schemas"]["CapabilityState"][];
|
|
620
|
+
/** @description The browsers that can go with it, each ready or not. */
|
|
621
|
+
browsers: components["schemas"]["BrowserState"][];
|
|
622
|
+
};
|
|
623
|
+
MadeKind: components["schemas"]["Offer"] & {
|
|
624
|
+
isolation: components["schemas"]["Isolation"];
|
|
625
|
+
};
|
|
562
626
|
ServiceInfo: {
|
|
563
627
|
version: string;
|
|
564
|
-
/** @description
|
|
565
|
-
|
|
566
|
-
/** @description
|
|
567
|
-
|
|
628
|
+
/** @description This computer, the machine the service runs on, attached whole, as whoever started the service. It can be attached while ready: only where the service listens on loopback, with no proxy in front and no public address. Elsewhere it isn't offered, and one attached before is refused at start. */
|
|
629
|
+
thisComputer: components["schemas"]["Offer"];
|
|
630
|
+
/** @description Each kind of computer it makes, ready while it can be made now. A container is ready while Docker answers on the service's machine: asked for a second here and for ten when one is made, so one that is slow can be not ready here and still be made. */
|
|
631
|
+
made: components["schemas"]["MadeKind"][];
|
|
568
632
|
};
|
|
569
633
|
};
|
|
570
634
|
responses: {
|
|
@@ -663,6 +727,34 @@ export interface operations {
|
|
|
663
727
|
};
|
|
664
728
|
400: components["responses"]["Error"];
|
|
665
729
|
401: components["responses"]["Unauthorized"];
|
|
730
|
+
409: components["responses"]["Error"];
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
attachComputer: {
|
|
734
|
+
parameters: {
|
|
735
|
+
query?: never;
|
|
736
|
+
header?: never;
|
|
737
|
+
path?: never;
|
|
738
|
+
cookie?: never;
|
|
739
|
+
};
|
|
740
|
+
requestBody: {
|
|
741
|
+
content: {
|
|
742
|
+
"application/json": components["schemas"]["AttachComputer"];
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
responses: {
|
|
746
|
+
/** @description It, with its access token, shown only now. */
|
|
747
|
+
201: {
|
|
748
|
+
headers: {
|
|
749
|
+
[name: string]: unknown;
|
|
750
|
+
};
|
|
751
|
+
content: {
|
|
752
|
+
"application/json": components["schemas"]["CreatedComputer"];
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
400: components["responses"]["Error"];
|
|
756
|
+
401: components["responses"]["Unauthorized"];
|
|
757
|
+
409: components["responses"]["Error"];
|
|
666
758
|
};
|
|
667
759
|
};
|
|
668
760
|
getComputer: {
|
|
@@ -794,6 +886,7 @@ export interface operations {
|
|
|
794
886
|
};
|
|
795
887
|
401: components["responses"]["Unauthorized"];
|
|
796
888
|
404: components["responses"]["Error"];
|
|
889
|
+
409: components["responses"]["Error"];
|
|
797
890
|
};
|
|
798
891
|
};
|
|
799
892
|
getComputerLogs: {
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -38,14 +38,21 @@ export interface ConnectionOpts {
|
|
|
38
38
|
export interface CreateOpts extends ConnectionOpts {
|
|
39
39
|
access: Schemas["Access"];
|
|
40
40
|
browser?: boolean;
|
|
41
|
-
/** How it is isolated
|
|
41
|
+
/** How it is isolated: a container by default, and no other is offered now. */
|
|
42
42
|
isolation?: Schemas["Isolation"];
|
|
43
43
|
workspace?: string;
|
|
44
|
+
/** A folder whose files its workspace starts with, copied once when it is made. */
|
|
45
|
+
copyFrom?: string;
|
|
44
46
|
name?: string;
|
|
45
47
|
/** How long until it stops, in milliseconds. By default it doesn't. */
|
|
46
48
|
timeoutMs?: number;
|
|
47
49
|
metadata?: Record<string, string>;
|
|
48
50
|
}
|
|
51
|
+
/** This computer, attached whole: its files and commands reach all of it, as the service's user. */
|
|
52
|
+
export interface AttachOpts extends Omit<CreateOpts, "isolation" | "workspace" | "copyFrom"> {
|
|
53
|
+
/** Its work folder, where commands and relative paths start. Detaching never removes it. */
|
|
54
|
+
workspace: string;
|
|
55
|
+
}
|
|
49
56
|
export interface CommandResult {
|
|
50
57
|
exitCode: number;
|
|
51
58
|
output: string;
|
|
@@ -142,6 +149,8 @@ export declare class Computer {
|
|
|
142
149
|
readonly terminals: Terminals;
|
|
143
150
|
private constructor();
|
|
144
151
|
static create(opts: CreateOpts): Promise<Computer>;
|
|
152
|
+
/** This computer, attached whole. Killing it detaches it and removes nothing of the machine's. */
|
|
153
|
+
static attach(opts: AttachOpts): Promise<Computer>;
|
|
145
154
|
/** A computer made earlier. Its token was shown when it was made, and only then. */
|
|
146
155
|
static connect(computerID: string, opts: ConnectionOpts & {
|
|
147
156
|
accessToken: string;
|
|
@@ -174,6 +183,7 @@ export declare class Computer {
|
|
|
174
183
|
state: components["schemas"]["ComputerState"];
|
|
175
184
|
access: components["schemas"]["Access"];
|
|
176
185
|
isolation: components["schemas"]["Isolation"];
|
|
186
|
+
attached: boolean;
|
|
177
187
|
version: string | null;
|
|
178
188
|
browser: boolean;
|
|
179
189
|
workspace: string | null;
|
|
@@ -196,6 +206,7 @@ export declare class Computer {
|
|
|
196
206
|
state: components["schemas"]["ComputerState"];
|
|
197
207
|
access: components["schemas"]["Access"];
|
|
198
208
|
isolation: components["schemas"]["Isolation"];
|
|
209
|
+
attached: boolean;
|
|
199
210
|
version: string | null;
|
|
200
211
|
browser: boolean;
|
|
201
212
|
workspace: string | null;
|
|
@@ -210,6 +221,7 @@ export declare class Computer {
|
|
|
210
221
|
state: components["schemas"]["ComputerState"];
|
|
211
222
|
access: components["schemas"]["Access"];
|
|
212
223
|
isolation: components["schemas"]["Isolation"];
|
|
224
|
+
attached: boolean;
|
|
213
225
|
version: string | null;
|
|
214
226
|
browser: boolean;
|
|
215
227
|
workspace: string | null;
|
|
@@ -226,6 +238,7 @@ export declare class Computer {
|
|
|
226
238
|
state: components["schemas"]["ComputerState"];
|
|
227
239
|
access: components["schemas"]["Access"];
|
|
228
240
|
isolation: components["schemas"]["Isolation"];
|
|
241
|
+
attached: boolean;
|
|
229
242
|
version: string | null;
|
|
230
243
|
browser: boolean;
|
|
231
244
|
workspace: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentorg/computer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "Computers for agents, as a service: a terminal, files and a browser over MCP",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
"dist/THIRD_PARTY_LICENSES.txt",
|
|
22
22
|
"NOTICE"
|
|
23
23
|
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"tag": "next"
|
|
26
|
+
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"generate": "node scripts/generate.js",
|
|
26
29
|
"build": "tsc -p tsconfig.json && node scripts/bundle.js",
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
"playwright-core": "1.65.0-alpha-2026-10-30"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
|
-
"@agentorg/exec": "0.0.
|
|
37
|
+
"@agentorg/exec": "0.0.9",
|
|
35
38
|
"@biomejs/biome": "2.6.5",
|
|
36
39
|
"@modelcontextprotocol/client": "2.4.0",
|
|
37
40
|
"@modelcontextprotocol/node": "2.1.2",
|