cueframe 0.4.9 → 0.6.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/LICENSE +202 -661
- package/NOTICE +10 -0
- package/README.md +29 -35
- package/dist/analyze-Q6MIQWOJ.js +2 -0
- package/dist/chunk-3QSA3EBY.js +2 -0
- package/dist/chunk-U3YHQOER.js +12 -0
- package/dist/cueframe.js +107 -64
- package/dist/skills/add-music-bed/SKILL.md +12 -7
- package/dist/skills/brand-reel/SKILL.md +19 -15
- package/dist/skills/clip-a-talking-head/SKILL.md +15 -7
- package/dist/skills/composing-video/SKILL.md +58 -313
- package/dist/skills/cueframe-brand-demo/SKILL.md +9 -2
- package/dist/skills/cueframe-cli/SKILL.md +54 -49
- package/dist/skills/cueframe-component-authoring/SKILL.md +14 -6
- package/dist/skills/cueframe-compose-loop/SKILL.md +20 -6
- package/dist/skills/cueframe-compose-loop/references/builtin-insertion.md +49 -0
- package/dist/skills/cueframe-compose-loop/references/builtin-requests.json +111 -0
- package/dist/skills/cueframe-connect/SKILL.md +17 -9
- package/dist/skills/cueframe-product-video/SKILL.md +15 -7
- package/dist/skills/cueframe-scene-shot/SKILL.md +8 -0
- package/dist/skills/cueframe-storyboard/SKILL.md +27 -55
- package/dist/skills/every-format-from-one-edit/SKILL.md +14 -8
- package/dist/skills/extracting-brand-kits/SKILL.md +8 -0
- package/dist/skills/launch-video/SKILL.md +17 -11
- package/dist/skills/make-a-social-reel/SKILL.md +19 -15
- package/dist/skills/rebrand-a-video/SKILL.md +18 -16
- package/dist/skills/video-craft-standards/SKILL.md +40 -47
- package/dist/supportedAgents.js +1 -1
- package/package.json +12 -12
- package/dist/analyze-Y2CE6BNM.js +0 -2
- package/dist/chunk-HFZRI4NX.js +0 -68
- package/dist/chunk-MCQRX24V.js +0 -2
package/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CueFrame MCP, SDK and CLI
|
|
2
|
+
Copyright 2026 CueFrame, Inc.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0.
|
|
5
|
+
|
|
6
|
+
This repository contains no code from @cueframe/kernel (AGPL-3.0-only). The CLI's
|
|
7
|
+
authoring verbs validate and bind through the hosted API; the API contract and the
|
|
8
|
+
scene schema arrive as generated JSON under api/.
|
|
9
|
+
|
|
10
|
+
Third-party notices: see each package's dependencies on npm.
|
package/README.md
CHANGED
|
@@ -77,45 +77,39 @@ npx -y cueframe render <projectId> -o short.mp4 --json
|
|
|
77
77
|
Both paths converge on `render`; the suggestion on-ramp just authors the
|
|
78
78
|
composition for you instead of you hand-writing it.
|
|
79
79
|
|
|
80
|
-
##
|
|
80
|
+
## Run a template
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
rendering runtime, or separately installed kernel. It does not compile or execute
|
|
87
|
-
component code; preview the result in a compatible CueFrame runtime before publishing.
|
|
82
|
+
A template is one `.cueframe` document: a composition with `{{name}}`
|
|
83
|
+
references, the parameters that fill them, optional presets and brand kits.
|
|
84
|
+
The public catalog lives in `cueframe-ai/cueframe-templates`; your org keeps
|
|
85
|
+
its own under `POST /v1/templates`.
|
|
88
86
|
|
|
89
87
|
```bash
|
|
90
|
-
cueframe
|
|
91
|
-
cueframe
|
|
92
|
-
|
|
88
|
+
cueframe template run yosemite-warp-text --preset granite --media source=sample --values text=CARVED -o carved.mp4
|
|
89
|
+
cueframe template run ./template.cueframe --media source=./clip.mp4 --values title="Journey" --no-render --json
|
|
90
|
+
cueframe template status <jobId> --wait --json # reconnect to a running preparation
|
|
91
|
+
cueframe template validate ./template.cueframe # on the API with your key; nothing is stored
|
|
93
92
|
```
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Use a recipe with `cueframe recipe run ./recipe.cueframe --media ./input.svg
|
|
116
|
-
--no-render --json`. That authenticated workflow uploads media, installs owned
|
|
117
|
-
components, and creates an editable project. Omit `--no-render` for immediate
|
|
118
|
-
rendering, or render the created project after previewing and editing it.
|
|
94
|
+
`run` publishes a local document to your org (a catalog slug is imported on
|
|
95
|
+
first use), uploads each `--media name=<file>`, then starts one preparation job.
|
|
96
|
+
The job imports and processes media, attaches verified template assets, applies
|
|
97
|
+
the composition, and returns the ready project before `run` renders it. The
|
|
98
|
+
`template_job_request` JSON event carries an idempotency key; pass it back with
|
|
99
|
+
`--idempotency-key` if the start request loses its response. Reuse the same
|
|
100
|
+
media IDs from the earlier upload events as `--media name=media:<id>` so the
|
|
101
|
+
retried request has identical inputs. After a `jobId` arrives,
|
|
102
|
+
`template status <jobId> --wait` reconnects without starting another project.
|
|
103
|
+
`--media name=<https url>` imports the
|
|
104
|
+
URL, `--media name=sample` takes the template's own sample. `--values` are
|
|
105
|
+
coerced to the document's parameter types before anything is sent; whether a
|
|
106
|
+
value fits (an enum option, a number in range) is the server's verdict, which
|
|
107
|
+
`--dry-run` fetches without storing anything.
|
|
108
|
+
|
|
109
|
+
`validate` runs on the CueFrame API with your key and stores nothing. It exits
|
|
110
|
+
2 with the problems the server returns: undeclared or misplaced references, a
|
|
111
|
+
preset that does not bind, a required media parameter with no sample, a
|
|
112
|
+
prepared matte at another bake version.
|
|
119
113
|
|
|
120
114
|
## Wire it into your agents
|
|
121
115
|
|
|
@@ -152,4 +146,4 @@ MCP config) — add `https://api.cueframe.ai/v1/mcp` as a custom connector inste
|
|
|
152
146
|
|
|
153
147
|
---
|
|
154
148
|
|
|
155
|
-
© CueFrame, Inc. Open source under
|
|
149
|
+
© CueFrame, Inc. Open source under Apache-2.0.
|
|
@@ -0,0 +1,12 @@
|
|
|
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,s){super(r.message),this.name="ApiError",this.status=t,this.code=r.code,this.details=r.details,this.requestId=s}},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 et(e,t){return/^https?:\/\//.test(t)?t:e.replace(/\/$/,"")+(t.startsWith("/")?t:`/${t}`)}async function F(e,t={}){if(!g.baseUrl)throw new Error("@cueframe/sdk: createClient({baseUrl}) must be called before issuing requests.");let r=g.fetch??fetch,s=et(g.baseUrl,e),o=new Headers({accept:"application/json"});for(let[c,m]of Object.entries(g.headers??{}))o.set(c,m);t.headers&&new Headers(t.headers).forEach((c,m)=>o.set(m,c)),g.apiKey&&!o.has("authorization")&&o.set("authorization",`Bearer ${g.apiKey}`);let n=g.timeoutMs??3e4,i=new AbortController,p=setTimeout(()=>i.abort(),n),d=t.signal?AbortSignal.any([t.signal,i.signal]):i.signal;try{let c=await r(s,{...t,headers:o,signal:d}),m={};c.headers.forEach((b,x)=>{m[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:m,body:l,requestId:m["x-request-id"]}}catch(c){throw t.signal?.aborted?c:i.signal.aborted?new v(s,n):new q(s,c)}finally{clearTimeout(p)}}async function a(e,t={}){let r=await F(e,t);if(r.status>=400){let s;throw r.body&&typeof r.body=="object"&&"error"in r.body?s=r.body.error??{code:"unknown",message:r.statusText}:s={code:"unknown",message:r.statusText},new u(r.status,s,r.requestId)}if(r.status!==204)return r.body}var tt={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?tt[e.code]??null:null}async function*rt(e,t,r){let s=j();if(!s?.baseUrl)throw new Error(`@cueframe/sdk: createClient({baseUrl}) must be called before ${t}.`);let o=s.baseUrl.replace(/\/$/,"")+e,n=new Headers({accept:"text/event-stream",...s.headers??{}});s.apiKey&&!n.has("authorization")&&n.set("authorization",`Bearer ${s.apiKey}`);let p=await(s.fetch??fetch)(o,{method:"GET",headers:n,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"),m="";try{for(;;){let{value:l,done:b}=await d.read();if(b)break;m+=c.decode(l,{stream:!0});let x=m.indexOf(`
|
|
3
|
+
|
|
4
|
+
`);for(;x!==-1;){let Qe=m.slice(0,x);m=m.slice(x+2);let B=ot(Qe);B&&(yield B),x=m.indexOf(`
|
|
5
|
+
|
|
6
|
+
`)}}}finally{try{d.releaseLock()}catch{}}}function ot(e){if(!e.trim())return null;let t=null,r=[];for(let s of e.split(`
|
|
7
|
+
`)){if(!s||s.startsWith(":"))continue;let o=s.indexOf(":");if(o===-1)continue;let n=s.slice(0,o),i=s.slice(o+1).replace(/^ /,"");n==="event"?t=i:n==="data"&&r.push(i)}return!t||r.length===0?null:{event:t,data:r.join(`
|
|
8
|
+
`)}}async function*st(e,t,r={}){let s=`/v1/projects/${encodeURIComponent(e)}/renders/${encodeURIComponent(t)}/stream`;for await(let o of rt(s,"iterRenderEvents",r)){let n=nt(o);n&&(yield n)}}function nt(e){let{event:t,data:r}=e;if(r===null||t!=="progress"&&t!=="complete"&&t!=="error")return null;let s;try{s=JSON.parse(r)}catch{return null}return{event:t,data:s}}var P={};y(P,{composeFromSuggestion:()=>dt,getComposeFromSuggestionUrl:()=>L,getListMediaSuggestionsUrl:()=>G,getResetMediaSuggestionsUrl:()=>$,getSuggestBriefsUrl:()=>N,listMediaSuggestions:()=>ut,resetMediaSuggestions:()=>gt,suggestBriefs:()=>lt});var L=e=>`/v1/projects/${e}/composition/from-suggestion`,dt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(L(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},G=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,n])=>{n!==void 0&&r.append(o,n===null?"null":String(n))});let s=r.toString();return s.length>0?`/v1/media/${e}/suggestions?${s}`:`/v1/media/${e}/suggestions`},ut=async(e,t,r)=>a(G(e,t),{...r,method:"GET"}),N=e=>`/v1/media/${e}/suggestions`,lt=async(e,t)=>a(N(e),{...t,method:"POST"}),$=e=>`/v1/media/${e}/suggestions`,gt=async(e,t)=>a($(e),{...t,method:"DELETE"});var X={};y(X,{createComponent:()=>Rt,getComponent:()=>Pt,getComponentSource:()=>St,getCreateComponentUrl:()=>H,getGetComponentSourceUrl:()=>z,getGetComponentUrl:()=>V,getListCatalogUrl:()=>_,getPatchComponentUrl:()=>W,getResolveBuiltinComponentUrl:()=>J,getUpdateComponentUrl:()=>D,listCatalog:()=>xt,patchComponent:()=>bt,resolveBuiltinComponent:()=>yt,updateComponent:()=>Ct});var J=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([s,o])=>{o!==void 0&&t.append(s,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/components/builtin/resolve?${r}`:"/v1/components/builtin/resolve"},yt=async(e,t)=>a(J(e),{...t,method:"GET"}),_=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([s,o])=>{o!==void 0&&t.append(s,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/components?${r}`:"/v1/components"},xt=async(e,t)=>a(_(e),{...t,method:"GET"}),H=()=>"/v1/components",Rt=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(H(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},D=e=>`/v1/components/${e}`,Ct=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(D(e),{...r,method:"PUT",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},W=e=>`/v1/components/${e}`,bt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(W(e),{...r,method:"PATCH",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},V=e=>`/v1/components/${e}`,Pt=async(e,t)=>a(V(e),{...t,method:"GET"}),z=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,n])=>{n!==void 0&&r.append(o,n===null?"null":String(n))});let s=r.toString();return s.length>0?`/v1/components/${e}/source?${s}`:`/v1/components/${e}/source`},St=async(e,t,r)=>a(z(e,t),{...r,method:"GET"});var te={};y(te,{cancelExport:()=>wt,createFcpxmlExport:()=>It,createPremiereExport:()=>jt,getCancelExportUrl:()=>ee,getCreateFcpxmlExportUrl:()=>Z,getCreatePremiereExportUrl:()=>Y,getExport:()=>Ot,getGetExportUrl:()=>Q});var Z=e=>`/v1/projects/${e}/exports/fcpxml`,It=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(Z(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},Y=e=>`/v1/projects/${e}/exports/premiere`,jt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(Y(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},Q=(e,t)=>`/v1/projects/${e}/exports/${t}`,Ot=async(e,t,r)=>a(Q(e,t),{...r,method:"GET"}),ee=(e,t)=>`/v1/projects/${e}/exports/${t}/cancel`,wt=async(e,t,r)=>a(ee(e,t),{...r,method:"POST"});var Ce={};y(Ce,{analyzeTimeline:()=>Yt,analyzeTranscript:()=>Zt,createMediaUpload:()=>Ft,createUploadToken:()=>Bt,deleteMedia:()=>Jt,finalizeMedia:()=>Gt,generateMedia:()=>Nt,getAnalyzeTimelineUrl:()=>Re,getAnalyzeTranscriptUrl:()=>xe,getCreateMediaUploadUrl:()=>se,getCreateUploadTokenUrl:()=>oe,getDeleteMediaUrl:()=>ce,getFinalizeMediaUrl:()=>ie,getGenerateMediaUrl:()=>ae,getGetMediaContextUrl:()=>de,getGetMediaTranscriptUrl:()=>fe,getGetMediaUrl:()=>me,getImportMediaUrl:()=>pe,getListMediaFactsUrl:()=>ge,getListMediaUrl:()=>ne,getMedia:()=>_t,getMediaContext:()=>Dt,getMediaTranscript:()=>Ht,getPurchaseMediaFactUrl:()=>ye,getSearchLibraryUrl:()=>re,getTriggerMatteBakeUrl:()=>le,getTriggerSubjectDetectionUrl:()=>ue,importMedia:()=>$t,listMedia:()=>Lt,listMediaFacts:()=>zt,purchaseMediaFact:()=>Xt,searchLibrary:()=>Kt,triggerMatteBake:()=>Vt,triggerSubjectDetection:()=>Wt});var re=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([s,o])=>{o!==void 0&&t.append(s,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/media/search?${r}`:"/v1/media/search"},Kt=async(e,t)=>a(re(e),{...t,method:"GET"}),oe=()=>"/v1/uploads/token",Bt=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(oe(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},se=()=>"/v1/media",Ft=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(se(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ne=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([s,o])=>{o!==void 0&&t.append(s,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/media?${r}`:"/v1/media"},Lt=async(e,t)=>a(ne(e),{...t,method:"GET"}),ie=e=>`/v1/media/${e}/finalize`,Gt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(ie(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},ae=()=>"/v1/media/generate",Nt=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(ae(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},pe=()=>"/v1/media/import",$t=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(pe(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ce=e=>`/v1/media/${e}`,Jt=async(e,t)=>a(ce(e),{...t,method:"DELETE"}),me=e=>`/v1/media/${e}`,_t=async(e,t)=>a(me(e),{...t,method:"GET"}),fe=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,n])=>{n!==void 0&&r.append(o,n===null?"null":String(n))});let s=r.toString();return s.length>0?`/v1/media/${e}/transcript?${s}`:`/v1/media/${e}/transcript`},Ht=async(e,t,r)=>a(fe(e,t),{...r,method:"GET"}),de=e=>`/v1/media/${e}/context`,Dt=async(e,t)=>a(de(e),{...t,method:"GET"}),ue=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,n])=>{n!==void 0&&r.append(o,n===null?"null":String(n))});let s=r.toString();return s.length>0?`/v1/media/${e}/detect-subjects?${s}`:`/v1/media/${e}/detect-subjects`},Wt=async(e,t,r)=>a(ue(e,t),{...r,method:"POST"}),le=e=>`/v1/media/${e}/matte`,Vt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(le(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},ge=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,n])=>{n!==void 0&&r.append(o,n===null?"null":String(n))});let s=r.toString();return s.length>0?`/v1/media/${e}/facts?${s}`:`/v1/media/${e}/facts`},zt=async(e,t,r)=>a(ge(e,t),{...r,method:"GET"}),ye=e=>`/v1/media/${e}/facts`,Xt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(ye(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},xe=e=>`/v1/media/${e}/transcript/analyze`,Zt=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(xe(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},Re=()=>"/v1/timeline-analysis",Yt=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(Re(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})};var ke={};y(ke,{createProject:()=>er,deleteProject:()=>or,getCreateProjectUrl:()=>Pe,getDeleteProjectUrl:()=>ve,getGetProjectContextUrl:()=>qe,getGetProjectUrl:()=>Se,getListProjectsUrl:()=>be,getPatchProjectUrl:()=>he,getProject:()=>tr,getProjectContext:()=>sr,listProjects:()=>Qt,patchProject:()=>rr});var be=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([s,o])=>{o!==void 0&&t.append(s,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/projects?${r}`:"/v1/projects"},Qt=async(e,t)=>a(be(e),{...t,method:"GET"}),Pe=()=>"/v1/projects",er=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(Pe(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},Se=e=>`/v1/projects/${e}`,tr=async(e,t)=>a(Se(e),{...t,method:"GET"}),he=e=>`/v1/projects/${e}`,rr=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(he(e),{...r,method:"PATCH",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},ve=e=>`/v1/projects/${e}`,or=async(e,t)=>a(ve(e),{...t,method:"DELETE"}),qe=e=>`/v1/projects/${e}/context`,sr=async(e,t)=>a(qe(e),{...t,method:"GET"});var Ue={};y(Ue,{cancelRender:()=>cr,createRender:()=>nr,getCancelRenderUrl:()=>Oe,getCreateRenderUrl:()=>Ee,getGetRenderUrl:()=>je,getListProjectRendersUrl:()=>Te,getPreviewClipUrl:()=>Ie,getRefreshRenderUrlUrl:()=>Ae,getRender:()=>pr,getRetryRenderUrl:()=>we,getStreamRenderUrl:()=>Me,listProjectRenders:()=>ir,previewClip:()=>ar,refreshRenderUrl:()=>fr,retryRender:()=>mr,streamRender:()=>dr});var Ee=e=>`/v1/projects/${e}/renders`,nr=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(Ee(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},Te=(e,t)=>{let r=new URLSearchParams;Object.entries(t||{}).forEach(([o,n])=>{n!==void 0&&r.append(o,n===null?"null":String(n))});let s=r.toString();return s.length>0?`/v1/projects/${e}/renders?${s}`:`/v1/projects/${e}/renders`},ir=async(e,t,r)=>a(Te(e,t),{...r,method:"GET"}),Ie=e=>`/v1/projects/${e}/preview-clip`,ar=async(e,t,r)=>{let s=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 n={};for(let[i,p]of Object.entries(o))p!==void 0&&(n[i]=p);return n};return a(Ie(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...s(r?.headers)},body:JSON.stringify(t)})},je=(e,t)=>`/v1/projects/${e}/renders/${t}`,pr=async(e,t,r)=>a(je(e,t),{...r,method:"GET"}),Oe=(e,t)=>`/v1/projects/${e}/renders/${t}/cancel`,cr=async(e,t,r)=>a(Oe(e,t),{...r,method:"POST"}),we=(e,t)=>`/v1/projects/${e}/renders/${t}/retry`,mr=async(e,t,r)=>a(we(e,t),{...r,method:"POST"}),Ae=(e,t)=>`/v1/projects/${e}/renders/${t}/refresh-url`,fr=async(e,t,r)=>a(Ae(e,t),{...r,method:"POST"}),Me=(e,t)=>`/v1/projects/${e}/renders/${t}/stream`,dr=async(e,t,r)=>a(Me(e,t),{...r,method:"GET"});var $e={};y($e,{createSession:()=>yr,deleteSession:()=>Rr,getCreateSessionUrl:()=>Be,getDeleteSessionUrl:()=>Le,getGetMuxJobUrl:()=>Ne,getGetSessionUrl:()=>Fe,getListSessionsUrl:()=>Ke,getMuxJob:()=>br,getSession:()=>xr,getTriggerMuxJobUrl:()=>Ge,listSessions:()=>gr,triggerMuxJob:()=>Cr});var Ke=e=>{let t=new URLSearchParams;Object.entries(e||{}).forEach(([s,o])=>{o!==void 0&&t.append(s,o===null?"null":String(o))});let r=t.toString();return r.length>0?`/v1/sessions?${r}`:"/v1/sessions"},gr=async(e,t)=>a(Ke(e),{...t,method:"GET"}),Be=()=>"/v1/sessions",yr=async(e,t)=>{let r=s=>{if(!s)return{};if(s instanceof Headers)return Object.fromEntries(s.entries());if(Symbol.iterator in s)return Object.fromEntries(Array.from(s,n=>Array.from(n)));let o={};for(let[n,i]of Object.entries(s))i!==void 0&&(o[n]=i);return o};return a(Be(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},Fe=e=>`/v1/sessions/${e}`,xr=async(e,t)=>a(Fe(e),{...t,method:"GET"}),Le=e=>`/v1/sessions/${e}`,Rr=async(e,t)=>a(Le(e),{...t,method:"DELETE"}),Ge=e=>`/v1/sessions/${e}/mux-job`,Cr=async(e,t)=>a(Ge(e),{...t,method:"POST"}),Ne=e=>`/v1/sessions/${e}/mux-job`,br=async(e,t)=>a(Ne(e),{...t,method:"GET"});var k="X-CueFrame-Client";var kr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Er=["web","console","clips"];function Tr(e,t){return Er.includes(e)===(t==="browser")}function Je(e){if(!kr.test(e.version))throw new Error(`${k} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Tr(e.surface,e.os))throw new Error(`${k} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function _e(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Ir,writeFileSync as jr,mkdirSync as Or,existsSync as wr}from"fs";import{join as He}from"path";import{homedir as Ar}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 Qb(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var De=He(Ar(),".cueframe"),E=He(De,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},Mr="prod";function nP(e=Mr){return process.env.CUEFRAME_API_URL??R[e]??R.prod}var h=class extends Error{constructor(r,s){super(s);this.code=r;this.name="AuthStoreError"}code;exitCode=f.UserError};function iP(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 We(){if(!wr(E))return{targets:{}};let e=Ir(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 Ur(e){Or(De,{recursive:!0,mode:448}),jr(E,JSON.stringify(e,null,2),{mode:384})}function aP(e,t="prod",r){let s=We(),o=R[t]??R.prod;s.targets[t]={apiKey:e,apiUrl:r??o},Ur(s)}function Ve(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=We().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 Kr(){return{[k]:Je({surface:"cli",version:"0.6.0",os:_e(process.platform)})}}function ze(e){let{apiKey:t,apiUrl:r}=Ve(e);I({baseUrl:r,apiKey:t,headers:Kr()})}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}
|
|
9
|
+
\u2192 ${r}`:t}import Br from"ora";import Fr from"pino";var Lr="v1",Xe=Fr({level:"trace",base:{schemaVersion:Lr},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function A(e,t){return Br({text:e,isSilent:!!t}).start()}function C(e,t,r={}){e.json&&Xe.info(r,t)}function yP(e,t,r){if(e.json){console.log(JSON.stringify(t,null,2));return}r()}function M(e,t,r,s){let o=r instanceof Error?r.message:String(r),n=typeof r?.code=="string"?r.code:void 0,i=r?.status;e.json?Xe.info({phase:t,message:o,...n?{code:n}:{},...typeof i=="number"?{status:i}:{},exitCode:s},"error"):process.stderr.write(`\u2716 ${t}: ${T(r)}
|
|
10
|
+
`)}function U(e,t,r,s){e.json&&M(e,t,r,s)}function xP(e,t){t.json||console.log(e)}function Gr(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<=31||r===127)return!0}return!1}function Ye(e,t,r){e.length===0&&Ze(`${t} is empty.`,r),Gr(e)&&Ze(`${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 Ze(e,t){M(t,"preflight",new Error(e),f.UserError),S(f.UserError)}var Nr=5e3,K=300*1e3;async function EP(e,t){if(Ye(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}ze(t.target),C(t,"analyze_prepare",{mediaItemId:e,target:t.target,wait:!!t.wait});let r=A("Triggering clip analysis\u2026",t.json),s;try{s=await P.suggestBriefs(e),r.succeed(`Analysis ${s.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:s.status,alreadyRunning:!!s.alreadyRunning}),!t.wait){t.json||console.log(`
|
|
11
|
+
Run \`cueframe clips ${e}\` to check results.`);return}let o=A("Waiting for analysis to complete\u2026",t.json),n=Date.now();for(;;){await new Promise(i=>setTimeout(i,Nr)),Date.now()-n>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`),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()-n,suggestionCount:i.suggestions.length,suggestions:i.suggestions}),t.json||i.suggestions.forEach((d,c)=>{let m=(d.trim.end-d.trim.start).toFixed(1);console.log(`
|
|
12
|
+
${c+1}. ${d.title} (${d.id})`),console.log(` ${d.trim.start.toFixed(1)}s \u2013 ${d.trim.end.toFixed(1)}s (${m}s) score: ${d.score}`),console.log(` ${d.reason}`)});return}let p=Math.round((Date.now()-n)/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,F as c,a as d,O as e,st as f,P as g,X as h,te as i,Ce as j,ke as k,Ue as l,$e as m,f as n,w as o,Qb as p,S as q,nP as r,iP as s,aP as t,Kr as u,ze as v,T as w,A as x,C as y,yP as z,M as A,U as B,xP as C,Ye as D,EP as E};
|