@nagellabs/libi 0.1.7 → 0.1.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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +5 -5
- package/.next/diagnostics/route-bundle-stats.json +16 -16
- package/.next/externals-manifest.json +1 -1
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/(app)/editor/page/build-manifest.json +2 -2
- package/.next/server/app/(app)/instructions/page/build-manifest.json +2 -2
- package/.next/server/app/(app)/mcps-skills/page/build-manifest.json +2 -2
- package/.next/server/app/(app)/mcps-skills/skills/[name]/page/build-manifest.json +2 -2
- package/.next/server/app/(app)/mcps-skills/skills/new/page/build-manifest.json +2 -2
- package/.next/server/app/(app)/settings/page/build-manifest.json +2 -2
- package/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/server/app/api/agent/cancel/route.js +8 -8
- package/.next/server/app/api/agent/cancel/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/detect/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/dispatch/route.js +5 -5
- package/.next/server/app/api/agent/dispatch/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/events/route.js +11 -11
- package/.next/server/app/api/agent/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/messages/route.js +7 -7
- package/.next/server/app/api/agent/messages/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/providers/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/send/route.js +7 -7
- package/.next/server/app/api/agent/send/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/start/route.js +7 -7
- package/.next/server/app/api/agent/start/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/stop/route.js +8 -8
- package/.next/server/app/api/agent/stop/route.js.nft.json +1 -1
- package/.next/server/app/api/agents/[agentId]/install/route.js +4 -4
- package/.next/server/app/api/agents/[agentId]/install/route.js.nft.json +1 -1
- package/.next/server/app/api/codex/connect/route.js.nft.json +1 -1
- package/.next/server/app/api/db/resolve/route.js +9 -9
- package/.next/server/app/api/db/resolve/route.js.nft.json +1 -1
- package/.next/server/app/api/export/chromium/route.js +5 -5
- package/.next/server/app/api/export/chromium/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js +4 -4
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/files/by-id/[fileId]/filmstrip-status/route.js +4 -4
- package/.next/server/app/api/files/by-id/[fileId]/filmstrip-status/route.js.nft.json +1 -1
- package/.next/server/app/api/files/by-id/[fileId]/rename/route.js +7 -7
- package/.next/server/app/api/files/by-id/[fileId]/rename/route.js.nft.json +1 -1
- package/.next/server/app/api/folders/[folderId]/duplicate/route.js +6 -6
- package/.next/server/app/api/folders/[folderId]/duplicate/route.js.nft.json +1 -1
- package/.next/server/app/api/install-from-url/route.js +10 -10
- package/.next/server/app/api/install-from-url/route.js.nft.json +1 -1
- package/.next/server/app/api/instructions/override/route.js.nft.json +1 -1
- package/.next/server/app/api/jobs/[id]/events/route.js +8 -8
- package/.next/server/app/api/jobs/[id]/events/route.js.nft.json +1 -1
- package/.next/server/app/api/jobs/[id]/retry/route.js +4 -4
- package/.next/server/app/api/jobs/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/jobs/[id]/route.js +4 -4
- package/.next/server/app/api/jobs/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/jobs/[id]/status/route.js +3 -3
- package/.next/server/app/api/jobs/[id]/status/route.js.nft.json +1 -1
- package/.next/server/app/api/jobs/route.js +9 -9
- package/.next/server/app/api/jobs/route.js.nft.json +1 -1
- package/.next/server/app/api/notify/route.js.nft.json +1 -1
- package/.next/server/app/api/pieces/[pieceId]/duplicate/route.js +4 -4
- package/.next/server/app/api/pieces/[pieceId]/duplicate/route.js.nft.json +1 -1
- package/.next/server/app/api/pieces/[pieceId]/tracks/[trackId]/manual-anchors/apply-deletes/route.js +9 -9
- package/.next/server/app/api/pieces/[pieceId]/tracks/[trackId]/manual-anchors/apply-deletes/route.js.nft.json +1 -1
- package/.next/server/app/api/pieces/[pieceId]/tracks/[trackId]/manual-anchors/route.js +9 -9
- package/.next/server/app/api/pieces/[pieceId]/tracks/[trackId]/manual-anchors/route.js.nft.json +1 -1
- package/.next/server/app/api/render/frames/route.js +7 -7
- package/.next/server/app/api/render/frames/route.js.nft.json +1 -1
- package/.next/server/app/api/runtime/update/route.js +5 -5
- package/.next/server/app/api/runtime/update/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[sessionId]/activate/route.js +8 -8
- package/.next/server/app/api/sessions/[sessionId]/activate/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[sessionId]/context/route.js +8 -8
- package/.next/server/app/api/sessions/[sessionId]/context/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[sessionId]/deactivate/route.js +8 -8
- package/.next/server/app/api/sessions/[sessionId]/deactivate/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[sessionId]/model/route.js +7 -7
- package/.next/server/app/api/sessions/[sessionId]/model/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[sessionId]/permission/route.js +7 -7
- package/.next/server/app/api/sessions/[sessionId]/permission/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/permission-modes/route.js +7 -7
- package/.next/server/app/api/sessions/permission-modes/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +7 -7
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/mcp-servers/[id]/dependencies/route.js +7 -7
- package/.next/server/app/api/settings/mcp-servers/[id]/dependencies/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/mcp-servers/[id]/install-plan/route.js +5 -5
- package/.next/server/app/api/settings/mcp-servers/[id]/install-plan/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/mcp-servers/[id]/retry/route.js +7 -7
- package/.next/server/app/api/settings/mcp-servers/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/mcp-servers/[id]/retry-dep/route.js +7 -7
- package/.next/server/app/api/settings/mcp-servers/[id]/retry-dep/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/mcp-servers/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/mcp-servers/resync/route.js +7 -7
- package/.next/server/app/api/settings/mcp-servers/resync/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/memories/route.js.nft.json +1 -1
- package/.next/server/app/api/skill-eval/configure/route.js +8 -8
- package/.next/server/app/api/skill-eval/configure/route.js.nft.json +1 -1
- package/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/.next/server/app/api/terminal/ws-info/route.js.nft.json +1 -1
- package/.next/server/app/api/tracking/run/route.js +4 -4
- package/.next/server/app/api/tracking/run/route.js.nft.json +1 -1
- package/.next/server/app/page/build-manifest.json +2 -2
- package/.next/server/chunks/[root-of-the-server]__04thdbt._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__04thdbt._.js.map +2 -2
- package/.next/server/chunks/[root-of-the-server]__05bfu4m._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__05bfu4m._.js.map +2 -2
- package/.next/server/chunks/[root-of-the-server]__09qyvq1._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__09qyvq1._.js.map +2 -2
- package/.next/server/chunks/[root-of-the-server]__0gnut6f._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0gnut6f._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0l_-iy7._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0l_-iy7._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0s0b6ty._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0s0b6ty._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__0sj68ta._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__0sj68ta._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__10oxitf._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__10oxitf._.js.map +2 -2
- package/.next/server/chunks/[root-of-the-server]__11.cp_g._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__11.cp_g._.js.map +2 -2
- package/.next/server/chunks/_04i643i._.js +3 -3
- package/.next/server/chunks/_0_t4b-f._.js +4 -4
- package/.next/server/chunks/_0gc3hkv._.js +3 -3
- package/.next/server/chunks/_0hainf0._.js +4 -4
- package/.next/server/chunks/_0jrwb4i._.js +3 -3
- package/.next/server/chunks/_0ms~zo_._.js +3 -3
- package/.next/server/chunks/_0ou5g0c._.js +4 -4
- package/.next/server/chunks/_0ovzm6d._.js +4 -4
- package/.next/server/chunks/_0pwx1vo._.js +3 -3
- package/.next/server/chunks/_0snzqta._.js +4 -4
- package/.next/server/chunks/lib_08x49mw._.js +3 -3
- package/.next/server/chunks/lib_runtime_runtime-prune_ts_0eaw~-q._.js +3 -3
- package/.next/server/chunks/node_modules_003ody_._.js +3 -3
- package/.next/server/chunks/ssr/_0675jux._.js +3 -3
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +5 -5
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{0tfripjpjgh0x.js → 0rgnvt2t.fexk.js} +3 -3
- package/.next/static/chunks/{turbopack-0nj3aucu1vtlz.js → turbopack-06tait4frhc5a.js} +3 -3
- package/.next/trace-build +1 -1
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist-cli/BUILD_INFO.json +6 -6
- package/dist-cli/lib/analytics/config.js +1 -1
- package/dist-cli/lib/install/next-externals.js +6 -1
- package/dist-cli/lib/onboarding/piece/v1/index.js +5 -1
- package/dist-cli/lib/server/next-server.js +12 -2
- package/lib/analytics/config.ts +15 -2
- package/lib/install/next-externals.ts +36 -1
- package/lib/onboarding/piece/v1/index.ts +5 -1
- package/lib/server/next-server.ts +29 -4
- package/package.json +1 -1
- /package/.next/static/{AKrgjfjGvLuWkXofXFBpx → 05vWgPQtQKJ6EuLHg8nZ3}/_buildManifest.js +0 -0
- /package/.next/static/{AKrgjfjGvLuWkXofXFBpx → 05vWgPQtQKJ6EuLHg8nZ3}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{AKrgjfjGvLuWkXofXFBpx → 05vWgPQtQKJ6EuLHg8nZ3}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="
|
|
1
|
+
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="f6c03646-79c3-3f61-6493-efe85d0b5569")}catch(e){}}();
|
|
2
2
|
module.exports=[669385,764014,125138,547124,435865,e=>{"use strict";var t=e.i(233405),A=e.i(938281),r=e.i(527622),i=e.i(28618),n=e.i(336763),o=e.i(997901),s=e.i(902157),a=e.i(750227),l=e.i(472691),g=e.i(98228),c=e.i(525610),h=e.i(38330);function d(e){var t;let A={command:e.command,args:e.args??[],source:"fallback"};if(e.inRepoEntry){let t=(0,c.packageRoot)(),A=(0,h.resolveEntrySpawn)(t,e.inRepoEntry);if(A)return{command:A.command,args:A.args,source:"in-repo"};throw Error(`resolveBundledSpawn: could not resolve the in-repo MCP entry point for "${e.id}" — ${(0,h.entryResolutionDiagnostic)(t,e.inRepoEntry)} Deliberately not falling back to \`${e.command}${(e.args??[]).length?" "+(e.args??[]).join(" "):""}\`: this repo is unpublished and the public \`libi\` npm package belongs to an unrelated third party.`)}if(!e.npmPackage||!e.pinnedVersion)return A;let r=(0,l.getLibiNodeModulesRoot)(),i=e.binName??((t=e.npmPackage).startsWith("@")?t.split("/").slice(1).join("/"):t).split("/").pop()??t,n=a.default.join(r,"node_modules",".bin"),o=(0,g.adapterBinFileNames)(i,process.platform).map(e=>a.default.join(n,e)).find(e=>s.default.existsSync(e))??null,d=a.default.join(r,"node_modules",...e.npmPackage.split("/"),"package.json"),u=null;try{let e=s.default.readFileSync(d,"utf-8"),t=JSON.parse(e);t&&"object"==typeof t&&"version"in t&&"string"==typeof t.version&&(u=t.version)}catch{return A}return u===e.pinnedVersion&&o?{command:o,args:[],source:"local"}:A}function u(e,t){if(!e)return e;let A=e;for(let e of t)e&&(A=A.split(e).join("••••"));return A}async function E(e){let t=(0,o.buildSpawnEnv)({}),r=d(e);return A.serverLogger.info({tag:"mcp-probe",op:"probe_in_memory_start",mcpId:e.id,command:r.command,args:r.args,spawnSource:r.source,timeoutMs:18e4},`Probing MCP server "${e.id}" (in-memory, ${r.source})`),Q({command:r.command,args:r.args,env:t,timeoutMs:18e4})}async function I(e){let t=(0,r.getDb)();t.update(i.mcpServers).set({serverStatus:"starting",serverLastChecked:new Date,updatedAt:new Date}).where((0,n.eq)(i.mcpServers.id,e.id)).run();let[s]=t.select().from(i.mcpServers).where((0,n.eq)(i.mcpServers.id,e.id)).limit(1).all(),a=s?.envVars?JSON.parse(s.envVars):{},l=(0,o.buildSpawnEnv)(a),g=d(e);A.serverLogger.info({tag:"mcp-probe",op:"probe_start",mcpId:e.id,command:g.command,args:g.args,spawnSource:g.source,envKeys:Object.keys(l).sort(),hasHome:"string"==typeof l.HOME&&l.HOME.length>0,timeoutMs:18e4},`Probing MCP server "${e.id}" (${g.source})`);let c=await Q({command:g.command,args:g.args,env:l,timeoutMs:18e4}),h=function(e){if(!e)return[];let t=[],A=e=>{if(e)try{let A=JSON.parse(e);if(A&&"object"==typeof A)for(let e of Object.values(A))"string"==typeof e&&e&&t.push(e)}catch{}};return A(e.envVars),A(e.headers),t}(s),E=c.error?u(c.error,h):c.error;return t.update(i.mcpServers).set({serverStatus:c.status,serverError:E,serverLastChecked:new Date,updatedAt:new Date}).where((0,n.eq)(i.mcpServers.id,e.id)).run(),"up"===c.status?A.serverLogger.info({tag:"mcp-probe",op:"probe_persisted",mcpId:e.id,status:c.status,durationMs:c.durationMs},`MCP server "${e.id}" is up`):A.serverLogger.warn({tag:"mcp-probe",op:"probe_persisted",mcpId:e.id,status:c.status,durationMs:c.durationMs,error:E},`MCP server "${e.id}" is down`),c}async function Q(e){let{command:r,args:i,env:n,timeoutMs:o=1e4}=e,s=Date.now();return A.serverLogger.debug({tag:"mcp-probe",op:"spawn",command:r,args:i,timeoutMs:o},"Spawning MCP child for probe"),new Promise(e=>{let a,l,g=!1,c="",h=0,d=null,u=null,E=t=>{if(!g){g=!0;try{l.kill("SIGTERM")}catch{}e(t)}};try{a=(l=(0,t.spawn)(r,i,{env:n,windowsHide:!0,stdio:["pipe","pipe","pipe"]})).pid,A.serverLogger.debug({tag:"mcp-probe",op:"spawned",command:r,pid:a},`MCP child spawned (pid=${a??"?"})`)}catch(t){let e=t instanceof Error?t.message:String(t);A.serverLogger.warn({tag:"mcp-probe",op:"spawn_failed",command:r,args:i,err:e},"Failed to spawn MCP child"),E({status:"down",error:e,durationMs:Date.now()-s});return}let I=setTimeout(()=>{A.serverLogger.warn({tag:"mcp-probe",op:"timeout",command:r,pid:a,timeoutMs:o,stderrBytes:h,stderrLength:c.length,initSentAt:d,firstStdoutAt:u},`MCP probe timed out after ${o}ms`),E({status:"down",error:`MCP probe timed out after ${o}ms${c?`
|
|
3
3
|
stderr: ${c.slice(0,4096)}`:""}`,durationMs:Date.now()-s})},o);l.stderr?.on("data",e=>{let t=e.toString("utf-8");h+=e.length,(c+=t).length>8192&&(c=c.slice(-4096)),A.serverLogger.trace({tag:"mcp-probe",op:"stderr",command:r,pid:a,bytes:e.length,stderrLength:c.length},"MCP child stderr")}),l.on("error",e=>{clearTimeout(I),A.serverLogger.warn({tag:"mcp-probe",op:"child_error",command:r,pid:a,err:e.message,stderrLength:c.length},"MCP child errored"),E({status:"down",error:`${e.message}${c?`
|
|
4
4
|
stderr: ${c.slice(0,4096)}`:""}`,durationMs:Date.now()-s})}),l.on("exit",(e,t)=>{g||(clearTimeout(I),A.serverLogger.warn({tag:"mcp-probe",op:"exit_before_init",command:r,pid:a,code:e,signal:t,stderrLength:c.length},`MCP child exited before initialize (code=${e} signal=${t})`),E({status:"down",error:`MCP exited before initialize (code=${e} signal=${t})${c?`
|
|
@@ -836,7 +836,7 @@ const g = ctx.createRadialGradient(W / 2, H / 2, H * 0.12, W / 2, H / 2, H * 0.9
|
|
|
836
836
|
g.addColorStop(0, \`rgba(0,0,0,\${0.45 * a})\`);
|
|
837
837
|
g.addColorStop(1, \`rgba(0,0,0,\${0.85 * a})\`);
|
|
838
838
|
ctx.fillStyle = g;
|
|
839
|
-
ctx.fillRect(0, 0, W, H);`,displayName:"Ad end vignette"},{id:"img-zyv32z0t",kind:"image",startTime:37.4,duration:2.1,rect:{x:820,y:140,width:280,height:280},z:10,opacity:1,assetSlug:"logo-mark.png",group:"shoe-brand",keyframes:{rect:{keyframes:[{t:0,value:{x:869.25,y:309.25,width:181.50000000000003,height:181.50000000000003},easing:"ease-out"},{t:.2222222222222222,value:{x:795,y:235,width:330,height:330},easing:"linear"},{t:.3492063492063492,value:{x:785.4497891718671,y:98.38367346938782,width:333.2326530612245,height:333.2326530612245}},{t:1,value:{x:820,y:140,width:280,height:280}}]},opacity:{keyframes:[{t:0,value:0,easing:"ease-out"},{t:.2222222222222222,value:1,easing:"linear"},{t:1,value:1}]}}},{id:"text-hlcq7y7c",kind:"text",startTime:38.1,duration:1.4,rect:{x:460,y:775,width:1e3,height:55},z:10,opacity:1,content:"ENGINEERED TO FLOAT",font:"48px Inter",color:"#9aa3b2",align:"center",fontFamily:"Inter",fontSize:32,fontWeight:500,reveal:{mode:"fade-words",durationMs:500},group:"shoe-brand"},{id:"text-16gcy19w",kind:"text",startTime:40.8,duration:11.2,rect:{x:1010,y:745,width:460,height:80},z:21,opacity:1,content:"Or download for Mac",font:"48px Inter",color:"#cdd3de",align:"center",fontFamily:"Inter",fontSize:42,fontWeight:500,background:{color:"rgba(255,255,255,0.08)",padding:18,radius:12},reveal:{mode:"fade-words",durationMs:300},group:"end-card"},{id:"img-vxnkonqd",kind:"image",startTime:39.8,duration:12.2,rect:{x:670,y:228,width:320,height:320},z:21,opacity:1,assetSlug:"libi-ring-glyph.png",group:"end-card",keyframes:{rect:{keyframes:[{t:0,value:{x:670,y:228,width:320,height:320},easing:"ease-out"},{t:.062842,value:{x:670,y:228,width:320,height:320},easing:"linear"},{t:.180328,value:{x:663.6,y:221.6,width:332.8,height:332.8},easing:"linear"},{t:1,value:{x:663.6,y:221.6,width:332.8,height:332.8}}]},opacity:{keyframes:[{t:0,value:0,easing:"ease-out"},{t:.062842,value:1,easing:"linear"},{t:.180328,value:1,easing:"linear"},{t:1,value:1}]}},shadow:{color:"rgba(139,180,139,0.55)",blur:70,dx:0,dy:0}},{id:"text-3048dja6",kind:"text",startTime:41.2,duration:10.8,rect:{x:610,y:872,width:700,height:64},z:21,opacity:1,content:"libi.nagellabs.com",font:"48px Inter",color:"#8b93a7",align:"center",fontFamily:"Inter",fontSize:40,fontWeight:400,reveal:{mode:"fade-words",durationMs:300},group:"end-card"}],audioClips:[{id:"clip_i13f0m0n",kind:"inline",assetSlug:"clip-water-impact.mp4",startTime:34.4,duration:6,trimStart:0,volume:.6,enabled:!0,linkedOverlayId:"vid-so51lufn",label:"film audio — splash"},{id:"clip_4t921f5s",kind:"standalone",assetSlug:"music-build-28s.mp3",startTime:0,duration:28,trimStart:0,volume:.85,enabled:!0,label:"music — build (hard cut at 0:28)",duck:{sidechainClipIds:["clip_vo1","clip_vo2","clip_vo3","clip_vo4","clip_vo5","clip_vo6"],thresholdDb:-30,ratio:4,attackMs:50,releaseMs:250,reductionDb:-12}},{id:"clip_g0uxbvkf",kind:"standalone",assetSlug:"sfx-typing.mp3",startTime:.2,duration:3.6,trimStart:0,volume:.5,enabled:!0,label:"SFX typing"},{id:"clip_pj7r0it5",kind:"standalone",assetSlug:"sfx-basshit.mp3",startTime:3.95,duration:1,trimStart:0,volume:.9,enabled:!0,label:"SFX bass hit (Enter)"},{id:"clip_316hr7uq",kind:"standalone",assetSlug:"sfx-clicks.mp3",startTime:4.6,duration:4,trimStart:0,volume:.35,enabled:!0,label:"SFX UI clicks"},{id:"clip_wuk6rzqz",kind:"standalone",assetSlug:"sfx-riser.mp3",startTime:24,duration:4,trimStart:0,volume:.7,enabled:!0,label:"SFX riser → cut"},{id:"clip_v4tmovmb",kind:"inline",assetSlug:"clip-hero-orbit-v2.mp4",startTime:30,duration:4.4,trimStart:0,volume:.6,enabled:!0,linkedOverlayId:"vid-gdgll882",label:"film audio — orbit"},{id:"clip_c44rnjt8",kind:"standalone",assetSlug:"music-anthem-12s.mp3",startTime:30,duration:12,trimStart:0,volume:.9,enabled:!0,label:"music — anthem (0:30–0:42)",duck:{sidechainClipIds:["clip_vo1","clip_vo2","clip_vo3","clip_vo4","clip_vo5","clip_vo6"],thresholdDb:-30,ratio:4,attackMs:50,releaseMs:250,reductionDb:-12}},{id:"clip_tnqhriva",kind:"inline",assetSlug:"clip-track-demo.mp4",startTime:16,duration:6,trimStart:0,volume:1,enabled:!1,linkedOverlayId:"vid-lu4jxr6v",label:"tracking clip audio (muted)"},{id:"clip_vo1",kind:"standalone",assetSlug:"vo-1-describe.mp3",startTime:1,duration:1.149,trimStart:0,volume:1,enabled:!0,label:"VO 1 — You describe it."},{id:"clip_vo2",kind:"standalone",assetSlug:"vo-2-agent.mp3",startTime:5,duration:2.273,trimStart:0,volume:1,enabled:!0,label:"VO 2 — A coding agent builds it."},{id:"clip_vo3",kind:"standalone",assetSlug:"vo-3-generates.mp3",startTime:11,duration:3.474,trimStart:0,volume:1,enabled:!0,label:"VO 3 — It generates the footage…"},{id:"clip_vo4",kind:"standalone",assetSlug:"vo-4-code.mp3",startTime:17,duration:2.508,trimStart:0,volume:1,enabled:!0,label:"VO 4 — Every frame is code."},{id:"clip_vo5",kind:"standalone",assetSlug:"vo-5-director.mp3",startTime:24.6,duration:1.411,trimStart:0,volume:1,enabled:!0,label:"VO 5 — You stay the director."},{id:"clip_vo6",kind:"standalone",assetSlug:"vo-6-madein.mp3",startTime:37.3,duration:2.508,trimStart:0,volume:1,enabled:!0,label:"VO 6 — This video? Made in libi."}]},assets:eg}};var eh=e.i(305121);function ed(e){return`libi:onboarding:${e}`}function eu(e,t){if(Array.isArray(e))return e.map(e=>eu(e,t));if(null!==e&&"object"==typeof e){if(Object.hasOwn(e,"assetSlug")&&Object.hasOwn(e,"fileId"))throw Error(`onboarding: node carries both assetSlug and fileId — ${JSON.stringify(e)} — refusing to let key order pick a winner.`);let A={};for(let[r,i]of Object.entries(e)){if("assetSlug"!==r){A[r]=eu(i,t);continue}if("string"!=typeof i)throw Error(`onboarding: assetSlug must be a string, got ${JSON.stringify(i)}`);let e=t.get(i);if(!e)throw Error(`onboarding: unresolved asset slug ${JSON.stringify(i)} — it is referenced by the composition but was never downloaded.`);A.fileId=e}return A}return e}async function eE(e){let t=ed(e);for(let e of(0,o.getDb)().select({id:s.pieces.id}).from(s.pieces).where((0,n.eq)(s.pieces.description,t)).orderBy((0,et.desc)(s.pieces.createdAt),(0,et.desc)(s.pieces.id)).all())if(await (0,eh.hasManifest)(e.id))return e.id;return null}let eI={kind:"onboarding_piece",maxConcurrent:1,paramsSchema:S.z.object({version:S.z.literal("v1"),force:S.z.boolean()}),resumable:!1,noProgressTimeoutMs:12e4,mcpToolId:(0,T.makeMcpToolId)("libi","libi.build_onboarding_piece"),async run(e){var t;let A,{version:r,force:i}=e.params,a=ec[r];if(!a)throw Error(`onboarding: no definition for version ${r}`);let{definition:g,assets:c}=a;if(!i){let t=await eE(r);if(t)return l.serverLogger.info({tag:"onboarding",op:"reused",version:r,pieceId:t},"onboarding: demo piece already built — reusing it"),e.reportProgress(c.length,c.length,"files"),{pieceId:t,version:r,bytes:0,assets:0,reused:!0}}let h=function(e){let t=process.env[es]?.trim(),A=!!t,r=A?t:"https://storage.googleapis.com/libi-public-assets/onboarding";if(A){let e;try{e=new URL(r)}catch{throw Error(`${es} is not a valid http(s) url: ${r}`)}if("http:"!==e.protocol&&"https:"!==e.protocol)throw Error(`${es} must be an http(s) url, got ${e.protocol}//… (${r})`)}return{baseUrl:`${r.replace(/\/+$/,"")}/${el("version",e)}`,guard:A?eo.assertDevLoopbackOrPublicHttpUrl:eo.assertPublicHttpUrl,overridden:A}}(r);l.serverLogger.info({tag:"onboarding",op:"asset_source",version:r,baseUrl:h.baseUrl,overridden:h.overridden,assets:c.length},"onboarding: resolved demo asset base");let d=await ei({name:g.name,description:`libi:onboarding:${r}:building`});if(!d.success||!d.data)throw Error(`onboarding: could not create the demo piece: ${d.error??"unknown"}`);let u=d.data.id;try{e.reportProgress(0,c.length,"files");let i=new Map,a=0;for(let[A,r]of c.entries()){if(e.shouldCancel())throw new eA.CancelledError(e.jobId);try{let e=await (0,en.fetchAndStoreRemoteFile)({url:(t=r.slug,`${h.baseUrl}/${el("slug",t)}`),guard:h.guard,pieceId:u,filename:r.slug,expectSha256:r.sha256,contentType:r.contentType,skipProxyGeneration:!0});i.set(r.slug,e.fileId),a+=e.bytes}catch(e){throw Error(`onboarding: asset ${r.slug} failed: ${e instanceof Error?e.message:String(e)}`,{cause:e})}e.reportProgress(A+1,c.length,"files")}if(e.shouldCancel())throw new eA.CancelledError(e.jobId);let d=eu(g.overlays,i),E=eu(g.audioClips,i),I={width:g.width,height:g.height,fps:g.fps,overlays:d,audioClips:E};await (0,eh.saveManifest)(u,I),(0,o.getDb)().update(s.pieces).set({description:ed(r),updatedAt:new Date}).where((0,n.eq)(s.pieces.id,u)).run(),l.serverLogger.info({tag:"onboarding",op:"built",version:r,pieceId:u,assets:i.size,bytes:a,overlays:d.length},"onboarding: demo piece built"),A={pieceId:u,version:r,bytes:a,assets:i.size,reused:!1}}catch(e){try{await (0,er.deletePieceCompletely)(u)}catch(e){l.serverLogger.error({tag:"onboarding",op:"rollback_failed",version:r,pieceId:u,err:e instanceof Error?e.message:String(e)},"onboarding: could not clean up the partial demo piece")}throw e}return(0,V.trackServerEvent)("onboarding_piece_built",{version:r}),A}},eQ=globalThis.__libiRunnerRegistry??new Map;function eB(e){return eQ.get(e)??null}function eC(){for(let e of[c.trackingRunner,h.trackingProviderRunner,d.proxyGenRunner,u.filmstripGenRunner,E.exportRenderRunner,I.exportRunner,Q.analysisDescribeFrameRunner,B.whisperModelDownloadRunner,C.ttsModelDownloadRunner,f.musicModelDownloadRunner,p.musicGenerateRunner,y.pieceDupRunner,m.extraAnalysisModelRunner,w.remoteFetchRunner,D.matteGenRunner,b.runtimeUpdateRunner,L,Z,eI,ee])eB(e.kind)||function(e){if(eQ.has(e.kind))throw Error(`Runner already registered for kind: ${e.kind}`);eQ.set(e.kind,e)}(e)}function ef(){eC();let e=new Map;for(let t of Array.from(eQ.values())){if(!t.mcpToolId)continue;let A=Array.isArray(t.mcpToolId)?t.mcpToolId:[t.mcpToolId];e.set(t.kind,A)}return e}globalThis.__libiRunnerRegistry=eQ;var ep=e.i(70499);async function ey(e){(0,o.getDb)().insert(s.jobs).values({id:e.id,kind:e.kind,clientKey:e.clientKey,paramsHash:e.paramsHash,paramsJson:e.paramsJson,pieceId:e.pieceId,fileId:e.fileId,status:"queued"}).run()}async function em(e){let[t]=(0,o.getDb)().select().from(s.jobs).where((0,n.eq)(s.jobs.id,e)).limit(1).all();return t??null}async function ew(e,t,A={}){let r=(0,o.getDb)(),i=(0,n.and)((0,n.eq)(s.jobs.kind,e),(0,n.eq)(s.jobs.paramsHash,t)),a=A.excludeTerminal?(0,n.and)(i,(0,n.notInArray)(s.jobs.status,["completed","failed","cancelled"])):i,[l]=r.select().from(s.jobs).where(a).limit(1).all();return l??null}async function eD(e,t){let[A]=(0,o.getDb)().select().from(s.jobs).where((0,n.and)((0,n.eq)(s.jobs.kind,e),(0,n.eq)(s.jobs.paramsHash,t),(0,n.inArray)(s.jobs.status,["running","queued","cancel-requested"]))).limit(1).all();return A??null}async function eb(e,t){let[A]=(0,o.getDb)().select().from(s.jobs).where((0,n.and)((0,n.eq)(s.jobs.kind,e),(0,n.eq)(s.jobs.paramsHash,t),(0,n.inArray)(s.jobs.status,["completed","failed","cancelled"]))).orderBy((0,et.desc)(s.jobs.completedAt)).limit(1).all();return A??null}async function eS(e){let t=(0,o.getDb)(),A=new Date;t.update(s.jobs).set({status:"running",startedAt:A,lastProgressAt:A}).where((0,n.eq)(s.jobs.id,e)).run()}async function eN(e,t){let A=(0,o.getDb)(),r={progressDone:t.done,progressTotal:t.total,lastProgressAt:new Date};void 0!==t.unit&&(r.progressUnit=t.unit),void 0!==t.msPerUnit&&(r.msPerUnit=t.msPerUnit),A.update(s.jobs).set(r).where((0,n.eq)(s.jobs.id,e)).run()}async function eR(e,t){(0,o.getDb)().update(s.jobs).set({partialPath:t}).where((0,n.eq)(s.jobs.id,e)).run()}async function ek(e,t){(0,o.getDb)().update(s.jobs).set({status:"completed",resultJson:t,completedAt:new Date,error:null}).where((0,n.eq)(s.jobs.id,e)).run()}async function eF(e,t){(0,o.getDb)().update(s.jobs).set({status:"failed",error:t,completedAt:new Date}).where((0,n.eq)(s.jobs.id,e)).run()}async function eM(e){(0,o.getDb)().update(s.jobs).set({status:"cancel-requested"}).where((0,n.eq)(s.jobs.id,e)).run()}async function eU(e){(0,o.getDb)().update(s.jobs).set({status:"cancelled",completedAt:new Date}).where((0,n.eq)(s.jobs.id,e)).run()}async function eT(e){let t=function(){try{let e=(0,a.getCurrentPort)();return`http://127.0.0.1:${e}`}catch{return null}}();if(t)try{await fetch(`${t}/api/notify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(3e3)})}catch{}}let ev={navigate(e){eT({type:"navigate",...e})},refreshQuery(e){eT({type:"refresh_query",...e})},refreshMcpConfig(){eT({type:"refresh_mcp_config"})},instructionsChanged(){eT({type:"instructions_changed"})},analysisChanged(e){eT({type:"analysis_changed",...e})},navigateSettings(e){eT({type:"navigate_settings",mcpId:e.mcpId})},rightRegion(e){eT({type:"right_region",...e})},highlight(e){eT({type:"highlight",...e})},highlightEffect(e){eT({type:"highlight_effect",...e})},setComplexityMode(e){eT({type:"set_complexity_mode",pieceId:e.pieceId,overlayId:e.overlayId,mode:e.mode})},jobProgress(e){eT({type:"job_progress",...e})}};async function eL(e){}function ex(e){return i.default.join((0,a.getLibiHome)(),"jobs",e,"state.json")}e.s(["notify",0,ev,"pushIfBackgrounded",0,eL],981797);class eY extends t.EventEmitter{cancelFlags=new Map;inflight=new Map;lastEmitAt=new Map;lastProgress=new Map;watchdogTripped=new Set;progressChains=new Map;etaTrackers=new Map;forcedJobs=new Set;discardOutputJobs=new Set;activeByKind=new Map;waiters=new Map;toolCallIdByJob=new Map;jobIdByToolCallId=new Map;toolHintByJob=new Map;attachToolHint(e,t){this.toolHintByJob.set(e,t)}getToolHint(e){return this.toolHintByJob.get(e)??null}attachToolCallId(e,t){let A=this.toolCallIdByJob.get(e);A||(A=new Set,this.toolCallIdByJob.set(e,A)),A.add(t),this.jobIdByToolCallId.set(t,e)}getJobIdForToolCallId(e){return this.jobIdByToolCallId.get(e)??null}emitTerminal(e,t,A={}){let r=this.toolCallIdByJob.get(t);this.emit(e,{jobId:t,...A,toolCallIds:r?Array.from(r):[]})}async enqueue(e,t,A={}){let a=eB(e);if(!a)throw Error(`No runner registered for kind: ${e}`);let c=a.paramsSchema.parse(t),h=(0,g.canonicalHash)(c),d=A.clientKey||`srv-${eH()}`;if(!0===A.forceNew||!1===A.resume){if(a.exclusiveResource){let t=await eD(e,h);if(t)return l.serverLogger.info({jobId:t.id,kind:e},"jobs.force_new.attached_exclusive"),{status:"attached_running",jobId:t.id,clientKey:t.clientKey||d,existingJob:{jobId:t.id,pieceId:t.pieceId,startedAt:t.startedAt?.toISOString()??""}}}let t=await ew(e,h);if(t){(0,o.getDb)().delete(s.jobs).where((0,n.eq)(s.jobs.id,t.id)).run(),this.forcedJobs.delete(t.id),this.discardOutputJobs.delete(t.id);let e=i.default.dirname(ex(t.id));try{r.default.rmSync(e,{recursive:!0,force:!0})}catch(t){l.serverLogger.warn({err:t,oldStateDir:e},"jobs.resume.cleanup_failed")}}let g=`job-${eH()}`;return await ey({id:g,kind:e,clientKey:d,paramsHash:h,paramsJson:JSON.stringify(c),pieceId:A.pieceId??null,fileId:A.fileId??null}),this.forcedJobs.add(g),!0===A.discardOutput&&this.discardOutputJobs.add(g),this.emit("created",{jobId:g,kind:e}),{status:"new",jobId:g,clientKey:d,forced:!0}}let u=await eD(e,h);if(u)return{status:"attached_running",jobId:u.id,clientKey:u.clientKey||d,existingJob:{jobId:u.id,pieceId:u.pieceId,startedAt:u.startedAt?.toISOString()??""}};let E=await eb(e,h);if(E)return{status:"matching_completed",existingJob:{jobId:E.id,pieceId:E.pieceId,completedAt:E.completedAt?.toISOString()??"",status:E.status,result:function(e,t){if(t)try{return JSON.parse(t)}catch(t){l.serverLogger.warn({tag:"jobs",op:"terminal_result_parse_failed",jobId:e,err:t instanceof Error?t.message:String(t)},"Failed to parse cached job result JSON; returning undefined");return}}(E.id,E.resultJson),error:E.error}};let I=`job-${eH()}`;return await ey({id:I,kind:e,clientKey:d,paramsHash:h,paramsJson:JSON.stringify(c),pieceId:A.pieceId??null,fileId:A.fileId??null}),this.emit("created",{jobId:I,kind:e}),{status:"new",jobId:I,clientKey:d}}async runToCompletion(e,t){let A=t?this.subscribe(e,t):()=>{};try{let t=this.inflight.get(e);if(t)return t;let A=this.runLocked(e);this.inflight.set(e,A);try{return await A}finally{this.inflight.delete(e)}}finally{A()}}subscribe(e,t){let A=A=>{A.jobId===e&&t(A)};return this.on("progress",A),()=>this.off("progress",A)}async getStatus(e){let t=await em(e);if(!t)throw new eA.JobNotFoundError(e);return(0,eA.snapshotFromRow)(t)}async cancel(e){let t=await em(e);if(!t)throw new eA.JobNotFoundError(e);if("completed"===t.status||"failed"===t.status||"cancelled"===t.status)return;await eM(e);let A=this.cancelFlags.get(e);A&&A.abort(),this.emit("cancel-requested",{jobId:e})}async runLocked(e){let t=await em(e);if(!t)throw new eA.JobNotFoundError(e);let A=eB(t.kind);if(!A)throw Error(`No runner registered for kind: ${t.kind}`);await this.acquireSlot(A.kind,A.maxConcurrent);try{let r=await em(e);if(r?.status==="cancel-requested")throw await eU(e),this.emitTerminal("cancelled",e),new eA.CancelledError(e);return await this.runWithSlot(e,r??t,A)}finally{this.releaseSlot(A.kind)}}async acquireSlot(e,t){(this.activeByKind.get(e)??0)<t||await new Promise(t=>{let A=this.waiters.get(e)??[];A.push(t),this.waiters.set(e,A)}),this.activeByKind.set(e,(this.activeByKind.get(e)??0)+1)}releaseSlot(e){this.activeByKind.set(e,Math.max(0,(this.activeByKind.get(e)??0)-1));let t=this.waiters.get(e);t&&t.length>0&&t.shift()()}async runWithSlot(e,t,A){await eS(e);let n=new AbortController;this.cancelFlags.set(e,n);let o=null===A.noProgressTimeoutMs?null:A.noProgressTimeoutMs??6e4,s=null;null!==o&&(await eN(e,{done:0,total:0}),s=setInterval(()=>{(async()=>{let A=await em(e);if(!A||"running"!==A.status||!A.lastProgressAt)return;let r=Date.now()-A.lastProgressAt.getTime();r>o&&(l.serverLogger.warn({jobId:e,kind:t.kind,idleMs:r},"jobs.watchdog.no_progress"),this.watchdogTripped.add(e),n.abort())})().catch(t=>l.serverLogger.warn({err:t,jobId:e},"jobs.watchdog.poll_failed"))},Math.max(10,Math.min(5e3,Math.floor(o/4)))));let a=setInterval(()=>{try{this.emitHeartbeat(e)}catch(t){l.serverLogger.warn({err:t,jobId:e},"jobs.heartbeat.failed")}},15e3);a.unref?.();let g=ex(e),c=null;if(t.partialPath&&r.default.existsSync(t.partialPath))try{c=JSON.parse(r.default.readFileSync(t.partialPath,"utf-8"))}catch(t){l.serverLogger.warn({err:t,jobId:e},"jobs.resume.parse_failed"),c=null}let h={jobId:e,params:JSON.parse(t.paramsJson),resumeState:c,reportProgress:(A,r,i)=>{this.handleProgress(e,t.kind,A,r,i??t.progressUnit)},checkpoint:async A=>{r.default.mkdirSync(i.default.dirname(g),{recursive:!0}),r.default.writeFileSync(g,JSON.stringify(A),"utf-8"),t.partialPath||(await eR(e,g),t.partialPath=g)},shouldCancel:()=>n.signal.aborted,forced:this.forcedJobs.has(e),discardOutput:this.discardOutputJobs.has(e)};try{var d,u;let t=await Promise.race([A.run(h),(d=n.signal,u=()=>this.watchdogTripped.has(e)?Error(`No progress for ${o}ms — watchdog tripped`):new eA.CancelledError(e),new Promise((e,t)=>{d.aborted?t(u()):d.addEventListener("abort",()=>t(u()),{once:!0})}))]);if(r.default.existsSync(g))try{r.default.unlinkSync(g)}catch{}return await ek(e,JSON.stringify(t)),this.emitTerminal("completed",e,{result:t}),t}catch(r){if(this.watchdogTripped.has(e)){this.watchdogTripped.delete(e);let A=`No progress for ${o}ms — watchdog tripped`;try{await eF(e,A)}catch(t){l.serverLogger.error({err:t,jobId:e},"jobs.run.mark_failed_throw")}throw l.serverLogger.error({jobId:e,kind:t.kind,watchdogMs:o},"jobs.run.watchdog_failed"),this.emitTerminal("failed",e,{error:A}),Error(A)}if(r instanceof eA.CancelledError||n.signal.aborted){try{await eU(e)}catch(t){l.serverLogger.error({err:t,jobId:e},"jobs.run.mark_cancelled_throw")}throw this.emitTerminal("cancelled",e),r instanceof eA.CancelledError?r:new eA.CancelledError(e)}let A=r instanceof Error?r.message:String(r);try{await eF(e,A)}catch(t){l.serverLogger.error({err:t,jobId:e},"jobs.run.mark_failed_throw")}throw l.serverLogger.error({jobId:e,kind:t.kind,err:A},"jobs.run.failed"),this.emitTerminal("failed",e,{error:A}),r}finally{s&&clearInterval(s),clearInterval(a),this.cancelFlags.delete(e),this.progressChains.delete(e),this.etaTrackers.delete(e),this.lastProgress.delete(e);let t=this.toolCallIdByJob.get(e);if(t)for(let e of t)this.jobIdByToolCallId.delete(e);this.toolCallIdByJob.delete(e),this.toolHintByJob.delete(e),this.forcedJobs.delete(e),this.discardOutputJobs.delete(e)}}handleProgress(e,t,A,r,i){let n=Date.now();if(A=Math.min(A,r>0?r:A),n-(this.lastEmitAt.get(e)??0)<1e3&&A<r)return;this.lastEmitAt.set(e,n);let o=(this.progressChains.get(e)??Promise.resolve()).then(async()=>{let o=await em(e);if(!o||!o.startedAt)return;let s=this.etaTrackers.get(e);s||(s=new ep.EtaTracker,this.etaTrackers.set(e,s)),s.add(n,A);let a=s.msPerUnit();await eN(e,{done:A,total:r,unit:i,msPerUnit:a}),this.lastProgress.set(e,{kind:t,done:A,total:r,unit:i});let l={jobId:e,kind:t,done:A,total:r,unit:i,msPerUnit:a,etaMs:s.etaMs(r,A)};this.emit("progress",l),this.notifyProgress(l)}).catch(t=>{l.serverLogger.warn({err:t,jobId:e},"jobs.progress.update_failed")});this.progressChains.set(e,o)}notifyProgress(e){let t=this.toolCallIdByJob.get(e.jobId),A=this.toolHintByJob.get(e.jobId),r={jobId:e.jobId,kind:e.kind,done:e.done,total:e.total,unit:e.unit,etaMs:e.etaMs,msSinceProgress:e.msSinceProgress??null,...A?{toolName:A.toolName,toolArgs:A.toolArgs,...A.progressLabel?{progressLabel:A.progressLabel}:{}}:{}};try{if(t&&t.size>0)for(let e of t)ev.jobProgress({...r,toolCallId:e});else ev.jobProgress({...r,toolCallId:void 0})}catch(t){l.serverLogger.warn({err:t,jobId:e.jobId},"jobs.progress.notify_failed")}}emitHeartbeat(e){let t=this.lastProgress.get(e);if(!t)return;let A=this.etaTrackers.get(e);if(!A)return;let r=Date.now(),i=A.lastSampleAt(),n={jobId:e,kind:t.kind,done:t.done,total:t.total,unit:t.unit,msPerUnit:A.msPerUnit(),etaMs:A.etaMs(t.total,t.done,r),msSinceProgress:null!==i?r-i:null};this.emit("progress",n),this.notifyProgress(n)}}function eH(){return(0,A.randomUUID)()}function eG(){return globalThis.__libiJobManager||(eC(),globalThis.__libiJobManager=new eY),globalThis.__libiJobManager}},846963,e=>{"use strict";e.s(["DependencyManager",()=>Z],846963);var t=e.i(233405),A=e.i(224361),r=e.i(522734),i=e.i(814747),n=e.i(446786),o=e.i(527622),s=e.i(28618),a=e.i(336763),l=e.i(507980),g=e.i(669385),c=e.i(547124),h=e.i(219199),d=e.i(290303),u=e.i(472691),E=e.i(196808),I=e.i(938281),Q=e.i(36921),B=e.i(435865),C=e.i(537252),f=e.i(186586),p=e.i(151611);let y=new Set;function m(e){return y.has(e)}let w={id:"ace-step-model",label:`ace-step weights (${f.ACESTEP_DOWNLOAD_SIZE_HUMAN})`,async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,f.isAceStepModelInstalled)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,p.getJobManager)(),t=await e.enqueue("music_model_download",{force:!1});"matching_completed"!==t.status&&await e.runToCompletion(t.jobId)}};var D=e.i(815403);e.i(254799);var b=e.i(999436),S=e.i(770565);e.i(525610);let N="3.12",R=["librosa==0.11.0","soundfile"];function k(){return(0,S.hashSpec)(N,R)}[...R.flatMap(e=>["--with",e])];class F extends Error{constructor(e){super(e),this.name="MusicAnalyzeError"}}var M=e.i(753965);let U=".libi-music-analysis.install-token";async function T(e=3e5){let A=(0,b.requireUvBinary)(F,"Music analysis"),r=["run","--python",N,...R.flatMap(e=>["--with",e]),"python","-c","import librosa, soundfile; print('ok')"];await new Promise((i,n)=>{let o=(0,t.spawn)(A,r,{windowsHide:!0,stdio:["ignore","pipe","pipe"],env:(0,E.buildUvEnv)()}),s="",a=setTimeout(()=>{o.kill("SIGKILL"),n(new F(`install timed out after ${e}ms`))},e);o.stdout.on("data",()=>{}),o.stderr.on("data",e=>s+=e.toString()),o.on("close",e=>{clearTimeout(a),0===e?i():n(new F(`install exited ${e}: ${(0,D.formatStderrTail)(s)}`))})}),(0,M.writeInstallToken)(U,k())}let v=[w,{id:"ace-step-env",label:"ace-step env",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,D.isAceStepEnvCurrent)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){await (0,D.generateMusic)({prompt:"warmup",durationSeconds:1,instrumental:!0,seed:0})}},{id:"music-analysis-env",label:"librosa env (~50 MB)",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,M.isTokenCurrent)(U,k());return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){await T()}}];var L=e.i(712168);let x=L.DEFAULT_WHISPER_MODEL,Y={id:"whisper-model",label:`whisper ${x} weights`,async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,L.isWhisperModelInstalled)(x);return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,p.getJobManager)(),t=await e.enqueue("whisper_model_download",{model:x});"matching_completed"!==t.status&&await e.runToCompletion(t.jobId)}};var H=e.i(946113);class G extends Error{constructor(e){super(e),this.name="WhisperEnvInstallError"}}let O=[Y,{id:"whisper-env",label:"whisper env (faster-whisper)",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,H.isWhisperEnvCurrent)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,b.requireUvBinary)(G,"Whisper"),A=["run","--python",H.WHISPER_PYTHON_VERSION,...H.WHISPER_WITH_SPECS.flatMap(e=>["--with",e]),"python","-c","import faster_whisper; print('ok')"];await new Promise((r,i)=>{let n=(0,t.spawn)(e,A,{windowsHide:!0,stdio:["ignore","pipe","pipe"],env:(0,E.buildUvEnv)()}),o="",s=setTimeout(()=>{n.kill("SIGKILL"),i(new G("install timed out after 5 minutes"))},3e5);n.stdout.on("data",()=>{}),n.stderr.on("data",e=>o+=e.toString()),n.on("close",e=>{clearTimeout(s),0===e?r():i(new G(`install exited ${e}: ${o.trim().slice(-2e3)}`))})}),(0,H.writeWhisperEnvToken)()}}];var V=e.i(906385),J=e.i(854503);class _ extends Error{constructor(e){super(e),this.name="TtsEnvInstallError"}}let P=[{id:"tts-model",label:"kokoro TTS weights",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,V.isKokoroModelInstalled)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,p.getJobManager)(),t=await e.enqueue("tts_model_download",{});"matching_completed"!==t.status&&await e.runToCompletion(t.jobId)}},{id:"tts-env",label:"kokoro env (kokoro-onnx)",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,J.isTtsEnvCurrent)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,b.requireUvBinary)(_,"Kokoro TTS"),A=["run","--python",J.TTS_PYTHON_VERSION,...J.TTS_WITH_SPECS.flatMap(e=>["--with",e]),"python","-c","import kokoro_onnx, soundfile; print('ok')"];await new Promise((r,i)=>{let n=(0,t.spawn)(e,A,{windowsHide:!0,stdio:["ignore","pipe","pipe"],env:(0,E.buildUvEnv)()}),o="",s=setTimeout(()=>{n.kill("SIGKILL"),i(new _("install timed out after 5 minutes"))},3e5);n.stdout.on("data",()=>{}),n.stderr.on("data",e=>o+=e.toString()),n.on("close",e=>{clearTimeout(s),0===e?r():i(new _(`install exited ${e}: ${o.trim().slice(-2e3)}`))})}),(0,J.writeTtsEnvToken)()}}],W=new Map;function q(e,t){let A=new Set;for(let r of t){if(A.has(r.id))throw Error(`duplicate virtual-dep id "${r.id}" for mcp "${e}"`);A.add(r.id)}W.set(e,t)}function j(e){return W.get(e)??[]}let z=!1,X=(0,A.promisify)(t.execFile);class Z{skipDbWrites=!1;static unverifiedBinariesWarned=new Set;async verifyBinaryIntegrity(e,t){if(e.sha256){try{await (0,Q.verifySha256)(t,e.sha256)}catch(e){try{r.default.unlinkSync(t)}catch{}throw e}I.serverLogger.info({tag:"security",op:"binary_verified",binary:e.binary,sha256Prefix:e.sha256.slice(0,16)},`Verified sha256 of downloaded binary "${e.binary}"`);return}Z.unverifiedBinariesWarned.has(e.binary)||(Z.unverifiedBinariesWarned.add(e.binary),I.serverLogger.warn({tag:"security",op:"binary_unverified",binary:e.binary},`Downloaded binary "${e.binary}" WITHOUT sha256 verification — its download URL is a "latest" alias with no pinned hash (transport was HTTPS-only). Re-host as a pinned release asset + set the dep's sha256 to enable content verification.`))}setSkipDbWrites(e){this.skipDbWrites=e}async ensureAll(e){await this.installBundledDeps(e),await this.prewarmBundledMcps(e)}static syncLog(t){try{let A=e.r(902157),r=e.r(750227),i=e.r(660526),n=r.join(process.env.LIBI_HOME??r.join(i.homedir(),".libi"),"logs");A.mkdirSync(n,{recursive:!0}),A.appendFileSync(r.join(n,"category-a-sync.log"),`[${new Date().toISOString()}] dm: ${t}
|
|
839
|
+
ctx.fillRect(0, 0, W, H);`,displayName:"Ad end vignette"},{id:"img-zyv32z0t",kind:"image",startTime:37.4,duration:2.1,rect:{x:820,y:140,width:280,height:280},z:10,opacity:1,assetSlug:"logo-mark.png",group:"shoe-brand",keyframes:{rect:{keyframes:[{t:0,value:{x:869.25,y:309.25,width:181.50000000000003,height:181.50000000000003},easing:"ease-out"},{t:.2222222222222222,value:{x:795,y:235,width:330,height:330},easing:"linear"},{t:.3492063492063492,value:{x:785.4497891718671,y:98.38367346938782,width:333.2326530612245,height:333.2326530612245}},{t:1,value:{x:820,y:140,width:280,height:280}}]},opacity:{keyframes:[{t:0,value:0,easing:"ease-out"},{t:.2222222222222222,value:1,easing:"linear"},{t:1,value:1}]}}},{id:"text-hlcq7y7c",kind:"text",startTime:38.1,duration:1.4,rect:{x:460,y:775,width:1e3,height:55},z:10,opacity:1,content:"ENGINEERED TO FLOAT",font:"48px Inter",color:"#9aa3b2",align:"center",fontFamily:"Inter",fontSize:32,fontWeight:500,reveal:{mode:"fade-words",durationMs:500},group:"shoe-brand"},{id:"text-16gcy19w",kind:"text",startTime:40.8,duration:11.2,rect:{x:1010,y:745,width:460,height:80},z:21,opacity:1,content:"Or download the app",font:"48px Inter",color:"#cdd3de",align:"center",fontFamily:"Inter",fontSize:42,fontWeight:500,background:{color:"rgba(255,255,255,0.08)",padding:18,radius:12},reveal:{mode:"fade-words",durationMs:300},group:"end-card"},{id:"img-vxnkonqd",kind:"image",startTime:39.8,duration:12.2,rect:{x:670,y:228,width:320,height:320},z:21,opacity:1,assetSlug:"libi-ring-glyph.png",group:"end-card",keyframes:{rect:{keyframes:[{t:0,value:{x:670,y:228,width:320,height:320},easing:"ease-out"},{t:.062842,value:{x:670,y:228,width:320,height:320},easing:"linear"},{t:.180328,value:{x:663.6,y:221.6,width:332.8,height:332.8},easing:"linear"},{t:1,value:{x:663.6,y:221.6,width:332.8,height:332.8}}]},opacity:{keyframes:[{t:0,value:0,easing:"ease-out"},{t:.062842,value:1,easing:"linear"},{t:.180328,value:1,easing:"linear"},{t:1,value:1}]}},shadow:{color:"rgba(139,180,139,0.55)",blur:70,dx:0,dy:0}},{id:"text-3048dja6",kind:"text",startTime:41.2,duration:10.8,rect:{x:610,y:872,width:700,height:64},z:21,opacity:1,content:"libi.nagellabs.com",font:"48px Inter",color:"#8b93a7",align:"center",fontFamily:"Inter",fontSize:40,fontWeight:400,reveal:{mode:"fade-words",durationMs:300},group:"end-card"}],audioClips:[{id:"clip_i13f0m0n",kind:"inline",assetSlug:"clip-water-impact.mp4",startTime:34.4,duration:6,trimStart:0,volume:.6,enabled:!0,linkedOverlayId:"vid-so51lufn",label:"film audio — splash"},{id:"clip_4t921f5s",kind:"standalone",assetSlug:"music-build-28s.mp3",startTime:0,duration:28,trimStart:0,volume:.85,enabled:!0,label:"music — build (hard cut at 0:28)",duck:{sidechainClipIds:["clip_vo1","clip_vo2","clip_vo3","clip_vo4","clip_vo5","clip_vo6"],thresholdDb:-30,ratio:4,attackMs:50,releaseMs:250,reductionDb:-12}},{id:"clip_g0uxbvkf",kind:"standalone",assetSlug:"sfx-typing.mp3",startTime:.2,duration:3.6,trimStart:0,volume:.5,enabled:!0,label:"SFX typing"},{id:"clip_pj7r0it5",kind:"standalone",assetSlug:"sfx-basshit.mp3",startTime:3.95,duration:1,trimStart:0,volume:.9,enabled:!0,label:"SFX bass hit (Enter)"},{id:"clip_316hr7uq",kind:"standalone",assetSlug:"sfx-clicks.mp3",startTime:4.6,duration:4,trimStart:0,volume:.35,enabled:!0,label:"SFX UI clicks"},{id:"clip_wuk6rzqz",kind:"standalone",assetSlug:"sfx-riser.mp3",startTime:24,duration:4,trimStart:0,volume:.7,enabled:!0,label:"SFX riser → cut"},{id:"clip_v4tmovmb",kind:"inline",assetSlug:"clip-hero-orbit-v2.mp4",startTime:30,duration:4.4,trimStart:0,volume:.6,enabled:!0,linkedOverlayId:"vid-gdgll882",label:"film audio — orbit"},{id:"clip_c44rnjt8",kind:"standalone",assetSlug:"music-anthem-12s.mp3",startTime:30,duration:12,trimStart:0,volume:.9,enabled:!0,label:"music — anthem (0:30–0:42)",duck:{sidechainClipIds:["clip_vo1","clip_vo2","clip_vo3","clip_vo4","clip_vo5","clip_vo6"],thresholdDb:-30,ratio:4,attackMs:50,releaseMs:250,reductionDb:-12}},{id:"clip_tnqhriva",kind:"inline",assetSlug:"clip-track-demo.mp4",startTime:16,duration:6,trimStart:0,volume:1,enabled:!1,linkedOverlayId:"vid-lu4jxr6v",label:"tracking clip audio (muted)"},{id:"clip_vo1",kind:"standalone",assetSlug:"vo-1-describe.mp3",startTime:1,duration:1.149,trimStart:0,volume:1,enabled:!0,label:"VO 1 — You describe it."},{id:"clip_vo2",kind:"standalone",assetSlug:"vo-2-agent.mp3",startTime:5,duration:2.273,trimStart:0,volume:1,enabled:!0,label:"VO 2 — A coding agent builds it."},{id:"clip_vo3",kind:"standalone",assetSlug:"vo-3-generates.mp3",startTime:11,duration:3.474,trimStart:0,volume:1,enabled:!0,label:"VO 3 — It generates the footage…"},{id:"clip_vo4",kind:"standalone",assetSlug:"vo-4-code.mp3",startTime:17,duration:2.508,trimStart:0,volume:1,enabled:!0,label:"VO 4 — Every frame is code."},{id:"clip_vo5",kind:"standalone",assetSlug:"vo-5-director.mp3",startTime:24.6,duration:1.411,trimStart:0,volume:1,enabled:!0,label:"VO 5 — You stay the director."},{id:"clip_vo6",kind:"standalone",assetSlug:"vo-6-madein.mp3",startTime:37.3,duration:2.508,trimStart:0,volume:1,enabled:!0,label:"VO 6 — This video? Made in libi."}]},assets:eg}};var eh=e.i(305121);function ed(e){return`libi:onboarding:${e}`}function eu(e,t){if(Array.isArray(e))return e.map(e=>eu(e,t));if(null!==e&&"object"==typeof e){if(Object.hasOwn(e,"assetSlug")&&Object.hasOwn(e,"fileId"))throw Error(`onboarding: node carries both assetSlug and fileId — ${JSON.stringify(e)} — refusing to let key order pick a winner.`);let A={};for(let[r,i]of Object.entries(e)){if("assetSlug"!==r){A[r]=eu(i,t);continue}if("string"!=typeof i)throw Error(`onboarding: assetSlug must be a string, got ${JSON.stringify(i)}`);let e=t.get(i);if(!e)throw Error(`onboarding: unresolved asset slug ${JSON.stringify(i)} — it is referenced by the composition but was never downloaded.`);A.fileId=e}return A}return e}async function eE(e){let t=ed(e);for(let e of(0,o.getDb)().select({id:s.pieces.id}).from(s.pieces).where((0,n.eq)(s.pieces.description,t)).orderBy((0,et.desc)(s.pieces.createdAt),(0,et.desc)(s.pieces.id)).all())if(await (0,eh.hasManifest)(e.id))return e.id;return null}let eI={kind:"onboarding_piece",maxConcurrent:1,paramsSchema:S.z.object({version:S.z.literal("v1"),force:S.z.boolean()}),resumable:!1,noProgressTimeoutMs:12e4,mcpToolId:(0,T.makeMcpToolId)("libi","libi.build_onboarding_piece"),async run(e){var t;let A,{version:r,force:i}=e.params,a=ec[r];if(!a)throw Error(`onboarding: no definition for version ${r}`);let{definition:g,assets:c}=a;if(!i){let t=await eE(r);if(t)return l.serverLogger.info({tag:"onboarding",op:"reused",version:r,pieceId:t},"onboarding: demo piece already built — reusing it"),e.reportProgress(c.length,c.length,"files"),{pieceId:t,version:r,bytes:0,assets:0,reused:!0}}let h=function(e){let t=process.env[es]?.trim(),A=!!t,r=A?t:"https://storage.googleapis.com/libi-public-assets/onboarding";if(A){let e;try{e=new URL(r)}catch{throw Error(`${es} is not a valid http(s) url: ${r}`)}if("http:"!==e.protocol&&"https:"!==e.protocol)throw Error(`${es} must be an http(s) url, got ${e.protocol}//… (${r})`)}return{baseUrl:`${r.replace(/\/+$/,"")}/${el("version",e)}`,guard:A?eo.assertDevLoopbackOrPublicHttpUrl:eo.assertPublicHttpUrl,overridden:A}}(r);l.serverLogger.info({tag:"onboarding",op:"asset_source",version:r,baseUrl:h.baseUrl,overridden:h.overridden,assets:c.length},"onboarding: resolved demo asset base");let d=await ei({name:g.name,description:`libi:onboarding:${r}:building`});if(!d.success||!d.data)throw Error(`onboarding: could not create the demo piece: ${d.error??"unknown"}`);let u=d.data.id;try{e.reportProgress(0,c.length,"files");let i=new Map,a=0;for(let[A,r]of c.entries()){if(e.shouldCancel())throw new eA.CancelledError(e.jobId);try{let e=await (0,en.fetchAndStoreRemoteFile)({url:(t=r.slug,`${h.baseUrl}/${el("slug",t)}`),guard:h.guard,pieceId:u,filename:r.slug,expectSha256:r.sha256,contentType:r.contentType,skipProxyGeneration:!0});i.set(r.slug,e.fileId),a+=e.bytes}catch(e){throw Error(`onboarding: asset ${r.slug} failed: ${e instanceof Error?e.message:String(e)}`,{cause:e})}e.reportProgress(A+1,c.length,"files")}if(e.shouldCancel())throw new eA.CancelledError(e.jobId);let d=eu(g.overlays,i),E=eu(g.audioClips,i),I={width:g.width,height:g.height,fps:g.fps,overlays:d,audioClips:E};await (0,eh.saveManifest)(u,I),(0,o.getDb)().update(s.pieces).set({description:ed(r),updatedAt:new Date}).where((0,n.eq)(s.pieces.id,u)).run(),l.serverLogger.info({tag:"onboarding",op:"built",version:r,pieceId:u,assets:i.size,bytes:a,overlays:d.length},"onboarding: demo piece built"),A={pieceId:u,version:r,bytes:a,assets:i.size,reused:!1}}catch(e){try{await (0,er.deletePieceCompletely)(u)}catch(e){l.serverLogger.error({tag:"onboarding",op:"rollback_failed",version:r,pieceId:u,err:e instanceof Error?e.message:String(e)},"onboarding: could not clean up the partial demo piece")}throw e}return(0,V.trackServerEvent)("onboarding_piece_built",{version:r}),A}},eQ=globalThis.__libiRunnerRegistry??new Map;function eB(e){return eQ.get(e)??null}function eC(){for(let e of[c.trackingRunner,h.trackingProviderRunner,d.proxyGenRunner,u.filmstripGenRunner,E.exportRenderRunner,I.exportRunner,Q.analysisDescribeFrameRunner,B.whisperModelDownloadRunner,C.ttsModelDownloadRunner,f.musicModelDownloadRunner,p.musicGenerateRunner,y.pieceDupRunner,m.extraAnalysisModelRunner,w.remoteFetchRunner,D.matteGenRunner,b.runtimeUpdateRunner,L,Z,eI,ee])eB(e.kind)||function(e){if(eQ.has(e.kind))throw Error(`Runner already registered for kind: ${e.kind}`);eQ.set(e.kind,e)}(e)}function ef(){eC();let e=new Map;for(let t of Array.from(eQ.values())){if(!t.mcpToolId)continue;let A=Array.isArray(t.mcpToolId)?t.mcpToolId:[t.mcpToolId];e.set(t.kind,A)}return e}globalThis.__libiRunnerRegistry=eQ;var ep=e.i(70499);async function ey(e){(0,o.getDb)().insert(s.jobs).values({id:e.id,kind:e.kind,clientKey:e.clientKey,paramsHash:e.paramsHash,paramsJson:e.paramsJson,pieceId:e.pieceId,fileId:e.fileId,status:"queued"}).run()}async function em(e){let[t]=(0,o.getDb)().select().from(s.jobs).where((0,n.eq)(s.jobs.id,e)).limit(1).all();return t??null}async function ew(e,t,A={}){let r=(0,o.getDb)(),i=(0,n.and)((0,n.eq)(s.jobs.kind,e),(0,n.eq)(s.jobs.paramsHash,t)),a=A.excludeTerminal?(0,n.and)(i,(0,n.notInArray)(s.jobs.status,["completed","failed","cancelled"])):i,[l]=r.select().from(s.jobs).where(a).limit(1).all();return l??null}async function eD(e,t){let[A]=(0,o.getDb)().select().from(s.jobs).where((0,n.and)((0,n.eq)(s.jobs.kind,e),(0,n.eq)(s.jobs.paramsHash,t),(0,n.inArray)(s.jobs.status,["running","queued","cancel-requested"]))).limit(1).all();return A??null}async function eb(e,t){let[A]=(0,o.getDb)().select().from(s.jobs).where((0,n.and)((0,n.eq)(s.jobs.kind,e),(0,n.eq)(s.jobs.paramsHash,t),(0,n.inArray)(s.jobs.status,["completed","failed","cancelled"]))).orderBy((0,et.desc)(s.jobs.completedAt)).limit(1).all();return A??null}async function eS(e){let t=(0,o.getDb)(),A=new Date;t.update(s.jobs).set({status:"running",startedAt:A,lastProgressAt:A}).where((0,n.eq)(s.jobs.id,e)).run()}async function eN(e,t){let A=(0,o.getDb)(),r={progressDone:t.done,progressTotal:t.total,lastProgressAt:new Date};void 0!==t.unit&&(r.progressUnit=t.unit),void 0!==t.msPerUnit&&(r.msPerUnit=t.msPerUnit),A.update(s.jobs).set(r).where((0,n.eq)(s.jobs.id,e)).run()}async function eR(e,t){(0,o.getDb)().update(s.jobs).set({partialPath:t}).where((0,n.eq)(s.jobs.id,e)).run()}async function ek(e,t){(0,o.getDb)().update(s.jobs).set({status:"completed",resultJson:t,completedAt:new Date,error:null}).where((0,n.eq)(s.jobs.id,e)).run()}async function eF(e,t){(0,o.getDb)().update(s.jobs).set({status:"failed",error:t,completedAt:new Date}).where((0,n.eq)(s.jobs.id,e)).run()}async function eM(e){(0,o.getDb)().update(s.jobs).set({status:"cancel-requested"}).where((0,n.eq)(s.jobs.id,e)).run()}async function eU(e){(0,o.getDb)().update(s.jobs).set({status:"cancelled",completedAt:new Date}).where((0,n.eq)(s.jobs.id,e)).run()}async function eT(e){let t=function(){try{let e=(0,a.getCurrentPort)();return`http://127.0.0.1:${e}`}catch{return null}}();if(t)try{await fetch(`${t}/api/notify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(3e3)})}catch{}}let ev={navigate(e){eT({type:"navigate",...e})},refreshQuery(e){eT({type:"refresh_query",...e})},refreshMcpConfig(){eT({type:"refresh_mcp_config"})},instructionsChanged(){eT({type:"instructions_changed"})},analysisChanged(e){eT({type:"analysis_changed",...e})},navigateSettings(e){eT({type:"navigate_settings",mcpId:e.mcpId})},rightRegion(e){eT({type:"right_region",...e})},highlight(e){eT({type:"highlight",...e})},highlightEffect(e){eT({type:"highlight_effect",...e})},setComplexityMode(e){eT({type:"set_complexity_mode",pieceId:e.pieceId,overlayId:e.overlayId,mode:e.mode})},jobProgress(e){eT({type:"job_progress",...e})}};async function eL(e){}function ex(e){return i.default.join((0,a.getLibiHome)(),"jobs",e,"state.json")}e.s(["notify",0,ev,"pushIfBackgrounded",0,eL],981797);class eY extends t.EventEmitter{cancelFlags=new Map;inflight=new Map;lastEmitAt=new Map;lastProgress=new Map;watchdogTripped=new Set;progressChains=new Map;etaTrackers=new Map;forcedJobs=new Set;discardOutputJobs=new Set;activeByKind=new Map;waiters=new Map;toolCallIdByJob=new Map;jobIdByToolCallId=new Map;toolHintByJob=new Map;attachToolHint(e,t){this.toolHintByJob.set(e,t)}getToolHint(e){return this.toolHintByJob.get(e)??null}attachToolCallId(e,t){let A=this.toolCallIdByJob.get(e);A||(A=new Set,this.toolCallIdByJob.set(e,A)),A.add(t),this.jobIdByToolCallId.set(t,e)}getJobIdForToolCallId(e){return this.jobIdByToolCallId.get(e)??null}emitTerminal(e,t,A={}){let r=this.toolCallIdByJob.get(t);this.emit(e,{jobId:t,...A,toolCallIds:r?Array.from(r):[]})}async enqueue(e,t,A={}){let a=eB(e);if(!a)throw Error(`No runner registered for kind: ${e}`);let c=a.paramsSchema.parse(t),h=(0,g.canonicalHash)(c),d=A.clientKey||`srv-${eH()}`;if(!0===A.forceNew||!1===A.resume){if(a.exclusiveResource){let t=await eD(e,h);if(t)return l.serverLogger.info({jobId:t.id,kind:e},"jobs.force_new.attached_exclusive"),{status:"attached_running",jobId:t.id,clientKey:t.clientKey||d,existingJob:{jobId:t.id,pieceId:t.pieceId,startedAt:t.startedAt?.toISOString()??""}}}let t=await ew(e,h);if(t){(0,o.getDb)().delete(s.jobs).where((0,n.eq)(s.jobs.id,t.id)).run(),this.forcedJobs.delete(t.id),this.discardOutputJobs.delete(t.id);let e=i.default.dirname(ex(t.id));try{r.default.rmSync(e,{recursive:!0,force:!0})}catch(t){l.serverLogger.warn({err:t,oldStateDir:e},"jobs.resume.cleanup_failed")}}let g=`job-${eH()}`;return await ey({id:g,kind:e,clientKey:d,paramsHash:h,paramsJson:JSON.stringify(c),pieceId:A.pieceId??null,fileId:A.fileId??null}),this.forcedJobs.add(g),!0===A.discardOutput&&this.discardOutputJobs.add(g),this.emit("created",{jobId:g,kind:e}),{status:"new",jobId:g,clientKey:d,forced:!0}}let u=await eD(e,h);if(u)return{status:"attached_running",jobId:u.id,clientKey:u.clientKey||d,existingJob:{jobId:u.id,pieceId:u.pieceId,startedAt:u.startedAt?.toISOString()??""}};let E=await eb(e,h);if(E)return{status:"matching_completed",existingJob:{jobId:E.id,pieceId:E.pieceId,completedAt:E.completedAt?.toISOString()??"",status:E.status,result:function(e,t){if(t)try{return JSON.parse(t)}catch(t){l.serverLogger.warn({tag:"jobs",op:"terminal_result_parse_failed",jobId:e,err:t instanceof Error?t.message:String(t)},"Failed to parse cached job result JSON; returning undefined");return}}(E.id,E.resultJson),error:E.error}};let I=`job-${eH()}`;return await ey({id:I,kind:e,clientKey:d,paramsHash:h,paramsJson:JSON.stringify(c),pieceId:A.pieceId??null,fileId:A.fileId??null}),this.emit("created",{jobId:I,kind:e}),{status:"new",jobId:I,clientKey:d}}async runToCompletion(e,t){let A=t?this.subscribe(e,t):()=>{};try{let t=this.inflight.get(e);if(t)return t;let A=this.runLocked(e);this.inflight.set(e,A);try{return await A}finally{this.inflight.delete(e)}}finally{A()}}subscribe(e,t){let A=A=>{A.jobId===e&&t(A)};return this.on("progress",A),()=>this.off("progress",A)}async getStatus(e){let t=await em(e);if(!t)throw new eA.JobNotFoundError(e);return(0,eA.snapshotFromRow)(t)}async cancel(e){let t=await em(e);if(!t)throw new eA.JobNotFoundError(e);if("completed"===t.status||"failed"===t.status||"cancelled"===t.status)return;await eM(e);let A=this.cancelFlags.get(e);A&&A.abort(),this.emit("cancel-requested",{jobId:e})}async runLocked(e){let t=await em(e);if(!t)throw new eA.JobNotFoundError(e);let A=eB(t.kind);if(!A)throw Error(`No runner registered for kind: ${t.kind}`);await this.acquireSlot(A.kind,A.maxConcurrent);try{let r=await em(e);if(r?.status==="cancel-requested")throw await eU(e),this.emitTerminal("cancelled",e),new eA.CancelledError(e);return await this.runWithSlot(e,r??t,A)}finally{this.releaseSlot(A.kind)}}async acquireSlot(e,t){(this.activeByKind.get(e)??0)<t||await new Promise(t=>{let A=this.waiters.get(e)??[];A.push(t),this.waiters.set(e,A)}),this.activeByKind.set(e,(this.activeByKind.get(e)??0)+1)}releaseSlot(e){this.activeByKind.set(e,Math.max(0,(this.activeByKind.get(e)??0)-1));let t=this.waiters.get(e);t&&t.length>0&&t.shift()()}async runWithSlot(e,t,A){await eS(e);let n=new AbortController;this.cancelFlags.set(e,n);let o=null===A.noProgressTimeoutMs?null:A.noProgressTimeoutMs??6e4,s=null;null!==o&&(await eN(e,{done:0,total:0}),s=setInterval(()=>{(async()=>{let A=await em(e);if(!A||"running"!==A.status||!A.lastProgressAt)return;let r=Date.now()-A.lastProgressAt.getTime();r>o&&(l.serverLogger.warn({jobId:e,kind:t.kind,idleMs:r},"jobs.watchdog.no_progress"),this.watchdogTripped.add(e),n.abort())})().catch(t=>l.serverLogger.warn({err:t,jobId:e},"jobs.watchdog.poll_failed"))},Math.max(10,Math.min(5e3,Math.floor(o/4)))));let a=setInterval(()=>{try{this.emitHeartbeat(e)}catch(t){l.serverLogger.warn({err:t,jobId:e},"jobs.heartbeat.failed")}},15e3);a.unref?.();let g=ex(e),c=null;if(t.partialPath&&r.default.existsSync(t.partialPath))try{c=JSON.parse(r.default.readFileSync(t.partialPath,"utf-8"))}catch(t){l.serverLogger.warn({err:t,jobId:e},"jobs.resume.parse_failed"),c=null}let h={jobId:e,params:JSON.parse(t.paramsJson),resumeState:c,reportProgress:(A,r,i)=>{this.handleProgress(e,t.kind,A,r,i??t.progressUnit)},checkpoint:async A=>{r.default.mkdirSync(i.default.dirname(g),{recursive:!0}),r.default.writeFileSync(g,JSON.stringify(A),"utf-8"),t.partialPath||(await eR(e,g),t.partialPath=g)},shouldCancel:()=>n.signal.aborted,forced:this.forcedJobs.has(e),discardOutput:this.discardOutputJobs.has(e)};try{var d,u;let t=await Promise.race([A.run(h),(d=n.signal,u=()=>this.watchdogTripped.has(e)?Error(`No progress for ${o}ms — watchdog tripped`):new eA.CancelledError(e),new Promise((e,t)=>{d.aborted?t(u()):d.addEventListener("abort",()=>t(u()),{once:!0})}))]);if(r.default.existsSync(g))try{r.default.unlinkSync(g)}catch{}return await ek(e,JSON.stringify(t)),this.emitTerminal("completed",e,{result:t}),t}catch(r){if(this.watchdogTripped.has(e)){this.watchdogTripped.delete(e);let A=`No progress for ${o}ms — watchdog tripped`;try{await eF(e,A)}catch(t){l.serverLogger.error({err:t,jobId:e},"jobs.run.mark_failed_throw")}throw l.serverLogger.error({jobId:e,kind:t.kind,watchdogMs:o},"jobs.run.watchdog_failed"),this.emitTerminal("failed",e,{error:A}),Error(A)}if(r instanceof eA.CancelledError||n.signal.aborted){try{await eU(e)}catch(t){l.serverLogger.error({err:t,jobId:e},"jobs.run.mark_cancelled_throw")}throw this.emitTerminal("cancelled",e),r instanceof eA.CancelledError?r:new eA.CancelledError(e)}let A=r instanceof Error?r.message:String(r);try{await eF(e,A)}catch(t){l.serverLogger.error({err:t,jobId:e},"jobs.run.mark_failed_throw")}throw l.serverLogger.error({jobId:e,kind:t.kind,err:A},"jobs.run.failed"),this.emitTerminal("failed",e,{error:A}),r}finally{s&&clearInterval(s),clearInterval(a),this.cancelFlags.delete(e),this.progressChains.delete(e),this.etaTrackers.delete(e),this.lastProgress.delete(e);let t=this.toolCallIdByJob.get(e);if(t)for(let e of t)this.jobIdByToolCallId.delete(e);this.toolCallIdByJob.delete(e),this.toolHintByJob.delete(e),this.forcedJobs.delete(e),this.discardOutputJobs.delete(e)}}handleProgress(e,t,A,r,i){let n=Date.now();if(A=Math.min(A,r>0?r:A),n-(this.lastEmitAt.get(e)??0)<1e3&&A<r)return;this.lastEmitAt.set(e,n);let o=(this.progressChains.get(e)??Promise.resolve()).then(async()=>{let o=await em(e);if(!o||!o.startedAt)return;let s=this.etaTrackers.get(e);s||(s=new ep.EtaTracker,this.etaTrackers.set(e,s)),s.add(n,A);let a=s.msPerUnit();await eN(e,{done:A,total:r,unit:i,msPerUnit:a}),this.lastProgress.set(e,{kind:t,done:A,total:r,unit:i});let l={jobId:e,kind:t,done:A,total:r,unit:i,msPerUnit:a,etaMs:s.etaMs(r,A)};this.emit("progress",l),this.notifyProgress(l)}).catch(t=>{l.serverLogger.warn({err:t,jobId:e},"jobs.progress.update_failed")});this.progressChains.set(e,o)}notifyProgress(e){let t=this.toolCallIdByJob.get(e.jobId),A=this.toolHintByJob.get(e.jobId),r={jobId:e.jobId,kind:e.kind,done:e.done,total:e.total,unit:e.unit,etaMs:e.etaMs,msSinceProgress:e.msSinceProgress??null,...A?{toolName:A.toolName,toolArgs:A.toolArgs,...A.progressLabel?{progressLabel:A.progressLabel}:{}}:{}};try{if(t&&t.size>0)for(let e of t)ev.jobProgress({...r,toolCallId:e});else ev.jobProgress({...r,toolCallId:void 0})}catch(t){l.serverLogger.warn({err:t,jobId:e.jobId},"jobs.progress.notify_failed")}}emitHeartbeat(e){let t=this.lastProgress.get(e);if(!t)return;let A=this.etaTrackers.get(e);if(!A)return;let r=Date.now(),i=A.lastSampleAt(),n={jobId:e,kind:t.kind,done:t.done,total:t.total,unit:t.unit,msPerUnit:A.msPerUnit(),etaMs:A.etaMs(t.total,t.done,r),msSinceProgress:null!==i?r-i:null};this.emit("progress",n),this.notifyProgress(n)}}function eH(){return(0,A.randomUUID)()}function eG(){return globalThis.__libiJobManager||(eC(),globalThis.__libiJobManager=new eY),globalThis.__libiJobManager}},846963,e=>{"use strict";e.s(["DependencyManager",()=>Z],846963);var t=e.i(233405),A=e.i(224361),r=e.i(522734),i=e.i(814747),n=e.i(446786),o=e.i(527622),s=e.i(28618),a=e.i(336763),l=e.i(507980),g=e.i(669385),c=e.i(547124),h=e.i(219199),d=e.i(290303),u=e.i(472691),E=e.i(196808),I=e.i(938281),Q=e.i(36921),B=e.i(435865),C=e.i(537252),f=e.i(186586),p=e.i(151611);let y=new Set;function m(e){return y.has(e)}let w={id:"ace-step-model",label:`ace-step weights (${f.ACESTEP_DOWNLOAD_SIZE_HUMAN})`,async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,f.isAceStepModelInstalled)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,p.getJobManager)(),t=await e.enqueue("music_model_download",{force:!1});"matching_completed"!==t.status&&await e.runToCompletion(t.jobId)}};var D=e.i(815403);e.i(254799);var b=e.i(999436),S=e.i(770565);e.i(525610);let N="3.12",R=["librosa==0.11.0","soundfile"];function k(){return(0,S.hashSpec)(N,R)}[...R.flatMap(e=>["--with",e])];class F extends Error{constructor(e){super(e),this.name="MusicAnalyzeError"}}var M=e.i(753965);let U=".libi-music-analysis.install-token";async function T(e=3e5){let A=(0,b.requireUvBinary)(F,"Music analysis"),r=["run","--python",N,...R.flatMap(e=>["--with",e]),"python","-c","import librosa, soundfile; print('ok')"];await new Promise((i,n)=>{let o=(0,t.spawn)(A,r,{windowsHide:!0,stdio:["ignore","pipe","pipe"],env:(0,E.buildUvEnv)()}),s="",a=setTimeout(()=>{o.kill("SIGKILL"),n(new F(`install timed out after ${e}ms`))},e);o.stdout.on("data",()=>{}),o.stderr.on("data",e=>s+=e.toString()),o.on("close",e=>{clearTimeout(a),0===e?i():n(new F(`install exited ${e}: ${(0,D.formatStderrTail)(s)}`))})}),(0,M.writeInstallToken)(U,k())}let v=[w,{id:"ace-step-env",label:"ace-step env",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,D.isAceStepEnvCurrent)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){await (0,D.generateMusic)({prompt:"warmup",durationSeconds:1,instrumental:!0,seed:0})}},{id:"music-analysis-env",label:"librosa env (~50 MB)",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,M.isTokenCurrent)(U,k());return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){await T()}}];var L=e.i(712168);let x=L.DEFAULT_WHISPER_MODEL,Y={id:"whisper-model",label:`whisper ${x} weights`,async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,L.isWhisperModelInstalled)(x);return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,p.getJobManager)(),t=await e.enqueue("whisper_model_download",{model:x});"matching_completed"!==t.status&&await e.runToCompletion(t.jobId)}};var H=e.i(946113);class G extends Error{constructor(e){super(e),this.name="WhisperEnvInstallError"}}let O=[Y,{id:"whisper-env",label:"whisper env (faster-whisper)",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,H.isWhisperEnvCurrent)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,b.requireUvBinary)(G,"Whisper"),A=["run","--python",H.WHISPER_PYTHON_VERSION,...H.WHISPER_WITH_SPECS.flatMap(e=>["--with",e]),"python","-c","import faster_whisper; print('ok')"];await new Promise((r,i)=>{let n=(0,t.spawn)(e,A,{windowsHide:!0,stdio:["ignore","pipe","pipe"],env:(0,E.buildUvEnv)()}),o="",s=setTimeout(()=>{n.kill("SIGKILL"),i(new G("install timed out after 5 minutes"))},3e5);n.stdout.on("data",()=>{}),n.stderr.on("data",e=>o+=e.toString()),n.on("close",e=>{clearTimeout(s),0===e?r():i(new G(`install exited ${e}: ${o.trim().slice(-2e3)}`))})}),(0,H.writeWhisperEnvToken)()}}];var V=e.i(906385),J=e.i(854503);class _ extends Error{constructor(e){super(e),this.name="TtsEnvInstallError"}}let P=[{id:"tts-model",label:"kokoro TTS weights",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,V.isKokoroModelInstalled)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,p.getJobManager)(),t=await e.enqueue("tts_model_download",{});"matching_completed"!==t.status&&await e.runToCompletion(t.jobId)}},{id:"tts-env",label:"kokoro env (kokoro-onnx)",async inspect(){if(m(this.id))return{binary:this.label,installed:!1,path:null,source:null,runtimeStatus:"installing",error:null};let e=(0,J.isTtsEnvCurrent)();return{binary:this.label,installed:e,path:null,source:e?"bundled":null,runtimeStatus:e?"installed":"pending",error:null}},async install(){let e=(0,b.requireUvBinary)(_,"Kokoro TTS"),A=["run","--python",J.TTS_PYTHON_VERSION,...J.TTS_WITH_SPECS.flatMap(e=>["--with",e]),"python","-c","import kokoro_onnx, soundfile; print('ok')"];await new Promise((r,i)=>{let n=(0,t.spawn)(e,A,{windowsHide:!0,stdio:["ignore","pipe","pipe"],env:(0,E.buildUvEnv)()}),o="",s=setTimeout(()=>{n.kill("SIGKILL"),i(new _("install timed out after 5 minutes"))},3e5);n.stdout.on("data",()=>{}),n.stderr.on("data",e=>o+=e.toString()),n.on("close",e=>{clearTimeout(s),0===e?r():i(new _(`install exited ${e}: ${o.trim().slice(-2e3)}`))})}),(0,J.writeTtsEnvToken)()}}],W=new Map;function q(e,t){let A=new Set;for(let r of t){if(A.has(r.id))throw Error(`duplicate virtual-dep id "${r.id}" for mcp "${e}"`);A.add(r.id)}W.set(e,t)}function j(e){return W.get(e)??[]}let z=!1,X=(0,A.promisify)(t.execFile);class Z{skipDbWrites=!1;static unverifiedBinariesWarned=new Set;async verifyBinaryIntegrity(e,t){if(e.sha256){try{await (0,Q.verifySha256)(t,e.sha256)}catch(e){try{r.default.unlinkSync(t)}catch{}throw e}I.serverLogger.info({tag:"security",op:"binary_verified",binary:e.binary,sha256Prefix:e.sha256.slice(0,16)},`Verified sha256 of downloaded binary "${e.binary}"`);return}Z.unverifiedBinariesWarned.has(e.binary)||(Z.unverifiedBinariesWarned.add(e.binary),I.serverLogger.warn({tag:"security",op:"binary_unverified",binary:e.binary},`Downloaded binary "${e.binary}" WITHOUT sha256 verification — its download URL is a "latest" alias with no pinned hash (transport was HTTPS-only). Re-host as a pinned release asset + set the dep's sha256 to enable content verification.`))}setSkipDbWrites(e){this.skipDbWrites=e}async ensureAll(e){await this.installBundledDeps(e),await this.prewarmBundledMcps(e)}static syncLog(t){try{let A=e.r(902157),r=e.r(750227),i=e.r(660526),n=r.join(process.env.LIBI_HOME??r.join(i.homedir(),".libi"),"logs");A.mkdirSync(n,{recursive:!0}),A.appendFileSync(r.join(n,"category-a-sync.log"),`[${new Date().toISOString()}] dm: ${t}
|
|
840
840
|
`)}catch{}}async installBundledDeps(e){this.ensureBinDir();let t=e?.tier??"all",A="tier-1"===t?l.BUNDLED_MCP_SERVERS.filter(e=>(e.installFlow??"tier-1")==="tier-1"||e.dependencies.some(e=>"tier-1"===e.installFlow)):l.BUNDLED_MCP_SERVERS;for(let r of(Z.syncLog(`installBundledDeps: ${A.length} defs, tier=${t}`),A)){if(Z.syncLog(`def loop: ${r.id} (deps=${r.dependencies.length})`),e?.failedOnly){let[e]=(0,o.getDb)().select().from(s.mcpServers).where((0,a.eq)(s.mcpServers.id,r.id)).limit(1).all();if(e&&"failed"!==e.installStatus)continue}if("tier-1"===t&&(r.installFlow??"tier-1")==="tier-2"){for(let t of r.dependencies.filter(e=>"tier-1"===e.installFlow))await this.installSingleDep(r.id,t,e?.onProgress);continue}await this.ensureMcp(r,e?.onProgress)}}async prewarmBundledMcps(e){let t=e?.tier??"all",A=l.BUNDLED_MCP_SERVERS.filter(e=>!e.core&&!e.noServer&&"http"!==e.type&&("tier-1"!==t||(e.installFlow??"tier-1")==="tier-1")),r=Date.now();I.serverLogger.info({tag:"mcp-prewarm",op:"batch_start",count:A.length,ids:A.map(e=>e.id),failedOnly:e?.failedOnly===!0},`Pre-warming ${A.length} bundled MCP server(s)`);let i=[];for(let t of A)i.push(await this.prewarmMcp(t,e));I.serverLogger.info({tag:"mcp-prewarm",op:"batch_done",durationMs:Date.now()-r,results:i},`Pre-warm batch done in ${Date.now()-r}ms`)}async prewarmMcp(e,t){if(e.core)return{id:e.id,status:"skipped",durationMs:0,skipped:"core"};if(e.noServer)return{id:e.id,status:"skipped",durationMs:0,skipped:"no-server"};if("http"===e.type)return{id:e.id,status:"skipped",durationMs:0,skipped:"http"};let[A]=(0,o.getDb)().select().from(s.mcpServers).where((0,a.eq)(s.mcpServers.id,e.id)).limit(1).all();if(A?.installStatus!=="installed"&&A?.installStatus!=="not_required")return I.serverLogger.info({tag:"mcp-prewarm",op:"skip",mcpId:e.id,reason:"install_not_ready",installStatus:A?.installStatus??null},`Skipping pre-warm for "${e.id}" — install not ready`),{id:e.id,status:"skipped",durationMs:0,skipped:"install_not_ready"};if(t?.failedOnly&&"down"!==A.serverStatus)return{id:e.id,status:"skipped",durationMs:0,skipped:"not_failed"};let r=Date.now();I.serverLogger.info({tag:"mcp-prewarm",op:"start",mcpId:e.id,command:e.command,args:e.args},`Pre-warming MCP "${e.id}" (${e.command} ${(e.args??[]).join(" ")})`);try{let t=await (0,g.probeAndPersist)(e),A=Date.now()-r;return I.serverLogger.info({tag:"mcp-prewarm",op:"done",mcpId:e.id,status:t.status,durationMs:A},`Pre-warm done for "${e.id}" (${t.status}, ${A}ms)`),{id:e.id,status:t.status,durationMs:A}}catch(i){let t=Date.now()-r,A=i instanceof Error?i.message:String(i);return I.serverLogger.error({tag:"mcp-prewarm",op:"error",mcpId:e.id,durationMs:t,err:A},`Pre-warm threw for "${e.id}"`),{id:e.id,status:"error",durationMs:t}}}static getBinDir(){return(0,u.getLibiBinDir)()}static pickPlatformValue(e){let t=process.platform,A=e[t];if(void 0===A)throw Error(`No download URL for platform=${t}`);if("string"==typeof A)return A;let r=process.arch,i=A[r];if(void 0!==i)return i;let n=Object.values(A).find(e=>void 0!==e);if(void 0===n)throw Error(`No download URL for platform=${t}, arch=${r}`);return n}static resolveDownloadUrl(e){if(!e.downloadUrl)throw Error(`Dependency ${e.binary} has no downloadUrl — likely a customInstaller dep called via the wrong path.`);return Z.pickPlatformValue(e.downloadUrl)}static resolveBinaryPathInArchive(e){if(!e.archive)throw Error(`Dependency ${e.binary} has no archive metadata`);return Z.pickPlatformValue(e.archive.binaryPathInArchive)}static evaluateConfigStatus(e){let t=e.requiredEnvVars??[];if(0===t.length)return{status:"installed",missing:[]};let A={};if(e.envVarsJson)try{A=JSON.parse(e.envVarsJson)}catch{}let r=t.filter(e=>!A[e]||""===A[e]);return 0===r.length?{status:"installed",missing:[]}:{status:"needs_config",missing:r}}async getStatuses(e){z||(z=!0,q("local-music",v),q("whisper",O),q("local-tts",P));let t=l.BUNDLED_MCP_SERVERS.find(t=>t.id===e);return[...t?await Promise.all(t.dependencies.map(e=>this.resolveStatusAsync(e))):[],...await Promise.all(j(e).map(e=>e.inspect().catch(t=>({binary:e.label,installed:!1,path:null,source:null,runtimeStatus:"failed",error:t instanceof Error?t.message:String(t)}))))]}async settleInstallStatus(e){let t,A=l.BUNDLED_MCP_SERVERS.find(t=>t.id===e);if(!A||A.core)return null;let r=(0,o.getDb)(),[i]=r.select().from(s.mcpServers).where((0,a.eq)(s.mcpServers.id,e)).limit(1).all();if(!i)return null;if("failed"===i.installStatus||"installing"===i.installStatus)return i.installStatus;let n=await this.getStatuses(e),g=n.every(e=>e.installed),c=null;if(g)if(A.requiredEnvVars&&A.requiredEnvVars.length>0){let e=Z.evaluateConfigStatus({requiredEnvVars:A.requiredEnvVars,envVarsJson:i.envVars??null});t=e.status,c="needs_config"===e.status?`Missing required env vars: ${e.missing.join(", ")}`:null}else t=0===A.dependencies.length&&0===j(e).length?"not_required":"installed";else t="pending";return r.update(s.mcpServers).set({installStatus:t,installError:c,dependencyStatus:JSON.stringify(n),updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,e)).run(),"installed"!==t&&"not_required"!==t&&"unknown"!==i.serverStatus&&r.update(s.mcpServers).set({serverStatus:"unknown",serverError:null,updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,e)).run(),t}async settleAllBundledStatuses(){for(let e of l.BUNDLED_MCP_SERVERS)if(!e.core)try{await this.settleInstallStatus(e.id)}catch(t){I.serverLogger.warn({tag:"mcp-settle",op:"settle_failed",mcpId:e.id,err:t instanceof Error?t.message:String(t)},`settleInstallStatus failed for "${e.id}"`)}}async retryDep(e,t){let A=l.BUNDLED_MCP_SERVERS.find(t=>t.id===e);if(!A)throw Error(`No bundled MCP with id ${e}`);let r=A.dependencies.find(e=>e.binary===t);if(!r)throw Error(`No dep ${t} on MCP ${e}`);this.ensureBinDir(),this.writeDepTransition(e,t,{runtimeStatus:"installing",error:null});try{if(r.files)await this.installMultiFile(r);else if(r.customInstallerId)await this.runCustomInstaller(r);else{let e=Z.resolveDownloadUrl(r);await this.downloadGroup(e,[r])}let A=await this.resolveStatusAsync(r);if(!A.installed)return void this.writeDepTransition(e,t,{runtimeStatus:"failed",error:"Install completed without throwing, but binary still not detected."});this.writeDepTransition(e,t,A)}catch(r){let A=r instanceof Error?r.message:String(r);throw I.serverLogger.error({mcpId:e,binary:t,err:A},"retryDep failed"),this.writeDepTransition(e,t,{runtimeStatus:"failed",error:A}),r}}async installSingleDep(e,t,A){if(this.ensureBinDir(),(await this.resolveStatusAsync(t)).installed)return void A?.({binary:t.binary,mcpId:e,status:"skipped",reason:"already_installed"});this.writeDepTransition(e,t.binary,{runtimeStatus:"installing",error:null}),A?.({binary:t.binary,mcpId:e,status:"downloading"});try{if(t.files)await this.installMultiFile(t);else if(t.customInstallerId)await this.runCustomInstaller(t);else{let r=Z.resolveDownloadUrl(t);await this.downloadGroup(r,[t],A?r=>A({...r,binary:t.binary,mcpId:e}):void 0)}let r=await this.resolveStatusAsync(t);this.writeDepTransition(e,t.binary,r),A?.({binary:t.binary,mcpId:e,status:"done"})}catch(r){let A=r instanceof Error?r.message:String(r);throw I.serverLogger.error({mcpId:e,binary:t.binary,err:A},"installSingleDep failed"),this.writeDepTransition(e,t.binary,{runtimeStatus:"failed",error:A}),r}}ensureBinDir(){r.default.existsSync((0,u.getLibiBinDir)())||r.default.mkdirSync((0,u.getLibiBinDir)(),{recursive:!0})}async ensureMcp(e,t){let A,r;Z.syncLog(`ensureMcp(${e.id}): before getDb()`);let i=(0,o.getDb)();Z.syncLog(`ensureMcp(${e.id}): after getDb()`);let n=e.id;if(Z.syncLog(`ensureMcp(${e.id}): deps=${e.dependencies.length}`),0===e.dependencies.length){if(this.skipDbWrites)return;let t="not_required",A=null;if(e.requiredEnvVars&&e.requiredEnvVars.length>0){let[r]=i.select().from(s.mcpServers).where((0,a.eq)(s.mcpServers.id,e.id)).limit(1).all(),n=Z.evaluateConfigStatus({requiredEnvVars:e.requiredEnvVars,envVarsJson:r?.envVars??null});t=n.status,A="needs_config"===n.status?`Missing required env vars: ${n.missing.join(", ")}`:null}i.update(s.mcpServers).set({installStatus:t,installError:A,dependencyStatus:JSON.stringify([]),updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,n)).run();return}this.skipDbWrites||(Z.syncLog(`ensureMcp(${n}): UPDATE mcpServers SET installStatus=checking`),i.update(s.mcpServers).set({installStatus:"checking",updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,n)).run(),Z.syncLog(`ensureMcp(${n}): UPDATE done`));let l=[],g=new Map,c=e.dependencies.filter(e=>e.files),h=e.dependencies.filter(e=>e.customInstallerId&&!e.files),d=e.dependencies.filter(e=>!e.customInstallerId&&!e.files),u=new Map;for(let e of d){let t=Z.resolveDownloadUrl(e),A=u.get(t)??[];A.push(e),u.set(t,A)}for(let e of c){if(this.isMultiFileInstalled(e)){t?.({binary:e.binary,mcpId:n,status:"skipped",reason:"already_installed"});continue}this.writeDepTransition(n,e.binary,{runtimeStatus:"installing",error:null}),t?.({binary:e.binary,mcpId:n,status:"downloading"});try{await this.installMultiFile(e);let A=await this.resolveStatusAsync(e);this.writeDepTransition(n,e.binary,A),t?.({binary:e.binary,mcpId:n,status:"done"})}catch(A){let t=A instanceof Error?A.message:String(A);l.push(`${e.binary}: ${t}`),I.serverLogger.error({binary:e.binary,err:t},"Multi-file installer failed"),g.set(e.binary,t),this.writeDepTransition(n,e.binary,{runtimeStatus:"failed",error:t})}}for(let e of h){if((await this.resolveStatusAsync(e)).installed){t?.({binary:e.binary,mcpId:n,status:"skipped",reason:"already_installed"});continue}this.writeDepTransition(n,e.binary,{runtimeStatus:"installing",error:null}),t?.({binary:e.binary,mcpId:n,status:"downloading"});try{await this.runCustomInstaller(e),t?.({binary:e.binary,mcpId:n,status:"done"})}catch(A){let t=A instanceof Error?A.message:String(A);l.push(`${e.binary}: ${t}`),I.serverLogger.error({binary:e.binary,err:t},"Custom installer failed"),g.set(e.binary,t),this.writeDepTransition(n,e.binary,{runtimeStatus:"failed",error:t})}}for(let[e,A]of u){if(A.every(e=>this.resolveStatus(e).installed)){for(let e of A)t?.({binary:e.binary,mcpId:n,status:"skipped",reason:"already_installed"});continue}let r=new Set;for(let e of A)this.resolveStatus(e).installed?t?.({binary:e.binary,mcpId:n,status:"skipped",reason:"already installed"}):(r.add(e.binary),this.writeDepTransition(n,e.binary,{runtimeStatus:"installing",error:null}),t?.({binary:e.binary,mcpId:n,status:"downloading"}));try{for(let i of(await this.downloadGroup(e,A,t?e=>{for(let i of A)r.has(i.binary)&&t({...e,binary:i.binary,mcpId:n})}:void 0),A))r.has(i.binary)&&t?.({binary:i.binary,mcpId:n,status:"done"})}catch(t){let e=t instanceof Error?t.message:String(t);for(let t of(l.push(`${A.map(e=>e.binary).join(", ")}: ${e}`),I.serverLogger.error({binaries:A.map(e=>e.binary),err:e},"Failed to download dependency group"),A))g.set(t.binary,e),this.writeDepTransition(n,t.binary,{runtimeStatus:"failed",error:e})}}if(this.skipDbWrites)return;let E=(await Promise.all(e.dependencies.map(e=>this.resolveStatusAsync(e)))).map(e=>{let t=g.get(e.binary);return t&&!e.installed?{...e,runtimeStatus:"failed",error:t}:e});if(E.every(e=>e.installed))if(e.requiredEnvVars&&e.requiredEnvVars.length>0){let[t]=i.select().from(s.mcpServers).where((0,a.eq)(s.mcpServers.id,e.id)).limit(1).all(),n=Z.evaluateConfigStatus({requiredEnvVars:e.requiredEnvVars,envVarsJson:t?.envVars??null});A=n.status,r="needs_config"===n.status?`Missing required env vars: ${n.missing.join(", ")}`:null}else A="installed",r=null;else A="failed",r=l.join(" | ")||"unknown";i.update(s.mcpServers).set({installStatus:A,installError:r,dependencyStatus:JSON.stringify(E),updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,n)).run(),e.core||"installed"!==A&&i.update(s.mcpServers).set({serverStatus:"down",serverError:`Dependencies not installed: ${r??"unknown"}`,serverLastChecked:new Date,updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,n)).run()}writeDepTransition(e,t,A){if(this.skipDbWrites)return;let r=(0,o.getDb)(),[i]=r.select().from(s.mcpServers).where((0,a.eq)(s.mcpServers.id,e)).limit(1).all();if(!i)return;let n=[];try{n=JSON.parse(i.dependencyStatus??"[]")}catch{}let l=n.findIndex(e=>e.binary===t);-1===l?n.push({binary:t,installed:!1,path:null,source:null,runtimeStatus:"pending",...A}):n[l]={...n[l],...A},r.update(s.mcpServers).set({dependencyStatus:JSON.stringify(n),updatedAt:new Date}).where((0,a.eq)(s.mcpServers.id,e)).run();try{C.navigationEmitter.emit("refresh_query",{queryKey:"mcp-servers"})}catch{}}resolveStatus(e){if(e.files){let t="models"===e.destination?(0,u.getLibiModelsDir)():(0,u.getLibiBinDir)(),A=i.default.join(t,e.binary),n=e.files.every(e=>r.default.existsSync(i.default.join(A,e.relPath)))&&this.installTokenMatches(e);return{binary:e.binary,installed:n,path:n?A:null,source:n?"bundled":null,runtimeStatus:n?"installed":"pending"}}if(e.customInstallerId)return{binary:e.binary,installed:!1,path:null,source:null,runtimeStatus:"pending"};let t=this.getBinaryPath(e.binary);if(r.default.existsSync(t)){let A=this.installTokenMatches(e);return{binary:e.binary,installed:A,path:A?t:null,source:A?"bundled":null,runtimeStatus:A?"installed":"pending"}}return!e.requireBundled&&this.binaryExistsOnPath(e.binary)?{binary:e.binary,installed:!0,path:null,source:"system",runtimeStatus:"installed"}:{binary:e.binary,installed:!1,path:null,source:null,runtimeStatus:"pending"}}async resolveStatusAsync(e){if(e.files){let t="models"===e.destination?(0,u.getLibiModelsDir)():(0,u.getLibiBinDir)(),A=i.default.join(t,e.binary),n=e.files.every(e=>r.default.existsSync(i.default.join(A,e.relPath)))&&this.installTokenMatches(e);return{binary:e.binary,installed:n,path:n?A:null,source:n?"bundled":null,runtimeStatus:n?"installed":"pending"}}if(e.customInstallerId){let t=(0,c.getCustomInstaller)(e.customInstallerId);if(!t)return I.serverLogger.warn({binary:e.binary,customInstallerId:e.customInstallerId},"Unknown customInstallerId — no implementation registered"),{binary:e.binary,installed:!1,path:null,source:null,runtimeStatus:"pending"};try{let A=await t.verify();if(A)return{binary:e.binary,installed:!0,path:A,source:"bundled",runtimeStatus:"installed"}}catch(t){I.serverLogger.warn({binary:e.binary,err:t instanceof Error?t.message:String(t)},"customInstaller.verify threw")}return{binary:e.binary,installed:!1,path:null,source:null,runtimeStatus:"pending"}}let t=this.resolveStatus(e);if(e.runCheck&&t.installed&&t.path&&!await Z.isBinaryRunnable(t.path,e.runCheck))return I.serverLogger.warn({binary:e.binary,path:t.path,tag:"dep-runcheck"},"installed binary failed its runCheck (likely wrong CPU arch) — marking for re-install"),{binary:e.binary,installed:!1,path:null,source:null,runtimeStatus:"pending"};if(e.capabilityCheck&&t.installed&&t.path){let A=await Z.missingCapabilities(t.path,e.capabilityCheck);if(A.length>0)return I.serverLogger.warn({binary:e.binary,path:t.path,missing:A,tag:"dep-capability"},`installed ${e.binary} is missing required capabilities (${A.join(", ")}) — marking for re-install`),{binary:e.binary,installed:!1,path:null,source:null,runtimeStatus:"pending"}}return t}static async isBinaryRunnable(e,t){try{return await X(e,t,{timeout:1e4,windowsHide:!0,killSignal:"SIGKILL"}),!0}catch{return!1}}static async missingCapabilities(e,t){let A;try{let{stdout:r,stderr:i}=await X(e,t.args,{timeout:15e3,windowsHide:!0,killSignal:"SIGKILL",maxBuffer:8388608});A=`${r}
|
|
841
841
|
${i}`}catch{return[...t.mustContain]}return t.mustContain.filter(e=>!A.includes(e))}async installMultiFile(e){if(!e.files||0===e.files.length)throw Error(`installMultiFile called on dep ${e.binary} without files[]`);let t="models"===e.destination?(0,u.getLibiModelsDir)():(0,u.getLibiBinDir)(),A=i.default.join(t,e.binary);r.default.mkdirSync(A,{recursive:!0});let n=[];try{for(let t of e.files){let o=i.default.join(A,t.relPath);r.default.mkdirSync(i.default.dirname(o),{recursive:!0});let s=await (0,Q.downloadBufferWithStallGuard)(t.url,{label:`${e.binary}/${t.relPath}`,onRetry:({attempt:A,maxAttempts:r,delayMs:i,error:n,bytesDownloaded:o})=>{I.serverLogger.warn({url:t.url,binary:e.binary,relPath:t.relPath,attempt:A,maxAttempts:r,delayMs:i,bytesDownloaded:o,err:n.message},"Model-file download failed — retrying")}});r.default.writeFileSync(o,s),n.push(o),t.sha256&&await (0,Q.verifySha256)(o,t.sha256)}}catch(e){for(let e of n)try{r.default.unlinkSync(e)}catch{}throw e}this.writeInstallToken(e)}isMultiFileInstalled(e){if(!e.files)return!1;let t="models"===e.destination?(0,u.getLibiModelsDir)():(0,u.getLibiBinDir)(),A=i.default.join(t,e.binary);return e.files.every(e=>r.default.existsSync(i.default.join(A,e.relPath)))&&this.installTokenMatches(e)}async runCustomInstaller(t){if(!t.customInstallerId)return;let A=(0,c.getCustomInstaller)(t.customInstallerId);if(!A)throw Error(`Unknown customInstallerId: ${t.customInstallerId}`);let{command:r,args:i,timeoutMs:n}=A.install;if("__TRACKING_PYENV_INSTALL__"===r){let{runTrackingPyenvInstall:r}=await e.A(297261);await r();let i=await A.verify();if(!i)throw Error(`${t.binary} install command completed but verify() still returns null`);I.serverLogger.info({binary:t.binary,path:i,via:"tracking-pyenv"},"Custom installer succeeded");return}if("__YT_DLP_UV_INSTALL__"===r){await this.installYtDlpViaUv(t,n);let e=await A.verify();if(!e)throw Error(`${t.binary} install command completed but verify() still returns null`);I.serverLogger.info({binary:t.binary,path:e,via:"uv"},"Custom installer succeeded");return}let o=i.map(e=>"__PLAYWRIGHT_CORE_CLI__"===e?(0,c.resolvePlaywrightCoreCli)():e),s=r===c.NODE_COMMAND_SENTINEL?(0,h.resolveNodeCommand)():r;I.serverLogger.info({binary:t.binary,command:s,args:o},"Running custom installer"),await X(s,o,{timeout:n??6e4,windowsHide:!0,maxBuffer:0x2000000});let a=await A.verify();if(!a)throw Error(`${t.binary} install command completed but verify() still returns null`);I.serverLogger.info({binary:t.binary,path:a},"Custom installer succeeded")}async installYtDlpViaUv(e,t){let A=this.getBinaryPath("uv");if(!r.default.existsSync(A))try{let{stdout:e}=await X((0,d.isWindows)()?"where":"which",["uv"],{timeout:5e3,windowsHide:!0});if(!(A=e.split("\n")[0]?.trim())||!r.default.existsSync(A))throw Error("uv not on PATH")}catch{throw Error(`Cannot install yt-dlp via uv: uv not found in ${this.getBinaryPath("uv")} or on PATH. Expected uv to be installed earlier (tier-1 dep on the youtube-downloader def).`)}I.serverLogger.info({binary:e.binary,uvBinary:A},"Installing yt-dlp via uv tool install"),await X(A,["tool","install","yt-dlp","--reinstall","--python","3.12","--with","certifi"],{timeout:t??3e5,windowsHide:!0,maxBuffer:0x2000000,env:(0,E.buildUvEnv)()});let{stdout:n}=await X(A,["tool","dir"],{timeout:1e4,windowsHide:!0,env:(0,E.buildUvEnv)({NO_COLOR:"1"})}),o=n.replace(/\[[0-9;]*m/g,"").trim(),s=(0,d.isWindows)()?"Scripts":"bin",a=i.default.join(o,"yt-dlp",s,`yt-dlp${(0,d.exeSuffix)()}`);if(!r.default.existsSync(a))throw Error(`uv tool install completed but expected entry point not found: ${a}`);let l=i.default.join(o,"yt-dlp",s,(0,d.isWindows)()?"python.exe":"python3"),g="";try{let{stdout:e}=await X(l,["-m","certifi"],{timeout:1e4,windowsHide:!0,env:{...process.env,NO_COLOR:"1"}});g=e.replace(/\[[0-9;]*m/g,"").trim(),r.default.existsSync(g)||(g="")}catch{}let h=i.default.join((0,u.getLibiBinDir)(),"yt-dlp");try{r.default.unlinkSync(h)}catch(e){if("ENOENT"!==e.code)throw e}if((0,d.isWindows)()){let t=h+".cmd";try{r.default.unlinkSync(t)}catch(e){if("ENOENT"!==e.code)throw e}let A=g?`set SSL_CERT_FILE=${g}\r
|
|
842
842
|
set REQUESTS_CA_BUNDLE=${g}\r
|
|
@@ -855,5 +855,5 @@ ${t}for _a in "$@"; do case "$_a" in *playlist*) exec "${a}" "$@";; esac; done
|
|
|
855
855
|
exec "${a}" --no-playlist "$@"
|
|
856
856
|
`;r.default.writeFileSync(h,A,{mode:493}),I.serverLogger.info({binary:e.binary,ytDlpEntry:a,wrapperPath:h,hasCertifi:!!g},"Wrote yt-dlp wrapper into ~/.libi/bin with SSL_CERT_FILE from uv's certifi")}r.default.writeFileSync((0,c.ytDlpTokenPath)((0,u.getLibiBinDir)()),c.YT_DLP_UV_TOKEN,"utf-8")}binaryExistsOnPath(e){try{let A=(0,d.isWindows)()?"where":"which";return(0,t.execSync)(`${A} ${e}`,{stdio:"ignore",timeout:3e3,windowsHide:!0}),!0}catch{return!1}}getBinaryPath(e){let t=`${e}${(0,d.exeSuffix)()}`;return i.default.join((0,u.getLibiBinDir)(),t)}getInstallTokenPath(e){if(e.customInstallerId)return null;if(e.files){let t="models"===e.destination?(0,u.getLibiModelsDir)():(0,u.getLibiBinDir)();return i.default.join(t,e.binary,".install-token")}return`${this.getBinaryPath(e.binary)}.install-token`}readInstallToken(e){let t=this.getInstallTokenPath(e);if(!t)return null;try{return r.default.readFileSync(t,"utf-8").trim()}catch{return null}}writeInstallToken(e){if(!e.pinnedInstallToken)return;let t=this.getInstallTokenPath(e);if(t)try{r.default.mkdirSync(i.default.dirname(t),{recursive:!0}),r.default.writeFileSync(t,e.pinnedInstallToken,"utf-8")}catch(t){I.serverLogger.warn({binary:e.binary,err:t instanceof Error?t.message:String(t)},"Failed to write install-token marker — re-installs will retrigger until fixed")}}installTokenMatches(e){return!e.pinnedInstallToken||this.readInstallToken(e)===e.pinnedInstallToken}async downloadGroup(e,t,A){let o=t.map(e=>e.binary),s=o.join(", ");I.serverLogger.info({url:e,binaries:o},"Downloading dependency");let a=await (0,Q.downloadBufferWithStallGuard)(e,{label:s,onProgress:A?e=>A({status:"downloading",...e}):void 0,onRetry:({attempt:t,maxAttempts:r,delayMs:i,error:n,bytesDownloaded:s,bytesTotal:a})=>{I.serverLogger.warn({url:e,binaries:o,attempt:t,maxAttempts:r,delayMs:i,bytesDownloaded:s,err:n.message},"Dependency download failed — retrying");let l=n instanceof Q.DownloadStalledError?"stalled":"failed";A?.({status:"downloading",bytesDownloaded:0,bytesTotal:a,detail:`download ${l} — retrying (attempt ${t+1} of ${r})`})}});if(!t.some(e=>void 0!==e.archive)){if(1!==t.length)throw Error("Raw-binary URL shared across multiple deps");let e=t[0],A=this.getBinaryPath(e.binary);r.default.writeFileSync(A,a),await this.verifyBinaryIntegrity(e,A),(0,d.isWindows)()||r.default.chmodSync(A,493),this.writeInstallToken(e),I.serverLogger.info({binary:e.binary,path:A},"Dependency installed");return}A?.({status:"extracting"});let l=r.default.mkdtempSync(i.default.join(n.default.tmpdir(),"libi-dep-"));try{let A=this.archiveFilenameFor(e,t),n=i.default.join(l,A);for(let e of(r.default.writeFileSync(n,a),await this.extractArchive(n,l),t)){if(!e.archive)continue;let t=Z.resolveBinaryPathInArchive(e),A=(0,B.resolveGlob)(l,t);if(!A)throw Error(`Extracted file not found for ${e.binary}: ${t}`);let i=this.getBinaryPath(e.binary);r.default.copyFileSync(A,i),await this.verifyBinaryIntegrity(e,i),(0,d.isWindows)()||r.default.chmodSync(i,493),this.writeInstallToken(e),I.serverLogger.info({binary:e.binary,path:i},"Dependency installed")}}finally{try{r.default.rmSync(l,{recursive:!0,force:!0})}catch{}}}archiveFilenameFor(e,t){return"tar.xz"===(t[0].archive?.format??"zip")?"archive.tar.xz":"archive.zip"}async extractArchive(e,t){await X("tar",["-xf",e,"-C",t],{timeout:6e4,windowsHide:!0})}}}];
|
|
857
857
|
|
|
858
|
-
//# debugId=
|
|
858
|
+
//# debugId=f6c03646-79c3-3f61-6493-efe85d0b5569
|
|
859
859
|
//# sourceMappingURL=_0ms~zo_._.js.map
|