aicommits 2.0.0-develop.2 → 2.0.0-develop.3
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/README.md +3 -1
- package/dist/{cli-p51f4U3R.mjs → cli-8OikwcWH.mjs} +6 -6
- package/dist/cli.mjs +1 -1
- package/dist/{token-BcjwApjJ.mjs → token-BBjSjsOL.mjs} +1 -1
- package/dist/{token-util-CwXWciaG.mjs → token-util-DSUfZicm.mjs} +1 -1
- package/dist/{token-util-DvcpPQUZ.mjs → token-util-kF1mb_fv.mjs} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
1. Install _aicommits_:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
npm install -g aicommits
|
|
20
|
+
npm install -g aicommits@develop
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
> We need @develop since v2 is still not released as latest/main! Don't remove it to test v2!
|
|
24
|
+
|
|
23
25
|
2. Run the setup command to choose your AI provider:
|
|
24
26
|
|
|
25
27
|
```sh
|
|
@@ -19,7 +19,7 @@ var Ap=Object.defineProperty;var a=(e,t)=>Ap(e,"name",{value:t,configurable:!0})
|
|
|
19
19
|
`:"")+(n?this.indentText({text:this.render(n),spaces:r}):"")}
|
|
20
20
|
`}table({tableData:t,tableOptions:n,tableBreakpoints:r}){return wD(t.map(s=>s.map(i=>this.render(i))),r?xD(r):n)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:n,flagFormatted:r,aliasesEnabled:s,aliasFormatted:i}=t;let o="";if(i?o+=`${i}, `:s&&(o+=" "),o+=r,"placeholder"in n&&typeof n.placeholder=="string")o+=`${this.flagOperator(t)}${n.placeholder}`;else{const u=this.flagParameter("type"in n?n.type:n);u&&(o+=`${this.flagOperator(t)}${u}`)}return o}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:r}=t;typeof r=="function"&&(r=r()),r&&(n+=` (default: ${this.flagDefault(r)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
|
|
21
21
|
`);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}},a(Jt,"_z"),Jt);se(Fa,"Renderers");let RD=Fa;const Fo=se(e=>e.length>0&&!e.includes(" "),"isValidScriptName"),{stringify:Xe}=JSON,PD=/[|\\{}()[\]^$+*?.]/;function vr(e){const t=[];let n,r;for(const s of e){if(r)throw new Error(`Invalid parameter: Spread parameter ${Xe(r)} must be last`);const i=s[0],o=s.at(-1);let u;if(i==="<"&&o===">"&&(u=!0,n))throw new Error(`Invalid parameter: Required parameter ${Xe(s)} cannot come after optional parameter ${Xe(n)}`);if(i==="["&&o==="]"&&(u=!1,n=s),u===void 0)throw new Error(`Invalid parameter: ${Xe(s)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let l=s.slice(1,-1);const c=l.slice(-3)==="...";c&&(r=s,l=l.slice(0,-3));const d=l.match(PD);if(d)throw new Error(`Invalid parameter: ${Xe(s)}. Invalid character found ${Xe(d[0])}`);t.push({name:l,required:u,spread:c})}return t}a(vr,"b$1"),se(vr,"parseParameters");function yr(e,t,n,r){for(let s=0;s<t.length;s+=1){const{name:i,required:o,spread:u}=t[s],l=ID(i);if(l in e)throw new Error(`Invalid parameter: ${Xe(i)} is used more than once.`);const c=u?n.slice(s):n[s];if(u&&(s=t.length),o&&(!c||u&&c.length===0))return console.error(`Error: Missing required parameter ${Xe(i)}
|
|
22
|
-
`),r(),process.exit(1);e[l]=c}}a(yr,"v"),se(yr,"mapParametersToArguments");function Ea(e){return e===void 0||e!==!1}a(Ea,"G$2"),se(Ea,"helpEnabled");function Eo(e,t,n,r){const s={...t.flags},i=t.version&&!("version"in s);i&&(s.version={type:Boolean,description:"Show version"});const{help:o}=t,u=Ea(o);u&&!("help"in s)&&(s.help={type:Boolean,alias:"h",description:"Show help"});const l=oD(s,r,{ignore:t.ignoreArgv}),c=se(()=>{console.log(t.version)},"showVersion");if(i&&l.flags.version===!0)return c(),process.exit(0);const d=new RD,p=u&&o?.render?o.render:g=>d.render(g),h=se(g=>{const v=TD({...t,...g?{help:g}:{},flags:s});console.log(p(v,d))},"showHelp");if(u&&l.flags.help===!0)return h(),process.exit(0);if(t.parameters){let{parameters:g}=t,v=l._;const F=g.indexOf("--"),C=g.slice(F+1),_=Object.create(null);if(F>-1&&C.length>0){g=g.slice(0,F);const b=l._["--"];v=v.slice(0,-b.length||void 0),yr(_,vr(g),v,h),yr(_,vr(C),b,h)}else yr(_,vr(g),v,h);Object.assign(l._,_)}const f={...l,showVersion:c,showHelp:h},D={command:e,...f};if(typeof n=="function"){const g=n(f);if(g&&"then"in g)return Object.assign(Promise.resolve(g),D)}return D}a(Eo,"j"),se(Eo,"cliBase");function Ca(e,t){const n=new Map;for(const r of t){const s=[r.options.name],{alias:i}=r.options;i&&(Array.isArray(i)?s.push(...i):s.push(i));for(const o of s){if(n.has(o))throw new Error(`Duplicate command name found: ${Xe(o)}`);n.set(o,r)}}return n.get(e)}a(Ca,"K$1"),se(Ca,"getCommand");function ba(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Fo(e.name)))throw new Error(`Invalid script name: ${Xe(e.name)}`);const r=n[0];if(e.commands&&r&&Fo(r)){const s=Ca(r,e.commands);if(s)return Eo(s.options.name,{...s.options,parent:e},s.callback,n.slice(1))}return Eo(void 0,e,t,n)}a(ba,"Q"),se(ba,"cli");function Mt(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Fo(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}a(Mt,"X"),se(Mt,"command");var ND="aicommits",MD="2.0.0-develop.2",jD="Writes your git commit messages for you with AI",zD=["ai","git","commit","code changes"],ZD="MIT",LD="Nutlope/aicommits",UD="Hassan El Mghari (@nutlope)",qD="module",VD=["dist"],GD={aicommits:"./dist/cli.mjs",aic:"./dist/cli.mjs"},WD={build:"pkgroll --minify",lint:"","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json"},HD={"@clack/prompts":"^0.11.0","@types/ini":"^1.3.31","@types/node":"^24.10.1","@types/update-notifier":"^6.0.8","clean-pkg-json":"^1.3.0",cleye:"^2.0.0",clipboardy:"^5.0.0",execa:"^7.0.0","fs-fixture":"^1.2.0",ini:"^3.0.1",kolorist:"^1.8.0",manten:"^0.7.0",ai:"^5.0.104","@ai-sdk/openai":"^2.0.74","@ai-sdk/openai-compatible":"^1.0.28",pkgroll:"^2.20.1",tsx:"^4.20.6",typescript:"^5.9.3"},JD={branches:["main",{name:"develop",prerelease:!0}]},KD={"update-notifier":"^7.3.1"},Co={name:ND,version:MD,description:jD,keywords:zD,license:ZD,repository:LD,author:UD,type:qD,files:VD,bin:GD,scripts:WD,devDependencies:HD,release:JD,dependencies:KD},ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}a(yt,"getDefaultExportFromCjs");var _t={exports:{}},bo,wa;function YD(){if(wa)return bo;wa=1,bo=r,r.sync=s;var e=Do;function t(i,o){var u=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!u||(u=u.split(";"),u.indexOf("")!==-1))return!0;for(var l=0;l<u.length;l++){var c=u[l].toLowerCase();if(c&&i.substr(-c.length).toLowerCase()===c)return!0}return!1}a(t,"checkPathExt");function n(i,o,u){return!i.isSymbolicLink()&&!i.isFile()?!1:t(o,u)}a(n,"checkStat");function r(i,o,u){e.stat(i,function(l,c){u(l,l?!1:n(c,i,o))})}a(r,"isexe");function s(i,o){return n(e.statSync(i),i,o)}return a(s,"sync"),bo}a(YD,"requireWindows");var wo,ka;function XD(){if(ka)return wo;ka=1,wo=t,t.sync=n;var e=Do;function t(i,o,u){e.stat(i,function(l,c){u(l,l?!1:r(c,o))})}a(t,"isexe");function n(i,o){return r(e.statSync(i),o)}a(n,"sync");function r(i,o){return i.isFile()&&s(i,o)}a(r,"checkStat");function s(i,o){var u=i.mode,l=i.uid,c=i.gid,d=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),p=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),h=parseInt("100",8),f=parseInt("010",8),D=parseInt("001",8),g=h|f,v=u&D||u&f&&c===p||u&h&&l===d||u&g&&d===0;return v}return a(s,"checkMode"),wo}a(XD,"requireMode");var ko,Aa;function QD(){if(Aa)return ko;Aa=1;var e;process.platform==="win32"||ct.TESTING_WINDOWS?e=YD():e=XD(),ko=t,t.sync=n;function t(r,s,i){if(typeof s=="function"&&(i=s,s={}),!i){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,u){t(r,s||{},function(l,c){l?u(l):o(c)})})}e(r,s||{},function(o,u){o&&(o.code==="EACCES"||s&&s.ignoreErrors)&&(o=null,u=!1),i(o,u)})}a(t,"isexe");function n(r,s){try{return e.sync(r,s||{})}catch(i){if(s&&s.ignoreErrors||i.code==="EACCES")return!1;throw i}}return a(n,"sync"),ko}a(QD,"requireIsexe");var Ao,xa;function ef(){if(xa)return Ao;xa=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=Ge,n=e?";":":",r=QD(),s=a(l=>Object.assign(new Error(`not found: ${l}`),{code:"ENOENT"}),"getNotFoundError"),i=a((l,c)=>{const d=c.colon||n,p=l.match(/\//)||e&&l.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(c.path||process.env.PATH||"").split(d)],h=e?c.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",f=e?h.split(d):[""];return e&&l.indexOf(".")!==-1&&f[0]!==""&&f.unshift(""),{pathEnv:p,pathExt:f,pathExtExe:h}},"getPathInfo"),o=a((l,c,d)=>{typeof c=="function"&&(d=c,c={}),c||(c={});const{pathEnv:p,pathExt:h,pathExtExe:f}=i(l,c),D=[],g=a(F=>new Promise((C,_)=>{if(F===p.length)return c.all&&D.length?C(D):_(s(l));const b=p[F],S=/^".*"$/.test(b)?b.slice(1,-1):b,T=t.join(S,l),B=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+T:T;C(v(B,F,0))}),"step"),v=a((F,C,_)=>new Promise((b,S)=>{if(_===h.length)return b(g(C+1));const T=h[_];r(F+T,{pathExt:f},(B,x)=>{if(!B&&x)if(c.all)D.push(F+T);else return b(F+T);return b(v(F,C,_+1))})}),"subStep");return d?g(0).then(F=>d(null,F),d):g(0)},"which"),u=a((l,c)=>{c=c||{};const{pathEnv:d,pathExt:p,pathExtExe:h}=i(l,c),f=[];for(let D=0;D<d.length;D++){const g=d[D],v=/^".*"$/.test(g)?g.slice(1,-1):g,F=t.join(v,l),C=!v&&/^\.[\\\/]/.test(l)?l.slice(0,2)+F:F;for(let _=0;_<p.length;_++){const b=C+p[_];try{if(r.sync(b,{pathExt:h}))if(c.all)f.push(b);else return b}catch{}}}if(c.all&&f.length)return f;if(c.nothrow)return null;throw s(l)},"whichSync");return Ao=o,o.sync=u,Ao}a(ef,"requireWhich");var _r={exports:{}},$a;function tf(){if($a)return _r.exports;$a=1;const e=a((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"},"pathKey");return _r.exports=e,_r.exports.default=e,_r.exports}a(tf,"requirePathKey");var xo,Ia;function nf(){if(Ia)return xo;Ia=1;const e=Ge,t=ef(),n=tf();function r(i,o){const u=i.options.env||process.env,l=process.cwd(),c=i.options.cwd!=null,d=c&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(i.options.cwd)}catch{}let p;try{p=t.sync(i.command,{path:u[n({env:u})],pathExt:o?e.delimiter:void 0})}catch{}finally{d&&process.chdir(l)}return p&&(p=e.resolve(c?i.options.cwd:"",p)),p}a(r,"resolveCommandAttempt");function s(i){return r(i)||r(i,!0)}return a(s,"resolveCommand"),xo=s,xo}a(nf,"requireResolveCommand");var Fr={},Ba;function rf(){if(Ba)return Fr;Ba=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(r){return r=r.replace(e,"^$1"),r}a(t,"escapeCommand");function n(r,s){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(e,"^$1"),s&&(r=r.replace(e,"^$1")),r}return a(n,"escapeArgument"),Fr.command=t,Fr.argument=n,Fr}a(rf,"require_escape");var $o,Sa;function of(){return Sa||(Sa=1,$o=/^#!(.*)/),$o}a(of,"requireShebangRegex");var Io,Ta;function sf(){if(Ta)return Io;Ta=1;const e=of();return Io=a((t="")=>{const n=t.match(e);if(!n)return null;const[r,s]=n[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?s:s?`${i} ${s}`:i},"shebangCommand"),Io}a(sf,"requireShebangCommand");var Bo,Oa;function af(){if(Oa)return Bo;Oa=1;const e=Do,t=sf();function n(r){const i=Buffer.alloc(150);let o;try{o=e.openSync(r,"r"),e.readSync(o,i,0,150,0),e.closeSync(o)}catch{}return t(i.toString())}return a(n,"readShebang"),Bo=n,Bo}a(af,"requireReadShebang");var So,Ra;function uf(){if(Ra)return So;Ra=1;const e=Ge,t=nf(),n=rf(),r=af(),s=process.platform==="win32",i=/\.(?:com|exe)$/i,o=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(d){d.file=t(d);const p=d.file&&r(d.file);return p?(d.args.unshift(d.file),d.command=p,t(d)):d.file}a(u,"detectShebang");function l(d){if(!s)return d;const p=u(d),h=!i.test(p);if(d.options.forceShell||h){const f=o.test(p);d.command=e.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(g=>n.argument(g,f));const D=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${D}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}a(l,"parseNonShell");function c(d,p,h){p&&!Array.isArray(p)&&(h=p,p=null),p=p?p.slice(0):[],h=Object.assign({},h);const f={command:d,args:p,options:h,file:void 0,original:{command:d,args:p}};return h.shell?f:l(f)}return a(c,"parse"),So=c,So}a(uf,"requireParse");var To,Pa;function lf(){if(Pa)return To;Pa=1;const e=process.platform==="win32";function t(i,o){return Object.assign(new Error(`${o} ${i.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${o} ${i.command}`,path:i.command,spawnargs:i.args})}a(t,"notFoundError");function n(i,o){if(!e)return;const u=i.emit;i.emit=function(l,c){if(l==="exit"){const d=r(c,o);if(d)return u.call(i,"error",d)}return u.apply(i,arguments)}}a(n,"hookChildProcess");function r(i,o){return e&&i===1&&!o.file?t(o.original,"spawn"):null}a(r,"verifyENOENT");function s(i,o){return e&&i===1&&!o.file?t(o.original,"spawnSync"):null}return a(s,"verifyENOENTSync"),To={hookChildProcess:n,verifyENOENT:r,verifyENOENTSync:s,notFoundError:t},To}a(lf,"requireEnoent");var Na;function cf(){if(Na)return _t.exports;Na=1;const e=Sp,t=uf(),n=lf();function r(i,o,u){const l=t(i,o,u),c=e.spawn(l.command,l.args,l.options);return n.hookChildProcess(c,l),c}a(r,"spawn");function s(i,o,u){const l=t(i,o,u),c=e.spawnSync(l.command,l.args,l.options);return c.error=c.error||n.verifyENOENTSync(c.status,l),c}return a(s,"spawnSync"),_t.exports=r,_t.exports.spawn=r,_t.exports.sync=s,_t.exports._parse=t,_t.exports._enoent=n,_t.exports}a(cf,"requireCrossSpawn");var df=cf(),pf=yt(df);function Df(e){const t=typeof e=="string"?`
|
|
22
|
+
`),r(),process.exit(1);e[l]=c}}a(yr,"v"),se(yr,"mapParametersToArguments");function Ea(e){return e===void 0||e!==!1}a(Ea,"G$2"),se(Ea,"helpEnabled");function Eo(e,t,n,r){const s={...t.flags},i=t.version&&!("version"in s);i&&(s.version={type:Boolean,description:"Show version"});const{help:o}=t,u=Ea(o);u&&!("help"in s)&&(s.help={type:Boolean,alias:"h",description:"Show help"});const l=oD(s,r,{ignore:t.ignoreArgv}),c=se(()=>{console.log(t.version)},"showVersion");if(i&&l.flags.version===!0)return c(),process.exit(0);const d=new RD,p=u&&o?.render?o.render:g=>d.render(g),h=se(g=>{const v=TD({...t,...g?{help:g}:{},flags:s});console.log(p(v,d))},"showHelp");if(u&&l.flags.help===!0)return h(),process.exit(0);if(t.parameters){let{parameters:g}=t,v=l._;const F=g.indexOf("--"),C=g.slice(F+1),_=Object.create(null);if(F>-1&&C.length>0){g=g.slice(0,F);const b=l._["--"];v=v.slice(0,-b.length||void 0),yr(_,vr(g),v,h),yr(_,vr(C),b,h)}else yr(_,vr(g),v,h);Object.assign(l._,_)}const f={...l,showVersion:c,showHelp:h},D={command:e,...f};if(typeof n=="function"){const g=n(f);if(g&&"then"in g)return Object.assign(Promise.resolve(g),D)}return D}a(Eo,"j"),se(Eo,"cliBase");function Ca(e,t){const n=new Map;for(const r of t){const s=[r.options.name],{alias:i}=r.options;i&&(Array.isArray(i)?s.push(...i):s.push(i));for(const o of s){if(n.has(o))throw new Error(`Duplicate command name found: ${Xe(o)}`);n.set(o,r)}}return n.get(e)}a(Ca,"K$1"),se(Ca,"getCommand");function ba(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Fo(e.name)))throw new Error(`Invalid script name: ${Xe(e.name)}`);const r=n[0];if(e.commands&&r&&Fo(r)){const s=Ca(r,e.commands);if(s)return Eo(s.options.name,{...s.options,parent:e},s.callback,n.slice(1))}return Eo(void 0,e,t,n)}a(ba,"Q"),se(ba,"cli");function Mt(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Fo(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}a(Mt,"X"),se(Mt,"command");var ND="aicommits",MD="2.0.0-develop.3",jD="Writes your git commit messages for you with AI",zD=["ai","git","commit","code changes"],ZD="MIT",LD="Nutlope/aicommits",UD="Hassan El Mghari (@nutlope)",qD="module",VD=["dist"],GD={aicommits:"./dist/cli.mjs",aic:"./dist/cli.mjs"},WD={build:"pkgroll --minify",lint:"","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json"},HD={"@clack/prompts":"^0.11.0","@types/ini":"^1.3.31","@types/node":"^24.10.1","@types/update-notifier":"^6.0.8","clean-pkg-json":"^1.3.0",cleye:"^2.0.0",clipboardy:"^5.0.0",execa:"^7.0.0","fs-fixture":"^1.2.0",ini:"^3.0.1",kolorist:"^1.8.0",manten:"^0.7.0",ai:"^5.0.104","@ai-sdk/openai":"^2.0.74","@ai-sdk/openai-compatible":"^1.0.28",pkgroll:"^2.20.1",tsx:"^4.20.6",typescript:"^5.9.3"},JD={branches:["main",{name:"develop",prerelease:!0}]},KD={"update-notifier":"^7.3.1"},Co={name:ND,version:MD,description:jD,keywords:zD,license:ZD,repository:LD,author:UD,type:qD,files:VD,bin:GD,scripts:WD,devDependencies:HD,release:JD,dependencies:KD},ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}a(yt,"getDefaultExportFromCjs");var _t={exports:{}},bo,wa;function YD(){if(wa)return bo;wa=1,bo=r,r.sync=s;var e=Do;function t(i,o){var u=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!u||(u=u.split(";"),u.indexOf("")!==-1))return!0;for(var l=0;l<u.length;l++){var c=u[l].toLowerCase();if(c&&i.substr(-c.length).toLowerCase()===c)return!0}return!1}a(t,"checkPathExt");function n(i,o,u){return!i.isSymbolicLink()&&!i.isFile()?!1:t(o,u)}a(n,"checkStat");function r(i,o,u){e.stat(i,function(l,c){u(l,l?!1:n(c,i,o))})}a(r,"isexe");function s(i,o){return n(e.statSync(i),i,o)}return a(s,"sync"),bo}a(YD,"requireWindows");var wo,ka;function XD(){if(ka)return wo;ka=1,wo=t,t.sync=n;var e=Do;function t(i,o,u){e.stat(i,function(l,c){u(l,l?!1:r(c,o))})}a(t,"isexe");function n(i,o){return r(e.statSync(i),o)}a(n,"sync");function r(i,o){return i.isFile()&&s(i,o)}a(r,"checkStat");function s(i,o){var u=i.mode,l=i.uid,c=i.gid,d=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),p=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),h=parseInt("100",8),f=parseInt("010",8),D=parseInt("001",8),g=h|f,v=u&D||u&f&&c===p||u&h&&l===d||u&g&&d===0;return v}return a(s,"checkMode"),wo}a(XD,"requireMode");var ko,Aa;function QD(){if(Aa)return ko;Aa=1;var e;process.platform==="win32"||ct.TESTING_WINDOWS?e=YD():e=XD(),ko=t,t.sync=n;function t(r,s,i){if(typeof s=="function"&&(i=s,s={}),!i){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,u){t(r,s||{},function(l,c){l?u(l):o(c)})})}e(r,s||{},function(o,u){o&&(o.code==="EACCES"||s&&s.ignoreErrors)&&(o=null,u=!1),i(o,u)})}a(t,"isexe");function n(r,s){try{return e.sync(r,s||{})}catch(i){if(s&&s.ignoreErrors||i.code==="EACCES")return!1;throw i}}return a(n,"sync"),ko}a(QD,"requireIsexe");var Ao,xa;function ef(){if(xa)return Ao;xa=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=Ge,n=e?";":":",r=QD(),s=a(l=>Object.assign(new Error(`not found: ${l}`),{code:"ENOENT"}),"getNotFoundError"),i=a((l,c)=>{const d=c.colon||n,p=l.match(/\//)||e&&l.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(c.path||process.env.PATH||"").split(d)],h=e?c.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",f=e?h.split(d):[""];return e&&l.indexOf(".")!==-1&&f[0]!==""&&f.unshift(""),{pathEnv:p,pathExt:f,pathExtExe:h}},"getPathInfo"),o=a((l,c,d)=>{typeof c=="function"&&(d=c,c={}),c||(c={});const{pathEnv:p,pathExt:h,pathExtExe:f}=i(l,c),D=[],g=a(F=>new Promise((C,_)=>{if(F===p.length)return c.all&&D.length?C(D):_(s(l));const b=p[F],S=/^".*"$/.test(b)?b.slice(1,-1):b,T=t.join(S,l),B=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+T:T;C(v(B,F,0))}),"step"),v=a((F,C,_)=>new Promise((b,S)=>{if(_===h.length)return b(g(C+1));const T=h[_];r(F+T,{pathExt:f},(B,x)=>{if(!B&&x)if(c.all)D.push(F+T);else return b(F+T);return b(v(F,C,_+1))})}),"subStep");return d?g(0).then(F=>d(null,F),d):g(0)},"which"),u=a((l,c)=>{c=c||{};const{pathEnv:d,pathExt:p,pathExtExe:h}=i(l,c),f=[];for(let D=0;D<d.length;D++){const g=d[D],v=/^".*"$/.test(g)?g.slice(1,-1):g,F=t.join(v,l),C=!v&&/^\.[\\\/]/.test(l)?l.slice(0,2)+F:F;for(let _=0;_<p.length;_++){const b=C+p[_];try{if(r.sync(b,{pathExt:h}))if(c.all)f.push(b);else return b}catch{}}}if(c.all&&f.length)return f;if(c.nothrow)return null;throw s(l)},"whichSync");return Ao=o,o.sync=u,Ao}a(ef,"requireWhich");var _r={exports:{}},$a;function tf(){if($a)return _r.exports;$a=1;const e=a((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"},"pathKey");return _r.exports=e,_r.exports.default=e,_r.exports}a(tf,"requirePathKey");var xo,Ia;function nf(){if(Ia)return xo;Ia=1;const e=Ge,t=ef(),n=tf();function r(i,o){const u=i.options.env||process.env,l=process.cwd(),c=i.options.cwd!=null,d=c&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(i.options.cwd)}catch{}let p;try{p=t.sync(i.command,{path:u[n({env:u})],pathExt:o?e.delimiter:void 0})}catch{}finally{d&&process.chdir(l)}return p&&(p=e.resolve(c?i.options.cwd:"",p)),p}a(r,"resolveCommandAttempt");function s(i){return r(i)||r(i,!0)}return a(s,"resolveCommand"),xo=s,xo}a(nf,"requireResolveCommand");var Fr={},Ba;function rf(){if(Ba)return Fr;Ba=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(r){return r=r.replace(e,"^$1"),r}a(t,"escapeCommand");function n(r,s){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(e,"^$1"),s&&(r=r.replace(e,"^$1")),r}return a(n,"escapeArgument"),Fr.command=t,Fr.argument=n,Fr}a(rf,"require_escape");var $o,Sa;function of(){return Sa||(Sa=1,$o=/^#!(.*)/),$o}a(of,"requireShebangRegex");var Io,Ta;function sf(){if(Ta)return Io;Ta=1;const e=of();return Io=a((t="")=>{const n=t.match(e);if(!n)return null;const[r,s]=n[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?s:s?`${i} ${s}`:i},"shebangCommand"),Io}a(sf,"requireShebangCommand");var Bo,Oa;function af(){if(Oa)return Bo;Oa=1;const e=Do,t=sf();function n(r){const i=Buffer.alloc(150);let o;try{o=e.openSync(r,"r"),e.readSync(o,i,0,150,0),e.closeSync(o)}catch{}return t(i.toString())}return a(n,"readShebang"),Bo=n,Bo}a(af,"requireReadShebang");var So,Ra;function uf(){if(Ra)return So;Ra=1;const e=Ge,t=nf(),n=rf(),r=af(),s=process.platform==="win32",i=/\.(?:com|exe)$/i,o=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(d){d.file=t(d);const p=d.file&&r(d.file);return p?(d.args.unshift(d.file),d.command=p,t(d)):d.file}a(u,"detectShebang");function l(d){if(!s)return d;const p=u(d),h=!i.test(p);if(d.options.forceShell||h){const f=o.test(p);d.command=e.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(g=>n.argument(g,f));const D=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${D}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}a(l,"parseNonShell");function c(d,p,h){p&&!Array.isArray(p)&&(h=p,p=null),p=p?p.slice(0):[],h=Object.assign({},h);const f={command:d,args:p,options:h,file:void 0,original:{command:d,args:p}};return h.shell?f:l(f)}return a(c,"parse"),So=c,So}a(uf,"requireParse");var To,Pa;function lf(){if(Pa)return To;Pa=1;const e=process.platform==="win32";function t(i,o){return Object.assign(new Error(`${o} ${i.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${o} ${i.command}`,path:i.command,spawnargs:i.args})}a(t,"notFoundError");function n(i,o){if(!e)return;const u=i.emit;i.emit=function(l,c){if(l==="exit"){const d=r(c,o);if(d)return u.call(i,"error",d)}return u.apply(i,arguments)}}a(n,"hookChildProcess");function r(i,o){return e&&i===1&&!o.file?t(o.original,"spawn"):null}a(r,"verifyENOENT");function s(i,o){return e&&i===1&&!o.file?t(o.original,"spawnSync"):null}return a(s,"verifyENOENTSync"),To={hookChildProcess:n,verifyENOENT:r,verifyENOENTSync:s,notFoundError:t},To}a(lf,"requireEnoent");var Na;function cf(){if(Na)return _t.exports;Na=1;const e=Sp,t=uf(),n=lf();function r(i,o,u){const l=t(i,o,u),c=e.spawn(l.command,l.args,l.options);return n.hookChildProcess(c,l),c}a(r,"spawn");function s(i,o,u){const l=t(i,o,u),c=e.spawnSync(l.command,l.args,l.options);return c.error=c.error||n.verifyENOENTSync(c.status,l),c}return a(s,"spawnSync"),_t.exports=r,_t.exports.spawn=r,_t.exports.sync=s,_t.exports._parse=t,_t.exports._enoent=n,_t.exports}a(cf,"requireCrossSpawn");var df=cf(),pf=yt(df);function Df(e){const t=typeof e=="string"?`
|
|
23
23
|
`:10,n=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}a(Df,"stripFinalNewline");function Ma(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}a(Ma,"pathKey");const ff=a(({cwd:e=me.cwd(),path:t=me.env[Ma()],preferLocal:n=!0,execPath:r=me.execPath,addExecPath:s=!0}={})=>{const i=e instanceof URL?Pi(e):e,o=Nt.resolve(i),u=[];return n&&mf(u,o),s&&hf(u,r,o),[...u,t].join(Nt.delimiter)},"npmRunPath"),mf=a((e,t)=>{let n;for(;n!==t;)e.push(Nt.join(t,"node_modules/.bin")),n=t,t=Nt.resolve(t,"..")},"applyPreferLocal"),hf=a((e,t,n)=>{const r=t instanceof URL?Pi(t):t;e.push(Nt.resolve(n,r,".."))},"applyExecPath"),gf=a(({env:e=me.env,...t}={})=>{e={...e};const n=Ma({env:e});return t.path=e[n],e[n]=ff(t),e},"npmRunPathEnv"),vf=a((e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const s=Object.getOwnPropertyDescriptor(e,n),i=Object.getOwnPropertyDescriptor(t,n);!yf(s,i)&&r||Object.defineProperty(e,n,i)},"copyProperty"),yf=a(function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},"canCopyProperty"),_f=a((e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},"changePrototype"),Ff=a((e,t)=>`/* Wrapped ${e}*/
|
|
24
24
|
${t}`,"wrappedToString"),Ef=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Cf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),bf=a((e,t,n)=>{const r=n===""?"":`with ${n.trim()}() `,s=Ff.bind(null,r,t.toString());Object.defineProperty(s,"name",Cf),Object.defineProperty(e,"toString",{...Ef,value:s})},"changeToString");function wf(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:r}=e;for(const s of Reflect.ownKeys(t))vf(e,t,s,n);return _f(e,t),bf(e,t,r),e}a(wf,"mimicFunction");const Er=new WeakMap,ja=a((e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0;const s=e.displayName||e.name||"<anonymous>",i=a(function(...o){if(Er.set(i,++r),r===1)n=e.apply(this,o),e=null;else if(t.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return n},"onetime2");return wf(i,e),Er.set(i,r),i},"onetime");ja.callCount=e=>{if(!Er.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Er.get(e)};const kf=a(()=>{const e=Za-za+1;return Array.from({length:e},Af)},"getRealtimeSignals"),Af=a((e,t)=>({name:`SIGRT${t+1}`,number:za+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),"getRealtimeSignal"),za=34,Za=64,xf=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],La=a(()=>{const e=kf();return[...xf,...e].map($f)},"getSignals"),$f=a(({name:e,number:t,description:n,action:r,forced:s=!1,standard:i})=>{const{signals:{[e]:o}}=Ni,u=o!==void 0;return{name:e,number:u?o:t,description:n,supported:u,action:r,forced:s,standard:i}},"normalizeSignal"),If=a(()=>{const e=La();return Object.fromEntries(e.map(Bf))},"getSignalsByName"),Bf=a(({name:e,number:t,description:n,supported:r,action:s,forced:i,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:s,forced:i,standard:o}],"getSignalByName"),Sf=If(),Tf=a(()=>{const e=La(),t=Za+1,n=Array.from({length:t},(r,s)=>Of(s,e));return Object.assign({},...n)},"getSignalsByNumber"),Of=a((e,t)=>{const n=Rf(e,t);if(n===void 0)return{};const{name:r,description:s,supported:i,action:o,forced:u,standard:l}=n;return{[e]:{name:r,number:e,description:s,supported:i,action:o,forced:u,standard:l}}},"getSignalByNumber"),Rf=a((e,t)=>{const n=t.find(({name:r})=>Ni.signals[r]===e);return n!==void 0?n:t.find(r=>r.number===e)},"findSignalByNumber");Tf();const Pf=a(({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:s,exitCode:i,isCanceled:o})=>e?`timed out after ${t} milliseconds`:o?"was canceled":n!==void 0?`failed with ${n}`:r!==void 0?`was killed with ${r} (${s})`:i!==void 0?`failed with exit code ${i}`:"failed","getErrorPrefix"),Ua=a(({stdout:e,stderr:t,all:n,error:r,signal:s,exitCode:i,command:o,escapedCommand:u,timedOut:l,isCanceled:c,killed:d,parsed:{options:{timeout:p,cwd:h=me.cwd()}}})=>{i=i===null?void 0:i,s=s===null?void 0:s;const f=s===void 0?void 0:Sf[s].description,D=r&&r.code,v=`Command ${Pf({timedOut:l,timeout:p,errorCode:D,signal:s,signalDescription:f,exitCode:i,isCanceled:c})}: ${o}`,F=Object.prototype.toString.call(r)==="[object Error]",C=F?`${v}
|
|
25
25
|
${r.message}`:v,_=[C,t,e].filter(Boolean).join(`
|
|
@@ -118,7 +118,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
118
118
|
]))`;continue}else if(s[c]==="$"){i+=`($|(?=[\r
|
|
119
119
|
]))`;continue}}if(r.s&&s[c]==="."){i+=u?`${s[c]}\r
|
|
120
120
|
`:`[${s[c]}\r
|
|
121
|
-
]`;continue}i+=s[c],s[c]==="\\"?o=!0:u&&s[c]==="]"?u=!1:!u&&s[c]==="["&&(u=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}a(Dc,"stringifyRegExpWithFlags");function fc(e,t){var n,r,s,i,o,u;const l={type:"object",additionalProperties:(n=Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===M.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:c,...d}=pc(e.keyType._def,t);return{...l,propertyNames:d}}else{if(((i=e.keyType)==null?void 0:i._def.typeName)===M.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===M.ZodBranded&&e.keyType._def.type._def.typeName===M.ZodString&&((u=e.keyType._def.type._def.checks)!=null&&u.length)){const{type:c,...d}=cc(e.keyType._def,t);return{...l,propertyNames:d}}}return l}a(fc,"parseRecordDef");function N_(e,t){if(t.mapStrategy==="record")return fc(e,t);const n=Q(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ze(),r=Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ze();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}a(N_,"parseMapDef");function M_(e){const t=e.values,r=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),s=Array.from(new Set(r.map(i=>typeof i)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r}}a(M_,"parseNativeEnumDef");function j_(){return{not:Ze()}}a(j_,"parseNeverDef");function z_(){return{type:"null"}}a(z_,"parseNullDef");var Ss={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Z_(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Ss&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((s,i)=>{const o=Ss[i._def.typeName];return o&&!s.includes(o)?[...s,o]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((s,i)=>{const o=typeof i._def.value;switch(o){case"string":case"number":case"boolean":return[...s,o];case"bigint":return[...s,"integer"];case"object":if(i._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(r.length===n.length){const s=r.filter((i,o,u)=>u.indexOf(i)===o);return{type:s.length>1?s:s[0],enum:n.reduce((i,o)=>i.includes(o._def.value)?i:[...i,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(i=>!r.includes(i))],[])};return L_(e,t)}a(Z_,"parseUnionDef");var L_=a((e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>Q(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0},"asAnyOf");function U_(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Ss[e.innerType._def.typeName],"null"]};const n=Q(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}a(U_,"parseNullableDef");function q_(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}a(q_,"parseNumberDef");function V_(e,t){const n={type:"object",properties:{}},r=[],s=e.shape();for(const o in s){let u=s[o];if(u===void 0||u._def===void 0)continue;const l=W_(u),c=Q(u._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});c!==void 0&&(n.properties[o]=c,l||r.push(o))}r.length&&(n.required=r);const i=G_(e,t);return i!==void 0&&(n.additionalProperties=i),n}a(V_,"parseObjectDef");function G_(e,t){if(e.catchall._def.typeName!=="ZodNever")return Q(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}a(G_,"decideAdditionalProperties");function W_(e){try{return e.isOptional()}catch{return!0}}a(W_,"safeIsOptional");var H_=a((e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Q(e.innerType._def,t);const r=Q(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ze()},r]}:Ze()},"parseOptionalDef"),J_=a((e,t)=>{if(t.pipeStrategy==="input")return Q(e.in._def,t);if(t.pipeStrategy==="output")return Q(e.out._def,t);const n=Q(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Q(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(s=>s!==void 0)}},"parsePipelineDef");function K_(e,t){return Q(e.type._def,t)}a(K_,"parsePromiseDef");function Y_(e,t){const r={type:"array",uniqueItems:!0,items:Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}a(Y_,"parseSetDef");function X_(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Q(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Q(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Q(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}a(X_,"parseTupleDef");function Q_(){return{not:Ze()}}a(Q_,"parseUndefinedDef");function e2(){return Ze()}a(e2,"parseUnknownDef");var t2=a((e,t)=>Q(e.innerType._def,t),"parseReadonlyDef"),n2=a((e,t,n)=>{switch(t){case M.ZodString:return pc(e,n);case M.ZodNumber:return q_(e);case M.ZodObject:return V_(e,n);case M.ZodBigInt:return w_(e);case M.ZodBoolean:return k_();case M.ZodDate:return dc(e,n);case M.ZodUndefined:return Q_();case M.ZodNull:return z_();case M.ZodArray:return b_(e,n);case M.ZodUnion:case M.ZodDiscriminatedUnion:return Z_(e,n);case M.ZodIntersection:return T_(e,n);case M.ZodTuple:return X_(e,n);case M.ZodRecord:return fc(e,n);case M.ZodLiteral:return O_(e);case M.ZodEnum:return B_(e);case M.ZodNativeEnum:return M_(e);case M.ZodNullable:return U_(e,n);case M.ZodOptional:return H_(e,n);case M.ZodMap:return N_(e,n);case M.ZodSet:return Y_(e,n);case M.ZodLazy:return()=>e.getter()._def;case M.ZodPromise:return K_(e,n);case M.ZodNaN:case M.ZodNever:return j_();case M.ZodEffects:return I_(e,n);case M.ZodAny:return Ze();case M.ZodUnknown:return e2();case M.ZodDefault:return $_(e,n);case M.ZodBranded:return cc(e,n);case M.ZodReadonly:return t2(e,n);case M.ZodCatch:return A_(e,n);case M.ZodPipeline:return J_(e,n);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return(r=>{})()}},"selectParser");function Q(e,t,n=!1){var r;const s=t.seen.get(e);if(t.override){const l=(r=t.override)==null?void 0:r.call(t,e,t,s,n);if(l!==E_)return l}if(s&&!n){const l=r2(s,t);if(l!==void 0)return l}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const o=n2(e,e.typeName,t),u=typeof o=="function"?Q(o(),t):o;if(u&&o2(e,t,u),t.postProcess){const l=t.postProcess(u,e,t);return i.jsonSchema=u,l}return i.jsonSchema=u,u}a(Q,"parseDef");var r2=a((e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:F_(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ze()):t.$refStrategy==="seen"?Ze():void 0}},"get$ref"),o2=a((e,t,n)=>(e.description&&(n.description=e.description),n),"addMeta"),s2=a(e=>{const t=C_(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},"getRefs"),i2=a((e,t)=>{var n;const r=s2(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[d,p])=>{var h;return{...c,[d]:(h=Q(p._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:Ze()}},{}):void 0;const i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=(n=Q(e._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1))!=null?n:Ze(),u=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;u!==void 0&&(o.title=u);const l=i===void 0?s?{...o,[r.definitionPath]:s}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...s,[i]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},"zodToJsonSchema"),a2=i2;function u2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Os(()=>a2(e,{$refStrategy:r?"root":"none"}),{validate:a(async s=>{const i=await e.safeParseAsync(s);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}},"validate")})}a(u2,"zod3Schema");function l2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Os(()=>V0(e,{target:"draft-7",io:"output",reused:r?"ref":"inline"}),{validate:a(async s=>{const i=await Vl(e,s);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}},"validate")})}a(l2,"zod4Schema");function c2(e){return"_zod"in e}a(c2,"isZod4Schema");function U(e,t){return c2(e)?l2(e):u2(e)}a(U,"zodSchema");var Ts=Symbol.for("vercel.ai.schema");function Ie(e){let t;return()=>(t==null&&(t=e()),t)}a(Ie,"lazySchema");function Os(e,{validate:t}={}){return{[Ts]:!0,_type:void 0,[Kr]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}a(Os,"jsonSchema");function d2(e){return typeof e=="object"&&e!==null&&Ts in e&&e[Ts]===!0&&"jsonSchema"in e&&"validate"in e}a(d2,"isSchema");function Xr(e){return e==null?Os({properties:{},additionalProperties:!1}):d2(e)?e:typeof e=="function"?e():U(e)}a(Xr,"asSchema");var{btoa:p2,atob:D2}=globalThis;function Qr(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=D2(t);return Uint8Array.from(n,r=>r.codePointAt(0))}a(Qr,"convertBase64ToUint8Array");function eo(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCodePoint(e[n]);return p2(t)}a(eo,"convertUint8ArrayToBase64");function Bt(e){return e instanceof Uint8Array?eo(e):e}a(Bt,"convertToBase64");function Rs(e){return e?.replace(/\/$/,"")}a(Rs,"withoutTrailingSlash");function f2(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}a(f2,"isAsyncIterable");async function*m2({execute:e,input:t,options:n}){const r=e(t,n);if(f2(r)){let s;for await(const i of r)s=i,yield{type:"preliminary",output:i};yield{type:"final",output:s}}else yield{type:"final",output:await r}}a(m2,"executeTool");var Ps,mc;function hc(){if(mc)return Ps;mc=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((d,p)=>{for(var h in p)e(d,h,{get:p[h],enumerable:!0})},"__export"),i=a((d,p,h,f)=>{if(p&&typeof p=="object"||typeof p=="function")for(let D of n(p))!r.call(d,D)&&D!==h&&e(d,D,{get:a(()=>p[D],"get"),enumerable:!(f=t(p,D))||f.enumerable});return d},"__copyProps"),o=a(d=>i(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};s(u,{SYMBOL_FOR_REQ_CONTEXT:a(()=>l,"SYMBOL_FOR_REQ_CONTEXT"),getContext:a(()=>c,"getContext")}),Ps=o(u);const l=Symbol.for("@vercel/request-context");function c(){return globalThis[l]?.get?.()??{}}return a(c,"getContext"),Ps}a(hc,"requireGetContext");var Ns,gc;function vc(){if(gc)return Ns;gc=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((d,p)=>{for(var h in p)e(d,h,{get:p[h],enumerable:!0})},"__export"),i=a((d,p,h,f)=>{if(p&&typeof p=="object"||typeof p=="function")for(let D of n(p))!r.call(d,D)&&D!==h&&e(d,D,{get:a(()=>p[D],"get"),enumerable:!(f=t(p,D))||f.enumerable});return d},"__copyProps"),o=a(d=>i(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};s(u,{VercelOidcTokenError:a(()=>l,"VercelOidcTokenError")}),Ns=o(u);const c=class c extends Error{constructor(p,h){super(p),this.name="VercelOidcTokenError",this.cause=h}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};a(c,"VercelOidcTokenError");let l=c;return Ns}a(vc,"requireTokenError");var Ms,yc;function h2(){if(yc)return Ms;yc=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((h,f)=>{for(var D in f)e(h,D,{get:f[D],enumerable:!0})},"__export"),i=a((h,f,D,g)=>{if(f&&typeof f=="object"||typeof f=="function")for(let v of n(f))!r.call(h,v)&&v!==D&&e(h,v,{get:a(()=>f[v],"get"),enumerable:!(g=t(f,v))||g.enumerable});return h},"__copyProps"),o=a(h=>i(e({},"__esModule",{value:!0}),h),"__toCommonJS"),u={};s(u,{getVercelOidcToken:a(()=>d,"getVercelOidcToken"),getVercelOidcTokenSync:a(()=>p,"getVercelOidcTokenSync")}),Ms=o(u);var l=hc(),c=vc();async function d(){let h="",f;try{h=p()}catch(D){f=D}try{const[{getTokenPayload:D,isExpired:g},{refreshToken:v}]=await Promise.all([await import("./token-util-DvcpPQUZ.mjs").then(function(F){return F.t}),await import("./token-BcjwApjJ.mjs").then(function(F){return F.t})]);(!h||g(D(h)))&&(await v(),h=p())}catch(D){throw f?.message&&D instanceof Error&&(D.message=`${f.message}
|
|
121
|
+
]`;continue}i+=s[c],s[c]==="\\"?o=!0:u&&s[c]==="]"?u=!1:!u&&s[c]==="["&&(u=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}a(Dc,"stringifyRegExpWithFlags");function fc(e,t){var n,r,s,i,o,u;const l={type:"object",additionalProperties:(n=Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===M.ZodString&&((s=e.keyType._def.checks)!=null&&s.length)){const{type:c,...d}=pc(e.keyType._def,t);return{...l,propertyNames:d}}else{if(((i=e.keyType)==null?void 0:i._def.typeName)===M.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===M.ZodBranded&&e.keyType._def.type._def.typeName===M.ZodString&&((u=e.keyType._def.type._def.checks)!=null&&u.length)){const{type:c,...d}=cc(e.keyType._def,t);return{...l,propertyNames:d}}}return l}a(fc,"parseRecordDef");function N_(e,t){if(t.mapStrategy==="record")return fc(e,t);const n=Q(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ze(),r=Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ze();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}a(N_,"parseMapDef");function M_(e){const t=e.values,r=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),s=Array.from(new Set(r.map(i=>typeof i)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:r}}a(M_,"parseNativeEnumDef");function j_(){return{not:Ze()}}a(j_,"parseNeverDef");function z_(){return{type:"null"}}a(z_,"parseNullDef");var Ss={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Z_(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Ss&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((s,i)=>{const o=Ss[i._def.typeName];return o&&!s.includes(o)?[...s,o]:s},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((s,i)=>{const o=typeof i._def.value;switch(o){case"string":case"number":case"boolean":return[...s,o];case"bigint":return[...s,"integer"];case"object":if(i._def.value===null)return[...s,"null"];case"symbol":case"undefined":case"function":default:return s}},[]);if(r.length===n.length){const s=r.filter((i,o,u)=>u.indexOf(i)===o);return{type:s.length>1?s:s[0],enum:n.reduce((i,o)=>i.includes(o._def.value)?i:[...i,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,s)=>[...r,...s._def.values.filter(i=>!r.includes(i))],[])};return L_(e,t)}a(Z_,"parseUnionDef");var L_=a((e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,s)=>Q(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${s}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0},"asAnyOf");function U_(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Ss[e.innerType._def.typeName],"null"]};const n=Q(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}a(U_,"parseNullableDef");function q_(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}a(q_,"parseNumberDef");function V_(e,t){const n={type:"object",properties:{}},r=[],s=e.shape();for(const o in s){let u=s[o];if(u===void 0||u._def===void 0)continue;const l=W_(u),c=Q(u._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});c!==void 0&&(n.properties[o]=c,l||r.push(o))}r.length&&(n.required=r);const i=G_(e,t);return i!==void 0&&(n.additionalProperties=i),n}a(V_,"parseObjectDef");function G_(e,t){if(e.catchall._def.typeName!=="ZodNever")return Q(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}a(G_,"decideAdditionalProperties");function W_(e){try{return e.isOptional()}catch{return!0}}a(W_,"safeIsOptional");var H_=a((e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Q(e.innerType._def,t);const r=Q(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ze()},r]}:Ze()},"parseOptionalDef"),J_=a((e,t)=>{if(t.pipeStrategy==="input")return Q(e.in._def,t);if(t.pipeStrategy==="output")return Q(e.out._def,t);const n=Q(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Q(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(s=>s!==void 0)}},"parsePipelineDef");function K_(e,t){return Q(e.type._def,t)}a(K_,"parsePromiseDef");function Y_(e,t){const r={type:"array",uniqueItems:!0,items:Q(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}a(Y_,"parseSetDef");function X_(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Q(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Q(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Q(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}a(X_,"parseTupleDef");function Q_(){return{not:Ze()}}a(Q_,"parseUndefinedDef");function e2(){return Ze()}a(e2,"parseUnknownDef");var t2=a((e,t)=>Q(e.innerType._def,t),"parseReadonlyDef"),n2=a((e,t,n)=>{switch(t){case M.ZodString:return pc(e,n);case M.ZodNumber:return q_(e);case M.ZodObject:return V_(e,n);case M.ZodBigInt:return w_(e);case M.ZodBoolean:return k_();case M.ZodDate:return dc(e,n);case M.ZodUndefined:return Q_();case M.ZodNull:return z_();case M.ZodArray:return b_(e,n);case M.ZodUnion:case M.ZodDiscriminatedUnion:return Z_(e,n);case M.ZodIntersection:return T_(e,n);case M.ZodTuple:return X_(e,n);case M.ZodRecord:return fc(e,n);case M.ZodLiteral:return O_(e);case M.ZodEnum:return B_(e);case M.ZodNativeEnum:return M_(e);case M.ZodNullable:return U_(e,n);case M.ZodOptional:return H_(e,n);case M.ZodMap:return N_(e,n);case M.ZodSet:return Y_(e,n);case M.ZodLazy:return()=>e.getter()._def;case M.ZodPromise:return K_(e,n);case M.ZodNaN:case M.ZodNever:return j_();case M.ZodEffects:return I_(e,n);case M.ZodAny:return Ze();case M.ZodUnknown:return e2();case M.ZodDefault:return $_(e,n);case M.ZodBranded:return cc(e,n);case M.ZodReadonly:return t2(e,n);case M.ZodCatch:return A_(e,n);case M.ZodPipeline:return J_(e,n);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return(r=>{})()}},"selectParser");function Q(e,t,n=!1){var r;const s=t.seen.get(e);if(t.override){const l=(r=t.override)==null?void 0:r.call(t,e,t,s,n);if(l!==E_)return l}if(s&&!n){const l=r2(s,t);if(l!==void 0)return l}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const o=n2(e,e.typeName,t),u=typeof o=="function"?Q(o(),t):o;if(u&&o2(e,t,u),t.postProcess){const l=t.postProcess(u,e,t);return i.jsonSchema=u,l}return i.jsonSchema=u,u}a(Q,"parseDef");var r2=a((e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:F_(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ze()):t.$refStrategy==="seen"?Ze():void 0}},"get$ref"),o2=a((e,t,n)=>(e.description&&(n.description=e.description),n),"addMeta"),s2=a(e=>{const t=C_(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,s])=>[s._def,{def:s._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},"getRefs"),i2=a((e,t)=>{var n;const r=s2(t);let s=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[d,p])=>{var h;return{...c,[d]:(h=Q(p._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:Ze()}},{}):void 0;const i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=(n=Q(e._def,i===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,i]},!1))!=null?n:Ze(),u=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;u!==void 0&&(o.title=u);const l=i===void 0?s?{...o,[r.definitionPath]:s}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,i].join("/"),[r.definitionPath]:{...s,[i]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},"zodToJsonSchema"),a2=i2;function u2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Os(()=>a2(e,{$refStrategy:r?"root":"none"}),{validate:a(async s=>{const i=await e.safeParseAsync(s);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}},"validate")})}a(u2,"zod3Schema");function l2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Os(()=>V0(e,{target:"draft-7",io:"output",reused:r?"ref":"inline"}),{validate:a(async s=>{const i=await Vl(e,s);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}},"validate")})}a(l2,"zod4Schema");function c2(e){return"_zod"in e}a(c2,"isZod4Schema");function U(e,t){return c2(e)?l2(e):u2(e)}a(U,"zodSchema");var Ts=Symbol.for("vercel.ai.schema");function Ie(e){let t;return()=>(t==null&&(t=e()),t)}a(Ie,"lazySchema");function Os(e,{validate:t}={}){return{[Ts]:!0,_type:void 0,[Kr]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}a(Os,"jsonSchema");function d2(e){return typeof e=="object"&&e!==null&&Ts in e&&e[Ts]===!0&&"jsonSchema"in e&&"validate"in e}a(d2,"isSchema");function Xr(e){return e==null?Os({properties:{},additionalProperties:!1}):d2(e)?e:typeof e=="function"?e():U(e)}a(Xr,"asSchema");var{btoa:p2,atob:D2}=globalThis;function Qr(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=D2(t);return Uint8Array.from(n,r=>r.codePointAt(0))}a(Qr,"convertBase64ToUint8Array");function eo(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCodePoint(e[n]);return p2(t)}a(eo,"convertUint8ArrayToBase64");function Bt(e){return e instanceof Uint8Array?eo(e):e}a(Bt,"convertToBase64");function Rs(e){return e?.replace(/\/$/,"")}a(Rs,"withoutTrailingSlash");function f2(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}a(f2,"isAsyncIterable");async function*m2({execute:e,input:t,options:n}){const r=e(t,n);if(f2(r)){let s;for await(const i of r)s=i,yield{type:"preliminary",output:i};yield{type:"final",output:s}}else yield{type:"final",output:await r}}a(m2,"executeTool");var Ps,mc;function hc(){if(mc)return Ps;mc=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((d,p)=>{for(var h in p)e(d,h,{get:p[h],enumerable:!0})},"__export"),i=a((d,p,h,f)=>{if(p&&typeof p=="object"||typeof p=="function")for(let D of n(p))!r.call(d,D)&&D!==h&&e(d,D,{get:a(()=>p[D],"get"),enumerable:!(f=t(p,D))||f.enumerable});return d},"__copyProps"),o=a(d=>i(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};s(u,{SYMBOL_FOR_REQ_CONTEXT:a(()=>l,"SYMBOL_FOR_REQ_CONTEXT"),getContext:a(()=>c,"getContext")}),Ps=o(u);const l=Symbol.for("@vercel/request-context");function c(){return globalThis[l]?.get?.()??{}}return a(c,"getContext"),Ps}a(hc,"requireGetContext");var Ns,gc;function vc(){if(gc)return Ns;gc=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((d,p)=>{for(var h in p)e(d,h,{get:p[h],enumerable:!0})},"__export"),i=a((d,p,h,f)=>{if(p&&typeof p=="object"||typeof p=="function")for(let D of n(p))!r.call(d,D)&&D!==h&&e(d,D,{get:a(()=>p[D],"get"),enumerable:!(f=t(p,D))||f.enumerable});return d},"__copyProps"),o=a(d=>i(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};s(u,{VercelOidcTokenError:a(()=>l,"VercelOidcTokenError")}),Ns=o(u);const c=class c extends Error{constructor(p,h){super(p),this.name="VercelOidcTokenError",this.cause=h}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};a(c,"VercelOidcTokenError");let l=c;return Ns}a(vc,"requireTokenError");var Ms,yc;function h2(){if(yc)return Ms;yc=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((h,f)=>{for(var D in f)e(h,D,{get:f[D],enumerable:!0})},"__export"),i=a((h,f,D,g)=>{if(f&&typeof f=="object"||typeof f=="function")for(let v of n(f))!r.call(h,v)&&v!==D&&e(h,v,{get:a(()=>f[v],"get"),enumerable:!(g=t(f,v))||g.enumerable});return h},"__copyProps"),o=a(h=>i(e({},"__esModule",{value:!0}),h),"__toCommonJS"),u={};s(u,{getVercelOidcToken:a(()=>d,"getVercelOidcToken"),getVercelOidcTokenSync:a(()=>p,"getVercelOidcTokenSync")}),Ms=o(u);var l=hc(),c=vc();async function d(){let h="",f;try{h=p()}catch(D){f=D}try{const[{getTokenPayload:D,isExpired:g},{refreshToken:v}]=await Promise.all([await import("./token-util-kF1mb_fv.mjs").then(function(F){return F.t}),await import("./token-BBjSjsOL.mjs").then(function(F){return F.t})]);(!h||g(D(h)))&&(await v(),h=p())}catch(D){throw f?.message&&D instanceof Error&&(D.message=`${f.message}
|
|
122
122
|
${D.message}`),new c.VercelOidcTokenError("Failed to refresh OIDC token",D)}return h}a(d,"getVercelOidcToken");function p(){const h=(0,l.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!h)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return h}return a(p,"getVercelOidcTokenSync"),Ms}a(h2,"requireGetVercelOidcToken");var js,_c;function g2(){if(_c)return js;_c=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,s=a((d,p)=>{for(var h in p)e(d,h,{get:p[h],enumerable:!0})},"__export"),i=a((d,p,h,f)=>{if(p&&typeof p=="object"||typeof p=="function")for(let D of n(p))!r.call(d,D)&&D!==h&&e(d,D,{get:a(()=>p[D],"get"),enumerable:!(f=t(p,D))||f.enumerable});return d},"__copyProps"),o=a(d=>i(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};s(u,{getContext:a(()=>c.getContext,"getContext"),getVercelOidcToken:a(()=>l.getVercelOidcToken,"getVercelOidcToken"),getVercelOidcTokenSync:a(()=>l.getVercelOidcTokenSync,"getVercelOidcTokenSync")}),js=o(u);var l=h2(),c=hc();return js}a(g2,"requireDist");var Fc=g2(),v2="vercel.ai.gateway.error",zs=Symbol.for(v2),Ec,Cc,Le=(Ot=class extends(Cc=Error,Ec=zs,Cc){constructor({message:t,statusCode:n=500,cause:r}){super(t),this[Ec]=!0,this.statusCode=n,this.cause=r}static isInstance(t){return Ot.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&zs in t&&t[zs]===!0}},a(Ot,"_GatewayError"),Ot),bc="GatewayAuthenticationError",y2=`vercel.ai.gateway.error.${bc}`,wc=Symbol.for(y2),kc,Ac,Zs=(Rt=class extends(Ac=Le,kc=wc,Ac){constructor({message:t="Authentication failed",statusCode:n=401,cause:r}={}){super({message:t,statusCode:n,cause:r}),this[kc]=!0,this.name=bc,this.type="authentication_error"}static isInstance(t){return Le.hasMarker(t)&&wc in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:r="Authentication failed",statusCode:s=401,cause:i}){let o;return t?o=`AI Gateway authentication failed: Invalid API key.
|
|
123
123
|
|
|
124
124
|
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
@@ -161,15 +161,15 @@ ${o}
|
|
|
161
161
|
${t}:`]}}a(lb,"convertToOpenAICompatibleCompletionPrompt");function hp({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n!=null?new Date(n*1e3):void 0}}a(hp,"getResponseMetadata2");function gp(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"unknown"}}a(gp,"mapOpenAICompatibleFinishReason2");var cb=y({echo:ke().optional(),logitBias:ge(m(),w()).optional(),suffix:m().optional(),user:m().optional()}),db=(Pn=class{constructor(t,n){this.specificationVersion="v2";var r;this.modelId=t,this.config=n;const s=(r=n.errorStructure)!=null?r:io;this.chunkSchema=Db(s.errorSchema),this.failedResponseHandler=We(s)}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var t,n,r;return(r=(n=(t=this.config).supportedUrls)==null?void 0:n.call(t))!=null?r:{}}async getArgs({prompt:t,maxOutputTokens:n,temperature:r,topP:s,topK:i,frequencyPenalty:o,presencePenalty:u,stopSequences:l,responseFormat:c,seed:d,providerOptions:p,tools:h,toolChoice:f}){var D;const g=[],v=(D=await ze({provider:this.providerOptionsName,providerOptions:p,schema:cb}))!=null?D:{};i!=null&&g.push({type:"unsupported-setting",setting:"topK"}),h?.length&&g.push({type:"unsupported-setting",setting:"tools"}),f!=null&&g.push({type:"unsupported-setting",setting:"toolChoice"}),c!=null&&c.type!=="text"&&g.push({type:"unsupported-setting",setting:"responseFormat",details:"JSON response format is not supported."});const{prompt:F,stopSequences:C}=lb({prompt:t}),_=[...C??[],...l??[]];return{args:{model:this.modelId,echo:v.echo,logit_bias:v.logitBias,suffix:v.suffix,user:v.user,max_tokens:n,temperature:r,top_p:s,frequency_penalty:o,presence_penalty:u,seed:d,...p?.[this.providerOptionsName],prompt:F,stop:_.length>0?_:void 0},warnings:g}}async doGenerate(t){var n,r,s,i,o,u;const{args:l,warnings:c}=await this.getArgs(t),{responseHeaders:d,value:p,rawValue:h}=await Ce({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:_e(this.config.headers(),t.headers),body:l,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:Te(pb),abortSignal:t.abortSignal,fetch:this.config.fetch}),f=p.choices[0],D=[];return f.text!=null&&f.text.length>0&&D.push({type:"text",text:f.text}),{content:D,usage:{inputTokens:(r=(n=p.usage)==null?void 0:n.prompt_tokens)!=null?r:void 0,outputTokens:(i=(s=p.usage)==null?void 0:s.completion_tokens)!=null?i:void 0,totalTokens:(u=(o=p.usage)==null?void 0:o.total_tokens)!=null?u:void 0},finishReason:gp(f.finish_reason),request:{body:l},response:{...hp(p),headers:d,body:h},warnings:c}}async doStream(t){const{args:n,warnings:r}=await this.getArgs(t),s={...n,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:i,value:o}=await Ce({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:_e(this.config.headers(),t.headers),body:s,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:Gt(this.chunkSchema),abortSignal:t.abortSignal,fetch:this.config.fetch});let u="unknown";const l={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};let c=!0;return{stream:o.pipeThrough(new TransformStream({start(d){d.enqueue({type:"stream-start",warnings:r})},transform(d,p){var h,f,D;if(t.includeRawChunks&&p.enqueue({type:"raw",rawValue:d.rawValue}),!d.success){u="error",p.enqueue({type:"error",error:d.error});return}const g=d.value;if("error"in g){u="error",p.enqueue({type:"error",error:g.error});return}c&&(c=!1,p.enqueue({type:"response-metadata",...hp(g)}),p.enqueue({type:"text-start",id:"0"})),g.usage!=null&&(l.inputTokens=(h=g.usage.prompt_tokens)!=null?h:void 0,l.outputTokens=(f=g.usage.completion_tokens)!=null?f:void 0,l.totalTokens=(D=g.usage.total_tokens)!=null?D:void 0);const v=g.choices[0];v?.finish_reason!=null&&(u=gp(v.finish_reason)),v?.text!=null&&p.enqueue({type:"text-delta",id:"0",delta:v.text})},flush(d){c||d.enqueue({type:"text-end",id:"0"}),d.enqueue({type:"finish",finishReason:u,usage:l})}})),request:{body:s},response:{headers:i}}}},a(Pn,"OpenAICompatibleCompletionLanguageModel"),Pn),vp=y({prompt_tokens:w(),completion_tokens:w(),total_tokens:w()}),pb=y({id:m().nullish(),created:w().nullish(),model:m().nullish(),choices:$(y({text:m(),finish_reason:m()})),usage:vp.nullish()}),Db=a(e=>ee([y({id:m().nullish(),created:w().nullish(),model:m().nullish(),choices:$(y({text:m(),finish_reason:m().nullish(),index:w()})),usage:vp.nullish()}),e]),"createOpenAICompatibleCompletionChunkSchema"),yp=y({dimensions:w().optional(),user:m().optional()}),fb=(Nn=class{constructor(t,n){this.specificationVersion="v2",this.modelId=t,this.config=n}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var t;return(t=this.config.maxEmbeddingsPerCall)!=null?t:2048}get supportsParallelCalls(){var t;return(t=this.config.supportsParallelCalls)!=null?t:!0}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}async doEmbed({values:t,headers:n,abortSignal:r,providerOptions:s}){var i,o,u;const l=Object.assign((i=await ze({provider:"openai-compatible",providerOptions:s,schema:yp}))!=null?i:{},(o=await ze({provider:this.providerOptionsName,providerOptions:s,schema:yp}))!=null?o:{});if(t.length>this.maxEmbeddingsPerCall)throw new sl({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:t});const{responseHeaders:c,value:d,rawValue:p}=await Ce({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:_e(this.config.headers(),n),body:{model:this.modelId,input:t,encoding_format:"float",dimensions:l.dimensions,user:l.user},failedResponseHandler:We((u=this.config.errorStructure)!=null?u:io),successfulResponseHandler:Te(mb),abortSignal:r,fetch:this.config.fetch});return{embeddings:d.data.map(h=>h.embedding),usage:d.usage?{tokens:d.usage.prompt_tokens}:void 0,providerMetadata:d.providerMetadata,response:{headers:c,body:p}}}},a(Nn,"OpenAICompatibleEmbeddingModel"),Nn),mb=y({data:$(y({embedding:$(w())})),usage:y({prompt_tokens:w()}).nullish(),providerMetadata:ge(m(),ge(m(),Me())).optional()}),hb=(Mn=class{constructor(t,n){this.modelId=t,this.config=n,this.specificationVersion="v2",this.maxImagesPerCall=10}get provider(){return this.config.provider}async doGenerate({prompt:t,n,size:r,aspectRatio:s,seed:i,providerOptions:o,headers:u,abortSignal:l}){var c,d,p,h,f;const D=[];s!=null&&D.push({type:"unsupported-setting",setting:"aspectRatio",details:"This model does not support aspect ratio. Use `size` instead."}),i!=null&&D.push({type:"unsupported-setting",setting:"seed"});const g=(p=(d=(c=this.config._internal)==null?void 0:c.currentDate)==null?void 0:d.call(c))!=null?p:new Date,{value:v,responseHeaders:F}=await Ce({url:this.config.url({path:"/images/generations",modelId:this.modelId}),headers:_e(this.config.headers(),u),body:{model:this.modelId,prompt:t,n,size:r,...(h=o.openai)!=null?h:{},response_format:"b64_json"},failedResponseHandler:We((f=this.config.errorStructure)!=null?f:io),successfulResponseHandler:Te(gb),abortSignal:l,fetch:this.config.fetch});return{images:v.data.map(C=>C.b64_json),warnings:D,response:{timestamp:g,modelId:this.modelId,headers:F}}}},a(Mn,"OpenAICompatibleImageModel"),Mn),gb=y({data:$(y({b64_json:m()}))}),vb="1.0.28";function si(e){const t=Rs(e.baseURL),n=e.name,r={...e.apiKey&&{Authorization:`Bearer ${e.apiKey}`},...e.headers},s=a(()=>$t(r,`ai-sdk/openai-compatible/${vb}`),"getHeaders"),i=a(h=>({provider:`${n}.${h}`,url:a(({path:f})=>{const D=new URL(`${t}${f}`);return e.queryParams&&(D.search=new URLSearchParams(e.queryParams).toString()),D.toString()},"url"),headers:s,fetch:e.fetch}),"getCommonModelConfig"),o=a(h=>u(h),"createLanguageModel"),u=a(h=>new ib(h,{...i("chat"),includeUsage:e.includeUsage,supportsStructuredOutputs:e.supportsStructuredOutputs}),"createChatModel"),l=a(h=>new db(h,{...i("completion"),includeUsage:e.includeUsage}),"createCompletionModel"),c=a(h=>new fb(h,{...i("embedding")}),"createEmbeddingModel"),d=a(h=>new hb(h,i("image")),"createImageModel"),p=a(h=>o(h),"provider");return p.languageModel=o,p.chatModel=u,p.completionModel=l,p.textEmbeddingModel=c,p.imageModel=d,p}a(si,"createOpenAICompatible");const yb={"":"<commit message>",conventional:"<type>[optional (<scope>)]: <commit message>",gitmoji:":emoji: <commit message>"},_b=a(e=>`The output response must be in format:
|
|
162
162
|
${yb[e]}`,"specifyCommitFormat"),Fb={"":"",conventional:`Choose a type from the type-to-description JSON below that best describes the git diff:
|
|
163
163
|
${JSON.stringify({docs:"Documentation only changes",style:"Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",refactor:"A code change that improves code structure without changing functionality (renaming, restructuring classes/methods, extracting functions, etc)",perf:"A code change that improves performance",test:"Adding missing tests or correcting existing tests",build:"Changes that affect the build system or external dependencies",ci:"Changes to our CI configuration files and scripts",chore:"Other changes that don't modify src or test files",revert:"Reverts a previous commit",feat:"A new feature",fix:"A bug fix"},null,2)}`,gitmoji:`Choose an emoji from the emoji-to-description JSON below that best describes the git diff:
|
|
164
|
-
${JSON.stringify({"\u{1F3A8}":"Improve structure / format of the code","\u26A1":"Improve performance","\u{1F525}":"Remove code or files","\u{1F41B}":"Fix a bug","\u{1F691}":"Critical hotfix","\u2728":"Introduce new features","\u{1F4DD}":"Add or update documentation","\u{1F680}":"Deploy stuff","\u{1F484}":"Add or update the UI and style files","\u{1F389}":"Begin a project","\u2705":"Add, update, or pass tests","\u{1F512}":"Fix security or privacy issues","\u{1F510}":"Add or update secrets","\u{1F516}":"Release / Version tags","\u{1F6A8}":"Fix compiler / linter warnings","\u{1F6A7}":"Work in progress","\u{1F49A}":"Fix CI Build","\u2B07\uFE0F":"Downgrade dependencies","\u2B06\uFE0F":"Upgrade dependencies","\u{1F4CC}":"Pin dependencies to specific versions","\u{1F477}":"Add or update CI build system","\u{1F4C8}":"Add or update analytics or track code","\u267B\uFE0F":"Refactor code","\u2795":"Add a dependency","\u2796":"Remove a dependency","\u{1F527}":"Add or update configuration files","\u{1F528}":"Add or update development scripts","\u{1F310}":"Internationalization and localization","\u270F\uFE0F":"Fix typos","\u{1F4A9}":"Write bad code that needs to be improved","\u23EA":"Revert changes","\u{1F500}":"Merge branches","\u{1F4E6}":"Add or update compiled files or packages","\u{1F47D}":"Update code due to external API changes","\u{1F69A}":"Move or rename resources (e.g.: files, paths, routes)","\u{1F4C4}":"Add or update license","\u{1F4A5}":"Introduce breaking changes","\u{1F371}":"Add or update assets","\u267F":"Improve accessibility","\u{1F4A1}":"Add or update comments in source code","\u{1F37B}":"Write code drunkenly","\u{1F4AC}":"Add or update text and literals","\u{1F5C3}":"Perform database related changes","\u{1F50A}":"Add or update logs","\u{1F507}":"Remove logs","\u{1F465}":"Add or update contributor(s)","\u{1F6B8}":"Improve user experience / usability","\u{1F3D7}":"Make architectural changes","\u{1F4F1}":"Work on responsive design","\u{1F921}":"Mock things","\u{1F95A}":"Add or update an easter egg","\u{1F648}":"Add or update a .gitignore file","\u{1F4F8}":"Add or update snapshots","\u2697":"Perform experiments","\u{1F50D}":"Improve SEO","\u{1F3F7}":"Add or update types","\u{1F331}":"Add or update seed files","\u{1F6A9}":"Add, update, or remove feature flags","\u{1F945}":"Catch errors","\u{1F4AB}":"Add or update animations and transitions","\u{1F5D1}":"Deprecate code that needs to be cleaned up","\u{1F6C2}":"Work on code related to authorization, roles and permissions","\u{1FA79}":"Simple fix for a non-critical issue","\u{1F9D0}":"Data exploration/inspection","\u26B0":"Remove dead code","\u{1F9EA}":"Add a failing test","\u{1F454}":"Add or update business logic","\u{1FA7A}":"Add or update healthcheck","\u{1F9F1}":"Infrastructure related changes","\u{1F9D1}\u200D\u{1F4BB}":"Improve developer experience","\u{1F4B8}":"Add sponsorships or money related infrastructure","\u{1F9F5}":"Add or update code related to multithreading or concurrency","\u{1F9BA}":"Add or update code related to validation"},null,2)}`},Eb=a((e,t,n)=>["Generate a concise git commit message title in present tense that precisely describes the key changes in the following code diff. Focus on what was changed, not just file names. Provide only the title, no description or body.",`Message language: ${e}`,`Commit message must be a maximum of ${t} characters.`,"Exclude anything unnecessary such as translation. Your entire response will be passed directly into git commit."
|
|
165
|
-
`),"generatePrompt"),_p=a((e,t)=>e.trim().split(`
|
|
166
|
-
`)[0].replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,"").replace(/^<[^>]*>\s*/,"").substring(0,t),"sanitizeMessage"),Cb=a(e=>Array.from(new Set(e)),"deduplicateMessages"),ii=a(async(e,t,n,r,s,i,o,u,l)=>{process.env.DEBUG&&(console.log("Diff being sent to AI:"),console.log(s));try{const c=e==="https://api.openai.com/v1"?so({apiKey:t}):si({name:"custom",apiKey:t,baseURL:e}),d=new AbortController,p=setTimeout(()=>d.abort(),l),h=Array.from({length:i},()=>oo({model:c(n),system:Eb(r,o,u),prompt:s,temperature:.4,maxRetries:2}).finally(()=>clearTimeout(p))),f=await Promise.all(h),D=f.map(F=>F.text),g=Cb(D.map(F=>_p(F,o))),v={prompt_tokens:f.reduce((F,C)=>F+(C.usage.promptTokens||0),0),completion_tokens:f.reduce((F,C)=>F+(C.usage.completionTokens||0),0),total_tokens:f.reduce((F,C)=>F+(C.usage.totalTokens||0),0)};return{messages:g,usage:v}}catch(c){const d=c;if(console.log(d),d.code==="ENOTFOUND")throw new X(`Error connecting to ${d.hostname} (${d.syscall}). Are you connected to the internet?`);if(d.status===429){const p=d.headers?.get("x-ratelimit-reset");let h="Rate limit exceeded";if(p){const f=parseInt(p),D=Date.now(),g=f-D,v=Math.ceil(g/1e3);if(v>0){let F;if(v<60)F=`${v} second${v===1?"":"s"}`;else if(v<3600){const C=Math.ceil(v/60);F=`${C} minute${C===1?"":"s"}`}else{const C=Math.ceil(v/3600);F=`${C} hour${C===1?"":"s"}`}h+=`. Retry in ${F}.`}}throw new X(h)}throw d}},"generateCommitMessage"),bb=a(async(e,t,n,r,s,i,o,u)=>{try{const l=t==="https://api.openai.com/v1"?so({apiKey:n}):si({name:"custom",apiKey:n,baseURL:t}),c=new AbortController,d=setTimeout(()=>c.abort(),u),h=await oo({model:l(r),system:`You are a tool that generates git commit messages. Your task is to combine multiple commit messages into one.
|
|
164
|
+
${JSON.stringify({"\u{1F3A8}":"Improve structure / format of the code","\u26A1":"Improve performance","\u{1F525}":"Remove code or files","\u{1F41B}":"Fix a bug","\u{1F691}":"Critical hotfix","\u2728":"Introduce new features","\u{1F4DD}":"Add or update documentation","\u{1F680}":"Deploy stuff","\u{1F484}":"Add or update the UI and style files","\u{1F389}":"Begin a project","\u2705":"Add, update, or pass tests","\u{1F512}":"Fix security or privacy issues","\u{1F510}":"Add or update secrets","\u{1F516}":"Release / Version tags","\u{1F6A8}":"Fix compiler / linter warnings","\u{1F6A7}":"Work in progress","\u{1F49A}":"Fix CI Build","\u2B07\uFE0F":"Downgrade dependencies","\u2B06\uFE0F":"Upgrade dependencies","\u{1F4CC}":"Pin dependencies to specific versions","\u{1F477}":"Add or update CI build system","\u{1F4C8}":"Add or update analytics or track code","\u267B\uFE0F":"Refactor code","\u2795":"Add a dependency","\u2796":"Remove a dependency","\u{1F527}":"Add or update configuration files","\u{1F528}":"Add or update development scripts","\u{1F310}":"Internationalization and localization","\u270F\uFE0F":"Fix typos","\u{1F4A9}":"Write bad code that needs to be improved","\u23EA":"Revert changes","\u{1F500}":"Merge branches","\u{1F4E6}":"Add or update compiled files or packages","\u{1F47D}":"Update code due to external API changes","\u{1F69A}":"Move or rename resources (e.g.: files, paths, routes)","\u{1F4C4}":"Add or update license","\u{1F4A5}":"Introduce breaking changes","\u{1F371}":"Add or update assets","\u267F":"Improve accessibility","\u{1F4A1}":"Add or update comments in source code","\u{1F37B}":"Write code drunkenly","\u{1F4AC}":"Add or update text and literals","\u{1F5C3}":"Perform database related changes","\u{1F50A}":"Add or update logs","\u{1F507}":"Remove logs","\u{1F465}":"Add or update contributor(s)","\u{1F6B8}":"Improve user experience / usability","\u{1F3D7}":"Make architectural changes","\u{1F4F1}":"Work on responsive design","\u{1F921}":"Mock things","\u{1F95A}":"Add or update an easter egg","\u{1F648}":"Add or update a .gitignore file","\u{1F4F8}":"Add or update snapshots","\u2697":"Perform experiments","\u{1F50D}":"Improve SEO","\u{1F3F7}":"Add or update types","\u{1F331}":"Add or update seed files","\u{1F6A9}":"Add, update, or remove feature flags","\u{1F945}":"Catch errors","\u{1F4AB}":"Add or update animations and transitions","\u{1F5D1}":"Deprecate code that needs to be cleaned up","\u{1F6C2}":"Work on code related to authorization, roles and permissions","\u{1FA79}":"Simple fix for a non-critical issue","\u{1F9D0}":"Data exploration/inspection","\u26B0":"Remove dead code","\u{1F9EA}":"Add a failing test","\u{1F454}":"Add or update business logic","\u{1FA7A}":"Add or update healthcheck","\u{1F9F1}":"Infrastructure related changes","\u{1F9D1}\u200D\u{1F4BB}":"Improve developer experience","\u{1F4B8}":"Add sponsorships or money related infrastructure","\u{1F9F5}":"Add or update code related to multithreading or concurrency","\u{1F9BA}":"Add or update code related to validation"},null,2)}`},Eb=a((e,t,n)=>["Generate a concise git commit message title in present tense that precisely describes the key changes in the following code diff. Focus on what was changed, not just file names. Provide only the title, no description or body.",`Message language: ${e}`,`Commit message must be a maximum of ${t} characters.`,"Exclude anything unnecessary such as translation. Your entire response will be passed directly into git commit.",`IMPORTANT: Do not include any explanations, introductions, or additional text. Do not wrap the commit message in quotes or any other formatting. The commit message must not exceed ${t} characters. Respond with ONLY the commit message text.`,Fb[n],_b(n)].filter(Boolean).join(`
|
|
165
|
+
`),"generatePrompt"),_p=a((e,t)=>{let n=e.trim().split(`
|
|
166
|
+
`)[0].replace(/(\w)\.$/,"$1").replace(/^["'`]|["'`]$/g,"").replace(/^<[^>]*>\s*/,"");if(n.length<=t)return n;const r=n.lastIndexOf(" ",t);return r>0?n.substring(0,r):n.substring(0,t)},"sanitizeMessage"),Cb=a(e=>Array.from(new Set(e)),"deduplicateMessages"),ii=a(async(e,t,n,r,s,i,o,u,l)=>{process.env.DEBUG&&(console.log("Diff being sent to AI:"),console.log(s));try{const c=e==="https://api.openai.com/v1"?so({apiKey:t}):si({name:"custom",apiKey:t,baseURL:e}),d=new AbortController,p=setTimeout(()=>d.abort(),l),h=Array.from({length:i},()=>oo({model:c(n),system:Eb(r,o,u),prompt:s,temperature:.4,maxRetries:2,maxOutputTokens:2e3}).finally(()=>clearTimeout(p))),f=await Promise.all(h),D=f.map(F=>F.text),g=Cb(D.map(F=>_p(F,o))),v={prompt_tokens:f.reduce((F,C)=>F+(C.usage.promptTokens||0),0),completion_tokens:f.reduce((F,C)=>F+(C.usage.completionTokens||0),0),total_tokens:f.reduce((F,C)=>F+(C.usage.totalTokens||0),0)};return{messages:g,usage:v}}catch(c){const d=c;if(console.log(d),d.code==="ENOTFOUND")throw new X(`Error connecting to ${d.hostname} (${d.syscall}). Are you connected to the internet?`);if(d.status===429){const p=d.headers?.get("x-ratelimit-reset");let h="Rate limit exceeded";if(p){const f=parseInt(p),D=Date.now(),g=f-D,v=Math.ceil(g/1e3);if(v>0){let F;if(v<60)F=`${v} second${v===1?"":"s"}`;else if(v<3600){const C=Math.ceil(v/60);F=`${C} minute${C===1?"":"s"}`}else{const C=Math.ceil(v/3600);F=`${C} hour${C===1?"":"s"}`}h+=`. Retry in ${F}.`}}throw new X(h)}throw d}},"generateCommitMessage"),bb=a(async(e,t,n,r,s,i,o,u)=>{try{const l=t==="https://api.openai.com/v1"?so({apiKey:n}):si({name:"custom",apiKey:n,baseURL:t}),c=new AbortController,d=setTimeout(()=>c.abort(),u),h=await oo({model:l(r),system:`You are a tool that generates git commit messages. Your task is to combine multiple commit messages into one.
|
|
167
167
|
|
|
168
168
|
Input: Several commit messages separated by newlines.
|
|
169
169
|
Output: A single commit message starting with type like 'feat:' or 'fix:'.
|
|
170
170
|
|
|
171
171
|
Do not add thanks, explanations, or any text outside the commit message.`,prompt:e.join(`
|
|
172
|
-
`),temperature:.4,maxRetries:2});return clearTimeout(d),{messages:[_p(h.text,i)],usage:h.usage}}catch(l){const c=l;throw console.log(c),c}},"combineCommitMessages"),wb=a(async(e,t)=>{const{select:n,confirm:r,isCancel:s}=await Promise.resolve().then(function(){return Gn}),{dim:i}=await Promise.resolve().then(function(){return Am}),o=process.stdout.isTTY&&!process.env.CI;if(e.length===1){const[l]=e;if(t)return l;if(!o)throw new X("Interactive terminal required for commit message confirmation. Use --confirm flag to skip confirmation.");console.log(`
|
|
172
|
+
`),temperature:.4,maxRetries:2,maxOutputTokens:2e3});return clearTimeout(d),{messages:[_p(h.text,i)],usage:h.usage}}catch(l){const c=l;throw console.log(c),c}},"combineCommitMessages"),wb=a(async(e,t)=>{const{select:n,confirm:r,isCancel:s}=await Promise.resolve().then(function(){return Gn}),{dim:i}=await Promise.resolve().then(function(){return Am}),o=process.stdout.isTTY&&!process.env.CI;if(e.length===1){const[l]=e;if(t)return l;if(!o)throw new X("Interactive terminal required for commit message confirmation. Use --confirm flag to skip confirmation.");console.log(`
|
|
173
173
|
\x1B[1m${l}\x1B[0m
|
|
174
174
|
`);const c=await r({message:"Use this commit message?"});return c&&!s(c)?l:null}if(t)return e[0];if(!o)throw new X("Interactive terminal required for commit message selection. Use --confirm flag to skip selection and use the first message.");const u=await n({message:`Pick a commit message to use: ${i("(Ctrl+c to exit)")}`,options:e.map(l=>({label:l,value:l}))});return s(u)?null:u},"getCommitMessage");var kb=a(async(e,t,n,r,s,i,o)=>(async()=>{Sr(kr(wr(" aicommits "))),await ss();const u=bt();n&&await qe("git",["add","--update"]),u.start("Detecting staged files");const l=await Fu(t);if(!l)throw u.stop("Detecting staged files"),new X("No staged changes found. Stage your changes manually, or automatically stage all changes with the `--all` flag.");l.files.length<=10?u.stop(`\u{1F4C1} ${Eu(l.files)}:
|
|
175
175
|
${l.files.map(T=>` ${T}`).join(`
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./cli-
|
|
2
|
+
import"./cli-8OikwcWH.mjs";import"update-notifier";import"tty";import"node:buffer";import"node:path";import"node:child_process";import"node:process";import"child_process";import"path";import"fs";import"node:url";import"node:os";import"assert";import"events";import"node:fs";import"buffer";import"stream";import"util";import"node:util";import"node:readline";import"node:stream";import"fs/promises";import"os";import"crypto";import"url";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var o=(n,f)=>T(n,"name",{value:f,configurable:!0});import{r as b,g as h}from"./cli-
|
|
1
|
+
var T=Object.defineProperty;var o=(n,f)=>T(n,"name",{value:f,configurable:!0});import{r as b,g as h}from"./cli-8OikwcWH.mjs";import{r as w}from"./token-util-DSUfZicm.mjs";function j(n,f){return f.forEach(function(a){a&&typeof a!="string"&&!Array.isArray(a)&&Object.keys(a).forEach(function(i){if(i!=="default"&&!(i in n)){var u=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(n,i,u.get?u:{enumerable:!0,get:o(function(){return a[i]},"get")})}})}),Object.freeze(n)}o(j,"_mergeNamespaces");var _,O;function m(){if(O)return _;O=1;var n=Object.defineProperty,f=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,u=o((e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:!0})},"__export"),d=o((e,r,t,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of a(r))!i.call(e,s)&&s!==t&&n(e,s,{get:o(()=>r[s],"get"),enumerable:!(p=f(r,s))||p.enumerable});return e},"__copyProps"),y=o(e=>d(n({},"__esModule",{value:!0}),e),"__toCommonJS"),k={};u(k,{refreshToken:o(()=>g,"refreshToken")}),_=y(k);var l=b(),c=w();async function g(){const{projectId:e,teamId:r}=(0,c.findProjectInfo)();let t=(0,c.loadToken)(e);if(!t||(0,c.isExpired)((0,c.getTokenPayload)(t.token))){const p=(0,c.getVercelCliToken)();if(!p)throw new l.VercelOidcTokenError("Failed to refresh OIDC token: login to vercel cli");if(!e)throw new l.VercelOidcTokenError("Failed to refresh OIDC token: project id not found");if(t=await(0,c.getVercelOidcToken)(p,e,r),!t)throw new l.VercelOidcTokenError("Failed to refresh OIDC token");(0,c.saveToken)(t,e)}process.env.VERCEL_OIDC_TOKEN=t.token}return o(g,"refreshToken"),_}o(m,"requireToken");var v=m(),P=h(v),E=j({__proto__:null,default:P},[v]);export{E as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var F=Object.defineProperty;var r=(k,l)=>F(k,"name",{value:l,configurable:!0});import x from"path";import I from"fs";import{r as A}from"./cli-
|
|
1
|
+
var F=Object.defineProperty;var r=(k,l)=>F(k,"name",{value:l,configurable:!0});import x from"path";import I from"fs";import{r as A}from"./cli-8OikwcWH.mjs";import C from"os";var E,U;function J(){if(U)return E;U=1;var k=Object.create,l=Object.defineProperty,j=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,T=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty,D=r((n,i)=>{for(var d in i)l(n,d,{get:i[d],enumerable:!0})},"__export"),O=r((n,i,d,w)=>{if(i&&typeof i=="object"||typeof i=="function")for(let _ of g(i))!P.call(n,_)&&_!==d&&l(n,_,{get:r(()=>i[_],"get"),enumerable:!(w=j(i,_))||w.enumerable});return n},"__copyProps"),v=r((n,i,d)=>(d=n!=null?k(T(n)):{},O(!n||!n.__esModule?l(d,"default",{value:n,enumerable:!0}):d,n)),"__toESM"),b=r(n=>O(l({},"__esModule",{value:!0}),n),"__toCommonJS"),y={};D(y,{findRootDir:r(()=>h,"findRootDir"),getUserDataDir:r(()=>m,"getUserDataDir")}),E=b(y);var s=v(x),u=v(I),c=v(C),f=A();function h(){try{let n=process.cwd();for(;n!==s.default.dirname(n);){const i=s.default.join(n,".vercel");if(u.default.existsSync(i))return n;n=s.default.dirname(n)}}catch{throw new f.VercelOidcTokenError("Token refresh only supported in node server environments")}throw new f.VercelOidcTokenError("Unable to find root directory")}r(h,"findRootDir");function m(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(c.default.platform()){case"darwin":return s.default.join(c.default.homedir(),"Library/Application Support");case"linux":return s.default.join(c.default.homedir(),".local/share");case"win32":return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}return r(m,"getUserDataDir"),E}r(J,"requireTokenIo");var S,N;function R(){if(N)return S;N=1;var k=Object.create,l=Object.defineProperty,j=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,T=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty,D=r((e,t)=>{for(var o in t)l(e,o,{get:t[o],enumerable:!0})},"__export"),O=r((e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of g(t))!P.call(e,p)&&p!==o&&l(e,p,{get:r(()=>t[p],"get"),enumerable:!(a=j(t,p))||a.enumerable});return e},"__copyProps"),v=r((e,t,o)=>(o=e!=null?k(T(e)):{},O(!e||!e.__esModule?l(o,"default",{value:e,enumerable:!0}):o,e)),"__toESM"),b=r(e=>O(l({},"__esModule",{value:!0}),e),"__toCommonJS"),y={};D(y,{assertVercelOidcTokenResponse:r(()=>i,"assertVercelOidcTokenResponse"),findProjectInfo:r(()=>d,"findProjectInfo"),getTokenPayload:r(()=>M,"getTokenPayload"),getVercelCliToken:r(()=>m,"getVercelCliToken"),getVercelDataDir:r(()=>h,"getVercelDataDir"),getVercelOidcToken:r(()=>n,"getVercelOidcToken"),isExpired:r(()=>$,"isExpired"),loadToken:r(()=>_,"loadToken"),saveToken:r(()=>w,"saveToken")}),S=b(y);var s=v(x),u=v(I),c=A(),f=J();function h(){const e="com.vercel.cli",t=(0,f.getUserDataDir)();return t?s.join(t,e):null}r(h,"getVercelDataDir");function m(){const e=h();if(!e)return null;const t=s.join(e,"auth.json");if(!u.existsSync(t))return null;const o=u.readFileSync(t,"utf8");return o?JSON.parse(o).token:null}r(m,"getVercelCliToken");async function n(e,t,o){try{const a=`https://api.vercel.com/v1/projects/${t}/token?source=vercel-oidc-refresh${o?`&teamId=${o}`:""}`,p=await fetch(a,{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!p.ok)throw new c.VercelOidcTokenError(`Failed to refresh OIDC token: ${p.statusText}`);const V=await p.json();return i(V),V}catch(a){throw new c.VercelOidcTokenError("Failed to refresh OIDC token",a)}}r(n,"getVercelOidcToken");function i(e){if(!e||typeof e!="object")throw new TypeError("Expected an object");if(!("token"in e)||typeof e.token!="string")throw new TypeError("Expected a string-valued token property")}r(i,"assertVercelOidcTokenResponse");function d(){const e=(0,f.findRootDir)();if(!e)throw new c.VercelOidcTokenError("Unable to find root directory");try{const t=s.join(e,".vercel","project.json");if(!u.existsSync(t))throw new c.VercelOidcTokenError("project.json not found");const o=JSON.parse(u.readFileSync(t,"utf8"));if(typeof o.projectId!="string"&&typeof o.orgId!="string")throw new TypeError("Expected a string-valued projectId property");return{projectId:o.projectId,teamId:o.orgId}}catch(t){throw new c.VercelOidcTokenError("Unable to find project ID",t)}}r(d,"findProjectInfo");function w(e,t){try{const o=(0,f.getUserDataDir)();if(!o)throw new c.VercelOidcTokenError("Unable to find user data directory");const a=s.join(o,"com.vercel.token",`${t}.json`),p=JSON.stringify(e);u.mkdirSync(s.dirname(a),{mode:504,recursive:!0}),u.writeFileSync(a,p),u.chmodSync(a,432);return}catch(o){throw new c.VercelOidcTokenError("Failed to save token",o)}}r(w,"saveToken");function _(e){try{const t=(0,f.getUserDataDir)();if(!t)return null;const o=s.join(t,"com.vercel.token",`${e}.json`);if(!u.existsSync(o))return null;const a=JSON.parse(u.readFileSync(o,"utf8"));return i(a),a}catch(t){throw new c.VercelOidcTokenError("Failed to load token",t)}}r(_,"loadToken");function M(e){const t=e.split(".");if(t.length!==3)throw new c.VercelOidcTokenError("Invalid token");const o=t[1].replace(/-/g,"+").replace(/_/g,"/"),a=o.padEnd(o.length+(4-o.length%4)%4,"=");return JSON.parse(Buffer.from(a,"base64").toString("utf8"))}r(M,"getTokenPayload");function $(e){return e.exp*1e3<Date.now()}return r($,"isExpired"),S}r(R,"requireTokenUtil");export{R as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var n=(t,o)=>f(t,"name",{value:o,configurable:!0});import{g as u}from"./cli-
|
|
1
|
+
var f=Object.defineProperty;var n=(t,o)=>f(t,"name",{value:o,configurable:!0});import{g as u}from"./cli-8OikwcWH.mjs";import{r as c}from"./token-util-DSUfZicm.mjs";function p(t,o){return o.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(e){if(e!=="default"&&!(e in t)){var a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:n(function(){return r[e]},"get")})}})}),Object.freeze(t)}n(p,"_mergeNamespaces");var i=c(),s=u(i),l=p({__proto__:null,default:s},[i]);export{l as t};
|