@b3os/sdk 0.1.0 → 0.1.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 +171 -42
- package/dist/cjs/core/bytes.d.ts +30 -0
- package/dist/cjs/core/bytes.js +115 -0
- package/dist/cjs/core/bytes.js.map +1 -0
- package/dist/cjs/core/client.d.ts +61 -3
- package/dist/cjs/core/client.js +211 -33
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/core/errors.d.ts +16 -4
- package/dist/cjs/core/errors.js +9 -6
- package/dist/cjs/core/errors.js.map +1 -1
- package/dist/cjs/core/handle.d.ts +31 -0
- package/dist/cjs/core/handle.js +86 -0
- package/dist/cjs/core/handle.js.map +1 -0
- package/dist/cjs/core/index.d.ts +6 -4
- package/dist/cjs/core/index.js +8 -1
- package/dist/cjs/core/index.js.map +1 -1
- package/dist/cjs/core/login.d.ts +24 -0
- package/dist/cjs/core/login.js +93 -0
- package/dist/cjs/core/login.js.map +1 -0
- package/dist/cjs/core/namespace.d.ts +1 -1
- package/dist/cjs/core/namespace.js +1 -1
- package/dist/cjs/core/op.d.ts +11 -1
- package/dist/cjs/core/timing.d.ts +1 -1
- package/dist/cjs/core/timing.js +8 -1
- package/dist/cjs/core/timing.js.map +1 -1
- package/dist/cjs/core/transport.js +1 -1
- package/dist/cjs/core/transport.js.map +1 -1
- package/dist/cjs/core/util.d.ts +15 -3
- package/dist/cjs/core/util.js +54 -2
- package/dist/cjs/core/util.js.map +1 -1
- package/dist/cjs/core/ws.d.ts +4 -0
- package/dist/cjs/core/ws.js +7 -4
- package/dist/cjs/core/ws.js.map +1 -1
- package/dist/cjs/generated/client.d.ts +2 -2
- package/dist/cjs/generated/client.js +2 -2
- package/dist/cjs/generated/errors.d.ts +1 -1
- package/dist/cjs/generated/errors.js +30 -0
- package/dist/cjs/generated/errors.js.map +1 -1
- package/dist/cjs/generated/jobs.js +1 -1
- package/dist/cjs/generated/ns/actions.d.ts +48 -6
- package/dist/cjs/generated/ns/actions.js +59 -6
- package/dist/cjs/generated/ns/actions.js.map +1 -1
- package/dist/cjs/generated/ns/infer.d.ts +185 -54
- package/dist/cjs/generated/ns/infer.js +28 -74
- package/dist/cjs/generated/ns/infer.js.map +1 -1
- package/dist/cjs/generated/ns/keys.d.ts +12 -0
- package/dist/cjs/generated/ns/keys.js +22 -0
- package/dist/cjs/generated/ns/keys.js.map +1 -1
- package/dist/cjs/generated/ns/render.d.ts +95 -6
- package/dist/cjs/generated/ns/render.js +124 -7
- package/dist/cjs/generated/ns/render.js.map +1 -1
- package/dist/cjs/generated/ns/requests.d.ts +3 -1
- package/dist/cjs/generated/ns/requests.js +3 -1
- package/dist/cjs/generated/ns/requests.js.map +1 -1
- package/dist/cjs/generated/ns/routines.d.ts +131 -9
- package/dist/cjs/generated/ns/routines.js +186 -9
- package/dist/cjs/generated/ns/routines.js.map +1 -1
- package/dist/cjs/generated/ns/sandboxes.d.ts +298 -31
- package/dist/cjs/generated/ns/sandboxes.js +368 -29
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
- package/dist/cjs/generated/ns/vision.d.ts +133 -14
- package/dist/cjs/generated/ns/vision.js +158 -12
- package/dist/cjs/generated/ns/vision.js.map +1 -1
- package/dist/cjs/generated/ns/webhooks.d.ts +8 -5
- package/dist/cjs/generated/ns/webhooks.js +8 -5
- package/dist/cjs/generated/ns/webhooks.js.map +1 -1
- package/dist/cjs/generated/types.d.ts +1956 -301
- package/dist/cjs/helpers/agents.d.ts +95 -0
- package/dist/cjs/helpers/agents.js +205 -0
- package/dist/cjs/helpers/agents.js.map +1 -0
- package/dist/cjs/helpers/render.d.ts +15 -0
- package/dist/cjs/helpers/render.js +74 -0
- package/dist/cjs/helpers/render.js.map +1 -0
- package/dist/cjs/helpers/routines.d.ts +61 -0
- package/dist/cjs/helpers/routines.js +234 -0
- package/dist/cjs/helpers/routines.js.map +1 -0
- package/dist/cjs/helpers/sandboxes.d.ts +237 -0
- package/dist/cjs/helpers/sandboxes.js +608 -0
- package/dist/cjs/helpers/sandboxes.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -1
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/routines.d.ts +1 -0
- package/dist/cjs/routines.js +21 -0
- package/dist/cjs/routines.js.map +1 -0
- package/dist/cjs/webhooks.js.map +1 -1
- package/dist/esm/core/bytes.d.ts +30 -0
- package/dist/esm/core/bytes.js +111 -0
- package/dist/esm/core/bytes.js.map +1 -0
- package/dist/esm/core/client.d.ts +61 -3
- package/dist/esm/core/client.js +208 -31
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/core/errors.d.ts +16 -4
- package/dist/esm/core/errors.js +9 -6
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/handle.d.ts +31 -0
- package/dist/esm/core/handle.js +82 -0
- package/dist/esm/core/handle.js.map +1 -0
- package/dist/esm/core/index.d.ts +6 -4
- package/dist/esm/core/index.js +4 -2
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/core/login.d.ts +24 -0
- package/dist/esm/core/login.js +85 -0
- package/dist/esm/core/login.js.map +1 -0
- package/dist/esm/core/namespace.d.ts +1 -1
- package/dist/esm/core/namespace.js +1 -1
- package/dist/esm/core/op.d.ts +11 -1
- package/dist/esm/core/timing.d.ts +1 -1
- package/dist/esm/core/timing.js +8 -1
- package/dist/esm/core/timing.js.map +1 -1
- package/dist/esm/core/transport.js +1 -1
- package/dist/esm/core/transport.js.map +1 -1
- package/dist/esm/core/util.d.ts +15 -3
- package/dist/esm/core/util.js +48 -1
- package/dist/esm/core/util.js.map +1 -1
- package/dist/esm/core/ws.d.ts +4 -0
- package/dist/esm/core/ws.js +7 -4
- package/dist/esm/core/ws.js.map +1 -1
- package/dist/esm/generated/client.d.ts +2 -2
- package/dist/esm/generated/client.js +2 -2
- package/dist/esm/generated/errors.d.ts +1 -1
- package/dist/esm/generated/errors.js +30 -0
- package/dist/esm/generated/errors.js.map +1 -1
- package/dist/esm/generated/jobs.js +1 -1
- package/dist/esm/generated/ns/actions.d.ts +48 -6
- package/dist/esm/generated/ns/actions.js +59 -6
- package/dist/esm/generated/ns/actions.js.map +1 -1
- package/dist/esm/generated/ns/infer.d.ts +185 -54
- package/dist/esm/generated/ns/infer.js +28 -74
- package/dist/esm/generated/ns/infer.js.map +1 -1
- package/dist/esm/generated/ns/keys.d.ts +12 -0
- package/dist/esm/generated/ns/keys.js +22 -0
- package/dist/esm/generated/ns/keys.js.map +1 -1
- package/dist/esm/generated/ns/render.d.ts +95 -6
- package/dist/esm/generated/ns/render.js +124 -7
- package/dist/esm/generated/ns/render.js.map +1 -1
- package/dist/esm/generated/ns/requests.d.ts +3 -1
- package/dist/esm/generated/ns/requests.js +3 -1
- package/dist/esm/generated/ns/requests.js.map +1 -1
- package/dist/esm/generated/ns/routines.d.ts +131 -9
- package/dist/esm/generated/ns/routines.js +186 -9
- package/dist/esm/generated/ns/routines.js.map +1 -1
- package/dist/esm/generated/ns/sandboxes.d.ts +298 -31
- package/dist/esm/generated/ns/sandboxes.js +368 -29
- package/dist/esm/generated/ns/sandboxes.js.map +1 -1
- package/dist/esm/generated/ns/vision.d.ts +133 -14
- package/dist/esm/generated/ns/vision.js +158 -12
- package/dist/esm/generated/ns/vision.js.map +1 -1
- package/dist/esm/generated/ns/webhooks.d.ts +8 -5
- package/dist/esm/generated/ns/webhooks.js +8 -5
- package/dist/esm/generated/ns/webhooks.js.map +1 -1
- package/dist/esm/generated/types.d.ts +1956 -301
- package/dist/esm/helpers/agents.d.ts +95 -0
- package/dist/esm/helpers/agents.js +199 -0
- package/dist/esm/helpers/agents.js.map +1 -0
- package/dist/esm/helpers/render.d.ts +15 -0
- package/dist/esm/helpers/render.js +70 -0
- package/dist/esm/helpers/render.js.map +1 -0
- package/dist/esm/helpers/routines.d.ts +61 -0
- package/dist/esm/helpers/routines.js +226 -0
- package/dist/esm/helpers/routines.js.map +1 -0
- package/dist/esm/helpers/sandboxes.d.ts +237 -0
- package/dist/esm/helpers/sandboxes.js +600 -0
- package/dist/esm/helpers/sandboxes.js.map +1 -0
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.js +6 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routines.d.ts +1 -0
- package/dist/esm/routines.js +5 -0
- package/dist/esm/routines.js.map +1 -0
- package/dist/esm/webhooks.js.map +1 -1
- package/package.json +14 -3
- package/src/core/bytes.ts +112 -0
- package/src/core/client.ts +253 -33
- package/src/core/errors.ts +27 -10
- package/src/core/handle.ts +97 -0
- package/src/core/index.ts +7 -2
- package/src/core/login.ts +98 -0
- package/src/core/namespace.ts +1 -1
- package/src/core/op.ts +11 -1
- package/src/core/timing.ts +7 -2
- package/src/core/transport.ts +1 -1
- package/src/core/util.ts +53 -3
- package/src/core/ws.ts +11 -4
- package/src/generated/client.ts +2 -2
- package/src/generated/errors.ts +60 -0
- package/src/generated/jobs.ts +1 -1
- package/src/generated/ns/actions.ts +69 -6
- package/src/generated/ns/infer.ts +229 -61
- package/src/generated/ns/keys.ts +23 -0
- package/src/generated/ns/render.ts +152 -7
- package/src/generated/ns/requests.ts +3 -1
- package/src/generated/ns/routines.ts +205 -9
- package/src/generated/ns/sandboxes.ts +434 -34
- package/src/generated/ns/vision.ts +168 -14
- package/src/generated/ns/webhooks.ts +8 -5
- package/src/generated/types.ts +2211 -422
- package/src/helpers/agents.ts +300 -0
- package/src/helpers/render.ts +91 -0
- package/src/helpers/routines.ts +278 -0
- package/src/helpers/sandboxes.ts +788 -0
- package/src/index.ts +29 -5
- package/src/routines.ts +5 -0
- package/src/webhooks.ts +5 -1
package/src/generated/types.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type Scope =
|
|
|
18
18
|
| "vision:read"
|
|
19
19
|
| "vision:write"
|
|
20
20
|
| "vision:run"
|
|
21
|
+
| "vision:profiles:use"
|
|
22
|
+
| "vision:profiles:export"
|
|
21
23
|
| "render:read"
|
|
22
24
|
| "render:write"
|
|
23
25
|
| "render:run"
|
|
@@ -58,6 +60,17 @@ export interface Timing {
|
|
|
58
60
|
[key: string]: unknown;
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
/**
|
|
64
|
+
* What kind of page the scrape returned (the page your `actions` left, when there are any), from heuristics on the HTML, the status and the amount of text (no model call): `ok` (the page), `blocked` (a bot-management interstitial or refusal), `captcha` (a challenge for a person), `cookie_wall` (consent before content), `login` (a sign-in form instead of content), `error` (an error status, or a 200 whose title says the page is missing) or `loading` (an unfinished shell). `blocked` and `captcha` are walls, and when the signals are unclear the state is `ok`, since a wall's content is withheld. A wall has little text (under about 2,500 bytes of visible text, counted outside the head whether or not the document has a `<body>` tag, and under 2,000 bytes of Markdown of the default main content, whatever `include_tags`, `exclude_tags` or `only_main_content` ask for) and either a 403 or 429 status or an interstitial signal: a challenge or refusal title (whole words, such as "Just a moment" or "Access denied"), a resource only a vendor's challenge loads (such as Cloudflare's `/cdn-cgi/challenge-platform/.../orchestrate/` or DataDome's `captcha-delivery.com`), an element only a vendor's challenge or block page has (Cloudflare's `cf-error-details` only with a 403 or 429 status or its "you have been blocked" headline: its 5xx origin-error pages, 520 to 526, use the same template and are `error`), or a CAPTCHA widget (`g-recaptcha`, `h-captcha`, `cf-turnstile`, or a rendered Turnstile widget's frame) on a page without a form field to fill in. Scripts that sites load on every page are not signals (reCAPTCHA v3, Cloudflare's JavaScript detections, PerimeterX, Kasada or Imperva loaders), so a small page that carries one is `ok`; vendor names count only in markup (classes, ids, resource URLs, inline scripts, comments), never in visible text; and a body that is not HTML (JSON, text) is judged by its status alone. Without an error status a wall is also small, at most 16 KiB of markup: a thin page with more keeps its content in scripts (a single-page app's inline state) and is not a wall. A marker or refusal word that the requested or final URL also carries (percent-decoded, in any case, a slug's words included) does not count: a page that echoes its own address, such as a search page with the query in its title or a tag page titled after its slug, is not refusing it. The markup judged is the document as served or, in a browser, the whole DOM with its scripts when the page shows fewer than 6,000 characters of text (counted in the DOM itself, the same whatever `formats` asks for); a page that shows more is judged by that text, and no rule that reads markup applies to it. So `formats` does not change the state, and neither does which copy of a page the cache holds for the same tier; a `cache_only` scrape with `engine: "auto"` reads whichever tier's copy is cached, and the fetch tier and the browser can judge the same page differently. A page whose content is visible text is not a wall, whatever its status or markers: with a consent banner or a CAPTCHA widget it is `ok`, answered with 403 or 429 it is `error`. A thin page that keeps its content in scripts and is answered with 403 or 429 is a wall, so its content is withheld unless `walls: "bill"`. Your own `actions` can make a wall (an `evaluate` step that empties the page), and the state then says so. A wall is free (no `vision.page`, not counted against the allowance; Firecrawl's `creditsUsed` is 0) and its content withheld (`content_withheld`), unless the request sets `walls: "bill"` or runs `actions`, which bill like any page. The other states are billed: they are the site's answer.
|
|
65
|
+
*/
|
|
66
|
+
export interface PageState {
|
|
67
|
+
state: "ok" | "blocked" | "captcha" | "cookie_wall" | "login" | "error" | "loading";
|
|
68
|
+
/**
|
|
69
|
+
* What decided it, such as `cloudflare_challenge`, `recaptcha`, `onetrust`, `password_form`, `status`, `title` or `empty_spa_root`.
|
|
70
|
+
*/
|
|
71
|
+
signal?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
/** One validation problem. */
|
|
62
75
|
export interface ProblemItem {
|
|
63
76
|
/**
|
|
@@ -126,6 +139,16 @@ export interface Problem {
|
|
|
126
139
|
message: string;
|
|
127
140
|
retryable: boolean;
|
|
128
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* The option a request value was refused for, by its id (`option_not_allowed`), e.g. `sandboxes.clone_reset`.
|
|
144
|
+
*/
|
|
145
|
+
option?: string;
|
|
146
|
+
/** The value the request asked for (`option_not_allowed`). */
|
|
147
|
+
value?: unknown;
|
|
148
|
+
/** The values the request may ask for (`option_not_allowed`, an option with a closed list of values). */
|
|
149
|
+
allowed?: unknown[];
|
|
150
|
+
/** What set the bound a refused value is outside (`option_not_allowed`); `node` is the node's policy. */
|
|
151
|
+
bound_by?: "node" | "org" | "flag" | "limit";
|
|
129
152
|
[key: string]: unknown;
|
|
130
153
|
}
|
|
131
154
|
|
|
@@ -329,12 +352,23 @@ export interface StreamTicket {
|
|
|
329
352
|
export type ScrapeFormat = "markdown" | "html" | "raw_html" | "text" | "links" | "metadata" | "screenshot" | "json";
|
|
330
353
|
|
|
331
354
|
/**
|
|
332
|
-
* Which tier may serve the page. `auto` (default): cache, then HTTP fetch, then a browser when the
|
|
333
|
-
*
|
|
334
|
-
* `screenshot` and profiles; implied by them).
|
|
355
|
+
* Which tier may serve the page. `auto` (default): cache, then HTTP fetch, then a browser when the fetch may not
|
|
356
|
+
* be enough. `fetch`: never start a browser. `browser`: always render in Chrome (needed for `actions`,
|
|
357
|
+
* `screenshot` and profiles; implied by them). With `auto`, a browser runs when the page needs JavaScript, when
|
|
358
|
+
* the fetch came back thin or mostly script, and when the fetch failed in a way a browser may not.
|
|
335
359
|
*/
|
|
336
360
|
export type ScrapeEngine = "auto" | "fetch" | "browser";
|
|
337
361
|
|
|
362
|
+
/**
|
|
363
|
+
* Which browser renders the page: `chrome` (full Chrome in its new headless mode) or `headless-shell`
|
|
364
|
+
* (chrome-headless-shell, which starts faster and uses less memory but has no `window.chrome` and no
|
|
365
|
+
* plugins). Both run the same launch profile: a current Chrome user agent without `HeadlessChrome`,
|
|
366
|
+
* `navigator.webdriver` false, and the time zone and locale of the node's egress location unless the
|
|
367
|
+
* request sets them. Sessions and pages in a browser of their own have WebGL on SwiftShader; pages in the
|
|
368
|
+
* shared scrape pool, whose browsers serve several organizations at once, have no WebGL.
|
|
369
|
+
*/
|
|
370
|
+
export type BrowserEngine = "chrome" | "headless-shell";
|
|
371
|
+
|
|
338
372
|
/** Options for the `screenshot` format. */
|
|
339
373
|
export interface ScreenshotOptions {
|
|
340
374
|
/** @default false */
|
|
@@ -370,39 +404,59 @@ export interface ScrapeOptions {
|
|
|
370
404
|
/** CSS selectors to drop. */
|
|
371
405
|
exclude_tags?: string[];
|
|
372
406
|
engine?: ScrapeEngine;
|
|
407
|
+
/**
|
|
408
|
+
* Which browser renders the page when the browser tier runs (`engine: browser`, or an `auto` scrape that renders); not allowed with `engine: fetch`. The scrape pool runs `headless-shell`. `chrome` renders in a browser of its own, which counts toward `vision.sessions.concurrent` while it runs, as a scrape with a `profile` does.
|
|
409
|
+
* @default "headless-shell"
|
|
410
|
+
*/
|
|
411
|
+
browser?: BrowserEngine;
|
|
373
412
|
/**
|
|
374
413
|
* Extra wait after the page is ready, before capture.
|
|
375
414
|
* @default 0
|
|
376
415
|
*/
|
|
377
416
|
wait_for_ms?: number;
|
|
378
|
-
/**
|
|
417
|
+
/**
|
|
418
|
+
* Time for the whole scrape, `wait_for_ms` and a browser render included. A scrape that runs out answers `504 scrape_timeout` and is not billed. In a batch or crawl, each page gets this long.
|
|
419
|
+
* @default 30000
|
|
420
|
+
*/
|
|
379
421
|
timeout_ms?: number;
|
|
380
422
|
/**
|
|
381
423
|
* Accept a cached copy up to this old (default 2 days). `0` always fetches.
|
|
382
424
|
* @default 172800000
|
|
383
425
|
*/
|
|
384
426
|
max_age_ms?: number;
|
|
427
|
+
/**
|
|
428
|
+
* Answer from the page cache only, with no outbound request at all (with `respect_robots`, only a robots.txt this node already holds is checked): a cached copy (within `max_age_ms` when it is given) or `404 scrape_no_cached_data`, which is not billed. Cannot be combined with `headers`, `profile`, `actions` or a screenshot, which never use the cache. The share of pages the cache serves is the `b3os_vision_cache_served_ratio` metric.
|
|
429
|
+
* @default false
|
|
430
|
+
*/
|
|
431
|
+
cache_only?: boolean;
|
|
385
432
|
/**
|
|
386
433
|
* Store the result in the cache. Requests with headers, a profile or actions are never shared across organizations.
|
|
387
434
|
* @default true
|
|
388
435
|
*/
|
|
389
436
|
store_in_cache?: boolean;
|
|
390
437
|
/**
|
|
391
|
-
*
|
|
438
|
+
* Check the site's robots.txt (RFC 9309, product token `B3OSBot`) and Content Signals before fetching: a URL they disallow (or `ai-input=no`) answers `403 robots_disallowed`, which is not billed. Off by default: vision does not consult robots.txt unless asked. In a crawl's `scrape` options it means the same as the crawl's own `respect_robots`.
|
|
439
|
+
* @default false
|
|
440
|
+
*/
|
|
441
|
+
respect_robots?: boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Extra request headers, sent only to the target URL's origin (scheme, host and port): in a browser to the page and its same-origin subresources and fetches, never to the other hosts the page loads from, and on both tiers never along a redirect to another origin. A header you set replaces the browser's header of the same name (one value is sent, yours). A request with custom headers bypasses the cache. In a browser, a `Cookie` header becomes cookies for the page's host (path `/`), so it reaches the origin as on an HTTP fetch.
|
|
392
444
|
*/
|
|
393
445
|
headers?: Record<string, string>;
|
|
394
446
|
/**
|
|
395
|
-
* A profile ID or name to load cookies and storage from. Implies `engine: browser`. The page renders in a browser of its own (never one shared with other organizations), which counts toward `vision.sessions.concurrent` while it runs.
|
|
447
|
+
* A profile ID or name to load cookies and storage from. Implies `engine: browser`. The page renders in a browser of its own (never one shared with other organizations), which counts toward `vision.sessions.concurrent` while it runs: a single scrape answers 429 when no slot is free, a batch or crawl page waits for one. Not served (503 `product_unavailable`) on a node whose Chrome runs without its own sandbox.
|
|
396
448
|
*/
|
|
397
449
|
profile?: string;
|
|
398
450
|
/** Browser actions to run before capture. Implies `engine: browser`. */
|
|
399
451
|
actions?: ActStep[];
|
|
400
452
|
/**
|
|
401
|
-
* BCP 47 locale for `Accept-Language` and the browser.
|
|
453
|
+
* BCP 47 locale for `Accept-Language` and the browser. Defaults to the locale of the node's egress location (`en-US` on every node today).
|
|
402
454
|
* @default "en-US"
|
|
403
455
|
*/
|
|
404
456
|
locale?: string;
|
|
405
|
-
/**
|
|
457
|
+
/**
|
|
458
|
+
* IANA time zone for the browser, such as `Europe/Berlin`. Defaults to the time zone of the node's egress location (`America/Los_Angeles` on every node today).
|
|
459
|
+
*/
|
|
406
460
|
timezone?: string;
|
|
407
461
|
/**
|
|
408
462
|
* Emulate a phone (viewport, user agent, touch).
|
|
@@ -421,6 +475,11 @@ export interface ScrapeOptions {
|
|
|
421
475
|
block_resources?: Array<"image" | "media" | "font" | "stylesheet">;
|
|
422
476
|
screenshot?: ScreenshotOptions;
|
|
423
477
|
json?: JsonExtractOptions;
|
|
478
|
+
/**
|
|
479
|
+
* What a wall (`page_state` `blocked` or `captcha`) costs. `free`: no `vision.page`, and the result carries no page content, only `page_state`, `status_code`, `final_url` and `content_withheld: true`. `bill`: the wall bills like any page and its content is returned. A scrape with `actions` bills either way.
|
|
480
|
+
* @default "free"
|
|
481
|
+
*/
|
|
482
|
+
walls?: "free" | "bill";
|
|
424
483
|
}
|
|
425
484
|
|
|
426
485
|
/** A URL plus scrape options. */
|
|
@@ -464,9 +523,13 @@ export interface ScrapeResult {
|
|
|
464
523
|
object: "scrape";
|
|
465
524
|
/** The requested URL. */
|
|
466
525
|
url: string;
|
|
467
|
-
/**
|
|
526
|
+
/**
|
|
527
|
+
* The URL of the page the answer was read from: the URL after redirects or, for a page the browser rendered, the page the browser read. When a script moved the browser to another host or path after the load, or changed the address to another path with `history.pushState` or `replaceState`, it is that address. A change of query or fragment alone after the load leaves it at the URL after redirects.
|
|
528
|
+
*/
|
|
468
529
|
final_url: string;
|
|
469
|
-
/**
|
|
530
|
+
/**
|
|
531
|
+
* The HTTP status the site returned. A 404 page is still a successful scrape. For a page the browser rendered, it is the status the browser got when it loaded the page, so after a script moved the browser to another page (see `final_url`) it can be the status of the page before the move.
|
|
532
|
+
*/
|
|
470
533
|
status_code: number;
|
|
471
534
|
content_type?: string;
|
|
472
535
|
/** What served the page. */
|
|
@@ -483,11 +546,34 @@ export interface ScrapeResult {
|
|
|
483
546
|
metadata?: PageMetadata;
|
|
484
547
|
/** Results of `actions`, in order. */
|
|
485
548
|
actions?: ActStepResult[];
|
|
549
|
+
page_state?: PageState;
|
|
550
|
+
/**
|
|
551
|
+
* Present (`true`) when the page is a wall and the scrape was free (`walls: free`): the result then has no `markdown`, `html`, `raw_html`, `text`, `links`, `metadata`, `screenshot`, `json`, `actions` or `content_type`, only the state, `status_code` and `final_url`.
|
|
552
|
+
*/
|
|
553
|
+
content_withheld?: boolean;
|
|
486
554
|
/** Non-fatal problems, such as a format that could not be produced. */
|
|
487
555
|
warnings: string[];
|
|
488
556
|
timing: Timing;
|
|
489
557
|
}
|
|
490
558
|
|
|
559
|
+
export interface PrepareRequest {
|
|
560
|
+
/** The page a coming scrape will fetch. */
|
|
561
|
+
url: string;
|
|
562
|
+
/**
|
|
563
|
+
* Fetch and cache the origin's robots.txt and say whether it allows `url` (the scrape itself checks only when it sets `respect_robots`).
|
|
564
|
+
* @default false
|
|
565
|
+
*/
|
|
566
|
+
respect_robots?: boolean;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export interface PrepareResult {
|
|
570
|
+
object: "prepare";
|
|
571
|
+
url: string;
|
|
572
|
+
/** `not_checked` unless the request set `respect_robots`. */
|
|
573
|
+
robots: "allowed" | "disallowed" | "unreachable" | "not_checked";
|
|
574
|
+
timing: Timing;
|
|
575
|
+
}
|
|
576
|
+
|
|
491
577
|
export interface MapRequest {
|
|
492
578
|
url: string;
|
|
493
579
|
/** Order results by relevance to this phrase. */
|
|
@@ -506,8 +592,16 @@ export interface MapRequest {
|
|
|
506
592
|
ignore_query_parameters?: boolean;
|
|
507
593
|
/** @default 1000 */
|
|
508
594
|
limit?: number;
|
|
509
|
-
/**
|
|
595
|
+
/**
|
|
596
|
+
* Time for the whole map, the start page and its sitemaps included.
|
|
597
|
+
* @default 30000
|
|
598
|
+
*/
|
|
510
599
|
timeout_ms?: number;
|
|
600
|
+
/**
|
|
601
|
+
* Refuse a start URL the site's robots.txt or Content Signals disallow (`403 robots_disallowed`), and use its `Sitemap:` lines for sitemap discovery. Off by default: then no robots.txt is fetched at all and sitemaps are looked for at `/sitemap.xml`.
|
|
602
|
+
* @default false
|
|
603
|
+
*/
|
|
604
|
+
respect_robots?: boolean;
|
|
511
605
|
}
|
|
512
606
|
|
|
513
607
|
export interface MapResult {
|
|
@@ -521,6 +615,62 @@ export interface MapResult {
|
|
|
521
615
|
timing: Timing;
|
|
522
616
|
}
|
|
523
617
|
|
|
618
|
+
export interface SearchRequest {
|
|
619
|
+
/**
|
|
620
|
+
* What to search for, at most 50 words. Operators the provider supports pass through: `site:`, quotes, `-word`.
|
|
621
|
+
*/
|
|
622
|
+
query: string;
|
|
623
|
+
/**
|
|
624
|
+
* Most results to return.
|
|
625
|
+
* @default 5
|
|
626
|
+
*/
|
|
627
|
+
limit?: number;
|
|
628
|
+
/**
|
|
629
|
+
* Two-letter country code to rank results for, like `us` or `de`. Default the provider's. A code the provider does not cover answers `400 invalid_request` on this field.
|
|
630
|
+
*/
|
|
631
|
+
country?: string;
|
|
632
|
+
/** Language of the results, like `en`, `de` or `pt-br`. */
|
|
633
|
+
lang?: string;
|
|
634
|
+
/** Only results the provider found within this past period. */
|
|
635
|
+
freshness?: "day" | "week" | "month" | "year";
|
|
636
|
+
/**
|
|
637
|
+
* Filter adult content.
|
|
638
|
+
* @default "moderate"
|
|
639
|
+
*/
|
|
640
|
+
safe_search?: "off" | "moderate" | "strict";
|
|
641
|
+
/**
|
|
642
|
+
* Time for the whole search, the results' scrapes included. A scrape it cuts short is that result's `scrape_timeout` error.
|
|
643
|
+
* @default 30000
|
|
644
|
+
*/
|
|
645
|
+
timeout_ms?: number;
|
|
646
|
+
/**
|
|
647
|
+
* Scrape every result with these options. `headers`, `profile`, `actions` and the `json` format are refused (`400 invalid_request`): results are pages a third party's index chose.
|
|
648
|
+
*/
|
|
649
|
+
scrape?: NestedScrapeOptions;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export interface SearchResult {
|
|
653
|
+
object: "search";
|
|
654
|
+
query: string;
|
|
655
|
+
results: {
|
|
656
|
+
/** Rank in the provider's order, from 1. */
|
|
657
|
+
position: number;
|
|
658
|
+
url: string;
|
|
659
|
+
title: string;
|
|
660
|
+
description?: string;
|
|
661
|
+
scrape?: ScrapeResult;
|
|
662
|
+
error?: Problem;
|
|
663
|
+
}[];
|
|
664
|
+
/**
|
|
665
|
+
* `scrape_failed: <n> of <m> results could not be scraped; each has its error`, and `empty_page: <n> of <m> results came back with no text in their Markdown; each has its warning`.
|
|
666
|
+
*/
|
|
667
|
+
warnings?: string[];
|
|
668
|
+
/**
|
|
669
|
+
* `search_ms` and `total_ms`, and `scrape_ms` when the request has `scrape` and the search found results.
|
|
670
|
+
*/
|
|
671
|
+
timing: Timing;
|
|
672
|
+
}
|
|
673
|
+
|
|
524
674
|
/** Scrape options applied to every page. */
|
|
525
675
|
export type NestedScrapeOptions = ScrapeOptions;
|
|
526
676
|
|
|
@@ -571,9 +721,19 @@ export interface CrawlCreateRequest {
|
|
|
571
721
|
allow_external_links?: boolean;
|
|
572
722
|
/** @default false */
|
|
573
723
|
ignore_query_parameters?: boolean;
|
|
574
|
-
/**
|
|
724
|
+
/**
|
|
725
|
+
* Minimum gap between this crawl's requests to one host. Default 250 ms (or robots.txt's Crawl-delay with
|
|
726
|
+
* `respect_robots: true`). Whatever the value, job pages to one host start at least 250 ms apart
|
|
727
|
+
* node-wide, with at most 2 in flight to it per organization and 2 for all organizations together, and a
|
|
728
|
+
* 429 or 503 from the host pauses them for its `Retry-After`.
|
|
729
|
+
*/
|
|
575
730
|
delay_ms?: number;
|
|
576
731
|
max_concurrency?: number;
|
|
732
|
+
/**
|
|
733
|
+
* Apply robots.txt: skip pages it disallows (`result.robots_blocked`), skip every page when it cannot be read (RFC 9309), and use its Crawl-delay when `delay_ms` is not set. Off by default.
|
|
734
|
+
* @default false
|
|
735
|
+
*/
|
|
736
|
+
respect_robots?: boolean;
|
|
577
737
|
scrape?: NestedScrapeOptions;
|
|
578
738
|
webhook?: WebhookConfig;
|
|
579
739
|
metadata?: Metadata;
|
|
@@ -619,7 +779,7 @@ export type Crawl = Omit<Job, "id" | "object" | "result"> & {
|
|
|
619
779
|
result?: {
|
|
620
780
|
pages_succeeded: number;
|
|
621
781
|
pages_failed: number;
|
|
622
|
-
/** URLs skipped because robots.txt disallows them. */
|
|
782
|
+
/** URLs skipped because robots.txt disallows them (empty unless the crawl set `respect_robots`). */
|
|
623
783
|
robots_blocked: string[];
|
|
624
784
|
};
|
|
625
785
|
};
|
|
@@ -664,10 +824,17 @@ export type ExtractJob = Omit<Job, "id" | "object" | "result"> & {
|
|
|
664
824
|
};
|
|
665
825
|
};
|
|
666
826
|
|
|
667
|
-
/**
|
|
827
|
+
/**
|
|
828
|
+
* `active` until closed by its timeout (`expired`) or otherwise (`closed`: `DELETE`, its browser stopped, or the node restarted; `closed_reason` says which).
|
|
829
|
+
*/
|
|
668
830
|
export type SessionStatus = "active" | "closed" | "expired";
|
|
669
831
|
|
|
670
832
|
export interface SessionCreateRequest {
|
|
833
|
+
/**
|
|
834
|
+
* The session's browser. A session that asks for `headless-shell` starts its browser cold.
|
|
835
|
+
* @default "chrome"
|
|
836
|
+
*/
|
|
837
|
+
browser?: BrowserEngine;
|
|
671
838
|
/** A profile ID or name to load. */
|
|
672
839
|
profile?: string;
|
|
673
840
|
/**
|
|
@@ -681,8 +848,14 @@ export interface SessionCreateRequest {
|
|
|
681
848
|
*/
|
|
682
849
|
overwrite_profile?: boolean;
|
|
683
850
|
viewport?: Viewport;
|
|
684
|
-
/**
|
|
851
|
+
/**
|
|
852
|
+
* BCP 47 locale for `Accept-Language` and the browser. Defaults to the locale of the node's egress location (`en-US` on every node today).
|
|
853
|
+
* @default "en-US"
|
|
854
|
+
*/
|
|
685
855
|
locale?: string;
|
|
856
|
+
/**
|
|
857
|
+
* IANA time zone for the browser. Defaults to the time zone of the node's egress location (`America/Los_Angeles` on every node today).
|
|
858
|
+
*/
|
|
686
859
|
timezone?: string;
|
|
687
860
|
user_agent?: string;
|
|
688
861
|
/**
|
|
@@ -694,6 +867,89 @@ export interface SessionCreateRequest {
|
|
|
694
867
|
block_ads?: boolean;
|
|
695
868
|
block_resources?: Array<"image" | "media" | "font" | "stylesheet">;
|
|
696
869
|
metadata?: Metadata;
|
|
870
|
+
/**
|
|
871
|
+
* Give each act step's row in the session timeline a JPEG thumbnail of the viewport, at most 320 px wide,
|
|
872
|
+
* taken after the step. Each thumbnail adds a capture to the act call's time.
|
|
873
|
+
* @default false
|
|
874
|
+
*/
|
|
875
|
+
thumbnails?: boolean;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
export interface SessionTimeline {
|
|
879
|
+
object: "session_timeline";
|
|
880
|
+
session_id: string;
|
|
881
|
+
viewport: Viewport;
|
|
882
|
+
steps: TimelineStep[];
|
|
883
|
+
cursor: CursorPoint[];
|
|
884
|
+
/** What did not fit in the session's timeline. */
|
|
885
|
+
dropped: {
|
|
886
|
+
steps: number;
|
|
887
|
+
points: number;
|
|
888
|
+
thumbnails: number;
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export interface TimelineStep {
|
|
893
|
+
/** Which act call on the session (1, 2, ...). */
|
|
894
|
+
act: number;
|
|
895
|
+
/** The step's position in that call's `actions`. */
|
|
896
|
+
index: number;
|
|
897
|
+
kind:
|
|
898
|
+
| "navigate"
|
|
899
|
+
| "click"
|
|
900
|
+
| "hover"
|
|
901
|
+
| "type"
|
|
902
|
+
| "key"
|
|
903
|
+
| "scroll"
|
|
904
|
+
| "select"
|
|
905
|
+
| "wait"
|
|
906
|
+
| "evaluate"
|
|
907
|
+
| "screenshot"
|
|
908
|
+
| "markdown";
|
|
909
|
+
started_at: string;
|
|
910
|
+
/** Milliseconds from the session's creation to the step's start. */
|
|
911
|
+
at_ms: number;
|
|
912
|
+
duration_ms: number;
|
|
913
|
+
status: "ok" | "failed" | "skipped";
|
|
914
|
+
/**
|
|
915
|
+
* The target's box in the viewport (CSS pixels, after it was scrolled into view), or `null` for a step without a target.
|
|
916
|
+
*/
|
|
917
|
+
target: null | TimelineBox;
|
|
918
|
+
/** The URL a `navigate` step reached. */
|
|
919
|
+
url: string | null;
|
|
920
|
+
/** The step's problem; only on a step that failed. */
|
|
921
|
+
error?: Problem;
|
|
922
|
+
/** A JPEG of the viewport after the step, or `null` (thumbnails off, skipped step, budget spent). */
|
|
923
|
+
thumbnail: null | TimelineThumbnail;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/** Target box */
|
|
927
|
+
export interface TimelineBox {
|
|
928
|
+
x: number;
|
|
929
|
+
y: number;
|
|
930
|
+
width: number;
|
|
931
|
+
height: number;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/** Thumbnail */
|
|
935
|
+
export interface TimelineThumbnail {
|
|
936
|
+
format: "jpeg";
|
|
937
|
+
width: number;
|
|
938
|
+
height: number;
|
|
939
|
+
data_base64: string;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
export interface CursorPoint {
|
|
943
|
+
/** Milliseconds from the session's creation. */
|
|
944
|
+
at_ms: number;
|
|
945
|
+
x: number;
|
|
946
|
+
y: number;
|
|
947
|
+
/** `Input.dispatchMouseEvent` type: `mouseMoved`, `mousePressed`, `mouseReleased` or `mouseWheel`. */
|
|
948
|
+
type: string;
|
|
949
|
+
/** The button of a press or release (`left`, `middle`, `right`, `back`, `forward`). */
|
|
950
|
+
button?: string;
|
|
951
|
+
/** `act`: an act step. `cdp`: a CDP client on the session socket. */
|
|
952
|
+
source: "act" | "cdp";
|
|
697
953
|
}
|
|
698
954
|
|
|
699
955
|
export interface SessionPage {
|
|
@@ -720,8 +976,16 @@ export interface BrowserSession {
|
|
|
720
976
|
created_at: string;
|
|
721
977
|
expires_at: string;
|
|
722
978
|
closed_at: string | null;
|
|
979
|
+
/**
|
|
980
|
+
* Why the session closed; `null` while it is active. `deleted`: `DELETE`. `expired`: its timeout.
|
|
981
|
+
* `browser_exited`: its browser stopped under it. `node_restart`: the node stopped or restarted while the
|
|
982
|
+
* session was open; browser time is billed up to the stop and not after it (nothing when the node did not
|
|
983
|
+
* stop cleanly, since it cannot tell when the browser stopped). Closed sessions stay readable for 7 days.
|
|
984
|
+
*/
|
|
985
|
+
closed_reason?: "deleted" | "expired" | "browser_exited" | "node_restart" | null;
|
|
723
986
|
timeout_s: number;
|
|
724
987
|
viewport: Viewport;
|
|
988
|
+
browser: BrowserEngine;
|
|
725
989
|
/** The loaded profile, or `null`. */
|
|
726
990
|
profile: null | SessionProfileRef;
|
|
727
991
|
/** WebSocket URL of the session's CDP endpoint. */
|
|
@@ -741,8 +1005,9 @@ export type BrowserSessionList = Omit<ListEnvelope, "data"> & {
|
|
|
741
1005
|
|
|
742
1006
|
/**
|
|
743
1007
|
* One browser action; `kind` selects it. The kinds and their fields match render timeline actions
|
|
744
|
-
* (`navigate`, `click`, `hover`, `type`, `key`, `scroll`, `select`, `wait`) plus `evaluate`, `screenshot
|
|
745
|
-
* `markdown`, which only `act` and scrape `actions` offer
|
|
1008
|
+
* (`navigate`, `click`, `hover`, `type`, `key`, `scroll`, `select`, `wait`) plus `evaluate`, `screenshot`,
|
|
1009
|
+
* `markdown` and `snapshot`, which only `act` and scrape `actions` offer, as is `settle` on `navigate`,
|
|
1010
|
+
* `click`, `type`, `key` and `select`.
|
|
746
1011
|
*/
|
|
747
1012
|
export type ActStep =
|
|
748
1013
|
| ActNavigate
|
|
@@ -755,8 +1020,10 @@ export type ActStep =
|
|
|
755
1020
|
| ActWait
|
|
756
1021
|
| ActEvaluate
|
|
757
1022
|
| ActScreenshot
|
|
758
|
-
| ActMarkdown
|
|
1023
|
+
| ActMarkdown
|
|
1024
|
+
| ActSnapshot;
|
|
759
1025
|
|
|
1026
|
+
/** Navigate */
|
|
760
1027
|
export interface ActNavigate {
|
|
761
1028
|
kind: "navigate";
|
|
762
1029
|
url: string;
|
|
@@ -764,11 +1031,30 @@ export interface ActNavigate {
|
|
|
764
1031
|
wait_until?: "load" | "domcontentloaded" | "networkidle";
|
|
765
1032
|
/** @default 10000 */
|
|
766
1033
|
timeout_ms?: number;
|
|
1034
|
+
settle?: ActSettle;
|
|
767
1035
|
}
|
|
768
1036
|
|
|
1037
|
+
/**
|
|
1038
|
+
* After the action's input, wait until the page settles, and report how long that took (`settled_ms`, from the browser's acknowledgement of the input) and how it ended (`settled_by`). The page is settled when the document is at least interactive (loaded, when the input led to a new document), no document load and no `fetch` or XHR to the page's own site (sent since the action began) is in flight, and no DOM mutation and no such request has started or ended for `quiet_ms`. Third-party requests, images, scripts and streams do not hold it. Reaching `timeout_ms` is not an error: the action succeeds with `settled_by: deadline`. `true` takes the defaults. A click that changes nothing settles in about `quiet_ms`. The observer runs in an isolated world, so the page's scripts never see it.
|
|
1039
|
+
*/
|
|
1040
|
+
export type ActSettle =
|
|
1041
|
+
| boolean
|
|
1042
|
+
| {
|
|
1043
|
+
/** @default 50 */
|
|
1044
|
+
quiet_ms?: number;
|
|
1045
|
+
/**
|
|
1046
|
+
* The longest the settle waits (within the batch's own time).
|
|
1047
|
+
* @default 5000
|
|
1048
|
+
*/
|
|
1049
|
+
timeout_ms?: number;
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Click the target with trusted mouse events at its centre. Before pressing, vision checks that the target (or an element inside it, or one of its labels) is what the page draws at that point. A band fixed or sticky to the window that covers it gets one scroll to clear the target; any cover still there after half a second fails the click with `target_covered`, naming the cover, and no event is sent. A visually hidden checkbox or radio is clicked through its label.
|
|
1054
|
+
*/
|
|
769
1055
|
export interface ActClick {
|
|
770
1056
|
kind: "click";
|
|
771
|
-
target:
|
|
1057
|
+
target: ActTarget;
|
|
772
1058
|
/** @default "left" */
|
|
773
1059
|
button?: "left" | "right" | "middle";
|
|
774
1060
|
/** @default 1 */
|
|
@@ -779,18 +1065,23 @@ export interface ActClick {
|
|
|
779
1065
|
* @default 10000
|
|
780
1066
|
*/
|
|
781
1067
|
timeout_ms?: number;
|
|
1068
|
+
settle?: ActSettle;
|
|
782
1069
|
}
|
|
783
1070
|
|
|
1071
|
+
/** Hover */
|
|
784
1072
|
export interface ActHover {
|
|
785
1073
|
kind: "hover";
|
|
786
|
-
target:
|
|
1074
|
+
target: ActTarget;
|
|
787
1075
|
/** @default 10000 */
|
|
788
1076
|
timeout_ms?: number;
|
|
789
1077
|
}
|
|
790
1078
|
|
|
1079
|
+
/**
|
|
1080
|
+
* Types `text` into `target` (focused first) or, without a target, into the element that has focus. The target must lead to one field that takes text: an input whose type is not checkbox, radio, button, submit, reset, image, file, color, range or hidden, a textarea, or an editable element; a label, which stands for its control (its `for` target or the field inside it, so `{"text": "Email"}` types into the Email field); or any other element that holds exactly one such field. Anything else fails the step (`act_step_failed`) and nothing is typed. The detail says what to do instead: a `select` step for a select element, a `click` for a checkbox, radio or button, an `evaluate` step for a color or range input; a file or hidden input takes no typed text; an element holding several fields needs a target that names one.
|
|
1081
|
+
*/
|
|
791
1082
|
export interface ActType {
|
|
792
1083
|
kind: "type";
|
|
793
|
-
target?:
|
|
1084
|
+
target?: ActTarget;
|
|
794
1085
|
text: string;
|
|
795
1086
|
/**
|
|
796
1087
|
* Clear the field before typing.
|
|
@@ -804,31 +1095,38 @@ export interface ActType {
|
|
|
804
1095
|
interval_ms?: number;
|
|
805
1096
|
/** @default 10000 */
|
|
806
1097
|
timeout_ms?: number;
|
|
1098
|
+
settle?: ActSettle;
|
|
807
1099
|
}
|
|
808
1100
|
|
|
1101
|
+
/** Key */
|
|
809
1102
|
export interface ActKey {
|
|
810
1103
|
kind: "key";
|
|
811
1104
|
/** `KeyboardEvent.key`, such as `Enter`, `Tab` or `a`. */
|
|
812
1105
|
key: string;
|
|
813
1106
|
modifiers?: KeyModifiers;
|
|
1107
|
+
settle?: ActSettle;
|
|
814
1108
|
}
|
|
815
1109
|
|
|
816
1110
|
/** Scroll to an offset (`to`), by a delta (`by`), or until `target` is in view. */
|
|
817
1111
|
export interface ActScroll {
|
|
818
1112
|
kind: "scroll";
|
|
819
|
-
target?:
|
|
1113
|
+
target?: ActTarget;
|
|
820
1114
|
to?: Point;
|
|
821
1115
|
by?: Point;
|
|
822
1116
|
}
|
|
823
1117
|
|
|
1118
|
+
/** Select */
|
|
824
1119
|
export interface ActSelect {
|
|
825
1120
|
kind: "select";
|
|
826
|
-
target:
|
|
1121
|
+
target: ActTarget;
|
|
827
1122
|
/** The option value to select. */
|
|
828
1123
|
value: string;
|
|
1124
|
+
settle?: ActSettle;
|
|
829
1125
|
}
|
|
830
1126
|
|
|
831
|
-
/**
|
|
1127
|
+
/**
|
|
1128
|
+
* Wait a fixed time (`ms`) or until a condition holds (`for`). `network_idle` holds once the document has loaded and no request has been in flight, sent or ended for 500 ms, counted from the start of the wait; requests count from the moment they are sent (long polls older than 30 seconds are ignored).
|
|
1129
|
+
*/
|
|
832
1130
|
export interface ActWait {
|
|
833
1131
|
kind: "wait";
|
|
834
1132
|
ms?: number;
|
|
@@ -837,6 +1135,7 @@ export interface ActWait {
|
|
|
837
1135
|
timeout_ms?: number;
|
|
838
1136
|
}
|
|
839
1137
|
|
|
1138
|
+
/** Evaluate */
|
|
840
1139
|
export interface ActEvaluate {
|
|
841
1140
|
kind: "evaluate";
|
|
842
1141
|
/**
|
|
@@ -845,9 +1144,10 @@ export interface ActEvaluate {
|
|
|
845
1144
|
expression: string;
|
|
846
1145
|
}
|
|
847
1146
|
|
|
1147
|
+
/** Screenshot */
|
|
848
1148
|
export interface ActScreenshot {
|
|
849
1149
|
kind: "screenshot";
|
|
850
|
-
target?:
|
|
1150
|
+
target?: ActTarget;
|
|
851
1151
|
/** @default false */
|
|
852
1152
|
full_page?: boolean;
|
|
853
1153
|
/** @default "jpeg" */
|
|
@@ -856,12 +1156,56 @@ export interface ActScreenshot {
|
|
|
856
1156
|
quality?: number;
|
|
857
1157
|
}
|
|
858
1158
|
|
|
1159
|
+
/** Markdown */
|
|
859
1160
|
export interface ActMarkdown {
|
|
860
1161
|
kind: "markdown";
|
|
861
1162
|
/** @default true */
|
|
862
1163
|
only_main_content?: boolean;
|
|
863
1164
|
}
|
|
864
1165
|
|
|
1166
|
+
/**
|
|
1167
|
+
* An outline of the page for choosing what to act on: one element per line, indented by container, in Playwright's aria-snapshot shape (`- button "Sign in" [ref=3f9a2c10:e4]`). Controls and headings carry a `ref`; a later step targets one with `target: {ref}`, in this batch or a later `act` on the same page. `skeleton` lists landmarks, headings and controls, cuts names at 80 characters and counts the controls of one role past the eighth in a container (`- link (42 more)`) instead of listing them; `full` also lists text blocks and images, and every control. The outline stops at `max_tokens` (tokens counted as characters / 4): the step is still `ok`, with `truncated: true` and `complete: false`. Frames are listed, not entered.
|
|
1168
|
+
*/
|
|
1169
|
+
export interface ActSnapshot {
|
|
1170
|
+
kind: "snapshot";
|
|
1171
|
+
/** @default "skeleton" */
|
|
1172
|
+
mode?: "skeleton" | "full";
|
|
1173
|
+
/** CSS selector of the element to outline (the body by default). */
|
|
1174
|
+
root?: string;
|
|
1175
|
+
/** @default 4000 */
|
|
1176
|
+
max_tokens?: number;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* The element an action works on: a `Target` (found by selector, text or role when the step runs), or a `ref` from a `snapshot` step, which names the element that snapshot listed and nothing else.
|
|
1181
|
+
*/
|
|
1182
|
+
export type ActTarget = Target | SnapshotRef;
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* A ref from a `snapshot` step's outline (`<snapshot id>:e<n>`). It is bound to that element of that document: once the element is removed, or the page has navigated, or the ref comes from another page, the step fails with `stale_ref`, and vision never looks for a look-alike by text or role. A ref is used as it is, alone.
|
|
1186
|
+
*/
|
|
1187
|
+
export interface SnapshotRef {
|
|
1188
|
+
ref: string;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
export interface SnapshotData {
|
|
1192
|
+
/** The snapshot's id, the first part of its refs. */
|
|
1193
|
+
id: string;
|
|
1194
|
+
mode: "skeleton" | "full";
|
|
1195
|
+
/** The outline, one element per line; controls and headings end in `[ref=<id>:e<n>]`. */
|
|
1196
|
+
text: string;
|
|
1197
|
+
/** How many refs the outline holds. */
|
|
1198
|
+
refs: number;
|
|
1199
|
+
/** How many elements the outline lists. */
|
|
1200
|
+
nodes: number;
|
|
1201
|
+
/** The outline's size in tokens, counted as characters / 4. */
|
|
1202
|
+
tokens: number;
|
|
1203
|
+
/** Every element of the mode's kinds is listed (none counted instead, nothing cut by the budget). */
|
|
1204
|
+
complete: boolean;
|
|
1205
|
+
/** The budget (`max_tokens`) cut the outline. */
|
|
1206
|
+
truncated: boolean;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
865
1209
|
export interface ActRequest {
|
|
866
1210
|
actions: ActStep[];
|
|
867
1211
|
/** The page to act on (from `pages`); defaults to the most recently active page. */
|
|
@@ -870,6 +1214,11 @@ export interface ActRequest {
|
|
|
870
1214
|
continue_on_error?: boolean;
|
|
871
1215
|
/** @default 30000 */
|
|
872
1216
|
timeout_ms?: number;
|
|
1217
|
+
/**
|
|
1218
|
+
* Accept `confirm` dialogs (they are dismissed by default, so `confirm` returns false).
|
|
1219
|
+
* @default false
|
|
1220
|
+
*/
|
|
1221
|
+
accept_confirm?: boolean;
|
|
873
1222
|
}
|
|
874
1223
|
|
|
875
1224
|
export interface ActStepResult {
|
|
@@ -884,7 +1233,8 @@ export interface ActStepResult {
|
|
|
884
1233
|
| "wait"
|
|
885
1234
|
| "evaluate"
|
|
886
1235
|
| "screenshot"
|
|
887
|
-
| "markdown"
|
|
1236
|
+
| "markdown"
|
|
1237
|
+
| "snapshot";
|
|
888
1238
|
status: "ok" | "failed" | "skipped";
|
|
889
1239
|
duration_ms: number;
|
|
890
1240
|
/** `navigate`: the URL after redirects. */
|
|
@@ -896,7 +1246,56 @@ export interface ActStepResult {
|
|
|
896
1246
|
screenshot?: ScreenshotData;
|
|
897
1247
|
/** `markdown`: the page as Markdown. */
|
|
898
1248
|
markdown?: string;
|
|
1249
|
+
snapshot?: SnapshotData;
|
|
899
1250
|
error?: Problem;
|
|
1251
|
+
/** JavaScript dialogs the page opened while the action ran, in order. Left out when there were none. */
|
|
1252
|
+
dialogs?: ActDialog[];
|
|
1253
|
+
delivery: ActDelivery;
|
|
1254
|
+
retry: ActRetry;
|
|
1255
|
+
/**
|
|
1256
|
+
* With `settle`: milliseconds from the browser's acknowledgement of the input until the page settled (or the settle's deadline). Left out without `settle`.
|
|
1257
|
+
*/
|
|
1258
|
+
settled_ms?: number;
|
|
1259
|
+
/**
|
|
1260
|
+
* With `settle`: `quiet` (the page went quiet), `navigation` (the input led to a new document, which loaded and went quiet; a `navigate` always ends this way) or `deadline` (`timeout_ms` came first; the action still succeeded).
|
|
1261
|
+
*/
|
|
1262
|
+
settled_by?: "quiet" | "navigation" | "deadline";
|
|
1263
|
+
/**
|
|
1264
|
+
* What changed this action's answer, each starting with its code as a scrape's `warnings` do: a `screenshot` cut at the 16,384 px screenshot limit (`screenshot_truncated:` with the page's or the element's real size), a `markdown` read that returned the whole page because main content was under a quarter of it, or one that a markup limit or the extraction deadline shortened. Left out when there is nothing to say.
|
|
1265
|
+
*/
|
|
1266
|
+
warnings?: string[];
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Whether the action's input reached the page, on every result, failed and skipped ones included.
|
|
1271
|
+
* `delivered_verified`: sent, and the page's answer was seen (a `navigate` whose document loaded).
|
|
1272
|
+
* `delivered_unverified`: sent and acknowledged by the browser (a click, typed text, a key, a select, an
|
|
1273
|
+
* `evaluate`); what the page did with it is not checked. `delivery_uncertain`: part of it may have reached the
|
|
1274
|
+
* page (a `navigate` that timed out, `type` with `interval_ms` cut off). `not_delivered`: nothing was sent:
|
|
1275
|
+
* the target was missing, covered (`target_covered`) or stale (`stale_ref`), a field or option check refused,
|
|
1276
|
+
* the step was skipped, or the action sends no input (`wait`, `screenshot`, `markdown`, `snapshot`).
|
|
1277
|
+
* `unknown`: the browser stopped answering, or the batch ran out of time, after the input was sent.
|
|
1278
|
+
*/
|
|
1279
|
+
export type ActDelivery =
|
|
1280
|
+
| "delivered_verified"
|
|
1281
|
+
| "delivered_unverified"
|
|
1282
|
+
| "delivery_uncertain"
|
|
1283
|
+
| "not_delivered"
|
|
1284
|
+
| "unknown";
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Whether sending the action again is safe. `safe`: nothing was sent, or the action does the same thing
|
|
1288
|
+
* twice (`navigate`, `hover`, `scroll`, the read actions). `unsafe`: its input landed and a second send repeats
|
|
1289
|
+
* it (a second click, the text typed twice). `unknown`: whether its input landed cannot be told (`delivery`
|
|
1290
|
+
* `unknown`, or an `evaluate` that threw part way).
|
|
1291
|
+
*/
|
|
1292
|
+
export type ActRetry = "safe" | "unsafe" | "unknown";
|
|
1293
|
+
|
|
1294
|
+
export interface ActDialog {
|
|
1295
|
+
type: "alert" | "confirm" | "prompt" | "beforeunload";
|
|
1296
|
+
/** The dialog's text (cut at 1,000 characters). */
|
|
1297
|
+
message: string;
|
|
1298
|
+
action: "accepted" | "dismissed";
|
|
900
1299
|
}
|
|
901
1300
|
|
|
902
1301
|
export interface ActResult {
|
|
@@ -923,6 +1322,10 @@ export interface Profile {
|
|
|
923
1322
|
expires_at?: ProfileTimestamp | null;
|
|
924
1323
|
metadata: ProfileMetadata;
|
|
925
1324
|
name: string;
|
|
1325
|
+
/**
|
|
1326
|
+
* Whether GET /v1/vision/profiles/{id}/state exports the state. True when the current state was uploaded; false when a B3OS browser session saved it: such state still loads into the organization's sessions, scrapes and render jobs, but the state route answers 403 profile_not_exportable. The flag governs that route only: a session's CDP client with vision:profiles:export reads the cookies of a profile the session loaded, and scripts in its pages read what the page's own scripts can. An upload makes a profile exportable again.
|
|
1327
|
+
*/
|
|
1328
|
+
exportable: boolean;
|
|
926
1329
|
/** Owning org. Returned to the owner only; tenancy is checked on every access. */
|
|
927
1330
|
org?: string;
|
|
928
1331
|
project?: string;
|
|
@@ -973,7 +1376,9 @@ export type ProfileMetadata = Record<string, string>;
|
|
|
973
1376
|
export interface ProfileCookie {
|
|
974
1377
|
name: string;
|
|
975
1378
|
value: string;
|
|
976
|
-
/**
|
|
1379
|
+
/**
|
|
1380
|
+
* Host or .domain the cookie belongs to: a name of two or more labels, or an IPv4 address. Single-label hosts such as localhost are refused (B3OS browsers reach only public hosts).
|
|
1381
|
+
*/
|
|
977
1382
|
domain: string;
|
|
978
1383
|
path: string;
|
|
979
1384
|
/** Unix time in seconds; -1 for a session cookie. */
|
|
@@ -1031,7 +1436,9 @@ export interface ProfileOpfsEntry {
|
|
|
1031
1436
|
}
|
|
1032
1437
|
|
|
1033
1438
|
export interface ProfileOrigin {
|
|
1034
|
-
/**
|
|
1439
|
+
/**
|
|
1440
|
+
* Serialized origin: scheme://host[:port], no path. The host has two or more labels or is an IPv4 address.
|
|
1441
|
+
*/
|
|
1035
1442
|
origin: string;
|
|
1036
1443
|
localStorage: ProfileNameValue[];
|
|
1037
1444
|
indexedDB?: ProfileIndexedDBDatabase[];
|
|
@@ -1050,7 +1457,11 @@ export interface ProfileCreateRequest {
|
|
|
1050
1457
|
/** Unique per project. */
|
|
1051
1458
|
name: string;
|
|
1052
1459
|
state: ProfileStorageState;
|
|
1053
|
-
/**
|
|
1460
|
+
/**
|
|
1461
|
+
* Registrable domains the profile may hold state for. Derived from `state` when omitted. Each is a name of
|
|
1462
|
+
* two or more labels or an IPv4 address; a leading dot and capitals are dropped (spellings of one domain
|
|
1463
|
+
* count once); anything else answers 400 `invalid_request` with the item's pointer.
|
|
1464
|
+
*/
|
|
1054
1465
|
domains?: string[];
|
|
1055
1466
|
/** Delete the profile automatically at this time. */
|
|
1056
1467
|
expires_at?: string;
|
|
@@ -1084,19 +1495,300 @@ export type PresetRef = string;
|
|
|
1084
1495
|
|
|
1085
1496
|
export type PresetKind = "background" | "frame" | "cursor" | "captions" | "click_effect";
|
|
1086
1497
|
|
|
1498
|
+
/** A background preset (`GET /v1/render/presets?kind=background` has a preview of each). */
|
|
1499
|
+
export type BackgroundPreset =
|
|
1500
|
+
| "b3os-light"
|
|
1501
|
+
| "b3os-dark"
|
|
1502
|
+
| "b3os-blue"
|
|
1503
|
+
| "midnight"
|
|
1504
|
+
| "aurora"
|
|
1505
|
+
| "sunset"
|
|
1506
|
+
| "ocean"
|
|
1507
|
+
| "arctic"
|
|
1508
|
+
| "dusk"
|
|
1509
|
+
| "forest"
|
|
1510
|
+
| "ember"
|
|
1511
|
+
| "graphite"
|
|
1512
|
+
| "paper";
|
|
1513
|
+
|
|
1514
|
+
/** A window frame preset (`GET /v1/render/presets?kind=frame` has a preview of each). */
|
|
1515
|
+
export type FramePreset =
|
|
1516
|
+
| "mac"
|
|
1517
|
+
| "mac-dark"
|
|
1518
|
+
| "browser"
|
|
1519
|
+
| "browser-dark"
|
|
1520
|
+
| "windows"
|
|
1521
|
+
| "windows-dark"
|
|
1522
|
+
| "phone"
|
|
1523
|
+
| "tablet"
|
|
1524
|
+
| "laptop"
|
|
1525
|
+
| "laptop-dark"
|
|
1526
|
+
| "desktop";
|
|
1527
|
+
|
|
1528
|
+
/** A cursor preset (`GET /v1/render/presets?kind=cursor` has a preview of each). */
|
|
1529
|
+
export type CursorPreset = "arrow" | "arrow-light" | "dot";
|
|
1530
|
+
|
|
1531
|
+
/** A caption style preset (`GET /v1/render/presets?kind=captions` has a preview of each). */
|
|
1532
|
+
export type CaptionsPreset = "default" | "bold" | "minimal" | "light";
|
|
1533
|
+
|
|
1534
|
+
/** A click effect preset (`GET /v1/render/presets?kind=click_effect` has a preview of each). */
|
|
1535
|
+
export type ClickEffectPreset = "ripple" | "ring";
|
|
1536
|
+
|
|
1087
1537
|
/**
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1538
|
+
* One preset for each part plus `overrides`, the same object as a timeline's `style` (restyle replaces exactly
|
|
1539
|
+
* this). Every field is optional. The per-kind enums (`BackgroundPreset`, `FramePreset`, `CursorPreset`,
|
|
1540
|
+
* `CaptionsPreset`, `ClickEffectPreset`) list today's presets; the schema also takes any preset ID so a preset
|
|
1541
|
+
* added later needs no client update, and the node refuses an ID that is not a preset of that kind with
|
|
1542
|
+
* `style_invalid`. `none` draws nothing for that part; `auto` (the default background) picks one of the studio
|
|
1543
|
+
* backgrounds (`GET /v1/render/backgrounds`, pack `studio`, tag `auto`) for the page, one whose color just
|
|
1544
|
+
* outside the window's edges is at least 12 L* from the page's own (a dark page gets one at least 20 L*
|
|
1545
|
+
* lighter), the same pick for the same page every time; `transparent` leaves the background transparent.
|
|
1546
|
+
* Strings are drawn by the compositor and escaped before they reach any HTML or CSS.
|
|
1091
1547
|
*/
|
|
1092
1548
|
export interface RenderStyle {
|
|
1093
|
-
background
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1549
|
+
/** A background preset, or `auto`, `transparent` or `none`. */
|
|
1550
|
+
background?: BackgroundPreset | "auto" | "transparent" | "none" | (string & {});
|
|
1551
|
+
/** A window frame preset, or `none`. */
|
|
1552
|
+
frame?: FramePreset | "none" | (string & {});
|
|
1553
|
+
/** A cursor preset, or `none`. */
|
|
1554
|
+
cursor?: CursorPreset | "none" | (string & {});
|
|
1555
|
+
/** A caption style preset, or `none`. */
|
|
1556
|
+
captions?: CaptionsPreset | "none" | (string & {});
|
|
1557
|
+
/** A click effect preset, or `none`. */
|
|
1558
|
+
click_effect?: ClickEffectPreset | "none" | (string & {});
|
|
1559
|
+
overrides?: RenderStyleOverrides;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* A color: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb(r,g,b)`, `rgba(r,g,b,a)`, `rgb(r g b / a)` (channels
|
|
1564
|
+
* 0-255 or percentages, alpha 0-1 or a percentage), or `white`, `black` or `transparent`.
|
|
1565
|
+
*/
|
|
1566
|
+
export type RenderColor = string;
|
|
1567
|
+
|
|
1568
|
+
/** One shadow, in CSS pixels; a field left out is 0, and the color defaults to black at 25% alpha. */
|
|
1569
|
+
export interface RenderShadow {
|
|
1570
|
+
x?: number;
|
|
1571
|
+
y?: number;
|
|
1572
|
+
blur?: number;
|
|
1573
|
+
spread?: number;
|
|
1574
|
+
color?: RenderColor;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
export type RenderGradientStop =
|
|
1578
|
+
| RenderColor
|
|
1579
|
+
| {
|
|
1580
|
+
color: RenderColor;
|
|
1581
|
+
/**
|
|
1582
|
+
* Position along the gradient, 0 to 1, never less than the stop before. Left out, stops are spaced evenly.
|
|
1583
|
+
*/
|
|
1584
|
+
at?: number;
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* Style fields that override the presets; a closed set, so any other key is refused with `style_invalid`.
|
|
1589
|
+
* Lengths are CSS pixels, scaled with the device pixel ratio for screenshots and with the output size for
|
|
1590
|
+
* videos (relative to 1080p).
|
|
1591
|
+
*/
|
|
1592
|
+
export interface RenderStyleOverrides {
|
|
1593
|
+
/** Space around the page, the same on every side or `{x, y}`. */
|
|
1594
|
+
padding?:
|
|
1595
|
+
| number
|
|
1596
|
+
| {
|
|
1597
|
+
x?: number;
|
|
1598
|
+
y?: number;
|
|
1599
|
+
};
|
|
1600
|
+
corner_radius?: number;
|
|
1601
|
+
/** A shadow preset, one shadow, or a list of up to 4 drawn together. */
|
|
1602
|
+
shadow?: "none" | "soft" | "float" | "hard" | "glow" | RenderShadow | RenderShadow[];
|
|
1603
|
+
/**
|
|
1604
|
+
* `none`, or a border of `width` (default 1) and `color`. Left out, a hairline matched to the background.
|
|
1605
|
+
*/
|
|
1606
|
+
border?:
|
|
1607
|
+
| "none"
|
|
1608
|
+
| {
|
|
1609
|
+
width?: number;
|
|
1610
|
+
color?: RenderColor;
|
|
1611
|
+
};
|
|
1612
|
+
background_color?: RenderColor;
|
|
1613
|
+
/** A linear gradient at `angle` degrees (135 by default), or a radial one with `kind` radial. */
|
|
1614
|
+
background_gradient?: {
|
|
1615
|
+
kind?: "linear" | "radial";
|
|
1616
|
+
angle?: number;
|
|
1617
|
+
stops: RenderGradientStop[];
|
|
1618
|
+
};
|
|
1619
|
+
/**
|
|
1620
|
+
* A library background, `<pack>/<slug>` (`GET /v1/render/backgrounds` lists them; ScreenFramed's
|
|
1621
|
+
* `gradients/<pack>/<slug>` names the same entry of that group). It replaces the preset's background and
|
|
1622
|
+
* cannot be combined with `background_color` or `background_gradient`. An unknown ref is refused with
|
|
1623
|
+
* `style_invalid` at `/overrides/background_ref`. An image background is fetched by the render node on its
|
|
1624
|
+
* first use there and cached; if it cannot be loaded the request fails with `background_unavailable` (503,
|
|
1625
|
+
* retry).
|
|
1626
|
+
*
|
|
1627
|
+
* `"auto"` (screenshots only) picks a library image that fits the captured page: one of the quiet, bold or
|
|
1628
|
+
* soft-photo backgrounds (quiet ones first), in the page's light or dark theme (or `theme`'s), so a light
|
|
1629
|
+
* page gets a light, soft background and a dark page a dark one, with clear lightness separation, a hue
|
|
1630
|
+
* analogous or complementary to the page's accent, little detail where it shows around the window, and
|
|
1631
|
+
* enough pixels for the output. The same page gets the same background; the screenshot's `background_ref`
|
|
1632
|
+
* names the one drawn. If the chosen image cannot be loaded within 2 s, the screenshot keeps the style's own
|
|
1633
|
+
* background (the `auto` background preset unless `background` names another) and `warnings` says so
|
|
1634
|
+
* (`background_fallback`).
|
|
1635
|
+
*/
|
|
1636
|
+
background_ref?: string;
|
|
1637
|
+
/**
|
|
1638
|
+
* A text block set by the compositor above or below the window of a screenshot (Geist; never parsed as
|
|
1639
|
+
* HTML): an optional badge pill, a title (up to `title_lines` lines, 3 by default) and a subtitle (up to 4
|
|
1640
|
+
* lines), wrapped at `max_width` (the window's width by default); a line that does not fit ends with an
|
|
1641
|
+
* ellipsis. With `autofit` the title shrinks to fit instead. It needs a title, a subtitle or a badge. The
|
|
1642
|
+
* canvas grows to hold it, or on a fixed `canvas` the page shrinks. Screenshots only: a video with `text`
|
|
1643
|
+
* is refused with `style_invalid` at `/overrides/text`.
|
|
1644
|
+
*/
|
|
1645
|
+
text?: {
|
|
1646
|
+
title?: string;
|
|
1647
|
+
subtitle?: string;
|
|
1648
|
+
badge?: string;
|
|
1649
|
+
/** Above (the default) or below the window. */
|
|
1650
|
+
position?: "above" | "below";
|
|
1651
|
+
/** Center (the default), left or right; left and right line up with the window's edge. */
|
|
1652
|
+
align?: "left" | "center" | "right";
|
|
1653
|
+
color?: RenderColor;
|
|
1654
|
+
badge_color?: RenderColor;
|
|
1655
|
+
/** Title size in CSS pixels, 48 by default (the subtitle's is 22). */
|
|
1656
|
+
title_size?: number;
|
|
1657
|
+
subtitle_size?: number;
|
|
1658
|
+
/** Wrapping width in CSS pixels; the window's width by default. */
|
|
1659
|
+
max_width?: number;
|
|
1660
|
+
/** Space between the text and the window, 40 by default. */
|
|
1661
|
+
gap?: number;
|
|
1662
|
+
/** The most lines the title wraps to, 3 by default. */
|
|
1663
|
+
title_lines?: number;
|
|
1664
|
+
/**
|
|
1665
|
+
* Sets the title at the largest size from `title_size` down to `fit_min` (in steps of 0.25 px) at
|
|
1666
|
+
* which it fits in `title_lines` lines with no word broken or cut; the subtitle and the badge keep
|
|
1667
|
+
* their ratio to it. A title that does not fit even at `fit_min` is set at `fit_min` with an ellipsis.
|
|
1668
|
+
* False by default.
|
|
1669
|
+
*/
|
|
1670
|
+
autofit?: boolean;
|
|
1671
|
+
/**
|
|
1672
|
+
* The smallest title size `autofit` may use, in CSS pixels: half of `title_size` by default, at least
|
|
1673
|
+
* 12. A value above `title_size` counts as `title_size`; without `autofit` it is unused.
|
|
1674
|
+
*/
|
|
1675
|
+
fit_min?: number;
|
|
1676
|
+
};
|
|
1677
|
+
/**
|
|
1678
|
+
* Tilts the window in 3D (ScreenFramed's presets; CSS `perspective: 1000px` about the canvas center),
|
|
1679
|
+
* scaled by `perspective_intensity`. Screenshots only, like every camera field below.
|
|
1680
|
+
*/
|
|
1681
|
+
perspective?:
|
|
1682
|
+
| "none"
|
|
1683
|
+
| "tilt-left"
|
|
1684
|
+
| "tilt-right"
|
|
1685
|
+
| "tilt-up"
|
|
1686
|
+
| "tilt-down"
|
|
1687
|
+
| "tilt-left-strong"
|
|
1688
|
+
| "tilt-right-strong"
|
|
1689
|
+
| "iso-left"
|
|
1690
|
+
| "iso-right";
|
|
1691
|
+
/** How much of the `perspective` preset to apply, 50 by default. */
|
|
1692
|
+
perspective_intensity?: number;
|
|
1693
|
+
/**
|
|
1694
|
+
* A camera preset (tilt, roll, offset, frame scale and depth blur): `hero` 6/-6 degrees, offset 160,80,
|
|
1695
|
+
* 1.25x; `dashboard` 4/5, offset 10,70, 1.1x; `flat`; `cinematic` 25/0, 1.1x; `detail` 18/-9, offset
|
|
1696
|
+
* -30,0, 1.95x. Not with `perspective`; the single fields below override it, and `depth_blur` lists the
|
|
1697
|
+
* blur each one brings.
|
|
1698
|
+
*/
|
|
1699
|
+
camera?: "hero" | "dashboard" | "flat" | "cinematic" | "detail";
|
|
1700
|
+
/** Degrees about the horizontal axis; positive tips the top away. */
|
|
1701
|
+
tilt_x?: number;
|
|
1702
|
+
/** Degrees about the vertical axis; positive turns the right side away. */
|
|
1703
|
+
tilt_y?: number;
|
|
1704
|
+
/** Degrees in the picture plane, clockwise. */
|
|
1705
|
+
roll?: number;
|
|
1706
|
+
/** Moves the tilted window, in CSS pixels. */
|
|
1707
|
+
camera_offset?: {
|
|
1708
|
+
x?: number;
|
|
1709
|
+
y?: number;
|
|
1710
|
+
};
|
|
1711
|
+
/** Scales the window about its center before the tilt; above 1 it may run past the canvas edges. */
|
|
1712
|
+
frame_scale?: number;
|
|
1713
|
+
/**
|
|
1714
|
+
* Depth of field over the whole composed screenshot (background, window, shadows and text): a Gaussian
|
|
1715
|
+
* blur whose sigma, in CSS pixels, is this value where the blur is full, mixed over the sharp image by
|
|
1716
|
+
* the `depth_blur_type` mask. The `hero` and `dashboard` cameras bring 6 from position 0.7, `cinematic`
|
|
1717
|
+
* 38 from 0.45 and `detail` 4 from 0.3 (ScreenFramed's presets); 0 turns the blur off. Screenshots only:
|
|
1718
|
+
* a video with a depth blur is refused with `style_invalid` at `/overrides/depth_blur`.
|
|
1719
|
+
*/
|
|
1720
|
+
depth_blur?: number;
|
|
1721
|
+
/**
|
|
1722
|
+
* `dir` (the default) stays sharp up to `depth_blur_position` along `depth_blur_angle` and blurs toward
|
|
1723
|
+
* the far edge; `tilt` keeps a sharp band `depth_blur_band` wide centered at `depth_blur_position` and
|
|
1724
|
+
* blurs both sides; `radial` keeps the center sharp (18% of the half-diagonal) and blurs toward the
|
|
1725
|
+
* corners; `lens` is radial with a sharp circle of radius `depth_blur_width`. Needs `depth_blur`.
|
|
1726
|
+
*/
|
|
1727
|
+
depth_blur_type?: "dir" | "radial" | "tilt" | "lens";
|
|
1728
|
+
/**
|
|
1729
|
+
* `dir` and `tilt`: the direction the blur grows toward (or the axis across the band), in degrees: 0 up,
|
|
1730
|
+
* 90 right, 180 down (the default), 270 left.
|
|
1731
|
+
*/
|
|
1732
|
+
depth_blur_angle?: number;
|
|
1733
|
+
/**
|
|
1734
|
+
* `dir`: where the blur starts along the axis, 0.35 by default; `tilt`: the sharp band's center, 0.5 by
|
|
1735
|
+
* default.
|
|
1736
|
+
*/
|
|
1737
|
+
depth_blur_position?: number;
|
|
1738
|
+
/** `tilt` only: the sharp band's width as a fraction of the axis, 0.25 by default. */
|
|
1739
|
+
depth_blur_band?: number;
|
|
1740
|
+
/** `lens` only: the sharp circle's radius as a fraction of the half-diagonal, 0.3 by default. */
|
|
1741
|
+
depth_blur_width?: number;
|
|
1742
|
+
/**
|
|
1743
|
+
* New colors for the library background's color tokens (each row of `GET /v1/render/backgrounds` lists its
|
|
1744
|
+
* `tokens`), for example `{"accent": "#2f43ff"}`. Needs `background_ref`; an unknown token is refused at
|
|
1745
|
+
* `/overrides/background_tokens/<token>`.
|
|
1746
|
+
*/
|
|
1747
|
+
background_tokens?: Record<string, RenderColor>;
|
|
1748
|
+
/** The canvas aspect ratio; a screenshot's canvas grows to it. */
|
|
1749
|
+
aspect_ratio?: "auto" | "16:9" | "16:10" | "4:3" | "3:2" | "1:1" | "4:5" | "3:4" | "9:16" | "21:9";
|
|
1750
|
+
/** A fixed screenshot size; the page is fitted into it by `fit`. */
|
|
1751
|
+
canvas?: {
|
|
1752
|
+
width: number;
|
|
1753
|
+
height: number;
|
|
1754
|
+
};
|
|
1755
|
+
/** `contain` (the default) fits the whole page; `cover` fills the width and crops the bottom. */
|
|
1756
|
+
fit?: "contain" | "cover";
|
|
1757
|
+
/**
|
|
1758
|
+
* Where the window sits (ScreenFramed's `layout`). `default` centers it with `padding` around it.
|
|
1759
|
+
* `bottom-cropped` is a hero: the window is 80% of the canvas wide with equal sides and runs off the
|
|
1760
|
+
* bottom edge, so the top of the page shows and no bottom corner does. With `text` its top edge is at 28%
|
|
1761
|
+
* to 34% of the height and the text block is centered above it (the block shrinks as one until it fits,
|
|
1762
|
+
* and the title defaults to `title_lines` 2 with `autofit`); without text the top margin equals the
|
|
1763
|
+
* sides. On a fixed `canvas` the page is scaled to the window and the text sizes scale with it; without
|
|
1764
|
+
* one the page keeps its pixels and the canvas is the window's width / 0.8 wide at `aspect_ratio` (16:9
|
|
1765
|
+
* by default). `padding` and `fit` do not apply to it, nor does `text.position` `below`, and it does not
|
|
1766
|
+
* combine with a camera or perspective. Screenshots only: a video with it is refused with
|
|
1767
|
+
* `style_invalid` at `/overrides/layout`.
|
|
1768
|
+
*/
|
|
1769
|
+
layout?: "default" | "bottom-cropped";
|
|
1770
|
+
/** Text for the window's title bar, drawn by the compositor and never parsed as HTML. */
|
|
1771
|
+
frame_title?: string;
|
|
1772
|
+
/** Text for the address pill of a browser frame, drawn by the compositor and never parsed as HTML. */
|
|
1773
|
+
frame_url?: string;
|
|
1774
|
+
/** Flips the frame and the `auto` background. */
|
|
1775
|
+
theme?: "light" | "dark";
|
|
1776
|
+
/** Cursor scale, 1 by default. */
|
|
1777
|
+
cursor_size?: number;
|
|
1778
|
+
/** `false` keeps the cursor's size while the camera zooms. */
|
|
1779
|
+
cursor_zoom?: boolean;
|
|
1780
|
+
click_color?: RenderColor;
|
|
1781
|
+
/** How long the click effect lasts, 450 by default. */
|
|
1782
|
+
click_duration_ms?: number;
|
|
1783
|
+
/** Caption text size in pixels at 1080p, 44 by default. */
|
|
1784
|
+
caption_size?: number;
|
|
1785
|
+
caption_color?: RenderColor;
|
|
1786
|
+
caption_highlight?: RenderColor;
|
|
1787
|
+
caption_background?: RenderColor;
|
|
1788
|
+
caption_position?: "bottom" | "top";
|
|
1789
|
+
/** Smear the cursor while it moves; on by default. */
|
|
1790
|
+
motion_blur?: boolean;
|
|
1791
|
+
matte?: RenderColor;
|
|
1100
1792
|
}
|
|
1101
1793
|
|
|
1102
1794
|
/** Give `url` or `html`. */
|
|
@@ -1116,8 +1808,11 @@ export type ScreenshotCreateRequest = {
|
|
|
1116
1808
|
/** @default false */
|
|
1117
1809
|
full_page?: boolean;
|
|
1118
1810
|
target?: Target;
|
|
1119
|
-
/**
|
|
1120
|
-
|
|
1811
|
+
/**
|
|
1812
|
+
* When the page counts as loaded. `auto` takes the load event, or, from 2 s after the navigation started, a first screen that has painted with its web fonts, the images in view and any large video in view loaded and has stayed that way for 0.3 s, whichever comes first; from 6 s a painted page is taken with media in view still loading. A page taken before its load event gets a `load_incomplete` warning. `load` waits for the load event up to `timeout_ms`, `domcontentloaded` for DOMContentLoaded, `networkidle` for the load event and then 500 ms without a request.
|
|
1813
|
+
* @default "auto"
|
|
1814
|
+
*/
|
|
1815
|
+
wait_until?: "auto" | "load" | "domcontentloaded" | "networkidle";
|
|
1121
1816
|
/**
|
|
1122
1817
|
* Extra settle time after the page is ready.
|
|
1123
1818
|
* @default 0
|
|
@@ -1130,10 +1825,25 @@ export type ScreenshotCreateRequest = {
|
|
|
1130
1825
|
* @default "auto"
|
|
1131
1826
|
*/
|
|
1132
1827
|
theme?: "light" | "dark" | "auto";
|
|
1133
|
-
/**
|
|
1828
|
+
/**
|
|
1829
|
+
* CSS selectors to hide before capture, for anything `overlays` does not find on its own (a site's own sticky promotion, a notice you do not want in the image).
|
|
1830
|
+
*/
|
|
1134
1831
|
hide?: string[];
|
|
1135
|
-
/**
|
|
1832
|
+
/**
|
|
1833
|
+
* Block requests to ad and tracker hosts, and collapse the ad slots they leave empty (listed as `ad_slot` in `overlays_removed`), so no blank band is left where an ad was.
|
|
1834
|
+
* @default true
|
|
1835
|
+
*/
|
|
1136
1836
|
block_ads?: boolean;
|
|
1837
|
+
/**
|
|
1838
|
+
* `remove` hides what covers a page loaded from `url`: consent walls and banners (known consent managers by their markup, others by their text; a layer that fills the viewport counts as consent only with a consent wall's shape, a dim or blurred ground, dialog semantics, a consent manager's markup or a consent answer button), sign-up, discount and app dialogs, the dim layer behind a dialog, and chat widgets, and lifts the scroll lock a dialog left. Nothing is clicked. It runs after the page is ready and again right before the capture. The page's own header, navigation, hero video and an app shell that fills the viewport stay, and so does a paywall or registration wall with no close control (with its dim layer and the scroll lock): `page_state` reports it. `keep` leaves the page as it loaded and lists the overlays in view in `warnings`. Inline `html` is never changed.
|
|
1839
|
+
* @default "remove"
|
|
1840
|
+
*/
|
|
1841
|
+
overlays?: "remove" | "keep";
|
|
1842
|
+
/**
|
|
1843
|
+
* `auto` finishes the page's entrance animations (finite CSS and Web Animations, never endless ones), waits up to 1.5 s for the first screen to fill in (a large video in view to show its first frame, skeleton blocks to give way to content, a large image or video player in view to show something), and when the capture's main area is still blank while the page is loading or fading in, captures again every 100 ms for up to 1.5 s. `fast` captures as soon as the readiness rule (`wait_until`, then a short network quiet window) is met. Applies to `url` captures of the viewport; element and full-page shots finish animations only.
|
|
1844
|
+
* @default "auto"
|
|
1845
|
+
*/
|
|
1846
|
+
settle?: "auto" | "fast";
|
|
1137
1847
|
style?: RenderStyle;
|
|
1138
1848
|
/** @default "webp" */
|
|
1139
1849
|
format?: "webp" | "png" | "jpeg";
|
|
@@ -1174,8 +1884,47 @@ export interface Screenshot {
|
|
|
1174
1884
|
artifacts: Artifact[];
|
|
1175
1885
|
created_at: string;
|
|
1176
1886
|
expires_at: string;
|
|
1887
|
+
/**
|
|
1888
|
+
* The HTTP status the site answered for the page (absent for `html`). A 404 page is still a successful screenshot of the site's error page; `page_state` and `warnings` say so.
|
|
1889
|
+
*/
|
|
1890
|
+
status_code?: number;
|
|
1891
|
+
/** The URL after redirects (absent for `html`). */
|
|
1892
|
+
final_url?: string;
|
|
1893
|
+
page_state?: ScreenshotPageState;
|
|
1894
|
+
/**
|
|
1895
|
+
* Non-fatal problems, each starting with a code and a colon: `http_status` (the site answered an error, or a 200 whose title says the page is missing), `blank_main_area` (the main area was still one color after the readiness wait), `still_animating` (content was still fading in when the wait ended), `login_form` (a sign-in form instead of the content), `video_not_shown` (a video or video player in view had no frame to show and its box is empty in the image: a format this browser cannot play, or still loading), `image_not_shown` (a large image in view had not loaded and its box is empty in the image), `content_placeholder` (loading placeholders, the gray skeleton blocks a site draws while its content loads, were still in view), `partial_page` (when the wait ended, the lower part of the first screen was empty or a loading indicator stood alone above the page's footer, and the site had answered 202 or the page still had work under way: the page may not have finished drawing, or may have finished with a spinner left in view), `overlays_kept` (overlays in view with `overlays: "keep"`), `paywall` (a subscription wall covers the content and was left in place), `login_wall` (a registration or sign-in wall covers the content and was left in place), `load_incomplete` (`wait_until: "auto"` took the page before its load event, with how many images and videos in view had not arrived), `text_glyph_missing` (characters of the style's text, frame title or host that no font on the node has, or in a script the compositor does not shape yet, such as Devanagari and Thai; they are left blank), `background_fallback` (the image `background_ref: "auto"` chose could not be loaded within 2 s; the style's own background was drawn).
|
|
1896
|
+
*/
|
|
1897
|
+
warnings?: string[];
|
|
1898
|
+
/** What the clean capture hid, by kind and signal, with how many (`overlays`, `block_ads`). */
|
|
1899
|
+
overlays_removed?: OverlayRemoved[];
|
|
1177
1900
|
timing?: Timing;
|
|
1178
1901
|
metadata: Metadata;
|
|
1902
|
+
/**
|
|
1903
|
+
* The library background drawn: the style's `overrides.background_ref`, or the image `"auto"` chose for
|
|
1904
|
+
* this page. Absent when the style draws no library background.
|
|
1905
|
+
*/
|
|
1906
|
+
background_ref?: string;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* What kind of page the screenshot captured, with vision's `PageState` field names: `ok`; `error` (an error status, signal `status`, or a 200 whose title says the page is missing, signal `title`); `loading` (the main area stayed blank, signal `blank_main_area`, or images or videos in view had not arrived when `wait_until: "auto"` took the page, signal `images_pending`, or skeleton blocks were still in view, signal `placeholders`, or, when the wait ended, the lower part of the first screen was empty or a loading indicator stood alone above the page's footer while the site had answered 202 or the page still had work under way, signal `partial_page`); `login` (a sign-in form instead of the content, signal `password_form`, or a registration or sign-in wall over it, signal `login_wall`); `paywall` (a subscription wall over the content, signal `paywall`; render's own state, as vision reads the HTML and has none); `cookie_wall` (a consent overlay left in view with `overlays: "keep"`). A wall is kept in the image, never hidden. A challenge or block page is not a screenshot: it fails with 502 `capture_failed` and reason `bot_challenge`.
|
|
1911
|
+
*/
|
|
1912
|
+
export interface ScreenshotPageState {
|
|
1913
|
+
state: "ok" | "error" | "loading" | "login" | "paywall" | "cookie_wall";
|
|
1914
|
+
/** What decided it. */
|
|
1915
|
+
signal?: string;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
export interface OverlayRemoved {
|
|
1919
|
+
/**
|
|
1920
|
+
* `consent` a consent wall or banner, `dialog` a sign-up, discount or app dialog, `backdrop` the dim layer behind one, `banner` a promotion strip or corner box, `chat` a chat launcher or messenger, `ad_slot` an ad slot left empty by `block_ads`.
|
|
1921
|
+
*/
|
|
1922
|
+
kind: "consent" | "dialog" | "backdrop" | "banner" | "chat" | "ad_slot";
|
|
1923
|
+
/**
|
|
1924
|
+
* How it was recognized: a consent manager's name (`onetrust`, `sourcepoint`, `trustarc`...), `markup`, `text`, `banner`, `dialog`, `dim`, `promo`, `widget`, or `empty` for ad slots.
|
|
1925
|
+
*/
|
|
1926
|
+
signal: string;
|
|
1927
|
+
count: number;
|
|
1179
1928
|
}
|
|
1180
1929
|
|
|
1181
1930
|
export type ScreenshotList = Omit<ListEnvelope, "data"> & {
|
|
@@ -1185,7 +1934,10 @@ export type ScreenshotList = Omit<ListEnvelope, "data"> & {
|
|
|
1185
1934
|
export interface Artifact {
|
|
1186
1935
|
id: string;
|
|
1187
1936
|
object: "artifact";
|
|
1188
|
-
|
|
1937
|
+
/**
|
|
1938
|
+
* `vtt` and `srt` are the captions; `chapters` is a WebVTT chapters file (`chapters.vtt`, text/vtt) with one cue per beat that has a `title`, starting where that beat starts, written for every video with a titled beat. `share` is a video's share page (`share.html`, text/html, `renderShareVideo`).
|
|
1939
|
+
*/
|
|
1940
|
+
kind: "image" | "mp4" | "gif" | "poster" | "vtt" | "srt" | "chapters" | "share";
|
|
1189
1941
|
content_type: string;
|
|
1190
1942
|
bytes?: number;
|
|
1191
1943
|
width?: number;
|
|
@@ -1305,8 +2057,8 @@ export interface VoiceSpec {
|
|
|
1305
2057
|
|
|
1306
2058
|
export interface CaptionOptions {
|
|
1307
2059
|
/**
|
|
1308
|
-
* `none`: sidecar files only. `static
|
|
1309
|
-
* @default "
|
|
2060
|
+
* `none`: sidecar files only. `static` (the default): draw each cue, as a small pill near the foot of the frame that moves to the top while a step clicks what it would cover. `karaoke`: also highlight the spoken word.
|
|
2061
|
+
* @default "static"
|
|
1310
2062
|
*/
|
|
1311
2063
|
burn_in?: "none" | "static" | "karaoke";
|
|
1312
2064
|
/** @default ["vtt"] */
|
|
@@ -1330,8 +2082,19 @@ export type VideoFormat = "mp4" | "gif" | "poster";
|
|
|
1330
2082
|
export interface VideoCreateRequest {
|
|
1331
2083
|
source: VideoSource;
|
|
1332
2084
|
beats: Beat[];
|
|
1333
|
-
|
|
2085
|
+
/**
|
|
2086
|
+
* The narration voice. Leave it out and every beat with `say` is narrated in the node's default voice,
|
|
2087
|
+
* `kokoro-82m` `af_heart`, normalized to -16 LUFS. Narration is speech made as the caller, so it needs
|
|
2088
|
+
* `infer:run` in the key's scopes as well as `render:run`; a key without it gets a silent video with a
|
|
2089
|
+
* `narration_scope` warning. `null` makes a silent video: word times are then estimated from the text, so
|
|
2090
|
+
* steps and captions still follow the lines.
|
|
2091
|
+
*/
|
|
2092
|
+
voice?: VoiceSpec | null;
|
|
1334
2093
|
captions?: CaptionOptions;
|
|
2094
|
+
/**
|
|
2095
|
+
* The look. Leave it out for the B3OS look in a browser window (`{"frame": "browser"}`); `{}` is the look
|
|
2096
|
+
* without a window frame.
|
|
2097
|
+
*/
|
|
1335
2098
|
style?: RenderStyle;
|
|
1336
2099
|
camera?: {
|
|
1337
2100
|
/**
|
|
@@ -1390,13 +2153,58 @@ export interface VideoRestyleRequest {
|
|
|
1390
2153
|
metadata?: Metadata;
|
|
1391
2154
|
}
|
|
1392
2155
|
|
|
2156
|
+
export interface VideoShareRequest {
|
|
2157
|
+
/** The page title and preview title. Default the first beat's `title`, else "Video". */
|
|
2158
|
+
title?: string;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
export interface VideoShare {
|
|
2162
|
+
object: "video_share";
|
|
2163
|
+
video_id: string;
|
|
2164
|
+
/** The share page's artifact (kind `share`, `share.html`). */
|
|
2165
|
+
artifact_id: string;
|
|
2166
|
+
title: string;
|
|
2167
|
+
/** The share page, a signed `usercontent.b3os.org` URL valid until `expires_at`. */
|
|
2168
|
+
url: string;
|
|
2169
|
+
/** An `<iframe>` of the page, 960 wide at the video's aspect ratio, ready to paste. */
|
|
2170
|
+
embed_html: string;
|
|
2171
|
+
/** The video's width in pixels. */
|
|
2172
|
+
width: number;
|
|
2173
|
+
/** The video's height in pixels. */
|
|
2174
|
+
height: number;
|
|
2175
|
+
created_at: string;
|
|
2176
|
+
/** When the page and its link end (the MP4's own expiry). */
|
|
2177
|
+
expires_at: string;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
1393
2180
|
export interface VideoResult {
|
|
1394
2181
|
duration_ms: number;
|
|
1395
2182
|
width: number;
|
|
1396
2183
|
height: number;
|
|
1397
2184
|
fps: number;
|
|
2185
|
+
/**
|
|
2186
|
+
* The MP4 first (when asked for), then the poster, the caption files, the GIF and, when a beat has a title, the chapters file.
|
|
2187
|
+
*/
|
|
1398
2188
|
artifacts: Artifact[];
|
|
1399
2189
|
recording?: RecordingInfo;
|
|
2190
|
+
narration?: NarrationInfo;
|
|
2191
|
+
/**
|
|
2192
|
+
* Non-fatal problems, each starting with a code and a colon: `narration_scope` (the beats' `say` lines were not spoken because the key lacks `infer:run`, which narration needs; the video has no narration track); `page_requests` (requests for the page's code, styles or fonts, or for its own site's data, made while the video was captured, were not in the network recording made when it loaded, so they failed and the video can show a page that did not finish loading; up to three are named, without their query; trackers, beacons and prefetches that fail the same way are not counted); `zoom_soft` (the page drew differently between two parts of the capture and the video could not be captured again whole, so from the time it names on the video comes from a lower device scale and its zooms are softer than the page). A restyle repeats its source's. Absent when there is nothing to say.
|
|
2193
|
+
*/
|
|
2194
|
+
warnings?: string[];
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* Present when the request has `voice` and at least one beat has `say` (a restyle repeats its source's).
|
|
2199
|
+
* `spoken: false` means the narration was not spoken for at least one beat: the key lacks `infer:run`
|
|
2200
|
+
* (`reason` names the scope) or speech synthesis was unavailable. The video still succeeds, has no narration
|
|
2201
|
+
* track, and its word times (step placement, captions) are estimated from the text.
|
|
2202
|
+
*/
|
|
2203
|
+
export interface NarrationInfo {
|
|
2204
|
+
/** True when every beat's narration was synthesized and is in the video's audio. */
|
|
2205
|
+
spoken: boolean;
|
|
2206
|
+
/** Why the narration was not spoken (only when `spoken` is false). */
|
|
2207
|
+
reason?: string;
|
|
1400
2208
|
}
|
|
1401
2209
|
|
|
1402
2210
|
/** A video job (`vid_…`). `progress` counts phases (voice, plan, capture, compose, encode, upload). */
|
|
@@ -1406,6 +2214,12 @@ export type Video = Omit<Job, "id" | "object" | "result"> & {
|
|
|
1406
2214
|
source: VideoSource;
|
|
1407
2215
|
/** The source video when this video is a restyle. */
|
|
1408
2216
|
restyled_from: string | null;
|
|
2217
|
+
/**
|
|
2218
|
+
* Only while `status` is `queued` and the video waits for one of the node's video slots: its place in
|
|
2219
|
+
* the node's queue, `1` for the next video to start. It moves up as videos ahead start or are
|
|
2220
|
+
* canceled, and the field is gone once the video runs.
|
|
2221
|
+
*/
|
|
2222
|
+
queue_position?: number;
|
|
1409
2223
|
result?: VideoResult;
|
|
1410
2224
|
};
|
|
1411
2225
|
|
|
@@ -1414,10 +2228,12 @@ export type VideoList = Omit<ListEnvelope, "data"> & {
|
|
|
1414
2228
|
};
|
|
1415
2229
|
|
|
1416
2230
|
/**
|
|
1417
|
-
* An event of a video's stream. `
|
|
1418
|
-
*
|
|
2231
|
+
* An event of a video's stream. `job.queued` carries `queue_position` when the video waits for a slot (its
|
|
2232
|
+
* place when it was created; the video itself has the current one); `video.phase` carries `phase`;
|
|
2233
|
+
* `video.artifact` carries `artifact` (without a signed URL; fetch the artifact or the video for one).
|
|
1419
2234
|
*/
|
|
1420
2235
|
export type VideoEvent = JobEvent & {
|
|
2236
|
+
queue_position?: number;
|
|
1421
2237
|
phase?: "voice" | "plan" | "capture" | "compose" | "encode" | "upload";
|
|
1422
2238
|
artifact?: Artifact;
|
|
1423
2239
|
};
|
|
@@ -1463,6 +2279,15 @@ export interface RenderTimeline {
|
|
|
1463
2279
|
* @default 1
|
|
1464
2280
|
*/
|
|
1465
2281
|
segments?: number;
|
|
2282
|
+
/**
|
|
2283
|
+
* Device scale factor of the capture (ARCHITECTURE 5.2, orchestrator decision D1): 1 or 2 for every segment, or auto: segments whose zoom plan goes past about 1.2x are captured at 2, the rest at 1. segment_dsf records what each segment got.
|
|
2284
|
+
* @default "auto"
|
|
2285
|
+
*/
|
|
2286
|
+
dsf?: 1 | 2 | "auto";
|
|
2287
|
+
/**
|
|
2288
|
+
* The device scale factor each segment was captured at (index = segment number), written when the capture is planned; a restyle from the archived capture reads it instead of inferring it from image sizes. A page image larger than the page layer by more than 4/3 is box-halved by the compositor before resampling.
|
|
2289
|
+
*/
|
|
2290
|
+
segment_dsf?: Array<1 | 2>;
|
|
1466
2291
|
};
|
|
1467
2292
|
/** Composed video. Output frame index i is presented at t = round(i * 1e6 / fps) us. */
|
|
1468
2293
|
output: {
|
|
@@ -1488,7 +2313,7 @@ export interface RenderTimeline {
|
|
|
1488
2313
|
captions?: RenderTimelinePresetRef;
|
|
1489
2314
|
click_effect?: RenderTimelinePresetRef;
|
|
1490
2315
|
/**
|
|
1491
|
-
* Style fields that override the presets, validated by b3os-compose against its Style type (NOTES/render-compose.md 1.1): padding, corner_radius, shadow, border, background_color, background_gradient, aspect_ratio, canvas, fit, frame_title, frame_url, theme, cursor_size, cursor_zoom, click_color, click_duration_ms, caption_size, caption_color, caption_highlight, caption_background, caption_position, motion_blur, matte. Unknown keys and bad values are refused with 422 style_invalid.
|
|
2316
|
+
* Style fields that override the presets, validated by b3os-compose against its Style type (NOTES/render-compose.md 1.1): padding, corner_radius, shadow, border, background_color, background_gradient, background_ref, background_tokens, aspect_ratio, canvas, fit, frame_title, frame_url, theme, cursor_size, cursor_zoom, click_color, click_duration_ms, caption_size, caption_color, caption_highlight, caption_background, caption_position, motion_blur, matte, text, perspective, perspective_intensity, camera, tilt_x, tilt_y, roll, camera_offset, frame_scale, depth_blur, depth_blur_type, depth_blur_angle, depth_blur_position, depth_blur_band, depth_blur_width, layout (these sixteen for screenshots only). Unknown keys and bad values are refused with 422 style_invalid.
|
|
1492
2317
|
*/
|
|
1493
2318
|
overrides?: Record<string, unknown>;
|
|
1494
2319
|
};
|
|
@@ -1556,7 +2381,7 @@ export interface RenderTimeline {
|
|
|
1556
2381
|
* Per capture frame: the viewport region to capture. Sent to the recorder for each segment. Frames not listed are not captured.
|
|
1557
2382
|
*/
|
|
1558
2383
|
capture_plan?: RenderTimelineCaptureFrame[];
|
|
1559
|
-
/** Optional FrameState dump (debugging, tests, GET .../timeline?frames=
|
|
2384
|
+
/** Optional FrameState dump (debugging, tests, GET .../timeline?frames=true). */
|
|
1560
2385
|
frames?: RenderTimelineFrameState[];
|
|
1561
2386
|
}
|
|
1562
2387
|
|
|
@@ -1630,6 +2455,14 @@ export interface RenderTimelineObservation {
|
|
|
1630
2455
|
scroll?: RenderTimelinePoint;
|
|
1631
2456
|
/** Virtual time at which a navigate or wait finished. */
|
|
1632
2457
|
settled_us?: RenderTimelineUs;
|
|
2458
|
+
/**
|
|
2459
|
+
* The target sits inside nav, aside or a header bar (or their landmark roles); the camera zooms less there (1.25x).
|
|
2460
|
+
*/
|
|
2461
|
+
landmark?: "nav" | "aside" | "header";
|
|
2462
|
+
/**
|
|
2463
|
+
* Page time the action ran the page clock ahead of the timeline, off camera: a client-side route its click opened drawing (its code, its data, a Suspense delay), or a wait whose condition held after a timer. Capture passes run exactly as far ahead. Absent when 0.
|
|
2464
|
+
*/
|
|
2465
|
+
ahead_us?: RenderTimelineUs;
|
|
1633
2466
|
error?: {
|
|
1634
2467
|
code: string;
|
|
1635
2468
|
detail?: string;
|
|
@@ -1747,6 +2580,10 @@ export interface RenderTimelineCue {
|
|
|
1747
2580
|
byte_start: number;
|
|
1748
2581
|
byte_end: number;
|
|
1749
2582
|
}[];
|
|
2583
|
+
/**
|
|
2584
|
+
* Where this cue is drawn when it is not where the caption style puts it: the director moves a cue off the target a step clicks while it shows.
|
|
2585
|
+
*/
|
|
2586
|
+
position?: "top" | "bottom";
|
|
1750
2587
|
}
|
|
1751
2588
|
|
|
1752
2589
|
/**
|
|
@@ -1795,6 +2632,8 @@ export interface RenderTimelineFrameState {
|
|
|
1795
2632
|
byte_start: number;
|
|
1796
2633
|
byte_end: number;
|
|
1797
2634
|
};
|
|
2635
|
+
/** The cue's own position, over the caption style's. */
|
|
2636
|
+
position?: "top" | "bottom";
|
|
1798
2637
|
};
|
|
1799
2638
|
/**
|
|
1800
2639
|
* Opacity of the window layer (page, frame chrome, shadow, border, cursor, click effects) over the background; the background and the caption stay opaque.
|
|
@@ -1828,6 +2667,124 @@ export type PresetList = Omit<ListEnvelope, "data"> & {
|
|
|
1828
2667
|
data: Preset[];
|
|
1829
2668
|
};
|
|
1830
2669
|
|
|
2670
|
+
/** A library background. Name it in a style with `overrides.background_ref` (as `style` shows). */
|
|
2671
|
+
export interface RenderBackground {
|
|
2672
|
+
/** `<pack>/<slug>`, the value of `overrides.background_ref`. */
|
|
2673
|
+
ref: string;
|
|
2674
|
+
object: "render.background";
|
|
2675
|
+
/**
|
|
2676
|
+
* `css`: drawn by the compositor from gradient layers. `procedural`: one of our own studio meshes (pack `studio`), computed in float, dithered, with 1% grain on stills; the set `style: {}` picks from carries the tag `auto`. `image`: a stored WebP (see `image`).
|
|
2677
|
+
*/
|
|
2678
|
+
kind: "css" | "procedural" | "image";
|
|
2679
|
+
pack: string;
|
|
2680
|
+
slug: string;
|
|
2681
|
+
name: string;
|
|
2682
|
+
description?: string;
|
|
2683
|
+
theme: "light" | "dark";
|
|
2684
|
+
tags: string[];
|
|
2685
|
+
/** The main colors, as the source lists them (images, the five most common, most common first). */
|
|
2686
|
+
palette: string[];
|
|
2687
|
+
/**
|
|
2688
|
+
* Color tokens and their defaults; `overrides.background_tokens` sets new colors for them. Empty for images.
|
|
2689
|
+
*/
|
|
2690
|
+
tokens: Record<string, string>;
|
|
2691
|
+
/**
|
|
2692
|
+
* `MIT`, `own` (B3OS's own work) or a written grant recorded in B3OS's decisions, such as `grant: Sean, decision T9 (2026-11-02)`.
|
|
2693
|
+
*/
|
|
2694
|
+
license: string;
|
|
2695
|
+
/**
|
|
2696
|
+
* Where the background comes from. `name` says it in text; `url`, `path` and `commit` are there only for a
|
|
2697
|
+
* public upstream (Pattern Craft's repository). Sean Geng's own projects (littledemo, ScreenFramed) are
|
|
2698
|
+
* named, never linked. `id` is the entry's id at the source.
|
|
2699
|
+
*/
|
|
2700
|
+
source: {
|
|
2701
|
+
name: string;
|
|
2702
|
+
url?: string;
|
|
2703
|
+
path?: string;
|
|
2704
|
+
commit?: string;
|
|
2705
|
+
id?: string;
|
|
2706
|
+
};
|
|
2707
|
+
/**
|
|
2708
|
+
* A 360x200 WebP on B3OS's own host: drawn by the compositor for CSS backgrounds
|
|
2709
|
+
* (`https://beta.b3os.org/assets/presets/library/`), a cover crop of the stored file for images
|
|
2710
|
+
* (`https://beta.b3os.org/gallery/_library/thumbs/`).
|
|
2711
|
+
*/
|
|
2712
|
+
thumbnail_url: string;
|
|
2713
|
+
image?: RenderBackgroundImage;
|
|
2714
|
+
/** The `style` value that draws this background. */
|
|
2715
|
+
style: {
|
|
2716
|
+
overrides: {
|
|
2717
|
+
background_ref: string;
|
|
2718
|
+
};
|
|
2719
|
+
};
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
/**
|
|
2723
|
+
* An image background's file and measured tone (CSS backgrounds have none). Tone is measured on a 16:9 cover
|
|
2724
|
+
* crop, over the matte for transparent shapes: `luminance` is the mean WCAG relative luminance, `hue` and
|
|
2725
|
+
* `chroma` OKLCH (no `hue` for grey or many-hued images), `detail` the mean Sobel edge strength (0 to 1; quiet
|
|
2726
|
+
* gradients are about 0.015, busy textures above 0.07).
|
|
2727
|
+
*/
|
|
2728
|
+
export interface RenderBackgroundImage {
|
|
2729
|
+
/** The lossless WebP on B3OS's own host, named by its sha256 (cached as immutable). */
|
|
2730
|
+
url: string;
|
|
2731
|
+
width: number;
|
|
2732
|
+
height: number;
|
|
2733
|
+
bytes: number;
|
|
2734
|
+
sha256: string;
|
|
2735
|
+
group: "backgrounds" | "gradients";
|
|
2736
|
+
coverage: "full-bleed" | "partial" | "cutout" | "sliver";
|
|
2737
|
+
/** Mean color of the crop, `#rrggbb`. */
|
|
2738
|
+
mean: string;
|
|
2739
|
+
luminance: number;
|
|
2740
|
+
/** Absent for grey or many-hued images. */
|
|
2741
|
+
hue?: number;
|
|
2742
|
+
chroma: number;
|
|
2743
|
+
detail: number;
|
|
2744
|
+
/** Whether `background_ref: "auto"` may pick it. */
|
|
2745
|
+
auto: boolean;
|
|
2746
|
+
/** One of the hand-picked images, with its label, collection and place in the picked order. */
|
|
2747
|
+
featured?: {
|
|
2748
|
+
label: string;
|
|
2749
|
+
collection: string;
|
|
2750
|
+
rank: number;
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2754
|
+
export type RenderBackgroundList = Omit<ListEnvelope, "data"> & {
|
|
2755
|
+
data: RenderBackground[];
|
|
2756
|
+
};
|
|
2757
|
+
|
|
2758
|
+
export interface RenderBackgroundPack {
|
|
2759
|
+
pack: string;
|
|
2760
|
+
object: "render.background_pack";
|
|
2761
|
+
name: string;
|
|
2762
|
+
kind: "css" | "procedural" | "image";
|
|
2763
|
+
count: number;
|
|
2764
|
+
themes: Array<"light" | "dark">;
|
|
2765
|
+
license: string;
|
|
2766
|
+
/** The attribution the license asks for. */
|
|
2767
|
+
notice?: string;
|
|
2768
|
+
/**
|
|
2769
|
+
* The upstream's public URL, or text naming the source when it has none (Sean Geng's own projects are named, never linked).
|
|
2770
|
+
*/
|
|
2771
|
+
source: string;
|
|
2772
|
+
cover_thumbnail_url: string;
|
|
2773
|
+
/** Image packs, the `ref` the cover shows. */
|
|
2774
|
+
cover?: string;
|
|
2775
|
+
/** Image packs, ScreenFramed's group. */
|
|
2776
|
+
group?: "backgrounds" | "gradients";
|
|
2777
|
+
/** Image packs, how the pack reads behind a screenshot (a hand review). */
|
|
2778
|
+
look?: "quiet" | "bold" | "soft-photo" | "texture" | "scenic" | "loud" | "cutout";
|
|
2779
|
+
/** Image packs, whether `background_ref: "auto"` may pick from it. */
|
|
2780
|
+
auto?: boolean;
|
|
2781
|
+
note?: string;
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
export type RenderBackgroundPackList = Omit<ListEnvelope, "data"> & {
|
|
2785
|
+
data: RenderBackgroundPack[];
|
|
2786
|
+
};
|
|
2787
|
+
|
|
1831
2788
|
/**
|
|
1832
2789
|
* `running` → `paused` ↔ `running` → `stopped`. `failed` means the microVM crashed; its usage is final.
|
|
1833
2790
|
*/
|
|
@@ -1880,7 +2837,10 @@ export interface SandboxApiGrant {
|
|
|
1880
2837
|
/**
|
|
1881
2838
|
* Where sandbox traffic may go, enforced by the node's egress guard. `public` (default): any public internet
|
|
1882
2839
|
* address. `allowlist`: only hosts matching `allow` (exact hosts or `*.` wildcards). `deny`: no outbound
|
|
1883
|
-
* network at all. Private, loopback, tailnet and metadata addresses are always refused.
|
|
2840
|
+
* network at all. Private, loopback, tailnet and metadata addresses are always refused. Without `egress`, a
|
|
2841
|
+
* sandbox created by code in another sandbox gets that sandbox's policy, and a policy within it is the most
|
|
2842
|
+
* such code can ask for (`403 forbidden`, `reason: egress_escalation`), and it gets no public port unless that
|
|
2843
|
+
* sandbox's egress is `public`. A sandbox has at most
|
|
1884
2844
|
* 512 outbound connections open and 64 DNS queries in flight at once; past that, new connections are refused
|
|
1885
2845
|
* (`egress_unavailable`) and queries answered `SERVFAIL`. When the sandbox stops, its outbound connections
|
|
1886
2846
|
* and its connections to `http://127.0.0.1:7700` close at once.
|
|
@@ -1900,11 +2860,20 @@ export interface SandboxCreateRequest {
|
|
|
1900
2860
|
/** Restore this snapshot instead of starting from a template. */
|
|
1901
2861
|
snapshot?: string;
|
|
1902
2862
|
/**
|
|
1903
|
-
* Virtual CPUs
|
|
1904
|
-
*
|
|
2863
|
+
* Virtual CPUs; defaults to the template's (`defaults.vcpu`), at most your plan's `sandboxes.vcpu_max`.
|
|
2864
|
+
* A microVM cannot change its vCPU count, so sandboxes come from pools per size: a create at one of the
|
|
2865
|
+
* template's `size_classes` claims a pre-warmed microVM, any other size is restored on demand (a pool
|
|
2866
|
+
* miss: tens of milliseconds, plus about two seconds the first time a node sees that size). A node
|
|
2867
|
+
* builds at most 4 new off-class sizes per organization and hour; past that, a create at a size the node
|
|
2868
|
+
* has not built yet is refused with `429 rate_limited` (`limit.id` `sandboxes.offclass_builds`,
|
|
2869
|
+
* `Retry-After`), while sizes it has built and the size classes are not.
|
|
1905
2870
|
*/
|
|
1906
2871
|
vcpu?: number;
|
|
1907
|
-
/**
|
|
2872
|
+
/**
|
|
2873
|
+
* Memory; defaults to the template's (`defaults.memory_mib`), at most your plan's `sandboxes.memory_max`.
|
|
2874
|
+
* Rounded up to 128 MiB or a multiple of 256 MiB (the sandbox's `memory_mib` says what it got, and
|
|
2875
|
+
* memory is billed at that size). See `vcpu` for size classes.
|
|
2876
|
+
*/
|
|
1908
2877
|
memory_mib?: number;
|
|
1909
2878
|
/** Disk size; defaults to the template's. */
|
|
1910
2879
|
disk_gib?: number;
|
|
@@ -1920,7 +2889,14 @@ export interface SandboxCreateRequest {
|
|
|
1920
2889
|
on_idle?: "stop" | "pause";
|
|
1921
2890
|
/** Environment variables. Returned as given; put credentials in `secrets`. */
|
|
1922
2891
|
env?: Record<string, string>;
|
|
1923
|
-
/**
|
|
2892
|
+
/**
|
|
2893
|
+
* Environment variables whose values are never returned by the API and never logged (the sandbox object
|
|
2894
|
+
* lists only their names in `secret_names`). They are not hidden from the sandbox itself: every process
|
|
2895
|
+
* in it gets them in its environment, so any code you run there can read them, and so can anything that
|
|
2896
|
+
* code sends them to. Give a sandbox only secrets the code you run in it may hold. (Injecting a
|
|
2897
|
+
* credential at the node's egress proxy, so that the value never enters the sandbox, is planned, not
|
|
2898
|
+
* available.)
|
|
2899
|
+
*/
|
|
1924
2900
|
secrets?: Record<string, SecretValue>;
|
|
1925
2901
|
ports?: SandboxPort[];
|
|
1926
2902
|
api?: SandboxApiGrant;
|
|
@@ -1930,9 +2906,89 @@ export interface SandboxCreateRequest {
|
|
|
1930
2906
|
* @default false
|
|
1931
2907
|
*/
|
|
1932
2908
|
forkable?: boolean;
|
|
2909
|
+
readiness?: ReadinessProbe;
|
|
2910
|
+
/**
|
|
2911
|
+
* Read only when `snapshot` is set; a create from a template ignores it and resets the template's Chrome
|
|
2912
|
+
* only where the node's image of that template has the reset. What happens to the random state of processes
|
|
2913
|
+
* that were running when the snapshot was taken, at the start of this sandbox (the option
|
|
2914
|
+
* `sandboxes.clone_reset`). A restored sandbox gets a fresh identity
|
|
2915
|
+
* and the kernel's random pool is reseeded, but a process running at the snapshot keeps its own
|
|
2916
|
+
* generators' state, which every sandbox started from that snapshot shares with the others and with the
|
|
2917
|
+
* source. The `browser` template's Chrome is the process this covers:
|
|
2918
|
+
* - `full`: its renderers and network service are replaced at the start, so `Math.random`,
|
|
2919
|
+
* `crypto.getRandomValues` and WebSocket keys are fresh. The tabs that were open at the snapshot are
|
|
2920
|
+
* closed and their connections dropped; the sandbox's Chrome has one new `about:blank` page.
|
|
2921
|
+
* - `none`: Chrome runs on as the snapshot had it, tabs and page state kept, its generators shared with the
|
|
2922
|
+
* source.
|
|
2923
|
+
*
|
|
2924
|
+
* Other processes running at the snapshot (a browser you started yourself, an interpreter) keep their
|
|
2925
|
+
* state either way; reseed or restart them. The code-interpreter kernel is reseeded on every start.
|
|
2926
|
+
* Default: the node's (`full` on the beta node). A value the node does not allow is refused with `422
|
|
2927
|
+
* option_not_allowed`. The reset runs in the snapshot's guest agent, and `full` is reported only when the
|
|
2928
|
+
* agent says it replaced Chrome: when this node's image of the template or the snapshot's agent predates
|
|
2929
|
+
* the option, `full` is refused with `409 guest_outdated` before the sandbox starts, and a start at which
|
|
2930
|
+
* the agent replaced none of Chrome's processes fails with `500 internal` and leaves no sandbox (retry, or
|
|
2931
|
+
* ask for `none`). The sandbox's `options` reports the value and where it came from, as does the
|
|
2932
|
+
* `X-B3OS-Options` header.
|
|
2933
|
+
*/
|
|
2934
|
+
clone_reset?: "full" | "none";
|
|
1933
2935
|
metadata?: Metadata;
|
|
1934
2936
|
}
|
|
1935
2937
|
|
|
2938
|
+
/**
|
|
2939
|
+
* When the sandbox counts as ready: a TCP port inside it accepting connections (`port`), or a command that
|
|
2940
|
+
* exits 0 (`cmd`, run as `user` with a 5 s limit per try). Set exactly one. The node tries it every
|
|
2941
|
+
* `interval_ms` from the moment it is set until it passes or `timeout_s` runs out; the sandbox's `readiness`
|
|
2942
|
+
* reports the result and `POST /v1/sandboxes/{sandbox_id}/ready` waits for it. Probing goes on across a
|
|
2943
|
+
* restart of the node's daemon, within the same `timeout_s`; `attempts` counts the tries since the daemon
|
|
2944
|
+
* last recorded a change of `status`, so it can start again from a lower number after such a restart.
|
|
2945
|
+
*/
|
|
2946
|
+
export interface ReadinessProbe {
|
|
2947
|
+
port?: number;
|
|
2948
|
+
/** A shell command line (run with `/bin/sh -c`) or an argv array. */
|
|
2949
|
+
cmd?: string | string[];
|
|
2950
|
+
/** @default 10 */
|
|
2951
|
+
interval_ms?: number;
|
|
2952
|
+
/** @default 60 */
|
|
2953
|
+
timeout_s?: number;
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
export interface Readiness {
|
|
2957
|
+
/** `failed`: the probe did not pass within its `timeout_s`, or the sandbox stopped first. */
|
|
2958
|
+
status: "pending" | "ready" | "failed";
|
|
2959
|
+
probe: ReadinessProbe;
|
|
2960
|
+
attempts: number;
|
|
2961
|
+
ready_at: string | null;
|
|
2962
|
+
/** From the create's start (or from when the probe was set) to the first passing try. */
|
|
2963
|
+
time_to_ready_ms: number | null;
|
|
2964
|
+
/** Why the last failing try failed. */
|
|
2965
|
+
last_error: string | null;
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
/** Optionally a new probe for the sandbox (replacing its earlier one), and how long to wait. */
|
|
2969
|
+
export interface ReadinessWaitRequest {
|
|
2970
|
+
/** @default 30000 */
|
|
2971
|
+
wait_ms?: number;
|
|
2972
|
+
port?: number;
|
|
2973
|
+
cmd?: string | string[];
|
|
2974
|
+
interval_ms?: number;
|
|
2975
|
+
timeout_s?: number;
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
export interface ReadinessResult {
|
|
2979
|
+
object: "readiness";
|
|
2980
|
+
sandbox_id: string;
|
|
2981
|
+
/** `pending`: `wait_ms` passed first; ask again. */
|
|
2982
|
+
status: "pending" | "ready" | "failed";
|
|
2983
|
+
probe: ReadinessProbe;
|
|
2984
|
+
attempts: number;
|
|
2985
|
+
ready_at: string | null;
|
|
2986
|
+
time_to_ready_ms: number | null;
|
|
2987
|
+
last_error: string | null;
|
|
2988
|
+
/** How long this call waited. */
|
|
2989
|
+
waited_ms: number;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
1936
2992
|
export interface TemplateRef {
|
|
1937
2993
|
id: string;
|
|
1938
2994
|
name: string;
|
|
@@ -1961,7 +3017,8 @@ export interface Sandbox {
|
|
|
1961
3017
|
public: boolean;
|
|
1962
3018
|
/**
|
|
1963
3019
|
* Public ports: the long-lived preview URL, token included. Private ports: `null`; mint a URL with
|
|
1964
|
-
* `POST /v1/sandboxes/{sandbox_id}/ports/{port}/url`.
|
|
3020
|
+
* `POST /v1/sandboxes/{sandbox_id}/ports/{port}/url`. Also `null` when code in another sandbox reads
|
|
3021
|
+
* this sandbox and this sandbox is not within that sandbox's reach (`sandboxesCreateSandbox`).
|
|
1965
3022
|
*/
|
|
1966
3023
|
url: string | null;
|
|
1967
3024
|
}[];
|
|
@@ -1980,16 +3037,42 @@ export interface Sandbox {
|
|
|
1980
3037
|
started_at: string;
|
|
1981
3038
|
paused_at: string | null;
|
|
1982
3039
|
stopped_at: string | null;
|
|
1983
|
-
/**
|
|
1984
|
-
|
|
3040
|
+
/**
|
|
3041
|
+
* Why the sandbox stopped: `deleted`, `timeout` (it reached `expires_at`), `failed` (the microVM crashed),
|
|
3042
|
+
* `budget` (while it ran, its organization was suspended or ran out of credits, or the creating key or
|
|
3043
|
+
* the sandbox's own `api.spend_cap_usd` reached its cap; the node checks every 10 s) or `revoked` (the key
|
|
3044
|
+
* that created it was revoked).
|
|
3045
|
+
*/
|
|
3046
|
+
stop_reason: "deleted" | "timeout" | "failed" | "budget" | "revoked" | null;
|
|
1985
3047
|
usage: {
|
|
1986
3048
|
vcpu_ms: number;
|
|
1987
3049
|
gib_ms: number;
|
|
3050
|
+
/**
|
|
3051
|
+
* Present, and `true`, when `vcpu_ms` is short of the CPU the sandbox used: the node could not read
|
|
3052
|
+
* the microVM's CPU counter when metering began or at its last sample. What was not read is not
|
|
3053
|
+
* billed. Absent when the figure is whole.
|
|
3054
|
+
*/
|
|
3055
|
+
vcpu_unmetered?: boolean;
|
|
1988
3056
|
};
|
|
3057
|
+
/** The readiness probe and what it found; `null` when the sandbox has none. */
|
|
3058
|
+
readiness?: null | Readiness;
|
|
3059
|
+
options: SandboxOptions;
|
|
1989
3060
|
timing?: Timing;
|
|
1990
3061
|
metadata: Metadata;
|
|
1991
3062
|
}
|
|
1992
3063
|
|
|
3064
|
+
/**
|
|
3065
|
+
* The options this sandbox started with, each with its `value` and the level it came from (`from`: `request`
|
|
3066
|
+
* when the create or fork asked for it, `node` for the node's default). Always present; `{}` for a sandbox
|
|
3067
|
+
* started from a template, which reads none. A fork reports its own value, not its source's.
|
|
3068
|
+
*/
|
|
3069
|
+
export interface SandboxOptions {
|
|
3070
|
+
"sandboxes.clone_reset"?: {
|
|
3071
|
+
value: "full" | "none";
|
|
3072
|
+
from: "request" | "node";
|
|
3073
|
+
};
|
|
3074
|
+
}
|
|
3075
|
+
|
|
1993
3076
|
export type SandboxList = Omit<ListEnvelope, "data"> & {
|
|
1994
3077
|
data: Sandbox[];
|
|
1995
3078
|
};
|
|
@@ -2001,6 +3084,29 @@ export interface TimeoutRequest {
|
|
|
2001
3084
|
export interface ForkRequest {
|
|
2002
3085
|
/** @default 1 */
|
|
2003
3086
|
count?: number;
|
|
3087
|
+
/**
|
|
3088
|
+
* What happens to the random state of processes that were running when the snapshot was taken, at the
|
|
3089
|
+
* start of each fork (the option `sandboxes.clone_reset`). A restored sandbox gets a fresh identity
|
|
3090
|
+
* and the kernel's random pool is reseeded, but a process running at the snapshot keeps its own
|
|
3091
|
+
* generators' state, which every fork of the call shares with the others and with the source (the
|
|
3092
|
+
* source itself is never reset). The `browser` template's Chrome is the process this covers:
|
|
3093
|
+
* - `full`: its renderers and network service are replaced at the start, so `Math.random`,
|
|
3094
|
+
* `crypto.getRandomValues` and WebSocket keys are fresh. The tabs that were open at the snapshot are
|
|
3095
|
+
* closed and their connections dropped; the sandbox's Chrome has one new `about:blank` page.
|
|
3096
|
+
* - `none`: Chrome runs on as the snapshot had it, tabs and page state kept, its generators shared with the
|
|
3097
|
+
* source.
|
|
3098
|
+
*
|
|
3099
|
+
* Other processes running at the snapshot (a browser you started yourself, an interpreter) keep their
|
|
3100
|
+
* state either way; reseed or restart them. The code-interpreter kernel is reseeded on every start.
|
|
3101
|
+
* Default: the node's (`full` on the beta node), not the source's. A value the node does not allow is
|
|
3102
|
+
* refused with `422 option_not_allowed`. The reset runs in each fork's guest agent, the source's copied,
|
|
3103
|
+
* and `full` is reported only when the agent says it replaced Chrome: when this node's image of the
|
|
3104
|
+
* template or the source's agent predates the option, `full` is refused with `409 guest_outdated` before
|
|
3105
|
+
* the source is paused, and a fork whose agent replaced none of Chrome's processes fails the call with
|
|
3106
|
+
* `500 internal`, no fork left (retry, or ask for `none`). Each fork's `options` reports the value and
|
|
3107
|
+
* where it came from, as does the `X-B3OS-Options` header.
|
|
3108
|
+
*/
|
|
3109
|
+
clone_reset?: "full" | "none";
|
|
2004
3110
|
metadata?: Metadata;
|
|
2005
3111
|
}
|
|
2006
3112
|
|
|
@@ -2014,8 +3120,7 @@ export interface ExecRequest {
|
|
|
2014
3120
|
/** Written to the command's standard input, which is then closed. */
|
|
2015
3121
|
stdin?: string;
|
|
2016
3122
|
/**
|
|
2017
|
-
* Kill the command after this long. At most 60000 unless the output is streamed or the command runs in the background.
|
|
2018
|
-
* @default 30000
|
|
3123
|
+
* Kill the command after this long. Default 30000, or none in the background. At most 60000 unless the output is streamed or the command runs in the background.
|
|
2019
3124
|
*/
|
|
2020
3125
|
timeout_ms?: number;
|
|
2021
3126
|
/**
|
|
@@ -2044,7 +3149,7 @@ export interface ExecResult {
|
|
|
2044
3149
|
}
|
|
2045
3150
|
|
|
2046
3151
|
/**
|
|
2047
|
-
* `exec.stdout` and `exec.stderr` carry `data`; `exec.exit` carries `exit_code`, `signal`, `timed_out` and `duration_ms
|
|
3152
|
+
* `exec.stdout` and `exec.stderr` carry `data`; `exec.exit` carries `exit_code`, `signal`, `timed_out` and `duration_ms`, and `error` (`code`, `detail`; `reason: egress_escalation` for a command cut because the sandbox left the reach of the sandbox the call came from) when the command could not run to its end.
|
|
2048
3153
|
*/
|
|
2049
3154
|
export type ExecEvent = JobEvent & {
|
|
2050
3155
|
data?: string;
|
|
@@ -2132,6 +3237,36 @@ export interface FileEntry {
|
|
|
2132
3237
|
target?: string;
|
|
2133
3238
|
}
|
|
2134
3239
|
|
|
3240
|
+
export interface FileDeleted {
|
|
3241
|
+
/** The path as the request gave it. */
|
|
3242
|
+
path: string;
|
|
3243
|
+
/** What was at the path. */
|
|
3244
|
+
type: "file" | "directory" | "symlink";
|
|
3245
|
+
deleted: true;
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
export interface MoveFileRequest {
|
|
3249
|
+
/** Absolute path of the file or directory to move. */
|
|
3250
|
+
from: string;
|
|
3251
|
+
/** Absolute path it moves to. */
|
|
3252
|
+
to: string;
|
|
3253
|
+
/**
|
|
3254
|
+
* Replace an existing file at `to` (or an empty directory, when `from` is a directory).
|
|
3255
|
+
* @default false
|
|
3256
|
+
*/
|
|
3257
|
+
overwrite?: boolean;
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
export interface MakeDirectoryRequest {
|
|
3261
|
+
/** Absolute path of the directory. */
|
|
3262
|
+
path: string;
|
|
3263
|
+
/**
|
|
3264
|
+
* Octal mode of the directory (the umask does not apply). Parents it creates get `0755`.
|
|
3265
|
+
* @default "0755"
|
|
3266
|
+
*/
|
|
3267
|
+
mode?: string;
|
|
3268
|
+
}
|
|
3269
|
+
|
|
2135
3270
|
export type FileEntryList = Omit<ListEnvelope, "data"> & {
|
|
2136
3271
|
data: FileEntry[];
|
|
2137
3272
|
};
|
|
@@ -2163,6 +3298,9 @@ export interface Snapshot {
|
|
|
2163
3298
|
id: string;
|
|
2164
3299
|
object: "snapshot";
|
|
2165
3300
|
name?: string | null;
|
|
3301
|
+
/**
|
|
3302
|
+
* `ready` once the snapshot's files are on the node's disk. `failed` after a restore found them damaged (`409 snapshot_damaged`); a failed snapshot cannot be restored.
|
|
3303
|
+
*/
|
|
2166
3304
|
status: "creating" | "ready" | "failed";
|
|
2167
3305
|
sandbox_id: string;
|
|
2168
3306
|
template: TemplateRef;
|
|
@@ -2198,6 +3336,15 @@ export interface Template {
|
|
|
2198
3336
|
memory_mib: number;
|
|
2199
3337
|
disk_gib: number;
|
|
2200
3338
|
};
|
|
3339
|
+
/**
|
|
3340
|
+
* The sizes this node keeps pre-warmed microVMs of: the template's default size first, then at most one
|
|
3341
|
+
* larger class. A create at one of them claims a parked microVM; any other size (within your plan) is
|
|
3342
|
+
* restored on demand, a pool miss.
|
|
3343
|
+
*/
|
|
3344
|
+
size_classes: {
|
|
3345
|
+
vcpu: number;
|
|
3346
|
+
memory_mib: number;
|
|
3347
|
+
}[];
|
|
2201
3348
|
created_at: string;
|
|
2202
3349
|
}
|
|
2203
3350
|
|
|
@@ -2212,7 +3359,7 @@ export interface RoutineDefinition {
|
|
|
2212
3359
|
/** Optional pointer to this schema for editors. */
|
|
2213
3360
|
$schema?: string;
|
|
2214
3361
|
/**
|
|
2215
|
-
* Routine slug, unique within the project. Used by the CLI (b3os routine deploy); an MCP server that lists routines as tools names the tool routine_<name> with - mapped to _. runs, hooks, validate and import are reserved: they are API paths under /v1/routines.
|
|
3362
|
+
* Routine slug, unique within the project. Used by the CLI (b3os routine deploy); an MCP server that lists routines as tools names the tool routine_<name> with - mapped to _. runs, hooks, waits, events, validate and import are reserved: they are API paths under /v1/routines.
|
|
2216
3363
|
*/
|
|
2217
3364
|
name: string;
|
|
2218
3365
|
/** What the routine does; an MCP server that lists routines as tools uses it as the tool description. */
|
|
@@ -2239,12 +3386,12 @@ export interface RoutineDefinition {
|
|
|
2239
3386
|
triggers?: RoutineDefinitionTrigger[];
|
|
2240
3387
|
defaults?: {
|
|
2241
3388
|
/**
|
|
2242
|
-
* ephemeral:
|
|
3389
|
+
* ephemeral: nothing journaled while it runs (the agent tool-call fast path; a crash loses the run), and once it ends only its summary is stored (status, timing, input, result, error; no step history). standard: group-commit journal, effects durable before dependents run. strict: intent and result commits for every effect step (ARCHITECTURE 4.9, 5.4). A run may request a different tier at start.
|
|
2243
3390
|
* @default "standard"
|
|
2244
3391
|
*/
|
|
2245
3392
|
durability?: "ephemeral" | "standard" | "strict";
|
|
2246
3393
|
/**
|
|
2247
|
-
* Default timeout for uses and map steps that do not set timeout_ms. Wait and sleep steps are not affected.
|
|
3394
|
+
* Default timeout for uses and map steps that do not set timeout_ms. Wait and sleep steps are not affected. A job step (a product callable of kind job, such as render/video@1) that sets neither gets its operation's timeout instead (one hour for every job callable today).
|
|
2248
3395
|
* @default 30000
|
|
2249
3396
|
*/
|
|
2250
3397
|
timeout_ms?: number;
|
|
@@ -2267,6 +3414,11 @@ export interface RoutineDefinition {
|
|
|
2267
3414
|
*/
|
|
2268
3415
|
on_limit?: "queue" | "skip" | "cancel_running";
|
|
2269
3416
|
};
|
|
3417
|
+
/**
|
|
3418
|
+
* Pause the existing sandboxes a run execs in (sandboxes/exec@1 with sandbox) while it waits long (a wait or sleep of at least the node's pause_sandboxes_after_ms, 30 s by default, or a signal wait without a deadline) and nothing else of it runs: a paused sandbox bills no CPU. The run's next exec there resumes it first, and the end of the run resumes it. A sandbox another active run on the node execs in is not paused, and another run's exec resumes it first; anything else using the sandbox (your own processes or agents in it, other clients) is frozen while it is paused, so set this only for sandboxes the routine's runs have to themselves. Needs sandboxes:write on the publishing key.
|
|
3419
|
+
* @default false
|
|
3420
|
+
*/
|
|
3421
|
+
pause_sandboxes?: boolean;
|
|
2270
3422
|
};
|
|
2271
3423
|
steps: RoutineDefinitionStep[];
|
|
2272
3424
|
}
|
|
@@ -2345,6 +3497,10 @@ export type RoutineDefinitionStep = {
|
|
|
2345
3497
|
* Pack action steps only: binds the pack's connection keys to vault connections. A key left out is resolved when the step runs with SecretStore::find_connection (the most recently created connection for that pack the run's principal may use); when there is none the step fails with connection_required. Bind explicitly when a project holds several.
|
|
2346
3498
|
*/
|
|
2347
3499
|
connections?: Record<string, RoutineDefinitionConnectionRef>;
|
|
3500
|
+
/**
|
|
3501
|
+
* Pack action steps only: the end user the call is made for (ARCHITECTURE 5.5), a literal or a ${{ }} template such as ${{ inputs.user_id }}. Connection keys the step does not bind resolve to that subject's most recent connection for the pack and key, never to another subject's or to one without a subject; a subject with no connection fails the step with connection_required. The evaluated subject is 1 to 256 characters. Without subject, an end user's connection is used only when bound in connections.
|
|
3502
|
+
*/
|
|
3503
|
+
subject?: string;
|
|
2348
3504
|
/**
|
|
2349
3505
|
* Runs steps once per element of over. Inside the body, item is the element and index its position; steps.<id> of a body step refers to the current item. outputs of the map step: {items: [the last body step's outputs per element, null for failed or skipped items], outcomes: [outcome per element]}, both in input order. An item fails when a body step fails without continue_on_error; the first failed item cancels in-flight items and fails the map.
|
|
2350
3506
|
*/
|
|
@@ -2356,14 +3512,35 @@ export type RoutineDefinitionStep = {
|
|
|
2356
3512
|
steps: RoutineDefinitionStep[];
|
|
2357
3513
|
};
|
|
2358
3514
|
/**
|
|
2359
|
-
* Blocks the step without holding resources. {signal}: wait for POST /v1/routines/runs/{run_id}/signal with that name (signals sent before the step starts are buffered, at most 16 per signal name per run, and consumed in order). {signal, ms} or {signal, until}: give up at the deadline. {until}: wait for a time. outputs for signal waits: {signal, payload, received_at, timed_out}; a deadline is not a failure: timed_out is true and signal, payload and received_at are null. outputs for {until}: {fired_at}.
|
|
3515
|
+
* Blocks the step without holding resources. {signal}: wait for POST /v1/routines/runs/{run_id}/signal with that name (signals sent before the step starts are buffered, at most 16 per signal name per run, and consumed in order). {signal, ms} or {signal, until}: give up at the deadline. {until}: wait for a time. {token: true}: a person answers through a signed link, run.wait_urls.<step id>, with no key or login (the signal is the step id unless signal names another). {event, match}: wait for an event sent with POST /v1/routines/events, from anywhere and without the run's ID, whose data holds the match values (not buffered: an event sent before the step waits does not count). outputs for signal waits: {signal, payload, received_at, timed_out}; a deadline is not a failure: timed_out is true and signal, payload and received_at are null. A link answer's payload is {decision: approve or reject, comment, via: link}. outputs for event waits: {event, data, id, received_at, timed_out}. outputs for {until}: {fired_at}.
|
|
2360
3516
|
*/
|
|
2361
3517
|
wait?: {
|
|
2362
3518
|
signal?: string;
|
|
2363
3519
|
/** RFC 3339 timestamp, literal or produced by an expression. */
|
|
2364
3520
|
until?: RoutineDefinitionTemplateString;
|
|
2365
|
-
/** Signal waits only: maximum wait. */
|
|
3521
|
+
/** Signal, token and event waits only: maximum wait. */
|
|
2366
3522
|
ms?: RoutineDefinitionDurationMs;
|
|
3523
|
+
/**
|
|
3524
|
+
* Wait for an event of this name (POST /v1/routines/events) in the run's project whose data holds every match value. Takes ms for a deadline; not with signal, until or token.
|
|
3525
|
+
*/
|
|
3526
|
+
event?: string;
|
|
3527
|
+
/**
|
|
3528
|
+
* Event waits only: values the event's data must hold, by dot path into data (customer.id), compared as JSON. Templates are evaluated when the step starts waiting. Without match, any event of the name answers.
|
|
3529
|
+
*/
|
|
3530
|
+
match?: Record<string, RoutineDefinitionTemplateValue>;
|
|
3531
|
+
/**
|
|
3532
|
+
* Give the wait a signed link a person can answer without a key: run.wait_urls.<step id> in any step's with (send it by Slack, email or a pack action). GET on the link shows a page with the prompt and Approve and Reject; the answer completes the step. The link is bound to this run and step, works once, stops working when the step stops waiting or the run ends, and expires 7 days after the step started waiting. Top-level steps only, and no other wait of the routine may use the same signal name.
|
|
3533
|
+
*/
|
|
3534
|
+
token?: boolean;
|
|
3535
|
+
/**
|
|
3536
|
+
* What the person is asked, shown on the link's page and the run page while the step waits. Evaluated when the step starts waiting (context as for with). title at most 200 characters, body at most 4,000 (plain text, line breaks kept), image an https URL or an object with one (a render artifact such as steps.shot.outputs.artifacts[0]), link an https URL.
|
|
3537
|
+
*/
|
|
3538
|
+
prompt?: {
|
|
3539
|
+
title?: RoutineDefinitionTemplateString;
|
|
3540
|
+
body?: RoutineDefinitionTemplateString;
|
|
3541
|
+
image?: RoutineDefinitionTemplateValue;
|
|
3542
|
+
link?: RoutineDefinitionTemplateString;
|
|
3543
|
+
};
|
|
2367
3544
|
};
|
|
2368
3545
|
/** Durable delay; outputs {}. */
|
|
2369
3546
|
sleep_ms?: RoutineDefinitionDurationMs;
|
|
@@ -2371,7 +3548,9 @@ export type RoutineDefinitionStep = {
|
|
|
2371
3548
|
needs?: RoutineDefinitionIdent[];
|
|
2372
3549
|
if?: RoutineDefinitionCondition;
|
|
2373
3550
|
retry?: RoutineDefinitionRetry;
|
|
2374
|
-
/**
|
|
3551
|
+
/**
|
|
3552
|
+
* uses steps: per attempt; a job step's attempt is its job's create and the wait for its end, and a job still running when it runs out is canceled. map steps: the whole map.
|
|
3553
|
+
*/
|
|
2375
3554
|
timeout_ms?: number;
|
|
2376
3555
|
/**
|
|
2377
3556
|
* When the step fails, its outcome is failure but its conclusion is success, so dependents run and the run can still succeed.
|
|
@@ -2461,19 +3640,34 @@ export type RoutineDefinitionTrigger = {
|
|
|
2461
3640
|
catch_up_window_s?: number;
|
|
2462
3641
|
overlap?: RoutineDefinitionOverlap;
|
|
2463
3642
|
verify?: RoutineDefinitionWebhookVerify;
|
|
3643
|
+
challenge?: RoutineDefinitionWebhookChallenge;
|
|
2464
3644
|
/**
|
|
2465
3645
|
* webhook: string key; a second delivery with the same key within 24 h returns the first delivery's response and starts nothing. Default per scheme: github X-GitHub-Delivery, stripe body.id, slack body.event_id, standard_webhooks webhook-id, b3os the Idempotency-Key header or else the v1 signature, hmac_sha256 none (then dedupe is required).
|
|
2466
3646
|
*/
|
|
2467
3647
|
dedupe?: RoutineDefinitionCelExpression;
|
|
2468
3648
|
};
|
|
2469
3649
|
|
|
3650
|
+
/**
|
|
3651
|
+
* webhook only: answer a provider's GET verification request, such as Meta's hub.challenge with hub.verify_token or Dropbox's challenge. GET /v1/routines/hooks/{hk_id}?<param>=<value>&<token_param>=<verify token> answers 200 text/plain with <value> and starts no run; a missing or wrong token answers 401 webhook_signature_invalid. <value> must be 1-1024 characters of A-Z a-z 0-9 and . _ ~ : + / = -. Without token_param and token_connection any caller gets the echo; the POST deliveries are verified by verify either way.
|
|
3652
|
+
*/
|
|
3653
|
+
export interface RoutineDefinitionWebhookChallenge {
|
|
3654
|
+
/** The query parameter whose value is echoed (hub.challenge, challenge). */
|
|
3655
|
+
param: string;
|
|
3656
|
+
/** The query parameter that carries the verify token (hub.verify_token). */
|
|
3657
|
+
token_param?: string;
|
|
3658
|
+
/**
|
|
3659
|
+
* An api_key vault connection whose api_key field holds the verify token you gave the provider (store it without pack and without hosts, like verify.secret). The token is read from the vault and never appears in the definition. Naming one needs vault:run on top of routines:write.
|
|
3660
|
+
*/
|
|
3661
|
+
token_connection?: string;
|
|
3662
|
+
}
|
|
3663
|
+
|
|
2470
3664
|
/**
|
|
2471
3665
|
* Mandatory verification for POST /v1/routines/hooks/{hk_id} (ARCHITECTURE 4.3); the hk_ id is created when the version is published. b3os: B3OS-Signature 't=<unix>,v1=<hex HMAC-SHA256(secret, "<t>.<body>")>' with a per-hook secret B3OS generates (shown once by the API). github, stripe, slack, standard_webhooks: the provider's scheme as in b3pack verify. hmac_sha256: generic, and always timestamped: the signature covers '<value of timestamp_header>.<body>', and a delivery whose timestamp header is missing or not a Unix time is refused. Timestamped schemes reject deliveries more than tolerance_s (at most 300 s) from the node clock. Secrets never appear in the URL.
|
|
2472
3666
|
*/
|
|
2473
3667
|
export type RoutineDefinitionWebhookVerify = {
|
|
2474
3668
|
scheme: "b3os" | "github" | "stripe" | "slack" | "standard_webhooks" | "hmac_sha256";
|
|
2475
3669
|
/**
|
|
2476
|
-
* An api_key vault connection whose api_key field holds the provider's signing secret (vault.yaml field names). Store it as a verification-only connection, without pack and without hosts: B3OS reads it to check signatures, and a connection with no hosts is never injected into any request. Not used with b3os.
|
|
3670
|
+
* An api_key vault connection whose api_key field holds the provider's signing secret (vault.yaml field names). Store it as a verification-only connection, without pack and without hosts: B3OS reads it to check signatures, and a connection with no hosts is never injected into any request. Naming one needs vault:run on top of routines:write. Not used with b3os.
|
|
2477
3671
|
*/
|
|
2478
3672
|
secret?: string;
|
|
2479
3673
|
header?: string;
|
|
@@ -2538,6 +3732,10 @@ export interface Routine {
|
|
|
2538
3732
|
created_at: string;
|
|
2539
3733
|
updated_at: string;
|
|
2540
3734
|
metadata: Metadata;
|
|
3735
|
+
/**
|
|
3736
|
+
* Present only when something about the active version needs attention. Today: a `product_unavailable` warning at `/triggers/<i>` for each action trigger whose subscription the actions product does not hold yet (it was not running, or answered 5xx or 429, when the version was published). The publish stands, the trigger starts no runs until it is subscribed, and routines retries the subscription every 10 seconds until the actions product takes it; the warning then goes away. A 4xx from the actions product fails the publish with `routine_invalid` instead.
|
|
3737
|
+
*/
|
|
3738
|
+
warnings?: Diagnostic[];
|
|
2541
3739
|
}
|
|
2542
3740
|
|
|
2543
3741
|
export type RoutineList = Omit<ListEnvelope, "data"> & {
|
|
@@ -2601,6 +3799,45 @@ export interface RoutineImport {
|
|
|
2601
3799
|
diagnostics: Diagnostic[];
|
|
2602
3800
|
}
|
|
2603
3801
|
|
|
3802
|
+
export interface HookTestRequest {
|
|
3803
|
+
/** The JSON body to deliver; `trigger.body` of the run it starts. */
|
|
3804
|
+
body?: Record<string, unknown>;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
/** One request to a known hook, as its delivery log keeps it. */
|
|
3808
|
+
export interface HookDeliveryEntry {
|
|
3809
|
+
object: "hook_delivery_entry";
|
|
3810
|
+
hook_id: string;
|
|
3811
|
+
received_at: string;
|
|
3812
|
+
method: "POST" | "GET";
|
|
3813
|
+
/** `edge_replay`: replayed from the edge's queue after the node was down; `test`: `POST …/test`. */
|
|
3814
|
+
source: "provider" | "edge_replay" | "test";
|
|
3815
|
+
/** The HTTP status the hook answered. */
|
|
3816
|
+
status: number;
|
|
3817
|
+
/**
|
|
3818
|
+
* `not_started`: accepted without a run (`if` was false, or the routine is paused); `rejected`: a 4xx; `unavailable`: a 5xx (the edge retries).
|
|
3819
|
+
*/
|
|
3820
|
+
outcome: "started" | "deduplicated" | "not_started" | "handshake" | "rejected" | "unavailable";
|
|
3821
|
+
/** The error code of a 4xx or 5xx. */
|
|
3822
|
+
code: string | null;
|
|
3823
|
+
/** The `reason` of a `webhook_signature_invalid` (`signature` or `timestamp`). */
|
|
3824
|
+
reason: string | null;
|
|
3825
|
+
/** The error's detail (at most 500 characters). */
|
|
3826
|
+
detail: string | null;
|
|
3827
|
+
run_id: string | null;
|
|
3828
|
+
delivery_id: string | null;
|
|
3829
|
+
deduplicated: boolean;
|
|
3830
|
+
handshake: "slack_url_verification" | "slack_ssl_check" | "github_ping" | "get_challenge" | null;
|
|
3831
|
+
/** Body bytes (the body itself is not kept). */
|
|
3832
|
+
size: number;
|
|
3833
|
+
/** The allowlisted request headers it had (values up to 256 characters). */
|
|
3834
|
+
headers: Record<string, string>;
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
export type HookDeliveryEntryList = Omit<ListEnvelope, "data"> & {
|
|
3838
|
+
data: HookDeliveryEntry[];
|
|
3839
|
+
};
|
|
3840
|
+
|
|
2604
3841
|
export interface HookRotateRequest {
|
|
2605
3842
|
/** @default 86400 */
|
|
2606
3843
|
grace_s?: number;
|
|
@@ -2615,7 +3852,7 @@ export interface HookSecret {
|
|
|
2615
3852
|
|
|
2616
3853
|
/** How the run started (the `trigger` context of its expressions). */
|
|
2617
3854
|
export interface RunTrigger {
|
|
2618
|
-
type: "api" | "cron" | "interval" | "webhook" | "action" | "routine";
|
|
3855
|
+
type: "api" | "cron" | "interval" | "webhook" | "action" | "routine" | "replay";
|
|
2619
3856
|
/** The trigger ID (cron, interval, webhook, action). */
|
|
2620
3857
|
id?: string;
|
|
2621
3858
|
/** Cron and interval occurrence, used to deduplicate fires. */
|
|
@@ -2627,9 +3864,11 @@ export interface RunTrigger {
|
|
|
2627
3864
|
subscription_id?: string;
|
|
2628
3865
|
/** The pack trigger event's ID (action triggers). */
|
|
2629
3866
|
event_id?: string;
|
|
2630
|
-
/** For sub-routine runs. */
|
|
3867
|
+
/** For sub-routine runs, the calling run; for replays, the source run. */
|
|
2631
3868
|
parent_run_id?: string;
|
|
2632
3869
|
parent_step_id?: string;
|
|
3870
|
+
/** For replays started with `from_step`, that step. */
|
|
3871
|
+
from_step?: string;
|
|
2633
3872
|
}
|
|
2634
3873
|
|
|
2635
3874
|
export interface StepRun {
|
|
@@ -2639,6 +3878,9 @@ export interface StepRun {
|
|
|
2639
3878
|
/** Position in the map's list, for steps inside a map body. */
|
|
2640
3879
|
item_index?: number;
|
|
2641
3880
|
status: "pending" | "running" | "waiting" | "retrying" | "succeeded" | "failed" | "skipped" | "canceled";
|
|
3881
|
+
/**
|
|
3882
|
+
* The attempt this execution is. Retries add one; so does a node restart while the step ran (the earlier attempt's result, should it arrive, is discarded).
|
|
3883
|
+
*/
|
|
2642
3884
|
attempt: number;
|
|
2643
3885
|
started_at?: string;
|
|
2644
3886
|
finished_at?: string;
|
|
@@ -2653,11 +3895,22 @@ export interface StepRun {
|
|
|
2653
3895
|
failed?: number;
|
|
2654
3896
|
running?: number;
|
|
2655
3897
|
};
|
|
2656
|
-
/**
|
|
3898
|
+
/**
|
|
3899
|
+
* What a waiting step waits for. `token` and `prompt` show in the run's current state (`GET /v1/routines/runs/{run_id}`), not in event snapshots.
|
|
3900
|
+
*/
|
|
2657
3901
|
waiting_for?: {
|
|
2658
3902
|
signal?: string;
|
|
2659
3903
|
until?: string;
|
|
3904
|
+
/** The step has a wait link (`token: true`); the link itself is only in `run.wait_urls`. */
|
|
3905
|
+
token?: true;
|
|
3906
|
+
prompt?: WaitPrompt;
|
|
3907
|
+
/** An event wait's event name (`POST /v1/routines/events`). */
|
|
3908
|
+
event?: string;
|
|
3909
|
+
/** An event wait's evaluated match values, by dot path into the event's data. */
|
|
3910
|
+
match?: Record<string, unknown>;
|
|
2660
3911
|
};
|
|
3912
|
+
/** A replay copied this step's outputs from its source run; the step did not run. Absent otherwise. */
|
|
3913
|
+
replayed?: true;
|
|
2661
3914
|
}
|
|
2662
3915
|
|
|
2663
3916
|
export type StepRunList = Omit<ListEnvelope, "data"> & {
|
|
@@ -2675,6 +3928,25 @@ export interface RunCreateRequest {
|
|
|
2675
3928
|
metadata?: Metadata;
|
|
2676
3929
|
}
|
|
2677
3930
|
|
|
3931
|
+
export interface RunReplayRequest {
|
|
3932
|
+
/**
|
|
3933
|
+
* Run this top-level step and every step downstream of it again. Absent: only the steps that did not succeed, and those downstream of them, run again.
|
|
3934
|
+
*/
|
|
3935
|
+
from_step?: string;
|
|
3936
|
+
/**
|
|
3937
|
+
* The new run's input instead of the source run's; validated against the version's `inputs`. When it differs from the source's, the steps that read it (directly or through `env`) and the steps that wait for a signal run again, with every step downstream of them.
|
|
3938
|
+
*/
|
|
3939
|
+
input?: Record<string, unknown>;
|
|
3940
|
+
/**
|
|
3941
|
+
* Replay with this version instead of the source run's (`ver_` ID or number). The steps it adds or changes and the steps that wait for a signal run again, with every step downstream of them.
|
|
3942
|
+
*/
|
|
3943
|
+
version?: string | number;
|
|
3944
|
+
/** Override the version's default durability for the new run. */
|
|
3945
|
+
durability?: "ephemeral" | "standard" | "strict";
|
|
3946
|
+
webhook?: WebhookConfig;
|
|
3947
|
+
metadata?: Metadata;
|
|
3948
|
+
}
|
|
3949
|
+
|
|
2678
3950
|
/** A routine run (`run_…`); `result` is the routine's `output`. */
|
|
2679
3951
|
export type RoutineRun = Omit<Job, "id" | "object"> & {
|
|
2680
3952
|
id: string;
|
|
@@ -2685,8 +3957,21 @@ export type RoutineRun = Omit<Job, "id" | "object"> & {
|
|
|
2685
3957
|
durability: "ephemeral" | "standard" | "strict";
|
|
2686
3958
|
trigger: RunTrigger;
|
|
2687
3959
|
input: Record<string, unknown>;
|
|
2688
|
-
/**
|
|
3960
|
+
/**
|
|
3961
|
+
* The run's outcome line: when the routine's `output` is an object with a non-empty `summary` string,
|
|
3962
|
+
* that string on one line, cut to 140 characters (an ellipsis marks the cut). Absent otherwise. Run
|
|
3963
|
+
* lists, the run's terminal event and its webhook carry it, so a list of runs says what each one did.
|
|
3964
|
+
*/
|
|
3965
|
+
summary?: string;
|
|
3966
|
+
/** Top-level steps in definition order (empty when `steps_kept` is `false`). */
|
|
2689
3967
|
steps: StepRun[];
|
|
3968
|
+
/**
|
|
3969
|
+
* `false` on an `ephemeral` run read after it ended: only its summary was kept (status, timing,
|
|
3970
|
+
* `input`, `result`, `error` and its IDs), so `steps` is empty, `…/steps` and a replay answer 410
|
|
3971
|
+
* `run_steps_not_kept`, and `…/events` sends its terminal event alone. The `?wait=` answer, the event
|
|
3972
|
+
* stream and the webhook carried its steps as it ended. Absent on every other run.
|
|
3973
|
+
*/
|
|
3974
|
+
steps_kept?: false;
|
|
2690
3975
|
};
|
|
2691
3976
|
|
|
2692
3977
|
export type RoutineRunList = Omit<ListEnvelope, "data"> & {
|
|
@@ -2701,6 +3986,75 @@ export type RunEvent = JobEvent & {
|
|
|
2701
3986
|
message?: string;
|
|
2702
3987
|
};
|
|
2703
3988
|
|
|
3989
|
+
export interface RoutineEventRequest {
|
|
3990
|
+
/** The event name `wait.event` names. */
|
|
3991
|
+
name: string;
|
|
3992
|
+
/** What `wait.match` is checked against, and the step's `data` output. */
|
|
3993
|
+
data?: unknown;
|
|
3994
|
+
/** Your ID for the event, passed to the step's `id` output. */
|
|
3995
|
+
id?: string;
|
|
3996
|
+
}
|
|
3997
|
+
|
|
3998
|
+
export interface RoutineEvent {
|
|
3999
|
+
object: "routine_event";
|
|
4000
|
+
name: string;
|
|
4001
|
+
id?: string | null;
|
|
4002
|
+
/** How many waiting steps the event resumed. */
|
|
4003
|
+
delivered: number;
|
|
4004
|
+
/** The runs and steps it resumed (the first 100). */
|
|
4005
|
+
runs: {
|
|
4006
|
+
run_id: string;
|
|
4007
|
+
step_id: string;
|
|
4008
|
+
}[];
|
|
4009
|
+
}
|
|
4010
|
+
|
|
4011
|
+
/**
|
|
4012
|
+
* A wait's `prompt` as evaluated when the step started waiting. `dropped` names fields left out because they were not https URLs.
|
|
4013
|
+
*/
|
|
4014
|
+
export interface WaitPrompt {
|
|
4015
|
+
title?: string;
|
|
4016
|
+
body?: string;
|
|
4017
|
+
image?: string;
|
|
4018
|
+
/**
|
|
4019
|
+
* The render artifact the image came from, when `image` was one (`steps.shot.outputs.artifacts[0]`). Its URL is signed for a day; the link's page signs a fresh one, as the run's principal, each time it is served.
|
|
4020
|
+
*/
|
|
4021
|
+
image_artifact?: string;
|
|
4022
|
+
link?: string;
|
|
4023
|
+
dropped?: Array<"image" | "link">;
|
|
4024
|
+
}
|
|
4025
|
+
|
|
4026
|
+
/** A wait link's step. */
|
|
4027
|
+
export interface RoutineWait {
|
|
4028
|
+
object: "routine_wait";
|
|
4029
|
+
/**
|
|
4030
|
+
* waiting: it takes an answer. pending: the step has not started waiting. answered: through a link or a signal. timed_out: its deadline passed. expired: 7 days after it started waiting. ended: the run ended, or the step was skipped or canceled, before an answer.
|
|
4031
|
+
*/
|
|
4032
|
+
status: "waiting" | "pending" | "answered" | "timed_out" | "expired" | "ended";
|
|
4033
|
+
run_id: string;
|
|
4034
|
+
run_status: "queued" | "running" | "succeeded" | "failed" | "canceled";
|
|
4035
|
+
routine_id: string;
|
|
4036
|
+
routine_name?: string | null;
|
|
4037
|
+
step_id: string;
|
|
4038
|
+
step_name?: string | null;
|
|
4039
|
+
/**
|
|
4040
|
+
* The step's evaluated prompt while it waits, and after an answer while the node still holds the run (null once the run is only in the run store).
|
|
4041
|
+
*/
|
|
4042
|
+
prompt: WaitPrompt | null;
|
|
4043
|
+
waiting_since?: string | null;
|
|
4044
|
+
/**
|
|
4045
|
+
* While the step waits, when the link stops taking an answer: 7 days after the step started waiting, or the step's own deadline (`wait.ms`, `wait.until`) when that is sooner.
|
|
4046
|
+
*/
|
|
4047
|
+
expires_at?: string | null;
|
|
4048
|
+
/** Once answered. `decision` is null for a signal sent through the API without one. */
|
|
4049
|
+
answer: {
|
|
4050
|
+
decision?: "approve" | "reject" | null;
|
|
4051
|
+
approved?: boolean | null;
|
|
4052
|
+
comment?: string | null;
|
|
4053
|
+
via?: "link" | "signal";
|
|
4054
|
+
answered_at?: string | null;
|
|
4055
|
+
} | null;
|
|
4056
|
+
}
|
|
4057
|
+
|
|
2704
4058
|
export interface SignalRequest {
|
|
2705
4059
|
/** The `wait.signal` name the run waits for (routine.schema.json). */
|
|
2706
4060
|
name: string;
|
|
@@ -2766,6 +4120,10 @@ export interface B3Pack {
|
|
|
2766
4120
|
legacyIds?: Record<string, string>;
|
|
2767
4121
|
};
|
|
2768
4122
|
signature?: B3PackSignature;
|
|
4123
|
+
/**
|
|
4124
|
+
* Search terms for the whole pack: what it is called and what it is for (email, inbox). A query that contains every word of one names the pack, and search then looks only at the packs it names.
|
|
4125
|
+
*/
|
|
4126
|
+
aliases?: B3PackSearchPhrases;
|
|
2769
4127
|
}
|
|
2770
4128
|
|
|
2771
4129
|
/**
|
|
@@ -2789,6 +4147,11 @@ export type B3PackKebabKey = string;
|
|
|
2789
4147
|
/** Connection key, a CEL identifier so templates can write connections.<key>. */
|
|
2790
4148
|
export type B3PackConnectionKey = string;
|
|
2791
4149
|
|
|
4150
|
+
/**
|
|
4151
|
+
* Lowercase words or short phrases search matches, as a person or an agent would ask (read my latest emails). Each phrase's words count like title words.
|
|
4152
|
+
*/
|
|
4153
|
+
export type B3PackSearchPhrases = string[];
|
|
4154
|
+
|
|
2792
4155
|
export type B3PackFacetList = string[];
|
|
2793
4156
|
|
|
2794
4157
|
/**
|
|
@@ -2804,7 +4167,7 @@ export interface B3PackEgressEntry {
|
|
|
2804
4167
|
*/
|
|
2805
4168
|
ports?: number[];
|
|
2806
4169
|
/**
|
|
2807
|
-
* Allowed URL schemes. Default ["https"]; plain http must be listed explicitly.
|
|
4170
|
+
* Allowed URL schemes. Default ["https"]; plain http must be listed explicitly. Credentials are injected only into https requests: a request to an http URL whose host a required connection binds is refused (403 egress_denied, reason scheme) and nothing is sent, in T0 and T1 alike (ARCHITECTURE 4.4).
|
|
2808
4171
|
* @default ["https"]
|
|
2809
4172
|
*/
|
|
2810
4173
|
schemes?: Array<"https" | "http">;
|
|
@@ -2831,7 +4194,7 @@ export type B3PackTemplateString = string;
|
|
|
2831
4194
|
export type B3PackTemplateValue = unknown;
|
|
2832
4195
|
|
|
2833
4196
|
/**
|
|
2834
|
-
* A connection definition. Secret fields the vault stores per type (the public names of vault.yaml ConnectionSecret), and how the egress proxy injects them (b3os-core egress::Injection): api_key {api_key}, injected as inject says (Header {name, prefix} or Query {name}); basic {username, password}, injected as Authorization: Basic base64(username:password); bearer {token}, injected as Authorization: Bearer <token>; oauth2 {access_token, refresh_token?, expires_at?, client_id?, client_secret?}, injected as Authorization: Bearer <access_token> (the refresh fields are never injected); none {} (configuration only). Each entry of hosts becomes one credential binding: credentials are injected only into requests to that host, after the egress guard validated and pinned the destination (ARCHITECTURE 4.4).
|
|
4197
|
+
* A connection definition. Secret fields the vault stores per type (the public names of vault.yaml ConnectionSecret), and how the egress proxy injects them (b3os-core egress::Injection): api_key {api_key}, injected as inject says (Header {name, prefix} or Query {name}); basic {username, password}, injected as Authorization: Basic base64(username:password); bearer {token}, injected as Authorization: Bearer <token>; oauth2 {access_token, refresh_token?, expires_at?, client_id?, client_secret?}, injected as Authorization: Bearer <access_token> (the refresh fields are never injected); none {} (configuration only). Each entry of hosts becomes one credential binding: credentials are injected only into https requests to that host, after the egress guard validated and pinned the destination (ARCHITECTURE 4.4), and only when the customer's vault connection is bound to the host as well (a pack connection is bound to the hosts its pack version declared when it was created). An upstream answer that echoes a credential value reaches templates with the value replaced by * characters, also where the answer writes it with JSON string or percent escapes (nested too); T1 code reads it the same way through the built-in capability proxy, while the platform egress proxy replaces only values written as is (b3osd searches T1 outputs and errors again).
|
|
2835
4198
|
*/
|
|
2836
4199
|
export type B3PackConnection = {
|
|
2837
4200
|
type: "api_key" | "basic" | "bearer" | "oauth2" | "none";
|
|
@@ -2839,7 +4202,7 @@ export type B3PackConnection = {
|
|
|
2839
4202
|
description?: string;
|
|
2840
4203
|
docsUrl?: string;
|
|
2841
4204
|
/**
|
|
2842
|
-
* Hosts that receive the injected credential. Each entry must also be covered by the pack egress list. * is not allowed.
|
|
4205
|
+
* Hosts that receive the injected credential. Each entry must also be covered by the pack egress list. * is not allowed. A wildcard entry (*.atlassian.net) binds the credential to the first host it is sent to: after a redirect to another host under the wildcard (another customer's site) the credential is not attached (T0: back at the host the request started at it is; T1 through the built-in capability proxy: only that first host within one invocation). The platform egress proxy, which serves T1 on production nodes, does not keep such a credential on one host yet: there an invocation whose credential would be bound only through a wildcard (declared here and in the vault connection's hosts) is refused with 501 not_implemented before anything runs.
|
|
2843
4206
|
*/
|
|
2844
4207
|
hosts?: B3PackHostPattern[];
|
|
2845
4208
|
/**
|
|
@@ -3017,6 +4380,8 @@ export type B3PackAction = {
|
|
|
3017
4380
|
*/
|
|
3018
4381
|
expose?: boolean;
|
|
3019
4382
|
};
|
|
4383
|
+
/** Task phrases for this action (read my latest emails). */
|
|
4384
|
+
aliases?: B3PackSearchPhrases;
|
|
3020
4385
|
};
|
|
3021
4386
|
|
|
3022
4387
|
/**
|
|
@@ -3028,7 +4393,7 @@ export type B3PackCron = string;
|
|
|
3028
4393
|
export type B3PackTimezone = string;
|
|
3029
4394
|
|
|
3030
4395
|
/**
|
|
3031
|
-
* Mandatory delivery verification (ARCHITECTURE 4.3). Signatures are compared in constant time over the raw request body bytes. Schemes: github: X-Hub-Signature-256 'sha256=<hex HMAC-SHA256(secret, body)>'. stripe: Stripe-Signature 't=<unix>,v1=<hex>' over '<t>.<body>' (any v1 may match). slack: X-Slack-Signature 'v0=<hex>' over 'v0:<X-Slack-Request-Timestamp>:<body>'. standard_webhooks: webhook-signature 'v1,<base64>' entries over '<webhook-id>.<webhook-timestamp>.<body>', secret is base64 after the whsec_ prefix. hmac_sha256: generic, and always timestamped: the header value is prefix plus the HMAC-SHA256 (hex or base64, per encoding) of '<value of timestampHeader>.<body>', and a delivery whose timestamp header is missing or not a Unix time is refused. Timestamped schemes (stripe, slack, standard_webhooks, hmac_sha256) reject deliveries more than toleranceS (at most 300 s, the same rule as routine webhooks) from the node clock. The node also remembers the verified signature of each accepted delivery with its dedupe key (73 h, up to 10,000 per subscription), so a delivery replayed with a different unsigned header (for example X-GitHub-Delivery, which github's dedupe key reads) is still a duplicate; github signs no timestamp, so outside that window such a replay is not refused.
|
|
4396
|
+
* Mandatory delivery verification (ARCHITECTURE 4.3). Signatures are compared in constant time over the raw request body bytes. Schemes: github: X-Hub-Signature-256 'sha256=<hex HMAC-SHA256(secret, body)>'. stripe: Stripe-Signature 't=<unix>,v1=<hex>' over '<t>.<body>' (any v1 may match). slack: X-Slack-Signature 'v0=<hex>' over 'v0:<X-Slack-Request-Timestamp>:<body>'. standard_webhooks: webhook-signature 'v1,<base64>' entries over '<webhook-id>.<webhook-timestamp>.<body>', secret is base64 after the whsec_ prefix. hmac_sha256: generic, and always timestamped: the header value is prefix plus the HMAC-SHA256 (hex or base64, per encoding) of '<value of timestampHeader>.<body>', and a delivery whose timestamp header is missing or not a Unix time is refused. Timestamped schemes (stripe, slack, standard_webhooks, hmac_sha256) reject deliveries more than toleranceS (at most 300 s, the same rule as routine webhooks) from the node clock. The node also remembers the verified signature of each accepted delivery with its dedupe key (73 h, up to 10,000 per subscription), so a delivery replayed with a different unsigned header (for example X-GitHub-Delivery, which github's dedupe key reads) is still a duplicate; github signs no timestamp, so outside that window such a replay is not refused. Because github's signature covers the body alone, two distinct deliveries with byte-identical bodies within the window are one event (the second is a duplicate).
|
|
3032
4397
|
*/
|
|
3033
4398
|
export type B3PackVerify = {
|
|
3034
4399
|
scheme: "github" | "stripe" | "slack" | "standard_webhooks" | "hmac_sha256";
|
|
@@ -3161,6 +4526,8 @@ export type B3PackTrigger = {
|
|
|
3161
4526
|
action?: B3PackKebabKey;
|
|
3162
4527
|
with?: B3PackTemplateValue;
|
|
3163
4528
|
};
|
|
4529
|
+
/** Task phrases for this trigger (when an issue is opened). */
|
|
4530
|
+
aliases?: B3PackSearchPhrases;
|
|
3164
4531
|
};
|
|
3165
4532
|
|
|
3166
4533
|
/**
|
|
@@ -3248,11 +4615,52 @@ export interface ActionSummary {
|
|
|
3248
4615
|
mcp_name: string;
|
|
3249
4616
|
/** Search relevance from 0 to 1 (search results only). */
|
|
3250
4617
|
score?: number;
|
|
4618
|
+
/** Set in search results when the search asked for `kind=any`. */
|
|
4619
|
+
kind?: "action";
|
|
3251
4620
|
}
|
|
3252
4621
|
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
4622
|
+
/** A trigger in search results (`kind=trigger` or `kind=any`). */
|
|
4623
|
+
export interface TriggerSearchHit {
|
|
4624
|
+
kind: "trigger";
|
|
4625
|
+
/** Exact reference with the resolved version, for a routine's `type: action` trigger. */
|
|
4626
|
+
ref: string;
|
|
4627
|
+
pack: string;
|
|
4628
|
+
key: string;
|
|
4629
|
+
title: string;
|
|
4630
|
+
description: string;
|
|
4631
|
+
trigger_kind: "webhook" | "poll" | "schedule";
|
|
4632
|
+
/** The connection keys a subscription binds, as in `TriggerSummary`. */
|
|
4633
|
+
connections: string[];
|
|
4634
|
+
/** Search relevance from 0 to 1. */
|
|
4635
|
+
score: number;
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4638
|
+
export type ActionSearchResult = Omit<ListEnvelope, "data"> & {
|
|
4639
|
+
data: Array<ActionSummary | TriggerSearchHit>;
|
|
4640
|
+
/**
|
|
4641
|
+
* `found` when `data` has results; `none` when nothing in the catalog (or under the `pack` and `effects` filters) does what the query asks.
|
|
4642
|
+
*/
|
|
4643
|
+
match: "found" | "none";
|
|
4644
|
+
/**
|
|
4645
|
+
* With `match: none`: the query's words no pack in the catalog knows, lowercase, such as `telegram`. Empty when every word is known but no one action carries them all, or when a filter left nothing.
|
|
4646
|
+
*/
|
|
4647
|
+
unmatched?: string[];
|
|
4648
|
+
fallback?: ActionSearchFallback;
|
|
4649
|
+
};
|
|
4650
|
+
|
|
4651
|
+
/** With `match: none`, what to do instead of using an unrelated action. */
|
|
4652
|
+
export interface ActionSearchFallback {
|
|
4653
|
+
/** The answer in a sentence an agent can act on. */
|
|
4654
|
+
detail: string;
|
|
4655
|
+
/**
|
|
4656
|
+
* The generic HTTP actions, for a public API or a URL that carries its own authorization (they attach no credential).
|
|
4657
|
+
*/
|
|
4658
|
+
refs: string[];
|
|
4659
|
+
/** The routine step that calls any HTTP API. */
|
|
4660
|
+
routine_step: string;
|
|
4661
|
+
/** The HTTP pack's page. */
|
|
4662
|
+
docs_url: string;
|
|
4663
|
+
}
|
|
3256
4664
|
|
|
3257
4665
|
export interface ConnectionRequirement {
|
|
3258
4666
|
/** The connection key in the pack. */
|
|
@@ -3263,6 +4671,19 @@ export interface ConnectionRequirement {
|
|
|
3263
4671
|
required?: boolean;
|
|
3264
4672
|
}
|
|
3265
4673
|
|
|
4674
|
+
/**
|
|
4675
|
+
* One example call from the pack's fixtures: an input and the output the pack maps from the service's
|
|
4676
|
+
* response. `fixture` marks a fixture shipped in the signed bundle (a documented response shape or a recorded
|
|
4677
|
+
* one; its `title` says which), never a call this node made.
|
|
4678
|
+
*/
|
|
4679
|
+
export interface ActionExample {
|
|
4680
|
+
title: string;
|
|
4681
|
+
input: Record<string, unknown>;
|
|
4682
|
+
/** What `actions.call` returns as `output` for this input. */
|
|
4683
|
+
output: unknown;
|
|
4684
|
+
label: "fixture" | "live-recorded";
|
|
4685
|
+
}
|
|
4686
|
+
|
|
3266
4687
|
export interface ActionDescription {
|
|
3267
4688
|
object: "action";
|
|
3268
4689
|
ref: string;
|
|
@@ -3290,6 +4711,11 @@ export interface ActionDescription {
|
|
|
3290
4711
|
inputSchema: JsonSchemaDocument;
|
|
3291
4712
|
outputSchema?: JsonSchemaDocument;
|
|
3292
4713
|
};
|
|
4714
|
+
/**
|
|
4715
|
+
* Example calls from the bundle's fixtures that succeed (error fixtures are left out), at most 5, read once
|
|
4716
|
+
* when the node loads the pack. Their inputs also appear as `examples` in `mcp.inputSchema`.
|
|
4717
|
+
*/
|
|
4718
|
+
examples: ActionExample[];
|
|
3293
4719
|
}
|
|
3294
4720
|
|
|
3295
4721
|
export interface ActionCallRequest {
|
|
@@ -3297,9 +4723,13 @@ export interface ActionCallRequest {
|
|
|
3297
4723
|
/** Validated against the action's input schema. */
|
|
3298
4724
|
input?: Record<string, unknown>;
|
|
3299
4725
|
/**
|
|
3300
|
-
* Pack connection key to vault connection ID. Omit a key to use your project's most recently created connection for it (
|
|
4726
|
+
* Pack connection key to vault connection ID. Omit a key to use your project's most recently created connection for it that has no `subject` (an end user's connection is used only when named; `422 connection_required` when there is none), or with `subject`, that subject's most recently created connection for it.
|
|
3301
4727
|
*/
|
|
3302
4728
|
connections?: Record<string, string>;
|
|
4729
|
+
/**
|
|
4730
|
+
* Your end user's ID, as stored on their connections. Each connection key you do not name in `connections` resolves to this subject's most recently created connection for the pack and key (`422 connection_required` when the subject has none); keys you name are used as named. Leave it out to resolve unnamed keys to connections without a `subject`.
|
|
4731
|
+
*/
|
|
4732
|
+
subject?: string;
|
|
3303
4733
|
/** Overall time limit; defaults to the action's own. */
|
|
3304
4734
|
timeout_ms?: number;
|
|
3305
4735
|
}
|
|
@@ -3324,6 +4754,12 @@ export interface TriggerSummary {
|
|
|
3324
4754
|
kind: "webhook" | "poll" | "schedule";
|
|
3325
4755
|
config_schema: JsonSchemaDocument;
|
|
3326
4756
|
event_schema: JsonSchemaDocument;
|
|
4757
|
+
/**
|
|
4758
|
+
* The connection keys a subscription binds (`connections` on a routine's action trigger): the pack
|
|
4759
|
+
* connections the trigger needs, plus `webhook_secret` when the provider's signing secret comes from you.
|
|
4760
|
+
* `webhook_secret` names an `api_key` connection that holds that secret (Stripe's endpoint signing secret,
|
|
4761
|
+
* Slack's signing secret); it is used only to verify deliveries and is never sent anywhere.
|
|
4762
|
+
*/
|
|
3327
4763
|
connections: string[];
|
|
3328
4764
|
}
|
|
3329
4765
|
|
|
@@ -3338,6 +4774,10 @@ export interface PackPublisher {
|
|
|
3338
4774
|
verified: boolean;
|
|
3339
4775
|
}
|
|
3340
4776
|
|
|
4777
|
+
/**
|
|
4778
|
+
* Nodes from this release on always send `facets`, `connection_types`, `keyless` and `icons`. Nodes deployed
|
|
4779
|
+
* before it do not, so clients should not require them.
|
|
4780
|
+
*/
|
|
3341
4781
|
export interface PackSummaryFields {
|
|
3342
4782
|
/** `<namespace>/<name>`. */
|
|
3343
4783
|
id: string;
|
|
@@ -3348,11 +4788,57 @@ export interface PackSummaryFields {
|
|
|
3348
4788
|
latest_version: string;
|
|
3349
4789
|
action_count: number;
|
|
3350
4790
|
trigger_count: number;
|
|
4791
|
+
/** The manifest's browse facets (`domain`, `assetClass`, `chains`); empty when it has none. */
|
|
4792
|
+
facets?: {
|
|
4793
|
+
domain?: string[];
|
|
4794
|
+
assetClass?: string[];
|
|
4795
|
+
chains?: string[];
|
|
4796
|
+
};
|
|
4797
|
+
/** The types of the pack's connections, sorted, each once; empty for a pack with none. */
|
|
4798
|
+
connection_types?: Array<"api_key" | "basic" | "bearer" | "oauth2" | "none">;
|
|
4799
|
+
/** True when the pack needs no stored credential (no connections, or only `none` connections). */
|
|
4800
|
+
keyless?: boolean;
|
|
4801
|
+
/**
|
|
4802
|
+
* The manifest's icons that are 4 KiB or smaller, as `data:` URIs read from the signed bundle; larger icons
|
|
4803
|
+
* are left out.
|
|
4804
|
+
*/
|
|
4805
|
+
icons?: {
|
|
4806
|
+
src: string;
|
|
4807
|
+
mimeType: "image/svg+xml" | "image/png" | "image/webp";
|
|
4808
|
+
sizes?: string[];
|
|
4809
|
+
}[];
|
|
3351
4810
|
}
|
|
3352
4811
|
|
|
3353
4812
|
/** A pack in a list. */
|
|
3354
4813
|
export type PackSummary = PackSummaryFields;
|
|
3355
4814
|
|
|
4815
|
+
/** A pack version's MCP tools (`GET /v1/actions/packs/{namespace}/{name}/tools`). */
|
|
4816
|
+
export interface PackTools {
|
|
4817
|
+
object: "pack_tools";
|
|
4818
|
+
pack: string;
|
|
4819
|
+
version: string;
|
|
4820
|
+
content_hash: string;
|
|
4821
|
+
/** How long to cache this list, in milliseconds. */
|
|
4822
|
+
ttlMs: number;
|
|
4823
|
+
tools: {
|
|
4824
|
+
/** The MCP tool name (`mcp_name`). */
|
|
4825
|
+
name: string;
|
|
4826
|
+
title: string;
|
|
4827
|
+
description: string;
|
|
4828
|
+
inputSchema: JsonSchemaDocument;
|
|
4829
|
+
outputSchema?: JsonSchemaDocument;
|
|
4830
|
+
annotations: {
|
|
4831
|
+
title?: string;
|
|
4832
|
+
readOnlyHint?: boolean;
|
|
4833
|
+
destructiveHint?: boolean;
|
|
4834
|
+
idempotentHint?: boolean;
|
|
4835
|
+
openWorldHint?: boolean;
|
|
4836
|
+
};
|
|
4837
|
+
ref: string;
|
|
4838
|
+
effects: EffectClass;
|
|
4839
|
+
}[];
|
|
4840
|
+
}
|
|
4841
|
+
|
|
3356
4842
|
export type PackList = Omit<ListEnvelope, "data"> & {
|
|
3357
4843
|
data: PackSummary[];
|
|
3358
4844
|
};
|
|
@@ -3362,10 +4848,32 @@ export type Pack = PackSummaryFields & {
|
|
|
3362
4848
|
version: string;
|
|
3363
4849
|
/** Every published version, newest first. */
|
|
3364
4850
|
versions: string[];
|
|
4851
|
+
/**
|
|
4852
|
+
* The pack's connections, with what creating one needs. Nodes from this release on send `optional`;
|
|
4853
|
+
* `description`, `docs_url`, `params_schema` and `defaults` when the manifest has them. Nodes deployed
|
|
4854
|
+
* before it send only `key`, `type` and `label`.
|
|
4855
|
+
*/
|
|
3365
4856
|
connections: {
|
|
3366
4857
|
key: string;
|
|
3367
4858
|
type: "api_key" | "basic" | "bearer" | "oauth2" | "none";
|
|
3368
4859
|
label: string;
|
|
4860
|
+
/** What the connection is for and where to get the credential. */
|
|
4861
|
+
description?: string;
|
|
4862
|
+
/** The provider's page about the credential. */
|
|
4863
|
+
docs_url?: string;
|
|
4864
|
+
/**
|
|
4865
|
+
* JSON Schema of the connection's non-secret parameters (`params` on `POST
|
|
4866
|
+
* /v1/vault/connections`), such as a Jira site name or SEC EDGAR's User-Agent. Absent when the
|
|
4867
|
+
* connection has none.
|
|
4868
|
+
*/
|
|
4869
|
+
params_schema?: JsonSchemaDocument;
|
|
4870
|
+
/**
|
|
4871
|
+
* True when a call that names no connection for this key and finds none stored still runs, with
|
|
4872
|
+
* `defaults` as its params (a `none` connection whose parameters all have defaults).
|
|
4873
|
+
*/
|
|
4874
|
+
optional?: boolean;
|
|
4875
|
+
/** With `optional`, the params a call sends when no connection is stored. */
|
|
4876
|
+
defaults?: Record<string, unknown>;
|
|
3369
4877
|
}[];
|
|
3370
4878
|
/** Hosts the pack may reach. */
|
|
3371
4879
|
egress: string[];
|
|
@@ -3485,20 +4993,27 @@ export interface ToolCall {
|
|
|
3485
4993
|
|
|
3486
4994
|
/**
|
|
3487
4995
|
* A message. `content` may be a string or a list of parts (images only in `user` messages); only `assistant`
|
|
3488
|
-
* messages may
|
|
3489
|
-
* here (such as `annotations` or `audio` echoed from an earlier response) are ignored.
|
|
4996
|
+
* messages may leave `content` out or set it to `null` (`400 invalid_request` with the pointer otherwise).
|
|
4997
|
+
* Members not listed here (such as `annotations` or `audio` echoed from an earlier response) are ignored.
|
|
3490
4998
|
*/
|
|
3491
|
-
export
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
4999
|
+
export type ChatMessage =
|
|
5000
|
+
| ({
|
|
5001
|
+
role: "system" | "developer" | "user" | "assistant" | "tool";
|
|
5002
|
+
content?: string | null | ContentPart[];
|
|
5003
|
+
name?: string | null;
|
|
5004
|
+
tool_calls?: ToolCall[] | null;
|
|
5005
|
+
/** For `tool` messages, the call this is the result of. */
|
|
5006
|
+
tool_call_id?: string | null;
|
|
5007
|
+
refusal?: string | null;
|
|
5008
|
+
/** B3OS extension. The reasoning of an earlier assistant turn, passed back to the model's template. */
|
|
5009
|
+
reasoning_content?: string | null;
|
|
5010
|
+
} & {
|
|
5011
|
+
role?: "assistant";
|
|
5012
|
+
})
|
|
5013
|
+
| {
|
|
5014
|
+
role?: "system" | "developer" | "user" | "tool";
|
|
5015
|
+
content: string | ContentPart[];
|
|
5016
|
+
};
|
|
3502
5017
|
|
|
3503
5018
|
export interface FunctionTool {
|
|
3504
5019
|
type: "function";
|
|
@@ -3508,6 +5023,10 @@ export interface FunctionTool {
|
|
|
3508
5023
|
/** A JSON Schema object (at most 64 KiB serialized and 32 levels deep), as OpenAI requires. */
|
|
3509
5024
|
parameters?: Record<string, unknown>;
|
|
3510
5025
|
strict?: boolean;
|
|
5026
|
+
/**
|
|
5027
|
+
* Accepted and ignored, with any value; never sent to the model. Evaluation harnesses such as BFCL leave a function's response schema here.
|
|
5028
|
+
*/
|
|
5029
|
+
response?: unknown;
|
|
3511
5030
|
};
|
|
3512
5031
|
}
|
|
3513
5032
|
|
|
@@ -3557,6 +5076,9 @@ export interface ChatCompletionRequest {
|
|
|
3557
5076
|
* Nucleus sampling. `0` keeps only the most probable token (passed to the runtime as 1e-9, the same thing, since vLLM takes values above 0 only).
|
|
3558
5077
|
*/
|
|
3559
5078
|
top_p?: number | null;
|
|
5079
|
+
/**
|
|
5080
|
+
* The most tokens to generate. Unset (with `max_completion_tokens` unset too), the model's default output cap applies where the node sets one (`b3os.default_max_tokens` in the model list); where that is `null`, the generation can run to the end of the context.
|
|
5081
|
+
*/
|
|
3560
5082
|
max_tokens?: number | null;
|
|
3561
5083
|
/** Wins over `max_tokens` when both are set. */
|
|
3562
5084
|
max_completion_tokens?: number | null;
|
|
@@ -3576,7 +5098,9 @@ export interface ChatCompletionRequest {
|
|
|
3576
5098
|
} | null;
|
|
3577
5099
|
/**
|
|
3578
5100
|
* B3OS extension. `gateway` sends the request to the B3IQ gateway when this node does not serve the model
|
|
3579
|
-
* (models it serves stay local); without it an unknown model is `404 model_not_available`.
|
|
5101
|
+
* (models it serves stay local); without it an unknown model is `404 model_not_available`. The production
|
|
5102
|
+
* node (beta-api.b3os.org) has no gateway route configured yet (no B3IQ gateway key or model list), so
|
|
5103
|
+
* there `gateway` answers `404 model_not_available` as well.
|
|
3580
5104
|
* @default "local"
|
|
3581
5105
|
*/
|
|
3582
5106
|
route?: "local" | "gateway" | null;
|
|
@@ -3588,9 +5112,24 @@ export interface ChatCompletionRequest {
|
|
|
3588
5112
|
repetition_penalty?: number | null;
|
|
3589
5113
|
/** Token ID to bias added to its logit. */
|
|
3590
5114
|
logit_bias?: Record<string, number> | null;
|
|
5115
|
+
/**
|
|
5116
|
+
* How much the model may reason before it answers. `none` and `minimal`: no reasoning phase (the
|
|
5117
|
+
* default). `low`, `medium`, `high`, `xhigh`: a reasoning phase of at most 256, 1,024, 4,096 and 8,192
|
|
5118
|
+
* tokens; at the budget the node closes the reasoning and the answer starts in the same request, so
|
|
5119
|
+
* `usage.completion_tokens_details.reasoning_tokens` stays within it. Without `max_tokens` the default
|
|
5120
|
+
* output cap grows by the budget, so the answer keeps the cap's room; with a `max_tokens` below the
|
|
5121
|
+
* budget the reasoning can use all of it, and the answer is empty with `finish_reason: "length"`. The
|
|
5122
|
+
* same levels and budgets apply to Responses' `reasoning.effort` and Messages' adaptive `thinking`
|
|
5123
|
+
* (`output_config.effort`). With `chat_template_kwargs.enable_thinking` set the other way, the request
|
|
5124
|
+
* is `400 invalid_request`. A `gateway` model takes it as its provider does.
|
|
5125
|
+
*/
|
|
5126
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
|
|
3591
5127
|
/** Runtime extension. Only `enable_thinking` is taken. */
|
|
3592
5128
|
chat_template_kwargs?: {
|
|
3593
|
-
/**
|
|
5129
|
+
/**
|
|
5130
|
+
* Let the model reason before answering; the reasoning arrives in `reasoning_content`. There is no
|
|
5131
|
+
* ceiling on the reasoning this way; `reasoning_effort` sets one.
|
|
5132
|
+
*/
|
|
3594
5133
|
enable_thinking?: boolean;
|
|
3595
5134
|
} | null;
|
|
3596
5135
|
/** Accepted and ignored. */
|
|
@@ -3599,12 +5138,35 @@ export interface ChatCompletionRequest {
|
|
|
3599
5138
|
store?: boolean | null;
|
|
3600
5139
|
/** Accepted and ignored. */
|
|
3601
5140
|
service_tier?: string | null;
|
|
5141
|
+
/**
|
|
5142
|
+
* Accepted and ignored. The node caches prompt prefixes per organization on its own; this key never changes which requests share a cache.
|
|
5143
|
+
*/
|
|
5144
|
+
prompt_cache_key?: string | null;
|
|
5145
|
+
/** Accepted and ignored (the runtime keeps cached prefixes while it has room). */
|
|
5146
|
+
prompt_cache_retention?: string | null;
|
|
5147
|
+
/** Accepted and ignored. */
|
|
5148
|
+
safety_identifier?: string | null;
|
|
5149
|
+
/** Accepted and ignored; set `max_tokens` to bound the answer. */
|
|
5150
|
+
verbosity?: string | null;
|
|
3602
5151
|
}
|
|
3603
5152
|
|
|
3604
5153
|
export interface Usage {
|
|
3605
5154
|
prompt_tokens: number;
|
|
3606
5155
|
completion_tokens: number;
|
|
3607
5156
|
total_tokens: number;
|
|
5157
|
+
/**
|
|
5158
|
+
* `cached_tokens`: the prompt tokens the runtime's prefix cache served, from this organization's earlier
|
|
5159
|
+
* requests (whole 1,056-token blocks on b3os/qwen3.5-9b); they are part of `prompt_tokens` and metered
|
|
5160
|
+
* like the rest. `multimodal_tokens` counts image tokens per modality when the prompt has images.
|
|
5161
|
+
*/
|
|
5162
|
+
prompt_tokens_details?: {
|
|
5163
|
+
cached_tokens?: number;
|
|
5164
|
+
[key: string]: unknown;
|
|
5165
|
+
};
|
|
5166
|
+
completion_tokens_details?: {
|
|
5167
|
+
reasoning_tokens?: number;
|
|
5168
|
+
[key: string]: unknown;
|
|
5169
|
+
};
|
|
3608
5170
|
[key: string]: unknown;
|
|
3609
5171
|
}
|
|
3610
5172
|
|
|
@@ -3679,15 +5241,28 @@ export interface ChatCompletionChunk {
|
|
|
3679
5241
|
|
|
3680
5242
|
/** B3OS extension with what the model supports and your limits on it. */
|
|
3681
5243
|
export interface ModelInfo {
|
|
5244
|
+
/**
|
|
5245
|
+
* On `b3os/default` only: the chat model it names, whose limits apply. A request for the alias is served, limited and metered as that model, and its response names that model.
|
|
5246
|
+
*/
|
|
5247
|
+
alias_of?: string;
|
|
3682
5248
|
kind: "chat" | "embedding" | "speech";
|
|
3683
5249
|
context_length: number | null;
|
|
5250
|
+
/**
|
|
5251
|
+
* The output cap of a chat request that sets no `max_tokens` (or `max_completion_tokens`, or Responses'
|
|
5252
|
+
* `max_output_tokens`): the generation stops there with `finish_reason: "length"`. Set `max_tokens` to go
|
|
5253
|
+
* higher. A node setting: `null` where the node has no cap (such a request then runs to the end of the
|
|
5254
|
+
* context) and for speech and embedding models.
|
|
5255
|
+
*/
|
|
5256
|
+
default_max_tokens?: number | null;
|
|
3684
5257
|
quantization: string | null;
|
|
3685
5258
|
tools: boolean;
|
|
3686
5259
|
json_schema: boolean;
|
|
3687
5260
|
image_input: boolean;
|
|
3688
5261
|
max_request_bytes: number;
|
|
3689
5262
|
limits: {
|
|
3690
|
-
/**
|
|
5263
|
+
/**
|
|
5264
|
+
* Tokens per minute for your organization (its own value from the node's budget snapshot, else the node's default).
|
|
5265
|
+
*/
|
|
3691
5266
|
tpm: number | null;
|
|
3692
5267
|
rpm: number | null;
|
|
3693
5268
|
};
|
|
@@ -3735,7 +5310,9 @@ export interface SpeechRequest {
|
|
|
3735
5310
|
/** A speech model, such as `kokoro-82m`. */
|
|
3736
5311
|
model: string;
|
|
3737
5312
|
input: string;
|
|
3738
|
-
/**
|
|
5313
|
+
/**
|
|
5314
|
+
* A voice ID from `GET /v1/infer/audio/voices`, or one of OpenAI's voice names (`alloy`, `ash`, `ballad`, `cedar`, `coral`, `echo`, `fable`, `marin`, `nova`, `onyx`, `sage`, `shimmer`, `verse`), which resolve to Kokoro voices as the operation describes. A voice the model has by that exact ID wins.
|
|
5315
|
+
*/
|
|
3739
5316
|
voice: string;
|
|
3740
5317
|
/** @default "mp3" */
|
|
3741
5318
|
response_format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm" | null;
|
|
@@ -3753,11 +5330,47 @@ export interface SpeechRequest {
|
|
|
3753
5330
|
* @default "none"
|
|
3754
5331
|
*/
|
|
3755
5332
|
timestamps?: "none" | "word" | null;
|
|
5333
|
+
/**
|
|
5334
|
+
* B3OS extension. The language to read `input` in, as a BCP 47 tag (case does not matter): one of the `language` values of the model's voices in `GET /v1/infer/audio/voices` (for `kokoro-82m`: `en-US`, `en-GB`, `es-ES`, `fr-FR`, `it-IT`, `pt-BR`). Unset, a voice reads in its own language. In a language other than English the word timings come from the forced aligner. Any other value is `400 unsupported_parameter`.
|
|
5335
|
+
*/
|
|
5336
|
+
language?: string | null;
|
|
5337
|
+
/**
|
|
5338
|
+
* OpenAI's streaming. Unset, the clip comes in one piece. `audio` streams the bytes of `response_format` as they are made; `sse` streams `speech.audio.delta` events, then `speech.audio.done`. Either way the head carries `Server-Timing` `ttfa`. Word timings stream only with `sse`, in the done event.
|
|
5339
|
+
*/
|
|
5340
|
+
stream_format?: "audio" | "sse" | null;
|
|
5341
|
+
}
|
|
5342
|
+
|
|
5343
|
+
/**
|
|
5344
|
+
* One event of a speech stream (`stream_format: "sse"`), named by its `type` (the SSE `event:` field carries
|
|
5345
|
+
* the same name): `speech.audio.delta` with a piece of the audio (`audio`, base64, in `response_format`; the
|
|
5346
|
+
* pieces joined are the whole clip), then `speech.audio.done` with the clip's `format`, `sample_rate`,
|
|
5347
|
+
* `duration_ms`, `words` when `timestamps` is `word`, and `b3os` (route, node, and timing in milliseconds:
|
|
5348
|
+
* the voice service's `voice_queue_ms` and `voice_run_ms`, and `total_ms`). A failure after audio is an
|
|
5349
|
+
* `error` event (`error`, OpenAI's error object) and ends the stream. There is no `usage`: speech bills
|
|
5350
|
+
* characters (`infer.audio_chars`), not tokens.
|
|
5351
|
+
*/
|
|
5352
|
+
export interface SpeechStreamEvent {
|
|
5353
|
+
type: "speech.audio.delta" | "speech.audio.done" | "error";
|
|
5354
|
+
audio?: string;
|
|
5355
|
+
model?: string;
|
|
5356
|
+
voice?: string;
|
|
5357
|
+
format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
|
|
5358
|
+
sample_rate?: number;
|
|
5359
|
+
duration_ms?: number;
|
|
5360
|
+
/** As in `SpeechWithTimestamps`, from the start of the clip. */
|
|
5361
|
+
words?: {
|
|
5362
|
+
text: string;
|
|
5363
|
+
start_ms: number;
|
|
5364
|
+
end_ms: number;
|
|
5365
|
+
}[];
|
|
5366
|
+
b3os?: Record<string, unknown>;
|
|
5367
|
+
error?: Record<string, unknown>;
|
|
3756
5368
|
}
|
|
3757
5369
|
|
|
3758
5370
|
export interface SpeechWithTimestamps {
|
|
3759
5371
|
object: "speech";
|
|
3760
5372
|
model: string;
|
|
5373
|
+
/** The voice that spoke, after an OpenAI voice name resolved (as `x-b3os-voice`). */
|
|
3761
5374
|
voice: string;
|
|
3762
5375
|
format: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
|
|
3763
5376
|
sample_rate: number;
|
|
@@ -3775,8 +5388,24 @@ export interface Voice {
|
|
|
3775
5388
|
object: "voice";
|
|
3776
5389
|
model: string;
|
|
3777
5390
|
name: string;
|
|
3778
|
-
/** BCP 47 tag
|
|
5391
|
+
/** BCP 47 tag, the language the voice reads in unless a request sets `language`. */
|
|
3779
5392
|
language: string;
|
|
5393
|
+
/** The voice's gender as the model's authors label it; `null` when the voice service does not say. */
|
|
5394
|
+
gender?: "female" | "male" | null;
|
|
5395
|
+
/**
|
|
5396
|
+
* Where the voice's word timings come from: `model` (the speech model's own durations) or `aligner` (a forced aligner run on the synthesized audio, in 80 ms steps); `null` when the voice service does not say.
|
|
5397
|
+
*/
|
|
5398
|
+
word_timings?: "model" | "aligner" | null;
|
|
5399
|
+
/**
|
|
5400
|
+
* Where the voice sits in the catalog: `featured` voices are a short list picked to start with and come first in this list, `limited` ones (the voices the model's authors grade lowest for their training data, and novelty voices) belong behind an "All voices" control; every voice can be used by its id. `null` when the voice service does not say.
|
|
5401
|
+
*/
|
|
5402
|
+
tier?: "featured" | "standard" | "limited" | null;
|
|
5403
|
+
/**
|
|
5404
|
+
* What a featured voice was picked for: `narration` (demos, explainers, read-alouds), `conversation` (assistants and agents that answer) or `character` (a voice in a role); `null` for voices nobody picked for one.
|
|
5405
|
+
*/
|
|
5406
|
+
use_case?: "narration" | "conversation" | "character" | null;
|
|
5407
|
+
/** True for one voice per language, the one to start with in that language. */
|
|
5408
|
+
default?: boolean;
|
|
3780
5409
|
/**
|
|
3781
5410
|
* A short audio sample of the voice, a B3OS static asset: `https://beta.b3os.org/assets/voices/<voice>.<ext>`
|
|
3782
5411
|
* (B3OS's own media are never served from `usercontent.b3os.org`, which holds customer bytes only).
|
|
@@ -3788,323 +5417,87 @@ export type VoiceList = Omit<ListEnvelope, "data"> & {
|
|
|
3788
5417
|
data: Voice[];
|
|
3789
5418
|
};
|
|
3790
5419
|
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
type?: string;
|
|
3794
|
-
ttl?: string;
|
|
3795
|
-
} | null;
|
|
3796
|
-
|
|
3797
|
-
export interface AnthropicTextBlock {
|
|
3798
|
-
type: "text";
|
|
5420
|
+
export interface ResponsesInputText {
|
|
5421
|
+
type: "input_text";
|
|
3799
5422
|
text: string;
|
|
3800
|
-
|
|
3801
|
-
/** Accepted and ignored. */
|
|
3802
|
-
citations?: Record<string, unknown>[] | null;
|
|
5423
|
+
prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
|
|
3803
5424
|
}
|
|
3804
5425
|
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
type: "base64";
|
|
3810
|
-
media_type: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
3811
|
-
/** The image file, which must be a PNG, JPEG, WebP or GIF. */
|
|
3812
|
-
data: string;
|
|
3813
|
-
}
|
|
3814
|
-
| {
|
|
3815
|
-
type: "url";
|
|
3816
|
-
/** Fetched by the node through its egress guard (PNG, JPEG, WebP or GIF, at most 10 MiB). */
|
|
3817
|
-
url: string;
|
|
3818
|
-
};
|
|
3819
|
-
cache_control?: AnthropicCacheControl;
|
|
3820
|
-
}
|
|
5426
|
+
/** Accepted and ignored; the runtime caches prompt prefixes on its own. */
|
|
5427
|
+
export type ResponsesCacheBreakpoint = {
|
|
5428
|
+
mode?: "explicit" | null;
|
|
5429
|
+
} | null;
|
|
3821
5430
|
|
|
3822
|
-
export interface
|
|
3823
|
-
type: "
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
5431
|
+
export interface ResponsesInputImage {
|
|
5432
|
+
type: "input_image";
|
|
5433
|
+
/** `https://` (fetched by the node through its egress guard) or a base64 `data:` URL. */
|
|
5434
|
+
image_url: string;
|
|
5435
|
+
/** Accepted and ignored; images are resized to about 1 MP. */
|
|
5436
|
+
detail?: "auto" | "low" | "high" | "original" | null;
|
|
5437
|
+
/** The Files API is not available on this node (null only). */
|
|
5438
|
+
file_id?: null;
|
|
5439
|
+
prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
|
|
3828
5440
|
}
|
|
3829
5441
|
|
|
3830
|
-
export interface
|
|
3831
|
-
type: "
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
is_error?: boolean | null;
|
|
3836
|
-
cache_control?: AnthropicCacheControl;
|
|
5442
|
+
export interface ResponsesOutputText {
|
|
5443
|
+
type: "output_text";
|
|
5444
|
+
text: string;
|
|
5445
|
+
annotations?: Record<string, unknown>[] | null;
|
|
5446
|
+
logprobs?: Record<string, unknown>[] | null;
|
|
3837
5447
|
}
|
|
3838
5448
|
|
|
3839
|
-
export interface
|
|
3840
|
-
type: "
|
|
3841
|
-
|
|
3842
|
-
/** Opaque; this node does not check it. */
|
|
3843
|
-
signature?: string | null;
|
|
5449
|
+
export interface ResponsesRefusal {
|
|
5450
|
+
type: "refusal";
|
|
5451
|
+
refusal: string;
|
|
3844
5452
|
}
|
|
3845
5453
|
|
|
3846
|
-
/**
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
5454
|
+
/**
|
|
5455
|
+
* A message. `user` messages take `input_text` and `input_image` parts, `system` and `developer` messages `input_text` parts (both become the system prompt, after `instructions`), `assistant` messages `output_text` and `refusal` parts. A string is one text part.
|
|
5456
|
+
*/
|
|
5457
|
+
export interface ResponsesInputMessage {
|
|
5458
|
+
type?: "message" | null;
|
|
5459
|
+
role: "user" | "assistant" | "system" | "developer";
|
|
5460
|
+
content: string | Array<ResponsesInputText | ResponsesInputImage | ResponsesOutputText | ResponsesRefusal>;
|
|
5461
|
+
id?: string | null;
|
|
5462
|
+
status?: string | null;
|
|
5463
|
+
phase?: string | null;
|
|
3850
5464
|
}
|
|
3851
5465
|
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
5466
|
+
/** A function call the model made in an earlier turn. */
|
|
5467
|
+
export interface ResponsesFunctionCallItem {
|
|
5468
|
+
type: "function_call";
|
|
5469
|
+
call_id: string;
|
|
5470
|
+
name: string;
|
|
5471
|
+
arguments: string;
|
|
5472
|
+
id?: string | null;
|
|
5473
|
+
status?: string | null;
|
|
5474
|
+
caller?: Record<string, unknown> | null;
|
|
5475
|
+
namespace?: string | null;
|
|
5476
|
+
/** Accepted and ignored. */
|
|
5477
|
+
async?: boolean | null;
|
|
3855
5478
|
}
|
|
3856
5479
|
|
|
3857
|
-
/**
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
5480
|
+
/**
|
|
5481
|
+
* A function's result for an earlier `function_call` with the same `call_id` in `input`. Images in `output` reach the model as a user message after the tool results.
|
|
5482
|
+
*/
|
|
5483
|
+
export interface ResponsesFunctionCallOutputItem {
|
|
5484
|
+
type: "function_call_output";
|
|
5485
|
+
call_id: string;
|
|
5486
|
+
output: string | Array<ResponsesInputText | ResponsesInputImage>;
|
|
5487
|
+
id?: string | null;
|
|
5488
|
+
status?: string | null;
|
|
5489
|
+
caller?: Record<string, unknown> | null;
|
|
5490
|
+
name?: string | null;
|
|
5491
|
+
namespace?: string | null;
|
|
3863
5492
|
}
|
|
3864
5493
|
|
|
3865
|
-
export
|
|
5494
|
+
export interface ResponsesReasoningText {
|
|
5495
|
+
type: "reasoning_text" | "summary_text";
|
|
5496
|
+
text: string;
|
|
5497
|
+
}
|
|
3866
5498
|
|
|
3867
5499
|
/**
|
|
3868
|
-
*
|
|
3869
|
-
*/
|
|
3870
|
-
export interface AnthropicTool {
|
|
3871
|
-
type?: "custom" | null;
|
|
3872
|
-
/** Unique within `tools`. */
|
|
3873
|
-
name: string;
|
|
3874
|
-
description?: string | null;
|
|
3875
|
-
/** A JSON Schema object (at most 64 KiB serialized and 32 levels deep). */
|
|
3876
|
-
input_schema: Record<string, unknown>;
|
|
3877
|
-
strict?: boolean | null;
|
|
3878
|
-
cache_control?: AnthropicCacheControl;
|
|
3879
|
-
}
|
|
3880
|
-
|
|
3881
|
-
export type AnthropicToolChoice =
|
|
3882
|
-
| (Record<string, unknown> & {
|
|
3883
|
-
/** `any` makes the model call a tool (it needs `tools`). */
|
|
3884
|
-
type: "auto" | "any";
|
|
3885
|
-
disable_parallel_tool_use?: boolean | null;
|
|
3886
|
-
})
|
|
3887
|
-
| {
|
|
3888
|
-
type: "tool";
|
|
3889
|
-
/** One of `tools`. */
|
|
3890
|
-
name: string;
|
|
3891
|
-
disable_parallel_tool_use?: boolean | null;
|
|
3892
|
-
}
|
|
3893
|
-
| {
|
|
3894
|
-
type: "none";
|
|
3895
|
-
};
|
|
3896
|
-
|
|
3897
|
-
/**
|
|
3898
|
-
* `enabled` (with `budget_tokens`, at least 1024 and less than `max_tokens`) and `adaptive` let the model
|
|
3899
|
-
* reason first, in `thinking` blocks; `disabled`, the default, does not. `display` is accepted and ignored.
|
|
3900
|
-
*/
|
|
3901
|
-
export type AnthropicThinking =
|
|
3902
|
-
| (Record<string, unknown> & {
|
|
3903
|
-
type: "enabled";
|
|
3904
|
-
budget_tokens: number;
|
|
3905
|
-
display?: "summarized" | "omitted" | "updates" | null;
|
|
3906
|
-
})
|
|
3907
|
-
| {
|
|
3908
|
-
type: "adaptive";
|
|
3909
|
-
display?: "summarized" | "omitted" | "updates" | null;
|
|
3910
|
-
}
|
|
3911
|
-
| {
|
|
3912
|
-
type: "disabled";
|
|
3913
|
-
};
|
|
3914
|
-
|
|
3915
|
-
/**
|
|
3916
|
-
* Anthropic Messages parameters. Any other parameter is `400 unsupported_parameter`; `null` means unset.
|
|
3917
|
-
*/
|
|
3918
|
-
export interface AnthropicMessagesRequest {
|
|
3919
|
-
model: string;
|
|
3920
|
-
messages: AnthropicInputMessage[];
|
|
3921
|
-
max_tokens: number;
|
|
3922
|
-
/** The system prompt; text blocks are joined with blank lines. */
|
|
3923
|
-
system?: null | string | AnthropicTextBlock[];
|
|
3924
|
-
tools?: AnthropicTool[] | null;
|
|
3925
|
-
tool_choice?: null | AnthropicToolChoice;
|
|
3926
|
-
thinking?: null | AnthropicThinking;
|
|
3927
|
-
output_config?: {
|
|
3928
|
-
/** The answer is JSON matching `schema` (at most 64 KiB serialized and 32 levels deep). */
|
|
3929
|
-
format?: {
|
|
3930
|
-
type: "json_schema";
|
|
3931
|
-
/** A JSON Schema object, as Anthropic requires. */
|
|
3932
|
-
schema: Record<string, unknown>;
|
|
3933
|
-
} | null;
|
|
3934
|
-
/** Accepted and ignored. */
|
|
3935
|
-
effort?: "low" | "medium" | "high" | "xhigh" | "max" | null;
|
|
3936
|
-
} | null;
|
|
3937
|
-
stop_sequences?: string[] | null;
|
|
3938
|
-
stream?: boolean | null;
|
|
3939
|
-
temperature?: number | null;
|
|
3940
|
-
/**
|
|
3941
|
-
* Nucleus sampling. `0` keeps only the most probable token (passed to the runtime as 1e-9, the same thing, since vLLM takes values above 0 only).
|
|
3942
|
-
*/
|
|
3943
|
-
top_p?: number | null;
|
|
3944
|
-
top_k?: number | null;
|
|
3945
|
-
/** Accepted and ignored. */
|
|
3946
|
-
metadata?: {
|
|
3947
|
-
user_id?: string | null;
|
|
3948
|
-
} | null;
|
|
3949
|
-
/** Accepted and ignored. */
|
|
3950
|
-
service_tier?: string | null;
|
|
3951
|
-
}
|
|
3952
|
-
|
|
3953
|
-
/** The input of a Messages request. Any other parameter is `400 unsupported_parameter`. */
|
|
3954
|
-
export interface AnthropicCountTokensRequest {
|
|
3955
|
-
model: string;
|
|
3956
|
-
messages: AnthropicInputMessage[];
|
|
3957
|
-
/** The system prompt; text blocks are joined with blank lines. */
|
|
3958
|
-
system?: null | string | AnthropicTextBlock[];
|
|
3959
|
-
tools?: AnthropicTool[] | null;
|
|
3960
|
-
tool_choice?: null | AnthropicToolChoice;
|
|
3961
|
-
thinking?: null | AnthropicThinking;
|
|
3962
|
-
}
|
|
3963
|
-
|
|
3964
|
-
export interface AnthropicCountTokens {
|
|
3965
|
-
input_tokens: number;
|
|
3966
|
-
}
|
|
3967
|
-
|
|
3968
|
-
export interface AnthropicUsage {
|
|
3969
|
-
input_tokens: number;
|
|
3970
|
-
output_tokens: number;
|
|
3971
|
-
}
|
|
3972
|
-
|
|
3973
|
-
/**
|
|
3974
|
-
* A block of the answer, `text`, `tool_use` (with `id`, `name`, `input`) or `thinking` (with `signature`).
|
|
3975
|
-
*/
|
|
3976
|
-
export interface AnthropicOutputBlock {
|
|
3977
|
-
type: "text" | "tool_use" | "thinking";
|
|
3978
|
-
text?: string;
|
|
3979
|
-
id?: string;
|
|
3980
|
-
name?: string;
|
|
3981
|
-
input?: Record<string, unknown>;
|
|
3982
|
-
thinking?: string;
|
|
3983
|
-
signature?: string;
|
|
3984
|
-
}
|
|
3985
|
-
|
|
3986
|
-
export interface AnthropicMessage {
|
|
3987
|
-
id: string;
|
|
3988
|
-
type: "message";
|
|
3989
|
-
role: "assistant";
|
|
3990
|
-
content: AnthropicOutputBlock[];
|
|
3991
|
-
model: string;
|
|
3992
|
-
stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "refusal";
|
|
3993
|
-
/** The stop sequence that ended the answer. */
|
|
3994
|
-
stop_sequence: string | null;
|
|
3995
|
-
usage: AnthropicUsage;
|
|
3996
|
-
b3os?: InferMeta;
|
|
3997
|
-
}
|
|
3998
|
-
|
|
3999
|
-
/**
|
|
4000
|
-
* One event of a stream, named by its `type` (the SSE `event:` field carries the same name):
|
|
4001
|
-
* `message_start` (`message`, with empty `content` and the input tokens), `content_block_start` (`index`,
|
|
4002
|
-
* `content_block`), `content_block_delta` (`index`, and a `delta` of type `text_delta`, `input_json_delta`,
|
|
4003
|
-
* `thinking_delta` or `signature_delta`), `content_block_stop` (`index`), `message_delta` (`delta` with
|
|
4004
|
-
* `stop_reason` and `stop_sequence`, and `usage`), `message_stop` (with the `b3os` metadata), or `error`.
|
|
4005
|
-
*/
|
|
4006
|
-
export interface AnthropicStreamEvent {
|
|
4007
|
-
type:
|
|
4008
|
-
| "message_start"
|
|
4009
|
-
| "content_block_start"
|
|
4010
|
-
| "content_block_delta"
|
|
4011
|
-
| "content_block_stop"
|
|
4012
|
-
| "message_delta"
|
|
4013
|
-
| "message_stop"
|
|
4014
|
-
| "error";
|
|
4015
|
-
message?: Record<string, unknown>;
|
|
4016
|
-
index?: number;
|
|
4017
|
-
content_block?: Record<string, unknown>;
|
|
4018
|
-
delta?: Record<string, unknown>;
|
|
4019
|
-
usage?: Record<string, unknown>;
|
|
4020
|
-
error?: {
|
|
4021
|
-
type?: string;
|
|
4022
|
-
message?: string;
|
|
4023
|
-
};
|
|
4024
|
-
b3os?: InferMeta;
|
|
4025
|
-
}
|
|
4026
|
-
|
|
4027
|
-
export interface ResponsesInputText {
|
|
4028
|
-
type: "input_text";
|
|
4029
|
-
text: string;
|
|
4030
|
-
prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
|
|
4031
|
-
}
|
|
4032
|
-
|
|
4033
|
-
/** Accepted and ignored; the runtime caches prompt prefixes on its own. */
|
|
4034
|
-
export type ResponsesCacheBreakpoint = {
|
|
4035
|
-
mode?: "explicit" | null;
|
|
4036
|
-
} | null;
|
|
4037
|
-
|
|
4038
|
-
export interface ResponsesInputImage {
|
|
4039
|
-
type: "input_image";
|
|
4040
|
-
/** `https://` (fetched by the node through its egress guard) or a base64 `data:` URL. */
|
|
4041
|
-
image_url: string;
|
|
4042
|
-
/** Accepted and ignored; images are resized to about 1 MP. */
|
|
4043
|
-
detail?: "auto" | "low" | "high" | "original" | null;
|
|
4044
|
-
/** The Files API is not available on this node (null only). */
|
|
4045
|
-
file_id?: null;
|
|
4046
|
-
prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
|
|
4047
|
-
}
|
|
4048
|
-
|
|
4049
|
-
export interface ResponsesOutputText {
|
|
4050
|
-
type: "output_text";
|
|
4051
|
-
text: string;
|
|
4052
|
-
annotations?: Record<string, unknown>[] | null;
|
|
4053
|
-
logprobs?: Record<string, unknown>[] | null;
|
|
4054
|
-
}
|
|
4055
|
-
|
|
4056
|
-
export interface ResponsesRefusal {
|
|
4057
|
-
type: "refusal";
|
|
4058
|
-
refusal: string;
|
|
4059
|
-
}
|
|
4060
|
-
|
|
4061
|
-
/**
|
|
4062
|
-
* A message. `user` messages take `input_text` and `input_image` parts, `system` and `developer` messages `input_text` parts (both become the system prompt, after `instructions`), `assistant` messages `output_text` and `refusal` parts. A string is one text part.
|
|
4063
|
-
*/
|
|
4064
|
-
export interface ResponsesInputMessage {
|
|
4065
|
-
type?: "message" | null;
|
|
4066
|
-
role: "user" | "assistant" | "system" | "developer";
|
|
4067
|
-
content: string | Array<ResponsesInputText | ResponsesInputImage | ResponsesOutputText | ResponsesRefusal>;
|
|
4068
|
-
id?: string | null;
|
|
4069
|
-
status?: string | null;
|
|
4070
|
-
phase?: string | null;
|
|
4071
|
-
}
|
|
4072
|
-
|
|
4073
|
-
/** A function call the model made in an earlier turn. */
|
|
4074
|
-
export interface ResponsesFunctionCallItem {
|
|
4075
|
-
type: "function_call";
|
|
4076
|
-
call_id: string;
|
|
4077
|
-
name: string;
|
|
4078
|
-
arguments: string;
|
|
4079
|
-
id?: string | null;
|
|
4080
|
-
status?: string | null;
|
|
4081
|
-
caller?: Record<string, unknown> | null;
|
|
4082
|
-
namespace?: string | null;
|
|
4083
|
-
/** Accepted and ignored. */
|
|
4084
|
-
async?: boolean | null;
|
|
4085
|
-
}
|
|
4086
|
-
|
|
4087
|
-
/**
|
|
4088
|
-
* A function's result for an earlier `function_call` with the same `call_id` in `input`. Images in `output` reach the model as a user message after the tool results.
|
|
4089
|
-
*/
|
|
4090
|
-
export interface ResponsesFunctionCallOutputItem {
|
|
4091
|
-
type: "function_call_output";
|
|
4092
|
-
call_id: string;
|
|
4093
|
-
output: string | Array<ResponsesInputText | ResponsesInputImage>;
|
|
4094
|
-
id?: string | null;
|
|
4095
|
-
status?: string | null;
|
|
4096
|
-
caller?: Record<string, unknown> | null;
|
|
4097
|
-
name?: string | null;
|
|
4098
|
-
namespace?: string | null;
|
|
4099
|
-
}
|
|
4100
|
-
|
|
4101
|
-
export interface ResponsesReasoningText {
|
|
4102
|
-
type: "reasoning_text" | "summary_text";
|
|
4103
|
-
text: string;
|
|
4104
|
-
}
|
|
4105
|
-
|
|
4106
|
-
/**
|
|
4107
|
-
* Reasoning from an earlier turn; its `content` (else its `summary`) goes back to the model with that turn. `encrypted_content` is accepted and ignored.
|
|
5500
|
+
* Reasoning from an earlier turn; its `content` (else its `summary`) goes back to the model with that turn. `encrypted_content` is accepted and ignored.
|
|
4108
5501
|
*/
|
|
4109
5502
|
export interface ResponsesReasoningInputItem {
|
|
4110
5503
|
type: "reasoning";
|
|
@@ -4128,6 +5521,7 @@ export interface ResponsesFunctionTool {
|
|
|
4128
5521
|
description?: string | null;
|
|
4129
5522
|
/** A JSON Schema object (at most 64 KiB serialized and 32 levels deep); absent means no arguments. */
|
|
4130
5523
|
parameters?: Record<string, unknown> | null;
|
|
5524
|
+
/** Passed to the runtime when set; the response echoes the value sent, or `null` when unset. */
|
|
4131
5525
|
strict?: boolean | null;
|
|
4132
5526
|
allowed_callers?: "direct"[] | null;
|
|
4133
5527
|
defer_loading?: false | null;
|
|
@@ -4175,7 +5569,11 @@ export interface ResponsesRequest {
|
|
|
4175
5569
|
verbosity?: "low" | "medium" | "high" | null;
|
|
4176
5570
|
} | null;
|
|
4177
5571
|
reasoning?: {
|
|
4178
|
-
/**
|
|
5572
|
+
/**
|
|
5573
|
+
* `low` and above turn the reasoning phase on with chat's `reasoning_effort` budgets (256, 1,024,
|
|
5574
|
+
* 4,096 and 8,192 reasoning tokens for `low`, `medium`, `high`, `xhigh`; the node closes the
|
|
5575
|
+
* reasoning at the budget and the answer follows); unset, `none` and `minimal` leave it off.
|
|
5576
|
+
*/
|
|
4179
5577
|
effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
|
|
4180
5578
|
/** Accepted and ignored. */
|
|
4181
5579
|
summary?: "auto" | "concise" | "detailed" | null;
|
|
@@ -4194,6 +5592,7 @@ export interface ResponsesRequest {
|
|
|
4194
5592
|
user?: string | null;
|
|
4195
5593
|
safety_identifier?: string | null;
|
|
4196
5594
|
prompt_cache_key?: string | null;
|
|
5595
|
+
prompt_cache_retention?: string | null;
|
|
4197
5596
|
service_tier?: string | null;
|
|
4198
5597
|
/** `auto` is refused: the node never drops input items. */
|
|
4199
5598
|
truncation?: "disabled" | null;
|
|
@@ -4341,7 +5740,13 @@ export interface WebhookSecret {
|
|
|
4341
5740
|
object: "webhook_secret";
|
|
4342
5741
|
/** The normalized endpoint URL. */
|
|
4343
5742
|
url: string;
|
|
4344
|
-
|
|
5743
|
+
/**
|
|
5744
|
+
* The signing secret. Present only in the response that hands it out (the first `POST
|
|
5745
|
+
* /v1/webhooks/secret` for the URL, or a rotation); `null` otherwise.
|
|
5746
|
+
*/
|
|
5747
|
+
secret: string | null;
|
|
5748
|
+
/** The secret's last four characters, so you can tell which secret you stored. */
|
|
5749
|
+
secret_hint: string;
|
|
4345
5750
|
/** Until when the previous secret still signs deliveries, after a rotation. */
|
|
4346
5751
|
previous_valid_until: string | null;
|
|
4347
5752
|
created_at: string;
|
|
@@ -4609,6 +6014,15 @@ export interface RegistryPackVersion {
|
|
|
4609
6014
|
*/
|
|
4610
6015
|
export type RequestConnection = "edge" | "uds" | "tcp" | "sandbox";
|
|
4611
6016
|
|
|
6017
|
+
/**
|
|
6018
|
+
* Who made the request: `api_key` (an API key), `cli_token` (the CLI's device-login token), `dashboard` (a
|
|
6019
|
+
* signed-in dashboard session; its successful reads are not logged, its changes and errors are), `sandbox` (code
|
|
6020
|
+
* inside a sandbox, as its creating key), `routine` (a routine run, as the key that published its version),
|
|
6021
|
+
* `local` (a host-local caller on the node's Unix socket) or `public` (no credential: a webhook or signed
|
|
6022
|
+
* callback to a public route, or a request refused before authentication).
|
|
6023
|
+
*/
|
|
6024
|
+
export type RequestSource = "api_key" | "cli_token" | "dashboard" | "sandbox" | "routine" | "local" | "public";
|
|
6025
|
+
|
|
4612
6026
|
export interface RequestPhase {
|
|
4613
6027
|
name: string;
|
|
4614
6028
|
source: "edge" | "node";
|
|
@@ -4647,30 +6061,299 @@ export interface RequestRecord {
|
|
|
4647
6061
|
/** The W3C trace ID from `traceparent`, when sent. */
|
|
4648
6062
|
trace_id: string | null;
|
|
4649
6063
|
user_agent: string | null;
|
|
6064
|
+
source: RequestSource;
|
|
4650
6065
|
}
|
|
4651
6066
|
|
|
4652
6067
|
export type RequestRecordList = Omit<ListEnvelope, "data"> & {
|
|
4653
6068
|
data: RequestRecord[];
|
|
4654
6069
|
};
|
|
4655
6070
|
|
|
4656
|
-
|
|
6071
|
+
/** Accepted and ignored. */
|
|
6072
|
+
export type AnthropicCacheControl = {
|
|
6073
|
+
type?: string;
|
|
6074
|
+
ttl?: string;
|
|
6075
|
+
} | null;
|
|
4657
6076
|
|
|
4658
|
-
/**
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
6077
|
+
/**
|
|
6078
|
+
* Anthropic's context-editing beta (Claude Code and the Claude Agent SDK send it). Accepted and ignored: the
|
|
6079
|
+
* node clears nothing, so the model sees every turn you send and a conversation past the context window gets
|
|
6080
|
+
* `400 context_length_exceeded`. Only the shape is checked: an object whose `edits`, if present, are objects
|
|
6081
|
+
* with a string `type`.
|
|
6082
|
+
*/
|
|
6083
|
+
export type AnthropicContextManagement = {
|
|
6084
|
+
edits?:
|
|
6085
|
+
| {
|
|
6086
|
+
type: string;
|
|
6087
|
+
}[]
|
|
6088
|
+
| null;
|
|
6089
|
+
} | null;
|
|
4670
6090
|
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
6091
|
+
export interface AnthropicTextBlock {
|
|
6092
|
+
type: "text";
|
|
6093
|
+
text: string;
|
|
6094
|
+
cache_control?: AnthropicCacheControl;
|
|
6095
|
+
/** Accepted and ignored. */
|
|
6096
|
+
citations?: Record<string, unknown>[] | null;
|
|
6097
|
+
}
|
|
6098
|
+
|
|
6099
|
+
export interface AnthropicImageBlock {
|
|
6100
|
+
type: "image";
|
|
6101
|
+
source:
|
|
6102
|
+
| {
|
|
6103
|
+
type: "base64";
|
|
6104
|
+
media_type: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
6105
|
+
/** The image file, which must be a PNG, JPEG, WebP or GIF. */
|
|
6106
|
+
data: string;
|
|
6107
|
+
}
|
|
6108
|
+
| {
|
|
6109
|
+
type: "url";
|
|
6110
|
+
/** Fetched by the node through its egress guard (PNG, JPEG, WebP or GIF, at most 10 MiB). */
|
|
6111
|
+
url: string;
|
|
6112
|
+
};
|
|
6113
|
+
cache_control?: AnthropicCacheControl;
|
|
6114
|
+
}
|
|
6115
|
+
|
|
6116
|
+
export interface AnthropicToolUseBlock {
|
|
6117
|
+
type: "tool_use";
|
|
6118
|
+
id: string;
|
|
6119
|
+
name: string;
|
|
6120
|
+
input: Record<string, unknown>;
|
|
6121
|
+
cache_control?: AnthropicCacheControl;
|
|
6122
|
+
}
|
|
6123
|
+
|
|
6124
|
+
export interface AnthropicToolResultBlock {
|
|
6125
|
+
type: "tool_result";
|
|
6126
|
+
tool_use_id: string;
|
|
6127
|
+
content?: null | string | Array<AnthropicTextBlock | AnthropicImageBlock>;
|
|
6128
|
+
/** The result is an error; the model sees it prefixed with `Error:`. */
|
|
6129
|
+
is_error?: boolean | null;
|
|
6130
|
+
cache_control?: AnthropicCacheControl;
|
|
6131
|
+
}
|
|
6132
|
+
|
|
6133
|
+
export interface AnthropicThinkingBlock {
|
|
6134
|
+
type: "thinking";
|
|
6135
|
+
thinking: string;
|
|
6136
|
+
/** Opaque; this node does not check it. */
|
|
6137
|
+
signature?: string | null;
|
|
6138
|
+
}
|
|
6139
|
+
|
|
6140
|
+
/** Accepted in assistant turns and left out of the prompt. */
|
|
6141
|
+
export interface AnthropicRedactedThinkingBlock {
|
|
6142
|
+
type: "redacted_thinking";
|
|
6143
|
+
data: string;
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6146
|
+
export interface AnthropicUserMessage {
|
|
6147
|
+
role: "user";
|
|
6148
|
+
content: string | Array<AnthropicTextBlock | AnthropicImageBlock | AnthropicToolResultBlock>;
|
|
6149
|
+
}
|
|
6150
|
+
|
|
6151
|
+
/** An earlier answer; as the last message, the start of the answer, which the model continues. */
|
|
6152
|
+
export interface AnthropicAssistantMessage {
|
|
6153
|
+
role: "assistant";
|
|
6154
|
+
content:
|
|
6155
|
+
| string
|
|
6156
|
+
| Array<AnthropicTextBlock | AnthropicToolUseBlock | AnthropicThinkingBlock | AnthropicRedactedThinkingBlock>;
|
|
6157
|
+
}
|
|
6158
|
+
|
|
6159
|
+
export type AnthropicInputMessage = AnthropicUserMessage | AnthropicAssistantMessage;
|
|
6160
|
+
|
|
6161
|
+
/**
|
|
6162
|
+
* A custom tool. Tools Anthropic defines or runs (a `type` other than `custom`) are `unsupported_parameter`.
|
|
6163
|
+
*/
|
|
6164
|
+
export interface AnthropicTool {
|
|
6165
|
+
type?: "custom" | null;
|
|
6166
|
+
/** Unique within `tools`. */
|
|
6167
|
+
name: string;
|
|
6168
|
+
description?: string | null;
|
|
6169
|
+
/** A JSON Schema object (at most 64 KiB serialized and 32 levels deep). */
|
|
6170
|
+
input_schema: Record<string, unknown>;
|
|
6171
|
+
strict?: boolean | null;
|
|
6172
|
+
cache_control?: AnthropicCacheControl;
|
|
6173
|
+
}
|
|
6174
|
+
|
|
6175
|
+
export type AnthropicToolChoice =
|
|
6176
|
+
| (Record<string, unknown> & {
|
|
6177
|
+
/** `any` makes the model call a tool (it needs `tools`). */
|
|
6178
|
+
type: "auto" | "any";
|
|
6179
|
+
disable_parallel_tool_use?: boolean | null;
|
|
6180
|
+
})
|
|
6181
|
+
| {
|
|
6182
|
+
type: "tool";
|
|
6183
|
+
/** One of `tools`. */
|
|
6184
|
+
name: string;
|
|
6185
|
+
disable_parallel_tool_use?: boolean | null;
|
|
6186
|
+
}
|
|
6187
|
+
| {
|
|
6188
|
+
type: "none";
|
|
6189
|
+
};
|
|
6190
|
+
|
|
6191
|
+
/**
|
|
6192
|
+
* `enabled` (with `budget_tokens`, at least 1024 and less than `max_tokens`) and `adaptive` let the model
|
|
6193
|
+
* reason first, in `thinking` blocks; `disabled`, the default, does not. The node closes the reasoning at
|
|
6194
|
+
* the budget and the answer follows in the same request: `budget_tokens`, or for `adaptive` the budget of
|
|
6195
|
+
* `output_config.effort` (`low` 256, `medium` 1,024, `high` 4,096, `xhigh` and `max` 8,192; `high` when
|
|
6196
|
+
* unset). `display` is accepted and ignored.
|
|
6197
|
+
*/
|
|
6198
|
+
export type AnthropicThinking =
|
|
6199
|
+
| (Record<string, unknown> & {
|
|
6200
|
+
type: "enabled";
|
|
6201
|
+
budget_tokens: number;
|
|
6202
|
+
display?: "summarized" | "omitted" | "updates" | null;
|
|
6203
|
+
})
|
|
6204
|
+
| {
|
|
6205
|
+
type: "adaptive";
|
|
6206
|
+
display?: "summarized" | "omitted" | "updates" | null;
|
|
6207
|
+
}
|
|
6208
|
+
| {
|
|
6209
|
+
type: "disabled";
|
|
6210
|
+
};
|
|
6211
|
+
|
|
6212
|
+
/**
|
|
6213
|
+
* Anthropic Messages parameters. Any other parameter is `400 unsupported_parameter`; `null` means unset.
|
|
6214
|
+
*/
|
|
6215
|
+
export interface AnthropicMessagesRequest {
|
|
6216
|
+
model: string;
|
|
6217
|
+
messages: AnthropicInputMessage[];
|
|
6218
|
+
max_tokens: number;
|
|
6219
|
+
/** The system prompt; text blocks are joined with blank lines. */
|
|
6220
|
+
system?: null | string | AnthropicTextBlock[];
|
|
6221
|
+
tools?: AnthropicTool[] | null;
|
|
6222
|
+
tool_choice?: null | AnthropicToolChoice;
|
|
6223
|
+
thinking?: null | AnthropicThinking;
|
|
6224
|
+
output_config?: {
|
|
6225
|
+
/** The answer is JSON matching `schema` (at most 64 KiB serialized and 32 levels deep). */
|
|
6226
|
+
format?: {
|
|
6227
|
+
type: "json_schema";
|
|
6228
|
+
/** A JSON Schema object, as Anthropic requires. */
|
|
6229
|
+
schema: Record<string, unknown>;
|
|
6230
|
+
} | null;
|
|
6231
|
+
/**
|
|
6232
|
+
* The reasoning budget of adaptive `thinking` (256, 1,024, 4,096 and 8,192 tokens for `low`, `medium`, `high`, `xhigh` and `max`); no effect without it.
|
|
6233
|
+
*/
|
|
6234
|
+
effort?: "low" | "medium" | "high" | "xhigh" | "max" | null;
|
|
6235
|
+
} | null;
|
|
6236
|
+
stop_sequences?: string[] | null;
|
|
6237
|
+
stream?: boolean | null;
|
|
6238
|
+
temperature?: number | null;
|
|
6239
|
+
/**
|
|
6240
|
+
* Nucleus sampling. `0` keeps only the most probable token (passed to the runtime as 1e-9, the same thing, since vLLM takes values above 0 only).
|
|
6241
|
+
*/
|
|
6242
|
+
top_p?: number | null;
|
|
6243
|
+
top_k?: number | null;
|
|
6244
|
+
/** Accepted and ignored. */
|
|
6245
|
+
metadata?: {
|
|
6246
|
+
user_id?: string | null;
|
|
6247
|
+
} | null;
|
|
6248
|
+
/** Accepted and ignored. */
|
|
6249
|
+
service_tier?: string | null;
|
|
6250
|
+
context_management?: AnthropicContextManagement;
|
|
6251
|
+
}
|
|
6252
|
+
|
|
6253
|
+
/** The input of a Messages request. Any other parameter is `400 unsupported_parameter`. */
|
|
6254
|
+
export interface AnthropicCountTokensRequest {
|
|
6255
|
+
model: string;
|
|
6256
|
+
messages: AnthropicInputMessage[];
|
|
6257
|
+
/** The system prompt; text blocks are joined with blank lines. */
|
|
6258
|
+
system?: null | string | AnthropicTextBlock[];
|
|
6259
|
+
tools?: AnthropicTool[] | null;
|
|
6260
|
+
tool_choice?: null | AnthropicToolChoice;
|
|
6261
|
+
thinking?: null | AnthropicThinking;
|
|
6262
|
+
context_management?: AnthropicContextManagement;
|
|
6263
|
+
}
|
|
6264
|
+
|
|
6265
|
+
export interface AnthropicCountTokens {
|
|
6266
|
+
input_tokens: number;
|
|
6267
|
+
}
|
|
6268
|
+
|
|
6269
|
+
export interface AnthropicUsage {
|
|
6270
|
+
/** Prompt tokens the prefix cache did not serve (all of them when the cache fields are absent). */
|
|
6271
|
+
input_tokens: number;
|
|
6272
|
+
output_tokens: number;
|
|
6273
|
+
/**
|
|
6274
|
+
* Always 0 when present. The runtime caches prompt prefixes on its own; nothing is written on request.
|
|
6275
|
+
*/
|
|
6276
|
+
cache_creation_input_tokens?: number;
|
|
6277
|
+
/**
|
|
6278
|
+
* Prompt tokens the runtime's prefix cache served, from this organization's earlier requests (whole
|
|
6279
|
+
* 1,056-token blocks on b3os/qwen3.5-9b). The prompt's size is input_tokens plus the two cache fields.
|
|
6280
|
+
* Metering charges every prompt token.
|
|
6281
|
+
*/
|
|
6282
|
+
cache_read_input_tokens?: number;
|
|
6283
|
+
}
|
|
6284
|
+
|
|
6285
|
+
/**
|
|
6286
|
+
* A block of the answer, `text`, `tool_use` (with `id`, `name`, `input`) or `thinking` (with `signature`).
|
|
6287
|
+
*/
|
|
6288
|
+
export interface AnthropicOutputBlock {
|
|
6289
|
+
type: "text" | "tool_use" | "thinking";
|
|
6290
|
+
text?: string;
|
|
6291
|
+
id?: string;
|
|
6292
|
+
name?: string;
|
|
6293
|
+
input?: Record<string, unknown>;
|
|
6294
|
+
thinking?: string;
|
|
6295
|
+
signature?: string;
|
|
6296
|
+
}
|
|
6297
|
+
|
|
6298
|
+
export interface AnthropicMessage {
|
|
6299
|
+
id: string;
|
|
6300
|
+
type: "message";
|
|
6301
|
+
role: "assistant";
|
|
6302
|
+
content: AnthropicOutputBlock[];
|
|
6303
|
+
model: string;
|
|
6304
|
+
stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "refusal";
|
|
6305
|
+
/** The stop sequence that ended the answer. */
|
|
6306
|
+
stop_sequence: string | null;
|
|
6307
|
+
usage: AnthropicUsage;
|
|
6308
|
+
b3os?: InferMeta;
|
|
6309
|
+
}
|
|
6310
|
+
|
|
6311
|
+
/**
|
|
6312
|
+
* One event of a stream, named by its `type` (the SSE `event:` field carries the same name):
|
|
6313
|
+
* `message_start` (`message`, with empty `content` and the input tokens), `content_block_start` (`index`,
|
|
6314
|
+
* `content_block`), `content_block_delta` (`index`, and a `delta` of type `text_delta`, `input_json_delta`,
|
|
6315
|
+
* `thinking_delta` or `signature_delta`), `content_block_stop` (`index`), `message_delta` (`delta` with
|
|
6316
|
+
* `stop_reason` and `stop_sequence`, and `usage`), `message_stop` (with the `b3os` metadata), or `error`.
|
|
6317
|
+
*/
|
|
6318
|
+
export interface AnthropicStreamEvent {
|
|
6319
|
+
type:
|
|
6320
|
+
| "message_start"
|
|
6321
|
+
| "content_block_start"
|
|
6322
|
+
| "content_block_delta"
|
|
6323
|
+
| "content_block_stop"
|
|
6324
|
+
| "message_delta"
|
|
6325
|
+
| "message_stop"
|
|
6326
|
+
| "error";
|
|
6327
|
+
message?: Record<string, unknown>;
|
|
6328
|
+
index?: number;
|
|
6329
|
+
content_block?: Record<string, unknown>;
|
|
6330
|
+
delta?: Record<string, unknown>;
|
|
6331
|
+
usage?: Record<string, unknown>;
|
|
6332
|
+
error?: {
|
|
6333
|
+
type?: string;
|
|
6334
|
+
message?: string;
|
|
6335
|
+
};
|
|
6336
|
+
b3os?: InferMeta;
|
|
6337
|
+
}
|
|
6338
|
+
|
|
6339
|
+
// ---------------------------------------------------------------- operation parameters and inline shapes
|
|
6340
|
+
|
|
6341
|
+
/** Parameters of `listBatches`. */
|
|
6342
|
+
export interface VisionListBatchesParams {
|
|
6343
|
+
/**
|
|
6344
|
+
* Page size, from 1 to 100.
|
|
6345
|
+
* @default 20
|
|
6346
|
+
*/
|
|
6347
|
+
limit?: number;
|
|
6348
|
+
/** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
|
|
6349
|
+
cursor?: string;
|
|
6350
|
+
/** Only jobs with this status. */
|
|
6351
|
+
status?: JobStatus;
|
|
6352
|
+
}
|
|
6353
|
+
|
|
6354
|
+
/** Parameters of `listBatchPages`. */
|
|
6355
|
+
export interface VisionListBatchPagesParams {
|
|
6356
|
+
/**
|
|
4674
6357
|
* Page size, from 1 to 100.
|
|
4675
6358
|
* @default 20
|
|
4676
6359
|
*/
|
|
@@ -4747,6 +6430,16 @@ export interface VisionReadUrlParams {
|
|
|
4747
6430
|
* @default 0
|
|
4748
6431
|
*/
|
|
4749
6432
|
wait_for_ms?: number;
|
|
6433
|
+
/**
|
|
6434
|
+
* `true` checks robots.txt and Content Signals first (see `respect_robots` on scrape).
|
|
6435
|
+
* @default false
|
|
6436
|
+
*/
|
|
6437
|
+
respect_robots?: boolean;
|
|
6438
|
+
/**
|
|
6439
|
+
* `bill` returns a wall's content and bills it like any page (see `walls` on scrape); by default a wall is free and the body is empty.
|
|
6440
|
+
* @default "free"
|
|
6441
|
+
*/
|
|
6442
|
+
walls?: "free" | "bill";
|
|
4750
6443
|
}
|
|
4751
6444
|
|
|
4752
6445
|
/** Parameters of `listSessions`. */
|
|
@@ -4762,6 +6455,33 @@ export interface VisionListSessionsParams {
|
|
|
4762
6455
|
status?: SessionStatus;
|
|
4763
6456
|
}
|
|
4764
6457
|
|
|
6458
|
+
/** Parameters of `listBackgrounds`. */
|
|
6459
|
+
export interface RenderListBackgroundsParams {
|
|
6460
|
+
/** Only this pack's backgrounds (`GET /v1/render/backgrounds/packs` lists the packs). */
|
|
6461
|
+
pack?: string;
|
|
6462
|
+
/** Only light or only dark backgrounds (measured per image, not per pack). */
|
|
6463
|
+
theme?: "light" | "dark";
|
|
6464
|
+
/** Only CSS, only procedural (the studio pack) or only image backgrounds. */
|
|
6465
|
+
kind?: "css" | "procedural" | "image";
|
|
6466
|
+
/** Only backgrounds with this tag (case-insensitive, whole tag). */
|
|
6467
|
+
tag?: string;
|
|
6468
|
+
/**
|
|
6469
|
+
* Only full-bleed backgrounds, or only transparent shapes (`cutout`, `partial`, `sliver`). CSS backgrounds are full-bleed.
|
|
6470
|
+
*/
|
|
6471
|
+
coverage?: "full-bleed" | "partial" | "cutout" | "sliver";
|
|
6472
|
+
/** `true`: only the hand-picked images (`image.featured`); `false`: everything else. */
|
|
6473
|
+
featured?: boolean;
|
|
6474
|
+
/** Only backgrounds whose name, slug or tags contain this text (case-insensitive). */
|
|
6475
|
+
q?: string;
|
|
6476
|
+
/**
|
|
6477
|
+
* Page size, from 1 to 500.
|
|
6478
|
+
* @default 100
|
|
6479
|
+
*/
|
|
6480
|
+
limit?: number;
|
|
6481
|
+
/** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
|
|
6482
|
+
cursor?: string;
|
|
6483
|
+
}
|
|
6484
|
+
|
|
4765
6485
|
/** Parameters of `listPresets`. */
|
|
4766
6486
|
export interface RenderListPresetsParams {
|
|
4767
6487
|
/** Only presets of this kind. */
|
|
@@ -4812,6 +6532,11 @@ export interface SandboxesListSandboxesParams {
|
|
|
4812
6532
|
cursor?: string;
|
|
4813
6533
|
/** Only sandboxes with this status. */
|
|
4814
6534
|
status?: SandboxStatus;
|
|
6535
|
+
/**
|
|
6536
|
+
* Only sandboxes whose `metadata` holds each of these pairs, as `metadata[<key>]=<value>`: up to 4, all of
|
|
6537
|
+
* which must match exactly. Keys follow the `metadata` key rule (1 to 40 of `A-Z a-z 0-9 _ . : -`).
|
|
6538
|
+
*/
|
|
6539
|
+
metadata?: Record<string, string>;
|
|
4815
6540
|
}
|
|
4816
6541
|
|
|
4817
6542
|
/** Parameters of `listSnapshots`. */
|
|
@@ -4825,15 +6550,26 @@ export interface SandboxesListSnapshotsParams {
|
|
|
4825
6550
|
cursor?: string;
|
|
4826
6551
|
}
|
|
4827
6552
|
|
|
6553
|
+
/** Parameters of `deleteFile`. */
|
|
6554
|
+
export interface SandboxesDeleteFileParams {
|
|
6555
|
+
/** Absolute path inside the sandbox. */
|
|
6556
|
+
path: string;
|
|
6557
|
+
/**
|
|
6558
|
+
* `1` deletes a directory and everything in it. `true` and `false` are sent as `1` and `0`.
|
|
6559
|
+
* @default 0
|
|
6560
|
+
*/
|
|
6561
|
+
recursive?: boolean | 0 | 1;
|
|
6562
|
+
}
|
|
6563
|
+
|
|
4828
6564
|
/** Parameters of `readFile`. */
|
|
4829
6565
|
export interface SandboxesReadFileParams {
|
|
4830
6566
|
/** Absolute path inside the sandbox. */
|
|
4831
6567
|
path: string;
|
|
4832
6568
|
/**
|
|
4833
|
-
* `1` lists the directory instead of reading a file.
|
|
6569
|
+
* `1` lists the directory instead of reading a file. `true` and `false` are sent as `1` and `0`.
|
|
4834
6570
|
* @default 0
|
|
4835
6571
|
*/
|
|
4836
|
-
list?: 0 | 1;
|
|
6572
|
+
list?: boolean | 0 | 1;
|
|
4837
6573
|
}
|
|
4838
6574
|
|
|
4839
6575
|
/** Parameters of `writeFile`. */
|
|
@@ -4846,10 +6582,16 @@ export interface SandboxesWriteFileParams {
|
|
|
4846
6582
|
*/
|
|
4847
6583
|
mode?: string;
|
|
4848
6584
|
/**
|
|
4849
|
-
* `1` creates missing parent directories.
|
|
6585
|
+
* `1` creates missing parent directories. `true` and `false` are sent as `1` and `0`.
|
|
4850
6586
|
* @default 0
|
|
4851
6587
|
*/
|
|
4852
|
-
mkdir?: 0 | 1;
|
|
6588
|
+
mkdir?: boolean | 0 | 1;
|
|
6589
|
+
}
|
|
6590
|
+
|
|
6591
|
+
/** Parameters of `statFile`. */
|
|
6592
|
+
export interface SandboxesStatFileParams {
|
|
6593
|
+
/** Absolute path inside the sandbox. */
|
|
6594
|
+
path: string;
|
|
4853
6595
|
}
|
|
4854
6596
|
|
|
4855
6597
|
/** Parameters of `streamLogs`. */
|
|
@@ -4872,6 +6614,11 @@ export interface SandboxesOpenPtyParams {
|
|
|
4872
6614
|
/** Command to run instead of the login shell. */
|
|
4873
6615
|
cmd?: string;
|
|
4874
6616
|
cwd?: string;
|
|
6617
|
+
/**
|
|
6618
|
+
* `new` for a terminal that can be reattached, or the id of one (`pts_...`) to attach to again. `cmd` and
|
|
6619
|
+
* `cwd` apply only to a new terminal.
|
|
6620
|
+
*/
|
|
6621
|
+
session?: string;
|
|
4875
6622
|
}
|
|
4876
6623
|
|
|
4877
6624
|
/** Parameters of `listRoutines`. */
|
|
@@ -4896,6 +6643,23 @@ export interface RoutinesListRunStepsParams {
|
|
|
4896
6643
|
cursor?: string;
|
|
4897
6644
|
}
|
|
4898
6645
|
|
|
6646
|
+
/** Parameters of `getWait`. */
|
|
6647
|
+
export interface RoutinesGetWaitParams {
|
|
6648
|
+
/** Preselect a decision on the page (HTML only); nothing is answered until the person confirms. */
|
|
6649
|
+
decision?: "approve" | "reject";
|
|
6650
|
+
}
|
|
6651
|
+
|
|
6652
|
+
/** Parameters of `listHookDeliveries`. */
|
|
6653
|
+
export interface RoutinesListHookDeliveriesParams {
|
|
6654
|
+
/**
|
|
6655
|
+
* Page size, from 1 to 100.
|
|
6656
|
+
* @default 20
|
|
6657
|
+
*/
|
|
6658
|
+
limit?: number;
|
|
6659
|
+
/** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
|
|
6660
|
+
cursor?: string;
|
|
6661
|
+
}
|
|
6662
|
+
|
|
4899
6663
|
/** Parameters of `listRuns`. */
|
|
4900
6664
|
export interface RoutinesListRunsParams {
|
|
4901
6665
|
/**
|
|
@@ -4922,7 +6686,7 @@ export interface RoutinesListVersionsParams {
|
|
|
4922
6686
|
|
|
4923
6687
|
/** Parameters of `describe`. */
|
|
4924
6688
|
export interface ActionsDescribeParams {
|
|
4925
|
-
/** `<namespace>/<name>/<action>@<version>`; the version may be exact (`1.
|
|
6689
|
+
/** `<namespace>/<name>/<action>@<version>`; the version may be exact (`1.0.0`) or a major (`1`). */
|
|
4926
6690
|
ref: ActionRef;
|
|
4927
6691
|
}
|
|
4928
6692
|
|
|
@@ -4945,6 +6709,18 @@ export interface ActionsGetPackParams {
|
|
|
4945
6709
|
version?: string;
|
|
4946
6710
|
}
|
|
4947
6711
|
|
|
6712
|
+
/** Parameters of `getPackTools` (header parameters are sent as their `X-B3OS-*` headers). */
|
|
6713
|
+
export interface ActionsGetPackToolsParams {
|
|
6714
|
+
/** An exact version or a range such as `1` or `^1.2`; the latest by default. */
|
|
6715
|
+
version?: string;
|
|
6716
|
+
/** The most a listed tool may do. `read` lists `pure` and `read` actions only. */
|
|
6717
|
+
effects?: EffectClass;
|
|
6718
|
+
/** Only these action keys, comma-separated (`post-message,list-channels`). An unknown key is a 400. */
|
|
6719
|
+
actions?: string;
|
|
6720
|
+
/** The `ETag` of a response you hold. */
|
|
6721
|
+
if_none_match?: string;
|
|
6722
|
+
}
|
|
6723
|
+
|
|
4948
6724
|
/** Parameters of `listRegistryPacks`. */
|
|
4949
6725
|
export interface PlatformListRegistryPacksParams {
|
|
4950
6726
|
/**
|
|
@@ -4964,8 +6740,13 @@ export interface ActionsSearchParams {
|
|
|
4964
6740
|
q: string;
|
|
4965
6741
|
/** Only actions of this pack (`io.b3os/github`). */
|
|
4966
6742
|
pack?: string;
|
|
4967
|
-
/** Only actions with this effect class. */
|
|
6743
|
+
/** Only actions with this effect class. Triggers have no effect class, so it never removes one. */
|
|
4968
6744
|
effects?: EffectClass;
|
|
6745
|
+
/**
|
|
6746
|
+
* `action` (the default), `trigger`, or `any` for both.
|
|
6747
|
+
* @default "action"
|
|
6748
|
+
*/
|
|
6749
|
+
kind?: "action" | "trigger" | "any";
|
|
4969
6750
|
/**
|
|
4970
6751
|
* Results to return, from 1 to 50.
|
|
4971
6752
|
* @default 10
|
|
@@ -5087,8 +6868,16 @@ export interface PlatformListRequestsParams {
|
|
|
5087
6868
|
key_id?: string;
|
|
5088
6869
|
/** Only requests that arrived this way. */
|
|
5089
6870
|
connection?: RequestConnection;
|
|
6871
|
+
/**
|
|
6872
|
+
* Only requests from this source, or from any of a comma-separated list of them (`api_key,cli_token`), each a `RequestSource` value at most once. Leave `dashboard` out of the list to hide what the dashboard did.
|
|
6873
|
+
*/
|
|
6874
|
+
source?: string;
|
|
5090
6875
|
/** Only requests made from inside this sandbox. */
|
|
5091
6876
|
sandbox_id?: string;
|
|
6877
|
+
/**
|
|
6878
|
+
* Only requests of this W3C trace (the trace id of their `traceparent`): one chain of calls, such as a scrape, then a render, then a sandbox exec, made with one traceparent.
|
|
6879
|
+
*/
|
|
6880
|
+
trace_id?: string;
|
|
5092
6881
|
since?: string;
|
|
5093
6882
|
}
|
|
5094
6883
|
|