cueframe 0.9.4 → 0.11.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/README.md CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Agent-native CLI for **CueFrame** — turn media into rendered video from the
4
4
  terminal. Commands support `--json` for structured output and the binary
5
- self-describes via `npx -y cueframe@0.9 describe --json`, so agents can drive it without
5
+ self-describes via `npx -y cueframe@0.11 describe --json`, so agents can drive it without
6
6
  guesswork.
7
7
 
8
8
  > Connects to the hosted CueFrame service — create an API key at
9
- > [app.cueframe.ai](https://app.cueframe.ai), or use `npx -y cueframe@0.9 login`.
9
+ > [app.cueframe.ai](https://app.cueframe.ai), or use `npx -y cueframe@0.11 login`.
10
10
 
11
11
  ## Run it
12
12
 
13
13
  Run the CLI without a global installation:
14
14
 
15
15
  ```bash
16
- npx -y cueframe@0.9 --help
16
+ npx -y cueframe@0.11 --help
17
17
  ```
18
18
 
19
19
  Requires **Node.js 24 or newer**. The `@0.8` selector keeps these commands on the documented minor release. `npx` downloads the package into its cache; it does not install a persistent binary on your `PATH`.
@@ -21,7 +21,7 @@ Requires **Node.js 24 or newer**. The `@0.8` selector keeps these commands on th
21
21
  For repeated terminal use, you can install that release globally:
22
22
 
23
23
  ```bash
24
- npm install -g cueframe@0.9
24
+ npm install -g cueframe@0.11
25
25
  ```
26
26
 
27
27
  The same commands then run as `cueframe …`.
@@ -29,9 +29,9 @@ The same commands then run as `cueframe …`.
29
29
  ## Authenticate
30
30
 
31
31
  ```bash
32
- npx -y cueframe@0.9 auth <cf_live_… key> # static API key (CI / headless)
32
+ npx -y cueframe@0.11 auth <cf_live_… key> # static API key (CI / headless)
33
33
  # or
34
- npx -y cueframe@0.9 login # OAuth device flow (browser)
34
+ npx -y cueframe@0.11 login # OAuth device flow (browser)
35
35
  ```
36
36
 
37
37
  The key can also be supplied via the `CUEFRAME_API_KEY` environment variable.
@@ -39,7 +39,7 @@ The key can also be supplied via the `CUEFRAME_API_KEY` environment variable.
39
39
  ## Check your connection
40
40
 
41
41
  ```bash
42
- npx -y cueframe@0.9 api GET /v1/me --json
42
+ npx -y cueframe@0.11 api GET /v1/me --json
43
43
  ```
44
44
 
45
45
  This reads your account and credit entitlements without rendering. Cloud processing and rendering consume credits; see [cloud rates](https://cueframe.ai/pricing).
@@ -48,29 +48,30 @@ This reads your account and credit entitlements without rendering. Cloud process
48
48
 
49
49
  ```bash
50
50
  # 1. Register media (video / image / audio)
51
- npx -y cueframe@0.9 upload ./source.mp4 --json # → mediaItemId
51
+ npx -y cueframe@0.11 upload ./source.mp4 --json # → mediaItemId
52
52
 
53
53
  # 2. Create a project (sets aspect / format)
54
- npx -y cueframe@0.9 project create -n promo -a 9:16 --json # → projectId
54
+ npx -y cueframe@0.11 project create -n promo -a 9:16 --json # → projectId
55
55
 
56
56
  # 3. Author the composition — tracks of clips, per-clip reframe/trim,
57
- # optional captions. The composition is the source of truth.
58
- npx -y cueframe@0.9 composition put <projectId> -b @composition.json
57
+ # optional captions. The composition is the source of truth. A put needs the
58
+ # ETag your edit started from (`composition get`), or --create for the first one.
59
+ npx -y cueframe@0.11 composition put <projectId> -b @composition.json --if-match <etag>
59
60
 
60
61
  # 4. Render the saved composition to MP4 (queues, SSE-watches, downloads)
61
- npx -y cueframe@0.9 render <projectId> -o out.mp4 --json
62
+ npx -y cueframe@0.11 render <projectId> -o out.mp4 --json
62
63
  ```
63
64
 
64
65
  `render` takes only a project id and renders whatever composition is saved on
65
- it — no clip suggestion required. Run `npx -y cueframe@0.9 describe --json` for command arguments and options. See the [API reference](https://docs.cueframe.ai/docs/api) for composition fields.
66
+ it — no clip suggestion required. Run `npx -y cueframe@0.11 describe --json` for command arguments and options. See the [API reference](https://docs.cueframe.ai/docs/api) for composition fields.
66
67
 
67
68
  ## Let CueFrame pick the clip (podcast → short)
68
69
 
69
70
  ```bash
70
- npx -y cueframe@0.9 upload ./long.mp4 --analyze --json # media + AI clip suggestions
71
- npx -y cueframe@0.9 clips <mediaItemId> --json # list suggestions (sug_…)
72
- npx -y cueframe@0.9 project create -n short -a 9:16 --from-suggestion <sug_…> --json
73
- npx -y cueframe@0.9 render <projectId> -o short.mp4 --json
71
+ npx -y cueframe@0.11 upload ./long.mp4 --analyze --json # media + AI clip suggestions
72
+ npx -y cueframe@0.11 clips <mediaItemId> --json # list suggestions (sug_…)
73
+ npx -y cueframe@0.11 project create -n short -a 9:16 --from-suggestion <sug_…> --json
74
+ npx -y cueframe@0.11 render <projectId> -o short.mp4 --json
74
75
  ```
75
76
 
76
77
  Both paths converge on `render`; the suggestion on-ramp just authors the
@@ -84,10 +85,10 @@ The public catalog lives in `cueframe-ai/cueframe-templates`; your org keeps
84
85
  its own under `POST /v1/templates`.
85
86
 
86
87
  ```bash
87
- npx -y cueframe@0.9 template run yosemite-warp-text --preset granite --media source=sample --values text=CARVED -o carved.mp4
88
- npx -y cueframe@0.9 template run ./template.cueframe --media source=./clip.mp4 --values title="Journey" --no-render --json
89
- npx -y cueframe@0.9 template status <jobId> --wait --json # reconnect to a running preparation
90
- npx -y cueframe@0.9 template validate ./template.cueframe # on the API with your key; nothing is stored
88
+ npx -y cueframe@0.11 template run yosemite-warp-text --preset granite --media source=sample --values text=CARVED -o carved.mp4
89
+ npx -y cueframe@0.11 template run ./template.cueframe --media source=./clip.mp4 --values title="Journey" --no-render --json
90
+ npx -y cueframe@0.11 template status <jobId> --wait --json # reconnect to a running preparation
91
+ npx -y cueframe@0.11 template validate ./template.cueframe # on the API with your key; nothing is stored
91
92
  ```
92
93
 
93
94
  `run` publishes a local document to your org (a catalog slug is imported on
@@ -113,13 +114,13 @@ prepared matte at another bake version.
113
114
  ## Wire it into your agents
114
115
 
115
116
  ```bash
116
- npx -y cueframe@0.9 install
117
+ npx -y cueframe@0.11 install
117
118
  ```
118
119
 
119
120
  Detects supported local agents and adds `https://api.cueframe.ai/v1/mcp` to their configuration. It also copies the bundled skills to `~/.agents/skills` and `~/.claude/skills`, preserving locally changed skills by default. This can update multiple detected clients; inspect the changes first:
120
121
 
121
122
  ```bash
122
- npx -y cueframe@0.9 install --dry-run --json
123
+ npx -y cueframe@0.11 install --dry-run --json
123
124
  ```
124
125
 
125
126
  Restart your agent session after installation. Interactive MCP clients open a browser to authorize on the first call. ChatGPT uses its hosted connector setup separately; see the [connection guide](https://docs.cueframe.ai/docs/setup).
@@ -127,17 +128,17 @@ Restart your agent session after installation. Interactive MCP clients open a br
127
128
  ## For agents
128
129
 
129
130
  - **`--json`** — lifecycle events use NDJSON: `<verb>_prepare → <verb>_progress* → <verb>_complete | error`, plus a non-zero exit on failure.
130
- - **`npx -y cueframe@0.9 describe --json`** — the full command tree as structured JSON.
131
- - **`npx -y cueframe@0.9 api <METHOD> <path>`** — raw escape hatch over the v1 API.
131
+ - **`npx -y cueframe@0.11 describe --json`** — the full command tree as structured JSON.
132
+ - **`npx -y cueframe@0.11 api <METHOD> <path>`** — raw escape hatch over the v1 API.
132
133
 
133
134
  ## Common commands
134
135
 
135
136
  | Need to… | Command |
136
137
  |---|---|
137
- | List projects | `npx -y cueframe@0.9 list` |
138
- | Read a composition + ETag | `npx -y cueframe@0.9 composition get <projectId> --json` |
139
- | Write a composition | `npx -y cueframe@0.9 composition put <projectId> -b @comp.json` |
140
- | Export to Final Cut / Premiere | `npx -y cueframe@0.9 export fcpxml \| premiere <projectId> -s <sug_…> --wait -o cut.zip` |
138
+ | List projects | `npx -y cueframe@0.11 list` |
139
+ | Read a composition + ETag | `npx -y cueframe@0.11 composition get <projectId> --json` |
140
+ | Write a composition | `npx -y cueframe@0.11 composition put <projectId> -b @comp.json --if-match <etag>` (`--create` for a project's first composition) |
141
+ | Export to Final Cut / Premiere | `npx -y cueframe@0.11 export fcpxml \| premiere <projectId> -s <sug_…> --wait -o cut.zip` |
141
142
  | Validate without mutating | use `--dry-run` where command help lists it |
142
143
 
143
144
  ## Render existing projects from a script
@@ -147,7 +148,7 @@ After authentication, render each saved project in sequence. This uses the exist
147
148
  ```bash
148
149
  set -e
149
150
  for project_id in "$@"; do
150
- npx -y cueframe@0.9 render "$project_id" -o "${project_id}.mp4" --json
151
+ npx -y cueframe@0.11 render "$project_id" -o "${project_id}.mp4" --json
151
152
  done
152
153
  ```
153
154
 
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{L as a}from"./chunk-M3NS5UR2.js";import"./chunk-3QSA3EBY.js";export{a as analyzeCommand};
@@ -0,0 +1,18 @@
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 O(e){return g={timeoutMs:3e4,...e},g}function I(){return g}function ft(e,t){return/^https?:\/\//.test(t)?t:e.replace(/\/$/,"")+(t.startsWith("/")?t:`/${t}`)}async function j(e,t={}){if(!g.baseUrl)throw new Error("@cueframe/sdk: createClient({baseUrl}) must be called before issuing requests.");let r=g.fetch??fetch,n=ft(g.baseUrl,e),o=new Headers({accept:"application/json"});for(let[c,d]of Object.entries(g.headers??{}))o.set(c,d);t.headers&&new Headers(t.headers).forEach((c,d)=>o.set(d,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),m=t.signal?AbortSignal.any([t.signal,i.signal]):i.signal;try{let c=await r(n,{...t,headers:o,signal:m}),d={};c.headers.forEach((b,x)=>{d[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:d,body:l,requestId:d["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 j(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 mt={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 A(e){return e instanceof u?mt[e.code]??null:null}async function*ut(e,t,r){let n=I();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 m=p.body.getReader(),c=new TextDecoder("utf-8"),d="";try{for(;;){let{value:l,done:b}=await m.read();if(b)break;d+=c.decode(l,{stream:!0});let x=d.indexOf(`
3
+
4
+ `);for(;x!==-1;){let dt=d.slice(0,x);d=d.slice(x+2);let N=lt(dt);N&&(yield N),x=d.indexOf(`
5
+
6
+ `)}}}finally{try{m.releaseLock()}catch{}}}function lt(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*gt(e,t,r={}){let n=`/v1/projects/${encodeURIComponent(e)}/renders/${encodeURIComponent(t)}/stream`;for await(let o of ut(n,"iterRenderEvents",r)){let s=yt(o);s&&(yield s)}}function yt(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:()=>ht,getComposeFromSuggestionUrl:()=>L,getListMediaSuggestionsUrl:()=>G,getResetMediaSuggestionsUrl:()=>F,getSuggestBriefsUrl:()=>$,listMediaSuggestions:()=>vt,resetMediaSuggestions:()=>Et,suggestBriefs:()=>qt});var L=e=>`/v1/projects/${e}/composition/from-suggestion`,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(L(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`},vt=async(e,t,r)=>a(G(e,t),{...r,method:"GET"}),$=e=>`/v1/media/${e}/suggestions`,qt=async(e,t)=>a($(e),{...t,method:"POST"}),F=e=>`/v1/media/${e}/suggestions`,Et=async(e,t)=>a(F(e),{...t,method:"DELETE"});var Z={};y(Z,{createComponent:()=>jt,getBlankComponentSource:()=>kt,getComponent:()=>Mt,getComponentSource:()=>Ut,getCreateComponentUrl:()=>V,getGetBlankComponentSourceUrl:()=>H,getGetComponentSourceUrl:()=>Y,getGetComponentUrl:()=>X,getListCatalogUrl:()=>D,getPatchComponentUrl:()=>z,getRepinComponentUrl:()=>_,getResolveBuiltinComponentUrl:()=>J,getUpdateComponentUrl:()=>W,listCatalog:()=>It,patchComponent:()=>wt,repinComponent:()=>Tt,resolveBuiltinComponent:()=>Ot,updateComponent:()=>At});var _=e=>`/v1/projects/${e}/components/native-upgrade`,Tt=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)})},H=()=>"/v1/components/blank-source",kt=async e=>a(H(),{...e,method:"GET"}),J=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"},Ot=async(e,t)=>a(J(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"},It=async(e,t)=>a(D(e),{...t,method:"GET"}),V=()=>"/v1/components",jt=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}`,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(W(e),{...r,method:"PUT",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},z=e=>`/v1/components/${e}`,wt=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}`,Mt=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`},Ut=async(e,t,r)=>a(Y(e,t),{...r,method:"GET"});var se={};y(se,{cancelExport:()=>Wt,createFcpxmlExport:()=>_t,createPremiereExport:()=>Ht,createVideoClipExport:()=>Jt,getCancelExportUrl:()=>ne,getCreateFcpxmlExportUrl:()=>Q,getCreatePremiereExportUrl:()=>ee,getCreateVideoClipExportUrl:()=>te,getExport:()=>Vt,getGetExportUrl:()=>oe,getRetryExportUrl:()=>re,retryExport:()=>Dt});var Q=e=>`/v1/projects/${e}/exports/fcpxml`,_t=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`,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(ee(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},te=e=>`/v1/projects/${e}/exports/videoClip`,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(te(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},re=(e,t)=>`/v1/projects/${e}/exports/${t}/retry`,Dt=async(e,t,r)=>a(re(e,t),{...r,method:"POST"}),oe=(e,t)=>`/v1/projects/${e}/exports/${t}`,Vt=async(e,t,r)=>a(oe(e,t),{...r,method:"GET"}),ne=(e,t)=>`/v1/projects/${e}/exports/${t}/cancel`,Wt=async(e,t,r)=>a(ne(e,t),{...r,method:"POST"});var ke={};y(ke,{analyzeTimeline:()=>Cr,analyzeTranscript:()=>Rr,cancelHostedProcessingRun:()=>rr,createMediaUpload:()=>nr,createUploadToken:()=>or,deleteMedia:()=>cr,finalizeMedia:()=>ir,generateMedia:()=>ar,getAnalyzeTimelineUrl:()=>Te,getAnalyzeTranscriptUrl:()=>Ee,getCancelHostedProcessingRunUrl:()=>de,getCreateMediaUploadUrl:()=>me,getCreateUploadTokenUrl:()=>fe,getDeleteMediaUrl:()=>xe,getFinalizeMediaUrl:()=>le,getGenerateMediaUrl:()=>ge,getGetHostedProcessingArtifactUrl:()=>ce,getGetHostedProcessingRunUrl:()=>pe,getGetMediaContextUrl:()=>Pe,getGetMediaDownloadUrlUrl:()=>Ce,getGetMediaTranscriptUrl:()=>be,getGetMediaUrl:()=>Re,getHostedProcessingArtifact:()=>tr,getHostedProcessingRun:()=>er,getImportMediaUrl:()=>ye,getListMediaFactsUrl:()=>ve,getListMediaUrl:()=>ue,getMedia:()=>dr,getMediaContext:()=>ur,getMediaDownloadUrl:()=>fr,getMediaTranscript:()=>mr,getPurchaseMediaFactUrl:()=>qe,getSearchLibraryUrl:()=>ie,getStartHostedProcessingRunUrl:()=>ae,getTriggerMatteBakeUrl:()=>he,getTriggerSubjectDetectionUrl:()=>Se,importMedia:()=>pr,listMedia:()=>sr,listMediaFacts:()=>yr,purchaseMediaFact:()=>xr,searchLibrary:()=>Zt,startHostedProcessingRun:()=>Qt,triggerMatteBake:()=>gr,triggerSubjectDetection:()=>lr});var ie=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([n,o])=>{let s=["mediaId"];if(Array.isArray(o)&&s.includes(n)){o.forEach(i=>{t.append(n,i===null?"null":String(i))});return}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"},Zt=async(e,t)=>a(ie(e),{...t,method:"GET"}),ae=e=>`/v1/media/${e}/processing-runs`,Qt=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(ae(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},pe=(e,t)=>`/v1/media/${e}/processing-runs/${t}`,er=async(e,t,r)=>a(pe(e,t),{...r,method:"GET"}),ce=(e,t,r)=>`/v1/media/${e}/processing-runs/${t}/artifacts/${r}`,tr=async(e,t,r,n)=>a(ce(e,t,r),{...n,method:"GET"}),de=(e,t)=>`/v1/media/${e}/processing-runs/${t}/cancel`,rr=async(e,t,r)=>a(de(e,t),{...r,method:"POST"}),fe=()=>"/v1/uploads/token",or=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=()=>"/v1/media",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(me(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ue=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"},sr=async(e,t)=>a(ue(e),{...t,method:"GET"}),le=e=>`/v1/media/${e}/finalize`,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(le(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ge=()=>"/v1/media/generate",ar=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(ge(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ye=()=>"/v1/media/import",pr=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(ye(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},xe=e=>`/v1/media/${e}`,cr=async(e,t)=>a(xe(e),{...t,method:"DELETE"}),Re=(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}?${n}`:`/v1/media/${e}`},dr=async(e,t,r)=>a(Re(e,t),{...r,method:"GET"}),Ce=(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}/download-url?${n}`:`/v1/media/${e}/download-url`},fr=async(e,t,r)=>a(Ce(e,t),{...r,method:"GET"}),be=(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`},mr=async(e,t,r)=>a(be(e,t),{...r,method:"GET"}),Pe=(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}/context?${n}`:`/v1/media/${e}/context`},ur=async(e,t,r)=>a(Pe(e,t),{...r,method:"GET"}),Se=(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`},lr=async(e,t,r)=>a(Se(e,t),{...r,method:"POST"}),he=e=>`/v1/media/${e}/matte`,gr=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(he(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ve=(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`},yr=async(e,t,r)=>a(ve(e,t),{...r,method:"GET"}),qe=e=>`/v1/media/${e}/facts`,xr=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:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},Ee=e=>`/v1/media/${e}/transcript/analyze`,Rr=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=()=>"/v1/timeline-analysis",Cr=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(Te(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})};var Ue={};y(Ue,{createProject:()=>Pr,deleteProject:()=>vr,getCreateProjectUrl:()=>Ie,getDeleteProjectUrl:()=>we,getGetProjectContextUrl:()=>Me,getGetProjectUrl:()=>je,getListProjectsUrl:()=>Oe,getPatchProjectUrl:()=>Ae,getProject:()=>Sr,getProjectContext:()=>qr,listProjects:()=>br,patchProject:()=>hr});var Oe=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"},br=async(e,t)=>a(Oe(e),{...t,method:"GET"}),Ie=()=>"/v1/projects",Pr=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)})},je=e=>`/v1/projects/${e}`,Sr=async(e,t)=>a(je(e),{...t,method:"GET"}),Ae=e=>`/v1/projects/${e}`,hr=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(Ae(e),{...r,method:"PATCH",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},we=e=>`/v1/projects/${e}`,vr=async(e,t)=>a(we(e),{...t,method:"DELETE"}),Me=e=>`/v1/projects/${e}/context`,qr=async(e,t)=>a(Me(e),{...t,method:"GET"});var He={};y(He,{cancelRender:()=>Ir,createRender:()=>Er,getCancelRenderUrl:()=>Ge,getCreateRenderUrl:()=>Ke,getGetRenderUrl:()=>Le,getListProjectRendersUrl:()=>Be,getPreviewClipUrl:()=>Ne,getRefreshRenderUrlUrl:()=>Fe,getRender:()=>Or,getRetryRenderUrl:()=>$e,getStreamRenderUrl:()=>_e,listProjectRenders:()=>Tr,previewClip:()=>kr,refreshRenderUrl:()=>Ar,retryRender:()=>jr,streamRender:()=>wr});var Ke=e=>`/v1/projects/${e}/renders`,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(Ke(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},Be=(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`},Tr=async(e,t,r)=>a(Be(e,t),{...r,method:"GET"}),Ne=e=>`/v1/projects/${e}/preview-clip`,kr=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(Ne(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},Le=(e,t)=>`/v1/projects/${e}/renders/${t}`,Or=async(e,t,r)=>a(Le(e,t),{...r,method:"GET"}),Ge=(e,t)=>`/v1/projects/${e}/renders/${t}/cancel`,Ir=async(e,t,r)=>a(Ge(e,t),{...r,method:"POST"}),$e=(e,t)=>`/v1/projects/${e}/renders/${t}/retry`,jr=async(e,t,r)=>a($e(e,t),{...r,method:"POST"}),Fe=(e,t)=>`/v1/projects/${e}/renders/${t}/refresh-url`,Ar=async(e,t,r)=>a(Fe(e,t),{...r,method:"POST"}),_e=(e,t)=>`/v1/projects/${e}/renders/${t}/stream`,wr=async(e,t,r)=>a(_e(e,t),{...r,method:"GET"});var Ze={};y(Ze,{cancelMuxJob:()=>Fr,createSession:()=>Br,deleteSession:()=>Lr,getCancelMuxJobUrl:()=>Ye,getCreateSessionUrl:()=>De,getDeleteSessionUrl:()=>We,getGetMuxJobUrl:()=>Xe,getGetSessionUrl:()=>Ve,getListSessionsUrl:()=>Je,getMuxJob:()=>$r,getSession:()=>Nr,getTriggerMuxJobUrl:()=>ze,listSessions:()=>Kr,triggerMuxJob:()=>Gr});var Je=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"},Kr=async(e,t)=>a(Je(e),{...t,method:"GET"}),De=()=>"/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(De(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},Ve=e=>`/v1/sessions/${e}`,Nr=async(e,t)=>a(Ve(e),{...t,method:"GET"}),We=e=>`/v1/sessions/${e}`,Lr=async(e,t)=>a(We(e),{...t,method:"DELETE"}),ze=e=>`/v1/sessions/${e}/mux-job`,Gr=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(ze(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},Xe=e=>`/v1/sessions/${e}/mux-job`,$r=async(e,t)=>a(Xe(e),{...t,method:"GET"}),Ye=e=>`/v1/sessions/${e}/mux-job/cancel`,Fr=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)})};var Ri={"16:9":"16:9","9:16":"9:16","1:1":"1:1","4:5":"4:5"};var bi={hd:"hd",fhd:"fhd","4k":"4k"};var ua={preview:"preview",final:"final"};var ga={interactive:"interactive",standard:"standard",background:"background"};var Qe=[3,4],Wr={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"}]}};function zr(e){return e.replace(/^W\//,"").replace(/-gzip(?=("?)$)/,"")}var E="X-CueFrame-Client";var Xr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Yr=["web","console","clips"];function Zr(e,t){return Yr.includes(e)===(t==="browser")}function et(e){if(!Xr.test(e.version))throw new Error(`${E} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Zr(e.surface,e.os))throw new Error(`${E} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function tt(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Qr,writeFileSync as eo,mkdirSync as to,existsSync as ro}from"fs";import{join as rt}from"path";import{homedir as oo}from"os";var f={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function w(e){if(e instanceof u){if(e.status===402)return f.PaymentRequired;if(e.status>=500)return f.ApiServerError;if(e.status>=400)return f.ApiClientError}let t=e?.exitCode;return typeof t=="number"?t:f.NetworkError}function uv(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var ot=rt(oo(),".cueframe"),T=rt(ot,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},no="prod";function Cv(e=no){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=f.UserError};function bv(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 nt(){if(!ro(T))return{targets:{}};let e=Qr(T,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${T} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function so(e){to(ot,{recursive:!0,mode:448}),eo(T,JSON.stringify(e,null,2),{mode:384})}function Pv(e,t="prod",r){let n=nt(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},so(n)}function st(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=nt().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 io(){return{[E]:et({surface:"cli",version:"0.11.0",os:tt(process.platform)})}}function it(e){let{apiKey:t,apiUrl:r}=st(e);O({baseUrl:r,apiKey:t,headers:io()})}function k(e){let t=e instanceof u?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=A(e);return r?`${t}
15
+ \u2192 ${r}`:t}import ao from"ora";import po from"pino";var co="v1",at=po({level:"trace",base:{schemaVersion:co},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function M(e,t){return ao({text:e,isSilent:!!t}).start()}function C(e,t,r={}){e.json&&at.info(r,t)}function Iv(e,t,r){if(e.json){console.log(JSON.stringify(t,null,2));return}r()}function U(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?at.info({phase:t,message:o,...s?{code:s}:{},...typeof i=="number"?{status:i}:{},exitCode:n},"error"):process.stderr.write(`\u2716 ${t}: ${k(r)}
16
+ `)}function K(e,t,r,n){e.json&&U(e,t,r,n)}function jv(e,t){t.json||console.log(e)}function fo(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<=31||r===127)return!0}return!1}function ct(e,t,r){e.length===0&&pt(`${t} is empty.`,r),fo(e)&&pt(`${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 pt(e,t){U(t,"preflight",new Error(e),f.UserError),S(f.UserError)}var mo=5e3,B=300*1e3;async function $v(e,t){if(ct(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}it(t.target),C(t,"analyze_prepare",{mediaItemId:e,target:t.target,wait:!!t.wait});let r=M("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: ${k(i)}`),K(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=M("Waiting for analysis to complete\u2026",t.json),s=Date.now();for(;;){await new Promise(i=>setTimeout(i,mo)),Date.now()-s>B&&(o.fail(`Timed out after ${Math.round(B/1e3)}s. Run \`cueframe clips ${e}\` to check later.`),K(t,"analyze_progress",new Error(`Analysis did not complete within ${Math.round(B/1e3)}s`),f.UserError),S(f.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((m,c)=>{let d=(m.trim.end-m.trim.start).toFixed(1);console.log(`
18
+ ${c+1}. ${m.title} (${m.id})`),console.log(` ${m.trim.start.toFixed(1)}s \u2013 ${m.trim.end.toFixed(1)}s (${d}s) score: ${m.score}`),console.log(` ${m.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,O as b,j as c,a as d,A as e,gt as f,P as g,Z as h,se as i,ke as j,Ue as k,He as l,Ze as m,Ri as n,bi as o,ua as p,ga as q,Qe as r,Wr as s,zr as t,f as u,w as v,uv as w,S as x,Cv as y,bv as z,Pv as A,io as B,it as C,k as D,M as E,C as F,Iv as G,U as H,K as I,jv as J,ct as K,$v as L};