@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
@@ -6,6 +6,7 @@ import { Namespace } from "../../core/namespace.ts";
6
6
  import type { Op } from "../../core/op.ts";
7
7
  import type { APIPromise, JobPromise, ListPromise } from "../../core/promise.ts";
8
8
  import type { EventStream } from "../../core/sse.ts";
9
+ import { type ArtifactBytes, fetchArtifact } from "../../helpers/render.ts";
9
10
  import type * as T from "../types.ts";
10
11
 
11
12
  const getArtifactOp: Op = {
@@ -16,12 +17,26 @@ const getArtifactOp: Op = {
16
17
  timeoutMs: 10000,
17
18
  scope: "render:read",
18
19
  };
20
+ const listBackgroundsOp: Op = {
21
+ id: "renderListBackgrounds",
22
+ method: "GET",
23
+ path: "/v1/render/backgrounds",
24
+ timeoutMs: 10000,
25
+ scope: "public",
26
+ };
27
+ const listBackgroundPacksOp: Op = {
28
+ id: "renderListBackgroundPacks",
29
+ method: "GET",
30
+ path: "/v1/render/backgrounds/packs",
31
+ timeoutMs: 10000,
32
+ scope: "public",
33
+ };
19
34
  const listPresetsOp: Op = {
20
35
  id: "renderListPresets",
21
36
  method: "GET",
22
37
  path: "/v1/render/presets",
23
38
  timeoutMs: 10000,
24
- scope: "render:read",
39
+ scope: "public",
25
40
  };
26
41
  const listScreenshotsOp: Op = {
27
42
  id: "renderListScreenshots",
@@ -95,6 +110,23 @@ const videoEventsOp: Op = {
95
110
  timeoutMs: 3600000,
96
111
  scope: "render:read",
97
112
  };
113
+ const unshareVideoOp: Op = {
114
+ id: "renderUnshareVideo",
115
+ method: "DELETE",
116
+ path: "/v1/render/videos/{video_id}/share",
117
+ params: ["video_id"],
118
+ timeoutMs: 10000,
119
+ scope: "render:write",
120
+ };
121
+ const shareVideoOp: Op = {
122
+ id: "renderShareVideo",
123
+ method: "POST",
124
+ path: "/v1/render/videos/{video_id}/share",
125
+ params: ["video_id"],
126
+ body: "json",
127
+ timeoutMs: 10000,
128
+ scope: "render:write",
129
+ };
98
130
  const getVideoTimelineOp: Op = {
99
131
  id: "renderGetVideoTimeline",
100
132
  method: "GET",
@@ -130,6 +162,8 @@ const restyleVideoOp: Op = {
130
162
  /** Descriptors of every render operation, keyed by method name (for tooling and custom clients). */
131
163
  export const renderOps = {
132
164
  getArtifact: getArtifactOp,
165
+ listBackgrounds: listBackgroundsOp,
166
+ listBackgroundPacks: listBackgroundPacksOp,
133
167
  listPresets: listPresetsOp,
134
168
  listScreenshots: listScreenshotsOp,
135
169
  createScreenshot: createScreenshotOp,
@@ -142,6 +176,8 @@ export const renderOps = {
142
176
  cancelVideo: cancelVideoOp,
143
177
  videoEvents: videoEventsOp,
144
178
  restyleVideo: restyleVideoOp,
179
+ unshareVideo: unshareVideoOp,
180
+ shareVideo: shareVideoOp,
145
181
  getVideoTimeline: getVideoTimelineOp,
146
182
  } as const;
147
183
 
@@ -160,12 +196,61 @@ export class RenderAPI extends Namespace {
160
196
  return this._client._call<T.Artifact>(getArtifactOp, { path: [artifactId] }, options);
161
197
  }
162
198
 
199
+ /**
200
+ * List library backgrounds
201
+ *
202
+ * Lists the background library: backgrounds a style names with `overrides.background_ref`, with their license,
203
+ * source and a 360x200 thumbnail served by B3OS. Three kinds:
204
+ *
205
+ * - `css`: drawn by the compositor from CSS gradient layers (no image file), recolorable through `tokens`.
206
+ * - `procedural`: the `studio` pack, our own soft meshes computed by the compositor (no image file, no
207
+ * tokens); the ones tagged `auto` are the set a screenshot's `auto` background (and anything's `studio`)
208
+ * picks from.
209
+ * - `image`: a lossless WebP from ScreenFramed's curated library (decisions T9 and T10: Sean's grants as owner
210
+ * of the library), up to 3840 px on the long edge, with its measured tone in `image` (theme, luminance, hue,
211
+ * detail; how `"auto"` matches a page). `image.coverage` is `full-bleed` for backgrounds; the `gradients`
212
+ * group holds transparent shapes (`cutout`) drawn over a matte. The images tagged `video` are the set a video's
213
+ * `auto` background picks from.
214
+ *
215
+ * Rows are in `ref` order, paged by `limit` and `cursor`. A ref whose bytes equal an earlier one's still
216
+ * resolves but is not listed. Public: no API key, rate limited per client address, and answered from the
217
+ * edge's cache for up to 5 minutes.
218
+ *
219
+ * `GET /v1/render/backgrounds` · scope `public` · served by the node
220
+ */
221
+ listBackgrounds(
222
+ params?: T.RenderListBackgroundsParams,
223
+ options?: RequestOptions,
224
+ ): ListPromise<T.RenderBackgroundList, T.RenderBackground> {
225
+ return this._client._list<T.RenderBackgroundList, T.RenderBackground>(
226
+ listBackgroundsOp,
227
+ { query: params },
228
+ options,
229
+ );
230
+ }
231
+
232
+ /**
233
+ * List library background packs
234
+ *
235
+ * Lists the packs of the background library with their license, notice, source, entry count and a cover
236
+ * thumbnail: the CSS packs first, then the image packs by look (`quiet`, `bold`, `soft-photo`, `texture`,
237
+ * `scenic`, `loud`, `cutout`) and size. `auto` says whether `background_ref: "auto"` may pick from the pack.
238
+ * Public and edge-cached like `GET /v1/render/backgrounds`.
239
+ *
240
+ * `GET /v1/render/backgrounds/packs` · scope `public` · served by the node
241
+ */
242
+ listBackgroundPacks(options?: RequestOptions): APIPromise<T.RenderBackgroundPackList> {
243
+ return this._client._call<T.RenderBackgroundPackList>(listBackgroundPacksOp, {}, options);
244
+ }
245
+
163
246
  /**
164
247
  * List style presets
165
248
  *
166
- * Lists the style presets `style` can name (backgrounds, window frames, cursors, caption styles, click effects), with a preview image for each.
249
+ * Lists the style presets `style` can name (backgrounds, window frames, cursors, caption styles, click effects),
250
+ * with a preview image for each. Public: no API key, rate limited per client address, and answered from the
251
+ * edge's cache for up to 5 minutes.
167
252
  *
168
- * `GET /v1/render/presets` · scope `render:read` · served by the node
253
+ * `GET /v1/render/presets` · scope `public` · served by the node
169
254
  */
170
255
  listPresets(params?: T.RenderListPresetsParams, options?: RequestOptions): APIPromise<T.PresetList> {
171
256
  return this._client._call<T.PresetList>(listPresetsOp, { query: params }, options);
@@ -193,6 +278,28 @@ export class RenderAPI extends Namespace {
193
278
  * URLs, or the image bytes directly when `Accept` is `image/png`, `image/jpeg` or `image/webp`. `variants`
194
279
  * adds extra encodings of the same capture. Bills one `render.screenshot` per capture plus one per variant.
195
280
  *
281
+ * A page loaded from `url` is cleaned before the capture: consent walls, sign-up and app dialogs, dim layers
282
+ * and chat widgets are hidden (never clicked, so no consent is given), and with `block_ads` the empty slots of
283
+ * blocked ads collapse. The answer lists what was hidden in `overlays_removed`; `overlays: "keep"` leaves
284
+ * everything and says what is in view in `warnings`. A paywall or registration wall is the site's answer, not
285
+ * clutter: it stays in the image with its dim layer and scroll lock, and `page_state` says so. Readiness (`settle: "auto"`) finishes the page's
286
+ * entrance animations, and when the capture's main area comes back blank while the page is still loading or
287
+ * fading in, captures again every 100 ms for up to 1.5 s (`recapture_ms` in `timing`). Render cannot tell a
288
+ * beacon or a request that never answers from content on its way, so a sparse page that has finished can wait
289
+ * while one is open; a page with nothing coming pays only `ready_check_ms`. A page whose load event is held up (a script or tracker that never answers)
290
+ * is taken once its first screen has painted, from 2 s on (`wait_until: "auto"`, the default). `status_code`,
291
+ * `final_url` and `page_state` say what the site answered, and `warnings` what a caller should know: an error
292
+ * status, a main area that stayed blank, a page taken before its load event, overlays or a wall left in place.
293
+ *
294
+ * `profile` names a vision profile (ID or name) of the key's project: its cookies and storage load into the
295
+ * page's own browser context before the page loads, so the capture shows the page signed in. It needs
296
+ * `vision:profiles:use` (403 without it, 404 `profile_not_found` for a profile the project does not have),
297
+ * and the answer's `source.profile` is the profile's `prof_` ID. Render writes the state into no answer,
298
+ * stored record or log line, but the image shows whatever the signed-in page shows: treat it and its link as
299
+ * private. A page that is still signed out after the profile loads (a sign-in form, a 401 or 403, a move to a
300
+ * sign-in page, or a sign-in wall) fails with 422 `profile_expired` and bills nothing: sign in again and save
301
+ * the profile.
302
+ *
196
303
  * `POST /v1/render/screenshots` · scope `render:run` · served by the node
197
304
  */
198
305
  createScreenshot(
@@ -251,11 +358,22 @@ export class RenderAPI extends Namespace {
251
358
  * Record a video
252
359
  *
253
360
  * Starts a job that records a scripted demo of `source.url`. Narration (`say`) is synthesized first with
254
- * `/v1/infer/audio/speech`; the director then places each beat's steps on its narration, plans cursor and
361
+ * `/v1/infer/audio/speech`, as the caller: it needs `infer:run` in the key's scopes too. Without it, or when
362
+ * speech is unavailable, the video is made silent with estimated word times and `result.narration.spoken` is
363
+ * false (without the scope, `result.warnings` has `narration_scope`, naming it); the director then places each beat's steps on its narration, plans cursor and
255
364
  * camera, records segments in parallel on a virtual clock, composes at the output frame rate and encodes MP4
256
365
  * (H.264, BT.709), GIF, poster and captions. Artifacts appear as they finish (`video.artifact` events, poster
257
366
  * first). Bills `render.video_s` per second of output.
258
367
  *
368
+ * `source.profile` names a vision profile (ID or name) of the key's project, found when the video is made
369
+ * (403 without `vision:profiles:use`, 404 `profile_not_found`). When the job runs, its state loads into the
370
+ * probe's browser context and every capture segment's, so the whole video is recorded signed in; the video,
371
+ * its timeline and its events name the profile by its `prof_` ID only, but the video shows whatever the
372
+ * signed-in pages show: treat it and its links as private. A page that opens still signed out (a sign-in form,
373
+ * a 401 or 403, or a move to a sign-in page) ends the job with `profile_expired` before any step runs, and
374
+ * nothing is billed. A recording made with a
375
+ * profile is reused (`recording.reuse`) only by videos with the same revision of the same profile.
376
+ *
259
377
  * `POST /v1/render/videos` · scope `render:run` · served by the node
260
378
  */
261
379
  createVideo(body: T.VideoCreateRequest, options?: RequestOptions): JobPromise<T.Video, T.VideoEvent> {
@@ -265,7 +383,7 @@ export class RenderAPI extends Namespace {
265
383
  /**
266
384
  * Delete a video
267
385
  *
268
- * Cancels the job if it is still running, then deletes the video, its artifacts and its archived capture.
386
+ * Cancels the job if it is still running, then deletes the video, its artifacts, its share page and its archived capture.
269
387
  *
270
388
  * `DELETE /v1/render/videos/{video_id}` · scope `render:write` · served by the node
271
389
  */
@@ -287,7 +405,8 @@ export class RenderAPI extends Namespace {
287
405
  /**
288
406
  * Cancel a video
289
407
  *
290
- * Stops the job. Artifacts already produced are kept; seconds already encoded are billed.
408
+ * Stops the job and marks the video canceled. A canceled video bills nothing: `render.video_s` is billed only
409
+ * when a video succeeds. A video that already finished answers 409.
291
410
  *
292
411
  * `POST /v1/render/videos/{video_id}/cancel` · scope `render:run` · served by the node
293
412
  */
@@ -329,12 +448,46 @@ export class RenderAPI extends Namespace {
329
448
  return this._client._job<T.Video, T.VideoEvent>(restyleVideoOp, { path: [videoId], body }, options);
330
449
  }
331
450
 
451
+ /**
452
+ * Stop sharing a video
453
+ *
454
+ * Deletes the video's share page; its link stops working within 60 seconds. The video stays, and so do the
455
+ * signed file links the page used (until the video expires); delete the video to end them. Works whether or not
456
+ * the `render.share_pages` flag is on.
457
+ *
458
+ * `DELETE /v1/render/videos/{video_id}/share` · scope `render:write` · served by the node
459
+ */
460
+ unshareVideo(videoId: string, options?: RequestOptions): APIPromise<T.Deleted> {
461
+ return this._client._call<T.Deleted>(unshareVideoOp, { path: [videoId] }, options);
462
+ }
463
+
464
+ /**
465
+ * Share a video
466
+ *
467
+ * Makes a share page for a finished video: one HTML page on `usercontent.b3os.org` that plays the MP4 with its
468
+ * poster, captions and chapters, carries Open Graph tags for link previews, and works as an iframe embed on any
469
+ * site. No script runs on it (`Content-Security-Policy: sandbox`). The link is signed like every artifact URL and
470
+ * lasts as long as the video's MP4 (7 days by default). Sharing again returns the same page while it lasts
471
+ * (200); a new one answers 201.
472
+ *
473
+ * Off by default: creating a share page needs the `render.share_pages` feature flag on for your organization,
474
+ * and answers 404 `feature_not_enabled` without it. The page plays the video from the video's own signed file
475
+ * links, which stay valid until the video expires: stopping the share (or deleting the video) takes the page
476
+ * down within 60 seconds, but only deleting the video ends the file links a viewer or a link preview already
477
+ * has. There is no password option.
478
+ *
479
+ * `POST /v1/render/videos/{video_id}/share` · scope `render:write` · served by the node
480
+ */
481
+ shareVideo(videoId: string, body?: T.VideoShareRequest, options?: RequestOptions): APIPromise<T.VideoShare> {
482
+ return this._client._call<T.VideoShare>(shareVideoOp, { path: [videoId], body }, options);
483
+ }
484
+
332
485
  /**
333
486
  * Get a video's timeline
334
487
  *
335
488
  * Returns the compiled timeline of a video that has finished planning: beats, narration with word timings,
336
489
  * the timed action list the recorder replayed, cursor path, camera keyframes, captions and style
337
- * (`timeline.schema.json`). `frames=1` adds the per-frame compositor state (large; for debugging).
490
+ * (`timeline.schema.json`). `frames=true` adds the per-frame compositor state (large; for debugging).
338
491
  *
339
492
  * `GET /v1/render/videos/{video_id}/timeline` · scope `render:read` · served by the node
340
493
  */
@@ -345,4 +498,16 @@ export class RenderAPI extends Namespace {
345
498
  ): APIPromise<T.RenderTimeline> {
346
499
  return this._client._call<T.RenderTimeline>(getVideoTimelineOp, { path: [videoId], query: params }, options);
347
500
  }
501
+
502
+ /**
503
+ * An artifact's bytes (from a screenshot or video, or its URL). A client that reaches the node (its Unix socket,
504
+ * or a node URL inside a sandbox) reads them from the node's signed content route, so they never leave the
505
+ * machine; any other client fetches the usercontent URL as given.
506
+ */
507
+ fetchArtifact(
508
+ artifact: Pick<T.Artifact, "url" | "content_type"> | string,
509
+ options?: RequestOptions,
510
+ ): Promise<ArtifactBytes> {
511
+ return fetchArtifact(this._client, artifact, options);
512
+ }
348
513
  }
@@ -31,7 +31,9 @@ export class RequestsAPI extends Namespace {
31
31
  * List requests
32
32
  *
33
33
  * Lists the requests the node served for your project in the last 7 days, newest first, over every connection
34
- * kind, filterable by product, operation, status, key, connection kind and sandbox. Requests the edge answered
34
+ * kind, filterable by product, operation, status, key, source, connection kind, sandbox and trace. Every source
35
+ * is listed unless `source` narrows it (the dashboard's Requests page leaves `dashboard` out until you show it).
36
+ * Requests the edge answered
35
37
  * without forwarding them (edge-served operations, or requests refused before forwarding) are not listed; get
36
38
  * those by ID. The edge forwards this operation and merges its `edge_*` phases into each record.
37
39
  *
@@ -24,6 +24,14 @@ const createRoutineOp: Op = {
24
24
  timeoutMs: 15000,
25
25
  scope: "routines:write",
26
26
  };
27
+ const sendEventOp: Op = {
28
+ id: "routinesSendEvent",
29
+ method: "POST",
30
+ path: "/v1/routines/events",
31
+ body: "json",
32
+ timeoutMs: 10000,
33
+ scope: "routines:run",
34
+ };
27
35
  const importRoutineOp: Op = {
28
36
  id: "routinesImportRoutine",
29
37
  method: "POST",
@@ -83,6 +91,14 @@ const validateRoutineOp: Op = {
83
91
  timeoutMs: 15000,
84
92
  scope: "routines:write",
85
93
  };
94
+ const getWaitOp: Op = {
95
+ id: "routinesGetWait",
96
+ method: "GET",
97
+ path: "/v1/routines/waits/{token}",
98
+ params: ["token"],
99
+ timeoutMs: 10000,
100
+ scope: "public",
101
+ };
86
102
  const deleteRoutineOp: Op = {
87
103
  id: "routinesDeleteRoutine",
88
104
  method: "DELETE",
@@ -118,6 +134,14 @@ const publishRoutineOp: Op = {
118
134
  timeoutMs: 15000,
119
135
  scope: "routines:write",
120
136
  };
137
+ const listHookDeliveriesOp: Op = {
138
+ id: "routinesListHookDeliveries",
139
+ method: "GET",
140
+ path: "/v1/routines/{routine}/hooks/{hook_id}/deliveries",
141
+ params: ["routine", "hook_id"],
142
+ timeoutMs: 10000,
143
+ scope: "routines:read",
144
+ };
121
145
  const rotateHookSecretOp: Op = {
122
146
  id: "routinesRotateHookSecret",
123
147
  method: "POST",
@@ -127,6 +151,15 @@ const rotateHookSecretOp: Op = {
127
151
  timeoutMs: 10000,
128
152
  scope: "routines:write",
129
153
  };
154
+ const testHookOp: Op = {
155
+ id: "routinesTestHook",
156
+ method: "POST",
157
+ path: "/v1/routines/{routine}/hooks/{hook_id}/test",
158
+ params: ["routine", "hook_id"],
159
+ body: "json",
160
+ timeoutMs: 10000,
161
+ scope: "routines:write",
162
+ };
130
163
  const rollbackRoutineOp: Op = {
131
164
  id: "routinesRollbackRoutine",
132
165
  method: "POST",
@@ -160,6 +193,18 @@ const getVersionOp: Op = {
160
193
  timeoutMs: 10000,
161
194
  scope: "routines:read",
162
195
  };
196
+ const replayRunOp: Op = {
197
+ id: "routinesReplayRun",
198
+ method: "POST",
199
+ path: "/v1/routines/runs/{run_id}/replay",
200
+ params: ["run_id"],
201
+ body: "json",
202
+ idem: true,
203
+ stream: "sse",
204
+ timeoutMs: 3600000,
205
+ scope: "routines:run",
206
+ job: { get: getRunOp, events: runEventsOp, cancel: cancelRunOp },
207
+ };
163
208
  const createRunOp: Op = {
164
209
  id: "routinesCreateRun",
165
210
  method: "POST",
@@ -177,18 +222,23 @@ const createRunOp: Op = {
177
222
  export const routinesOps = {
178
223
  listRoutines: listRoutinesOp,
179
224
  createRoutine: createRoutineOp,
225
+ sendEvent: sendEventOp,
180
226
  importRoutine: importRoutineOp,
181
227
  getRun: getRunOp,
182
228
  cancelRun: cancelRunOp,
183
229
  runEvents: runEventsOp,
230
+ replayRun: replayRunOp,
184
231
  signalRun: signalRunOp,
185
232
  listRunSteps: listRunStepsOp,
186
233
  validateRoutine: validateRoutineOp,
234
+ getWait: getWaitOp,
187
235
  deleteRoutine: deleteRoutineOp,
188
236
  getRoutine: getRoutineOp,
189
237
  updateRoutine: updateRoutineOp,
190
238
  publishRoutine: publishRoutineOp,
239
+ listHookDeliveries: listHookDeliveriesOp,
191
240
  rotateHookSecret: rotateHookSecretOp,
241
+ testHook: testHookOp,
192
242
  rollbackRoutine: rollbackRoutineOp,
193
243
  listRuns: listRunsOp,
194
244
  createRun: createRunOp,
@@ -216,7 +266,9 @@ export class RoutinesAPI extends Namespace {
216
266
  * (`Content-Type: application/yaml`). Fails with `routine_invalid` (pointers into the definition) when it does
217
267
  * not compile, and with `routine_name_taken` when the name exists; `PUT /v1/routines/{routine}` creates or
218
268
  * updates by name instead. Webhook triggers verified with the `b3os` scheme get a signing secret that is
219
- * returned in this response only.
269
+ * returned in this response only. A webhook trigger that names a vault connection (`verify.secret`,
270
+ * `challenge.token_connection`) needs `vault:run` on top of `routines:write`: without it the request answers
271
+ * 403 `forbidden` with `required_scope: vault:run` and nothing is read from the vault.
220
272
  *
221
273
  * `POST /v1/routines` · scope `routines:write` · served by the node
222
274
  */
@@ -228,6 +280,24 @@ export class RoutinesAPI extends Namespace {
228
280
  );
229
281
  }
230
282
 
283
+ /**
284
+ * Send an event to waiting runs
285
+ *
286
+ * Resumes every step of your project's active runs that waits for this event (`wait: {event, match}`,
287
+ * routine.schema.json) and whose `match` values are all in `data`, without knowing their run IDs: an order
288
+ * system sends `order.paid` with the order's ID, and the run waiting for that order continues. Each step
289
+ * completes with `{event, data, id, received_at, timed_out: false}`, journaled with its run like a signal.
290
+ * Events are not buffered: a step that starts waiting after the event does not see it, and an event no step
291
+ * waits for answers `delivered: 0`. Runs of other projects never see your events. Each step journals the
292
+ * event, so an event's JSON plus 256 bytes a step may add up to at most 4 MiB across the steps it resumes; past
293
+ * that it is refused whole with `event_fan_out_too_large` and no step continues.
294
+ *
295
+ * `POST /v1/routines/events` · scope `routines:run` · served by the node
296
+ */
297
+ sendEvent(body: T.RoutineEventRequest, options?: RequestOptions): APIPromise<T.RoutineEvent> {
298
+ return this._client._call<T.RoutineEvent>(sendEventOp, { body }, options);
299
+ }
300
+
231
301
  /**
232
302
  * Convert a B3OS workflow
233
303
  *
@@ -244,7 +314,7 @@ export class RoutinesAPI extends Namespace {
244
314
  /**
245
315
  * Get a run
246
316
  *
247
- * Returns the run with its status, input, result and the state of every top-level step (map items are summarized; list them with `…/steps`).
317
+ * Returns the run with its status, input, result and the state of every top-level step (map items are summarized; list them with `…/steps`). An `ephemeral` run read after it ended returns its summary: `steps` is empty and `steps_kept` is `false`, since its step history was not kept.
248
318
  *
249
319
  * `GET /v1/routines/runs/{run_id}` · scope `routines:read` · served by the node
250
320
  */
@@ -255,7 +325,7 @@ export class RoutinesAPI extends Namespace {
255
325
  /**
256
326
  * Cancel a run
257
327
  *
258
- * Cancels the run. In-flight steps are told to stop; steps that already had effects are not undone. The run ends `canceled` with `job_canceled`.
328
+ * Cancels the run. In-flight steps are told to stop (their in-process calls end; a buffered sandbox command is killed with its connection), child runs of `routine/` steps are canceled too, and steps that already had effects are not undone. The run ends `canceled` with `job_canceled`.
259
329
  *
260
330
  * `POST /v1/routines/runs/{run_id}/cancel` · scope `routines:run` · served by the node
261
331
  */
@@ -268,7 +338,8 @@ export class RoutinesAPI extends Namespace {
268
338
  *
269
339
  * Server-sent events for the run: lifecycle events, `step.*` events as steps start, retry, wait and finish,
270
340
  * and `run.log` from `core/log` steps. Ends after the terminal event; reconnect with `Last-Event-ID` to resume
271
- * (events are kept with the run history).
341
+ * (events are kept with the run history). An `ephemeral` run that ended kept no events but its terminal one:
342
+ * the stream sends that event alone, with the `seq` it had and the run's summary as its `job`.
272
343
  *
273
344
  * `GET /v1/routines/runs/{run_id}/events` · scope `routines:read` · served by the node
274
345
  */
@@ -279,12 +350,44 @@ export class RoutinesAPI extends Namespace {
279
350
  });
280
351
  }
281
352
 
353
+ /**
354
+ * Replay a run
355
+ *
356
+ * Starts a new run of a finished run's routine that reuses what the source run already did. Each top-level
357
+ * step that succeeded in the source run is copied: it succeeds at once with its recorded outputs, does not
358
+ * run its callable again (no request, no sandbox, no charge) and shows `replayed: true`. Everything else runs:
359
+ * `from_step` and every step downstream of it, the steps that failed, were skipped or were canceled, steps
360
+ * another version adds or changes (compared with the source version's step of the same id: the step as
361
+ * written, the pack and routine versions it pinned at publish, the steps it depends on, and the `vars` and
362
+ * `env` it reads), steps that read an `input` that differs from the source's (directly or through `env`),
363
+ * steps that wait for a signal unless the version and input are the source's, and every step downstream of
364
+ * one of those. `trigger` and `run` are not compared. Without `from_step`, a replay of a failed run picks up
365
+ * where it failed.
366
+ *
367
+ * The new run uses the source run's version and input unless `version` or `input` is given, so a fix
368
+ * published as a new version can be replayed against the run that failed. Its trigger is
369
+ * `{type: replay, parent_run_id, from_step}`; steps that run again read what the source got from its
370
+ * trigger through the input. Copied steps do not count toward `routines.steps.daily`. The copied outputs
371
+ * and the input together are at most `routines.max_step_output_bytes` (1 MiB by default), or the replay
372
+ * answers 422 `replay_too_large`. Answers like `routinesCreateRun`: `?wait=`, `Accept: text/event-stream`,
373
+ * `webhook` and `Idempotency-Key` work the same way. An `ephemeral` source run kept no step outputs to copy:
374
+ * 410 `run_steps_not_kept` (start a new run with its input instead).
375
+ *
376
+ * `POST /v1/routines/runs/{run_id}/replay` · scope `routines:run` · served by the node
377
+ */
378
+ replayRun(runId: string, body?: T.RunReplayRequest, options?: RequestOptions): JobPromise<T.RoutineRun, T.RunEvent> {
379
+ return this._client._job<T.RoutineRun, T.RunEvent>(replayRunOp, { path: [runId], body }, options);
380
+ }
381
+
282
382
  /**
283
383
  * Send a signal to a run
284
384
  *
285
385
  * Delivers a named signal to the run. A `wait` step waiting for it completes with `payload` as its outputs; a
286
386
  * signal sent before its step starts waiting is buffered (up to 16 per name) and consumed in order. Fails with
287
- * `run_not_waiting` when the run already finished or the buffer for this name is full.
387
+ * `run_not_waiting` when the run already finished or the buffer for this name is full. The payload counts
388
+ * against the organization's run data on the node (`max_org_run_bytes`): one that does not fit answers 429
389
+ * `concurrency_limited` (503 `capacity_unavailable` at the node's cap), except a payload of up to 1 KiB that
390
+ * ends a wait, so a run can always be let go.
288
391
  *
289
392
  * `POST /v1/routines/runs/{run_id}/signal` · scope `routines:run` · served by the node
290
393
  */
@@ -295,7 +398,7 @@ export class RoutinesAPI extends Namespace {
295
398
  /**
296
399
  * List a run's steps
297
400
  *
298
- * Lists every step execution of the run in start order, including each map item (`item_index`) and retries (`attempt`), with outputs and errors.
401
+ * Lists every step execution of the run in start order, including each map item (`item_index`) and retries (`attempt`), with outputs and errors. An `ephemeral` run that ended kept none: 410 `run_steps_not_kept`.
299
402
  *
300
403
  * `GET /v1/routines/runs/{run_id}/steps` · scope `routines:read` · served by the node
301
404
  */
@@ -320,6 +423,27 @@ export class RoutinesAPI extends Namespace {
320
423
  return this._client._call<T.RoutineValidation>(validateRoutineOp, { body }, options);
321
424
  }
322
425
 
426
+ /**
427
+ * Read a wait link
428
+ *
429
+ * The link of a `wait` step with `token: true` (`run.wait_urls.<step id>`, routine.schema.json). Send it
430
+ * to the person who should answer: no API key and no login are needed, the link is the credential. A
431
+ * browser (`Accept: text/html`) gets a page with the step's `prompt` (title, body, image, link) and Approve
432
+ * and Reject buttons; `?decision=approve` or `?decision=reject` preselects one, for buttons in a Slack or
433
+ * email message (the person still confirms, so link previews and mail scanners that fetch the URL answer
434
+ * nothing). Programs get the `RoutineWait` JSON. The link names one run and step of one project and is
435
+ * signed by the node; it works once, while the step waits, and for at most 7 days after the step started
436
+ * waiting. The run's end, the step's own deadline or a signal sent through the API ends it too. Any link
437
+ * that is malformed, signed for another run, step or project, or whose run is no longer kept answers the
438
+ * same 404 `wait_link_invalid`. Answers carry `Cache-Control: no-store` and `Referrer-Policy:
439
+ * no-referrer`, and the link never appears in your organization's request log.
440
+ *
441
+ * `GET /v1/routines/waits/{token}` · scope `public` · served by the node
442
+ */
443
+ getWait(token: string, params?: T.RoutinesGetWaitParams, options?: RequestOptions): APIPromise<T.RoutineWait> {
444
+ return this._client._call<T.RoutineWait>(getWaitOp, { path: [token], query: params }, options);
445
+ }
446
+
323
447
  /**
324
448
  * Delete a routine
325
449
  *
@@ -366,7 +490,13 @@ export class RoutinesAPI extends Namespace {
366
490
  * identity and its scopes are snapshotted. Hook IDs stay the same across versions for the same trigger ID.
367
491
  * Pack triggers (`type: action`) are subscriptions: publishing creates or updates one trigger subscription
368
492
  * (`tsub_`, read-only at `GET /v1/actions/subscriptions`) per action trigger, and removes the subscriptions of
369
- * action triggers the new version no longer has.
493
+ * action triggers the new version no longer has. When the actions product cannot take the subscriptions now
494
+ * (it is not running, or answers 5xx or 429), the version is still published and the routine carries a
495
+ * `product_unavailable` entry in `warnings` per action trigger until a retry subscribes it; when it refuses
496
+ * a trigger (an unknown trigger, a `with` that fails its config schema, a missing connection), the publish
497
+ * fails with `routine_invalid` and an `errors[]` item at that trigger. A webhook trigger that names a vault
498
+ * connection (`verify.secret`, `challenge.token_connection`) needs `vault:run` on top of `routines:write`
499
+ * (403 `forbidden`, `required_scope: vault:run`), as a connection in a pack trigger does.
370
500
  *
371
501
  * `PUT /v1/routines/{routine}` · scope `routines:write` · served by the node
372
502
  */
@@ -378,6 +508,34 @@ export class RoutinesAPI extends Namespace {
378
508
  );
379
509
  }
380
510
 
511
+ /**
512
+ * List a hook's deliveries
513
+ *
514
+ * The hook's delivery log, newest first: every request that reached a known hook in the last 7 days, the
515
+ * GET verifications included, whatever the answer (a run started, a duplicate, `if` false, a handshake, a
516
+ * 401 with its `reason`, a 422, a 503). An entry is listed within a second of the answer. Each entry has the
517
+ * status, the error `code`, `reason` and `detail`, the run, the size of the body and a fixed set of headers
518
+ * (`content-type`, `content-length`, `user-agent`, `idempotency-key`, `traceparent`, `x-github-event`,
519
+ * `x-github-delivery`, `x-github-hook-id`, `x-slack-retry-num`, `x-slack-retry-reason`, `webhook-id`,
520
+ * `webhook-timestamp`); no body, signature, cookie, credential or infrastructure header is stored. At most
521
+ * the newest 10,000 entries per hook are kept, and at most 1,200 POST and 60 GET requests per hook and
522
+ * minute are written: requests past that are answered as usual but not listed.
523
+ *
524
+ * `GET /v1/routines/{routine}/hooks/{hook_id}/deliveries` · scope `routines:read` · served by the node
525
+ */
526
+ listHookDeliveries(
527
+ routine: string,
528
+ hookId: string,
529
+ params?: T.RoutinesListHookDeliveriesParams,
530
+ options?: RequestOptions,
531
+ ): ListPromise<T.HookDeliveryEntryList, T.HookDeliveryEntry> {
532
+ return this._client._list<T.HookDeliveryEntryList, T.HookDeliveryEntry>(
533
+ listHookDeliveriesOp,
534
+ { path: [routine, hookId], query: params },
535
+ options,
536
+ );
537
+ }
538
+
381
539
  /**
382
540
  * Rotate a hook's signing secret
383
541
  *
@@ -395,13 +553,35 @@ export class RoutinesAPI extends Namespace {
395
553
  return this._client._call<T.HookSecret>(rotateHookSecretOp, { path: [routine, hookId], body }, options);
396
554
  }
397
555
 
556
+ /**
557
+ * Send a test delivery
558
+ *
559
+ * Signs `body` (default `{"test": true, "sent_at": "<now>"}`) with the hook's current secret and delivers it
560
+ * through the hook ingress the way a sender would, with a fresh `Idempotency-Key`. It is verified, matched
561
+ * against `if` and starts a run like any delivery, and its log entry (`source: test`) is the answer and is
562
+ * listed with the hook's deliveries. Only hooks verified with the `b3os` scheme: B3OS does not hold another
563
+ * provider's signing secret in the clear, so send a test from that provider's settings instead.
564
+ *
565
+ * `POST /v1/routines/{routine}/hooks/{hook_id}/test` · scope `routines:write` · served by the node
566
+ */
567
+ testHook(
568
+ routine: string,
569
+ hookId: string,
570
+ body?: T.HookTestRequest,
571
+ options?: RequestOptions,
572
+ ): APIPromise<T.HookDeliveryEntry> {
573
+ return this._client._call<T.HookDeliveryEntry>(testHookOp, { path: [routine, hookId], body }, options);
574
+ }
575
+
398
576
  /**
399
577
  * Roll back to a version
400
578
  *
401
579
  * Makes an earlier version active again (triggers switch atomically). Running runs keep their version. The
402
580
  * rollback is recorded as the routine's update; no new version is created. Trigger subscriptions follow the
403
581
  * version: those of action triggers the earlier version does not have are removed, and the others are updated
404
- * to its definition.
582
+ * to its definition (pending, with `warnings`, when the actions product cannot take them now, as on publish).
583
+ * An earlier version whose webhook triggers name vault connections needs `vault:run` of the caller and of the
584
+ * key that published it; either missing answers 403 `forbidden` with `required_scope: vault:run`.
405
585
  *
406
586
  * `POST /v1/routines/{routine}/rollback` · scope `routines:write` · served by the node
407
587
  */
@@ -412,7 +592,7 @@ export class RoutinesAPI extends Namespace {
412
592
  /**
413
593
  * List a routine's runs
414
594
  *
415
- * Lists runs of the routine, newest first. Run history is kept for 30 days.
595
+ * Lists runs of the routine, newest first. Run history is kept for 30 days (for an `ephemeral` run, its summary only: `steps_kept: false`).
416
596
  *
417
597
  * `GET /v1/routines/{routine}/runs` · scope `routines:read` · served by the node
418
598
  */
@@ -432,6 +612,22 @@ export class RoutinesAPI extends Namespace {
432
612
  * the journal), `Accept: text/event-stream` to follow steps live, or `webhook`. Effect steps without a product
433
613
  * meter of their own bill `routines.effect_step`; product steps bill their product's unit.
434
614
  *
615
+ * Once an `ephemeral` run ends, only its summary is stored: status, timing, `input`, `result`, `error` and its
616
+ * IDs, without its step history. The `?wait=` answer, the event stream and the webhook carry its steps as it
617
+ * ends; every read after that returns the summary with `steps_kept: false` (`routinesGetRun`).
618
+ *
619
+ * Organizations share a node's run shards fairly: the next turn goes to the organization that used the least
620
+ * so far, and each organization's I/O steps run within per-organization, per-routine and per-key budgets.
621
+ * The data an organization's runs hold on the node is capped (`max_org_run_bytes`): a run's input and its
622
+ * journal records count from its start, so a run that does not fit answers 429 `concurrency_limited` with
623
+ * `Retry-After` (503 `capacity_unavailable` when the node's own cap is reached), and a step whose data does
624
+ * not fit fails with `limit_exceeded`; new runs also answer 429 while the run store is a whole cap behind on
625
+ * the organization's finished runs. If the node restarts while a step runs, the step runs again as a new
626
+ * attempt (its `attempt` grows, with the same `Idempotency-Key` to the destination); a result of the earlier
627
+ * attempt that arrives late is discarded. With `defaults.pause_sandboxes`, a run that execs in an existing
628
+ * sandbox and then waits a long time pauses that sandbox until its next exec there (or until the run ends),
629
+ * unless another run on the node execs in it too.
630
+ *
435
631
  * `POST /v1/routines/{routine}/runs` · scope `routines:run` · served by the node
436
632
  */
437
633
  createRun(