@b3os/sdk 0.0.1 → 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.
Files changed (204) hide show
  1. package/README.md +171 -42
  2. package/dist/cjs/core/bytes.d.ts +30 -0
  3. package/dist/cjs/core/bytes.js +115 -0
  4. package/dist/cjs/core/bytes.js.map +1 -0
  5. package/dist/cjs/core/client.d.ts +61 -3
  6. package/dist/cjs/core/client.js +211 -33
  7. package/dist/cjs/core/client.js.map +1 -1
  8. package/dist/cjs/core/errors.d.ts +16 -4
  9. package/dist/cjs/core/errors.js +9 -6
  10. package/dist/cjs/core/errors.js.map +1 -1
  11. package/dist/cjs/core/handle.d.ts +31 -0
  12. package/dist/cjs/core/handle.js +86 -0
  13. package/dist/cjs/core/handle.js.map +1 -0
  14. package/dist/cjs/core/index.d.ts +6 -4
  15. package/dist/cjs/core/index.js +8 -1
  16. package/dist/cjs/core/index.js.map +1 -1
  17. package/dist/cjs/core/login.d.ts +24 -0
  18. package/dist/cjs/core/login.js +93 -0
  19. package/dist/cjs/core/login.js.map +1 -0
  20. package/dist/cjs/core/namespace.d.ts +1 -1
  21. package/dist/cjs/core/namespace.js +1 -1
  22. package/dist/cjs/core/op.d.ts +11 -1
  23. package/dist/cjs/core/timing.d.ts +1 -1
  24. package/dist/cjs/core/timing.js +8 -1
  25. package/dist/cjs/core/timing.js.map +1 -1
  26. package/dist/cjs/core/transport.js +1 -1
  27. package/dist/cjs/core/transport.js.map +1 -1
  28. package/dist/cjs/core/util.d.ts +15 -3
  29. package/dist/cjs/core/util.js +54 -2
  30. package/dist/cjs/core/util.js.map +1 -1
  31. package/dist/cjs/core/ws.d.ts +4 -0
  32. package/dist/cjs/core/ws.js +7 -4
  33. package/dist/cjs/core/ws.js.map +1 -1
  34. package/dist/cjs/generated/client.d.ts +2 -2
  35. package/dist/cjs/generated/client.js +2 -2
  36. package/dist/cjs/generated/errors.d.ts +1 -1
  37. package/dist/cjs/generated/errors.js +30 -0
  38. package/dist/cjs/generated/errors.js.map +1 -1
  39. package/dist/cjs/generated/jobs.js +1 -1
  40. package/dist/cjs/generated/ns/actions.d.ts +48 -6
  41. package/dist/cjs/generated/ns/actions.js +59 -6
  42. package/dist/cjs/generated/ns/actions.js.map +1 -1
  43. package/dist/cjs/generated/ns/infer.d.ts +185 -54
  44. package/dist/cjs/generated/ns/infer.js +28 -74
  45. package/dist/cjs/generated/ns/infer.js.map +1 -1
  46. package/dist/cjs/generated/ns/keys.d.ts +12 -0
  47. package/dist/cjs/generated/ns/keys.js +22 -0
  48. package/dist/cjs/generated/ns/keys.js.map +1 -1
  49. package/dist/cjs/generated/ns/render.d.ts +95 -6
  50. package/dist/cjs/generated/ns/render.js +124 -7
  51. package/dist/cjs/generated/ns/render.js.map +1 -1
  52. package/dist/cjs/generated/ns/requests.d.ts +3 -1
  53. package/dist/cjs/generated/ns/requests.js +3 -1
  54. package/dist/cjs/generated/ns/requests.js.map +1 -1
  55. package/dist/cjs/generated/ns/routines.d.ts +131 -9
  56. package/dist/cjs/generated/ns/routines.js +186 -9
  57. package/dist/cjs/generated/ns/routines.js.map +1 -1
  58. package/dist/cjs/generated/ns/sandboxes.d.ts +298 -31
  59. package/dist/cjs/generated/ns/sandboxes.js +368 -29
  60. package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
  61. package/dist/cjs/generated/ns/vision.d.ts +133 -14
  62. package/dist/cjs/generated/ns/vision.js +158 -12
  63. package/dist/cjs/generated/ns/vision.js.map +1 -1
  64. package/dist/cjs/generated/ns/webhooks.d.ts +8 -5
  65. package/dist/cjs/generated/ns/webhooks.js +8 -5
  66. package/dist/cjs/generated/ns/webhooks.js.map +1 -1
  67. package/dist/cjs/generated/types.d.ts +1956 -301
  68. package/dist/cjs/helpers/agents.d.ts +95 -0
  69. package/dist/cjs/helpers/agents.js +205 -0
  70. package/dist/cjs/helpers/agents.js.map +1 -0
  71. package/dist/cjs/helpers/render.d.ts +15 -0
  72. package/dist/cjs/helpers/render.js +74 -0
  73. package/dist/cjs/helpers/render.js.map +1 -0
  74. package/dist/cjs/helpers/routines.d.ts +61 -0
  75. package/dist/cjs/helpers/routines.js +234 -0
  76. package/dist/cjs/helpers/routines.js.map +1 -0
  77. package/dist/cjs/helpers/sandboxes.d.ts +237 -0
  78. package/dist/cjs/helpers/sandboxes.js +608 -0
  79. package/dist/cjs/helpers/sandboxes.js.map +1 -0
  80. package/dist/cjs/index.d.ts +4 -1
  81. package/dist/cjs/index.js +8 -5
  82. package/dist/cjs/index.js.map +1 -1
  83. package/dist/cjs/routines.d.ts +1 -0
  84. package/dist/cjs/routines.js +21 -0
  85. package/dist/cjs/routines.js.map +1 -0
  86. package/dist/cjs/webhooks.js.map +1 -1
  87. package/dist/esm/core/bytes.d.ts +30 -0
  88. package/dist/esm/core/bytes.js +111 -0
  89. package/dist/esm/core/bytes.js.map +1 -0
  90. package/dist/esm/core/client.d.ts +61 -3
  91. package/dist/esm/core/client.js +208 -31
  92. package/dist/esm/core/client.js.map +1 -1
  93. package/dist/esm/core/errors.d.ts +16 -4
  94. package/dist/esm/core/errors.js +9 -6
  95. package/dist/esm/core/errors.js.map +1 -1
  96. package/dist/esm/core/handle.d.ts +31 -0
  97. package/dist/esm/core/handle.js +82 -0
  98. package/dist/esm/core/handle.js.map +1 -0
  99. package/dist/esm/core/index.d.ts +6 -4
  100. package/dist/esm/core/index.js +4 -2
  101. package/dist/esm/core/index.js.map +1 -1
  102. package/dist/esm/core/login.d.ts +24 -0
  103. package/dist/esm/core/login.js +85 -0
  104. package/dist/esm/core/login.js.map +1 -0
  105. package/dist/esm/core/namespace.d.ts +1 -1
  106. package/dist/esm/core/namespace.js +1 -1
  107. package/dist/esm/core/op.d.ts +11 -1
  108. package/dist/esm/core/timing.d.ts +1 -1
  109. package/dist/esm/core/timing.js +8 -1
  110. package/dist/esm/core/timing.js.map +1 -1
  111. package/dist/esm/core/transport.js +1 -1
  112. package/dist/esm/core/transport.js.map +1 -1
  113. package/dist/esm/core/util.d.ts +15 -3
  114. package/dist/esm/core/util.js +48 -1
  115. package/dist/esm/core/util.js.map +1 -1
  116. package/dist/esm/core/ws.d.ts +4 -0
  117. package/dist/esm/core/ws.js +7 -4
  118. package/dist/esm/core/ws.js.map +1 -1
  119. package/dist/esm/generated/client.d.ts +2 -2
  120. package/dist/esm/generated/client.js +2 -2
  121. package/dist/esm/generated/errors.d.ts +1 -1
  122. package/dist/esm/generated/errors.js +30 -0
  123. package/dist/esm/generated/errors.js.map +1 -1
  124. package/dist/esm/generated/jobs.js +1 -1
  125. package/dist/esm/generated/ns/actions.d.ts +48 -6
  126. package/dist/esm/generated/ns/actions.js +59 -6
  127. package/dist/esm/generated/ns/actions.js.map +1 -1
  128. package/dist/esm/generated/ns/infer.d.ts +185 -54
  129. package/dist/esm/generated/ns/infer.js +28 -74
  130. package/dist/esm/generated/ns/infer.js.map +1 -1
  131. package/dist/esm/generated/ns/keys.d.ts +12 -0
  132. package/dist/esm/generated/ns/keys.js +22 -0
  133. package/dist/esm/generated/ns/keys.js.map +1 -1
  134. package/dist/esm/generated/ns/render.d.ts +95 -6
  135. package/dist/esm/generated/ns/render.js +124 -7
  136. package/dist/esm/generated/ns/render.js.map +1 -1
  137. package/dist/esm/generated/ns/requests.d.ts +3 -1
  138. package/dist/esm/generated/ns/requests.js +3 -1
  139. package/dist/esm/generated/ns/requests.js.map +1 -1
  140. package/dist/esm/generated/ns/routines.d.ts +131 -9
  141. package/dist/esm/generated/ns/routines.js +186 -9
  142. package/dist/esm/generated/ns/routines.js.map +1 -1
  143. package/dist/esm/generated/ns/sandboxes.d.ts +298 -31
  144. package/dist/esm/generated/ns/sandboxes.js +368 -29
  145. package/dist/esm/generated/ns/sandboxes.js.map +1 -1
  146. package/dist/esm/generated/ns/vision.d.ts +133 -14
  147. package/dist/esm/generated/ns/vision.js +158 -12
  148. package/dist/esm/generated/ns/vision.js.map +1 -1
  149. package/dist/esm/generated/ns/webhooks.d.ts +8 -5
  150. package/dist/esm/generated/ns/webhooks.js +8 -5
  151. package/dist/esm/generated/ns/webhooks.js.map +1 -1
  152. package/dist/esm/generated/types.d.ts +1956 -301
  153. package/dist/esm/helpers/agents.d.ts +95 -0
  154. package/dist/esm/helpers/agents.js +199 -0
  155. package/dist/esm/helpers/agents.js.map +1 -0
  156. package/dist/esm/helpers/render.d.ts +15 -0
  157. package/dist/esm/helpers/render.js +70 -0
  158. package/dist/esm/helpers/render.js.map +1 -0
  159. package/dist/esm/helpers/routines.d.ts +61 -0
  160. package/dist/esm/helpers/routines.js +226 -0
  161. package/dist/esm/helpers/routines.js.map +1 -0
  162. package/dist/esm/helpers/sandboxes.d.ts +237 -0
  163. package/dist/esm/helpers/sandboxes.js +600 -0
  164. package/dist/esm/helpers/sandboxes.js.map +1 -0
  165. package/dist/esm/index.d.ts +4 -1
  166. package/dist/esm/index.js +6 -5
  167. package/dist/esm/index.js.map +1 -1
  168. package/dist/esm/routines.d.ts +1 -0
  169. package/dist/esm/routines.js +5 -0
  170. package/dist/esm/routines.js.map +1 -0
  171. package/dist/esm/webhooks.js.map +1 -1
  172. package/package.json +18 -7
  173. package/src/core/bytes.ts +112 -0
  174. package/src/core/client.ts +253 -33
  175. package/src/core/errors.ts +27 -10
  176. package/src/core/handle.ts +97 -0
  177. package/src/core/index.ts +7 -2
  178. package/src/core/login.ts +98 -0
  179. package/src/core/namespace.ts +1 -1
  180. package/src/core/op.ts +11 -1
  181. package/src/core/timing.ts +7 -2
  182. package/src/core/transport.ts +1 -1
  183. package/src/core/util.ts +53 -3
  184. package/src/core/ws.ts +11 -4
  185. package/src/generated/client.ts +2 -2
  186. package/src/generated/errors.ts +60 -0
  187. package/src/generated/jobs.ts +1 -1
  188. package/src/generated/ns/actions.ts +69 -6
  189. package/src/generated/ns/infer.ts +229 -61
  190. package/src/generated/ns/keys.ts +23 -0
  191. package/src/generated/ns/render.ts +152 -7
  192. package/src/generated/ns/requests.ts +3 -1
  193. package/src/generated/ns/routines.ts +205 -9
  194. package/src/generated/ns/sandboxes.ts +434 -34
  195. package/src/generated/ns/vision.ts +168 -14
  196. package/src/generated/ns/webhooks.ts +8 -5
  197. package/src/generated/types.ts +2211 -422
  198. package/src/helpers/agents.ts +300 -0
  199. package/src/helpers/render.ts +91 -0
  200. package/src/helpers/routines.ts +278 -0
  201. package/src/helpers/sandboxes.ts +788 -0
  202. package/src/index.ts +29 -5
  203. package/src/routines.ts +5 -0
  204. package/src/webhooks.ts +5 -1
@@ -8,7 +8,7 @@ export type Metadata = Record<string, string>;
8
8
  * for every scope. The build generates `enum` from the catalog, the same list as `dist/scopes.json` plus
9
9
  * `<product>:*` and `*`.
10
10
  */
11
- export type Scope = "vision:read" | "vision:write" | "vision:run" | "render:read" | "render:write" | "render:run" | "sandboxes:read" | "sandboxes:write" | "sandboxes:run" | "routines:read" | "routines:write" | "routines:run" | "actions:read" | "actions:write" | "actions:run" | "infer:read" | "infer:write" | "infer:run" | "vault:read" | "vault:write" | "vault:run" | "platform:read" | "platform:write" | "vision:*" | "render:*" | "sandboxes:*" | "routines:*" | "actions:*" | "infer:*" | "vault:*" | "platform:*" | "*";
11
+ export type Scope = "vision:read" | "vision:write" | "vision:run" | "vision:profiles:use" | "vision:profiles:export" | "render:read" | "render:write" | "render:run" | "sandboxes:read" | "sandboxes:write" | "sandboxes:run" | "routines:read" | "routines:write" | "routines:run" | "actions:read" | "actions:write" | "actions:run" | "infer:read" | "infer:write" | "infer:run" | "vault:read" | "vault:write" | "vault:run" | "platform:read" | "platform:write" | "vision:*" | "render:*" | "sandboxes:*" | "routines:*" | "actions:*" | "infer:*" | "vault:*" | "platform:*" | "*";
12
12
  /**
13
13
  * Server-side phase durations in milliseconds with microsecond resolution: the same phases as the
14
14
  * `Server-Timing` header, keyed `<phase>_ms`. `total_ms` is always present. Phase names are product-specific
@@ -18,6 +18,16 @@ export interface Timing {
18
18
  total_ms: number;
19
19
  [key: string]: unknown;
20
20
  }
21
+ /**
22
+ * 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.
23
+ */
24
+ export interface PageState {
25
+ state: "ok" | "blocked" | "captcha" | "cookie_wall" | "login" | "error" | "loading";
26
+ /**
27
+ * What decided it, such as `cloudflare_challenge`, `recaptcha`, `onetrust`, `password_form`, `status`, `title` or `empty_spa_root`.
28
+ */
29
+ signal?: string;
30
+ }
21
31
  /** One validation problem. */
22
32
  export interface ProblemItem {
23
33
  /**
@@ -84,6 +94,16 @@ export interface Problem {
84
94
  message: string;
85
95
  retryable: boolean;
86
96
  };
97
+ /**
98
+ * The option a request value was refused for, by its id (`option_not_allowed`), e.g. `sandboxes.clone_reset`.
99
+ */
100
+ option?: string;
101
+ /** The value the request asked for (`option_not_allowed`). */
102
+ value?: unknown;
103
+ /** The values the request may ask for (`option_not_allowed`, an option with a closed list of values). */
104
+ allowed?: unknown[];
105
+ /** What set the bound a refused value is outside (`option_not_allowed`); `node` is the node's policy. */
106
+ bound_by?: "node" | "org" | "flag" | "limit";
87
107
  [key: string]: unknown;
88
108
  }
89
109
  /** Returned by deletes. */
@@ -270,11 +290,21 @@ export interface StreamTicket {
270
290
  */
271
291
  export type ScrapeFormat = "markdown" | "html" | "raw_html" | "text" | "links" | "metadata" | "screenshot" | "json";
272
292
  /**
273
- * Which tier may serve the page. `auto` (default): cache, then HTTP fetch, then a browser when the page needs
274
- * JavaScript. `fetch`: never start a browser. `browser`: always render in Chrome (needed for `actions`,
275
- * `screenshot` and profiles; implied by them).
293
+ * Which tier may serve the page. `auto` (default): cache, then HTTP fetch, then a browser when the fetch may not
294
+ * be enough. `fetch`: never start a browser. `browser`: always render in Chrome (needed for `actions`,
295
+ * `screenshot` and profiles; implied by them). With `auto`, a browser runs when the page needs JavaScript, when
296
+ * the fetch came back thin or mostly script, and when the fetch failed in a way a browser may not.
276
297
  */
277
298
  export type ScrapeEngine = "auto" | "fetch" | "browser";
299
+ /**
300
+ * Which browser renders the page: `chrome` (full Chrome in its new headless mode) or `headless-shell`
301
+ * (chrome-headless-shell, which starts faster and uses less memory but has no `window.chrome` and no
302
+ * plugins). Both run the same launch profile: a current Chrome user agent without `HeadlessChrome`,
303
+ * `navigator.webdriver` false, and the time zone and locale of the node's egress location unless the
304
+ * request sets them. Sessions and pages in a browser of their own have WebGL on SwiftShader; pages in the
305
+ * shared scrape pool, whose browsers serve several organizations at once, have no WebGL.
306
+ */
307
+ export type BrowserEngine = "chrome" | "headless-shell";
278
308
  /** Options for the `screenshot` format. */
279
309
  export interface ScreenshotOptions {
280
310
  /** @default false */
@@ -308,39 +338,59 @@ export interface ScrapeOptions {
308
338
  /** CSS selectors to drop. */
309
339
  exclude_tags?: string[];
310
340
  engine?: ScrapeEngine;
341
+ /**
342
+ * 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.
343
+ * @default "headless-shell"
344
+ */
345
+ browser?: BrowserEngine;
311
346
  /**
312
347
  * Extra wait after the page is ready, before capture.
313
348
  * @default 0
314
349
  */
315
350
  wait_for_ms?: number;
316
- /** @default 30000 */
351
+ /**
352
+ * 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.
353
+ * @default 30000
354
+ */
317
355
  timeout_ms?: number;
318
356
  /**
319
357
  * Accept a cached copy up to this old (default 2 days). `0` always fetches.
320
358
  * @default 172800000
321
359
  */
322
360
  max_age_ms?: number;
361
+ /**
362
+ * 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.
363
+ * @default false
364
+ */
365
+ cache_only?: boolean;
323
366
  /**
324
367
  * Store the result in the cache. Requests with headers, a profile or actions are never shared across organizations.
325
368
  * @default true
326
369
  */
327
370
  store_in_cache?: boolean;
328
371
  /**
329
- * Extra request headers. A request with custom headers bypasses the shared 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 and is not sent to the other hosts the page loads from.
372
+ * 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`.
373
+ * @default false
374
+ */
375
+ respect_robots?: boolean;
376
+ /**
377
+ * 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.
330
378
  */
331
379
  headers?: Record<string, string>;
332
380
  /**
333
- * 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.
381
+ * 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.
334
382
  */
335
383
  profile?: string;
336
384
  /** Browser actions to run before capture. Implies `engine: browser`. */
337
385
  actions?: ActStep[];
338
386
  /**
339
- * BCP 47 locale for `Accept-Language` and the browser.
387
+ * 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).
340
388
  * @default "en-US"
341
389
  */
342
390
  locale?: string;
343
- /** IANA time zone for the browser, such as `America/Los_Angeles`. */
391
+ /**
392
+ * 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).
393
+ */
344
394
  timezone?: string;
345
395
  /**
346
396
  * Emulate a phone (viewport, user agent, touch).
@@ -359,6 +409,11 @@ export interface ScrapeOptions {
359
409
  block_resources?: Array<"image" | "media" | "font" | "stylesheet">;
360
410
  screenshot?: ScreenshotOptions;
361
411
  json?: JsonExtractOptions;
412
+ /**
413
+ * 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.
414
+ * @default "free"
415
+ */
416
+ walls?: "free" | "bill";
362
417
  }
363
418
  /** A URL plus scrape options. */
364
419
  export type ScrapeRequest = {
@@ -397,9 +452,13 @@ export interface ScrapeResult {
397
452
  object: "scrape";
398
453
  /** The requested URL. */
399
454
  url: string;
400
- /** The URL after redirects. */
455
+ /**
456
+ * 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.
457
+ */
401
458
  final_url: string;
402
- /** The HTTP status the site returned. A 404 page is still a successful scrape. */
459
+ /**
460
+ * 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.
461
+ */
403
462
  status_code: number;
404
463
  content_type?: string;
405
464
  /** What served the page. */
@@ -416,10 +475,31 @@ export interface ScrapeResult {
416
475
  metadata?: PageMetadata;
417
476
  /** Results of `actions`, in order. */
418
477
  actions?: ActStepResult[];
478
+ page_state?: PageState;
479
+ /**
480
+ * 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`.
481
+ */
482
+ content_withheld?: boolean;
419
483
  /** Non-fatal problems, such as a format that could not be produced. */
420
484
  warnings: string[];
421
485
  timing: Timing;
422
486
  }
487
+ export interface PrepareRequest {
488
+ /** The page a coming scrape will fetch. */
489
+ url: string;
490
+ /**
491
+ * Fetch and cache the origin's robots.txt and say whether it allows `url` (the scrape itself checks only when it sets `respect_robots`).
492
+ * @default false
493
+ */
494
+ respect_robots?: boolean;
495
+ }
496
+ export interface PrepareResult {
497
+ object: "prepare";
498
+ url: string;
499
+ /** `not_checked` unless the request set `respect_robots`. */
500
+ robots: "allowed" | "disallowed" | "unreachable" | "not_checked";
501
+ timing: Timing;
502
+ }
423
503
  export interface MapRequest {
424
504
  url: string;
425
505
  /** Order results by relevance to this phrase. */
@@ -438,8 +518,16 @@ export interface MapRequest {
438
518
  ignore_query_parameters?: boolean;
439
519
  /** @default 1000 */
440
520
  limit?: number;
441
- /** @default 30000 */
521
+ /**
522
+ * Time for the whole map, the start page and its sitemaps included.
523
+ * @default 30000
524
+ */
442
525
  timeout_ms?: number;
526
+ /**
527
+ * 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`.
528
+ * @default false
529
+ */
530
+ respect_robots?: boolean;
443
531
  }
444
532
  export interface MapResult {
445
533
  object: "map";
@@ -451,6 +539,60 @@ export interface MapResult {
451
539
  }[];
452
540
  timing: Timing;
453
541
  }
542
+ export interface SearchRequest {
543
+ /**
544
+ * What to search for, at most 50 words. Operators the provider supports pass through: `site:`, quotes, `-word`.
545
+ */
546
+ query: string;
547
+ /**
548
+ * Most results to return.
549
+ * @default 5
550
+ */
551
+ limit?: number;
552
+ /**
553
+ * 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.
554
+ */
555
+ country?: string;
556
+ /** Language of the results, like `en`, `de` or `pt-br`. */
557
+ lang?: string;
558
+ /** Only results the provider found within this past period. */
559
+ freshness?: "day" | "week" | "month" | "year";
560
+ /**
561
+ * Filter adult content.
562
+ * @default "moderate"
563
+ */
564
+ safe_search?: "off" | "moderate" | "strict";
565
+ /**
566
+ * Time for the whole search, the results' scrapes included. A scrape it cuts short is that result's `scrape_timeout` error.
567
+ * @default 30000
568
+ */
569
+ timeout_ms?: number;
570
+ /**
571
+ * 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.
572
+ */
573
+ scrape?: NestedScrapeOptions;
574
+ }
575
+ export interface SearchResult {
576
+ object: "search";
577
+ query: string;
578
+ results: {
579
+ /** Rank in the provider's order, from 1. */
580
+ position: number;
581
+ url: string;
582
+ title: string;
583
+ description?: string;
584
+ scrape?: ScrapeResult;
585
+ error?: Problem;
586
+ }[];
587
+ /**
588
+ * `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`.
589
+ */
590
+ warnings?: string[];
591
+ /**
592
+ * `search_ms` and `total_ms`, and `scrape_ms` when the request has `scrape` and the search found results.
593
+ */
594
+ timing: Timing;
595
+ }
454
596
  /** Scrape options applied to every page. */
455
597
  export type NestedScrapeOptions = ScrapeOptions;
456
598
  export interface BatchCreateRequest {
@@ -499,9 +641,19 @@ export interface CrawlCreateRequest {
499
641
  allow_external_links?: boolean;
500
642
  /** @default false */
501
643
  ignore_query_parameters?: boolean;
502
- /** Minimum gap between requests to the same host. */
644
+ /**
645
+ * Minimum gap between this crawl's requests to one host. Default 250 ms (or robots.txt's Crawl-delay with
646
+ * `respect_robots: true`). Whatever the value, job pages to one host start at least 250 ms apart
647
+ * node-wide, with at most 2 in flight to it per organization and 2 for all organizations together, and a
648
+ * 429 or 503 from the host pauses them for its `Retry-After`.
649
+ */
503
650
  delay_ms?: number;
504
651
  max_concurrency?: number;
652
+ /**
653
+ * 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.
654
+ * @default false
655
+ */
656
+ respect_robots?: boolean;
505
657
  scrape?: NestedScrapeOptions;
506
658
  webhook?: WebhookConfig;
507
659
  metadata?: Metadata;
@@ -542,7 +694,7 @@ export type Crawl = Omit<Job, "id" | "object" | "result"> & {
542
694
  result?: {
543
695
  pages_succeeded: number;
544
696
  pages_failed: number;
545
- /** URLs skipped because robots.txt disallows them. */
697
+ /** URLs skipped because robots.txt disallows them (empty unless the crawl set `respect_robots`). */
546
698
  robots_blocked: string[];
547
699
  };
548
700
  };
@@ -580,9 +732,16 @@ export type ExtractJob = Omit<Job, "id" | "object" | "result"> & {
580
732
  sources: string[];
581
733
  };
582
734
  };
583
- /** `active` until closed by `DELETE` (`closed`) or by its timeout (`expired`). */
735
+ /**
736
+ * `active` until closed by its timeout (`expired`) or otherwise (`closed`: `DELETE`, its browser stopped, or the node restarted; `closed_reason` says which).
737
+ */
584
738
  export type SessionStatus = "active" | "closed" | "expired";
585
739
  export interface SessionCreateRequest {
740
+ /**
741
+ * The session's browser. A session that asks for `headless-shell` starts its browser cold.
742
+ * @default "chrome"
743
+ */
744
+ browser?: BrowserEngine;
586
745
  /** A profile ID or name to load. */
587
746
  profile?: string;
588
747
  /**
@@ -596,8 +755,14 @@ export interface SessionCreateRequest {
596
755
  */
597
756
  overwrite_profile?: boolean;
598
757
  viewport?: Viewport;
599
- /** @default "en-US" */
758
+ /**
759
+ * 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).
760
+ * @default "en-US"
761
+ */
600
762
  locale?: string;
763
+ /**
764
+ * IANA time zone for the browser. Defaults to the time zone of the node's egress location (`America/Los_Angeles` on every node today).
765
+ */
601
766
  timezone?: string;
602
767
  user_agent?: string;
603
768
  /**
@@ -609,6 +774,73 @@ export interface SessionCreateRequest {
609
774
  block_ads?: boolean;
610
775
  block_resources?: Array<"image" | "media" | "font" | "stylesheet">;
611
776
  metadata?: Metadata;
777
+ /**
778
+ * Give each act step's row in the session timeline a JPEG thumbnail of the viewport, at most 320 px wide,
779
+ * taken after the step. Each thumbnail adds a capture to the act call's time.
780
+ * @default false
781
+ */
782
+ thumbnails?: boolean;
783
+ }
784
+ export interface SessionTimeline {
785
+ object: "session_timeline";
786
+ session_id: string;
787
+ viewport: Viewport;
788
+ steps: TimelineStep[];
789
+ cursor: CursorPoint[];
790
+ /** What did not fit in the session's timeline. */
791
+ dropped: {
792
+ steps: number;
793
+ points: number;
794
+ thumbnails: number;
795
+ };
796
+ }
797
+ export interface TimelineStep {
798
+ /** Which act call on the session (1, 2, ...). */
799
+ act: number;
800
+ /** The step's position in that call's `actions`. */
801
+ index: number;
802
+ kind: "navigate" | "click" | "hover" | "type" | "key" | "scroll" | "select" | "wait" | "evaluate" | "screenshot" | "markdown";
803
+ started_at: string;
804
+ /** Milliseconds from the session's creation to the step's start. */
805
+ at_ms: number;
806
+ duration_ms: number;
807
+ status: "ok" | "failed" | "skipped";
808
+ /**
809
+ * The target's box in the viewport (CSS pixels, after it was scrolled into view), or `null` for a step without a target.
810
+ */
811
+ target: null | TimelineBox;
812
+ /** The URL a `navigate` step reached. */
813
+ url: string | null;
814
+ /** The step's problem; only on a step that failed. */
815
+ error?: Problem;
816
+ /** A JPEG of the viewport after the step, or `null` (thumbnails off, skipped step, budget spent). */
817
+ thumbnail: null | TimelineThumbnail;
818
+ }
819
+ /** Target box */
820
+ export interface TimelineBox {
821
+ x: number;
822
+ y: number;
823
+ width: number;
824
+ height: number;
825
+ }
826
+ /** Thumbnail */
827
+ export interface TimelineThumbnail {
828
+ format: "jpeg";
829
+ width: number;
830
+ height: number;
831
+ data_base64: string;
832
+ }
833
+ export interface CursorPoint {
834
+ /** Milliseconds from the session's creation. */
835
+ at_ms: number;
836
+ x: number;
837
+ y: number;
838
+ /** `Input.dispatchMouseEvent` type: `mouseMoved`, `mousePressed`, `mouseReleased` or `mouseWheel`. */
839
+ type: string;
840
+ /** The button of a press or release (`left`, `middle`, `right`, `back`, `forward`). */
841
+ button?: string;
842
+ /** `act`: an act step. `cdp`: a CDP client on the session socket. */
843
+ source: "act" | "cdp";
612
844
  }
613
845
  export interface SessionPage {
614
846
  /** The CDP target ID. */
@@ -632,8 +864,16 @@ export interface BrowserSession {
632
864
  created_at: string;
633
865
  expires_at: string;
634
866
  closed_at: string | null;
867
+ /**
868
+ * Why the session closed; `null` while it is active. `deleted`: `DELETE`. `expired`: its timeout.
869
+ * `browser_exited`: its browser stopped under it. `node_restart`: the node stopped or restarted while the
870
+ * session was open; browser time is billed up to the stop and not after it (nothing when the node did not
871
+ * stop cleanly, since it cannot tell when the browser stopped). Closed sessions stay readable for 7 days.
872
+ */
873
+ closed_reason?: "deleted" | "expired" | "browser_exited" | "node_restart" | null;
635
874
  timeout_s: number;
636
875
  viewport: Viewport;
876
+ browser: BrowserEngine;
637
877
  /** The loaded profile, or `null`. */
638
878
  profile: null | SessionProfileRef;
639
879
  /** WebSocket URL of the session's CDP endpoint. */
@@ -651,10 +891,12 @@ export type BrowserSessionList = Omit<ListEnvelope, "data"> & {
651
891
  };
652
892
  /**
653
893
  * One browser action; `kind` selects it. The kinds and their fields match render timeline actions
654
- * (`navigate`, `click`, `hover`, `type`, `key`, `scroll`, `select`, `wait`) plus `evaluate`, `screenshot` and
655
- * `markdown`, which only `act` and scrape `actions` offer.
894
+ * (`navigate`, `click`, `hover`, `type`, `key`, `scroll`, `select`, `wait`) plus `evaluate`, `screenshot`,
895
+ * `markdown` and `snapshot`, which only `act` and scrape `actions` offer, as is `settle` on `navigate`,
896
+ * `click`, `type`, `key` and `select`.
656
897
  */
657
- export type ActStep = ActNavigate | ActClick | ActHover | ActType | ActKey | ActScroll | ActSelect | ActWait | ActEvaluate | ActScreenshot | ActMarkdown;
898
+ export type ActStep = ActNavigate | ActClick | ActHover | ActType | ActKey | ActScroll | ActSelect | ActWait | ActEvaluate | ActScreenshot | ActMarkdown | ActSnapshot;
899
+ /** Navigate */
658
900
  export interface ActNavigate {
659
901
  kind: "navigate";
660
902
  url: string;
@@ -662,10 +904,26 @@ export interface ActNavigate {
662
904
  wait_until?: "load" | "domcontentloaded" | "networkidle";
663
905
  /** @default 10000 */
664
906
  timeout_ms?: number;
907
+ settle?: ActSettle;
665
908
  }
909
+ /**
910
+ * 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.
911
+ */
912
+ export type ActSettle = boolean | {
913
+ /** @default 50 */
914
+ quiet_ms?: number;
915
+ /**
916
+ * The longest the settle waits (within the batch's own time).
917
+ * @default 5000
918
+ */
919
+ timeout_ms?: number;
920
+ };
921
+ /**
922
+ * 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.
923
+ */
666
924
  export interface ActClick {
667
925
  kind: "click";
668
- target: Target;
926
+ target: ActTarget;
669
927
  /** @default "left" */
670
928
  button?: "left" | "right" | "middle";
671
929
  /** @default 1 */
@@ -676,16 +934,21 @@ export interface ActClick {
676
934
  * @default 10000
677
935
  */
678
936
  timeout_ms?: number;
937
+ settle?: ActSettle;
679
938
  }
939
+ /** Hover */
680
940
  export interface ActHover {
681
941
  kind: "hover";
682
- target: Target;
942
+ target: ActTarget;
683
943
  /** @default 10000 */
684
944
  timeout_ms?: number;
685
945
  }
946
+ /**
947
+ * 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.
948
+ */
686
949
  export interface ActType {
687
950
  kind: "type";
688
- target?: Target;
951
+ target?: ActTarget;
689
952
  text: string;
690
953
  /**
691
954
  * Clear the field before typing.
@@ -699,27 +962,34 @@ export interface ActType {
699
962
  interval_ms?: number;
700
963
  /** @default 10000 */
701
964
  timeout_ms?: number;
965
+ settle?: ActSettle;
702
966
  }
967
+ /** Key */
703
968
  export interface ActKey {
704
969
  kind: "key";
705
970
  /** `KeyboardEvent.key`, such as `Enter`, `Tab` or `a`. */
706
971
  key: string;
707
972
  modifiers?: KeyModifiers;
973
+ settle?: ActSettle;
708
974
  }
709
975
  /** Scroll to an offset (`to`), by a delta (`by`), or until `target` is in view. */
710
976
  export interface ActScroll {
711
977
  kind: "scroll";
712
- target?: Target;
978
+ target?: ActTarget;
713
979
  to?: Point;
714
980
  by?: Point;
715
981
  }
982
+ /** Select */
716
983
  export interface ActSelect {
717
984
  kind: "select";
718
- target: Target;
985
+ target: ActTarget;
719
986
  /** The option value to select. */
720
987
  value: string;
988
+ settle?: ActSettle;
721
989
  }
722
- /** Wait a fixed time (`ms`) or until a condition holds (`for`). */
990
+ /**
991
+ * 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).
992
+ */
723
993
  export interface ActWait {
724
994
  kind: "wait";
725
995
  ms?: number;
@@ -727,6 +997,7 @@ export interface ActWait {
727
997
  /** @default 10000 */
728
998
  timeout_ms?: number;
729
999
  }
1000
+ /** Evaluate */
730
1001
  export interface ActEvaluate {
731
1002
  kind: "evaluate";
732
1003
  /**
@@ -734,9 +1005,10 @@ export interface ActEvaluate {
734
1005
  */
735
1006
  expression: string;
736
1007
  }
1008
+ /** Screenshot */
737
1009
  export interface ActScreenshot {
738
1010
  kind: "screenshot";
739
- target?: Target;
1011
+ target?: ActTarget;
740
1012
  /** @default false */
741
1013
  full_page?: boolean;
742
1014
  /** @default "jpeg" */
@@ -744,11 +1016,51 @@ export interface ActScreenshot {
744
1016
  /** @default 80 */
745
1017
  quality?: number;
746
1018
  }
1019
+ /** Markdown */
747
1020
  export interface ActMarkdown {
748
1021
  kind: "markdown";
749
1022
  /** @default true */
750
1023
  only_main_content?: boolean;
751
1024
  }
1025
+ /**
1026
+ * 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.
1027
+ */
1028
+ export interface ActSnapshot {
1029
+ kind: "snapshot";
1030
+ /** @default "skeleton" */
1031
+ mode?: "skeleton" | "full";
1032
+ /** CSS selector of the element to outline (the body by default). */
1033
+ root?: string;
1034
+ /** @default 4000 */
1035
+ max_tokens?: number;
1036
+ }
1037
+ /**
1038
+ * 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.
1039
+ */
1040
+ export type ActTarget = Target | SnapshotRef;
1041
+ /**
1042
+ * 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.
1043
+ */
1044
+ export interface SnapshotRef {
1045
+ ref: string;
1046
+ }
1047
+ export interface SnapshotData {
1048
+ /** The snapshot's id, the first part of its refs. */
1049
+ id: string;
1050
+ mode: "skeleton" | "full";
1051
+ /** The outline, one element per line; controls and headings end in `[ref=<id>:e<n>]`. */
1052
+ text: string;
1053
+ /** How many refs the outline holds. */
1054
+ refs: number;
1055
+ /** How many elements the outline lists. */
1056
+ nodes: number;
1057
+ /** The outline's size in tokens, counted as characters / 4. */
1058
+ tokens: number;
1059
+ /** Every element of the mode's kinds is listed (none counted instead, nothing cut by the budget). */
1060
+ complete: boolean;
1061
+ /** The budget (`max_tokens`) cut the outline. */
1062
+ truncated: boolean;
1063
+ }
752
1064
  export interface ActRequest {
753
1065
  actions: ActStep[];
754
1066
  /** The page to act on (from `pages`); defaults to the most recently active page. */
@@ -757,9 +1069,14 @@ export interface ActRequest {
757
1069
  continue_on_error?: boolean;
758
1070
  /** @default 30000 */
759
1071
  timeout_ms?: number;
1072
+ /**
1073
+ * Accept `confirm` dialogs (they are dismissed by default, so `confirm` returns false).
1074
+ * @default false
1075
+ */
1076
+ accept_confirm?: boolean;
760
1077
  }
761
1078
  export interface ActStepResult {
762
- kind: "navigate" | "click" | "hover" | "type" | "key" | "scroll" | "select" | "wait" | "evaluate" | "screenshot" | "markdown";
1079
+ kind: "navigate" | "click" | "hover" | "type" | "key" | "scroll" | "select" | "wait" | "evaluate" | "screenshot" | "markdown" | "snapshot";
763
1080
  status: "ok" | "failed" | "skipped";
764
1081
  duration_ms: number;
765
1082
  /** `navigate`: the URL after redirects. */
@@ -771,7 +1088,48 @@ export interface ActStepResult {
771
1088
  screenshot?: ScreenshotData;
772
1089
  /** `markdown`: the page as Markdown. */
773
1090
  markdown?: string;
1091
+ snapshot?: SnapshotData;
774
1092
  error?: Problem;
1093
+ /** JavaScript dialogs the page opened while the action ran, in order. Left out when there were none. */
1094
+ dialogs?: ActDialog[];
1095
+ delivery: ActDelivery;
1096
+ retry: ActRetry;
1097
+ /**
1098
+ * With `settle`: milliseconds from the browser's acknowledgement of the input until the page settled (or the settle's deadline). Left out without `settle`.
1099
+ */
1100
+ settled_ms?: number;
1101
+ /**
1102
+ * 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).
1103
+ */
1104
+ settled_by?: "quiet" | "navigation" | "deadline";
1105
+ /**
1106
+ * 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.
1107
+ */
1108
+ warnings?: string[];
1109
+ }
1110
+ /**
1111
+ * Whether the action's input reached the page, on every result, failed and skipped ones included.
1112
+ * `delivered_verified`: sent, and the page's answer was seen (a `navigate` whose document loaded).
1113
+ * `delivered_unverified`: sent and acknowledged by the browser (a click, typed text, a key, a select, an
1114
+ * `evaluate`); what the page did with it is not checked. `delivery_uncertain`: part of it may have reached the
1115
+ * page (a `navigate` that timed out, `type` with `interval_ms` cut off). `not_delivered`: nothing was sent:
1116
+ * the target was missing, covered (`target_covered`) or stale (`stale_ref`), a field or option check refused,
1117
+ * the step was skipped, or the action sends no input (`wait`, `screenshot`, `markdown`, `snapshot`).
1118
+ * `unknown`: the browser stopped answering, or the batch ran out of time, after the input was sent.
1119
+ */
1120
+ export type ActDelivery = "delivered_verified" | "delivered_unverified" | "delivery_uncertain" | "not_delivered" | "unknown";
1121
+ /**
1122
+ * Whether sending the action again is safe. `safe`: nothing was sent, or the action does the same thing
1123
+ * twice (`navigate`, `hover`, `scroll`, the read actions). `unsafe`: its input landed and a second send repeats
1124
+ * it (a second click, the text typed twice). `unknown`: whether its input landed cannot be told (`delivery`
1125
+ * `unknown`, or an `evaluate` that threw part way).
1126
+ */
1127
+ export type ActRetry = "safe" | "unsafe" | "unknown";
1128
+ export interface ActDialog {
1129
+ type: "alert" | "confirm" | "prompt" | "beforeunload";
1130
+ /** The dialog's text (cut at 1,000 characters). */
1131
+ message: string;
1132
+ action: "accepted" | "dismissed";
775
1133
  }
776
1134
  export interface ActResult {
777
1135
  object: "act_result";
@@ -796,6 +1154,10 @@ export interface Profile {
796
1154
  expires_at?: ProfileTimestamp | null;
797
1155
  metadata: ProfileMetadata;
798
1156
  name: string;
1157
+ /**
1158
+ * 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.
1159
+ */
1160
+ exportable: boolean;
799
1161
  /** Owning org. Returned to the owner only; tenancy is checked on every access. */
800
1162
  org?: string;
801
1163
  project?: string;
@@ -841,7 +1203,9 @@ export type ProfileMetadata = Record<string, string>;
841
1203
  export interface ProfileCookie {
842
1204
  name: string;
843
1205
  value: string;
844
- /** Host or .domain the cookie belongs to. */
1206
+ /**
1207
+ * 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).
1208
+ */
845
1209
  domain: string;
846
1210
  path: string;
847
1211
  /** Unix time in seconds; -1 for a session cookie. */
@@ -894,7 +1258,9 @@ export interface ProfileOpfsEntry {
894
1258
  base64?: string;
895
1259
  }
896
1260
  export interface ProfileOrigin {
897
- /** Serialized origin: scheme://host[:port], no path. */
1261
+ /**
1262
+ * Serialized origin: scheme://host[:port], no path. The host has two or more labels or is an IPv4 address.
1263
+ */
898
1264
  origin: string;
899
1265
  localStorage: ProfileNameValue[];
900
1266
  indexedDB?: ProfileIndexedDBDatabase[];
@@ -911,7 +1277,11 @@ export interface ProfileCreateRequest {
911
1277
  /** Unique per project. */
912
1278
  name: string;
913
1279
  state: ProfileStorageState;
914
- /** Registrable domains the profile may hold state for. Derived from `state` when omitted. */
1280
+ /**
1281
+ * Registrable domains the profile may hold state for. Derived from `state` when omitted. Each is a name of
1282
+ * two or more labels or an IPv4 address; a leading dot and capitals are dropped (spellings of one domain
1283
+ * count once); anything else answers 400 `invalid_request` with the item's pointer.
1284
+ */
915
1285
  domains?: string[];
916
1286
  /** Delete the profile automatically at this time. */
917
1287
  expires_at?: string;
@@ -939,19 +1309,252 @@ export type ProfileList = Omit<ListEnvelope, "data"> & {
939
1309
  /** A preset ID from `GET /v1/render/presets`, such as `midnight`, `browser-dark` or `mac`. */
940
1310
  export type PresetRef = string;
941
1311
  export type PresetKind = "background" | "frame" | "cursor" | "captions" | "click_effect";
1312
+ /** A background preset (`GET /v1/render/presets?kind=background` has a preview of each). */
1313
+ export type BackgroundPreset = "b3os-light" | "b3os-dark" | "b3os-blue" | "midnight" | "aurora" | "sunset" | "ocean" | "arctic" | "dusk" | "forest" | "ember" | "graphite" | "paper";
1314
+ /** A window frame preset (`GET /v1/render/presets?kind=frame` has a preview of each). */
1315
+ export type FramePreset = "mac" | "mac-dark" | "browser" | "browser-dark" | "windows" | "windows-dark" | "phone" | "tablet" | "laptop" | "laptop-dark" | "desktop";
1316
+ /** A cursor preset (`GET /v1/render/presets?kind=cursor` has a preview of each). */
1317
+ export type CursorPreset = "arrow" | "arrow-light" | "dot";
1318
+ /** A caption style preset (`GET /v1/render/presets?kind=captions` has a preview of each). */
1319
+ export type CaptionsPreset = "default" | "bold" | "minimal" | "light";
1320
+ /** A click effect preset (`GET /v1/render/presets?kind=click_effect` has a preview of each). */
1321
+ export type ClickEffectPreset = "ripple" | "ring";
942
1322
  /**
943
- * Style presets plus overrides, the same object as a timeline's `style` (restyle replaces exactly this). Field
944
- * values inside `overrides` follow the compositor's style type (padding, corner radius, shadow, colors,
945
- * gradients); strings are escaped before they reach any HTML or CSS.
1323
+ * One preset for each part plus `overrides`, the same object as a timeline's `style` (restyle replaces exactly
1324
+ * this). Every field is optional. The per-kind enums (`BackgroundPreset`, `FramePreset`, `CursorPreset`,
1325
+ * `CaptionsPreset`, `ClickEffectPreset`) list today's presets; the schema also takes any preset ID so a preset
1326
+ * added later needs no client update, and the node refuses an ID that is not a preset of that kind with
1327
+ * `style_invalid`. `none` draws nothing for that part; `auto` (the default background) picks one of the studio
1328
+ * backgrounds (`GET /v1/render/backgrounds`, pack `studio`, tag `auto`) for the page, one whose color just
1329
+ * outside the window's edges is at least 12 L* from the page's own (a dark page gets one at least 20 L*
1330
+ * lighter), the same pick for the same page every time; `transparent` leaves the background transparent.
1331
+ * Strings are drawn by the compositor and escaped before they reach any HTML or CSS.
946
1332
  */
947
1333
  export interface RenderStyle {
948
- background?: PresetRef;
949
- frame?: PresetRef;
950
- cursor?: PresetRef;
951
- captions?: PresetRef;
952
- click_effect?: PresetRef;
953
- /** Style fields that override the presets. */
954
- overrides?: Record<string, unknown>;
1334
+ /** A background preset, or `auto`, `transparent` or `none`. */
1335
+ background?: BackgroundPreset | "auto" | "transparent" | "none" | (string & {});
1336
+ /** A window frame preset, or `none`. */
1337
+ frame?: FramePreset | "none" | (string & {});
1338
+ /** A cursor preset, or `none`. */
1339
+ cursor?: CursorPreset | "none" | (string & {});
1340
+ /** A caption style preset, or `none`. */
1341
+ captions?: CaptionsPreset | "none" | (string & {});
1342
+ /** A click effect preset, or `none`. */
1343
+ click_effect?: ClickEffectPreset | "none" | (string & {});
1344
+ overrides?: RenderStyleOverrides;
1345
+ }
1346
+ /**
1347
+ * A color: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb(r,g,b)`, `rgba(r,g,b,a)`, `rgb(r g b / a)` (channels
1348
+ * 0-255 or percentages, alpha 0-1 or a percentage), or `white`, `black` or `transparent`.
1349
+ */
1350
+ export type RenderColor = string;
1351
+ /** One shadow, in CSS pixels; a field left out is 0, and the color defaults to black at 25% alpha. */
1352
+ export interface RenderShadow {
1353
+ x?: number;
1354
+ y?: number;
1355
+ blur?: number;
1356
+ spread?: number;
1357
+ color?: RenderColor;
1358
+ }
1359
+ export type RenderGradientStop = RenderColor | {
1360
+ color: RenderColor;
1361
+ /**
1362
+ * Position along the gradient, 0 to 1, never less than the stop before. Left out, stops are spaced evenly.
1363
+ */
1364
+ at?: number;
1365
+ };
1366
+ /**
1367
+ * Style fields that override the presets; a closed set, so any other key is refused with `style_invalid`.
1368
+ * Lengths are CSS pixels, scaled with the device pixel ratio for screenshots and with the output size for
1369
+ * videos (relative to 1080p).
1370
+ */
1371
+ export interface RenderStyleOverrides {
1372
+ /** Space around the page, the same on every side or `{x, y}`. */
1373
+ padding?: number | {
1374
+ x?: number;
1375
+ y?: number;
1376
+ };
1377
+ corner_radius?: number;
1378
+ /** A shadow preset, one shadow, or a list of up to 4 drawn together. */
1379
+ shadow?: "none" | "soft" | "float" | "hard" | "glow" | RenderShadow | RenderShadow[];
1380
+ /**
1381
+ * `none`, or a border of `width` (default 1) and `color`. Left out, a hairline matched to the background.
1382
+ */
1383
+ border?: "none" | {
1384
+ width?: number;
1385
+ color?: RenderColor;
1386
+ };
1387
+ background_color?: RenderColor;
1388
+ /** A linear gradient at `angle` degrees (135 by default), or a radial one with `kind` radial. */
1389
+ background_gradient?: {
1390
+ kind?: "linear" | "radial";
1391
+ angle?: number;
1392
+ stops: RenderGradientStop[];
1393
+ };
1394
+ /**
1395
+ * A library background, `<pack>/<slug>` (`GET /v1/render/backgrounds` lists them; ScreenFramed's
1396
+ * `gradients/<pack>/<slug>` names the same entry of that group). It replaces the preset's background and
1397
+ * cannot be combined with `background_color` or `background_gradient`. An unknown ref is refused with
1398
+ * `style_invalid` at `/overrides/background_ref`. An image background is fetched by the render node on its
1399
+ * first use there and cached; if it cannot be loaded the request fails with `background_unavailable` (503,
1400
+ * retry).
1401
+ *
1402
+ * `"auto"` (screenshots only) picks a library image that fits the captured page: one of the quiet, bold or
1403
+ * soft-photo backgrounds (quiet ones first), in the page's light or dark theme (or `theme`'s), so a light
1404
+ * page gets a light, soft background and a dark page a dark one, with clear lightness separation, a hue
1405
+ * analogous or complementary to the page's accent, little detail where it shows around the window, and
1406
+ * enough pixels for the output. The same page gets the same background; the screenshot's `background_ref`
1407
+ * names the one drawn. If the chosen image cannot be loaded within 2 s, the screenshot keeps the style's own
1408
+ * background (the `auto` background preset unless `background` names another) and `warnings` says so
1409
+ * (`background_fallback`).
1410
+ */
1411
+ background_ref?: string;
1412
+ /**
1413
+ * A text block set by the compositor above or below the window of a screenshot (Geist; never parsed as
1414
+ * HTML): an optional badge pill, a title (up to `title_lines` lines, 3 by default) and a subtitle (up to 4
1415
+ * lines), wrapped at `max_width` (the window's width by default); a line that does not fit ends with an
1416
+ * ellipsis. With `autofit` the title shrinks to fit instead. It needs a title, a subtitle or a badge. The
1417
+ * canvas grows to hold it, or on a fixed `canvas` the page shrinks. Screenshots only: a video with `text`
1418
+ * is refused with `style_invalid` at `/overrides/text`.
1419
+ */
1420
+ text?: {
1421
+ title?: string;
1422
+ subtitle?: string;
1423
+ badge?: string;
1424
+ /** Above (the default) or below the window. */
1425
+ position?: "above" | "below";
1426
+ /** Center (the default), left or right; left and right line up with the window's edge. */
1427
+ align?: "left" | "center" | "right";
1428
+ color?: RenderColor;
1429
+ badge_color?: RenderColor;
1430
+ /** Title size in CSS pixels, 48 by default (the subtitle's is 22). */
1431
+ title_size?: number;
1432
+ subtitle_size?: number;
1433
+ /** Wrapping width in CSS pixels; the window's width by default. */
1434
+ max_width?: number;
1435
+ /** Space between the text and the window, 40 by default. */
1436
+ gap?: number;
1437
+ /** The most lines the title wraps to, 3 by default. */
1438
+ title_lines?: number;
1439
+ /**
1440
+ * Sets the title at the largest size from `title_size` down to `fit_min` (in steps of 0.25 px) at
1441
+ * which it fits in `title_lines` lines with no word broken or cut; the subtitle and the badge keep
1442
+ * their ratio to it. A title that does not fit even at `fit_min` is set at `fit_min` with an ellipsis.
1443
+ * False by default.
1444
+ */
1445
+ autofit?: boolean;
1446
+ /**
1447
+ * The smallest title size `autofit` may use, in CSS pixels: half of `title_size` by default, at least
1448
+ * 12. A value above `title_size` counts as `title_size`; without `autofit` it is unused.
1449
+ */
1450
+ fit_min?: number;
1451
+ };
1452
+ /**
1453
+ * Tilts the window in 3D (ScreenFramed's presets; CSS `perspective: 1000px` about the canvas center),
1454
+ * scaled by `perspective_intensity`. Screenshots only, like every camera field below.
1455
+ */
1456
+ perspective?: "none" | "tilt-left" | "tilt-right" | "tilt-up" | "tilt-down" | "tilt-left-strong" | "tilt-right-strong" | "iso-left" | "iso-right";
1457
+ /** How much of the `perspective` preset to apply, 50 by default. */
1458
+ perspective_intensity?: number;
1459
+ /**
1460
+ * A camera preset (tilt, roll, offset, frame scale and depth blur): `hero` 6/-6 degrees, offset 160,80,
1461
+ * 1.25x; `dashboard` 4/5, offset 10,70, 1.1x; `flat`; `cinematic` 25/0, 1.1x; `detail` 18/-9, offset
1462
+ * -30,0, 1.95x. Not with `perspective`; the single fields below override it, and `depth_blur` lists the
1463
+ * blur each one brings.
1464
+ */
1465
+ camera?: "hero" | "dashboard" | "flat" | "cinematic" | "detail";
1466
+ /** Degrees about the horizontal axis; positive tips the top away. */
1467
+ tilt_x?: number;
1468
+ /** Degrees about the vertical axis; positive turns the right side away. */
1469
+ tilt_y?: number;
1470
+ /** Degrees in the picture plane, clockwise. */
1471
+ roll?: number;
1472
+ /** Moves the tilted window, in CSS pixels. */
1473
+ camera_offset?: {
1474
+ x?: number;
1475
+ y?: number;
1476
+ };
1477
+ /** Scales the window about its center before the tilt; above 1 it may run past the canvas edges. */
1478
+ frame_scale?: number;
1479
+ /**
1480
+ * Depth of field over the whole composed screenshot (background, window, shadows and text): a Gaussian
1481
+ * blur whose sigma, in CSS pixels, is this value where the blur is full, mixed over the sharp image by
1482
+ * the `depth_blur_type` mask. The `hero` and `dashboard` cameras bring 6 from position 0.7, `cinematic`
1483
+ * 38 from 0.45 and `detail` 4 from 0.3 (ScreenFramed's presets); 0 turns the blur off. Screenshots only:
1484
+ * a video with a depth blur is refused with `style_invalid` at `/overrides/depth_blur`.
1485
+ */
1486
+ depth_blur?: number;
1487
+ /**
1488
+ * `dir` (the default) stays sharp up to `depth_blur_position` along `depth_blur_angle` and blurs toward
1489
+ * the far edge; `tilt` keeps a sharp band `depth_blur_band` wide centered at `depth_blur_position` and
1490
+ * blurs both sides; `radial` keeps the center sharp (18% of the half-diagonal) and blurs toward the
1491
+ * corners; `lens` is radial with a sharp circle of radius `depth_blur_width`. Needs `depth_blur`.
1492
+ */
1493
+ depth_blur_type?: "dir" | "radial" | "tilt" | "lens";
1494
+ /**
1495
+ * `dir` and `tilt`: the direction the blur grows toward (or the axis across the band), in degrees: 0 up,
1496
+ * 90 right, 180 down (the default), 270 left.
1497
+ */
1498
+ depth_blur_angle?: number;
1499
+ /**
1500
+ * `dir`: where the blur starts along the axis, 0.35 by default; `tilt`: the sharp band's center, 0.5 by
1501
+ * default.
1502
+ */
1503
+ depth_blur_position?: number;
1504
+ /** `tilt` only: the sharp band's width as a fraction of the axis, 0.25 by default. */
1505
+ depth_blur_band?: number;
1506
+ /** `lens` only: the sharp circle's radius as a fraction of the half-diagonal, 0.3 by default. */
1507
+ depth_blur_width?: number;
1508
+ /**
1509
+ * New colors for the library background's color tokens (each row of `GET /v1/render/backgrounds` lists its
1510
+ * `tokens`), for example `{"accent": "#2f43ff"}`. Needs `background_ref`; an unknown token is refused at
1511
+ * `/overrides/background_tokens/<token>`.
1512
+ */
1513
+ background_tokens?: Record<string, RenderColor>;
1514
+ /** The canvas aspect ratio; a screenshot's canvas grows to it. */
1515
+ aspect_ratio?: "auto" | "16:9" | "16:10" | "4:3" | "3:2" | "1:1" | "4:5" | "3:4" | "9:16" | "21:9";
1516
+ /** A fixed screenshot size; the page is fitted into it by `fit`. */
1517
+ canvas?: {
1518
+ width: number;
1519
+ height: number;
1520
+ };
1521
+ /** `contain` (the default) fits the whole page; `cover` fills the width and crops the bottom. */
1522
+ fit?: "contain" | "cover";
1523
+ /**
1524
+ * Where the window sits (ScreenFramed's `layout`). `default` centers it with `padding` around it.
1525
+ * `bottom-cropped` is a hero: the window is 80% of the canvas wide with equal sides and runs off the
1526
+ * bottom edge, so the top of the page shows and no bottom corner does. With `text` its top edge is at 28%
1527
+ * to 34% of the height and the text block is centered above it (the block shrinks as one until it fits,
1528
+ * and the title defaults to `title_lines` 2 with `autofit`); without text the top margin equals the
1529
+ * sides. On a fixed `canvas` the page is scaled to the window and the text sizes scale with it; without
1530
+ * one the page keeps its pixels and the canvas is the window's width / 0.8 wide at `aspect_ratio` (16:9
1531
+ * by default). `padding` and `fit` do not apply to it, nor does `text.position` `below`, and it does not
1532
+ * combine with a camera or perspective. Screenshots only: a video with it is refused with
1533
+ * `style_invalid` at `/overrides/layout`.
1534
+ */
1535
+ layout?: "default" | "bottom-cropped";
1536
+ /** Text for the window's title bar, drawn by the compositor and never parsed as HTML. */
1537
+ frame_title?: string;
1538
+ /** Text for the address pill of a browser frame, drawn by the compositor and never parsed as HTML. */
1539
+ frame_url?: string;
1540
+ /** Flips the frame and the `auto` background. */
1541
+ theme?: "light" | "dark";
1542
+ /** Cursor scale, 1 by default. */
1543
+ cursor_size?: number;
1544
+ /** `false` keeps the cursor's size while the camera zooms. */
1545
+ cursor_zoom?: boolean;
1546
+ click_color?: RenderColor;
1547
+ /** How long the click effect lasts, 450 by default. */
1548
+ click_duration_ms?: number;
1549
+ /** Caption text size in pixels at 1080p, 44 by default. */
1550
+ caption_size?: number;
1551
+ caption_color?: RenderColor;
1552
+ caption_highlight?: RenderColor;
1553
+ caption_background?: RenderColor;
1554
+ caption_position?: "bottom" | "top";
1555
+ /** Smear the cursor while it moves; on by default. */
1556
+ motion_blur?: boolean;
1557
+ matte?: RenderColor;
955
1558
  }
956
1559
  /** Give `url` or `html`. */
957
1560
  export type ScreenshotCreateRequest = {
@@ -970,8 +1573,11 @@ export type ScreenshotCreateRequest = {
970
1573
  /** @default false */
971
1574
  full_page?: boolean;
972
1575
  target?: Target;
973
- /** @default "load" */
974
- wait_until?: "load" | "domcontentloaded" | "networkidle";
1576
+ /**
1577
+ * 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.
1578
+ * @default "auto"
1579
+ */
1580
+ wait_until?: "auto" | "load" | "domcontentloaded" | "networkidle";
975
1581
  /**
976
1582
  * Extra settle time after the page is ready.
977
1583
  * @default 0
@@ -984,10 +1590,25 @@ export type ScreenshotCreateRequest = {
984
1590
  * @default "auto"
985
1591
  */
986
1592
  theme?: "light" | "dark" | "auto";
987
- /** CSS selectors to hide before capture (cookie banners, chat widgets). */
1593
+ /**
1594
+ * 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).
1595
+ */
988
1596
  hide?: string[];
989
- /** @default true */
1597
+ /**
1598
+ * 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.
1599
+ * @default true
1600
+ */
990
1601
  block_ads?: boolean;
1602
+ /**
1603
+ * `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.
1604
+ * @default "remove"
1605
+ */
1606
+ overlays?: "remove" | "keep";
1607
+ /**
1608
+ * `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.
1609
+ * @default "auto"
1610
+ */
1611
+ settle?: "auto" | "fast";
991
1612
  style?: RenderStyle;
992
1613
  /** @default "webp" */
993
1614
  format?: "webp" | "png" | "jpeg";
@@ -1025,8 +1646,45 @@ export interface Screenshot {
1025
1646
  artifacts: Artifact[];
1026
1647
  created_at: string;
1027
1648
  expires_at: string;
1649
+ /**
1650
+ * 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.
1651
+ */
1652
+ status_code?: number;
1653
+ /** The URL after redirects (absent for `html`). */
1654
+ final_url?: string;
1655
+ page_state?: ScreenshotPageState;
1656
+ /**
1657
+ * 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).
1658
+ */
1659
+ warnings?: string[];
1660
+ /** What the clean capture hid, by kind and signal, with how many (`overlays`, `block_ads`). */
1661
+ overlays_removed?: OverlayRemoved[];
1028
1662
  timing?: Timing;
1029
1663
  metadata: Metadata;
1664
+ /**
1665
+ * The library background drawn: the style's `overrides.background_ref`, or the image `"auto"` chose for
1666
+ * this page. Absent when the style draws no library background.
1667
+ */
1668
+ background_ref?: string;
1669
+ }
1670
+ /**
1671
+ * 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`.
1672
+ */
1673
+ export interface ScreenshotPageState {
1674
+ state: "ok" | "error" | "loading" | "login" | "paywall" | "cookie_wall";
1675
+ /** What decided it. */
1676
+ signal?: string;
1677
+ }
1678
+ export interface OverlayRemoved {
1679
+ /**
1680
+ * `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`.
1681
+ */
1682
+ kind: "consent" | "dialog" | "backdrop" | "banner" | "chat" | "ad_slot";
1683
+ /**
1684
+ * How it was recognized: a consent manager's name (`onetrust`, `sourcepoint`, `trustarc`...), `markup`, `text`, `banner`, `dialog`, `dim`, `promo`, `widget`, or `empty` for ad slots.
1685
+ */
1686
+ signal: string;
1687
+ count: number;
1030
1688
  }
1031
1689
  export type ScreenshotList = Omit<ListEnvelope, "data"> & {
1032
1690
  data: Screenshot[];
@@ -1034,7 +1692,10 @@ export type ScreenshotList = Omit<ListEnvelope, "data"> & {
1034
1692
  export interface Artifact {
1035
1693
  id: string;
1036
1694
  object: "artifact";
1037
- kind: "image" | "mp4" | "gif" | "poster" | "vtt" | "srt";
1695
+ /**
1696
+ * `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`).
1697
+ */
1698
+ kind: "image" | "mp4" | "gif" | "poster" | "vtt" | "srt" | "chapters" | "share";
1038
1699
  content_type: string;
1039
1700
  bytes?: number;
1040
1701
  width?: number;
@@ -1141,8 +1802,8 @@ export interface VoiceSpec {
1141
1802
  }
1142
1803
  export interface CaptionOptions {
1143
1804
  /**
1144
- * `none`: sidecar files only. `static`: draw each cue. `karaoke`: also highlight the spoken word.
1145
- * @default "none"
1805
+ * `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.
1806
+ * @default "static"
1146
1807
  */
1147
1808
  burn_in?: "none" | "static" | "karaoke";
1148
1809
  /** @default ["vtt"] */
@@ -1163,8 +1824,19 @@ export type VideoFormat = "mp4" | "gif" | "poster";
1163
1824
  export interface VideoCreateRequest {
1164
1825
  source: VideoSource;
1165
1826
  beats: Beat[];
1166
- voice?: VoiceSpec;
1827
+ /**
1828
+ * The narration voice. Leave it out and every beat with `say` is narrated in the node's default voice,
1829
+ * `kokoro-82m` `af_heart`, normalized to -16 LUFS. Narration is speech made as the caller, so it needs
1830
+ * `infer:run` in the key's scopes as well as `render:run`; a key without it gets a silent video with a
1831
+ * `narration_scope` warning. `null` makes a silent video: word times are then estimated from the text, so
1832
+ * steps and captions still follow the lines.
1833
+ */
1834
+ voice?: VoiceSpec | null;
1167
1835
  captions?: CaptionOptions;
1836
+ /**
1837
+ * The look. Leave it out for the B3OS look in a browser window (`{"frame": "browser"}`); `{}` is the look
1838
+ * without a window frame.
1839
+ */
1168
1840
  style?: RenderStyle;
1169
1841
  camera?: {
1170
1842
  /**
@@ -1219,13 +1891,55 @@ export interface VideoRestyleRequest {
1219
1891
  webhook?: WebhookConfig;
1220
1892
  metadata?: Metadata;
1221
1893
  }
1222
- export interface VideoResult {
1223
- duration_ms: number;
1894
+ export interface VideoShareRequest {
1895
+ /** The page title and preview title. Default the first beat's `title`, else "Video". */
1896
+ title?: string;
1897
+ }
1898
+ export interface VideoShare {
1899
+ object: "video_share";
1900
+ video_id: string;
1901
+ /** The share page's artifact (kind `share`, `share.html`). */
1902
+ artifact_id: string;
1903
+ title: string;
1904
+ /** The share page, a signed `usercontent.b3os.org` URL valid until `expires_at`. */
1905
+ url: string;
1906
+ /** An `<iframe>` of the page, 960 wide at the video's aspect ratio, ready to paste. */
1907
+ embed_html: string;
1908
+ /** The video's width in pixels. */
1224
1909
  width: number;
1910
+ /** The video's height in pixels. */
1225
1911
  height: number;
1226
- fps: number;
1227
- artifacts: Artifact[];
1912
+ created_at: string;
1913
+ /** When the page and its link end (the MP4's own expiry). */
1914
+ expires_at: string;
1915
+ }
1916
+ export interface VideoResult {
1917
+ duration_ms: number;
1918
+ width: number;
1919
+ height: number;
1920
+ fps: number;
1921
+ /**
1922
+ * The MP4 first (when asked for), then the poster, the caption files, the GIF and, when a beat has a title, the chapters file.
1923
+ */
1924
+ artifacts: Artifact[];
1228
1925
  recording?: RecordingInfo;
1926
+ narration?: NarrationInfo;
1927
+ /**
1928
+ * 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.
1929
+ */
1930
+ warnings?: string[];
1931
+ }
1932
+ /**
1933
+ * Present when the request has `voice` and at least one beat has `say` (a restyle repeats its source's).
1934
+ * `spoken: false` means the narration was not spoken for at least one beat: the key lacks `infer:run`
1935
+ * (`reason` names the scope) or speech synthesis was unavailable. The video still succeeds, has no narration
1936
+ * track, and its word times (step placement, captions) are estimated from the text.
1937
+ */
1938
+ export interface NarrationInfo {
1939
+ /** True when every beat's narration was synthesized and is in the video's audio. */
1940
+ spoken: boolean;
1941
+ /** Why the narration was not spoken (only when `spoken` is false). */
1942
+ reason?: string;
1229
1943
  }
1230
1944
  /** A video job (`vid_…`). `progress` counts phases (voice, plan, capture, compose, encode, upload). */
1231
1945
  export type Video = Omit<Job, "id" | "object" | "result"> & {
@@ -1234,16 +1948,24 @@ export type Video = Omit<Job, "id" | "object" | "result"> & {
1234
1948
  source: VideoSource;
1235
1949
  /** The source video when this video is a restyle. */
1236
1950
  restyled_from: string | null;
1951
+ /**
1952
+ * Only while `status` is `queued` and the video waits for one of the node's video slots: its place in
1953
+ * the node's queue, `1` for the next video to start. It moves up as videos ahead start or are
1954
+ * canceled, and the field is gone once the video runs.
1955
+ */
1956
+ queue_position?: number;
1237
1957
  result?: VideoResult;
1238
1958
  };
1239
1959
  export type VideoList = Omit<ListEnvelope, "data"> & {
1240
1960
  data: Video[];
1241
1961
  };
1242
1962
  /**
1243
- * An event of a video's stream. `video.phase` carries `phase`; `video.artifact` carries `artifact` (without a
1244
- * signed URL; fetch the artifact or the video for one).
1963
+ * An event of a video's stream. `job.queued` carries `queue_position` when the video waits for a slot (its
1964
+ * place when it was created; the video itself has the current one); `video.phase` carries `phase`;
1965
+ * `video.artifact` carries `artifact` (without a signed URL; fetch the artifact or the video for one).
1245
1966
  */
1246
1967
  export type VideoEvent = JobEvent & {
1968
+ queue_position?: number;
1247
1969
  phase?: "voice" | "plan" | "capture" | "compose" | "encode" | "upload";
1248
1970
  artifact?: Artifact;
1249
1971
  };
@@ -1288,6 +2010,15 @@ export interface RenderTimeline {
1288
2010
  * @default 1
1289
2011
  */
1290
2012
  segments?: number;
2013
+ /**
2014
+ * 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.
2015
+ * @default "auto"
2016
+ */
2017
+ dsf?: 1 | 2 | "auto";
2018
+ /**
2019
+ * 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.
2020
+ */
2021
+ segment_dsf?: Array<1 | 2>;
1291
2022
  };
1292
2023
  /** Composed video. Output frame index i is presented at t = round(i * 1e6 / fps) us. */
1293
2024
  output: {
@@ -1313,7 +2044,7 @@ export interface RenderTimeline {
1313
2044
  captions?: RenderTimelinePresetRef;
1314
2045
  click_effect?: RenderTimelinePresetRef;
1315
2046
  /**
1316
- * 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.
2047
+ * 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.
1317
2048
  */
1318
2049
  overrides?: Record<string, unknown>;
1319
2050
  };
@@ -1381,7 +2112,7 @@ export interface RenderTimeline {
1381
2112
  * Per capture frame: the viewport region to capture. Sent to the recorder for each segment. Frames not listed are not captured.
1382
2113
  */
1383
2114
  capture_plan?: RenderTimelineCaptureFrame[];
1384
- /** Optional FrameState dump (debugging, tests, GET .../timeline?frames=1). */
2115
+ /** Optional FrameState dump (debugging, tests, GET .../timeline?frames=true). */
1385
2116
  frames?: RenderTimelineFrameState[];
1386
2117
  }
1387
2118
  /** Microseconds on the virtual timeline. */
@@ -1440,6 +2171,14 @@ export interface RenderTimelineObservation {
1440
2171
  scroll?: RenderTimelinePoint;
1441
2172
  /** Virtual time at which a navigate or wait finished. */
1442
2173
  settled_us?: RenderTimelineUs;
2174
+ /**
2175
+ * The target sits inside nav, aside or a header bar (or their landmark roles); the camera zooms less there (1.25x).
2176
+ */
2177
+ landmark?: "nav" | "aside" | "header";
2178
+ /**
2179
+ * 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.
2180
+ */
2181
+ ahead_us?: RenderTimelineUs;
1443
2182
  error?: {
1444
2183
  code: string;
1445
2184
  detail?: string;
@@ -1552,6 +2291,10 @@ export interface RenderTimelineCue {
1552
2291
  byte_start: number;
1553
2292
  byte_end: number;
1554
2293
  }[];
2294
+ /**
2295
+ * 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.
2296
+ */
2297
+ position?: "top" | "bottom";
1555
2298
  }
1556
2299
  /**
1557
2300
  * Capture plan entry: at t(seq) capture the viewport region camera (viewport space). The recorder adds the scroll offset to get the document-space clip and sets clip.scale = layout page width (output px) / camera.width so the image arrives at page-layer size.
@@ -1598,6 +2341,8 @@ export interface RenderTimelineFrameState {
1598
2341
  byte_start: number;
1599
2342
  byte_end: number;
1600
2343
  };
2344
+ /** The cue's own position, over the caption style's. */
2345
+ position?: "top" | "bottom";
1601
2346
  };
1602
2347
  /**
1603
2348
  * Opacity of the window layer (page, frame chrome, shadow, border, cursor, click effects) over the background; the background and the caption stay opaque.
@@ -1628,6 +2373,119 @@ export interface Preset {
1628
2373
  export type PresetList = Omit<ListEnvelope, "data"> & {
1629
2374
  data: Preset[];
1630
2375
  };
2376
+ /** A library background. Name it in a style with `overrides.background_ref` (as `style` shows). */
2377
+ export interface RenderBackground {
2378
+ /** `<pack>/<slug>`, the value of `overrides.background_ref`. */
2379
+ ref: string;
2380
+ object: "render.background";
2381
+ /**
2382
+ * `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`).
2383
+ */
2384
+ kind: "css" | "procedural" | "image";
2385
+ pack: string;
2386
+ slug: string;
2387
+ name: string;
2388
+ description?: string;
2389
+ theme: "light" | "dark";
2390
+ tags: string[];
2391
+ /** The main colors, as the source lists them (images, the five most common, most common first). */
2392
+ palette: string[];
2393
+ /**
2394
+ * Color tokens and their defaults; `overrides.background_tokens` sets new colors for them. Empty for images.
2395
+ */
2396
+ tokens: Record<string, string>;
2397
+ /**
2398
+ * `MIT`, `own` (B3OS's own work) or a written grant recorded in B3OS's decisions, such as `grant: Sean, decision T9 (2026-11-02)`.
2399
+ */
2400
+ license: string;
2401
+ /**
2402
+ * Where the background comes from. `name` says it in text; `url`, `path` and `commit` are there only for a
2403
+ * public upstream (Pattern Craft's repository). Sean Geng's own projects (littledemo, ScreenFramed) are
2404
+ * named, never linked. `id` is the entry's id at the source.
2405
+ */
2406
+ source: {
2407
+ name: string;
2408
+ url?: string;
2409
+ path?: string;
2410
+ commit?: string;
2411
+ id?: string;
2412
+ };
2413
+ /**
2414
+ * A 360x200 WebP on B3OS's own host: drawn by the compositor for CSS backgrounds
2415
+ * (`https://beta.b3os.org/assets/presets/library/`), a cover crop of the stored file for images
2416
+ * (`https://beta.b3os.org/gallery/_library/thumbs/`).
2417
+ */
2418
+ thumbnail_url: string;
2419
+ image?: RenderBackgroundImage;
2420
+ /** The `style` value that draws this background. */
2421
+ style: {
2422
+ overrides: {
2423
+ background_ref: string;
2424
+ };
2425
+ };
2426
+ }
2427
+ /**
2428
+ * An image background's file and measured tone (CSS backgrounds have none). Tone is measured on a 16:9 cover
2429
+ * crop, over the matte for transparent shapes: `luminance` is the mean WCAG relative luminance, `hue` and
2430
+ * `chroma` OKLCH (no `hue` for grey or many-hued images), `detail` the mean Sobel edge strength (0 to 1; quiet
2431
+ * gradients are about 0.015, busy textures above 0.07).
2432
+ */
2433
+ export interface RenderBackgroundImage {
2434
+ /** The lossless WebP on B3OS's own host, named by its sha256 (cached as immutable). */
2435
+ url: string;
2436
+ width: number;
2437
+ height: number;
2438
+ bytes: number;
2439
+ sha256: string;
2440
+ group: "backgrounds" | "gradients";
2441
+ coverage: "full-bleed" | "partial" | "cutout" | "sliver";
2442
+ /** Mean color of the crop, `#rrggbb`. */
2443
+ mean: string;
2444
+ luminance: number;
2445
+ /** Absent for grey or many-hued images. */
2446
+ hue?: number;
2447
+ chroma: number;
2448
+ detail: number;
2449
+ /** Whether `background_ref: "auto"` may pick it. */
2450
+ auto: boolean;
2451
+ /** One of the hand-picked images, with its label, collection and place in the picked order. */
2452
+ featured?: {
2453
+ label: string;
2454
+ collection: string;
2455
+ rank: number;
2456
+ };
2457
+ }
2458
+ export type RenderBackgroundList = Omit<ListEnvelope, "data"> & {
2459
+ data: RenderBackground[];
2460
+ };
2461
+ export interface RenderBackgroundPack {
2462
+ pack: string;
2463
+ object: "render.background_pack";
2464
+ name: string;
2465
+ kind: "css" | "procedural" | "image";
2466
+ count: number;
2467
+ themes: Array<"light" | "dark">;
2468
+ license: string;
2469
+ /** The attribution the license asks for. */
2470
+ notice?: string;
2471
+ /**
2472
+ * The upstream's public URL, or text naming the source when it has none (Sean Geng's own projects are named, never linked).
2473
+ */
2474
+ source: string;
2475
+ cover_thumbnail_url: string;
2476
+ /** Image packs, the `ref` the cover shows. */
2477
+ cover?: string;
2478
+ /** Image packs, ScreenFramed's group. */
2479
+ group?: "backgrounds" | "gradients";
2480
+ /** Image packs, how the pack reads behind a screenshot (a hand review). */
2481
+ look?: "quiet" | "bold" | "soft-photo" | "texture" | "scenic" | "loud" | "cutout";
2482
+ /** Image packs, whether `background_ref: "auto"` may pick from it. */
2483
+ auto?: boolean;
2484
+ note?: string;
2485
+ }
2486
+ export type RenderBackgroundPackList = Omit<ListEnvelope, "data"> & {
2487
+ data: RenderBackgroundPack[];
2488
+ };
1631
2489
  /**
1632
2490
  * `running` → `paused` ↔ `running` → `stopped`. `failed` means the microVM crashed; its usage is final.
1633
2491
  */
@@ -1674,7 +2532,10 @@ export interface SandboxApiGrant {
1674
2532
  /**
1675
2533
  * Where sandbox traffic may go, enforced by the node's egress guard. `public` (default): any public internet
1676
2534
  * address. `allowlist`: only hosts matching `allow` (exact hosts or `*.` wildcards). `deny`: no outbound
1677
- * network at all. Private, loopback, tailnet and metadata addresses are always refused. A sandbox has at most
2535
+ * network at all. Private, loopback, tailnet and metadata addresses are always refused. Without `egress`, a
2536
+ * sandbox created by code in another sandbox gets that sandbox's policy, and a policy within it is the most
2537
+ * such code can ask for (`403 forbidden`, `reason: egress_escalation`), and it gets no public port unless that
2538
+ * sandbox's egress is `public`. A sandbox has at most
1678
2539
  * 512 outbound connections open and 64 DNS queries in flight at once; past that, new connections are refused
1679
2540
  * (`egress_unavailable`) and queries answered `SERVFAIL`. When the sandbox stops, its outbound connections
1680
2541
  * and its connections to `http://127.0.0.1:7700` close at once.
@@ -1693,11 +2554,20 @@ export interface SandboxCreateRequest {
1693
2554
  /** Restore this snapshot instead of starting from a template. */
1694
2555
  snapshot?: string;
1695
2556
  /**
1696
- * Virtual CPUs (plan maximum in `GET /v1/limits`).
1697
- * @default 1
2557
+ * Virtual CPUs; defaults to the template's (`defaults.vcpu`), at most your plan's `sandboxes.vcpu_max`.
2558
+ * A microVM cannot change its vCPU count, so sandboxes come from pools per size: a create at one of the
2559
+ * template's `size_classes` claims a pre-warmed microVM, any other size is restored on demand (a pool
2560
+ * miss: tens of milliseconds, plus about two seconds the first time a node sees that size). A node
2561
+ * builds at most 4 new off-class sizes per organization and hour; past that, a create at a size the node
2562
+ * has not built yet is refused with `429 rate_limited` (`limit.id` `sandboxes.offclass_builds`,
2563
+ * `Retry-After`), while sizes it has built and the size classes are not.
1698
2564
  */
1699
2565
  vcpu?: number;
1700
- /** @default 512 */
2566
+ /**
2567
+ * Memory; defaults to the template's (`defaults.memory_mib`), at most your plan's `sandboxes.memory_max`.
2568
+ * Rounded up to 128 MiB or a multiple of 256 MiB (the sandbox's `memory_mib` says what it got, and
2569
+ * memory is billed at that size). See `vcpu` for size classes.
2570
+ */
1701
2571
  memory_mib?: number;
1702
2572
  /** Disk size; defaults to the template's. */
1703
2573
  disk_gib?: number;
@@ -1713,7 +2583,14 @@ export interface SandboxCreateRequest {
1713
2583
  on_idle?: "stop" | "pause";
1714
2584
  /** Environment variables. Returned as given; put credentials in `secrets`. */
1715
2585
  env?: Record<string, string>;
1716
- /** Environment variables whose values are never returned or logged. */
2586
+ /**
2587
+ * Environment variables whose values are never returned by the API and never logged (the sandbox object
2588
+ * lists only their names in `secret_names`). They are not hidden from the sandbox itself: every process
2589
+ * in it gets them in its environment, so any code you run there can read them, and so can anything that
2590
+ * code sends them to. Give a sandbox only secrets the code you run in it may hold. (Injecting a
2591
+ * credential at the node's egress proxy, so that the value never enters the sandbox, is planned, not
2592
+ * available.)
2593
+ */
1717
2594
  secrets?: Record<string, SecretValue>;
1718
2595
  ports?: SandboxPort[];
1719
2596
  api?: SandboxApiGrant;
@@ -1723,8 +2600,84 @@ export interface SandboxCreateRequest {
1723
2600
  * @default false
1724
2601
  */
1725
2602
  forkable?: boolean;
2603
+ readiness?: ReadinessProbe;
2604
+ /**
2605
+ * Read only when `snapshot` is set; a create from a template ignores it and resets the template's Chrome
2606
+ * only where the node's image of that template has the reset. What happens to the random state of processes
2607
+ * that were running when the snapshot was taken, at the start of this sandbox (the option
2608
+ * `sandboxes.clone_reset`). A restored sandbox gets a fresh identity
2609
+ * and the kernel's random pool is reseeded, but a process running at the snapshot keeps its own
2610
+ * generators' state, which every sandbox started from that snapshot shares with the others and with the
2611
+ * source. The `browser` template's Chrome is the process this covers:
2612
+ * - `full`: its renderers and network service are replaced at the start, so `Math.random`,
2613
+ * `crypto.getRandomValues` and WebSocket keys are fresh. The tabs that were open at the snapshot are
2614
+ * closed and their connections dropped; the sandbox's Chrome has one new `about:blank` page.
2615
+ * - `none`: Chrome runs on as the snapshot had it, tabs and page state kept, its generators shared with the
2616
+ * source.
2617
+ *
2618
+ * Other processes running at the snapshot (a browser you started yourself, an interpreter) keep their
2619
+ * state either way; reseed or restart them. The code-interpreter kernel is reseeded on every start.
2620
+ * Default: the node's (`full` on the beta node). A value the node does not allow is refused with `422
2621
+ * option_not_allowed`. The reset runs in the snapshot's guest agent, and `full` is reported only when the
2622
+ * agent says it replaced Chrome: when this node's image of the template or the snapshot's agent predates
2623
+ * the option, `full` is refused with `409 guest_outdated` before the sandbox starts, and a start at which
2624
+ * the agent replaced none of Chrome's processes fails with `500 internal` and leaves no sandbox (retry, or
2625
+ * ask for `none`). The sandbox's `options` reports the value and where it came from, as does the
2626
+ * `X-B3OS-Options` header.
2627
+ */
2628
+ clone_reset?: "full" | "none";
1726
2629
  metadata?: Metadata;
1727
2630
  }
2631
+ /**
2632
+ * When the sandbox counts as ready: a TCP port inside it accepting connections (`port`), or a command that
2633
+ * exits 0 (`cmd`, run as `user` with a 5 s limit per try). Set exactly one. The node tries it every
2634
+ * `interval_ms` from the moment it is set until it passes or `timeout_s` runs out; the sandbox's `readiness`
2635
+ * reports the result and `POST /v1/sandboxes/{sandbox_id}/ready` waits for it. Probing goes on across a
2636
+ * restart of the node's daemon, within the same `timeout_s`; `attempts` counts the tries since the daemon
2637
+ * last recorded a change of `status`, so it can start again from a lower number after such a restart.
2638
+ */
2639
+ export interface ReadinessProbe {
2640
+ port?: number;
2641
+ /** A shell command line (run with `/bin/sh -c`) or an argv array. */
2642
+ cmd?: string | string[];
2643
+ /** @default 10 */
2644
+ interval_ms?: number;
2645
+ /** @default 60 */
2646
+ timeout_s?: number;
2647
+ }
2648
+ export interface Readiness {
2649
+ /** `failed`: the probe did not pass within its `timeout_s`, or the sandbox stopped first. */
2650
+ status: "pending" | "ready" | "failed";
2651
+ probe: ReadinessProbe;
2652
+ attempts: number;
2653
+ ready_at: string | null;
2654
+ /** From the create's start (or from when the probe was set) to the first passing try. */
2655
+ time_to_ready_ms: number | null;
2656
+ /** Why the last failing try failed. */
2657
+ last_error: string | null;
2658
+ }
2659
+ /** Optionally a new probe for the sandbox (replacing its earlier one), and how long to wait. */
2660
+ export interface ReadinessWaitRequest {
2661
+ /** @default 30000 */
2662
+ wait_ms?: number;
2663
+ port?: number;
2664
+ cmd?: string | string[];
2665
+ interval_ms?: number;
2666
+ timeout_s?: number;
2667
+ }
2668
+ export interface ReadinessResult {
2669
+ object: "readiness";
2670
+ sandbox_id: string;
2671
+ /** `pending`: `wait_ms` passed first; ask again. */
2672
+ status: "pending" | "ready" | "failed";
2673
+ probe: ReadinessProbe;
2674
+ attempts: number;
2675
+ ready_at: string | null;
2676
+ time_to_ready_ms: number | null;
2677
+ last_error: string | null;
2678
+ /** How long this call waited. */
2679
+ waited_ms: number;
2680
+ }
1728
2681
  export interface TemplateRef {
1729
2682
  id: string;
1730
2683
  name: string;
@@ -1752,7 +2705,8 @@ export interface Sandbox {
1752
2705
  public: boolean;
1753
2706
  /**
1754
2707
  * Public ports: the long-lived preview URL, token included. Private ports: `null`; mint a URL with
1755
- * `POST /v1/sandboxes/{sandbox_id}/ports/{port}/url`.
2708
+ * `POST /v1/sandboxes/{sandbox_id}/ports/{port}/url`. Also `null` when code in another sandbox reads
2709
+ * this sandbox and this sandbox is not within that sandbox's reach (`sandboxesCreateSandbox`).
1756
2710
  */
1757
2711
  url: string | null;
1758
2712
  }[];
@@ -1771,15 +2725,40 @@ export interface Sandbox {
1771
2725
  started_at: string;
1772
2726
  paused_at: string | null;
1773
2727
  stopped_at: string | null;
1774
- /** Why the sandbox stopped. */
1775
- stop_reason: "deleted" | "timeout" | "failed" | null;
2728
+ /**
2729
+ * Why the sandbox stopped: `deleted`, `timeout` (it reached `expires_at`), `failed` (the microVM crashed),
2730
+ * `budget` (while it ran, its organization was suspended or ran out of credits, or the creating key or
2731
+ * the sandbox's own `api.spend_cap_usd` reached its cap; the node checks every 10 s) or `revoked` (the key
2732
+ * that created it was revoked).
2733
+ */
2734
+ stop_reason: "deleted" | "timeout" | "failed" | "budget" | "revoked" | null;
1776
2735
  usage: {
1777
2736
  vcpu_ms: number;
1778
2737
  gib_ms: number;
2738
+ /**
2739
+ * Present, and `true`, when `vcpu_ms` is short of the CPU the sandbox used: the node could not read
2740
+ * the microVM's CPU counter when metering began or at its last sample. What was not read is not
2741
+ * billed. Absent when the figure is whole.
2742
+ */
2743
+ vcpu_unmetered?: boolean;
1779
2744
  };
2745
+ /** The readiness probe and what it found; `null` when the sandbox has none. */
2746
+ readiness?: null | Readiness;
2747
+ options: SandboxOptions;
1780
2748
  timing?: Timing;
1781
2749
  metadata: Metadata;
1782
2750
  }
2751
+ /**
2752
+ * The options this sandbox started with, each with its `value` and the level it came from (`from`: `request`
2753
+ * when the create or fork asked for it, `node` for the node's default). Always present; `{}` for a sandbox
2754
+ * started from a template, which reads none. A fork reports its own value, not its source's.
2755
+ */
2756
+ export interface SandboxOptions {
2757
+ "sandboxes.clone_reset"?: {
2758
+ value: "full" | "none";
2759
+ from: "request" | "node";
2760
+ };
2761
+ }
1783
2762
  export type SandboxList = Omit<ListEnvelope, "data"> & {
1784
2763
  data: Sandbox[];
1785
2764
  };
@@ -1789,6 +2768,29 @@ export interface TimeoutRequest {
1789
2768
  export interface ForkRequest {
1790
2769
  /** @default 1 */
1791
2770
  count?: number;
2771
+ /**
2772
+ * What happens to the random state of processes that were running when the snapshot was taken, at the
2773
+ * start of each fork (the option `sandboxes.clone_reset`). A restored sandbox gets a fresh identity
2774
+ * and the kernel's random pool is reseeded, but a process running at the snapshot keeps its own
2775
+ * generators' state, which every fork of the call shares with the others and with the source (the
2776
+ * source itself is never reset). The `browser` template's Chrome is the process this covers:
2777
+ * - `full`: its renderers and network service are replaced at the start, so `Math.random`,
2778
+ * `crypto.getRandomValues` and WebSocket keys are fresh. The tabs that were open at the snapshot are
2779
+ * closed and their connections dropped; the sandbox's Chrome has one new `about:blank` page.
2780
+ * - `none`: Chrome runs on as the snapshot had it, tabs and page state kept, its generators shared with the
2781
+ * source.
2782
+ *
2783
+ * Other processes running at the snapshot (a browser you started yourself, an interpreter) keep their
2784
+ * state either way; reseed or restart them. The code-interpreter kernel is reseeded on every start.
2785
+ * Default: the node's (`full` on the beta node), not the source's. A value the node does not allow is
2786
+ * refused with `422 option_not_allowed`. The reset runs in each fork's guest agent, the source's copied,
2787
+ * and `full` is reported only when the agent says it replaced Chrome: when this node's image of the
2788
+ * template or the source's agent predates the option, `full` is refused with `409 guest_outdated` before
2789
+ * the source is paused, and a fork whose agent replaced none of Chrome's processes fails the call with
2790
+ * `500 internal`, no fork left (retry, or ask for `none`). Each fork's `options` reports the value and
2791
+ * where it came from, as does the `X-B3OS-Options` header.
2792
+ */
2793
+ clone_reset?: "full" | "none";
1792
2794
  metadata?: Metadata;
1793
2795
  }
1794
2796
  export interface ExecRequest {
@@ -1801,8 +2803,7 @@ export interface ExecRequest {
1801
2803
  /** Written to the command's standard input, which is then closed. */
1802
2804
  stdin?: string;
1803
2805
  /**
1804
- * Kill the command after this long. At most 60000 unless the output is streamed or the command runs in the background.
1805
- * @default 30000
2806
+ * 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.
1806
2807
  */
1807
2808
  timeout_ms?: number;
1808
2809
  /**
@@ -1829,7 +2830,7 @@ export interface ExecResult {
1829
2830
  timing?: Timing;
1830
2831
  }
1831
2832
  /**
1832
- * `exec.stdout` and `exec.stderr` carry `data`; `exec.exit` carries `exit_code`, `signal`, `timed_out` and `duration_ms`.
2833
+ * `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.
1833
2834
  */
1834
2835
  export type ExecEvent = JobEvent & {
1835
2836
  data?: string;
@@ -1908,6 +2909,33 @@ export interface FileEntry {
1908
2909
  /** Symlink target. */
1909
2910
  target?: string;
1910
2911
  }
2912
+ export interface FileDeleted {
2913
+ /** The path as the request gave it. */
2914
+ path: string;
2915
+ /** What was at the path. */
2916
+ type: "file" | "directory" | "symlink";
2917
+ deleted: true;
2918
+ }
2919
+ export interface MoveFileRequest {
2920
+ /** Absolute path of the file or directory to move. */
2921
+ from: string;
2922
+ /** Absolute path it moves to. */
2923
+ to: string;
2924
+ /**
2925
+ * Replace an existing file at `to` (or an empty directory, when `from` is a directory).
2926
+ * @default false
2927
+ */
2928
+ overwrite?: boolean;
2929
+ }
2930
+ export interface MakeDirectoryRequest {
2931
+ /** Absolute path of the directory. */
2932
+ path: string;
2933
+ /**
2934
+ * Octal mode of the directory (the umask does not apply). Parents it creates get `0755`.
2935
+ * @default "0755"
2936
+ */
2937
+ mode?: string;
2938
+ }
1911
2939
  export type FileEntryList = Omit<ListEnvelope, "data"> & {
1912
2940
  data: FileEntry[];
1913
2941
  };
@@ -1935,6 +2963,9 @@ export interface Snapshot {
1935
2963
  id: string;
1936
2964
  object: "snapshot";
1937
2965
  name?: string | null;
2966
+ /**
2967
+ * `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.
2968
+ */
1938
2969
  status: "creating" | "ready" | "failed";
1939
2970
  sandbox_id: string;
1940
2971
  template: TemplateRef;
@@ -1968,6 +2999,15 @@ export interface Template {
1968
2999
  memory_mib: number;
1969
3000
  disk_gib: number;
1970
3001
  };
3002
+ /**
3003
+ * The sizes this node keeps pre-warmed microVMs of: the template's default size first, then at most one
3004
+ * larger class. A create at one of them claims a parked microVM; any other size (within your plan) is
3005
+ * restored on demand, a pool miss.
3006
+ */
3007
+ size_classes: {
3008
+ vcpu: number;
3009
+ memory_mib: number;
3010
+ }[];
1971
3011
  created_at: string;
1972
3012
  }
1973
3013
  export type TemplateList = Omit<ListEnvelope, "data"> & {
@@ -1980,7 +3020,7 @@ export interface RoutineDefinition {
1980
3020
  /** Optional pointer to this schema for editors. */
1981
3021
  $schema?: string;
1982
3022
  /**
1983
- * 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.
3023
+ * 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.
1984
3024
  */
1985
3025
  name: string;
1986
3026
  /** What the routine does; an MCP server that lists routines as tools uses it as the tool description. */
@@ -2007,12 +3047,12 @@ export interface RoutineDefinition {
2007
3047
  triggers?: RoutineDefinitionTrigger[];
2008
3048
  defaults?: {
2009
3049
  /**
2010
- * ephemeral: memory only, nothing journaled (the agent tool-call fast path; a crash loses the run). 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.
3050
+ * 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.
2011
3051
  * @default "standard"
2012
3052
  */
2013
3053
  durability?: "ephemeral" | "standard" | "strict";
2014
3054
  /**
2015
- * Default timeout for uses and map steps that do not set timeout_ms. Wait and sleep steps are not affected.
3055
+ * 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).
2016
3056
  * @default 30000
2017
3057
  */
2018
3058
  timeout_ms?: number;
@@ -2035,6 +3075,11 @@ export interface RoutineDefinition {
2035
3075
  */
2036
3076
  on_limit?: "queue" | "skip" | "cancel_running";
2037
3077
  };
3078
+ /**
3079
+ * 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.
3080
+ * @default false
3081
+ */
3082
+ pause_sandboxes?: boolean;
2038
3083
  };
2039
3084
  steps: RoutineDefinitionStep[];
2040
3085
  }
@@ -2100,6 +3145,10 @@ export type RoutineDefinitionStep = {
2100
3145
  * 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.
2101
3146
  */
2102
3147
  connections?: Record<string, RoutineDefinitionConnectionRef>;
3148
+ /**
3149
+ * 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.
3150
+ */
3151
+ subject?: string;
2103
3152
  /**
2104
3153
  * 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.
2105
3154
  */
@@ -2111,14 +3160,35 @@ export type RoutineDefinitionStep = {
2111
3160
  steps: RoutineDefinitionStep[];
2112
3161
  };
2113
3162
  /**
2114
- * 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}.
3163
+ * 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}.
2115
3164
  */
2116
3165
  wait?: {
2117
3166
  signal?: string;
2118
3167
  /** RFC 3339 timestamp, literal or produced by an expression. */
2119
3168
  until?: RoutineDefinitionTemplateString;
2120
- /** Signal waits only: maximum wait. */
3169
+ /** Signal, token and event waits only: maximum wait. */
2121
3170
  ms?: RoutineDefinitionDurationMs;
3171
+ /**
3172
+ * 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.
3173
+ */
3174
+ event?: string;
3175
+ /**
3176
+ * 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.
3177
+ */
3178
+ match?: Record<string, RoutineDefinitionTemplateValue>;
3179
+ /**
3180
+ * 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.
3181
+ */
3182
+ token?: boolean;
3183
+ /**
3184
+ * 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.
3185
+ */
3186
+ prompt?: {
3187
+ title?: RoutineDefinitionTemplateString;
3188
+ body?: RoutineDefinitionTemplateString;
3189
+ image?: RoutineDefinitionTemplateValue;
3190
+ link?: RoutineDefinitionTemplateString;
3191
+ };
2122
3192
  };
2123
3193
  /** Durable delay; outputs {}. */
2124
3194
  sleep_ms?: RoutineDefinitionDurationMs;
@@ -2126,7 +3196,9 @@ export type RoutineDefinitionStep = {
2126
3196
  needs?: RoutineDefinitionIdent[];
2127
3197
  if?: RoutineDefinitionCondition;
2128
3198
  retry?: RoutineDefinitionRetry;
2129
- /** uses steps: per attempt. map steps: the whole map. */
3199
+ /**
3200
+ * 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.
3201
+ */
2130
3202
  timeout_ms?: number;
2131
3203
  /**
2132
3204
  * When the step fails, its outcome is failure but its conclusion is success, so dependents run and the run can still succeed.
@@ -2210,18 +3282,32 @@ export type RoutineDefinitionTrigger = {
2210
3282
  catch_up_window_s?: number;
2211
3283
  overlap?: RoutineDefinitionOverlap;
2212
3284
  verify?: RoutineDefinitionWebhookVerify;
3285
+ challenge?: RoutineDefinitionWebhookChallenge;
2213
3286
  /**
2214
3287
  * 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).
2215
3288
  */
2216
3289
  dedupe?: RoutineDefinitionCelExpression;
2217
3290
  };
3291
+ /**
3292
+ * 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.
3293
+ */
3294
+ export interface RoutineDefinitionWebhookChallenge {
3295
+ /** The query parameter whose value is echoed (hub.challenge, challenge). */
3296
+ param: string;
3297
+ /** The query parameter that carries the verify token (hub.verify_token). */
3298
+ token_param?: string;
3299
+ /**
3300
+ * 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.
3301
+ */
3302
+ token_connection?: string;
3303
+ }
2218
3304
  /**
2219
3305
  * 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.
2220
3306
  */
2221
3307
  export type RoutineDefinitionWebhookVerify = {
2222
3308
  scheme: "b3os" | "github" | "stripe" | "slack" | "standard_webhooks" | "hmac_sha256";
2223
3309
  /**
2224
- * 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.
3310
+ * 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.
2225
3311
  */
2226
3312
  secret?: string;
2227
3313
  header?: string;
@@ -2282,6 +3368,10 @@ export interface Routine {
2282
3368
  created_at: string;
2283
3369
  updated_at: string;
2284
3370
  metadata: Metadata;
3371
+ /**
3372
+ * 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.
3373
+ */
3374
+ warnings?: Diagnostic[];
2285
3375
  }
2286
3376
  export type RoutineList = Omit<ListEnvelope, "data"> & {
2287
3377
  data: Routine[];
@@ -2335,6 +3425,42 @@ export interface RoutineImport {
2335
3425
  definition: RoutineDefinition;
2336
3426
  diagnostics: Diagnostic[];
2337
3427
  }
3428
+ export interface HookTestRequest {
3429
+ /** The JSON body to deliver; `trigger.body` of the run it starts. */
3430
+ body?: Record<string, unknown>;
3431
+ }
3432
+ /** One request to a known hook, as its delivery log keeps it. */
3433
+ export interface HookDeliveryEntry {
3434
+ object: "hook_delivery_entry";
3435
+ hook_id: string;
3436
+ received_at: string;
3437
+ method: "POST" | "GET";
3438
+ /** `edge_replay`: replayed from the edge's queue after the node was down; `test`: `POST …/test`. */
3439
+ source: "provider" | "edge_replay" | "test";
3440
+ /** The HTTP status the hook answered. */
3441
+ status: number;
3442
+ /**
3443
+ * `not_started`: accepted without a run (`if` was false, or the routine is paused); `rejected`: a 4xx; `unavailable`: a 5xx (the edge retries).
3444
+ */
3445
+ outcome: "started" | "deduplicated" | "not_started" | "handshake" | "rejected" | "unavailable";
3446
+ /** The error code of a 4xx or 5xx. */
3447
+ code: string | null;
3448
+ /** The `reason` of a `webhook_signature_invalid` (`signature` or `timestamp`). */
3449
+ reason: string | null;
3450
+ /** The error's detail (at most 500 characters). */
3451
+ detail: string | null;
3452
+ run_id: string | null;
3453
+ delivery_id: string | null;
3454
+ deduplicated: boolean;
3455
+ handshake: "slack_url_verification" | "slack_ssl_check" | "github_ping" | "get_challenge" | null;
3456
+ /** Body bytes (the body itself is not kept). */
3457
+ size: number;
3458
+ /** The allowlisted request headers it had (values up to 256 characters). */
3459
+ headers: Record<string, string>;
3460
+ }
3461
+ export type HookDeliveryEntryList = Omit<ListEnvelope, "data"> & {
3462
+ data: HookDeliveryEntry[];
3463
+ };
2338
3464
  export interface HookRotateRequest {
2339
3465
  /** @default 86400 */
2340
3466
  grace_s?: number;
@@ -2347,7 +3473,7 @@ export interface HookSecret {
2347
3473
  }
2348
3474
  /** How the run started (the `trigger` context of its expressions). */
2349
3475
  export interface RunTrigger {
2350
- type: "api" | "cron" | "interval" | "webhook" | "action" | "routine";
3476
+ type: "api" | "cron" | "interval" | "webhook" | "action" | "routine" | "replay";
2351
3477
  /** The trigger ID (cron, interval, webhook, action). */
2352
3478
  id?: string;
2353
3479
  /** Cron and interval occurrence, used to deduplicate fires. */
@@ -2359,9 +3485,11 @@ export interface RunTrigger {
2359
3485
  subscription_id?: string;
2360
3486
  /** The pack trigger event's ID (action triggers). */
2361
3487
  event_id?: string;
2362
- /** For sub-routine runs. */
3488
+ /** For sub-routine runs, the calling run; for replays, the source run. */
2363
3489
  parent_run_id?: string;
2364
3490
  parent_step_id?: string;
3491
+ /** For replays started with `from_step`, that step. */
3492
+ from_step?: string;
2365
3493
  }
2366
3494
  export interface StepRun {
2367
3495
  /** The step ID from the definition. */
@@ -2370,6 +3498,9 @@ export interface StepRun {
2370
3498
  /** Position in the map's list, for steps inside a map body. */
2371
3499
  item_index?: number;
2372
3500
  status: "pending" | "running" | "waiting" | "retrying" | "succeeded" | "failed" | "skipped" | "canceled";
3501
+ /**
3502
+ * 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).
3503
+ */
2373
3504
  attempt: number;
2374
3505
  started_at?: string;
2375
3506
  finished_at?: string;
@@ -2384,11 +3515,22 @@ export interface StepRun {
2384
3515
  failed?: number;
2385
3516
  running?: number;
2386
3517
  };
2387
- /** What a waiting step waits for. */
3518
+ /**
3519
+ * 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.
3520
+ */
2388
3521
  waiting_for?: {
2389
3522
  signal?: string;
2390
3523
  until?: string;
3524
+ /** The step has a wait link (`token: true`); the link itself is only in `run.wait_urls`. */
3525
+ token?: true;
3526
+ prompt?: WaitPrompt;
3527
+ /** An event wait's event name (`POST /v1/routines/events`). */
3528
+ event?: string;
3529
+ /** An event wait's evaluated match values, by dot path into the event's data. */
3530
+ match?: Record<string, unknown>;
2391
3531
  };
3532
+ /** A replay copied this step's outputs from its source run; the step did not run. Absent otherwise. */
3533
+ replayed?: true;
2392
3534
  }
2393
3535
  export type StepRunList = Omit<ListEnvelope, "data"> & {
2394
3536
  data: StepRun[];
@@ -2403,6 +3545,24 @@ export interface RunCreateRequest {
2403
3545
  webhook?: WebhookConfig;
2404
3546
  metadata?: Metadata;
2405
3547
  }
3548
+ export interface RunReplayRequest {
3549
+ /**
3550
+ * 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.
3551
+ */
3552
+ from_step?: string;
3553
+ /**
3554
+ * 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.
3555
+ */
3556
+ input?: Record<string, unknown>;
3557
+ /**
3558
+ * 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.
3559
+ */
3560
+ version?: string | number;
3561
+ /** Override the version's default durability for the new run. */
3562
+ durability?: "ephemeral" | "standard" | "strict";
3563
+ webhook?: WebhookConfig;
3564
+ metadata?: Metadata;
3565
+ }
2406
3566
  /** A routine run (`run_…`); `result` is the routine's `output`. */
2407
3567
  export type RoutineRun = Omit<Job, "id" | "object"> & {
2408
3568
  id: string;
@@ -2413,8 +3573,21 @@ export type RoutineRun = Omit<Job, "id" | "object"> & {
2413
3573
  durability: "ephemeral" | "standard" | "strict";
2414
3574
  trigger: RunTrigger;
2415
3575
  input: Record<string, unknown>;
2416
- /** Top-level steps in definition order. */
3576
+ /**
3577
+ * The run's outcome line: when the routine's `output` is an object with a non-empty `summary` string,
3578
+ * that string on one line, cut to 140 characters (an ellipsis marks the cut). Absent otherwise. Run
3579
+ * lists, the run's terminal event and its webhook carry it, so a list of runs says what each one did.
3580
+ */
3581
+ summary?: string;
3582
+ /** Top-level steps in definition order (empty when `steps_kept` is `false`). */
2417
3583
  steps: StepRun[];
3584
+ /**
3585
+ * `false` on an `ephemeral` run read after it ended: only its summary was kept (status, timing,
3586
+ * `input`, `result`, `error` and its IDs), so `steps` is empty, `…/steps` and a replay answer 410
3587
+ * `run_steps_not_kept`, and `…/events` sends its terminal event alone. The `?wait=` answer, the event
3588
+ * stream and the webhook carried its steps as it ended. Absent on every other run.
3589
+ */
3590
+ steps_kept?: false;
2418
3591
  };
2419
3592
  export type RoutineRunList = Omit<ListEnvelope, "data"> & {
2420
3593
  data: RoutineRun[];
@@ -2426,6 +3599,71 @@ export type RunEvent = JobEvent & {
2426
3599
  level?: "debug" | "info" | "warn" | "error";
2427
3600
  message?: string;
2428
3601
  };
3602
+ export interface RoutineEventRequest {
3603
+ /** The event name `wait.event` names. */
3604
+ name: string;
3605
+ /** What `wait.match` is checked against, and the step's `data` output. */
3606
+ data?: unknown;
3607
+ /** Your ID for the event, passed to the step's `id` output. */
3608
+ id?: string;
3609
+ }
3610
+ export interface RoutineEvent {
3611
+ object: "routine_event";
3612
+ name: string;
3613
+ id?: string | null;
3614
+ /** How many waiting steps the event resumed. */
3615
+ delivered: number;
3616
+ /** The runs and steps it resumed (the first 100). */
3617
+ runs: {
3618
+ run_id: string;
3619
+ step_id: string;
3620
+ }[];
3621
+ }
3622
+ /**
3623
+ * A wait's `prompt` as evaluated when the step started waiting. `dropped` names fields left out because they were not https URLs.
3624
+ */
3625
+ export interface WaitPrompt {
3626
+ title?: string;
3627
+ body?: string;
3628
+ image?: string;
3629
+ /**
3630
+ * 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.
3631
+ */
3632
+ image_artifact?: string;
3633
+ link?: string;
3634
+ dropped?: Array<"image" | "link">;
3635
+ }
3636
+ /** A wait link's step. */
3637
+ export interface RoutineWait {
3638
+ object: "routine_wait";
3639
+ /**
3640
+ * 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.
3641
+ */
3642
+ status: "waiting" | "pending" | "answered" | "timed_out" | "expired" | "ended";
3643
+ run_id: string;
3644
+ run_status: "queued" | "running" | "succeeded" | "failed" | "canceled";
3645
+ routine_id: string;
3646
+ routine_name?: string | null;
3647
+ step_id: string;
3648
+ step_name?: string | null;
3649
+ /**
3650
+ * 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).
3651
+ */
3652
+ prompt: WaitPrompt | null;
3653
+ waiting_since?: string | null;
3654
+ /**
3655
+ * 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.
3656
+ */
3657
+ expires_at?: string | null;
3658
+ /** Once answered. `decision` is null for a signal sent through the API without one. */
3659
+ answer: {
3660
+ decision?: "approve" | "reject" | null;
3661
+ approved?: boolean | null;
3662
+ comment?: string | null;
3663
+ via?: "link" | "signal";
3664
+ answered_at?: string | null;
3665
+ } | null;
3666
+ }
2429
3667
  export interface SignalRequest {
2430
3668
  /** The `wait.signal` name the run waits for (routine.schema.json). */
2431
3669
  name: string;
@@ -2490,6 +3728,10 @@ export interface B3Pack {
2490
3728
  legacyIds?: Record<string, string>;
2491
3729
  };
2492
3730
  signature?: B3PackSignature;
3731
+ /**
3732
+ * 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.
3733
+ */
3734
+ aliases?: B3PackSearchPhrases;
2493
3735
  }
2494
3736
  /**
2495
3737
  * Reverse-DNS publisher namespace with at least one dot, lowercase: io.b3os, com.example, io.github.acme.
@@ -2507,6 +3749,10 @@ export type B3PackSemver = string;
2507
3749
  export type B3PackKebabKey = string;
2508
3750
  /** Connection key, a CEL identifier so templates can write connections.<key>. */
2509
3751
  export type B3PackConnectionKey = string;
3752
+ /**
3753
+ * 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.
3754
+ */
3755
+ export type B3PackSearchPhrases = string[];
2510
3756
  export type B3PackFacetList = string[];
2511
3757
  /**
2512
3758
  * Lowercase host. Exact (api.github.com), wildcard (*.slack.com matches any name below slack.com but not slack.com itself), or * for any public host. * is first-party only and never receives injected credentials. IP literals are not allowed; the egress guard resolves names and denies private ranges either way.
@@ -2520,7 +3766,7 @@ export interface B3PackEgressEntry {
2520
3766
  */
2521
3767
  ports?: number[];
2522
3768
  /**
2523
- * Allowed URL schemes. Default ["https"]; plain http must be listed explicitly.
3769
+ * 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).
2524
3770
  * @default ["https"]
2525
3771
  */
2526
3772
  schemes?: Array<"https" | "http">;
@@ -2542,7 +3788,7 @@ export type B3PackTemplateString = string;
2542
3788
  /** Any JSON value. Strings inside it (at any depth) are template strings; object keys are literal. */
2543
3789
  export type B3PackTemplateValue = unknown;
2544
3790
  /**
2545
- * 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).
3791
+ * 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).
2546
3792
  */
2547
3793
  export type B3PackConnection = {
2548
3794
  type: "api_key" | "basic" | "bearer" | "oauth2" | "none";
@@ -2550,7 +3796,7 @@ export type B3PackConnection = {
2550
3796
  description?: string;
2551
3797
  docsUrl?: string;
2552
3798
  /**
2553
- * Hosts that receive the injected credential. Each entry must also be covered by the pack egress list. * is not allowed.
3799
+ * 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.
2554
3800
  */
2555
3801
  hosts?: B3PackHostPattern[];
2556
3802
  /**
@@ -2714,6 +3960,8 @@ export type B3PackAction = {
2714
3960
  */
2715
3961
  expose?: boolean;
2716
3962
  };
3963
+ /** Task phrases for this action (read my latest emails). */
3964
+ aliases?: B3PackSearchPhrases;
2717
3965
  };
2718
3966
  /**
2719
3967
  * Six-field cron with seconds: second minute hour day-of-month month day-of-week, single spaces. Fields accept numbers, names (JAN, MON), *, ranges a-b, lists a,b, steps *\/n and ?; L, W and # are accepted in the day fields.
@@ -2722,7 +3970,7 @@ export type B3PackCron = string;
2722
3970
  /** IANA time zone name, e.g. America/Los_Angeles. Default UTC. */
2723
3971
  export type B3PackTimezone = string;
2724
3972
  /**
2725
- * 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.
3973
+ * 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).
2726
3974
  */
2727
3975
  export type B3PackVerify = {
2728
3976
  scheme: "github" | "stripe" | "slack" | "standard_webhooks" | "hmac_sha256";
@@ -2853,6 +4101,8 @@ export type B3PackTrigger = {
2853
4101
  action?: B3PackKebabKey;
2854
4102
  with?: B3PackTemplateValue;
2855
4103
  };
4104
+ /** Task phrases for this trigger (when an issue is opened). */
4105
+ aliases?: B3PackSearchPhrases;
2856
4106
  };
2857
4107
  /**
2858
4108
  * Publisher signature written by the publish tool and repeated in the registry record. contentHash covers the whole bundle with this member removed (README, 'Pack content hash and signature'). sig is Ed25519 over the UTF-8 bytes of 'b3pack-sig-v1\n<pack>\n<version>\n<contentHash>'. Nodes verify contentHash and sig against the registry record and the publisher's registered key before loading (ARCHITECTURE 5.5).
@@ -2933,10 +4183,49 @@ export interface ActionSummary {
2933
4183
  mcp_name: string;
2934
4184
  /** Search relevance from 0 to 1 (search results only). */
2935
4185
  score?: number;
4186
+ /** Set in search results when the search asked for `kind=any`. */
4187
+ kind?: "action";
4188
+ }
4189
+ /** A trigger in search results (`kind=trigger` or `kind=any`). */
4190
+ export interface TriggerSearchHit {
4191
+ kind: "trigger";
4192
+ /** Exact reference with the resolved version, for a routine's `type: action` trigger. */
4193
+ ref: string;
4194
+ pack: string;
4195
+ key: string;
4196
+ title: string;
4197
+ description: string;
4198
+ trigger_kind: "webhook" | "poll" | "schedule";
4199
+ /** The connection keys a subscription binds, as in `TriggerSummary`. */
4200
+ connections: string[];
4201
+ /** Search relevance from 0 to 1. */
4202
+ score: number;
2936
4203
  }
2937
4204
  export type ActionSearchResult = Omit<ListEnvelope, "data"> & {
2938
- data: ActionSummary[];
4205
+ data: Array<ActionSummary | TriggerSearchHit>;
4206
+ /**
4207
+ * `found` when `data` has results; `none` when nothing in the catalog (or under the `pack` and `effects` filters) does what the query asks.
4208
+ */
4209
+ match: "found" | "none";
4210
+ /**
4211
+ * 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.
4212
+ */
4213
+ unmatched?: string[];
4214
+ fallback?: ActionSearchFallback;
2939
4215
  };
4216
+ /** With `match: none`, what to do instead of using an unrelated action. */
4217
+ export interface ActionSearchFallback {
4218
+ /** The answer in a sentence an agent can act on. */
4219
+ detail: string;
4220
+ /**
4221
+ * The generic HTTP actions, for a public API or a URL that carries its own authorization (they attach no credential).
4222
+ */
4223
+ refs: string[];
4224
+ /** The routine step that calls any HTTP API. */
4225
+ routine_step: string;
4226
+ /** The HTTP pack's page. */
4227
+ docs_url: string;
4228
+ }
2940
4229
  export interface ConnectionRequirement {
2941
4230
  /** The connection key in the pack. */
2942
4231
  key: string;
@@ -2945,6 +4234,18 @@ export interface ConnectionRequirement {
2945
4234
  /** Whether this action needs it. */
2946
4235
  required?: boolean;
2947
4236
  }
4237
+ /**
4238
+ * One example call from the pack's fixtures: an input and the output the pack maps from the service's
4239
+ * response. `fixture` marks a fixture shipped in the signed bundle (a documented response shape or a recorded
4240
+ * one; its `title` says which), never a call this node made.
4241
+ */
4242
+ export interface ActionExample {
4243
+ title: string;
4244
+ input: Record<string, unknown>;
4245
+ /** What `actions.call` returns as `output` for this input. */
4246
+ output: unknown;
4247
+ label: "fixture" | "live-recorded";
4248
+ }
2948
4249
  export interface ActionDescription {
2949
4250
  object: "action";
2950
4251
  ref: string;
@@ -2972,15 +4273,24 @@ export interface ActionDescription {
2972
4273
  inputSchema: JsonSchemaDocument;
2973
4274
  outputSchema?: JsonSchemaDocument;
2974
4275
  };
4276
+ /**
4277
+ * Example calls from the bundle's fixtures that succeed (error fixtures are left out), at most 5, read once
4278
+ * when the node loads the pack. Their inputs also appear as `examples` in `mcp.inputSchema`.
4279
+ */
4280
+ examples: ActionExample[];
2975
4281
  }
2976
4282
  export interface ActionCallRequest {
2977
4283
  ref: ActionRef;
2978
4284
  /** Validated against the action's input schema. */
2979
4285
  input?: Record<string, unknown>;
2980
4286
  /**
2981
- * Pack connection key to vault connection ID. Omit a key to use your project's most recently created connection for it (refused with `422 connection_required` when that connection belongs to an end user).
4287
+ * 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.
2982
4288
  */
2983
4289
  connections?: Record<string, string>;
4290
+ /**
4291
+ * 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`.
4292
+ */
4293
+ subject?: string;
2984
4294
  /** Overall time limit; defaults to the action's own. */
2985
4295
  timeout_ms?: number;
2986
4296
  }
@@ -3003,6 +4313,12 @@ export interface TriggerSummary {
3003
4313
  kind: "webhook" | "poll" | "schedule";
3004
4314
  config_schema: JsonSchemaDocument;
3005
4315
  event_schema: JsonSchemaDocument;
4316
+ /**
4317
+ * The connection keys a subscription binds (`connections` on a routine's action trigger): the pack
4318
+ * connections the trigger needs, plus `webhook_secret` when the provider's signing secret comes from you.
4319
+ * `webhook_secret` names an `api_key` connection that holds that secret (Stripe's endpoint signing secret,
4320
+ * Slack's signing secret); it is used only to verify deliveries and is never sent anywhere.
4321
+ */
3006
4322
  connections: string[];
3007
4323
  }
3008
4324
  export type TriggerList = Omit<ListEnvelope, "data"> & {
@@ -3014,6 +4330,10 @@ export interface PackPublisher {
3014
4330
  /** Set by the registry, never by the manifest. */
3015
4331
  verified: boolean;
3016
4332
  }
4333
+ /**
4334
+ * Nodes from this release on always send `facets`, `connection_types`, `keyless` and `icons`. Nodes deployed
4335
+ * before it do not, so clients should not require them.
4336
+ */
3017
4337
  export interface PackSummaryFields {
3018
4338
  /** `<namespace>/<name>`. */
3019
4339
  id: string;
@@ -3024,9 +4344,54 @@ export interface PackSummaryFields {
3024
4344
  latest_version: string;
3025
4345
  action_count: number;
3026
4346
  trigger_count: number;
4347
+ /** The manifest's browse facets (`domain`, `assetClass`, `chains`); empty when it has none. */
4348
+ facets?: {
4349
+ domain?: string[];
4350
+ assetClass?: string[];
4351
+ chains?: string[];
4352
+ };
4353
+ /** The types of the pack's connections, sorted, each once; empty for a pack with none. */
4354
+ connection_types?: Array<"api_key" | "basic" | "bearer" | "oauth2" | "none">;
4355
+ /** True when the pack needs no stored credential (no connections, or only `none` connections). */
4356
+ keyless?: boolean;
4357
+ /**
4358
+ * The manifest's icons that are 4 KiB or smaller, as `data:` URIs read from the signed bundle; larger icons
4359
+ * are left out.
4360
+ */
4361
+ icons?: {
4362
+ src: string;
4363
+ mimeType: "image/svg+xml" | "image/png" | "image/webp";
4364
+ sizes?: string[];
4365
+ }[];
3027
4366
  }
3028
4367
  /** A pack in a list. */
3029
4368
  export type PackSummary = PackSummaryFields;
4369
+ /** A pack version's MCP tools (`GET /v1/actions/packs/{namespace}/{name}/tools`). */
4370
+ export interface PackTools {
4371
+ object: "pack_tools";
4372
+ pack: string;
4373
+ version: string;
4374
+ content_hash: string;
4375
+ /** How long to cache this list, in milliseconds. */
4376
+ ttlMs: number;
4377
+ tools: {
4378
+ /** The MCP tool name (`mcp_name`). */
4379
+ name: string;
4380
+ title: string;
4381
+ description: string;
4382
+ inputSchema: JsonSchemaDocument;
4383
+ outputSchema?: JsonSchemaDocument;
4384
+ annotations: {
4385
+ title?: string;
4386
+ readOnlyHint?: boolean;
4387
+ destructiveHint?: boolean;
4388
+ idempotentHint?: boolean;
4389
+ openWorldHint?: boolean;
4390
+ };
4391
+ ref: string;
4392
+ effects: EffectClass;
4393
+ }[];
4394
+ }
3030
4395
  export type PackList = Omit<ListEnvelope, "data"> & {
3031
4396
  data: PackSummary[];
3032
4397
  };
@@ -3035,10 +4400,32 @@ export type Pack = PackSummaryFields & {
3035
4400
  version: string;
3036
4401
  /** Every published version, newest first. */
3037
4402
  versions: string[];
4403
+ /**
4404
+ * The pack's connections, with what creating one needs. Nodes from this release on send `optional`;
4405
+ * `description`, `docs_url`, `params_schema` and `defaults` when the manifest has them. Nodes deployed
4406
+ * before it send only `key`, `type` and `label`.
4407
+ */
3038
4408
  connections: {
3039
4409
  key: string;
3040
4410
  type: "api_key" | "basic" | "bearer" | "oauth2" | "none";
3041
4411
  label: string;
4412
+ /** What the connection is for and where to get the credential. */
4413
+ description?: string;
4414
+ /** The provider's page about the credential. */
4415
+ docs_url?: string;
4416
+ /**
4417
+ * JSON Schema of the connection's non-secret parameters (`params` on `POST
4418
+ * /v1/vault/connections`), such as a Jira site name or SEC EDGAR's User-Agent. Absent when the
4419
+ * connection has none.
4420
+ */
4421
+ params_schema?: JsonSchemaDocument;
4422
+ /**
4423
+ * True when a call that names no connection for this key and finds none stored still runs, with
4424
+ * `defaults` as its params (a `none` connection whose parameters all have defaults).
4425
+ */
4426
+ optional?: boolean;
4427
+ /** With `optional`, the params a call sends when no connection is stored. */
4428
+ defaults?: Record<string, unknown>;
3042
4429
  }[];
3043
4430
  /** Hosts the pack may reach. */
3044
4431
  egress: string[];
@@ -3147,10 +4534,10 @@ export interface ToolCall {
3147
4534
  }
3148
4535
  /**
3149
4536
  * A message. `content` may be a string or a list of parts (images only in `user` messages); only `assistant`
3150
- * messages may have `null` content (`400 invalid_request` with the pointer otherwise). Members not listed
3151
- * here (such as `annotations` or `audio` echoed from an earlier response) are ignored.
4537
+ * messages may leave `content` out or set it to `null` (`400 invalid_request` with the pointer otherwise).
4538
+ * Members not listed here (such as `annotations` or `audio` echoed from an earlier response) are ignored.
3152
4539
  */
3153
- export interface ChatMessage {
4540
+ export type ChatMessage = ({
3154
4541
  role: "system" | "developer" | "user" | "assistant" | "tool";
3155
4542
  content?: string | null | ContentPart[];
3156
4543
  name?: string | null;
@@ -3160,7 +4547,12 @@ export interface ChatMessage {
3160
4547
  refusal?: string | null;
3161
4548
  /** B3OS extension. The reasoning of an earlier assistant turn, passed back to the model's template. */
3162
4549
  reasoning_content?: string | null;
3163
- }
4550
+ } & {
4551
+ role?: "assistant";
4552
+ }) | {
4553
+ role?: "system" | "developer" | "user" | "tool";
4554
+ content: string | ContentPart[];
4555
+ };
3164
4556
  export interface FunctionTool {
3165
4557
  type: "function";
3166
4558
  function: {
@@ -3169,6 +4561,10 @@ export interface FunctionTool {
3169
4561
  /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep), as OpenAI requires. */
3170
4562
  parameters?: Record<string, unknown>;
3171
4563
  strict?: boolean;
4564
+ /**
4565
+ * Accepted and ignored, with any value; never sent to the model. Evaluation harnesses such as BFCL leave a function's response schema here.
4566
+ */
4567
+ response?: unknown;
3172
4568
  };
3173
4569
  }
3174
4570
  export interface ResponseFormatText {
@@ -3209,7 +4605,10 @@ export interface ChatCompletionRequest {
3209
4605
  * 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).
3210
4606
  */
3211
4607
  top_p?: number | null;
3212
- max_tokens?: number | null;
4608
+ /**
4609
+ * 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.
4610
+ */
4611
+ max_tokens?: number | null;
3213
4612
  /** Wins over `max_tokens` when both are set. */
3214
4613
  max_completion_tokens?: number | null;
3215
4614
  stop?: null | string | string[];
@@ -3228,7 +4627,9 @@ export interface ChatCompletionRequest {
3228
4627
  } | null;
3229
4628
  /**
3230
4629
  * B3OS extension. `gateway` sends the request to the B3IQ gateway when this node does not serve the model
3231
- * (models it serves stay local); without it an unknown model is `404 model_not_available`.
4630
+ * (models it serves stay local); without it an unknown model is `404 model_not_available`. The production
4631
+ * node (beta-api.b3os.org) has no gateway route configured yet (no B3IQ gateway key or model list), so
4632
+ * there `gateway` answers `404 model_not_available` as well.
3232
4633
  * @default "local"
3233
4634
  */
3234
4635
  route?: "local" | "gateway" | null;
@@ -3240,9 +4641,24 @@ export interface ChatCompletionRequest {
3240
4641
  repetition_penalty?: number | null;
3241
4642
  /** Token ID to bias added to its logit. */
3242
4643
  logit_bias?: Record<string, number> | null;
4644
+ /**
4645
+ * How much the model may reason before it answers. `none` and `minimal`: no reasoning phase (the
4646
+ * default). `low`, `medium`, `high`, `xhigh`: a reasoning phase of at most 256, 1,024, 4,096 and 8,192
4647
+ * tokens; at the budget the node closes the reasoning and the answer starts in the same request, so
4648
+ * `usage.completion_tokens_details.reasoning_tokens` stays within it. Without `max_tokens` the default
4649
+ * output cap grows by the budget, so the answer keeps the cap's room; with a `max_tokens` below the
4650
+ * budget the reasoning can use all of it, and the answer is empty with `finish_reason: "length"`. The
4651
+ * same levels and budgets apply to Responses' `reasoning.effort` and Messages' adaptive `thinking`
4652
+ * (`output_config.effort`). With `chat_template_kwargs.enable_thinking` set the other way, the request
4653
+ * is `400 invalid_request`. A `gateway` model takes it as its provider does.
4654
+ */
4655
+ reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
3243
4656
  /** Runtime extension. Only `enable_thinking` is taken. */
3244
4657
  chat_template_kwargs?: {
3245
- /** Let the model reason before answering; the reasoning arrives in `reasoning_content`. */
4658
+ /**
4659
+ * Let the model reason before answering; the reasoning arrives in `reasoning_content`. There is no
4660
+ * ceiling on the reasoning this way; `reasoning_effort` sets one.
4661
+ */
3246
4662
  enable_thinking?: boolean;
3247
4663
  } | null;
3248
4664
  /** Accepted and ignored. */
@@ -3251,11 +4667,34 @@ export interface ChatCompletionRequest {
3251
4667
  store?: boolean | null;
3252
4668
  /** Accepted and ignored. */
3253
4669
  service_tier?: string | null;
4670
+ /**
4671
+ * Accepted and ignored. The node caches prompt prefixes per organization on its own; this key never changes which requests share a cache.
4672
+ */
4673
+ prompt_cache_key?: string | null;
4674
+ /** Accepted and ignored (the runtime keeps cached prefixes while it has room). */
4675
+ prompt_cache_retention?: string | null;
4676
+ /** Accepted and ignored. */
4677
+ safety_identifier?: string | null;
4678
+ /** Accepted and ignored; set `max_tokens` to bound the answer. */
4679
+ verbosity?: string | null;
3254
4680
  }
3255
4681
  export interface Usage {
3256
4682
  prompt_tokens: number;
3257
4683
  completion_tokens: number;
3258
4684
  total_tokens: number;
4685
+ /**
4686
+ * `cached_tokens`: the prompt tokens the runtime's prefix cache served, from this organization's earlier
4687
+ * requests (whole 1,056-token blocks on b3os/qwen3.5-9b); they are part of `prompt_tokens` and metered
4688
+ * like the rest. `multimodal_tokens` counts image tokens per modality when the prompt has images.
4689
+ */
4690
+ prompt_tokens_details?: {
4691
+ cached_tokens?: number;
4692
+ [key: string]: unknown;
4693
+ };
4694
+ completion_tokens_details?: {
4695
+ reasoning_tokens?: number;
4696
+ [key: string]: unknown;
4697
+ };
3259
4698
  [key: string]: unknown;
3260
4699
  }
3261
4700
  /**
@@ -3326,15 +4765,28 @@ export interface ChatCompletionChunk {
3326
4765
  }
3327
4766
  /** B3OS extension with what the model supports and your limits on it. */
3328
4767
  export interface ModelInfo {
4768
+ /**
4769
+ * 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.
4770
+ */
4771
+ alias_of?: string;
3329
4772
  kind: "chat" | "embedding" | "speech";
3330
4773
  context_length: number | null;
4774
+ /**
4775
+ * The output cap of a chat request that sets no `max_tokens` (or `max_completion_tokens`, or Responses'
4776
+ * `max_output_tokens`): the generation stops there with `finish_reason: "length"`. Set `max_tokens` to go
4777
+ * higher. A node setting: `null` where the node has no cap (such a request then runs to the end of the
4778
+ * context) and for speech and embedding models.
4779
+ */
4780
+ default_max_tokens?: number | null;
3331
4781
  quantization: string | null;
3332
4782
  tools: boolean;
3333
4783
  json_schema: boolean;
3334
4784
  image_input: boolean;
3335
4785
  max_request_bytes: number;
3336
4786
  limits: {
3337
- /** Tokens per minute for your organization. */
4787
+ /**
4788
+ * Tokens per minute for your organization (its own value from the node's budget snapshot, else the node's default).
4789
+ */
3338
4790
  tpm: number | null;
3339
4791
  rpm: number | null;
3340
4792
  };
@@ -3377,7 +4829,9 @@ export interface SpeechRequest {
3377
4829
  /** A speech model, such as `kokoro-82m`. */
3378
4830
  model: string;
3379
4831
  input: string;
3380
- /** A voice ID from `GET /v1/infer/audio/voices`. */
4832
+ /**
4833
+ * 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.
4834
+ */
3381
4835
  voice: string;
3382
4836
  /** @default "mp3" */
3383
4837
  response_format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm" | null;
@@ -3395,10 +4849,45 @@ export interface SpeechRequest {
3395
4849
  * @default "none"
3396
4850
  */
3397
4851
  timestamps?: "none" | "word" | null;
4852
+ /**
4853
+ * 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`.
4854
+ */
4855
+ language?: string | null;
4856
+ /**
4857
+ * 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.
4858
+ */
4859
+ stream_format?: "audio" | "sse" | null;
4860
+ }
4861
+ /**
4862
+ * One event of a speech stream (`stream_format: "sse"`), named by its `type` (the SSE `event:` field carries
4863
+ * the same name): `speech.audio.delta` with a piece of the audio (`audio`, base64, in `response_format`; the
4864
+ * pieces joined are the whole clip), then `speech.audio.done` with the clip's `format`, `sample_rate`,
4865
+ * `duration_ms`, `words` when `timestamps` is `word`, and `b3os` (route, node, and timing in milliseconds:
4866
+ * the voice service's `voice_queue_ms` and `voice_run_ms`, and `total_ms`). A failure after audio is an
4867
+ * `error` event (`error`, OpenAI's error object) and ends the stream. There is no `usage`: speech bills
4868
+ * characters (`infer.audio_chars`), not tokens.
4869
+ */
4870
+ export interface SpeechStreamEvent {
4871
+ type: "speech.audio.delta" | "speech.audio.done" | "error";
4872
+ audio?: string;
4873
+ model?: string;
4874
+ voice?: string;
4875
+ format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
4876
+ sample_rate?: number;
4877
+ duration_ms?: number;
4878
+ /** As in `SpeechWithTimestamps`, from the start of the clip. */
4879
+ words?: {
4880
+ text: string;
4881
+ start_ms: number;
4882
+ end_ms: number;
4883
+ }[];
4884
+ b3os?: Record<string, unknown>;
4885
+ error?: Record<string, unknown>;
3398
4886
  }
3399
4887
  export interface SpeechWithTimestamps {
3400
4888
  object: "speech";
3401
4889
  model: string;
4890
+ /** The voice that spoke, after an OpenAI voice name resolved (as `x-b3os-voice`). */
3402
4891
  voice: string;
3403
4892
  format: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
3404
4893
  sample_rate: number;
@@ -3415,8 +4904,24 @@ export interface Voice {
3415
4904
  object: "voice";
3416
4905
  model: string;
3417
4906
  name: string;
3418
- /** BCP 47 tag. */
4907
+ /** BCP 47 tag, the language the voice reads in unless a request sets `language`. */
3419
4908
  language: string;
4909
+ /** The voice's gender as the model's authors label it; `null` when the voice service does not say. */
4910
+ gender?: "female" | "male" | null;
4911
+ /**
4912
+ * 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.
4913
+ */
4914
+ word_timings?: "model" | "aligner" | null;
4915
+ /**
4916
+ * 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.
4917
+ */
4918
+ tier?: "featured" | "standard" | "limited" | null;
4919
+ /**
4920
+ * 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.
4921
+ */
4922
+ use_case?: "narration" | "conversation" | "character" | null;
4923
+ /** True for one voice per language, the one to start with in that language. */
4924
+ default?: boolean;
3420
4925
  /**
3421
4926
  * A short audio sample of the voice, a B3OS static asset: `https://beta.b3os.org/assets/voices/<voice>.<ext>`
3422
4927
  * (B3OS's own media are never served from `usercontent.b3os.org`, which holds customer bytes only).
@@ -3426,205 +4931,6 @@ export interface Voice {
3426
4931
  export type VoiceList = Omit<ListEnvelope, "data"> & {
3427
4932
  data: Voice[];
3428
4933
  };
3429
- /** Accepted and ignored. */
3430
- export type AnthropicCacheControl = {
3431
- type?: string;
3432
- ttl?: string;
3433
- } | null;
3434
- export interface AnthropicTextBlock {
3435
- type: "text";
3436
- text: string;
3437
- cache_control?: AnthropicCacheControl;
3438
- /** Accepted and ignored. */
3439
- citations?: Record<string, unknown>[] | null;
3440
- }
3441
- export interface AnthropicImageBlock {
3442
- type: "image";
3443
- source: {
3444
- type: "base64";
3445
- media_type: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
3446
- /** The image file, which must be a PNG, JPEG, WebP or GIF. */
3447
- data: string;
3448
- } | {
3449
- type: "url";
3450
- /** Fetched by the node through its egress guard (PNG, JPEG, WebP or GIF, at most 10 MiB). */
3451
- url: string;
3452
- };
3453
- cache_control?: AnthropicCacheControl;
3454
- }
3455
- export interface AnthropicToolUseBlock {
3456
- type: "tool_use";
3457
- id: string;
3458
- name: string;
3459
- input: Record<string, unknown>;
3460
- cache_control?: AnthropicCacheControl;
3461
- }
3462
- export interface AnthropicToolResultBlock {
3463
- type: "tool_result";
3464
- tool_use_id: string;
3465
- content?: null | string | Array<AnthropicTextBlock | AnthropicImageBlock>;
3466
- /** The result is an error; the model sees it prefixed with `Error:`. */
3467
- is_error?: boolean | null;
3468
- cache_control?: AnthropicCacheControl;
3469
- }
3470
- export interface AnthropicThinkingBlock {
3471
- type: "thinking";
3472
- thinking: string;
3473
- /** Opaque; this node does not check it. */
3474
- signature?: string | null;
3475
- }
3476
- /** Accepted in assistant turns and left out of the prompt. */
3477
- export interface AnthropicRedactedThinkingBlock {
3478
- type: "redacted_thinking";
3479
- data: string;
3480
- }
3481
- export interface AnthropicUserMessage {
3482
- role: "user";
3483
- content: string | Array<AnthropicTextBlock | AnthropicImageBlock | AnthropicToolResultBlock>;
3484
- }
3485
- /** An earlier answer; as the last message, the start of the answer, which the model continues. */
3486
- export interface AnthropicAssistantMessage {
3487
- role: "assistant";
3488
- content: string | Array<AnthropicTextBlock | AnthropicToolUseBlock | AnthropicThinkingBlock | AnthropicRedactedThinkingBlock>;
3489
- }
3490
- export type AnthropicInputMessage = AnthropicUserMessage | AnthropicAssistantMessage;
3491
- /**
3492
- * A custom tool. Tools Anthropic defines or runs (a `type` other than `custom`) are `unsupported_parameter`.
3493
- */
3494
- export interface AnthropicTool {
3495
- type?: "custom" | null;
3496
- /** Unique within `tools`. */
3497
- name: string;
3498
- description?: string | null;
3499
- /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep). */
3500
- input_schema: Record<string, unknown>;
3501
- strict?: boolean | null;
3502
- cache_control?: AnthropicCacheControl;
3503
- }
3504
- export type AnthropicToolChoice = (Record<string, unknown> & {
3505
- /** `any` makes the model call a tool (it needs `tools`). */
3506
- type: "auto" | "any";
3507
- disable_parallel_tool_use?: boolean | null;
3508
- }) | {
3509
- type: "tool";
3510
- /** One of `tools`. */
3511
- name: string;
3512
- disable_parallel_tool_use?: boolean | null;
3513
- } | {
3514
- type: "none";
3515
- };
3516
- /**
3517
- * `enabled` (with `budget_tokens`, at least 1024 and less than `max_tokens`) and `adaptive` let the model
3518
- * reason first, in `thinking` blocks; `disabled`, the default, does not. `display` is accepted and ignored.
3519
- */
3520
- export type AnthropicThinking = (Record<string, unknown> & {
3521
- type: "enabled";
3522
- budget_tokens: number;
3523
- display?: "summarized" | "omitted" | "updates" | null;
3524
- }) | {
3525
- type: "adaptive";
3526
- display?: "summarized" | "omitted" | "updates" | null;
3527
- } | {
3528
- type: "disabled";
3529
- };
3530
- /**
3531
- * Anthropic Messages parameters. Any other parameter is `400 unsupported_parameter`; `null` means unset.
3532
- */
3533
- export interface AnthropicMessagesRequest {
3534
- model: string;
3535
- messages: AnthropicInputMessage[];
3536
- max_tokens: number;
3537
- /** The system prompt; text blocks are joined with blank lines. */
3538
- system?: null | string | AnthropicTextBlock[];
3539
- tools?: AnthropicTool[] | null;
3540
- tool_choice?: null | AnthropicToolChoice;
3541
- thinking?: null | AnthropicThinking;
3542
- output_config?: {
3543
- /** The answer is JSON matching `schema` (at most 64 KiB serialized and 32 levels deep). */
3544
- format?: {
3545
- type: "json_schema";
3546
- /** A JSON Schema object, as Anthropic requires. */
3547
- schema: Record<string, unknown>;
3548
- } | null;
3549
- /** Accepted and ignored. */
3550
- effort?: "low" | "medium" | "high" | "xhigh" | "max" | null;
3551
- } | null;
3552
- stop_sequences?: string[] | null;
3553
- stream?: boolean | null;
3554
- temperature?: number | null;
3555
- /**
3556
- * 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).
3557
- */
3558
- top_p?: number | null;
3559
- top_k?: number | null;
3560
- /** Accepted and ignored. */
3561
- metadata?: {
3562
- user_id?: string | null;
3563
- } | null;
3564
- /** Accepted and ignored. */
3565
- service_tier?: string | null;
3566
- }
3567
- /** The input of a Messages request. Any other parameter is `400 unsupported_parameter`. */
3568
- export interface AnthropicCountTokensRequest {
3569
- model: string;
3570
- messages: AnthropicInputMessage[];
3571
- /** The system prompt; text blocks are joined with blank lines. */
3572
- system?: null | string | AnthropicTextBlock[];
3573
- tools?: AnthropicTool[] | null;
3574
- tool_choice?: null | AnthropicToolChoice;
3575
- thinking?: null | AnthropicThinking;
3576
- }
3577
- export interface AnthropicCountTokens {
3578
- input_tokens: number;
3579
- }
3580
- export interface AnthropicUsage {
3581
- input_tokens: number;
3582
- output_tokens: number;
3583
- }
3584
- /**
3585
- * A block of the answer, `text`, `tool_use` (with `id`, `name`, `input`) or `thinking` (with `signature`).
3586
- */
3587
- export interface AnthropicOutputBlock {
3588
- type: "text" | "tool_use" | "thinking";
3589
- text?: string;
3590
- id?: string;
3591
- name?: string;
3592
- input?: Record<string, unknown>;
3593
- thinking?: string;
3594
- signature?: string;
3595
- }
3596
- export interface AnthropicMessage {
3597
- id: string;
3598
- type: "message";
3599
- role: "assistant";
3600
- content: AnthropicOutputBlock[];
3601
- model: string;
3602
- stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "refusal";
3603
- /** The stop sequence that ended the answer. */
3604
- stop_sequence: string | null;
3605
- usage: AnthropicUsage;
3606
- b3os?: InferMeta;
3607
- }
3608
- /**
3609
- * One event of a stream, named by its `type` (the SSE `event:` field carries the same name):
3610
- * `message_start` (`message`, with empty `content` and the input tokens), `content_block_start` (`index`,
3611
- * `content_block`), `content_block_delta` (`index`, and a `delta` of type `text_delta`, `input_json_delta`,
3612
- * `thinking_delta` or `signature_delta`), `content_block_stop` (`index`), `message_delta` (`delta` with
3613
- * `stop_reason` and `stop_sequence`, and `usage`), `message_stop` (with the `b3os` metadata), or `error`.
3614
- */
3615
- export interface AnthropicStreamEvent {
3616
- type: "message_start" | "content_block_start" | "content_block_delta" | "content_block_stop" | "message_delta" | "message_stop" | "error";
3617
- message?: Record<string, unknown>;
3618
- index?: number;
3619
- content_block?: Record<string, unknown>;
3620
- delta?: Record<string, unknown>;
3621
- usage?: Record<string, unknown>;
3622
- error?: {
3623
- type?: string;
3624
- message?: string;
3625
- };
3626
- b3os?: InferMeta;
3627
- }
3628
4934
  export interface ResponsesInputText {
3629
4935
  type: "input_text";
3630
4936
  text: string;
@@ -3714,6 +5020,7 @@ export interface ResponsesFunctionTool {
3714
5020
  description?: string | null;
3715
5021
  /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep); absent means no arguments. */
3716
5022
  parameters?: Record<string, unknown> | null;
5023
+ /** Passed to the runtime when set; the response echoes the value sent, or `null` when unset. */
3717
5024
  strict?: boolean | null;
3718
5025
  allowed_callers?: "direct"[] | null;
3719
5026
  defer_loading?: false | null;
@@ -3754,7 +5061,11 @@ export interface ResponsesRequest {
3754
5061
  verbosity?: "low" | "medium" | "high" | null;
3755
5062
  } | null;
3756
5063
  reasoning?: {
3757
- /** `low` and above turn the reasoning phase on; unset, `none` and `minimal` leave it off. */
5064
+ /**
5065
+ * `low` and above turn the reasoning phase on with chat's `reasoning_effort` budgets (256, 1,024,
5066
+ * 4,096 and 8,192 reasoning tokens for `low`, `medium`, `high`, `xhigh`; the node closes the
5067
+ * reasoning at the budget and the answer follows); unset, `none` and `minimal` leave it off.
5068
+ */
3758
5069
  effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
3759
5070
  /** Accepted and ignored. */
3760
5071
  summary?: "auto" | "concise" | "detailed" | null;
@@ -3773,6 +5084,7 @@ export interface ResponsesRequest {
3773
5084
  user?: string | null;
3774
5085
  safety_identifier?: string | null;
3775
5086
  prompt_cache_key?: string | null;
5087
+ prompt_cache_retention?: string | null;
3776
5088
  service_tier?: string | null;
3777
5089
  /** `auto` is refused: the node never drops input items. */
3778
5090
  truncation?: "disabled" | null;
@@ -3895,7 +5207,13 @@ export interface WebhookSecret {
3895
5207
  object: "webhook_secret";
3896
5208
  /** The normalized endpoint URL. */
3897
5209
  url: string;
3898
- secret: string;
5210
+ /**
5211
+ * The signing secret. Present only in the response that hands it out (the first `POST
5212
+ * /v1/webhooks/secret` for the URL, or a rotation); `null` otherwise.
5213
+ */
5214
+ secret: string | null;
5215
+ /** The secret's last four characters, so you can tell which secret you stored. */
5216
+ secret_hint: string;
3899
5217
  /** Until when the previous secret still signs deliveries, after a rotation. */
3900
5218
  previous_valid_until: string | null;
3901
5219
  created_at: string;
@@ -4132,6 +5450,14 @@ export interface RegistryPackVersion {
4132
5450
  * `sandbox` (from inside a sandbox, over vsock).
4133
5451
  */
4134
5452
  export type RequestConnection = "edge" | "uds" | "tcp" | "sandbox";
5453
+ /**
5454
+ * Who made the request: `api_key` (an API key), `cli_token` (the CLI's device-login token), `dashboard` (a
5455
+ * signed-in dashboard session; its successful reads are not logged, its changes and errors are), `sandbox` (code
5456
+ * inside a sandbox, as its creating key), `routine` (a routine run, as the key that published its version),
5457
+ * `local` (a host-local caller on the node's Unix socket) or `public` (no credential: a webhook or signed
5458
+ * callback to a public route, or a request refused before authentication).
5459
+ */
5460
+ export type RequestSource = "api_key" | "cli_token" | "dashboard" | "sandbox" | "routine" | "local" | "public";
4135
5461
  export interface RequestPhase {
4136
5462
  name: string;
4137
5463
  source: "edge" | "node";
@@ -4169,10 +5495,239 @@ export interface RequestRecord {
4169
5495
  /** The W3C trace ID from `traceparent`, when sent. */
4170
5496
  trace_id: string | null;
4171
5497
  user_agent: string | null;
5498
+ source: RequestSource;
4172
5499
  }
4173
5500
  export type RequestRecordList = Omit<ListEnvelope, "data"> & {
4174
5501
  data: RequestRecord[];
4175
5502
  };
5503
+ /** Accepted and ignored. */
5504
+ export type AnthropicCacheControl = {
5505
+ type?: string;
5506
+ ttl?: string;
5507
+ } | null;
5508
+ /**
5509
+ * Anthropic's context-editing beta (Claude Code and the Claude Agent SDK send it). Accepted and ignored: the
5510
+ * node clears nothing, so the model sees every turn you send and a conversation past the context window gets
5511
+ * `400 context_length_exceeded`. Only the shape is checked: an object whose `edits`, if present, are objects
5512
+ * with a string `type`.
5513
+ */
5514
+ export type AnthropicContextManagement = {
5515
+ edits?: {
5516
+ type: string;
5517
+ }[] | null;
5518
+ } | null;
5519
+ export interface AnthropicTextBlock {
5520
+ type: "text";
5521
+ text: string;
5522
+ cache_control?: AnthropicCacheControl;
5523
+ /** Accepted and ignored. */
5524
+ citations?: Record<string, unknown>[] | null;
5525
+ }
5526
+ export interface AnthropicImageBlock {
5527
+ type: "image";
5528
+ source: {
5529
+ type: "base64";
5530
+ media_type: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
5531
+ /** The image file, which must be a PNG, JPEG, WebP or GIF. */
5532
+ data: string;
5533
+ } | {
5534
+ type: "url";
5535
+ /** Fetched by the node through its egress guard (PNG, JPEG, WebP or GIF, at most 10 MiB). */
5536
+ url: string;
5537
+ };
5538
+ cache_control?: AnthropicCacheControl;
5539
+ }
5540
+ export interface AnthropicToolUseBlock {
5541
+ type: "tool_use";
5542
+ id: string;
5543
+ name: string;
5544
+ input: Record<string, unknown>;
5545
+ cache_control?: AnthropicCacheControl;
5546
+ }
5547
+ export interface AnthropicToolResultBlock {
5548
+ type: "tool_result";
5549
+ tool_use_id: string;
5550
+ content?: null | string | Array<AnthropicTextBlock | AnthropicImageBlock>;
5551
+ /** The result is an error; the model sees it prefixed with `Error:`. */
5552
+ is_error?: boolean | null;
5553
+ cache_control?: AnthropicCacheControl;
5554
+ }
5555
+ export interface AnthropicThinkingBlock {
5556
+ type: "thinking";
5557
+ thinking: string;
5558
+ /** Opaque; this node does not check it. */
5559
+ signature?: string | null;
5560
+ }
5561
+ /** Accepted in assistant turns and left out of the prompt. */
5562
+ export interface AnthropicRedactedThinkingBlock {
5563
+ type: "redacted_thinking";
5564
+ data: string;
5565
+ }
5566
+ export interface AnthropicUserMessage {
5567
+ role: "user";
5568
+ content: string | Array<AnthropicTextBlock | AnthropicImageBlock | AnthropicToolResultBlock>;
5569
+ }
5570
+ /** An earlier answer; as the last message, the start of the answer, which the model continues. */
5571
+ export interface AnthropicAssistantMessage {
5572
+ role: "assistant";
5573
+ content: string | Array<AnthropicTextBlock | AnthropicToolUseBlock | AnthropicThinkingBlock | AnthropicRedactedThinkingBlock>;
5574
+ }
5575
+ export type AnthropicInputMessage = AnthropicUserMessage | AnthropicAssistantMessage;
5576
+ /**
5577
+ * A custom tool. Tools Anthropic defines or runs (a `type` other than `custom`) are `unsupported_parameter`.
5578
+ */
5579
+ export interface AnthropicTool {
5580
+ type?: "custom" | null;
5581
+ /** Unique within `tools`. */
5582
+ name: string;
5583
+ description?: string | null;
5584
+ /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep). */
5585
+ input_schema: Record<string, unknown>;
5586
+ strict?: boolean | null;
5587
+ cache_control?: AnthropicCacheControl;
5588
+ }
5589
+ export type AnthropicToolChoice = (Record<string, unknown> & {
5590
+ /** `any` makes the model call a tool (it needs `tools`). */
5591
+ type: "auto" | "any";
5592
+ disable_parallel_tool_use?: boolean | null;
5593
+ }) | {
5594
+ type: "tool";
5595
+ /** One of `tools`. */
5596
+ name: string;
5597
+ disable_parallel_tool_use?: boolean | null;
5598
+ } | {
5599
+ type: "none";
5600
+ };
5601
+ /**
5602
+ * `enabled` (with `budget_tokens`, at least 1024 and less than `max_tokens`) and `adaptive` let the model
5603
+ * reason first, in `thinking` blocks; `disabled`, the default, does not. The node closes the reasoning at
5604
+ * the budget and the answer follows in the same request: `budget_tokens`, or for `adaptive` the budget of
5605
+ * `output_config.effort` (`low` 256, `medium` 1,024, `high` 4,096, `xhigh` and `max` 8,192; `high` when
5606
+ * unset). `display` is accepted and ignored.
5607
+ */
5608
+ export type AnthropicThinking = (Record<string, unknown> & {
5609
+ type: "enabled";
5610
+ budget_tokens: number;
5611
+ display?: "summarized" | "omitted" | "updates" | null;
5612
+ }) | {
5613
+ type: "adaptive";
5614
+ display?: "summarized" | "omitted" | "updates" | null;
5615
+ } | {
5616
+ type: "disabled";
5617
+ };
5618
+ /**
5619
+ * Anthropic Messages parameters. Any other parameter is `400 unsupported_parameter`; `null` means unset.
5620
+ */
5621
+ export interface AnthropicMessagesRequest {
5622
+ model: string;
5623
+ messages: AnthropicInputMessage[];
5624
+ max_tokens: number;
5625
+ /** The system prompt; text blocks are joined with blank lines. */
5626
+ system?: null | string | AnthropicTextBlock[];
5627
+ tools?: AnthropicTool[] | null;
5628
+ tool_choice?: null | AnthropicToolChoice;
5629
+ thinking?: null | AnthropicThinking;
5630
+ output_config?: {
5631
+ /** The answer is JSON matching `schema` (at most 64 KiB serialized and 32 levels deep). */
5632
+ format?: {
5633
+ type: "json_schema";
5634
+ /** A JSON Schema object, as Anthropic requires. */
5635
+ schema: Record<string, unknown>;
5636
+ } | null;
5637
+ /**
5638
+ * 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.
5639
+ */
5640
+ effort?: "low" | "medium" | "high" | "xhigh" | "max" | null;
5641
+ } | null;
5642
+ stop_sequences?: string[] | null;
5643
+ stream?: boolean | null;
5644
+ temperature?: number | null;
5645
+ /**
5646
+ * 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).
5647
+ */
5648
+ top_p?: number | null;
5649
+ top_k?: number | null;
5650
+ /** Accepted and ignored. */
5651
+ metadata?: {
5652
+ user_id?: string | null;
5653
+ } | null;
5654
+ /** Accepted and ignored. */
5655
+ service_tier?: string | null;
5656
+ context_management?: AnthropicContextManagement;
5657
+ }
5658
+ /** The input of a Messages request. Any other parameter is `400 unsupported_parameter`. */
5659
+ export interface AnthropicCountTokensRequest {
5660
+ model: string;
5661
+ messages: AnthropicInputMessage[];
5662
+ /** The system prompt; text blocks are joined with blank lines. */
5663
+ system?: null | string | AnthropicTextBlock[];
5664
+ tools?: AnthropicTool[] | null;
5665
+ tool_choice?: null | AnthropicToolChoice;
5666
+ thinking?: null | AnthropicThinking;
5667
+ context_management?: AnthropicContextManagement;
5668
+ }
5669
+ export interface AnthropicCountTokens {
5670
+ input_tokens: number;
5671
+ }
5672
+ export interface AnthropicUsage {
5673
+ /** Prompt tokens the prefix cache did not serve (all of them when the cache fields are absent). */
5674
+ input_tokens: number;
5675
+ output_tokens: number;
5676
+ /**
5677
+ * Always 0 when present. The runtime caches prompt prefixes on its own; nothing is written on request.
5678
+ */
5679
+ cache_creation_input_tokens?: number;
5680
+ /**
5681
+ * Prompt tokens the runtime's prefix cache served, from this organization's earlier requests (whole
5682
+ * 1,056-token blocks on b3os/qwen3.5-9b). The prompt's size is input_tokens plus the two cache fields.
5683
+ * Metering charges every prompt token.
5684
+ */
5685
+ cache_read_input_tokens?: number;
5686
+ }
5687
+ /**
5688
+ * A block of the answer, `text`, `tool_use` (with `id`, `name`, `input`) or `thinking` (with `signature`).
5689
+ */
5690
+ export interface AnthropicOutputBlock {
5691
+ type: "text" | "tool_use" | "thinking";
5692
+ text?: string;
5693
+ id?: string;
5694
+ name?: string;
5695
+ input?: Record<string, unknown>;
5696
+ thinking?: string;
5697
+ signature?: string;
5698
+ }
5699
+ export interface AnthropicMessage {
5700
+ id: string;
5701
+ type: "message";
5702
+ role: "assistant";
5703
+ content: AnthropicOutputBlock[];
5704
+ model: string;
5705
+ stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "refusal";
5706
+ /** The stop sequence that ended the answer. */
5707
+ stop_sequence: string | null;
5708
+ usage: AnthropicUsage;
5709
+ b3os?: InferMeta;
5710
+ }
5711
+ /**
5712
+ * One event of a stream, named by its `type` (the SSE `event:` field carries the same name):
5713
+ * `message_start` (`message`, with empty `content` and the input tokens), `content_block_start` (`index`,
5714
+ * `content_block`), `content_block_delta` (`index`, and a `delta` of type `text_delta`, `input_json_delta`,
5715
+ * `thinking_delta` or `signature_delta`), `content_block_stop` (`index`), `message_delta` (`delta` with
5716
+ * `stop_reason` and `stop_sequence`, and `usage`), `message_stop` (with the `b3os` metadata), or `error`.
5717
+ */
5718
+ export interface AnthropicStreamEvent {
5719
+ type: "message_start" | "content_block_start" | "content_block_delta" | "content_block_stop" | "message_delta" | "message_stop" | "error";
5720
+ message?: Record<string, unknown>;
5721
+ index?: number;
5722
+ content_block?: Record<string, unknown>;
5723
+ delta?: Record<string, unknown>;
5724
+ usage?: Record<string, unknown>;
5725
+ error?: {
5726
+ type?: string;
5727
+ message?: string;
5728
+ };
5729
+ b3os?: InferMeta;
5730
+ }
4176
5731
  /** Parameters of `listBatches`. */
4177
5732
  export interface VisionListBatchesParams {
4178
5733
  /**
@@ -4260,6 +5815,16 @@ export interface VisionReadUrlParams {
4260
5815
  * @default 0
4261
5816
  */
4262
5817
  wait_for_ms?: number;
5818
+ /**
5819
+ * `true` checks robots.txt and Content Signals first (see `respect_robots` on scrape).
5820
+ * @default false
5821
+ */
5822
+ respect_robots?: boolean;
5823
+ /**
5824
+ * `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.
5825
+ * @default "free"
5826
+ */
5827
+ walls?: "free" | "bill";
4263
5828
  }
4264
5829
  /** Parameters of `listSessions`. */
4265
5830
  export interface VisionListSessionsParams {
@@ -4273,6 +5838,32 @@ export interface VisionListSessionsParams {
4273
5838
  /** Only sessions with this status. */
4274
5839
  status?: SessionStatus;
4275
5840
  }
5841
+ /** Parameters of `listBackgrounds`. */
5842
+ export interface RenderListBackgroundsParams {
5843
+ /** Only this pack's backgrounds (`GET /v1/render/backgrounds/packs` lists the packs). */
5844
+ pack?: string;
5845
+ /** Only light or only dark backgrounds (measured per image, not per pack). */
5846
+ theme?: "light" | "dark";
5847
+ /** Only CSS, only procedural (the studio pack) or only image backgrounds. */
5848
+ kind?: "css" | "procedural" | "image";
5849
+ /** Only backgrounds with this tag (case-insensitive, whole tag). */
5850
+ tag?: string;
5851
+ /**
5852
+ * Only full-bleed backgrounds, or only transparent shapes (`cutout`, `partial`, `sliver`). CSS backgrounds are full-bleed.
5853
+ */
5854
+ coverage?: "full-bleed" | "partial" | "cutout" | "sliver";
5855
+ /** `true`: only the hand-picked images (`image.featured`); `false`: everything else. */
5856
+ featured?: boolean;
5857
+ /** Only backgrounds whose name, slug or tags contain this text (case-insensitive). */
5858
+ q?: string;
5859
+ /**
5860
+ * Page size, from 1 to 500.
5861
+ * @default 100
5862
+ */
5863
+ limit?: number;
5864
+ /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
5865
+ cursor?: string;
5866
+ }
4276
5867
  /** Parameters of `listPresets`. */
4277
5868
  export interface RenderListPresetsParams {
4278
5869
  /** Only presets of this kind. */
@@ -4319,6 +5910,11 @@ export interface SandboxesListSandboxesParams {
4319
5910
  cursor?: string;
4320
5911
  /** Only sandboxes with this status. */
4321
5912
  status?: SandboxStatus;
5913
+ /**
5914
+ * Only sandboxes whose `metadata` holds each of these pairs, as `metadata[<key>]=<value>`: up to 4, all of
5915
+ * which must match exactly. Keys follow the `metadata` key rule (1 to 40 of `A-Z a-z 0-9 _ . : -`).
5916
+ */
5917
+ metadata?: Record<string, string>;
4322
5918
  }
4323
5919
  /** Parameters of `listSnapshots`. */
4324
5920
  export interface SandboxesListSnapshotsParams {
@@ -4330,15 +5926,25 @@ export interface SandboxesListSnapshotsParams {
4330
5926
  /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
4331
5927
  cursor?: string;
4332
5928
  }
5929
+ /** Parameters of `deleteFile`. */
5930
+ export interface SandboxesDeleteFileParams {
5931
+ /** Absolute path inside the sandbox. */
5932
+ path: string;
5933
+ /**
5934
+ * `1` deletes a directory and everything in it. `true` and `false` are sent as `1` and `0`.
5935
+ * @default 0
5936
+ */
5937
+ recursive?: boolean | 0 | 1;
5938
+ }
4333
5939
  /** Parameters of `readFile`. */
4334
5940
  export interface SandboxesReadFileParams {
4335
5941
  /** Absolute path inside the sandbox. */
4336
5942
  path: string;
4337
5943
  /**
4338
- * `1` lists the directory instead of reading a file.
5944
+ * `1` lists the directory instead of reading a file. `true` and `false` are sent as `1` and `0`.
4339
5945
  * @default 0
4340
5946
  */
4341
- list?: 0 | 1;
5947
+ list?: boolean | 0 | 1;
4342
5948
  }
4343
5949
  /** Parameters of `writeFile`. */
4344
5950
  export interface SandboxesWriteFileParams {
@@ -4350,10 +5956,15 @@ export interface SandboxesWriteFileParams {
4350
5956
  */
4351
5957
  mode?: string;
4352
5958
  /**
4353
- * `1` creates missing parent directories.
5959
+ * `1` creates missing parent directories. `true` and `false` are sent as `1` and `0`.
4354
5960
  * @default 0
4355
5961
  */
4356
- mkdir?: 0 | 1;
5962
+ mkdir?: boolean | 0 | 1;
5963
+ }
5964
+ /** Parameters of `statFile`. */
5965
+ export interface SandboxesStatFileParams {
5966
+ /** Absolute path inside the sandbox. */
5967
+ path: string;
4357
5968
  }
4358
5969
  /** Parameters of `streamLogs`. */
4359
5970
  export interface SandboxesStreamLogsParams {
@@ -4374,6 +5985,11 @@ export interface SandboxesOpenPtyParams {
4374
5985
  /** Command to run instead of the login shell. */
4375
5986
  cmd?: string;
4376
5987
  cwd?: string;
5988
+ /**
5989
+ * `new` for a terminal that can be reattached, or the id of one (`pts_...`) to attach to again. `cmd` and
5990
+ * `cwd` apply only to a new terminal.
5991
+ */
5992
+ session?: string;
4377
5993
  }
4378
5994
  /** Parameters of `listRoutines`. */
4379
5995
  export interface RoutinesListRoutinesParams {
@@ -4395,6 +6011,21 @@ export interface RoutinesListRunStepsParams {
4395
6011
  /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
4396
6012
  cursor?: string;
4397
6013
  }
6014
+ /** Parameters of `getWait`. */
6015
+ export interface RoutinesGetWaitParams {
6016
+ /** Preselect a decision on the page (HTML only); nothing is answered until the person confirms. */
6017
+ decision?: "approve" | "reject";
6018
+ }
6019
+ /** Parameters of `listHookDeliveries`. */
6020
+ export interface RoutinesListHookDeliveriesParams {
6021
+ /**
6022
+ * Page size, from 1 to 100.
6023
+ * @default 20
6024
+ */
6025
+ limit?: number;
6026
+ /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
6027
+ cursor?: string;
6028
+ }
4398
6029
  /** Parameters of `listRuns`. */
4399
6030
  export interface RoutinesListRunsParams {
4400
6031
  /**
@@ -4419,7 +6050,7 @@ export interface RoutinesListVersionsParams {
4419
6050
  }
4420
6051
  /** Parameters of `describe`. */
4421
6052
  export interface ActionsDescribeParams {
4422
- /** `<namespace>/<name>/<action>@<version>`; the version may be exact (`1.2.0`) or a major (`1`). */
6053
+ /** `<namespace>/<name>/<action>@<version>`; the version may be exact (`1.0.0`) or a major (`1`). */
4423
6054
  ref: ActionRef;
4424
6055
  }
4425
6056
  /** Parameters of `listPacks`. */
@@ -4439,6 +6070,17 @@ export interface ActionsGetPackParams {
4439
6070
  /** An exact version or a range such as `1` or `^1.2`. */
4440
6071
  version?: string;
4441
6072
  }
6073
+ /** Parameters of `getPackTools` (header parameters are sent as their `X-B3OS-*` headers). */
6074
+ export interface ActionsGetPackToolsParams {
6075
+ /** An exact version or a range such as `1` or `^1.2`; the latest by default. */
6076
+ version?: string;
6077
+ /** The most a listed tool may do. `read` lists `pure` and `read` actions only. */
6078
+ effects?: EffectClass;
6079
+ /** Only these action keys, comma-separated (`post-message,list-channels`). An unknown key is a 400. */
6080
+ actions?: string;
6081
+ /** The `ETag` of a response you hold. */
6082
+ if_none_match?: string;
6083
+ }
4442
6084
  /** Parameters of `listRegistryPacks`. */
4443
6085
  export interface PlatformListRegistryPacksParams {
4444
6086
  /**
@@ -4457,8 +6099,13 @@ export interface ActionsSearchParams {
4457
6099
  q: string;
4458
6100
  /** Only actions of this pack (`io.b3os/github`). */
4459
6101
  pack?: string;
4460
- /** Only actions with this effect class. */
6102
+ /** Only actions with this effect class. Triggers have no effect class, so it never removes one. */
4461
6103
  effects?: EffectClass;
6104
+ /**
6105
+ * `action` (the default), `trigger`, or `any` for both.
6106
+ * @default "action"
6107
+ */
6108
+ kind?: "action" | "trigger" | "any";
4462
6109
  /**
4463
6110
  * Results to return, from 1 to 50.
4464
6111
  * @default 10
@@ -4572,8 +6219,16 @@ export interface PlatformListRequestsParams {
4572
6219
  key_id?: string;
4573
6220
  /** Only requests that arrived this way. */
4574
6221
  connection?: RequestConnection;
6222
+ /**
6223
+ * 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.
6224
+ */
6225
+ source?: string;
4575
6226
  /** Only requests made from inside this sandbox. */
4576
6227
  sandbox_id?: string;
6228
+ /**
6229
+ * 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.
6230
+ */
6231
+ trace_id?: string;
4577
6232
  since?: string;
4578
6233
  }
4579
6234
  /** Parameters of `listDeliveries`. */