@b3os/sdk 0.2.2 → 0.2.3
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 +1 -1
- package/dist/cjs/core/util.d.ts +1 -1
- package/dist/cjs/core/util.js +1 -1
- package/dist/cjs/generated/client.d.ts +5 -0
- package/dist/cjs/generated/client.js +9 -0
- package/dist/cjs/generated/client.js.map +1 -1
- package/dist/cjs/generated/errors.d.ts +1 -1
- package/dist/cjs/generated/errors.js +45 -0
- package/dist/cjs/generated/errors.js.map +1 -1
- package/dist/cjs/generated/ids.d.ts +28 -0
- package/dist/cjs/generated/ids.js +7 -0
- package/dist/cjs/generated/ids.js.map +1 -1
- package/dist/cjs/generated/ns/agents.d.ts +438 -11
- package/dist/cjs/generated/ns/agents.js +598 -11
- package/dist/cjs/generated/ns/agents.js.map +1 -1
- package/dist/cjs/generated/ns/images.d.ts +84 -3
- package/dist/cjs/generated/ns/images.js +126 -2
- package/dist/cjs/generated/ns/images.js.map +1 -1
- package/dist/cjs/generated/ns/listeners.d.ts +6 -2
- package/dist/cjs/generated/ns/listeners.js +6 -2
- package/dist/cjs/generated/ns/listeners.js.map +1 -1
- package/dist/cjs/generated/ns/routines.d.ts +11 -0
- package/dist/cjs/generated/ns/routines.js +11 -0
- package/dist/cjs/generated/ns/routines.js.map +1 -1
- package/dist/cjs/generated/ns/sandboxes.d.ts +140 -1
- package/dist/cjs/generated/ns/sandboxes.js +190 -1
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
- package/dist/cjs/generated/ns/vision.d.ts +55 -1
- package/dist/cjs/generated/ns/vision.js +94 -1
- package/dist/cjs/generated/ns/vision.js.map +1 -1
- package/dist/cjs/generated/ns/workspaces.d.ts +225 -0
- package/dist/cjs/generated/ns/workspaces.js +410 -0
- package/dist/cjs/generated/ns/workspaces.js.map +1 -0
- package/dist/cjs/generated/types.d.ts +2230 -72
- package/dist/esm/core/util.d.ts +1 -1
- package/dist/esm/core/util.js +1 -1
- package/dist/esm/generated/client.d.ts +5 -0
- package/dist/esm/generated/client.js +9 -0
- package/dist/esm/generated/client.js.map +1 -1
- package/dist/esm/generated/errors.d.ts +1 -1
- package/dist/esm/generated/errors.js +45 -0
- package/dist/esm/generated/errors.js.map +1 -1
- package/dist/esm/generated/ids.d.ts +28 -0
- package/dist/esm/generated/ids.js +7 -0
- package/dist/esm/generated/ids.js.map +1 -1
- package/dist/esm/generated/ns/agents.d.ts +438 -11
- package/dist/esm/generated/ns/agents.js +598 -11
- package/dist/esm/generated/ns/agents.js.map +1 -1
- package/dist/esm/generated/ns/images.d.ts +84 -3
- package/dist/esm/generated/ns/images.js +126 -2
- package/dist/esm/generated/ns/images.js.map +1 -1
- package/dist/esm/generated/ns/listeners.d.ts +6 -2
- package/dist/esm/generated/ns/listeners.js +6 -2
- package/dist/esm/generated/ns/listeners.js.map +1 -1
- package/dist/esm/generated/ns/routines.d.ts +11 -0
- package/dist/esm/generated/ns/routines.js +11 -0
- package/dist/esm/generated/ns/routines.js.map +1 -1
- package/dist/esm/generated/ns/sandboxes.d.ts +140 -1
- package/dist/esm/generated/ns/sandboxes.js +190 -1
- package/dist/esm/generated/ns/sandboxes.js.map +1 -1
- package/dist/esm/generated/ns/vision.d.ts +55 -1
- package/dist/esm/generated/ns/vision.js +94 -1
- package/dist/esm/generated/ns/vision.js.map +1 -1
- package/dist/esm/generated/ns/workspaces.d.ts +225 -0
- package/dist/esm/generated/ns/workspaces.js +406 -0
- package/dist/esm/generated/ns/workspaces.js.map +1 -0
- package/dist/esm/generated/types.d.ts +2230 -72
- package/package.json +1 -1
- package/src/core/util.ts +1 -1
- package/src/generated/client.ts +10 -0
- package/src/generated/errors.ts +90 -0
- package/src/generated/ids.ts +7 -0
- package/src/generated/ns/agents.ts +652 -11
- package/src/generated/ns/images.ts +131 -3
- package/src/generated/ns/listeners.ts +6 -2
- package/src/generated/ns/routines.ts +11 -0
- package/src/generated/ns/sandboxes.ts +203 -1
- package/src/generated/ns/vision.ts +101 -1
- package/src/generated/ns/workspaces.ts +448 -0
- package/src/generated/types.ts +2416 -48
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by packages/sdk/scripts/generate.mjs from packages/spec/dist. Do not edit; run `pnpm generate`.
|
|
2
2
|
|
|
3
|
-
import type { RequestOptions } from "../../core/client.ts";
|
|
3
|
+
import type { BinaryInput, RequestOptions } from "../../core/client.ts";
|
|
4
4
|
import { Namespace } from "../../core/namespace.ts";
|
|
5
5
|
import type { Op } from "../../core/op.ts";
|
|
6
6
|
import type { APIPromise } from "../../core/promise.ts";
|
|
@@ -21,6 +21,24 @@ const importImageOp: Op = {
|
|
|
21
21
|
timeoutMs: 30000,
|
|
22
22
|
scope: "sandboxes:write",
|
|
23
23
|
};
|
|
24
|
+
const getContextOp: Op = {
|
|
25
|
+
id: "imagesGetContext",
|
|
26
|
+
method: "GET",
|
|
27
|
+
path: "/v1/images/contexts/{sha256}",
|
|
28
|
+
params: ["sha256"],
|
|
29
|
+
timeoutMs: 10000,
|
|
30
|
+
scope: "sandboxes:read",
|
|
31
|
+
};
|
|
32
|
+
const putContextOp: Op = {
|
|
33
|
+
id: "imagesPutContext",
|
|
34
|
+
method: "PUT",
|
|
35
|
+
path: "/v1/images/contexts/{sha256}",
|
|
36
|
+
params: ["sha256"],
|
|
37
|
+
body: "bytes",
|
|
38
|
+
contentType: "application/octet-stream",
|
|
39
|
+
timeoutMs: 60000,
|
|
40
|
+
scope: "sandboxes:write",
|
|
41
|
+
};
|
|
24
42
|
const deleteImageOp: Op = {
|
|
25
43
|
id: "imagesDeleteImage",
|
|
26
44
|
method: "DELETE",
|
|
@@ -37,13 +55,34 @@ const getImageOp: Op = {
|
|
|
37
55
|
timeoutMs: 35000,
|
|
38
56
|
scope: "sandboxes:read",
|
|
39
57
|
};
|
|
58
|
+
const getImageLogsOp: Op = {
|
|
59
|
+
id: "imagesGetImageLogs",
|
|
60
|
+
method: "GET",
|
|
61
|
+
path: "/v1/images/{image_id}/logs",
|
|
62
|
+
params: ["image_id"],
|
|
63
|
+
timeoutMs: 35000,
|
|
64
|
+
scope: "sandboxes:read",
|
|
65
|
+
};
|
|
66
|
+
const releaseImageOp: Op = {
|
|
67
|
+
id: "imagesReleaseImage",
|
|
68
|
+
method: "POST",
|
|
69
|
+
path: "/v1/images/{image_id}/release",
|
|
70
|
+
params: ["image_id"],
|
|
71
|
+
body: "json",
|
|
72
|
+
timeoutMs: 30000,
|
|
73
|
+
scope: "sandboxes:write",
|
|
74
|
+
};
|
|
40
75
|
|
|
41
76
|
/** Descriptors of every images operation, keyed by method name (for tooling and custom clients). */
|
|
42
77
|
export const imagesOps = {
|
|
43
78
|
listImages: listImagesOp,
|
|
44
79
|
importImage: importImageOp,
|
|
80
|
+
getContext: getContextOp,
|
|
81
|
+
putContext: putContextOp,
|
|
45
82
|
deleteImage: deleteImageOp,
|
|
46
83
|
getImage: getImageOp,
|
|
84
|
+
getImageLogs: getImageLogsOp,
|
|
85
|
+
releaseImage: releaseImageOp,
|
|
47
86
|
} as const;
|
|
48
87
|
|
|
49
88
|
/** Public OCI images imported as templates for your project's sandboxes (`/v1/images`). */
|
|
@@ -63,7 +102,9 @@ export class ImagesAPI extends Namespace {
|
|
|
63
102
|
/**
|
|
64
103
|
* Import an image
|
|
65
104
|
*
|
|
66
|
-
* Imports a public OCI image
|
|
105
|
+
* Imports a public OCI image, or builds one from a Dockerfile (`build`, with the `images.build` flag), as a
|
|
106
|
+
* template for this project's sandboxes. A build skips the resolve: it is queued, then `building` in a microVM
|
|
107
|
+
* of its own, and from the unpacking on it goes as an import does. The reference is resolved before the
|
|
67
108
|
* answer (a tag to its digest with one manifest `HEAD`), so the answer names the exact image: `202` with a new
|
|
68
109
|
* image (`status: queued`), or `200` with the project's existing image when one with the same key exists,
|
|
69
110
|
* ready or still importing. The key covers the project, the image's digest, the warm-up, the size and the
|
|
@@ -84,7 +125,13 @@ export class ImagesAPI extends Namespace {
|
|
|
84
125
|
* only; the kernel's random pool is reseeded for each.
|
|
85
126
|
*
|
|
86
127
|
* `size` (`vcpu`, `memory_mib`) is fixed at import: every sandbox from the image has it, and a create that asks
|
|
87
|
-
* for another size answers `400 invalid_request`.
|
|
128
|
+
* for another size answers `400 invalid_request`.
|
|
129
|
+
*
|
|
130
|
+
* A private image (`images.build`) names a registry connection in `auth` (see `ImageRegistryAuth`); using it
|
|
131
|
+
* also needs `vault:run`. A connection of another project, or one this credential may not use, answers `404
|
|
132
|
+
* connection_not_found`; one that is not a registry connection for the image's registry, `422
|
|
133
|
+
* image_auth_invalid`; a credential the registry's token service refuses, `422 image_refused` with `reason:
|
|
134
|
+
* credentials`. While the flag is off, `auth` answers `400 invalid_request`. Without the flag on for your organization the answer is
|
|
88
135
|
* `404 feature_not_enabled`; without an image store on the node, a full store or the node's disk under its
|
|
89
136
|
* floor, `503 capacity_unavailable`.
|
|
90
137
|
*
|
|
@@ -93,12 +140,60 @@ export class ImagesAPI extends Namespace {
|
|
|
93
140
|
* replaces that file system, except while a running or paused sandbox, or a snapshot taken from one, uses the
|
|
94
141
|
* image's template: then the answer is `409 image_in_use`.
|
|
95
142
|
*
|
|
143
|
+
* `name` (with the `images.build` flag; without it the answer is `404 feature_not_enabled`) gives the image a
|
|
144
|
+
* name in this project, which a create resolves inside the project only: `POST /v1/sandboxes {"template":
|
|
145
|
+
* "py:3.11"}`. A name is unique among the project's images (`409 image_name_taken` while another image, of any
|
|
146
|
+
* status, has it; delete that one first) and is never a node template's (`422 image_name_reserved` for `base`,
|
|
147
|
+
* `base:v1` and the like). The name is part of the key: the same image under another name, or without one, is
|
|
148
|
+
* another image.
|
|
149
|
+
*
|
|
150
|
+
* `app` (with the `images.build` flag) asks for the image on behalf of an application, the `name` of its
|
|
151
|
+
* b3os.yaml: `b3os apply` sends it for `build.image` and `build.dockerfile`. The application then holds the
|
|
152
|
+
* image (`held_by`), new or existing: the same request from two applications is one image with two holds. An
|
|
153
|
+
* image asked for without `app`, even once, is `kept`: it stays until you delete it, as every image did before
|
|
154
|
+
* holds. An image that is not kept goes once no application holds it and no running, paused or hibernated
|
|
155
|
+
* sandbox and no snapshot uses its template. An application's hold ends when `b3os app down` releases it
|
|
156
|
+
* (`POST /v1/images/{image_id}/release`), or by itself once none of the application's sandboxes (running, or
|
|
157
|
+
* stopped and still listed, for 7 days) runs from the image and the application has not asked for it for
|
|
158
|
+
* `[images] hold_h` (7 days): a rollback can start every generation still listed from its image. When an
|
|
159
|
+
* import does not fit the node's image store, images that are not kept, that no sandbox or snapshot uses and
|
|
160
|
+
* that no application asked for in the last hour go first, least recently used first; a rollback to one of
|
|
161
|
+
* them imports it again by digest, or builds it again from its commit.
|
|
162
|
+
*
|
|
96
163
|
* `POST /v1/images` · scope `sandboxes:write` · served by the node
|
|
97
164
|
*/
|
|
98
165
|
importImage(body: T.ImageImportRequest, options?: RequestOptions): APIPromise<T.Image> {
|
|
99
166
|
return this._client._call<T.Image>(importImageOp, { body }, options);
|
|
100
167
|
}
|
|
101
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Check a build context tar
|
|
171
|
+
*
|
|
172
|
+
* This project's tar with this sha256 and when it expires, or `404 image_context_not_found` when it was never uploaded or has expired. A client checks before it uploads.
|
|
173
|
+
*
|
|
174
|
+
* `GET /v1/images/contexts/{sha256}` · scope `sandboxes:read` · served by the node
|
|
175
|
+
*/
|
|
176
|
+
getContext(sha256: string, options?: RequestOptions): APIPromise<T.ImageContext> {
|
|
177
|
+
return this._client._call<T.ImageContext>(getContextOp, { path: [sha256] }, options);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Upload a build context tar
|
|
182
|
+
*
|
|
183
|
+
* Stores the body, a tar (plain or gzip), as a build context of this project under its sha256, for
|
|
184
|
+
* `POST /v1/images {"build": {"context": [{"sha256": "…"}]}}`. The body's sha256 must be the one in the path
|
|
185
|
+
* (`400` otherwise). A tar is at most 100 MiB: split a larger context into more tars (they are unpacked in
|
|
186
|
+
* order, each at its `at`). It is kept 24 hours after its last upload or the last build that named it, and
|
|
187
|
+
* only this project can use it. Your organization's stored tars count against `images.contexts_bytes`
|
|
188
|
+
* (`422 limit_exceeded`). The node never unpacks a tar: only the build microVM does. Uploading the same tar
|
|
189
|
+
* again answers `200` and keeps it another 24 hours.
|
|
190
|
+
*
|
|
191
|
+
* `PUT /v1/images/contexts/{sha256}` · scope `sandboxes:write` · served by the node
|
|
192
|
+
*/
|
|
193
|
+
putContext(sha256: string, data: BinaryInput, options?: RequestOptions): APIPromise<T.ImageContext> {
|
|
194
|
+
return this._client._call<T.ImageContext>(putContextOp, { path: [sha256], body: data }, options);
|
|
195
|
+
}
|
|
196
|
+
|
|
102
197
|
/**
|
|
103
198
|
* Delete an image
|
|
104
199
|
*
|
|
@@ -125,4 +220,37 @@ export class ImagesAPI extends Namespace {
|
|
|
125
220
|
getImage(imageId: string, params?: T.ImagesGetImageParams, options?: RequestOptions): APIPromise<T.Image> {
|
|
126
221
|
return this._client._call<T.Image>(getImageOp, { path: [imageId], query: params }, options);
|
|
127
222
|
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Read an image's build log
|
|
226
|
+
*
|
|
227
|
+
* The build log of one of this project's images (a Dockerfile build's output, its last 1 MiB), as lines from
|
|
228
|
+
* `offset` (0 is the first), at most 1,000 per answer. `next_offset` is where the next read starts. The log is
|
|
229
|
+
* kept when the build microVM ends, so a build still running has no lines yet, and an import has none. With
|
|
230
|
+
* `wait` (seconds, at most 30) the answer is held until there are lines past `offset` or the image is `ready`,
|
|
231
|
+
* `failed` or `evicted`, whichever is first. To follow a build, read again from `next_offset` until `status`
|
|
232
|
+
* is one of those and no lines come.
|
|
233
|
+
*
|
|
234
|
+
* `GET /v1/images/{image_id}/logs` · scope `sandboxes:read` · served by the node
|
|
235
|
+
*/
|
|
236
|
+
getImageLogs(imageId: string, params?: T.ImagesGetImageLogsParams, options?: RequestOptions): APIPromise<T.ImageLog> {
|
|
237
|
+
return this._client._call<T.ImageLog>(getImageLogsOp, { path: [imageId], query: params }, options);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Release an application's hold on an image
|
|
242
|
+
*
|
|
243
|
+
* Ends `app`'s hold on the image (`held_by`), as `b3os app down` does for each image the application holds. The
|
|
244
|
+
* image is then removed now, as `DELETE /v1/images/{image_id}` removes it, when it is not `kept`, no other
|
|
245
|
+
* application holds it and no running, paused or hibernated sandbox and no snapshot uses its template
|
|
246
|
+
* (`removed: true`). Otherwise it stays, and the answer says why: `held_by`, `kept` or `in_use`. An image that
|
|
247
|
+
* stays only because something uses it goes once nothing does. Releasing a hold the application does not have
|
|
248
|
+
* changes nothing. An import still in progress for another holder answers `409 conflict`; release it once it
|
|
249
|
+
* is ready or failed.
|
|
250
|
+
*
|
|
251
|
+
* `POST /v1/images/{image_id}/release` · scope `sandboxes:write` · served by the node
|
|
252
|
+
*/
|
|
253
|
+
releaseImage(imageId: string, body: T.ImageReleaseRequest, options?: RequestOptions): APIPromise<T.ImageRelease> {
|
|
254
|
+
return this._client._call<T.ImageRelease>(releaseImageOp, { path: [imageId], body }, options);
|
|
255
|
+
}
|
|
128
256
|
}
|
|
@@ -172,7 +172,10 @@ export class ListenersAPI extends Namespace {
|
|
|
172
172
|
*
|
|
173
173
|
* Closes the source and stops delivery at once; an event already handed to its sink is not recalled. The
|
|
174
174
|
* event history stays readable for its 7 days through `GET /v1/listeners/{listener_id}/events` and is then
|
|
175
|
-
* deleted.
|
|
175
|
+
* deleted. A routine's listener trigger's listener (`sink.trigger`) answers `409 listener_managed`: it goes
|
|
176
|
+
* when its routine publishes a version without the trigger, or is deleted. A listener a routine trigger names
|
|
177
|
+
* (`sink.bound`) is its owner's to delete; the trigger then starts nothing and the routine shows a
|
|
178
|
+
* `listener_not_found` warning.
|
|
176
179
|
*
|
|
177
180
|
* `DELETE /v1/listeners/{listener_id}` · scope `listeners:write` · served by the node
|
|
178
181
|
*/
|
|
@@ -201,7 +204,8 @@ export class ListenersAPI extends Namespace {
|
|
|
201
204
|
* ends, or now if the PATCH raises the budget above what it used. The source cannot change: create a new
|
|
202
205
|
* listener. A new filter or `redact` applies to events received after the answer. A listener that ended
|
|
203
206
|
* (`failed`, `expired`, `revoked`) answers `409 listener_not_active`, except that a `failed` one can be
|
|
204
|
-
* resumed with `paused: false`, which starts its source again.
|
|
207
|
+
* resumed with `paused: false`, which starts its source again. While a routine's trigger names the listener
|
|
208
|
+
* (`sink.bound`), a change of `sink` answers `409 listener_bound`; everything else can change.
|
|
205
209
|
*
|
|
206
210
|
* `PATCH /v1/listeners/{listener_id}` · scope `listeners:write` · served by the node
|
|
207
211
|
*/
|
|
@@ -499,6 +499,17 @@ export class RoutinesAPI extends Namespace {
|
|
|
499
499
|
* fails with `routine_invalid` and an `errors[]` item at that trigger. A webhook trigger that names a vault
|
|
500
500
|
* connection (`verify.secret`, `challenge.token_connection`) needs `vault:run` on top of `routines:write`
|
|
501
501
|
* (403 `forbidden`, `required_scope: vault:run`), as a connection in a pack trigger does.
|
|
502
|
+
* Listener triggers (`type: listener`) are listeners: publishing creates one (`lsn_`, read-only at
|
|
503
|
+
* `GET /v1/listeners/{listener_id}`) per listener trigger as the publishing key, which needs `routines:run`;
|
|
504
|
+
* a trigger whose `listener` and publishing key are unchanged keeps its listener, and the listeners of
|
|
505
|
+
* listener triggers the new version drops or changes are removed. When the listeners product refuses one,
|
|
506
|
+
* the publish fails with `routine_invalid` and `errors[]` items under that trigger's `listener`; when this
|
|
507
|
+
* node runs no listeners product it fails with 503 `product_unavailable`, and nothing is published.
|
|
508
|
+
* A listener trigger whose `listener` is a string (preview, flag `routines.named_listeners`) names a listener
|
|
509
|
+
* that already exists in the project by id or name: the publishing key needs `listeners:read` (and
|
|
510
|
+
* `listeners:write` when the listener's sink points anywhere else), the listener is checked before anything is
|
|
511
|
+
* committed, and once the version is active its sink becomes this routine and trigger (`sink.bound`). A
|
|
512
|
+
* version without the trigger, or a delete, unbinds it and pauses it.
|
|
502
513
|
*
|
|
503
514
|
* `PUT /v1/routines/{routine}` · scope `routines:write` · served by the node
|
|
504
515
|
*/
|
|
@@ -48,6 +48,13 @@ const createSandboxOp: Op = {
|
|
|
48
48
|
timeoutMs: 30000,
|
|
49
49
|
scope: "sandboxes:write",
|
|
50
50
|
};
|
|
51
|
+
const getCapacityOp: Op = {
|
|
52
|
+
id: "sandboxesGetCapacity",
|
|
53
|
+
method: "GET",
|
|
54
|
+
path: "/v1/sandboxes/capacity",
|
|
55
|
+
timeoutMs: 10000,
|
|
56
|
+
scope: "sandboxes:read",
|
|
57
|
+
};
|
|
51
58
|
const listSnapshotsOp: Op = {
|
|
52
59
|
id: "sandboxesListSnapshots",
|
|
53
60
|
method: "GET",
|
|
@@ -118,6 +125,14 @@ const listTemplatesOp: Op = {
|
|
|
118
125
|
timeoutMs: 10000,
|
|
119
126
|
scope: "sandboxes:read",
|
|
120
127
|
};
|
|
128
|
+
const createTemplateOp: Op = {
|
|
129
|
+
id: "sandboxesCreateTemplate",
|
|
130
|
+
method: "POST",
|
|
131
|
+
path: "/v1/sandboxes/templates",
|
|
132
|
+
body: "json",
|
|
133
|
+
timeoutMs: 30000,
|
|
134
|
+
scope: "sandboxes:write",
|
|
135
|
+
};
|
|
121
136
|
const getTemplateOp: Op = {
|
|
122
137
|
id: "sandboxesGetTemplate",
|
|
123
138
|
method: "GET",
|
|
@@ -199,6 +214,31 @@ const getSandboxOp: Op = {
|
|
|
199
214
|
timeoutMs: 10000,
|
|
200
215
|
scope: "sandboxes:read",
|
|
201
216
|
};
|
|
217
|
+
const getComputerOp: Op = {
|
|
218
|
+
id: "sandboxesGetComputer",
|
|
219
|
+
method: "GET",
|
|
220
|
+
path: "/v1/sandboxes/{sandbox_id}/computer",
|
|
221
|
+
params: ["sandbox_id"],
|
|
222
|
+
timeoutMs: 15000,
|
|
223
|
+
scope: "sandboxes:read",
|
|
224
|
+
};
|
|
225
|
+
const computerActOp: Op = {
|
|
226
|
+
id: "sandboxesComputerAct",
|
|
227
|
+
method: "POST",
|
|
228
|
+
path: "/v1/sandboxes/{sandbox_id}/computer/actions",
|
|
229
|
+
params: ["sandbox_id"],
|
|
230
|
+
body: "json",
|
|
231
|
+
timeoutMs: 65000,
|
|
232
|
+
scope: "sandboxes:run",
|
|
233
|
+
};
|
|
234
|
+
const computerScreenshotOp: Op = {
|
|
235
|
+
id: "sandboxesComputerScreenshot",
|
|
236
|
+
method: "GET",
|
|
237
|
+
path: "/v1/sandboxes/{sandbox_id}/computer/screenshot",
|
|
238
|
+
params: ["sandbox_id"],
|
|
239
|
+
timeoutMs: 15000,
|
|
240
|
+
scope: "sandboxes:read",
|
|
241
|
+
};
|
|
202
242
|
const setEgressOp: Op = {
|
|
203
243
|
id: "sandboxesSetEgress",
|
|
204
244
|
method: "POST",
|
|
@@ -449,6 +489,7 @@ const createSwarmOp: Op = {
|
|
|
449
489
|
export const sandboxesOps = {
|
|
450
490
|
listSandboxes: listSandboxesOp,
|
|
451
491
|
createSandbox: createSandboxOp,
|
|
492
|
+
getCapacity: getCapacityOp,
|
|
452
493
|
listSnapshots: listSnapshotsOp,
|
|
453
494
|
deleteSnapshot: deleteSnapshotOp,
|
|
454
495
|
getSnapshot: getSnapshotOp,
|
|
@@ -459,6 +500,7 @@ export const sandboxesOps = {
|
|
|
459
500
|
listSwarmChildren: listSwarmChildrenOp,
|
|
460
501
|
swarmEvents: swarmEventsOp,
|
|
461
502
|
listTemplates: listTemplatesOp,
|
|
503
|
+
createTemplate: createTemplateOp,
|
|
462
504
|
getTemplate: getTemplateOp,
|
|
463
505
|
listVolumes: listVolumesOp,
|
|
464
506
|
createVolume: createVolumeOp,
|
|
@@ -469,6 +511,9 @@ export const sandboxesOps = {
|
|
|
469
511
|
restoreVolume: restoreVolumeOp,
|
|
470
512
|
deleteSandbox: deleteSandboxOp,
|
|
471
513
|
getSandbox: getSandboxOp,
|
|
514
|
+
getComputer: getComputerOp,
|
|
515
|
+
computerAct: computerActOp,
|
|
516
|
+
computerScreenshot: computerScreenshotOp,
|
|
472
517
|
setEgress: setEgressOp,
|
|
473
518
|
exec: execOp,
|
|
474
519
|
deleteFile: deleteFileOp,
|
|
@@ -610,6 +655,12 @@ export class SandboxesAPI extends Namespace {
|
|
|
610
655
|
* create the concurrency limit allows); past it a create is refused with `422 limit_exceeded`. While the
|
|
611
656
|
* node's disk store is nearly full, creates are refused with `503 capacity_unavailable` and `Retry-After`.
|
|
612
657
|
*
|
|
658
|
+
* Desktops: a sandbox of a template with the `computer` capability (`desktop`) also counts against
|
|
659
|
+
* `sandboxes.desktops_concurrent`, its running and paused sandboxes of such templates (forks included); past it
|
|
660
|
+
* a create or fork is refused with `429 concurrency_limited` and `Retry-After`, as past `sandboxes.concurrent`.
|
|
661
|
+
* Its environment has `DISPLAY=:1` (the desktop's X server) unless `env` sets `DISPLAY`, so commands reach the
|
|
662
|
+
* screen. `GET /v1/sandboxes/capacity` says how many more would be created now.
|
|
663
|
+
*
|
|
613
664
|
* Returns the sandbox object (`SandboxInfo`). `create()` sends the same request and returns a `Sandbox`
|
|
614
665
|
* handle instead (`exec`, `files`, `ports`), which `await using` deletes when the scope ends.
|
|
615
666
|
*
|
|
@@ -624,6 +675,36 @@ export class SandboxesAPI extends Namespace {
|
|
|
624
675
|
);
|
|
625
676
|
}
|
|
626
677
|
|
|
678
|
+
/**
|
|
679
|
+
* Check room for more sandboxes
|
|
680
|
+
*
|
|
681
|
+
* How many more sandboxes of one template and size your organization could create on this node now, and
|
|
682
|
+
* which limit refuses the next one. Call it before a wave of creates instead of meeting `429` or `503`
|
|
683
|
+
* answers. The default shape is the `desktop` template at its default size; name another with `template`,
|
|
684
|
+
* `vcpu` and `memory_mib`.
|
|
685
|
+
*
|
|
686
|
+
* `room` is the least of three counts. `org` is `sandboxes.concurrent`: your running and paused sandboxes
|
|
687
|
+
* (and creates in flight) against the limit; paused sandboxes count, so delete the ones you are done with
|
|
688
|
+
* rather than leave them paused. `desktops` is `sandboxes.desktops_concurrent`, the running and paused
|
|
689
|
+
* sandboxes of templates with the `computer` capability; it counts toward `room` only when the template has
|
|
690
|
+
* that capability. `node` is this node: `parked` is how many sandboxes of the shape wait warm in its pool
|
|
691
|
+
* (a create claims one without a restore), and `room` is how many sandboxes of the shape the memory left
|
|
692
|
+
* under the node's microVM memory limit holds, each counting its `memory_mib` plus the node's per-microVM
|
|
693
|
+
* overhead, or `0` while the node's disk store is too full for new sandboxes. `node.room` is `null` when the
|
|
694
|
+
* node cannot read that limit, and then it does not count toward `room`.
|
|
695
|
+
*
|
|
696
|
+
* `binding` names the limit that refuses the next create (`org_concurrency`, `desktops` or `node`) when
|
|
697
|
+
* `room` is `0`, with `retry_after_s`, and is `null` while a create would pass. The answer is a reading, not
|
|
698
|
+
* a reservation: another create can take the room first. `sandboxes.disk_total_max` is left out (its beta
|
|
699
|
+
* default never refuses a create the concurrency limit allows). Behind the `sandboxes.desktop` feature flag:
|
|
700
|
+
* until it is on for your organization the operation answers `404 feature_not_enabled`.
|
|
701
|
+
*
|
|
702
|
+
* `GET /v1/sandboxes/capacity` · scope `sandboxes:read` · served by the node
|
|
703
|
+
*/
|
|
704
|
+
getCapacity(params?: T.SandboxesGetCapacityParams, options?: RequestOptions): APIPromise<T.SandboxCapacity> {
|
|
705
|
+
return this._client._call<T.SandboxCapacity>(getCapacityOp, { query: params }, options);
|
|
706
|
+
}
|
|
707
|
+
|
|
627
708
|
/**
|
|
628
709
|
* List snapshots
|
|
629
710
|
*
|
|
@@ -792,10 +873,41 @@ export class SandboxesAPI extends Namespace {
|
|
|
792
873
|
return this._client._call<T.TemplateList>(listTemplatesOp, {}, options);
|
|
793
874
|
}
|
|
794
875
|
|
|
876
|
+
/**
|
|
877
|
+
* Create a template
|
|
878
|
+
*
|
|
879
|
+
* Makes a template for this project's sandboxes from a public OCI image (`image`, a reference) or from a
|
|
880
|
+
* Dockerfile build (`build`), with an optional `name` the project's creates start from:
|
|
881
|
+
* `POST /v1/sandboxes {"template": "py:3.11"}`. It takes the request `POST /v1/images` takes (with `image` in
|
|
882
|
+
* place of `ref`), and the template is that image's: one object, listed and deleted with `/v1/images`. The
|
|
883
|
+
* answer is the template's view: its `tpl_` ID (fixed from the start), `name`, `status` (the image's), `image`
|
|
884
|
+
* (the `img_` ID), `rootfs_sha256` once the image is flattened, and `key`. `202` for a new image, `200` for
|
|
885
|
+
* the project's image of the same request. Watch it with `GET /v1/images/{image_id}?wait=30` until `ready`;
|
|
886
|
+
* a create by name before then answers `409 image_not_ready`.
|
|
887
|
+
*
|
|
888
|
+
* A name is unique among the project's images (`409 image_name_taken`) and never a node template's
|
|
889
|
+
* (`422 image_name_reserved`). Another project's name answers `404 template_not_found`, as a template that
|
|
890
|
+
* does not exist. Behind the `images.build` flag (and `images.import`): until it is on for your organization
|
|
891
|
+
* the answer is `404 feature_not_enabled`. `503 product_unavailable` on a node without the images product.
|
|
892
|
+
*
|
|
893
|
+
* A private image names a registry connection in `auth`, as `POST /v1/images` does (`ImageRegistryAuth`): a
|
|
894
|
+
* vault connection of this project of type `basic` whose `hosts` list the registry and its token service.
|
|
895
|
+
* Using it also needs `vault:run` (`403` without it). Another project's connection, or one this credential may
|
|
896
|
+
* not use, answers `404 connection_not_found`; one that is not a registry connection for the image's registry,
|
|
897
|
+
* `422 image_auth_invalid`; a credential the registry refuses, `422 image_refused` with `reason: credentials`.
|
|
898
|
+
* The node reads the secret once, keeps it in memory for that one import and sends it only to the registry's
|
|
899
|
+
* token service: it is never logged, recorded or put in an error. A build takes no `auth`.
|
|
900
|
+
*
|
|
901
|
+
* `POST /v1/sandboxes/templates` · scope `sandboxes:write` · served by the node
|
|
902
|
+
*/
|
|
903
|
+
createTemplate(body: T.TemplateCreateRequest, options?: RequestOptions): APIPromise<T.TemplateCreated> {
|
|
904
|
+
return this._client._call<T.TemplateCreated>(createTemplateOp, { body }, options);
|
|
905
|
+
}
|
|
906
|
+
|
|
795
907
|
/**
|
|
796
908
|
* Get a template
|
|
797
909
|
*
|
|
798
|
-
* Returns one template by name (`base`) or ID (`tpl_…`): a node template, or one of your project's image templates
|
|
910
|
+
* Returns one template by name (`base`) or ID (`tpl_…`): a node template, or one of your project's image templates, by its ID or its image's `name`. Another project's image template answers `404 template_not_found`.
|
|
799
911
|
*
|
|
800
912
|
* `GET /v1/sandboxes/templates/{template}` · scope `sandboxes:read` · served by the node
|
|
801
913
|
*/
|
|
@@ -913,6 +1025,96 @@ export class SandboxesAPI extends Namespace {
|
|
|
913
1025
|
return this._client._call<T.Sandbox>(getSandboxOp, { path: [sandboxId] }, options);
|
|
914
1026
|
}
|
|
915
1027
|
|
|
1028
|
+
/**
|
|
1029
|
+
* Read a desktop's screen size and pointer
|
|
1030
|
+
*
|
|
1031
|
+
* The screen size and the pointer position of a sandbox made from a template with the `computer`
|
|
1032
|
+
* capability (`desktop`), and who controls its input. `controller` is always `agent` for now. A sandbox of
|
|
1033
|
+
* another template answers `409 computer_unavailable`.
|
|
1034
|
+
*
|
|
1035
|
+
* A paused sandbox is resumed first when your key also has `sandboxes:write` (the scope of
|
|
1036
|
+
* `POST /v1/sandboxes/{sandbox_id}/resume`); without it the answer is `409 sandbox_not_running`. A paused
|
|
1037
|
+
* sandbox past its `expires_at` is not resumed: extend it with `POST /v1/sandboxes/{sandbox_id}/timeout` first.
|
|
1038
|
+
* `503 desktop_unavailable` means the desktop's screen and input server in the sandbox did not answer; it is
|
|
1039
|
+
* restarted within a few seconds of stopping. Behind the `sandboxes.desktop` feature flag: until it is on for
|
|
1040
|
+
* your organization the operation answers `404 feature_not_enabled`.
|
|
1041
|
+
*
|
|
1042
|
+
* `GET /v1/sandboxes/{sandbox_id}/computer` · scope `sandboxes:read` · served by the node
|
|
1043
|
+
*/
|
|
1044
|
+
getComputer(sandboxId: string, options?: RequestOptions): APIPromise<T.Computer> {
|
|
1045
|
+
return this._client._call<T.Computer>(getComputerOp, { path: [sandboxId] }, options);
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Send mouse and keyboard actions to a desktop
|
|
1050
|
+
*
|
|
1051
|
+
* Runs 1 to 32 mouse and keyboard actions in order on a sandbox made from a template with the `computer`
|
|
1052
|
+
* capability (`desktop`), then optionally waits for the screen to settle and takes a screenshot, all in one
|
|
1053
|
+
* call. Action names follow Anthropic's computer-use actions, so a harness maps them one to one. Coordinates
|
|
1054
|
+
* are screen pixels from the top left (`GET /v1/sandboxes/{sandbox_id}/computer` gives the screen size); an
|
|
1055
|
+
* action without `x` and `y` acts at the pointer. `type` types up to 8,192 bytes of UTF-8 text (newline and
|
|
1056
|
+
* tab included, other control characters refused); `key` presses a chord of xdotool key names
|
|
1057
|
+
* (`ctrl+shift+t`, `Return`, `alt+F4`); `key_down` and `key_up` hold and release one key; `wait` waits; the
|
|
1058
|
+
* waits of one call add up to at most 30,000 ms.
|
|
1059
|
+
*
|
|
1060
|
+
* The whole batch is checked before any input is sent: a bad action answers `400 invalid_request` naming it
|
|
1061
|
+
* (`actions[2]`), and nothing ran. Then each action gets a result in `results`, in order: `delivery` says
|
|
1062
|
+
* whether its input reached the X server (`delivered_unverified`: sent and synced; what the application did
|
|
1063
|
+
* with it is not checked) and `retry` whether sending it again is safe (`unsafe` once a click, text or a key
|
|
1064
|
+
* landed). An action that fails stops the batch; the actions after it are `not_delivered` with `retry:
|
|
1065
|
+
* safe`. Held buttons and keys are released when a batch fails part way.
|
|
1066
|
+
*
|
|
1067
|
+
* `screenshot` adds a screenshot after the actions (`{format, quality}`, the same as the screenshot
|
|
1068
|
+
* operation's query; `null` or left out: none). `settle` waits before the screenshot until the screen has
|
|
1069
|
+
* not changed for `quiet_ms` (80 by default), at most `max_ms` (1,000 by default); `settled_by` says which
|
|
1070
|
+
* ended the wait. `cursor` is where the pointer ended, `null` when the desktop's X server went away during
|
|
1071
|
+
* the batch (then `screenshot` is `null` too). A failed screenshot after the actions also leaves `screenshot`
|
|
1072
|
+
* `null` with the results intact.
|
|
1073
|
+
*
|
|
1074
|
+
* A paused sandbox is resumed first when your key also has `sandboxes:write`, as for
|
|
1075
|
+
* `GET /v1/sandboxes/{sandbox_id}/computer`; without it the answer is `409 sandbox_not_running`. A sandbox of
|
|
1076
|
+
* another template answers `409 computer_unavailable`. A `503` or `504` after the batch was sent to the
|
|
1077
|
+
* sandbox says so in its detail: some actions may have run, so take a screenshot before you send them again.
|
|
1078
|
+
* The node logs each action's name, its coordinates and the batch's timing, never typed text (its length
|
|
1079
|
+
* only), keys or screenshots. Behind the `sandboxes.desktop` feature flag: until it is on for your
|
|
1080
|
+
* organization the operation answers `404 feature_not_enabled`.
|
|
1081
|
+
*
|
|
1082
|
+
* `POST /v1/sandboxes/{sandbox_id}/computer/actions` · scope `sandboxes:run` · served by the node
|
|
1083
|
+
*/
|
|
1084
|
+
computerAct(
|
|
1085
|
+
sandboxId: string,
|
|
1086
|
+
body: T.ComputerActRequest,
|
|
1087
|
+
options?: RequestOptions,
|
|
1088
|
+
): APIPromise<T.ComputerActResult> {
|
|
1089
|
+
return this._client._call<T.ComputerActResult>(computerActOp, { path: [sandboxId], body }, options);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Take a screenshot of a desktop
|
|
1094
|
+
*
|
|
1095
|
+
* Captures the whole screen of a sandbox made from a template with the `computer` capability (`desktop`).
|
|
1096
|
+
* With `Accept: image/png` or `image/jpeg` (or `image/*`, `*\/*`, or no `Accept`) the answer is the image
|
|
1097
|
+
* bytes; with `Accept: application/json` it is `{format, width, height, data_base64}`, the shape of a vision
|
|
1098
|
+
* screenshot. `format` is `jpeg` (at `quality`, 80 by default) unless the query or `Accept` asks for `png`;
|
|
1099
|
+
* `quality` applies to JPEG only. `Server-Timing` has `capture` and `encode` (the time inside the sandbox),
|
|
1100
|
+
* `desk` (the round trip to it) and `resume` when a paused sandbox was resumed first.
|
|
1101
|
+
*
|
|
1102
|
+
* A paused sandbox is resumed first when your key also has `sandboxes:write`, as for
|
|
1103
|
+
* `GET /v1/sandboxes/{sandbox_id}/computer`; without it the answer is `409 sandbox_not_running`. A sandbox of
|
|
1104
|
+
* another template answers `409 computer_unavailable`. Screenshots are never logged or stored by the node.
|
|
1105
|
+
* Behind the `sandboxes.desktop` feature flag: until it is on for your organization the operation answers
|
|
1106
|
+
* `404 feature_not_enabled`.
|
|
1107
|
+
*
|
|
1108
|
+
* `GET /v1/sandboxes/{sandbox_id}/computer/screenshot` · scope `sandboxes:read` · served by the node
|
|
1109
|
+
*/
|
|
1110
|
+
computerScreenshot(
|
|
1111
|
+
sandboxId: string,
|
|
1112
|
+
params?: T.SandboxesComputerScreenshotParams,
|
|
1113
|
+
options?: RequestOptions,
|
|
1114
|
+
): APIPromise<T.ScreenshotData> {
|
|
1115
|
+
return this._client._call<T.ScreenshotData>(computerScreenshotOp, { path: [sandboxId], query: params }, options);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
916
1118
|
/**
|
|
917
1119
|
* Change a sandbox's egress policy
|
|
918
1120
|
*
|
|
@@ -114,6 +114,29 @@ const extractEventsOp: Op = {
|
|
|
114
114
|
timeoutMs: 3600000,
|
|
115
115
|
scope: "vision:read",
|
|
116
116
|
};
|
|
117
|
+
const listIdentitiesOp: Op = {
|
|
118
|
+
id: "visionListIdentities",
|
|
119
|
+
method: "GET",
|
|
120
|
+
path: "/v1/vision/identities",
|
|
121
|
+
timeoutMs: 10000,
|
|
122
|
+
scope: "vision:read",
|
|
123
|
+
};
|
|
124
|
+
const retireIdentityOp: Op = {
|
|
125
|
+
id: "visionRetireIdentity",
|
|
126
|
+
method: "DELETE",
|
|
127
|
+
path: "/v1/vision/identities/{identity_id}",
|
|
128
|
+
params: ["identity_id"],
|
|
129
|
+
timeoutMs: 10000,
|
|
130
|
+
scope: "vision:write",
|
|
131
|
+
};
|
|
132
|
+
const getIdentityOp: Op = {
|
|
133
|
+
id: "visionGetIdentity",
|
|
134
|
+
method: "GET",
|
|
135
|
+
path: "/v1/vision/identities/{identity_id}",
|
|
136
|
+
params: ["identity_id"],
|
|
137
|
+
timeoutMs: 10000,
|
|
138
|
+
scope: "vision:read",
|
|
139
|
+
};
|
|
117
140
|
const mapOp: Op = {
|
|
118
141
|
id: "visionMap",
|
|
119
142
|
method: "POST",
|
|
@@ -255,6 +278,14 @@ const actOp: Op = {
|
|
|
255
278
|
timeoutMs: 65000,
|
|
256
279
|
scope: "vision:run",
|
|
257
280
|
};
|
|
281
|
+
const getSessionAuditOp: Op = {
|
|
282
|
+
id: "visionGetSessionAudit",
|
|
283
|
+
method: "GET",
|
|
284
|
+
path: "/v1/vision/sessions/{session_id}/audit",
|
|
285
|
+
params: ["session_id"],
|
|
286
|
+
timeoutMs: 10000,
|
|
287
|
+
scope: "vision:read",
|
|
288
|
+
};
|
|
258
289
|
const connectCdpOp: Op = {
|
|
259
290
|
id: "visionConnectCdp",
|
|
260
291
|
method: "GET",
|
|
@@ -341,6 +372,9 @@ export const visionOps = {
|
|
|
341
372
|
getExtract: getExtractOp,
|
|
342
373
|
cancelExtract: cancelExtractOp,
|
|
343
374
|
extractEvents: extractEventsOp,
|
|
375
|
+
listIdentities: listIdentitiesOp,
|
|
376
|
+
retireIdentity: retireIdentityOp,
|
|
377
|
+
getIdentity: getIdentityOp,
|
|
344
378
|
map: mapOp,
|
|
345
379
|
prepare: prepareOp,
|
|
346
380
|
listProfiles: listProfilesOp,
|
|
@@ -357,6 +391,7 @@ export const visionOps = {
|
|
|
357
391
|
closeSession: closeSessionOp,
|
|
358
392
|
getSession: getSessionOp,
|
|
359
393
|
act: actOp,
|
|
394
|
+
getSessionAudit: getSessionAuditOp,
|
|
360
395
|
connectCdp: connectCdpOp,
|
|
361
396
|
saveSessionProfile: saveSessionProfileOp,
|
|
362
397
|
createSessionTicket: createSessionTicketOp,
|
|
@@ -616,6 +651,50 @@ export class VisionAPI extends Namespace {
|
|
|
616
651
|
});
|
|
617
652
|
}
|
|
618
653
|
|
|
654
|
+
/**
|
|
655
|
+
* List stealth identities
|
|
656
|
+
*
|
|
657
|
+
* Lists your organization's stealth identities, newest first, retired ones included. A stealth session
|
|
658
|
+
* (`stealth` on `POST /v1/vision/sessions`) makes a new identity when it names none and its profile has none;
|
|
659
|
+
* new identities per day and active identities in all are limits (`vision.stealth.identities.daily`,
|
|
660
|
+
* `vision.stealth.identities.max`). Behind the `vision.stealth` feature flag: until it is on for your
|
|
661
|
+
* organization the operation answers `404 feature_not_enabled`.
|
|
662
|
+
*
|
|
663
|
+
* `GET /v1/vision/identities` · scope `vision:read` · served by the node
|
|
664
|
+
*/
|
|
665
|
+
listIdentities(
|
|
666
|
+
params?: T.VisionListIdentitiesParams,
|
|
667
|
+
options?: RequestOptions,
|
|
668
|
+
): ListPromise<T.StealthIdentityList, T.StealthIdentity> {
|
|
669
|
+
return this._client._list<T.StealthIdentityList, T.StealthIdentity>(listIdentitiesOp, { query: params }, options);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Retire a stealth identity
|
|
674
|
+
*
|
|
675
|
+
* Retires the identity: no new session uses it (a create that names it answers `409 identity_retired`), and
|
|
676
|
+
* it no longer counts toward `vision.stealth.identities.max`. Its record stays, and it still counts toward the
|
|
677
|
+
* day's new identities. Sessions already using it are not closed. Retiring a retired identity changes nothing.
|
|
678
|
+
* Behind the `vision.stealth` feature flag.
|
|
679
|
+
*
|
|
680
|
+
* `DELETE /v1/vision/identities/{identity_id}` · scope `vision:write` · served by the node
|
|
681
|
+
*/
|
|
682
|
+
retireIdentity(identityId: string, options?: RequestOptions): APIPromise<T.StealthIdentity> {
|
|
683
|
+
return this._client._call<T.StealthIdentity>(retireIdentityOp, { path: [identityId] }, options);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Get a stealth identity
|
|
688
|
+
*
|
|
689
|
+
* One stealth identity of your organization: what its browser presents (screen, window, fonts), its home
|
|
690
|
+
* region and how often it was used. Behind the `vision.stealth` feature flag.
|
|
691
|
+
*
|
|
692
|
+
* `GET /v1/vision/identities/{identity_id}` · scope `vision:read` · served by the node
|
|
693
|
+
*/
|
|
694
|
+
getIdentity(identityId: string, options?: RequestOptions): APIPromise<T.StealthIdentity> {
|
|
695
|
+
return this._client._call<T.StealthIdentity>(getIdentityOp, { path: [identityId] }, options);
|
|
696
|
+
}
|
|
697
|
+
|
|
619
698
|
/**
|
|
620
699
|
* Map a site's URLs
|
|
621
700
|
*
|
|
@@ -826,7 +905,7 @@ export class VisionAPI extends Namespace {
|
|
|
826
905
|
* list and some categories, keeps one address per organization and host, and never retries a 429 or 503. A page read through a proxy is never read from or stored in the cache. `egress` says which exit served
|
|
827
906
|
* the page, `options` and `X-B3OS-Options` which values applied. A page bills one `vision.page` whichever
|
|
828
907
|
* address it was read from; bytes are never billed. The bytes of residential reads (walls and robots.txt
|
|
829
|
-
* included) count against the monthly safety limit `vision.proxy.bytes.monthly`. Batches, crawls, sessions and the Firecrawl surface leave from the node's address.
|
|
908
|
+
* included) count against the monthly safety limit `vision.proxy.bytes.monthly`. Batches, crawls, sessions (but stealth sessions, which may take your own proxy) and the Firecrawl surface leave from the node's address.
|
|
830
909
|
*
|
|
831
910
|
* `POST /v1/vision/scrape` · scope `vision:run` · served by the node
|
|
832
911
|
*/
|
|
@@ -880,6 +959,10 @@ export class VisionAPI extends Namespace {
|
|
|
880
959
|
* session closes after `timeout_s` (at most 1,800) or on `DELETE`. Bills `vision.browser_ms` from claim to
|
|
881
960
|
* close. A node whose Chrome runs without its own sandbox (`chrome_sandbox: off` in `/readyz`) answers
|
|
882
961
|
* `503 product_unavailable`: one browser per session, with a renderer sandbox.
|
|
962
|
+
* `stealth` (needs the `vision.stealth` flag, invited organizations only) gives a session whose browser keeps
|
|
963
|
+
* one consistent identity and leaves through your own proxy or the node's address (`proxy`); see
|
|
964
|
+
* `StealthOption`. A node that serves no stealth browser answers such a create with `503
|
|
965
|
+
* product_unavailable`.
|
|
883
966
|
*
|
|
884
967
|
* `POST /v1/vision/sessions` · scope `vision:write` · served by the node
|
|
885
968
|
*/
|
|
@@ -933,6 +1016,23 @@ export class VisionAPI extends Namespace {
|
|
|
933
1016
|
return this._client._call<T.ActResult>(actOp, { path: [sessionId], body }, options);
|
|
934
1017
|
}
|
|
935
1018
|
|
|
1019
|
+
/**
|
|
1020
|
+
* Get a stealth session's audit record
|
|
1021
|
+
*
|
|
1022
|
+
* The durable record of one stealth session, line by line, kept 400 days, also after the session itself is
|
|
1023
|
+
* no longer listed: who started it (organization, project, key, creator, the stealth terms version in force),
|
|
1024
|
+
* what it presented (identity, persona, stage, engine version, exit class and place), every connection its
|
|
1025
|
+
* browser opened (host, port, times, bytes), every main-frame navigation as origin and path (never the
|
|
1026
|
+
* query), challenges seen, refusals (the deny list, robots.txt), warnings, act step kinds and the close
|
|
1027
|
+
* reason. It never holds page content, form values, cookies, screenshots or CDP payloads. Behind the
|
|
1028
|
+
* `vision.stealth` feature flag; a session that was not a stealth session answers `404 session_not_found`.
|
|
1029
|
+
*
|
|
1030
|
+
* `GET /v1/vision/sessions/{session_id}/audit` · scope `vision:read` · served by the node
|
|
1031
|
+
*/
|
|
1032
|
+
getSessionAudit(sessionId: string, options?: RequestOptions): APIPromise<T.StealthAudit> {
|
|
1033
|
+
return this._client._call<T.StealthAudit>(getSessionAuditOp, { path: [sessionId] }, options);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
936
1036
|
/**
|
|
937
1037
|
* Connect over CDP
|
|
938
1038
|
*
|