@b3os/sdk 0.0.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -42
- package/dist/cjs/core/bytes.d.ts +30 -0
- package/dist/cjs/core/bytes.js +115 -0
- package/dist/cjs/core/bytes.js.map +1 -0
- package/dist/cjs/core/client.d.ts +61 -3
- package/dist/cjs/core/client.js +211 -33
- package/dist/cjs/core/client.js.map +1 -1
- package/dist/cjs/core/errors.d.ts +16 -4
- package/dist/cjs/core/errors.js +9 -6
- package/dist/cjs/core/errors.js.map +1 -1
- package/dist/cjs/core/handle.d.ts +31 -0
- package/dist/cjs/core/handle.js +86 -0
- package/dist/cjs/core/handle.js.map +1 -0
- package/dist/cjs/core/index.d.ts +6 -4
- package/dist/cjs/core/index.js +8 -1
- package/dist/cjs/core/index.js.map +1 -1
- package/dist/cjs/core/login.d.ts +24 -0
- package/dist/cjs/core/login.js +93 -0
- package/dist/cjs/core/login.js.map +1 -0
- package/dist/cjs/core/namespace.d.ts +1 -1
- package/dist/cjs/core/namespace.js +1 -1
- package/dist/cjs/core/op.d.ts +11 -1
- package/dist/cjs/core/timing.d.ts +1 -1
- package/dist/cjs/core/timing.js +8 -1
- package/dist/cjs/core/timing.js.map +1 -1
- package/dist/cjs/core/transport.js +1 -1
- package/dist/cjs/core/transport.js.map +1 -1
- package/dist/cjs/core/util.d.ts +15 -3
- package/dist/cjs/core/util.js +54 -2
- package/dist/cjs/core/util.js.map +1 -1
- package/dist/cjs/core/ws.d.ts +4 -0
- package/dist/cjs/core/ws.js +7 -4
- package/dist/cjs/core/ws.js.map +1 -1
- package/dist/cjs/generated/client.d.ts +2 -2
- package/dist/cjs/generated/client.js +2 -2
- package/dist/cjs/generated/errors.d.ts +1 -1
- package/dist/cjs/generated/errors.js +30 -0
- package/dist/cjs/generated/errors.js.map +1 -1
- package/dist/cjs/generated/jobs.js +1 -1
- package/dist/cjs/generated/ns/actions.d.ts +48 -6
- package/dist/cjs/generated/ns/actions.js +59 -6
- package/dist/cjs/generated/ns/actions.js.map +1 -1
- package/dist/cjs/generated/ns/infer.d.ts +185 -54
- package/dist/cjs/generated/ns/infer.js +28 -74
- package/dist/cjs/generated/ns/infer.js.map +1 -1
- package/dist/cjs/generated/ns/keys.d.ts +12 -0
- package/dist/cjs/generated/ns/keys.js +22 -0
- package/dist/cjs/generated/ns/keys.js.map +1 -1
- package/dist/cjs/generated/ns/render.d.ts +95 -6
- package/dist/cjs/generated/ns/render.js +124 -7
- package/dist/cjs/generated/ns/render.js.map +1 -1
- package/dist/cjs/generated/ns/requests.d.ts +3 -1
- package/dist/cjs/generated/ns/requests.js +3 -1
- package/dist/cjs/generated/ns/requests.js.map +1 -1
- package/dist/cjs/generated/ns/routines.d.ts +131 -9
- package/dist/cjs/generated/ns/routines.js +186 -9
- package/dist/cjs/generated/ns/routines.js.map +1 -1
- package/dist/cjs/generated/ns/sandboxes.d.ts +298 -31
- package/dist/cjs/generated/ns/sandboxes.js +368 -29
- package/dist/cjs/generated/ns/sandboxes.js.map +1 -1
- package/dist/cjs/generated/ns/vision.d.ts +133 -14
- package/dist/cjs/generated/ns/vision.js +158 -12
- package/dist/cjs/generated/ns/vision.js.map +1 -1
- package/dist/cjs/generated/ns/webhooks.d.ts +8 -5
- package/dist/cjs/generated/ns/webhooks.js +8 -5
- package/dist/cjs/generated/ns/webhooks.js.map +1 -1
- package/dist/cjs/generated/types.d.ts +1956 -301
- package/dist/cjs/helpers/agents.d.ts +95 -0
- package/dist/cjs/helpers/agents.js +205 -0
- package/dist/cjs/helpers/agents.js.map +1 -0
- package/dist/cjs/helpers/render.d.ts +15 -0
- package/dist/cjs/helpers/render.js +74 -0
- package/dist/cjs/helpers/render.js.map +1 -0
- package/dist/cjs/helpers/routines.d.ts +61 -0
- package/dist/cjs/helpers/routines.js +234 -0
- package/dist/cjs/helpers/routines.js.map +1 -0
- package/dist/cjs/helpers/sandboxes.d.ts +237 -0
- package/dist/cjs/helpers/sandboxes.js +608 -0
- package/dist/cjs/helpers/sandboxes.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -1
- package/dist/cjs/index.js +8 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/routines.d.ts +1 -0
- package/dist/cjs/routines.js +21 -0
- package/dist/cjs/routines.js.map +1 -0
- package/dist/cjs/webhooks.js.map +1 -1
- package/dist/esm/core/bytes.d.ts +30 -0
- package/dist/esm/core/bytes.js +111 -0
- package/dist/esm/core/bytes.js.map +1 -0
- package/dist/esm/core/client.d.ts +61 -3
- package/dist/esm/core/client.js +208 -31
- package/dist/esm/core/client.js.map +1 -1
- package/dist/esm/core/errors.d.ts +16 -4
- package/dist/esm/core/errors.js +9 -6
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/handle.d.ts +31 -0
- package/dist/esm/core/handle.js +82 -0
- package/dist/esm/core/handle.js.map +1 -0
- package/dist/esm/core/index.d.ts +6 -4
- package/dist/esm/core/index.js +4 -2
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/core/login.d.ts +24 -0
- package/dist/esm/core/login.js +85 -0
- package/dist/esm/core/login.js.map +1 -0
- package/dist/esm/core/namespace.d.ts +1 -1
- package/dist/esm/core/namespace.js +1 -1
- package/dist/esm/core/op.d.ts +11 -1
- package/dist/esm/core/timing.d.ts +1 -1
- package/dist/esm/core/timing.js +8 -1
- package/dist/esm/core/timing.js.map +1 -1
- package/dist/esm/core/transport.js +1 -1
- package/dist/esm/core/transport.js.map +1 -1
- package/dist/esm/core/util.d.ts +15 -3
- package/dist/esm/core/util.js +48 -1
- package/dist/esm/core/util.js.map +1 -1
- package/dist/esm/core/ws.d.ts +4 -0
- package/dist/esm/core/ws.js +7 -4
- package/dist/esm/core/ws.js.map +1 -1
- package/dist/esm/generated/client.d.ts +2 -2
- package/dist/esm/generated/client.js +2 -2
- package/dist/esm/generated/errors.d.ts +1 -1
- package/dist/esm/generated/errors.js +30 -0
- package/dist/esm/generated/errors.js.map +1 -1
- package/dist/esm/generated/jobs.js +1 -1
- package/dist/esm/generated/ns/actions.d.ts +48 -6
- package/dist/esm/generated/ns/actions.js +59 -6
- package/dist/esm/generated/ns/actions.js.map +1 -1
- package/dist/esm/generated/ns/infer.d.ts +185 -54
- package/dist/esm/generated/ns/infer.js +28 -74
- package/dist/esm/generated/ns/infer.js.map +1 -1
- package/dist/esm/generated/ns/keys.d.ts +12 -0
- package/dist/esm/generated/ns/keys.js +22 -0
- package/dist/esm/generated/ns/keys.js.map +1 -1
- package/dist/esm/generated/ns/render.d.ts +95 -6
- package/dist/esm/generated/ns/render.js +124 -7
- package/dist/esm/generated/ns/render.js.map +1 -1
- package/dist/esm/generated/ns/requests.d.ts +3 -1
- package/dist/esm/generated/ns/requests.js +3 -1
- package/dist/esm/generated/ns/requests.js.map +1 -1
- package/dist/esm/generated/ns/routines.d.ts +131 -9
- package/dist/esm/generated/ns/routines.js +186 -9
- package/dist/esm/generated/ns/routines.js.map +1 -1
- package/dist/esm/generated/ns/sandboxes.d.ts +298 -31
- package/dist/esm/generated/ns/sandboxes.js +368 -29
- package/dist/esm/generated/ns/sandboxes.js.map +1 -1
- package/dist/esm/generated/ns/vision.d.ts +133 -14
- package/dist/esm/generated/ns/vision.js +158 -12
- package/dist/esm/generated/ns/vision.js.map +1 -1
- package/dist/esm/generated/ns/webhooks.d.ts +8 -5
- package/dist/esm/generated/ns/webhooks.js +8 -5
- package/dist/esm/generated/ns/webhooks.js.map +1 -1
- package/dist/esm/generated/types.d.ts +1956 -301
- package/dist/esm/helpers/agents.d.ts +95 -0
- package/dist/esm/helpers/agents.js +199 -0
- package/dist/esm/helpers/agents.js.map +1 -0
- package/dist/esm/helpers/render.d.ts +15 -0
- package/dist/esm/helpers/render.js +70 -0
- package/dist/esm/helpers/render.js.map +1 -0
- package/dist/esm/helpers/routines.d.ts +61 -0
- package/dist/esm/helpers/routines.js +226 -0
- package/dist/esm/helpers/routines.js.map +1 -0
- package/dist/esm/helpers/sandboxes.d.ts +237 -0
- package/dist/esm/helpers/sandboxes.js +600 -0
- package/dist/esm/helpers/sandboxes.js.map +1 -0
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.js +6 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routines.d.ts +1 -0
- package/dist/esm/routines.js +5 -0
- package/dist/esm/routines.js.map +1 -0
- package/dist/esm/webhooks.js.map +1 -1
- package/package.json +18 -7
- package/src/core/bytes.ts +112 -0
- package/src/core/client.ts +253 -33
- package/src/core/errors.ts +27 -10
- package/src/core/handle.ts +97 -0
- package/src/core/index.ts +7 -2
- package/src/core/login.ts +98 -0
- package/src/core/namespace.ts +1 -1
- package/src/core/op.ts +11 -1
- package/src/core/timing.ts +7 -2
- package/src/core/transport.ts +1 -1
- package/src/core/util.ts +53 -3
- package/src/core/ws.ts +11 -4
- package/src/generated/client.ts +2 -2
- package/src/generated/errors.ts +60 -0
- package/src/generated/jobs.ts +1 -1
- package/src/generated/ns/actions.ts +69 -6
- package/src/generated/ns/infer.ts +229 -61
- package/src/generated/ns/keys.ts +23 -0
- package/src/generated/ns/render.ts +152 -7
- package/src/generated/ns/requests.ts +3 -1
- package/src/generated/ns/routines.ts +205 -9
- package/src/generated/ns/sandboxes.ts +434 -34
- package/src/generated/ns/vision.ts +168 -14
- package/src/generated/ns/webhooks.ts +8 -5
- package/src/generated/types.ts +2211 -422
- package/src/helpers/agents.ts +300 -0
- package/src/helpers/render.ts +91 -0
- package/src/helpers/routines.ts +278 -0
- package/src/helpers/sandboxes.ts +788 -0
- package/src/index.ts +29 -5
- package/src/routines.ts +5 -0
- package/src/webhooks.ts +5 -1
|
@@ -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: "
|
|
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,59 @@ 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 the `auto` background preset picks from.
|
|
208
|
+
* - `image`: a lossless WebP from ScreenFramed's curated library (decisions T9 and T10: Sean's grants as owner
|
|
209
|
+
* of the library), up to 3840 px on the long edge, with its measured tone in `image` (theme, luminance, hue,
|
|
210
|
+
* detail; how `"auto"` matches a page). `image.coverage` is `full-bleed` for backgrounds; the `gradients`
|
|
211
|
+
* group holds transparent shapes (`cutout`) drawn over a matte.
|
|
212
|
+
*
|
|
213
|
+
* Rows are in `ref` order, paged by `limit` and `cursor`. A ref whose bytes equal an earlier one's still
|
|
214
|
+
* resolves but is not listed. Public: no API key, rate limited per client address, and answered from the
|
|
215
|
+
* edge's cache for up to 5 minutes.
|
|
216
|
+
*
|
|
217
|
+
* `GET /v1/render/backgrounds` · scope `public` · served by the node
|
|
218
|
+
*/
|
|
219
|
+
listBackgrounds(
|
|
220
|
+
params?: T.RenderListBackgroundsParams,
|
|
221
|
+
options?: RequestOptions,
|
|
222
|
+
): ListPromise<T.RenderBackgroundList, T.RenderBackground> {
|
|
223
|
+
return this._client._list<T.RenderBackgroundList, T.RenderBackground>(
|
|
224
|
+
listBackgroundsOp,
|
|
225
|
+
{ query: params },
|
|
226
|
+
options,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* List library background packs
|
|
232
|
+
*
|
|
233
|
+
* Lists the packs of the background library with their license, notice, source, entry count and a cover
|
|
234
|
+
* thumbnail: the CSS packs first, then the image packs by look (`quiet`, `bold`, `soft-photo`, `texture`,
|
|
235
|
+
* `scenic`, `loud`, `cutout`) and size. `auto` says whether `background_ref: "auto"` may pick from the pack.
|
|
236
|
+
* Public and edge-cached like `GET /v1/render/backgrounds`.
|
|
237
|
+
*
|
|
238
|
+
* `GET /v1/render/backgrounds/packs` · scope `public` · served by the node
|
|
239
|
+
*/
|
|
240
|
+
listBackgroundPacks(options?: RequestOptions): APIPromise<T.RenderBackgroundPackList> {
|
|
241
|
+
return this._client._call<T.RenderBackgroundPackList>(listBackgroundPacksOp, {}, options);
|
|
242
|
+
}
|
|
243
|
+
|
|
163
244
|
/**
|
|
164
245
|
* List style presets
|
|
165
246
|
*
|
|
166
|
-
* Lists the style presets `style` can name (backgrounds, window frames, cursors, caption styles, click effects),
|
|
247
|
+
* Lists the style presets `style` can name (backgrounds, window frames, cursors, caption styles, click effects),
|
|
248
|
+
* with a preview image for each. Public: no API key, rate limited per client address, and answered from the
|
|
249
|
+
* edge's cache for up to 5 minutes.
|
|
167
250
|
*
|
|
168
|
-
* `GET /v1/render/presets` · scope `
|
|
251
|
+
* `GET /v1/render/presets` · scope `public` · served by the node
|
|
169
252
|
*/
|
|
170
253
|
listPresets(params?: T.RenderListPresetsParams, options?: RequestOptions): APIPromise<T.PresetList> {
|
|
171
254
|
return this._client._call<T.PresetList>(listPresetsOp, { query: params }, options);
|
|
@@ -193,6 +276,19 @@ export class RenderAPI extends Namespace {
|
|
|
193
276
|
* URLs, or the image bytes directly when `Accept` is `image/png`, `image/jpeg` or `image/webp`. `variants`
|
|
194
277
|
* adds extra encodings of the same capture. Bills one `render.screenshot` per capture plus one per variant.
|
|
195
278
|
*
|
|
279
|
+
* A page loaded from `url` is cleaned before the capture: consent walls, sign-up and app dialogs, dim layers
|
|
280
|
+
* and chat widgets are hidden (never clicked, so no consent is given), and with `block_ads` the empty slots of
|
|
281
|
+
* blocked ads collapse. The answer lists what was hidden in `overlays_removed`; `overlays: "keep"` leaves
|
|
282
|
+
* everything and says what is in view in `warnings`. A paywall or registration wall is the site's answer, not
|
|
283
|
+
* 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
|
|
284
|
+
* entrance animations, and when the capture's main area comes back blank while the page is still loading or
|
|
285
|
+
* fading in, captures again every 100 ms for up to 1.5 s (`recapture_ms` in `timing`). Render cannot tell a
|
|
286
|
+
* beacon or a request that never answers from content on its way, so a sparse page that has finished can wait
|
|
287
|
+
* 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)
|
|
288
|
+
* is taken once its first screen has painted, from 2 s on (`wait_until: "auto"`, the default). `status_code`,
|
|
289
|
+
* `final_url` and `page_state` say what the site answered, and `warnings` what a caller should know: an error
|
|
290
|
+
* status, a main area that stayed blank, a page taken before its load event, overlays or a wall left in place.
|
|
291
|
+
*
|
|
196
292
|
* `POST /v1/render/screenshots` · scope `render:run` · served by the node
|
|
197
293
|
*/
|
|
198
294
|
createScreenshot(
|
|
@@ -251,7 +347,9 @@ export class RenderAPI extends Namespace {
|
|
|
251
347
|
* Record a video
|
|
252
348
|
*
|
|
253
349
|
* Starts a job that records a scripted demo of `source.url`. Narration (`say`) is synthesized first with
|
|
254
|
-
* `/v1/infer/audio/speech
|
|
350
|
+
* `/v1/infer/audio/speech`, as the caller: it needs `infer:run` in the key's scopes too. Without it, or when
|
|
351
|
+
* speech is unavailable, the video is made silent with estimated word times and `result.narration.spoken` is
|
|
352
|
+
* 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
353
|
* camera, records segments in parallel on a virtual clock, composes at the output frame rate and encodes MP4
|
|
256
354
|
* (H.264, BT.709), GIF, poster and captions. Artifacts appear as they finish (`video.artifact` events, poster
|
|
257
355
|
* first). Bills `render.video_s` per second of output.
|
|
@@ -265,7 +363,7 @@ export class RenderAPI extends Namespace {
|
|
|
265
363
|
/**
|
|
266
364
|
* Delete a video
|
|
267
365
|
*
|
|
268
|
-
* Cancels the job if it is still running, then deletes the video, its artifacts and its archived capture.
|
|
366
|
+
* Cancels the job if it is still running, then deletes the video, its artifacts, its share page and its archived capture.
|
|
269
367
|
*
|
|
270
368
|
* `DELETE /v1/render/videos/{video_id}` · scope `render:write` · served by the node
|
|
271
369
|
*/
|
|
@@ -287,7 +385,8 @@ export class RenderAPI extends Namespace {
|
|
|
287
385
|
/**
|
|
288
386
|
* Cancel a video
|
|
289
387
|
*
|
|
290
|
-
* Stops the job
|
|
388
|
+
* Stops the job and marks the video canceled. A canceled video bills nothing: `render.video_s` is billed only
|
|
389
|
+
* when a video succeeds. A video that already finished answers 409.
|
|
291
390
|
*
|
|
292
391
|
* `POST /v1/render/videos/{video_id}/cancel` · scope `render:run` · served by the node
|
|
293
392
|
*/
|
|
@@ -329,12 +428,46 @@ export class RenderAPI extends Namespace {
|
|
|
329
428
|
return this._client._job<T.Video, T.VideoEvent>(restyleVideoOp, { path: [videoId], body }, options);
|
|
330
429
|
}
|
|
331
430
|
|
|
431
|
+
/**
|
|
432
|
+
* Stop sharing a video
|
|
433
|
+
*
|
|
434
|
+
* Deletes the video's share page; its link stops working within 60 seconds. The video stays, and so do the
|
|
435
|
+
* signed file links the page used (until the video expires); delete the video to end them. Works whether or not
|
|
436
|
+
* the `render.share_pages` flag is on.
|
|
437
|
+
*
|
|
438
|
+
* `DELETE /v1/render/videos/{video_id}/share` · scope `render:write` · served by the node
|
|
439
|
+
*/
|
|
440
|
+
unshareVideo(videoId: string, options?: RequestOptions): APIPromise<T.Deleted> {
|
|
441
|
+
return this._client._call<T.Deleted>(unshareVideoOp, { path: [videoId] }, options);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Share a video
|
|
446
|
+
*
|
|
447
|
+
* Makes a share page for a finished video: one HTML page on `usercontent.b3os.org` that plays the MP4 with its
|
|
448
|
+
* poster, captions and chapters, carries Open Graph tags for link previews, and works as an iframe embed on any
|
|
449
|
+
* site. No script runs on it (`Content-Security-Policy: sandbox`). The link is signed like every artifact URL and
|
|
450
|
+
* lasts as long as the video's MP4 (7 days by default). Sharing again returns the same page while it lasts
|
|
451
|
+
* (200); a new one answers 201.
|
|
452
|
+
*
|
|
453
|
+
* Off by default: creating a share page needs the `render.share_pages` feature flag on for your organization,
|
|
454
|
+
* and answers 404 `feature_not_enabled` without it. The page plays the video from the video's own signed file
|
|
455
|
+
* links, which stay valid until the video expires: stopping the share (or deleting the video) takes the page
|
|
456
|
+
* down within 60 seconds, but only deleting the video ends the file links a viewer or a link preview already
|
|
457
|
+
* has. There is no password option.
|
|
458
|
+
*
|
|
459
|
+
* `POST /v1/render/videos/{video_id}/share` · scope `render:write` · served by the node
|
|
460
|
+
*/
|
|
461
|
+
shareVideo(videoId: string, body?: T.VideoShareRequest, options?: RequestOptions): APIPromise<T.VideoShare> {
|
|
462
|
+
return this._client._call<T.VideoShare>(shareVideoOp, { path: [videoId], body }, options);
|
|
463
|
+
}
|
|
464
|
+
|
|
332
465
|
/**
|
|
333
466
|
* Get a video's timeline
|
|
334
467
|
*
|
|
335
468
|
* Returns the compiled timeline of a video that has finished planning: beats, narration with word timings,
|
|
336
469
|
* the timed action list the recorder replayed, cursor path, camera keyframes, captions and style
|
|
337
|
-
* (`timeline.schema.json`). `frames=
|
|
470
|
+
* (`timeline.schema.json`). `frames=true` adds the per-frame compositor state (large; for debugging).
|
|
338
471
|
*
|
|
339
472
|
* `GET /v1/render/videos/{video_id}/timeline` · scope `render:read` · served by the node
|
|
340
473
|
*/
|
|
@@ -345,4 +478,16 @@ export class RenderAPI extends Namespace {
|
|
|
345
478
|
): APIPromise<T.RenderTimeline> {
|
|
346
479
|
return this._client._call<T.RenderTimeline>(getVideoTimelineOp, { path: [videoId], query: params }, options);
|
|
347
480
|
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* An artifact's bytes (from a screenshot or video, or its URL). A client that reaches the node (its Unix socket,
|
|
484
|
+
* or a node URL inside a sandbox) reads them from the node's signed content route, so they never leave the
|
|
485
|
+
* machine; any other client fetches the usercontent URL as given.
|
|
486
|
+
*/
|
|
487
|
+
fetchArtifact(
|
|
488
|
+
artifact: Pick<T.Artifact, "url" | "content_type"> | string,
|
|
489
|
+
options?: RequestOptions,
|
|
490
|
+
): Promise<ArtifactBytes> {
|
|
491
|
+
return fetchArtifact(this._client, artifact, options);
|
|
492
|
+
}
|
|
348
493
|
}
|
|
@@ -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
|
|
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(
|