@vivipilot/cli 0.1.4 → 0.1.5
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/{chunk-ZIATVRTF.js → chunk-QQW45E53.js} +1 -1
- package/dist/chunk-WFXDNIZA.js +8 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/mcp-53ZEPAXS.js +1 -0
- package/dist/render-YGM7ZIQD.js +1 -0
- package/package.json +1 -1
- package/dist/chunk-JJDAKVXA.js +0 -8
- package/dist/mcp-DTGU64NI.js +0 -1
- package/dist/render-CVXYAUBY.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{a as k}from"./chunk-FGUKEVKT.js";import{f as b}from"./chunk-L3C7EOPY.js";import{mkdir as V,writeFile as E}from"fs/promises";import{dirname as x}from"path";import{createInterface as A}from"readline";import{randomUUID as q}from"crypto";var J="2025-06-18";function S(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function g(e,o){let n=e[o];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function p(e,o){let n=e[o];return typeof n=="string"&&n.trim()?n.trim():void 0}function P(e){let o=p(e,"prompt");if(!o)throw new Error("prompt is required");let n=p(e,"engine"),l=n==="pixi"||n==="three"||n==="auto"?n:void 0,m=g(e,"width"),r=g(e,"height"),t=g(e,"fps"),i=g(e,"durationSeconds")??g(e,"duration");return{prompt:o,...m||r||t?{canvas:{width:m,height:r,fps:t}}:{},...i?{durationSeconds:i}:{},...l?{enginePreference:l}:{}}}function u(e,o=!1){return{content:[{type:"text",text:JSON.stringify(e,null,2)}],structuredContent:e,isError:o}}function M(e){let o=e instanceof Error?e.message:String(e);return u({ok:!1,error:o},!0)}async function R(e,o){await V(x(e),{recursive:!0}),await E(e,`${JSON.stringify(o,null,2)}
|
|
2
|
-
`,"utf8")}async function T(e,o,n){let{verifyManifestFile:l}=await import("./manifest-TDCIHZ46.js");return l(e,o,n)}function N(){return[{name:"vivipilot_get_balance",title:"Get Vivipilot paid credit balance",description:"Returns Vivipilot account balance and paid top-up balance. CLI/MCP generation is paid-only and never grants trial credits.",inputSchema:{type:"object",properties:{},additionalProperties:!1}},{name:"vivipilot_estimate_motion_layout",title:"Estimate Vivipilot motion layout credits",description:"Estimates paid credits for a cloud layout generation. This does not burn credits.",inputSchema:{type:"object",properties:{prompt:{type:"string"},width:{type:"number"},height:{type:"number"},fps:{type:"number"},durationSeconds:{type:"number"},engine:{type:"string",enum:["pixi","three","auto"]}},required:["prompt"],additionalProperties:!1}},{name:"vivipilot_generate_motion_layout",title:"Generate signed Vivipilot render manifest",description:"Paid-only cloud generation. Burns paid credits only after cloud orchestration is wired; local rendering uses the client's hardware.",inputSchema:{type:"object",properties:{prompt:{type:"string"},out:{type:"string"},idempotencyKey:{type:"string"},width:{type:"number"},height:{type:"number"},fps:{type:"number"},durationSeconds:{type:"number"},engine:{type:"string",enum:["pixi","three","auto"]}},required:["prompt"],additionalProperties:!1}},{name:"vivipilot_verify_manifest",title:"Verify Vivipilot render manifest",description:"Verifies a signed Vivipilot manifest locally using public keys. This does not burn credits.",inputSchema:{type:"object",properties:{manifestPath:{type:"string"}},required:["manifestPath"],additionalProperties:!1}},{name:"vivipilot_render_video",title:"Render Vivipilot video locally",description:"Renders a signed manifest on local hardware after signature verification. No cloud rendering is used.",inputSchema:{type:"object",properties:{manifestPath:{type:"string"},out:{type:"string"},verifyOnly:{type:"boolean"}},required:["manifestPath"],additionalProperties:!1}},{name:"vivipilot_get_generation_status",title:"Get Vivipilot generation status",description:"Checks cloud status for a Vivipilot layout generation. This does not burn credits.",inputSchema:{type:"object",properties:{generationId:{type:"string"}},required:["generationId"],additionalProperties:!1}}]}async function O(e,o,n,l,m){let r=S(o)?o:{};try{switch(e){case"vivipilot_get_balance":{let t=await n.balance(),a=(typeof t.paidBalance=="number"?t.paidBalance:0)>0?[{tool:"vivipilot_estimate_motion_layout",reason:"Estimate credits for a generation before spending."},{tool:"vivipilot_generate_motion_layout",reason:"Generate a signed manifest (paid credits will be burned)."}]:[{action:"topup",reason:`Buy credits at ${b(l,m)}/edit?billing=topup before generating. CLI/MCP generation is paid-only.`}];return u({ok:!0,...t,nextActions:a})}case"vivipilot_estimate_motion_layout":{let t=await n.estimate(P(r)),i=typeof t.estimatedCredits=="number"?t.estimatedCredits:0;return u({ok:!0,...t,nextActions:[{tool:"vivipilot_generate_motion_layout",reason:`Generate now for ~${i} credits (paid-only).`},{tool:"vivipilot_get_balance",reason:"Check balance before generating."}]})}case"vivipilot_generate_motion_layout":{let t=p(r,"out")??"scene.vivi.json",i=p(r,"idempotencyKey")??`mcp_${q()}`,a=P(r),f=await n.startGenerate({...a,outputFormat:"manifest"},i),d=f.generationId;if(f.idempotentReplay&&f.status==="completed"){let s=await n.generationProgress(d);if(s.manifestData)return await R(t,s.manifestData),u({ok:!0,generationId:d,manifestPath:t,creditsCharged:s.creditsCharged??null,status:"completed",nextActions:[{tool:"vivipilot_verify_manifest",args:{manifestPath:t},reason:"Verify the signed manifest locally before rendering."},{tool:"vivipilot_render_video",args:{manifestPath:t},reason:"Render the manifest to video on local hardware."}]})}let v=3e5,_=2e3,w=Date.now(),c="";for(;Date.now()-w<v;){await new Promise(I=>setTimeout(I,_));let s;try{s=await n.generationProgress(d)}catch{continue}if(s.progressMessage&&s.progressMessage!==c&&(c=s.progressMessage),s.status==="completed"&&s.manifestData)return await R(t,s.manifestData),u({ok:!0,generationId:d,manifestPath:t,creditsCharged:s.creditsCharged??null,engine:s.engine,status:"completed",progressLog:c,nextActions:[{tool:"vivipilot_verify_manifest",args:{manifestPath:t},reason:"Verify the signed manifest locally before rendering."},{tool:"vivipilot_render_video",args:{manifestPath:t},reason:"Render the manifest to video on local hardware."}]});if(s.status==="failed")return u({ok:!1,generationId:d,error:s.error??"Generation failed.",progressLog:c,nextActions:[{tool:"vivipilot_generate_motion_layout",reason:"Retry with a new prompt or idempotency key."},{tool:"vivipilot_get_balance",reason:"Check balance before retrying."}]},!0)}return u({ok:!1,generationId:d,error:"Generation timed out after 5 minutes.",nextActions:[{tool:"vivipilot_get_generation_status",args:{generationId:d},reason:"Check if generation completed after timeout."}]},!0)}case"vivipilot_verify_manifest":{let t=p(r,"manifestPath");if(!t)throw new Error("manifestPath is required");let i=await T(t,l,m);if(!i.ok)throw new Error(i.message);return u({ok:!0,manifestId:i.manifest.manifestId,generationId:i.manifest.generationId,canonicalPayloadHash:i.canonicalPayloadHash,nextActions:[{tool:"vivipilot_render_video",args:{manifestPath:t},reason:"Render the verified manifest to video."}]})}case"vivipilot_render_video":{let t=p(r,"manifestPath");if(!t)throw new Error("manifestPath is required");let i=p(r,"out")??"video.mp4",a=p(r,"format"),f=g(r,"scale"),d=g(r,"fps"),v=r.transparent===!0,_=r.verifyOnly===!0,{renderManifest:w}=await import("./render-
|
|
2
|
+
`,"utf8")}async function T(e,o,n){let{verifyManifestFile:l}=await import("./manifest-TDCIHZ46.js");return l(e,o,n)}function N(){return[{name:"vivipilot_get_balance",title:"Get Vivipilot paid credit balance",description:"Returns Vivipilot account balance and paid top-up balance. CLI/MCP generation is paid-only and never grants trial credits.",inputSchema:{type:"object",properties:{},additionalProperties:!1}},{name:"vivipilot_estimate_motion_layout",title:"Estimate Vivipilot motion layout credits",description:"Estimates paid credits for a cloud layout generation. This does not burn credits.",inputSchema:{type:"object",properties:{prompt:{type:"string"},width:{type:"number"},height:{type:"number"},fps:{type:"number"},durationSeconds:{type:"number"},engine:{type:"string",enum:["pixi","three","auto"]}},required:["prompt"],additionalProperties:!1}},{name:"vivipilot_generate_motion_layout",title:"Generate signed Vivipilot render manifest",description:"Paid-only cloud generation. Burns paid credits only after cloud orchestration is wired; local rendering uses the client's hardware.",inputSchema:{type:"object",properties:{prompt:{type:"string"},out:{type:"string"},idempotencyKey:{type:"string"},width:{type:"number"},height:{type:"number"},fps:{type:"number"},durationSeconds:{type:"number"},engine:{type:"string",enum:["pixi","three","auto"]}},required:["prompt"],additionalProperties:!1}},{name:"vivipilot_verify_manifest",title:"Verify Vivipilot render manifest",description:"Verifies a signed Vivipilot manifest locally using public keys. This does not burn credits.",inputSchema:{type:"object",properties:{manifestPath:{type:"string"}},required:["manifestPath"],additionalProperties:!1}},{name:"vivipilot_render_video",title:"Render Vivipilot video locally",description:"Renders a signed manifest on local hardware after signature verification. No cloud rendering is used.",inputSchema:{type:"object",properties:{manifestPath:{type:"string"},out:{type:"string"},verifyOnly:{type:"boolean"}},required:["manifestPath"],additionalProperties:!1}},{name:"vivipilot_get_generation_status",title:"Get Vivipilot generation status",description:"Checks cloud status for a Vivipilot layout generation. This does not burn credits.",inputSchema:{type:"object",properties:{generationId:{type:"string"}},required:["generationId"],additionalProperties:!1}}]}async function O(e,o,n,l,m){let r=S(o)?o:{};try{switch(e){case"vivipilot_get_balance":{let t=await n.balance(),a=(typeof t.paidBalance=="number"?t.paidBalance:0)>0?[{tool:"vivipilot_estimate_motion_layout",reason:"Estimate credits for a generation before spending."},{tool:"vivipilot_generate_motion_layout",reason:"Generate a signed manifest (paid credits will be burned)."}]:[{action:"topup",reason:`Buy credits at ${b(l,m)}/edit?billing=topup before generating. CLI/MCP generation is paid-only.`}];return u({ok:!0,...t,nextActions:a})}case"vivipilot_estimate_motion_layout":{let t=await n.estimate(P(r)),i=typeof t.estimatedCredits=="number"?t.estimatedCredits:0;return u({ok:!0,...t,nextActions:[{tool:"vivipilot_generate_motion_layout",reason:`Generate now for ~${i} credits (paid-only).`},{tool:"vivipilot_get_balance",reason:"Check balance before generating."}]})}case"vivipilot_generate_motion_layout":{let t=p(r,"out")??"scene.vivi.json",i=p(r,"idempotencyKey")??`mcp_${q()}`,a=P(r),f=await n.startGenerate({...a,outputFormat:"manifest"},i),d=f.generationId;if(f.idempotentReplay&&f.status==="completed"){let s=await n.generationProgress(d);if(s.manifestData)return await R(t,s.manifestData),u({ok:!0,generationId:d,manifestPath:t,creditsCharged:s.creditsCharged??null,status:"completed",nextActions:[{tool:"vivipilot_verify_manifest",args:{manifestPath:t},reason:"Verify the signed manifest locally before rendering."},{tool:"vivipilot_render_video",args:{manifestPath:t},reason:"Render the manifest to video on local hardware."}]})}let v=3e5,_=2e3,w=Date.now(),c="";for(;Date.now()-w<v;){await new Promise(I=>setTimeout(I,_));let s;try{s=await n.generationProgress(d)}catch{continue}if(s.progressMessage&&s.progressMessage!==c&&(c=s.progressMessage),s.status==="completed"&&s.manifestData)return await R(t,s.manifestData),u({ok:!0,generationId:d,manifestPath:t,creditsCharged:s.creditsCharged??null,engine:s.engine,status:"completed",progressLog:c,nextActions:[{tool:"vivipilot_verify_manifest",args:{manifestPath:t},reason:"Verify the signed manifest locally before rendering."},{tool:"vivipilot_render_video",args:{manifestPath:t},reason:"Render the manifest to video on local hardware."}]});if(s.status==="failed")return u({ok:!1,generationId:d,error:s.error??"Generation failed.",progressLog:c,nextActions:[{tool:"vivipilot_generate_motion_layout",reason:"Retry with a new prompt or idempotency key."},{tool:"vivipilot_get_balance",reason:"Check balance before retrying."}]},!0)}return u({ok:!1,generationId:d,error:"Generation timed out after 5 minutes.",nextActions:[{tool:"vivipilot_get_generation_status",args:{generationId:d},reason:"Check if generation completed after timeout."}]},!0)}case"vivipilot_verify_manifest":{let t=p(r,"manifestPath");if(!t)throw new Error("manifestPath is required");let i=await T(t,l,m);if(!i.ok)throw new Error(i.message);return u({ok:!0,manifestId:i.manifest.manifestId,generationId:i.manifest.generationId,canonicalPayloadHash:i.canonicalPayloadHash,nextActions:[{tool:"vivipilot_render_video",args:{manifestPath:t},reason:"Render the verified manifest to video."}]})}case"vivipilot_render_video":{let t=p(r,"manifestPath");if(!t)throw new Error("manifestPath is required");let i=p(r,"out")??"video.mp4",a=p(r,"format"),f=g(r,"scale"),d=g(r,"fps"),v=r.transparent===!0,_=r.verifyOnly===!0,{renderManifest:w}=await import("./render-YGM7ZIQD.js"),c=await w({manifestPath:t,outPath:i,...a?{format:a}:{},...f?{scale:f}:{},...d?{fps:d}:{},...v?{transparent:v}:{},verifyOnly:_},l,m);return u({ok:!0,manifestId:c.manifestId,out:c.outPath,size:c.size,nextActions:[{action:"file_ready",reason:`Video written to ${c.outPath} (${(c.size/1024/1024).toFixed(2)} MB).`}]})}case"vivipilot_get_generation_status":{let t=p(r,"generationId");if(!t)throw new Error("generationId is required");let i=await n.generationProgress(t),a=[];return i.status==="completed"&&i.manifest?(a.push({tool:"vivipilot_verify_manifest",reason:"Verify the completed manifest."}),a.push({tool:"vivipilot_render_video",reason:"Render the completed manifest to video."})):i.status==="failed"?(a.push({tool:"vivipilot_generate_motion_layout",reason:"Retry with a new idempotency key."}),a.push({tool:"vivipilot_get_balance",reason:"Check balance before retrying."})):a.push({tool:"vivipilot_get_generation_status",args:{generationId:t},reason:"Poll again \u2014 generation still in progress."}),u({ok:!0,...i,nextActions:a})}default:throw new Error(`Unknown tool: ${e}`)}}catch(t){return M(t)}}function C(e,o){e.write(`${JSON.stringify(o)}
|
|
3
3
|
`)}function y(e,o,n){C(e,{jsonrpc:"2.0",id:o,result:n})}function h(e,o,n,l){C(e,{jsonrpc:"2.0",id:o??null,error:{code:n,message:l}})}async function F(e){let o=e.env??process.env,n=new k({config:e.config,env:o}),l=A({input:e.stdin});for await(let m of l){let r=m.trim();if(!r)continue;let t;try{t=JSON.parse(r)}catch{h(e.stdout,null,-32700,"Parse error");continue}let i=t.id;try{switch(t.method){case"initialize":y(e.stdout,i??null,{protocolVersion:J,capabilities:{tools:{listChanged:!1}},serverInfo:{name:"vivipilot",title:"Vivipilot MCP",version:"0.1.0"},instructions:"Vivipilot generation tools are paid-only and require VIVIPILOT_API_KEY or `vivipilot login` configuration. Local render tools use the client's hardware."});break;case"notifications/initialized":break;case"ping":y(e.stdout,i??null,{});break;case"tools/list":y(e.stdout,i??null,{tools:N()});break;case"tools/call":{if(!S(t.params)||typeof t.params.name!="string"){h(e.stdout,i,-32602,"tools/call requires params.name");break}let a=await O(t.params.name,t.params.arguments,n,e.config,o);y(e.stdout,i??null,a);break}default:i!==void 0&&h(e.stdout,i,-32601,`Method not found: ${t.method??""}`)}}catch(a){let f=a instanceof Error?a.message:String(a);i!==void 0&&h(e.stdout,i,-32603,f)}}}export{F as a};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{b as U,c as D,d as F,e as j}from"./chunk-FN7FHZ3D.js";import{f as _,i as w}from"./chunk-L3C7EOPY.js";import{spawn as le}from"child_process";import{createServer as K}from"http";import{readFile as k,writeFile as I,access as W,stat as he,mkdir as de}from"fs/promises";import{constants as ue,openSync as me,writeSync as V,closeSync as fe}from"fs";import{join as C}from"path";import{createHash as pe}from"crypto";import{existsSync as ne}from"fs";import{access as se,constants as oe}from"fs/promises";import{homedir as E}from"os";import{join as g}from"path";var O=class extends Error{constructor(e){super(e),this.name="BrowserNotFoundError"}};async function G(t=process.env){let e=t.VIVIPILOT_HEADLESS_BROWSER;if(e&&await S(e))return{executablePath:e,source:"env"};let r=await ae();if(r)return{executablePath:r,source:"chrome-headless-shell"};let a=await ie();if(a)return{executablePath:a,source:"system-chrome"};let s=await ce();if(s)return{executablePath:s,source:"system-chromium"};throw new O(`No headless browser found. To install a lightweight headless browser automatically, run:
|
|
2
|
+
npx @puppeteer/browsers install chrome-headless-shell
|
|
3
|
+
|
|
4
|
+
Alternatively, install Chrome/Chromium on your system, or set VIVIPILOT_HEADLESS_BROWSER to your binary path.`)}async function S(t){try{return await se(t,oe.X_OK),!0}catch{return!1}}async function ae(){let t=[process.env.PUPPETEER_EXECUTABLE_PATH,g(E(),".cache","puppeteer","chrome-headless-shell"),"/usr/bin/chrome-headless-shell","/usr/local/bin/chrome-headless-shell","/snap/bin/chrome-headless-shell",g(E(),".local","share","chrome-headless-shell","chrome-headless-shell"),"/opt/chrome-headless-shell/chrome-headless-shell","/Applications/Google Chrome Headless Shell.app/Contents/MacOS/Google Chrome Headless Shell",g(E(),"AppData","Local","chrome-headless-shell","chrome-headless-shell.exe")];for(let e of t)if(e){if(await S(e))return e;if(ne(e)&&!e.endsWith("chrome-headless-shell")&&!e.endsWith(".exe")){let{readdirSync:r}=await import("fs");try{let a=r(e,{withFileTypes:!0});for(let s of a){if(!s.isDirectory())continue;let h=g(e,s.name,"chrome-headless-shell");if(await S(h))return h;let i=g(e,s.name,"chrome-headless-shell.exe");if(await S(i))return i}}catch{}}}return null}async function ie(){let t=["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/google-chrome-unstable","/usr/local/bin/google-chrome","/opt/google/chrome/chrome","/snap/bin/google-chrome","/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",g(E(),"AppData","Local","Google","Chrome","Application","chrome.exe"),"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"];for(let e of t)if(await S(e))return e;return null}async function ce(){let t=["/usr/bin/chromium","/usr/bin/chromium-browser","/usr/local/bin/chromium","/snap/bin/chromium","/usr/bin/brave-browser","/usr/bin/brave","/Applications/Chromium.app/Contents/MacOS/Chromium",g(E(),"AppData","Local","Chromium","Application","chromium.exe"),"C:\\Program Files\\Chromium\\Application\\chromium.exe"];for(let e of t)if(await S(e))return e;return null}function J(t,e){let r=e?.windowSize?.width??1920,a=e?.windowSize?.height??1080;return["--headless=new","--no-sandbox","--disable-web-security","--allow-running-insecure-content","--disable-gpu-sandbox","--disable-dev-shm-usage","--disable-extensions","--disable-background-networking","--disable-sync","--disable-translate","--disable-default-apps","--disable-popup-blocking","--disable-component-update","--disable-metrics","--no-first-run","--mute-audio","--enable-logging=stderr","--log-level=0","--v=1",`--window-size=${r},${a}`,"--enable-features=Vulkan","--use-gl=angle","--use-angle=swiftshader","--enable-unsafe-swiftshader","--ignore-gpu-blocklist",...e?.extraArgs??[],t]}var we=3e5;function ge(t){return new Promise((e,r)=>{let a=null,s=null,h=K(async(i,c)=>{if(c.setHeader("Access-Control-Allow-Origin","*"),c.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS"),c.setHeader("Access-Control-Allow-Headers","Content-Type"),i.method==="OPTIONS"){c.writeHead(204),c.end();return}let p=new URL(i.url??"/","http://localhost");if(p.pathname==="/manifest.json"&&i.method==="GET"){try{let u=await k(t.replace(/\.mp4$|\.webm$|\.gif$|\.mov$/,".vivi.json"),"utf8");c.writeHead(200,{"content-type":"application/json"}),c.end(u)}catch{c.writeHead(404),c.end("Manifest not found")}return}if(p.pathname==="/result"&&i.method==="POST"){let u=[];i.on("data",m=>u.push(m)),i.on("end",async()=>{a=Buffer.concat(u);try{await I(t,a),c.writeHead(200,{"content-type":"application/json"}),c.end(JSON.stringify({ok:!0,size:a.length}))}catch(m){c.writeHead(500,{"content-type":"application/json"}),c.end(JSON.stringify({ok:!1,error:m instanceof Error?m.message:String(m)}))}});return}if(p.pathname==="/error"&&i.method==="POST"){let u=[];i.on("data",m=>u.push(m)),i.on("end",()=>{try{s=JSON.parse(Buffer.concat(u).toString()).message??"Unknown render error"}catch{s=Buffer.concat(u).toString()||"Unknown render error"}c.writeHead(200,{"content-type":"application/json"}),c.end(JSON.stringify({ok:!0}))});return}if(p.pathname==="/status"&&i.method==="GET"){c.writeHead(200,{"content-type":"application/json"}),c.end(JSON.stringify({done:a!==null||s!==null,error:s,hasBlob:a!==null,blobSize:a?.length??0}));return}c.writeHead(404),c.end("Not found")});h.on("error",r),h.listen(0,"127.0.0.1",()=>{let i=h.address();if(!i||typeof i=="string"){r(new Error("Failed to bind callback server"));return}e({server:h,port:i.port})})})}async function be(t,e){let r=Date.now()+e;for(;Date.now()<r;){try{let s=await(await fetch(`http://127.0.0.1:${t}/status`)).json();if(s.done)return s.error?{size:0,error:s.error}:{size:s.blobSize,error:null}}catch{}await new Promise(a=>setTimeout(a,1e3))}return{size:0,error:`Render timed out after ${e/1e3}s`}}async function Ne(t,e,r=process.env){let{manifestPath:a,outPath:s}=t,h=await U(a,e,r);if(!h.ok)throw new w(`Manifest verification failed: ${h.message}`,1);let i=await D(h.manifest,e,r);F(i);let c={...t.format?{format:t.format}:{},...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}},p=j(h.manifest,c);if(!p.ok)throw new w(p.message,1);if(t.verifyOnly)return{ok:!0,outPath:s,size:0,manifestId:h.manifest.manifestId};let u;try{u=await G(r)}catch(n){throw n instanceof O?new w(n.message,1):n}let m=await k(a,"utf8"),b=JSON.parse(m),$=b.render.canvas,B="";if(b.render.assets&&Array.isArray(b.render.assets))try{B=await ye(b.render.assets)}catch(n){throw new w(`Failed to cache assets: ${n instanceof Error?n.message:String(n)}`,1)}let{server:X}=await ge(s);X.close();let P=null,x=!1,N=0,v=K((n,o)=>{if(o.setHeader("Access-Control-Allow-Origin","*"),o.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS"),o.setHeader("Access-Control-Allow-Headers","Content-Type"),n.method==="OPTIONS"){o.writeHead(204),o.end();return}let f=new URL(n.url??"/","http://localhost");if(B&&f.pathname.startsWith("/assets/")&&n.method==="GET"){let d=f.pathname.slice(8),l=C(B,d);k(l).then(y=>{let te=b.render.assets?.find(re=>re.sha256===d);o.writeHead(200,{"content-type":te?.mimeType||"application/octet-stream"}),o.end(y)}).catch(()=>{o.writeHead(404),o.end("Asset not found")});return}if(f.pathname==="/manifest.json"&&n.method==="GET"){let d={...b};d.render?.assets&&(d.render.assets=d.render.assets.map(l=>({...l,url:`http://127.0.0.1:${A}/assets/${l.sha256}`}))),o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify(d));return}if(f.pathname==="/result"&&n.method==="POST"){let d=[];n.on("data",l=>d.push(l)),n.on("end",async()=>{let l=Buffer.concat(d);try{await I(s,l),x=!0,N=l.length,o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({ok:!0,size:l.length}))}catch(y){P=y instanceof Error?y.message:String(y),o.writeHead(500,{"content-type":"application/json"}),o.end(JSON.stringify({ok:!1,error:P}))}});return}if(f.pathname==="/error"&&n.method==="POST"){let d=[];n.on("data",l=>d.push(l)),n.on("end",()=>{let l="Unknown render error";try{l=JSON.parse(Buffer.concat(d).toString()).message??l}catch{l=Buffer.concat(d).toString()||l}P=l,o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({ok:!0,error:l}))});return}if(f.pathname==="/status"&&n.method==="GET"){o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({done:x||P!==null,error:P,hasBlob:x,blobSize:N}));return}o.writeHead(404),o.end("Not found")}),A=await new Promise((n,o)=>{v.on("error",o),v.listen(0,"127.0.0.1",()=>{let f=v.address();if(!f||typeof f=="string"){o(new Error("Failed to bind manifest server"));return}n(f.port)})}),Y=r.VIVIPILOT_RENDER_URL??`${_(e,r)}/headless-render`,R=new URLSearchParams({manifest:`http://127.0.0.1:${A}/manifest.json`,format:t.format??"mp4",headless:"true",callback:`http://127.0.0.1:${A}/result`});t.scale&&R.set("scale",String(t.scale)),t.transparent&&R.set("transparent","true"),t.fps&&R.set("fps",String(t.fps));let Q=`${Y}?${R.toString()}`,Z=J(Q,{windowSize:{width:Math.max($.width,1280),height:Math.max($.height,720)}}),T=le(u.executablePath,Z,{stdio:["ignore","pipe","pipe"],env:{...r,DISPLAY:r.DISPLAY??":99"}}),q=C(process.cwd(),"host","chrome_browser.log"),H=me(q,"w"),L="",z="";T.stderr?.on("data",n=>{L+=n.toString();try{V(H,n)}catch{}}),T.stdout?.on("data",n=>{z+=n.toString();try{V(H,n)}catch{}});let ee=parseInt(r.VIVIPILOT_RENDER_TIMEOUT_MS??String(we),10),M=await be(A,ee);T.kill("SIGTERM"),setTimeout(()=>{try{T.kill("SIGKILL")}catch{}},5e3),v.close();try{fe(H)}catch{}if(M.error)throw new w(`Render failed: ${M.error}
|
|
5
|
+
Browser stderr (last 2KB):
|
|
6
|
+
${L.slice(-2e3)}
|
|
7
|
+
Browser stdout (last 1KB):
|
|
8
|
+
${z.slice(-1e3)}`,1);try{await W(s,ue.R_OK);let n=await he(s);return{ok:!0,outPath:s,size:n.size,manifestId:h.manifest.manifestId}}catch{throw new w(`Render completed but output file not found at ${s}`,1)}}async function ye(t){let e=C(process.env.HOME||process.env.USERPROFILE||process.cwd(),".cache","vivipilot","assets");await de(e,{recursive:!0});for(let r of t){if(!r.sha256||!r.url)continue;let a=C(e,r.sha256);try{await W(a);continue}catch{}let s=await fetch(r.url);if(!s.ok)throw new Error(`Failed to download asset ${r.url}: HTTP ${s.status}`);let h=Buffer.from(await s.arrayBuffer()),i=pe("sha256").update(h).digest("hex");if(i!==r.sha256)throw new Error(`Asset hash mismatch for ${r.url}: expected ${r.sha256}, got ${i}`);await I(a,h)}return e}export{Ne as a};
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as R,b as v,c as $,d as p}from"./chunk-ZZ72PPC3.js";import{a as E}from"./chunk-
|
|
2
|
+
import{a as R,b as v,c as $,d as p}from"./chunk-ZZ72PPC3.js";import{a as E}from"./chunk-WFXDNIZA.js";import{b as M}from"./chunk-FN7FHZ3D.js";import{a as G}from"./chunk-FGUKEVKT.js";import{b as S,c as A,d as O,e as N,f as U,g as V,i as u,j as T}from"./chunk-L3C7EOPY.js";import{randomUUID as F}from"crypto";import{createInterface as H}from"readline";import{mkdir as X,writeFile as Q}from"fs/promises";import{dirname as Z}from"path";var _=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],L=class{io;frame=0;timer=null;lastMessage="";lastStage="";constructor(e){this.io=e}start(e){this.lastMessage=e,this.io.stderr.write(`\r${_[0]} ${e}`),this.timer=setInterval(()=>{this.frame=(this.frame+1)%_.length,this.io.stderr.write(`\r${_[this.frame]} ${this.lastMessage}`)},80)}update(e,n){e!==this.lastStage&&(this.lastStage&&this.io.stderr.write(`\r\x1B[32m\u2713\x1B[0m ${this.lastMessage}
|
|
3
3
|
`),this.lastStage=e),this.lastMessage=n}succeed(e){this.timer&&clearInterval(this.timer),this.timer=null,this.io.stderr.write(`\r\x1B[32m\u2713\x1B[0m ${e}
|
|
4
4
|
`)}fail(e){this.timer&&clearInterval(this.timer),this.timer=null,this.io.stderr.write(`\r\x1B[31m\u2717\x1B[0m ${e}
|
|
5
5
|
`)}stop(){this.timer&&clearInterval(this.timer),this.timer=null}},q=`Vivipilot CLI (paid-only)
|
|
@@ -91,7 +91,7 @@ Goodbye!
|
|
|
91
91
|
|
|
92
92
|
`)}m.prompt()}s.scenes.length>0&&i.stderr.write(`
|
|
93
93
|
Session complete. ${s.scenes.length} scene(s) generated.
|
|
94
|
-
`)}async function me(t,e,n,i){let c=D(t),r=await M(c,e,n);if(!r.ok)throw new u(`Manifest verification failed: ${r.message}`,1);f(i,{ok:!0,manifestId:r.manifest.manifestId,generationId:r.manifest.generationId,canonicalPayloadHash:r.canonicalPayloadHash})}async function le(t,e,n,i){let c=D(t),r=v(t,["out","o"])??"video.mp4",a=v(t,["format"]),d=p(t,["scale"]),b=p(t,["fps"]),l=$(t,["transparent"]),s=$(t,["verify-only"]),m=await E({manifestPath:c,outPath:r,...a?{format:a}:{},...d?{scale:d}:{},...b?{fps:b}:{},...l?{transparent:l}:{},verifyOnly:s},e,n);f(i,{ok:!0,manifestId:m.manifestId,out:m.outPath,size:m.size,paidOnly:!0})}async function pe(t,e,n){let{startMcpServer:i}=await import("./mcp-
|
|
94
|
+
`)}async function me(t,e,n,i){let c=D(t),r=await M(c,e,n);if(!r.ok)throw new u(`Manifest verification failed: ${r.message}`,1);f(i,{ok:!0,manifestId:r.manifest.manifestId,generationId:r.manifest.generationId,canonicalPayloadHash:r.canonicalPayloadHash})}async function le(t,e,n,i){let c=D(t),r=v(t,["out","o"])??"video.mp4",a=v(t,["format"]),d=p(t,["scale"]),b=p(t,["fps"]),l=$(t,["transparent"]),s=$(t,["verify-only"]),m=await E({manifestPath:c,outPath:r,...a?{format:a}:{},...d?{scale:d}:{},...b?{fps:b}:{},...l?{transparent:l}:{},verifyOnly:s},e,n);f(i,{ok:!0,manifestId:m.manifestId,out:m.outPath,size:m.size,paidOnly:!0})}async function pe(t,e,n){let{startMcpServer:i}=await import("./mcp-53ZEPAXS.js");await i({config:t,env:e,stdin:process.stdin,stdout:n.stdout,stderr:n.stderr})}async function ue(t=process.argv.slice(2),e=process.env,n={stdout:process.stdout,stderr:process.stderr}){let i=R(t);if(!i.command||i.command==="help"||$(i,["help"])){n.stdout.write(q);return}let c=S(e),r=await A(c);switch(i.command){case"login":await te(i,e,n);return;case"logout":await ie(e,n);return;case"whoami":f(n,await P(r,e).whoami());return;case"balance":f(n,await P(r,e).balance());return;case"topup":await ne(r,e,n);return;case"estimate":f(n,await P(r,e).estimate(K(i)));return;case"generate":await ae(i,r,e,n);return;case"chat":await de(i,r,e,n);return;case"status":{let a=i.positionals[0];if(!a)throw new u("Missing generation id.",2);f(n,await P(r,e).generationStatus(a));return}case"verify":await me(i,r,e,n);return;case"render":await le(i,r,e,n);return;case"mcp":await pe(r,e,n);return;default:throw new u(`Unknown command: ${i.command}
|
|
95
95
|
|
|
96
96
|
${q}`,2)}}ue().catch(t=>{if(T(t)){process.stderr.write(`${t.message}
|
|
97
97
|
`),process.exitCode=t.exitCode;return}process.stderr.write(`${t instanceof Error?t.stack??t.message:String(t)}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,b as r,c as t,d as o}from"./chunk-ZZ72PPC3.js";import{a as C,b as A}from"./chunk-FN7FHZ3D.js";import{a as R}from"./chunk-
|
|
1
|
+
import{a as e,b as r,c as t,d as o}from"./chunk-ZZ72PPC3.js";import{a as C,b as A}from"./chunk-FN7FHZ3D.js";import{a as R}from"./chunk-QQW45E53.js";import{a as v}from"./chunk-FGUKEVKT.js";import{a as p,b as i,c as s,d as a,e as l,f as n,g as f,h as y,i as g,j as m}from"./chunk-L3C7EOPY.js";export{g as CliError,p as DEFAULT_API_URL,v as VivipilotApiClient,i as defaultConfigPath,l as deleteConfig,t as flagBoolean,o as flagNumber,r as flagString,m as isCliError,e as parseArgv,s as readConfig,C as readManifestFile,f as resolveApiKey,n as resolveApiUrl,y as resolvePublicKeys,R as startMcpServer,A as verifyManifestFile,a as writeConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-QQW45E53.js";import"./chunk-FGUKEVKT.js";import"./chunk-L3C7EOPY.js";export{a as startMcpServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-WFXDNIZA.js";import"./chunk-FN7FHZ3D.js";import"./chunk-L3C7EOPY.js";export{a as renderManifest};
|
package/package.json
CHANGED
package/dist/chunk-JJDAKVXA.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{b as U,c as D,d as F,e as j}from"./chunk-FN7FHZ3D.js";import{f as _,i as w}from"./chunk-L3C7EOPY.js";import{spawn as le}from"child_process";import{createServer as K}from"http";import{readFile as k,writeFile as I,access as W,stat as he,mkdir as de}from"fs/promises";import{constants as ue,openSync as me,writeSync as V,closeSync as fe}from"fs";import{join as C}from"path";import{createHash as pe}from"crypto";import{existsSync as ne}from"fs";import{access as oe,constants as se}from"fs/promises";import{homedir as E}from"os";import{join as g}from"path";var O=class extends Error{constructor(e){super(e),this.name="BrowserNotFoundError"}};async function G(t=process.env){let e=t.VIVIPILOT_HEADLESS_BROWSER;if(e&&await S(e))return{executablePath:e,source:"env"};let r=await ae();if(r)return{executablePath:r,source:"chrome-headless-shell"};let a=await ie();if(a)return{executablePath:a,source:"system-chrome"};let o=await ce();if(o)return{executablePath:o,source:"system-chromium"};throw new O(`No headless browser found. To install a lightweight headless browser automatically, run:
|
|
2
|
-
npx @puppeteer/browsers install chrome-headless-shell
|
|
3
|
-
|
|
4
|
-
Alternatively, install Chrome/Chromium on your system, or set VIVIPILOT_HEADLESS_BROWSER to your binary path.`)}async function S(t){try{return await oe(t,se.X_OK),!0}catch{return!1}}async function ae(){let t=[process.env.PUPPETEER_EXECUTABLE_PATH,g(E(),".cache","puppeteer","chrome-headless-shell"),"/usr/bin/chrome-headless-shell","/usr/local/bin/chrome-headless-shell","/snap/bin/chrome-headless-shell",g(E(),".local","share","chrome-headless-shell","chrome-headless-shell"),"/opt/chrome-headless-shell/chrome-headless-shell","/Applications/Google Chrome Headless Shell.app/Contents/MacOS/Google Chrome Headless Shell",g(E(),"AppData","Local","chrome-headless-shell","chrome-headless-shell.exe")];for(let e of t)if(e){if(await S(e))return e;if(ne(e)&&!e.endsWith("chrome-headless-shell")&&!e.endsWith(".exe")){let{readdirSync:r}=await import("fs");try{let a=r(e,{withFileTypes:!0});for(let o of a){if(!o.isDirectory())continue;let h=g(e,o.name,"chrome-headless-shell");if(await S(h))return h;let i=g(e,o.name,"chrome-headless-shell.exe");if(await S(i))return i}}catch{}}}return null}async function ie(){let t=["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/google-chrome-unstable","/usr/local/bin/google-chrome","/opt/google/chrome/chrome","/snap/bin/google-chrome","/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",g(E(),"AppData","Local","Google","Chrome","Application","chrome.exe"),"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"];for(let e of t)if(await S(e))return e;return null}async function ce(){let t=["/usr/bin/chromium","/usr/bin/chromium-browser","/usr/local/bin/chromium","/snap/bin/chromium","/usr/bin/brave-browser","/usr/bin/brave","/Applications/Chromium.app/Contents/MacOS/Chromium",g(E(),"AppData","Local","Chromium","Application","chromium.exe"),"C:\\Program Files\\Chromium\\Application\\chromium.exe"];for(let e of t)if(await S(e))return e;return null}function J(t,e){let r=e?.windowSize?.width??1920,a=e?.windowSize?.height??1080;return["--headless=new","--no-sandbox","--disable-gpu-sandbox","--disable-dev-shm-usage","--disable-extensions","--disable-background-networking","--disable-sync","--disable-translate","--disable-default-apps","--disable-popup-blocking","--disable-component-update","--disable-metrics","--no-first-run","--mute-audio","--enable-logging=stderr","--log-level=0","--v=1",`--window-size=${r},${a}`,"--enable-features=Vulkan","--use-gl=angle","--use-angle=swiftshader","--enable-unsafe-swiftshader","--ignore-gpu-blocklist",...e?.extraArgs??[],t]}var we=3e5;function ge(t){return new Promise((e,r)=>{let a=null,o=null,h=K(async(i,c)=>{if(c.setHeader("Access-Control-Allow-Origin","*"),c.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS"),c.setHeader("Access-Control-Allow-Headers","Content-Type"),i.method==="OPTIONS"){c.writeHead(204),c.end();return}let p=new URL(i.url??"/","http://localhost");if(p.pathname==="/manifest.json"&&i.method==="GET"){try{let u=await k(t.replace(/\.mp4$|\.webm$|\.gif$|\.mov$/,".vivi.json"),"utf8");c.writeHead(200,{"content-type":"application/json"}),c.end(u)}catch{c.writeHead(404),c.end("Manifest not found")}return}if(p.pathname==="/result"&&i.method==="POST"){let u=[];i.on("data",m=>u.push(m)),i.on("end",async()=>{a=Buffer.concat(u);try{await I(t,a),c.writeHead(200,{"content-type":"application/json"}),c.end(JSON.stringify({ok:!0,size:a.length}))}catch(m){c.writeHead(500,{"content-type":"application/json"}),c.end(JSON.stringify({ok:!1,error:m instanceof Error?m.message:String(m)}))}});return}if(p.pathname==="/error"&&i.method==="POST"){let u=[];i.on("data",m=>u.push(m)),i.on("end",()=>{try{o=JSON.parse(Buffer.concat(u).toString()).message??"Unknown render error"}catch{o=Buffer.concat(u).toString()||"Unknown render error"}c.writeHead(200,{"content-type":"application/json"}),c.end(JSON.stringify({ok:!0}))});return}if(p.pathname==="/status"&&i.method==="GET"){c.writeHead(200,{"content-type":"application/json"}),c.end(JSON.stringify({done:a!==null||o!==null,error:o,hasBlob:a!==null,blobSize:a?.length??0}));return}c.writeHead(404),c.end("Not found")});h.on("error",r),h.listen(0,"127.0.0.1",()=>{let i=h.address();if(!i||typeof i=="string"){r(new Error("Failed to bind callback server"));return}e({server:h,port:i.port})})})}async function be(t,e){let r=Date.now()+e;for(;Date.now()<r;){try{let o=await(await fetch(`http://127.0.0.1:${t}/status`)).json();if(o.done)return o.error?{size:0,error:o.error}:{size:o.blobSize,error:null}}catch{}await new Promise(a=>setTimeout(a,1e3))}return{size:0,error:`Render timed out after ${e/1e3}s`}}async function Ne(t,e,r=process.env){let{manifestPath:a,outPath:o}=t,h=await U(a,e,r);if(!h.ok)throw new w(`Manifest verification failed: ${h.message}`,1);let i=await D(h.manifest,e,r);F(i);let c={...t.format?{format:t.format}:{},...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}},p=j(h.manifest,c);if(!p.ok)throw new w(p.message,1);if(t.verifyOnly)return{ok:!0,outPath:o,size:0,manifestId:h.manifest.manifestId};let u;try{u=await G(r)}catch(n){throw n instanceof O?new w(n.message,1):n}let m=await k(a,"utf8"),b=JSON.parse(m),$=b.render.canvas,B="";if(b.render.assets&&Array.isArray(b.render.assets))try{B=await ye(b.render.assets)}catch(n){throw new w(`Failed to cache assets: ${n instanceof Error?n.message:String(n)}`,1)}let{server:X}=await ge(o);X.close();let P=null,x=!1,N=0,v=K((n,s)=>{if(s.setHeader("Access-Control-Allow-Origin","*"),s.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS"),s.setHeader("Access-Control-Allow-Headers","Content-Type"),n.method==="OPTIONS"){s.writeHead(204),s.end();return}let f=new URL(n.url??"/","http://localhost");if(B&&f.pathname.startsWith("/assets/")&&n.method==="GET"){let d=f.pathname.slice(8),l=C(B,d);k(l).then(y=>{let te=b.render.assets?.find(re=>re.sha256===d);s.writeHead(200,{"content-type":te?.mimeType||"application/octet-stream"}),s.end(y)}).catch(()=>{s.writeHead(404),s.end("Asset not found")});return}if(f.pathname==="/manifest.json"&&n.method==="GET"){let d={...b};d.render?.assets&&(d.render.assets=d.render.assets.map(l=>({...l,url:`http://127.0.0.1:${A}/assets/${l.sha256}`}))),s.writeHead(200,{"content-type":"application/json"}),s.end(JSON.stringify(d));return}if(f.pathname==="/result"&&n.method==="POST"){let d=[];n.on("data",l=>d.push(l)),n.on("end",async()=>{let l=Buffer.concat(d);try{await I(o,l),x=!0,N=l.length,s.writeHead(200,{"content-type":"application/json"}),s.end(JSON.stringify({ok:!0,size:l.length}))}catch(y){P=y instanceof Error?y.message:String(y),s.writeHead(500,{"content-type":"application/json"}),s.end(JSON.stringify({ok:!1,error:P}))}});return}if(f.pathname==="/error"&&n.method==="POST"){let d=[];n.on("data",l=>d.push(l)),n.on("end",()=>{let l="Unknown render error";try{l=JSON.parse(Buffer.concat(d).toString()).message??l}catch{l=Buffer.concat(d).toString()||l}P=l,s.writeHead(200,{"content-type":"application/json"}),s.end(JSON.stringify({ok:!0,error:l}))});return}if(f.pathname==="/status"&&n.method==="GET"){s.writeHead(200,{"content-type":"application/json"}),s.end(JSON.stringify({done:x||P!==null,error:P,hasBlob:x,blobSize:N}));return}s.writeHead(404),s.end("Not found")}),A=await new Promise((n,s)=>{v.on("error",s),v.listen(0,"127.0.0.1",()=>{let f=v.address();if(!f||typeof f=="string"){s(new Error("Failed to bind manifest server"));return}n(f.port)})}),Y=r.VIVIPILOT_RENDER_URL??`${_(e,r)}/headless-render`,R=new URLSearchParams({manifest:`http://127.0.0.1:${A}/manifest.json`,format:t.format??"mp4",headless:"true",callback:`http://127.0.0.1:${A}/result`});t.scale&&R.set("scale",String(t.scale)),t.transparent&&R.set("transparent","true"),t.fps&&R.set("fps",String(t.fps));let Q=`${Y}?${R.toString()}`,Z=J(Q,{windowSize:{width:Math.max($.width,1280),height:Math.max($.height,720)}}),T=le(u.executablePath,Z,{stdio:["ignore","pipe","pipe"],env:{...r,DISPLAY:r.DISPLAY??":99"}}),q=C(process.cwd(),"host","chrome_browser.log"),H=me(q,"w"),L="",z="";T.stderr?.on("data",n=>{L+=n.toString();try{V(H,n)}catch{}}),T.stdout?.on("data",n=>{z+=n.toString();try{V(H,n)}catch{}});let ee=parseInt(r.VIVIPILOT_RENDER_TIMEOUT_MS??String(we),10),M=await be(A,ee);T.kill("SIGTERM"),setTimeout(()=>{try{T.kill("SIGKILL")}catch{}},5e3),v.close();try{fe(H)}catch{}if(M.error)throw new w(`Render failed: ${M.error}
|
|
5
|
-
Browser stderr (last 2KB):
|
|
6
|
-
${L.slice(-2e3)}
|
|
7
|
-
Browser stdout (last 1KB):
|
|
8
|
-
${z.slice(-1e3)}`,1);try{await W(o,ue.R_OK);let n=await he(o);return{ok:!0,outPath:o,size:n.size,manifestId:h.manifest.manifestId}}catch{throw new w(`Render completed but output file not found at ${o}`,1)}}async function ye(t){let e=C(process.env.HOME||process.env.USERPROFILE||process.cwd(),".cache","vivipilot","assets");await de(e,{recursive:!0});for(let r of t){if(!r.sha256||!r.url)continue;let a=C(e,r.sha256);try{await W(a);continue}catch{}let o=await fetch(r.url);if(!o.ok)throw new Error(`Failed to download asset ${r.url}: HTTP ${o.status}`);let h=Buffer.from(await o.arrayBuffer()),i=pe("sha256").update(h).digest("hex");if(i!==r.sha256)throw new Error(`Asset hash mismatch for ${r.url}: expected ${r.sha256}, got ${i}`);await I(a,h)}return e}export{Ne as a};
|
package/dist/mcp-DTGU64NI.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-ZIATVRTF.js";import"./chunk-FGUKEVKT.js";import"./chunk-L3C7EOPY.js";export{a as startMcpServer};
|
package/dist/render-CVXYAUBY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-JJDAKVXA.js";import"./chunk-FN7FHZ3D.js";import"./chunk-L3C7EOPY.js";export{a as renderManifest};
|