cueframe 0.4.2 → 0.4.3
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 +661 -0
- package/README.md +1 -1
- package/dist/analyze-4EGOBMRV.js +2 -0
- package/dist/chunk-3QSA3EBY.js +0 -0
- package/dist/chunk-QKQNZIRI.js +12 -0
- package/dist/cueframe.js +22 -22
- package/dist/supportedAgents.js +0 -0
- package/package.json +13 -14
- package/skills/_connect.md +0 -17
- package/skills/clip-a-talking-head/SKILL.md +3 -2
- package/skills/composing-video/SKILL.md +2 -2
- package/skills/video-craft-standards/SKILL.md +4 -3
- package/dist/analyze-6QSD7KHH.js +0 -2
- package/dist/chunk-7TCLKYUZ.js +0 -12
|
@@ -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(o,t,n){super(t.message),this.name="ApiError",this.status=o,this.code=t.code,this.details=t.details,this.requestId=n}},P=class extends Error{url;timeoutMs;constructor(o,t){super(`Request timed out after ${t}ms: ${o}`),this.name="TimeoutError",this.url=o,this.timeoutMs=t}},k=class extends Error{url;constructor(o,t){super(`Request failed before a response: ${o}`,{cause:t}),this.name="NetworkError",this.url=o}},l={baseUrl:""};function T(e){return l={timeoutMs:3e4,...e},l}function b(){return l}function Ve(e,o){return/^https?:\/\//.test(o)?o:e.replace(/\/$/,"")+(o.startsWith("/")?o:`/${o}`)}async function j(e,o={}){if(!l.baseUrl)throw new Error("@cueframe/sdk: createClient({baseUrl}) must be called before issuing requests.");let t=l.fetch??fetch,n=Ve(l.baseUrl,e),s=new Headers({accept:"application/json"});for(let[a,f]of Object.entries(l.headers??{}))s.set(a,f);o.headers&&new Headers(o.headers).forEach((a,f)=>s.set(f,a)),l.apiKey&&!s.has("authorization")&&s.set("authorization",`Bearer ${l.apiKey}`);let i=l.timeoutMs??3e4,p=new AbortController,c=setTimeout(()=>p.abort(),i),d=o.signal?AbortSignal.any([o.signal,p.signal]):p.signal;try{let a=await t(n,{...o,headers:s,signal:d}),f={};a.headers.forEach((g,R)=>{f[R.toLowerCase()]=g});let x=null;if(a.status!==204)if((a.headers.get("content-type")??"").includes("application/json"))try{x=await a.json()}catch{x=null}else x=await a.text();return{status:a.status,statusText:a.statusText,headers:f,body:x,requestId:f["x-request-id"]}}catch(a){throw o.signal?.aborted?a:p.signal.aborted?new P(n,i):new k(n,a)}finally{clearTimeout(c)}}async function r(e,o={}){let t=await j(e,o);if(t.status>=400){let n;throw t.body&&typeof t.body=="object"&&"error"in t.body?n=t.body.error??{code:"unknown",message:t.statusText}:n={code:"unknown",message:t.statusText},new u(t.status,n,t.requestId)}if(t.status!==204)return t.body}var He={unauthorized:"The API key is invalid or expired for this target. Run `cueframe login` (or `cueframe auth <api-key>`), and check the key matches the target environment.",forbidden:"The key's scopes don't allow this operation. Create a key with the needed preset (`cueframe keys create --preset ...`) or use a key with wider scopes.",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 E(e){return e instanceof u?He[e.code]??null:null}async function*Ye(e,o,t){let n=b();if(!n?.baseUrl)throw new Error(`@cueframe/sdk: createClient({baseUrl}) must be called before ${o}.`);let s=n.baseUrl.replace(/\/$/,"")+e,i=new Headers({accept:"text/event-stream",...n.headers??{}});n.apiKey&&!i.has("authorization")&&i.set("authorization",`Bearer ${n.apiKey}`);let c=await(n.fetch??fetch)(s,{method:"GET",headers:i,signal:t.signal});if(!c.ok){let x;try{x=(await c.json()).error??{code:"unknown",message:c.statusText}}catch{x={code:"unknown",message:c.statusText}}throw new u(c.status,x,c.headers.get("x-request-id")??void 0)}if(!c.body)throw new Error("SSE response has no body");let d=c.body.getReader(),a=new TextDecoder("utf-8"),f="";try{for(;;){let{value:x,done:g}=await d.read();if(g)break;f+=a.decode(x,{stream:!0});let R=f.indexOf(`
|
|
3
|
+
|
|
4
|
+
`);for(;R!==-1;){let Ze=f.slice(0,R);f=f.slice(R+2);let M=Qe(Ze);M&&(yield M),R=f.indexOf(`
|
|
5
|
+
|
|
6
|
+
`)}}}finally{try{d.releaseLock()}catch{}}}function Qe(e){if(!e.trim())return null;let o=null,t=[];for(let n of e.split(`
|
|
7
|
+
`)){if(!n||n.startsWith(":"))continue;let s=n.indexOf(":");if(s===-1)continue;let i=n.slice(0,s),p=n.slice(s+1).replace(/^ /,"");i==="event"?o=p:i==="data"&&t.push(p)}return!o||t.length===0?null:{event:o,data:t.join(`
|
|
8
|
+
`)}}async function*Xe(e,o,t={}){let n=`/v1/projects/${encodeURIComponent(e)}/renders/${encodeURIComponent(o)}/stream`;for await(let s of Ye(n,"iterRenderEvents",t)){let i=eo(s);i&&(yield i)}}function eo(e){let{event:o,data:t}=e;if(t===null||o!=="progress"&&o!=="complete"&&o!=="error")return null;let n;try{n=JSON.parse(t)}catch{return null}return{event:o,data:n}}var h={};y(h,{composeFromSuggestion:()=>io,getComposeFromSuggestionUrl:()=>G,getListMediaSuggestionsUrl:()=>U,getResetMediaSuggestionsUrl:()=>$,getSuggestBriefsUrl:()=>L,listMediaSuggestions:()=>ao,resetMediaSuggestions:()=>mo,suggestBriefs:()=>fo});var G=e=>`/v1/projects/${e}/composition/from-suggestion`,io=async(e,o,t)=>r(G(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),U=e=>`/v1/media/${e}/suggestions`,ao=async(e,o)=>r(U(e),{...o,method:"GET"}),L=e=>`/v1/media/${e}/suggestions`,fo=async(e,o)=>r(L(e),{...o,method:"POST"}),$=e=>`/v1/media/${e}/suggestions`,mo=async(e,o)=>r($(e),{...o,method:"DELETE"});var D={};y(D,{createComponent:()=>uo,getComponent:()=>lo,getComponentSource:()=>yo,getCreateComponentUrl:()=>J,getGetComponentSourceUrl:()=>z,getGetComponentUrl:()=>W,getListCatalogUrl:()=>_,getUpdateComponentUrl:()=>N,listCatalog:()=>co,updateComponent:()=>xo});var _=e=>{let o=new URLSearchParams;Object.entries(e||{}).forEach(([n,s])=>{s!==void 0&&o.append(n,s===null?"null":s.toString())});let t=o.toString();return t.length>0?`/v1/components?${t}`:"/v1/components"},co=async(e,o)=>r(_(e),{...o,method:"GET"}),J=()=>"/v1/components",uo=async(e,o)=>r(J(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),N=e=>`/v1/components/${e}`,xo=async(e,o,t)=>r(N(e),{...t,method:"PUT",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),W=e=>`/v1/components/${e}`,lo=async(e,o)=>r(W(e),{...o,method:"GET"}),z=e=>`/v1/components/${e}/source`,yo=async(e,o)=>r(z(e),{...o,method:"GET"});var Q={};y(Q,{cancelExport:()=>Io,createFcpxmlExport:()=>Po,createPremiereExport:()=>ko,getCancelExportUrl:()=>Y,getCreateFcpxmlExportUrl:()=>Z,getCreatePremiereExportUrl:()=>V,getExport:()=>vo,getGetExportUrl:()=>H});var Z=e=>`/v1/projects/${e}/exports/fcpxml`,Po=async(e,o,t)=>r(Z(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),V=e=>`/v1/projects/${e}/exports/premiere`,ko=async(e,o,t)=>r(V(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),H=(e,o)=>`/v1/projects/${e}/exports/${o}`,vo=async(e,o,t)=>r(H(e,o),{...t,method:"GET"}),Y=(e,o)=>`/v1/projects/${e}/exports/${o}/cancel`,Io=async(e,o,t)=>r(Y(e,o),{...t,method:"POST"});var ye={};y(ye,{analyzeTranscript:()=>zo,createMediaUpload:()=>Bo,createUploadToken:()=>wo,deleteMedia:()=>jo,finalizeMedia:()=>Fo,generateMedia:()=>Ao,getAnalyzeTranscriptUrl:()=>le,getCreateMediaUploadUrl:()=>oe,getCreateUploadTokenUrl:()=>ee,getDeleteMediaUrl:()=>pe,getFinalizeMediaUrl:()=>re,getGenerateMediaUrl:()=>ne,getGetMediaContextUrl:()=>fe,getGetMediaPerformanceUrl:()=>xe,getGetMediaTranscriptUrl:()=>ae,getGetMediaUrl:()=>ie,getImportMediaUrl:()=>se,getListMediaFactsUrl:()=>de,getListMediaUrl:()=>te,getMedia:()=>Go,getMediaContext:()=>Lo,getMediaPerformance:()=>Wo,getMediaTranscript:()=>Uo,getPurchaseMediaFactUrl:()=>ue,getSearchLibraryUrl:()=>X,getTriggerMatteBakeUrl:()=>ce,getTriggerSubjectDetectionUrl:()=>me,importMedia:()=>Mo,listMedia:()=>Ko,listMediaFacts:()=>Jo,purchaseMediaFact:()=>No,searchLibrary:()=>Eo,triggerMatteBake:()=>_o,triggerSubjectDetection:()=>$o});var X=e=>{let o=new URLSearchParams;Object.entries(e||{}).forEach(([n,s])=>{s!==void 0&&o.append(n,s===null?"null":s.toString())});let t=o.toString();return t.length>0?`/v1/media/search?${t}`:"/v1/media/search"},Eo=async(e,o)=>r(X(e),{...o,method:"GET"}),ee=()=>"/v1/uploads/token",wo=async(e,o)=>r(ee(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),oe=()=>"/v1/media",Bo=async(e,o)=>r(oe(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),te=()=>"/v1/media",Ko=async e=>r(te(),{...e,method:"GET"}),re=e=>`/v1/media/${e}/finalize`,Fo=async(e,o,t)=>r(re(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),ne=()=>"/v1/media/generate",Ao=async(e,o)=>r(ne(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),se=()=>"/v1/media/import",Mo=async(e,o)=>r(se(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),pe=e=>`/v1/media/${e}`,jo=async(e,o)=>r(pe(e),{...o,method:"DELETE"}),ie=e=>`/v1/media/${e}`,Go=async(e,o)=>r(ie(e),{...o,method:"GET"}),ae=e=>`/v1/media/${e}/transcript`,Uo=async(e,o)=>r(ae(e),{...o,method:"GET"}),fe=e=>`/v1/media/${e}/context`,Lo=async(e,o)=>r(fe(e),{...o,method:"GET"}),me=e=>`/v1/media/${e}/detect-subjects`,$o=async(e,o)=>r(me(e),{...o,method:"POST"}),ce=e=>`/v1/media/${e}/matte`,_o=async(e,o,t)=>r(ce(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),de=(e,o)=>{let t=new URLSearchParams;Object.entries(o||{}).forEach(([s,i])=>{i!==void 0&&t.append(s,i===null?"null":i.toString())});let n=t.toString();return n.length>0?`/v1/media/${e}/facts?${n}`:`/v1/media/${e}/facts`},Jo=async(e,o,t)=>r(de(e,o),{...t,method:"GET"}),ue=e=>`/v1/media/${e}/facts`,No=async(e,o,t)=>r(ue(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),xe=e=>`/v1/media/${e}/performance`,Wo=async(e,o)=>r(xe(e),{...o,method:"GET"}),le=e=>`/v1/media/${e}/transcript/analyze`,zo=async(e,o,t)=>r(le(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)});var Pe={};y(Pe,{createProject:()=>Zo,deleteProject:()=>Yo,getCreateProjectUrl:()=>Oe,getDeleteProjectUrl:()=>he,getGetProjectContextUrl:()=>Se,getGetProjectUrl:()=>Ce,getListProjectsUrl:()=>Re,getPatchProjectUrl:()=>ge,getProject:()=>Vo,getProjectContext:()=>Qo,listProjects:()=>Do,patchProject:()=>Ho});var Re=()=>"/v1/projects",Do=async e=>r(Re(),{...e,method:"GET"}),Oe=()=>"/v1/projects",Zo=async(e,o)=>r(Oe(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),Ce=e=>`/v1/projects/${e}`,Vo=async(e,o)=>r(Ce(e),{...o,method:"GET"}),ge=e=>`/v1/projects/${e}`,Ho=async(e,o,t)=>r(ge(e),{...t,method:"PATCH",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),he=e=>`/v1/projects/${e}`,Yo=async(e,o)=>r(he(e),{...o,method:"DELETE"}),Se=e=>`/v1/projects/${e}/context`,Qo=async(e,o)=>r(Se(e),{...o,method:"GET"});var Be={};y(Be,{cancelRender:()=>nt,createRender:()=>et,getCancelRenderUrl:()=>Te,getCreateRenderUrl:()=>ke,getGetRenderUrl:()=>qe,getListProjectRendersUrl:()=>ve,getPreviewClipUrl:()=>Ie,getRefreshRenderUrlUrl:()=>Ee,getRender:()=>rt,getRetryRenderUrl:()=>be,getStreamRenderUrl:()=>we,listProjectRenders:()=>ot,previewClip:()=>tt,refreshRenderUrl:()=>pt,retryRender:()=>st,streamRender:()=>it});var ke=e=>`/v1/projects/${e}/renders`,et=async(e,o,t)=>r(ke(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),ve=e=>`/v1/projects/${e}/renders`,ot=async(e,o)=>r(ve(e),{...o,method:"GET"}),Ie=e=>`/v1/projects/${e}/preview-clip`,tt=async(e,o,t)=>r(Ie(e),{...t,method:"POST",headers:{"Content-Type":"application/json",...t?.headers},body:JSON.stringify(o)}),qe=(e,o)=>`/v1/projects/${e}/renders/${o}`,rt=async(e,o,t)=>r(qe(e,o),{...t,method:"GET"}),Te=(e,o)=>`/v1/projects/${e}/renders/${o}/cancel`,nt=async(e,o,t)=>r(Te(e,o),{...t,method:"POST"}),be=(e,o)=>`/v1/projects/${e}/renders/${o}/retry`,st=async(e,o,t)=>r(be(e,o),{...t,method:"POST"}),Ee=(e,o)=>`/v1/projects/${e}/renders/${o}/refresh-url`,pt=async(e,o,t)=>r(Ee(e,o),{...t,method:"POST"}),we=(e,o)=>`/v1/projects/${e}/renders/${o}/stream`,it=async(e,o,t)=>r(we(e,o),{...t,method:"GET"});var Ue={};y(Ue,{createSession:()=>ct,deleteSession:()=>ut,getCreateSessionUrl:()=>Fe,getDeleteSessionUrl:()=>Me,getGetMuxJobUrl:()=>Ge,getGetSessionUrl:()=>Ae,getListSessionsUrl:()=>Ke,getMuxJob:()=>lt,getSession:()=>dt,getTriggerMuxJobUrl:()=>je,listSessions:()=>mt,triggerMuxJob:()=>xt});var Ke=()=>"/v1/sessions",mt=async e=>r(Ke(),{...e,method:"GET"}),Fe=()=>"/v1/sessions",ct=async(e,o)=>r(Fe(),{...o,method:"POST",headers:{"Content-Type":"application/json",...o?.headers},body:JSON.stringify(e)}),Ae=e=>`/v1/sessions/${e}`,dt=async(e,o)=>r(Ae(e),{...o,method:"GET"}),Me=e=>`/v1/sessions/${e}`,ut=async(e,o)=>r(Me(e),{...o,method:"DELETE"}),je=e=>`/v1/sessions/${e}/mux-job`,xt=async(e,o)=>r(je(e),{...o,method:"POST"}),Ge=e=>`/v1/sessions/${e}/mux-job`,lt=async(e,o)=>r(Ge(e),{...o,method:"GET"});import{readFileSync as gt,writeFileSync as ht,mkdirSync as St,existsSync as Pt}from"fs";import{join as Le}from"path";import{homedir as kt}from"os";var m={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function w(e){if(e instanceof u){if(e.status===402)return m.PaymentRequired;if(e.status>=500)return m.ApiServerError;if(e.status>=400)return m.ApiClientError}let o=e?.exitCode;return typeof o=="number"?o:m.NetworkError}function tb(e){return e===402?m.PaymentRequired:e>=500?m.ApiServerError:e>=400?m.ApiClientError:m.Success}function S(e){process.exit(e)}var $e=Le(kt(),".cueframe"),v=Le($e,"auth.json"),O={local:"http://127.0.0.1:3211",dev:"https://api-dev.cueframe.ai",prod:"https://api.cueframe.ai"},vt="prod";function ab(e=vt){return process.env.CUEFRAME_API_URL??O[e]??O.prod}var I=class extends Error{constructor(t,n){super(n);this.code=t;this.name="AuthStoreError"}code;exitCode=m.UserError};function _e(){if(!Pt(v))return{targets:{}};let e=gt(v,"utf-8");try{return JSON.parse(e)}catch{throw new I("auth_config_corrupt",`${v} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function It(e){St($e,{recursive:!0,mode:448}),ht(v,JSON.stringify(e,null,2),{mode:384})}function fb(e,o="prod",t){let n=_e(),s=O[o]??O.prod;n.targets[o]={apiKey:e,apiUrl:t??s},It(n)}function Je(e="prod"){let o=process.env.CUEFRAME_API_KEY,t=process.env.CUEFRAME_API_URL;if(o)return{apiKey:o,apiUrl:t??O[e]??O.prod};let s=_e().targets[e];if(!s)throw new I("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 s}function Ne(e){let{apiKey:o,apiUrl:t}=Je(e);T({baseUrl:t,apiKey:o})}function q(e){let o=e instanceof u?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),t=E(e);return t?`${o}
|
|
9
|
+
\u2192 ${t}`:o}import qt from"ora";import Tt from"pino";var bt="v1",We=Tt({level:"trace",base:{schemaVersion:bt},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function B(e,o){return qt({text:e,isSilent:!!o}).start()}function C(e,o,t={}){e.json&&We.info(t,o)}function Rb(e,o,t){if(e.json){console.log(JSON.stringify(o,null,2));return}t()}function K(e,o,t,n){let s=t instanceof Error?t.message:String(t),i=typeof t?.code=="string"?t.code:void 0,p=t?.status;e.json?We.info({phase:o,message:s,...i?{code:i}:{},...typeof p=="number"?{status:p}:{},exitCode:n},"error"):process.stderr.write(`\u2716 ${o}: ${q(t)}
|
|
10
|
+
`)}function F(e,o,t,n){e.json&&K(e,o,t,n)}function Ob(e,o){o.json||console.log(e)}function Et(e){for(let o=0;o<e.length;o++){let t=e.charCodeAt(o);if(t<=31||t===127)return!0}return!1}function De(e,o,t){e.length===0&&ze(`${o} is empty.`,t),Et(e)&&ze(`${o} contains a control character (newline, tab, or null byte). Identifiers must be plain text \u2014 check for a stray copy-paste artifact.`,t)}function ze(e,o){K(o,"preflight",new Error(e),m.UserError),S(m.UserError)}var wt=5e3,A=300*1e3;async function Tb(e,o){if(De(e,"mediaItemId",o),o.dryRun){C(o,"analyze_dry_run",{mediaItemId:e,target:o.target,wait:!!o.wait,wouldCall:"POST /v1/media/:id/suggestions"}),o.json||console.log(`[dry-run] Would trigger clip analysis for ${e} on ${o.target}.`);return}Ne(o.target),C(o,"analyze_prepare",{mediaItemId:e,target:o.target,wait:!!o.wait});let t=B("Triggering clip analysis\u2026",o.json),n;try{n=await h.suggestBriefs(e),t.succeed(n.workflowId?`Analysis started (workflow: ${n.workflowId})`:`Analysis ${n.alreadyRunning?"already running":"started"}`)}catch(p){t.fail(`Failed to start analysis: ${q(p)}`),F(o,"analyze_prepare",p,w(p)),S(w(p))}if(C(o,"analyze_ready",{mediaItemId:e,workflowId:n.workflowId,alreadyRunning:!!n.alreadyRunning}),!o.wait){o.json||console.log(`
|
|
11
|
+
Run \`cueframe clips ${e}\` to check results.`);return}let s=B("Waiting for analysis to complete\u2026",o.json),i=Date.now();for(;;){await new Promise(p=>setTimeout(p,wt)),Date.now()-i>A&&(s.fail(`Timed out after ${Math.round(A/1e3)}s. Run \`cueframe clips ${e}\` to check later.`),F(o,"analyze_progress",new Error(`Analysis did not complete within ${Math.round(A/1e3)}s`),m.UserError),S(m.UserError));try{let p=await h.listMediaSuggestions(e);if(p.suggestions.length>0){s.succeed(`Analysis complete \u2014 ${p.suggestions.length} clips found`),C(o,"analyze_complete",{mediaItemId:e,durationMs:Date.now()-i,suggestionCount:p.suggestions.length,suggestions:p.suggestions}),o.json||p.suggestions.forEach((d,a)=>{let f=(d.trim.end-d.trim.start).toFixed(1);console.log(`
|
|
12
|
+
${a+1}. ${d.title} (${d.id})`),console.log(` ${d.trim.start.toFixed(1)}s \u2013 ${d.trim.end.toFixed(1)}s (${f}s) score: ${d.score}`),console.log(` ${d.reason}`)});return}let c=Math.round((Date.now()-i)/1e3);s.text=`Waiting for analysis\u2026 (${c}s)`,C(o,"analyze_progress",{mediaItemId:e,elapsedSec:c})}catch{}}}export{u as a,T as b,j as c,r as d,E as e,Xe as f,h as g,D as h,Q as i,ye as j,Pe as k,Be as l,Ue as m,m as n,w as o,tb as p,S as q,ab as r,fb as s,Ne as t,q as u,B as v,C as w,Rb as x,K as y,F as z,Ob as A,De as B,Tb as C};
|