@github/copilot
Advanced tools
+6
-6
@@ -9,4 +9,4 @@ #!/usr/bin/env node | ||
| var Ze=Object.create;var Y=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var K=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var st=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of tt(t))!nt.call(e,s)&&s!==r&&Y(e,s,{get:()=>t[s],enumerable:!(o=et(t,s))||o.enumerable});return e};var ot=(e,t,r)=>(r=e!=null?Ze(rt(e)):{},st(t||!e||!e.__esModule?Y(r,"default",{value:e,enumerable:!0}):r,e));var ae=_((fr,ce)=>{"use strict";var ie=()=>process.platform==="linux",A=null,ht=()=>{if(!A)if(ie()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,A=process.report.getReport(),process.report.excludeNetwork=e}else A={};return A};ce.exports={isLinux:ie,getReport:ht}});var le=_((pr,ue)=>{"use strict";var I=K("fs"),yt="/usr/bin/ldd",bt="/proc/self/exe",R=2048,vt=e=>{let t=I.openSync(e,"r"),r=Buffer.alloc(R),o=I.readSync(t,r,0,R,0);return I.close(t,()=>{}),r.subarray(0,o)},St=e=>new Promise((t,r)=>{I.open(e,"r",(o,s)=>{if(o)r(o);else{let n=Buffer.alloc(R);I.read(s,n,0,R,0,(i,m)=>{t(n.subarray(0,m)),I.close(s,()=>{})})}})});ue.exports={LDD_PATH:yt,SELF_PATH:bt,readFileSync:vt,readFile:St}});var fe=_((mr,de)=>{"use strict";var wt=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),o=e.readUInt16LE(56);for(let s=0;s<o;s++){let n=t+s*r;if(e.readUInt32LE(n)===3){let m=e.readUInt32LE(n+8),P=e.readUInt32LE(n+32);return e.subarray(m,m+P).toString().replace(/\0.*$/g,"")}}return null};de.exports={interpreterPath:wt}});var Ce=_((gr,_e)=>{"use strict";var me=K("child_process"),{isLinux:T,getReport:ge}=ae(),{LDD_PATH:N,SELF_PATH:he,readFile:D,readFileSync:j}=le(),{interpreterPath:ye}=fe(),h,y,b,be="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",O="",ve=()=>O||new Promise(e=>{me.exec(be,(t,r)=>{O=t?" ":r,e(O)})}),Se=()=>{if(!O)try{O=me.execSync(be,{encoding:"utf8"})}catch{O=" "}return O},w="glibc",we=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,x="musl",Pt=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),Pe=()=>{let e=ge();return e.header&&e.header.glibcVersionRuntime?w:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Pt)?x:null},Ee=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(w)?w:r&&r.includes(x)?x:null},Oe=e=>{if(e){if(e.includes("/ld-musl-"))return x;if(e.includes("/ld-linux-"))return w}return null},xe=e=>(e=e.toString(),e.includes("musl")?x:e.includes("GNU C Library")?w:null),Et=async()=>{if(y!==void 0)return y;y=null;try{let e=await D(N);y=xe(e)}catch{}return y},Ot=()=>{if(y!==void 0)return y;y=null;try{let e=j(N);y=xe(e)}catch{}return y},xt=async()=>{if(h!==void 0)return h;h=null;try{let e=await D(he),t=ye(e);h=Oe(t)}catch{}return h},It=()=>{if(h!==void 0)return h;h=null;try{let e=j(he),t=ye(e);h=Oe(t)}catch{}return h},Ie=async()=>{let e=null;if(T()&&(e=await xt(),!e&&(e=await Et(),e||(e=Pe()),!e))){let t=await ve();e=Ee(t)}return e},Te=()=>{let e=null;if(T()&&(e=It(),!e&&(e=Ot(),e||(e=Pe()),!e))){let t=Se();e=Ee(t)}return e},Tt=async()=>T()&&await Ie()!==w,Lt=()=>T()&&Te()!==w,Ft=async()=>{if(b!==void 0)return b;b=null;try{let t=(await D(N)).match(we);t&&(b=t[1])}catch{}return b},_t=()=>{if(b!==void 0)return b;b=null;try{let t=j(N).match(we);t&&(b=t[1])}catch{}return b},Le=()=>{let e=ge();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},pe=e=>e.trim().split(/\s+/)[1],Fe=e=>{let[t,r,o]=e.split(/[\r\n]+/);return t&&t.includes(w)?pe(t):r&&o&&r.includes(x)?pe(o):null},Ct=async()=>{let e=null;if(T()&&(e=await Ft(),e||(e=Le()),!e)){let t=await ve();e=Fe(t)}return e},At=()=>{let e=null;if(T()&&(e=_t(),e||(e=Le()),!e)){let t=Se();e=Fe(t)}return e};_e.exports={GLIBC:w,MUSL:x,family:Ie,familySync:Te,isNonGlibcLinux:Tt,isNonGlibcLinuxSync:Lt,version:Ct,versionSync:At}});import Dt from"node:module";import{spawn as jt}from"node:child_process";import{chmodSync as Me,copyFileSync as De,mkdirSync as Gt,readFileSync as je,realpathSync as Wt,rmSync as W,statSync as Bt,writeFileSync as Ge,writeSync as qt}from"node:fs";import{basename as V,dirname as Vt,join as a,resolve as Ye,sep as q}from"node:path";import{createInterface as Jt}from"node:readline";import*as Ke from"node:sea";import{fileURLToPath as Qe,pathToFileURL as B}from"node:url";var it=new Set;function Q(e,t){let r=Object.create(null);if(e)for(let[s,n]of Object.entries(e))r[s]=n;let o=t??it;return new Proxy(process.env,{get(s,n){if(typeof n=="string"){if(Object.hasOwn(r,n))return r[n];if(!o.has(n))return process.env[n]}},set(s,n,i){return r[n]=i,!0},has(s,n){return typeof n!="string"?!1:Object.hasOwn(r,n)?r[n]!==void 0:o.has(n)?!1:n in process.env},ownKeys(s){let n=new Set(Object.keys(process.env));for(let i of o)n.delete(i);for(let i of Object.keys(r))r[i]!==void 0?n.add(i):n.delete(i);return[...n]},getOwnPropertyDescriptor(s,n){if(typeof n!="string")return;let i;if(Object.hasOwn(r,n))i=r[n];else{if(o.has(n))return;i=process.env[n]}if(i!==void 0)return{value:i,writable:!0,enumerable:!0,configurable:!0}},deleteProperty(s,n){return r[n]=void 0,!0}})}var ct=new Set(["--server","--headless","--acp"]);function at(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function ut(e){return e.some(t=>ct.has(t)||at(t))}function z(e){return ut(e)}import{readdir as lt,access as dt,constants as ft}from"node:fs/promises";import{join as d,basename as X}from"node:path";import{homedir as C}from"node:os";function ee(){return process.env.XDG_CACHE_HOME||d(C(),".cache")}function te(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function re(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function pt(){if(process.platform==="darwin")return d(C(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||d(C(),".cache");return d(e,"copilot")}return d(ee(),"copilot")}function ne(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(d(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(d(pt(),"pkg")),e.push(d(ee(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(d(process.env.COPILOT_HOME,"pkg")),e.push(d(C(),".copilot","pkg")),[...new Set(e)]}function Z(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(t)return[Number(t[1]),Number(t[2]),Number(t[3])]}function mt(e,t){let r=Z(e),o=Z(t);if(!r&&!o)return 0;if(!r)return-1;if(!o)return 1;for(let i=0;i<3;i++)if(r[i]!==o[i])return r[i]-o[i];let s=e.includes("-"),n=t.includes("-");return s!==n?s?-1:1:e.localeCompare(t)}async function se(e,...t){let r=[];for(let o of t){let s;try{s=await lt(o)}catch{continue}for(let n of s){let i=d(o,n);try{await dt(d(i,e),ft.R_OK),r.push(i)}catch{continue}}}return r.sort((o,s)=>{let n=mt(X(s),X(o));return n!==0?n:o.localeCompare(s)}),r}import $e from"node:path";import{fileURLToPath as kt}from"node:url";function gt(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let t=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),r=e.substring(0,t).trim();return r?`${r} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function oe(e){let t;if(e instanceof Error)t=String(e);else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else t=String(e);return gt(t)}import{existsSync as Re}from"node:fs";import{createRequire as Rt}from"node:module";import{join as Ne,resolve as Nt}from"node:path";import{fileURLToPath as Ht}from"node:url";var H=ot(Ce(),1);function G(e={}){return(e.platform??process.platform)!=="linux"?"gnu":(e.detectLibcFamily??H.familySync)()===H.MUSL?"musl":"gnu"}function Ae(e=process.platform,t){let r=t??(e==="linux"?G():"gnu");return e==="linux"&&r==="musl"?"linuxmusl":e}function Ut(){return`${Ae()}-${process.arch}`}function $t(){let{platform:e,arch:t}=process;switch(e){case"win32":return`win32-${t}-msvc`;case"darwin":return`darwin-${t}`;case"linux":return`linux-${t}-${G()}`;default:throw new Error(`Unsupported platform: ${e}/${t}`)}}function Ue(e,t){let r=Ut(),o=`${e}.node`,s=`${e}.${$t()}.node`;for(let n of t){let i=Nt(n),m=Ne(i,"prebuilds",r,o);if(Re(m))return He(m);let P=Ne(i,s);if(Re(P))return He(P)}throw new Error(`Native addon "${e}" not found for ${r}.`)}function He(e){return Rt(Ht(import.meta.url))(e)}var L;function ke(){if(process.platform==="win32"){if(L){if(L.kind==="ok")return L.addon;throw L.error}try{let e=Mt();return L={kind:"ok",addon:e},e}catch(e){let t=e instanceof Error?e:new Error(`Failed to load Win32 native addon: ${oe(e)}`);throw L={kind:"error",error:t},t}}}function Mt(){let e=$e.dirname(kt(import.meta.url));return Ue("win32-native",[e,$e.resolve(e,"..","native","win32")])}try{Dt.enableCompileCache?.()}catch{}var Yt=75;function We(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}if(process.stdout.isTTY)try{qt(1,"\x1B[<u\x1B[?1049h\x1B[?1049l\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?2004l\x1B[?1004l\x1B[?25h\x1B[?2026l"+(process.env.TERM!=="dumb"?"\x1B[23;2t":""))}catch{}}var ze=Vt(Qe(import.meta.url)),Be=Ke.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=ke();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var U=process.argv.find(e=>V(e).startsWith("conpty_console_list_agent")),qe=process.argv.find(e=>V(e)==="extension_bootstrap.mjs"),Ve=qe?Ye(qe):void 0,Je=Ve?.startsWith(Ye(ze,"preloads")+q)?Ve:void 0;if(U){let e=U.endsWith(".js")?U:U+".js";await import(B(e).href)}else if(Je)await import(B(Je).href);else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:t,body:r}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:t,body:r,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else if(process.env.COPILOT_RUN_APP==="1"||z(process.argv.slice(2))){let e=a(ze,"app.js"),t=re();if(Be&&(te()||t)){let r=ne().flatMap(s=>[a(s,"universal"),a(s,`${process.platform}-${process.arch}`)]),o=await se("app.js",...r);if(t){let s=o.find(n=>V(n)===t);s?e=a(s,"app.js"):process.stderr.write(`Warning: preferred version ${t} not found in package cache, using built-in version | ||
| `)}else o.length>0&&(e=a(o[0],"app.js"))}await import(B(e).href)}else{let t=function(){let c=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(c,"restart",`${e}.json`)},r=function(){let c=t();try{let u=je(c,"utf-8");return W(c,{force:!0}),JSON.parse(u)}catch{return}},o=function(){try{W(t(),{force:!0})}catch{}},s=function(){let c=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(c,"crash-context",`${e}.json`)},n=function(){try{let c=je(s(),"utf-8");return JSON.parse(c)}catch{return}},i=function(){try{W(s(),{force:!0})}catch{}},m=function(c,u){return new Promise(g=>{let f=Jt({input:process.stdin,output:process.stdout}),l=c.toString(16).toUpperCase();if(process.stdout.write(` | ||
| var Ze=Object.create;var J=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var K=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var st=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of tt(t))!nt.call(e,s)&&s!==r&&J(e,s,{get:()=>t[s],enumerable:!(o=et(t,s))||o.enumerable});return e};var ot=(e,t,r)=>(r=e!=null?Ze(rt(e)):{},st(t||!e||!e.__esModule?J(r,"default",{value:e,enumerable:!0}):r,e));var ae=_((fr,ce)=>{"use strict";var ie=()=>process.platform==="linux",A=null,ht=()=>{if(!A)if(ie()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,A=process.report.getReport(),process.report.excludeNetwork=e}else A={};return A};ce.exports={isLinux:ie,getReport:ht}});var le=_((pr,ue)=>{"use strict";var I=K("fs"),yt="/usr/bin/ldd",bt="/proc/self/exe",R=2048,vt=e=>{let t=I.openSync(e,"r"),r=Buffer.alloc(R),o=I.readSync(t,r,0,R,0);return I.close(t,()=>{}),r.subarray(0,o)},St=e=>new Promise((t,r)=>{I.open(e,"r",(o,s)=>{if(o)r(o);else{let n=Buffer.alloc(R);I.read(s,n,0,R,0,(i,m)=>{t(n.subarray(0,m)),I.close(s,()=>{})})}})});ue.exports={LDD_PATH:yt,SELF_PATH:bt,readFileSync:vt,readFile:St}});var fe=_((mr,de)=>{"use strict";var wt=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),o=e.readUInt16LE(56);for(let s=0;s<o;s++){let n=t+s*r;if(e.readUInt32LE(n)===3){let m=e.readUInt32LE(n+8),E=e.readUInt32LE(n+32);return e.subarray(m,m+E).toString().replace(/\0.*$/g,"")}}return null};de.exports={interpreterPath:wt}});var Ce=_((gr,_e)=>{"use strict";var me=K("child_process"),{isLinux:T,getReport:ge}=ae(),{LDD_PATH:N,SELF_PATH:he,readFile:D,readFileSync:j}=le(),{interpreterPath:ye}=fe(),h,y,b,be="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",P="",ve=()=>P||new Promise(e=>{me.exec(be,(t,r)=>{P=t?" ":r,e(P)})}),Se=()=>{if(!P)try{P=me.execSync(be,{encoding:"utf8"})}catch{P=" "}return P},w="glibc",we=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,x="musl",Et=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),Ee=()=>{let e=ge();return e.header&&e.header.glibcVersionRuntime?w:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Et)?x:null},Oe=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(w)?w:r&&r.includes(x)?x:null},Pe=e=>{if(e){if(e.includes("/ld-musl-"))return x;if(e.includes("/ld-linux-"))return w}return null},xe=e=>(e=e.toString(),e.includes("musl")?x:e.includes("GNU C Library")?w:null),Ot=async()=>{if(y!==void 0)return y;y=null;try{let e=await D(N);y=xe(e)}catch{}return y},Pt=()=>{if(y!==void 0)return y;y=null;try{let e=j(N);y=xe(e)}catch{}return y},xt=async()=>{if(h!==void 0)return h;h=null;try{let e=await D(he),t=ye(e);h=Pe(t)}catch{}return h},It=()=>{if(h!==void 0)return h;h=null;try{let e=j(he),t=ye(e);h=Pe(t)}catch{}return h},Ie=async()=>{let e=null;if(T()&&(e=await xt(),!e&&(e=await Ot(),e||(e=Ee()),!e))){let t=await ve();e=Oe(t)}return e},Te=()=>{let e=null;if(T()&&(e=It(),!e&&(e=Pt(),e||(e=Ee()),!e))){let t=Se();e=Oe(t)}return e},Tt=async()=>T()&&await Ie()!==w,Lt=()=>T()&&Te()!==w,Ft=async()=>{if(b!==void 0)return b;b=null;try{let t=(await D(N)).match(we);t&&(b=t[1])}catch{}return b},_t=()=>{if(b!==void 0)return b;b=null;try{let t=j(N).match(we);t&&(b=t[1])}catch{}return b},Le=()=>{let e=ge();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},pe=e=>e.trim().split(/\s+/)[1],Fe=e=>{let[t,r,o]=e.split(/[\r\n]+/);return t&&t.includes(w)?pe(t):r&&o&&r.includes(x)?pe(o):null},Ct=async()=>{let e=null;if(T()&&(e=await Ft(),e||(e=Le()),!e)){let t=await ve();e=Fe(t)}return e},At=()=>{let e=null;if(T()&&(e=_t(),e||(e=Le()),!e)){let t=Se();e=Fe(t)}return e};_e.exports={GLIBC:w,MUSL:x,family:Ie,familySync:Te,isNonGlibcLinux:Tt,isNonGlibcLinuxSync:Lt,version:Ct,versionSync:At}});import Dt from"node:module";import{spawn as jt}from"node:child_process";import{chmodSync as Me,copyFileSync as De,mkdirSync as Gt,readFileSync as je,realpathSync as Wt,rmSync as W,statSync as Bt,writeFileSync as Ge,writeSync as qt}from"node:fs";import{basename as V,dirname as Vt,join as a,resolve as Je,sep as q}from"node:path";import{createInterface as Yt}from"node:readline";import*as Ke from"node:sea";import{fileURLToPath as ze,pathToFileURL as B}from"node:url";var it=new Set;function z(e,t){let r=Object.create(null);if(e)for(let[s,n]of Object.entries(e))r[s]=n;let o=t??it;return new Proxy(process.env,{get(s,n){if(typeof n=="string"){if(Object.hasOwn(r,n))return r[n];if(!o.has(n))return process.env[n]}},set(s,n,i){return r[n]=i,!0},has(s,n){return typeof n!="string"?!1:Object.hasOwn(r,n)?r[n]!==void 0:o.has(n)?!1:n in process.env},ownKeys(s){let n=new Set(Object.keys(process.env));for(let i of o)n.delete(i);for(let i of Object.keys(r))r[i]!==void 0?n.add(i):n.delete(i);return[...n]},getOwnPropertyDescriptor(s,n){if(typeof n!="string")return;let i;if(Object.hasOwn(r,n))i=r[n];else{if(o.has(n))return;i=process.env[n]}if(i!==void 0)return{value:i,writable:!0,enumerable:!0,configurable:!0}},deleteProperty(s,n){return r[n]=void 0,!0}})}var ct=new Set(["--server","--headless","--acp"]);function at(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function ut(e){return e.some(t=>ct.has(t)||at(t))}function Q(e){return ut(e)}import{readdir as lt,access as dt,constants as ft}from"node:fs/promises";import{join as d,basename as X}from"node:path";import{homedir as C}from"node:os";function ee(){return process.env.XDG_CACHE_HOME||d(C(),".cache")}function te(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function re(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function pt(){if(process.platform==="darwin")return d(C(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||d(C(),".cache");return d(e,"copilot")}return d(ee(),"copilot")}function ne(){let e=[];return process.env.COPILOT_CACHE_HOME&&e.push(d(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(d(pt(),"pkg")),e.push(d(ee(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(d(process.env.COPILOT_HOME,"pkg")),e.push(d(C(),".copilot","pkg")),[...new Set(e)]}function Z(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(t)return[Number(t[1]),Number(t[2]),Number(t[3])]}function mt(e,t){let r=Z(e),o=Z(t);if(!r&&!o)return 0;if(!r)return-1;if(!o)return 1;for(let i=0;i<3;i++)if(r[i]!==o[i])return r[i]-o[i];let s=e.includes("-"),n=t.includes("-");return s!==n?s?-1:1:e.localeCompare(t)}async function se(e,...t){let r=[];for(let o of t){let s;try{s=await lt(o)}catch{continue}for(let n of s){let i=d(o,n);try{await dt(d(i,e),ft.R_OK),r.push(i)}catch{continue}}}return r.sort((o,s)=>{let n=mt(X(s),X(o));return n!==0?n:o.localeCompare(s)}),r}import $e from"node:path";import{fileURLToPath as kt}from"node:url";function gt(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let t=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),r=e.substring(0,t).trim();return r?`${r} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function oe(e){let t;if(e instanceof Error)t=String(e);else if(typeof e=="object"&&e!==null)try{t=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else t=String(e);return gt(t)}import{existsSync as Re}from"node:fs";import{createRequire as Rt}from"node:module";import{join as Ne,resolve as Nt}from"node:path";import{fileURLToPath as Ht}from"node:url";var H=ot(Ce(),1);function G(e={}){return(e.platform??process.platform)!=="linux"?"gnu":(e.detectLibcFamily??H.familySync)()===H.MUSL?"musl":"gnu"}function Ae(e=process.platform,t){let r=t??(e==="linux"?G():"gnu");return e==="linux"&&r==="musl"?"linuxmusl":e}function Ut(){return`${Ae()}-${process.arch}`}function $t(){let{platform:e,arch:t}=process;switch(e){case"win32":return`win32-${t}-msvc`;case"darwin":return`darwin-${t}`;case"linux":return`linux-${t}-${G()}`;default:throw new Error(`Unsupported platform: ${e}/${t}`)}}function Ue(e,t){let r=Ut(),o=`${e}.node`,s=`${e}.${$t()}.node`;for(let n of t){let i=Nt(n),m=Ne(i,"prebuilds",r,o);if(Re(m))return He(m);let E=Ne(i,s);if(Re(E))return He(E)}throw new Error(`Native addon "${e}" not found for ${r}.`)}function He(e){return Rt(Ht(import.meta.url))(e)}var L;function ke(){if(process.platform==="win32"){if(L){if(L.kind==="ok")return L.addon;throw L.error}try{let e=Mt();return L={kind:"ok",addon:e},e}catch(e){let t=e instanceof Error?e:new Error(`Failed to load Win32 native addon: ${oe(e)}`);throw L={kind:"error",error:t},t}}}function Mt(){let e=$e.dirname(kt(import.meta.url));return Ue("win32-native",[e,$e.resolve(e,"..","native","win32")])}try{Dt.enableCompileCache?.()}catch{}var Jt=75;function We(){if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}if(process.stdout.isTTY)try{qt(1,"\x1B[<u\x1B[?1049h\x1B[?1049l\x1B[?1006l\x1B[?1003l\x1B[?1002l\x1B[?2004l\x1B[?1004l\x1B[?25h\x1B[?2026l"+(process.env.TERM!=="dumb"?"\x1B[23;2t":""))}catch{}}var Qe=Vt(ze(import.meta.url)),Be=Ke.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=ke();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var U=process.argv.find(e=>V(e).startsWith("conpty_console_list_agent")),qe=process.argv.find(e=>V(e)==="extension_bootstrap.mjs"),Ve=qe?Je(qe):void 0,Ye=Ve?.startsWith(Je(Qe,"preloads")+q)?Ve:void 0;if(U){let e=U.endsWith(".js")?U:U+".js";await import(B(e).href)}else if(Ye)await import(B(Ye).href);else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:t,body:r}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:t,body:r,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else if(process.env.COPILOT_RUN_APP==="1"||Q(process.argv.slice(2))){let e=a(Qe,"app.js"),t=re();if(Be&&(te()||t)){let r=ne().flatMap(s=>[a(s,"universal"),a(s,`${process.platform}-${process.arch}`)]),o=await se("app.js",...r);if(t){let s=o.find(n=>V(n)===t);s?e=a(s,"app.js"):process.stderr.write(`Warning: preferred version ${t} not found in package cache, using built-in version | ||
| `)}else o.length>0&&(e=a(o[0],"app.js"))}await import(B(e).href)}else{let t=function(){let c=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(c,"restart",`${e}.json`)},r=function(){let c=t();try{let u=je(c,"utf-8");return W(c,{force:!0}),JSON.parse(u)}catch{return}},o=function(){try{W(t(),{force:!0})}catch{}},s=function(){let c=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot");return a(c,"crash-context",`${e}.json`)},n=function(){try{let c=je(s(),"utf-8");return JSON.parse(c)}catch{return}},i=function(){try{W(s(),{force:!0})}catch{}},m=function(c,u){return new Promise(g=>{let f=Yt({input:process.stdin,output:process.stdout}),l=c.toString(16).toUpperCase();if(process.stdout.write(` | ||
| *** Copilot exited unexpectedly (exit code ${c} = 0x${l}) *** | ||
@@ -19,5 +19,5 @@ `),u){let v=u.length>200?u.slice(0,200)+"\u2026":u;process.stdout.write(`Error: ${v} | ||
| `),f.question("Save crash report? [y/N] ",v=>{f.close(),g(v.trim().toLowerCase()==="y")})})},P=function(c,u){try{let g=Wt(c);return g.startsWith(u+q)?Bt(g).isFile():!1}catch{return!1}},F=function(c,u){let g=Be?c:[...process.execArgv,Qe(import.meta.url),...c],f=jt(process.execPath,g,{stdio:"inherit",cwd:u,env:Q({COPILOT_RUN_APP:"1",COPILOT_LOADER_PID:e})});process.env.COPILOT_LOADER_DEBUG&&process.stderr.write(`[loader] spawned app child: pid=${f.pid} (loader pid=${e}) | ||
| `),f.question("Save crash report? [y/N] ",v=>{f.close(),g(v.trim().toLowerCase()==="y")})})},E=function(c,u){try{let g=Wt(c);return g.startsWith(u+q)?Bt(g).isFile():!1}catch{return!1}},F=function(c,u){let g=Be?c:[...process.execArgv,ze(import.meta.url),...c],f=jt(process.execPath,g,{stdio:"inherit",cwd:u,env:z({COPILOT_RUN_APP:"1",COPILOT_LOADER_PID:e})});process.env.COPILOT_LOADER_DEBUG&&process.stderr.write(`[loader] spawned app child: pid=${f.pid} (loader pid=${e}) | ||
| `);let l=p=>{try{f.kill(p)}catch{}},v=()=>l("SIGINT"),S=()=>l("SIGTERM"),$=()=>l("SIGHUP"),k=()=>l("SIGQUIT");process.on("SIGINT",v),process.on("SIGTERM",S),process.on("SIGHUP",$),process.on("SIGQUIT",k),f.on("error",p=>{process.off("SIGINT",v),process.off("SIGTERM",S),process.off("SIGHUP",$),process.off("SIGQUIT",k),o(),process.stderr.write(`Failed to start: ${p.message} | ||
| `),process.exit(1)}),f.on("exit",(p,J)=>{if(process.off("SIGINT",v),process.off("SIGTERM",S),process.off("SIGHUP",$),process.off("SIGQUIT",k),p===Yt){let E=r();if(E){let M=[...E.argv,"--resume",E.sessionId];F(M,E.cwd||u)}else F(c,u);return}if(o(),J)i(),We(),process.kill(process.pid,J);else if(p!==0){We();let E=n();E&&process.stdin.isTTY?m(p??1,E.lastError).then(async M=>{M&&await Xe(E,p??1),i(),process.exit(p??1)}).catch(()=>{i(),process.exit(p??1)}):(i(),process.exit(p??1))}else i(),process.exit(0)})};Kt=t,Qt=r,zt=o,Xt=s,Zt=n,er=i,tr=m,rr=P,nr=F;let e=String(process.pid);async function Xe(c,u){try{let g=new Date().toISOString().replace(/[:.]/g,"-"),f=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot"),l=a(f,"crash-reports",`crash-${c.sessionId}-${g}`);Gt(l,{recursive:!0,mode:448}),Ge(a(l,"crash-context.json"),JSON.stringify(c,null,2),{mode:384});let v=["# Crash Report","",`**Exit code**: ${u}`,c.errorType?`**Error type**: ${c.errorType}`:"",c.lastError?`**Error**: ${c.lastError}`:"",`**Timestamp**: ${new Date().toISOString()}`,`**Session ID**: ${c.sessionId}`,`**Working directory**: ${c.cwd}`,c.stackTrace?` | ||
| `),process.exit(1)}),f.on("exit",(p,Y)=>{if(process.off("SIGINT",v),process.off("SIGTERM",S),process.off("SIGHUP",$),process.off("SIGQUIT",k),p===Jt){let O=r();if(O){let M=[...O.argv,"--session-id",O.sessionId];F(M,O.cwd||u)}else F(c,u);return}if(o(),Y)i(),We(),process.kill(process.pid,Y);else if(p!==0){We();let O=n();O&&process.stdin.isTTY?m(p??1,O.lastError).then(async M=>{M&&await Xe(O,p??1),i(),process.exit(p??1)}).catch(()=>{i(),process.exit(p??1)}):(i(),process.exit(p??1))}else i(),process.exit(0)})};Kt=t,zt=r,Qt=o,Xt=s,Zt=n,er=i,tr=m,rr=E,nr=F;let e=String(process.pid);async function Xe(c,u){try{let g=new Date().toISOString().replace(/[:.]/g,"-"),f=process.env.COPILOT_HOME||a(process.env.HOME||process.env.USERPROFILE||"",".copilot"),l=a(f,"crash-reports",`crash-${c.sessionId}-${g}`);Gt(l,{recursive:!0,mode:448}),Ge(a(l,"crash-context.json"),JSON.stringify(c,null,2),{mode:384});let v=["# Crash Report","",`**Exit code**: ${u}`,c.errorType?`**Error type**: ${c.errorType}`:"",c.lastError?`**Error**: ${c.lastError}`:"",`**Timestamp**: ${new Date().toISOString()}`,`**Session ID**: ${c.sessionId}`,`**Working directory**: ${c.cwd}`,c.stackTrace?` | ||
| ## Stack Trace | ||
@@ -28,5 +28,5 @@ | ||
| \`\`\``:"",""].filter(Boolean).join(` | ||
| `);if(Ge(a(l,"feedback.md"),v,{mode:384}),c.sessionFilePath&&P(c.sessionFilePath,f))try{let S=a(l,"events.jsonl");De(c.sessionFilePath,S),Me(S,384)}catch{}if(c.logFilePath&&P(c.logFilePath,f))try{let S=a(l,"process.log");De(c.logFilePath,S),Me(S,384)}catch{}process.stdout.write(` | ||
| `);if(Ge(a(l,"feedback.md"),v,{mode:384}),c.sessionFilePath&&E(c.sessionFilePath,f))try{let S=a(l,"events.jsonl");De(c.sessionFilePath,S),Me(S,384)}catch{}if(c.logFilePath&&E(c.logFilePath,f))try{let S=a(l,"process.log");De(c.logFilePath,S),Me(S,384)}catch{}process.stdout.write(` | ||
| Crash report saved to: ${l}${q} | ||
| `)}catch(g){process.stderr.write(`Failed to create crash report: ${String(g)} | ||
| `)}}F(process.argv.slice(2),process.cwd())}var Kt,Qt,zt,Xt,Zt,er,tr,rr,nr; | ||
| `)}}F(process.argv.slice(2),process.cwd())}var Kt,zt,Qt,Xt,Zt,er,tr,rr,nr; |
+10
-10
| { | ||
| "name": "@github/copilot", | ||
| "description": "GitHub Copilot CLI brings the power of Copilot coding agent directly to your terminal.", | ||
| "version": "1.0.51", | ||
| "version": "1.0.52-0", | ||
| "license": "SEE LICENSE IN LICENSE.md", | ||
@@ -73,14 +73,14 @@ "type": "module", | ||
| "buildMetadata": { | ||
| "gitCommit": "fec395b" | ||
| "gitCommit": "4301841" | ||
| }, | ||
| "optionalDependencies": { | ||
| "@github/copilot-linux-x64": "1.0.51", | ||
| "@github/copilot-linux-arm64": "1.0.51", | ||
| "@github/copilot-linuxmusl-x64": "1.0.51", | ||
| "@github/copilot-linuxmusl-arm64": "1.0.51", | ||
| "@github/copilot-darwin-x64": "1.0.51", | ||
| "@github/copilot-darwin-arm64": "1.0.51", | ||
| "@github/copilot-win32-x64": "1.0.51", | ||
| "@github/copilot-win32-arm64": "1.0.51" | ||
| "@github/copilot-linux-x64": "1.0.52-0", | ||
| "@github/copilot-linux-arm64": "1.0.52-0", | ||
| "@github/copilot-linuxmusl-x64": "1.0.52-0", | ||
| "@github/copilot-linuxmusl-arm64": "1.0.52-0", | ||
| "@github/copilot-darwin-x64": "1.0.52-0", | ||
| "@github/copilot-darwin-arm64": "1.0.52-0", | ||
| "@github/copilot-win32-x64": "1.0.52-0", | ||
| "@github/copilot-win32-arm64": "1.0.52-0" | ||
| } | ||
| } |
@@ -59,2 +59,2 @@ | ||
| const __dirname = __path.dirname(__filename); | ||
| var j=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});import{parentPort as v,workerData as re}from"node:worker_threads";var a=class extends Error{constructor(n,t,o){super(n,o);this.code=t;this.name="VoiceBackendError"}},V=16;function S(s){return E(s,new WeakSet,0)}function E(s,e,n){if(n>=V)return{name:"Error",message:"<cause chain truncated>"};if(typeof s=="object"&&s!==null){if(e.has(s))return{name:"Error",message:"<cyclic cause>"};e.add(s)}let t;if(s instanceof a)t={name:s.name,message:s.message,stack:s.stack,code:s.code};else if(s instanceof Error)t={name:s.name,message:s.message,stack:s.stack};else return{name:"Error",message:String(s)};return s instanceof Error&&s.cause!==void 0&&(t.cause=E(s.cause,e,n+1)),t}function L(s){return s instanceof Error?s:new Error(String(s))}function k(s,e){s.on("message",n=>{if(n==null||typeof n!="object")return;let t=n;t.kind==="request"&&W(s,e,t).catch(()=>{})})}async function W(s,e,n){try{let t=n.method,o=n.params,i=await e.call(t,o),r={kind:"response",id:n.id,ok:!0,result:i};s.postMessage(r)}catch(t){let o={kind:"response",id:n.id,ok:!1,error:S(t)};s.postMessage(o)}}var p=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;writePromise=this.initialQueueResolvers.promise;setLogWriter(e){this.logWriter=e;for(let n of this.initialQueue)this.writePromise=this.logWriter.writeLog(n.method,n.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){await this.writePromise}async dispose(){await this.flush()}outputPath(){return this.logWriter?.outputPath()}logToLevel(e,n){this.logWriter?this.writePromise=this.logWriter.writeLog(e,n):this.initialQueue.push({method:e,message:n})}info(e){this.logToLevel("info",e)}debug(e){this.logToLevel("debug",e)}warning(e){this.logToLevel("warning",e)}error(e){this.logToLevel("error",e instanceof Error?e.message:e)}log(e){this.error(e)}isDebug(){return!1}shouldLog(e){return!0}notice(e){this.info(e instanceof Error?e.message:e)}startGroup(e,n){this.info(`--- Start of group: ${e} ---`)}endGroup(e){this.info("--- End of group ---")}},P=new p;var f=16*1024,m=class{constructor(e){this.port=e}writeLog(e,n){let t={kind:"log",level:e,message:H(n)};try{this.port.postMessage(t)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function I(s,e=P){e.setLogWriter(new m(s))}function H(s){return s.length<=f?s:`${s.slice(0,f)}\u2026 [truncated, ${s.length-f} more chars]`}import*as D from"node:fs/promises";import*as G from"node:os";import*as C from"node:path";function $(s){if(s.includes("<!DOCTYPE")||s.includes("<html")){let e=Math.min(s.indexOf("<!DOCTYPE")!==-1?s.indexOf("<!DOCTYPE"):1/0,s.indexOf("<html")!==-1?s.indexOf("<html"):1/0),n=s.substring(0,e).trim();return n?`${n} [HTML error page omitted]`:"[HTML error page omitted]"}return s}function b(s){let e;if(s instanceof Error)e=String(s);else if(typeof s=="object"&&s!==null)try{e=JSON.stringify(s)??"[object]"}catch{return"[object with circular reference]"}else e=String(s);return $(e)}var u=class{listeners=new Map;on(e,n){let t=this.listeners.get(e);t||(t=new Set,this.listeners.set(e,t));let o=n,i=t;return i.add(o),()=>{i.delete(o)}}emit(e,n){let t=this.listeners.get(e);if(!t)return;let o=[...t];for(let i of o)try{i(n)}catch{}}clear(){this.listeners.clear()}};var z={listModels:!0,downloadModel:!0,deleteModel:!0,loadModel:!0,openSession:!0,appendSession:!0,stopSession:!0,cancelSession:!0,shutdown:!0},me=Object.keys(z),T="automatic-speech-recognition",Y={modelDownloadProgress:!0,sessionPreview:!0},we=Object.keys(Y);import*as A from"node:fs/promises";import{open as q}from"node:fs/promises";var x=16e3,w=1,y=16,R=44,g=class{constructor(e){this.path=e}handle;dataSize=0;writeTail=Promise.resolve();async open(){this.handle=await q(this.path,"w"),await this.handle.write(F(0))}append(e){let n=this.writeTail.then(async()=>{if(!this.handle)throw new Error("WavStreamWriter not opened");await this.handle.write(e),this.dataSize+=e.byteLength});return this.writeTail=n.catch(()=>{}),n}async finalize(){if(!this.handle||(await this.writeTail,!this.handle))return;let e=this.handle;this.handle=void 0;try{await e.write(F(this.dataSize),0,R,0)}finally{await e.close()}}async discard(){this.handle&&(await this.handle.close().catch(()=>{}),this.handle=void 0),await A.unlink(this.path).catch(()=>{})}};function F(s){let e=x*w*y/8,n=w*y/8,t=Buffer.alloc(R);return t.write("RIFF",0,"ascii"),t.writeUInt32LE(36+s,4),t.write("WAVE",8,"ascii"),t.write("fmt ",12,"ascii"),t.writeUInt32LE(16,16),t.writeUInt16LE(1,20),t.writeUInt16LE(w,22),t.writeUInt32LE(x,24),t.writeUInt32LE(e,28),t.writeUInt16LE(n,32),t.writeUInt16LE(y,34),t.write("data",36,"ascii"),t.writeUInt32LE(s,40),t}var Q="github-copilot-cli",J={AzureCatalogFilter:"'',test"},K=1e4,X=2e3,Z="voice-foundry-batch-";function ee(s){switch(s.tag){case"opening":return;case"active":case"stopping":case"cancelling":return s.session;default:return s}}var h=class{managerPromise;state={tag:"unloaded"};lastModelGeneration=0;downloads=new Map;shutdownPromise;events=new u;foundryAdditionalSettings;nativeLocation;tempDir;managerFactory;handlers={listModels:()=>this.handleListModels(),downloadModel:e=>this.handleDownloadModel(e),deleteModel:e=>this.handleDeleteModel(e),loadModel:e=>this.handleLoadModel(e),openSession:e=>this.handleOpenSession(e),appendSession:e=>this.handleAppendSession(e),stopSession:e=>this.handleStopSession(e),cancelSession:e=>this.handleCancelSession(e),shutdown:()=>this.handleShutdown()};constructor(e={}){this.foundryAdditionalSettings=e.foundryAdditionalSettings??J,this.nativeLocation=e.nativeLocation,this.tempDir=e.tempDir??G.tmpdir(),this.managerFactory=e.managerFactory}call(e,n,t){if(this.shutdownPromise&&e!=="shutdown")return Promise.reject(this.disposedError());let o=this.handlers[e];return o(n)}on(e,n){return this.events.on(e,n)}onFatalError(e){return()=>{}}shutdown(e){return this.handleShutdown()}async handleListModels(){return O(async()=>{let n=await(await this.getManager()).catalog.getModels(),t=[];for(let o of n)for(let i of o.variants)se(i)&&t.push(await ie(i));return t})}async handleDownloadModel(e){let{variantId:n,downloadId:t}=e,o=this.downloads.get(n);if(o){if(o.downloadId===t)return o.promise;throw new a(`A different download for '${n}' is in flight.`,"io")}let i=(async()=>{await(await this.getVariant(n)).download(d=>{this.events.emit("modelDownloadProgress",{downloadId:t,variantId:n,percent:d})})})(),r={downloadId:t,promise:i};this.downloads.set(n,r);try{await i}finally{this.downloads.get(n)===r&&this.downloads.delete(n)}}async handleDeleteModel(e){let{variantId:n}=e;if(this.downloads.has(n))throw new a(`Cannot delete '${n}' while a download is in flight.`,"io");let t=this.state;switch(t.tag){case"unloaded":break;case"loading":t.selection.variantId===n&&await this.unloadSelected();break;case"ready":if(t.selection.variantId===n){if(t.session!==void 0)throw new a(`Cannot delete '${n}' while a session is active.`,"session-active");await this.unloadSelected()}break;default:}(await this.getVariant(n)).removeFromCache()}async handleLoadModel(e){let{variantId:n}=e;if(this.shutdownPromise)throw this.disposedError();let t=this.state;switch(t.tag){case"unloaded":return this.startLoad(n,void 0);case"loading":if(t.selection.variantId===n){let o=await t.selection.loadedModel;return o.modelGeneration=this.bumpModelGeneration(),{modelGeneration:o.modelGeneration}}return this.startLoad(n,t.selection);case"ready":if(t.session!==void 0&&t.selection.variantId!==n)throw new a(`Cannot load '${n}' while a session is active.`,"session-active");return t.selection.variantId===n?(t.selection.loaded.modelGeneration=this.bumpModelGeneration(),{modelGeneration:t.selection.loaded.modelGeneration}):this.startLoad(n,t.selection);default:return t}}async startLoad(e,n){let t=this.loadVariant(e,n),o={variantId:e,loadedModel:t,previous:n};return this.state={tag:"loading",selection:o},t.then(r=>{this.state.tag==="loading"&&this.state.selection===o&&(this.state={tag:"ready",selection:{variantId:e,loadedModel:t,loaded:r}})},()=>{this.state.tag==="loading"&&this.state.selection===o&&(this.state={tag:"unloaded"})}),{modelGeneration:(await t).modelGeneration}}async loadVariant(e,n){if(n){let o=await n.loadedModel.catch(()=>{});o&&await o.variant.unload().catch(()=>{})}if(this.shutdownPromise)throw this.disposedError();let t=await this.getVariant(e);if(!t.isCached)throw new a(`Voice model '${e}' is not downloaded.`,"model-not-downloaded");if(await t.load(),this.shutdownPromise)throw await t.unload().catch(()=>{}),this.disposedError();return{variant:t,isStreaming:ne(t.alias),modelGeneration:this.bumpModelGeneration()}}bumpModelGeneration(){return this.lastModelGeneration=this.lastModelGeneration+1,this.lastModelGeneration}async unloadSelected(){if(this.state.tag==="unloaded")return;let e=this.state.selection;this.state={tag:"unloaded"};let n=await e.loadedModel.catch(()=>{});n&&await n.variant.unload().catch(()=>{})}async handleOpenSession(e){let n=this.state;switch(n.tag){case"unloaded":throw new a("Loaded model has changed since this session was prepared.","stale-model");case"loading":return await n.selection.loadedModel.catch(()=>{}),this.handleOpenSession(e);case"ready":{let t=n,{sessionId:o,modelGeneration:i}=e;if(t.session!==void 0)throw new a("A voice session is already active.","session-active");if(t.selection.loaded.modelGeneration!==i)throw new a("Loaded model has changed since this session was prepared.","stale-model");let r=t.selection.loaded,c=(async()=>{try{let d=r.isStreaming?await this.openStreamingSession(r,o):await this.openBatchSession(o),l=t.session;this.state===t&&l?.tag==="opening"&&l.sessionId===o?t.session={tag:"active",session:d}:await this.teardownSession(d).catch(()=>{})}catch(d){let l=t.session;throw this.state===t&&l?.tag==="opening"&&l.sessionId===o&&(t.session=void 0),d}})();t.session={tag:"opening",sessionId:o,opening:c},await c;return}default:return n}}async handleAppendSession(e){let n=this.state;switch(n.tag){case"unloaded":case"loading":return;case"ready":{let t=n.session;if(t===void 0)return;switch(t.tag){case"opening":case"stopping":case"cancelling":return;case"active":{if(t.session.sessionId!==e.sessionId)return;let o=t.session;if(o.kind==="streaming"){await o.foundrySdkSession.append(e.pcm);return}await o.wav.append(e.pcm);return}default:return t}}default:return n}}async handleStopSession(e){let n=()=>{throw new a(`No session '${e.sessionId}'.`,"session-not-found")},t=this.state;switch(t.tag){case"unloaded":case"loading":return n();case"ready":{let o=t,i=o.session;if(i===void 0)return n();switch(i.tag){case"opening":case"stopping":case"cancelling":return n();case"active":{if(i.session.sessionId!==e.sessionId)return n();let r=i.session,c=r.error;if(c)throw o.session=void 0,await this.teardownSession(r).catch(()=>{}),c;o.session={tag:"stopping",session:r};try{return{text:r.kind==="streaming"?await this.stopStreaming(r):await this.stopBatch(r)}}catch(d){throw r.error?r.error:d}finally{let d=o.session;this.state===o&&d?.tag==="stopping"&&d.session===r&&(o.session=void 0),await this.teardownSession(r).catch(()=>{})}}default:return i}}default:return t}}async handleCancelSession(e){let n=this.state;switch(n.tag){case"unloaded":case"loading":return;case"ready":{let t=n,o=t.session;if(o===void 0)return;switch(o.tag){case"opening":case"cancelling":return;case"active":{if(o.session.sessionId!==e.sessionId)return;let i=o.session;t.session={tag:"cancelling",session:i};try{await this.teardownSession(i)}finally{let r=t.session;this.state===t&&r?.tag==="cancelling"&&r.session===i&&(t.session=void 0)}return}case"stopping":{if(o.session.sessionId!==e.sessionId)return;let i=o.session;i.error=i.error??new a("Session cancelled.","cancelled"),t.session={tag:"cancelling",session:i},await this.teardownSession(i).catch(()=>{});return}default:return o}}default:return n}}async openStreamingSession(e,n){let t=e.variant.createAudioClient().createLiveTranscriptionSession();try{await t.start()}catch(i){throw await this.disposeSdk(t),i}let o={kind:"streaming",sessionId:n,foundrySdkSession:t,committed:"",tail:"",drainTask:Promise.resolve("")};return o.drainTask=this.runStreamingDrain(o),o.drainTask.catch(()=>{}),o}async openBatchSession(e){let n=new g(C.join(this.tempDir,`${Z}${e}.wav`));try{await n.open()}catch(t){throw await n.discard(),t}return{kind:"batch",sessionId:e,wav:n}}async runStreamingDrain(e){try{for await(let n of e.foundrySdkSession.getStream()){if(this.isCancellingSession(e))break;let t=te(n);t&&(n.is_final?(e.committed+=t,e.tail=""):e.tail+=t,this.events.emit("sessionPreview",{sessionId:e.sessionId,text:e.committed+e.tail}))}return e.committed+e.tail}catch(n){let t=L(n);throw e.error=t,t}}isCancellingSession(e){let n=this.state;switch(n.tag){case"unloaded":case"loading":return!1;case"ready":{let t=n.session;if(t===void 0)return!1;switch(t.tag){case"opening":case"active":case"stopping":return!1;case"cancelling":return t.session===e;default:return t}}default:return n}}async stopStreaming(e){return _((async()=>(await e.foundrySdkSession.stop(),e.drainTask))(),K,"session-timeout","Streaming session drain timed out.")}async stopBatch(e){if(this.state.tag!=="ready")return"";let n=this.state.selection.loaded;await e.wav.finalize();try{return(await n.variant.createAudioClient().transcribe(e.wav.path)).text??""}finally{await D.unlink(e.wav.path).catch(()=>{})}}async teardownSession(e){e.kind==="streaming"?await this.disposeSdk(e.foundrySdkSession):await e.wav.discard()}async disposeSdk(e){await _(e.dispose(),X,"io","SDK dispose timed out.").catch(()=>{})}async handleShutdown(){return this.shutdownPromise?this.shutdownPromise:(this.shutdownPromise=(async()=>{if(this.state.tag==="ready"&&this.state.session?.tag==="opening"&&await this.state.session.opening.catch(()=>{}),this.state.tag==="ready"){let e=this.state,n=e.session;if(n!==void 0){let t=ee(n);t&&(e.session=void 0,await this.teardownSession(t).catch(()=>{}))}}await this.unloadSelected().catch(()=>{}),this.managerPromise=void 0,this.events.clear()})(),this.shutdownPromise)}disposedError(){return new a("Foundry backend has been shut down.","disposed")}async getVariant(e){return(await this.getManager()).catalog.getModelVariant(e)}getManager(){return this.managerPromise||(this.managerPromise=this.initManager().catch(e=>{throw this.managerPromise=void 0,e})),this.managerPromise}async initManager(){if(this.managerFactory)return this.managerFactory();if(!this.nativeLocation)throw new a("Voice runtime is not downloaded. RuntimeInstaller must resolve it before backend construction.","runtime-not-downloaded");let e=this.nativeLocation;return O(async()=>{let n=j("foundry-local-sdk"),t={...this.foundryAdditionalSettings};return e.needsBootstrap&&!("Bootstrap"in t)&&(t.Bootstrap="true"),n.FoundryLocalManager.create({appName:Q,libraryPath:e.corePath,additionalSettings:t})})}};function te(s){return s.content?.[0]?.text??""}function ne(s){return s.toLowerCase().includes("streaming")}function se(s){return s.info.task===T}async function O(s,e){try{return await s()}catch(n){if((e?.platform??process.platform)!=="win32")throw n;let o=b(n);if(!/Failed to load (?:dependency|core) library/i.test(o))throw n;let r=(e?.arch??process.arch)==="arm64"?"https://aka.ms/vs/17/release/vc_redist.arm64.exe":"https://aka.ms/vs/17/release/vc_redist.x64.exe";throw new a(`Voice mode requires the Microsoft Visual C++ Redistributable (2015-2022). Download and install it, then try again: ${r}`,"windows-runtime-missing",{cause:n})}}function oe(s){return Array.isArray(s)?s.filter(e=>typeof e=="string"):typeof s=="string"?s.split(/[,\s]+/).filter(e=>e.length>0):s&&typeof s=="object"?Object.keys(s):[]}async function ie(s){let e=s.isCached,n=oe(s.info.capabilities),t=s.info,o=s.info.runtime?.deviceType??t.device,i=o?o.toLowerCase():void 0,r=t.sizeInBytes??(typeof s.info.fileSizeMb=="number"?Math.round(s.info.fileSizeMb*1024*1024):void 0);return{id:s.id,alias:s.alias,name:s.info.name??s.id,cached:e,capabilities:n,sizeBytes:r,device:i}}function _(s,e,n,t){let o,i=new Promise((r,c)=>{o=setTimeout(()=>c(new a(t,n)),e)});return Promise.race([s,i]).finally(()=>{o&&clearTimeout(o)})}if(!v)throw new Error("voice-foundry.worker.js must be loaded as a worker thread.");I(v);var N=re;if(!N?.nativeLocation)throw new Error("voice-foundry.worker.ts requires workerData.nativeLocation.");var B=v,M=new h({nativeLocation:N.nativeLocation});M.on("modelDownloadProgress",s=>U("modelDownloadProgress",s));M.on("sessionPreview",s=>U("sessionPreview",s));k(B,M);function U(s,e){let n={kind:"event",event:s,payload:e};B.postMessage(n)} | ||
| var j=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});import{parentPort as v,workerData as re}from"node:worker_threads";var a=class extends Error{constructor(n,t,o){super(n,o);this.code=t;this.name="VoiceBackendError"}},V=16;function S(s){return E(s,new WeakSet,0)}function E(s,e,n){if(n>=V)return{name:"Error",message:"<cause chain truncated>"};if(typeof s=="object"&&s!==null){if(e.has(s))return{name:"Error",message:"<cyclic cause>"};e.add(s)}let t;if(s instanceof a)t={name:s.name,message:s.message,stack:s.stack,code:s.code};else if(s instanceof Error)t={name:s.name,message:s.message,stack:s.stack};else return{name:"Error",message:String(s)};return s instanceof Error&&s.cause!==void 0&&(t.cause=E(s.cause,e,n+1)),t}function L(s){return s instanceof Error?s:new Error(String(s))}function k(s,e){s.on("message",n=>{if(n==null||typeof n!="object")return;let t=n;t.kind==="request"&&W(s,e,t).catch(()=>{})})}async function W(s,e,n){try{let t=n.method,o=n.params,i=await e.call(t,o),r={kind:"response",id:n.id,ok:!0,result:i};s.postMessage(r)}catch(t){let o={kind:"response",id:n.id,ok:!1,error:S(t)};s.postMessage(o)}}var p=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;writePromise=this.initialQueueResolvers.promise;setLogWriter(e){this.logWriter=e;for(let n of this.initialQueue)this.writePromise=this.logWriter.writeLog(n.method,n.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){await this.writePromise}async dispose(){await this.flush()}outputPath(){return this.logWriter?.outputPath()}logToLevel(e,n){this.logWriter?this.writePromise=this.logWriter.writeLog(e,n):this.initialQueue.push({method:e,message:n})}info(e){this.logToLevel("info",e)}debug(e){this.logToLevel("debug",e)}warning(e){this.logToLevel("warning",e)}error(e){this.logToLevel("error",e instanceof Error?e.message:e)}log(e){this.error(e)}isDebug(){return!1}shouldLog(e){return!0}notice(e){this.info(e instanceof Error?e.message:e)}startGroup(e,n){this.info(`--- Start of group: ${e} ---`)}endGroup(e){this.info("--- End of group ---")}},P=new p;var f=16*1024,m=class{constructor(e){this.port=e}writeLog(e,n){let t={kind:"log",level:e,message:H(n)};try{this.port.postMessage(t)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function I(s,e=P){e.setLogWriter(new m(s))}function H(s){return s.length<=f?s:`${s.slice(0,f)}\u2026 [truncated, ${s.length-f} more chars]`}import*as D from"node:fs/promises";import*as G from"node:os";import*as C from"node:path";function $(s){if(s.includes("<!DOCTYPE")||s.includes("<html")){let e=Math.min(s.indexOf("<!DOCTYPE")!==-1?s.indexOf("<!DOCTYPE"):1/0,s.indexOf("<html")!==-1?s.indexOf("<html"):1/0),n=s.substring(0,e).trim();return n?`${n} [HTML error page omitted]`:"[HTML error page omitted]"}return s}function b(s){let e;if(s instanceof Error)e=String(s);else if(typeof s=="object"&&s!==null)try{e=JSON.stringify(s)??"[object]"}catch{return"[object with circular reference]"}else e=String(s);return $(e)}var u=class{listeners=new Map;on(e,n){let t=this.listeners.get(e);t||(t=new Set,this.listeners.set(e,t));let o=n,i=t;return i.add(o),()=>{i.delete(o)}}emit(e,n){let t=this.listeners.get(e);if(!t)return;let o=[...t];for(let i of o)try{i(n)}catch{}}clear(){this.listeners.clear()}};var z={listModels:!0,downloadModel:!0,deleteModel:!0,loadModel:!0,openSession:!0,appendSession:!0,stopSession:!0,cancelSession:!0,shutdown:!0},me=Object.keys(z),T="automatic-speech-recognition",Y={modelDownloadProgress:!0,sessionPreview:!0},we=Object.keys(Y);import*as A from"node:fs/promises";import{open as q}from"node:fs/promises";var x=16e3,w=1,y=16,R=44,g=class{constructor(e){this.path=e}handle;dataSize=0;writeTail=Promise.resolve();async open(){this.handle=await q(this.path,"w"),await this.handle.write(F(0))}append(e){let n=this.writeTail.then(async()=>{if(!this.handle)throw new Error("WavStreamWriter not opened");await this.handle.write(e),this.dataSize+=e.byteLength});return this.writeTail=n.catch(()=>{}),n}async finalize(){if(!this.handle||(await this.writeTail,!this.handle))return;let e=this.handle;this.handle=void 0;try{await e.write(F(this.dataSize),0,R,0)}finally{await e.close()}}async discard(){this.handle&&(await this.handle.close().catch(()=>{}),this.handle=void 0),await A.unlink(this.path).catch(()=>{})}};function F(s){let e=x*w*y/8,n=w*y/8,t=Buffer.alloc(R);return t.write("RIFF",0,"ascii"),t.writeUInt32LE(36+s,4),t.write("WAVE",8,"ascii"),t.write("fmt ",12,"ascii"),t.writeUInt32LE(16,16),t.writeUInt16LE(1,20),t.writeUInt16LE(w,22),t.writeUInt32LE(x,24),t.writeUInt32LE(e,28),t.writeUInt16LE(n,32),t.writeUInt16LE(y,34),t.write("data",36,"ascii"),t.writeUInt32LE(s,40),t}var J="github-copilot-cli",Q={AzureCatalogFilter:"'',test"},K=1e4,X=2e3,Z="voice-foundry-batch-";function ee(s){switch(s.tag){case"opening":return;case"active":case"stopping":case"cancelling":return s.session;default:return s}}var h=class{managerPromise;state={tag:"unloaded"};lastModelGeneration=0;downloads=new Map;shutdownPromise;events=new u;foundryAdditionalSettings;nativeLocation;tempDir;managerFactory;handlers={listModels:()=>this.handleListModels(),downloadModel:e=>this.handleDownloadModel(e),deleteModel:e=>this.handleDeleteModel(e),loadModel:e=>this.handleLoadModel(e),openSession:e=>this.handleOpenSession(e),appendSession:e=>this.handleAppendSession(e),stopSession:e=>this.handleStopSession(e),cancelSession:e=>this.handleCancelSession(e),shutdown:()=>this.handleShutdown()};constructor(e={}){this.foundryAdditionalSettings=e.foundryAdditionalSettings??Q,this.nativeLocation=e.nativeLocation,this.tempDir=e.tempDir??G.tmpdir(),this.managerFactory=e.managerFactory}call(e,n,t){if(this.shutdownPromise&&e!=="shutdown")return Promise.reject(this.disposedError());let o=this.handlers[e];return o(n)}on(e,n){return this.events.on(e,n)}onFatalError(e){return()=>{}}shutdown(e){return this.handleShutdown()}async handleListModels(){return O(async()=>{let n=await(await this.getManager()).catalog.getModels(),t=[];for(let o of n)for(let i of o.variants)se(i)&&t.push(await ie(i));return t})}async handleDownloadModel(e){let{variantId:n,downloadId:t}=e,o=this.downloads.get(n);if(o){if(o.downloadId===t)return o.promise;throw new a(`A different download for '${n}' is in flight.`,"io")}let i=(async()=>{await(await this.getVariant(n)).download(d=>{this.events.emit("modelDownloadProgress",{downloadId:t,variantId:n,percent:d})})})(),r={downloadId:t,promise:i};this.downloads.set(n,r);try{await i}finally{this.downloads.get(n)===r&&this.downloads.delete(n)}}async handleDeleteModel(e){let{variantId:n}=e;if(this.downloads.has(n))throw new a(`Cannot delete '${n}' while a download is in flight.`,"io");let t=this.state;switch(t.tag){case"unloaded":break;case"loading":t.selection.variantId===n&&await this.unloadSelected();break;case"ready":if(t.selection.variantId===n){if(t.session!==void 0)throw new a(`Cannot delete '${n}' while a session is active.`,"session-active");await this.unloadSelected()}break;default:}(await this.getVariant(n)).removeFromCache()}async handleLoadModel(e){let{variantId:n}=e;if(this.shutdownPromise)throw this.disposedError();let t=this.state;switch(t.tag){case"unloaded":return this.startLoad(n,void 0);case"loading":if(t.selection.variantId===n){let o=await t.selection.loadedModel;return o.modelGeneration=this.bumpModelGeneration(),{modelGeneration:o.modelGeneration}}return this.startLoad(n,t.selection);case"ready":if(t.session!==void 0&&t.selection.variantId!==n)throw new a(`Cannot load '${n}' while a session is active.`,"session-active");return t.selection.variantId===n?(t.selection.loaded.modelGeneration=this.bumpModelGeneration(),{modelGeneration:t.selection.loaded.modelGeneration}):this.startLoad(n,t.selection);default:return t}}async startLoad(e,n){let t=this.loadVariant(e,n),o={variantId:e,loadedModel:t,previous:n};return this.state={tag:"loading",selection:o},t.then(r=>{this.state.tag==="loading"&&this.state.selection===o&&(this.state={tag:"ready",selection:{variantId:e,loadedModel:t,loaded:r}})},()=>{this.state.tag==="loading"&&this.state.selection===o&&(this.state={tag:"unloaded"})}),{modelGeneration:(await t).modelGeneration}}async loadVariant(e,n){if(n){let o=await n.loadedModel.catch(()=>{});o&&await o.variant.unload().catch(()=>{})}if(this.shutdownPromise)throw this.disposedError();let t=await this.getVariant(e);if(!t.isCached)throw new a(`Voice model '${e}' is not downloaded.`,"model-not-downloaded");if(await t.load(),this.shutdownPromise)throw await t.unload().catch(()=>{}),this.disposedError();return{variant:t,isStreaming:ne(t.alias),modelGeneration:this.bumpModelGeneration()}}bumpModelGeneration(){return this.lastModelGeneration=this.lastModelGeneration+1,this.lastModelGeneration}async unloadSelected(){if(this.state.tag==="unloaded")return;let e=this.state.selection;this.state={tag:"unloaded"};let n=await e.loadedModel.catch(()=>{});n&&await n.variant.unload().catch(()=>{})}async handleOpenSession(e){let n=this.state;switch(n.tag){case"unloaded":throw new a("Loaded model has changed since this session was prepared.","stale-model");case"loading":return await n.selection.loadedModel.catch(()=>{}),this.handleOpenSession(e);case"ready":{let t=n,{sessionId:o,modelGeneration:i}=e;if(t.session!==void 0)throw new a("A voice session is already active.","session-active");if(t.selection.loaded.modelGeneration!==i)throw new a("Loaded model has changed since this session was prepared.","stale-model");let r=t.selection.loaded,c=(async()=>{try{let d=r.isStreaming?await this.openStreamingSession(r,o):await this.openBatchSession(o),l=t.session;this.state===t&&l?.tag==="opening"&&l.sessionId===o?t.session={tag:"active",session:d}:await this.teardownSession(d).catch(()=>{})}catch(d){let l=t.session;throw this.state===t&&l?.tag==="opening"&&l.sessionId===o&&(t.session=void 0),d}})();t.session={tag:"opening",sessionId:o,opening:c},await c;return}default:return n}}async handleAppendSession(e){let n=this.state;switch(n.tag){case"unloaded":case"loading":return;case"ready":{let t=n.session;if(t===void 0)return;switch(t.tag){case"opening":case"stopping":case"cancelling":return;case"active":{if(t.session.sessionId!==e.sessionId)return;let o=t.session;if(o.kind==="streaming"){await o.foundrySdkSession.append(e.pcm);return}await o.wav.append(e.pcm);return}default:return t}}default:return n}}async handleStopSession(e){let n=()=>{throw new a(`No session '${e.sessionId}'.`,"session-not-found")},t=this.state;switch(t.tag){case"unloaded":case"loading":return n();case"ready":{let o=t,i=o.session;if(i===void 0)return n();switch(i.tag){case"opening":case"stopping":case"cancelling":return n();case"active":{if(i.session.sessionId!==e.sessionId)return n();let r=i.session,c=r.error;if(c)throw o.session=void 0,await this.teardownSession(r).catch(()=>{}),c;o.session={tag:"stopping",session:r};try{return{text:r.kind==="streaming"?await this.stopStreaming(r):await this.stopBatch(r)}}catch(d){throw r.error?r.error:d}finally{let d=o.session;this.state===o&&d?.tag==="stopping"&&d.session===r&&(o.session=void 0),await this.teardownSession(r).catch(()=>{})}}default:return i}}default:return t}}async handleCancelSession(e){let n=this.state;switch(n.tag){case"unloaded":case"loading":return;case"ready":{let t=n,o=t.session;if(o===void 0)return;switch(o.tag){case"opening":case"cancelling":return;case"active":{if(o.session.sessionId!==e.sessionId)return;let i=o.session;t.session={tag:"cancelling",session:i};try{await this.teardownSession(i)}finally{let r=t.session;this.state===t&&r?.tag==="cancelling"&&r.session===i&&(t.session=void 0)}return}case"stopping":{if(o.session.sessionId!==e.sessionId)return;let i=o.session;i.error=i.error??new a("Session cancelled.","cancelled"),t.session={tag:"cancelling",session:i},await this.teardownSession(i).catch(()=>{});return}default:return o}}default:return n}}async openStreamingSession(e,n){let t=e.variant.createAudioClient().createLiveTranscriptionSession();try{await t.start()}catch(i){throw await this.disposeSdk(t),i}let o={kind:"streaming",sessionId:n,foundrySdkSession:t,committed:"",tail:"",drainTask:Promise.resolve("")};return o.drainTask=this.runStreamingDrain(o),o.drainTask.catch(()=>{}),o}async openBatchSession(e){let n=new g(C.join(this.tempDir,`${Z}${e}.wav`));try{await n.open()}catch(t){throw await n.discard(),t}return{kind:"batch",sessionId:e,wav:n}}async runStreamingDrain(e){try{for await(let n of e.foundrySdkSession.getStream()){if(this.isCancellingSession(e))break;let t=te(n);t&&(n.is_final?(e.committed+=t,e.tail=""):e.tail+=t,this.events.emit("sessionPreview",{sessionId:e.sessionId,text:e.committed+e.tail}))}return e.committed+e.tail}catch(n){let t=L(n);throw e.error=t,t}}isCancellingSession(e){let n=this.state;switch(n.tag){case"unloaded":case"loading":return!1;case"ready":{let t=n.session;if(t===void 0)return!1;switch(t.tag){case"opening":case"active":case"stopping":return!1;case"cancelling":return t.session===e;default:return t}}default:return n}}async stopStreaming(e){return _((async()=>(await e.foundrySdkSession.stop(),e.drainTask))(),K,"session-timeout","Streaming session drain timed out.")}async stopBatch(e){if(this.state.tag!=="ready")return"";let n=this.state.selection.loaded;await e.wav.finalize();try{return(await n.variant.createAudioClient().transcribe(e.wav.path)).text??""}finally{await D.unlink(e.wav.path).catch(()=>{})}}async teardownSession(e){e.kind==="streaming"?await this.disposeSdk(e.foundrySdkSession):await e.wav.discard()}async disposeSdk(e){await _(e.dispose(),X,"io","SDK dispose timed out.").catch(()=>{})}async handleShutdown(){return this.shutdownPromise?this.shutdownPromise:(this.shutdownPromise=(async()=>{if(this.state.tag==="ready"&&this.state.session?.tag==="opening"&&await this.state.session.opening.catch(()=>{}),this.state.tag==="ready"){let e=this.state,n=e.session;if(n!==void 0){let t=ee(n);t&&(e.session=void 0,await this.teardownSession(t).catch(()=>{}))}}await this.unloadSelected().catch(()=>{}),this.managerPromise=void 0,this.events.clear()})(),this.shutdownPromise)}disposedError(){return new a("Foundry backend has been shut down.","disposed")}async getVariant(e){return(await this.getManager()).catalog.getModelVariant(e)}getManager(){return this.managerPromise||(this.managerPromise=this.initManager().catch(e=>{throw this.managerPromise=void 0,e})),this.managerPromise}async initManager(){if(this.managerFactory)return this.managerFactory();if(!this.nativeLocation)throw new a("Voice runtime is not downloaded. RuntimeInstaller must resolve it before backend construction.","runtime-not-downloaded");let e=this.nativeLocation;return O(async()=>{let n=j("foundry-local-sdk"),t={...this.foundryAdditionalSettings};return e.needsBootstrap&&!("Bootstrap"in t)&&(t.Bootstrap="true"),n.FoundryLocalManager.create({appName:J,libraryPath:e.corePath,additionalSettings:t})})}};function te(s){return s.content?.[0]?.text??""}function ne(s){return s.toLowerCase().includes("streaming")}function se(s){return s.info.task===T}async function O(s,e){try{return await s()}catch(n){if((e?.platform??process.platform)!=="win32")throw n;let o=b(n);if(!/Failed to load (?:dependency|core) library/i.test(o))throw n;let r=(e?.arch??process.arch)==="arm64"?"https://aka.ms/vs/17/release/vc_redist.arm64.exe":"https://aka.ms/vs/17/release/vc_redist.x64.exe";throw new a(`Voice mode requires the Microsoft Visual C++ Redistributable (2015-2022). Download and install it, then try again: ${r}`,"windows-runtime-missing",{cause:n})}}function oe(s){return Array.isArray(s)?s.filter(e=>typeof e=="string"):typeof s=="string"?s.split(/[,\s]+/).filter(e=>e.length>0):s&&typeof s=="object"?Object.keys(s):[]}async function ie(s){let e=s.isCached,n=oe(s.info.capabilities),t=s.info,o=s.info.runtime?.deviceType??t.device,i=o?o.toLowerCase():void 0,r=t.sizeInBytes??(typeof s.info.fileSizeMb=="number"?Math.round(s.info.fileSizeMb*1024*1024):void 0);return{id:s.id,alias:s.alias,name:s.info.name??s.id,cached:e,capabilities:n,sizeBytes:r,device:i}}function _(s,e,n,t){let o,i=new Promise((r,c)=>{o=setTimeout(()=>c(new a(t,n)),e)});return Promise.race([s,i]).finally(()=>{o&&clearTimeout(o)})}if(!v)throw new Error("voice-foundry.worker.js must be loaded as a worker thread.");I(v);var N=re;if(!N?.nativeLocation)throw new Error("voice-foundry.worker.ts requires workerData.nativeLocation.");var B=v,M=new h({nativeLocation:N.nativeLocation});M.on("modelDownloadProgress",s=>U("modelDownloadProgress",s));M.on("sessionPreview",s=>U("sessionPreview",s));k(B,M);function U(s,e){let n={kind:"event",event:s,payload:e};B.postMessage(n)} |
@@ -59,2 +59,2 @@ | ||
| const __dirname = __path.dirname(__filename); | ||
| import{parentPort as T,workerData as ee}from"node:worker_threads";import{createRequire as D}from"node:module";import{existsSync as W}from"node:fs";import*as o from"node:fs/promises";import*as a from"node:path";import{createHash as H}from"node:crypto";import{join as u,basename as oe}from"node:path";import{homedir as g}from"node:os";function j(){return process.env.XDG_CACHE_HOME||u(g(),".cache")}function L(){if(process.platform==="darwin")return u(g(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||u(g(),".cache");return u(e,"copilot")}return u(j(),"copilot")}function A(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),t=e.substring(0,r).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function m(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return A(r)}var J=1,b=".complete";var h={"win32-x64":"win-x64","win32-arm64":"win-arm64","linux-x64":"linux-x64","darwin-arm64":"osx-arm64"};function S(){return typeof __foundryRequire<"u"&&__foundryRequire||D(import.meta.url)}var d;function U(){if(d)return d;try{let e=S()("foundry-local-sdk/script/install-utils.cjs");if(typeof e.runInstall!="function")throw new Error(`Expected exports {runInstall: function}, got: ${JSON.stringify(Object.fromEntries(Object.entries(e).map(([r,t])=>[r,typeof t])))}`);return d=e,d}catch(e){throw new Error(`Failed to load foundry-local-sdk/script/install-utils.cjs: ${m(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}var f;function V(){if(f)return f;try{let e=S()("foundry-local-sdk/deps_versions.json");if(typeof e["foundry-local-core"]?.nuget!="string"||typeof e.onnxruntime?.version!="string"||typeof e["onnxruntime-genai"]?.version!="string")throw new Error('deps_versions.json is missing one of the expected version keys: ["foundry-local-core"].nuget, .onnxruntime.version, ["onnxruntime-genai"].version');return f=e,f}catch(e){throw new Error(`Failed to load foundry-local-sdk/deps_versions.json: ${m(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}function I(e=process.platform){let r=V();return[{name:"Microsoft.AI.Foundry.Local.Core",version:r["foundry-local-core"].nuget},{name:e==="linux"?"Microsoft.ML.OnnxRuntime.Gpu.Linux":"Microsoft.ML.OnnxRuntime.Foundry",version:r.onnxruntime.version},{name:"Microsoft.ML.OnnxRuntimeGenAI.Foundry",version:r["onnxruntime-genai"].version}]}function O(e){return e==="win32"?".dll":e==="darwin"?".dylib":".so"}function q(e,r){return a.join(e,`Microsoft.AI.Foundry.Local.Core${O(r)}`)}function K(e){let r=O(e),t=e==="win32"?"":"lib";return[`Microsoft.AI.Foundry.Local.Core${r}`,`${t}onnxruntime${r}`,`${t}onnxruntime-genai${r}`]}function G(e,r=process.platform,t=process.arch){let n=h[`${r}-${t}`];if(!n)throw new Error(`Voice mode not supported on ${r}-${t}`);let i=e??process.env.COPILOT_CACHE_HOME??L(),s=I(r),c=H("sha256").update(JSON.stringify({schema:J,artifacts:s})).digest("hex").slice(0,12);return a.join(i,"foundry",c,n)}async function C(e={}){let r=e.platform??process.platform,t=e.arch??process.arch,n=`${r}-${t}`;if(!h[n])throw new Error(`Voice mode is not supported on ${n}. Supported platforms: ${Object.keys(h).join(", ")}.`);let s=G(e.cacheRoot,r,t),c=q(s,r),l=K(r);return await M(s,l)||(e.onDownloadStart?.(),await z(s,r,l,e.runInstall)),P(c,s,r,e.existsSyncImpl)}async function M(e,r){return await y(a.join(e,b))?(await Promise.all(r.map(n=>y(a.join(e,n))))).every(Boolean):!1}function P(e,r,t,n=Y){if(t!=="win32")return{corePath:e,needsBootstrap:!1};let i=a.join(r,"Microsoft.WindowsAppRuntime.Bootstrap.dll");return{corePath:e,needsBootstrap:n(i)}}function Y(e){try{return W(e)}catch{return!1}}async function y(e){try{return await o.access(e),!0}catch{return!1}}async function z(e,r,t,n){let i=a.dirname(e);await o.mkdir(i,{recursive:!0});let s=a.join(i,`.tmp-${a.basename(e)}-${process.pid}-${Date.now()}`);await o.mkdir(s,{recursive:!0});try{let c=n??U().runInstall,l=I(r);await B(()=>c(l,{binDir:s}));for(let k of t)if(!await y(a.join(s,k)))throw new Error(`Foundry runtime download finished but required file is missing: ${k}. RID for ${r} may not be supported by the published packages.`);await o.writeFile(a.join(s,b),""),await Q(s,e,t)}catch(c){throw await o.rm(s,{recursive:!0,force:!0}).catch(()=>{}),c}}async function Q(e,r,t){try{await o.rename(e,r)}catch(n){let i=n.code;if(i==="ENOTEMPTY"||i==="EEXIST"||i==="EPERM"){if(await M(r,t)){await o.rm(e,{recursive:!0,force:!0}).catch(()=>{});return}await o.rm(r,{recursive:!0,force:!0}),await o.rename(e,r);return}throw n}}async function B(e){let r=process.stdout.write.bind(process.stdout),t=process.stderr.write.bind(process.stderr);process.stdout.write=(()=>!0),process.stderr.write=(()=>!0);try{return await e()}finally{process.stdout.write=r,process.stderr.write=t}}var w=class extends Error{constructor(t,n,i){super(t,i);this.code=n;this.name="VoiceBackendError"}},X=16;function _(e){return N(e,new WeakSet,0)}function N(e,r,t){if(t>=X)return{name:"Error",message:"<cause chain truncated>"};if(typeof e=="object"&&e!==null){if(r.has(e))return{name:"Error",message:"<cyclic cause>"};r.add(e)}let n;if(e instanceof w)n={name:e.name,message:e.message,stack:e.stack,code:e.code};else if(e instanceof Error)n={name:e.name,message:e.message,stack:e.stack};else return{name:"Error",message:String(e)};return e instanceof Error&&e.cause!==void 0&&(n.cause=N(e.cause,r,t+1)),n}function R(e){return e instanceof Error?e:new Error(String(e))}var v=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;writePromise=this.initialQueueResolvers.promise;setLogWriter(r){this.logWriter=r;for(let t of this.initialQueue)this.writePromise=this.logWriter.writeLog(t.method,t.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){await this.writePromise}async dispose(){await this.flush()}outputPath(){return this.logWriter?.outputPath()}logToLevel(r,t){this.logWriter?this.writePromise=this.logWriter.writeLog(r,t):this.initialQueue.push({method:r,message:t})}info(r){this.logToLevel("info",r)}debug(r){this.logToLevel("debug",r)}warning(r){this.logToLevel("warning",r)}error(r){this.logToLevel("error",r instanceof Error?r.message:r)}log(r){this.error(r)}isDebug(){return!1}shouldLog(r){return!0}notice(r){this.info(r instanceof Error?r.message:r)}startGroup(r,t){this.info(`--- Start of group: ${r} ---`)}endGroup(r){this.info("--- End of group ---")}},F=new v;var E=16*1024,x=class{constructor(r){this.port=r}writeLog(r,t){let n={kind:"log",level:r,message:Z(t)};try{this.port.postMessage(n)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function $(e,r=F){r.setLogWriter(new x(e))}function Z(e){return e.length<=E?e:`${e.slice(0,E)}\u2026 [truncated, ${e.length-E} more chars]`}if(!T)throw new Error("voice-installer.worker.js must be loaded as a worker thread.");var p=T;$(p);var re=ee??{};async function te(){try{let r={kind:"ok",location:await C({cacheRoot:re.cacheRoot,onDownloadStart:()=>{let t={kind:"download-started"};p.postMessage(t)}})};p.postMessage(r)}catch(e){let r={kind:"error",error:_(R(e))};p.postMessage(r)}finally{setImmediate(()=>process.exit(0))}}te().catch(()=>{process.exit(1)}); | ||
| import{parentPort as T,workerData as ee}from"node:worker_threads";import{createRequire as D}from"node:module";import{existsSync as W}from"node:fs";import*as o from"node:fs/promises";import*as a from"node:path";import{createHash as H}from"node:crypto";import{join as u,basename as oe}from"node:path";import{homedir as g}from"node:os";function j(){return process.env.XDG_CACHE_HOME||u(g(),".cache")}function L(){if(process.platform==="darwin")return u(g(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||u(g(),".cache");return u(e,"copilot")}return u(j(),"copilot")}function A(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),t=e.substring(0,r).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function m(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return A(r)}var J=1,P=".complete";var h={"win32-x64":"win-x64","win32-arm64":"win-arm64","linux-x64":"linux-x64","darwin-arm64":"osx-arm64"};function S(){return typeof __foundryRequire<"u"&&__foundryRequire||D(import.meta.url)}var d;function U(){if(d)return d;try{let e=S()("foundry-local-sdk/script/install-utils.cjs");if(typeof e.runInstall!="function")throw new Error(`Expected exports {runInstall: function}, got: ${JSON.stringify(Object.fromEntries(Object.entries(e).map(([r,t])=>[r,typeof t])))}`);return d=e,d}catch(e){throw new Error(`Failed to load foundry-local-sdk/script/install-utils.cjs: ${m(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}var f;function V(){if(f)return f;try{let e=S()("foundry-local-sdk/deps_versions.json");if(typeof e["foundry-local-core"]?.nuget!="string"||typeof e.onnxruntime?.version!="string"||typeof e["onnxruntime-genai"]?.version!="string")throw new Error('deps_versions.json is missing one of the expected version keys: ["foundry-local-core"].nuget, .onnxruntime.version, ["onnxruntime-genai"].version');return f=e,f}catch(e){throw new Error(`Failed to load foundry-local-sdk/deps_versions.json: ${m(e)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}function I(e=process.platform){let r=V();return[{name:"Microsoft.AI.Foundry.Local.Core",version:r["foundry-local-core"].nuget},{name:e==="linux"?"Microsoft.ML.OnnxRuntime.Gpu.Linux":"Microsoft.ML.OnnxRuntime.Foundry",version:r.onnxruntime.version},{name:"Microsoft.ML.OnnxRuntimeGenAI.Foundry",version:r["onnxruntime-genai"].version}]}function O(e){return e==="win32"?".dll":e==="darwin"?".dylib":".so"}function q(e,r){return a.join(e,`Microsoft.AI.Foundry.Local.Core${O(r)}`)}function K(e){let r=O(e),t=e==="win32"?"":"lib";return[`Microsoft.AI.Foundry.Local.Core${r}`,`${t}onnxruntime${r}`,`${t}onnxruntime-genai${r}`]}function Y(e,r=process.platform,t=process.arch){let n=h[`${r}-${t}`];if(!n)throw new Error(`Voice mode not supported on ${r}-${t}`);let i=e??process.env.COPILOT_CACHE_HOME??L(),s=I(r),c=H("sha256").update(JSON.stringify({schema:J,artifacts:s})).digest("hex").slice(0,12);return a.join(i,"foundry",c,n)}async function C(e={}){let r=e.platform??process.platform,t=e.arch??process.arch,n=`${r}-${t}`;if(!h[n])throw new Error(`Voice mode is not supported on ${n}. Supported platforms: ${Object.keys(h).join(", ")}.`);let s=Y(e.cacheRoot,r,t),c=q(s,r),l=K(r);return await M(s,l)||(e.onDownloadStart?.(),await z(s,r,l,e.runInstall)),b(c,s,r,e.existsSyncImpl)}async function M(e,r){return await y(a.join(e,P))?(await Promise.all(r.map(n=>y(a.join(e,n))))).every(Boolean):!1}function b(e,r,t,n=G){if(t!=="win32")return{corePath:e,needsBootstrap:!1};let i=a.join(r,"Microsoft.WindowsAppRuntime.Bootstrap.dll");return{corePath:e,needsBootstrap:n(i)}}function G(e){try{return W(e)}catch{return!1}}async function y(e){try{return await o.access(e),!0}catch{return!1}}async function z(e,r,t,n){let i=a.dirname(e);await o.mkdir(i,{recursive:!0});let s=a.join(i,`.tmp-${a.basename(e)}-${process.pid}-${Date.now()}`);await o.mkdir(s,{recursive:!0});try{let c=n??U().runInstall,l=I(r);await Q(()=>c(l,{binDir:s}));for(let k of t)if(!await y(a.join(s,k)))throw new Error(`Foundry runtime download finished but required file is missing: ${k}. RID for ${r} may not be supported by the published packages.`);await o.writeFile(a.join(s,P),""),await B(s,e,t)}catch(c){throw await o.rm(s,{recursive:!0,force:!0}).catch(()=>{}),c}}async function B(e,r,t){try{await o.rename(e,r)}catch(n){let i=n.code;if(i==="ENOTEMPTY"||i==="EEXIST"||i==="EPERM"){if(await M(r,t)){await o.rm(e,{recursive:!0,force:!0}).catch(()=>{});return}await o.rm(r,{recursive:!0,force:!0}),await o.rename(e,r);return}throw n}}async function Q(e){let r=process.stdout.write.bind(process.stdout),t=process.stderr.write.bind(process.stderr);process.stdout.write=(()=>!0),process.stderr.write=(()=>!0);try{return await e()}finally{process.stdout.write=r,process.stderr.write=t}}var w=class extends Error{constructor(t,n,i){super(t,i);this.code=n;this.name="VoiceBackendError"}},X=16;function _(e){return N(e,new WeakSet,0)}function N(e,r,t){if(t>=X)return{name:"Error",message:"<cause chain truncated>"};if(typeof e=="object"&&e!==null){if(r.has(e))return{name:"Error",message:"<cyclic cause>"};r.add(e)}let n;if(e instanceof w)n={name:e.name,message:e.message,stack:e.stack,code:e.code};else if(e instanceof Error)n={name:e.name,message:e.message,stack:e.stack};else return{name:"Error",message:String(e)};return e instanceof Error&&e.cause!==void 0&&(n.cause=N(e.cause,r,t+1)),n}function R(e){return e instanceof Error?e:new Error(String(e))}var v=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;writePromise=this.initialQueueResolvers.promise;setLogWriter(r){this.logWriter=r;for(let t of this.initialQueue)this.writePromise=this.logWriter.writeLog(t.method,t.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){await this.writePromise}async dispose(){await this.flush()}outputPath(){return this.logWriter?.outputPath()}logToLevel(r,t){this.logWriter?this.writePromise=this.logWriter.writeLog(r,t):this.initialQueue.push({method:r,message:t})}info(r){this.logToLevel("info",r)}debug(r){this.logToLevel("debug",r)}warning(r){this.logToLevel("warning",r)}error(r){this.logToLevel("error",r instanceof Error?r.message:r)}log(r){this.error(r)}isDebug(){return!1}shouldLog(r){return!0}notice(r){this.info(r instanceof Error?r.message:r)}startGroup(r,t){this.info(`--- Start of group: ${r} ---`)}endGroup(r){this.info("--- End of group ---")}},F=new v;var E=16*1024,x=class{constructor(r){this.port=r}writeLog(r,t){let n={kind:"log",level:r,message:Z(t)};try{this.port.postMessage(n)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function $(e,r=F){r.setLogWriter(new x(e))}function Z(e){return e.length<=E?e:`${e.slice(0,E)}\u2026 [truncated, ${e.length-E} more chars]`}if(!T)throw new Error("voice-installer.worker.js must be loaded as a worker thread.");var p=T;$(p);var re=ee??{};async function te(){try{let r={kind:"ok",location:await C({cacheRoot:re.cacheRoot,onDownloadStart:()=>{let t={kind:"download-started"};p.postMessage(t)}})};p.postMessage(r)}catch(e){let r={kind:"error",error:_(R(e))};p.postMessage(r)}finally{setImmediate(()=>process.exit(0))}}te().catch(()=>{process.exit(1)}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 22 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 22 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
278357726
0.04%183089
0.58%9
12.5%178
0.56%