cueframe 0.9.0 → 0.9.1
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 +29 -29
- package/dist/analyze-2OBMYCB7.js +2 -0
- package/dist/chunk-4GLKC6H7.js +18 -0
- package/dist/cueframe.js +51 -51
- package/dist/skills/cueframe-brand-demo/SKILL.md +1 -1
- package/dist/skills/cueframe-cli/SKILL.md +42 -42
- package/dist/skills/cueframe-component-authoring/SKILL.md +5 -5
- package/dist/skills/cueframe-connect/SKILL.md +1 -1
- package/dist/skills/cueframe-product-video/SKILL.md +7 -7
- package/package.json +3 -3
- package/dist/analyze-EKOZIDCB.js +0 -2
- package/dist/chunk-B4ON73FK.js +0 -18
|
@@ -261,4 +261,4 @@ frames) before declaring done.
|
|
|
261
261
|
which is the engine's job now.
|
|
262
262
|
- This recipe lives in a skill on purpose: the engine stays use-case-free; the
|
|
263
263
|
product opinions (what to extract, which overlays, how to brand) live here and
|
|
264
|
-
ship via `npx -y cueframe@0.
|
|
264
|
+
ship via `npx -y cueframe@0.9 install`.
|
|
@@ -31,11 +31,11 @@ both MCP and this CLI exist so you do not have to.
|
|
|
31
31
|
|
|
32
32
|
## Overview
|
|
33
33
|
|
|
34
|
-
The `cueframe` CLI drives the CueFrame platform from the terminal. Optimized for agents — every command supports `--json` (NDJSON event stream) and the binary self-describes via `npx -y cueframe@0.
|
|
34
|
+
The `cueframe` CLI drives the CueFrame platform from the terminal. Optimized for agents — every command supports `--json` (NDJSON event stream) and the binary self-describes via `npx -y cueframe@0.9 describe --json`.
|
|
35
35
|
|
|
36
|
-
**Run it as `npx -y cueframe@0.
|
|
36
|
+
**Run it as `npx -y cueframe@0.9 …` — every command in this skill is written that way, and
|
|
37
37
|
that form is executable verbatim.** There is no `cueframe` on your PATH unless you put it
|
|
38
|
-
there: `npx -y cueframe@0.
|
|
38
|
+
there: `npx -y cueframe@0.9 install` wires the MCP server and drops these skills, but npx
|
|
39
39
|
unpacks to an ephemeral cache, so it installs no binary. `npx` re-resolves the current
|
|
40
40
|
version on each call (~0.5s warm, ~5s cold), which also means these commands never go
|
|
41
41
|
stale. If you are running many in a row and want to skip that, `npm i -g cueframe` once
|
|
@@ -46,9 +46,9 @@ the documented path.
|
|
|
46
46
|
**The framework is three verbs:** `upload` (register media) → `composition put` (author the timeline) → `render` (→ MP4). The `Composition` is the contract — render takes the saved composition, nothing else. Everything domain-specific (AI clip suggestions, FCPXML/Premiere export) is a **use-case on-ramp** layered on top, not part of the core.
|
|
47
47
|
|
|
48
48
|
**Core principle — discover, don't guess.** Never author a composition from the
|
|
49
|
-
examples below alone. The live contract is `npx -y cueframe@0.
|
|
49
|
+
examples below alone. The live contract is `npx -y cueframe@0.9 schema composition` (prints
|
|
50
50
|
the real wire schema the server enforces); confirm any draft with
|
|
51
|
-
`npx -y cueframe@0.
|
|
51
|
+
`npx -y cueframe@0.9 composition validate -b @file.json` BEFORE you render. Validation is
|
|
52
52
|
free and instant; a render is neither. The examples here are orientation — the
|
|
53
53
|
schema is the source of truth.
|
|
54
54
|
|
|
@@ -70,20 +70,20 @@ delivery, not checking each edit. CLI validation does not replace visual evidenc
|
|
|
70
70
|
# Commands run against production; auth is stored in ~/.cueframe/auth.json.
|
|
71
71
|
|
|
72
72
|
# 1. Register media (one or many — mixed video / image / audio).
|
|
73
|
-
npx -y cueframe@0.
|
|
73
|
+
npx -y cueframe@0.9 upload "/path/to/source.mp4" --json # → mediaItemId (process_complete)
|
|
74
74
|
|
|
75
75
|
# 2. Create a project (sets aspect/format).
|
|
76
|
-
npx -y cueframe@0.
|
|
76
|
+
npx -y cueframe@0.9 project create -n "promo" -a 9:16 --json # → projectId
|
|
77
77
|
|
|
78
78
|
# 3. Author the composition: tracks of clips (per-clip reframe/trim), optional
|
|
79
79
|
# captions (captions.segments), brandKitId. The composition is the SSOT.
|
|
80
80
|
# Discover the live schema, then validate the draft BEFORE saving/rendering:
|
|
81
|
-
npx -y cueframe@0.
|
|
82
|
-
npx -y cueframe@0.
|
|
83
|
-
npx -y cueframe@0.
|
|
81
|
+
npx -y cueframe@0.9 schema composition # → live wire schema
|
|
82
|
+
npx -y cueframe@0.9 composition validate -b @composition.json # → ✓ valid | per-field errors (no render)
|
|
83
|
+
npx -y cueframe@0.9 composition put <projectId> -b @composition.json # ETag auto
|
|
84
84
|
|
|
85
85
|
# 4. Render the saved composition to MP4. SSE-watches + downloads when done.
|
|
86
|
-
npx -y cueframe@0.
|
|
86
|
+
npx -y cueframe@0.9 render <projectId> -o ./out.mp4 --json
|
|
87
87
|
# → render_queued → render_progress* → render_complete
|
|
88
88
|
#
|
|
89
89
|
# `render` takes ONLY a projectId and renders the SAVED composition (tracks +
|
|
@@ -92,14 +92,14 @@ npx -y cueframe@0.8 render <projectId> -o ./out.mp4 --json
|
|
|
92
92
|
# a hand-authored composition; if absent, the clip is rendered without captions.
|
|
93
93
|
|
|
94
94
|
# Reattach to an in-flight render later (e.g. after disconnect):
|
|
95
|
-
npx -y cueframe@0.
|
|
95
|
+
npx -y cueframe@0.9 render watch <renderId> -p <projectId> -o ./out.mp4 --json
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
## Anatomy of a composition.json
|
|
99
99
|
|
|
100
100
|
This section orients you to the shape; the authoritative contract is
|
|
101
|
-
`npx -y cueframe@0.
|
|
102
|
-
unclear, and `npx -y cueframe@0.
|
|
101
|
+
`npx -y cueframe@0.9 schema composition` (the live wire schema) — run it when a field is
|
|
102
|
+
unclear, and `npx -y cueframe@0.9 composition validate -b @file.json` to check a draft.
|
|
103
103
|
|
|
104
104
|
`composition put` takes the **bare** `Composition` object (no wrapper; the CLI POSTs
|
|
105
105
|
the `@file` verbatim and handles the ETag). Minimal valid shape:
|
|
@@ -166,18 +166,18 @@ the composition yourself (above).
|
|
|
166
166
|
|
|
167
167
|
```bash
|
|
168
168
|
# 1. Upload + chain the AI clip pass.
|
|
169
|
-
npx -y cueframe@0.
|
|
170
|
-
# (or run it explicitly: npx -y cueframe@0.
|
|
169
|
+
npx -y cueframe@0.9 upload "/path/to/source.mp4" --analyze --json # mediaItemId + suggestions
|
|
170
|
+
# (or run it explicitly: npx -y cueframe@0.9 analyze <mediaItemId> --wait --json)
|
|
171
171
|
|
|
172
172
|
# 2. List clip suggestions (publicId sug_…, title, startMs/endMs, score).
|
|
173
|
-
npx -y cueframe@0.
|
|
173
|
+
npx -y cueframe@0.9 clips <mediaItemId> --json
|
|
174
174
|
|
|
175
175
|
# 3. Create a project AND author its composition from the chosen suggestion.
|
|
176
|
-
npx -y cueframe@0.
|
|
177
|
-
# (or, on an existing project: npx -y cueframe@0.
|
|
176
|
+
npx -y cueframe@0.9 project create -n "paul-klein-shorts" -a 9:16 --from-suggestion <sug_…> --json
|
|
177
|
+
# (or, on an existing project: npx -y cueframe@0.9 composition from-suggestion <projectId> -s <sug_…>)
|
|
178
178
|
|
|
179
179
|
# 4. Render — same framework verb as above.
|
|
180
|
-
npx -y cueframe@0.
|
|
180
|
+
npx -y cueframe@0.9 render <projectId> -o ./out.mp4 --json
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
Both flows converge on `composition put` → `render`; the on-ramp just authors the
|
|
@@ -194,10 +194,10 @@ video and composites it (the shared renderer never runs your code).
|
|
|
194
194
|
|
|
195
195
|
```bash
|
|
196
196
|
# 1. Scaffold a workspace (writes cueframe.json + cueframe/components/). Idempotent.
|
|
197
|
-
npx -y cueframe@0.
|
|
197
|
+
npx -y cueframe@0.9 init --json
|
|
198
198
|
|
|
199
199
|
# 2a. Scaffold a component in cueframe/components/<id>/ as owned, editable source.
|
|
200
|
-
npx -y cueframe@0.
|
|
200
|
+
npx -y cueframe@0.9 new component my-badge --category ui-blocks --json
|
|
201
201
|
|
|
202
202
|
# The scaffold is a native (version 4) source: template.html + definition.json, with its
|
|
203
203
|
# manifest in cueframe.json. Built-in forks copy the exact template, definition and manifest.
|
|
@@ -206,38 +206,38 @@ npx -y cueframe@0.8 new component my-badge --category ui-blocks --json
|
|
|
206
206
|
# __cfScene.mount(...)) and definition.json (inputs, defaults, timing, capabilities).
|
|
207
207
|
|
|
208
208
|
# 4. Publish to CueFrame so it can render (the server admits the source or names the rule it breaks).
|
|
209
|
-
npx -y cueframe@0.
|
|
210
|
-
npx -y cueframe@0.
|
|
209
|
+
npx -y cueframe@0.9 push my-badge --json # one component
|
|
210
|
+
npx -y cueframe@0.9 sync --json # every component in the workspace
|
|
211
211
|
|
|
212
212
|
# 5. Reference the component id in your composition as a {kind:'component', componentId, props}
|
|
213
213
|
# clip, then render with the same verb. Preview a single component first via the MCP
|
|
214
214
|
# preview_component loop.
|
|
215
|
-
npx -y cueframe@0.
|
|
215
|
+
npx -y cueframe@0.9 render <projectId> -o ./out.mp4 --json
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
## Quick reference
|
|
219
219
|
|
|
220
220
|
| Need to… | Command |
|
|
221
221
|
|---|---|
|
|
222
|
-
| See every command + flags | `npx -y cueframe@0.
|
|
223
|
-
| Install/refresh managed skills | `npx -y cueframe@0.
|
|
224
|
-
| List projects | `npx -y cueframe@0.
|
|
225
|
-
| List your media | `npx -y cueframe@0.
|
|
226
|
-
| Discover the live composition schema | `npx -y cueframe@0.
|
|
227
|
-
| Validate a draft (no save, no render) | `npx -y cueframe@0.
|
|
228
|
-
| Read composition + ETag | `npx -y cueframe@0.
|
|
229
|
-
| Write composition | `npx -y cueframe@0.
|
|
230
|
-
| Export to Final Cut | `npx -y cueframe@0.
|
|
231
|
-
| Export to Premiere | `npx -y cueframe@0.
|
|
232
|
-
| Anything not wrapped | `npx -y cueframe@0.
|
|
233
|
-
| Validate a composition without mutating | `npx -y cueframe@0.
|
|
222
|
+
| See every command + flags | `npx -y cueframe@0.9 describe --json` |
|
|
223
|
+
| Install/refresh managed skills | `npx -y cueframe@0.9 install` (shared `~/.agents/skills` and Claude `~/.claude/skills`; locally changed or untracked packages are preserved and reported) |
|
|
224
|
+
| List projects | `npx -y cueframe@0.9 list -n 50` |
|
|
225
|
+
| List your media | `npx -y cueframe@0.9 clips` (no mediaId arg) |
|
|
226
|
+
| Discover the live composition schema | `npx -y cueframe@0.9 schema composition` |
|
|
227
|
+
| Validate a draft (no save, no render) | `npx -y cueframe@0.9 composition validate -b @plan.json` |
|
|
228
|
+
| Read composition + ETag | `npx -y cueframe@0.9 composition get <projectId> --json` |
|
|
229
|
+
| Write composition | `npx -y cueframe@0.9 composition put <projectId> -b @plan.json` (ETag auto) |
|
|
230
|
+
| Export to Final Cut | `npx -y cueframe@0.9 export fcpxml <projectId> -s <sug> --wait -o cut.zip` |
|
|
231
|
+
| Export to Premiere | `npx -y cueframe@0.9 export premiere <projectId> -s <sug> --wait -o cut.zip` |
|
|
232
|
+
| Anything not wrapped | `npx -y cueframe@0.9 api GET /v1/... -i` (escape hatch, like `gh api`) |
|
|
233
|
+
| Validate a composition without mutating | `npx -y cueframe@0.9 composition validate -b @plan.json` |
|
|
234
234
|
|
|
235
235
|
## Auth
|
|
236
236
|
|
|
237
237
|
Commands run against production. Authenticate once:
|
|
238
238
|
|
|
239
|
-
- `npx -y cueframe@0.
|
|
240
|
-
- `npx -y cueframe@0.
|
|
239
|
+
- `npx -y cueframe@0.9 login` — OAuth device flow (laptops).
|
|
240
|
+
- `npx -y cueframe@0.9 auth <cf_live_… key>` — save a static API key (CI / headless).
|
|
241
241
|
|
|
242
242
|
Creds are stored in `~/.cueframe/auth.json`; the key can also come from the `CUEFRAME_API_KEY` env var.
|
|
243
243
|
|
|
@@ -255,11 +255,11 @@ Errors come as `{"event":"error", "phase":"<step>", "message":"...", "code":"...
|
|
|
255
255
|
|
|
256
256
|
| Mistake | Reality |
|
|
257
257
|
|---|---|
|
|
258
|
-
| Reaching for `curl …/v1/...` because the CLI didn't have a command | Use `npx -y cueframe@0.
|
|
259
|
-
| Polling for render completion with a sleep loop | `npx -y cueframe@0.
|
|
258
|
+
| Reaching for `curl …/v1/...` because the CLI didn't have a command | Use `npx -y cueframe@0.9 api METHOD /v1/...` — same auth, same JSON pipeline. |
|
|
259
|
+
| Polling for render completion with a sleep loop | `npx -y cueframe@0.9 render` already SSE-watches and exits when done. Use `render watch <id>` to reattach. |
|
|
260
260
|
| Skipping `--json` and trying to parse human output | Human output is for humans. Agents always use `--json`. |
|
|
261
261
|
| Hand-editing the composition without an ETag | `composition put` GETs the ETag for you; `from-suggestion` rebuilds from a clip. Don't hand-craft unless you have to. |
|
|
262
|
-
| Calling `npx -y cueframe@0.
|
|
262
|
+
| Calling `npx -y cueframe@0.9 render <projectId> <suggestionId>` (old two-positional shape) | `render` takes ONLY a projectId; commander rejects the extra arg. It renders the SAVED composition — author it first via `composition put` (hand-author) or `project create --from-suggestion <sug>` (clip-finder on-ramp). |
|
|
263
263
|
| Assuming `render` needs a clip suggestion / that captions only come from a suggestion | No — `render` renders the saved composition directly; a suggestion is optional. Captions come from `composition.captions` (author them in the `put` JSON). The clip-suggestion on-ramp just fills those captions for you by slicing the transcript at author time. |
|
|
264
264
|
|
|
265
265
|
## When this skill applies (routing)
|
|
@@ -80,14 +80,14 @@ Source lives in `cueframe/components/<id>/` (the `cueframe.json` workspace); edi
|
|
|
80
80
|
template locally, push to render.
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
npx -y cueframe@0.
|
|
84
|
-
npx -y cueframe@0.
|
|
83
|
+
npx -y cueframe@0.9 init --json # scaffold cueframe.json + cueframe/components/
|
|
84
|
+
npx -y cueframe@0.9 new component my-badge --category ui-blocks --json # scaffold a component in the workspace
|
|
85
85
|
# New scaffolds contain template.html and definition.json (native source, version 4).
|
|
86
86
|
# …edit cueframe/components/<id>/template.html and definition.json in your editor…
|
|
87
|
-
npx -y cueframe@0.
|
|
88
|
-
# or: npx -y cueframe@0.
|
|
87
|
+
npx -y cueframe@0.9 push my-badge --json # send the native source; the server admits it
|
|
88
|
+
# or: npx -y cueframe@0.9 sync --json # push every component in the workspace
|
|
89
89
|
# reference the component id in your composition, then render:
|
|
90
|
-
npx -y cueframe@0.
|
|
90
|
+
npx -y cueframe@0.9 render <projectId> -o ./out.mp4 --json
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
The CLI writes `template.html` and `definition.json` (input schema, defaults, timing and
|
|
@@ -23,7 +23,7 @@ When a required capability is missing, explain the limitation and the supported
|
|
|
23
23
|
- **Claude.ai / Claude Desktop:** Settings → Connectors → add a custom connector with
|
|
24
24
|
`https://api.cueframe.ai/v1/mcp`.
|
|
25
25
|
- **Other agents (Cursor, Codex, VS Code, Windsurf, Zed, Antigravity CLI, Copilot CLI, …):**
|
|
26
|
-
use `npx -y cueframe@0.
|
|
26
|
+
use `npx -y cueframe@0.9 install --help` to select the intended client; preserve existing configuration and avoid duplicate installs.
|
|
27
27
|
- **ChatGPT:** the CLI cannot wire it because there is no local config to write; add
|
|
28
28
|
`https://api.cueframe.ai/v1/mcp` as a custom connector instead.
|
|
29
29
|
- **No account (pay per call):** connect
|
|
@@ -21,7 +21,7 @@ to author, not how to transport it.
|
|
|
21
21
|
|
|
22
22
|
**Drive the primitives over MCP if you can call tools** (`new_composition` /
|
|
23
23
|
`apply_composition` / `validate_composition` / `create_render` — see the
|
|
24
|
-
`cueframe-connect` skill for the one-line setup). The `npx -y cueframe@0.
|
|
24
|
+
`cueframe-connect` skill for the one-line setup). The `npx -y cueframe@0.9 …` commands
|
|
25
25
|
written out below are the same operations for a terminal or CI job with no MCP
|
|
26
26
|
host; see the `cueframe-cli` skill.
|
|
27
27
|
|
|
@@ -64,7 +64,7 @@ style's) over each window. Result → `source.reframe.segments` on the clip.
|
|
|
64
64
|
## 3. Compose
|
|
65
65
|
|
|
66
66
|
One video track, the screen recording as a media clip carrying the reframe.
|
|
67
|
-
`npx -y cueframe@0.
|
|
67
|
+
`npx -y cueframe@0.9 composition put <projectId> -b @composition.json` (see `cueframe-cli`).
|
|
68
68
|
Choose `-a 16:9` for landscape product video, `9:16` for social.
|
|
69
69
|
|
|
70
70
|
## 4. Polish — layer overlay primitives (this is what makes it look "produced")
|
|
@@ -101,21 +101,21 @@ check framing with `preview_frame` and click/zoom timing with an affected-window
|
|
|
101
101
|
For a small revision, verify that change and relevant regressions without exporting the whole film.
|
|
102
102
|
When delivering the finished video:
|
|
103
103
|
|
|
104
|
-
`npx -y cueframe@0.
|
|
104
|
+
`npx -y cueframe@0.9 render <projectId> -o out.mp4 --json`. Verify the output (ffprobe +
|
|
105
105
|
sample frames) before declaring done.
|
|
106
106
|
|
|
107
107
|
## Worked examples — composition JSON
|
|
108
108
|
|
|
109
109
|
These are **orientation, not the contract.** The live wire schema is
|
|
110
|
-
`npx -y cueframe@0.
|
|
111
|
-
`npx -y cueframe@0.
|
|
110
|
+
`npx -y cueframe@0.9 schema composition`, and the way to know a draft is correct is
|
|
111
|
+
`npx -y cueframe@0.9 composition validate -b @composition.json` — it runs the same
|
|
112
112
|
validator the server enforces, with no save and no render. Discover + validate
|
|
113
113
|
before you render; never spend a render to find a schema mistake.
|
|
114
114
|
|
|
115
115
|
Each block below is a complete `@composition.json` (the bare object `composition put`
|
|
116
116
|
accepts: top-level `v`, `format`, `tracks`, optional `captions`). All five validate
|
|
117
117
|
against the real wire schema + save invariants (swap the `<…MediaId>` placeholders for
|
|
118
|
-
real `npx -y cueframe@0.
|
|
118
|
+
real `npx -y cueframe@0.9 upload` ids). Conventions that keep them valid:
|
|
119
119
|
|
|
120
120
|
- Tracks hold **`contents`** (not `clips`); each clip wraps a `source`.
|
|
121
121
|
- A clip's `source.kind` must match the track `kind`: `media` → `video`/`image`/`audio`
|
|
@@ -297,4 +297,4 @@ Talking-head with an `active-speaker` reframe and a `heroText` title at `zPlane:
|
|
|
297
297
|
background. See EX3 / EX4 below.
|
|
298
298
|
- This recipe lives in a skill on purpose: the engine stays use-case-free; the
|
|
299
299
|
product opinions (style, which primitives, layout) live here and ship via
|
|
300
|
-
`npx -y cueframe@0.
|
|
300
|
+
`npx -y cueframe@0.9 install`. Add sibling recipes (`cueframe-podcast-clip`, …) the same way.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cueframe",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "CueFrame video editing CLI: manage media, edit compositions and render MP4s from terminals and scripts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cueframe",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"tsup": "^8.5.1",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^4.1.2",
|
|
48
|
-
"@cueframe/skills": "0.3.
|
|
49
|
-
"@cueframe/sdk": "^0.
|
|
48
|
+
"@cueframe/skills": "0.3.2",
|
|
49
|
+
"@cueframe/sdk": "^0.9.0"
|
|
50
50
|
},
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
package/dist/analyze-EKOZIDCB.js
DELETED
package/dist/chunk-B4ON73FK.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as y}from"./chunk-3QSA3EBY.js";var u=class extends Error{status;code;details;requestId;constructor(t,r,n){super(r.message),this.name="ApiError",this.status=t,this.code=r.code,this.details=r.details,this.requestId=n}},v=class extends Error{url;timeoutMs;constructor(t,r){super(`Request timed out after ${r}ms: ${t}`),this.name="TimeoutError",this.url=t,this.timeoutMs=r}},q=class extends Error{url;constructor(t,r){super(`Request failed before a response: ${t}`,{cause:r}),this.name="NetworkError",this.url=t}},g={baseUrl:""};function I(e){return g={timeoutMs:3e4,...e},g}function j(){return g}function rt(e,t){return/^https?:\/\//.test(t)?t:e.replace(/\/$/,"")+(t.startsWith("/")?t:`/${t}`)}async function L(e,t={}){if(!g.baseUrl)throw new Error("@cueframe/sdk: createClient({baseUrl}) must be called before issuing requests.");let r=g.fetch??fetch,n=rt(g.baseUrl,e),o=new Headers({accept:"application/json"});for(let[c,f]of Object.entries(g.headers??{}))o.set(c,f);t.headers&&new Headers(t.headers).forEach((c,f)=>o.set(f,c)),g.apiKey&&!o.has("authorization")&&o.set("authorization",`Bearer ${g.apiKey}`);let s=g.timeoutMs??3e4,i=new AbortController,p=setTimeout(()=>i.abort(),s),d=t.signal?AbortSignal.any([t.signal,i.signal]):i.signal;try{let c=await r(n,{...t,headers:o,signal:d}),f={};c.headers.forEach((b,x)=>{f[x.toLowerCase()]=b});let l=null;if(c.status!==204)if((c.headers.get("content-type")??"").includes("application/json"))try{l=await c.json()}catch{l=null}else l=await c.text();return{status:c.status,statusText:c.statusText,headers:f,body:l,requestId:f["x-request-id"]}}catch(c){throw t.signal?.aborted?c:i.signal.aborted?new v(n,s):new q(n,c)}finally{clearTimeout(p)}}async function a(e,t={}){let r=await L(e,t);if(r.status>=400){let n;throw r.body&&typeof r.body=="object"&&"error"in r.body?n=r.body.error??{code:"unknown",message:r.statusText}:n={code:"unknown",message:r.statusText},new u(r.status,n,r.requestId)}if(r.status!==204)return r.body}var ot={unauthorized:"The credential is invalid or expired for this target, or it belongs to a different environment. Re-authenticate the way you connected: reconnect the MCP server, run `cueframe login` in a terminal, or supply a current API key.",forbidden:"The credential's permissions don't cover this operation. The server message above names the exact missing ones and the `permissions` body that grants them; a key's permissions are fixed at creation, so this needs a NEW key, not a change to this one.",not_found:"No such resource in this org (cross-org access also reads as 404). Check the id, or enumerate with the matching list command/tool.",media_not_ready:"Media is still processing. Wait for the `media.transcribed` webhook or retry after ~30s.",suggestions_already_complete:"Suggestions already exist for this media item. To re-run, call DELETE /v1/media/:id/suggestions first to reset state.",precondition_required:"Fetch the resource with GET first to obtain its ETag, then resend the write with `If-Match: <etag>`. `cueframe composition get` returns one for you.",stale_etag:"Resource was modified since your last GET \u2014 `details.currentEtag` is the value to thread next. Re-GET (or run `cueframe composition get`) and rebase your edits before retrying.",conflict:"ETag mismatch \u2014 the resource was modified since your last GET. Re-fetch and merge before retrying.",media_in_use:"Media is referenced by other resources. See `details.projectIds` and `details.sessionIds` \u2014 remove those references before deleting.",session_in_use:"Session is referenced by a composition. See `details.projectIds` \u2014 remove those references before deleting.",render_not_cancellable:"Render is already in a terminal state (complete / error / cancelled) and cannot be cancelled.",rate_limited:"Rate limit exceeded. Back off using the `retry-after` response header.",invalid_composition:"Composition violates an invariant (see `details`). Common ones: clip_source_track_kind_mismatch, track_clips_overlap, transition_no_predecessor.",clip_not_found:"The clip suggestion publicId doesn't exist in this org. Run `cueframe clips <mediaItemId>` to enumerate valid sug_* ids.",service_unavailable:"The processing pipeline is temporarily unavailable. Retry shortly; if it persists, contact support@cueframe.ai with the requestId.",payment_required:"The request exceeds a billing limit. For generation, the estimated cost is over the per-call ceiling (see `details.estimateUsd` / `details.ceilingUsd`) \u2014 lower the requested duration or raise the ceiling."};function O(e){return e instanceof u?ot[e.code]??null:null}async function*nt(e,t,r){let n=j();if(!n?.baseUrl)throw new Error(`@cueframe/sdk: createClient({baseUrl}) must be called before ${t}.`);let o=n.baseUrl.replace(/\/$/,"")+e,s=new Headers({accept:"text/event-stream",...n.headers??{}});n.apiKey&&!s.has("authorization")&&s.set("authorization",`Bearer ${n.apiKey}`);let p=await(n.fetch??fetch)(o,{method:"GET",headers:s,signal:r.signal});if(!p.ok){let l;try{l=(await p.json()).error??{code:"unknown",message:p.statusText}}catch{l={code:"unknown",message:p.statusText}}throw new u(p.status,l,p.headers.get("x-request-id")??void 0)}if(!p.body)throw new Error("SSE response has no body");let d=p.body.getReader(),c=new TextDecoder("utf-8"),f="";try{for(;;){let{value:l,done:b}=await d.read();if(b)break;f+=c.decode(l,{stream:!0});let x=f.indexOf(`
|
|
3
|
-
|
|
4
|
-
`);for(;x!==-1;){let tt=f.slice(0,x);f=f.slice(x+2);let B=st(tt);B&&(yield B),x=f.indexOf(`
|
|
5
|
-
|
|
6
|
-
`)}}}finally{try{d.releaseLock()}catch{}}}function st(e){if(!e.trim())return null;let t=null,r=[];for(let n of e.split(`
|
|
7
|
-
`)){if(!n||n.startsWith(":"))continue;let o=n.indexOf(":");if(o===-1)continue;let s=n.slice(0,o),i=n.slice(o+1).replace(/^ /,"");s==="event"?t=i:s==="data"&&r.push(i)}return!t||r.length===0?null:{event:t,data:r.join(`
|
|
8
|
-
`)}}async function*it(e,t,r={}){let n=`/v1/projects/${encodeURIComponent(e)}/renders/${encodeURIComponent(t)}/stream`;for await(let o of nt(n,"iterRenderEvents",r)){let s=at(o);s&&(yield s)}}function at(e){let{event:t,data:r}=e;if(r===null||t!=="progress"&&t!=="complete"&&t!=="error")return null;let n;try{n=JSON.parse(r)}catch{return null}return{event:t,data:n}}var P={};y(P,{composeFromSuggestion:()=>lt,getComposeFromSuggestionUrl:()=>N,getListMediaSuggestionsUrl:()=>G,getResetMediaSuggestionsUrl:()=>$,getSuggestBriefsUrl:()=>F,listMediaSuggestions:()=>gt,resetMediaSuggestions:()=>xt,suggestBriefs:()=>yt});var N=e=>`/v1/projects/${e}/composition/from-suggestion`,lt=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(N(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},G=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,s])=>{s!==void 0&&r.append(o,s===null?"null":String(s))});let n=r.toString();return n.length>0?`/v1/media/${e}/suggestions?${n}`:`/v1/media/${e}/suggestions`},gt=async(e,t,r)=>a(G(e,t),{...r,method:"GET"}),F=e=>`/v1/media/${e}/suggestions`,yt=async(e,t)=>a(F(e),{...t,method:"POST"}),$=e=>`/v1/media/${e}/suggestions`,xt=async(e,t)=>a($(e),{...t,method:"DELETE"});var Z={};y(Z,{createComponent:()=>St,getBlankComponentSource:()=>Ct,getComponent:()=>qt,getComponentSource:()=>kt,getCreateComponentUrl:()=>V,getGetBlankComponentSourceUrl:()=>J,getGetComponentSourceUrl:()=>Y,getGetComponentUrl:()=>X,getListCatalogUrl:()=>D,getPatchComponentUrl:()=>z,getRepinComponentUrl:()=>_,getResolveBuiltinComponentUrl:()=>H,getUpdateComponentUrl:()=>W,listCatalog:()=>Pt,patchComponent:()=>vt,repinComponent:()=>Rt,resolveBuiltinComponent:()=>bt,updateComponent:()=>ht});var _=e=>`/v1/projects/${e}/components/native-upgrade`,Rt=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(_(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},J=()=>"/v1/components/blank-source",Ct=async e=>a(J(),{...e,method:"GET"}),H=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{o!==void 0&&t.append(n,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/components/builtin/resolve?${r}`:"/v1/components/builtin/resolve"},bt=async(e,t)=>a(H(e),{...t,method:"GET"}),D=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{o!==void 0&&t.append(n,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/components?${r}`:"/v1/components"},Pt=async(e,t)=>a(D(e),{...t,method:"GET"}),V=()=>"/v1/components",St=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(V(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},W=e=>`/v1/components/${e}`,ht=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(W(e),{...r,method:"PUT",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},z=e=>`/v1/components/${e}`,vt=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(z(e),{...r,method:"PATCH",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},X=e=>`/v1/components/${e}`,qt=async(e,t)=>a(X(e),{...t,method:"GET"}),Y=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,s])=>{s!==void 0&&r.append(o,s===null?"null":String(s))});let n=r.toString();return n.length>0?`/v1/components/${e}/source?${n}`:`/v1/components/${e}/source`},kt=async(e,t,r)=>a(Y(e,t),{...r,method:"GET"});var oe={};y(oe,{cancelExport:()=>Kt,createFcpxmlExport:()=>At,createPremiereExport:()=>Mt,getCancelExportUrl:()=>re,getCreateFcpxmlExportUrl:()=>Q,getCreatePremiereExportUrl:()=>ee,getExport:()=>Ut,getGetExportUrl:()=>te});var Q=e=>`/v1/projects/${e}/exports/fcpxml`,At=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(Q(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ee=e=>`/v1/projects/${e}/exports/premiere`,Mt=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(ee(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},te=(e,t)=>`/v1/projects/${e}/exports/${t}`,Ut=async(e,t,r)=>a(te(e,t),{...r,method:"GET"}),re=(e,t)=>`/v1/projects/${e}/exports/${t}/cancel`,Kt=async(e,t,r)=>a(re(e,t),{...r,method:"POST"});var Pe={};y(Pe,{analyzeTimeline:()=>rr,analyzeTranscript:()=>tr,createMediaUpload:()=>$t,createUploadToken:()=>Ft,deleteMedia:()=>Vt,finalizeMedia:()=>Jt,generateMedia:()=>Ht,getAnalyzeTimelineUrl:()=>be,getAnalyzeTranscriptUrl:()=>Ce,getCreateMediaUploadUrl:()=>ie,getCreateUploadTokenUrl:()=>se,getDeleteMediaUrl:()=>me,getFinalizeMediaUrl:()=>pe,getGenerateMediaUrl:()=>ce,getGetMediaContextUrl:()=>le,getGetMediaTranscriptUrl:()=>ue,getGetMediaUrl:()=>de,getImportMediaUrl:()=>fe,getListMediaFactsUrl:()=>xe,getListMediaUrl:()=>ae,getMedia:()=>Wt,getMediaContext:()=>Xt,getMediaTranscript:()=>zt,getPurchaseMediaFactUrl:()=>Re,getSearchLibraryUrl:()=>ne,getTriggerMatteBakeUrl:()=>ye,getTriggerSubjectDetectionUrl:()=>ge,importMedia:()=>Dt,listMedia:()=>_t,listMediaFacts:()=>Qt,purchaseMediaFact:()=>er,searchLibrary:()=>Gt,triggerMatteBake:()=>Zt,triggerSubjectDetection:()=>Yt});var ne=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{o!==void 0&&t.append(n,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/media/search?${r}`:"/v1/media/search"},Gt=async(e,t)=>a(ne(e),{...t,method:"GET"}),se=()=>"/v1/uploads/token",Ft=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(se(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ie=()=>"/v1/media",$t=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(ie(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ae=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{o!==void 0&&t.append(n,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/media?${r}`:"/v1/media"},_t=async(e,t)=>a(ae(e),{...t,method:"GET"}),pe=e=>`/v1/media/${e}/finalize`,Jt=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(pe(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ce=()=>"/v1/media/generate",Ht=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(ce(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},fe=()=>"/v1/media/import",Dt=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(fe(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},me=e=>`/v1/media/${e}`,Vt=async(e,t)=>a(me(e),{...t,method:"DELETE"}),de=e=>`/v1/media/${e}`,Wt=async(e,t)=>a(de(e),{...t,method:"GET"}),ue=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,s])=>{s!==void 0&&r.append(o,s===null?"null":String(s))});let n=r.toString();return n.length>0?`/v1/media/${e}/transcript?${n}`:`/v1/media/${e}/transcript`},zt=async(e,t,r)=>a(ue(e,t),{...r,method:"GET"}),le=e=>`/v1/media/${e}/context`,Xt=async(e,t)=>a(le(e),{...t,method:"GET"}),ge=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,s])=>{s!==void 0&&r.append(o,s===null?"null":String(s))});let n=r.toString();return n.length>0?`/v1/media/${e}/detect-subjects?${n}`:`/v1/media/${e}/detect-subjects`},Yt=async(e,t,r)=>a(ge(e,t),{...r,method:"POST"}),ye=e=>`/v1/media/${e}/matte`,Zt=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(ye(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},xe=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,s])=>{s!==void 0&&r.append(o,s===null?"null":String(s))});let n=r.toString();return n.length>0?`/v1/media/${e}/facts?${n}`:`/v1/media/${e}/facts`},Qt=async(e,t,r)=>a(xe(e,t),{...r,method:"GET"}),Re=e=>`/v1/media/${e}/facts`,er=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(Re(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},Ce=e=>`/v1/media/${e}/transcript/analyze`,tr=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(Ce(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},be=()=>"/v1/timeline-analysis",rr=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(be(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})};var Te={};y(Te,{createProject:()=>nr,deleteProject:()=>ar,getCreateProjectUrl:()=>he,getDeleteProjectUrl:()=>ke,getGetProjectContextUrl:()=>Ee,getGetProjectUrl:()=>ve,getListProjectsUrl:()=>Se,getPatchProjectUrl:()=>qe,getProject:()=>sr,getProjectContext:()=>pr,listProjects:()=>or,patchProject:()=>ir});var Se=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{o!==void 0&&t.append(n,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/projects?${r}`:"/v1/projects"},or=async(e,t)=>a(Se(e),{...t,method:"GET"}),he=()=>"/v1/projects",nr=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(he(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ve=e=>`/v1/projects/${e}`,sr=async(e,t)=>a(ve(e),{...t,method:"GET"}),qe=e=>`/v1/projects/${e}`,ir=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(qe(e),{...r,method:"PATCH",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ke=e=>`/v1/projects/${e}`,ar=async(e,t)=>a(ke(e),{...t,method:"DELETE"}),Ee=e=>`/v1/projects/${e}/context`,pr=async(e,t)=>a(Ee(e),{...t,method:"GET"});var Be={};y(Be,{cancelRender:()=>ur,createRender:()=>cr,getCancelRenderUrl:()=>Ae,getCreateRenderUrl:()=>Ie,getGetRenderUrl:()=>we,getListProjectRendersUrl:()=>je,getPreviewClipUrl:()=>Oe,getRefreshRenderUrlUrl:()=>Ue,getRender:()=>dr,getRetryRenderUrl:()=>Me,getStreamRenderUrl:()=>Ke,listProjectRenders:()=>fr,previewClip:()=>mr,refreshRenderUrl:()=>gr,retryRender:()=>lr,streamRender:()=>yr});var Ie=e=>`/v1/projects/${e}/renders`,cr=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(Ie(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},je=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,s])=>{s!==void 0&&r.append(o,s===null?"null":String(s))});let n=r.toString();return n.length>0?`/v1/projects/${e}/renders?${n}`:`/v1/projects/${e}/renders`},fr=async(e,t,r)=>a(je(e,t),{...r,method:"GET"}),Oe=e=>`/v1/projects/${e}/preview-clip`,mr=async(e,t,r)=>{let n=o=>{if(!o)return{};if(o instanceof Headers)return Object.fromEntries(o.entries());if(Symbol.iterator in o)return Object.fromEntries(Array.from(o,i=>Array.from(i)));let s={};for(let[i,p]of Object.entries(o))p!==void 0&&(s[i]=p);return s};return a(Oe(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},we=(e,t)=>`/v1/projects/${e}/renders/${t}`,dr=async(e,t,r)=>a(we(e,t),{...r,method:"GET"}),Ae=(e,t)=>`/v1/projects/${e}/renders/${t}/cancel`,ur=async(e,t,r)=>a(Ae(e,t),{...r,method:"POST"}),Me=(e,t)=>`/v1/projects/${e}/renders/${t}/retry`,lr=async(e,t,r)=>a(Me(e,t),{...r,method:"POST"}),Ue=(e,t)=>`/v1/projects/${e}/renders/${t}/refresh-url`,gr=async(e,t,r)=>a(Ue(e,t),{...r,method:"POST"}),Ke=(e,t)=>`/v1/projects/${e}/renders/${t}/stream`,yr=async(e,t,r)=>a(Ke(e,t),{...r,method:"GET"});var Je={};y(Je,{createSession:()=>br,deleteSession:()=>Sr,getCreateSessionUrl:()=>Ne,getDeleteSessionUrl:()=>Fe,getGetMuxJobUrl:()=>_e,getGetSessionUrl:()=>Ge,getListSessionsUrl:()=>Le,getMuxJob:()=>vr,getSession:()=>Pr,getTriggerMuxJobUrl:()=>$e,listSessions:()=>Cr,triggerMuxJob:()=>hr});var Le=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{o!==void 0&&t.append(n,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/sessions?${r}`:"/v1/sessions"},Cr=async(e,t)=>a(Le(e),{...t,method:"GET"}),Ne=()=>"/v1/sessions",br=async(e,t)=>{let r=n=>{if(!n)return{};if(n instanceof Headers)return Object.fromEntries(n.entries());if(Symbol.iterator in n)return Object.fromEntries(Array.from(n,s=>Array.from(s)));let o={};for(let[s,i]of Object.entries(n))i!==void 0&&(o[s]=i);return o};return a(Ne(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},Ge=e=>`/v1/sessions/${e}`,Pr=async(e,t)=>a(Ge(e),{...t,method:"GET"}),Fe=e=>`/v1/sessions/${e}`,Sr=async(e,t)=>a(Fe(e),{...t,method:"DELETE"}),$e=e=>`/v1/sessions/${e}/mux-job`,hr=async(e,t)=>a($e(e),{...t,method:"POST"}),_e=e=>`/v1/sessions/${e}/mux-job`,vr=async(e,t)=>a(_e(e),{...t,method:"GET"});var jr=[3,4],Or={version:4,componentId:"blank-component",template:`<template><div id="root" data-composition-id="blank-component" data-width="1920" data-height="1080" data-no-timeline data-composition-variables='[{"id":"background","type":"color","label":"Background","default":"#101014"}]'><div data-cf-scene></div></div><script>
|
|
9
|
-
const { h, MediaTileScene } = __cfScene;
|
|
10
|
-
function Blank({ params }) {
|
|
11
|
-
return h(MediaTileScene, { streams: {}, tiles: [], background: params.background ?? '#101014' });
|
|
12
|
-
}
|
|
13
|
-
__cfScene.mount({ root: document.getElementById('root'), component: Blank, variables: __hyperframes.getVariables() });
|
|
14
|
-
</script></template>`,manifest:{version:4,runtime:"hyperframes",hfContract:1,kind:"scene",assets:{},graphics:{api:"webgl2",required:!0,accelerationPreference:"software-allowed"},alphaPolicy:"allows-opaque"},definition:{inputSchema:{type:"object",additionalProperties:!1,properties:{background:{type:"string",pattern:"^#[0-9a-fA-F]{6}$",default:"#101014",title:"Background"}}},defaults:{},brandBindings:[],timing:{defaultDuration:{frames:90,fps:30}},capabilities:[{kind:"clip"}]}};var k="X-CueFrame-Client";var wr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Ar=["web","console","clips"];function Mr(e,t){return Ar.includes(e)===(t==="browser")}function He(e){if(!wr.test(e.version))throw new Error(`${k} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Mr(e.surface,e.os))throw new Error(`${k} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function De(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Ur,writeFileSync as Kr,mkdirSync as Br,existsSync as Lr}from"fs";import{join as Ve}from"path";import{homedir as Nr}from"os";var m={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function w(e){if(e instanceof u){if(e.status===402)return m.PaymentRequired;if(e.status>=500)return m.ApiServerError;if(e.status>=400)return m.ApiClientError}let t=e?.exitCode;return typeof t=="number"?t:m.NetworkError}function eS(e){return e===402?m.PaymentRequired:e>=500?m.ApiServerError:e>=400?m.ApiClientError:m.Success}function S(e){process.exit(e)}var We=Ve(Nr(),".cueframe"),E=Ve(We,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},Gr="prod";function iS(e=Gr){return process.env.CUEFRAME_API_URL??R[e]??R.prod}var h=class extends Error{constructor(r,n){super(n);this.code=r;this.name="AuthStoreError"}code;exitCode=m.UserError};function aS(e){if(!/^cf_(?:live|test)_[A-Za-z0-9_-]{8,}$/.test(e))throw new h("auth_invalid","Invalid API key. Expected a key beginning with cf_live_ or cf_test_.")}function ze(){if(!Lr(E))return{targets:{}};let e=Ur(E,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${E} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function Fr(e){Br(We,{recursive:!0,mode:448}),Kr(E,JSON.stringify(e,null,2),{mode:384})}function pS(e,t="prod",r){let n=ze(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},Fr(n)}function Xe(e="prod"){let t=process.env.CUEFRAME_API_KEY,r=process.env.CUEFRAME_API_URL;if(t)return{apiKey:t,apiUrl:r??R[e]??R.prod};let o=ze().targets[e];if(!o)throw new h("auth_missing",`No auth configured for target "${e}". Run \`cueframe login --target ${e}\` (browser sign-in) or \`cueframe auth <api-key> --target ${e}\` (CI / headless).`);return o}function $r(){return{[k]:He({surface:"cli",version:"0.9.0",os:De(process.platform)})}}function Ye(e){let{apiKey:t,apiUrl:r}=Xe(e);I({baseUrl:r,apiKey:t,headers:$r()})}function T(e){let t=e instanceof u?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=O(e);return r?`${t}
|
|
15
|
-
\u2192 ${r}`:t}import _r from"ora";import Jr from"pino";var Hr="v1",Ze=Jr({level:"trace",base:{schemaVersion:Hr},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function A(e,t){return _r({text:e,isSilent:!!t}).start()}function C(e,t,r={}){e.json&&Ze.info(r,t)}function xS(e,t,r){if(e.json){console.log(JSON.stringify(t,null,2));return}r()}function M(e,t,r,n){let o=r instanceof Error?r.message:String(r),s=typeof r?.code=="string"?r.code:void 0,i=r?.status;e.json?Ze.info({phase:t,message:o,...s?{code:s}:{},...typeof i=="number"?{status:i}:{},exitCode:n},"error"):process.stderr.write(`\u2716 ${t}: ${T(r)}
|
|
16
|
-
`)}function U(e,t,r,n){e.json&&M(e,t,r,n)}function RS(e,t){t.json||console.log(e)}function Dr(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<=31||r===127)return!0}return!1}function et(e,t,r){e.length===0&&Qe(`${t} is empty.`,r),Dr(e)&&Qe(`${t} contains a control character (newline, tab, or null byte). Identifiers must be plain text \u2014 check for a stray copy-paste artifact.`,r)}function Qe(e,t){M(t,"preflight",new Error(e),m.UserError),S(m.UserError)}var Vr=5e3,K=300*1e3;async function TS(e,t){if(et(e,"mediaItemId",t),t.dryRun){C(t,"analyze_dry_run",{mediaItemId:e,target:t.target,wait:!!t.wait,wouldCall:"POST /v1/media/:id/suggestions"}),t.json||console.log(`[dry-run] Would trigger clip analysis for ${e} on ${t.target}.`);return}Ye(t.target),C(t,"analyze_prepare",{mediaItemId:e,target:t.target,wait:!!t.wait});let r=A("Triggering clip analysis\u2026",t.json),n;try{n=await P.suggestBriefs(e),r.succeed(`Analysis ${n.alreadyRunning?"already running":"started"}`)}catch(i){r.fail(`Failed to start analysis: ${T(i)}`),U(t,"analyze_prepare",i,w(i)),S(w(i))}if(C(t,"analyze_ready",{mediaItemId:e,status:n.status,alreadyRunning:!!n.alreadyRunning}),!t.wait){t.json||console.log(`
|
|
17
|
-
Run \`cueframe clips ${e}\` to check results.`);return}let o=A("Waiting for analysis to complete\u2026",t.json),s=Date.now();for(;;){await new Promise(i=>setTimeout(i,Vr)),Date.now()-s>K&&(o.fail(`Timed out after ${Math.round(K/1e3)}s. Run \`cueframe clips ${e}\` to check later.`),U(t,"analyze_progress",new Error(`Analysis did not complete within ${Math.round(K/1e3)}s`),m.UserError),S(m.UserError));try{let i=await P.listMediaSuggestions(e);if(i.suggestions.length>0){o.succeed(`Analysis complete \u2014 ${i.suggestions.length} clips found`),C(t,"analyze_complete",{mediaItemId:e,durationMs:Date.now()-s,suggestionCount:i.suggestions.length,suggestions:i.suggestions}),t.json||i.suggestions.forEach((d,c)=>{let f=(d.trim.end-d.trim.start).toFixed(1);console.log(`
|
|
18
|
-
${c+1}. ${d.title} (${d.id})`),console.log(` ${d.trim.start.toFixed(1)}s \u2013 ${d.trim.end.toFixed(1)}s (${f}s) score: ${d.score}`),console.log(` ${d.reason}`)});return}let p=Math.round((Date.now()-s)/1e3);o.text=`Waiting for analysis\u2026 (${p}s)`,C(t,"analyze_progress",{mediaItemId:e,elapsedSec:p})}catch{}}}export{u as a,I as b,L as c,a as d,O as e,it as f,P as g,Z as h,oe as i,Pe as j,Te as k,Be as l,Je as m,jr as n,Or as o,m as p,w as q,eS as r,S as s,iS as t,aS as u,pS as v,$r as w,Ye as x,T as y,A as z,C as A,xS as B,M as C,U as D,RS as E,et as F,TS as G};
|