@b3os/sdk 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/sse.d.ts +2 -0
- package/dist/cjs/core/sse.js +17 -5
- package/dist/cjs/core/sse.js.map +1 -1
- package/dist/cjs/core/util.d.ts +1 -1
- package/dist/cjs/core/util.js +1 -1
- package/dist/cjs/generated/errors.d.ts +1 -1
- package/dist/cjs/generated/errors.js +20 -0
- package/dist/cjs/generated/errors.js.map +1 -1
- package/dist/cjs/generated/ns/actions.d.ts +66 -1
- package/dist/cjs/generated/ns/actions.js +101 -1
- package/dist/cjs/generated/ns/actions.js.map +1 -1
- package/dist/cjs/generated/types.d.ts +218 -12
- package/dist/cjs/helpers/sandboxes.d.ts +26 -2
- package/dist/cjs/helpers/sandboxes.js +114 -13
- package/dist/cjs/helpers/sandboxes.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/core/sse.d.ts +2 -0
- package/dist/esm/core/sse.js +17 -5
- package/dist/esm/core/sse.js.map +1 -1
- package/dist/esm/core/util.d.ts +1 -1
- package/dist/esm/core/util.js +1 -1
- package/dist/esm/generated/errors.d.ts +1 -1
- package/dist/esm/generated/errors.js +20 -0
- package/dist/esm/generated/errors.js.map +1 -1
- package/dist/esm/generated/ns/actions.d.ts +66 -1
- package/dist/esm/generated/ns/actions.js +101 -1
- package/dist/esm/generated/ns/actions.js.map +1 -1
- package/dist/esm/generated/types.d.ts +218 -12
- package/dist/esm/helpers/sandboxes.d.ts +26 -2
- package/dist/esm/helpers/sandboxes.js +113 -12
- package/dist/esm/helpers/sandboxes.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/sse.ts +17 -5
- package/src/core/util.ts +1 -1
- package/src/generated/errors.ts +40 -0
- package/src/generated/ns/actions.ts +110 -1
- package/src/generated/types.ts +232 -11
- package/src/helpers/sandboxes.ts +136 -12
- package/src/index.ts +1 -0
|
@@ -48,6 +48,35 @@ const getPackManifestOp = {
|
|
|
48
48
|
timeoutMs: 10000,
|
|
49
49
|
scope: "actions:read",
|
|
50
50
|
};
|
|
51
|
+
const getRegistryBlobOp = {
|
|
52
|
+
id: "platformGetRegistryBlob",
|
|
53
|
+
method: "GET",
|
|
54
|
+
path: "/v1/actions/registry/blobs/{digest}",
|
|
55
|
+
params: ["digest"],
|
|
56
|
+
edge: true,
|
|
57
|
+
timeoutMs: 10000,
|
|
58
|
+
scope: "actions:read",
|
|
59
|
+
};
|
|
60
|
+
const headRegistryBlobOp = {
|
|
61
|
+
id: "platformHeadRegistryBlob",
|
|
62
|
+
method: "HEAD",
|
|
63
|
+
path: "/v1/actions/registry/blobs/{digest}",
|
|
64
|
+
params: ["digest"],
|
|
65
|
+
edge: true,
|
|
66
|
+
timeoutMs: 10000,
|
|
67
|
+
scope: "actions:tools:publish",
|
|
68
|
+
};
|
|
69
|
+
const putRegistryBlobOp = {
|
|
70
|
+
id: "platformPutRegistryBlob",
|
|
71
|
+
method: "PUT",
|
|
72
|
+
path: "/v1/actions/registry/blobs/{digest}",
|
|
73
|
+
params: ["digest"],
|
|
74
|
+
body: "bytes",
|
|
75
|
+
contentType: "application/octet-stream",
|
|
76
|
+
edge: true,
|
|
77
|
+
timeoutMs: 60000,
|
|
78
|
+
scope: "actions:tools:publish",
|
|
79
|
+
};
|
|
51
80
|
const listRegistryPacksOp = {
|
|
52
81
|
id: "platformListRegistryPacks",
|
|
53
82
|
method: "GET",
|
|
@@ -130,6 +159,9 @@ export const actionsOps = {
|
|
|
130
159
|
getPack: getPackOp,
|
|
131
160
|
getPackTools: getPackToolsOp,
|
|
132
161
|
getPackManifest: getPackManifestOp,
|
|
162
|
+
getRegistryBlob: getRegistryBlobOp,
|
|
163
|
+
headRegistryBlob: headRegistryBlobOp,
|
|
164
|
+
putRegistryBlob: putRegistryBlobOp,
|
|
133
165
|
listRegistryPacks: listRegistryPacksOp,
|
|
134
166
|
publishPack: publishPackOp,
|
|
135
167
|
getRegistryPack: getRegistryPackOp,
|
|
@@ -174,6 +206,25 @@ export class ActionsAPI extends Namespace {
|
|
|
174
206
|
* (response mapping and output schema) for declarative HTTP actions; `sidecar` for JavaScript actions.
|
|
175
207
|
* Bills one `actions.call` once the action ran.
|
|
176
208
|
*
|
|
209
|
+
* **Hosted tools** (a preview, on for every organization in the beta; without `actions.tools` a `vm` call is
|
|
210
|
+
* `404 feature_not_enabled` and nothing runs). A `vm` action runs its publisher's command in a fresh microVM
|
|
211
|
+
* with no network, made for this call only and deleted before the call answers. A file field of the input
|
|
212
|
+
* schema (`x-b3os-file`) takes a file value inline, `{"$bytes": "<base64>", "name": "<name>"}` with `name`
|
|
213
|
+
* matching `^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$` (`ToolFileInput`); an output file comes back as
|
|
214
|
+
* `{"$bytes", "name", "bytes", "contentType"}` (`ToolFileOutput`), 262144 bytes of files in all. The budget is
|
|
215
|
+
* the least of `timeout_ms`, the action's own timeout and 60 seconds; a priced action refuses a `timeout_ms`
|
|
216
|
+
* below its own (`400 invalid_request`) here, and runs to its own timeout when a routine step calls it. Every
|
|
217
|
+
* call is a fresh VM, and a call that finished is charged even if the client had stopped waiting: send
|
|
218
|
+
* `Idempotency-Key` with a priced call, so a retry with the same key gets the stored answer and is not charged
|
|
219
|
+
* again (a routine step's retry with its key gets the answer of the call it started). Per organization: 120 tool calls started a minute, 4 at once, and
|
|
220
|
+
* 20 USD of publisher prices a month, counted on each node (`429`); per node, a limit of tool VMs at once (`503 tool_unavailable`,
|
|
221
|
+
* `reason: node_busy`). The answer has `tier: vm`, `cost` in micro-USD, and the `timing` phases `validate`,
|
|
222
|
+
* `start`, `copy`, `unpack`, `run`, `collect`, `delete` and `cost`. A tool call bills `actions.tool_call` (the
|
|
223
|
+
* floor, once the command ran) instead of `actions.call`, the VM's `actions.vcpu_ms` and `actions.gib_ms`,
|
|
224
|
+
* and, once the tool answered, its output matched its schema and its output files were read, the publisher's
|
|
225
|
+
* price as `actions.publisher_microusd`. A failure
|
|
226
|
+
* before the command ran bills nothing; a failure of the tool bills compute and the floor and no price.
|
|
227
|
+
*
|
|
177
228
|
* `POST /v1/actions/call` · scope `actions:run` · served by the node
|
|
178
229
|
*/
|
|
179
230
|
call(body, options) {
|
|
@@ -235,6 +286,47 @@ export class ActionsAPI extends Namespace {
|
|
|
235
286
|
getPackManifest(namespace, name, version, options) {
|
|
236
287
|
return this._client._call(getPackManifestOp, { path: [namespace, name, version] }, options);
|
|
237
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Download a hosted tool's archive
|
|
291
|
+
*
|
|
292
|
+
* Redirects to a short-lived signed URL for the archive (`application/octet-stream`). Served to a node's
|
|
293
|
+
* registry sync (a node-signed read), to the organization the publisher list names for a namespace that
|
|
294
|
+
* published a pack naming this archive, and to B3's organizations; to anyone else it is `404`, as if it did
|
|
295
|
+
* not exist. Verify the sha256 before use.
|
|
296
|
+
*
|
|
297
|
+
* `GET /v1/actions/registry/blobs/{digest}` · scope `actions:read` · served by beta-api.b3os.org
|
|
298
|
+
*/
|
|
299
|
+
getRegistryBlob(digest, options) {
|
|
300
|
+
return this._client._call(getRegistryBlobOp, { path: [digest] }, options, "application/gzip, application/octet-stream", "bytes");
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Check for a hosted tool's archive
|
|
304
|
+
*
|
|
305
|
+
* Answers `200` with the archive's `Content-Length` when the blob store holds `digest`, else `404` (a HEAD
|
|
306
|
+
* answer carries no body). `b3os tool
|
|
307
|
+
* publish` asks before it uploads. Needs the `actions.tools` flag and the scope `actions:tools:publish`.
|
|
308
|
+
*
|
|
309
|
+
* `HEAD /v1/actions/registry/blobs/{digest}` · scope `actions:tools:publish` · served by beta-api.b3os.org
|
|
310
|
+
*/
|
|
311
|
+
headRegistryBlob(digest, options) {
|
|
312
|
+
return this._client._call(headRegistryBlobOp, { path: [digest] }, options);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Upload a hosted tool's archive
|
|
316
|
+
*
|
|
317
|
+
* Stores a hosted tool's archive under its sha256, before the pack that names it is published
|
|
318
|
+
* (`platformPublishPack`). The body is the archive's bytes; `Content-Length` is required and at most
|
|
319
|
+
* 67108864 (64 MiB), and is checked before the body is read. The edge hashes the body as it streams it to
|
|
320
|
+
* storage: a body whose sha256 is not `digest`, or whose length is not `Content-Length`, is deleted and
|
|
321
|
+
* refused with `422 pack_invalid`. No `Content-Length` is `400 invalid_request`. A digest already stored answers `200` and stores nothing, so a retry is
|
|
322
|
+
* safe. Needs the `actions.tools` flag and the scope `actions:tools:publish`, which `*` and `actions:*` never
|
|
323
|
+
* grant; in the beta only B3's organizations may upload.
|
|
324
|
+
*
|
|
325
|
+
* `PUT /v1/actions/registry/blobs/{digest}` · scope `actions:tools:publish` · served by beta-api.b3os.org
|
|
326
|
+
*/
|
|
327
|
+
putRegistryBlob(digest, data, options) {
|
|
328
|
+
return this._client._call(putRegistryBlobOp, { path: [digest], body: data }, options);
|
|
329
|
+
}
|
|
238
330
|
/**
|
|
239
331
|
* List registry packs
|
|
240
332
|
*
|
|
@@ -252,7 +344,15 @@ export class ActionsAPI extends Namespace {
|
|
|
252
344
|
* most 2,000 files and 16 MiB once decompressed; other organizations are refused before the upload is read). The
|
|
253
345
|
* manifest's `signature` must verify: `sig` is Ed25519 over `b3pack-sig-v1\n<pack>\n<version>\n<contentHash>`
|
|
254
346
|
* with the publisher key `kid`, and `contentHash` covers the bundle with the signature removed. Versions are
|
|
255
|
-
* immutable. In the beta only
|
|
347
|
+
* immutable. In the beta only B3's organizations may publish, into `io.b3os` or a namespace the registry's
|
|
348
|
+
* publisher list names for the caller's organization.
|
|
349
|
+
*
|
|
350
|
+
* A pack with a `tool` block (a hosted tool) also needs: the `actions.tools` flag for the caller's
|
|
351
|
+
* organization (`404 feature_not_enabled`), the scope `actions:tools:publish`, which `*` and `actions:*` never
|
|
352
|
+
* grant (`403 forbidden` with `required_scope`), its archive already uploaded with the sha256 and size the
|
|
353
|
+
* manifest names (`PUT /v1/actions/registry/blobs/{digest}`; else `422 pack_invalid` with the pointer
|
|
354
|
+
* `/tool/bundle/archive`), and the hosted-tool and price rules of the b3pack publish checks (13 to 20). The
|
|
355
|
+
* version records who published it (`published_by`).
|
|
256
356
|
*
|
|
257
357
|
* `POST /v1/actions/registry/packs` · scope `actions:write` · served by beta-api.b3os.org
|
|
258
358
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/generated/ns/actions.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAG5G,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAKpD,MAAM,MAAM,GAAO;IACjB,EAAE,EAAE,aAAa;IACjB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,aAAa;CACrB,CAAC;AACF,MAAM,UAAU,GAAO;IACrB,EAAE,EAAE,iBAAiB;IACrB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,sBAAsB;IAC5B,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,cAAc;CACtB,CAAC;AACF,MAAM,WAAW,GAAO;IACtB,EAAE,EAAE,kBAAkB;IACtB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,KAAK;IAChB,KAAK,EAAE,cAAc;CACtB,CAAC;AACF,MAAM,SAAS,GAAO;IACpB,EAAE,EAAE,gBAAgB;IACpB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,sCAAsC;IAC5C,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,KAAK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;IAED;;;;;;;;OAQG;IACH,YAAY,CACV,MAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAkC,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACF"}
|
|
@@ -8,7 +8,7 @@ export type Metadata = Record<string, string>;
|
|
|
8
8
|
* for every scope. The build generates `enum` from the catalog, the same list as `dist/scopes.json` plus
|
|
9
9
|
* `<product>:*` and `*`.
|
|
10
10
|
*/
|
|
11
|
-
export type Scope = "vision:read" | "vision:write" | "vision:run" | "vision:profiles:use" | "vision:profiles:export" | "render:read" | "render:write" | "render:run" | "sandboxes:read" | "sandboxes:write" | "sandboxes:run" | "routines:read" | "routines:write" | "routines:run" | "actions:read" | "actions:write" | "actions:run" | "infer:read" | "infer:write" | "infer:run" | "vault:read" | "vault:write" | "vault:run" | "platform:read" | "platform:write" | "vision:*" | "render:*" | "sandboxes:*" | "routines:*" | "actions:*" | "infer:*" | "vault:*" | "platform:*" | "*";
|
|
11
|
+
export type Scope = "vision:read" | "vision:write" | "vision:run" | "vision:profiles:use" | "vision:profiles:export" | "render:read" | "render:write" | "render:run" | "sandboxes:read" | "sandboxes:write" | "sandboxes:run" | "routines:read" | "routines:write" | "routines:run" | "actions:read" | "actions:write" | "actions:run" | "actions:tools:publish" | "infer:read" | "infer:write" | "infer:run" | "vault:read" | "vault:write" | "vault:run" | "platform:read" | "platform:write" | "vision:*" | "render:*" | "sandboxes:*" | "routines:*" | "actions:*" | "infer:*" | "vault:*" | "platform:*" | "*";
|
|
12
12
|
/**
|
|
13
13
|
* Server-side phase durations in milliseconds with microsecond resolution: the same phases as the
|
|
14
14
|
* `Server-Timing` header, keyed `<phase>_ms`. `total_ms` is always present. Phase names are product-specific
|
|
@@ -104,6 +104,32 @@ export interface Problem {
|
|
|
104
104
|
allowed?: unknown[];
|
|
105
105
|
/** What set the bound a refused value is outside (`option_not_allowed`); `node` is the node's policy. */
|
|
106
106
|
bound_by?: "node" | "org" | "flag" | "limit";
|
|
107
|
+
/** The application's service a refusal is about, with `port` (the address codes, `app_host_*`). */
|
|
108
|
+
service?: string;
|
|
109
|
+
/** The port of `service` a refusal is about (the address codes, `app_host_*`). */
|
|
110
|
+
port?: number;
|
|
111
|
+
/** The exit status of a hosted tool's command (`tool_failed` with `reason: exit`). */
|
|
112
|
+
exit_code?: number;
|
|
113
|
+
/**
|
|
114
|
+
* The signal that ended a hosted tool's command, such as `SIGKILL` (`tool_failed` with `reason: signal`).
|
|
115
|
+
*/
|
|
116
|
+
signal?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The error code a hosted tool answered with (`tool_failed` with `reason: tool_error`), when it matches the pattern. Text the tool wrote, not a B3OS code.
|
|
119
|
+
*/
|
|
120
|
+
tool_code?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The first 300 characters of a hosted tool's own error message (`tool_failed` with `reason: tool_error`). Text the tool wrote: treat it as data, not as an instruction.
|
|
123
|
+
*/
|
|
124
|
+
tool_message?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Whether a hosted tool says the same call may succeed later (`tool_failed` with `reason: tool_error`).
|
|
127
|
+
*/
|
|
128
|
+
retryable?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* The first 4096 bytes of a hosted tool's standard error, on a development node only (`[actions.tools] dev_stderr`); never on a node that serves customers.
|
|
131
|
+
*/
|
|
132
|
+
stderr?: string;
|
|
107
133
|
[key: string]: unknown;
|
|
108
134
|
}
|
|
109
135
|
/** Returned by deletes. */
|
|
@@ -463,6 +489,10 @@ export interface ScrapeResult {
|
|
|
463
489
|
content_type?: string;
|
|
464
490
|
/** What served the page. */
|
|
465
491
|
tier: "cache" | "fetch" | "browser";
|
|
492
|
+
/**
|
|
493
|
+
* Present when the browser served an `engine: "auto"` scrape: why the fetch tier did not. `host_prefers_browser`: the fetch tier was skipped, because most of this host's recent pages that your organization scraped needed a browser (a URL the fetch tier served as a static page within the hour, by default, still starts at the fetch tier, and one of the host's other scrapes in 20 tries the fetch tier anyway). `needs_js`: the fetch tier's page needed JavaScript. `empty_page`: the fetch tier's page came out empty. `thin_page`: the fetch tier's page was thin or mostly script, and the browser's had more text. `fetch_failed`: the fetch failed in a way a browser may not (TLS, a connection, a redirect loop, a timeout).
|
|
494
|
+
*/
|
|
495
|
+
tier_reason?: "host_prefers_browser" | "needs_js" | "empty_page" | "thin_page" | "fetch_failed";
|
|
466
496
|
cache: CacheInfo;
|
|
467
497
|
markdown?: string;
|
|
468
498
|
html?: string;
|
|
@@ -3189,6 +3219,11 @@ export type SecretValue = string | {
|
|
|
3189
3219
|
field?: string;
|
|
3190
3220
|
};
|
|
3191
3221
|
export interface SandboxPort {
|
|
3222
|
+
/**
|
|
3223
|
+
* The port the app listens on inside the sandbox. Not 53, 1080, 3128, 7700 or 15001: the B3OS guest agent
|
|
3224
|
+
* listens on those in every sandbox (its API proxy, egress proxies and DNS), so they are never proxied and
|
|
3225
|
+
* a create that declares one is `400 invalid_request`.
|
|
3226
|
+
*/
|
|
3192
3227
|
port: number;
|
|
3193
3228
|
/**
|
|
3194
3229
|
* Reachable by anyone with the sandbox's long-lived port URL (`ports[].url` in the sandbox; its token lasts 7
|
|
@@ -3204,6 +3239,14 @@ export interface SandboxPort {
|
|
|
3204
3239
|
* @default 65
|
|
3205
3240
|
*/
|
|
3206
3241
|
first_byte_s?: number;
|
|
3242
|
+
/**
|
|
3243
|
+
* The port has an app address (`<label>.b3os.io`); `b3os apply` sets it on such a port and keeps the port
|
|
3244
|
+
* private (no long-lived URL). The sandbox then counts as reachable from the internet for as long as it
|
|
3245
|
+
* lives, as with a public port: code in another sandbox whose egress is not `public` cannot reach into it,
|
|
3246
|
+
* and code in such a sandbox cannot start one with an addressed port (`403 egress_escalation`).
|
|
3247
|
+
* @default false
|
|
3248
|
+
*/
|
|
3249
|
+
addressed?: boolean;
|
|
3207
3250
|
}
|
|
3208
3251
|
/**
|
|
3209
3252
|
* What code inside the sandbox may call at `http://127.0.0.1:7700`. Empty by default, revoked when the sandbox stops.
|
|
@@ -3397,6 +3440,8 @@ export interface Sandbox {
|
|
|
3397
3440
|
ports: {
|
|
3398
3441
|
port: number;
|
|
3399
3442
|
public: boolean;
|
|
3443
|
+
/** The port has an app address (the create set `addressed`); always sent by this node. */
|
|
3444
|
+
addressed?: boolean;
|
|
3400
3445
|
/**
|
|
3401
3446
|
* Public ports: the long-lived preview URL, token included. Private ports: `null`; mint a URL with
|
|
3402
3447
|
* `POST /v1/sandboxes/{sandbox_id}/ports/{port}/url`. Also `null` when code in another sandbox reads
|
|
@@ -4407,7 +4452,7 @@ export interface SignalRequest {
|
|
|
4407
4452
|
payload?: unknown;
|
|
4408
4453
|
}
|
|
4409
4454
|
/**
|
|
4410
|
-
* One manifest per pack: connections, egress, actions (T0 declarative HTTP
|
|
4455
|
+
* One manifest per pack: connections, egress, actions (T0 declarative HTTP, T1 first-party JS, or vm: a hosted tool's command run in a fresh microVM), triggers (webhook, poll, schedule), fixtures, pricing and the publisher signature. A pack whose actions are vm is a hosted tool and has a tool block. Field names follow research/b3os-actions.md section 12.3 (camelCase, like MCP). Every string that contains ${{ }} is a CEL template; the template rules and CEL contexts are in packages/spec/schemas/README.md. Rules JSON Schema cannot express (unique action keys, egress subset, connection references, effect consistency, what a hosted tool may declare in this version) are listed in the README under 'b3pack publish checks' and are enforced by the actions registry and by examples/validate.mjs. Owner after freeze: actions.
|
|
4411
4456
|
*/
|
|
4412
4457
|
export interface B3Pack {
|
|
4413
4458
|
/** Optional pointer to this schema for editors. Ignored by the runtime. */
|
|
@@ -4440,7 +4485,7 @@ export interface B3Pack {
|
|
|
4440
4485
|
sizes?: string[];
|
|
4441
4486
|
}[];
|
|
4442
4487
|
/**
|
|
4443
|
-
* Pack runtime API the pack needs, as a caret range (npm and Cargo read it the same way). The
|
|
4488
|
+
* Pack runtime API the pack needs, as a caret range (npm and Cargo read it the same way). The runtime is 1.1.0: packs without a tool block declare ^1, ^1.0 or ^1.1; a pack with a tool block declares ^1.1 or later (the vm kind is runtime API 1.1), so a node from before hosted tools refuses it instead of loading half of it.
|
|
4444
4489
|
*/
|
|
4445
4490
|
engine: string;
|
|
4446
4491
|
/**
|
|
@@ -4454,9 +4499,10 @@ export interface B3Pack {
|
|
|
4454
4499
|
actions: B3PackAction[];
|
|
4455
4500
|
triggers?: B3PackTrigger[];
|
|
4456
4501
|
/**
|
|
4457
|
-
* Default price for every action that does not set its own.
|
|
4502
|
+
* Default price for every action that does not set its own. A price is charged on vm actions only (a hosted tool's publisher price, usage unit actions.publisher_microusd); packs without vm actions are free and the node still meters actions.call (ARCHITECTURE 4.5).
|
|
4458
4503
|
*/
|
|
4459
4504
|
pricing?: B3PackPricing;
|
|
4505
|
+
tool?: B3PackTool;
|
|
4460
4506
|
compat?: {
|
|
4461
4507
|
/**
|
|
4462
4508
|
* Maps an action key in this pack to the flat action id it replaces in the old B3OS catalog (research 12.3, 13). Used by the importer so old workflows resolve.
|
|
@@ -4508,7 +4554,7 @@ export interface B3PackEgressEntry {
|
|
|
4508
4554
|
schemes?: Array<"https" | "http">;
|
|
4509
4555
|
}
|
|
4510
4556
|
/**
|
|
4511
|
-
* A JSON Schema 2020-12 document whose top level describes an object (MCP requires object-typed inputSchema and outputSchema). Objects should be closed (additionalProperties false) unless declared open (research 12.4). x-b3-* keywords (x-b3-widget, x-b3-semantic, x-b3-options, ...) are allowed as annotations and ignored by validation.
|
|
4557
|
+
* A JSON Schema 2020-12 document whose top level describes an object (MCP requires object-typed inputSchema and outputSchema). Objects should be closed (additionalProperties false) unless declared open (research 12.4). x-b3-* keywords (x-b3-widget, x-b3-semantic, x-b3-options, ...) are allowed as annotations and ignored by validation. x-b3os-file marks a file field of a vm action: on a top-level property of inputSchema it is {"accept": [media types]} and the property's value is a file value; on a top-level property of outputSchema it is {"produces": [media types]} and the tool answers {"path": "/out/<name>"} there (README, 'b3pack publish checks' 19).
|
|
4512
4558
|
*/
|
|
4513
4559
|
export type B3PackJsonSchemaObject = JsonSchemaDocument & {
|
|
4514
4560
|
type: "object";
|
|
@@ -4563,7 +4609,7 @@ export interface B3PackEffects {
|
|
|
4563
4609
|
class: "pure" | "read" | "write" | "irreversible";
|
|
4564
4610
|
}
|
|
4565
4611
|
/**
|
|
4566
|
-
* Publisher price on top of the platform's actions.
|
|
4612
|
+
* Publisher price, charged on vm actions only, on top of the platform's own meters (a hosted tool's call bills actions.tool_call, actions.vcpu_ms and actions.gib_ms; the price is actions.publisher_microusd). First-party packs are free. Amounts are decimal strings in USD to avoid float rounding; the publish checks hold a per_call price to at most 1 USD and 6 decimal places, so it is a whole number of micro-USD.
|
|
4567
4613
|
*/
|
|
4568
4614
|
export interface B3PackPricing {
|
|
4569
4615
|
model: "free" | "per_call";
|
|
@@ -4619,7 +4665,7 @@ export interface B3PackHttpResponse {
|
|
|
4619
4665
|
}[];
|
|
4620
4666
|
}
|
|
4621
4667
|
/**
|
|
4622
|
-
* How the action runs. http = T0, declarative HTTP inside b3osd. js = T1, a first-party ES module run by the actions-js sidecar (packages/spec/sidecars/actions-js.md).
|
|
4668
|
+
* How the action runs. http = T0, declarative HTTP inside b3osd. js = T1, a first-party ES module run by the actions-js sidecar (packages/spec/sidecars/actions-js.md). vm = a hosted tool: each call runs cmd in a fresh microVM of tool.base with the tool's archive unpacked at /tool, the request as one JSON object on stdin and one JSON object as the last line of stdout (protocol json-stdio, README 'Hosted tools').
|
|
4623
4669
|
*/
|
|
4624
4670
|
export type B3PackImpl = {
|
|
4625
4671
|
kind: "http";
|
|
@@ -4636,6 +4682,16 @@ export type B3PackImpl = {
|
|
|
4636
4682
|
* @default "run"
|
|
4637
4683
|
*/
|
|
4638
4684
|
export?: string;
|
|
4685
|
+
} | {
|
|
4686
|
+
kind: "vm";
|
|
4687
|
+
/**
|
|
4688
|
+
* The request is one JSON object on stdin; the answer is the last line of stdout, {"output": ...} or {"error": {code, message, retryable}}, with exit status 0 either way.
|
|
4689
|
+
*/
|
|
4690
|
+
protocol: "json-stdio";
|
|
4691
|
+
/**
|
|
4692
|
+
* The command and its arguments, run with no shell, working directory /work, as the guest's user. Fixed text: no caller value ever enters it. cmd[0] is a path under /tool/ (publish check 18).
|
|
4693
|
+
*/
|
|
4694
|
+
cmd: string[];
|
|
4639
4695
|
};
|
|
4640
4696
|
export type B3PackExample = {
|
|
4641
4697
|
fixture: B3PackFixturePath;
|
|
@@ -4669,9 +4725,17 @@ export type B3PackAction = {
|
|
|
4669
4725
|
egress?: B3PackEgressEntry[];
|
|
4670
4726
|
execution?: {
|
|
4671
4727
|
/**
|
|
4672
|
-
* Wall-clock budget per call, including upstream time. Default 10000 for http, 30000 for js. A caller's shorter deadline wins.
|
|
4728
|
+
* Wall-clock budget per call, including upstream time. Default 10000 for http, 30000 for js and vm; at most 60000 for vm. A caller's shorter deadline wins, except on a priced vm action, where a shorter timeout_ms is refused.
|
|
4673
4729
|
*/
|
|
4674
4730
|
timeoutMs?: number;
|
|
4731
|
+
/**
|
|
4732
|
+
* vm only, reserved for files that are not inline (slice B): the most input file data a call may carry. Refused in this version.
|
|
4733
|
+
*/
|
|
4734
|
+
maxInputMb?: number;
|
|
4735
|
+
/** vm only, reserved (slice B): the most output file data a call may return. Refused in this version. */
|
|
4736
|
+
maxOutputMb?: number;
|
|
4737
|
+
/** vm only, reserved (slice B): the most output files a call may return. Refused in this version. */
|
|
4738
|
+
maxOutputFiles?: number;
|
|
4675
4739
|
/** T1 only: V8 old-generation limit of the worker running the call. Default 128. */
|
|
4676
4740
|
memoryMb?: number;
|
|
4677
4741
|
/**
|
|
@@ -4840,6 +4904,101 @@ export type B3PackTrigger = {
|
|
|
4840
4904
|
/** Task phrases for this trigger (when an issue is opened). */
|
|
4841
4905
|
aliases?: B3PackSearchPhrases;
|
|
4842
4906
|
};
|
|
4907
|
+
/**
|
|
4908
|
+
* A hosted tool: the software a pack's vm actions run, and what it needs to run. Required when any action is vm and refused otherwise (publish checks 13 to 20). The schema admits the values of later versions (mcp, the other bases, session, hosts, caller, any size) and the reserved keys (setup, image, formats, errors, bundle.files, base.range), so that what this version refuses is refused with a plain sentence of the publish checks rather than a schema error.
|
|
4909
|
+
*/
|
|
4910
|
+
export interface B3PackTool {
|
|
4911
|
+
/**
|
|
4912
|
+
* cli: a command that reads a request on stdin and writes an answer on stdout. mcp (later): an MCP server. Shown on the listing.
|
|
4913
|
+
*/
|
|
4914
|
+
kind: "cli" | "mcp";
|
|
4915
|
+
/** The shared template the tool runs on. Bases have no versions yet. */
|
|
4916
|
+
base: {
|
|
4917
|
+
name: "base" | "files" | "browser" | "code-interpreter";
|
|
4918
|
+
/** Reserved: not read, because bases have no versions yet. Refused in this version. */
|
|
4919
|
+
range?: string;
|
|
4920
|
+
};
|
|
4921
|
+
/**
|
|
4922
|
+
* The tool VM's size, one of the base's size classes. Absent: 1 vCPU and 512 MiB, the only size of this version.
|
|
4923
|
+
*/
|
|
4924
|
+
size?: {
|
|
4925
|
+
vcpu: number;
|
|
4926
|
+
memoryMb: number;
|
|
4927
|
+
};
|
|
4928
|
+
/**
|
|
4929
|
+
* Where the tool's files come from. This version reads one archive, unpacked at /tool before each call.
|
|
4930
|
+
*/
|
|
4931
|
+
bundle?: {
|
|
4932
|
+
archive?: B3PackToolArchive;
|
|
4933
|
+
/**
|
|
4934
|
+
* Reserved: files carried inside the pack bundle under tool/, with their sources (later versions). Refused in this version.
|
|
4935
|
+
*/
|
|
4936
|
+
files?: unknown[];
|
|
4937
|
+
};
|
|
4938
|
+
/**
|
|
4939
|
+
* call: one fresh VM per call, deleted before the call answers. session (later): a keyed instance kept between calls.
|
|
4940
|
+
*/
|
|
4941
|
+
runtime?: {
|
|
4942
|
+
mode: "call" | "session";
|
|
4943
|
+
/** Reserved for session tools. */
|
|
4944
|
+
start?: unknown;
|
|
4945
|
+
/** Reserved for session tools. */
|
|
4946
|
+
ready?: unknown;
|
|
4947
|
+
/** Reserved for session tools. */
|
|
4948
|
+
idleS?: number;
|
|
4949
|
+
/** Reserved for session tools. */
|
|
4950
|
+
maxS?: number;
|
|
4951
|
+
};
|
|
4952
|
+
/**
|
|
4953
|
+
* What the tool's VM may reach. none: nothing (egress deny); the pack's egress list is empty. hosts (later): the pack's egress list, port 443 only. caller (later, first-party only): hosts the caller names.
|
|
4954
|
+
*/
|
|
4955
|
+
network?: {
|
|
4956
|
+
mode: "none" | "hosts" | "caller";
|
|
4957
|
+
};
|
|
4958
|
+
/** The software the tool runs and did not write. Stored and returned by describe. */
|
|
4959
|
+
upstream?: {
|
|
4960
|
+
name: string;
|
|
4961
|
+
url: string;
|
|
4962
|
+
version: string;
|
|
4963
|
+
/** SPDX license expression. */
|
|
4964
|
+
license: string;
|
|
4965
|
+
/** Where the publisher got the upstream's files, and their digest. */
|
|
4966
|
+
obtained?: {
|
|
4967
|
+
url: string;
|
|
4968
|
+
sha256?: string;
|
|
4969
|
+
};
|
|
4970
|
+
patchedBy?: string;
|
|
4971
|
+
trademarkPolicy?: string;
|
|
4972
|
+
}[];
|
|
4973
|
+
/**
|
|
4974
|
+
* Bundle-relative path of the notices file (licences, attributions, 'Not affiliated with ...'). It must be a file of the pack bundle.
|
|
4975
|
+
*/
|
|
4976
|
+
notices?: string;
|
|
4977
|
+
/**
|
|
4978
|
+
* Reserved: a command run once when the node prepares the tool's snapshot (later). Refused in this version.
|
|
4979
|
+
*/
|
|
4980
|
+
setup?: unknown;
|
|
4981
|
+
/** Reserved: an imported image's artifact (later). Refused in this version. */
|
|
4982
|
+
image?: unknown;
|
|
4983
|
+
/** Reserved: output formats a takedown can turn off by name (later). Refused in this version. */
|
|
4984
|
+
formats?: unknown;
|
|
4985
|
+
/** Reserved: the tool's own error codes, as an enum (later). Refused in this version. */
|
|
4986
|
+
errors?: unknown;
|
|
4987
|
+
}
|
|
4988
|
+
/**
|
|
4989
|
+
* One archive of the tool's files, named by its sha256, uploaded to the registry's blob store before the pack is published, and unpacked at /tool before each call. The publish checks cap it at 64 MiB packed (bytes 67108864), 512 MiB unpacked (unpackedBytes 536870912) and 20,000 entries.
|
|
4990
|
+
*/
|
|
4991
|
+
export interface B3PackToolArchive {
|
|
4992
|
+
/** Lowercase hex sha256 of the archive's bytes. */
|
|
4993
|
+
sha256: string;
|
|
4994
|
+
/** The archive's size in bytes. */
|
|
4995
|
+
bytes: number;
|
|
4996
|
+
format: "tar.gz" | "tar";
|
|
4997
|
+
/** The sum of the sizes of the archive's regular files. */
|
|
4998
|
+
unpackedBytes: number;
|
|
4999
|
+
/** Files, directories and links in the archive. */
|
|
5000
|
+
entries: number;
|
|
5001
|
+
}
|
|
4843
5002
|
/**
|
|
4844
5003
|
* Publisher signature written by the publish tool and repeated in the registry record. contentHash covers the whole bundle with this member removed (README, 'Pack content hash and signature'). sig is Ed25519 over the UTF-8 bytes of 'b3pack-sig-v1\n<pack>\n<version>\n<contentHash>'. Nodes verify contentHash and sig against the registry record and the publisher's registered key before loading (ARCHITECTURE 5.5).
|
|
4845
5004
|
*/
|
|
@@ -5014,6 +5173,23 @@ export interface ActionDescription {
|
|
|
5014
5173
|
* when the node loads the pack. Their inputs also appear as `examples` in `mcp.inputSchema`.
|
|
5015
5174
|
*/
|
|
5016
5175
|
examples: ActionExample[];
|
|
5176
|
+
/**
|
|
5177
|
+
* For a hosted tool's action (`impl.kind` `vm`), what it runs on and what it costs; absent for other actions.
|
|
5178
|
+
*/
|
|
5179
|
+
tool?: {
|
|
5180
|
+
kind: "cli";
|
|
5181
|
+
/** The template its VM is made from. */
|
|
5182
|
+
base: string;
|
|
5183
|
+
network: "none";
|
|
5184
|
+
/**
|
|
5185
|
+
* The publisher's price per call that answered validly, in micro-USD (millionths of a US dollar); 0 when free.
|
|
5186
|
+
*/
|
|
5187
|
+
price_micro_usd: number;
|
|
5188
|
+
/** The software the tool runs and did not write (the manifest's `tool.upstream`). */
|
|
5189
|
+
upstream: Record<string, unknown>[];
|
|
5190
|
+
/** The bundle path of the tool's notices file. */
|
|
5191
|
+
notices?: string;
|
|
5192
|
+
};
|
|
5017
5193
|
}
|
|
5018
5194
|
export interface ActionCallRequest {
|
|
5019
5195
|
ref: ActionRef;
|
|
@@ -5034,12 +5210,29 @@ export interface ActionResult {
|
|
|
5034
5210
|
object: "action_result";
|
|
5035
5211
|
/** The exact version that ran. */
|
|
5036
5212
|
ref: string;
|
|
5037
|
-
/** Matches the action's output schema. */
|
|
5213
|
+
/** Matches the action's output schema. A hosted tool's output file is a `ToolFileOutput`. */
|
|
5038
5214
|
output: unknown;
|
|
5039
5215
|
/** HTTP status of the upstream call, for declarative HTTP actions. */
|
|
5040
5216
|
upstream_status?: number;
|
|
5217
|
+
/**
|
|
5218
|
+
* `vm` for a hosted tool's call (its command ran in a microVM made for the call). Absent for other actions.
|
|
5219
|
+
*/
|
|
5220
|
+
tier?: "vm";
|
|
5221
|
+
cost?: ToolCallCost;
|
|
5041
5222
|
timing: Timing;
|
|
5042
5223
|
}
|
|
5224
|
+
/**
|
|
5225
|
+
* What a hosted tool's call costs, in micro-USD (millionths of a US dollar), from the node's unit prices when
|
|
5226
|
+
* the call ran: `compute` (`actions.vcpu_ms` and `actions.gib_ms`), `floor` (`actions.tool_call`), `price` (the
|
|
5227
|
+
* publisher's, `actions.publisher_microusd`; 0 when the tool failed or is free) and their sum, `total`. The
|
|
5228
|
+
* same numbers are in the `actions.tool_call` usage record's `meta.cost_micro_usd`.
|
|
5229
|
+
*/
|
|
5230
|
+
export interface ToolCallCost {
|
|
5231
|
+
compute: number;
|
|
5232
|
+
floor: number;
|
|
5233
|
+
price: number;
|
|
5234
|
+
total: number;
|
|
5235
|
+
}
|
|
5043
5236
|
export interface TriggerSummary {
|
|
5044
5237
|
ref: string;
|
|
5045
5238
|
pack: string;
|
|
@@ -6185,6 +6378,17 @@ export interface RegistryPackVersion {
|
|
|
6185
6378
|
published_at: string;
|
|
6186
6379
|
yanked: boolean;
|
|
6187
6380
|
download_url: string;
|
|
6381
|
+
/**
|
|
6382
|
+
* The API key (`key_...`) or dashboard user (`usr_...`) that published the version, shown to the namespace's owner and to B3's organizations; `null` for any other reader, a node, and versions published before it was recorded.
|
|
6383
|
+
*/
|
|
6384
|
+
published_by?: string | null;
|
|
6385
|
+
}
|
|
6386
|
+
/** A hosted tool's archive in the registry's blob store, named by its sha256. */
|
|
6387
|
+
export interface RegistryBlob {
|
|
6388
|
+
object: "registry_blob";
|
|
6389
|
+
digest: string;
|
|
6390
|
+
bytes: number;
|
|
6391
|
+
created_at: string;
|
|
6188
6392
|
}
|
|
6189
6393
|
/**
|
|
6190
6394
|
* How the request reached B3OS: `edge` (through beta-api.b3os.org or the dashboard; forwarded to the node, or
|
|
@@ -6196,10 +6400,12 @@ export type RequestConnection = "edge" | "uds" | "tcp" | "sandbox";
|
|
|
6196
6400
|
* Who made the request: `api_key` (an API key), `cli_token` (the CLI's device-login token), `dashboard` (a
|
|
6197
6401
|
* signed-in dashboard session; its successful reads are not logged, its changes and errors are), `sandbox` (code
|
|
6198
6402
|
* inside a sandbox, as its creating key), `routine` (a routine run, as the key that published its version),
|
|
6199
|
-
* `local` (a host-local caller on the node's Unix socket)
|
|
6200
|
-
* callback to a public route, or a request refused before authentication)
|
|
6403
|
+
* `local` (a host-local caller on the node's Unix socket), `public` (no credential: a webhook or signed
|
|
6404
|
+
* callback to a public route, or a request refused before authentication), `address` (a visitor of an app
|
|
6405
|
+
* address, `<label>.b3os.io`) or `preview` (a visitor of a sandbox port preview). `address` and `preview`
|
|
6406
|
+
* records belong to the sandbox's project; their `path` is the app's path, without the query, cut at 1,024 bytes.
|
|
6201
6407
|
*/
|
|
6202
|
-
export type RequestSource = "api_key" | "cli_token" | "dashboard" | "sandbox" | "routine" | "local" | "public";
|
|
6408
|
+
export type RequestSource = "api_key" | "cli_token" | "dashboard" | "sandbox" | "routine" | "local" | "public" | "address" | "preview";
|
|
6203
6409
|
export interface RequestPhase {
|
|
6204
6410
|
name: string;
|
|
6205
6411
|
source: "edge" | "node";
|
|
@@ -127,7 +127,21 @@ export interface SandboxExecOptions extends RequestOptions {
|
|
|
127
127
|
/** Kill the command after this long (default 30 s; at most 60 s unless streamed). */
|
|
128
128
|
commandTimeoutMs?: number;
|
|
129
129
|
user?: "user" | "root";
|
|
130
|
+
/**
|
|
131
|
+
* What the result keeps of each stream, in UTF-8 bytes, never part of a character (default
|
|
132
|
+
* {@link DEFAULT_MAX_OUTPUT_BYTES}, 16 MiB; `Infinity` keeps everything, and `null` is refused). Past it a streamed
|
|
133
|
+
* call stops keeping output as it arrives while the command runs on and `onStdout`/`onStderr` still get every
|
|
134
|
+
* chunk; a buffered call gets at most the node's 1 MiB, and a smaller cap trims it here. Either way
|
|
135
|
+
* `stdoutTruncated` / `stderrTruncated` say so.
|
|
136
|
+
*/
|
|
137
|
+
maxOutputBytes?: number;
|
|
130
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* What `Sandbox.exec` keeps of each output stream by default: 16 MiB of stdout and 16 MiB of stderr (UTF-8 bytes).
|
|
141
|
+
* A streamed command may run for an hour, and keeping all of a chatty one (`yes`, a verbose build) would fill the
|
|
142
|
+
* caller's memory; `maxOutputBytes: Infinity` keeps everything.
|
|
143
|
+
*/
|
|
144
|
+
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
131
145
|
/** A finished command. */
|
|
132
146
|
export interface SandboxExecOutput {
|
|
133
147
|
/** The exit status; `null` when a signal killed it. */
|
|
@@ -137,6 +151,13 @@ export interface SandboxExecOutput {
|
|
|
137
151
|
stdout: string;
|
|
138
152
|
stderr: string;
|
|
139
153
|
durationMs: number | null;
|
|
154
|
+
/**
|
|
155
|
+
* True when `stdout` is not all the command wrote: the node keeps at most 1 MiB of each stream on a buffered call,
|
|
156
|
+
* and `maxOutputBytes` caps what the SDK keeps on either path (a streamed call's callbacks still get every chunk).
|
|
157
|
+
*/
|
|
158
|
+
stdoutTruncated: boolean;
|
|
159
|
+
/** The same for stderr. */
|
|
160
|
+
stderrTruncated: boolean;
|
|
140
161
|
}
|
|
141
162
|
/** Files inside the sandbox (`/v1/sandboxes/{id}/files`, `files/stat`, `files/move`, `files/mkdir`). */
|
|
142
163
|
export interface SandboxFiles {
|
|
@@ -206,8 +227,11 @@ export declare class Sandbox implements AsyncDisposable {
|
|
|
206
227
|
/** A handle for an existing sandbox (`GET /v1/sandboxes/{id}`). */
|
|
207
228
|
static connect(client: SandboxClient, sandboxId: string, options?: RequestOptions): Promise<Sandbox>;
|
|
208
229
|
/**
|
|
209
|
-
* Run a command and wait for it. With `onStdout` or `onStderr` the output streams to them as it arrives;
|
|
210
|
-
*
|
|
230
|
+
* Run a command and wait for it. With `onStdout` or `onStderr` the output streams to them as it arrives; the
|
|
231
|
+
* result keeps up to `maxOutputBytes` of each stream (16 MiB by default). A string runs through `/bin/sh -c`, an
|
|
232
|
+
* array is executed directly. An error from a streamed call (`stream_interrupted`, `stream_ended`, `timeout`, a
|
|
233
|
+
* cut the node reports in `exec.exit`, `aborted` once the answer began) carries the call's `requestId`, as an
|
|
234
|
+
* error answer does.
|
|
211
235
|
*/
|
|
212
236
|
exec(cmd: string | readonly string[], options?: SandboxExecOptions): Promise<SandboxExecOutput>;
|
|
213
237
|
/** Start a background process (a server, a worker); read its output with `logs`. */
|