@b3os/sdk 0.1.0 → 0.2.0

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 (225) hide show
  1. package/README.md +172 -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 +80 -3
  6. package/dist/cjs/core/client.js +236 -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 +36 -0
  12. package/dist/cjs/core/handle.js +97 -0
  13. package/dist/cjs/core/handle.js.map +1 -0
  14. package/dist/cjs/core/index.d.ts +8 -4
  15. package/dist/cjs/core/index.js +14 -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/traces-api.d.ts +42 -0
  27. package/dist/cjs/core/traces-api.js +54 -0
  28. package/dist/cjs/core/traces-api.js.map +1 -0
  29. package/dist/cjs/core/traces.d.ts +120 -0
  30. package/dist/cjs/core/traces.js +306 -0
  31. package/dist/cjs/core/traces.js.map +1 -0
  32. package/dist/cjs/core/transport.js +1 -1
  33. package/dist/cjs/core/transport.js.map +1 -1
  34. package/dist/cjs/core/util.d.ts +15 -3
  35. package/dist/cjs/core/util.js +54 -2
  36. package/dist/cjs/core/util.js.map +1 -1
  37. package/dist/cjs/core/ws.d.ts +4 -0
  38. package/dist/cjs/core/ws.js +7 -4
  39. package/dist/cjs/core/ws.js.map +1 -1
  40. package/dist/cjs/generated/client.d.ts +2 -2
  41. package/dist/cjs/generated/client.js +2 -2
  42. package/dist/cjs/generated/errors.d.ts +1 -1
  43. package/dist/cjs/generated/errors.js +42 -0
  44. package/dist/cjs/generated/errors.js.map +1 -1
  45. package/dist/cjs/generated/ids.d.ts +12 -0
  46. package/dist/cjs/generated/ids.js +3 -0
  47. package/dist/cjs/generated/ids.js.map +1 -1
  48. package/dist/cjs/generated/jobs.js +1 -1
  49. package/dist/cjs/generated/ns/actions.d.ts +48 -6
  50. package/dist/cjs/generated/ns/actions.js +59 -6
  51. package/dist/cjs/generated/ns/actions.js.map +1 -1
  52. package/dist/cjs/generated/ns/infer.d.ts +185 -54
  53. package/dist/cjs/generated/ns/infer.js +28 -74
  54. package/dist/cjs/generated/ns/infer.js.map +1 -1
  55. package/dist/cjs/generated/ns/keys.d.ts +14 -1
  56. package/dist/cjs/generated/ns/keys.js +24 -1
  57. package/dist/cjs/generated/ns/keys.js.map +1 -1
  58. package/dist/cjs/generated/ns/render.d.ts +115 -6
  59. package/dist/cjs/generated/ns/render.js +135 -7
  60. package/dist/cjs/generated/ns/render.js.map +1 -1
  61. package/dist/cjs/generated/ns/requests.d.ts +3 -1
  62. package/dist/cjs/generated/ns/requests.js +3 -1
  63. package/dist/cjs/generated/ns/requests.js.map +1 -1
  64. package/dist/cjs/generated/ns/routines.d.ts +131 -9
  65. package/dist/cjs/generated/ns/routines.js +186 -9
  66. package/dist/cjs/generated/ns/routines.js.map +1 -1
  67. package/dist/cjs/generated/ns/sandboxes.d.ts +327 -31
  68. package/dist/cjs/generated/ns/sandboxes.js +417 -29
  69. package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
  70. package/dist/cjs/generated/ns/vision.d.ts +133 -14
  71. package/dist/cjs/generated/ns/vision.js +158 -12
  72. package/dist/cjs/generated/ns/vision.js.map +1 -1
  73. package/dist/cjs/generated/ns/webhooks.d.ts +8 -5
  74. package/dist/cjs/generated/ns/webhooks.js +8 -5
  75. package/dist/cjs/generated/ns/webhooks.js.map +1 -1
  76. package/dist/cjs/generated/types.d.ts +2750 -328
  77. package/dist/cjs/helpers/agents.d.ts +95 -0
  78. package/dist/cjs/helpers/agents.js +205 -0
  79. package/dist/cjs/helpers/agents.js.map +1 -0
  80. package/dist/cjs/helpers/render.d.ts +15 -0
  81. package/dist/cjs/helpers/render.js +74 -0
  82. package/dist/cjs/helpers/render.js.map +1 -0
  83. package/dist/cjs/helpers/routines.d.ts +61 -0
  84. package/dist/cjs/helpers/routines.js +234 -0
  85. package/dist/cjs/helpers/routines.js.map +1 -0
  86. package/dist/cjs/helpers/sandboxes.d.ts +237 -0
  87. package/dist/cjs/helpers/sandboxes.js +608 -0
  88. package/dist/cjs/helpers/sandboxes.js.map +1 -0
  89. package/dist/cjs/index.d.ts +4 -1
  90. package/dist/cjs/index.js +8 -5
  91. package/dist/cjs/index.js.map +1 -1
  92. package/dist/cjs/routines.d.ts +1 -0
  93. package/dist/cjs/routines.js +21 -0
  94. package/dist/cjs/routines.js.map +1 -0
  95. package/dist/cjs/webhooks.js.map +1 -1
  96. package/dist/esm/core/bytes.d.ts +30 -0
  97. package/dist/esm/core/bytes.js +111 -0
  98. package/dist/esm/core/bytes.js.map +1 -0
  99. package/dist/esm/core/client.d.ts +80 -3
  100. package/dist/esm/core/client.js +233 -31
  101. package/dist/esm/core/client.js.map +1 -1
  102. package/dist/esm/core/errors.d.ts +16 -4
  103. package/dist/esm/core/errors.js +9 -6
  104. package/dist/esm/core/errors.js.map +1 -1
  105. package/dist/esm/core/handle.d.ts +36 -0
  106. package/dist/esm/core/handle.js +93 -0
  107. package/dist/esm/core/handle.js.map +1 -0
  108. package/dist/esm/core/index.d.ts +8 -4
  109. package/dist/esm/core/index.js +6 -2
  110. package/dist/esm/core/index.js.map +1 -1
  111. package/dist/esm/core/login.d.ts +24 -0
  112. package/dist/esm/core/login.js +85 -0
  113. package/dist/esm/core/login.js.map +1 -0
  114. package/dist/esm/core/namespace.d.ts +1 -1
  115. package/dist/esm/core/namespace.js +1 -1
  116. package/dist/esm/core/op.d.ts +11 -1
  117. package/dist/esm/core/timing.d.ts +1 -1
  118. package/dist/esm/core/timing.js +8 -1
  119. package/dist/esm/core/timing.js.map +1 -1
  120. package/dist/esm/core/traces-api.d.ts +42 -0
  121. package/dist/esm/core/traces-api.js +50 -0
  122. package/dist/esm/core/traces-api.js.map +1 -0
  123. package/dist/esm/core/traces.d.ts +120 -0
  124. package/dist/esm/core/traces.js +295 -0
  125. package/dist/esm/core/traces.js.map +1 -0
  126. package/dist/esm/core/transport.js +1 -1
  127. package/dist/esm/core/transport.js.map +1 -1
  128. package/dist/esm/core/util.d.ts +15 -3
  129. package/dist/esm/core/util.js +48 -1
  130. package/dist/esm/core/util.js.map +1 -1
  131. package/dist/esm/core/ws.d.ts +4 -0
  132. package/dist/esm/core/ws.js +7 -4
  133. package/dist/esm/core/ws.js.map +1 -1
  134. package/dist/esm/generated/client.d.ts +2 -2
  135. package/dist/esm/generated/client.js +2 -2
  136. package/dist/esm/generated/errors.d.ts +1 -1
  137. package/dist/esm/generated/errors.js +42 -0
  138. package/dist/esm/generated/errors.js.map +1 -1
  139. package/dist/esm/generated/ids.d.ts +12 -0
  140. package/dist/esm/generated/ids.js +3 -0
  141. package/dist/esm/generated/ids.js.map +1 -1
  142. package/dist/esm/generated/jobs.js +1 -1
  143. package/dist/esm/generated/ns/actions.d.ts +48 -6
  144. package/dist/esm/generated/ns/actions.js +59 -6
  145. package/dist/esm/generated/ns/actions.js.map +1 -1
  146. package/dist/esm/generated/ns/infer.d.ts +185 -54
  147. package/dist/esm/generated/ns/infer.js +28 -74
  148. package/dist/esm/generated/ns/infer.js.map +1 -1
  149. package/dist/esm/generated/ns/keys.d.ts +14 -1
  150. package/dist/esm/generated/ns/keys.js +24 -1
  151. package/dist/esm/generated/ns/keys.js.map +1 -1
  152. package/dist/esm/generated/ns/render.d.ts +115 -6
  153. package/dist/esm/generated/ns/render.js +135 -7
  154. package/dist/esm/generated/ns/render.js.map +1 -1
  155. package/dist/esm/generated/ns/requests.d.ts +3 -1
  156. package/dist/esm/generated/ns/requests.js +3 -1
  157. package/dist/esm/generated/ns/requests.js.map +1 -1
  158. package/dist/esm/generated/ns/routines.d.ts +131 -9
  159. package/dist/esm/generated/ns/routines.js +186 -9
  160. package/dist/esm/generated/ns/routines.js.map +1 -1
  161. package/dist/esm/generated/ns/sandboxes.d.ts +327 -31
  162. package/dist/esm/generated/ns/sandboxes.js +417 -29
  163. package/dist/esm/generated/ns/sandboxes.js.map +1 -1
  164. package/dist/esm/generated/ns/vision.d.ts +133 -14
  165. package/dist/esm/generated/ns/vision.js +158 -12
  166. package/dist/esm/generated/ns/vision.js.map +1 -1
  167. package/dist/esm/generated/ns/webhooks.d.ts +8 -5
  168. package/dist/esm/generated/ns/webhooks.js +8 -5
  169. package/dist/esm/generated/ns/webhooks.js.map +1 -1
  170. package/dist/esm/generated/types.d.ts +2750 -328
  171. package/dist/esm/helpers/agents.d.ts +95 -0
  172. package/dist/esm/helpers/agents.js +199 -0
  173. package/dist/esm/helpers/agents.js.map +1 -0
  174. package/dist/esm/helpers/render.d.ts +15 -0
  175. package/dist/esm/helpers/render.js +70 -0
  176. package/dist/esm/helpers/render.js.map +1 -0
  177. package/dist/esm/helpers/routines.d.ts +61 -0
  178. package/dist/esm/helpers/routines.js +226 -0
  179. package/dist/esm/helpers/routines.js.map +1 -0
  180. package/dist/esm/helpers/sandboxes.d.ts +237 -0
  181. package/dist/esm/helpers/sandboxes.js +600 -0
  182. package/dist/esm/helpers/sandboxes.js.map +1 -0
  183. package/dist/esm/index.d.ts +4 -1
  184. package/dist/esm/index.js +6 -5
  185. package/dist/esm/index.js.map +1 -1
  186. package/dist/esm/routines.d.ts +1 -0
  187. package/dist/esm/routines.js +5 -0
  188. package/dist/esm/routines.js.map +1 -0
  189. package/dist/esm/webhooks.js.map +1 -1
  190. package/package.json +14 -3
  191. package/src/core/bytes.ts +112 -0
  192. package/src/core/client.ts +285 -33
  193. package/src/core/errors.ts +27 -10
  194. package/src/core/handle.ts +107 -0
  195. package/src/core/index.ts +17 -2
  196. package/src/core/login.ts +98 -0
  197. package/src/core/namespace.ts +1 -1
  198. package/src/core/op.ts +11 -1
  199. package/src/core/timing.ts +7 -2
  200. package/src/core/traces-api.ts +80 -0
  201. package/src/core/traces.ts +375 -0
  202. package/src/core/transport.ts +1 -1
  203. package/src/core/util.ts +53 -3
  204. package/src/core/ws.ts +11 -4
  205. package/src/generated/client.ts +2 -2
  206. package/src/generated/errors.ts +84 -0
  207. package/src/generated/ids.ts +3 -0
  208. package/src/generated/jobs.ts +1 -1
  209. package/src/generated/ns/actions.ts +69 -6
  210. package/src/generated/ns/infer.ts +229 -61
  211. package/src/generated/ns/keys.ts +25 -1
  212. package/src/generated/ns/render.ts +172 -7
  213. package/src/generated/ns/requests.ts +3 -1
  214. package/src/generated/ns/routines.ts +205 -9
  215. package/src/generated/ns/sandboxes.ts +493 -34
  216. package/src/generated/ns/vision.ts +168 -14
  217. package/src/generated/ns/webhooks.ts +8 -5
  218. package/src/generated/types.ts +3034 -472
  219. package/src/helpers/agents.ts +300 -0
  220. package/src/helpers/render.ts +91 -0
  221. package/src/helpers/routines.ts +278 -0
  222. package/src/helpers/sandboxes.ts +788 -0
  223. package/src/index.ts +29 -5
  224. package/src/routines.ts +5 -0
  225. 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,424 @@ 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
+ /**
1315
+ * A window frame preset (`GET /v1/render/presets?kind=frame` has a preview of each). `window` is a macOS window whose 28 px bar (at 1080p) holds the traffic lights and nothing else, in the page's own top color, so it reads as the page's toolbar. `mac` adds a centered title (or the host), `browser` an address pill with the host, `windows` caption buttons; the `-dark` ones keep a dark bar whatever the page. A video has no frame by default: the bare rounded window.
1316
+ */
1317
+ export type FramePreset = "window" | "window-dark" | "mac" | "mac-dark" | "browser" | "browser-dark" | "windows" | "windows-dark" | "phone" | "tablet" | "laptop" | "laptop-dark" | "desktop";
1318
+ /** A cursor preset (`GET /v1/render/presets?kind=cursor` has a preview of each). */
1319
+ export type CursorPreset = "arrow" | "arrow-light" | "dot";
1320
+ /**
1321
+ * A caption style preset (`GET /v1/render/presets?kind=captions` has a preview of each): `default`, a small
1322
+ * neutral near-black pill that never takes on the background's hue (where the darkest 30% of what it covers is
1323
+ * darker than luma 24, its fill is lifted 18 levels above that and its edge brightened, so it still reads as a
1324
+ * pill), whose
1325
+ * karaoke shows the spoken words white,
1326
+ * the word being spoken in a light B3 blue and the words to come dimmed; `bold`, a large dark pill with a yellow
1327
+ * karaoke word; `minimal`, outlined text with no box; `light`, dark text on a white box.
1328
+ */
1329
+ export type CaptionsPreset = "default" | "bold" | "minimal" | "light";
1330
+ /** A click effect preset (`GET /v1/render/presets?kind=click_effect` has a preview of each). */
1331
+ export type ClickEffectPreset = "ripple" | "ring";
942
1332
  /**
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.
1333
+ * One preset for each part plus `overrides`, the same object as a timeline's `style` (restyle replaces exactly
1334
+ * this). Every field is optional. The per-kind enums (`BackgroundPreset`, `FramePreset`, `CursorPreset`,
1335
+ * `CaptionsPreset`, `ClickEffectPreset`) list today's presets; the schema also takes any preset ID so a preset
1336
+ * added later needs no client update, and the node refuses an ID that is not a preset of that kind with
1337
+ * `style_invalid`. `none` draws nothing for that part; `auto` is the default background. On a video and on a
1338
+ * styled screenshot it draws one of the library images tagged `video` (the node's set, by default 24: macOS-style
1339
+ * waves, calm cool, warm and pastel gradient fields, deep dark fields, a grey grain and five soft photographs),
1340
+ * picked from the page (a video's first frame, a screenshot's capture). Only images at least 12 L* from the page
1341
+ * all along just outside the window's edges compete (a dark page: 20 L* lighter outside its dark edges). Among
1342
+ * them a small vision model (`b3os/qwen3.5-9b`, run by the node, not billed to you) picks the one that best
1343
+ * matches the app's look and brand, from the page and one labelled sheet of the candidates. Without the model,
1344
+ * when it does not answer within 4 s, or when one image clears, the color rules pick: the image whose hue suits
1345
+ * the page's accent color and whose tone sits behind the page (deeper behind a light page, airier behind a dark
1346
+ * one), ties broken by the page's host. The first pick for a site (the page's registrable domain, such as
1347
+ * `linear.app`; the host for `localhost` and IP addresses) is kept for your organization, so later videos and
1348
+ * screenshots of the site draw the same image while it clears their page's edges; `auto_background` pins an
1349
+ * image, picks again or turns the model off. The studio pick when no image clears the edges (or the node has no
1350
+ * set). The pick reads the page in CSS pixels, so it does not depend on the device scale; the result's
1351
+ * `auto_background` says which image was drawn and how it was chosen. On a video the timeline's `style` then
1352
+ * names the image in `overrides.background_ref`, and its `look` records it as the `auto` pick with how it was
1353
+ * chosen. If the node cannot load it in time (2 s for a file it has, 0.5 s for one it must fetch,
1354
+ * none while the image store is failing: a minute after it fails, or its Retry-After, 1 s to 10 min), the video
1355
+ * draws the studio pick and `warnings` says so
1356
+ * (`background_fallback`). `studio` is the studio pick by name, on screenshots and videos (what `auto` drew
1357
+ * before 2026-11-11, and what a restyle without a style draws for a timeline from before then: the mesh it
1358
+ * drew, read from the first frame's own pixels as production read it). `transparent` leaves
1359
+ * the background transparent.
1360
+ * Strings are drawn by the compositor and escaped before they reach any HTML or CSS.
946
1361
  */
947
1362
  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>;
1363
+ /** A background preset, or `auto`, `studio`, `transparent` or `none`. */
1364
+ background?: BackgroundPreset | "auto" | "studio" | "transparent" | "none" | (string & {});
1365
+ /** A window frame preset, or `none`. */
1366
+ frame?: FramePreset | "none" | (string & {});
1367
+ /** A cursor preset, or `none`. */
1368
+ cursor?: CursorPreset | "none" | (string & {});
1369
+ /** A caption style preset, or `none`. */
1370
+ captions?: CaptionsPreset | "none" | (string & {});
1371
+ /** A click effect preset, or `none`. */
1372
+ click_effect?: ClickEffectPreset | "none" | (string & {});
1373
+ overrides?: RenderStyleOverrides;
1374
+ }
1375
+ /**
1376
+ * A color: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb(r,g,b)`, `rgba(r,g,b,a)`, `rgb(r g b / a)` (channels
1377
+ * 0-255 or percentages, alpha 0-1 or a percentage), a CSS color name such as `orange` or `rebeccapurple` (any
1378
+ * of the 148), or `transparent`. A value that is none of these is refused with an error that names it.
1379
+ */
1380
+ export type RenderColor = string;
1381
+ /** One shadow, in CSS pixels; a field left out is 0, and the color defaults to black at 25% alpha. */
1382
+ export interface RenderShadow {
1383
+ x?: number;
1384
+ y?: number;
1385
+ blur?: number;
1386
+ spread?: number;
1387
+ color?: RenderColor;
1388
+ }
1389
+ export type RenderGradientStop = RenderColor | {
1390
+ color: RenderColor;
1391
+ /**
1392
+ * Position along the gradient, 0 to 1, never less than the stop before. Left out, stops are spaced evenly.
1393
+ */
1394
+ at?: number;
1395
+ };
1396
+ /**
1397
+ * Style fields that override the presets; a closed set, so any other key is refused with `style_invalid`.
1398
+ * Lengths are CSS pixels, scaled with the device pixel ratio for screenshots and with the output size for
1399
+ * videos (relative to 1080p).
1400
+ */
1401
+ export interface RenderStyleOverrides {
1402
+ /**
1403
+ * Space around the page, the same on every side or `{x, y}`. Left out, 6% of the canvas's long edge on a
1404
+ * screenshot (48 to 160 pixels), and on a video what `window_shape` gives: by default 8% of the frame's
1405
+ * height above and below the window and 6.5% of its width at each side on a landscape frame (86 and 126
1406
+ * pixels at 1920x1080, the window on even pixels), with room under the window for burned-in captions.
1407
+ */
1408
+ padding?: number | {
1409
+ x?: number;
1410
+ y?: number;
1411
+ };
1412
+ /**
1413
+ * The window's corner radius in style px. Left out, 14 on a screenshot and 22 at 1080p on a video (2% of the output's short edge, scaled with it).
1414
+ */
1415
+ corner_radius?: number;
1416
+ /**
1417
+ * A shadow preset, one shadow, or a list of up to 6 drawn together. Left out, the default look's shadow, tinted with the background's own hue: on a video the `soft` one, on a screenshot a contact and an ambient shadow fading out 48-64 px below the window, which `classic` names (a video's before 2026-11-11). `subtle`, `soft` and `deep` are a directional layered shadow (a main shadow, a key light and a contact shadow), tinted the same way, deeper and stronger where the background under the window is deep: `soft` is 0 44 120 -12 at 30%, 0 14 36 -6 at 10% and 0 1 2 0 at 7% at 1080p on a light background, as screen recorders draw a window, deep below and faint above; `subtle` is about two thirds as deep and wide, `deep` about a quarter more. `none` draws none; `float`, `hard` and `glow` are black (glow blue) and untinted.
1418
+ */
1419
+ shadow?: "none" | "subtle" | "soft" | "deep" | "classic" | "float" | "hard" | "glow" | RenderShadow | RenderShadow[];
1420
+ /**
1421
+ * `none`, or a border of `width` (default 1) and `color`. Left out, a hairline matched to the background.
1422
+ */
1423
+ border?: "none" | {
1424
+ width?: number;
1425
+ color?: RenderColor;
1426
+ };
1427
+ background_color?: RenderColor;
1428
+ /** A linear gradient at `angle` degrees (135 by default), or a radial one with `kind` radial. */
1429
+ background_gradient?: {
1430
+ kind?: "linear" | "radial";
1431
+ angle?: number;
1432
+ stops: RenderGradientStop[];
1433
+ };
1434
+ /**
1435
+ * A library background, `<pack>/<slug>` (`GET /v1/render/backgrounds` lists them; ScreenFramed's
1436
+ * `gradients/<pack>/<slug>` names the same entry of that group). It replaces the preset's background and
1437
+ * cannot be combined with `background_color` or `background_gradient`. An unknown ref is refused with
1438
+ * `style_invalid` at `/overrides/background_ref`. An image background is fetched by the render node on its
1439
+ * first use there and cached; if it cannot be loaded the request fails with `background_unavailable` (503,
1440
+ * retry).
1441
+ *
1442
+ * `"auto"` picks a library image that fits the captured page (a video's first frame): one of the quiet,
1443
+ * bold or soft-photo backgrounds (quiet ones first), in the page's light or dark theme (or `theme`'s), so a
1444
+ * light page gets a light, soft background and a dark page a dark one, with clear lightness separation, a
1445
+ * hue analogous or complementary to the page's accent, little detail where it shows around the window, and
1446
+ * enough pixels for the output. The same page gets the same background; the screenshot's `background_ref`
1447
+ * names the one drawn, a video's timeline `style` does. If the chosen image cannot be loaded within 2 s, the
1448
+ * screenshot or video keeps the style's own background (the `auto` background preset unless `background`
1449
+ * names another) and `warnings` says so (`background_fallback`). The default `auto` background already
1450
+ * draws a library image, on videos and styled screenshots; this picks from the whole library instead of
1451
+ * the video set.
1452
+ */
1453
+ background_ref?: string;
1454
+ /**
1455
+ * A text block set by the compositor above or below the window of a screenshot (Geist; never parsed as
1456
+ * HTML): an optional badge pill, a title (up to `title_lines` lines, 3 by default) and a subtitle (up to 4
1457
+ * lines), wrapped at `max_width` (the window's width by default); a line that does not fit ends with an
1458
+ * ellipsis. With `autofit` the title shrinks to fit instead. It needs a title, a subtitle or a badge. The
1459
+ * canvas grows to hold it, or on a fixed `canvas` the page shrinks. Screenshots only: a video with `text`
1460
+ * is refused with `style_invalid` at `/overrides/text`.
1461
+ */
1462
+ text?: {
1463
+ title?: string;
1464
+ subtitle?: string;
1465
+ badge?: string;
1466
+ /** Above (the default) or below the window. */
1467
+ position?: "above" | "below";
1468
+ /** Center (the default), left or right; left and right line up with the window's edge. */
1469
+ align?: "left" | "center" | "right";
1470
+ color?: RenderColor;
1471
+ badge_color?: RenderColor;
1472
+ /** Title size in CSS pixels, 48 by default (the subtitle's is 22). */
1473
+ title_size?: number;
1474
+ subtitle_size?: number;
1475
+ /** Wrapping width in CSS pixels; the window's width by default. */
1476
+ max_width?: number;
1477
+ /** Space between the text and the window, 40 by default. */
1478
+ gap?: number;
1479
+ /** The most lines the title wraps to, 3 by default. */
1480
+ title_lines?: number;
1481
+ /**
1482
+ * Sets the title at the largest size from `title_size` down to `fit_min` (in steps of 0.25 px) at
1483
+ * which it fits in `title_lines` lines with no word broken or cut; the subtitle and the badge keep
1484
+ * their ratio to it. A title that does not fit even at `fit_min` is set at `fit_min` with an ellipsis.
1485
+ * False by default.
1486
+ */
1487
+ autofit?: boolean;
1488
+ /**
1489
+ * The smallest title size `autofit` may use, in CSS pixels: half of `title_size` by default, at least
1490
+ * 12. A value above `title_size` counts as `title_size`; without `autofit` it is unused.
1491
+ */
1492
+ fit_min?: number;
1493
+ };
1494
+ /**
1495
+ * Tilts the window in 3D (ScreenFramed's presets; CSS `perspective: 1000px` about the canvas center),
1496
+ * scaled by `perspective_intensity`. Screenshots only, like every camera field below.
1497
+ */
1498
+ perspective?: "none" | "tilt-left" | "tilt-right" | "tilt-up" | "tilt-down" | "tilt-left-strong" | "tilt-right-strong" | "iso-left" | "iso-right";
1499
+ /** How much of the `perspective` preset to apply, 50 by default. */
1500
+ perspective_intensity?: number;
1501
+ /**
1502
+ * A camera preset (tilt, roll, offset, frame scale and depth blur): `hero` 6/-6 degrees, offset 160,80,
1503
+ * 1.25x; `dashboard` 4/5, offset 10,70, 1.1x; `flat`; `cinematic` 25/0, 1.1x; `detail` 18/-9, offset
1504
+ * -30,0, 1.95x. Not with `perspective`; the single fields below override it, and `depth_blur` lists the
1505
+ * blur each one brings.
1506
+ */
1507
+ camera?: "hero" | "dashboard" | "flat" | "cinematic" | "detail";
1508
+ /** Degrees about the horizontal axis; positive tips the top away. */
1509
+ tilt_x?: number;
1510
+ /** Degrees about the vertical axis; positive turns the right side away. */
1511
+ tilt_y?: number;
1512
+ /** Degrees in the picture plane, clockwise. */
1513
+ roll?: number;
1514
+ /** Moves the tilted window, in CSS pixels. */
1515
+ camera_offset?: {
1516
+ x?: number;
1517
+ y?: number;
1518
+ };
1519
+ /** Scales the window about its center before the tilt; above 1 it may run past the canvas edges. */
1520
+ frame_scale?: number;
1521
+ /**
1522
+ * Depth of field over the whole composed screenshot (background, window, shadows and text): a Gaussian
1523
+ * blur whose sigma, in CSS pixels, is this value where the blur is full, mixed over the sharp image by
1524
+ * the `depth_blur_type` mask. The `hero` and `dashboard` cameras bring 6 from position 0.7, `cinematic`
1525
+ * 38 from 0.45 and `detail` 4 from 0.3 (ScreenFramed's presets); 0 turns the blur off. Screenshots only:
1526
+ * a video with a depth blur is refused with `style_invalid` at `/overrides/depth_blur`.
1527
+ */
1528
+ depth_blur?: number;
1529
+ /**
1530
+ * `dir` (the default) stays sharp up to `depth_blur_position` along `depth_blur_angle` and blurs toward
1531
+ * the far edge; `tilt` keeps a sharp band `depth_blur_band` wide centered at `depth_blur_position` and
1532
+ * blurs both sides; `radial` keeps the center sharp (18% of the half-diagonal) and blurs toward the
1533
+ * corners; `lens` is radial with a sharp circle of radius `depth_blur_width`. Needs `depth_blur`.
1534
+ */
1535
+ depth_blur_type?: "dir" | "radial" | "tilt" | "lens";
1536
+ /**
1537
+ * `dir` and `tilt`: the direction the blur grows toward (or the axis across the band), in degrees: 0 up,
1538
+ * 90 right, 180 down (the default), 270 left.
1539
+ */
1540
+ depth_blur_angle?: number;
1541
+ /**
1542
+ * `dir`: where the blur starts along the axis, 0.35 by default; `tilt`: the sharp band's center, 0.5 by
1543
+ * default.
1544
+ */
1545
+ depth_blur_position?: number;
1546
+ /** `tilt` only: the sharp band's width as a fraction of the axis, 0.25 by default. */
1547
+ depth_blur_band?: number;
1548
+ /** `lens` only: the sharp circle's radius as a fraction of the half-diagonal, 0.3 by default. */
1549
+ depth_blur_width?: number;
1550
+ /**
1551
+ * New colors for the library background's color tokens (each row of `GET /v1/render/backgrounds` lists its
1552
+ * `tokens`), for example `{"accent": "#2f43ff"}`. Needs `background_ref`; an unknown token is refused at
1553
+ * `/overrides/background_tokens/<token>`.
1554
+ */
1555
+ background_tokens?: Record<string, RenderColor>;
1556
+ /** The canvas aspect ratio; a screenshot's canvas grows to it. */
1557
+ aspect_ratio?: "auto" | "16:9" | "16:10" | "4:3" | "3:2" | "1:1" | "4:5" | "3:4" | "9:16" | "21:9";
1558
+ /** A fixed screenshot size; the page is fitted into it by `fit`. */
1559
+ canvas?: {
1560
+ width: number;
1561
+ height: number;
1562
+ };
1563
+ /** `contain` (the default) fits the whole page; `cover` fills the width and crops the bottom. */
1564
+ fit?: "contain" | "cover";
1565
+ /**
1566
+ * Where the window sits (ScreenFramed's `layout`). `default` centers it with `padding` around it.
1567
+ * `bottom-cropped` is a hero: the window is 80% of the canvas wide with equal sides and runs off the
1568
+ * bottom edge, so the top of the page shows and no bottom corner does. With `text` its top edge is at 28%
1569
+ * to 34% of the height and the text block is centered above it (the block shrinks as one until it fits,
1570
+ * and the title defaults to `title_lines` 2 with `autofit`); without text the top margin equals the
1571
+ * sides. On a fixed `canvas` the page is scaled to the window and the text sizes scale with it; without
1572
+ * one the page keeps its pixels and the canvas is the window's width / 0.8 wide at `aspect_ratio` (16:9
1573
+ * by default). `padding` and `fit` do not apply to it, nor does `text.position` `below`, and it does not
1574
+ * combine with a camera or perspective. Screenshots only: a video with it is refused with
1575
+ * `style_invalid` at `/overrides/layout`.
1576
+ */
1577
+ layout?: "default" | "bottom-cropped";
1578
+ /** Text for the window's title bar, drawn by the compositor and never parsed as HTML. */
1579
+ frame_title?: string;
1580
+ /**
1581
+ * Text for the address pill of a browser frame, and for a `mac` title bar that has no title (a video's
1582
+ * never does), drawn by the compositor and never parsed as HTML.
1583
+ */
1584
+ frame_url?: string;
1585
+ /** Flips the frame and the `auto` background. */
1586
+ theme?: "light" | "dark";
1587
+ /**
1588
+ * Cursor scale, 1 by default. On a video, 1 is an arrow 48 px tall on a 1080p frame (4.4% of the frame's
1589
+ * short side), about twice a system cursor against the page, as in Screen Studio; it grows with the camera's
1590
+ * zoom. On a screenshot, and with `look: 1`, 1 is the 22 px arrow on the page's scale.
1591
+ */
1592
+ cursor_size?: number;
1593
+ /** `false` keeps the cursor's size while the camera zooms. */
1594
+ cursor_zoom?: boolean;
1595
+ /**
1596
+ * How small the cursor gets when it clicks: it shrinks to this over 70 ms and springs back over 220 ms
1597
+ * after the release, with no overshoot. 0.8 by default; 1 turns it off. A video's only.
1598
+ */
1599
+ cursor_press_scale?: number;
1600
+ /**
1601
+ * The click effect's color. Left out, B3 blue (#2F43FF), and on a video white at 45% where the page under
1602
+ * the click is darker than luma 100 or more saturated than 0.6, such as a blue button, so the ring shows
1603
+ * there (not with `look: 1`). Set, it is that color on every page.
1604
+ */
1605
+ click_color?: RenderColor;
1606
+ /** How long the click effect lasts, 450 by default. */
1607
+ click_duration_ms?: number;
1608
+ /**
1609
+ * Caption text size in pixels at 1080p, 34 by default. Each captions preset starts at its own size: 34 for
1610
+ * `default`, 42 for `bold`, 40 for `minimal` and 44 for `light`. A caption's box keeps at least 48 px (at
1611
+ * 1080p) from each side of a video's frame: a cue too wide for that wraps between its words, and a word too
1612
+ * wide for it alone draws that cue smaller (not with `look: 1`).
1613
+ */
1614
+ caption_size?: number;
1615
+ caption_color?: RenderColor;
1616
+ /**
1617
+ * The karaoke word being spoken: a color (`RenderColor`: hex, `rgb()` or a CSS color name), or `auto`, the
1618
+ * `default` captions' setting. `auto` takes the color from the video's background: a preset background
1619
+ * of the video set carries its own accent (the image's most characteristic color), any other image or a
1620
+ * gradient gives the most saturated color covering at least 5% of it, and a flat or grey one gives
1621
+ * #9CB0FF. That color is then lightened or darkened, its hue kept, until it reads at 4.5:1 or more
1622
+ * against the caption's box (or the background under the caption when the box is clear), stands 12
1623
+ * or more (CIELAB Delta E) from `caption_color` and, where the words to come are dimmer than the spoken
1624
+ * ones (`caption_upcoming` under 1), is 10 or more points of CIELAB lightness further from the box than
1625
+ * they are, so the word being spoken always stands apart from the words already spoken and is never the
1626
+ * dimmest word in the caption. A color set here is drawn as it is. The color chosen is the same for the whole video and is recorded in the
1627
+ * timeline's `captions.highlight`, so a restyle without a style and a re-export repeat it; a restyle
1628
+ * that brings a style takes the word from that style, `auto` fitted to the background it draws. `bold` lights it in yellow; with `look: 1` the `default` captions light it in
1629
+ * #8B97FF, as before.
1630
+ */
1631
+ caption_highlight?: RenderColor | "auto";
1632
+ caption_background?: RenderColor;
1633
+ /**
1634
+ * Where burned-in captions sit for the whole video: `bottom` (the default) or `top`, centred in the caption
1635
+ * band beside the window. A cue never moves; the camera keeps every target it frames, and the cursor, at
1636
+ * least 24 px (at 1080p) clear of the pill instead. With `look: 1` a cue still moves to the other edge when a
1637
+ * step's target sits under it.
1638
+ */
1639
+ caption_position?: "bottom" | "top";
1640
+ /**
1641
+ * Karaoke: how bright the words still to come are, as an opacity of `caption_color`; the words already
1642
+ * spoken are `caption_color` and the word being spoken `caption_highlight`. 0.55 for the `default`
1643
+ * captions; 1 for the other presets, which draw the words to come like the spoken ones.
1644
+ */
1645
+ caption_upcoming?: number;
1646
+ /**
1647
+ * Karaoke: how long a word takes to light, from the shade of the words to come to `caption_highlight`,
1648
+ * while the word before it settles to `caption_color`, so the light passes from one word to the next with
1649
+ * no frame where none is lit. Only colors change: the line never moves as words light. 80 for the
1650
+ * `default` captions; 0 (at once) for the other presets.
1651
+ */
1652
+ caption_fade_ms?: number;
1653
+ /**
1654
+ * What a video draws around the caption where the window lies under it: when the camera zooms in until
1655
+ * the page fills the frame, or when the captions sit over the page. `blur`, the default on every preset,
1656
+ * blurs the window's pixels from 120 px (at 1080p) above the caption's box to the frame's edge,
1657
+ * progressively, from nothing to a 16 px blur (a Gaussian's standard deviation, as CSS `blur(16px)`) at
1658
+ * the box's edge and past it, and darkens light content there by up to 6% (dark content not at all), so
1659
+ * text beside, above and below the caption dissolves and is never cut by its edge. The wallpaper, the
1660
+ * caption and the cursor stay sharp; where the caption lies on the wallpaper, as at rest, nothing changes.
1661
+ * The blur keeps its own time: it stays through the pause between two lines on one page when the pause
1662
+ * is 1 s or less and the page lies under the caption at both of its ends, while only the caption fades,
1663
+ * and it fades in and out over 200 ms before the first line, after the last, at a page change and across
1664
+ * a longer pause (the timeline's `captions.backdrop`). `none` leaves the page around the caption as it is.
1665
+ * With `look: 1` there is none.
1666
+ */
1667
+ caption_backdrop?: "blur" | "none";
1668
+ /**
1669
+ * A video's window proportions under the default `padding`. `tall` (the default) gives the window the
1670
+ * height screen recorders give it and the width a desktop page needs: 8% of the frame's height above and
1671
+ * below the window (more on the captions' side when they need it) and, on a landscape frame, 6.5% of the
1672
+ * width at each side, the window never wider than 2:1; at 1920x1080 a 1668x864 window, 80% of the frame's
1673
+ * height, over a 1440x746 default viewport, the page drawn 1.16 times its CSS size. `wide` is the first look
1674
+ * v2 shape: 9% of the frame's long edge on every side, the window as wide as that leaves (1568x734 at
1675
+ * 1920x1080 over a 1440x674 viewport, 2.14:1).
1676
+ */
1677
+ window_shape?: "tall" | "wide";
1678
+ /**
1679
+ * Smear what moves over each frame's shutter, as a camera would: the window, page and background on every
1680
+ * frame of a zoom or pan that moves faster than `motion_blur_onset`, by its motion past it over half a
1681
+ * frame. On by default. Held frames, and frames the camera moves through slowly, stay sharp, exactly as
1682
+ * without it. At the default 60 fps the fastest frames of the default zoom-in soften and a paused one still
1683
+ * reads. A moving cursor stays
1684
+ * a sharp arrow on every frame, over a faint trail behind it of its motion across the shutter, at most three
1685
+ * quarters of the arrow long. With `look: 1` only the cursor's trail shows, as its smear did before.
1686
+ */
1687
+ motion_blur?: boolean;
1688
+ /**
1689
+ * How long the shutter stays open, in frames, centered on each frame's time: 0.5 by default (half a frame at the
1690
+ * default 60 fps). 1 is Screen Studio's whole frame (1/60 s at 60 fps), twice as long a smear.
1691
+ */
1692
+ motion_blur_shutter?: number;
1693
+ /**
1694
+ * How fast what the camera shows must move at the frame's edge, on average and with the zoom's own rate,
1695
+ * before the window, page and background smear, in the frame's short sides a second, whatever the frame
1696
+ * rate: 0.45 by default, about 8 px a frame at 1080p and 60 fps, so slower frames stay sharp and a faster one
1697
+ * smears by `motion_blur_shutter` of the motion past it, up to `motion_blur_max`. Read at the edge, a zoom
1698
+ * about the middle of the frame blurs like a zoom into a corner. 0 smears every frame of a move from its first
1699
+ * pixel. The cursor's trail shows its own motion whatever this is.
1700
+ */
1701
+ motion_blur_onset?: number;
1702
+ /**
1703
+ * The longest smear a camera move leaves at the frame's edge, on average, in pixels at 1080p: 6.5 by
1704
+ * default, so the fastest frames of every zoom soften alike (to about a quarter of the sharpness at rest)
1705
+ * and a paused one still reads. 200 lifts the limit.
1706
+ */
1707
+ motion_blur_max?: number;
1708
+ /**
1709
+ * How close to its camera move's top speed a frame must be to smear: 0 by default, no such gate. 0.9 smears
1710
+ * only the two or three fastest frames of a move, as before 11-10.
1711
+ * `{"motion_blur_shutter": 1, "motion_blur_onset": 0, "motion_blur_max": 200}` smears every camera move by the
1712
+ * whole frame, as Screen Studio does.
1713
+ */
1714
+ motion_blur_peak?: number;
1715
+ matte?: RenderColor;
1716
+ /**
1717
+ * `1` draws a video in production's look from before 2026-11-11: its frame and layout (`padding`, 64 px at
1718
+ * 1080p by default, on every side, and the default viewport of then, 1440x730 at 1920x1080 in the browser
1719
+ * frame), the captions over the page near the window's foot, the 60% black caption pill, `bold` as 52 px
1720
+ * outlined text, the studio background for `auto`, 14 pixel corners, the old default shadow and a cursor
1721
+ * shown from the start. A new video gets a page-only camera, which zooms the page inside a window that
1722
+ * stands still, capped at 1.6x by default (`max_zoom` sets another; no `background_motion` or
1723
+ * `background_blur`), with today's move timings, and makes the poster the whole window after the last
1724
+ * step. Send it with `"frame": "browser"` to keep a video's old look. With it, `shadow: "soft"` is the old
1725
+ * black two-layer shadow, on a screenshot too. A restyle keeps the camera its video was recorded with, and
1726
+ * draws today's cursor, a sharp arrow over a faint trail, where production stamped copies of it. `2`, the
1727
+ * default, is the current look.
1728
+ */
1729
+ look?: 1 | 2;
955
1730
  }
956
1731
  /** Give `url` or `html`. */
957
1732
  export type ScreenshotCreateRequest = {
@@ -959,7 +1734,9 @@ export type ScreenshotCreateRequest = {
959
1734
  url?: string;
960
1735
  /** HTML to render instead of loading a URL. Rendered with no network access. */
961
1736
  html?: string;
962
- /** A vision profile ID or name to load before navigating (with `url` only). */
1737
+ /**
1738
+ * A vision profile ID or name of this project to load before the page loads, to capture it signed in (with `url` only; needs `vision:profiles:use`). A page that is still signed out fails with `profile_expired`.
1739
+ */
963
1740
  profile?: string;
964
1741
  viewport?: Viewport;
965
1742
  /**
@@ -970,8 +1747,11 @@ export type ScreenshotCreateRequest = {
970
1747
  /** @default false */
971
1748
  full_page?: boolean;
972
1749
  target?: Target;
973
- /** @default "load" */
974
- wait_until?: "load" | "domcontentloaded" | "networkidle";
1750
+ /**
1751
+ * 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.
1752
+ * @default "auto"
1753
+ */
1754
+ wait_until?: "auto" | "load" | "domcontentloaded" | "networkidle";
975
1755
  /**
976
1756
  * Extra settle time after the page is ready.
977
1757
  * @default 0
@@ -984,10 +1764,25 @@ export type ScreenshotCreateRequest = {
984
1764
  * @default "auto"
985
1765
  */
986
1766
  theme?: "light" | "dark" | "auto";
987
- /** CSS selectors to hide before capture (cookie banners, chat widgets). */
1767
+ /**
1768
+ * 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).
1769
+ */
988
1770
  hide?: string[];
989
- /** @default true */
1771
+ /**
1772
+ * 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.
1773
+ * @default true
1774
+ */
990
1775
  block_ads?: boolean;
1776
+ /**
1777
+ * `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.
1778
+ * @default "remove"
1779
+ */
1780
+ overlays?: "remove" | "keep";
1781
+ /**
1782
+ * `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.
1783
+ * @default "auto"
1784
+ */
1785
+ settle?: "auto" | "fast";
991
1786
  style?: RenderStyle;
992
1787
  /** @default "webp" */
993
1788
  format?: "webp" | "png" | "jpeg";
@@ -998,6 +1793,7 @@ export type ScreenshotCreateRequest = {
998
1793
  quality?: number;
999
1794
  /** Extra encodings of the same capture, each an artifact. */
1000
1795
  variants?: ScreenshotVariant[];
1796
+ auto_background?: AutoBackgroundOptions;
1001
1797
  metadata?: Metadata;
1002
1798
  };
1003
1799
  export interface ScreenshotVariant {
@@ -1025,8 +1821,46 @@ export interface Screenshot {
1025
1821
  artifacts: Artifact[];
1026
1822
  created_at: string;
1027
1823
  expires_at: string;
1824
+ /**
1825
+ * 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.
1826
+ */
1827
+ status_code?: number;
1828
+ /** The URL after redirects (absent for `html`). */
1829
+ final_url?: string;
1830
+ page_state?: ScreenshotPageState;
1831
+ /**
1832
+ * 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 library image the `auto` background or `background_ref: "auto"` chose could not be loaded within 2 s; the style's own background was drawn), `auto_background_pin` (the project's, organization's or node's `auto_background` pin does not clear the page's edges, so `auto` picked another image; it names both).
1833
+ */
1834
+ warnings?: string[];
1835
+ /** What the clean capture hid, by kind and signal, with how many (`overlays`, `block_ads`). */
1836
+ overlays_removed?: OverlayRemoved[];
1028
1837
  timing?: Timing;
1029
1838
  metadata: Metadata;
1839
+ /**
1840
+ * The library background drawn: the style's `overrides.background_ref`, or the image `"auto"` chose for
1841
+ * this page. Absent when the style draws no library background.
1842
+ */
1843
+ background_ref?: string;
1844
+ auto_background?: AutoBackgroundChoice;
1845
+ }
1846
+ /**
1847
+ * 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`.
1848
+ */
1849
+ export interface ScreenshotPageState {
1850
+ state: "ok" | "error" | "loading" | "login" | "paywall" | "cookie_wall";
1851
+ /** What decided it. */
1852
+ signal?: string;
1853
+ }
1854
+ export interface OverlayRemoved {
1855
+ /**
1856
+ * `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`.
1857
+ */
1858
+ kind: "consent" | "dialog" | "backdrop" | "banner" | "chat" | "ad_slot";
1859
+ /**
1860
+ * How it was recognized: a consent manager's name (`onetrust`, `sourcepoint`, `trustarc`...), `markup`, `text`, `banner`, `dialog`, `dim`, `promo`, `widget`, or `empty` for ad slots.
1861
+ */
1862
+ signal: string;
1863
+ count: number;
1030
1864
  }
1031
1865
  export type ScreenshotList = Omit<ListEnvelope, "data"> & {
1032
1866
  data: Screenshot[];
@@ -1034,7 +1868,10 @@ export type ScreenshotList = Omit<ListEnvelope, "data"> & {
1034
1868
  export interface Artifact {
1035
1869
  id: string;
1036
1870
  object: "artifact";
1037
- kind: "image" | "mp4" | "gif" | "poster" | "vtt" | "srt";
1871
+ /**
1872
+ * `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`).
1873
+ */
1874
+ kind: "image" | "mp4" | "gif" | "poster" | "vtt" | "srt" | "chapters" | "share";
1038
1875
  content_type: string;
1039
1876
  bytes?: number;
1040
1877
  width?: number;
@@ -1082,8 +1919,9 @@ export interface StepType {
1082
1919
  target?: Target;
1083
1920
  text: string;
1084
1921
  /**
1085
- * Delay between characters on the video's clock.
1086
- * @default 80
1922
+ * Delay between characters on the video's clock. Left out, 35 ms: quick, steady typing, which reads well
1923
+ * on screen. The camera holds one shot on the field for the whole burst (`camera.typing_zoom`).
1924
+ * @default 35
1087
1925
  */
1088
1926
  interval_ms?: number;
1089
1927
  }
@@ -1128,7 +1966,9 @@ export interface Beat {
1128
1966
  export interface VideoSource {
1129
1967
  /** Where the recording starts. */
1130
1968
  url: string;
1131
- /** A vision profile ID or name to start signed in. Responses show the resolved `prof_` ID. */
1969
+ /**
1970
+ * A vision profile ID or name of this project to record signed in: loaded into the probe and every capture segment (needs `vision:profiles:use`). Responses show the resolved `prof_` ID. A page that opens still signed out fails the video with `profile_expired`.
1971
+ */
1132
1972
  profile?: string;
1133
1973
  }
1134
1974
  export interface VoiceSpec {
@@ -1141,8 +1981,7 @@ export interface VoiceSpec {
1141
1981
  }
1142
1982
  export interface CaptionOptions {
1143
1983
  /**
1144
- * `none`: sidecar files only. `static`: draw each cue. `karaoke`: also highlight the spoken word.
1145
- * @default "none"
1984
+ * `none`: sidecar files only. `static`: draw each cue as a small pill in the margin under the window, which grows to hold it, on one line when that fits and `max_chars_per_line` and `max_lines` are left out. When the captions are too large for the margin, every cue sits over the page near its foot instead, and moves to the top while a step clicks what it would cover. `karaoke`: the same, with the words in step with the narration: on the default pill the words already spoken are white, the word being spoken is lit in a light B3 blue and the words to come are dimmed, each word lighting over 80 ms. A cue stays up until 0.2 s after its last word and 0.3 s after the last step of its beat is done; one still up when a click loads a new page ends 0.1 s after that page first shows, or 0.2 s after its last word when that is later. Left out: `karaoke` when the video is narrated, `static` when it is silent (`voice: null`, or a key without `infer:run`), whose word times are only estimated.
1146
1985
  */
1147
1986
  burn_in?: "none" | "static" | "karaoke";
1148
1987
  /** @default ["vtt"] */
@@ -1157,44 +1996,331 @@ export interface CaptionOptions {
1157
1996
  export interface VideoOutput {
1158
1997
  width: number;
1159
1998
  height: number;
1999
+ /**
2000
+ * Frames per second of the video. The page is captured at 30 frames a second and the camera, cursor and
2001
+ * captions are drawn at this rate; while the page scrolls, a 60 fps video captures it at 60, once per output
2002
+ * frame (the timeline's `capture.stride` and `capture.full_rate`).
2003
+ */
1160
2004
  fps: 24 | 25 | 30 | 50 | 60;
1161
2005
  }
1162
2006
  export type VideoFormat = "mp4" | "gif" | "poster";
1163
2007
  export interface VideoCreateRequest {
1164
2008
  source: VideoSource;
1165
2009
  beats: Beat[];
1166
- voice?: VoiceSpec;
2010
+ /**
2011
+ * The narration voice. Leave it out and every beat with `say` is narrated in the node's default voice,
2012
+ * `kokoro-82m` `af_heart`, normalized to -16 LUFS. Narration is speech made as the caller, so it needs
2013
+ * `infer:run` in the key's scopes as well as `render:run`; a key without it gets a silent video with a
2014
+ * `narration_scope` warning. `null` makes a silent video: word times are then estimated from the text, so
2015
+ * steps and captions still follow the lines.
2016
+ */
2017
+ voice?: VoiceSpec | null;
1167
2018
  captions?: CaptionOptions;
2019
+ /**
2020
+ * The look. Leave it out, or send `{}`, for the B3OS look on the bare rounded window, with no bar;
2021
+ * `{"frame": "window"}` adds the traffic lights on a slim bar in the page's top color, and `{"frame":
2022
+ * "browser"}` an address pill.
2023
+ */
1168
2024
  style?: RenderStyle;
2025
+ /**
2026
+ * How the camera follows the steps. The camera moves over the whole frame: as it zooms in, the window, its
2027
+ * shadow and the page grow together and the background and the window's edges leave the frame, while
2028
+ * captions stay where they are. By default (`framing: subject`) each page is held in one of three
2029
+ * compositions: the whole window, the page's main content area, or one panel (see `framing`). With
2030
+ * `framing: point`, before a click, select or typing step it zooms in on the element and stays in through
2031
+ * the whole step (a type until its last key), for 1.5 s at least; it stays in for the next step when that
2032
+ * one starts within 2.5 s, or is close by, and pans only when the next element nears the edge of the frame,
2033
+ * and only as far as brings it back in. Every move is one quick, damped spring with no overshoot:
2034
+ * a zoom in or out takes 0.6 s (the first zoom-in less when the first step comes in under 1.1 s); a move to
2035
+ * the next element sets off with the cursor, never before it, and takes longer the farther it goes, so the
2036
+ * middle of the frame moves at most 60 px a frame at 60 fps, or faster where that keeps the cursor 8% of
2037
+ * the frame inside its edges. An element near an edge of the window zooms with that edge held in place, so
2038
+ * the margin beside it stays in view, and where the whole window or page fits the frame, it stays whole,
2039
+ * with the room beside it split evenly when there is little to spare. The camera rests 1.5 s at least on
2040
+ * what it shows last before it zooms out, when the video has room before its end, and the last zoom holds
2041
+ * until the narration line about it has nearly ended. The video opens on the whole window
2042
+ * for half a second at least and ends on it for a second at least, so it can run a little past the last
2043
+ * beat.
2044
+ */
1169
2045
  camera?: {
1170
2046
  /**
1171
- * Zoom toward the element each step acts on.
1172
- * @default true
2047
+ * `auto` moves the camera. With `framing: subject`, the default, its zooms are its compositions' (see
2048
+ * `framing`) and what follows holds where it says so. With `framing: point` it zooms so the element and a
2049
+ * little around it fill about 45% of the frame width, from 1.25x up to `max_zoom`, and 1.25x on an
2050
+ * element in a nav, aside or header bar, where the change it causes is
2051
+ * usually elsewhere on the page. A zoom under 1.4x is not worth the move: the camera stays wide for it
2052
+ * (a nav element starting a session, a typing shot under 1.4x), and an element inside a zoomed session
2053
+ * that would zoom less is framed at the session's zoom. After a move lands, the next waits 1.2 s at
2054
+ * least: an element that comes sooner is framed with the one before it when both fit one view at 1.4x
2055
+ * or more, else the camera stays where it is for the earlier one and moves once, to the later one. With
2056
+ * `scroll: comfortable` the view changes (camera moves and page scrolls together) at most once per 2.5 s
2057
+ * on average over the video: over that, the move with the least change of zoom whose element was
2058
+ * already in view is left out, and the element is framed where the camera stands. A
2059
+ * re-centre under 96 px at 1080p is left out. A click that loads a new page ends the zoom: the camera
2060
+ * starts going wide 0.1 s after the new page first shows, also when the page's address changes only by
2061
+ * the next step. On a portrait frame the camera zooms at most as far as keeps the whole window across the
2062
+ * frame, and the 1.4x floor applies after that, so a portrait video stays on the whole window and only
2063
+ * its page scrolls. Held against one window edge, a view keeps a window edge on the other axis that shows
2064
+ * in the frame at its resting margin. With burned-in captions every element the camera frames, and the
2065
+ * cursor resting by it, stays at least 24 px (at 1080p) clear of the caption pill, and a zoomed hold keeps
2066
+ * the window's bottom edge where it rests, so the pill sits on the background under it, whenever the
2067
+ * element ends at least 20 px above that edge and starts at least 120 px below the frame's top; otherwise
2068
+ * the pill lies over the page. A hold never leaves the window's bottom edge between y 960 and 1080 at
2069
+ * 1080p: it moves it to 950 or below the frame. With both framings the 1.2 s between moves, the 2.5 s
2070
+ * budget, the click that loads a new page and the portrait limit hold. The pill never moves. `subtle` makes the same moves at 1.25x (its zooms
2071
+ * are kept, under 1.4x). `off` keeps the whole window in view.
2072
+ * @default "auto"
2073
+ */
2074
+ style?: "auto" | "subtle" | "off";
2075
+ /**
2076
+ * The older spelling of `style`: `false` is `off`, `true` is `auto`. Send `style` instead. A request
2077
+ * whose `auto_zoom` and `style` disagree is refused with `invalid_request`.
2078
+ * @deprecated
1173
2079
  */
1174
2080
  auto_zoom?: boolean;
1175
- /** @default 2 */
2081
+ /**
2082
+ * The most the camera zooms, never exceeded. A small button reaches it; a wide element zooms less, so it
2083
+ * fits. Left out, the camera zooms up to 1.7x, or to the zoom within 10% of it where one captured pixel
2084
+ * lands on one output pixel (1.73x on the default canvas and viewport, two output pixels per CSS pixel;
2085
+ * 1.84x with `window_shape: wide`), so zoomed text is as sharp as the page. Left out, it never magnifies
2086
+ * the page past three output pixels per CSS pixel at 1080p, so a phone layout on a portrait video, drawn
2087
+ * at about twice its size, zooms about 1.4x. Above that the zoom enlarges the capture, and text is a
2088
+ * little softer. The zoom magnifies the whole frame, window and page alike. With `look: 1`, left out
2089
+ * it is 1.6, production's cap, which lands at 1.61x, one to one, on that look's default canvas, and
2090
+ * the zoom magnifies the page inside the window.
2091
+ * @default 1.7
2092
+ */
1176
2093
  max_zoom?: number;
2094
+ /**
2095
+ * How far the background follows the window as the camera moves: 0 holds it still, 1 moves and zooms
2096
+ * it with the window, so the whole frame zooms as one. At the default it moves and zooms a tenth as
2097
+ * much, a slight depth behind the window.
2098
+ * @default 0.1
2099
+ */
2100
+ background_motion?: number;
2101
+ /**
2102
+ * Blur the background: an image background is drawn 4 px soft on the whole window (at 1080p, scaled
2103
+ * with the frame), so the window stays the busiest thing in the frame, and softens further as the camera
2104
+ * zooms in, about 7 px at 1.6x on a 1080p video, at most 16 px. `false` keeps it sharp throughout, and
2105
+ * `overrides.look: 1` draws it sharp at rest. Left out, it is on for an image background (the default
2106
+ * look's library images among them) and off for gradients, solid colors and patterns, where a blur shows
2107
+ * little or erases the pattern. Gradients, solid colors and patterns are never blurred at rest. It is
2108
+ * decided before the first frame, so a default video drawn on its studio fallback (no library image
2109
+ * clears the page's edges, or the image could not be loaded) blurs that mesh as the camera zooms; send
2110
+ * `false` to keep it sharp.
2111
+ */
2112
+ background_blur?: boolean;
2113
+ /**
2114
+ * The zoom of a typing shot: a field typed into (a `type` step, or a click a `type` without a target
2115
+ * follows) is framed from its start at this zoom, reached by the first key (the cursor gets there half a
2116
+ * second early) and held for the whole
2117
+ * burst, with no move per key; a click right after it on something already in view stays in the
2118
+ * same shot.
2119
+ * It is never less than the camera's least zoom, 1.25x, which is what 1 gives, never more than
2120
+ * `max_zoom`, nor more than the zoom where the page is as sharp as captured (1.73x on the default
2121
+ * canvas), so the default types at 1.73x. `style: subtle` keeps its own ceiling, and a field in a nav,
2122
+ * aside or header bar its own zoom. With `framing: subject` a field typed into is a DETAIL when it
2123
+ * qualifies (see `framing`), at this zoom at most, and otherwise held in the page's main content area.
2124
+ * @default 2
2125
+ */
2126
+ typing_zoom?: number;
2127
+ /**
2128
+ * What the camera holds. `subject` (the default) holds each page in one of three compositions. The
2129
+ * whole window. MAIN, the page's main content area across the frame: the content box of its `main` (or
2130
+ * `role="main"`) element when that is wider than half the viewport, else the viewport less a fixed or
2131
+ * sticky sidebar or header bar, with 24 CSS px each side, from 1.25x up to `max_zoom` (1.42x on the B3OS
2132
+ * console); a page with neither has no MAIN and is held on the whole window, where the first element a
2133
+ * step acts on or the narration names is a DETAIL whatever the length of its line (an element with no
2134
+ * enclosing panel framed by its own box), an element that DETAIL shows stays in it, and a page's DETAILs
2135
+ * come at most one per 4 s. DETAIL, one panel or control:
2136
+ * the nearest enclosing element that draws a box of its own (a background, a border, a shadow or
2137
+ * rounded corners) or is a section, article, main, form, table, list, dialog or region, at least 240 x
2138
+ * 120 CSS px or 1.3 times the element on both axes, or the element's own row when that panel is too wide
2139
+ * for 1.4x, at up to `max_zoom`, only when it is narrower than 45% of MAIN's view, its narration line (or
2140
+ * its typing) lasts 2 s or more from the step, it zooms at least 1.1x MAIN's zoom, and its view keeps the
2141
+ * window's bottom edge where it rests or holds the element above the caption band. A page opens on the
2142
+ * whole window, goes to MAIN at its first step or narrated element, may go to a DETAIL (held through its
2143
+ * line) and back, goes from one DETAIL to another only within 40% of the frame's width, and goes wide
2144
+ * again only at a click that loads a new page or at the end; an element outside MAIN across, such as a
2145
+ * sidebar link, is reached wide. MAIN keeps the window's bottom edge where it rests, the caption pill on
2146
+ * the background under it; for a beat whose element lies above that view, or whose label starts less than
2147
+ * 24 CSS px under that view's top edge, its top is the window's top,
2148
+ * the pill over the page, and a page moves between the two at most once, in one 0.4 s vertical move (it
2149
+ * stays top-anchored when its elements would need more). A click that loads a new path starts a new page,
2150
+ * which takes its own position as it first shows: where the camera holds MAIN across the click at one
2151
+ * zoom, it cuts there with the page, with no move. Where page content lies under the captions, no
2152
+ * element the camera frames, no typed text and no resting cursor sits within 120 px (at 1080p) above the
2153
+ * pill's top. A DETAIL's view is placed by its panel, never by the click: centred on it, or from 24 px
2154
+ * left of its left edge when it is wider than the view, with the element and the cursor kept 24 px
2155
+ * inside, and an edge that would cut a neighbouring panel moves to the gap beside it when that is within
2156
+ * 20% of the frame's width. A hover the narration speaks over, and an element a `wait` step waits for (by
2157
+ * `for.selector` or `for.text`) while a line is spoken, are followed too, a wait only when no click,
2158
+ * hover, select or typing follows it in its beat; the first such element of a line is in view from 0.3 s
2159
+ * before the line starts, and so is an element waited for after clicks in its line that all land inside
2160
+ * it, once a scroll before it has landed. A click that opens a beat after the first lands 0.3 s after its
2161
+ * line starts, the cursor setting off in the pause before the line, and an element waited for after it is
2162
+ * that line's element; a `wait` for a heading names its section's first panel. The closing zoom-out starts
2163
+ * at least 1.2 s after the last narrated element is shown. After a click that loads a new page, the first
2164
+ * element waited
2165
+ * for or hovered on it is the new page's subject: the camera zooms in to the new page's MAIN 0.3 s after
2166
+ * the new page first shows, or, still in MAIN on the page the click left at the same zoom, cuts to it as
2167
+ * it first shows, and holds until 0.8 s after its line ends, and the video leaves
2168
+ * room for that; without one, the camera goes wide 0.1 s after the new page first shows. The recorder measures each element's panels and the
2169
+ * page's main content box as its step runs (`observed.subject` in the timeline). `point` frames the click
2170
+ * point, at the zoom that fits the element, and leaves hovers and waits to the cursor, as before. With
2171
+ * `look: 1` the camera frames the point.
2172
+ * @default "subject"
2173
+ */
2174
+ framing?: "subject" | "point";
2175
+ };
2176
+ /**
2177
+ * How the page scrolls to what a step acts on or waits for. `comfortable`: an element outside the middle of
2178
+ * the viewport (8% to 85% of its height) scrolls its panel (see `camera.framing`) to the middle, its top at
2179
+ * 20% when the panel is taller than 40% of the viewport, else centred at 45%, the element kept in that band,
2180
+ * and up to 24 px further so the viewport's edges fall between lines of text: before the cursor sets off
2181
+ * for it (the scroll lasts 300 ms plus 0.6 ms per CSS px, from 0.45 s to 0.9 s, starts and stops gently
2182
+ * with its fastest moment at its middle, and lands 0.3 s before), and as a waited-for element appears. A
2183
+ * 60 fps video captures its page once per output frame while it scrolls (at 30 fps elsewhere), so the page
2184
+ * moves a little every frame. A scroll always runs its whole length: the step and the rest of its beat wait
2185
+ * for it. A scroll that brings in the element a narration line names runs in the pause before the line and
2186
+ * ends by its start (0.3 s before it when there is room); when the pause is shorter than the scroll, the line
2187
+ * and everything after it wait for it, 0.8 s at most. Before the scrolls are planned step by step, a page
2188
+ * whose elements all show in the camera's view at one scroll position scrolls once, to that position, in the
2189
+ * pause before the first line that needs it, and never again. A scroll that serves a later beat runs before
2190
+ * that beat. An element already in
2191
+ * the band never scrolls the page, and while the camera is zoomed, an element whose panel the viewport
2192
+ * shows whole is reached by moving the camera (`framing: "point"`); with the default framing the camera
2193
+ * holds the page's view instead, so the scroll is left out only when that view already shows the panel
2194
+ * whole above the caption. The page never goes up and back down: of two scrolls in
2195
+ * opposite directions within 4 s that move it on by less than 25% of their total, one or both are left out
2196
+ * whenever the steps they serve stay in the viewport without them, or the two become one scroll to a position
2197
+ * that keeps them all in view (a step's element is never left out of the viewport); when neither works, both
2198
+ * run at their whole length, and `result.warnings` and the timeline's `warnings` have `scroll_round_trip`. A
2199
+ * scroll for an element in a sticky box is left out when it can be. A scroll never runs
2200
+ * during a camera move (it ends 0.1 s before one starts, or starts 0.1 s after one lands; a zoom-out waits
2201
+ * for the scroll that brings a waited-for element), a scrolled result stays put 1.2 s, and a narration line
2202
+ * scrolls the page once. Before the closing zoom-out a scrolled page goes back to the top whenever the last
2203
+ * 0.9 s or more before it have no caption and no step, and otherwise as the zoom-out starts. So name a step's
2204
+ * result with a `wait` step
2205
+ * (`for.selector` or `for.text`) and the camera brings it into view. `minimal` scrolls only an
2206
+ * element outside the viewport, to its middle, as before. `off` moves the page only by the script's own
2207
+ * `scroll` steps: a step whose element is outside the viewport fails as one whose element is not found. With
2208
+ * `look: 1` the page scrolls as `minimal`.
2209
+ * @default "comfortable"
2210
+ */
2211
+ scroll?: "comfortable" | "minimal" | "off";
2212
+ /**
2213
+ * How the cursor moves. It shows from the first frame, with no fade-in, parked on the first of six spots
2214
+ * that is plain on the video's first frame and on its frame just before the cursor first moves, as
2215
+ * captured, and clear of text, controls and images on the page just before the first step: right of
2216
+ * and below the middle of the page (62% across, 68% down), near its bottom right (88%, 88%), low in the
2217
+ * middle (50%, 92%), at its right edge (92%, 50%), in its bottom-right corner (96%, 96%) or at the middle
2218
+ * of its bottom edge (50%, 97%); the page gets no pointer event until the cursor's first move has ended, so
2219
+ * nothing on it is hovered from the first frame or on the cursor's way to its first target. Each move settles smoothly, the way Screen Studio's smoothed cursor
2220
+ * does, and lands when it would have; after a click, a select or the first key typed into a field, the
2221
+ * cursor moves just off the element, so it never covers its label or the text being typed while the camera
2222
+ * holds. After a hover, and while typing, it rests where its arrow covers no text, badge or control and
2223
+ * stays at least 8 px inside the page: below and right of the hovered label's own text (of the hovered
2224
+ * point on a target wider than 400 px whose text runs as wide, such as a table row), else right of it,
2225
+ * else another spot that keeps the arrow's tip within 24 px of the label (a table's header cells count as
2226
+ * text); while typing, under the field, beside
2227
+ * it or above it, else another spot within 24 px of it, else inside it past the end of the typed text. A
2228
+ * hover's rest is checked again on the captured page as the cursor sets off for it: where its arrow would
2229
+ * lie on text there, it rests at the first clear spot beside, below or above the element (or on the
2230
+ * element itself), the least busy one when none is clear.
2231
+ * When the page scrolls under the resting cursor, it stands still while the page moves, then, 150 ms
2232
+ * after the scroll ends, moves once off what it landed on, across it (under or above a label, beside a
2233
+ * tall box) up to 64 px, else up to 40 px to the nearest spot clear of what scrolled there; it stays when
2234
+ * that spot is under 24 px away. Still for 2 s, it fades out, and it fades back in before its next move. It never tilts. A restyle keeps the path its video was recorded with; `look: 1`
2235
+ * moves it as before (hidden until it fades in at the middle before its first move).
2236
+ */
2237
+ cursor?: {
2238
+ /**
2239
+ * How long each move takes to settle: the remaining distance falls to about a third of itself every
2240
+ * 100 ms near the end at the default. 0 keeps the eased path without smoothing.
2241
+ * @default 100
2242
+ */
2243
+ smoothing_ms?: number;
2244
+ /**
2245
+ * Still this long, the cursor fades out over 0.4 s, and it fades back in over 0.3 s before its next
2246
+ * move; still to the end of the video, it stays hidden. 0 never hides it; under 500 counts as 500.
2247
+ * @default 2000
2248
+ */
2249
+ hide_after_ms?: number;
2250
+ /**
2251
+ * After a click, a select or the first key typed into a field, move the cursor just below the element
2252
+ * (above it near the bottom of the page) when the next move can wait for it. A hover never moves off.
2253
+ * @default true
2254
+ */
2255
+ move_aside?: boolean;
1177
2256
  };
2257
+ /**
2258
+ * The page's CSS size. Left out, 1440 px wide on a landscape frame and 430 on a portrait one, as tall as the
2259
+ * window's shape; a square or near-square frame (no wider than 4:3) gets about its window's width, so its page
2260
+ * is drawn at least one pixel per CSS pixel at rest.
2261
+ */
1178
2262
  viewport?: Viewport;
1179
2263
  output?: VideoOutput;
1180
2264
  /** @default ["mp4","poster"] */
1181
2265
  formats?: VideoFormat[];
1182
2266
  /** Seeds the page's randomness so a re-render is identical. */
1183
2267
  seed?: number;
1184
- /** The page's `Date` at the start of the video; the clock then advances with the video. */
2268
+ /**
2269
+ * The page's `Date` at the start of the video; the clock then advances with the video. Left out, it is the job's creation time, the same as `created_at`, so the page shows when the video was made. `result.start_time` gives the value used. Send it back in the same request with `recording.reuse` to replay the same recording on the same clock while it is kept; without `recording.reuse` the site is loaded again, so a page that changed shows the change.
2270
+ */
1185
2271
  start_time?: string;
1186
2272
  recording?: RecordingOptions;
2273
+ auto_background?: AutoBackgroundOptions;
1187
2274
  webhook?: WebhookConfig;
1188
2275
  metadata?: Metadata;
1189
2276
  }
2277
+ /**
2278
+ * How the default `background: auto` picks its library image, for this request. Each field overrides the
2279
+ * project's, then the organization's, then the node's setting. By default the node keeps one pick per
2280
+ * organization and site (the page's registrable domain, such as `linear.app` for `app.linear.app`; the host for
2281
+ * `localhost` and IP addresses): the vision model's first pick for a site is kept, and later videos and
2282
+ * screenshots of the site draw the same image while it clears their page's edges. A color-rules pick is not
2283
+ * kept, so the site's next video or screenshot asks the model again.
2284
+ */
2285
+ export interface AutoBackgroundOptions {
2286
+ /**
2287
+ * Draw this library image instead of picking one (an image `auto` could pick: in an auto pack, as `GET /v1/render/backgrounds` lists them), on any page. Another value is refused with 422 `invalid_request` at `/auto_background/pin`. A project's, organization's or node's pin is drawn on pages whose edges its image clears; on another page `auto` picks instead and `warnings` names the pin (`auto_background_pin`), and when no image of the set clears that page either, the pin is drawn after all.
2288
+ */
2289
+ pin?: string;
2290
+ /**
2291
+ * Ask the model again for this site and keep its answer in place of the one kept. Where the vision model is off (the node's setting, or `vision: false`), it makes no call and the color rules pick.
2292
+ * @default false
2293
+ */
2294
+ repick?: boolean;
2295
+ /**
2296
+ * `false`: pick with the color rules alone, without the vision model or the site's kept pick. Default: the project's, the organization's or the node's setting (on where the node has the model). `true` does not turn the model on where the node has turned it off.
2297
+ */
2298
+ vision?: boolean;
2299
+ }
2300
+ /**
2301
+ * The library image the default `background: auto` drew and how it was chosen. Absent when the style draws another background, or when the image could not be loaded in time (`background_fallback`).
2302
+ */
2303
+ export interface AutoBackgroundChoice {
2304
+ ref: string;
2305
+ /**
2306
+ * `vision`: the vision model chose it among the images that clear the page's edges. `heuristic`: the color rules chose it (vision off or unavailable, an `html` source, the model did not answer in time, or one image clears); it is not kept. `pinned`: `auto_background.pin` named it, or a project, organization or node setting did, where its image clears the page's edges or no image of the set clears them. `stored`: the pick kept for this site.
2307
+ */
2308
+ chosen_by: "vision" | "heuristic" | "pinned" | "stored";
2309
+ /** The site the pick is kept under. Absent for an `html` source. */
2310
+ key?: string;
2311
+ /** The model's one-line reason (`vision`), or why the color rules chose (`heuristic`). */
2312
+ reason?: string;
2313
+ }
1190
2314
  /**
1191
2315
  * Where the page's network traffic comes from. By default every video loads the site live and records that
1192
2316
  * load (its capture segments replay the recording, so they all see the same content). With `reuse: true` the
1193
2317
  * video replays the newest recording another video of this project made of the same source URL, steps,
1194
2318
  * viewport, seed and start time within `max_age_s`, instead of loading the site again: faster, and the
1195
- * content is what the site served then. When no such recording exists the site is loaded and recorded as
1196
- * usual. `result.recording` says which happened. Recordings hold the page's responses; they are deleted
1197
- * 24 hours after they were made, or earlier with the last video that used them.
2319
+ * content is what the site served then. Videos without `start_time` match each other, and the replay runs on
2320
+ * the clock the recording was made on, so the page shows that time. A video that sends back such a video's
2321
+ * `result.start_time` replays that recording too. When no such recording exists the site is loaded and
2322
+ * recorded as usual. `result.recording` says which happened. Recordings hold the page's
2323
+ * responses; they are deleted 24 hours after they were made, or earlier with the last video that used them.
1198
2324
  */
1199
2325
  export interface RecordingOptions {
1200
2326
  /** @default false */
@@ -1219,13 +2345,60 @@ export interface VideoRestyleRequest {
1219
2345
  webhook?: WebhookConfig;
1220
2346
  metadata?: Metadata;
1221
2347
  }
2348
+ export interface VideoShareRequest {
2349
+ /** The page title and preview title. Default the first beat's `title`, else "Video". */
2350
+ title?: string;
2351
+ }
2352
+ export interface VideoShare {
2353
+ object: "video_share";
2354
+ video_id: string;
2355
+ /** The share page's artifact (kind `share`, `share.html`). */
2356
+ artifact_id: string;
2357
+ title: string;
2358
+ /** The share page, a signed `usercontent.b3os.org` URL valid until `expires_at`. */
2359
+ url: string;
2360
+ /** An `<iframe>` of the page, 960 wide at the video's aspect ratio, ready to paste. */
2361
+ embed_html: string;
2362
+ /** The video's width in pixels. */
2363
+ width: number;
2364
+ /** The video's height in pixels. */
2365
+ height: number;
2366
+ created_at: string;
2367
+ /** When the page and its link end (the MP4's own expiry). */
2368
+ expires_at: string;
2369
+ }
1222
2370
  export interface VideoResult {
1223
2371
  duration_ms: number;
1224
2372
  width: number;
1225
2373
  height: number;
1226
2374
  fps: number;
2375
+ /**
2376
+ * The page's clock at the start of the video: the request's `start_time`, or the job's `created_at` when it had none (with `recording.reuse`, a replayed recording's own clock). Sent back as `start_time` with `recording.reuse`, the same request replays a recording made on that clock while one is kept, so the content and clock are the same; without `recording.reuse` the site is loaded again. A restyle repeats its source's. Absent on videos made before this field, and on a restyle of one whose `start_time` is not an RFC 3339 date and time.
2377
+ */
2378
+ start_time?: string;
2379
+ /**
2380
+ * The MP4 first (when asked for), then the poster, the caption files, the GIF and, when a beat has a title, the chapters file.
2381
+ */
1227
2382
  artifacts: Artifact[];
1228
2383
  recording?: RecordingInfo;
2384
+ narration?: NarrationInfo;
2385
+ /**
2386
+ * 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); `background_fallback` (the library image the `auto` background or `background_ref: "auto"` chose could not be loaded in time; the video was drawn on the studio pick, or the style's own background, and a restyle tries again); `scroll_round_trip` (the steps make the page scroll down and back up, or up and back down, within 4 s and no one scroll position shows every element they act on, so the video runs both scrolls; the timeline's `warnings` has the code too); `auto_background_pin` (the project's, organization's or node's `auto_background` pin does not clear the first frame's edges, so `auto` picked another image; it names both). A restyle repeats its source's, except `background_fallback`, which it decides again, and `auto_background_pin`, which it repeats only when it draws the source's image again (a restyle that picks the background again says its own, and one that draws another background says none). Absent when there is nothing to say.
2387
+ */
2388
+ warnings?: string[];
2389
+ auto_background?: AutoBackgroundChoice;
2390
+ }
2391
+ /**
2392
+ * Present when the request has `voice` and at least one beat has `say` (a restyle repeats its source's).
2393
+ * `spoken: false` means the narration was not spoken for at least one beat: the key lacks `infer:run`
2394
+ * (`reason` names the scope) or speech synthesis was unavailable. The video still succeeds, has no narration
2395
+ * track, and its word times (step placement, captions) are estimated from the text.
2396
+ */
2397
+ export interface NarrationInfo {
2398
+ /** True when every beat's narration was synthesized and is in the video's audio. */
2399
+ spoken: boolean;
2400
+ /** Why the narration was not spoken (only when `spoken` is false). */
2401
+ reason?: string;
1229
2402
  }
1230
2403
  /** A video job (`vid_…`). `progress` counts phases (voice, plan, capture, compose, encode, upload). */
1231
2404
  export type Video = Omit<Job, "id" | "object" | "result"> & {
@@ -1234,16 +2407,24 @@ export type Video = Omit<Job, "id" | "object" | "result"> & {
1234
2407
  source: VideoSource;
1235
2408
  /** The source video when this video is a restyle. */
1236
2409
  restyled_from: string | null;
2410
+ /**
2411
+ * Only while `status` is `queued` and the video waits for one of the node's video slots: its place in
2412
+ * the node's queue, `1` for the next video to start. It moves up as videos ahead start or are
2413
+ * canceled, and the field is gone once the video runs.
2414
+ */
2415
+ queue_position?: number;
1237
2416
  result?: VideoResult;
1238
2417
  };
1239
2418
  export type VideoList = Omit<ListEnvelope, "data"> & {
1240
2419
  data: Video[];
1241
2420
  };
1242
2421
  /**
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).
2422
+ * An event of a video's stream. `job.queued` carries `queue_position` when the video waits for a slot (its
2423
+ * place when it was created; the video itself has the current one); `video.phase` carries `phase`;
2424
+ * `video.artifact` carries `artifact` (without a signed URL; fetch the artifact or the video for one).
1245
2425
  */
1246
2426
  export type VideoEvent = JobEvent & {
2427
+ queue_position?: number;
1247
2428
  phase?: "voice" | "plan" | "capture" | "compose" | "encode" | "upload";
1248
2429
  artifact?: Artifact;
1249
2430
  };
@@ -1267,7 +2448,7 @@ export interface RenderTimeline {
1267
2448
  };
1268
2449
  capture: {
1269
2450
  /**
1270
- * Page capture rate. Capture frame seq is taken at virtual time t(seq) = round(seq * 1e6 / fps) us.
2451
+ * Page capture clock. Capture frame seq is taken at virtual time t(seq) = round(seq * 1e6 / fps) us (with stride, only the seqs it takes).
1271
2452
  * @default 30
1272
2453
  */
1273
2454
  fps: number;
@@ -1288,6 +2469,23 @@ export interface RenderTimeline {
1288
2469
  * @default 1
1289
2470
  */
1290
2471
  segments?: number;
2472
+ /**
2473
+ * 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, or, in look v2, at the video's rest scale (its page layer's output pixels per CSS pixel rounded up to a thousandth, 1.159 on the default 1920x1080 canvas), so the whole window is the capture drawn one to one, and a zoom at 2 (a node may capture a zoom at the least of 1.5, 1.75 and 2 that its frames need, never enlarged); a closing shot on the whole window shorter than 2 s right after a zoom is captured with it. segment_dsf records what each segment got.
2474
+ * @default "auto"
2475
+ */
2476
+ dsf?: 1 | 2 | "auto";
2477
+ /**
2478
+ * 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. 1 or 2, or a scale between them in thousandths: a rest scale (1.159) for the segments of a look v2 video that do not zoom, 1.5 or 1.75 for a look v2 zoom that needs no more where the node captures zooms at a mid scale; timelines written before 2026-11-11 hold only 1 and 2. A page image larger than the page layer by more than 4/3 is box-halved by the compositor before resampling; one up to 3 pixels larger (a rest-scale capture) is cut to the layer and drawn one to one.
2479
+ */
2480
+ segment_dsf?: number[];
2481
+ /**
2482
+ * Look v2 (2026-11-11): outside full_rate, only the capture seqs that are a multiple of stride are taken (captured and drawn); every output frame shows the latest taken seq at or before its time. A video whose page scrolls runs its capture clock (fps) at the output rate with stride 2 (60 over the node's 30), so its scrolls are captured once per output frame and the rest of it at 30 fps as before. Absent: every seq is taken.
2483
+ */
2484
+ stride?: number;
2485
+ /**
2486
+ * Capture seq ranges [from, to) taken at the full fps whatever the stride: each page scroll from one frame before it starts to one after it lands.
2487
+ */
2488
+ full_rate?: number[][];
1291
2489
  };
1292
2490
  /** Composed video. Output frame index i is presented at t = round(i * 1e6 / fps) us. */
1293
2491
  output: {
@@ -1313,10 +2511,29 @@ export interface RenderTimeline {
1313
2511
  captions?: RenderTimelinePresetRef;
1314
2512
  click_effect?: RenderTimelinePresetRef;
1315
2513
  /**
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.
2514
+ * 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, cursor_press_scale, click_color, click_duration_ms, caption_size, caption_color, caption_highlight, caption_background, caption_position, caption_upcoming, caption_fade_ms, caption_backdrop, window_shape, motion_blur, motion_blur_shutter, motion_blur_onset, motion_blur_peak, 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), look. Unknown keys and bad values are refused with 422 style_invalid.
1317
2515
  */
1318
2516
  overrides?: Record<string, unknown>;
1319
2517
  };
2518
+ /**
2519
+ * The default look the video was drawn in: version 2 (2026-11-11: a library image behind the page, the bare rounded window with no bar, 22 px corners on 1080p, the layered shadow, the tall window: 8% of the frame's height above and below it and 6.5% of a landscape frame's width at each side). Absent on a timeline from before it, whose restyle without a style draws production's look of then: its style (`{"frame": "browser"}` when it names none), a 64 px margin at 1080p, the captions over the page, the 60% black pill, the studio mesh it drew, 14 px corners and the contact and ambient shadow pair; the cursor is today's, a sharp arrow over a faint trail.
2520
+ */
2521
+ look?: {
2522
+ version: 2;
2523
+ /**
2524
+ * The library image `background: auto` picked from the first frame (also in `style.overrides.background_ref`). A restyle without a style loads it again the way `auto` does: if it cannot be had in time, the studio pick and a `background_fallback` warning, never a failed job.
2525
+ */
2526
+ background_pick?: string;
2527
+ /**
2528
+ * How the first frame chose the image `background: auto` drew: by the vision model among the images that clear the page's edges, by the color rules, pinned by an option, or the pick kept for the site (`key`, the page's registrable domain).
2529
+ */
2530
+ background_choice?: {
2531
+ ref: string;
2532
+ chosen_by: "vision" | "heuristic" | "pinned" | "stored";
2533
+ key?: string;
2534
+ reason?: string;
2535
+ };
2536
+ };
1320
2537
  /**
1321
2538
  * Where the page layer lands in the output frame, computed by b3os-compose from style and output size and recorded for reproducibility.
1322
2539
  */
@@ -1341,7 +2558,7 @@ export interface RenderTimeline {
1341
2558
  */
1342
2559
  actions: RenderTimelineAction[];
1343
2560
  /**
1344
- * Composited cursor (not drawn in the page). Position is linear between consecutive points; pressed and visible keep their last value until a point changes them. Before the first point and after the last, the nearest point applies.
2561
+ * Composited cursor (not drawn in the page). Position is linear between consecutive points; pressed and visible keep their last value until a point changes them. Before the first point and after the last, the nearest point applies. The director hides the cursor until it fades in over 300 ms before its first move, where that move starts.
1345
2562
  */
1346
2563
  cursor?: {
1347
2564
  points: {
@@ -1350,12 +2567,34 @@ export interface RenderTimeline {
1350
2567
  y: number;
1351
2568
  pressed?: boolean;
1352
2569
  visible?: boolean;
2570
+ /**
2571
+ * On a point that changes visible: turning it true, the cursor's opacity rises from 0 to 1 over this long from t_us; turning it false (the idle hide), it falls from 1 to 0 and the cursor is drawn until t_us + fade_us (smoothstep).
2572
+ */
2573
+ fade_us?: RenderTimelineUs;
1353
2574
  }[];
2575
+ /**
2576
+ * The page gets the pointer from this time on: the end of the cursor's first move (look v2; round 4 gave it from that move's start). Before it the recorder sends the page no pointer event, so nothing under the parked cursor, or on its way to its first target, is hovered, and the capture's frame 0 may park the cursor again. A look v2 cursor parks at the first of (62%, 68%), (88%, 88%), (50%, 92%), (92%, 50%), (96%, 96%) and (50%, 97%) of the viewport whose 96 px box (output px) is plain on the capture's frame 0 and that the probe found clear of text, controls and media; the timeline's path is parked there. Absent: the pointer follows the cursor from frame 0, as before.
2577
+ */
2578
+ pointer_from_us?: RenderTimelineUs;
1354
2579
  };
1355
2580
  /**
1356
- * Camera keyframes. For t between keyframes k-1 and k: u = (t - t[k-1]) / (t[k] - t[k-1]), e = easing[k](u), zoom = zoom[k-1] * (zoom[k] / zoom[k-1])^e, center = center[k-1] + (center[k] - center[k-1]) * e. Before the first keyframe and after the last, the nearest keyframe holds. The camera rect is width = viewport.width / zoom, height = viewport.height / zoom, x = clamp(center.x - width / 2, 0, viewport.width - width), y likewise. Absent: zoom 1 centered.
2581
+ * Camera keyframes. For t between keyframes k-1 and k: u = (t - t[k-1]) / (t[k] - t[k-1]), e = easing[k](u), zoom = zoom[k-1] * (zoom[k] / zoom[k-1])^e, center = center[k-1] + (center[k] - center[k-1]) * e. Before the first keyframe and after the last, the nearest keyframe holds. Page space (space absent or page): the camera rect is width = viewport.width / zoom, height = viewport.height / zoom, x = clamp(center.x - width / 2, 0, viewport.width - width), y likewise; the page is cropped and scaled inside a fixed window. Canvas space: the camera moves over the whole composition (output px, canvas W x H = output size, page rect P = layout.page, s = P.size / viewport). center is the zoom's focus, the point that keeps its place on the frame: F = P.xy + center * s on the canvas; the card's view (frame_state view.card) is width = W / zoom, height = H / zoom, x = clamp(F.x * (1 - 1 / zoom), 0, W - width), y likewise, and every card layer (window, shadow, page, border, cursor, click effects) shows it scaled to the frame; zoom keeps its meaning (output px per CSS px = s * zoom). The background's view has zoom zb = 1 + p * (zoom - 1) (p = background_motion) about (W / 2 + p * (cx - W / 2), H / 2 + p * (cy - H / 2)), (cx, cy) the card view's center, clamped likewise, and blurs by a Gaussian of sigma = min(7 / 0.6 * (zoom - 1), 16) * min(W, H) / 1080 output px when background_blur is on (drawn at the nearest whole multiple of min(W, H) / 1080 px; frame_state view.blur gives sigma unrounded). Captions stay fixed on the frame. Absent: zoom 1 centered.
1357
2582
  */
1358
2583
  camera?: {
2584
+ /**
2585
+ * What the keyframes move: the page inside a fixed window (page; every timeline from before look v2), or the whole composition (canvas).
2586
+ * @default "page"
2587
+ */
2588
+ space?: "page" | "canvas";
2589
+ /**
2590
+ * Canvas space: how far the background follows the card, 0 (still) to 1 (zooms with it: the whole composition zooms as one).
2591
+ * @default 0.1
2592
+ */
2593
+ background_motion?: number;
2594
+ /**
2595
+ * Canvas space: whether the background blurs as the card zooms in, as the request's camera.background_blur set it. Absent, the request left it out, and the background the video draws decides: on for an image, the default look's library images among them, off for gradients, solid colors and patterns. A restyle decides again for the background it draws.
2596
+ */
2597
+ background_blur?: boolean;
1359
2598
  keyframes: {
1360
2599
  t_us: RenderTimelineUs;
1361
2600
  center: RenderTimelinePoint;
@@ -1376,13 +2615,37 @@ export interface RenderTimeline {
1376
2615
  /** @default 20 */
1377
2616
  max_chars_per_second?: number;
1378
2617
  cues: RenderTimelineCue[];
2618
+ /**
2619
+ * Look v2 round 4f: the karaoke word's color the frames drew and where it came from, so a restyle and a re-export repeat it. Written by the node for karaoke captions in the new look; absent on a timeline from before, with look 1 and without karaoke.
2620
+ */
2621
+ highlight?: {
2622
+ /** The word's color, #rrggbb. */
2623
+ color: string;
2624
+ /**
2625
+ * auto: from the background's pixels (an image outside the presets, a gradient; a flat or grey one gives #9cb0ff), fitted to the caption. preset: a preset background's own accent, fitted. request: the request's caption_highlight or its captions preset's own color.
2626
+ */
2627
+ source: "auto" | "preset" | "request";
2628
+ };
2629
+ /**
2630
+ * Look v2: when the caption backdrop's band (the blur under the pill where page content lies under the captions) holds, as runs it is drawn at full strength in; it fades in over 200 ms before each run and out over 200 ms after it, and only the pill fades between the cues of a run. The node decides the runs from the final cues, pages and camera: two cues share a run when their gap is 1.0 s or less, no new page paints in it and page content lies under the band at both of its ends (abutting cues always do). Written by the node and decided again by a restyle; absent (a timeline from before, look 1, no burned-in captions): the band fades with the pill.
2631
+ */
2632
+ backdrop?: {
2633
+ /** The run's first cue's start. */
2634
+ start_us: number;
2635
+ /** The run's last cue's end. */
2636
+ end_us: number;
2637
+ }[];
1379
2638
  };
1380
2639
  /**
1381
2640
  * Per capture frame: the viewport region to capture. Sent to the recorder for each segment. Frames not listed are not captured.
1382
2641
  */
1383
2642
  capture_plan?: RenderTimelineCaptureFrame[];
1384
- /** Optional FrameState dump (debugging, tests, GET .../timeline?frames=1). */
2643
+ /** Optional FrameState dump (debugging, tests, GET .../timeline?frames=true). */
1385
2644
  frames?: RenderTimelineFrameState[];
2645
+ /**
2646
+ * What the planner rendered as the script asked although the look would do it otherwise, as codes (look v2). `scroll_round_trip`: the script's own steps scroll the page one way and back within 4 s and no one position shows them all, so both scrolls run. Absent when there are none.
2647
+ */
2648
+ warnings?: string[];
1386
2649
  }
1387
2650
  /** Microseconds on the virtual timeline. */
1388
2651
  export type RenderTimelineUs = number;
@@ -1440,6 +2703,78 @@ export interface RenderTimelineObservation {
1440
2703
  scroll?: RenderTimelinePoint;
1441
2704
  /** Virtual time at which a navigate or wait finished. */
1442
2705
  settled_us?: RenderTimelineUs;
2706
+ /**
2707
+ * The target sits inside nav, aside or a header bar (or their landmark roles); the camera zooms less there (1.25x).
2708
+ */
2709
+ landmark?: "nav" | "aside" | "header";
2710
+ /**
2711
+ * Look v2 round 4e: the least height (CSS px) the document had in the probe from the step before this one up to this one. The planner gives a page no offset a later step's page could not keep (a list that empties while a filter loads shortens the page and the browser scrolls it back).
2712
+ */
2713
+ doc_min?: number;
2714
+ /**
2715
+ * Look v2 round 4f: after the step, the rows where the page draws ink as [top, bottom, left, right] in page CSS px (text lines, media, fields, buttons, fills and borders that stand off the page's background; columns apart; a sticky element where it stood when the probe read it). The planner puts the top edge of a held view in a gap between them, so no line is cut by the frame's edge.
2716
+ */
2717
+ ink?: number[][];
2718
+ /** Look v2 round 4f: the same rows for what fixed elements draw, in viewport CSS px. */
2719
+ ink_fixed?: number[][];
2720
+ /**
2721
+ * 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.
2722
+ */
2723
+ ahead_us?: RenderTimelineUs;
2724
+ /**
2725
+ * Look v2 round 4 (a new video's camera.framing and scroll): what the camera frames the target by, measured in the page in the same evaluate as the target when the action ran, in CSS px in page coordinates (the viewport position plus scroll), so a restyle can frame it again. For a wait: its element (the one for.selector matches, or the first visible element showing for.text), whose viewport box is then also rect and point.
2726
+ */
2727
+ subject?: {
2728
+ /** The document's scroll offset when the boxes were measured. */
2729
+ scroll: RenderTimelinePoint;
2730
+ /**
2731
+ * The scroll offset before the recorder scrolled the page to the target (scroll: comfortable); absent when it did not.
2732
+ */
2733
+ from?: RenderTimelinePoint;
2734
+ target: RenderTimelineRect;
2735
+ /** The target's ancestors with a box, nearest first, up to the body (left out). */
2736
+ ancestors?: {
2737
+ rect: RenderTimelineRect;
2738
+ tag?: string;
2739
+ role?: string;
2740
+ /** It draws a box of its own: a background, a border, a shadow or rounded corners. */
2741
+ panel?: boolean;
2742
+ /**
2743
+ * A sectioning or grouping element or role: table, form, section, article, main, dialog, fieldset, figure, a list, a region, group, tab panel or grid.
2744
+ */
2745
+ group?: boolean;
2746
+ /** A row or list item: tr, li, row, listitem, option, treeitem. */
2747
+ row?: boolean;
2748
+ }[];
2749
+ /**
2750
+ * The index in ancestors of the target's subject as the recorder chose it: the nearest panel or group that holds the target and is at least 240 x 120 CSS px or 1.3 times the target on both axes. The camera chooses again by the same rule.
2751
+ */
2752
+ panel?: number;
2753
+ /**
2754
+ * The boxes of that subject's siblings: a held view's edge never rests inside one when a gap beside it is near.
2755
+ */
2756
+ siblings?: RenderTimelineRect[];
2757
+ /**
2758
+ * Look v2 round 4b: the rows in the viewport (lines of text and table rows). No longer written or read since round 4c, when the camera's three compositions and the blur band under the caption pill replaced the shift that kept the pill's edges off them; accepted on a timeline from before.
2759
+ */
2760
+ rows?: RenderTimelineRect[];
2761
+ /**
2762
+ * Look v2 round 4c: the page's main content box, which the camera's MAIN view frames with 24 CSS px each side across the frame: the content box (padding and border left out) of the main or [role=main] element when that is wider than half the viewport, else the viewport less the fixed or sticky elements that span a full edge of it (a sidebar, a header bar), 24 px in from them. Absent on a page with neither: its MAIN is the whole window. The camera reads the first one measured on each page.
2763
+ */
2764
+ main?: RenderTimelineRect;
2765
+ /**
2766
+ * Look v2 round 4c: the target or one of its ancestors is position: sticky; the page does not scroll for it when what the scroll served stays in the viewport without it.
2767
+ */
2768
+ sticky?: boolean;
2769
+ };
2770
+ /**
2771
+ * Where the cursor's tip can rest after a hover or a type, viewport space at at_us (look v2, round 4): its arrow's box at least 8 px inside the viewport and over no text, badge, control or media, as the probe found it with elementFromPoint: below and right of the hovered label's own text (of the hovered point on a target wider than 400 px whose text runs as wide or that has none), right of it plus 16 px, or (round 4b) another spot within 24 px of it (round 4c: with the arrow's tip within 24 px, so never above it, where round 4's spot put the tip an arrow's height over the label; a table's header cells count as text); for a field typed into, under it, beside it, above it, another spot within 24 px of it, or inside it 12 px from its right end when the typed text ends at least 24 px before the arrow. A type without a target is probed on the focused field, and the click into that field carries the type's rest. Absent when no spot was clear, or the probe was not asked.
2772
+ */
2773
+ rest?: RenderTimelinePoint;
2774
+ /**
2775
+ * Look v2 round 4b: after the probe's framing scrolled the page for this action, the boxes (viewport space after the scroll) of the text lines, badges, controls, fields and media near where the cursor rests after the last pointer action. The resting cursor stands still while the scroll plays, then (round 4c) moves once, 150 ms after it ends, up to 40 px to a spot clear of them; it stays when that spot is under 24 px away. Absent when the page did not scroll for the action, nothing was near, or the probe was not asked.
2776
+ */
2777
+ busy?: RenderTimelineRect[];
1443
2778
  error?: {
1444
2779
  code: string;
1445
2780
  detail?: string;
@@ -1479,8 +2814,7 @@ export type RenderTimelineAction = {
1479
2814
  /** scroll: delta from the current offset. */
1480
2815
  by?: RenderTimelinePoint;
1481
2816
  /**
1482
- * scroll: animation length on the virtual clock.
1483
- * @default 600000
2817
+ * scroll: animation length on the virtual clock, at most 10 s, 600000 (0.6 s) when absent. type: how long the typing runs, its characters times interval_us, at most the video's length (the director writes it; the recorder times each key from interval_us, and a type without it lasts that long all the same).
1484
2818
  */
1485
2819
  duration_us?: number;
1486
2820
  easing?: RenderTimelineEasing;
@@ -1552,6 +2886,10 @@ export interface RenderTimelineCue {
1552
2886
  byte_start: number;
1553
2887
  byte_end: number;
1554
2888
  }[];
2889
+ /**
2890
+ * 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.
2891
+ */
2892
+ position?: "top" | "bottom";
1555
2893
  }
1556
2894
  /**
1557
2895
  * 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.
@@ -1582,6 +2920,16 @@ export interface RenderTimelineFrameState {
1582
2920
  y: number;
1583
2921
  visible: boolean;
1584
2922
  pressed: boolean;
2923
+ /**
2924
+ * Below 1 while the cursor fades in or out (a point's fade_us).
2925
+ * @default 1
2926
+ */
2927
+ opacity?: number;
2928
+ /**
2929
+ * How far the last press has shrunk the cursor: from the press it rises to 1 over 70 ms (a critically damped spring from rest), and from the release it falls back to 0 over 220 ms. The style's cursor_press_scale is the cursor's size at 1.
2930
+ * @default 0
2931
+ */
2932
+ press?: number;
1585
2933
  };
1586
2934
  effects: {
1587
2935
  kind: "click";
@@ -1593,10 +2941,39 @@ export interface RenderTimelineFrameState {
1593
2941
  caption: null | {
1594
2942
  cue: RenderTimelineLocalId;
1595
2943
  lines: string[];
2944
+ /**
2945
+ * Karaoke: the word being spoken, the last whose start is at or before t_us (look v2: at or before t_us plus half of caption_fade_ms, so its fade is centred on the word's start). The style draws the words before it in the caption color, it in caption_highlight and the words after it at caption_upcoming of the caption color; over caption_fade_ms from its start it lights from that shade while the previous word settles from caption_highlight to the caption color (ease-out cubic).
2946
+ */
1596
2947
  highlight?: {
1597
2948
  line: number;
1598
2949
  byte_start: number;
1599
2950
  byte_end: number;
2951
+ /** How long ago the word started, at most 1 s. Absent: lit in full. */
2952
+ since_us?: number;
2953
+ /** The word before it in the cue. */
2954
+ previous?: {
2955
+ line: number;
2956
+ byte_start: number;
2957
+ byte_end: number;
2958
+ };
2959
+ };
2960
+ /** The cue's own position, over the caption style's. */
2961
+ position?: "top" | "bottom";
2962
+ /**
2963
+ * Look v2: below 1 while the caption fades in over the 150 ms before its cue starts (as much of them as the cue before leaves) or out over its last 150 ms (a cue that abuts the one before or after it does not fade on that side).
2964
+ * @default 1
2965
+ */
2966
+ opacity?: number;
2967
+ /**
2968
+ * Look v2: the cue before it, which this one abuts, while the text crossfades from it (120 ms) and the box resizes from its size (200 ms), both ease-out cubic from the boundary.
2969
+ */
2970
+ from?: {
2971
+ lines: string[];
2972
+ position?: "top" | "bottom";
2973
+ /** How far the text has crossfaded to this cue. */
2974
+ text: number;
2975
+ /** How far the box has moved from the old cue's size to this one's. */
2976
+ size: number;
1600
2977
  };
1601
2978
  };
1602
2979
  /**
@@ -1613,6 +2990,60 @@ export interface RenderTimelineFrameState {
1613
2990
  cursor_dx?: number;
1614
2991
  cursor_dy?: number;
1615
2992
  };
2993
+ /**
2994
+ * Canvas-space camera only: what the frame shows of the composition, in canvas px (output px at zoom 1). camera is then the part of the viewport in view (view.card cut to layout.page), the whole viewport at zoom 1. A view of the whole canvas composes as a frame without a camera.
2995
+ */
2996
+ view?: {
2997
+ /**
2998
+ * The card's view: the window, its shadow, the page, the cursor and click effects show this rect scaled to the frame.
2999
+ */
3000
+ card: RenderTimelineRect;
3001
+ /** The background's own view. Absent: the background moves with the card, unblurred. */
3002
+ background?: RenderTimelineRect;
3003
+ /**
3004
+ * The background's Gaussian blur, sigma in output px.
3005
+ * @default 0
3006
+ */
3007
+ blur?: number;
3008
+ };
3009
+ /**
3010
+ * Where the camera and the cursor are when the frame's shutter opens and closes, half an output frame before and after t_us ([open, close]); present when either moves over it. With the style's motion_blur, a zoomed canvas frame whose card moves faster than motion_blur_onset and than motion_blur_peak of move_reach is the average of the composition over motion_blur_shutter of it, shortened by that onset (the card, its background at its own views), and the cursor is smeared along its own motion over motion_blur_shutter and along the camera's by the card's share.
3011
+ */
3012
+ shutter?: {
3013
+ /** Canvas space: view.card at open and close, when the camera moves. */
3014
+ card?: RenderTimelineRect[];
3015
+ /** Canvas space: view.background at open and close, when the frame has one. */
3016
+ background?: RenderTimelineRect[];
3017
+ /** The cursor's position (viewport px) at open and close. */
3018
+ cursor: RenderTimelinePoint[];
3019
+ /**
3020
+ * How long the shutter is open (µs): a whole output frame. The style's motion_blur_onset is a speed, so the compositor needs it; 0 or absent (a frame state written before it) counts as a 60 fps frame.
3021
+ */
3022
+ length_us?: number;
3023
+ /**
3024
+ * Output px: the most the card's far corner moves over such a shutter at any frame of the camera move (keyframe segment) this frame is in. The style's motion_blur_peak keeps frames under that share of it sharp; 0 or absent: no such floor.
3025
+ */
3026
+ move_reach?: number;
3027
+ };
3028
+ /**
3029
+ * Look v2: the caption backdrop's band on this frame, from captions.backdrop: its own opacity (the pill's fades do not fade it) and, when it is not the caption's, the cue whose caption box it lies under. Absent: no band, or, from a timeline without captions.backdrop, the band at the caption's own opacity.
3030
+ */
3031
+ backdrop?: {
3032
+ /** How much of the band shows (smoothstep over its 200 ms fades). */
3033
+ opacity: number;
3034
+ /**
3035
+ * The cue the band's box comes from: while no caption is drawn (a gap its run holds across, the fade after its last cue or before its first), or the cue before a held gap while the band's box moves from its box to the caption's.
3036
+ */
3037
+ under?: {
3038
+ lines: string[];
3039
+ position?: "top" | "bottom";
3040
+ /**
3041
+ * With a caption drawn: how far the band's box has moved from this cue's box to the caption's (0 to 1, ease-out cubic over 200 ms from when the caption starts to show).
3042
+ * @default 0
3043
+ */
3044
+ size?: number;
3045
+ };
3046
+ };
1616
3047
  }
1617
3048
  export interface Preset {
1618
3049
  id: PresetRef;
@@ -1628,6 +3059,119 @@ export interface Preset {
1628
3059
  export type PresetList = Omit<ListEnvelope, "data"> & {
1629
3060
  data: Preset[];
1630
3061
  };
3062
+ /** A library background. Name it in a style with `overrides.background_ref` (as `style` shows). */
3063
+ export interface RenderBackground {
3064
+ /** `<pack>/<slug>`, the value of `overrides.background_ref`. */
3065
+ ref: string;
3066
+ object: "render.background";
3067
+ /**
3068
+ * `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 the studio pick chooses from (`background: "studio"`) carries the tag `auto`. `image`: a stored WebP (see `image`).
3069
+ */
3070
+ kind: "css" | "procedural" | "image";
3071
+ pack: string;
3072
+ slug: string;
3073
+ name: string;
3074
+ description?: string;
3075
+ theme: "light" | "dark";
3076
+ tags: string[];
3077
+ /** The main colors, as the source lists them (images, the five most common, most common first). */
3078
+ palette: string[];
3079
+ /**
3080
+ * Color tokens and their defaults; `overrides.background_tokens` sets new colors for them. Empty for images.
3081
+ */
3082
+ tokens: Record<string, string>;
3083
+ /**
3084
+ * `MIT`, `own` (B3OS's own work) or a written grant recorded in B3OS's decisions, such as `grant: Sean, decision T9 (2026-11-02)`.
3085
+ */
3086
+ license: string;
3087
+ /**
3088
+ * Where the background comes from. `name` says it in text; `url`, `path` and `commit` are there only for a
3089
+ * public upstream (Pattern Craft's repository). Sean Geng's own projects (littledemo, ScreenFramed) are
3090
+ * named, never linked. `id` is the entry's id at the source.
3091
+ */
3092
+ source: {
3093
+ name: string;
3094
+ url?: string;
3095
+ path?: string;
3096
+ commit?: string;
3097
+ id?: string;
3098
+ };
3099
+ /**
3100
+ * A 360x200 WebP on B3OS's own host: drawn by the compositor for CSS backgrounds
3101
+ * (`https://beta.b3os.org/assets/presets/library/`), a cover crop of the stored file for images
3102
+ * (`https://beta.b3os.org/gallery/_library/thumbs/`).
3103
+ */
3104
+ thumbnail_url: string;
3105
+ image?: RenderBackgroundImage;
3106
+ /** The `style` value that draws this background. */
3107
+ style: {
3108
+ overrides: {
3109
+ background_ref: string;
3110
+ };
3111
+ };
3112
+ }
3113
+ /**
3114
+ * An image background's file and measured tone (CSS backgrounds have none). Tone is measured on a 16:9 cover
3115
+ * crop, over the matte for transparent shapes: `luminance` is the mean WCAG relative luminance, `hue` and
3116
+ * `chroma` OKLCH (no `hue` for grey or many-hued images), `detail` the mean Sobel edge strength (0 to 1; quiet
3117
+ * gradients are about 0.015, busy textures above 0.07).
3118
+ */
3119
+ export interface RenderBackgroundImage {
3120
+ /** The lossless WebP on B3OS's own host, named by its sha256 (cached as immutable). */
3121
+ url: string;
3122
+ width: number;
3123
+ height: number;
3124
+ bytes: number;
3125
+ sha256: string;
3126
+ group: "backgrounds" | "gradients";
3127
+ coverage: "full-bleed" | "partial" | "cutout" | "sliver";
3128
+ /** Mean color of the crop, `#rrggbb`. */
3129
+ mean: string;
3130
+ luminance: number;
3131
+ /** Absent for grey or many-hued images. */
3132
+ hue?: number;
3133
+ chroma: number;
3134
+ detail: number;
3135
+ /** Whether `background_ref: "auto"` may pick it. */
3136
+ auto: boolean;
3137
+ /** One of the hand-picked images, with its label, collection and place in the picked order. */
3138
+ featured?: {
3139
+ label: string;
3140
+ collection: string;
3141
+ rank: number;
3142
+ };
3143
+ }
3144
+ export type RenderBackgroundList = Omit<ListEnvelope, "data"> & {
3145
+ data: RenderBackground[];
3146
+ };
3147
+ export interface RenderBackgroundPack {
3148
+ pack: string;
3149
+ object: "render.background_pack";
3150
+ name: string;
3151
+ kind: "css" | "procedural" | "image";
3152
+ count: number;
3153
+ themes: Array<"light" | "dark">;
3154
+ license: string;
3155
+ /** The attribution the license asks for. */
3156
+ notice?: string;
3157
+ /**
3158
+ * The upstream's public URL, or text naming the source when it has none (Sean Geng's own projects are named, never linked).
3159
+ */
3160
+ source: string;
3161
+ cover_thumbnail_url: string;
3162
+ /** Image packs, the `ref` the cover shows. */
3163
+ cover?: string;
3164
+ /** Image packs, ScreenFramed's group. */
3165
+ group?: "backgrounds" | "gradients";
3166
+ /** Image packs, how the pack reads behind a screenshot (a hand review). */
3167
+ look?: "quiet" | "bold" | "soft-photo" | "texture" | "scenic" | "loud" | "cutout";
3168
+ /** Image packs, whether `background_ref: "auto"` may pick from it. */
3169
+ auto?: boolean;
3170
+ note?: string;
3171
+ }
3172
+ export type RenderBackgroundPackList = Omit<ListEnvelope, "data"> & {
3173
+ data: RenderBackgroundPack[];
3174
+ };
1631
3175
  /**
1632
3176
  * `running` → `paused` ↔ `running` → `stopped`. `failed` means the microVM crashed; its usage is final.
1633
3177
  */
@@ -1652,6 +3196,14 @@ export interface SandboxPort {
1652
3196
  * @default false
1653
3197
  */
1654
3198
  public?: boolean;
3199
+ /**
3200
+ * How long a request through the port's preview waits for the app to start its response (status and
3201
+ * headers), counted from when the node lets the request in. Past it the request answers `504
3202
+ * upstream_first_byte_timeout`. A response that has started may stream for up to an hour. At most 95: the
3203
+ * path in front of the node gives up on a response that has not started after 100 seconds.
3204
+ * @default 65
3205
+ */
3206
+ first_byte_s?: number;
1655
3207
  }
1656
3208
  /**
1657
3209
  * What code inside the sandbox may call at `http://127.0.0.1:7700`. Empty by default, revoked when the sandbox stops.
@@ -1674,7 +3226,10 @@ export interface SandboxApiGrant {
1674
3226
  /**
1675
3227
  * Where sandbox traffic may go, enforced by the node's egress guard. `public` (default): any public internet
1676
3228
  * 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
3229
+ * network at all. Private, loopback, tailnet and metadata addresses are always refused. Without `egress`, a
3230
+ * sandbox created by code in another sandbox gets that sandbox's policy, and a policy within it is the most
3231
+ * such code can ask for (`403 forbidden`, `reason: egress_escalation`), and it gets no public port unless that
3232
+ * sandbox's egress is `public`. A sandbox has at most
1678
3233
  * 512 outbound connections open and 64 DNS queries in flight at once; past that, new connections are refused
1679
3234
  * (`egress_unavailable`) and queries answered `SERVFAIL`. When the sandbox stops, its outbound connections
1680
3235
  * and its connections to `http://127.0.0.1:7700` close at once.
@@ -1693,11 +3248,20 @@ export interface SandboxCreateRequest {
1693
3248
  /** Restore this snapshot instead of starting from a template. */
1694
3249
  snapshot?: string;
1695
3250
  /**
1696
- * Virtual CPUs (plan maximum in `GET /v1/limits`).
1697
- * @default 1
3251
+ * Virtual CPUs; defaults to the template's (`defaults.vcpu`), at most your plan's `sandboxes.vcpu_max`.
3252
+ * A microVM cannot change its vCPU count, so sandboxes come from pools per size: a create at one of the
3253
+ * template's `size_classes` claims a pre-warmed microVM, any other size is restored on demand (a pool
3254
+ * miss: tens of milliseconds, plus about two seconds the first time a node sees that size). A node
3255
+ * builds at most 4 new off-class sizes per organization and hour; past that, a create at a size the node
3256
+ * has not built yet is refused with `429 rate_limited` (`limit.id` `sandboxes.offclass_builds`,
3257
+ * `Retry-After`), while sizes it has built and the size classes are not.
1698
3258
  */
1699
3259
  vcpu?: number;
1700
- /** @default 512 */
3260
+ /**
3261
+ * Memory; defaults to the template's (`defaults.memory_mib`), at most your plan's `sandboxes.memory_max`.
3262
+ * Rounded up to 128 MiB or a multiple of 256 MiB (the sandbox's `memory_mib` says what it got, and
3263
+ * memory is billed at that size). See `vcpu` for size classes.
3264
+ */
1701
3265
  memory_mib?: number;
1702
3266
  /** Disk size; defaults to the template's. */
1703
3267
  disk_gib?: number;
@@ -1713,7 +3277,14 @@ export interface SandboxCreateRequest {
1713
3277
  on_idle?: "stop" | "pause";
1714
3278
  /** Environment variables. Returned as given; put credentials in `secrets`. */
1715
3279
  env?: Record<string, string>;
1716
- /** Environment variables whose values are never returned or logged. */
3280
+ /**
3281
+ * Environment variables whose values are never returned by the API and never logged (the sandbox object
3282
+ * lists only their names in `secret_names`). They are not hidden from the sandbox itself: every process
3283
+ * in it gets them in its environment, so any code you run there can read them, and so can anything that
3284
+ * code sends them to. Give a sandbox only secrets the code you run in it may hold. (Injecting a
3285
+ * credential at the node's egress proxy, so that the value never enters the sandbox, is planned, not
3286
+ * available.)
3287
+ */
1717
3288
  secrets?: Record<string, SecretValue>;
1718
3289
  ports?: SandboxPort[];
1719
3290
  api?: SandboxApiGrant;
@@ -1723,8 +3294,84 @@ export interface SandboxCreateRequest {
1723
3294
  * @default false
1724
3295
  */
1725
3296
  forkable?: boolean;
3297
+ readiness?: ReadinessProbe;
3298
+ /**
3299
+ * Read only when `snapshot` is set; a create from a template ignores it and resets the template's Chrome
3300
+ * only where the node's image of that template has the reset. What happens to the random state of processes
3301
+ * that were running when the snapshot was taken, at the start of this sandbox (the option
3302
+ * `sandboxes.clone_reset`). A restored sandbox gets a fresh identity
3303
+ * and the kernel's random pool is reseeded, but a process running at the snapshot keeps its own
3304
+ * generators' state, which every sandbox started from that snapshot shares with the others and with the
3305
+ * source. The `browser` template's Chrome is the process this covers:
3306
+ * - `full`: its renderers and network service are replaced at the start, so `Math.random`,
3307
+ * `crypto.getRandomValues` and WebSocket keys are fresh. The tabs that were open at the snapshot are
3308
+ * closed and their connections dropped; the sandbox's Chrome has one new `about:blank` page.
3309
+ * - `none`: Chrome runs on as the snapshot had it, tabs and page state kept, its generators shared with the
3310
+ * source.
3311
+ *
3312
+ * Other processes running at the snapshot (a browser you started yourself, an interpreter) keep their
3313
+ * state either way; reseed or restart them. The code-interpreter kernel is reseeded on every start.
3314
+ * Default: the node's (`full` on the beta node). A value the node does not allow is refused with `422
3315
+ * option_not_allowed`. The reset runs in the snapshot's guest agent, and `full` is reported only when the
3316
+ * agent says it replaced Chrome: when this node's image of the template or the snapshot's agent predates
3317
+ * the option, `full` is refused with `409 guest_outdated` before the sandbox starts, and a start at which
3318
+ * the agent replaced none of Chrome's processes fails with `500 internal` and leaves no sandbox (retry, or
3319
+ * ask for `none`). The sandbox's `options` reports the value and where it came from, as does the
3320
+ * `X-B3OS-Options` header.
3321
+ */
3322
+ clone_reset?: "full" | "none";
1726
3323
  metadata?: Metadata;
1727
3324
  }
3325
+ /**
3326
+ * When the sandbox counts as ready: a TCP port inside it accepting connections (`port`), or a command that
3327
+ * exits 0 (`cmd`, run as `user` with a 5 s limit per try). Set exactly one. The node tries it every
3328
+ * `interval_ms` from the moment it is set until it passes or `timeout_s` runs out; the sandbox's `readiness`
3329
+ * reports the result and `POST /v1/sandboxes/{sandbox_id}/ready` waits for it. Probing goes on across a
3330
+ * restart of the node's daemon, within the same `timeout_s`; `attempts` counts the tries since the daemon
3331
+ * last recorded a change of `status`, so it can start again from a lower number after such a restart.
3332
+ */
3333
+ export interface ReadinessProbe {
3334
+ port?: number;
3335
+ /** A shell command line (run with `/bin/sh -c`) or an argv array. */
3336
+ cmd?: string | string[];
3337
+ /** @default 10 */
3338
+ interval_ms?: number;
3339
+ /** @default 60 */
3340
+ timeout_s?: number;
3341
+ }
3342
+ export interface Readiness {
3343
+ /** `failed`: the probe did not pass within its `timeout_s`, or the sandbox stopped first. */
3344
+ status: "pending" | "ready" | "failed";
3345
+ probe: ReadinessProbe;
3346
+ attempts: number;
3347
+ ready_at: string | null;
3348
+ /** From the create's start (or from when the probe was set) to the first passing try. */
3349
+ time_to_ready_ms: number | null;
3350
+ /** Why the last failing try failed. */
3351
+ last_error: string | null;
3352
+ }
3353
+ /** Optionally a new probe for the sandbox (replacing its earlier one), and how long to wait. */
3354
+ export interface ReadinessWaitRequest {
3355
+ /** @default 30000 */
3356
+ wait_ms?: number;
3357
+ port?: number;
3358
+ cmd?: string | string[];
3359
+ interval_ms?: number;
3360
+ timeout_s?: number;
3361
+ }
3362
+ export interface ReadinessResult {
3363
+ object: "readiness";
3364
+ sandbox_id: string;
3365
+ /** `pending`: `wait_ms` passed first; ask again. */
3366
+ status: "pending" | "ready" | "failed";
3367
+ probe: ReadinessProbe;
3368
+ attempts: number;
3369
+ ready_at: string | null;
3370
+ time_to_ready_ms: number | null;
3371
+ last_error: string | null;
3372
+ /** How long this call waited. */
3373
+ waited_ms: number;
3374
+ }
1728
3375
  export interface TemplateRef {
1729
3376
  id: string;
1730
3377
  name: string;
@@ -1752,9 +3399,14 @@ export interface Sandbox {
1752
3399
  public: boolean;
1753
3400
  /**
1754
3401
  * 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`.
3402
+ * `POST /v1/sandboxes/{sandbox_id}/ports/{port}/url`. Also `null` when code in another sandbox reads
3403
+ * this sandbox and this sandbox is not within that sandbox's reach (`sandboxesCreateSandbox`).
1756
3404
  */
1757
3405
  url: string | null;
3406
+ /**
3407
+ * How long a preview request waits for the app to start its response, seconds (65 unless the create said otherwise).
3408
+ */
3409
+ first_byte_s?: number;
1758
3410
  }[];
1759
3411
  api: {
1760
3412
  scopes: string[];
@@ -1771,15 +3423,40 @@ export interface Sandbox {
1771
3423
  started_at: string;
1772
3424
  paused_at: string | null;
1773
3425
  stopped_at: string | null;
1774
- /** Why the sandbox stopped. */
1775
- stop_reason: "deleted" | "timeout" | "failed" | null;
3426
+ /**
3427
+ * Why the sandbox stopped: `deleted`, `timeout` (it reached `expires_at`), `failed` (the microVM crashed),
3428
+ * `budget` (while it ran, its organization was suspended or ran out of credits, or the creating key or
3429
+ * the sandbox's own `api.spend_cap_usd` reached its cap; the node checks every 10 s) or `revoked` (the key
3430
+ * that created it was revoked).
3431
+ */
3432
+ stop_reason: "deleted" | "timeout" | "failed" | "budget" | "revoked" | null;
1776
3433
  usage: {
1777
3434
  vcpu_ms: number;
1778
3435
  gib_ms: number;
3436
+ /**
3437
+ * Present, and `true`, when `vcpu_ms` is short of the CPU the sandbox used: the node could not read
3438
+ * the microVM's CPU counter when metering began or at its last sample. What was not read is not
3439
+ * billed. Absent when the figure is whole.
3440
+ */
3441
+ vcpu_unmetered?: boolean;
1779
3442
  };
3443
+ /** The readiness probe and what it found; `null` when the sandbox has none. */
3444
+ readiness?: null | Readiness;
3445
+ options: SandboxOptions;
1780
3446
  timing?: Timing;
1781
3447
  metadata: Metadata;
1782
3448
  }
3449
+ /**
3450
+ * The options this sandbox started with, each with its `value` and the level it came from (`from`: `request`
3451
+ * when the create or fork asked for it, `node` for the node's default). Always present; `{}` for a sandbox
3452
+ * started from a template, which reads none. A fork reports its own value, not its source's.
3453
+ */
3454
+ export interface SandboxOptions {
3455
+ "sandboxes.clone_reset"?: {
3456
+ value: "full" | "none";
3457
+ from: "request" | "node";
3458
+ };
3459
+ }
1783
3460
  export type SandboxList = Omit<ListEnvelope, "data"> & {
1784
3461
  data: Sandbox[];
1785
3462
  };
@@ -1789,6 +3466,29 @@ export interface TimeoutRequest {
1789
3466
  export interface ForkRequest {
1790
3467
  /** @default 1 */
1791
3468
  count?: number;
3469
+ /**
3470
+ * What happens to the random state of processes that were running when the snapshot was taken, at the
3471
+ * start of each fork (the option `sandboxes.clone_reset`). A restored sandbox gets a fresh identity
3472
+ * and the kernel's random pool is reseeded, but a process running at the snapshot keeps its own
3473
+ * generators' state, which every fork of the call shares with the others and with the source (the
3474
+ * source itself is never reset). The `browser` template's Chrome is the process this covers:
3475
+ * - `full`: its renderers and network service are replaced at the start, so `Math.random`,
3476
+ * `crypto.getRandomValues` and WebSocket keys are fresh. The tabs that were open at the snapshot are
3477
+ * closed and their connections dropped; the sandbox's Chrome has one new `about:blank` page.
3478
+ * - `none`: Chrome runs on as the snapshot had it, tabs and page state kept, its generators shared with the
3479
+ * source.
3480
+ *
3481
+ * Other processes running at the snapshot (a browser you started yourself, an interpreter) keep their
3482
+ * state either way; reseed or restart them. The code-interpreter kernel is reseeded on every start.
3483
+ * Default: the node's (`full` on the beta node), not the source's. A value the node does not allow is
3484
+ * refused with `422 option_not_allowed`. The reset runs in each fork's guest agent, the source's copied,
3485
+ * and `full` is reported only when the agent says it replaced Chrome: when this node's image of the
3486
+ * template or the source's agent predates the option, `full` is refused with `409 guest_outdated` before
3487
+ * the source is paused, and a fork whose agent replaced none of Chrome's processes fails the call with
3488
+ * `500 internal`, no fork left (retry, or ask for `none`). Each fork's `options` reports the value and
3489
+ * where it came from, as does the `X-B3OS-Options` header.
3490
+ */
3491
+ clone_reset?: "full" | "none";
1792
3492
  metadata?: Metadata;
1793
3493
  }
1794
3494
  export interface ExecRequest {
@@ -1801,8 +3501,7 @@ export interface ExecRequest {
1801
3501
  /** Written to the command's standard input, which is then closed. */
1802
3502
  stdin?: string;
1803
3503
  /**
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
3504
+ * 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
3505
  */
1807
3506
  timeout_ms?: number;
1808
3507
  /**
@@ -1829,7 +3528,7 @@ export interface ExecResult {
1829
3528
  timing?: Timing;
1830
3529
  }
1831
3530
  /**
1832
- * `exec.stdout` and `exec.stderr` carry `data`; `exec.exit` carries `exit_code`, `signal`, `timed_out` and `duration_ms`.
3531
+ * `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
3532
  */
1834
3533
  export type ExecEvent = JobEvent & {
1835
3534
  data?: string;
@@ -1850,6 +3549,44 @@ export interface SandboxProcess {
1850
3549
  started_at: string;
1851
3550
  exited_at: string | null;
1852
3551
  }
3552
+ /** What a running sandbox uses now (`GET /v1/sandboxes/{sandbox_id}/stats`). */
3553
+ export interface SandboxStats {
3554
+ object: "sandbox_stats";
3555
+ sandbox_id: string;
3556
+ /** When the node read it. */
3557
+ taken_at: string;
3558
+ cpu: {
3559
+ /**
3560
+ * The share of all the sandbox's vCPUs that was busy over `interval_ms`, one decimal (100 is every vCPU busy). Null when the node could not read the sandbox's CPU counter.
3561
+ */
3562
+ percent: number | null;
3563
+ /** The sandbox's vCPUs. */
3564
+ vcpu: number;
3565
+ /** The window `percent` covers. */
3566
+ interval_ms: number | null;
3567
+ };
3568
+ memory: {
3569
+ /** `total_bytes` minus `available_bytes`. */
3570
+ used_bytes: number;
3571
+ /** What the guest kernel can still give programs (`MemAvailable`). */
3572
+ available_bytes: number;
3573
+ /** The memory the guest kernel manages (`MemTotal`), a little under the sandbox's `memory_mib`. */
3574
+ total_bytes: number;
3575
+ };
3576
+ /** The root filesystem, or null in a sandbox whose image does not report it. */
3577
+ disk: null | {
3578
+ used_bytes: number;
3579
+ total_bytes: number;
3580
+ };
3581
+ processes: {
3582
+ /** Background processes started with exec that still run (as `GET …/processes` lists them). */
3583
+ running: number;
3584
+ /**
3585
+ * Every user process in the sandbox, kernel threads left out; null in a sandbox whose image does not report it.
3586
+ */
3587
+ total: number | null;
3588
+ };
3589
+ }
1853
3590
  export type SandboxProcessList = Omit<ListEnvelope, "data"> & {
1854
3591
  data: SandboxProcess[];
1855
3592
  };
@@ -1908,6 +3645,33 @@ export interface FileEntry {
1908
3645
  /** Symlink target. */
1909
3646
  target?: string;
1910
3647
  }
3648
+ export interface FileDeleted {
3649
+ /** The path as the request gave it. */
3650
+ path: string;
3651
+ /** What was at the path. */
3652
+ type: "file" | "directory" | "symlink";
3653
+ deleted: true;
3654
+ }
3655
+ export interface MoveFileRequest {
3656
+ /** Absolute path of the file or directory to move. */
3657
+ from: string;
3658
+ /** Absolute path it moves to. */
3659
+ to: string;
3660
+ /**
3661
+ * Replace an existing file at `to` (or an empty directory, when `from` is a directory).
3662
+ * @default false
3663
+ */
3664
+ overwrite?: boolean;
3665
+ }
3666
+ export interface MakeDirectoryRequest {
3667
+ /** Absolute path of the directory. */
3668
+ path: string;
3669
+ /**
3670
+ * Octal mode of the directory (the umask does not apply). Parents it creates get `0755`.
3671
+ * @default "0755"
3672
+ */
3673
+ mode?: string;
3674
+ }
1911
3675
  export type FileEntryList = Omit<ListEnvelope, "data"> & {
1912
3676
  data: FileEntry[];
1913
3677
  };
@@ -1935,6 +3699,9 @@ export interface Snapshot {
1935
3699
  id: string;
1936
3700
  object: "snapshot";
1937
3701
  name?: string | null;
3702
+ /**
3703
+ * `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.
3704
+ */
1938
3705
  status: "creating" | "ready" | "failed";
1939
3706
  sandbox_id: string;
1940
3707
  template: TemplateRef;
@@ -1968,6 +3735,15 @@ export interface Template {
1968
3735
  memory_mib: number;
1969
3736
  disk_gib: number;
1970
3737
  };
3738
+ /**
3739
+ * The sizes this node keeps pre-warmed microVMs of: the template's default size first, then at most one
3740
+ * larger class. A create at one of them claims a parked microVM; any other size (within your plan) is
3741
+ * restored on demand, a pool miss.
3742
+ */
3743
+ size_classes: {
3744
+ vcpu: number;
3745
+ memory_mib: number;
3746
+ }[];
1971
3747
  created_at: string;
1972
3748
  }
1973
3749
  export type TemplateList = Omit<ListEnvelope, "data"> & {
@@ -1980,7 +3756,7 @@ export interface RoutineDefinition {
1980
3756
  /** Optional pointer to this schema for editors. */
1981
3757
  $schema?: string;
1982
3758
  /**
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.
3759
+ * 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
3760
  */
1985
3761
  name: string;
1986
3762
  /** What the routine does; an MCP server that lists routines as tools uses it as the tool description. */
@@ -2007,12 +3783,12 @@ export interface RoutineDefinition {
2007
3783
  triggers?: RoutineDefinitionTrigger[];
2008
3784
  defaults?: {
2009
3785
  /**
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.
3786
+ * 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
3787
  * @default "standard"
2012
3788
  */
2013
3789
  durability?: "ephemeral" | "standard" | "strict";
2014
3790
  /**
2015
- * Default timeout for uses and map steps that do not set timeout_ms. Wait and sleep steps are not affected.
3791
+ * 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
3792
  * @default 30000
2017
3793
  */
2018
3794
  timeout_ms?: number;
@@ -2035,6 +3811,11 @@ export interface RoutineDefinition {
2035
3811
  */
2036
3812
  on_limit?: "queue" | "skip" | "cancel_running";
2037
3813
  };
3814
+ /**
3815
+ * 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.
3816
+ * @default false
3817
+ */
3818
+ pause_sandboxes?: boolean;
2038
3819
  };
2039
3820
  steps: RoutineDefinitionStep[];
2040
3821
  }
@@ -2100,6 +3881,10 @@ export type RoutineDefinitionStep = {
2100
3881
  * 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
3882
  */
2102
3883
  connections?: Record<string, RoutineDefinitionConnectionRef>;
3884
+ /**
3885
+ * 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.
3886
+ */
3887
+ subject?: string;
2103
3888
  /**
2104
3889
  * 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
3890
  */
@@ -2111,14 +3896,35 @@ export type RoutineDefinitionStep = {
2111
3896
  steps: RoutineDefinitionStep[];
2112
3897
  };
2113
3898
  /**
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}.
3899
+ * 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
3900
  */
2116
3901
  wait?: {
2117
3902
  signal?: string;
2118
3903
  /** RFC 3339 timestamp, literal or produced by an expression. */
2119
3904
  until?: RoutineDefinitionTemplateString;
2120
- /** Signal waits only: maximum wait. */
3905
+ /** Signal, token and event waits only: maximum wait. */
2121
3906
  ms?: RoutineDefinitionDurationMs;
3907
+ /**
3908
+ * 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.
3909
+ */
3910
+ event?: string;
3911
+ /**
3912
+ * 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.
3913
+ */
3914
+ match?: Record<string, RoutineDefinitionTemplateValue>;
3915
+ /**
3916
+ * 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.
3917
+ */
3918
+ token?: boolean;
3919
+ /**
3920
+ * 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.
3921
+ */
3922
+ prompt?: {
3923
+ title?: RoutineDefinitionTemplateString;
3924
+ body?: RoutineDefinitionTemplateString;
3925
+ image?: RoutineDefinitionTemplateValue;
3926
+ link?: RoutineDefinitionTemplateString;
3927
+ };
2122
3928
  };
2123
3929
  /** Durable delay; outputs {}. */
2124
3930
  sleep_ms?: RoutineDefinitionDurationMs;
@@ -2126,7 +3932,9 @@ export type RoutineDefinitionStep = {
2126
3932
  needs?: RoutineDefinitionIdent[];
2127
3933
  if?: RoutineDefinitionCondition;
2128
3934
  retry?: RoutineDefinitionRetry;
2129
- /** uses steps: per attempt. map steps: the whole map. */
3935
+ /**
3936
+ * 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.
3937
+ */
2130
3938
  timeout_ms?: number;
2131
3939
  /**
2132
3940
  * When the step fails, its outcome is failure but its conclusion is success, so dependents run and the run can still succeed.
@@ -2210,18 +4018,32 @@ export type RoutineDefinitionTrigger = {
2210
4018
  catch_up_window_s?: number;
2211
4019
  overlap?: RoutineDefinitionOverlap;
2212
4020
  verify?: RoutineDefinitionWebhookVerify;
4021
+ challenge?: RoutineDefinitionWebhookChallenge;
2213
4022
  /**
2214
4023
  * 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
4024
  */
2216
4025
  dedupe?: RoutineDefinitionCelExpression;
2217
4026
  };
4027
+ /**
4028
+ * 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.
4029
+ */
4030
+ export interface RoutineDefinitionWebhookChallenge {
4031
+ /** The query parameter whose value is echoed (hub.challenge, challenge). */
4032
+ param: string;
4033
+ /** The query parameter that carries the verify token (hub.verify_token). */
4034
+ token_param?: string;
4035
+ /**
4036
+ * 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.
4037
+ */
4038
+ token_connection?: string;
4039
+ }
2218
4040
  /**
2219
4041
  * 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
4042
  */
2221
4043
  export type RoutineDefinitionWebhookVerify = {
2222
4044
  scheme: "b3os" | "github" | "stripe" | "slack" | "standard_webhooks" | "hmac_sha256";
2223
4045
  /**
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.
4046
+ * 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
4047
  */
2226
4048
  secret?: string;
2227
4049
  header?: string;
@@ -2282,6 +4104,10 @@ export interface Routine {
2282
4104
  created_at: string;
2283
4105
  updated_at: string;
2284
4106
  metadata: Metadata;
4107
+ /**
4108
+ * 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.
4109
+ */
4110
+ warnings?: Diagnostic[];
2285
4111
  }
2286
4112
  export type RoutineList = Omit<ListEnvelope, "data"> & {
2287
4113
  data: Routine[];
@@ -2335,6 +4161,42 @@ export interface RoutineImport {
2335
4161
  definition: RoutineDefinition;
2336
4162
  diagnostics: Diagnostic[];
2337
4163
  }
4164
+ export interface HookTestRequest {
4165
+ /** The JSON body to deliver; `trigger.body` of the run it starts. */
4166
+ body?: Record<string, unknown>;
4167
+ }
4168
+ /** One request to a known hook, as its delivery log keeps it. */
4169
+ export interface HookDeliveryEntry {
4170
+ object: "hook_delivery_entry";
4171
+ hook_id: string;
4172
+ received_at: string;
4173
+ method: "POST" | "GET";
4174
+ /** `edge_replay`: replayed from the edge's queue after the node was down; `test`: `POST …/test`. */
4175
+ source: "provider" | "edge_replay" | "test";
4176
+ /** The HTTP status the hook answered. */
4177
+ status: number;
4178
+ /**
4179
+ * `not_started`: accepted without a run (`if` was false, or the routine is paused); `rejected`: a 4xx; `unavailable`: a 5xx (the edge retries).
4180
+ */
4181
+ outcome: "started" | "deduplicated" | "not_started" | "handshake" | "rejected" | "unavailable";
4182
+ /** The error code of a 4xx or 5xx. */
4183
+ code: string | null;
4184
+ /** The `reason` of a `webhook_signature_invalid` (`signature` or `timestamp`). */
4185
+ reason: string | null;
4186
+ /** The error's detail (at most 500 characters). */
4187
+ detail: string | null;
4188
+ run_id: string | null;
4189
+ delivery_id: string | null;
4190
+ deduplicated: boolean;
4191
+ handshake: "slack_url_verification" | "slack_ssl_check" | "github_ping" | "get_challenge" | null;
4192
+ /** Body bytes (the body itself is not kept). */
4193
+ size: number;
4194
+ /** The allowlisted request headers it had (values up to 256 characters). */
4195
+ headers: Record<string, string>;
4196
+ }
4197
+ export type HookDeliveryEntryList = Omit<ListEnvelope, "data"> & {
4198
+ data: HookDeliveryEntry[];
4199
+ };
2338
4200
  export interface HookRotateRequest {
2339
4201
  /** @default 86400 */
2340
4202
  grace_s?: number;
@@ -2347,7 +4209,7 @@ export interface HookSecret {
2347
4209
  }
2348
4210
  /** How the run started (the `trigger` context of its expressions). */
2349
4211
  export interface RunTrigger {
2350
- type: "api" | "cron" | "interval" | "webhook" | "action" | "routine";
4212
+ type: "api" | "cron" | "interval" | "webhook" | "action" | "routine" | "replay";
2351
4213
  /** The trigger ID (cron, interval, webhook, action). */
2352
4214
  id?: string;
2353
4215
  /** Cron and interval occurrence, used to deduplicate fires. */
@@ -2359,9 +4221,11 @@ export interface RunTrigger {
2359
4221
  subscription_id?: string;
2360
4222
  /** The pack trigger event's ID (action triggers). */
2361
4223
  event_id?: string;
2362
- /** For sub-routine runs. */
4224
+ /** For sub-routine runs, the calling run; for replays, the source run. */
2363
4225
  parent_run_id?: string;
2364
4226
  parent_step_id?: string;
4227
+ /** For replays started with `from_step`, that step. */
4228
+ from_step?: string;
2365
4229
  }
2366
4230
  export interface StepRun {
2367
4231
  /** The step ID from the definition. */
@@ -2370,6 +4234,9 @@ export interface StepRun {
2370
4234
  /** Position in the map's list, for steps inside a map body. */
2371
4235
  item_index?: number;
2372
4236
  status: "pending" | "running" | "waiting" | "retrying" | "succeeded" | "failed" | "skipped" | "canceled";
4237
+ /**
4238
+ * 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).
4239
+ */
2373
4240
  attempt: number;
2374
4241
  started_at?: string;
2375
4242
  finished_at?: string;
@@ -2384,11 +4251,22 @@ export interface StepRun {
2384
4251
  failed?: number;
2385
4252
  running?: number;
2386
4253
  };
2387
- /** What a waiting step waits for. */
4254
+ /**
4255
+ * 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.
4256
+ */
2388
4257
  waiting_for?: {
2389
4258
  signal?: string;
2390
4259
  until?: string;
4260
+ /** The step has a wait link (`token: true`); the link itself is only in `run.wait_urls`. */
4261
+ token?: true;
4262
+ prompt?: WaitPrompt;
4263
+ /** An event wait's event name (`POST /v1/routines/events`). */
4264
+ event?: string;
4265
+ /** An event wait's evaluated match values, by dot path into the event's data. */
4266
+ match?: Record<string, unknown>;
2391
4267
  };
4268
+ /** A replay copied this step's outputs from its source run; the step did not run. Absent otherwise. */
4269
+ replayed?: true;
2392
4270
  }
2393
4271
  export type StepRunList = Omit<ListEnvelope, "data"> & {
2394
4272
  data: StepRun[];
@@ -2403,6 +4281,24 @@ export interface RunCreateRequest {
2403
4281
  webhook?: WebhookConfig;
2404
4282
  metadata?: Metadata;
2405
4283
  }
4284
+ export interface RunReplayRequest {
4285
+ /**
4286
+ * 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.
4287
+ */
4288
+ from_step?: string;
4289
+ /**
4290
+ * 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.
4291
+ */
4292
+ input?: Record<string, unknown>;
4293
+ /**
4294
+ * 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.
4295
+ */
4296
+ version?: string | number;
4297
+ /** Override the version's default durability for the new run. */
4298
+ durability?: "ephemeral" | "standard" | "strict";
4299
+ webhook?: WebhookConfig;
4300
+ metadata?: Metadata;
4301
+ }
2406
4302
  /** A routine run (`run_…`); `result` is the routine's `output`. */
2407
4303
  export type RoutineRun = Omit<Job, "id" | "object"> & {
2408
4304
  id: string;
@@ -2413,8 +4309,21 @@ export type RoutineRun = Omit<Job, "id" | "object"> & {
2413
4309
  durability: "ephemeral" | "standard" | "strict";
2414
4310
  trigger: RunTrigger;
2415
4311
  input: Record<string, unknown>;
2416
- /** Top-level steps in definition order. */
4312
+ /**
4313
+ * The run's outcome line: when the routine's `output` is an object with a non-empty `summary` string,
4314
+ * that string on one line, cut to 140 characters (an ellipsis marks the cut). Absent otherwise. Run
4315
+ * lists, the run's terminal event and its webhook carry it, so a list of runs says what each one did.
4316
+ */
4317
+ summary?: string;
4318
+ /** Top-level steps in definition order (empty when `steps_kept` is `false`). */
2417
4319
  steps: StepRun[];
4320
+ /**
4321
+ * `false` on an `ephemeral` run read after it ended: only its summary was kept (status, timing,
4322
+ * `input`, `result`, `error` and its IDs), so `steps` is empty, `…/steps` and a replay answer 410
4323
+ * `run_steps_not_kept`, and `…/events` sends its terminal event alone. The `?wait=` answer, the event
4324
+ * stream and the webhook carried its steps as it ended. Absent on every other run.
4325
+ */
4326
+ steps_kept?: false;
2418
4327
  };
2419
4328
  export type RoutineRunList = Omit<ListEnvelope, "data"> & {
2420
4329
  data: RoutineRun[];
@@ -2426,6 +4335,71 @@ export type RunEvent = JobEvent & {
2426
4335
  level?: "debug" | "info" | "warn" | "error";
2427
4336
  message?: string;
2428
4337
  };
4338
+ export interface RoutineEventRequest {
4339
+ /** The event name `wait.event` names. */
4340
+ name: string;
4341
+ /** What `wait.match` is checked against, and the step's `data` output. */
4342
+ data?: unknown;
4343
+ /** Your ID for the event, passed to the step's `id` output. */
4344
+ id?: string;
4345
+ }
4346
+ export interface RoutineEvent {
4347
+ object: "routine_event";
4348
+ name: string;
4349
+ id?: string | null;
4350
+ /** How many waiting steps the event resumed. */
4351
+ delivered: number;
4352
+ /** The runs and steps it resumed (the first 100). */
4353
+ runs: {
4354
+ run_id: string;
4355
+ step_id: string;
4356
+ }[];
4357
+ }
4358
+ /**
4359
+ * A wait's `prompt` as evaluated when the step started waiting. `dropped` names fields left out because they were not https URLs.
4360
+ */
4361
+ export interface WaitPrompt {
4362
+ title?: string;
4363
+ body?: string;
4364
+ image?: string;
4365
+ /**
4366
+ * 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.
4367
+ */
4368
+ image_artifact?: string;
4369
+ link?: string;
4370
+ dropped?: Array<"image" | "link">;
4371
+ }
4372
+ /** A wait link's step. */
4373
+ export interface RoutineWait {
4374
+ object: "routine_wait";
4375
+ /**
4376
+ * 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.
4377
+ */
4378
+ status: "waiting" | "pending" | "answered" | "timed_out" | "expired" | "ended";
4379
+ run_id: string;
4380
+ run_status: "queued" | "running" | "succeeded" | "failed" | "canceled";
4381
+ routine_id: string;
4382
+ routine_name?: string | null;
4383
+ step_id: string;
4384
+ step_name?: string | null;
4385
+ /**
4386
+ * 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).
4387
+ */
4388
+ prompt: WaitPrompt | null;
4389
+ waiting_since?: string | null;
4390
+ /**
4391
+ * 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.
4392
+ */
4393
+ expires_at?: string | null;
4394
+ /** Once answered. `decision` is null for a signal sent through the API without one. */
4395
+ answer: {
4396
+ decision?: "approve" | "reject" | null;
4397
+ approved?: boolean | null;
4398
+ comment?: string | null;
4399
+ via?: "link" | "signal";
4400
+ answered_at?: string | null;
4401
+ } | null;
4402
+ }
2429
4403
  export interface SignalRequest {
2430
4404
  /** The `wait.signal` name the run waits for (routine.schema.json). */
2431
4405
  name: string;
@@ -2490,6 +4464,10 @@ export interface B3Pack {
2490
4464
  legacyIds?: Record<string, string>;
2491
4465
  };
2492
4466
  signature?: B3PackSignature;
4467
+ /**
4468
+ * 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.
4469
+ */
4470
+ aliases?: B3PackSearchPhrases;
2493
4471
  }
2494
4472
  /**
2495
4473
  * Reverse-DNS publisher namespace with at least one dot, lowercase: io.b3os, com.example, io.github.acme.
@@ -2507,6 +4485,10 @@ export type B3PackSemver = string;
2507
4485
  export type B3PackKebabKey = string;
2508
4486
  /** Connection key, a CEL identifier so templates can write connections.<key>. */
2509
4487
  export type B3PackConnectionKey = string;
4488
+ /**
4489
+ * 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.
4490
+ */
4491
+ export type B3PackSearchPhrases = string[];
2510
4492
  export type B3PackFacetList = string[];
2511
4493
  /**
2512
4494
  * 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 +4502,7 @@ export interface B3PackEgressEntry {
2520
4502
  */
2521
4503
  ports?: number[];
2522
4504
  /**
2523
- * Allowed URL schemes. Default ["https"]; plain http must be listed explicitly.
4505
+ * 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
4506
  * @default ["https"]
2525
4507
  */
2526
4508
  schemes?: Array<"https" | "http">;
@@ -2542,7 +4524,7 @@ export type B3PackTemplateString = string;
2542
4524
  /** Any JSON value. Strings inside it (at any depth) are template strings; object keys are literal. */
2543
4525
  export type B3PackTemplateValue = unknown;
2544
4526
  /**
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).
4527
+ * 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
4528
  */
2547
4529
  export type B3PackConnection = {
2548
4530
  type: "api_key" | "basic" | "bearer" | "oauth2" | "none";
@@ -2550,7 +4532,7 @@ export type B3PackConnection = {
2550
4532
  description?: string;
2551
4533
  docsUrl?: string;
2552
4534
  /**
2553
- * Hosts that receive the injected credential. Each entry must also be covered by the pack egress list. * is not allowed.
4535
+ * 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
4536
  */
2555
4537
  hosts?: B3PackHostPattern[];
2556
4538
  /**
@@ -2714,6 +4696,8 @@ export type B3PackAction = {
2714
4696
  */
2715
4697
  expose?: boolean;
2716
4698
  };
4699
+ /** Task phrases for this action (read my latest emails). */
4700
+ aliases?: B3PackSearchPhrases;
2717
4701
  };
2718
4702
  /**
2719
4703
  * 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 +4706,7 @@ export type B3PackCron = string;
2722
4706
  /** IANA time zone name, e.g. America/Los_Angeles. Default UTC. */
2723
4707
  export type B3PackTimezone = string;
2724
4708
  /**
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.
4709
+ * 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
4710
  */
2727
4711
  export type B3PackVerify = {
2728
4712
  scheme: "github" | "stripe" | "slack" | "standard_webhooks" | "hmac_sha256";
@@ -2853,6 +4837,8 @@ export type B3PackTrigger = {
2853
4837
  action?: B3PackKebabKey;
2854
4838
  with?: B3PackTemplateValue;
2855
4839
  };
4840
+ /** Task phrases for this trigger (when an issue is opened). */
4841
+ aliases?: B3PackSearchPhrases;
2856
4842
  };
2857
4843
  /**
2858
4844
  * 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 +4919,49 @@ export interface ActionSummary {
2933
4919
  mcp_name: string;
2934
4920
  /** Search relevance from 0 to 1 (search results only). */
2935
4921
  score?: number;
4922
+ /** Set in search results when the search asked for `kind=any`. */
4923
+ kind?: "action";
4924
+ }
4925
+ /** A trigger in search results (`kind=trigger` or `kind=any`). */
4926
+ export interface TriggerSearchHit {
4927
+ kind: "trigger";
4928
+ /** Exact reference with the resolved version, for a routine's `type: action` trigger. */
4929
+ ref: string;
4930
+ pack: string;
4931
+ key: string;
4932
+ title: string;
4933
+ description: string;
4934
+ trigger_kind: "webhook" | "poll" | "schedule";
4935
+ /** The connection keys a subscription binds, as in `TriggerSummary`. */
4936
+ connections: string[];
4937
+ /** Search relevance from 0 to 1. */
4938
+ score: number;
2936
4939
  }
2937
4940
  export type ActionSearchResult = Omit<ListEnvelope, "data"> & {
2938
- data: ActionSummary[];
4941
+ data: Array<ActionSummary | TriggerSearchHit>;
4942
+ /**
4943
+ * `found` when `data` has results; `none` when nothing in the catalog (or under the `pack` and `effects` filters) does what the query asks.
4944
+ */
4945
+ match: "found" | "none";
4946
+ /**
4947
+ * 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.
4948
+ */
4949
+ unmatched?: string[];
4950
+ fallback?: ActionSearchFallback;
2939
4951
  };
4952
+ /** With `match: none`, what to do instead of using an unrelated action. */
4953
+ export interface ActionSearchFallback {
4954
+ /** The answer in a sentence an agent can act on. */
4955
+ detail: string;
4956
+ /**
4957
+ * The generic HTTP actions, for a public API or a URL that carries its own authorization (they attach no credential).
4958
+ */
4959
+ refs: string[];
4960
+ /** The routine step that calls any HTTP API. */
4961
+ routine_step: string;
4962
+ /** The HTTP pack's page. */
4963
+ docs_url: string;
4964
+ }
2940
4965
  export interface ConnectionRequirement {
2941
4966
  /** The connection key in the pack. */
2942
4967
  key: string;
@@ -2945,6 +4970,18 @@ export interface ConnectionRequirement {
2945
4970
  /** Whether this action needs it. */
2946
4971
  required?: boolean;
2947
4972
  }
4973
+ /**
4974
+ * One example call from the pack's fixtures: an input and the output the pack maps from the service's
4975
+ * response. `fixture` marks a fixture shipped in the signed bundle (a documented response shape or a recorded
4976
+ * one; its `title` says which), never a call this node made.
4977
+ */
4978
+ export interface ActionExample {
4979
+ title: string;
4980
+ input: Record<string, unknown>;
4981
+ /** What `actions.call` returns as `output` for this input. */
4982
+ output: unknown;
4983
+ label: "fixture" | "live-recorded";
4984
+ }
2948
4985
  export interface ActionDescription {
2949
4986
  object: "action";
2950
4987
  ref: string;
@@ -2972,15 +5009,24 @@ export interface ActionDescription {
2972
5009
  inputSchema: JsonSchemaDocument;
2973
5010
  outputSchema?: JsonSchemaDocument;
2974
5011
  };
5012
+ /**
5013
+ * Example calls from the bundle's fixtures that succeed (error fixtures are left out), at most 5, read once
5014
+ * when the node loads the pack. Their inputs also appear as `examples` in `mcp.inputSchema`.
5015
+ */
5016
+ examples: ActionExample[];
2975
5017
  }
2976
5018
  export interface ActionCallRequest {
2977
5019
  ref: ActionRef;
2978
5020
  /** Validated against the action's input schema. */
2979
5021
  input?: Record<string, unknown>;
2980
5022
  /**
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).
5023
+ * 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
5024
  */
2983
5025
  connections?: Record<string, string>;
5026
+ /**
5027
+ * 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`.
5028
+ */
5029
+ subject?: string;
2984
5030
  /** Overall time limit; defaults to the action's own. */
2985
5031
  timeout_ms?: number;
2986
5032
  }
@@ -3003,6 +5049,12 @@ export interface TriggerSummary {
3003
5049
  kind: "webhook" | "poll" | "schedule";
3004
5050
  config_schema: JsonSchemaDocument;
3005
5051
  event_schema: JsonSchemaDocument;
5052
+ /**
5053
+ * The connection keys a subscription binds (`connections` on a routine's action trigger): the pack
5054
+ * connections the trigger needs, plus `webhook_secret` when the provider's signing secret comes from you.
5055
+ * `webhook_secret` names an `api_key` connection that holds that secret (Stripe's endpoint signing secret,
5056
+ * Slack's signing secret); it is used only to verify deliveries and is never sent anywhere.
5057
+ */
3006
5058
  connections: string[];
3007
5059
  }
3008
5060
  export type TriggerList = Omit<ListEnvelope, "data"> & {
@@ -3014,6 +5066,10 @@ export interface PackPublisher {
3014
5066
  /** Set by the registry, never by the manifest. */
3015
5067
  verified: boolean;
3016
5068
  }
5069
+ /**
5070
+ * Nodes from this release on always send `facets`, `connection_types`, `keyless` and `icons`. Nodes deployed
5071
+ * before it do not, so clients should not require them.
5072
+ */
3017
5073
  export interface PackSummaryFields {
3018
5074
  /** `<namespace>/<name>`. */
3019
5075
  id: string;
@@ -3024,9 +5080,54 @@ export interface PackSummaryFields {
3024
5080
  latest_version: string;
3025
5081
  action_count: number;
3026
5082
  trigger_count: number;
5083
+ /** The manifest's browse facets (`domain`, `assetClass`, `chains`); empty when it has none. */
5084
+ facets?: {
5085
+ domain?: string[];
5086
+ assetClass?: string[];
5087
+ chains?: string[];
5088
+ };
5089
+ /** The types of the pack's connections, sorted, each once; empty for a pack with none. */
5090
+ connection_types?: Array<"api_key" | "basic" | "bearer" | "oauth2" | "none">;
5091
+ /** True when the pack needs no stored credential (no connections, or only `none` connections). */
5092
+ keyless?: boolean;
5093
+ /**
5094
+ * The manifest's icons that are 4 KiB or smaller, as `data:` URIs read from the signed bundle; larger icons
5095
+ * are left out.
5096
+ */
5097
+ icons?: {
5098
+ src: string;
5099
+ mimeType: "image/svg+xml" | "image/png" | "image/webp";
5100
+ sizes?: string[];
5101
+ }[];
3027
5102
  }
3028
5103
  /** A pack in a list. */
3029
5104
  export type PackSummary = PackSummaryFields;
5105
+ /** A pack version's MCP tools (`GET /v1/actions/packs/{namespace}/{name}/tools`). */
5106
+ export interface PackTools {
5107
+ object: "pack_tools";
5108
+ pack: string;
5109
+ version: string;
5110
+ content_hash: string;
5111
+ /** How long to cache this list, in milliseconds. */
5112
+ ttlMs: number;
5113
+ tools: {
5114
+ /** The MCP tool name (`mcp_name`). */
5115
+ name: string;
5116
+ title: string;
5117
+ description: string;
5118
+ inputSchema: JsonSchemaDocument;
5119
+ outputSchema?: JsonSchemaDocument;
5120
+ annotations: {
5121
+ title?: string;
5122
+ readOnlyHint?: boolean;
5123
+ destructiveHint?: boolean;
5124
+ idempotentHint?: boolean;
5125
+ openWorldHint?: boolean;
5126
+ };
5127
+ ref: string;
5128
+ effects: EffectClass;
5129
+ }[];
5130
+ }
3030
5131
  export type PackList = Omit<ListEnvelope, "data"> & {
3031
5132
  data: PackSummary[];
3032
5133
  };
@@ -3035,10 +5136,32 @@ export type Pack = PackSummaryFields & {
3035
5136
  version: string;
3036
5137
  /** Every published version, newest first. */
3037
5138
  versions: string[];
5139
+ /**
5140
+ * The pack's connections, with what creating one needs. Nodes from this release on send `optional`;
5141
+ * `description`, `docs_url`, `params_schema` and `defaults` when the manifest has them. Nodes deployed
5142
+ * before it send only `key`, `type` and `label`.
5143
+ */
3038
5144
  connections: {
3039
5145
  key: string;
3040
5146
  type: "api_key" | "basic" | "bearer" | "oauth2" | "none";
3041
5147
  label: string;
5148
+ /** What the connection is for and where to get the credential. */
5149
+ description?: string;
5150
+ /** The provider's page about the credential. */
5151
+ docs_url?: string;
5152
+ /**
5153
+ * JSON Schema of the connection's non-secret parameters (`params` on `POST
5154
+ * /v1/vault/connections`), such as a Jira site name or SEC EDGAR's User-Agent. Absent when the
5155
+ * connection has none.
5156
+ */
5157
+ params_schema?: JsonSchemaDocument;
5158
+ /**
5159
+ * True when a call that names no connection for this key and finds none stored still runs, with
5160
+ * `defaults` as its params (a `none` connection whose parameters all have defaults).
5161
+ */
5162
+ optional?: boolean;
5163
+ /** With `optional`, the params a call sends when no connection is stored. */
5164
+ defaults?: Record<string, unknown>;
3042
5165
  }[];
3043
5166
  /** Hosts the pack may reach. */
3044
5167
  egress: string[];
@@ -3147,10 +5270,10 @@ export interface ToolCall {
3147
5270
  }
3148
5271
  /**
3149
5272
  * 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.
5273
+ * messages may leave `content` out or set it to `null` (`400 invalid_request` with the pointer otherwise).
5274
+ * Members not listed here (such as `annotations` or `audio` echoed from an earlier response) are ignored.
3152
5275
  */
3153
- export interface ChatMessage {
5276
+ export type ChatMessage = ({
3154
5277
  role: "system" | "developer" | "user" | "assistant" | "tool";
3155
5278
  content?: string | null | ContentPart[];
3156
5279
  name?: string | null;
@@ -3160,7 +5283,12 @@ export interface ChatMessage {
3160
5283
  refusal?: string | null;
3161
5284
  /** B3OS extension. The reasoning of an earlier assistant turn, passed back to the model's template. */
3162
5285
  reasoning_content?: string | null;
3163
- }
5286
+ } & {
5287
+ role?: "assistant";
5288
+ }) | {
5289
+ role?: "system" | "developer" | "user" | "tool";
5290
+ content: string | ContentPart[];
5291
+ };
3164
5292
  export interface FunctionTool {
3165
5293
  type: "function";
3166
5294
  function: {
@@ -3169,6 +5297,10 @@ export interface FunctionTool {
3169
5297
  /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep), as OpenAI requires. */
3170
5298
  parameters?: Record<string, unknown>;
3171
5299
  strict?: boolean;
5300
+ /**
5301
+ * Accepted and ignored, with any value; never sent to the model. Evaluation harnesses such as BFCL leave a function's response schema here.
5302
+ */
5303
+ response?: unknown;
3172
5304
  };
3173
5305
  }
3174
5306
  export interface ResponseFormatText {
@@ -3209,6 +5341,9 @@ export interface ChatCompletionRequest {
3209
5341
  * 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
5342
  */
3211
5343
  top_p?: number | null;
5344
+ /**
5345
+ * 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.
5346
+ */
3212
5347
  max_tokens?: number | null;
3213
5348
  /** Wins over `max_tokens` when both are set. */
3214
5349
  max_completion_tokens?: number | null;
@@ -3228,7 +5363,9 @@ export interface ChatCompletionRequest {
3228
5363
  } | null;
3229
5364
  /**
3230
5365
  * 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`.
5366
+ * (models it serves stay local); without it an unknown model is `404 model_not_available`. The production
5367
+ * node (beta-api.b3os.org) has no gateway route configured yet (no B3IQ gateway key or model list), so
5368
+ * there `gateway` answers `404 model_not_available` as well.
3232
5369
  * @default "local"
3233
5370
  */
3234
5371
  route?: "local" | "gateway" | null;
@@ -3240,9 +5377,24 @@ export interface ChatCompletionRequest {
3240
5377
  repetition_penalty?: number | null;
3241
5378
  /** Token ID to bias added to its logit. */
3242
5379
  logit_bias?: Record<string, number> | null;
5380
+ /**
5381
+ * How much the model may reason before it answers. `none` and `minimal`: no reasoning phase (the
5382
+ * default). `low`, `medium`, `high`, `xhigh`: a reasoning phase of at most 256, 1,024, 4,096 and 8,192
5383
+ * tokens; at the budget the node closes the reasoning and the answer starts in the same request, so
5384
+ * `usage.completion_tokens_details.reasoning_tokens` stays within it. Without `max_tokens` the default
5385
+ * output cap grows by the budget, so the answer keeps the cap's room; with a `max_tokens` below the
5386
+ * budget the reasoning can use all of it, and the answer is empty with `finish_reason: "length"`. The
5387
+ * same levels and budgets apply to Responses' `reasoning.effort` and Messages' adaptive `thinking`
5388
+ * (`output_config.effort`). With `chat_template_kwargs.enable_thinking` set the other way, the request
5389
+ * is `400 invalid_request`. A `gateway` model takes it as its provider does.
5390
+ */
5391
+ reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
3243
5392
  /** Runtime extension. Only `enable_thinking` is taken. */
3244
5393
  chat_template_kwargs?: {
3245
- /** Let the model reason before answering; the reasoning arrives in `reasoning_content`. */
5394
+ /**
5395
+ * Let the model reason before answering; the reasoning arrives in `reasoning_content`. There is no
5396
+ * ceiling on the reasoning this way; `reasoning_effort` sets one.
5397
+ */
3246
5398
  enable_thinking?: boolean;
3247
5399
  } | null;
3248
5400
  /** Accepted and ignored. */
@@ -3251,11 +5403,34 @@ export interface ChatCompletionRequest {
3251
5403
  store?: boolean | null;
3252
5404
  /** Accepted and ignored. */
3253
5405
  service_tier?: string | null;
5406
+ /**
5407
+ * Accepted and ignored. The node caches prompt prefixes per organization on its own; this key never changes which requests share a cache.
5408
+ */
5409
+ prompt_cache_key?: string | null;
5410
+ /** Accepted and ignored (the runtime keeps cached prefixes while it has room). */
5411
+ prompt_cache_retention?: string | null;
5412
+ /** Accepted and ignored. */
5413
+ safety_identifier?: string | null;
5414
+ /** Accepted and ignored; set `max_tokens` to bound the answer. */
5415
+ verbosity?: string | null;
3254
5416
  }
3255
5417
  export interface Usage {
3256
5418
  prompt_tokens: number;
3257
5419
  completion_tokens: number;
3258
5420
  total_tokens: number;
5421
+ /**
5422
+ * `cached_tokens`: the prompt tokens the runtime's prefix cache served, from this organization's earlier
5423
+ * requests (whole 1,056-token blocks on b3os/qwen3.5-9b); they are part of `prompt_tokens` and metered
5424
+ * like the rest. `multimodal_tokens` counts image tokens per modality when the prompt has images.
5425
+ */
5426
+ prompt_tokens_details?: {
5427
+ cached_tokens?: number;
5428
+ [key: string]: unknown;
5429
+ };
5430
+ completion_tokens_details?: {
5431
+ reasoning_tokens?: number;
5432
+ [key: string]: unknown;
5433
+ };
3259
5434
  [key: string]: unknown;
3260
5435
  }
3261
5436
  /**
@@ -3326,15 +5501,28 @@ export interface ChatCompletionChunk {
3326
5501
  }
3327
5502
  /** B3OS extension with what the model supports and your limits on it. */
3328
5503
  export interface ModelInfo {
5504
+ /**
5505
+ * 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.
5506
+ */
5507
+ alias_of?: string;
3329
5508
  kind: "chat" | "embedding" | "speech";
3330
5509
  context_length: number | null;
5510
+ /**
5511
+ * The output cap of a chat request that sets no `max_tokens` (or `max_completion_tokens`, or Responses'
5512
+ * `max_output_tokens`): the generation stops there with `finish_reason: "length"`. Set `max_tokens` to go
5513
+ * higher. A node setting: `null` where the node has no cap (such a request then runs to the end of the
5514
+ * context) and for speech and embedding models.
5515
+ */
5516
+ default_max_tokens?: number | null;
3331
5517
  quantization: string | null;
3332
5518
  tools: boolean;
3333
5519
  json_schema: boolean;
3334
5520
  image_input: boolean;
3335
5521
  max_request_bytes: number;
3336
5522
  limits: {
3337
- /** Tokens per minute for your organization. */
5523
+ /**
5524
+ * Tokens per minute for your organization (its own value from the node's budget snapshot, else the node's default).
5525
+ */
3338
5526
  tpm: number | null;
3339
5527
  rpm: number | null;
3340
5528
  };
@@ -3377,7 +5565,9 @@ export interface SpeechRequest {
3377
5565
  /** A speech model, such as `kokoro-82m`. */
3378
5566
  model: string;
3379
5567
  input: string;
3380
- /** A voice ID from `GET /v1/infer/audio/voices`. */
5568
+ /**
5569
+ * 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.
5570
+ */
3381
5571
  voice: string;
3382
5572
  /** @default "mp3" */
3383
5573
  response_format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm" | null;
@@ -3395,10 +5585,45 @@ export interface SpeechRequest {
3395
5585
  * @default "none"
3396
5586
  */
3397
5587
  timestamps?: "none" | "word" | null;
5588
+ /**
5589
+ * 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`.
5590
+ */
5591
+ language?: string | null;
5592
+ /**
5593
+ * 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.
5594
+ */
5595
+ stream_format?: "audio" | "sse" | null;
5596
+ }
5597
+ /**
5598
+ * One event of a speech stream (`stream_format: "sse"`), named by its `type` (the SSE `event:` field carries
5599
+ * the same name): `speech.audio.delta` with a piece of the audio (`audio`, base64, in `response_format`; the
5600
+ * pieces joined are the whole clip), then `speech.audio.done` with the clip's `format`, `sample_rate`,
5601
+ * `duration_ms`, `words` when `timestamps` is `word`, and `b3os` (route, node, and timing in milliseconds:
5602
+ * the voice service's `voice_queue_ms` and `voice_run_ms`, and `total_ms`). A failure after audio is an
5603
+ * `error` event (`error`, OpenAI's error object) and ends the stream. There is no `usage`: speech bills
5604
+ * characters (`infer.audio_chars`), not tokens.
5605
+ */
5606
+ export interface SpeechStreamEvent {
5607
+ type: "speech.audio.delta" | "speech.audio.done" | "error";
5608
+ audio?: string;
5609
+ model?: string;
5610
+ voice?: string;
5611
+ format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
5612
+ sample_rate?: number;
5613
+ duration_ms?: number;
5614
+ /** As in `SpeechWithTimestamps`, from the start of the clip. */
5615
+ words?: {
5616
+ text: string;
5617
+ start_ms: number;
5618
+ end_ms: number;
5619
+ }[];
5620
+ b3os?: Record<string, unknown>;
5621
+ error?: Record<string, unknown>;
3398
5622
  }
3399
5623
  export interface SpeechWithTimestamps {
3400
5624
  object: "speech";
3401
5625
  model: string;
5626
+ /** The voice that spoke, after an OpenAI voice name resolved (as `x-b3os-voice`). */
3402
5627
  voice: string;
3403
5628
  format: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
3404
5629
  sample_rate: number;
@@ -3415,8 +5640,24 @@ export interface Voice {
3415
5640
  object: "voice";
3416
5641
  model: string;
3417
5642
  name: string;
3418
- /** BCP 47 tag. */
5643
+ /** BCP 47 tag, the language the voice reads in unless a request sets `language`. */
3419
5644
  language: string;
5645
+ /** The voice's gender as the model's authors label it; `null` when the voice service does not say. */
5646
+ gender?: "female" | "male" | null;
5647
+ /**
5648
+ * 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.
5649
+ */
5650
+ word_timings?: "model" | "aligner" | null;
5651
+ /**
5652
+ * 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.
5653
+ */
5654
+ tier?: "featured" | "standard" | "limited" | null;
5655
+ /**
5656
+ * 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.
5657
+ */
5658
+ use_case?: "narration" | "conversation" | "character" | null;
5659
+ /** True for one voice per language, the one to start with in that language. */
5660
+ default?: boolean;
3420
5661
  /**
3421
5662
  * A short audio sample of the voice, a B3OS static asset: `https://beta.b3os.org/assets/voices/<voice>.<ext>`
3422
5663
  * (B3OS's own media are never served from `usercontent.b3os.org`, which holds customer bytes only).
@@ -3426,223 +5667,24 @@ export interface Voice {
3426
5667
  export type VoiceList = Omit<ListEnvelope, "data"> & {
3427
5668
  data: Voice[];
3428
5669
  };
3429
- /** Accepted and ignored. */
3430
- export type AnthropicCacheControl = {
3431
- type?: string;
3432
- ttl?: string;
3433
- } | null;
3434
- export interface AnthropicTextBlock {
3435
- type: "text";
5670
+ export interface ResponsesInputText {
5671
+ type: "input_text";
3436
5672
  text: string;
3437
- cache_control?: AnthropicCacheControl;
3438
- /** Accepted and ignored. */
3439
- citations?: Record<string, unknown>[] | null;
5673
+ prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
3440
5674
  }
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
- export interface ResponsesInputText {
3629
- type: "input_text";
3630
- text: string;
3631
- prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
3632
- }
3633
- /** Accepted and ignored; the runtime caches prompt prefixes on its own. */
3634
- export type ResponsesCacheBreakpoint = {
3635
- mode?: "explicit" | null;
3636
- } | null;
3637
- export interface ResponsesInputImage {
3638
- type: "input_image";
3639
- /** `https://` (fetched by the node through its egress guard) or a base64 `data:` URL. */
3640
- image_url: string;
3641
- /** Accepted and ignored; images are resized to about 1 MP. */
3642
- detail?: "auto" | "low" | "high" | "original" | null;
3643
- /** The Files API is not available on this node (null only). */
3644
- file_id?: null;
3645
- prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
5675
+ /** Accepted and ignored; the runtime caches prompt prefixes on its own. */
5676
+ export type ResponsesCacheBreakpoint = {
5677
+ mode?: "explicit" | null;
5678
+ } | null;
5679
+ export interface ResponsesInputImage {
5680
+ type: "input_image";
5681
+ /** `https://` (fetched by the node through its egress guard) or a base64 `data:` URL. */
5682
+ image_url: string;
5683
+ /** Accepted and ignored; images are resized to about 1 MP. */
5684
+ detail?: "auto" | "low" | "high" | "original" | null;
5685
+ /** The Files API is not available on this node (null only). */
5686
+ file_id?: null;
5687
+ prompt_cache_breakpoint?: ResponsesCacheBreakpoint;
3646
5688
  }
3647
5689
  export interface ResponsesOutputText {
3648
5690
  type: "output_text";
@@ -3714,6 +5756,7 @@ export interface ResponsesFunctionTool {
3714
5756
  description?: string | null;
3715
5757
  /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep); absent means no arguments. */
3716
5758
  parameters?: Record<string, unknown> | null;
5759
+ /** Passed to the runtime when set; the response echoes the value sent, or `null` when unset. */
3717
5760
  strict?: boolean | null;
3718
5761
  allowed_callers?: "direct"[] | null;
3719
5762
  defer_loading?: false | null;
@@ -3754,7 +5797,11 @@ export interface ResponsesRequest {
3754
5797
  verbosity?: "low" | "medium" | "high" | null;
3755
5798
  } | null;
3756
5799
  reasoning?: {
3757
- /** `low` and above turn the reasoning phase on; unset, `none` and `minimal` leave it off. */
5800
+ /**
5801
+ * `low` and above turn the reasoning phase on with chat's `reasoning_effort` budgets (256, 1,024,
5802
+ * 4,096 and 8,192 reasoning tokens for `low`, `medium`, `high`, `xhigh`; the node closes the
5803
+ * reasoning at the budget and the answer follows); unset, `none` and `minimal` leave it off.
5804
+ */
3758
5805
  effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
3759
5806
  /** Accepted and ignored. */
3760
5807
  summary?: "auto" | "concise" | "detailed" | null;
@@ -3773,6 +5820,7 @@ export interface ResponsesRequest {
3773
5820
  user?: string | null;
3774
5821
  safety_identifier?: string | null;
3775
5822
  prompt_cache_key?: string | null;
5823
+ prompt_cache_retention?: string | null;
3776
5824
  service_tier?: string | null;
3777
5825
  /** `auto` is refused: the node never drops input items. */
3778
5826
  truncation?: "disabled" | null;
@@ -3895,7 +5943,13 @@ export interface WebhookSecret {
3895
5943
  object: "webhook_secret";
3896
5944
  /** The normalized endpoint URL. */
3897
5945
  url: string;
3898
- secret: string;
5946
+ /**
5947
+ * The signing secret. Present only in the response that hands it out (the first `POST
5948
+ * /v1/webhooks/secret` for the URL, or a rotation); `null` otherwise.
5949
+ */
5950
+ secret: string | null;
5951
+ /** The secret's last four characters, so you can tell which secret you stored. */
5952
+ secret_hint: string;
3899
5953
  /** Until when the previous secret still signs deliveries, after a rotation. */
3900
5954
  previous_valid_until: string | null;
3901
5955
  created_at: string;
@@ -3989,6 +6043,12 @@ export interface CurrentPrincipal {
3989
6043
  project_id: string;
3990
6044
  scopes: Scope[];
3991
6045
  spend_cap_usd: number | null;
6046
+ /**
6047
+ * What the key has spent this billing period (the UTC calendar month, from `spend_period_start`): its usage at the configured unit prices, the number a metered call's `402 spend_cap_exceeded` check compares with `spend_cap_usd`. Up to 10 seconds old. The free beta prices no usage yet, so it reads 0. Null for a dashboard session or a sandbox, which have no key of their own.
6048
+ */
6049
+ spend_usd?: number | null;
6050
+ /** Start of the billing period `spend_usd` covers. */
6051
+ spend_period_start?: string;
3992
6052
  expires_at: string | null;
3993
6053
  }
3994
6054
  export interface UsageSummary {
@@ -4132,6 +6192,14 @@ export interface RegistryPackVersion {
4132
6192
  * `sandbox` (from inside a sandbox, over vsock).
4133
6193
  */
4134
6194
  export type RequestConnection = "edge" | "uds" | "tcp" | "sandbox";
6195
+ /**
6196
+ * Who made the request: `api_key` (an API key), `cli_token` (the CLI's device-login token), `dashboard` (a
6197
+ * signed-in dashboard session; its successful reads are not logged, its changes and errors are), `sandbox` (code
6198
+ * inside a sandbox, as its creating key), `routine` (a routine run, as the key that published its version),
6199
+ * `local` (a host-local caller on the node's Unix socket) or `public` (no credential: a webhook or signed
6200
+ * callback to a public route, or a request refused before authentication).
6201
+ */
6202
+ export type RequestSource = "api_key" | "cli_token" | "dashboard" | "sandbox" | "routine" | "local" | "public";
4135
6203
  export interface RequestPhase {
4136
6204
  name: string;
4137
6205
  source: "edge" | "node";
@@ -4147,6 +6215,12 @@ export interface RequestRecord {
4147
6215
  product: string | null;
4148
6216
  status_code: number;
4149
6217
  error_code: string | null;
6218
+ /**
6219
+ * Why a 4xx or 5xx answer failed, in the server's own words: the first 200 characters of its problem's
6220
+ * `detail` (or a compatibility surface's message). `null` for a success, or when the server recorded none;
6221
+ * absent from records written before it was recorded.
6222
+ */
6223
+ error_detail?: string | null;
4150
6224
  org_id: string;
4151
6225
  project_id: string;
4152
6226
  /** The API key behind the request (for sandbox calls, the key that created the sandbox). */
@@ -4169,10 +6243,239 @@ export interface RequestRecord {
4169
6243
  /** The W3C trace ID from `traceparent`, when sent. */
4170
6244
  trace_id: string | null;
4171
6245
  user_agent: string | null;
6246
+ source: RequestSource;
4172
6247
  }
4173
6248
  export type RequestRecordList = Omit<ListEnvelope, "data"> & {
4174
6249
  data: RequestRecord[];
4175
6250
  };
6251
+ /** Accepted and ignored. */
6252
+ export type AnthropicCacheControl = {
6253
+ type?: string;
6254
+ ttl?: string;
6255
+ } | null;
6256
+ /**
6257
+ * Anthropic's context-editing beta (Claude Code and the Claude Agent SDK send it). Accepted and ignored: the
6258
+ * node clears nothing, so the model sees every turn you send and a conversation past the context window gets
6259
+ * `400 context_length_exceeded`. Only the shape is checked: an object whose `edits`, if present, are objects
6260
+ * with a string `type`.
6261
+ */
6262
+ export type AnthropicContextManagement = {
6263
+ edits?: {
6264
+ type: string;
6265
+ }[] | null;
6266
+ } | null;
6267
+ export interface AnthropicTextBlock {
6268
+ type: "text";
6269
+ text: string;
6270
+ cache_control?: AnthropicCacheControl;
6271
+ /** Accepted and ignored. */
6272
+ citations?: Record<string, unknown>[] | null;
6273
+ }
6274
+ export interface AnthropicImageBlock {
6275
+ type: "image";
6276
+ source: {
6277
+ type: "base64";
6278
+ media_type: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
6279
+ /** The image file, which must be a PNG, JPEG, WebP or GIF. */
6280
+ data: string;
6281
+ } | {
6282
+ type: "url";
6283
+ /** Fetched by the node through its egress guard (PNG, JPEG, WebP or GIF, at most 10 MiB). */
6284
+ url: string;
6285
+ };
6286
+ cache_control?: AnthropicCacheControl;
6287
+ }
6288
+ export interface AnthropicToolUseBlock {
6289
+ type: "tool_use";
6290
+ id: string;
6291
+ name: string;
6292
+ input: Record<string, unknown>;
6293
+ cache_control?: AnthropicCacheControl;
6294
+ }
6295
+ export interface AnthropicToolResultBlock {
6296
+ type: "tool_result";
6297
+ tool_use_id: string;
6298
+ content?: null | string | Array<AnthropicTextBlock | AnthropicImageBlock>;
6299
+ /** The result is an error; the model sees it prefixed with `Error:`. */
6300
+ is_error?: boolean | null;
6301
+ cache_control?: AnthropicCacheControl;
6302
+ }
6303
+ export interface AnthropicThinkingBlock {
6304
+ type: "thinking";
6305
+ thinking: string;
6306
+ /** Opaque; this node does not check it. */
6307
+ signature?: string | null;
6308
+ }
6309
+ /** Accepted in assistant turns and left out of the prompt. */
6310
+ export interface AnthropicRedactedThinkingBlock {
6311
+ type: "redacted_thinking";
6312
+ data: string;
6313
+ }
6314
+ export interface AnthropicUserMessage {
6315
+ role: "user";
6316
+ content: string | Array<AnthropicTextBlock | AnthropicImageBlock | AnthropicToolResultBlock>;
6317
+ }
6318
+ /** An earlier answer; as the last message, the start of the answer, which the model continues. */
6319
+ export interface AnthropicAssistantMessage {
6320
+ role: "assistant";
6321
+ content: string | Array<AnthropicTextBlock | AnthropicToolUseBlock | AnthropicThinkingBlock | AnthropicRedactedThinkingBlock>;
6322
+ }
6323
+ export type AnthropicInputMessage = AnthropicUserMessage | AnthropicAssistantMessage;
6324
+ /**
6325
+ * A custom tool. Tools Anthropic defines or runs (a `type` other than `custom`) are `unsupported_parameter`.
6326
+ */
6327
+ export interface AnthropicTool {
6328
+ type?: "custom" | null;
6329
+ /** Unique within `tools`. */
6330
+ name: string;
6331
+ description?: string | null;
6332
+ /** A JSON Schema object (at most 64 KiB serialized and 32 levels deep). */
6333
+ input_schema: Record<string, unknown>;
6334
+ strict?: boolean | null;
6335
+ cache_control?: AnthropicCacheControl;
6336
+ }
6337
+ export type AnthropicToolChoice = (Record<string, unknown> & {
6338
+ /** `any` makes the model call a tool (it needs `tools`). */
6339
+ type: "auto" | "any";
6340
+ disable_parallel_tool_use?: boolean | null;
6341
+ }) | {
6342
+ type: "tool";
6343
+ /** One of `tools`. */
6344
+ name: string;
6345
+ disable_parallel_tool_use?: boolean | null;
6346
+ } | {
6347
+ type: "none";
6348
+ };
6349
+ /**
6350
+ * `enabled` (with `budget_tokens`, at least 1024 and less than `max_tokens`) and `adaptive` let the model
6351
+ * reason first, in `thinking` blocks; `disabled`, the default, does not. The node closes the reasoning at
6352
+ * the budget and the answer follows in the same request: `budget_tokens`, or for `adaptive` the budget of
6353
+ * `output_config.effort` (`low` 256, `medium` 1,024, `high` 4,096, `xhigh` and `max` 8,192; `high` when
6354
+ * unset). `display` is accepted and ignored.
6355
+ */
6356
+ export type AnthropicThinking = (Record<string, unknown> & {
6357
+ type: "enabled";
6358
+ budget_tokens: number;
6359
+ display?: "summarized" | "omitted" | "updates" | null;
6360
+ }) | {
6361
+ type: "adaptive";
6362
+ display?: "summarized" | "omitted" | "updates" | null;
6363
+ } | {
6364
+ type: "disabled";
6365
+ };
6366
+ /**
6367
+ * Anthropic Messages parameters. Any other parameter is `400 unsupported_parameter`; `null` means unset.
6368
+ */
6369
+ export interface AnthropicMessagesRequest {
6370
+ model: string;
6371
+ messages: AnthropicInputMessage[];
6372
+ max_tokens: number;
6373
+ /** The system prompt; text blocks are joined with blank lines. */
6374
+ system?: null | string | AnthropicTextBlock[];
6375
+ tools?: AnthropicTool[] | null;
6376
+ tool_choice?: null | AnthropicToolChoice;
6377
+ thinking?: null | AnthropicThinking;
6378
+ output_config?: {
6379
+ /** The answer is JSON matching `schema` (at most 64 KiB serialized and 32 levels deep). */
6380
+ format?: {
6381
+ type: "json_schema";
6382
+ /** A JSON Schema object, as Anthropic requires. */
6383
+ schema: Record<string, unknown>;
6384
+ } | null;
6385
+ /**
6386
+ * 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.
6387
+ */
6388
+ effort?: "low" | "medium" | "high" | "xhigh" | "max" | null;
6389
+ } | null;
6390
+ stop_sequences?: string[] | null;
6391
+ stream?: boolean | null;
6392
+ temperature?: number | null;
6393
+ /**
6394
+ * 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).
6395
+ */
6396
+ top_p?: number | null;
6397
+ top_k?: number | null;
6398
+ /** Accepted and ignored. */
6399
+ metadata?: {
6400
+ user_id?: string | null;
6401
+ } | null;
6402
+ /** Accepted and ignored. */
6403
+ service_tier?: string | null;
6404
+ context_management?: AnthropicContextManagement;
6405
+ }
6406
+ /** The input of a Messages request. Any other parameter is `400 unsupported_parameter`. */
6407
+ export interface AnthropicCountTokensRequest {
6408
+ model: string;
6409
+ messages: AnthropicInputMessage[];
6410
+ /** The system prompt; text blocks are joined with blank lines. */
6411
+ system?: null | string | AnthropicTextBlock[];
6412
+ tools?: AnthropicTool[] | null;
6413
+ tool_choice?: null | AnthropicToolChoice;
6414
+ thinking?: null | AnthropicThinking;
6415
+ context_management?: AnthropicContextManagement;
6416
+ }
6417
+ export interface AnthropicCountTokens {
6418
+ input_tokens: number;
6419
+ }
6420
+ export interface AnthropicUsage {
6421
+ /** Prompt tokens the prefix cache did not serve (all of them when the cache fields are absent). */
6422
+ input_tokens: number;
6423
+ output_tokens: number;
6424
+ /**
6425
+ * Always 0 when present. The runtime caches prompt prefixes on its own; nothing is written on request.
6426
+ */
6427
+ cache_creation_input_tokens?: number;
6428
+ /**
6429
+ * Prompt tokens the runtime's prefix cache served, from this organization's earlier requests (whole
6430
+ * 1,056-token blocks on b3os/qwen3.5-9b). The prompt's size is input_tokens plus the two cache fields.
6431
+ * Metering charges every prompt token.
6432
+ */
6433
+ cache_read_input_tokens?: number;
6434
+ }
6435
+ /**
6436
+ * A block of the answer, `text`, `tool_use` (with `id`, `name`, `input`) or `thinking` (with `signature`).
6437
+ */
6438
+ export interface AnthropicOutputBlock {
6439
+ type: "text" | "tool_use" | "thinking";
6440
+ text?: string;
6441
+ id?: string;
6442
+ name?: string;
6443
+ input?: Record<string, unknown>;
6444
+ thinking?: string;
6445
+ signature?: string;
6446
+ }
6447
+ export interface AnthropicMessage {
6448
+ id: string;
6449
+ type: "message";
6450
+ role: "assistant";
6451
+ content: AnthropicOutputBlock[];
6452
+ model: string;
6453
+ stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | "refusal";
6454
+ /** The stop sequence that ended the answer. */
6455
+ stop_sequence: string | null;
6456
+ usage: AnthropicUsage;
6457
+ b3os?: InferMeta;
6458
+ }
6459
+ /**
6460
+ * One event of a stream, named by its `type` (the SSE `event:` field carries the same name):
6461
+ * `message_start` (`message`, with empty `content` and the input tokens), `content_block_start` (`index`,
6462
+ * `content_block`), `content_block_delta` (`index`, and a `delta` of type `text_delta`, `input_json_delta`,
6463
+ * `thinking_delta` or `signature_delta`), `content_block_stop` (`index`), `message_delta` (`delta` with
6464
+ * `stop_reason` and `stop_sequence`, and `usage`), `message_stop` (with the `b3os` metadata), or `error`.
6465
+ */
6466
+ export interface AnthropicStreamEvent {
6467
+ type: "message_start" | "content_block_start" | "content_block_delta" | "content_block_stop" | "message_delta" | "message_stop" | "error";
6468
+ message?: Record<string, unknown>;
6469
+ index?: number;
6470
+ content_block?: Record<string, unknown>;
6471
+ delta?: Record<string, unknown>;
6472
+ usage?: Record<string, unknown>;
6473
+ error?: {
6474
+ type?: string;
6475
+ message?: string;
6476
+ };
6477
+ b3os?: InferMeta;
6478
+ }
4176
6479
  /** Parameters of `listBatches`. */
4177
6480
  export interface VisionListBatchesParams {
4178
6481
  /**
@@ -4260,6 +6563,16 @@ export interface VisionReadUrlParams {
4260
6563
  * @default 0
4261
6564
  */
4262
6565
  wait_for_ms?: number;
6566
+ /**
6567
+ * `true` checks robots.txt and Content Signals first (see `respect_robots` on scrape).
6568
+ * @default false
6569
+ */
6570
+ respect_robots?: boolean;
6571
+ /**
6572
+ * `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.
6573
+ * @default "free"
6574
+ */
6575
+ walls?: "free" | "bill";
4263
6576
  }
4264
6577
  /** Parameters of `listSessions`. */
4265
6578
  export interface VisionListSessionsParams {
@@ -4273,6 +6586,34 @@ export interface VisionListSessionsParams {
4273
6586
  /** Only sessions with this status. */
4274
6587
  status?: SessionStatus;
4275
6588
  }
6589
+ /** Parameters of `listBackgrounds`. */
6590
+ export interface RenderListBackgroundsParams {
6591
+ /** Only this pack's backgrounds (`GET /v1/render/backgrounds/packs` lists the packs). */
6592
+ pack?: string;
6593
+ /** Only light or only dark backgrounds (measured per image, not per pack). */
6594
+ theme?: "light" | "dark";
6595
+ /** Only CSS, only procedural (the studio pack) or only image backgrounds. */
6596
+ kind?: "css" | "procedural" | "image";
6597
+ /**
6598
+ * Only backgrounds with this tag (case-insensitive, whole tag). `video` lists the images the `auto` background picks from, on videos and styled screenshots; `auto` the studio meshes of the studio pick (`background: "studio"`, and `auto` when no image clears the page's edges).
6599
+ */
6600
+ tag?: string;
6601
+ /**
6602
+ * Only full-bleed backgrounds, or only transparent shapes (`cutout`, `partial`, `sliver`). CSS backgrounds are full-bleed.
6603
+ */
6604
+ coverage?: "full-bleed" | "partial" | "cutout" | "sliver";
6605
+ /** `true`: only the hand-picked images (`image.featured`); `false`: everything else. */
6606
+ featured?: boolean;
6607
+ /** Only backgrounds whose name, slug or tags contain this text (case-insensitive). */
6608
+ q?: string;
6609
+ /**
6610
+ * Page size, from 1 to 500.
6611
+ * @default 100
6612
+ */
6613
+ limit?: number;
6614
+ /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
6615
+ cursor?: string;
6616
+ }
4276
6617
  /** Parameters of `listPresets`. */
4277
6618
  export interface RenderListPresetsParams {
4278
6619
  /** Only presets of this kind. */
@@ -4319,6 +6660,11 @@ export interface SandboxesListSandboxesParams {
4319
6660
  cursor?: string;
4320
6661
  /** Only sandboxes with this status. */
4321
6662
  status?: SandboxStatus;
6663
+ /**
6664
+ * Only sandboxes whose `metadata` holds each of these pairs, as `metadata[<key>]=<value>`: up to 4, all of
6665
+ * which must match exactly. Keys follow the `metadata` key rule (1 to 40 of `A-Z a-z 0-9 _ . : -`).
6666
+ */
6667
+ metadata?: Record<string, string>;
4322
6668
  }
4323
6669
  /** Parameters of `listSnapshots`. */
4324
6670
  export interface SandboxesListSnapshotsParams {
@@ -4330,15 +6676,25 @@ export interface SandboxesListSnapshotsParams {
4330
6676
  /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
4331
6677
  cursor?: string;
4332
6678
  }
6679
+ /** Parameters of `deleteFile`. */
6680
+ export interface SandboxesDeleteFileParams {
6681
+ /** Absolute path inside the sandbox. */
6682
+ path: string;
6683
+ /**
6684
+ * `1` deletes a directory and everything in it. `true` and `false` are sent as `1` and `0`.
6685
+ * @default 0
6686
+ */
6687
+ recursive?: boolean | 0 | 1;
6688
+ }
4333
6689
  /** Parameters of `readFile`. */
4334
6690
  export interface SandboxesReadFileParams {
4335
6691
  /** Absolute path inside the sandbox. */
4336
6692
  path: string;
4337
6693
  /**
4338
- * `1` lists the directory instead of reading a file.
6694
+ * `1` lists the directory instead of reading a file. `true` and `false` are sent as `1` and `0`.
4339
6695
  * @default 0
4340
6696
  */
4341
- list?: 0 | 1;
6697
+ list?: boolean | 0 | 1;
4342
6698
  }
4343
6699
  /** Parameters of `writeFile`. */
4344
6700
  export interface SandboxesWriteFileParams {
@@ -4350,10 +6706,15 @@ export interface SandboxesWriteFileParams {
4350
6706
  */
4351
6707
  mode?: string;
4352
6708
  /**
4353
- * `1` creates missing parent directories.
6709
+ * `1` creates missing parent directories. `true` and `false` are sent as `1` and `0`.
4354
6710
  * @default 0
4355
6711
  */
4356
- mkdir?: 0 | 1;
6712
+ mkdir?: boolean | 0 | 1;
6713
+ }
6714
+ /** Parameters of `statFile`. */
6715
+ export interface SandboxesStatFileParams {
6716
+ /** Absolute path inside the sandbox. */
6717
+ path: string;
4357
6718
  }
4358
6719
  /** Parameters of `streamLogs`. */
4359
6720
  export interface SandboxesStreamLogsParams {
@@ -4374,6 +6735,28 @@ export interface SandboxesOpenPtyParams {
4374
6735
  /** Command to run instead of the login shell. */
4375
6736
  cmd?: string;
4376
6737
  cwd?: string;
6738
+ /**
6739
+ * `new` for a terminal that can be reattached, or the id of one (`pts_...`) to attach to again. `cmd` and
6740
+ * `cwd` apply only to a new terminal.
6741
+ */
6742
+ session?: string;
6743
+ }
6744
+ /** Parameters of `listRequests`. */
6745
+ export interface SandboxesListRequestsParams {
6746
+ /**
6747
+ * Page size, from 1 to 100.
6748
+ * @default 20
6749
+ */
6750
+ limit?: number;
6751
+ /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
6752
+ cursor?: string;
6753
+ product?: string;
6754
+ operation_id?: string;
6755
+ /** Only requests that succeeded (`2xx`) or failed (`4xx`, `5xx`). */
6756
+ status?: "2xx" | "4xx" | "5xx";
6757
+ /** Only requests of this W3C trace (the trace id of their `traceparent`). */
6758
+ trace_id?: string;
6759
+ since?: string;
4377
6760
  }
4378
6761
  /** Parameters of `listRoutines`. */
4379
6762
  export interface RoutinesListRoutinesParams {
@@ -4395,6 +6778,21 @@ export interface RoutinesListRunStepsParams {
4395
6778
  /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
4396
6779
  cursor?: string;
4397
6780
  }
6781
+ /** Parameters of `getWait`. */
6782
+ export interface RoutinesGetWaitParams {
6783
+ /** Preselect a decision on the page (HTML only); nothing is answered until the person confirms. */
6784
+ decision?: "approve" | "reject";
6785
+ }
6786
+ /** Parameters of `listHookDeliveries`. */
6787
+ export interface RoutinesListHookDeliveriesParams {
6788
+ /**
6789
+ * Page size, from 1 to 100.
6790
+ * @default 20
6791
+ */
6792
+ limit?: number;
6793
+ /** Opaque cursor from the previous page's `next_cursor`. Omit it for the first page. */
6794
+ cursor?: string;
6795
+ }
4398
6796
  /** Parameters of `listRuns`. */
4399
6797
  export interface RoutinesListRunsParams {
4400
6798
  /**
@@ -4419,7 +6817,7 @@ export interface RoutinesListVersionsParams {
4419
6817
  }
4420
6818
  /** Parameters of `describe`. */
4421
6819
  export interface ActionsDescribeParams {
4422
- /** `<namespace>/<name>/<action>@<version>`; the version may be exact (`1.2.0`) or a major (`1`). */
6820
+ /** `<namespace>/<name>/<action>@<version>`; the version may be exact (`1.0.0`) or a major (`1`). */
4423
6821
  ref: ActionRef;
4424
6822
  }
4425
6823
  /** Parameters of `listPacks`. */
@@ -4439,6 +6837,17 @@ export interface ActionsGetPackParams {
4439
6837
  /** An exact version or a range such as `1` or `^1.2`. */
4440
6838
  version?: string;
4441
6839
  }
6840
+ /** Parameters of `getPackTools` (header parameters are sent as their `X-B3OS-*` headers). */
6841
+ export interface ActionsGetPackToolsParams {
6842
+ /** An exact version or a range such as `1` or `^1.2`; the latest by default. */
6843
+ version?: string;
6844
+ /** The most a listed tool may do. `read` lists `pure` and `read` actions only. */
6845
+ effects?: EffectClass;
6846
+ /** Only these action keys, comma-separated (`post-message,list-channels`). An unknown key is a 400. */
6847
+ actions?: string;
6848
+ /** The `ETag` of a response you hold. */
6849
+ if_none_match?: string;
6850
+ }
4442
6851
  /** Parameters of `listRegistryPacks`. */
4443
6852
  export interface PlatformListRegistryPacksParams {
4444
6853
  /**
@@ -4457,8 +6866,13 @@ export interface ActionsSearchParams {
4457
6866
  q: string;
4458
6867
  /** Only actions of this pack (`io.b3os/github`). */
4459
6868
  pack?: string;
4460
- /** Only actions with this effect class. */
6869
+ /** Only actions with this effect class. Triggers have no effect class, so it never removes one. */
4461
6870
  effects?: EffectClass;
6871
+ /**
6872
+ * `action` (the default), `trigger`, or `any` for both.
6873
+ * @default "action"
6874
+ */
6875
+ kind?: "action" | "trigger" | "any";
4462
6876
  /**
4463
6877
  * Results to return, from 1 to 50.
4464
6878
  * @default 10
@@ -4572,8 +6986,16 @@ export interface PlatformListRequestsParams {
4572
6986
  key_id?: string;
4573
6987
  /** Only requests that arrived this way. */
4574
6988
  connection?: RequestConnection;
6989
+ /**
6990
+ * 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.
6991
+ */
6992
+ source?: string;
4575
6993
  /** Only requests made from inside this sandbox. */
4576
6994
  sandbox_id?: string;
6995
+ /**
6996
+ * 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.
6997
+ */
6998
+ trace_id?: string;
4577
6999
  since?: string;
4578
7000
  }
4579
7001
  /** Parameters of `listDeliveries`. */