@b3os/sdk 0.2.1 → 0.2.2

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 (138) hide show
  1. package/dist/cjs/core/util.d.ts +1 -1
  2. package/dist/cjs/core/util.js +1 -1
  3. package/dist/cjs/generated/client.d.ts +13 -0
  4. package/dist/cjs/generated/client.js +25 -0
  5. package/dist/cjs/generated/client.js.map +1 -1
  6. package/dist/cjs/generated/errors.d.ts +1 -1
  7. package/dist/cjs/generated/errors.js +75 -0
  8. package/dist/cjs/generated/errors.js.map +1 -1
  9. package/dist/cjs/generated/ids.d.ts +61 -0
  10. package/dist/cjs/generated/ids.js +15 -0
  11. package/dist/cjs/generated/ids.js.map +1 -1
  12. package/dist/cjs/generated/jobs.js +4 -0
  13. package/dist/cjs/generated/jobs.js.map +1 -1
  14. package/dist/cjs/generated/ns/actions.d.ts +267 -33
  15. package/dist/cjs/generated/ns/actions.js +375 -33
  16. package/dist/cjs/generated/ns/actions.js.map +1 -1
  17. package/dist/cjs/generated/ns/agents.d.ts +229 -0
  18. package/dist/cjs/generated/ns/agents.js +402 -0
  19. package/dist/cjs/generated/ns/agents.js.map +1 -0
  20. package/dist/cjs/generated/ns/images.d.ts +81 -0
  21. package/dist/cjs/generated/ns/images.js +122 -0
  22. package/dist/cjs/generated/ns/images.js.map +1 -0
  23. package/dist/cjs/generated/ns/infer.d.ts +71 -3
  24. package/dist/cjs/generated/ns/infer.js +98 -3
  25. package/dist/cjs/generated/ns/infer.js.map +1 -1
  26. package/dist/cjs/generated/ns/keys.d.ts +3 -1
  27. package/dist/cjs/generated/ns/keys.js +3 -1
  28. package/dist/cjs/generated/ns/keys.js.map +1 -1
  29. package/dist/cjs/generated/ns/listeners.d.ts +159 -0
  30. package/dist/cjs/generated/ns/listeners.js +264 -0
  31. package/dist/cjs/generated/ns/listeners.js.map +1 -0
  32. package/dist/cjs/generated/ns/orgs.d.ts +10 -0
  33. package/dist/cjs/generated/ns/orgs.js +26 -1
  34. package/dist/cjs/generated/ns/orgs.js.map +1 -1
  35. package/dist/cjs/generated/ns/projects.d.ts +32 -0
  36. package/dist/cjs/generated/ns/projects.js +66 -0
  37. package/dist/cjs/generated/ns/projects.js.map +1 -1
  38. package/dist/cjs/generated/ns/render.d.ts +192 -21
  39. package/dist/cjs/generated/ns/render.js +267 -24
  40. package/dist/cjs/generated/ns/render.js.map +1 -1
  41. package/dist/cjs/generated/ns/requests.d.ts +3 -1
  42. package/dist/cjs/generated/ns/requests.js +3 -1
  43. package/dist/cjs/generated/ns/requests.js.map +1 -1
  44. package/dist/cjs/generated/ns/routines.d.ts +11 -4
  45. package/dist/cjs/generated/ns/routines.js +11 -4
  46. package/dist/cjs/generated/ns/routines.js.map +1 -1
  47. package/dist/cjs/generated/ns/sandboxes.d.ts +292 -7
  48. package/dist/cjs/generated/ns/sandboxes.js +444 -6
  49. package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
  50. package/dist/cjs/generated/ns/usage.d.ts +1 -1
  51. package/dist/cjs/generated/ns/usage.js +1 -1
  52. package/dist/cjs/generated/ns/vision.d.ts +59 -17
  53. package/dist/cjs/generated/ns/vision.js +59 -21
  54. package/dist/cjs/generated/ns/vision.js.map +1 -1
  55. package/dist/cjs/generated/types.d.ts +2564 -68
  56. package/dist/cjs/helpers/sandboxes.d.ts +20 -1
  57. package/dist/cjs/helpers/sandboxes.js +13 -1
  58. package/dist/cjs/helpers/sandboxes.js.map +1 -1
  59. package/dist/esm/core/util.d.ts +1 -1
  60. package/dist/esm/core/util.js +1 -1
  61. package/dist/esm/generated/client.d.ts +13 -0
  62. package/dist/esm/generated/client.js +25 -0
  63. package/dist/esm/generated/client.js.map +1 -1
  64. package/dist/esm/generated/errors.d.ts +1 -1
  65. package/dist/esm/generated/errors.js +75 -0
  66. package/dist/esm/generated/errors.js.map +1 -1
  67. package/dist/esm/generated/ids.d.ts +61 -0
  68. package/dist/esm/generated/ids.js +15 -0
  69. package/dist/esm/generated/ids.js.map +1 -1
  70. package/dist/esm/generated/jobs.js +4 -0
  71. package/dist/esm/generated/jobs.js.map +1 -1
  72. package/dist/esm/generated/ns/actions.d.ts +267 -33
  73. package/dist/esm/generated/ns/actions.js +375 -33
  74. package/dist/esm/generated/ns/actions.js.map +1 -1
  75. package/dist/esm/generated/ns/agents.d.ts +229 -0
  76. package/dist/esm/generated/ns/agents.js +398 -0
  77. package/dist/esm/generated/ns/agents.js.map +1 -0
  78. package/dist/esm/generated/ns/images.d.ts +81 -0
  79. package/dist/esm/generated/ns/images.js +118 -0
  80. package/dist/esm/generated/ns/images.js.map +1 -0
  81. package/dist/esm/generated/ns/infer.d.ts +71 -3
  82. package/dist/esm/generated/ns/infer.js +98 -3
  83. package/dist/esm/generated/ns/infer.js.map +1 -1
  84. package/dist/esm/generated/ns/keys.d.ts +3 -1
  85. package/dist/esm/generated/ns/keys.js +3 -1
  86. package/dist/esm/generated/ns/keys.js.map +1 -1
  87. package/dist/esm/generated/ns/listeners.d.ts +159 -0
  88. package/dist/esm/generated/ns/listeners.js +260 -0
  89. package/dist/esm/generated/ns/listeners.js.map +1 -0
  90. package/dist/esm/generated/ns/orgs.d.ts +10 -0
  91. package/dist/esm/generated/ns/orgs.js +26 -1
  92. package/dist/esm/generated/ns/orgs.js.map +1 -1
  93. package/dist/esm/generated/ns/projects.d.ts +32 -0
  94. package/dist/esm/generated/ns/projects.js +66 -0
  95. package/dist/esm/generated/ns/projects.js.map +1 -1
  96. package/dist/esm/generated/ns/render.d.ts +192 -21
  97. package/dist/esm/generated/ns/render.js +267 -24
  98. package/dist/esm/generated/ns/render.js.map +1 -1
  99. package/dist/esm/generated/ns/requests.d.ts +3 -1
  100. package/dist/esm/generated/ns/requests.js +3 -1
  101. package/dist/esm/generated/ns/requests.js.map +1 -1
  102. package/dist/esm/generated/ns/routines.d.ts +11 -4
  103. package/dist/esm/generated/ns/routines.js +11 -4
  104. package/dist/esm/generated/ns/routines.js.map +1 -1
  105. package/dist/esm/generated/ns/sandboxes.d.ts +292 -7
  106. package/dist/esm/generated/ns/sandboxes.js +444 -6
  107. package/dist/esm/generated/ns/sandboxes.js.map +1 -1
  108. package/dist/esm/generated/ns/usage.d.ts +1 -1
  109. package/dist/esm/generated/ns/usage.js +1 -1
  110. package/dist/esm/generated/ns/vision.d.ts +59 -17
  111. package/dist/esm/generated/ns/vision.js +59 -21
  112. package/dist/esm/generated/ns/vision.js.map +1 -1
  113. package/dist/esm/generated/types.d.ts +2564 -68
  114. package/dist/esm/helpers/sandboxes.d.ts +20 -1
  115. package/dist/esm/helpers/sandboxes.js +13 -1
  116. package/dist/esm/helpers/sandboxes.js.map +1 -1
  117. package/package.json +1 -1
  118. package/src/core/util.ts +1 -1
  119. package/src/generated/client.ts +28 -0
  120. package/src/generated/errors.ts +150 -0
  121. package/src/generated/ids.ts +15 -0
  122. package/src/generated/jobs.ts +4 -0
  123. package/src/generated/ns/actions.ts +403 -33
  124. package/src/generated/ns/agents.ts +461 -0
  125. package/src/generated/ns/images.ts +128 -0
  126. package/src/generated/ns/infer.ts +100 -3
  127. package/src/generated/ns/keys.ts +3 -1
  128. package/src/generated/ns/listeners.ts +296 -0
  129. package/src/generated/ns/orgs.ts +27 -1
  130. package/src/generated/ns/projects.ts +74 -0
  131. package/src/generated/ns/render.ts +277 -24
  132. package/src/generated/ns/requests.ts +3 -1
  133. package/src/generated/ns/routines.ts +11 -4
  134. package/src/generated/ns/sandboxes.ts +492 -7
  135. package/src/generated/ns/usage.ts +1 -1
  136. package/src/generated/ns/vision.ts +59 -21
  137. package/src/generated/types.ts +2907 -192
  138. package/src/helpers/sandboxes.ts +31 -2
@@ -9,6 +9,55 @@ import type { EventStream } from "../../core/sse.ts";
9
9
  import { type ArtifactBytes, fetchArtifact } from "../../helpers/render.ts";
10
10
  import type * as T from "../types.ts";
11
11
 
12
+ const listAliasesOp: Op = {
13
+ id: "renderListAliases",
14
+ method: "GET",
15
+ path: "/v1/render/aliases",
16
+ timeoutMs: 10000,
17
+ scope: "render:read",
18
+ };
19
+ const deleteAliasOp: Op = {
20
+ id: "renderDeleteAlias",
21
+ method: "DELETE",
22
+ path: "/v1/render/aliases/{alias}",
23
+ params: ["alias"],
24
+ timeoutMs: 15000,
25
+ scope: "render:write",
26
+ };
27
+ const getAliasOp: Op = {
28
+ id: "renderGetAlias",
29
+ method: "GET",
30
+ path: "/v1/render/aliases/{alias}",
31
+ params: ["alias"],
32
+ timeoutMs: 10000,
33
+ scope: "render:read",
34
+ };
35
+ const putAliasOp: Op = {
36
+ id: "renderPutAlias",
37
+ method: "PUT",
38
+ path: "/v1/render/aliases/{alias}",
39
+ params: ["alias"],
40
+ body: "json",
41
+ timeoutMs: 15000,
42
+ scope: "render:write",
43
+ };
44
+ const unshareAliasOp: Op = {
45
+ id: "renderUnshareAlias",
46
+ method: "DELETE",
47
+ path: "/v1/render/aliases/{alias}/share",
48
+ params: ["alias"],
49
+ timeoutMs: 15000,
50
+ scope: "render:write",
51
+ };
52
+ const shareAliasOp: Op = {
53
+ id: "renderShareAlias",
54
+ method: "POST",
55
+ path: "/v1/render/aliases/{alias}/share",
56
+ params: ["alias"],
57
+ body: "json",
58
+ timeoutMs: 15000,
59
+ scope: "render:write",
60
+ };
12
61
  const getArtifactOp: Op = {
13
62
  id: "renderGetArtifact",
14
63
  method: "GET",
@@ -31,6 +80,15 @@ const listBackgroundPacksOp: Op = {
31
80
  timeoutMs: 10000,
32
81
  scope: "public",
33
82
  };
83
+ const createInspectionOp: Op = {
84
+ id: "renderCreateInspection",
85
+ method: "POST",
86
+ path: "/v1/render/inspections",
87
+ body: "json",
88
+ idem: true,
89
+ timeoutMs: 65000,
90
+ scope: "render:run",
91
+ };
34
92
  const listPresetsOp: Op = {
35
93
  id: "renderListPresets",
36
94
  method: "GET",
@@ -91,7 +149,7 @@ const getVideoOp: Op = {
91
149
  path: "/v1/render/videos/{video_id}",
92
150
  params: ["video_id"],
93
151
  timeoutMs: 10000,
94
- scope: "render:read",
152
+ scope: "authenticated",
95
153
  };
96
154
  const cancelVideoOp: Op = {
97
155
  id: "renderCancelVideo",
@@ -115,7 +173,7 @@ const unshareVideoOp: Op = {
115
173
  method: "DELETE",
116
174
  path: "/v1/render/videos/{video_id}/share",
117
175
  params: ["video_id"],
118
- timeoutMs: 10000,
176
+ timeoutMs: 15000,
119
177
  scope: "render:write",
120
178
  };
121
179
  const shareVideoOp: Op = {
@@ -124,7 +182,7 @@ const shareVideoOp: Op = {
124
182
  path: "/v1/render/videos/{video_id}/share",
125
183
  params: ["video_id"],
126
184
  body: "json",
127
- timeoutMs: 10000,
185
+ timeoutMs: 15000,
128
186
  scope: "render:write",
129
187
  };
130
188
  const getVideoTimelineOp: Op = {
@@ -161,9 +219,16 @@ const restyleVideoOp: Op = {
161
219
 
162
220
  /** Descriptors of every render operation, keyed by method name (for tooling and custom clients). */
163
221
  export const renderOps = {
222
+ listAliases: listAliasesOp,
223
+ deleteAlias: deleteAliasOp,
224
+ getAlias: getAliasOp,
225
+ putAlias: putAliasOp,
226
+ unshareAlias: unshareAliasOp,
227
+ shareAlias: shareAliasOp,
164
228
  getArtifact: getArtifactOp,
165
229
  listBackgrounds: listBackgroundsOp,
166
230
  listBackgroundPacks: listBackgroundPacksOp,
231
+ createInspection: createInspectionOp,
167
232
  listPresets: listPresetsOp,
168
233
  listScreenshots: listScreenshotsOp,
169
234
  createScreenshot: createScreenshotOp,
@@ -183,6 +248,94 @@ export const renderOps = {
183
248
 
184
249
  /** Styled screenshots and product videos (`/v1/render`). */
185
250
  export class RenderAPI extends Namespace {
251
+ /**
252
+ * List aliases
253
+ *
254
+ * Lists the project's aliases, by name. An alias names a recording (`onboarding`, `billing-tour`): it points at
255
+ * the newest succeeded video tagged with it, so a share of the alias always plays the latest re-record with no
256
+ * change to the embed.
257
+ *
258
+ * `GET /v1/render/aliases` · scope `render:read` · served by the node
259
+ */
260
+ listAliases(
261
+ params?: T.RenderListAliasesParams,
262
+ options?: RequestOptions,
263
+ ): ListPromise<T.VideoAliasList, T.VideoAlias> {
264
+ return this._client._list<T.VideoAliasList, T.VideoAlias>(listAliasesOp, { query: params }, options);
265
+ }
266
+
267
+ /**
268
+ * Delete an alias
269
+ *
270
+ * Stops the alias's share (as `DELETE /v1/render/aliases/{alias}/share` does: 503 and nothing changed when
271
+ * storage cannot be reached), releases the video it pointed at to the normal retention (it expires 24 hours
272
+ * from now, or at its own expiry when that is later) and removes the alias. The tagged videos stay.
273
+ *
274
+ * `DELETE /v1/render/aliases/{alias}` · scope `render:write` · served by the node
275
+ */
276
+ deleteAlias(alias: string, options?: RequestOptions): APIPromise<T.Deleted> {
277
+ return this._client._call<T.Deleted>(deleteAliasOp, { path: [alias] }, options);
278
+ }
279
+
280
+ /**
281
+ * Get an alias
282
+ *
283
+ * The alias, the video it points at, its newest 20 tagged videos and its share.
284
+ *
285
+ * `GET /v1/render/aliases/{alias}` · scope `render:read` · served by the node
286
+ */
287
+ getAlias(alias: string, options?: RequestOptions): APIPromise<T.VideoAlias> {
288
+ return this._client._call<T.VideoAlias>(getAliasOp, { path: [alias] }, options);
289
+ }
290
+
291
+ /**
292
+ * Point or pin an alias
293
+ *
294
+ * Makes the alias (201) or changes it (200). `video_id` points it at a video tagged with it that has not
295
+ * expired, and pins it there (`follow: false`): re-records no longer move it, which is how to roll an embed
296
+ * back. `follow: true` makes it follow again and moves it to the newest succeeded tagged video at once (while
297
+ * the alias has a share, not to one recorded with `source.profile`: only `video_id` puts that on a share). A
298
+ * video not tagged with the alias is refused with 409 `conflict`: restyle it with `alias: <name>` to add it
299
+ * (its files then go to the alias's storage). The video an alias points at is kept past the 7-day retention;
300
+ * the one it leaves is kept 24 hours more, and its versioned file URLs keep working for an hour.
301
+ *
302
+ * `PUT /v1/render/aliases/{alias}` · scope `render:write` · served by the node
303
+ */
304
+ putAlias(alias: string, body: T.VideoAliasPutRequest, options?: RequestOptions): APIPromise<T.VideoAlias> {
305
+ return this._client._call<T.VideoAlias>(putAliasOp, { path: [alias], body }, options);
306
+ }
307
+
308
+ /**
309
+ * Stop sharing an alias
310
+ *
311
+ * Stops the alias's share, the same way as stopping a video's share: the answer comes once storage confirmed
312
+ * it, the next request to the page, its files or its oEmbed answer answers 404, caches keep a copy for at most
313
+ * 60 seconds, and 503 `product_unavailable` leaves it live. Stopping a share that does not exist succeeds.
314
+ *
315
+ * `DELETE /v1/render/aliases/{alias}/share` · scope `render:write` · served by the node
316
+ */
317
+ unshareAlias(alias: string, options?: RequestOptions): APIPromise<T.Deleted> {
318
+ return this._client._call<T.Deleted>(unshareAliasOp, { path: [alias] }, options);
319
+ }
320
+
321
+ /**
322
+ * Share an alias
323
+ *
324
+ * Makes a public share of the alias: the same page, files and oEmbed answer as a video's share, but they play
325
+ * the video the alias points at, so an embed shows the newest re-record with no change to its HTML. Its stable
326
+ * URLs (`url`, `media`) change bytes when the alias moves; the page names the files of one version, so a
327
+ * player that loaded it before the move keeps playing that video. The share lasts while the alias exists
328
+ * (`expires_at: null`). Sharing again returns the live share (200). Answers 409 `conflict` while the alias
329
+ * points at no video or its video's MP4 does not reach storage (files are served from storage only; while a
330
+ * re-record's files upload, the page plays the video the alias left), 403 `share_blocked` when B3 took its
331
+ * share down, and 503 `product_unavailable` without object storage.
332
+ *
333
+ * `POST /v1/render/aliases/{alias}/share` · scope `render:write` · served by the node
334
+ */
335
+ shareAlias(alias: string, body?: T.VideoShareRequest, options?: RequestOptions): APIPromise<T.VideoShare> {
336
+ return this._client._call<T.VideoShare>(shareAliasOp, { path: [alias], body }, options);
337
+ }
338
+
186
339
  /**
187
340
  * Get an artifact
188
341
  *
@@ -243,6 +396,43 @@ export class RenderAPI extends Namespace {
243
396
  return this._client._call<T.RenderBackgroundPackList>(listBackgroundPacksOp, {}, options);
244
397
  }
245
398
 
399
+ /**
400
+ * Inspect a page or a video
401
+ *
402
+ * Records a short window frame by frame and reports what changed from each frame to the next. With `url`, it
403
+ * loads the page in a browser at device scale 1, runs `steps` on a virtual clock and takes every frame of
404
+ * `duration_ms` at `fps` (at most 300 frames). With `video_id`, it reads the same window from a finished video
405
+ * of this project. It answers in one call: up to 8 `summary` lines, the change `report` (changed regions,
406
+ * layout shifts, flashes, cuts, scroll stalls), a `trace` of each `watch` target's box over time, and one
407
+ * contact sheet (`sheet`, WebP, at most 1568x1176 px) with up to 12 timestamped frames and before/after crops
408
+ * of the two main changes. Nothing is drawn over the page's pixels except outlines of the changed regions.
409
+ *
410
+ * Positions are CSS px for a page and video px for a video (`window.units`); times are ms from the start of
411
+ * the page's clock, or of the video. Page time is virtual: it holds while code, data, style and font requests
412
+ * are in flight, so network waits never show as page time (`report.network` says how long it held). Web
413
+ * workers and other wall-clock work run in real time against it. Unlike a video's capture, banners are left
414
+ * in place, lazy content is not loaded ahead and client-side routes are not run ahead of the clock. The window
415
+ * starts after the page's `load` event, its images, a short network quiet and 1 s of page time, so how the page
416
+ * loaded is not in it: to see a change, make it with `steps` (a click, or a `navigate`).
417
+ *
418
+ * The browser, the page's load and the capture must fit in about a minute: a load or a step that waits past
419
+ * that answers 504 `job_timed_out`.
420
+ *
421
+ * A video source drops shifts and flashes while the video's camera moves, reports the camera's planned cuts
422
+ * as `camera_cut`, and leaves the caption rows out (`report.masked`). `steps`, `watch`, `viewport` and `theme`
423
+ * are for `url` only.
424
+ *
425
+ * The sheet is an artifact kept for 24 hours; the inspection itself is not stored (there is no GET for it).
426
+ * `sheet.tokens` is what the sheet costs a vision model that reads 28 px patches: ceil(width / 28) x
427
+ * ceil(height / 28), at most 2352. Bills `render.inspection_s`, one per second of window rounded up, once the
428
+ * sheet is saved; an error bills nothing.
429
+ *
430
+ * `POST /v1/render/inspections` · scope `render:run` · served by the node
431
+ */
432
+ createInspection(body: T.InspectionCreateRequest, options?: RequestOptions): APIPromise<T.Inspection> {
433
+ return this._client._call<T.Inspection>(createInspectionOp, { body }, options);
434
+ }
435
+
246
436
  /**
247
437
  * List style presets
248
438
  *
@@ -374,6 +564,27 @@ export class RenderAPI extends Namespace {
374
564
  * nothing is billed. A recording made with a
375
565
  * profile is reused (`recording.reuse`) only by videos with the same revision of the same profile.
376
566
  *
567
+ * `goal` instead of `beats` says what the video should show and lets the node plan the steps: the job's first
568
+ * phase, `draft`, reads the start page with a vision scrape (as the caller), asks the node's chat model for
569
+ * beats whose steps can only click, hover or type into controls that page listed, runs those steps once in a
570
+ * second scrape to check them, and asks once more for the rest of the goal when they revealed new controls. At most 2 vision pages, 2 model answers and 6 beats, within the
571
+ * `render.goal.plan_s` limit (90 s). The drafted beats are the video's script from then on (`goal.beats`, the
572
+ * `video.drafted` event); send them back as `beats` to record the same steps again. Planning needs `vision:run`
573
+ * and `infer:run` in the key's scopes (403 `forbidden` before the job exists otherwise). When it fails, the job
574
+ * fails with `goal_unplanned` and its `reason`, and no `render.video_s` is billed; the vision pages and model
575
+ * tokens planning used are billed by those operations (`vision.page`, `infer.input_tokens`,
576
+ * `infer.output_tokens`), whether or not it succeeds. A goal is planned on public pages only: with
577
+ * `source.profile` it is refused with 422 `script_invalid` at `/source/profile` before the job exists, since the
578
+ * check runs the drafted steps on the page before anyone sees them; send `beats` for a signed-in page.
579
+ *
580
+ * `alias` tags the video with a name of the project, such as `onboarding`, and makes the alias if it does not
581
+ * exist: when the video succeeds the alias points at it (it never moves back to an older video), and a share
582
+ * of the alias (`POST /v1/render/aliases/{alias}/share`) plays it. While an alias points at a video, the video
583
+ * is kept past the 7-day retention (`expires_at: null`, `kept_by_alias`). A tag can change what a live share
584
+ * plays, so `alias` needs `render:write` besides `render:run` (403 `forbidden`, reason `scope`, otherwise). A
585
+ * video recorded with `source.profile` never moves an alias that has a share: the alias stays where it is,
586
+ * `result.warnings` says `alias_signed_in`, and `PUT /v1/render/aliases/{alias}` with `video_id` moves it.
587
+ *
377
588
  * `POST /v1/render/videos` · scope `render:run` · served by the node
378
589
  */
379
590
  createVideo(body: T.VideoCreateRequest, options?: RequestOptions): JobPromise<T.Video, T.VideoEvent> {
@@ -383,7 +594,9 @@ export class RenderAPI extends Namespace {
383
594
  /**
384
595
  * Delete a video
385
596
  *
386
- * Cancels the job if it is still running, then deletes the video, its artifacts, its share page and its archived capture.
597
+ * Cancels the job if it is still running, then deletes the video, its artifacts, its share and its archived
598
+ * capture. When an alias points at the video, the alias moves to the newest other succeeded video tagged with
599
+ * it that has not expired, or to none (its share page then answers 404 until a new video succeeds).
387
600
  *
388
601
  * `DELETE /v1/render/videos/{video_id}` · scope `render:write` · served by the node
389
602
  */
@@ -396,7 +609,15 @@ export class RenderAPI extends Namespace {
396
609
  *
397
610
  * Returns the video job; once it succeeded, `result.artifacts` lists its files with fresh signed URLs.
398
611
  *
399
- * `GET /v1/render/videos/{video_id}` · scope `render:read` · served by the node
612
+ * Needs `render:read`, or `render:run` when the caller created the video (node release 1119): the creating
613
+ * sandbox for a video a sandbox made, the creating key for one a key made, so a service that may only record
614
+ * videos can wait for its own. A fork is a new sandbox, so it reads the videos its parent made only with
615
+ * `render:read`. A `render:run` caller that did not create the video gets the `404 video_not_found` an unknown
616
+ * id gets; a credential with neither scope gets `403 forbidden` (`reason: scope`, `required_scope:
617
+ * render:read`). A video created before the release, or by a credential with neither a sandbox nor a key (a
618
+ * dashboard session), has no recorded creator: only `render:read` reads it.
619
+ *
620
+ * `GET /v1/render/videos/{video_id}` · scope `authenticated` · served by the node
400
621
  */
401
622
  getVideo(videoId: string, options?: RequestOptions): APIPromise<T.Video> {
402
623
  return this._client._call<T.Video>(getVideoOp, { path: [videoId] }, options);
@@ -406,7 +627,9 @@ export class RenderAPI extends Namespace {
406
627
  * Cancel a video
407
628
  *
408
629
  * 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.
630
+ * when a video succeeds. A video that already finished answers 409. Since node release 1119 the caller must
631
+ * be able to read the video: its creator, or a credential with `render:read`; anyone else gets the
632
+ * `404 video_not_found` an unknown id gets.
410
633
  *
411
634
  * `POST /v1/render/videos/{video_id}/cancel` · scope `render:run` · served by the node
412
635
  */
@@ -417,9 +640,10 @@ export class RenderAPI extends Namespace {
417
640
  /**
418
641
  * Stream a video's events
419
642
  *
420
- * Server-sent events for the video job: lifecycle events, `video.phase` as the job moves through voice, plan,
421
- * capture, compose, encode and upload, and `video.artifact` as each file becomes available. Ends after the
422
- * terminal event; reconnect with `Last-Event-ID` to resume.
643
+ * Server-sent events for the video job: lifecycle events, `video.phase` as the job moves through draft (a
644
+ * video made from a `goal`), voice, plan, capture, compose, encode and upload, `video.drafted` once a goal's
645
+ * beats are planned, and `video.artifact` as each file becomes available. Ends after the terminal event;
646
+ * reconnect with `Last-Event-ID` to resume.
423
647
  *
424
648
  * `GET /v1/render/videos/{video_id}/events` · scope `render:read` · served by the node
425
649
  */
@@ -436,7 +660,20 @@ export class RenderAPI extends Namespace {
436
660
  * Starts a job that re-composes the source video's archived raw capture with a new style, captions, output
437
661
  * size or formats. No browser runs and narration is reused, so it takes seconds. Camera moves are not
438
662
  * changed. The result is a new video (`restyled_from` names the source). The raw capture is kept as long as
439
- * the source video (7 days).
663
+ * the source video (7 days, or while an alias keeps it).
664
+ *
665
+ * A restyle does not inherit its source's alias, so trying styles never moves a live embed. Give `alias` to
666
+ * tag the new video with one: when it succeeds the alias points at it, in seconds and without a browser. That
667
+ * is also how a video made without an alias joins one. `alias` needs `render:write` besides `render:run` (403
668
+ * `forbidden`, reason `scope`, otherwise). A restyle of a video recorded with `source.profile` keeps its
669
+ * `source.profile`, and so never moves an alias that has a share (`alias_signed_in`).
670
+ *
671
+ * Since node release 1119 the caller must be able to read the source: its creator, or a credential with
672
+ * `render:read`; anyone else gets the `404 video_not_found` an unknown id gets. The new video's creator is the
673
+ * caller, who reads it with `render:run`.
674
+ *
675
+ * A video B3 took down is not restyled while the takedown stands (403 `share_blocked`): the node asks B3OS's
676
+ * storage first, and answers 503 `product_unavailable` with `Retry-After` when it cannot.
440
677
  *
441
678
  * `POST /v1/render/videos/{video_id}/restyle` · scope `render:run` · served by the node
442
679
  */
@@ -451,9 +688,11 @@ export class RenderAPI extends Namespace {
451
688
  /**
452
689
  * Stop sharing a video
453
690
  *
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.
691
+ * Stops the video's share. The answer comes once B3OS's storage confirmed the share is gone: from then on its
692
+ * page, its files and its oEmbed answer answer 404 at once, and a browser or shared cache keeps a copy for at
693
+ * most 60 seconds. When storage cannot be reached the share stays live and the call answers 503
694
+ * `product_unavailable` with `Retry-After`; call it again. The video stays. Stopping a share that does not
695
+ * exist succeeds.
457
696
  *
458
697
  * `DELETE /v1/render/videos/{video_id}/share` · scope `render:write` · served by the node
459
698
  */
@@ -464,17 +703,31 @@ export class RenderAPI extends Namespace {
464
703
  /**
465
704
  * Share a video
466
705
  *
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.
706
+ * Makes a public share of a finished video: a page at `https://usercontent.b3os.org/s/<share id>` that plays
707
+ * the MP4 with its poster, captions and chapters, carries Open Graph tags and a JSON-LD `VideoObject` for link
708
+ * previews, is its own iframe embed (`embed_html`), and answers oEmbed (`oembed_url`). `media` gives stable
709
+ * URLs of the files for a README image or a `<video>` written by hand (`…/video.gif`, `…/poster.jpg`,
710
+ * `…/video.mp4`). The share ID is 128 random bits: the URL is the only key, and the page is `noindex`. No
711
+ * script runs on the page (`Content-Security-Policy: sandbox`, which allows only popups, so its footer links
712
+ * open).
713
+ *
714
+ * A video's share lasts as long as the video (7 days by default); to keep a demo past that, share an alias
715
+ * instead (`POST /v1/render/aliases/{alias}/share`). Sharing again returns the live share (200); a new one
716
+ * answers 201. Videos are never public until shared: a video recorded with a profile shows signed-in pages,
717
+ * so share it only if those pages may be public.
718
+ *
719
+ * Stopping the share (`DELETE`) or deleting the video takes the page, its files and its oEmbed answer down for
720
+ * every viewer: the next request answers 404, and a browser or shared cache keeps a copy for at most 60
721
+ * seconds. Bytes a player already downloaded, and copies other services made of public URLs (link previews,
722
+ * an image proxy for a README), are out of reach. Answers 503 `product_unavailable` when the node has no
723
+ * object storage to publish to (`[render.upload] kind = "none"`), and 403 `share_blocked` when B3 took the
724
+ * video's share down.
725
+ *
726
+ * A share's files come from B3OS's storage only, never from the node that recorded the video. A file that is
727
+ * still uploading (seconds after the video succeeded) answers 404 at its share URLs until it lands; a file
728
+ * that will never reach storage (larger than the node uploads: 100 MiB, or what its upload pace sends in 60
729
+ * seconds, 75 MB by default; or its upload was given up) is left out of the share. A video whose MP4 is such a
730
+ * file is refused with 409 `conflict`, whose `detail` says why.
478
731
  *
479
732
  * `POST /v1/render/videos/{video_id}/share` · scope `render:write` · served by the node
480
733
  */
@@ -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, source, connection kind, sandbox and trace. Every source
34
+ * kind, filterable by product, operation, status, key, source, connection kind, sandbox, trace and pack (the
35
+ * records whose `action` ran one of that pack's actions: a sandbox's tool calls over MCP and its
36
+ * `POST /v1/actions/call` calls). Every source
35
37
  * is listed unless `source` narrows it (the dashboard's Requests page leaves `dashboard` out until you show it).
36
38
  * Requests the edge answered
37
39
  * without forwarding them (edge-served operations, or requests refused before forwarding) are not listed; get
@@ -290,7 +290,8 @@ export class RoutinesAPI extends Namespace {
290
290
  * Events are not buffered: a step that starts waiting after the event does not see it, and an event no step
291
291
  * waits for answers `delivered: 0`. Runs of other projects never see your events. Each step journals the
292
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.
293
+ * that it is refused whole with `event_fan_out_too_large` and no step continues. An event sent from inside a
294
+ * sandbox whose grant has an actions rule resumes only runs within that rule (ones such a sandbox started).
294
295
  *
295
296
  * `POST /v1/routines/events` · scope `routines:run` · served by the node
296
297
  */
@@ -387,7 +388,8 @@ export class RoutinesAPI extends Namespace {
387
388
  * `run_not_waiting` when the run already finished or the buffer for this name is full. The payload counts
388
389
  * against the organization's run data on the node (`max_org_run_bytes`): one that does not fit answers 429
389
390
  * `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.
391
+ * ends a wait, so a run can always be let go. From inside a sandbox whose grant has an actions rule, only a run
392
+ * within that rule (one such a sandbox started) takes the signal; any other answers `403 action_not_allowed`.
391
393
  *
392
394
  * `POST /v1/routines/runs/{run_id}/signal` · scope `routines:run` · served by the node
393
395
  */
@@ -609,8 +611,9 @@ export class RoutinesAPI extends Namespace {
609
611
  *
610
612
  * Starts a run of the active version (or `version`) with `input`, validated against the routine's `inputs`
611
613
  * schema. Use `?wait=` for tool-call style use (an `ephemeral` run that finishes within the wait never touches
612
- * the journal), `Accept: text/event-stream` to follow steps live, or `webhook`. Effect steps without a product
613
- * meter of their own bill `routines.effect_step`; product steps bill their product's unit.
614
+ * the journal), `Accept: text/event-stream` to follow steps live, or `webhook`. Only `core/http@1`, `wait` and
615
+ * `sleep_ms` steps bill `routines.effect_step`, one for each such step that ends (a skipped one bills nothing);
616
+ * a product step bills its product's unit, a pack step `actions.call`, and other steps bill nothing.
614
617
  *
615
618
  * Once an `ephemeral` run ends, only its summary is stored: status, timing, `input`, `result`, `error` and its
616
619
  * IDs, without its step history. The `?wait=` answer, the event stream and the webhook carry its steps as it
@@ -628,6 +631,10 @@ export class RoutinesAPI extends Namespace {
628
631
  * sandbox and then waits a long time pauses that sandbox until its next exec there (or until the run ends),
629
632
  * unless another run on the node execs in it too.
630
633
  *
634
+ * A run started from inside a sandbox whose grant has an actions rule (`api.actions.allow`) acts as the
635
+ * routine's publisher within that rule: a pack step outside it fails with `action_not_allowed`, and a
636
+ * sub-routine inherits the rule. The rule is kept with the run, across restarts.
637
+ *
631
638
  * `POST /v1/routines/{routine}/runs` · scope `routines:run` · served by the node
632
639
  */
633
640
  createRun(