cueframe 0.9.1 → 0.9.2
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/dist/analyze-HCXSAPMH.js +2 -0
- package/dist/chunk-OF3NJZW3.js +18 -0
- package/dist/cueframe.js +71 -71
- package/package.json +3 -3
- package/dist/analyze-2OBMYCB7.js +0 -2
- package/dist/chunk-4GLKC6H7.js +0 -18
|
@@ -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 pt(e,t){return/^https?:\/\//.test(t)?t:e.replace(/\/$/,"")+(t.startsWith("/")?t:`/${t}`)}async function N(e,t={}){if(!g.baseUrl)throw new Error("@cueframe/sdk: createClient({baseUrl}) must be called before issuing requests.");let r=g.fetch??fetch,n=pt(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 N(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 ct={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 j(e){return e instanceof u?ct[e.code]??null:null}async function*dt(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 at=d.slice(0,x);d=d.slice(x+2);let B=ft(at);B&&(yield B),x=d.indexOf(`
|
|
5
|
+
|
|
6
|
+
`)}}}finally{try{m.releaseLock()}catch{}}}function ft(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*mt(e,t,r={}){let n=`/v1/projects/${encodeURIComponent(e)}/renders/${encodeURIComponent(t)}/stream`;for await(let o of dt(n,"iterRenderEvents",r)){let s=ut(o);s&&(yield s)}}function ut(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:()=>bt,getComposeFromSuggestionUrl:()=>L,getListMediaSuggestionsUrl:()=>G,getResetMediaSuggestionsUrl:()=>F,getSuggestBriefsUrl:()=>$,listMediaSuggestions:()=>Pt,resetMediaSuggestions:()=>ht,suggestBriefs:()=>St});var L=e=>`/v1/projects/${e}/composition/from-suggestion`,bt=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`},Pt=async(e,t,r)=>a(G(e,t),{...r,method:"GET"}),$=e=>`/v1/media/${e}/suggestions`,St=async(e,t)=>a($(e),{...t,method:"POST"}),F=e=>`/v1/media/${e}/suggestions`,ht=async(e,t)=>a(F(e),{...t,method:"DELETE"});var Z={};y(Z,{createComponent:()=>Tt,getBlankComponentSource:()=>qt,getComponent:()=>jt,getComponentSource:()=>At,getCreateComponentUrl:()=>V,getGetBlankComponentSourceUrl:()=>J,getGetComponentSourceUrl:()=>Y,getGetComponentUrl:()=>X,getListCatalogUrl:()=>D,getPatchComponentUrl:()=>z,getRepinComponentUrl:()=>_,getResolveBuiltinComponentUrl:()=>H,getUpdateComponentUrl:()=>W,listCatalog:()=>kt,patchComponent:()=>It,repinComponent:()=>vt,resolveBuiltinComponent:()=>Et,updateComponent:()=>Ot});var _=e=>`/v1/projects/${e}/components/native-upgrade`,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(_(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},J=()=>"/v1/components/blank-source",qt=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"},Et=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"},kt=async(e,t)=>a(D(e),{...t,method:"GET"}),V=()=>"/v1/components",Tt=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}`,Ot=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}`,It=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}`,jt=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`},At=async(e,t,r)=>a(Y(e,t),{...r,method:"GET"});var oe={};y(oe,{cancelExport:()=>_t,createFcpxmlExport:()=>Gt,createPremiereExport:()=>$t,getCancelExportUrl:()=>re,getCreateFcpxmlExportUrl:()=>Q,getCreatePremiereExportUrl:()=>ee,getExport:()=>Ft,getGetExportUrl:()=>te});var Q=e=>`/v1/projects/${e}/exports/fcpxml`,Gt=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`,$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(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}`,Ft=async(e,t,r)=>a(te(e,t),{...r,method:"GET"}),re=(e,t)=>`/v1/projects/${e}/exports/${t}/cancel`,_t=async(e,t,r)=>a(re(e,t),{...r,method:"POST"});var Ee={};y(Ee,{analyzeTimeline:()=>lr,analyzeTranscript:()=>ur,cancelHostedProcessingRun:()=>Yt,createMediaUpload:()=>Qt,createUploadToken:()=>Zt,deleteMedia:()=>nr,finalizeMedia:()=>tr,generateMedia:()=>rr,getAnalyzeTimelineUrl:()=>qe,getAnalyzeTranscriptUrl:()=>ve,getCancelHostedProcessingRunUrl:()=>pe,getCreateMediaUploadUrl:()=>de,getCreateUploadTokenUrl:()=>ce,getDeleteMediaUrl:()=>ge,getFinalizeMediaUrl:()=>me,getGenerateMediaUrl:()=>ue,getGetHostedProcessingArtifactUrl:()=>ae,getGetHostedProcessingRunUrl:()=>ie,getGetMediaContextUrl:()=>Ce,getGetMediaDownloadUrlUrl:()=>xe,getGetMediaTranscriptUrl:()=>Re,getGetMediaUrl:()=>ye,getHostedProcessingArtifact:()=>Xt,getHostedProcessingRun:()=>zt,getImportMediaUrl:()=>le,getListMediaFactsUrl:()=>Se,getListMediaUrl:()=>fe,getMedia:()=>sr,getMediaContext:()=>pr,getMediaDownloadUrl:()=>ir,getMediaTranscript:()=>ar,getPurchaseMediaFactUrl:()=>he,getSearchLibraryUrl:()=>ne,getStartHostedProcessingRunUrl:()=>se,getTriggerMatteBakeUrl:()=>Pe,getTriggerSubjectDetectionUrl:()=>be,importMedia:()=>or,listMedia:()=>er,listMediaFacts:()=>fr,purchaseMediaFact:()=>mr,searchLibrary:()=>Vt,startHostedProcessingRun:()=>Wt,triggerMatteBake:()=>dr,triggerSubjectDetection:()=>cr});var ne=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"},Vt=async(e,t)=>a(ne(e),{...t,method:"GET"}),se=e=>`/v1/media/${e}/processing-runs`,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(se(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ie=(e,t)=>`/v1/media/${e}/processing-runs/${t}`,zt=async(e,t,r)=>a(ie(e,t),{...r,method:"GET"}),ae=(e,t,r)=>`/v1/media/${e}/processing-runs/${t}/artifacts/${r}`,Xt=async(e,t,r,n)=>a(ae(e,t,r),{...n,method:"GET"}),pe=(e,t)=>`/v1/media/${e}/processing-runs/${t}/cancel`,Yt=async(e,t,r)=>a(pe(e,t),{...r,method:"POST"}),ce=()=>"/v1/uploads/token",Zt=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)})},de=()=>"/v1/media",Qt=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)})},fe=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"},er=async(e,t)=>a(fe(e),{...t,method:"GET"}),me=e=>`/v1/media/${e}/finalize`,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(me(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ue=()=>"/v1/media/generate",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(ue(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},le=()=>"/v1/media/import",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(le(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},ge=e=>`/v1/media/${e}`,nr=async(e,t)=>a(ge(e),{...t,method:"DELETE"}),ye=(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}`},sr=async(e,t,r)=>a(ye(e,t),{...r,method:"GET"}),xe=e=>`/v1/media/${e}/download-url`,ir=async(e,t)=>a(xe(e),{...t,method:"GET"}),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}/transcript?${n}`:`/v1/media/${e}/transcript`},ar=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}/context?${n}`:`/v1/media/${e}/context`},pr=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}/detect-subjects?${n}`:`/v1/media/${e}/detect-subjects`},cr=async(e,t,r)=>a(be(e,t),{...r,method:"POST"}),Pe=e=>`/v1/media/${e}/matte`,dr=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)})},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}/facts?${n}`:`/v1/media/${e}/facts`},fr=async(e,t,r)=>a(Se(e,t),{...r,method:"GET"}),he=e=>`/v1/media/${e}/facts`,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(he(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},ve=e=>`/v1/media/${e}/transcript/analyze`,ur=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(ve(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},qe=()=>"/v1/timeline-analysis",lr=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(qe(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})};var we={};y(we,{createProject:()=>yr,deleteProject:()=>Cr,getCreateProjectUrl:()=>Te,getDeleteProjectUrl:()=>je,getGetProjectContextUrl:()=>Ae,getGetProjectUrl:()=>Oe,getListProjectsUrl:()=>ke,getPatchProjectUrl:()=>Ie,getProject:()=>xr,getProjectContext:()=>br,listProjects:()=>gr,patchProject:()=>Rr});var ke=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"},gr=async(e,t)=>a(ke(e),{...t,method:"GET"}),Te=()=>"/v1/projects",yr=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)})},Oe=e=>`/v1/projects/${e}`,xr=async(e,t)=>a(Oe(e),{...t,method:"GET"}),Ie=e=>`/v1/projects/${e}`,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(Ie(e),{...r,method:"PATCH",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},je=e=>`/v1/projects/${e}`,Cr=async(e,t)=>a(je(e),{...t,method:"DELETE"}),Ae=e=>`/v1/projects/${e}/context`,br=async(e,t)=>a(Ae(e),{...t,method:"GET"});var Fe={};y(Fe,{cancelRender:()=>qr,createRender:()=>Pr,getCancelRenderUrl:()=>Ne,getCreateRenderUrl:()=>Me,getGetRenderUrl:()=>Be,getListProjectRendersUrl:()=>Ue,getPreviewClipUrl:()=>Ke,getRefreshRenderUrlUrl:()=>Ge,getRender:()=>vr,getRetryRenderUrl:()=>Le,getStreamRenderUrl:()=>$e,listProjectRenders:()=>Sr,previewClip:()=>hr,refreshRenderUrl:()=>kr,retryRender:()=>Er,streamRender:()=>Tr});var Me=e=>`/v1/projects/${e}/renders`,Pr=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(Me(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},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/projects/${e}/renders?${n}`:`/v1/projects/${e}/renders`},Sr=async(e,t,r)=>a(Ue(e,t),{...r,method:"GET"}),Ke=e=>`/v1/projects/${e}/preview-clip`,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(Ke(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},Be=(e,t)=>`/v1/projects/${e}/renders/${t}`,vr=async(e,t,r)=>a(Be(e,t),{...r,method:"GET"}),Ne=(e,t)=>`/v1/projects/${e}/renders/${t}/cancel`,qr=async(e,t,r)=>a(Ne(e,t),{...r,method:"POST"}),Le=(e,t)=>`/v1/projects/${e}/renders/${t}/retry`,Er=async(e,t,r)=>a(Le(e,t),{...r,method:"POST"}),Ge=(e,t)=>`/v1/projects/${e}/renders/${t}/refresh-url`,kr=async(e,t,r)=>a(Ge(e,t),{...r,method:"POST"}),$e=(e,t)=>`/v1/projects/${e}/renders/${t}/stream`,Tr=async(e,t,r)=>a($e(e,t),{...r,method:"GET"});var Xe={};y(Xe,{cancelMuxJob:()=>Br,createSession:()=>Ar,deleteSession:()=>Mr,getCancelMuxJobUrl:()=>ze,getCreateSessionUrl:()=>Je,getDeleteSessionUrl:()=>De,getGetMuxJobUrl:()=>We,getGetSessionUrl:()=>He,getListSessionsUrl:()=>_e,getMuxJob:()=>Kr,getSession:()=>wr,getTriggerMuxJobUrl:()=>Ve,listSessions:()=>jr,triggerMuxJob:()=>Ur});var _e=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"},jr=async(e,t)=>a(_e(e),{...t,method:"GET"}),Je=()=>"/v1/sessions",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(Je(),{...t,method:"POST",headers:{"Content-Type":"application/json",...r(t?.headers)},body:JSON.stringify(e)})},He=e=>`/v1/sessions/${e}`,wr=async(e,t)=>a(He(e),{...t,method:"GET"}),De=e=>`/v1/sessions/${e}`,Mr=async(e,t)=>a(De(e),{...t,method:"DELETE"}),Ve=e=>`/v1/sessions/${e}/mux-job`,Ur=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(Ve(e),{...r,method:"POST",headers:{"Content-Type":"application/json",...n(r?.headers)},body:JSON.stringify(t)})},We=e=>`/v1/sessions/${e}/mux-job`,Kr=async(e,t)=>a(We(e),{...t,method:"GET"}),ze=e=>`/v1/sessions/${e}/mux-job/cancel`,Br=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)})};var _r=[3,4],Jr={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 E="X-CueFrame-Client";var Hr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Dr=["web","console","clips"];function Vr(e,t){return Dr.includes(e)===(t==="browser")}function Ye(e){if(!Hr.test(e.version))throw new Error(`${E} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Vr(e.surface,e.os))throw new Error(`${E} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function Ze(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Wr,writeFileSync as zr,mkdirSync as Xr,existsSync as Yr}from"fs";import{join as Qe}from"path";import{homedir as Zr}from"os";var f={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function A(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 Hh(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var et=Qe(Zr(),".cueframe"),k=Qe(et,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},Qr="prod";function Yh(e=Qr){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 Zh(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 tt(){if(!Yr(k))return{targets:{}};let e=Wr(k,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${k} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function eo(e){Xr(et,{recursive:!0,mode:448}),zr(k,JSON.stringify(e,null,2),{mode:384})}function Qh(e,t="prod",r){let n=tt(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},eo(n)}function rt(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=tt().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 to(){return{[E]:Ye({surface:"cli",version:"0.9.2",os:Ze(process.platform)})}}function ot(e){let{apiKey:t,apiUrl:r}=rt(e);O({baseUrl:r,apiKey:t,headers:to()})}function T(e){let t=e instanceof u?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=j(e);return r?`${t}
|
|
15
|
+
\u2192 ${r}`:t}import ro from"ora";import oo from"pino";var no="v1",nt=oo({level:"trace",base:{schemaVersion:no},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function w(e,t){return ro({text:e,isSilent:!!t}).start()}function C(e,t,r={}){e.json&&nt.info(r,t)}function pv(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?nt.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 cv(e,t){t.json||console.log(e)}function so(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<=31||r===127)return!0}return!1}function it(e,t,r){e.length===0&&st(`${t} is empty.`,r),so(e)&&st(`${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 st(e,t){M(t,"preflight",new Error(e),f.UserError),S(f.UserError)}var io=5e3,K=300*1e3;async function Cv(e,t){if(it(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}ot(t.target),C(t,"analyze_prepare",{mediaItemId:e,target:t.target,wait:!!t.wait});let r=w("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,A(i)),S(A(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=w("Waiting for analysis to complete\u2026",t.json),s=Date.now();for(;;){await new Promise(i=>setTimeout(i,io)),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`),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,N as c,a as d,j as e,mt as f,P as g,Z as h,oe as i,Ee as j,we as k,Fe as l,Xe as m,_r as n,Jr as o,f as p,A as q,Hh as r,S as s,Yh as t,Zh as u,Qh as v,to as w,ot as x,T as y,w as z,C as A,pv as B,M as C,U as D,cv as E,it as F,Cv as G};
|