@yukino.js/yukino 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +131 -26
- package/dist/a2a-C65LD3SC.js +14 -0
- package/dist/acp-SNG4K2LG.js +14 -0
- package/dist/anthropic-E7KF3CEK.js +4 -0
- package/dist/chunk-4RUACBRP.js +5 -0
- package/dist/chunk-BQGLVWJ2.js +363 -0
- package/dist/chunk-COBTQXCB.js +88 -0
- package/dist/chunk-GTWPLFAN.js +38 -0
- package/dist/chunk-HZFKNHPB.js +4 -0
- package/dist/chunk-PP5WWNTV.js +4 -0
- package/dist/chunk-QEUO5B7I.js +1033 -0
- package/dist/{chunk-HWDSXNX4.js → chunk-SQ26ASOB.js} +3 -3
- package/dist/chunk-WGFROGUC.js +8 -0
- package/dist/esm-4KOJC56H.js +225 -0
- package/dist/fe/dist/index.html +21 -0
- package/dist/fe/dist/static/index.css +2 -0
- package/dist/fe/dist/static/index.js +203 -0
- package/dist/lib/{anthropic-CDPTNR5L.js → anthropic-XFZKSPOX.js} +3 -2
- package/dist/lib/{chunk-6NYUYSER.js → chunk-7EWMQYVH.js} +12 -3
- package/dist/lib/{chunk-OYQY3Q45.js → chunk-K532PPI6.js} +0 -2
- package/dist/lib/{chunk-PEV5NGQ2.js → chunk-KUA7U27R.js} +8 -3
- package/dist/lib/{chunk-TKCJSTWI.js → chunk-LHIQSMGD.js} +12 -7
- package/dist/lib/{chunk-HE4RUUZP.js → chunk-MFEAVGDX.js} +291 -592
- package/dist/lib/chunk-Q3EV2REC.js +260 -0
- package/dist/lib/{chunk-EO23VPDZ.js → chunk-RY7EXVHD.js} +18 -15
- package/dist/lib/index.d.ts +476 -3675
- package/dist/lib/index.js +4800 -3279
- package/dist/lib/{openai-TEFKPV7T.js → openai-QSDLFAKO.js} +3 -2
- package/dist/lib/{providers-2X5JB2JX.js → providers-TL72PZZD.js} +2 -1
- package/dist/lib/{seatbelt-VE3I3EGH.js → seatbelt-MRJ25UBQ.js} +1 -1
- package/dist/lib/{tool-filter-HUVHJN3O.js → tool-filter-F4S25GMJ.js} +1 -1
- package/dist/main.js +366 -237
- package/dist/{openai-RYXW7AKZ.js → openai-XNFC4DJ2.js} +13 -13
- package/dist/{providers-YG2HYIG6.js → providers-XEORRTYK.js} +1 -1
- package/dist/{seatbelt-3YN3GMQO.js → seatbelt-FU3EQ42H.js} +1 -1
- package/dist/server-35JMM5JU.js +4 -0
- package/package.json +11 -12
- package/dist/acp-76S2XII3.js +0 -14
- package/dist/anthropic-WK6EYMUE.js +0 -4
- package/dist/chunk-3OULXPVI.js +0 -5
- package/dist/chunk-4GE22WHI.js +0 -4
- package/dist/chunk-7PPWFSIC.js +0 -4
- package/dist/chunk-7ZBAF7M4.js +0 -4
- package/dist/chunk-IW5L5276.js +0 -65
- package/dist/chunk-NG62ISUV.js +0 -61
- package/dist/chunk-QQZCYWYI.js +0 -241
- package/dist/chunk-QRO6H32L.js +0 -1031
- package/dist/esm-5V3TYPZK.js +0 -229
- package/dist/lib/chunk-EFNPK4SJ.js +0 -137
- package/dist/lib/sandbox-runtime-QDN5SXPM.js +0 -9
- package/dist/sandbox-runtime-ELKAYRIL.js +0 -4
- package/dist/server-66HLMSUR.js +0 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{D as N,I as En,b as Ve,c as Qe}from"./chunk-COBTQXCB.js";import{homedir as Oi}from"os";import{join as Ii}from"path";function Me(){return Ii(Oi(),".yukino","config.yaml")}var le=["off","minimal","low","medium","high","xhigh","max"],te=N.enum(["none","minimal","low","medium","high","xhigh","max"]),Ni=N.enum(["low","medium","high","xhigh","max"]),Ri=N.strictObject({off:N.literal("none").nullable().optional(),minimal:te.nullable().optional(),low:te.nullable().optional(),medium:te.nullable().optional(),high:te.nullable().optional(),xhigh:te.nullable().optional(),max:te.nullable().optional()}),Xe=N.looseObject({name:N.string(),protocol:N.enum(["anthropic","openai","openai-compat"]),base_url:N.string(),model:N.string(),api_key:N.string().optional(),thinking:N.enum(le).optional(),reasoning:N.boolean().optional(),thinking_level_map:Ri.optional(),thinking_mode:N.enum(["budget","adaptive"]).optional(),context_window:N.coerce.number().optional(),max_output_tokens:N.coerce.number().optional()});function Ar(i,r){return i[r]??i[0]}var Mi="high",Ne=1e6,Re=128e3,Pi={minimal:1024,low:2048,medium:8192,high:16384,xhigh:32768,max:65536},Fi=1024,Di=1024;function xr(i){return le.some(r=>r===i)}function Je(i){return Ui(i,i.thinking??Mi)}function Tr(i){return i==="off"?0:Pi[i]}function kn(i,r){if(r?.reasoning===!1)return null;if(i==="off")return"none";let l=r?.thinking_level_map?.[i];if(l!==void 0)return l;if(r?.protocol==="anthropic"&&r.thinking_mode==="adaptive"){if(i==="minimal")return"low";if(i==="xhigh")return"high"}return(r?.protocol==="openai"||r?.protocol==="openai-compat")&&(i==="xhigh"||i==="max")?"high":i}function qi(i,r){let l=Ni.safeParse(kn(i,r));return l.success?l.data:null}function ji(i){return i.reasoning===!1||i.protocol==="anthropic"&&i.thinking_mode!=="adaptive"&&vn(i)<Fi+Di?["off"]:le.filter(r=>{if(r==="off")return!0;if(i.protocol==="anthropic"&&i.thinking_mode==="adaptive")return qi(r,i)!==null;let l=kn(r,i);return!(l===null||l==="none"||(i.protocol==="openai"||i.protocol==="openai-compat")&&(r==="xhigh"||r==="max")&&i.thinking_level_map?.[r]===void 0)})}function Ui(i,r){let l=ji(i),A="off";for(let s of le)if(l.includes(s)&&(A=s),s===r)break;return A}function _r(i){return{...i,thinking:Je(i),context_window:Ln(i),max_output_tokens:vn(i)}}function Ln(i){return Number.isSafeInteger(i.context_window)&&(i.context_window??0)>0?i.context_window??Ne:Ne}function vn(i){let r=i.max_output_tokens,l=Number.isSafeInteger(r)&&(r??0)>0?r??Re:Re;return Math.min(l,Ln(i))}import{randomUUID as Wi}from"crypto";import{existsSync as xi,mkdirSync as zi,readFileSync as Vi,renameSync as Qi,unlinkSync as Xi,writeFileSync as Ji}from"fs";import{dirname as Zi,join as er}from"path";function Yi(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var q={},Pe={},Z={},On;function Ae(){if(On)return Z;On=1;function i(m){return typeof m>"u"||m===null}function r(m){return typeof m=="object"&&m!==null}function l(m){return Array.isArray(m)?m:i(m)?[]:[m]}function A(m,f){if(f){let S=Object.keys(f);for(let u=0,p=S.length;u<p;u+=1){let w=S[u];m[w]=f[w]}}return m}function s(m,f){let S="";for(let u=0;u<f;u+=1)S+=m;return S}function y(m){return m===0&&Number.NEGATIVE_INFINITY===1/m}return Z.isNothing=i,Z.isObject=r,Z.toArray=l,Z.repeat=s,Z.isNegativeZero=y,Z.extend=A,Z}var Ze,In;function xe(){if(In)return Ze;In=1;function i(l,A){let s="",y=l.reason||"(unknown reason)";return l.mark?(l.mark.name&&(s+='in "'+l.mark.name+'" '),s+="("+(l.mark.line+1)+":"+(l.mark.column+1)+")",!A&&l.mark.snippet&&(s+=`
|
|
5
|
+
|
|
6
|
+
`+l.mark.snippet),y+" "+s):y}function r(l,A){Error.call(this),this.name="YAMLException",this.reason=l,this.mark=A,this.message=i(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(A){return this.name+": "+i(this,A)},Ze=r,Ze}var en,Nn;function Hi(){if(Nn)return en;Nn=1;let i=Ae();function r(s,y,m,f,S){let u="",p="",w=Math.floor(S/2)-1;return f-y>w&&(u=" ... ",y=f-w+u.length),m-f>w&&(p=" ...",m=f+w-p.length),{str:u+s.slice(y,m).replace(/\t/g,"\u2192")+p,pos:f-y+u.length}}function l(s,y){return i.repeat(" ",y-s.length)+s}function A(s,y){if(y=Object.create(y||null),!s.buffer)return null;y.maxLength||(y.maxLength=79),typeof y.indent!="number"&&(y.indent=1),typeof y.linesBefore!="number"&&(y.linesBefore=3),typeof y.linesAfter!="number"&&(y.linesAfter=2);let m=/\r?\n|\r|\0/g,f=[0],S=[],u,p=-1;for(;u=m.exec(s.buffer);)S.push(u.index),f.push(u.index+u[0].length),s.position<=u.index&&p<0&&(p=f.length-2);p<0&&(p=f.length-1);let w="",v=Math.min(s.line+y.linesAfter,S.length).toString().length,R=y.maxLength-(y.indent+v+3);for(let M=1;M<=y.linesBefore&&!(p-M<0);M++){let B=r(s.buffer,f[p-M],S[p-M],s.position-(f[p]-f[p-M]),R);w=i.repeat(" ",y.indent)+l((s.line-M+1).toString(),v)+" | "+B.str+`
|
|
7
|
+
`+w}let W=r(s.buffer,f[p],S[p],s.position,R);w+=i.repeat(" ",y.indent)+l((s.line+1).toString(),v)+" | "+W.str+`
|
|
8
|
+
`,w+=i.repeat("-",y.indent+v+3+W.pos)+`^
|
|
9
|
+
`;for(let M=1;M<=y.linesAfter&&!(p+M>=S.length);M++){let B=r(s.buffer,f[p+M],S[p+M],s.position-(f[p]-f[p+M]),R);w+=i.repeat(" ",y.indent)+l((s.line+M+1).toString(),v)+" | "+B.str+`
|
|
10
|
+
`}return w.replace(/\n$/,"")}return en=A,en}var nn,Rn;function j(){if(Rn)return nn;Rn=1;let i=xe(),r=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],l=["scalar","sequence","mapping"];function A(y){let m={};return y!==null&&Object.keys(y).forEach(function(f){y[f].forEach(function(S){m[String(S)]=f})}),m}function s(y,m){if(m=m||{},Object.keys(m).forEach(function(f){if(r.indexOf(f)===-1)throw new i('Unknown option "'+f+'" is met in definition of "'+y+'" YAML type.')}),this.options=m,this.tag=y,this.kind=m.kind||null,this.resolve=m.resolve||function(){return!0},this.construct=m.construct||function(f){return f},this.instanceOf=m.instanceOf||null,this.predicate=m.predicate||null,this.represent=m.represent||null,this.representName=m.representName||null,this.defaultStyle=m.defaultStyle||null,this.multi=m.multi||!1,this.styleAliases=A(m.styleAliases||null),l.indexOf(this.kind)===-1)throw new i('Unknown kind "'+this.kind+'" is specified for "'+y+'" YAML type.')}return nn=s,nn}var rn,Mn;function ni(){if(Mn)return rn;Mn=1;let i=xe(),r=j();function l(y,m){let f=[];return y[m].forEach(function(S){let u=f.length;f.forEach(function(p,w){p.tag===S.tag&&p.kind===S.kind&&p.multi===S.multi&&(u=w)}),f[u]=S}),f}function A(){let y={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function m(f){f.multi?(y.multi[f.kind].push(f),y.multi.fallback.push(f)):y[f.kind][f.tag]=y.fallback[f.tag]=f}for(let f=0,S=arguments.length;f<S;f+=1)arguments[f].forEach(m);return y}function s(y){return this.extend(y)}return s.prototype.extend=function(m){let f=[],S=[];if(m instanceof r)S.push(m);else if(Array.isArray(m))S=S.concat(m);else if(m&&(Array.isArray(m.implicit)||Array.isArray(m.explicit)))m.implicit&&(f=f.concat(m.implicit)),m.explicit&&(S=S.concat(m.explicit));else throw new i("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");f.forEach(function(p){if(!(p instanceof r))throw new i("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(p.loadKind&&p.loadKind!=="scalar")throw new i("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(p.multi)throw new i("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),S.forEach(function(p){if(!(p instanceof r))throw new i("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let u=Object.create(s.prototype);return u.implicit=(this.implicit||[]).concat(f),u.explicit=(this.explicit||[]).concat(S),u.compiledImplicit=l(u,"implicit"),u.compiledExplicit=l(u,"explicit"),u.compiledTypeMap=A(u.compiledImplicit,u.compiledExplicit),u},rn=s,rn}var on,Pn;function ii(){if(Pn)return on;Pn=1;let i=j();return on=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}}),on}var tn,Fn;function ri(){if(Fn)return tn;Fn=1;let i=j();return tn=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}}),tn}var ln,Dn;function oi(){if(Dn)return ln;Dn=1;let i=j();return ln=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}}),ln}var un,qn;function ti(){if(qn)return un;qn=1;let i=ni();return un=new i({explicit:[ii(),ri(),oi()]}),un}var cn,jn;function li(){if(jn)return cn;jn=1;let i=j();function r(s){if(s===null)return!0;let y=s.length;return y===1&&s==="~"||y===4&&(s==="null"||s==="Null"||s==="NULL")}function l(){return null}function A(s){return s===null}return cn=new i("tag:yaml.org,2002:null",{kind:"scalar",resolve:r,construct:l,predicate:A,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),cn}var fn,Un;function ui(){if(Un)return fn;Un=1;let i=j();function r(s){if(s===null)return!1;let y=s.length;return y===4&&(s==="true"||s==="True"||s==="TRUE")||y===5&&(s==="false"||s==="False"||s==="FALSE")}function l(s){return s==="true"||s==="True"||s==="TRUE"}function A(s){return Object.prototype.toString.call(s)==="[object Boolean]"}return fn=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:r,construct:l,predicate:A,represent:{lowercase:function(s){return s?"true":"false"},uppercase:function(s){return s?"TRUE":"FALSE"},camelcase:function(s){return s?"True":"False"}},defaultStyle:"lowercase"}),fn}var sn,Yn;function ci(){if(Yn)return sn;Yn=1;let i=Ae(),r=j();function l(u){return u>=48&&u<=57||u>=65&&u<=70||u>=97&&u<=102}function A(u){return u>=48&&u<=55}function s(u){return u>=48&&u<=57}function y(u){if(u===null)return!1;let p=u.length,w=0,v=!1;if(!p)return!1;let R=u[w];if((R==="-"||R==="+")&&(R=u[++w]),R==="0"){if(w+1===p)return!0;if(R=u[++w],R==="b"){for(w++;w<p;w++){if(R=u[w],R!=="0"&&R!=="1")return!1;v=!0}return v&&isFinite(m(u))}if(R==="x"){for(w++;w<p;w++){if(!l(u.charCodeAt(w)))return!1;v=!0}return v&&isFinite(m(u))}if(R==="o"){for(w++;w<p;w++){if(!A(u.charCodeAt(w)))return!1;v=!0}return v&&isFinite(m(u))}}for(;w<p;w++){if(!s(u.charCodeAt(w)))return!1;v=!0}return v?isFinite(m(u)):!1}function m(u){let p=u,w=1,v=p[0];if((v==="-"||v==="+")&&(v==="-"&&(w=-1),p=p.slice(1),v=p[0]),p==="0")return 0;if(v==="0"){if(p[1]==="b")return w*parseInt(p.slice(2),2);if(p[1]==="x")return w*parseInt(p.slice(2),16);if(p[1]==="o")return w*parseInt(p.slice(2),8)}return w*parseInt(p,10)}function f(u){return m(u)}function S(u){return Object.prototype.toString.call(u)==="[object Number]"&&u%1===0&&!i.isNegativeZero(u)}return sn=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:y,construct:f,predicate:S,represent:{binary:function(u){return u>=0?"0b"+u.toString(2):"-0b"+u.toString(2).slice(1)},octal:function(u){return u>=0?"0o"+u.toString(8):"-0o"+u.toString(8).slice(1)},decimal:function(u){return u.toString(10)},hexadecimal:function(u){return u>=0?"0x"+u.toString(16).toUpperCase():"-0x"+u.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),sn}var an,Hn;function fi(){if(Hn)return an;Hn=1;let i=Ae(),r=j(),l=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),A=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function s(u){return u===null||!l.test(u)?!1:isFinite(parseFloat(u,10))?!0:A.test(u)}function y(u){let p=u.toLowerCase(),w=p[0]==="-"?-1:1;return"+-".indexOf(p[0])>=0&&(p=p.slice(1)),p===".inf"?w===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:p===".nan"?NaN:w*parseFloat(p,10)}let m=/^[-+]?[0-9]+e/;function f(u,p){if(isNaN(u))switch(p){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===u)switch(p){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===u)switch(p){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(u))return"-0.0";let w=u.toString(10);return m.test(w)?w.replace("e",".e"):w}function S(u){return Object.prototype.toString.call(u)==="[object Number]"&&(u%1!==0||i.isNegativeZero(u))}return an=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:s,construct:y,predicate:S,represent:f,defaultStyle:"lowercase"}),an}var pn,Bn;function si(){return Bn||(Bn=1,pn=ti().extend({implicit:[li(),ui(),ci(),fi()]})),pn}var hn,Kn;function ai(){return Kn||(Kn=1,hn=si()),hn}var dn,Gn;function pi(){if(Gn)return dn;Gn=1;let i=j(),r=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),l=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function A(m){return m===null?!1:r.exec(m)!==null||l.exec(m)!==null}function s(m){let f=0,S=null,u=r.exec(m);if(u===null&&(u=l.exec(m)),u===null)throw new Error("Date resolve error");let p=+u[1],w=+u[2]-1,v=+u[3];if(!u[4])return new Date(Date.UTC(p,w,v));let R=+u[4],W=+u[5],M=+u[6];if(u[7]){for(f=u[7].slice(0,3);f.length<3;)f+="0";f=+f}if(u[9]){let ee=+u[10],U=+(u[11]||0);S=(ee*60+U)*6e4,u[9]==="-"&&(S=-S)}let B=new Date(Date.UTC(p,w,v,R,W,M,f));return S&&B.setTime(B.getTime()-S),B}function y(m){return m.toISOString()}return dn=new i("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:A,construct:s,instanceOf:Date,represent:y}),dn}var mn,$n;function hi(){if($n)return mn;$n=1;let i=j();function r(l){return l==="<<"||l===null}return mn=new i("tag:yaml.org,2002:merge",{kind:"scalar",resolve:r}),mn}var gn,Wn;function di(){if(Wn)return gn;Wn=1;let i=j(),r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
11
|
+
\r`;function l(m){if(m===null)return!1;let f=0,S=m.length,u=r;for(let p=0;p<S;p++){let w=u.indexOf(m.charAt(p));if(!(w>64)){if(w<0)return!1;f+=6}}return f%8===0}function A(m){let f=m.replace(/[\r\n=]/g,""),S=f.length,u=r,p=0,w=[];for(let R=0;R<S;R++)R%4===0&&R&&(w.push(p>>16&255),w.push(p>>8&255),w.push(p&255)),p=p<<6|u.indexOf(f.charAt(R));let v=S%4*6;return v===0?(w.push(p>>16&255),w.push(p>>8&255),w.push(p&255)):v===18?(w.push(p>>10&255),w.push(p>>2&255)):v===12&&w.push(p>>4&255),new Uint8Array(w)}function s(m){let f="",S=0,u=m.length,p=r;for(let v=0;v<u;v++)v%3===0&&v&&(f+=p[S>>18&63],f+=p[S>>12&63],f+=p[S>>6&63],f+=p[S&63]),S=(S<<8)+m[v];let w=u%3;return w===0?(f+=p[S>>18&63],f+=p[S>>12&63],f+=p[S>>6&63],f+=p[S&63]):w===2?(f+=p[S>>10&63],f+=p[S>>4&63],f+=p[S<<2&63],f+=p[64]):w===1&&(f+=p[S>>2&63],f+=p[S<<4&63],f+=p[64],f+=p[64]),f}function y(m){return Object.prototype.toString.call(m)==="[object Uint8Array]"}return gn=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:l,construct:A,predicate:y,represent:s}),gn}var yn,zn;function mi(){if(zn)return yn;zn=1;let i=j(),r=Object.prototype.hasOwnProperty,l=Object.prototype.toString;function A(y){if(y===null)return!0;let m={},f=y;for(let S=0,u=f.length;S<u;S+=1){let p=f[S],w=!1;if(l.call(p)!=="[object Object]")return!1;let v;for(v in p)if(r.call(p,v))if(!w)w=!0;else return!1;if(!w||r.call(m,v))return!1;Object.defineProperty(m,v,{value:!0})}return!0}function s(y){return y!==null?y:[]}return yn=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:A,construct:s}),yn}var An,Vn;function gi(){if(Vn)return An;Vn=1;let i=j(),r=Object.prototype.toString;function l(s){if(s===null)return!0;let y=s,m=new Array(y.length);for(let f=0,S=y.length;f<S;f+=1){let u=y[f];if(r.call(u)!=="[object Object]")return!1;let p=Object.keys(u);if(p.length!==1)return!1;m[f]=[p[0],u[p[0]]]}return!0}function A(s){if(s===null)return[];let y=s,m=new Array(y.length);for(let f=0,S=y.length;f<S;f+=1){let u=y[f],p=Object.keys(u);m[f]=[p[0],u[p[0]]]}return m}return An=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:l,construct:A}),An}var xn,Qn;function yi(){if(Qn)return xn;Qn=1;let i=j(),r=Object.prototype.hasOwnProperty;function l(s){if(s===null)return!0;let y=s;for(let m in y)if(r.call(y,m)&&y[m]!==null)return!1;return!0}function A(s){return s!==null?s:{}}return xn=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:l,construct:A}),xn}var Tn,Xn;function Sn(){return Xn||(Xn=1,Tn=ai().extend({implicit:[pi(),hi()],explicit:[di(),mi(),gi(),yi()]})),Tn}var Jn;function Bi(){if(Jn)return Pe;Jn=1;let i=Ae(),r=xe(),l=Hi(),A=Sn(),s=Object.prototype.hasOwnProperty,y=1,m=2,f=3,S=4,u=1,p=2,w=3,v=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,R=/[\x85\u2028\u2029]/,W=/[,\[\]{}]/,M=/^(?:!|!!|![0-9A-Za-z-]+!)$/,B=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function ee(e){return Object.prototype.toString.call(e)}function U(e){return e===10||e===13}function Y(e){return e===9||e===32}function D(e){return e===9||e===32||e===10||e===13}function z(e){return e===44||e===91||e===93||e===123||e===125}function Ue(e){if(e>=48&&e<=57)return e-48;let o=e|32;return o>=97&&o<=102?o-97+10:-1}function Ye(e){return e===120?2:e===117?4:e===85?8:0}function Te(e){return e>=48&&e<=57?e-48:-1}function ce(e){switch(e){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
12
|
+
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function He(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function fe(e,o,d){o==="__proto__"?Object.defineProperty(e,o,{configurable:!0,enumerable:!0,writable:!0,value:d}):e[o]=d}let _e=new Array(256),se=new Array(256);for(let e=0;e<256;e++)_e[e]=ce(e)?1:0,se[e]=ce(e);function F(e,o){this.input=e,this.filename=o.filename||null,this.schema=o.schema||A,this.onWarning=o.onWarning||null,this.legacy=o.legacy||!1,this.json=o.json||!1,this.listener=o.listener||null,this.maxDepth=typeof o.maxDepth=="number"?o.maxDepth:100,this.maxTotalMergeKeys=typeof o.maxTotalMergeKeys=="number"?o.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function Se(e,o){let d={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return d.snippet=l(d),new r(o,d)}function E(e,o){throw Se(e,o)}function ie(e,o){e.onWarning&&e.onWarning.call(null,Se(e,o))}function G(e,o,d){let g=e.anchorMapTransactions;if(g.length!==0){let a=g[g.length-1];s.call(a,o)||(a[o]={existed:s.call(e.anchorMap,o),value:e.anchorMap[o]})}e.anchorMap[o]=d}function Be(e){e.anchorMapTransactions.push(Object.create(null))}function ne(e){let o=e.anchorMapTransactions.pop(),d=e.anchorMapTransactions;if(d.length===0)return;let g=d[d.length-1],a=Object.keys(o);for(let n=0,t=a.length;n<t;n+=1){let c=a[n];s.call(g,c)||(g[c]=o[c])}}function Ke(e){let o=e.anchorMapTransactions.pop(),d=Object.keys(o);for(let g=d.length-1;g>=0;g-=1){let a=o[d[g]];a.existed?e.anchorMap[d[g]]=a.value:delete e.anchorMap[d[g]]}}function ae(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,tag:e.tag,anchor:e.anchor,kind:e.kind,result:e.result}}function re(e,o){e.position=o.position,e.line=o.line,e.lineStart=o.lineStart,e.lineIndent=o.lineIndent,e.firstTabInLine=o.firstTabInLine,e.tag=o.tag,e.anchor=o.anchor,e.kind=o.kind,e.result=o.result}let be={YAML:function(o,d,g){o.version!==null&&E(o,"duplication of %YAML directive"),g.length!==1&&E(o,"YAML directive accepts exactly one argument");let a=/^([0-9]+)\.([0-9]+)$/.exec(g[0]);a===null&&E(o,"ill-formed argument of the YAML directive");let n=parseInt(a[1],10),t=parseInt(a[2],10);n!==1&&E(o,"unacceptable YAML version of the document"),o.version=g[0],o.checkLineBreaks=t<2,t!==1&&t!==2&&ie(o,"unsupported YAML version of the document")},TAG:function(o,d,g){let a;g.length!==2&&E(o,"TAG directive accepts exactly two arguments");let n=g[0];a=g[1],M.test(n)||E(o,"ill-formed tag handle (first argument) of the TAG directive"),s.call(o.tagMap,n)&&E(o,'there is a previously declared suffix for "'+n+'" tag handle'),B.test(a)||E(o,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{E(o,"tag prefix is malformed: "+a)}o.tagMap[n]=a}};function H(e,o,d,g){if(o<d){let a=e.input.slice(o,d);if(g)for(let n=0,t=a.length;n<t;n+=1){let c=a.charCodeAt(n);c===9||c>=32&&c<=1114111||E(e,"expected valid JSON character")}else v.test(a)&&E(e,"the stream contains non-printable characters");e.result+=a}}function V(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&E(e,"merge keys exceeded maxTotalMergeKeys ("+e.maxTotalMergeKeys+")")}function pe(e,o,d,g){i.isObject(d)||E(e,"cannot merge mappings; the provided source object is unacceptable"),V(e);let a=Object.keys(d);for(let n=0,t=a.length;n<t;n+=1){let c=a[n];V(e),s.call(o,c)||(fe(o,c,d[c]),g[c]=!0)}}function $(e,o,d,g,a,n,t,c,x){if(Array.isArray(a)){a=Array.prototype.slice.call(a);for(let T=0,_=a.length;T<_;T+=1)Array.isArray(a[T])&&E(e,"nested arrays are not supported inside keys"),typeof a=="object"&&ee(a[T])==="[object Object]"&&(a[T]="[object Object]")}if(typeof a=="object"&&ee(a)==="[object Object]"&&(a="[object Object]"),a=String(a),o===null&&(o={}),g==="tag:yaml.org,2002:merge")if(Array.isArray(n)){n.length>100&&E(e,"abnormal merge sequence size");for(let T=0,_=n.length;T<_;T+=1)pe(e,o,n[T],d)}else pe(e,o,n,d);else!e.json&&!s.call(d,a)&&s.call(o,a)&&(e.line=t||e.line,e.lineStart=c||e.lineStart,e.position=x||e.position,E(e,"duplicated mapping key")),fe(o,a,n),delete d[a];return o}function he(e){let o=e.input.charCodeAt(e.position);o===10?e.position++:o===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):E(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function P(e,o,d){let g=0,a=e.input.charCodeAt(e.position);for(;a!==0;){for(;Y(a);)a===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),a=e.input.charCodeAt(++e.position);if(o&&a===35)do a=e.input.charCodeAt(++e.position);while(a!==10&&a!==13&&a!==0);if(U(a))for(he(e),a=e.input.charCodeAt(e.position),g++,e.lineIndent=0;a===32;)e.lineIndent++,a=e.input.charCodeAt(++e.position);else break}return d!==-1&&g!==0&&e.lineIndent<d&&ie(e,"deficient indentation"),g}function K(e){let o=e.position,d=e.input.charCodeAt(o);return!!((d===45||d===46)&&d===e.input.charCodeAt(o+1)&&d===e.input.charCodeAt(o+2)&&(o+=3,d=e.input.charCodeAt(o),d===0||D(d)))}function oe(e,o){o===1?e.result+=" ":o>1&&(e.result+=i.repeat(`
|
|
13
|
+
`,o-1))}function we(e,o,d){let g,a,n,t,c,x,T=e.kind,_=e.result,h=e.input.charCodeAt(e.position);if(D(h)||z(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96)return!1;if(h===63||h===45){let b=e.input.charCodeAt(e.position+1);if(D(b)||d&&z(b))return!1}for(e.kind="scalar",e.result="",g=a=e.position,n=!1;h!==0;){if(h===58){let b=e.input.charCodeAt(e.position+1);if(D(b)||d&&z(b))break}else if(h===35){let b=e.input.charCodeAt(e.position-1);if(D(b))break}else{if(e.position===e.lineStart&&K(e)||d&&z(h))break;if(U(h))if(t=e.line,c=e.lineStart,x=e.lineIndent,P(e,!1,-1),e.lineIndent>=o){n=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=t,e.lineStart=c,e.lineIndent=x;break}}n&&(H(e,g,a,!1),oe(e,e.line-t),g=a=e.position,n=!1),Y(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return H(e,g,a,!1),e.result?!0:(e.kind=T,e.result=_,!1)}function de(e,o){let d,g,a=e.input.charCodeAt(e.position);if(a!==39)return!1;for(e.kind="scalar",e.result="",e.position++,d=g=e.position;(a=e.input.charCodeAt(e.position))!==0;)if(a===39)if(H(e,d,e.position,!0),a=e.input.charCodeAt(++e.position),a===39)d=e.position,e.position++,g=e.position;else return!0;else U(a)?(H(e,d,g,!0),oe(e,P(e,!1,o)),d=g=e.position):e.position===e.lineStart&&K(e)?E(e,"unexpected end of the document within a single quoted scalar"):(e.position++,Y(a)||(g=e.position));E(e,"unexpected end of the stream within a single quoted scalar")}function Ce(e,o){let d,g,a,n=e.input.charCodeAt(e.position);if(n!==34)return!1;for(e.kind="scalar",e.result="",e.position++,d=g=e.position;(n=e.input.charCodeAt(e.position))!==0;){if(n===34)return H(e,d,e.position,!0),e.position++,!0;if(n===92){if(H(e,d,e.position,!0),n=e.input.charCodeAt(++e.position),U(n))P(e,!1,o);else if(n<256&&_e[n])e.result+=se[n],e.position++;else if((a=Ye(n))>0){let t=a,c=0;for(;t>0;t--)n=e.input.charCodeAt(++e.position),(a=Ue(n))>=0?c=(c<<4)+a:E(e,"expected hexadecimal character");e.result+=He(c),e.position++}else E(e,"unknown escape sequence");d=g=e.position}else U(n)?(H(e,d,g,!0),oe(e,P(e,!1,o)),d=g=e.position):e.position===e.lineStart&&K(e)?E(e,"unexpected end of the document within a double quoted scalar"):(e.position++,Y(n)||(g=e.position))}E(e,"unexpected end of the stream within a double quoted scalar")}function Ee(e,o){let d=!0,g,a,n,t=e.tag,c,x=e.anchor,T,_,h,b,C=Object.create(null),k,L,O,I=e.input.charCodeAt(e.position);if(I===91)T=93,b=!1,c=[];else if(I===123)T=125,b=!0,c={};else return!1;for(e.anchor!==null&&G(e,e.anchor,c),I=e.input.charCodeAt(++e.position);I!==0;){if(P(e,!0,o),I=e.input.charCodeAt(e.position),I===T)return e.position++,e.tag=t,e.anchor=x,e.kind=b?"mapping":"sequence",e.result=c,!0;if(d?I===44&&E(e,"expected the node content, but found ','"):E(e,"missed comma between flow collection entries"),L=k=O=null,_=h=!1,I===63){let J=e.input.charCodeAt(e.position+1);D(J)&&(_=h=!0,e.position++,P(e,!0,o))}g=e.line,a=e.lineStart,n=e.position,X(e,o,y,!1,!0),L=e.tag,k=e.result,P(e,!0,o),I=e.input.charCodeAt(e.position),(h||e.line===g)&&I===58&&(_=!0,I=e.input.charCodeAt(++e.position),P(e,!0,o),X(e,o,y,!1,!0),O=e.result),b?$(e,c,C,L,k,O,g,a,n):_?c.push($(e,null,C,L,k,O,g,a,n)):c.push(k),P(e,!0,o),I=e.input.charCodeAt(e.position),I===44?(d=!0,I=e.input.charCodeAt(++e.position)):d=!1}E(e,"unexpected end of the stream within a flow collection")}function Q(e,o){let d,g=u,a=!1,n=!1,t=o,c=0,x=!1,T,_=e.input.charCodeAt(e.position);if(_===124)d=!1;else if(_===62)d=!0;else return!1;for(e.kind="scalar",e.result="";_!==0;)if(_=e.input.charCodeAt(++e.position),_===43||_===45)u===g?g=_===43?w:p:E(e,"repeat of a chomping mode identifier");else if((T=Te(_))>=0)T===0?E(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):n?E(e,"repeat of an indentation width identifier"):(t=o+T-1,n=!0);else break;if(Y(_)){do _=e.input.charCodeAt(++e.position);while(Y(_));if(_===35)do _=e.input.charCodeAt(++e.position);while(!U(_)&&_!==0)}for(;_!==0;){for(he(e),e.lineIndent=0,_=e.input.charCodeAt(e.position);(!n||e.lineIndent<t)&&_===32;)e.lineIndent++,_=e.input.charCodeAt(++e.position);if(!n&&e.lineIndent>t&&(t=e.lineIndent),U(_)){c++;continue}if(!n&&t===0&&E(e,"missing indentation for block scalar"),e.lineIndent<t){g===w?e.result+=i.repeat(`
|
|
14
|
+
`,a?1+c:c):g===u&&a&&(e.result+=`
|
|
15
|
+
`);break}d?Y(_)?(x=!0,e.result+=i.repeat(`
|
|
16
|
+
`,a?1+c:c)):x?(x=!1,e.result+=i.repeat(`
|
|
17
|
+
`,c+1)):c===0?a&&(e.result+=" "):e.result+=i.repeat(`
|
|
18
|
+
`,c):e.result+=i.repeat(`
|
|
19
|
+
`,a?1+c:c),a=!0,n=!0,c=0;let h=e.position;for(;!U(_)&&_!==0;)_=e.input.charCodeAt(++e.position);H(e,h,e.position,!1)}return!0}function ke(e,o){let d=e.tag,g=e.anchor,a=[],n=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&G(e,e.anchor,a);let t=e.input.charCodeAt(e.position);for(;t!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,E(e,"tab characters must not be used in indentation")),t===45);){let c=e.input.charCodeAt(e.position+1);if(!D(c))break;if(n=!0,e.position++,P(e,!0,-1)&&e.lineIndent<=o){a.push(null),t=e.input.charCodeAt(e.position);continue}let x=e.line;if(X(e,o,f,!1,!0),a.push(e.result),P(e,!0,-1),t=e.input.charCodeAt(e.position),(e.line===x||e.lineIndent>o)&&t!==0)E(e,"bad indentation of a sequence entry");else if(e.lineIndent<o)break}return n?(e.tag=d,e.anchor=g,e.kind="sequence",e.result=a,!0):!1}function Le(e,o,d){let g,a,n,t,c=e.tag,x=e.anchor,T={},_=Object.create(null),h=null,b=null,C=null,k=!1,L=!1;if(e.firstTabInLine!==-1)return!1;e.anchor!==null&&G(e,e.anchor,T);let O=e.input.charCodeAt(e.position);for(;O!==0;){!k&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,E(e,"tab characters must not be used in indentation"));let I=e.input.charCodeAt(e.position+1),J=e.line;if((O===63||O===58)&&D(I))O===63?(k&&($(e,T,_,h,b,null,a,n,t),h=b=C=null),L=!0,k=!0,g=!0):k?(k=!1,g=!0):E(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,O=I;else{if(a=e.line,n=e.lineStart,t=e.position,!X(e,d,m,!1,!0))break;if(e.line===J){for(O=e.input.charCodeAt(e.position);Y(O);)O=e.input.charCodeAt(++e.position);if(O===58)O=e.input.charCodeAt(++e.position),D(O)||E(e,"a whitespace character is expected after the key-value separator within a block mapping"),k&&($(e,T,_,h,b,null,a,n,t),h=b=C=null),L=!0,k=!1,g=!1,h=e.tag,b=e.result;else if(L)E(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=x,!0}else if(L)E(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=x,!0}if((e.line===J||e.lineIndent>o)&&(k&&(a=e.line,n=e.lineStart,t=e.position),X(e,o,S,!0,g)&&(k?b=e.result:C=e.result),k||($(e,T,_,h,b,C,a,n,t),h=b=C=null),P(e,!0,-1),O=e.input.charCodeAt(e.position)),(e.line===J||e.lineIndent>o)&&O!==0)E(e,"bad indentation of a mapping entry");else if(e.lineIndent<o)break}return k&&$(e,T,_,h,b,null,a,n,t),L&&(e.tag=c,e.anchor=x,e.kind="mapping",e.result=T),L}function ve(e){let o=!1,d=!1,g,a,n=e.input.charCodeAt(e.position);if(n!==33)return!1;e.tag!==null&&E(e,"duplication of a tag property"),n=e.input.charCodeAt(++e.position),n===60?(o=!0,n=e.input.charCodeAt(++e.position)):n===33?(d=!0,g="!!",n=e.input.charCodeAt(++e.position)):g="!";let t=e.position;if(o){do n=e.input.charCodeAt(++e.position);while(n!==0&&n!==62);e.position<e.length?(a=e.input.slice(t,e.position),n=e.input.charCodeAt(++e.position)):E(e,"unexpected end of the stream within a verbatim tag")}else{for(;n!==0&&!D(n);)n===33&&(d?E(e,"tag suffix cannot contain exclamation marks"):(g=e.input.slice(t-1,e.position+1),M.test(g)||E(e,"named tag handle cannot contain such characters"),d=!0,t=e.position+1)),n=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),W.test(a)&&E(e,"tag suffix cannot contain flow indicator characters")}a&&!B.test(a)&&E(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{E(e,"tag name is malformed: "+a)}return o?e.tag=a:s.call(e.tagMap,g)?e.tag=e.tagMap[g]+a:g==="!"?e.tag="!"+a:g==="!!"?e.tag="tag:yaml.org,2002:"+a:E(e,'undeclared tag handle "'+g+'"'),!0}function Oe(e){let o=e.input.charCodeAt(e.position);if(o!==38)return!1;e.anchor!==null&&E(e,"duplication of an anchor property"),o=e.input.charCodeAt(++e.position);let d=e.position;for(;o!==0&&!D(o)&&!z(o);)o=e.input.charCodeAt(++e.position);return e.position===d&&E(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(d,e.position),!0}function Ge(e){let o=e.input.charCodeAt(e.position);if(o!==42)return!1;o=e.input.charCodeAt(++e.position);let d=e.position;for(;o!==0&&!D(o)&&!z(o);)o=e.input.charCodeAt(++e.position);e.position===d&&E(e,"name of an alias node must contain at least one character");let g=e.input.slice(d,e.position);return s.call(e.anchorMap,g)||E(e,'unidentified alias "'+g+'"'),e.result=e.anchorMap[g],P(e,!0,-1),!0}function Ie(e,o,d,g){let a=ae(e);return Be(e),re(e,o),e.tag=null,e.anchor=null,e.kind=null,e.result=null,Le(e,d,g)&&e.kind==="mapping"?(ne(e),!0):(Ke(e),re(e,a),!1)}function X(e,o,d,g,a){let n,t,c=1,x=!1,T=!1,_=null,h,b,C;e.depth>=e.maxDepth&&E(e,"nesting exceeded maxDepth ("+e.maxDepth+")"),e.depth+=1,e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null;let k=n=t=S===d||f===d;if(g&&P(e,!0,-1)&&(x=!0,e.lineIndent>o?c=1:e.lineIndent===o?c=0:e.lineIndent<o&&(c=-1)),c===1)for(;;){let L=e.input.charCodeAt(e.position),O=ae(e);if(x&&(L===33&&e.tag!==null||L===38&&e.anchor!==null)||!ve(e)&&!Oe(e))break;_===null&&(_=O),P(e,!0,-1)?(x=!0,t=k,e.lineIndent>o?c=1:e.lineIndent===o?c=0:e.lineIndent<o&&(c=-1)):t=!1}if(t&&(t=x||a),c===1||S===d)if(y===d||m===d?b=o:b=o+1,C=e.position-e.lineStart,c===1)if(t&&(ke(e,C)||Le(e,C,b))||Ee(e,b))T=!0;else{let L=e.input.charCodeAt(e.position);_!==null&&k&&!t&&L!==124&&L!==62&&Ie(e,_,_.position-_.lineStart,b)||n&&Q(e,b)||de(e,b)||Ce(e,b)?T=!0:Ge(e)?(T=!0,(e.tag!==null||e.anchor!==null)&&E(e,"alias node should not have any properties")):we(e,b,y===d)&&(T=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&G(e,e.anchor,e.result)}else c===0&&(T=t&&ke(e,C));if(e.tag===null)e.anchor!==null&&G(e,e.anchor,e.result);else if(e.tag==="?"){e.result!==null&&e.kind!=="scalar"&&E(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"');for(let L=0,O=e.implicitTypes.length;L<O;L+=1)if(h=e.implicitTypes[L],h.resolve(e.result)){e.result=h.construct(e.result),e.tag=h.tag,e.anchor!==null&&G(e,e.anchor,e.result);break}}else if(e.tag!=="!"){if(s.call(e.typeMap[e.kind||"fallback"],e.tag))h=e.typeMap[e.kind||"fallback"][e.tag];else{h=null;let L=e.typeMap.multi[e.kind||"fallback"];for(let O=0,I=L.length;O<I;O+=1)if(e.tag.slice(0,L[O].tag.length)===L[O].tag){h=L[O];break}}h||E(e,"unknown tag !<"+e.tag+">"),e.result!==null&&h.kind!==e.kind&&E(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result,e.tag)?(e.result=h.construct(e.result,e.tag),e.anchor!==null&&G(e,e.anchor,e.result)):E(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.depth-=1,e.tag!==null||e.anchor!==null||T}function $e(e){let o=e.position,d=!1,g;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(g=e.input.charCodeAt(e.position))!==0&&(P(e,!0,-1),g=e.input.charCodeAt(e.position),!(e.lineIndent>0||g!==37));){d=!0,g=e.input.charCodeAt(++e.position);let a=e.position;for(;g!==0&&!D(g);)g=e.input.charCodeAt(++e.position);let n=e.input.slice(a,e.position),t=[];for(n.length<1&&E(e,"directive name must not be less than one character in length");g!==0;){for(;Y(g);)g=e.input.charCodeAt(++e.position);if(g===35){do g=e.input.charCodeAt(++e.position);while(g!==0&&!U(g));break}if(U(g))break;for(a=e.position;g!==0&&!D(g);)g=e.input.charCodeAt(++e.position);t.push(e.input.slice(a,e.position))}g!==0&&he(e),s.call(be,n)?be[n](e,n,t):ie(e,'unknown document directive "'+n+'"')}if(P(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,P(e,!0,-1)):d&&E(e,"directives end mark is expected"),X(e,e.lineIndent-1,S,!1,!0),P(e,!0,-1),e.checkLineBreaks&&R.test(e.input.slice(o,e.position))&&ie(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&K(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,P(e,!0,-1));return}e.position<e.length-1&&E(e,"end of the stream or a document separator is expected")}function me(e,o){e=String(e),o=o||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
20
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));let d=new F(e,o),g=e.indexOf("\0");for(g!==-1&&(d.position=g,E(d,"null byte is not allowed in input")),d.input+="\0";d.input.charCodeAt(d.position)===32;)d.lineIndent+=1,d.position+=1;for(;d.position<d.length-1;)$e(d);return d.documents}function We(e,o,d){o!==null&&typeof o=="object"&&typeof d>"u"&&(d=o,o=null);let g=me(e,d);if(typeof o!="function")return g;for(let a=0,n=g.length;a<n;a+=1)o(g[a])}function ze(e,o){let d=me(e,o);if(d.length!==0){if(d.length===1)return d[0];throw new r("expected a single document in the stream, but found more")}}return Pe.loadAll=We,Pe.load=ze,Pe}var _n={},Zn;function Ki(){if(Zn)return _n;Zn=1;let i=Ae(),r=xe(),l=Sn(),A=Object.prototype.toString,s=Object.prototype.hasOwnProperty,y=65279,m=9,f=10,S=13,u=32,p=33,w=34,v=35,R=37,W=38,M=39,B=42,ee=44,U=45,Y=58,D=61,z=62,Ue=63,Ye=64,Te=91,ce=93,He=96,fe=123,_e=124,se=125,F={};F[0]="\\0",F[7]="\\a",F[8]="\\b",F[9]="\\t",F[10]="\\n",F[11]="\\v",F[12]="\\f",F[13]="\\r",F[27]="\\e",F[34]='\\"',F[92]="\\\\",F[133]="\\N",F[160]="\\_",F[8232]="\\L",F[8233]="\\P";let Se=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],E=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function ie(n,t){if(t===null)return{};let c={},x=Object.keys(t);for(let T=0,_=x.length;T<_;T+=1){let h=x[T],b=String(t[h]);h.slice(0,2)==="!!"&&(h="tag:yaml.org,2002:"+h.slice(2));let C=n.compiledTypeMap.fallback[h];C&&s.call(C.styleAliases,b)&&(b=C.styleAliases[b]),c[h]=b}return c}function G(n){let t,c,x=n.toString(16).toUpperCase();if(n<=255)t="x",c=2;else if(n<=65535)t="u",c=4;else if(n<=4294967295)t="U",c=8;else throw new r("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+i.repeat("0",c-x.length)+x}let Be=1,ne=2;function Ke(n){this.schema=n.schema||l,this.indent=Math.max(1,n.indent||2),this.noArrayIndent=n.noArrayIndent||!1,this.skipInvalid=n.skipInvalid||!1,this.flowLevel=i.isNothing(n.flowLevel)?-1:n.flowLevel,this.styleMap=ie(this.schema,n.styles||null),this.sortKeys=n.sortKeys||!1,this.lineWidth=n.lineWidth||80,this.noRefs=n.noRefs||!1,this.noCompatMode=n.noCompatMode||!1,this.condenseFlow=n.condenseFlow||!1,this.quotingType=n.quotingType==='"'?ne:Be,this.forceQuotes=n.forceQuotes||!1,this.replacer=typeof n.replacer=="function"?n.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function ae(n,t){let c=i.repeat(" ",t),x=0,T="",_=n.length;for(;x<_;){let h,b=n.indexOf(`
|
|
21
|
+
`,x);b===-1?(h=n.slice(x),x=_):(h=n.slice(x,b+1),x=b+1),h.length&&h!==`
|
|
22
|
+
`&&(T+=c),T+=h}return T}function re(n,t){return`
|
|
23
|
+
`+i.repeat(" ",n.indent*t)}function be(n,t){for(let c=0,x=n.implicitTypes.length;c<x;c+=1)if(n.implicitTypes[c].resolve(t))return!0;return!1}function H(n){return n===u||n===m}function V(n){return n>=32&&n<=126||n>=161&&n<=55295&&n!==8232&&n!==8233||n>=57344&&n<=65533&&n!==y||n>=65536&&n<=1114111}function pe(n){return V(n)&&n!==y&&n!==S&&n!==f}function $(n,t,c){let x=pe(n),T=x&&!H(n);return(c?x:x&&n!==ee&&n!==Te&&n!==ce&&n!==fe&&n!==se)&&n!==v&&!(t===Y&&!T)||pe(t)&&!H(t)&&n===v||t===Y&&T}function he(n){return V(n)&&n!==y&&!H(n)&&n!==U&&n!==Ue&&n!==Y&&n!==ee&&n!==Te&&n!==ce&&n!==fe&&n!==se&&n!==v&&n!==W&&n!==B&&n!==p&&n!==_e&&n!==D&&n!==z&&n!==M&&n!==w&&n!==R&&n!==Ye&&n!==He}function P(n){return!H(n)&&n!==Y}function K(n,t){let c=n.charCodeAt(t),x;return c>=55296&&c<=56319&&t+1<n.length&&(x=n.charCodeAt(t+1),x>=56320&&x<=57343)?(c-55296)*1024+x-56320+65536:c}function oe(n){return/^\n* /.test(n)}let we=1,de=2,Ce=3,Ee=4,Q=5;function ke(n,t,c,x,T,_,h,b){let C,k=0,L=null,O=!1,I=!1,J=x!==-1,ge=-1,ye=he(K(n,0))&&P(K(n,n.length-1));if(t||h)for(C=0;C<n.length;k>=65536?C+=2:C++){if(k=K(n,C),!V(k))return Q;ye=ye&&$(k,L,b),L=k}else{for(C=0;C<n.length;k>=65536?C+=2:C++){if(k=K(n,C),k===f)O=!0,J&&(I=I||C-ge-1>x&&n[ge+1]!==" ",ge=C);else if(!V(k))return Q;ye=ye&&$(k,L,b),L=k}I=I||J&&C-ge-1>x&&n[ge+1]!==" "}return!O&&!I?ye&&!h&&!T(n)?we:_===ne?Q:de:c>9&&oe(n)?Q:h?_===ne?Q:de:I?Ee:Ce}function Le(n,t,c,x,T){n.dump=(function(){if(t.length===0)return n.quotingType===ne?'""':"''";if(!n.noCompatMode&&(Se.indexOf(t)!==-1||E.test(t)))return n.quotingType===ne?'"'+t+'"':"'"+t+"'";let _=n.indent*Math.max(1,c),h=n.lineWidth===-1?-1:Math.max(Math.min(n.lineWidth,40),n.lineWidth-_),b=x||n.flowLevel>-1&&c>=n.flowLevel;function C(k){return be(n,k)}switch(ke(t,b,n.indent,h,C,n.quotingType,n.forceQuotes&&!x,T)){case we:return t;case de:return"'"+t.replace(/'/g,"''")+"'";case Ce:return"|"+ve(t,n.indent)+Oe(ae(t,_));case Ee:return">"+ve(t,n.indent)+Oe(ae(Ge(t,h),_));case Q:return'"'+X(t)+'"';default:throw new r("impossible error: invalid scalar style")}})()}function ve(n,t){let c=oe(n)?String(t):"",x=n[n.length-1]===`
|
|
24
|
+
`,_=x&&(n[n.length-2]===`
|
|
25
|
+
`||n===`
|
|
26
|
+
`)?"+":x?"":"-";return c+_+`
|
|
27
|
+
`}function Oe(n){return n[n.length-1]===`
|
|
28
|
+
`?n.slice(0,-1):n}function Ge(n,t){let c=/(\n+)([^\n]*)/g,x=(function(){let b=n.indexOf(`
|
|
29
|
+
`);return b=b!==-1?b:n.length,c.lastIndex=b,Ie(n.slice(0,b),t)})(),T=n[0]===`
|
|
30
|
+
`||n[0]===" ",_,h;for(;h=c.exec(n);){let b=h[1],C=h[2];_=C[0]===" ",x+=b+(!T&&!_&&C!==""?`
|
|
31
|
+
`:"")+Ie(C,t),T=_}return x}function Ie(n,t){if(n===""||n[0]===" ")return n;let c=/ [^ ]/g,x,T=0,_,h=0,b=0,C="";for(;x=c.exec(n);)b=x.index,b-T>t&&(_=h>T?h:b,C+=`
|
|
32
|
+
`+n.slice(T,_),T=_+1),h=b;return C+=`
|
|
33
|
+
`,n.length-T>t&&h>T?C+=n.slice(T,h)+`
|
|
34
|
+
`+n.slice(h+1):C+=n.slice(T),C.slice(1)}function X(n){let t="",c=0;for(let x=0;x<n.length;c>=65536?x+=2:x++){c=K(n,x);let T=F[c];!T&&V(c)?(t+=n[x],c>=65536&&(t+=n[x+1])):t+=T||G(c)}return t}function $e(n,t,c){let x="",T=n.tag;for(let _=0,h=c.length;_<h;_+=1){let b=c[_];n.replacer&&(b=n.replacer.call(c,String(_),b)),(o(n,t,b,!1,!1)||typeof b>"u"&&o(n,t,null,!1,!1))&&(x!==""&&(x+=","+(n.condenseFlow?"":" ")),x+=n.dump)}n.tag=T,n.dump="["+x+"]"}function me(n,t,c,x){let T="",_=n.tag;for(let h=0,b=c.length;h<b;h+=1){let C=c[h];n.replacer&&(C=n.replacer.call(c,String(h),C)),(o(n,t+1,C,!0,!0,!1,!0)||typeof C>"u"&&o(n,t+1,null,!0,!0,!1,!0))&&((!x||T!=="")&&(T+=re(n,t)),n.dump&&f===n.dump.charCodeAt(0)?T+="-":T+="- ",T+=n.dump)}n.tag=_,n.dump=T||"[]"}function We(n,t,c){let x="",T=n.tag,_=Object.keys(c);for(let h=0,b=_.length;h<b;h+=1){let C="";x!==""&&(C+=", "),n.condenseFlow&&(C+='"');let k=_[h],L=c[k];n.replacer&&(L=n.replacer.call(c,k,L)),o(n,t,k,!1,!1)&&(n.dump.length>1024&&(C+="? "),C+=n.dump+(n.condenseFlow?'"':"")+":"+(n.condenseFlow?"":" "),o(n,t,L,!1,!1)&&(C+=n.dump,x+=C))}n.tag=T,n.dump="{"+x+"}"}function ze(n,t,c,x){let T="",_=n.tag,h=Object.keys(c);if(n.sortKeys===!0)h.sort();else if(typeof n.sortKeys=="function")h.sort(n.sortKeys);else if(n.sortKeys)throw new r("sortKeys must be a boolean or a function");for(let b=0,C=h.length;b<C;b+=1){let k="";(!x||T!=="")&&(k+=re(n,t));let L=h[b],O=c[L];if(n.replacer&&(O=n.replacer.call(c,L,O)),!o(n,t+1,L,!0,!0,!0))continue;let I=n.tag!==null&&n.tag!=="?"||n.dump&&n.dump.length>1024;I&&(n.dump&&f===n.dump.charCodeAt(0)?k+="?":k+="? "),k+=n.dump,I&&(k+=re(n,t)),o(n,t+1,O,!0,I)&&(n.dump&&f===n.dump.charCodeAt(0)?k+=":":k+=": ",k+=n.dump,T+=k)}n.tag=_,n.dump=T||"{}"}function e(n,t,c){let x=c?n.explicitTypes:n.implicitTypes;for(let T=0,_=x.length;T<_;T+=1){let h=x[T];if((h.instanceOf||h.predicate)&&(!h.instanceOf||typeof t=="object"&&t instanceof h.instanceOf)&&(!h.predicate||h.predicate(t))){if(c?h.multi&&h.representName?n.tag=h.representName(t):n.tag=h.tag:n.tag="?",h.represent){let b=n.styleMap[h.tag]||h.defaultStyle,C;if(A.call(h.represent)==="[object Function]")C=h.represent(t,b);else if(s.call(h.represent,b))C=h.represent[b](t,b);else throw new r("!<"+h.tag+'> tag resolver accepts not "'+b+'" style');n.dump=C}return!0}}return!1}function o(n,t,c,x,T,_,h){n.tag=null,n.dump=c,e(n,c,!1)||e(n,c,!0);let b=A.call(n.dump),C=x;x&&(x=n.flowLevel<0||n.flowLevel>t);let k=b==="[object Object]"||b==="[object Array]",L,O;if(k&&(L=n.duplicates.indexOf(c),O=L!==-1),(n.tag!==null&&n.tag!=="?"||O||n.indent!==2&&t>0)&&(T=!1),O&&n.usedDuplicates[L])n.dump="*ref_"+L;else{if(k&&O&&!n.usedDuplicates[L]&&(n.usedDuplicates[L]=!0),b==="[object Object]")x&&Object.keys(n.dump).length!==0?(ze(n,t,n.dump,T),O&&(n.dump="&ref_"+L+n.dump)):(We(n,t,n.dump),O&&(n.dump="&ref_"+L+" "+n.dump));else if(b==="[object Array]")x&&n.dump.length!==0?(n.noArrayIndent&&!h&&t>0?me(n,t-1,n.dump,T):me(n,t,n.dump,T),O&&(n.dump="&ref_"+L+n.dump)):($e(n,t,n.dump),O&&(n.dump="&ref_"+L+" "+n.dump));else if(b==="[object String]")n.tag!=="?"&&Le(n,n.dump,t,_,C);else{if(b==="[object Undefined]")return!1;if(n.skipInvalid)return!1;throw new r("unacceptable kind of an object to dump "+b)}if(n.tag!==null&&n.tag!=="?"){let I=encodeURI(n.tag[0]==="!"?n.tag.slice(1):n.tag).replace(/!/g,"%21");n.tag[0]==="!"?I="!"+I:I.slice(0,18)==="tag:yaml.org,2002:"?I="!!"+I.slice(18):I="!<"+I+">",n.dump=I+" "+n.dump}}return!0}function d(n,t){let c=[],x=[];g(n,c,x);let T=x.length;for(let _=0;_<T;_+=1)t.duplicates.push(c[x[_]]);t.usedDuplicates=new Array(T)}function g(n,t,c){if(n!==null&&typeof n=="object"){let x=t.indexOf(n);if(x!==-1)c.indexOf(x)===-1&&c.push(x);else if(t.push(n),Array.isArray(n))for(let T=0,_=n.length;T<_;T+=1)g(n[T],t,c);else{let T=Object.keys(n);for(let _=0,h=T.length;_<h;_+=1)g(n[T[_]],t,c)}}}function a(n,t){t=t||{};let c=new Ke(t);c.noRefs||d(n,c);let x=n;return c.replacer&&(x=c.replacer.call({"":x},"",x)),o(c,0,x,!0,!0)?c.dump+`
|
|
35
|
+
`:""}return _n.dump=a,_n}var ei;function Gi(){if(ei)return q;ei=1;let i=Bi(),r=Ki();function l(A,s){return function(){throw new Error("Function yaml."+A+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return q.Type=j(),q.Schema=ni(),q.FAILSAFE_SCHEMA=ti(),q.JSON_SCHEMA=si(),q.CORE_SCHEMA=ai(),q.DEFAULT_SCHEMA=Sn(),q.load=i.load,q.loadAll=i.loadAll,q.dump=r.dump,q.YAMLException=xe(),q.types={binary:di(),float:fi(),map:oi(),null:li(),pairs:gi(),set:yi(),timestamp:pi(),bool:ui(),int:ci(),merge:hi(),omap:mi(),seq:ri(),str:ii()},q.safeLoad=l("safeLoad","load"),q.safeLoadAll=l("safeLoadAll","loadAll"),q.safeDump=l("safeDump","dump"),q}var $i=Gi(),Fe=Yi($i),{Type:br,Schema:wr,FAILSAFE_SCHEMA:Cr,JSON_SCHEMA:Er,CORE_SCHEMA:kr,DEFAULT_SCHEMA:Lr,load:vr,loadAll:Or,dump:Ir,YAMLException:Nr,types:Rr,safeLoad:Mr,safeLoadAll:Pr,safeDump:Fr}=Fe;var Ai=(i,r,l)=>N.preprocess(A=>A===void 0||typeof A=="string"&&!A.trim()?i:A,N.union([N.number(),N.string().trim().regex(/^\d+$/,"Enter a whole number").transform(Number)]).pipe(N.number().int().min(r).max(l))),nr=Xe.extend({name:N.string().trim().min(1,"Name is required"),base_url:N.url("Enter a valid HTTP(S) URL").refine(i=>/^https?:\/\//i.test(i),"Use an HTTP(S) URL"),api_key:N.string().trim().min(1,"API key is required"),model:N.string().trim().min(1,"Model is required"),thinking:N.enum(le).optional(),context_window:Ai(Ne,1e3,1e7),max_output_tokens:Ai(Re,1,1e6)}).refine(i=>i.max_output_tokens<=i.context_window,{path:["max_output_tokens"],message:"Max output tokens must not exceed the context window"}).transform(i=>({...i,thinking:Je(i)}));function bn(i){if(!xi(i))return{};let r;try{r=Fe.load(Vi(i,"utf-8"))}catch{throw new Error(`Unable to read existing ${i}; it has not been changed.`)}return N.record(N.string(),N.unknown()).parse(r??{})}function wn(i,r){let l=Zi(i);zi(l,{recursive:!0});let A=er(l,`.config-${Wi()}.tmp`);try{Ji(A,Fe.dump(r,{lineWidth:-1,noRefs:!0}),{encoding:"utf-8",mode:384,flag:"wx"}),Qi(A,i)}finally{xi(A)&&Xi(A)}}function Kr(i,r){let l=nr.parse(i),A=Me(),s=bn(A),m=[...N.array(N.record(N.string(),N.unknown())).parse(s.providers??[])];for(let p of r)m.some(w=>w.base_url===p.base_url)||m.push({...p});let f=[],S=!1;for(let p of m){if(p.base_url!==l.base_url){f.push(p);continue}S||(S=!0,f.push(l))}S||f.push(l);let u=f.map(p=>Xe.parse(p));return wn(A,{...s,providers:f}),{provider:l,providers:u,replaced:S,path:A}}function Ti(i,r,l){let A=Me(),s=bn(A),y=N.array(N.record(N.string(),N.unknown())).parse(s.providers??[]),m=y.filter(S=>S.base_url===i);if(m.length===0)throw new Error(`Provider with base URL "${i}" not found in ${A}.`);let f=m.filter(S=>S[r]!==l);if(f.length!==0){for(let S of f)S[r]=l;wn(A,{...s,providers:y})}}function Gr(i,r){Ti(i,"thinking",r)}function $r(i,r){Ti(i,"model",r)}function Wr(i){let r=Me(),l=bn(r);l.default_provider!==i&&wn(r,{...l,default_provider:i})}import{realpathSync as ir}from"fs";import{homedir as rr}from"os";import{basename as or,dirname as tr,isAbsolute as Si,join as bi,relative as wi,resolve as _i,sep as Ci}from"path";function Jr(i){let r=_i(i),l=[];for(;;)try{return bi(ir(r),...l)}catch(A){if(!(A instanceof Error)||!("code"in A)||A.code!=="ENOENT"&&A.code!=="ENOTDIR")throw A;let s=tr(r);if(s===r)return _i(i);l.unshift(or(r)),r=s}}function Zr(i,r){let l=wi(i,r);return l===""||l!==".."&&!l.startsWith(`..${Ci}`)&&!Si(l)}function eo(i){let r=rr(),l=wi(r,i);return l===""?"~":!l.startsWith(`..${Ci}`)&&l!==".."&&!Si(l)?bi("~",l):i}import{randomBytes as ur}from"crypto";function io(){let i=Date.now().toString(36),r=ur(6).toString("hex");return`${i}-${r}`}var fr=En({module:"utils"});function sr(i){if(typeof i=="string")return i;let r=[];for(let l of i)if(l.type==="text"&&typeof l.text=="string")r.push(l.text);else if(l.type==="image"&&Cn(l.source)){let A=l.source.type==="base64"&&typeof l.source.media_type=="string"?l.source.media_type:"image";r.push(`[Image: ${A}]`)}else if(l.type==="tool_reference"&&typeof l.tool_name=="string")r.push(`[Tool reference: ${l.tool_name}]`);else if(l.type==="search_result"){let A=typeof l.title=="string"?l.title:"search result",s=typeof l.source=="string"?` (${l.source})`:"",y=Array.isArray(l.content)?sr(l.content.filter(Cn)):"";r.push(`${A}${s}${y?`
|
|
36
|
+
${y}`:""}`)}else if(l.type==="document"){let A=typeof l.title=="string"?l.title:"document";r.push(`[Document: ${A}]`)}return r.join(`
|
|
37
|
+
`)}function Cn(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function oo(i){return Cn(i)?i:Array.isArray(i)?Object.fromEntries(i.entries()):{}}function ar(i){return typeof i=="string"?i:String(i)}function to(i){return i instanceof Error?i.message:ar(i)}function lo(i){return typeof i=="object"&&i!==null}function pr(i,r){return typeof i!="function"?i:function(...l){let A;try{A=r?i.call(r,...l):i.call(this,...l)}catch(s){fr.error({err:s},"utils operation failed");return}return A}}var uo=pr(JSON.parse,JSON);function co(i,r,l){let A=i[r];if(typeof A=="number")return Math.floor(A);if(typeof A=="string"){let s=Number.parseInt(A,10);return Number.isNaN(s)?l:s}return l}function fo(i){return Array.isArray(i)?i.filter(r=>typeof r=="string"):[]}function De(i,r,l){let A=i[r];return typeof A=="string"?A:l??""}function so(i,r,l){let A=i[r];if(typeof A=="boolean")return A;if(typeof A=="string"){let s=A.trim().toLowerCase();if(s==="true"||s==="1")return!0;if(s==="false"||s==="0")return!1}if(typeof A=="number"){if(A===1)return!0;if(A===0)return!1}return l??!1}function ao(i){return i.command?qe(De(i,"command"),80):i.file_path?qe(De(i,"file_path"),80):i.pattern?qe(De(i,"pattern"),80):i.description?qe(De(i,"description"),80):""}function qe(i,r){return i.length>r?`${i.slice(0,r)}\u2026`:i}var hr="Tool execution was interrupted. The tool may or may not have completed; verify before relying on its effects.",ho="The user rejected this tool use. Nothing was changed (for file edits, the new content was NOT written).";function mo(i){let r=[];for(let l=0;l<i.length;l++){let A=i[l];if(A.role==="assistant"&&A.toolUses?.length){r.push(A);let s=new Set(A.toolUses.map(f=>f.toolUseId)),y=[],m=[];for(;l+1<i.length;){let f=i[l+1];if(f.role!=="user"||!f.toolResults?.length||f.toolUses?.length)break;l++,m.push(f);for(let S of f.toolResults)s.delete(S.toolUseId)&&y.push(S)}for(let f of s)y.push({toolUseId:f,content:hr,isError:!0});r.push({...m[0]??{role:"user",content:""},toolResults:y});for(let f of m.slice(1))(f.content.length>0||f.thinkingBlocks?.length)&&r.push({...f,toolResults:[]});continue}if((A.toolResults?.length??0)>0){if(A.content.length===0&&!A.toolUses?.length&&!A.thinkingBlocks?.length)continue;r.push({...A,toolResults:[]})}else r.push(A)}return r}var ue=class extends Error{constructor(r){super(r),this.name="LLMError"}},Ei=class extends ue{constructor(r){super(r),this.name="AuthenticationError"}},ki=class extends ue{retryAfter;constructor(r,l){super(r),this.name="RateLimitError",this.retryAfter=l}},Li=class extends ue{constructor(r){super(r),this.name="NetworkError"}},vi=class extends ue{constructor(r){super(r),this.name="ContextTooLongError"}};function yo(i){return/context_length_exceeded/i.test(i)||/maximum\s+context\s+length/i.test(i)||/prompts?\s+(?:is\s+)?too\s+long/i.test(i)}function je(i){return!!i._zod}function Po(i,r){return je(i)?Ve(i,r):i.safeParse(r)}async function Fo(i,r){return je(i)?await Qe(i,r):await i.safeParseAsync(r)}function Do(i){if(!i)return;let r;if(je(i)?r=i._zod?.def?.shape:r=i.shape,!!r){if(typeof r=="function")try{return r()}catch{return}return r}}function dr(i){return i.length===0?"object root":i.reduce((r,l,A)=>A===0?String(l):typeof l=="number"?`${r}[${l}]`:`${r}.${l}`,"")}function qo(i){if(i&&typeof i=="object"){if("issues"in i&&Array.isArray(i.issues)&&i.issues.length>0)return i.issues.map(r=>r.path?.length?`${r.message} at ${dr(r.path)}`:r.message).join(`
|
|
38
|
+
`);if("message"in i&&typeof i.message=="string")return i.message;try{return JSON.stringify(i)}catch{return String(i)}}return String(i)}function jo(i){if(je(i)){let y=i._zod?.def;if(y){if(y.value!==void 0)return y.value;if(Array.isArray(y.values)&&y.values.length>0)return y.values[0]}}let l=i._def;if(l){if(l.value!==void 0)return l.value;if(Array.isArray(l.values)&&l.values.length>0)return l.values[0]}let A=i.value;if(A!==void 0)return A}export{Po as a,Fo as b,Do as c,qo as d,jo as e,Fe as f,Me as g,le as h,Xe as i,Ar as j,Mi as k,Ne as l,Re as m,Di as n,xr as o,Je as p,Tr as q,kn as r,qi as s,ji as t,Ui as u,_r as v,Ln as w,vn as x,nr as y,Kr as z,Gr as A,$r as B,Wr as C,Jr as D,Zr as E,eo as F,io as G,sr as H,Cn as I,oo as J,ar as K,to as L,lo as M,uo as N,co as O,fo as P,De as Q,so as R,ao as S,ho as T,mo as U,ue as V,Ei as W,ki as X,Li as Y,vi as Z,yo as _};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{a as d,d as g,f as u,g as v,i as h,v as b}from"./chunk-GTWPLFAN.js";import{D as o,I as y}from"./chunk-COBTQXCB.js";import{existsSync as _,readFileSync as P}from"fs";import{join as M}from"path";var m=y({module:"config"}),E={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","openai-compat":"OPENAI_API_KEY"};function A(n){return f.has(n)}var f=new Set(Object.keys(E)),s=class extends Error{constructor(r){super(r),this.name="ConfigError"}};function B(n){if(n.api_key)return n.api_key;let r=A(n.protocol)?E[n.protocol]:"";return r?process.env[r]??"":""}var x=o.object({name:o.string(),command:o.string().optional(),args:o.array(o.string()).optional(),url:o.string().optional(),transport:o.string().optional(),headers:o.record(o.string(),o.string()).optional(),env:o.record(o.string(),o.string()).optional()}),$=o.object({id:o.string().optional(),event:o.string(),condition:o.string().optional(),action:o.object({type:o.string(),command:o.string().optional(),url:o.string().optional(),method:o.string().optional(),prompt:o.string().optional()}),reject:o.boolean().optional(),once:o.boolean().optional(),async:o.boolean().optional(),on_error:o.string().optional()}),j=o.object({enabled:o.boolean().optional(),auto_allow:o.boolean().optional(),network_enabled:o.boolean().optional()}),k=o.looseObject({default_provider:o.number().default(0),providers:o.array(h),permission_mode:o.string().optional(),mcp_servers:o.array(x).default([]),hooks:o.array($).default([]),sandbox:j.optional(),enable_coordinator_mode:o.boolean().optional(),enable_fork:o.boolean().optional(),enable_memory:o.boolean().optional()});function D(n){return n.enable_fork!==!1}function q(n){return n.enable_memory!==!1}function w(n){let r=P(n,"utf-8"),i=u.load(r),e=d(k,i);if(!e.success)throw new s(`Invalid configuration in ${n}: ${g(e.error)}`);let t=e.data;return{...t,providers:t.providers.map(b)}}function C(n){if(n.providers.length===0)throw new s("At least one provider MUST be configured.");let r=["name","protocol","base_url","model"],i=new Map;for(let e=0;e<n.providers.length;e++){let t=n.providers[e],a={name:t.name,protocol:t.protocol,base_url:t.base_url,model:t.model},l=r.filter(c=>!a[c].trim());if(l.length>0)throw new s(`Provider #${String(e+1)}: missing fields: ${l.join(", ")}`);if(!f.has(t.protocol))throw new s(`Provider #${String(e+1)}: invalid protocol '${t.protocol}', MUST be one of: ${Array.from(f).join(", ")}`);let p=i.get(t.base_url);if(p!==void 0)throw new s(`Provider #${String(e+1)}: duplicate base_url '${t.base_url}' (already used by provider #${String(p+1)}).`);i.set(t.base_url,e)}}function S(n){let r=new Map;for(let i=0;i<n.mcp_servers.length;i++){let e=n.mcp_servers[i],t=`MCP server #${String(i+1)}`;if(!e.name.trim())throw new s(`${t}: name must not be empty.`);let a=r.get(e.name);if(a!==void 0)throw new s(`${t}: duplicate name '${e.name}' (already used by MCP server #${String(a+1)}).`);r.set(e.name,i);let l=!!e.command?.trim(),p=!!e.url?.trim();if(l===p)throw new s(`${t} '${e.name}': configure exactly one of command or url.`);if(l&&e.transport&&e.transport!=="stdio")throw new s(`${t} '${e.name}': command servers must use stdio.`);if(p&&e.transport&&!["http","sse"].includes(e.transport))throw new s(`${t} '${e.name}': URL transport must be http or sse.`)}}var O=".mcp.json",I=o.looseObject({command:o.string().optional(),args:o.array(o.string()).optional(),env:o.record(o.string(),o.string()).optional(),type:o.enum(["stdio","sse","http"]).optional(),url:o.string().optional(),headers:o.record(o.string(),o.string()).optional()}),J=o.looseObject({mcpServers:o.record(o.string(),o.unknown()).default({})});function K(n,r){let i=r.type??(r.command!==void 0?"stdio":"http");return i==="stdio"?!r.command||r.url!==void 0?null:{name:n,command:r.command,args:r.args,env:r.env}:!r.url||r.command!==void 0?null:{name:n,url:r.url,transport:i,headers:r.headers}}function N(n){let r=M(n,O);if(!_(r))return[];let i;try{i=JSON.parse(P(r,"utf-8"))}catch(a){return m.error({err:a,path:r},"invalid .mcp.json"),[]}let e=d(J,i);if(!e.success)return m.error({error:e.error,path:r},"invalid .mcp.json"),[];let t=[];for(let[a,l]of Object.entries(e.data.mcpServers)){let p=d(I,l);if(!a.trim()||!p.success){m.warn({name:a,path:r,error:p.success?void 0:p.error},"skipping invalid .mcp.json server entry");continue}let c=K(a,p.data);c?t.push(c):m.warn({name:a,path:r},"skipping invalid .mcp.json server entry")}return t}function G(n,r){let i=N(r);if(i.length===0)return n;let e=new Set(n.mcp_servers.map(t=>t.name));return{...n,mcp_servers:[...n.mcp_servers,...i.filter(t=>!e.has(t.name))]}}function Q(n,r={}){if(n){let t=w(n);return S(t),(!r.allowEmptyProviders||t.providers.length>0)&&C(t),t}let i=v();if(!_(i)){if(r.allowEmptyProviders)return{default_provider:0,providers:[],mcp_servers:[],hooks:[]};throw new s(`No config file found, expected ${i}.`)}let e=w(i);return S(e),(!r.allowEmptyProviders||e.providers.length>0)&&C(e),e}export{B as a,D as b,q as c,G as d,Q as e};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
|
+
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
+
import{J as m,L as k,Q as p}from"./chunk-GTWPLFAN.js";import{I as x}from"./chunk-COBTQXCB.js";function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var _=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function b(e){return _.has(e)}function d(e){return g(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function C(e){return!g(e)||e.type!=="image"||!g(e.source)?null:e.source.type==="url"&&typeof e.source.url=="string"?{type:"image",source:{type:"url",url:e.source.url}}:e.source.type==="base64"&&typeof e.source.media_type=="string"&&b(e.source.media_type)&&typeof e.source.data=="string"?{type:"image",source:{type:"base64",media_type:e.source.media_type,data:e.source.data}}:null}function M(e){if(e.type!=="document"||!g(e.source))return null;let t=null;if(e.source.type==="url"&&typeof e.source.url=="string")t={type:"url",url:e.source.url};else if(e.source.type==="base64"&&e.source.media_type==="application/pdf"&&typeof e.source.data=="string")t={type:"base64",media_type:"application/pdf",data:e.source.data};else if(e.source.type==="text"&&e.source.media_type==="text/plain"&&typeof e.source.data=="string")t={type:"text",media_type:"text/plain",data:e.source.data};else if(e.source.type==="content"){if(typeof e.source.content=="string")t={type:"content",content:e.source.content};else if(Array.isArray(e.source.content)){let o=[];for(let r of e.source.content){let i=d(r)??C(r);if(!i)return null;o.push(i)}t={type:"content",content:o}}}return t?{type:"document",source:t,...typeof e.title=="string"||e.title===null?{title:e.title}:{},...typeof e.context=="string"||e.context===null?{context:e.context}:{}}:null}function $(e){let t=d(e);if(t)return t;let o=C(e);if(o)return o;if(!g(e))return null;if(e.type==="tool_reference"&&typeof e.tool_name=="string")return{type:"tool_reference",tool_name:e.tool_name};if(e.type==="search_result"&&typeof e.source=="string"&&typeof e.title=="string"&&Array.isArray(e.content)){let r=[];for(let i of e.content){let n=d(i);if(!n)return null;r.push(n)}return{type:"search_result",source:e.source,title:e.title,content:r}}return M(e)}var q=new Set([".agents",".git",".yukino",".next",".venv",".mypy_cache","__pycache__","dist","node_modules"]);var A=x({module:"mcp"}),a="mcp__",u="__";function f(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function P(e){let t=f(e);return`${a}${String(t.length)}_${t}${u}`}function h(e,t){return P(e)+f(t)}var S=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(t,o,r){this.name=h(o,r.name),this.description=r.description,this.originalName=r.name,this.client=t,this.inputSchema=r.inputSchema,this.mcpServerName=o}mcpInputSchema(){return this.inputSchema??{}}setDeferLoading(t){this.deferred=t}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(t,o){try{return await this.client.callTool(this.originalName,o,t.abortSignal)}catch(r){return A.error({err:r},"mcp operation failed"),{output:`MCP tool error: ${k(r)}`,isError:!0}}}};function w(e,t){if(t==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((t==="integer"||t==="number")&&typeof e=="string"){let o=e.trim();if(o===""||!(t==="integer"?/^[+-]?\d+$/:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/).test(o))return e;let i=t==="integer"?Number.parseInt(o,10):Number.parseFloat(o);return Number.isFinite(i)?i:e}if(t==="boolean"&&typeof e=="string"){let o=e.trim().toLowerCase();if(o==="true")return!0;if(o==="false")return!1}return e}function T(e,t){if(typeof t!="object"||t===null)return e;let o=m(t),r=p(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let i=m(o.properties??{}),n={};for(let[s,c]of Object.entries(e))n[s]=s in i?T(c,i[s]):c;return n}if(r==="array"){let i=o.items??{},n=e;if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let s=Object.values(n);s.length===1&&Array.isArray(s[0])&&(n=s[0])}else typeof n=="string"&&(n=n.split(",").map(s=>s.trim()).filter(s=>s!==""));return Array.isArray(n)?n.map(s=>T(s,i)):n}return r!==""?w(e,r):e}function V(e,t){if(t.startsWith(a)){let o=t.slice(a.length),r=/^(\d+)_/u.exec(o);if(r){let i=r[0].length,n=Number.parseInt(r[1],10),s=i+n;if(o.slice(s,s+2)===u)return o.slice(i,s)+u+o.slice(s+u.length)}}return f(e)+u+f(t)}function y(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var R=class{constructor(t){this.registry=t}registry;name="McpCall";description="Invoke a tool on a connected MCP server. Call ToolSearch first to load the tool's schema, then pass its arguments here exactly as that schema requires, using the same JSON types.";category="command";deferred=!1;schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{server:{type:"string",description:"MCP server name, e.g. 'linear'."},tool:{type:"string",description:"Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'."},arguments:{type:"object",description:"The target tool's arguments. Must match that tool's input_schema exactly, including JSON types: bare numbers for integer fields, bare true/false for boolean fields, quoted strings for string fields, and plain JSON arrays for array fields."}},required:["server","tool","arguments"]}}}resolveTarget(t){let o=p(t,"server"),r=p(t,"tool");if(!o||!r)return;let i=r.startsWith(a)?r:h(o,r),n=this.registry.get(i);return n&&y(n)&&n.mcpServerName===o?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(a)).map(t=>t.name).sort()}async execute(t,o){let r=p(o,"server",""),i=p(o,"tool","");if(i==="")return{output:"McpCall requires a 'tool' name",isError:!0};let n=this.resolveTarget(o);if(!n){let c=this.availableNames(),l=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${i}' on server '${r}'. Available tools: ${l}`,isError:!0}}if(typeof o.arguments!="object"||o.arguments===null||Array.isArray(o.arguments))return{output:"McpCall requires an 'arguments' object matching the target schema",isError:!0};let s=m(o.arguments);if(y(n)){let c=n.mcpInputSchema();if(Object.keys(c).length>0){let l=T(s,c);typeof l=="object"&&l!==null&&!Array.isArray(l)&&(s=m(l))}}return t.abortSignal?.throwIfAborted(),n.execute(t,s)}};var I=10,E=2.5,Z="advanced-tool-use-2025-11-20",N=new Set(["api.anthropic.com"]),L="YUKINO_MCP_LOADING";function O(e){if(!e)return!0;try{return N.has(new URL(e).hostname.toLowerCase())}catch{return!1}}function j(e){return Math.floor(e/E)}function B(e,t,o,r,i=I){let n=(process.env[L]??"").trim().toLowerCase();if(n==="eager"||n==="native"||n==="dispatch")return n==="native"&&t!=="anthropic"?"dispatch":n;if(r<=0)return"eager";let s=o*i/100;return j(r)<s?"eager":t==="anthropic"&&O(e)?"native":"dispatch"}function D(e){let t=0;for(let o of e.listTools())if(o.name.startsWith(a))try{t+=JSON.stringify(o.schema()).length}catch{t+=o.name.length+(o.description?.length??0)}return t}function F(e,t){e.mcpLoadingMode=t;let o=t==="eager";for(let r of e.listTools())y(r)&&typeof r.setDeferLoading=="function"&&r.setDeferLoading(!o);e.exposeToolSearch=!o,e.exposeMcpCall=t==="dispatch"}function Q(e,t,o,r){let i=B(t,o,r,D(e));return F(e,i),i}export{$ as a,q as b,a as c,S as d,V as e,R as f,Z as g,O as h,F as i,Q as j};
|