cueframe 0.12.8 → 0.12.9

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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{L as a}from"./chunk-R6NZ7IQ4.js";import"./chunk-3QSA3EBY.js";export{a as analyzeCommand};
@@ -11,7 +11,7 @@ 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"}]}};function zr(e){return e.replace(/^W\//,"").replace(/-gzip(?=("?)$)/,"")}var E="X-CueFrame-Client";var Yr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Xr=["web","console","clips"];function Zr(e,t){return Xr.includes(e)===(t==="browser")}function et(e){if(!Yr.test(e.version))throw new Error(`${E} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Zr(e.surface,e.os))throw new Error(`${E} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function tt(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Qr,writeFileSync as eo,mkdirSync as to,existsSync as ro}from"fs";import{join as rt}from"path";import{homedir as oo}from"os";var f={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function M(e){if(e instanceof l){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 oT(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var ot=rt(oo(),".cueframe"),T=rt(ot,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},no="prod";function cT(e=no){return process.env.CUEFRAME_API_URL??R[e]??R.prod}var h=class extends Error{constructor(r,n){super(n);this.code=r;this.name="AuthStoreError"}code;exitCode=f.UserError};function mT(e){if(!/^cf_(?:live|test)_[A-Za-z0-9_-]{8,}$/.test(e))throw new h("auth_invalid","Invalid API key. Expected a key beginning with cf_live_ or cf_test_.")}function nt(){if(!ro(T))return{targets:{}};let e=Qr(T,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${T} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function so(e){to(ot,{recursive:!0,mode:448}),eo(T,JSON.stringify(e,null,2),{mode:384})}function fT(e,t="prod",r){let n=nt(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},so(n)}function st(e="prod"){let t=process.env.CUEFRAME_API_KEY,r=process.env.CUEFRAME_API_URL;if(t)return{apiKey:t,apiUrl:r??R[e]??R.prod};let o=nt().targets[e];if(!o)throw new h("auth_missing",`No auth configured for target "${e}". Run \`cueframe login --target ${e}\` (browser sign-in) or \`cueframe auth <api-key> --target ${e}\` (CI / headless).`);return o}function io(){return{[E]:et({surface:"cli",version:"0.12.8",os:tt(process.platform)})}}function it(e,t={}){let{apiKey:r,apiUrl:n}=st(e);I({baseUrl:n,apiKey:r,headers:io(),...t})}function k(e){let t=e instanceof l?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=A(e);return r?`${t}
14
+ </script></template>`,manifest:{version:4,runtime:"hyperframes",hfContract:1,kind:"scene",assets:{},graphics:{api:"webgl2",required:!0,accelerationPreference:"software-allowed"},alphaPolicy:"allows-opaque"},definition:{inputSchema:{type:"object",additionalProperties:!1,properties:{background:{type:"string",pattern:"^#[0-9a-fA-F]{6}$",default:"#101014",title:"Background"}}},defaults:{},brandBindings:[],timing:{defaultDuration:{frames:90,fps:30}},capabilities:[{kind:"clip"}]}};function zr(e){return e.replace(/^W\//,"").replace(/-gzip(?=("?)$)/,"")}var E="X-CueFrame-Client";var Yr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Xr=["web","console","clips"];function Zr(e,t){return Xr.includes(e)===(t==="browser")}function et(e){if(!Yr.test(e.version))throw new Error(`${E} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Zr(e.surface,e.os))throw new Error(`${E} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function tt(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Qr,writeFileSync as eo,mkdirSync as to,existsSync as ro}from"fs";import{join as rt}from"path";import{homedir as oo}from"os";var f={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function M(e){if(e instanceof l){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 oT(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var ot=rt(oo(),".cueframe"),T=rt(ot,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},no="prod";function cT(e=no){return process.env.CUEFRAME_API_URL??R[e]??R.prod}var h=class extends Error{constructor(r,n){super(n);this.code=r;this.name="AuthStoreError"}code;exitCode=f.UserError};function mT(e){if(!/^cf_(?:live|test)_[A-Za-z0-9_-]{8,}$/.test(e))throw new h("auth_invalid","Invalid API key. Expected a key beginning with cf_live_ or cf_test_.")}function nt(){if(!ro(T))return{targets:{}};let e=Qr(T,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${T} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function so(e){to(ot,{recursive:!0,mode:448}),eo(T,JSON.stringify(e,null,2),{mode:384})}function fT(e,t="prod",r){let n=nt(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},so(n)}function st(e="prod"){let t=process.env.CUEFRAME_API_KEY,r=process.env.CUEFRAME_API_URL;if(t)return{apiKey:t,apiUrl:r??R[e]??R.prod};let o=nt().targets[e];if(!o)throw new h("auth_missing",`No auth configured for target "${e}". Run \`cueframe login --target ${e}\` (browser sign-in) or \`cueframe auth <api-key> --target ${e}\` (CI / headless).`);return o}function io(){return{[E]:et({surface:"cli",version:"0.12.9",os:tt(process.platform)})}}function it(e,t={}){let{apiKey:r,apiUrl:n}=st(e);I({baseUrl:n,apiKey:r,headers:io(),...t})}function k(e){let t=e instanceof l?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=A(e);return r?`${t}
15
15
  \u2192 ${r}`:t}import ao from"ora";import po from"pino";var co="v1",at=po({level:"trace",base:{schemaVersion:co},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function w(e,t){return ao({text:e,isSilent:!!t}).start()}function C(e,t,r={}){e.json&&at.info(r,t)}function bT(e,t,r){if(e.json){console.log(JSON.stringify(t,null,2));return}r()}function U(e,t,r,n){let o=r instanceof Error?r.message:String(r),s=typeof r?.code=="string"?r.code:void 0,i=r?.status;e.json?at.info({phase:t,message:o,...s?{code:s}:{},...typeof i=="number"?{status:i}:{},exitCode:n},"error"):process.stderr.write(`\u2716 ${t}: ${k(r)}
16
16
  `)}function K(e,t,r,n){e.json&&U(e,t,r,n)}function PT(e,t){t.json||console.log(e)}function mo(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<=31||r===127)return!0}return!1}function ct(e,t,r){e.length===0&&pt(`${t} is empty.`,r),mo(e)&&pt(`${t} contains a control character (newline, tab, or null byte). Identifiers must be plain text \u2014 check for a stray copy-paste artifact.`,r)}function pt(e,t){U(t,"preflight",new Error(e),f.UserError),S(f.UserError)}var fo=5e3,N=300*1e3;async function jT(e,t){if(ct(e,"mediaItemId",t),t.dryRun){C(t,"analyze_dry_run",{mediaItemId:e,target:t.target,wait:!!t.wait,wouldCall:"POST /v1/media/:id/suggestions"}),t.json||console.log(`[dry-run] Would trigger clip analysis for ${e} on ${t.target}.`);return}it(t.target),C(t,"analyze_prepare",{mediaItemId:e,target:t.target,wait:!!t.wait});let r=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: ${k(i)}`),K(t,"analyze_prepare",i,M(i)),S(M(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,fo)),Date.now()-s>N&&(o.fail(`Timed out after ${Math.round(N/1e3)}s. Run \`cueframe clips ${e}\` to check later.`),K(t,"analyze_progress",new Error(`Analysis did not complete within ${Math.round(N/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((d,c)=>{let m=(d.trim.end-d.trim.start).toFixed(1);console.log(`