@mediaruntime/cli 1.2.0 → 1.4.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.
- package/CHANGELOG.md +28 -0
- package/README.md +247 -1
- package/dist/cli.d.ts +113 -0
- package/dist/cli.js +1079 -23
- package/dist/cli.js.map +1 -1
- package/docs/AUTH.md +8 -0
- package/docs/CLI_SDD.md +43 -0
- package/docs/STICKERS.md +98 -0
- package/docs/clipping.md +113 -0
- package/package.json +3 -3
package/docs/AUTH.md
CHANGED
|
@@ -61,6 +61,14 @@ Authenticated commands resolve credentials in this order:
|
|
|
61
61
|
No command-line API-key flag exists. No plaintext credential-file fallback exists. A
|
|
62
62
|
machine without a supported credential vault must use `MEDIARUNTIME_API_KEY`.
|
|
63
63
|
|
|
64
|
+
Hosted Sticker Runtime has one deliberately narrower exception. For collection-bound
|
|
65
|
+
`stickers packs list`, `search`, `typeahead`, `get`, and `resolve`,
|
|
66
|
+
`MEDIARUNTIME_STICKER_CLIENT_TOKEN` selects a short-lived scoped client without reading the
|
|
67
|
+
master API key or stored login. The explicit collection must match the token claim.
|
|
68
|
+
Collection management, pack binding, workspace usage, and token issuance never accept that
|
|
69
|
+
credential and continue using the normal resolution order above. See
|
|
70
|
+
[the Sticker Runtime contract](STICKERS.md) for the exact boundary.
|
|
71
|
+
|
|
64
72
|
## Security invariants
|
|
65
73
|
|
|
66
74
|
- Device codes and PKCE verifiers carry at least 256 bits of randomness.
|
package/docs/CLI_SDD.md
CHANGED
|
@@ -23,6 +23,12 @@ mediaruntime recipes get <name>
|
|
|
23
23
|
mediaruntime recipes create --file <recipe.json>
|
|
24
24
|
mediaruntime recipes version <name> --file <recipe.json> --expected <version>
|
|
25
25
|
mediaruntime recipes archive <name>
|
|
26
|
+
mediaruntime stickers collections list
|
|
27
|
+
mediaruntime stickers collections packs enable <collection_id> --pack <pack_id>
|
|
28
|
+
mediaruntime stickers search <query> --collection <collection_id>
|
|
29
|
+
mediaruntime stickers resolve <sticker_id> --variant <name> --collection <collection_id>
|
|
30
|
+
mediaruntime stickers usage
|
|
31
|
+
mediaruntime stickers token create --collection <collection_id>
|
|
26
32
|
mediaruntime jobs list
|
|
27
33
|
mediaruntime jobs get <job_id>
|
|
28
34
|
mediaruntime trigger job.completed --to http://127.0.0.1:3000/webhooks/mediaruntime
|
|
@@ -41,6 +47,11 @@ The canonical result remains one expiring ZIP bundle containing the complete out
|
|
|
41
47
|
The CLI downloads that ZIP as-is; it does not expose individual artifacts or infer an
|
|
42
48
|
engine directory layout.
|
|
43
49
|
|
|
50
|
+
Hosted Sticker Runtime commands are the other explicit asset-delivery surface. They bind
|
|
51
|
+
all reads to one application collection and use the SDK's short-lived, generation-pinned
|
|
52
|
+
sticker resolution rather than the job ZIP contract. The complete command and security
|
|
53
|
+
contract is maintained in `docs/STICKERS.md`.
|
|
54
|
+
|
|
44
55
|
## 2. Goals and non-goals
|
|
45
56
|
|
|
46
57
|
### Goals
|
|
@@ -130,6 +141,38 @@ mediaruntime run <source>
|
|
|
130
141
|
[--json]
|
|
131
142
|
```
|
|
132
143
|
|
|
144
|
+
When exactly one clipping preset is selected, `run` accepts the controls in
|
|
145
|
+
[the clipping guide](clipping.md). `video_clip_v1` requires explicit `--clip-start`
|
|
146
|
+
and `--clip-duration`; `clip_candidates_v1` accepts duration bounds, suggestion count,
|
|
147
|
+
and repeated keywords. `--clip-transcript` accepts a local JSON plan/segment array,
|
|
148
|
+
SRT, or VTT file with full-source timestamps (at most 1 MiB). Invalid attachments
|
|
149
|
+
fail before job creation. Burned captions are opt-in through `--clip-captions`, which
|
|
150
|
+
requires a transcript. Supplied transcripts bypass analysis transcription; manual
|
|
151
|
+
ranges never require Whisper. Clipping controls cannot ambiguously target multiple
|
|
152
|
+
outputs or a hosted recipe. This additive surface is available in client release 1.4.0.
|
|
153
|
+
|
|
154
|
+
When exactly one `contact_sheet_v1` preset is selected, `run` also accepts bounded
|
|
155
|
+
`--contact-columns`, `--contact-rows`, `--contact-tile-width`,
|
|
156
|
+
`--contact-tile-height`, `--contact-interval`, `--contact-start`,
|
|
157
|
+
`--contact-duration`, `--contact-max-sheets`, `--contact-format`, and
|
|
158
|
+
`--contact-quality` controls. They are rejected with recipes, mixed outputs, or any
|
|
159
|
+
other preset so the CLI cannot attach them ambiguously.
|
|
160
|
+
|
|
161
|
+
When exactly one `audiogram_v1` preset is selected, `--audiogram-artwork` is required.
|
|
162
|
+
`--audiogram-captions` is optional and explicitly enables caption burning. Layout,
|
|
163
|
+
background/waveform colours, start, duration, and frame-rate controls mirror the bounded
|
|
164
|
+
gateway contract. Artwork and captions may be HTTP(S), `gs://`, `file://`, or local
|
|
165
|
+
paths. Local secondary assets use the same authenticated signed-upload client as the
|
|
166
|
+
main source; the submitted job contains only the resulting account-scoped `gs://` URI.
|
|
167
|
+
Raw filters, font paths, and arbitrary rendering arguments are not accepted.
|
|
168
|
+
|
|
169
|
+
Privacy redaction is a Premium Preview for still-image inputs and public image presets with one or
|
|
170
|
+
more repeatable `--privacy-detector face|license_plate|text` flags. The CLI accepts only
|
|
171
|
+
the gateway's bounded style, strength, failure-mode, confidence, segmented frame-count,
|
|
172
|
+
padding, pixel-block, debug-observation, and solid-colour controls. It resolves aliases through the live capabilities document so
|
|
173
|
+
the request carries explicit output objects, rejects video, audio, animated-image, and recipe combinations
|
|
174
|
+
locally, and never accepts model paths, raw OCR retention, or arbitrary detector options.
|
|
175
|
+
|
|
133
176
|
`-o` is the short spelling of `--output`. Exactly one source and at least one output or preset are
|
|
134
177
|
required. `<source>` may be an HTTP(S) URL, `gs://` URI, local path, or `file://` URL. The
|
|
135
178
|
CLI passes it to the SDK so local inputs use the SDK's signed-upload flow.
|
package/docs/STICKERS.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Hosted Sticker Runtime CLI contract
|
|
2
|
+
|
|
3
|
+
## Authentication boundary
|
|
4
|
+
|
|
5
|
+
Sticker commands use the normal trusted credential by default: an explicit
|
|
6
|
+
`MEDIARUNTIME_API_KEY`, then the API key stored by `mediaruntime login`. There is no
|
|
7
|
+
command-line secret flag.
|
|
8
|
+
|
|
9
|
+
`MEDIARUNTIME_STICKER_CLIENT_TOKEN` is an optional short-lived credential for only these
|
|
10
|
+
collection-bound runtime reads:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
stickers packs list
|
|
14
|
+
stickers search
|
|
15
|
+
stickers typeahead
|
|
16
|
+
stickers get
|
|
17
|
+
stickers resolve
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
When this variable is set for one of those reads, the CLI constructs the Node SDK's scoped
|
|
21
|
+
`StickerRuntime` directly and does not resolve or send a master API key. The explicit
|
|
22
|
+
`--collection` must match the token claim. A scoped token cannot manage collections or pack
|
|
23
|
+
bindings, inspect workspace usage, or mint another token. Those commands always require the
|
|
24
|
+
trusted credential.
|
|
25
|
+
|
|
26
|
+
## Collection management
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
mediaruntime stickers collections list [--include-archived] [--json]
|
|
30
|
+
mediaruntime stickers collections create --name <name> [--description <text>] [--json]
|
|
31
|
+
mediaruntime stickers collections get <collection_id> [--json]
|
|
32
|
+
mediaruntime stickers collections update <collection_id>
|
|
33
|
+
[--name <name>] [--description <text> | --clear-description]
|
|
34
|
+
[--status active|archived] [--json]
|
|
35
|
+
mediaruntime stickers collections archive <collection_id> [--json]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Archive is recoverable and retains pack-binding history. Restore an archived collection with
|
|
39
|
+
`collections update <collection_id> --status active`. JSON output is the SDK's camel-case
|
|
40
|
+
projection.
|
|
41
|
+
|
|
42
|
+
## Pack bindings
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
mediaruntime stickers collections packs list <collection_id> [--json]
|
|
46
|
+
mediaruntime stickers collections packs enable <collection_id>
|
|
47
|
+
(--pack <pack_id> | --activation <activation_id>) [--json]
|
|
48
|
+
mediaruntime stickers collections packs disable <collection_id> --pack <pack_id> [--json]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
These commands bind an existing paid Hosted Pack activation to an application collection.
|
|
52
|
+
They do not purchase, activate, revoke, or charge for a pack. The stable pack-ID form is
|
|
53
|
+
idempotent and suitable for configuration scripts. The activation-ID form is useful just
|
|
54
|
+
after an account administrator completes activation elsewhere.
|
|
55
|
+
|
|
56
|
+
Disabling removes the pack from new-use discovery while retaining the binding and its
|
|
57
|
+
historical-access policy. Exact historical references can therefore remain renderable when
|
|
58
|
+
the policy is `preserve`; search and metadata retrieval no longer return the disabled pack.
|
|
59
|
+
|
|
60
|
+
## Runtime reads
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
mediaruntime stickers packs list --collection <collection_id> [--json]
|
|
64
|
+
mediaruntime stickers search <query> --collection <collection_id>
|
|
65
|
+
[--pack <pack_id>] [--category <category>]
|
|
66
|
+
[--animated | --static] [--limit <1..50>] [--json]
|
|
67
|
+
mediaruntime stickers typeahead <prefix> --collection <collection_id>
|
|
68
|
+
[--pack <pack_id>] [--locale <locale>] [--limit <1..20>] [--json]
|
|
69
|
+
mediaruntime stickers get <sticker_id> --collection <collection_id> [--json]
|
|
70
|
+
mediaruntime stickers resolve <sticker_id> --variant <variant>
|
|
71
|
+
--collection <collection_id> [--json]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Search is metadata-only. Persist the stable `stickerId`, then call `resolve` only when an
|
|
75
|
+
approved representation is needed. Resolution intentionally prints the short-lived signed
|
|
76
|
+
URL because delivery authorization is the command's purpose. The URL is collection checked,
|
|
77
|
+
variant checked, generation pinned, and expiring; do not persist it or write it to logs.
|
|
78
|
+
|
|
79
|
+
Supported variants are `animated`, `reduced_motion`, `small_80`, `small_100`, `small_160`,
|
|
80
|
+
and `thumbnail`. The gateway remains authoritative and may reject a supported name when the
|
|
81
|
+
specific sticker does not publish that representation.
|
|
82
|
+
|
|
83
|
+
## Usage and scoped token issuance
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
mediaruntime stickers usage [--json]
|
|
87
|
+
mediaruntime stickers token create --collection <collection_id>
|
|
88
|
+
[--expires-in <60..3600>]
|
|
89
|
+
[--scope packs:read|stickers:search|stickers:read|assets:resolve]...
|
|
90
|
+
[--json]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Omitting `--scope` asks the gateway for all four read scopes. Repeated scopes are
|
|
94
|
+
deduplicated. Token output is secret-bearing by explicit request; redirect it only to a
|
|
95
|
+
protected sink and avoid CI log capture. Usage is pooled at workspace/month level and
|
|
96
|
+
reports operations, authorized delivery bytes, included allowances, settled overage, and
|
|
97
|
+
health status. URL issuance records maximum authorized bytes; it does not claim that the
|
|
98
|
+
client completed a CDN transfer.
|
package/docs/clipping.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Assisted clipping (1.4.0)
|
|
2
|
+
|
|
3
|
+
Requires CLI and Node SDK 1.4.0 or newer. Earlier versions do not include these
|
|
4
|
+
controls. The gateway and worker must
|
|
5
|
+
also deploy `clip_candidates_v1` and `video_clip_v1`. The live capability catalog
|
|
6
|
+
controls which presets an account can run.
|
|
7
|
+
|
|
8
|
+
## Analyze → review → render
|
|
9
|
+
|
|
10
|
+
Analyze and download the resulting plan using the normal job flow. Choose a minimum
|
|
11
|
+
no longer than the source (the 15-second default does not fit a 12-second video):
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
mediaruntime run https://your-cdn.example/episode.mp4 \
|
|
15
|
+
--preset clip_candidates_v1 --clip-min-duration 15 --clip-max-duration 60 \
|
|
16
|
+
--clip-count 5 --clip-keyword deployment --download analysis.zip
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`--download` implies `--wait`. Extract `clip_candidates.json` from the ZIP, review
|
|
20
|
+
its candidates and transcript, and choose a range. Scores express transcript and
|
|
21
|
+
pause heuristics, not predicted engagement. Analysis produces a JSON report, not
|
|
22
|
+
rendered clips. Empty candidates are a successful result when nothing matches;
|
|
23
|
+
`empty_reason` explains `no_speech`, `no_keyword_match`, `no_matching_ranges`, or
|
|
24
|
+
`source_too_short` when present. A nonempty transcript can still be reused. Current
|
|
25
|
+
preflight rejects a minimum longer than the source before analysis begins.
|
|
26
|
+
|
|
27
|
+
Render the reviewed range from the **same source**:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
mediaruntime run https://your-cdn.example/episode.mp4 \
|
|
31
|
+
--preset video_clip_v1 --clip-start 20 --clip-duration 30 \
|
|
32
|
+
--clip-layout vertical_blur --clip-transcript clip_candidates.json --clip-captions \
|
|
33
|
+
--download clip.zip
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The example needs a source of at least 50 seconds. Replace its start and duration
|
|
37
|
+
with the candidate you reviewed; CLI does not automatically pick or submit a candidate.
|
|
38
|
+
The ZIP includes the MP4, poster, and SRT/VTT sidecars when a transcript intersects
|
|
39
|
+
the range. `--clip-captions` additionally burns that supplied text into the video.
|
|
40
|
+
Omit `--clip-captions` to keep sidecars only.
|
|
41
|
+
|
|
42
|
+
## Manual clips and existing captions
|
|
43
|
+
|
|
44
|
+
Manual clipping requires no transcription or Whisper model:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
mediaruntime run ./source.mp4 --preset video_clip_v1 \
|
|
48
|
+
--clip-start 1 --clip-duration 5 --download manual-clip.zip
|
|
49
|
+
|
|
50
|
+
mediaruntime run ./source.mp4 --preset video_clip_v1 \
|
|
51
|
+
--clip-start 1 --clip-duration 5 --clip-transcript ./source.srt \
|
|
52
|
+
--clip-captions --download captioned-clip.zip
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`--clip-transcript` accepts a **local** `.srt`, `.vtt`, or `.json` file. JSON may
|
|
56
|
+
be a report with `transcript` or a bare segment array. Snake-case API fields
|
|
57
|
+
`start_time_sec` / `end_time_sec` and camel-case Node fields `startTimeSec` /
|
|
58
|
+
`endTimeSec` are accepted with `text`. SRT/VTT styling is flattened into plain text.
|
|
59
|
+
Cloud URLs and storage paths are not transcript file arguments: download the file
|
|
60
|
+
locally first. Main media sources continue to support the usual upload/source flow.
|
|
61
|
+
|
|
62
|
+
Times refer to the **full original source**, not the trimmed clip. Do not subtract
|
|
63
|
+
the clip start; the engine intersects and rebases captions. Burning requires text
|
|
64
|
+
that overlaps the selected range. Text need not describe the content for a rendering
|
|
65
|
+
test, but use accurate transcripts for meaningful speech suggestions.
|
|
66
|
+
|
|
67
|
+
Attachments must be UTF-8, at most 1 MiB, and contain 1–2000 ordered segments.
|
|
68
|
+
Each cue needs a finite start ≥ 0, end > start, and nonblank text of at most
|
|
69
|
+
2000 UTF-8 bytes. Total text is bounded to 256 KiB and timestamps to 604800 seconds.
|
|
70
|
+
Source duration/range validity is checked by gateway/engine preflight.
|
|
71
|
+
|
|
72
|
+
## Controls and processing
|
|
73
|
+
|
|
74
|
+
| Option | Bound/default |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `--clip-start` | Required for render; 0–604800 seconds |
|
|
77
|
+
| `--clip-duration` | Required for render; 0.1–300 seconds, wholly within source |
|
|
78
|
+
| `--clip-layout` | `original` (default) or `vertical_blur` |
|
|
79
|
+
| `--clip-min-duration` | Analysis: 1–300 seconds; default 15 |
|
|
80
|
+
| `--clip-max-duration` | Analysis: 1–300 seconds; default 60; ≥ minimum |
|
|
81
|
+
| `--clip-count` | Analysis: integer 1–20; default 5 |
|
|
82
|
+
| `--clip-keyword` | Analysis: repeat up to 20 times, 1–100 UTF-8 bytes each |
|
|
83
|
+
| `--clip-transcript` | Local JSON/SRT/VTT attachment for either clipping preset |
|
|
84
|
+
| `--clip-captions` | Render only; opt-in burn, requires transcript |
|
|
85
|
+
|
|
86
|
+
Clipping controls require exactly one corresponding `--preset`; they cannot be
|
|
87
|
+
combined with a hosted recipe or ambiguously target multiple outputs.
|
|
88
|
+
|
|
89
|
+
Analysis is Premium. Without supplied text it uses the worker's **existing Whisper
|
|
90
|
+
base model**, which must be available in that runtime. Supplying `--clip-transcript`
|
|
91
|
+
for analysis bypasses Whisper. This feature introduces no additional ML model.
|
|
92
|
+
Standard renders cap original framing at a 1920-pixel long edge and 30 fps;
|
|
93
|
+
vertical blur-fill uses 720×1280 at up to 30 fps. Account settings may select a
|
|
94
|
+
higher effective tier. Premium analysis depends on the deployment's Sandbox
|
|
95
|
+
configuration; use a funded account when that Sandbox disables Premium processing.
|
|
96
|
+
|
|
97
|
+
## Local release verification
|
|
98
|
+
|
|
99
|
+
Build and pack the sibling Node SDK 1.4.0 first, then install its tarball only for
|
|
100
|
+
local verification, keeping the committed dependency as `^1.4.0`:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
npm install --offline --no-save --package-lock=false /path/to/mediaruntime-node-1.4.0.tgz
|
|
104
|
+
npm run check
|
|
105
|
+
npm test
|
|
106
|
+
node dist/cli.js --version
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The CLI checks that its SDK supports clipping before submission. Do not publish a
|
|
110
|
+
filesystem dependency. After publishing the SDK, regenerate the CLI lock with
|
|
111
|
+
`npm install --package-lock-only`, run a clean `npm ci` and package smoke test, then
|
|
112
|
+
publish the CLI. Registry publication and deployed-service verification are separate
|
|
113
|
+
release steps; passing local tests does not assert they have happened.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediaruntime/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Official command-line client for MediaRuntime",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"prepack": "npm run check && npm test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
34
|
+
"@mediaruntime/node": "^1.4.0",
|
|
35
|
+
"@napi-rs/keyring": "^1.3.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^24.3.0",
|