cueframe 0.9.2 → 0.9.4
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.
|
@@ -11,8 +11,8 @@ function Blank({ params }) {
|
|
|
11
11
|
return h(MediaTileScene, { streams: {}, tiles: [], background: params.background ?? '#101014' });
|
|
12
12
|
}
|
|
13
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
|
|
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
|
|
16
|
-
`)}function U(e,t,r,n){e.json&&M(e,t,r,n)}function
|
|
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 _h(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 zh(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 Xh(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 Yh(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.4",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 iv(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 av(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 xv(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
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,
|
|
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,_h as r,S as s,zh as t,Xh as u,Yh as v,to as w,ot as x,T as y,w as z,C as A,iv as B,M as C,U as D,av as E,it as F,xv as G};
|