@maincode-ai/matilda-code 0.21.12 → 0.21.13
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/bundled/mainy/docs/configuration/model-providers.md +0 -82
- package/bundled/mainy/docs/configuration/settings.md +30 -2
- package/bundled/mainy/docs/features/auto-mode.md +1 -1
- package/bundled/mainy/docs/features/channels/_meta.ts +0 -3
- package/bundled/mainy/docs/features/channels/overview.md +8 -16
- package/bundled/mainy/docs/features/commands.md +4 -4
- package/bundled/mainy/docs/features/hooks.md +9 -7
- package/bundled/mainy/docs/features/language.md +2 -29
- package/bundled/mainy/docs/features/worktree.md +0 -2
- package/bundled/mainy/docs/integration-github-action.md +3 -3
- package/bundled/mainy/docs/quickstart.md +2 -2
- package/bundled/mainy/docs/support/troubleshooting.md +1 -1
- package/chunks/agent-SRAIVZEE.js +3 -0
- package/chunks/agent-headless-XRDOZESG.js +3 -0
- package/chunks/{anthropicContentGenerator-VKFTAIU3.js → anthropicContentGenerator-LLDIKDMQ.js} +3 -3
- package/chunks/{askUserQuestion-2QI4NSFJ.js → askUserQuestion-BNSWGD26.js} +1 -1
- package/chunks/{ca-I2HEEIL7.js → ca-NPYL24ME.js} +2 -2
- package/chunks/{chunk-YJAKOETP.js → chunk-27HUYW23.js} +2 -2
- package/chunks/{chunk-EQGA7LH7.js → chunk-3B2HABK7.js} +1 -1
- package/chunks/{chunk-CSJTA7NE.js → chunk-3MTZTNAU.js} +18 -18
- package/chunks/{chunk-YRQP3SLC.js → chunk-5OHGYMKP.js} +1 -1
- package/chunks/chunk-6I6VGTKD.js +8 -0
- package/chunks/{chunk-MCQUPLRE.js → chunk-6M5G5FBH.js} +1 -1
- package/chunks/chunk-7ZODGQO6.js +4 -0
- package/chunks/chunk-AOOZREGV.js +9 -0
- package/chunks/chunk-DHDD5YJC.js +207 -0
- package/chunks/{chunk-WV3IUPZS.js → chunk-EZDV7A76.js} +1 -1
- package/chunks/{chunk-QVCGLQCI.js → chunk-IJEGHQ7Z.js} +3 -3
- package/chunks/{chunk-5C2RJ5RR.js → chunk-LWARA7JY.js} +1 -1
- package/chunks/{chunk-VTGICC67.js → chunk-MEV5XQI2.js} +1 -1
- package/chunks/{chunk-DOOFGSRV.js → chunk-P5TG5CON.js} +1 -1
- package/chunks/{chunk-JRECUFB3.js → chunk-PEKAUGYV.js} +552 -561
- package/chunks/chunk-PGUG43HG.js +24 -0
- package/chunks/{chunk-CZGZ3KK7.js → chunk-QZI2ZGZY.js} +1 -1
- package/chunks/chunk-RI54U73U.js +56 -0
- package/chunks/chunk-RPFSFS7Z.js +39 -0
- package/chunks/chunk-SOEIVSM5.js +113 -0
- package/chunks/{chunk-4J6DC24J.js → chunk-SVSY6AWS.js} +1 -1
- package/chunks/{chunk-6E766NPX.js → chunk-TWJLOEAI.js} +1 -1
- package/chunks/{chunk-HYVP4472.js → chunk-V6UPUMP3.js} +1 -1
- package/chunks/chunk-W4QSMIWO.js +9 -0
- package/chunks/chunk-ZX34M2GF.js +14 -0
- package/chunks/{computer-use-WKDNUTLD.js → computer-use-J4GAM4M6.js} +1 -1
- package/chunks/contextCommand-5F5M7NA4.js +3 -0
- package/chunks/{cron-create-F2LXM2OA.js → cron-create-IDWSZENI.js} +1 -1
- package/chunks/{cron-delete-DE6Q2S2L.js → cron-delete-NQCDZDUI.js} +1 -1
- package/chunks/{cron-list-IAQEJVV7.js → cron-list-Z4XMC3TO.js} +1 -1
- package/chunks/{de-AQXFJYZI.js → de-34YZHGC6.js} +2 -2
- package/chunks/{devtools-5JRKK3E7.js → devtools-XRQ4YJ5S.js} +1 -1
- package/chunks/{dist-P6SLWL5V.js → dist-PH6JW7XD.js} +1 -1
- package/chunks/{edit-QQNJZ55P.js → edit-X2S2ZXRN.js} +1 -1
- package/chunks/{en-EJLDYIBM.js → en-QLGMD6OS.js} +3 -3
- package/chunks/{enter-worktree-5X5SAMBJ.js → enter-worktree-TUCGNCLO.js} +1 -1
- package/chunks/{enterPlanMode-HP35SPLN.js → enterPlanMode-SQEZAAIR.js} +1 -1
- package/chunks/{exit-worktree-SRKZBEYF.js → exit-worktree-7FLITFZI.js} +1 -1
- package/chunks/{exitPlanMode-WSPTGGVN.js → exitPlanMode-O5UUJ3GM.js} +1 -1
- package/chunks/{fr-6TDHK7F2.js → fr-EDNBQACJ.js} +3 -3
- package/chunks/geminiContentGenerator-FIZFLPU3.js +8 -0
- package/chunks/glob-GSFTYAS2.js +22 -0
- package/chunks/{goal-tools-C6BSBHCF.js → goal-tools-YQOA6OKU.js} +1 -1
- package/chunks/{grep-MVCOBUYW.js → grep-VAB2VSXM.js} +1 -1
- package/chunks/{ja-GGNJR7AR.js → ja-LV4RLM3M.js} +2 -2
- package/chunks/{ls-JYJXFSXN.js → ls-IZJ3CKZY.js} +1 -1
- package/chunks/{lsp-DYDK6XCS.js → lsp-NGLDRHZU.js} +1 -1
- package/chunks/matildaAgentContentGenerator-QQHPCFJ5.js +8 -0
- package/chunks/matildaContentGenerator-W7Z33ONU.js +8 -0
- package/chunks/mcp-client-DXUNIEIB.js +3 -0
- package/chunks/monitor-4PFIGAGG.js +32 -0
- package/chunks/notebook-edit-MWJYAATJ.js +17 -0
- package/chunks/{openaiContentGenerator-2EALAM3U.js → openaiContentGenerator-NDVJL6QL.js} +1 -1
- package/chunks/{pt-D6L2QTDM.js → pt-5SQ4DGL7.js} +2 -2
- package/chunks/read-file-WPZKPXWA.js +3 -0
- package/chunks/ripGrep-7LZDZFTX.js +3 -0
- package/chunks/{ru-BNJCHDYO.js → ru-7K24S53N.js} +2 -2
- package/chunks/scheduler-DK2MVKXX.js +8 -0
- package/chunks/{send-message-P3SMWNEE.js → send-message-TCPX5UDU.js} +1 -1
- package/chunks/{serve-FXH6EBQ6.js → serve-GSZPJI2O.js} +59 -48
- package/chunks/shell-PRS47PDP.js +3 -0
- package/chunks/{skill-HZPFEAPF.js → skill-ETQM5NI3.js} +1 -1
- package/chunks/src-UB7DZRYK.js +3 -0
- package/chunks/{symbol-search-EAIZPWN7.js → symbol-search-HARHZ5AH.js} +1 -1
- package/chunks/{syntheticOutput-432LXITX.js → syntheticOutput-WZDPECYS.js} +1 -1
- package/chunks/task-create-XRNIDT4T.js +3 -0
- package/chunks/{task-detach-XMSJ3HBM.js → task-detach-TBAVUOTC.js} +1 -1
- package/chunks/task-list-Z6BDZZID.js +9 -0
- package/chunks/{task-stop-NTS62FLG.js → task-stop-HDSARSJ6.js} +1 -1
- package/chunks/{task-update-AR26UFYZ.js → task-update-MW2VT2XV.js} +1 -1
- package/chunks/{team-create-PYXFVIR5.js → team-create-VMYNLZCC.js} +1 -1
- package/chunks/team-delete-F7QDC2TE.js +8 -0
- package/chunks/{todoWrite-5NZ7CHTC.js → todoWrite-SCF5M24M.js} +1 -1
- package/chunks/{tool-search-RKZDSRYS.js → tool-search-WX6FOE35.js} +1 -1
- package/chunks/{web-fetch-VW3SVDQ6.js → web-fetch-CKYBHGLF.js} +1 -1
- package/chunks/{web-search-XQUIZARL.js → web-search-67DFNS5V.js} +1 -1
- package/chunks/{workflow-YXNXDRWZ.js → workflow-WBSRQG3N.js} +2 -2
- package/chunks/write-file-S5FAX4JJ.js +15 -0
- package/cli.js +436 -439
- package/locales/ca.js +0 -3
- package/locales/de.js +0 -3
- package/locales/en.js +0 -3
- package/locales/fr.js +0 -3
- package/locales/ja.js +0 -3
- package/locales/pt.js +0 -3
- package/locales/ru.js +0 -3
- package/package.json +2 -2
- package/sandbox-macos-permissive-closed.sb +0 -1
- package/sandbox-macos-permissive-open.sb +0 -1
- package/sandbox-macos-permissive-proxied.sb +0 -1
- package/sandbox-macos-restrictive-closed.sb +0 -1
- package/sandbox-macos-restrictive-open.sb +0 -1
- package/sandbox-macos-restrictive-proxied.sb +0 -1
- package/bundled/mainy/docs/features/channels/dingtalk.md +0 -134
- package/bundled/mainy/docs/features/channels/feishu.md +0 -186
- package/bundled/mainy/docs/features/channels/weixin.md +0 -106
- package/chunks/agent-WM63A6NK.js +0 -3
- package/chunks/agent-headless-QIUBDKPW.js +0 -3
- package/chunks/chunk-2MOGYHWM.js +0 -8
- package/chunks/chunk-3IRGBRSP.js +0 -113
- package/chunks/chunk-6GBNB5Z2.js +0 -3
- package/chunks/chunk-6Z2MV7ZY.js +0 -186
- package/chunks/chunk-BVOCFLC4.js +0 -56
- package/chunks/chunk-FPO57O66.js +0 -39
- package/chunks/chunk-LJR4RZZ2.js +0 -3
- package/chunks/chunk-MO2HXJG5.js +0 -9
- package/chunks/chunk-PA6532AY.js +0 -6
- package/chunks/chunk-S3CWEVTS.js +0 -15
- package/chunks/chunk-U347OO7S.js +0 -9
- package/chunks/chunk-UIRBHC5X.js +0 -3
- package/chunks/chunk-WVY2P6WH.js +0 -26
- package/chunks/chunk-WZ75OGYY.js +0 -14
- package/chunks/chunk-XMZIY7XX.js +0 -13
- package/chunks/contextCommand-DAB3HOHY.js +0 -3
- package/chunks/dist-ME6647DQ.js +0 -195
- package/chunks/dist-VG3ZDJ2A.js +0 -28
- package/chunks/dist-YTCHM57U.js +0 -23
- package/chunks/geminiContentGenerator-RJ73DQAP.js +0 -8
- package/chunks/glob-QQ6LGKDX.js +0 -22
- package/chunks/matildaAgentContentGenerator-YUYS4336.js +0 -8
- package/chunks/matildaContentGenerator-O4Z2QPCP.js +0 -8
- package/chunks/mcp-client-RXVQU5VI.js +0 -3
- package/chunks/monitor-77KXDXPR.js +0 -32
- package/chunks/notebook-edit-TKJD2EQZ.js +0 -17
- package/chunks/read-file-3KUAH6ND.js +0 -3
- package/chunks/ripGrep-U2PLKXMY.js +0 -3
- package/chunks/scheduler-J7VU2V5Y.js +0 -8
- package/chunks/shell-PXR2AXDD.js +0 -3
- package/chunks/src-RFAEPLY7.js +0 -3
- package/chunks/task-create-Z3QRCMX4.js +0 -3
- package/chunks/task-list-GXAJW3JP.js +0 -9
- package/chunks/team-delete-OMYVUAQU.js +0 -8
- package/chunks/write-file-XDDLTGSG.js +0 -15
package/chunks/dist-VG3ZDJ2A.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as Hr,b as vr,c as qr}from"./chunk-WZ75OGYY.js";import"./chunk-XMZIY7XX.js";import{f as Bt}from"./chunk-EQGA7LH7.js";import"./chunk-T2T2UEPY.js";import"./chunk-M53RP3YP.js";import{c as Pt}from"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-UIRBHC5X.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import{b as l}from"./chunk-GZPNIYVZ.js";import{e as Mr,f as Qe}from"./chunk-OWGSC52X.js";l();l();import{mkdirSync as js,writeFileSync as $s}from"node:fs";import{randomUUID as zs}from"node:crypto";import{basename as Js,join as Fr}from"node:path";import{tmpdir as Ws}from"node:os";l();l();var Ye="/v1.0/im/bot/messages/get";l();l();l();l();l();function Ee(t,e){return function(){return t.apply(e,arguments)}}var{toString:jr}=Object.prototype,{getPrototypeOf:et}=Object,{iterator:Fe,toStringTag:Mt}=Symbol,Me=(t=>e=>{let n=jr.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),W=t=>(t=t.toLowerCase(),e=>Me(e)===t),He=t=>e=>typeof e===t,{isArray:he}=Array,me=He("undefined");function Te(t){return t!==null&&!me(t)&&t.constructor!==null&&!me(t.constructor)&&q(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Ht=W("ArrayBuffer");function $r(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ht(t.buffer),e}var zr=He("string"),q=He("function"),vt=He("number"),xe=t=>t!==null&&typeof t=="object",Jr=t=>t===!0||t===!1,Ue=t=>{if(Me(t)!=="object")return!1;let e=et(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Mt in t)&&!(Fe in t)},Wr=t=>{if(!xe(t)||Te(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Vr=W("Date"),Kr=W("File"),Gr=t=>!!(t&&typeof t.uri<"u"),Xr=t=>t&&typeof t.getParts<"u",Qr=W("Blob"),Yr=W("FileList"),Zr=t=>xe(t)&&q(t.pipe);function en(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}var It=en(),Ut=typeof It.FormData<"u"?It.FormData:void 0,tn=t=>{let e;return t&&(Ut&&t instanceof Ut||q(t.append)&&((e=Me(t))==="formdata"||e==="object"&&q(t.toString)&&t.toString()==="[object FormData]"))},rn=W("URLSearchParams"),[nn,sn,on,an]=["ReadableStream","Request","Response","Headers"].map(W),cn=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Se(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),he(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(Te(t))return;let i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length,c;for(r=0;r<o;r++)c=i[r],e.call(null,t[c],c,t)}}function qt(t,e){if(Te(t))return null;e=e.toLowerCase();let n=Object.keys(t),r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}var ae=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:globalThis,jt=t=>!me(t)&&t!==ae;function Ze(){let{caseless:t,skipUndefined:e}=jt(this)&&this||{},n={},r=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;let o=t&&qt(n,i)||i;Ue(n[o])&&Ue(s)?n[o]=Ze(n[o],s):Ue(s)?n[o]=Ze({},s):he(s)?n[o]=s.slice():(!e||!me(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Se(arguments[s],r);return n}var ln=(t,e,n,{allOwnKeys:r}={})=>(Se(e,(s,i)=>{n&&q(s)?Object.defineProperty(t,i,{value:Ee(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),t),un=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),fn=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},dn=(t,e,n,r)=>{let s,i,o,c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!c[o]&&(e[o]=t[o],c[o]=!0);t=n!==!1&&et(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},pn=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;let r=t.indexOf(e,n);return r!==-1&&r===n},mn=t=>{if(!t)return null;if(he(t))return t;let e=t.length;if(!vt(e))return null;let n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},hn=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&et(Uint8Array)),yn=(t,e)=>{let r=(t&&t[Fe]).call(t),s;for(;(s=r.next())&&!s.done;){let i=s.value;e.call(t,i[0],i[1])}},bn=(t,e)=>{let n,r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},gn=W("HTMLFormElement"),wn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ft=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Rn=W("RegExp"),$t=(t,e)=>{let n=Object.getOwnPropertyDescriptors(t),r={};Se(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},En=t=>{$t(t,(e,n)=>{if(q(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let r=t[n];if(q(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Tn=(t,e)=>{let n={},r=s=>{s.forEach(i=>{n[i]=!0})};return he(t)?r(t):r(String(t).split(e)),n},xn=()=>{},Sn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function An(t){return!!(t&&q(t.append)&&t[Mt]==="FormData"&&t[Fe])}var Cn=t=>{let e=new Array(10),n=(r,s)=>{if(xe(r)){if(e.indexOf(r)>=0)return;if(Te(r))return r;if(!("toJSON"in r)){e[s]=r;let i=he(r)?[]:{};return Se(r,(o,c)=>{let d=n(o,s+1);!me(d)&&(i[c]=d)}),e[s]=void 0,i}}return r};return n(t,0)},On=W("AsyncFunction"),_n=t=>t&&(xe(t)||q(t))&&q(t.then)&&q(t.catch),zt=((t,e)=>t?setImmediate:e?((n,r)=>(ae.addEventListener("message",({source:s,data:i})=>{s===ae&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ae.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",q(ae.postMessage)),kn=typeof queueMicrotask<"u"?queueMicrotask.bind(ae):typeof process<"u"&&process.nextTick||zt,Dn=t=>t!=null&&q(t[Fe]),a={isArray:he,isArrayBuffer:Ht,isBuffer:Te,isFormData:tn,isArrayBufferView:$r,isString:zr,isNumber:vt,isBoolean:Jr,isObject:xe,isPlainObject:Ue,isEmptyObject:Wr,isReadableStream:nn,isRequest:sn,isResponse:on,isHeaders:an,isUndefined:me,isDate:Vr,isFile:Kr,isReactNativeBlob:Gr,isReactNative:Xr,isBlob:Qr,isRegExp:Rn,isFunction:q,isStream:Zr,isURLSearchParams:rn,isTypedArray:hn,isFileList:Yr,forEach:Se,merge:Ze,extend:ln,trim:cn,stripBOM:un,inherits:fn,toFlatObject:dn,kindOf:Me,kindOfTest:W,endsWith:pn,toArray:mn,forEachEntry:yn,matchAll:bn,isHTMLForm:gn,hasOwnProperty:Ft,hasOwnProp:Ft,reduceDescriptors:$t,freezeMethods:En,toObjectSet:Tn,toCamelCase:wn,noop:xn,toFiniteNumber:Sn,findKey:qt,global:ae,isContextDefined:jt,isSpecCompliantForm:An,toJSONObject:Cn,isAsyncFn:On,isThenable:_n,setImmediate:zt,asap:kn,isIterable:Dn};l();l();l();l();l();var F=class t extends Error{static from(e,n,r,s,i,o){let c=new t(e.message,n||e.code,r,s,i);return c.cause=e,c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),o&&Object.assign(c,o),c}constructor(e,n,r,s,i){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};F.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";F.ERR_BAD_OPTION="ERR_BAD_OPTION";F.ECONNABORTED="ECONNABORTED";F.ETIMEDOUT="ETIMEDOUT";F.ERR_NETWORK="ERR_NETWORK";F.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";F.ERR_DEPRECATED="ERR_DEPRECATED";F.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";F.ERR_BAD_REQUEST="ERR_BAD_REQUEST";F.ERR_CANCELED="ERR_CANCELED";F.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";F.ERR_INVALID_URL="ERR_INVALID_URL";var y=F;l();var Jt=Qe(Hr(),1),ve=Jt.default;function rt(t){return a.isPlainObject(t)||a.isArray(t)}function Wt(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function tt(t,e,n){return t?t.concat(e).map(function(s,i){return s=Wt(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function Nn(t){return a.isArray(t)&&!t.some(rt)}var Ln=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Pn(t,e,n){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new(ve||FormData),n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,m){return!a.isUndefined(m[g])});let r=n.metaTokens,s=n.visitor||f,i=n.dots,o=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(a.isDate(p))return p.toISOString();if(a.isBoolean(p))return p.toString();if(!d&&a.isBlob(p))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(p)||a.isTypedArray(p)?d&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,g,m){let S=p;if(a.isReactNative(e)&&a.isReactNativeBlob(p))return e.append(tt(m,g,i),u(p)),!1;if(p&&!m&&typeof p=="object"){if(a.endsWith(g,"{}"))g=r?g:g.slice(0,-2),p=JSON.stringify(p);else if(a.isArray(p)&&Nn(p)||(a.isFileList(p)||a.endsWith(g,"[]"))&&(S=a.toArray(p)))return g=Wt(g),S.forEach(function(T,_){!(a.isUndefined(T)||T===null)&&e.append(o===!0?tt([g],_,i):o===null?g:g+"[]",u(T))}),!1}return rt(p)?!0:(e.append(tt(m,g,i),u(p)),!1)}let h=[],b=Object.assign(Ln,{defaultVisitor:f,convertValue:u,isVisitable:rt});function R(p,g){if(!a.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+g.join("."));h.push(p),a.forEach(p,function(S,C){(!(a.isUndefined(S)||S===null)&&s.call(e,S,a.isString(C)?C.trim():C,g,b))===!0&&R(S,g?g.concat(C):[C])}),h.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}var re=Pn;function Vt(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Kt(t,e){this._pairs=[],t&&re(t,this,e)}var Gt=Kt.prototype;Gt.append=function(e,n){this._pairs.push([e,n])};Gt.toString=function(e){let n=e?function(r){return e.call(this,r,Vt)}:Vt;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};var Xt=Kt;function Bn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ce(t,e,n){if(!e)return t;let r=n&&n.encode||Bn,s=a.isFunction(n)?{serialize:n}:n,i=s&&s.serialize,o;if(i?o=i(e,s):o=a.isURLSearchParams(e)?e.toString():new Xt(e,s).toString(r),o){let c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}l();var nt=class{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(r){r!==null&&e(r)})}},st=nt;l();l();l();l();var ne={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};l();l();l();import Un from"crypto";l();import In from"url";var Qt=In.URLSearchParams;var ot="abcdefghijklmnopqrstuvwxyz",Yt="0123456789",Zt={DIGIT:Yt,ALPHA:ot,ALPHA_DIGIT:ot+ot.toUpperCase()+Yt},Fn=(t=16,e=Zt.ALPHA_DIGIT)=>{let n="",{length:r}=e,s=new Uint32Array(t);Un.randomFillSync(s);for(let i=0;i<t;i++)n+=e[s[i]%r];return n},er={isNode:!0,classes:{URLSearchParams:Qt,FormData:ve,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:Zt,generateString:Fn,protocols:["http","https","file","data"]};var ct={};Mr(ct,{hasBrowserEnv:()=>at,hasStandardBrowserEnv:()=>Mn,hasStandardBrowserWebWorkerEnv:()=>Hn,navigator:()=>it,origin:()=>vn});l();var at=typeof window<"u"&&typeof document<"u",it=typeof navigator=="object"&&navigator||void 0,Mn=at&&(!it||["ReactNative","NativeScript","NS"].indexOf(it.product)<0),Hn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",vn=at&&window.location.href||"http://localhost";var x={...ct,...er};function lt(t,e){return re(t,new x.classes.URLSearchParams,{visitor:function(n,r,s,i){return x.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}l();function qn(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function jn(t){let e={},n=Object.keys(t),r,s=n.length,i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function $n(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,d?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=jn(s[o])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){let n={};return a.forEachEntry(t,(r,s)=>{e(qn(r),s,n,0)}),n}return null}var qe=$n;function zn(t,e,n){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}var ut={transitional:ne,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){let r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(e);if(i&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(qe(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return lt(e,this.formSerializer).toString();if((c=a.isFileList(e))||r.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return re(c?{"files[]":e}:e,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),zn(e)):e}],transformResponse:[function(e){let n=this.transitional||ut.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(r&&!this.responseType||s)){let o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{ut.headers[t]={}});var ye=ut;l();l();var Jn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tr=t=>{let e={},n,r,s;return t&&t.split(`
|
|
4
|
-
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||e[n]&&Jn[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e};var rr=Symbol("internals");function Ae(t){return t&&String(t).trim().toLowerCase()}function je(t){return t===!1||t==null?t:a.isArray(t)?t.map(je):String(t)}function Wn(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}var Vn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ft(t,e,n,r,s){if(a.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!a.isString(e)){if(a.isString(r))return e.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(e)}}function Kn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Gn(t,e){let n=a.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}var be=class{constructor(e){e&&this.set(e)}set(e,n,r){let s=this;function i(c,d,u){let f=Ae(d);if(!f)throw new Error("header name must be a non-empty string");let h=a.findKey(s,f);(!h||s[h]===void 0||u===!0||u===void 0&&s[h]!==!1)&&(s[h||d]=je(c))}let o=(c,d)=>a.forEach(c,(u,f)=>i(u,f,d));if(a.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(a.isString(e)&&(e=e.trim())&&!Vn(e))o(tr(e),n);else if(a.isObject(e)&&a.isIterable(e)){let c={},d,u;for(let f of e){if(!a.isArray(f))throw TypeError("Object iterator must return a key-value pair");c[u=f[0]]=(d=c[u])?a.isArray(d)?[...d,f[1]]:[d,f[1]]:f[1]}o(c,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Ae(e),e){let r=a.findKey(this,e);if(r){let s=this[r];if(!n)return s;if(n===!0)return Wn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Ae(e),e){let r=a.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||ft(this,this[r],r,n)))}return!1}delete(e,n){let r=this,s=!1;function i(o){if(o=Ae(o),o){let c=a.findKey(r,o);c&&(!n||ft(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(e)?e.forEach(i):i(e),s}clear(e){let n=Object.keys(this),r=n.length,s=!1;for(;r--;){let i=n[r];(!e||ft(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){let n=this,r={};return a.forEach(this,(s,i)=>{let o=a.findKey(r,i);if(o){n[o]=je(s),delete n[i];return}let c=e?Kn(i):String(i).trim();c!==i&&delete n[i],n[c]=je(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
5
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){let r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){let r=(this[rr]=this[rr]={accessors:{}}).accessors,s=this.prototype;function i(o){let c=Ae(o);r[c]||(Gn(s,o),r[c]=!0)}return a.isArray(e)?e.forEach(i):i(e),this}};be.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(be.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});a.freezeMethods(be);var O=be;function Ce(t,e){let n=this||ye,r=e||n,s=O.from(r.headers),i=r.data;return a.forEach(t,function(c){i=c.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}l();function Oe(t){return!!(t&&t.__CANCEL__)}l();var dt=class extends y{constructor(e,n,r){super(e??"canceled",y.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}},$=dt;l();l();l();function G(t,e,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}l();l();function pt(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}l();function mt(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function le(t,e,n){let r=!pt(e);return t&&(r||n==!1)?mt(t,e):e}var mr=Qe(vr(),1),br=Qe(qr(),1);import ls from"http";import us from"https";import hr from"http2";import yr from"util";import oe from"zlib";l();var ue="1.13.6";l();l();function _e(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}var Xn=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function ht(t,e,n){let r=n&&n.Blob||x.classes.Blob,s=_e(t);if(e===void 0&&r&&(e=!0),s==="data"){t=s.length?t.slice(s.length+1):t;let i=Xn.exec(t);if(!i)throw new y("Invalid URL",y.ERR_INVALID_URL);let o=i[1],c=i[2],d=i[3],u=Buffer.from(decodeURIComponent(d),c?"base64":"utf8");if(e){if(!r)throw new y("Blob is not supported",y.ERR_NOT_SUPPORT);return new r([u],{type:o})}return u}throw new y("Unsupported protocol "+s,y.ERR_NOT_SUPPORT)}import se from"stream";l();import Qn from"stream";var yt=Symbol("internals"),bt=class extends Qn.Transform{constructor(e){e=a.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(r,s)=>!a.isUndefined(s[r])),super({readableHighWaterMark:e.chunkSize});let n=this[yt]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",r=>{r==="progress"&&(n.isCaptured||(n.isCaptured=!0))})}_read(e){let n=this[yt];return n.onReadCallback&&n.onReadCallback(),super._read(e)}_transform(e,n,r){let s=this[yt],i=s.maxRate,o=this.readableHighWaterMark,c=s.timeWindow,d=1e3/c,u=i/d,f=s.minChunkSize!==!1?Math.max(s.minChunkSize,u*.01):0,h=(R,p)=>{let g=Buffer.byteLength(R);s.bytesSeen+=g,s.bytes+=g,s.isCaptured&&this.emit("progress",s.bytesSeen),this.push(R)?process.nextTick(p):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(p)}},b=(R,p)=>{let g=Buffer.byteLength(R),m=null,S=o,C,T=0;if(i){let _=Date.now();(!s.ts||(T=_-s.ts)>=c)&&(s.ts=_,C=u-s.bytes,s.bytes=C<0?-C:0,T=0),C=u-s.bytes}if(i){if(C<=0)return setTimeout(()=>{p(null,R)},c-T);C<S&&(S=C)}S&&g>S&&g-S>f&&(m=R.subarray(S),R=R.subarray(0,S)),h(R,m?()=>{process.nextTick(p,null,m)}:p)};b(e,function R(p,g){if(p)return r(p);g?b(g,R):r(null)})}},gt=bt;import{EventEmitter as fs}from"events";l();import Zn from"util";import{Readable as es}from"stream";l();var{asyncIterator:nr}=Symbol,Yn=async function*(t){t.stream?yield*t.stream():t.arrayBuffer?yield await t.arrayBuffer():t[nr]?yield*t[nr]():yield t},$e=Yn;var ts=x.ALPHABET.ALPHA_DIGIT+"-_",ke=typeof TextEncoder=="function"?new TextEncoder:new Zn.TextEncoder,fe=`\r
|
|
6
|
-
`,rs=ke.encode(fe),ns=2,wt=class{constructor(e,n){let{escapeName:r}=this.constructor,s=a.isString(n),i=`Content-Disposition: form-data; name="${r(e)}"${!s&&n.name?`; filename="${r(n.name)}"`:""}${fe}`;s?n=ke.encode(String(n).replace(/\r?\n|\r\n?/g,fe)):i+=`Content-Type: ${n.type||"application/octet-stream"}${fe}`,this.headers=ke.encode(i+fe),this.contentLength=s?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+ns,this.name=e,this.value=n}async*encode(){yield this.headers;let{value:e}=this;a.isTypedArray(e)?yield e:yield*$e(e),yield rs}static escapeName(e){return String(e).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},ss=(t,e,n)=>{let{tag:r="form-data-boundary",size:s=25,boundary:i=r+"-"+x.generateString(s,ts)}=n||{};if(!a.isFormData(t))throw TypeError("FormData instance required");if(i.length<1||i.length>70)throw Error("boundary must be 10-70 characters long");let o=ke.encode("--"+i+fe),c=ke.encode("--"+i+"--"+fe),d=c.byteLength,u=Array.from(t.entries()).map(([h,b])=>{let R=new wt(h,b);return d+=R.size,R});d+=o.byteLength*u.length,d=a.toFiniteNumber(d);let f={"Content-Type":`multipart/form-data; boundary=${i}`};return Number.isFinite(d)&&(f["Content-Length"]=d),e&&e(f),es.from(async function*(){for(let h of u)yield o,yield*h.encode();yield c}())},sr=ss;l();import os from"stream";var Rt=class extends os.Transform{__transform(e,n,r){this.push(e),r()}_transform(e,n,r){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let s=Buffer.alloc(2);s[0]=120,s[1]=156,this.push(s,n)}this.__transform(e,n,r)}},or=Rt;l();var is=(t,e)=>a.isAsyncFn(t)?function(...n){let r=n.pop();t.apply(this,n).then(s=>{try{e?r(null,...e(s)):r(null,s)}catch(i){r(i)}},r)}:t,ir=is;l();l();function as(t,e){t=t||10;let n=new Array(t),r=new Array(t),s=0,i=0,o;return e=e!==void 0?e:1e3,function(d){let u=Date.now(),f=r[i];o||(o=u),n[s]=d,r[s]=u;let h=i,b=0;for(;h!==s;)b+=n[h++],h=h%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),u-o<e)return;let R=f&&u-f;return R?Math.round(b*1e3/R):void 0}}var ar=as;l();function cs(t,e){let n=0,r=1e3/e,s,i,o=(u,f=Date.now())=>{n=f,s=null,i&&(clearTimeout(i),i=null),t(...u)};return[(...u)=>{let f=Date.now(),h=f-n;h>=r?o(u,f):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-h)))},()=>s&&o(s)]}var cr=cs;var Y=(t,e,n=3)=>{let r=0,s=ar(50,250);return cr(i=>{let o=i.loaded,c=i.lengthComputable?i.total:void 0,d=o-r,u=s(d),f=o<=c;r=o;let h={loaded:o,total:c,progress:c?o/c:void 0,bytes:d,rate:u||void 0,estimated:u&&c&&f?(c-o)/u:void 0,event:i,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(h)},n)},ge=(t,e)=>{let n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},we=t=>(...e)=>a.asap(()=>t(...e));l();function Et(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let e=t.indexOf(",");if(e<0)return 0;let n=t.slice(5,e),r=t.slice(e+1);if(/;base64/i.test(n)){let i=r.length,o=r.length;for(let b=0;b<o;b++)if(r.charCodeAt(b)===37&&b+2<o){let R=r.charCodeAt(b+1),p=r.charCodeAt(b+2);(R>=48&&R<=57||R>=65&&R<=70||R>=97&&R<=102)&&(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102)&&(i-=2,b+=2)}let c=0,d=o-1,u=b=>b>=2&&r.charCodeAt(b-2)===37&&r.charCodeAt(b-1)===51&&(r.charCodeAt(b)===68||r.charCodeAt(b)===100);d>=0&&(r.charCodeAt(d)===61?(c++,d--):u(d)&&(c++,d-=3)),c===1&&d>=0&&(r.charCodeAt(d)===61||u(d))&&c++;let h=Math.floor(i/4)*3-(c||0);return h>0?h:0}return Buffer.byteLength(r,"utf8")}var lr={flush:oe.constants.Z_SYNC_FLUSH,finishFlush:oe.constants.Z_SYNC_FLUSH},ds={flush:oe.constants.BROTLI_OPERATION_FLUSH,finishFlush:oe.constants.BROTLI_OPERATION_FLUSH},ur=a.isFunction(oe.createBrotliDecompress),{http:ps,https:ms}=br.default,hs=/https:?/,fr=x.protocols.map(t=>t+":"),dr=(t,[e,n])=>(t.on("end",n).on("error",n),e),Tt=class{constructor(){this.sessions=Object.create(null)}getSession(e,n){n=Object.assign({sessionTimeout:1e3},n);let r=this.sessions[e];if(r){let f=r.length;for(let h=0;h<f;h++){let[b,R]=r[h];if(!b.destroyed&&!b.closed&&yr.isDeepStrictEqual(R,n))return b}}let s=hr.connect(e,n),i,o=()=>{if(i)return;i=!0;let f=r,h=f.length,b=h;for(;b--;)if(f[b][0]===s){h===1?delete this.sessions[e]:f.splice(b,1);return}},c=s.request,{sessionTimeout:d}=n;if(d!=null){let f,h=0;s.request=function(){let b=c.apply(this,arguments);return h++,f&&(clearTimeout(f),f=null),b.once("close",()=>{--h||(f=setTimeout(()=>{f=null,o()},d))}),b}}s.once("close",o);let u=[s,n];return r?r.push(u):r=this.sessions[e]=[u],s}},ys=new Tt;function bs(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function gr(t,e,n){let r=e;if(!r&&r!==!1){let s=mr.default.getProxyForUrl(n);s&&(r=new URL(s))}if(r){if(r.username&&(r.auth=(r.username||"")+":"+(r.password||"")),r.auth){if(!!(r.auth.username||r.auth.password))r.auth=(r.auth.username||"")+":"+(r.auth.password||"");else if(typeof r.auth=="object")throw new y("Invalid proxy authorization",y.ERR_BAD_OPTION,{proxy:r});let o=Buffer.from(r.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+o}t.headers.host=t.hostname+(t.port?":"+t.port:"");let s=r.hostname||r.host;t.hostname=s,t.host=s,t.port=r.port,t.path=n,r.protocol&&(t.protocol=r.protocol.includes(":")?r.protocol:`${r.protocol}:`)}t.beforeRedirects.proxy=function(i){gr(i,e,i.href)}}var gs=typeof process<"u"&&a.kindOf(process)==="process",ws=t=>new Promise((e,n)=>{let r,s,i=(d,u)=>{s||(s=!0,r&&r(d,u))},o=d=>{i(d),e(d)},c=d=>{i(d,!0),n(d)};t(o,c,d=>r=d).catch(c)}),Rs=({address:t,family:e})=>{if(!a.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},pr=(t,e)=>Rs(a.isObject(t)?t:{address:t,family:e}),Es={request(t,e){let n=t.protocol+"//"+t.hostname+":"+(t.port||(t.protocol==="https:"?443:80)),{http2Options:r,headers:s}=t,i=ys.getSession(n,r),{HTTP2_HEADER_SCHEME:o,HTTP2_HEADER_METHOD:c,HTTP2_HEADER_PATH:d,HTTP2_HEADER_STATUS:u}=hr.constants,f={[o]:t.protocol.replace(":",""),[c]:t.method,[d]:t.path};a.forEach(s,(b,R)=>{R.charAt(0)!==":"&&(f[R]=b)});let h=i.request(f);return h.once("response",b=>{let R=h;b=Object.assign({},b);let p=b[u];delete b[u],R.headers=b,R.statusCode=+p,e(R)}),h}},wr=gs&&function(e){return ws(async function(r,s,i){let{data:o,lookup:c,family:d,httpVersion:u=1,http2Options:f}=e,{responseType:h,responseEncoding:b}=e,R=e.method.toUpperCase(),p,g=!1,m;if(u=+u,Number.isNaN(u))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(u!==1&&u!==2)throw TypeError(`Unsupported protocol version '${u}'`);let S=u===2;if(c){let E=ir(c,w=>a.isArray(w)?w:[w]);c=(w,A,j)=>{E(w,A,(D,J,te)=>{if(D)return j(D);let v=a.isArray(J)?J.map(Ie=>pr(Ie)):[pr(J,te)];A.all?j(D,v):j(D,v[0].address,v[0].family)})}}let C=new fs;function T(E){try{C.emit("abort",!E||E.type?new $(null,e,m):E)}catch(w){console.warn("emit error",w)}}C.once("abort",s);let _=()=>{e.cancelToken&&e.cancelToken.unsubscribe(T),e.signal&&e.signal.removeEventListener("abort",T),C.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(T),e.signal&&(e.signal.aborted?T():e.signal.addEventListener("abort",T))),i((E,w)=>{if(p=!0,w){g=!0,_();return}let{data:A}=E;if(A instanceof se.Readable||A instanceof se.Duplex){let j=se.finished(A,()=>{j(),_()})}else _()});let M=le(e.baseURL,e.url,e.allowAbsoluteUrls),k=new URL(M,x.hasBrowserEnv?x.origin:void 0),L=k.protocol||fr[0];if(L==="data:"){if(e.maxContentLength>-1){let w=String(e.url||M||"");if(Et(w)>e.maxContentLength)return s(new y("maxContentLength size of "+e.maxContentLength+" exceeded",y.ERR_BAD_RESPONSE,e))}let E;if(R!=="GET")return G(r,s,{status:405,statusText:"method not allowed",headers:{},config:e});try{E=ht(e.url,h==="blob",{Blob:e.env&&e.env.Blob})}catch(w){throw y.from(w,y.ERR_BAD_REQUEST,e)}return h==="text"?(E=E.toString(b),(!b||b==="utf8")&&(E=a.stripBOM(E))):h==="stream"&&(E=se.Readable.from(E)),G(r,s,{data:E,status:200,statusText:"OK",headers:new O,config:e})}if(fr.indexOf(L)===-1)return s(new y("Unsupported protocol "+L,y.ERR_BAD_REQUEST,e));let P=O.from(e.headers).normalize();P.set("User-Agent","axios/"+ue,!1);let{onUploadProgress:Z,onDownloadProgress:de}=e,ie=e.maxRate,X,K;if(a.isSpecCompliantForm(o)){let E=P.getContentType(/boundary=([-_\w\d]{10,70})/i);o=sr(o,w=>{P.set(w)},{tag:`axios-${ue}-boundary`,boundary:E&&E[1]||void 0})}else if(a.isFormData(o)&&a.isFunction(o.getHeaders)){if(P.set(o.getHeaders()),!P.hasContentLength())try{let E=await yr.promisify(o.getLength).call(o);Number.isFinite(E)&&E>=0&&P.setContentLength(E)}catch{}}else if(a.isBlob(o)||a.isFile(o))o.size&&P.setContentType(o.type||"application/octet-stream"),P.setContentLength(o.size||0),o=se.Readable.from($e(o));else if(o&&!a.isStream(o)){if(!Buffer.isBuffer(o))if(a.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(a.isString(o))o=Buffer.from(o,"utf-8");else return s(new y("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",y.ERR_BAD_REQUEST,e));if(P.setContentLength(o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return s(new y("Request body larger than maxBodyLength limit",y.ERR_BAD_REQUEST,e))}let Q=a.toFiniteNumber(P.getContentLength());a.isArray(ie)?(X=ie[0],K=ie[1]):X=K=ie,o&&(Z||X)&&(a.isStream(o)||(o=se.Readable.from(o,{objectMode:!1})),o=se.pipeline([o,new gt({maxRate:a.toFiniteNumber(X)})],a.noop),Z&&o.on("progress",dr(o,ge(Q,Y(we(Z),!1,3)))));let ee;if(e.auth){let E=e.auth.username||"",w=e.auth.password||"";ee=E+":"+w}if(!ee&&k.username){let E=k.username,w=k.password;ee=E+":"+w}ee&&P.delete("authorization");let B;try{B=ce(k.pathname+k.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(E){let w=new Error(E.message);return w.config=e,w.url=e.url,w.exists=!0,s(w)}P.set("Accept-Encoding","gzip, compress, deflate"+(ur?", br":""),!1);let I={path:B,method:R,headers:P.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:ee,protocol:L,family:d,beforeRedirect:bs,beforeRedirects:{},http2Options:f};!a.isUndefined(c)&&(I.lookup=c),e.socketPath?I.socketPath=e.socketPath:(I.hostname=k.hostname.startsWith("[")?k.hostname.slice(1,-1):k.hostname,I.port=k.port,gr(I,e.proxy,L+"//"+k.hostname+(k.port?":"+k.port:"")+I.path));let H,pe=hs.test(I.protocol);if(I.agent=pe?e.httpsAgent:e.httpAgent,S?H=Es:e.transport?H=e.transport:e.maxRedirects===0?H=pe?us:ls:(e.maxRedirects&&(I.maxRedirects=e.maxRedirects),e.beforeRedirect&&(I.beforeRedirects.config=e.beforeRedirect),H=pe?ms:ps),e.maxBodyLength>-1?I.maxBodyLength=e.maxBodyLength:I.maxBodyLength=1/0,e.insecureHTTPParser&&(I.insecureHTTPParser=e.insecureHTTPParser),m=H.request(I,function(w){if(m.destroyed)return;let A=[w],j=a.toFiniteNumber(w.headers["content-length"]);if(de||K){let v=new gt({maxRate:a.toFiniteNumber(K)});de&&v.on("progress",dr(v,ge(j,Y(we(de),!0,3)))),A.push(v)}let D=w,J=w.req||m;if(e.decompress!==!1&&w.headers["content-encoding"])switch((R==="HEAD"||w.statusCode===204)&&delete w.headers["content-encoding"],(w.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":A.push(oe.createUnzip(lr)),delete w.headers["content-encoding"];break;case"deflate":A.push(new or),A.push(oe.createUnzip(lr)),delete w.headers["content-encoding"];break;case"br":ur&&(A.push(oe.createBrotliDecompress(ds)),delete w.headers["content-encoding"])}D=A.length>1?se.pipeline(A,a.noop):A[0];let te={status:w.statusCode,statusText:w.statusMessage,headers:new O(w.headers),config:e,request:J};if(h==="stream")te.data=D,G(r,s,te);else{let v=[],Ie=0;D.on("data",function(U){v.push(U),Ie+=U.length,e.maxContentLength>-1&&Ie>e.maxContentLength&&(g=!0,D.destroy(),T(new y("maxContentLength size of "+e.maxContentLength+" exceeded",y.ERR_BAD_RESPONSE,e,J)))}),D.on("aborted",function(){if(g)return;let U=new y("stream has been aborted",y.ERR_BAD_RESPONSE,e,J);D.destroy(U),s(U)}),D.on("error",function(U){m.destroyed||s(y.from(U,null,e,J))}),D.on("end",function(){try{let U=v.length===1?v[0]:Buffer.concat(v);h!=="arraybuffer"&&(U=U.toString(b),(!b||b==="utf8")&&(U=a.stripBOM(U))),te.data=U}catch(U){return s(y.from(U,null,e,te.request,te))}G(r,s,te)})}C.once("abort",v=>{D.destroyed||(D.emit("error",v),D.destroy())})}),C.once("abort",E=>{m.close?m.close():m.destroy(E)}),m.on("error",function(w){s(y.from(w,null,e,m))}),m.on("socket",function(w){w.setKeepAlive(!0,1e3*60)}),e.timeout){let E=parseInt(e.timeout,10);if(Number.isNaN(E)){T(new y("error trying to parse `config.timeout` to int",y.ERR_BAD_OPTION_VALUE,e,m));return}m.setTimeout(E,function(){if(p)return;let A=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",j=e.transitional||ne;e.timeoutErrorMessage&&(A=e.timeoutErrorMessage),T(new y(A,j.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,m))})}else m.setTimeout(0);if(a.isStream(o)){let E=!1,w=!1;o.on("end",()=>{E=!0}),o.once("error",A=>{w=!0,m.destroy(A)}),o.on("close",()=>{!E&&!w&&T(new $("Request stream has been aborted",e,m))}),o.pipe(m)}else o&&m.write(o),m.end()})};l();l();l();var Rr=x.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,x.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(x.origin),x.navigator&&/(msie|trident)/i.test(x.navigator.userAgent)):()=>!0;l();var Er=x.hasStandardBrowserEnv?{write(t,e,n,r,s,i,o){if(typeof document>"u")return;let c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};l();var Tr=t=>t instanceof O?{...t}:t;function V(t,e){e=e||{};let n={};function r(u,f,h,b){return a.isPlainObject(u)&&a.isPlainObject(f)?a.merge.call({caseless:b},u,f):a.isPlainObject(f)?a.merge({},f):a.isArray(f)?f.slice():f}function s(u,f,h,b){if(a.isUndefined(f)){if(!a.isUndefined(u))return r(void 0,u,h,b)}else return r(u,f,h,b)}function i(u,f){if(!a.isUndefined(f))return r(void 0,f)}function o(u,f){if(a.isUndefined(f)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function c(u,f,h){if(h in e)return r(u,f);if(h in t)return r(void 0,u)}let d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,f,h)=>s(Tr(u),Tr(f),h,!0)};return a.forEach(Object.keys({...t,...e}),function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;let h=a.hasOwnProp(d,f)?d[f]:s,b=h(t[f],e[f],f);a.isUndefined(b)&&h!==c||(n[f]=b)}),n}var ze=t=>{let e=V({},t),{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=e;if(e.headers=o=O.from(o),e.url=ce(le(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){let d=n.getHeaders(),u=["content-type","content-length"];Object.entries(d).forEach(([f,h])=>{u.includes(f.toLowerCase())&&o.set(f,h)})}}if(x.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(e)),r||r!==!1&&Rr(e.url))){let d=s&&i&&Er.read(i);d&&o.set(s,d)}return e};var Ts=typeof XMLHttpRequest<"u",xr=Ts&&function(t){return new Promise(function(n,r){let s=ze(t),i=s.data,o=O.from(s.headers).normalize(),{responseType:c,onUploadProgress:d,onDownloadProgress:u}=s,f,h,b,R,p;function g(){R&&R(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function S(){if(!m)return;let T=O.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),M={data:!c||c==="text"||c==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:T,config:t,request:m};G(function(L){n(L),g()},function(L){r(L),g()},M),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(r(new y("Request aborted",y.ECONNABORTED,t,m)),m=null)},m.onerror=function(_){let M=_&&_.message?_.message:"Network Error",k=new y(M,y.ERR_NETWORK,t,m);k.event=_||null,r(k),m=null},m.ontimeout=function(){let _=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",M=s.transitional||ne;s.timeoutErrorMessage&&(_=s.timeoutErrorMessage),r(new y(_,M.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,t,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(_,M){m.setRequestHeader(M,_)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),c&&c!=="json"&&(m.responseType=s.responseType),u&&([b,p]=Y(u,!0),m.addEventListener("progress",b)),d&&m.upload&&([h,R]=Y(d),m.upload.addEventListener("progress",h),m.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(f=T=>{m&&(r(!T||T.type?new $(null,t,m):T),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));let C=_e(s.url);if(C&&x.protocols.indexOf(C)===-1){r(new y("Unsupported protocol "+C+":",y.ERR_BAD_REQUEST,t));return}m.send(i||null)})};l();l();var xs=(t,e)=>{let{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s,i=function(u){if(!s){s=!0,c();let f=u instanceof Error?u:this.reason;r.abort(f instanceof y?f:new $(f instanceof Error?f.message:f))}},o=e&&setTimeout(()=>{o=null,i(new y(`timeout of ${e}ms exceeded`,y.ETIMEDOUT))},e),c=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),t=null)};t.forEach(u=>u.addEventListener("abort",i));let{signal:d}=r;return d.unsubscribe=()=>a.asap(c),d}},Sr=xs;l();var Ss=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},As=async function*(t,e){for await(let n of Cs(t))yield*Ss(n,e)},Cs=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}let e=t.getReader();try{for(;;){let{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},xt=(t,e,n,r)=>{let s=As(t,e),i=0,o,c=d=>{o||(o=!0,r&&r(d))};return new ReadableStream({async pull(d){try{let{done:u,value:f}=await s.next();if(u){c(),d.close();return}let h=f.byteLength;if(n){let b=i+=h;n(b)}d.enqueue(new Uint8Array(f))}catch(u){throw c(u),u}},cancel(d){return c(d),s.return()}},{highWaterMark:2})};var Ar=64*1024,{isFunction:Je}=a,Os=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Cr,TextEncoder:Or}=a.global,_r=(t,...e)=>{try{return!!t(...e)}catch{return!1}},_s=t=>{t=a.merge.call({skipUndefined:!0},Os,t);let{fetch:e,Request:n,Response:r}=t,s=e?Je(e):typeof fetch=="function",i=Je(n),o=Je(r);if(!s)return!1;let c=s&&Je(Cr),d=s&&(typeof Or=="function"?(p=>g=>p.encode(g))(new Or):async p=>new Uint8Array(await new n(p).arrayBuffer())),u=i&&c&&_r(()=>{let p=!1,g=new n(x.origin,{body:new Cr,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!g}),f=o&&c&&_r(()=>a.isReadableStream(new r("").body)),h={stream:f&&(p=>p.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!h[p]&&(h[p]=(g,m)=>{let S=g&&g[p];if(S)return S.call(g);throw new y(`Response type '${p}' is not supported`,y.ERR_NOT_SUPPORT,m)})});let b=async p=>{if(p==null)return 0;if(a.isBlob(p))return p.size;if(a.isSpecCompliantForm(p))return(await new n(x.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(a.isArrayBufferView(p)||a.isArrayBuffer(p))return p.byteLength;if(a.isURLSearchParams(p)&&(p=p+""),a.isString(p))return(await d(p)).byteLength},R=async(p,g)=>{let m=a.toFiniteNumber(p.getContentLength());return m??b(g)};return async p=>{let{url:g,method:m,data:S,signal:C,cancelToken:T,timeout:_,onDownloadProgress:M,onUploadProgress:k,responseType:L,headers:P,withCredentials:Z="same-origin",fetchOptions:de}=ze(p),ie=e||fetch;L=L?(L+"").toLowerCase():"text";let X=Sr([C,T&&T.toAbortSignal()],_),K=null,Q=X&&X.unsubscribe&&(()=>{X.unsubscribe()}),ee;try{if(k&&u&&m!=="get"&&m!=="head"&&(ee=await R(P,S))!==0){let w=new n(g,{method:"POST",body:S,duplex:"half"}),A;if(a.isFormData(S)&&(A=w.headers.get("content-type"))&&P.setContentType(A),w.body){let[j,D]=ge(ee,Y(we(k)));S=xt(w.body,Ar,j,D)}}a.isString(Z)||(Z=Z?"include":"omit");let B=i&&"credentials"in n.prototype,I={...de,signal:X,method:m.toUpperCase(),headers:P.normalize().toJSON(),body:S,duplex:"half",credentials:B?Z:void 0};K=i&&new n(g,I);let H=await(i?ie(K,de):ie(g,I)),pe=f&&(L==="stream"||L==="response");if(f&&(M||pe&&Q)){let w={};["status","statusText","headers"].forEach(J=>{w[J]=H[J]});let A=a.toFiniteNumber(H.headers.get("content-length")),[j,D]=M&&ge(A,Y(we(M),!0))||[];H=new r(xt(H.body,Ar,j,()=>{D&&D(),Q&&Q()}),w)}L=L||"text";let E=await h[a.findKey(h,L)||"text"](H,p);return!pe&&Q&&Q(),await new Promise((w,A)=>{G(w,A,{data:E,headers:O.from(H.headers),status:H.status,statusText:H.statusText,config:p,request:K})})}catch(B){throw Q&&Q(),B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,p,K,B&&B.response),{cause:B.cause||B}):y.from(B,B&&B.code,p,K,B&&B.response)}}},ks=new Map,St=t=>{let e=t&&t.env||{},{fetch:n,Request:r,Response:s}=e,i=[r,s,n],o=i.length,c=o,d,u,f=ks;for(;c--;)d=i[c],u=f.get(d),u===void 0&&f.set(d,u=c?new Map:_s(e)),f=u;return u},Fc=St();var At={http:wr,xhr:xr,fetch:{get:St}};a.forEach(At,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});var kr=t=>`- ${t}`,Ns=t=>a.isFunction(t)||t===null||t===!1;function Ls(t,e){t=a.isArray(t)?t:[t];let{length:n}=t,r,s,i={};for(let o=0;o<n;o++){r=t[o];let c;if(s=r,!Ns(r)&&(s=At[(c=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;i[c||"#"+o]=s}if(!s){let o=Object.entries(i).map(([d,u])=>`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build")),c=n?o.length>1?`since :
|
|
7
|
-
`+o.map(kr).join(`
|
|
8
|
-
`):" "+kr(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}var We={getAdapter:Ls,adapters:At};function Ct(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new $(null,t)}function Ve(t){return Ct(t),t.headers=O.from(t.headers),t.data=Ce.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),We.getAdapter(t.adapter||ye.adapter,t)(t).then(function(r){return Ct(t),r.data=Ce.call(t,t.transformResponse,r),r.headers=O.from(r.headers),r},function(r){return Oe(r)||(Ct(t),r&&r.response&&(r.response.data=Ce.call(t,t.transformResponse,r.response),r.response.headers=O.from(r.response.headers))),Promise.reject(r)})}l();var Ke={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ke[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var Dr={};Ke.transitional=function(e,n,r){function s(i,o){return"[Axios v"+ue+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(e===!1)throw new y(s(o," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!Dr[o]&&(Dr[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,o,c):!0}};Ke.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Ps(t,e,n){if(typeof t!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);let r=Object.keys(t),s=r.length;for(;s-- >0;){let i=r[s],o=e[i];if(o){let c=t[i],d=c===void 0||o(c,i,t);if(d!==!0)throw new y("option "+i+" must be "+d,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}var De={assertOptions:Ps,validators:Ke};var z=De.validators,Re=class{constructor(e){this.defaults=e||{},this.interceptors={request:new st,response:new st}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;let i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
9
|
-
`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=V(this.defaults,n);let{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&De.assertOptions(r,{silentJSONParsing:z.transitional(z.boolean),forcedJSONParsing:z.transitional(z.boolean),clarifyTimeoutError:z.transitional(z.boolean),legacyInterceptorReqResOrdering:z.transitional(z.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:De.assertOptions(s,{encode:z.function,serialize:z.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),De.assertOptions(n,{baseUrl:z.spelling("baseURL"),withXsrfToken:z.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),n.headers=O.concat(o,i);let c=[],d=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(n)===!1)return;d=d&&g.synchronous;let m=n.transitional||ne;m&&m.legacyInterceptorReqResOrdering?c.unshift(g.fulfilled,g.rejected):c.push(g.fulfilled,g.rejected)});let u=[];this.interceptors.response.forEach(function(g){u.push(g.fulfilled,g.rejected)});let f,h=0,b;if(!d){let p=[Ve.bind(this),void 0];for(p.unshift(...c),p.push(...u),b=p.length,f=Promise.resolve(n);h<b;)f=f.then(p[h++],p[h++]);return f}b=c.length;let R=n;for(;h<b;){let p=c[h++],g=c[h++];try{R=p(R)}catch(m){g.call(this,m);break}}try{f=Ve.call(this,R)}catch(p){return Promise.reject(p)}for(h=0,b=u.length;h<b;)f=f.then(u[h++],u[h++]);return f}getUri(e){e=V(this.defaults,e);let n=le(e.baseURL,e.url,e.allowAbsoluteUrls);return ce(n,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){Re.prototype[e]=function(n,r){return this.request(V(r||{},{method:e,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(e){function n(r){return function(i,o,c){return this.request(V(c||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}Re.prototype[e]=n(),Re.prototype[e+"Form"]=n(!0)});var Ne=Re;l();var Ot=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});let r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i,o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,c){r.reason||(r.reason=new $(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new t(function(s){e=s}),cancel:e}}},Nr=Ot;l();function _t(t){return function(n){return t.apply(null,n)}}l();function kt(t){return a.isObject(t)&&t.isAxiosError===!0}l();var Dt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Dt).forEach(([t,e])=>{Dt[e]=t});var Lr=Dt;function Pr(t){let e=new Ne(t),n=Ee(Ne.prototype.request,e);return a.extend(n,Ne.prototype,e,{allOwnKeys:!0}),a.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Pr(V(t,s))},n}var N=Pr(ye);N.Axios=Ne;N.CanceledError=$;N.CancelToken=Nr;N.isCancel=Oe;N.VERSION=ue;N.toFormData=re;N.AxiosError=y;N.Cancel=N.CanceledError;N.all=function(e){return Promise.all(e)};N.spread=_t;N.isAxiosError=kt;N.mergeConfig=V;N.AxiosHeaders=O;N.formToJSON=t=>qe(a.isHTMLForm(t)?new FormData(t):t);N.getAdapter=We.getAdapter;N.HttpStatusCode=Lr;N.default=N;var Le=N;var{Axios:zl,AxiosError:Jl,CanceledError:Wl,isCancel:Vl,CancelToken:Kl,VERSION:Gl,all:Xl,Cancel:Ql,isAxiosError:Yl,spread:Zl,toFormData:eu,AxiosHeaders:tu,HttpStatusCode:ru,formToJSON:nu,getAdapter:su,mergeConfig:ou}=Le;import Bs from"events";var Ge=(t=>(t.SUCCESS="SUCCESS",t.LATER="LATER",t))(Ge||{}),Is={autoReconnect:!0,keepAlive:!1,ua:"",subscriptions:[{type:"EVENT",topic:"*"}]},Pe=class extends Bs{debug=!0;connected=!1;registered=!1;reconnecting=!1;userDisconnect=!1;reconnectInterval=1e3;heartbeat_interval=8e3;heartbeatIntervallId;sslopts={rejectUnauthorized:!0};config;socket;dw_url;isAlive=!1;onEventReceived=e=>({status:"SUCCESS"});constructor(e){if(super(),this.config={...Is,...e},!this.config.clientId||!this.config.clientSecret)throw console.error("clientId or clientSecret is null"),new Error("clientId or clientSecret is null")}getConfig(){return{...this.config}}printDebug(e){if(this.debug){let n="["+new Date().toISOString()+"]";console.info(n,e)}}registerAllEventListener(e){return this.onEventReceived=e,this}registerCallbackListener(e,n){if(!e||!n)throw console.error("registerCallbackListener: eventId and callback must be defined"),new Error("registerCallbackListener: eventId and callback must be defined");return this.config.subscriptions.find(r=>r.topic===e&&r.type==="CALLBACK")||this.config.subscriptions.push({type:"CALLBACK",topic:e}),this.on(e,n),this}async getEndpoint(){this.printDebug("get connect endpoint by config"),console.log(this.config);let e=await Le.get(`https://oapi.dingtalk.com/gettoken?appkey=${this.config.clientId}&appsecret=${this.config.clientSecret}`);if(e.status===200&&e.data.access_token){this.config.access_token=e.data.access_token;let n=await Le({url:"https://api.dingtalk.com/v1.0/gateway/connections/open",method:"POST",responseType:"json",data:{clientId:this.config.clientId,clientSecret:this.config.clientSecret,ua:this.config.ua,subscriptions:this.config.subscriptions},headers:{Accept:"application/json","access-token":e.data.access_token}});if(console.log("res.data",JSON.stringify(n.data)),n.data){this.config.endpoint=n.data;let{endpoint:r,ticket:s}=n.data;if(!r||!s)throw this.printDebug("endpoint or ticket is null"),new Error("endpoint or ticket is null");return this.dw_url=`${r}?ticket=${s}`,this}else throw new Error("build: get endpoint failed")}else throw new Error("build: get access_token failed")}_connect(){return new Promise((e,n)=>{this.userDisconnect=!1,this.printDebug("Connecting to dingtalk websocket @ "+this.dw_url),this.socket=new Pt(this.dw_url,this.sslopts),this.socket.on("open",()=>{this.connected=!0,this.printDebug("Socket open"),this.config.keepAlive&&(this.isAlive=!0,this.heartbeatIntervallId=setInterval(()=>{var r,s;if(this.isAlive===!1)return console.error("TERMINATE SOCKET: Ping Pong does not transfer heartbeat within heartbeat intervall"),(r=this.socket)==null?void 0:r.terminate();this.isAlive=!1,(s=this.socket)==null||s.ping("",!0)},this.heartbeat_interval))}),this.socket.on("pong",()=>{this.heartbeat()}),this.socket.on("message",r=>{this.onDownStream(r)}),this.socket.on("close",r=>{this.printDebug("Socket closed"),this.connected=!1,this.registered=!1,this.config.autoReconnect&&!this.userDisconnect&&(this.reconnecting=!0,this.printDebug("Reconnecting in "+this.reconnectInterval/1e3+" seconds..."),setTimeout(this.connect.bind(this),this.reconnectInterval))}),this.socket.on("error",r=>{this.printDebug("SOCKET ERROR"),console.warn("ERROR",r)}),e()})}async connect(){await this.getEndpoint(),await this._connect()}disconnect(){var e;console.info("Disconnecting."),this.userDisconnect=!0,this.config.keepAlive&&this.heartbeatIntervallId!==void 0&&clearInterval(this.heartbeatIntervallId),(e=this.socket)==null||e.close()}heartbeat(){this.isAlive=!0,this.printDebug("CLIENT-SIDE HEARTBEAT")}onDownStream(e){this.printDebug("Received message from dingtalk websocket server"),this.printDebug(e),console.log(e);let n=JSON.parse(e);switch(n.type){case"SYSTEM":this.onSystem(n);break;case"EVENT":this.onEvent(n);break;case"CALLBACK":this.onCallback(n);break}}onSystem(e){var n;switch(e.headers.topic){case"CONNECTED":{this.printDebug("CONNECTED");break}case"REGISTERED":{this.registered=!0,this.reconnecting=!1;break}case"disconnect":{this.connected=!1,this.registered=!1;break}case"KEEPALIVE":{this.heartbeat();break}case"ping":{this.printDebug("PING"),(n=this.socket)==null||n.send(JSON.stringify({code:200,headers:e.headers,message:"OK",data:e.data}));break}}}onEvent(e){var n;this.printDebug("received event, message="+JSON.stringify(e));let r=this.onEventReceived(e);(n=this.socket)==null||n.send(JSON.stringify({code:200,headers:{contentType:"application/json",messageId:e.headers.messageId},message:"OK",data:JSON.stringify(r)}))}onCallback(e){this.emit(e.headers.topic,e)}send(e,n){var r;if(!e)throw console.error("send: messageId must be defined"),new Error("send: messageId must be defined");let s={code:200,headers:{contentType:"application/json",messageId:e},message:"OK",data:JSON.stringify(n)};(r=this.socket)==null||r.send(JSON.stringify(s))}};l();function Us(t){let e=t.trim();if(!e.includes("-"))return!1;let n=e.replace(/^\|/,"").replace(/\|$/,"").split("|").map(r=>r.trim());return n.length>0&&n.every(r=>/^:?-{3,}:?$/.test(r))}function Br(t){let e=t.trim();return e.includes("|")&&!e.startsWith("```")}function Fs(t){return t.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function Ms(t){return t.map(Fs).filter(n=>n.length>0).map(n=>n.join(" | ")).join(`
|
|
10
|
-
`)}function Hs(t){let e=t.split(`
|
|
11
|
-
`),n=[],r=0,s=!1;for(;r<e.length;){let i=e[r]||"";if(i.trim().startsWith("```")){s=!s,n.push(i),r++;continue}if(!s&&r+1<e.length&&Br(i)&&Us(e[r+1]||"")){let o=[i];for(r+=2;r<e.length&&Br(e[r]||"");)o.push(e[r]||""),r++;n.push(Ms(o));continue}n.push(i),r++}return n.join(`
|
|
12
|
-
`)}function vs(t){if(!t||t.length<=3800)return[t];let e=[],n="",r=t.split(`
|
|
13
|
-
`),s=!1;for(let i of r){let o=(i.match(/```/g)||[]).length;n.length+i.length+1>3800&&n.length>0&&(s&&(n+="\n```"),e.push(n),n=s?"```":""),n+=(n?`
|
|
14
|
-
`:"")+i,o%2===1&&(s=!s)}return n&&e.push(n),e}function Ir(t){return(t.split(`
|
|
15
|
-
`)[0]||"").replace(/^[#*\s\->]+/,"").slice(0,20)||"Reply"}function Ur(t){let e=Hs(t);return vs(e)}l();var qs="https://api.dingtalk.com/v1.0/robot/messageFiles/download";async function Nt(t,e,n){if(!t||!e||!n)return null;try{let r=await fetch(qs,{method:"POST",headers:{"x-acs-dingtalk-access-token":n,"Content-Type":"application/json"},body:JSON.stringify({downloadCode:t,robotCode:e})});if(!r.ok){let u=await r.text().catch(()=>"");return process.stderr.write(`[DingTalk] downloadMedia API failed: HTTP ${r.status} ${u}
|
|
16
|
-
`),null}let s=await r.json(),i=s.downloadUrl??s.data?.downloadUrl;if(!i)return process.stderr.write(`[DingTalk] downloadMedia: no downloadUrl in response
|
|
17
|
-
`),null;let o=await fetch(i);if(!o.ok)return process.stderr.write(`[DingTalk] downloadMedia file fetch failed: HTTP ${o.status}
|
|
18
|
-
`),null;let c=o.headers.get("content-type")||"application/octet-stream";return{buffer:Buffer.from(await o.arrayBuffer()),mimeType:c}}catch(r){return process.stderr.write(`[DingTalk] downloadMedia error: ${r instanceof Error?r.message:r}
|
|
19
|
-
`),null}}var Vs=5*60*1e3,Lt="\u{1F440}",Ks="2659900",Gs="im_bg_1",Xs="https://api.dingtalk.com/v1.0/robot/emotion",Be=class extends Bt{client;seenMessages=new Map;dedupTimer;webhooks=new Map;constructor(e,n,r,s){if(super(e,n,r,s),!n.clientId||!n.clientSecret)throw new Error(`Channel "${e}" requires clientId and clientSecret for DingTalk.`);this.client=new Pe({clientId:n.clientId,clientSecret:n.clientSecret})}async connect(){this.client.registerCallbackListener(Ye,e=>{this.client.send(e.headers.messageId,{status:Ge.SUCCESS,message:"ok"}),this.onMessage(e)}),await this.client.connect(),this.dedupTimer=setInterval(()=>{let e=Date.now();for(let[n,r]of this.seenMessages)e-r>Vs&&this.seenMessages.delete(n)},6e4),process.stderr.write(`[DingTalk:${this.name}] Connected via stream.
|
|
20
|
-
`)}async sendMessage(e,n){let r=this.webhooks.get(e);if(!r){process.stderr.write(`[DingTalk:${this.name}] No webhook for chatId ${e}, cannot send.
|
|
21
|
-
`);return}let s=Ur(n),i=Ir(n);for(let o=0;o<s.length;o++){let c=s[o],d={msgtype:"markdown",markdown:{title:o===0?i:`${i} (cont.)`,text:c}},u=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!u.ok){let f=await u.text().catch(()=>"");process.stderr.write(`[DingTalk:${this.name}] sendMessage failed: HTTP ${u.status} ${f}
|
|
22
|
-
`)}}}getAccessToken(){return this.client.getConfig().access_token}async emotionApi(e,n,r){let s=this.getAccessToken();if(!s)return;let i=this.config.clientId;if(!(!i||!n||!r))try{let o=await fetch(`${Xs}/${e}`,{method:"POST",headers:{"x-acs-dingtalk-access-token":s,"Content-Type":"application/json"},body:JSON.stringify({robotCode:i,openMsgId:n,openConversationId:r,emotionType:2,emotionName:Lt,textEmotion:{emotionId:Ks,emotionName:Lt,text:Lt,backgroundId:Gs}})});if(!o.ok){let c=await o.text().catch(()=>"");process.stderr.write(`[DingTalk:${this.name}] emotion/${e} failed: ${o.status} ${c}
|
|
23
|
-
`)}}catch{}}async attachReaction(e,n){await this.emotionApi("reply",e,n)}async recallReaction(e,n){await this.emotionApi("recall",e,n)}disconnect(){this.dedupTimer&&clearInterval(this.dedupTimer),this.client.disconnect(),process.stderr.write(`[DingTalk:${this.name}] Disconnected.
|
|
24
|
-
`)}isConversationId(e){return!!e&&!e.startsWith("http")}onPromptStart(e,n,r){!r||!this.isConversationId(e)||this.attachReaction(r,e).catch(()=>{})}onPromptEnd(e,n,r){!r||!this.isConversationId(e)||this.recallReaction(r,e).catch(()=>{})}extractQuotedContext(e){if(e.text?.isReplyMsg&&e.text.repliedMsg){let n=e.text.repliedMsg,r=!!e.chatbotUserId&&n.senderId===e.chatbotUserId;return{referencedText:this.summarizeRepliedContent(n)||void 0,isReplyToBot:r}}if(e.quoteMessage){let n=e.quoteMessage,r=!!e.chatbotUserId&&n.senderId===e.chatbotUserId;return{referencedText:n.text?.content?.trim()||void 0,isReplyToBot:r}}return{isReplyToBot:!1}}summarizeRepliedContent(e){let n=e.msgType,r=e.content;if(r?.text?.trim())return r.text.trim();if(r?.richText&&Array.isArray(r.richText)){let s=[];for(let o of r.richText){let c=o.type||"text";c==="text"&&o.text?s.push(o.text):c==="picture"?s.push("[image]"):c==="at"&&o.atName&&s.push(`@${o.atName}`)}let i=s.join("").trim();if(i)return i}switch(n){case"picture":return"[image]";case"file":return`[file: ${r?.fileName||"file"}]`;case"audio":return"[audio]";case"video":return"[video]";default:break}return""}extractContent(e){let n=e.msgtype||"text";if(n==="richText"){let r=e.content?.richText;if(!Array.isArray(r))return{text:"",downloadCodes:[]};let s="",i=[];for(let o of r){let c=o.type||"text";c==="text"&&o.text?s+=o.text:c==="picture"&&o.downloadCode&&i.push(o.downloadCode)}return{text:s.trim()||(i.length>0?"(image)":""),downloadCodes:i,mediaType:i.length>0?"image":void 0}}if(n==="picture"){let r=e.content?.downloadCode;return{text:"(image)",downloadCodes:r?[r]:[],mediaType:"image"}}if(n==="file"){let r=e.content?.downloadCode,s=e.content?.fileName||void 0;return{text:`(file: ${s||"file"})`,downloadCodes:r?[r]:[],mediaType:"file",fileName:s}}if(n==="audio"){let r=e.content?.downloadCode;return{text:e.content?.recognition||"(audio)",downloadCodes:r?[r]:[],mediaType:"audio"}}if(n==="video"){let r=e.content?.downloadCode;return{text:"(video)",downloadCodes:r?[r]:[],mediaType:"video"}}return{text:e.text?.content?.trim()||"",downloadCodes:[]}}async attachMedia(e,n,r,s){let i=this.getAccessToken(),o=this.config.clientId;if(!i||!o){process.stderr.write(`[DingTalk:${this.name}] Cannot download media: missing token or robotCode.
|
|
25
|
-
`);return}let c=await Nt(n,o,i);if(c)if(r==="image"){let d=c.mimeType.startsWith("image/")?c.mimeType:"image/jpeg";e.attachments=[...e.attachments||[],{type:"image",data:c.buffer.toString("base64"),mimeType:d}]}else{let d=Fr(Ws(),"channel-files",zs());js(d,{recursive:!0});let u=Js(s||"")||`dingtalk_${r}_${Date.now()}`,f=Fr(d,u);$s(f,c.buffer),(e.text===`(file: ${s||"file"})`||e.text==="(audio)"||e.text==="(video)")&&(e.text=""),e.attachments=[...e.attachments||[],{type:r,filePath:f,mimeType:c.mimeType,fileName:u}]}}onMessage(e){try{let n=typeof e.data=="string"?JSON.parse(e.data):e.data,r=n.msgId||e.headers.messageId;if(r&&this.seenMessages.has(r))return;r&&this.seenMessages.set(r,Date.now());let s=n.conversationType==="2",i=n.sessionWebhook,o=n.conversationId;if(!i){process.stderr.write(`[DingTalk:${this.name}] No sessionWebhook in message, skipping.
|
|
26
|
-
`);return}o&&this.webhooks.set(o,i);let c=!!n.isInAtList,d=this.extractContent(n),u=d.text;c&&(u=u.replace(/@\S+/,"").trim());let f=this.extractQuotedContext(n),h=o||i,b=c?u:u||d.text,R={channelName:this.name,senderId:n.senderStaffId||n.senderId||"",senderName:n.senderNick||"Unknown",chatId:h,text:b,isGroup:s,isMentioned:c,isReplyToBot:f.isReplyToBot,referencedText:f.referencedText};R.messageId=r,(async()=>{d.downloadCodes.length>0&&d.mediaType&&await this.attachMedia(R,d.downloadCodes[0],d.mediaType,d.fileName),await this.handleInbound(R)})().catch(g=>{process.stderr.write(`[DingTalk:${this.name}] Error handling message: ${g}
|
|
27
|
-
`),this.sendMessage(h,"Sorry, something went wrong processing your message.").catch(()=>{})})}catch(n){process.stderr.write(`[DingTalk:${this.name}] Failed to parse message: ${n}
|
|
28
|
-
`)}}};var Bu={channelType:"dingtalk",displayName:"DingTalk",requiredConfigFields:["clientId","clientSecret"],createChannel:(t,e,n,r)=>new Be(t,e,n,r)};export{Be as DingtalkChannel,Nt as downloadMedia,Bu as plugin};
|
package/chunks/dist-YTCHM57U.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as M,b as A,c as P,f as _,h as N,i as E,j as W,k as D,l as B,m as L}from"./chunk-6GBNB5Z2.js";import{f as C}from"./chunk-EQGA7LH7.js";import"./chunk-T2T2UEPY.js";import"./chunk-M53RP3YP.js";import{b as p}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";p();p();import{mkdirSync as Ue,writeFileSync as Ce}from"node:fs";import{randomUUID as Me}from"node:crypto";import{basename as Ae,join as Z}from"node:path";import{tmpdir as Pe}from"node:os";p();p();var h={NONE:0,USER:1,BOT:2},g={NONE:0,TEXT:1,IMAGE:2,VOICE:3,FILE:4,VIDEO:5},T={NEW:0,GENERATING:1,FINISH:2},$={TYPING:1,CANCEL:2};import{existsSync as re,readFileSync as ne,writeFileSync as oe}from"node:fs";import{join as ie}from"node:path";var F=new Map;function k(e){return F.get(e)}function R(){return ie(A(),"cursor.txt")}function se(){let e=R();return re(e)?ne(e,"utf-8").trim():""}function ae(e){oe(R(),e,"utf-8")}async function G(e){let{baseUrl:t,token:o,onMessage:r,abortSignal:i}=e,s=se(),c=0,a=4e4;for(process.stderr.write(`[weixin] Starting message poll loop...
|
|
4
|
-
`);!i.aborted;)try{let n=await N(t,o,s,a,i);if(n.errcode===-14){process.stderr.write(`[weixin] Session expired (errcode -14). Pausing 30s...
|
|
5
|
-
`),await new Promise(l=>setTimeout(l,3e4));continue}if(n.ret!==0&&n.ret!==void 0)throw new Error(`getUpdates error: ret=${n.ret} errcode=${n.errcode} ${n.errmsg}`);if(c=0,n.longpolling_timeout_ms&&n.longpolling_timeout_ms>0&&(a=n.longpolling_timeout_ms+5e3),n.msgs&&n.msgs.length>0)for(let l of n.msgs)await ce(l,r);n.get_updates_buf&&(s=n.get_updates_buf,ae(s))}catch(n){if(i.aborted)break;c++,process.stderr.write(`[weixin] Poll error (${c}): ${n instanceof Error?n.message:n}
|
|
6
|
-
`),c>=3?(process.stderr.write(`[weixin] Too many consecutive errors, backing off 30s...
|
|
7
|
-
`),await new Promise(l=>setTimeout(l,3e4)),c=0):await new Promise(l=>setTimeout(l,2e3))}process.stderr.write(`[weixin] Poll loop stopped.
|
|
8
|
-
`)}async function ce(e,t){if(e.message_type!==h.USER)return;let o=e.from_user_id;if(!o)return;e.context_token&&F.set(o,e.context_token);let r="",i,s,c;if(e.item_list)for(let a of e.item_list){if(a.type===g.TEXT&&a.text_item?.text&&(r+=(r?`
|
|
9
|
-
`:"")+a.text_item.text),a.ref_msg){let n=a.ref_msg.message_item;n?.text_item?.text?c=n.text_item.text:a.ref_msg.title&&(c=a.ref_msg.title)}if(a.type===g.IMAGE&&a.image_item){let n=a.image_item.media;n?.encrypt_query_param&&n.aes_key&&(i={encryptQueryParam:n.encrypt_query_param,aesKey:n.aes_key})}else if(a.type===g.FILE&&a.file_item){let n=a.file_item.media;n?.encrypt_query_param&&n.aes_key&&(s={encryptQueryParam:n.encrypt_query_param,aesKey:n.aes_key,fileName:a.file_item.file_name||`file_${Date.now()}`})}}!r&&!i&&!s||await t({fromUserId:o,messageId:String(e.message_id||""),text:r||(s?`(file: ${s.fileName})`:"(image)"),image:i,file:s,refText:c})}p();import{randomBytes as j,randomUUID as Q}from"node:crypto";import{readFileSync as he,statSync as ye,realpathSync as b,openSync as xe,readSync as we,closeSync as _e}from"node:fs";import{tmpdir as K}from"node:os";import{resolve as q,extname as be,win32 as Ee,posix as Te}from"node:path";p();import{createCipheriv as le,createDecipheriv as me,createHash as pe}from"node:crypto";var fe="https://novac2c.cdn.weixin.qq.com/c2c";function ge(e){return`${fe}/download?encrypted_query_param=${encodeURIComponent(e)}`}function de(e,t){let o=me("aes-128-ecb",t,null);return Buffer.concat([o.update(e),o.final()])}function ue(e){let t=Buffer.from(e,"base64");if(t.length===16)return t;if(t.length===32&&/^[0-9a-fA-F]{32}$/.test(t.toString("ascii")))return Buffer.from(t.toString("ascii"),"hex");throw new Error(`Invalid aes_key: expected 16 raw bytes or 32 hex chars, got ${t.length} bytes`)}async function I(e,t){let o=ge(e),r=new AbortController,i=setTimeout(()=>r.abort(),4e4);try{let s=await fetch(o,{signal:r.signal});if(!s.ok)throw new Error(`CDN download failed: HTTP ${s.status}`);let c=Buffer.from(await s.arrayBuffer()),a=ue(t);return de(c,a)}finally{clearTimeout(i)}}function O(e,t){let o=le("aes-128-ecb",t,null);return Buffer.concat([o.update(e),o.final()])}function v(e){return pe("md5").update(e).digest("hex")}function $e(e){return e.replace(/```[\s\S]*?\n([\s\S]*?)```/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*\*(.+?)\*\*\*/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/___(.+?)___/g,"$1").replace(/__(.+?)__/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1 ($2)").replace(/!\[([^\]]*)\]\([^)]+\)/g,"[$1]").replace(/^>\s+/gm,"").replace(/^[-*_]{3,}$/gm,"---").replace(/^[\s]*[-*+]\s+/gm,"- ").replace(/^[\s]*(\d+)\.\s+/gm,"$1. ").replace(/\n{3,}/g,`
|
|
10
|
-
|
|
11
|
-
`).trim()}var ke=new Set([".png",".jpg",".jpeg",".gif",".webp"]),z=20*1024*1024;function H(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")}function X(e){return e.replace(/\//g,"\\")}function Ie(e,t){let o=H(e)||H(t),r=o?Ee:Te,i=o?X(t):t,s=o?X(e):e,c=r.relative(i,s);return c===""||!c.startsWith("..")&&!r.isAbsolute(c)}function S(e){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70)return"image/webp";if(e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";throw new Error("Unrecognized image format: magic bytes do not match any supported type")}function Se(e,t=[]){let o=q(e),r=be(o).toLowerCase();if(!ke.has(r))throw new Error(`Image extension not allowed: ${r} (path: ${o})`);let i=(()=>{try{return b(o)}catch{throw new Error(`Image file not found: ${o}`)}})(),s=ye(i);if(!s.isFile())throw new Error(`Not a regular file: ${i}`);if(s.size>z)throw new Error(`Image too large: ${s.size} bytes (max ${z})`);if(!["/tmp/",b("/tmp/")+"/",K()+"/",b(K())+"/",...t.map(n=>b(q(n))+"/")].some(n=>Ie(i,n)))throw new Error(`Image path outside allowed directories: ${i}`);let a;try{a=xe(i,"r");let n=Buffer.alloc(16),l=we(a,n,0,16,0),m=S(n.slice(0,l)),f={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp"}[r];if(m!==f)throw new Error(`Image type mismatch: ext=${r} expects ${f} but got ${m}`)}finally{a!==void 0&&_e(a)}return i}async function U(e){let{to:t,text:o,baseUrl:r,token:i,contextToken:s}=e,c=$e(o);await E(r,i,{to_user_id:t,from_user_id:"",client_id:Q(),message_type:h.BOT,message_state:T.FINISH,context_token:s,item_list:[{type:g.TEXT,text_item:{text:c}}]})}async function Y(e){let{to:t,imagePath:o,baseUrl:r,token:i,contextToken:s,workspaceDirs:c}=e,a=Se(o,c),n=he(a),l=n.length,m=v(n),d=j(16),f=d.toString("hex"),x=j(16).toString("hex"),w=Math.ceil((l+1)/16)*16,u=await B(r,i,t,x,l,m,w,f),V=O(n,d),ee=await L(u,x,V),te=Buffer.from(f,"ascii").toString("base64");await E(r,i,{to_user_id:t,from_user_id:"",client_id:Q(),message_type:h.BOT,message_state:T.FINISH,context_token:s,item_list:[{type:g.IMAGE,image_item:{aeskey:f,mid_size:w,media:{encrypt_query_param:ee,aes_key:te,encrypt_type:1}}}]})}var J=new Map;function Ne(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var y=class extends C{abortController=null;baseUrl;token="";constructor(t,o,r,i){super(t,o,r,i),this.baseUrl=o.baseUrl||M}async connect(){let t=["","If you created an image file (screenshot, chart, etc.), you can send it to the user by writing:","[IMAGE: /absolute/path/to/file.png]","","The marker is stripped from text and the image is uploaded automatically.","","CRITICAL: Only use real file paths. Do NOT write [IMAGE: ...] with:","- Example paths like /path/to/file or /tmp/cat.png","- Placeholder symbols like ...","- Paths that don't exist on disk"].join(`
|
|
12
|
-
`);this.config.instructions?this.config.instructions.includes("[IMAGE:")||(this.config.instructions=this.config.instructions+`
|
|
13
|
-
`+t):this.config.instructions=["## WeChat Channel","","You are a concise coding assistant responding via WeChat.","Keep responses under 500 characters. Use plain text only.","","Users can also send you images.",t].join(`
|
|
14
|
-
`);let o=P();if(!o)throw new Error('WeChat account not configured. Run "matilda channel configure-weixin" first.');this.token=o.token,o.baseUrl&&(this.baseUrl=o.baseUrl),this.abortController=new AbortController,G({baseUrl:this.baseUrl,token:this.token,onMessage:async r=>{let i={channelName:this.name,senderId:r.fromUserId,senderName:r.fromUserId,chatId:r.fromUserId,text:r.text,isGroup:!1,isMentioned:!1,isReplyToBot:!1,referencedText:r.refText};this.handleInboundWithMedia(i,r.image,r.file).catch(s=>{let c=s instanceof Error?s.message:JSON.stringify(s,null,2);process.stderr.write(`[Weixin:${this.name}] Error handling message: ${c}
|
|
15
|
-
`)})},abortSignal:this.abortController.signal}).catch(r=>{this.abortController?.signal.aborted||process.stderr.write(`[Weixin:${this.name}] Poll loop error: ${r}
|
|
16
|
-
`)}),process.stderr.write(`[Weixin:${this.name}] Connected to WeChat (${this.baseUrl})
|
|
17
|
-
`)}onPromptStart(t){this.setTyping(t,!0).catch(()=>{})}onPromptEnd(t){this.setTyping(t,!1).catch(()=>{})}async handleInboundWithMedia(t,o,r){if(o)try{let i=await I(o.encryptQueryParam,o.aesKey);t.imageBase64=i.toString("base64"),t.imageMimeType=S(i)}catch(i){process.stderr.write(`[Weixin:${this.name}] Failed to download image: ${i instanceof Error?i.message:i}
|
|
18
|
-
`)}if(r)try{let i=await I(r.encryptQueryParam,r.aesKey),s=Z(Pe(),"channel-files",Me());Ue(s,{recursive:!0});let c=Z(s,Ae(r.fileName)||`file_${Date.now()}`);Ce(c,i),t.attachments=[{type:"file",filePath:c,mimeType:"application/octet-stream",fileName:r.fileName}]}catch(i){process.stderr.write(`[Weixin:${this.name}] Failed to download file: ${i instanceof Error?i.message:i}
|
|
19
|
-
`),t.text=`(User sent a file "${r.fileName}" but download failed)`}await super.handleInbound(t)}async sendMessage(t,o){let r=k(t)||"",i=o.replace(/```[\s\S]*?```/g,"").replace(/`[^`]*`/g,""),s=/\[IMAGE:\s*([^\]]+)\]/gi,c=[];for(let n of i.matchAll(s)){let l=n[1]?.trim();l&&c.push(l)}let a=o;for(let n of c)a=a.replace(new RegExp(`\\[IMAGE:\\s*${Ne(n)}\\]`,"gi"),"");if(a=a.replace(/\n{3,}/g,`
|
|
20
|
-
|
|
21
|
-
`).trim(),a&&await U({to:t,text:a,baseUrl:this.baseUrl,token:this.token,contextToken:r}),c.length){let n=[this.config.cwd];for(let l of c)try{await Y({to:t,imagePath:l,baseUrl:this.baseUrl,token:this.token,contextToken:r,workspaceDirs:n})}catch(m){let d=m instanceof _?m.status:0,f=m instanceof _?m.ret:void 0,x=m instanceof _?m.errcode:void 0,w=m instanceof Error?m.message:String(m);process.stderr.write(`[Weixin:${this.name}] Failed to send image (status=${d} ret=${f} errcode=${x}): ${w}
|
|
22
|
-
`);try{await U({to:t,text:"\u56FE\u7247\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5",baseUrl:this.baseUrl,token:this.token,contextToken:r})}catch(u){process.stderr.write(`[Weixin:${this.name}] Fallback text also failed: ${u instanceof Error?u.message:String(u)}
|
|
23
|
-
`)}}}}disconnect(){this.abortController&&(this.abortController.abort(),this.abortController=null)}async setTyping(t,o){try{let r=J.get(t);if(!r){let i=k(t),s=await W(this.baseUrl,this.token,t,i);s.typing_ticket&&(r=s.typing_ticket,J.set(t,r))}if(!r)return;await D(this.baseUrl,this.token,{ilink_user_id:t,typing_ticket:r,status:o?$.TYPING:$.CANCEL})}catch{}}};var ut={channelType:"weixin",displayName:"WeChat",createChannel:(e,t,o,r)=>new y(e,t,o,r)};export{y as WeixinChannel,ut as plugin};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as g}from"./chunk-6EQMZNIY.js";import{g as u}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{f as d}from"./chunk-SDTWBD62.js";import"./chunk-LUNDTQ3G.js";import"./chunk-27Q5KW3A.js";import"./chunk-FWDMPRKU.js";import{b as m}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";m();m();var p=class{googleGenAI;contentGeneratorConfig;constructor(e,t){let r=t?.customHeaders,n=r?(()=>{let i=e.httpOptions,s=i?.headers??{},l=Object.fromEntries(Object.entries(r).filter(([a])=>!d(a)));return{...e,httpOptions:{...i??{},headers:{...s,...l}}}})():e;this.googleGenAI=new u(n),this.contentGeneratorConfig=t}buildGenerateContentConfig(e){let t=this.contentGeneratorConfig?.samplingParams,r=e.config||{},n=(i,s,l)=>{let a=r[s];return i!==void 0?i:a!==void 0?a:l};return{...r,temperature:n(t?.temperature,"temperature",1),topP:n(t?.top_p,"topP",.95),topK:n(t?.top_k,"topK",64),maxOutputTokens:n(t?.max_tokens,"maxOutputTokens"),presencePenalty:n(t?.presence_penalty,"presencePenalty"),frequencyPenalty:n(t?.frequency_penalty,"frequencyPenalty"),thinkingConfig:n(this.buildThinkingConfig(),"thinkingConfig",{includeThoughts:!0,thinkingLevel:"THINKING_LEVEL_UNSPECIFIED"})}}buildThinkingConfig(){let e=this.contentGeneratorConfig?.reasoning;if(e===!1)return{includeThoughts:!1};if(e)return{includeThoughts:!0,thinkingLevel:e.effort==="low"?"LOW":e.effort==="high"||e.effort==="max"?"HIGH":"THINKING_LEVEL_UNSPECIFIED"}}async generateContent(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContent(r)}async generateContentStream(e,t){let r={...e,contents:this.stripUnsupportedFields(e.contents),config:this.buildGenerateContentConfig(e)};return this.googleGenAI.models.generateContentStream(r)}stripUnsupportedFields(e){return!e||typeof e=="string"?e:Array.isArray(e)?e.map(t=>this.stripContentFields(t)):this.stripContentFields(e)}stripContentFields(e){if(typeof e=="string")return e;if(!("role"in e)&&!("parts"in e))return this.stripPartFields(e);let t=e;return t.parts?{...t,parts:t.parts.map(r=>this.stripPartFields(r))}:t}stripPartFields(e){if(typeof e=="string")return e;let t={...e};if(t.inlineData){let{displayName:r,...n}=t.inlineData;t.inlineData=n}if(t.fileData){let{displayName:r,...n}=t.fileData;t.fileData=n}if(t.functionResponse?.parts){let r=t.functionResponse.parts.map(n=>{let i=this.convertUnsupportedMediaToText(n);return this.stripPartFields(i)});t.functionResponse={...t.functionResponse,parts:r}}return t}convertUnsupportedMediaToText(e){if(typeof e=="string")return e;let t=e.inlineData?.mimeType||"",r=e.fileData?.mimeType||"";if(t.startsWith("audio/")||t.startsWith("video/")){let n=e.inlineData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${t}${i}.`}}if(r.startsWith("audio/")||r.startsWith("video/")){let n=e.fileData?.displayName,i=n?` (${n})`:"";return{text:`Unsupported media type for Gemini: ${r}${i}.`}}return e}async countTokens(e){return this.googleGenAI.models.countTokens(e)}async embedContent(e){return this.googleGenAI.models.embedContent(e)}useSummarizedThinking(){return!0}};function T(o,e){let i={...{"User-Agent":o.userAgent||`MatildaCode/0.21.12 (${process.platform}; ${process.arch})`}};if(e?.getUsageStatisticsEnabled()){let f=new g().getInstallationId();i={...i,"x-gemini-api-privileged-user-id":`${f}`}}let s=o.baseUrl?{headers:i,baseUrl:o.baseUrl}:{headers:i};return new p({apiKey:o.apiKey===""?void 0:o.apiKey,vertexai:o.vertexai,httpOptions:s},o)}export{p as GeminiContentGenerator,T as createGeminiContentGenerator};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/glob-QQ6LGKDX.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{Gf as _,Hf as j}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import{b as D}from"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import{g as k}from"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import{g as M,i as C,p as N,q as A}from"./chunk-6E766NPX.js";import{G as $,J as O,O as v,ba as R,d as x}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as L}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";L();import z from"node:fs";import T from"node:path";var V=R("GLOB"),Y=100,B=2e4,W=15e3,q=500;function K(u,g,t){let e=[...u];return e.sort((r,s)=>{let c=r.mtimeMs??0,a=s.mtimeMs??0,o=g-c<t,l=g-a<t;return o&&l?a-c:o?-1:l?1:r.fullpath().localeCompare(s.fullpath())}),e}var S=class extends M{constructor(t,e){super(e);this.config=t;this.fileService=t.getFileService()}fileService;getDescription(){let t=`'${this.params.pattern}'`;return this.params.path&&(t+=` in path '${this.params.path}'`),t}async getDefaultPermission(){if(!this.params.path)return"allow";let t=this.config.getWorkspaceContext(),e=T.resolve(this.config.getTargetDir(),this.params.path);return t.isPathWithinWorkspace(e)||O(k(),e)?"allow":"ask"}async globInDirectory(t,e,r){let s=e,c=T.join(t,s);z.existsSync(c)&&(s=_(s));let a=j(s,{cwd:t,withFileTypes:!0,nodir:!0,stat:!0,nocase:!0,dot:!0,ignore:this.config.getFileExclusions().getGlobExcludes(),follow:!1,signal:r}),o=[],l=Date.now(),p=null;for await(let n of a){if(o.push(n),o.length>=B){p="count";break}if(Date.now()-l>W){p="time";break}o.length%q===0&&await new Promise(b=>setImmediate(b))}p&&a.destroy?.();let d=this.config.getTargetDir(),P=o.map(n=>T.relative(d,n.fullpath())),{filteredPaths:m}=this.fileService.filterFilesWithReport(P,this.getFileFilteringOptions()),h=n=>process.platform==="win32"||process.platform==="darwin"?n.toLowerCase():n,f=new Set(m.map(n=>h(T.resolve(d,n))));return{entries:o.filter(n=>f.has(h(n.fullpath()))),limited:p}}async execute(t){try{let e=[],r;if(this.params.path){let i=v(this.config,this.params.path,{allowExternalPaths:!0});e.push(i),r=`within ${i}`}else{let i=this.config.getWorkspaceContext().getDirectories();e.push(...i),r=i.length>1?`across ${i.length} workspace directories`:"in the workspace directory"}let s=this.params.pattern,c=[],a=new Set,o=null;for(let i of e){let{entries:F,limited:E}=await this.globInDirectory(i,s,t);E&&(o=E);for(let G of F){let I=G.fullpath();a.has(I)||(a.add(I),c.push(G))}}let l=c,p=o==="time"?`
|
|
4
|
-
|
|
5
|
-
[Search stopped after ${W/1e3}s before scanning the whole tree. Results may be incomplete \u2014 narrow the search by passing a more specific 'path' or pattern.]`:o==="count"?`
|
|
6
|
-
|
|
7
|
-
[Search stopped after scanning ${B} entries. Results may be incomplete \u2014 narrow the search by passing a more specific 'path' or pattern.]`:"";if(!l||l.length===0)return{llmContent:`No files found matching pattern "${this.params.pattern}" ${r}${p}`,returnDisplay:o?"No files found (search truncated)":"No files found"};let d=24*60*60*1e3,P=new Date().getTime(),m=K(l,P,d),h=m.length,f=Math.min(Y,this.config.getTruncateToolOutputLines()),y=h>f,b=(y?m.slice(0,f):m).map(i=>i.fullpath()),X=b.join(`
|
|
8
|
-
`),w=`Found ${h} file(s) matching "${this.params.pattern}" ${r}`;if(w+=`, sorted by modification time (newest first):
|
|
9
|
-
---
|
|
10
|
-
${X}`,y){let i=h-f;w+=`
|
|
11
|
-
---
|
|
12
|
-
[${i} ${i===1?"file":"files"} truncated] ...`}return w+=p,{llmContent:w,returnDisplay:`Found ${h} matching file(s)${y?" (truncated)":""}`,resultFilePaths:b}}catch(e){let r=e instanceof Error?e.message:String(e);V.error(`GlobLogic execute Error: ${r}`,e);let s=`Error during glob search operation: ${r}`;return{llmContent:s,returnDisplay:`Error: ${r||"An unexpected error occurred."}`,error:{message:s,type:"glob_execution_error"}}}}getFileFilteringOptions(){let t=this.config.getFileFilteringOptions?.();return{respectGitIgnore:t?.respectGitIgnore??D.respectGitIgnore,respectMatildaIgnore:t?.respectMatildaIgnore??D.respectMatildaIgnore}}},U=class u extends C{constructor(t){super(u.Name,A.GLOB,`Fast file pattern matching tool that works with any codebase size
|
|
13
|
-
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
14
|
-
- Returns matching file paths sorted by modification time
|
|
15
|
-
- Use this tool when you need to find files by name patterns
|
|
16
|
-
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
|
|
17
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.`,"search",{properties:{pattern:{description:"The glob pattern to match files against",type:"string"},path:{description:'The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.',type:"string"}},required:["pattern"],type:"object"});this.config=t}static Name=N.GLOB;validateToolParamValues(t){if(!t.pattern||typeof t.pattern!="string"||t.pattern.trim()==="")return"The 'pattern' parameter cannot be empty.";if(t.path){t.path=$(t.path.trim());try{v(this.config,t.path,{allowExternalPaths:!0})}catch(e){return x(e)}}return null}createInvocation(t){return new S(this.config,t)}};export{U as GlobTool,B as MAX_SCAN_ENTRIES,W as MAX_SCAN_MS,K as sortFileEntries};
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2025 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
22
|
-
*/
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as t}from"./chunk-QVCGLQCI.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as n}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";n();function a(e,o){return new t(e,o)}export{t as MatildaAgentContentGenerator,a as createMatildaAgentContentGenerator};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2026 Matilda Team
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{a as l,i as p}from"./chunk-FPO57O66.js";import"./chunk-GOJCMVJJ.js";import"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import{c as h}from"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import{d as u}from"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{k as c}from"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import{ba as d,s as i,t as a}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as s}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";s();var m=class extends p{debugLogger=d("MATILDA");matildaClient;sharedManager;currentToken;constructor(e,t,n){let r=new l(t,n);super(t,n,r),this.matildaClient=e,this.sharedManager=h.getInstance(),t?.baseUrl&&t?.apiKey&&(this.pipeline.client.baseURL=t?.baseUrl,this.pipeline.client.apiKey=t?.apiKey)}getCurrentEndpoint(e){let t=e||u,n="/v1",r=t.startsWith("http")?t:`https://${t}`;return r.endsWith(n)||r.endsWith("/api/v1")||r.endsWith("/api/v1/code")?r:`${r}${n}`}shouldSuppressErrorLogging(e,t){return this.isAuthError(e)}async getValidToken(){try{let e=await this.sharedManager.getValidCredentials(this.matildaClient);if(!e.access_token)throw new Error("No access token available");return{token:e.access_token,endpoint:this.getCurrentEndpoint(e.resource_url)}}catch(e){throw this.isAuthError(e)?e:(this.debugLogger.warn("Failed to get token from shared manager:",e),new Error("Failed to obtain a valid legacy OAuth access token. Please re-authenticate with Matilda."))}}async executeWithCredentialManagement(e){let t=async()=>{let{token:n,endpoint:r}=await this.getValidToken();this.pipeline.client.apiKey=n,this.pipeline.client.baseURL=r;try{return await e()}catch(o){throw a(o)?new i:o}};try{return await t()}catch(n){if(this.isAuthError(n))return await this.sharedManager.getValidCredentials(this.matildaClient,!0),await c("retry",t);throw n}}async generateContent(e,t){return this.executeWithCredentialManagement(()=>super.generateContent(e,t))}async generateContentStream(e,t){let n=await this.executeWithCredentialManagement(()=>super.generateContentStream(e,t));return async function*(){try{yield*n}catch(r){throw a(r)?new i:r}}()}async countTokens(e){return super.countTokens(e)}async embedContent(e){return this.executeWithCredentialManagement(()=>super.embedContent(e))}isAuthError(e){if(!e||a(e))return!1;let t=e instanceof Error?e.message.toLowerCase():String(e).toLowerCase(),n=e,r=n?.status||n?.code;return Number(r)===403?!1:r===401||r==="401"||t.includes("unauthorized")||t.includes("invalid api key")||t.includes("invalid access token")||t.includes("token expired")||t.includes("authentication")||t.includes("token")&&t.includes("expired")}getCurrentToken(){return this.currentToken?this.currentToken:this.sharedManager.getCurrentCredentials()?.access_token||null}clearToken(){this.currentToken=void 0,this.sharedManager.clearCache()}};export{m as MatildaContentGenerator};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Matilda
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{A as e,B as f,C as g,D as h,E as i,F as j,G as k,H as l,I as m,J as n,K as o,L as p,M as q,N as r,O as s,P as t,Q as u,R as v,S as w,T as x,U as y,V as z,W as A,w as a,x as b,y as c,z as d}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{d as MCPDiscoveryState,c as MCPServerStatus,a as MCP_DEFAULT_TIMEOUT_MSEC,e as McpClient,g as addMCPStatusChangeListener,s as connectAndDiscover,y as connectToMcpServer,b as createStreamableHttpCompatibilityFetch,z as createTransport,q as discoverMcpTools,v as discoverPrompts,t as discoverTools,m as getAllMCPServerStatuses,n as getMCPDiscoveryState,k as getMCPServerStatus,l as getMCPServerStderrTail,p as handleAutomaticOAuth,x as hasNetworkTransport,w as invokeMcpPrompt,A as isEnabled,u as listMcpPrompts,f as mcpServerRequiresOAuth,r as populateMcpServerCommand,j as removeMCPServerStatus,h as removeMCPStatusChangeListener,o as setMCPDiscoveryState,i as updateMCPServerStatus};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{Af as lt,Bd as D,Bi as O,De as P,Di as mt,Ed as nt,Fd as L,Kd as v,Ld as it,Pd as rt,Yd as st,pf as at,u as ot,yd as et}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import{g as q,i as Y,p as Q,q as tt}from"./chunk-6E766NPX.js";import{K,ba as Z,d as u}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as J}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";J();import{spawn as ct}from"node:child_process";import dt from"node:path";import{randomUUID as Et}from"node:crypto";var p=Z("MONITOR"),St=1e3,N=1e4,kt=3e5,U=6e5,ut=80,R=4096,ft=5,pt=1e3;function gt(c){return c.length>ut?c.slice(0,ut-1)+"\u2026":c}var xt=new Set(["task-notification","task-id","tool-use-id","kind","status","event-count","summary","result"]),Dt=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)>/g;function ht(c){let g="";for(let t=0;t<c.length;t++){let n=c.charCodeAt(t);if(n===9){g+=c[t];continue}n<32||n>=128&&n<=159||(g+=c[t])}return g=g.replace(Dt,(t,n,r)=>xt.has(String(r).toLowerCase())?n==="/"?`</\u200B${r}>`:`<\u200B${r}>`:t),g}var B=class extends q{constructor(t,n){super(n);this.config=t}callId;setCallId(t){this.callId=t}getDescription(){let t=this.params.description||v(this.params.command).spawnCommand;return`Monitor: ${gt(t)}`}async getDefaultPermission(){if(D().shell!=="bash")return"ask";let t=v(this.params.command).spawnCommand;return await P(t,{cwd:this.params.directory||this.config.getTargetDir(),workspace:this.config.getWorkspaceContext()})?"allow":"ask"}async getConfirmationDetails(t){let n=D();if(n.shell!=="bash")return{type:"exec",title:"Monitor",command:v(this.params.command).spawnCommand,rootCommand:n.executable,permissionRules:[],hideAlwaysAllow:!0,onConfirm:async()=>{}};let r=v(this.params.command),h=nt(r.safetyCommand),C=[];for(let l of h){let a=!1;try{a=await P(l,{cwd:this.params.directory||this.config.getTargetDir(),workspace:this.config.getWorkspaceContext()})}catch(m){p.warn("AST read-only check failed for monitor sub-command, falling back to ask:",m)}a||C.push(l)}let T=C.length>0?C:h,w=[...new Set(T.map(l=>L(l)).filter(l=>!!l))],i=[];try{let l=[];for(let a of T){let m=await st(a);l.push(...m)}i=[...new Set(l)].map(a=>`Monitor(${a})`)}catch(l){p.warn("Failed to extract monitor command rules:",l),i=[`Monitor(${r.safetyCommand})`]}let d=rt(r.safetyCommand,this.params.command),M={type:"exec",title:"Monitor",command:r.spawnCommand,rootCommand:w.join(", ")||(L(r.safetyCommand)??r.spawnCommand),permissionRules:i,onConfirm:async(l,a)=>{}};return d&&(M.warnings=d),M}async execute(t){if(t.aborted)return{llmContent:"Monitor was cancelled before it could start.",returnDisplay:"Monitor cancelled."};let n=v(this.params.command),r=n.spawnCommand;n.strippedTrailingAmp&&p.warn("Stripped trailing & from monitor command \u2014 monitor lifecycle handles backgrounding");let h=ht(this.params.description||r),C=gt(h),T=Math.min(this.params.max_events??St,N),w=Math.min(this.params.idle_timeout_ms??kt,U),i=`mon_${Et().replace(/-/g,"").slice(0,16)}`,d=this.config.getMonitorRegistry(),M=et()??void 0;if(d.getRunning().length>=O)return{llmContent:`Cannot start monitor: maximum concurrent monitors (${O}) reached. Stop an existing monitor first.`,returnDisplay:"Monitor rejected: too many concurrent monitors."};let a=new AbortController,m={monitorId:i,command:r,description:h,status:"running",startTime:Date.now(),abortController:a,toolUseId:this.callId,eventCount:0,lastEventTime:0,maxEvents:T,idleTimeoutMs:w,droppedLines:0,outputFile:mt(this.config.storage.getProjectDir(),this.config.getSessionId(),i),...M?{ownerAgentId:M}:{}},{executable:vt,argsPrefix:Tt}=D(),e;try{e=ct(vt,[...Tt,r],{cwd:this.params.directory||this.config.getTargetDir(),stdio:["ignore","pipe","pipe"],detached:!0,env:{...ot(),MATILDA_CODE:"1",TERM:"dumb",PAGER:"cat",...lt()}})}catch(o){return{llmContent:`Monitor failed to start: ${u(o)}`,returnDisplay:`Monitor failed: ${u(o)}`}}m.pid=e.pid;let b=!1,E,I=o=>{E??=o};e.on("error",I);let G={value:""},W={value:""},k=ft,$=Date.now(),A=o=>{let s=ht(o);if(s.length===0||s.trim().length===0)return;let y=Date.now(),_=y-$;if(_<0)p.warn(`Monitor ${i}: clock moved backwards by ${-_}ms, resetting refill timestamp`),$=y;else{let f=Math.floor(_/pt);f>0&&(k=Math.min(ft,k+f),$+=f*pt)}k>0?(k--,d.emitEvent(i,s)):m.droppedLines++},j=()=>{for(let o of[G,W]){let s=o.value.trim();s.length>0&&A(s),o.value=""}},_t=()=>{if(!(b||!e.pid))if(process.platform==="win32")ct("taskkill",["/pid",e.pid.toString(),"/f","/t"],{stdio:"ignore"}).on("error",s=>p.warn(`Monitor taskkill failed for pid ${e.pid}: ${u(s)}`));else{try{process.kill(-e.pid,"SIGTERM")}catch(o){p.warn(`Monitor ${i} SIGTERM failed (pid=${e.pid}): ${u(o)}`)}setTimeout(()=>{if(!b&&e.pid)try{process.kill(-e.pid,"SIGKILL")}catch(o){p.warn(`Monitor ${i} SIGKILL escalation failed (pid=${e.pid}): ${u(o)}`)}},200).unref?.()}},S=()=>{j(),_t()};a.signal.addEventListener("abort",S,{once:!0}),a.signal.aborted&&S();try{d.register(m)}catch(o){return S(),a.signal.removeEventListener("abort",S),e.stdout?.destroy?.(),e.stderr?.destroy?.(),e.removeListener("error",I),e.on("error",()=>{}),{llmContent:`Monitor failed to start: ${u(o)}`,returnDisplay:`Monitor failed: ${u(o)}`}}let z=(o,s)=>{if(m.status!=="running")return;let y=at(s.toString("utf-8"));if(o.value+=y,!o.value.includes(`
|
|
4
|
-
`)&&o.value.length>R){let f=o.value.trim();f.length>0&&A(f.slice(0,R)+"..."),o.value="";return}let _=o.value.split(`
|
|
5
|
-
`);o.value=_.pop()??"";for(let f of _){let x=f.trim();if(x.length===0)continue;let bt=x.length>R?x.slice(0,R)+"...":x;A(bt)}};e.stdout?.on("data",o=>z(G,o)),e.stderr?.on("data",o=>z(W,o));let F=!1,X=()=>{F||(F=!0,j(),a.signal.removeEventListener("abort",S),m.droppedLines>0&&p.info(`Monitor ${i} dropped ${m.droppedLines} lines due to throttling`))},V=null,Ct=(o,s)=>{m.status==="running"&&(a.signal.aborted?d.cancel(i):o!==null&&o!==0?d.fail(i,`Exit code ${o}`):s?d.fail(i,`Killed by signal ${s}`):d.complete(i,o))},wt=(o,s)=>{b=!0,V={code:o,sig:s}},Mt=(o,s)=>{b=!0,X();let y=V??{code:o,sig:s};Ct(y.code,y.sig)},H=o=>{b=!0,X(),m.status==="running"&&d.fail(i,u(o))};return e.on("exit",wt),e.on("close",Mt),e.on("error",H),e.removeListener("error",I),E?(H(E),{llmContent:`Monitor failed to start: ${u(E)}`,returnDisplay:`Monitor failed: ${u(E)}`}):{llmContent:`Monitor started.
|
|
6
|
-
id: ${i}
|
|
7
|
-
command: ${r}
|
|
8
|
-
description: ${h}
|
|
9
|
-
max_events: ${T}
|
|
10
|
-
idle_timeout: ${w}ms
|
|
11
|
-
Events will be delivered as notifications. The monitor auto-stops after ${T} events or ${w}ms of silence.
|
|
12
|
-
To inspect: /tasks (text) or the interactive Background tasks dialog (focus the footer Background tasks pill, then Enter \u2014 detail view + live updates).`,returnDisplay:`Monitor started: ${C} (${i})`}}},yt=class c extends Y{constructor(t){super(c.Name,tt.MONITOR,`Starts a long-running shell command and streams its stdout/stderr as event notifications back to you.
|
|
13
|
-
|
|
14
|
-
Use this tool for:
|
|
15
|
-
- Watching log files: \`tail -f /var/log/app.log\`
|
|
16
|
-
- Monitoring build output: \`npm run build --watch\`
|
|
17
|
-
- Polling for state changes: \`while true; do curl -s http://localhost:8080/health; sleep 1; done\`
|
|
18
|
-
- Watching file changes: \`fswatch -r ./src\`
|
|
19
|
-
|
|
20
|
-
Each output line from the command becomes a notification event delivered to you. The monitor runs in the background \u2014 you can continue working while it streams events.
|
|
21
|
-
|
|
22
|
-
**Auto-stop:** The monitor automatically stops after max_events (default 1000) events or after idle_timeout_ms (default 5 minutes) of silence. The process is killed when the monitor stops.
|
|
23
|
-
|
|
24
|
-
**Do NOT use this tool for:**
|
|
25
|
-
- One-shot commands (use run_shell_command instead)
|
|
26
|
-
- Commands you need the full output from (use run_shell_command instead)
|
|
27
|
-
- Commands with no output (use run_shell_command with is_background: true instead)`,"execute",{type:"object",properties:{command:{type:"string",description:"Shell command to run and monitor. Each output line (stdout and stderr) becomes an event notification."},description:{type:"string",description:'Brief description of what this monitor watches (e.g., "webpack build output"). Truncated to 80 characters in display.'},max_events:{type:"number",description:"Stop the monitor after this many events. Default 1000. Max 10000."},idle_timeout_ms:{type:"number",description:"Stop the monitor if no output for this many milliseconds. Default 300000 (5 min). Max 600000."},directory:{type:"string",description:"(OPTIONAL) The absolute path of the directory to run the command in. If not provided, the project root directory is used. Must be within the workspace."}},required:["command"],additionalProperties:!1},!0,!1,!0,!1,"monitor watch tail log stream background");this.config=t}static Name=Q.MONITOR;validateToolParamValues(t){if(typeof t.command!="string"||!v(t.command).analysisCommand)return"Command cannot be empty.";if(it(t.command))return'Monitor commands must not contain non-final top-level background operators. Remove "&" and let the monitor manage process lifetime.';if(t.max_events!==void 0){if(typeof t.max_events!="number"||!Number.isInteger(t.max_events)||t.max_events<=0)return"max_events must be a positive integer.";if(t.max_events>N)return`max_events cannot exceed ${N}.`}if(t.idle_timeout_ms!==void 0){if(typeof t.idle_timeout_ms!="number"||!Number.isInteger(t.idle_timeout_ms)||t.idle_timeout_ms<=0)return"idle_timeout_ms must be a positive integer.";if(t.idle_timeout_ms>U)return`idle_timeout_ms cannot exceed ${U}ms (10 minutes).`}if(t.directory){if(!dt.isAbsolute(t.directory))return"Directory must be an absolute path.";let n=dt.resolve(t.directory),r=this.config.storage.getUserSkillsDirs();if(K(r,n))return"Explicitly running monitor commands from within the user skills directory is not allowed. Please use absolute paths for command parameter instead.";if(!this.config.getWorkspaceContext().isPathWithinWorkspace(t.directory))return`Directory '${t.directory}' is not within any of the registered workspace directories.`}return null}createInvocation(t){return new B(this.config,t)}toAutoClassifierInput(t){let n={command:t.command};return t.directory&&(n.directory=t.directory),n}};export{yt as MonitorTool,ht as sanitizeMonitorLine};
|
|
28
|
-
/**
|
|
29
|
-
* @license
|
|
30
|
-
* Copyright 2025 Matilda
|
|
31
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
32
|
-
*/
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{Ef as y,Nf as X,Qf as Z,Ua as R,if as D,jf as Y,od as Q}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import{J as B,K as k,L as U,M as K,Mb as z,N as q,O as b,P as W,Q as j,R as C,S as J,T as V,U as w,V as M,ca as G,cd as H}from"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import{g as $,i as L,p as c,q as x}from"./chunk-6E766NPX.js";import{D as _,E as N,G as T,ba as F}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as v}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";v();import*as E from"node:fs";import*as m from"node:path";var ee=F("NOTEBOOK_EDIT");function g(d,r,t){return ee.debug("prior-read-rejected",{path:d,reason:r,type:t.type,displayMessage:t.displayMessage}),t}var u=class extends Error{constructor(t,e){super(t);this.type=e;this.name="NotebookEditError"}};function te(d,r){if(r==="delete")return"";if(typeof d!="string")throw new u(`new_source is required when edit_mode is "${r}".`,"invalid_tool_params");return d}function I(d,r){return d?q(d,r):`cell-${r}`}function oe(d,r,t){if(!r){if(t==="insert")return-1;throw new u("cell_id is required for replace and delete operations.","invalid_tool_params")}if(W(d,r))throw new u(`Cell ID "${r}" is ambiguous in the rendered notebook. Re-read the notebook and target a stable real cell ID before editing.`,"invalid_tool_params");let e=j(d,r);if(e===-1)throw new u(`Cell with ID "${r}" not found in notebook.`,"notebook_cell_not_found");return e}function ie(d,r,t,e){let o={cell_type:r,metadata:{},source:w(t,e)},i=J(d);return i&&(o.id=i),M(o,r),o}function O(d,r){let t;try{t=k(d)}catch(a){throw new u(a instanceof Error?a.message:String(a),"notebook_invalid_json")}let e=r.edit_mode??"replace",o=te(r.new_source,e),i=b(t),n=oe(t,r.cell_id,e),l=C(t),p=U(d),s=(a,f)=>{let h=e==="insert"||e==="delete";return{...f,updatedContent:K(a,p),requiresReadAfterWrite:h&&!(i&&b(a))}};switch(e){case"insert":{let a=r.cell_type??"code",f=n===-1?0:n+1,h=ie(t,a,o,V(t,f));return t.cells.splice(f,0,h),s(t,{editedCellId:I(h,f),editedCellType:a,language:l,mode:e})}case"delete":{let[a]=t.cells.splice(n,1);return s(t,{editedCellId:I(a,n),editedCellType:a?.cell_type,language:l,mode:e})}case"replace":{let a=t.cells[n];if(!a)throw new u(`Cell index ${n} is out of range.`,"notebook_cell_not_found");let f=r.cell_type??a.cell_type;return a.source=w(o,Array.isArray(a.source)),M(a,f),s(t,{editedCellId:I(a,n),editedCellType:f,language:l,mode:e})}default:throw new u(`Unsupported notebook edit mode: ${e}`,"invalid_tool_params")}}function re(d,r,t){let e,o;try{e=k(r),o=k(d)}catch(i){throw new u(i instanceof Error?i.message:String(i),"notebook_invalid_json")}return{updatedContent:r,editedCellId:t.cell_id??"user-modified-notebook",editedCellType:void 0,language:C(e),mode:t.edit_mode??"replace",requiresReadAfterWrite:!b(o)||!b(e)}}async function A(d,r,t={}){if(d.getFileReadCacheDisabled())return{ok:!0};let e;try{e=await E.promises.stat(r)}catch(i){let n=i?.code;return n==="ENOENT"?t.expectExisting?g(r,"missing-after-read",{ok:!1,type:"file_changed_since_read",rawMessage:`Notebook ${r} disappeared after it was read. Re-read it with the ${c.READ_FILE} tool before editing it.`,displayMessage:`notebook disappeared after last read; re-run ${c.READ_FILE} first.`}):{ok:!0}:g(r,"stat-failed",{ok:!1,type:"prior_read_verification_failed",rawMessage:`Could not stat ${r} to verify prior notebook read (${n??"unknown error"}). Re-read it with the ${c.READ_FILE} tool before editing it.`,displayMessage:`cannot verify prior read of ${r}; re-run ${c.READ_FILE} before editing this notebook.`})}if(e.isDirectory())return g(r,"target-is-directory",{ok:!1,type:"target_is_directory",rawMessage:`${r} is a directory. The NotebookEdit tool only operates on .ipynb files.`,displayMessage:"path is a directory; cannot edit as a notebook."});if(!e.isFile())return g(r,"target-not-regular-file",{ok:!1,type:"target_not_regular_file",rawMessage:`${r} is not a regular file. The NotebookEdit tool only operates on .ipynb files.`,displayMessage:"special file; cannot edit as a notebook."});let o=d.getFileReadCache().check(e);return o.state==="fresh"&&o.entry.lastReadAt!==void 0&&o.entry.lastReadWasFull?{ok:!0}:o.state==="fresh"&&o.entry.lastReadAt!==void 0&&!o.entry.lastReadWasFull?g(r,"truncated-cache-entry",{ok:!1,type:"edit_requires_prior_read",rawMessage:`Notebook ${r} is too large for cell-level editing because its rendered output was truncated when read. Reduce the notebook output size or split the notebook before editing cells.`,displayMessage:"notebook too large for cell-level editing."}):o.state==="stale"?g(r,"stale-cache-entry",{ok:!1,type:"file_changed_since_read",rawMessage:`Notebook ${r} has been modified since you last read it. Re-read it with the ${c.READ_FILE} tool before editing it.`,displayMessage:`notebook changed since last read; re-run ${c.READ_FILE} first.`}):g(r,`cache-${o.state}`,{ok:!1,type:"edit_requires_prior_read",rawMessage:`Notebook ${r} has not been fully read in this session. Use the ${c.READ_FILE} tool first, without offset or limit, before editing cells.`,displayMessage:`${c.READ_FILE} required before editing this notebook.`})}var P=class extends ${constructor(t,e,o){super(e);this.config=t;this.modifyMetadata=o}toolLocations(){return[{path:this.params.notebook_path}]}getDescription(){let t=N(this.params.notebook_path,this.config.getTargetDir()),e=this.params.edit_mode??"replace",o=this.params.cell_id??"beginning";return`${e} notebook cell ${o} in ${_(t)}`}async getDefaultPermission(){return"ask"}async getConfirmationDetails(t){let e=await this.prepareEdit(t),o=m.basename(this.params.notebook_path),i=R(o,e.originalContent,e.updatedContent,"Current","Proposed",D);return{type:"edit",title:`Confirm Notebook Edit: ${_(N(this.params.notebook_path,this.config.getTargetDir()))}`,fileName:o,filePath:this.params.notebook_path,fileDiff:i,originalContent:e.originalContent,newContent:e.updatedContent,onConfirm:async l=>{l==="proceed_always"&&this.config.setApprovalMode("auto-edit")}}}async prepareEdit(t){let e=await A(this.config,this.params.notebook_path);if(!e.ok)throw new y(e.rawMessage,e.type);let o,i=!1,n,l="lf";try{let s=await this.config.getFileSystemService().readTextFile({path:this.params.notebook_path});o=s.content,i=s._meta?.bom??!1,n=s._meta?.encoding,l=s._meta?.lineEnding??X(s.content)}catch(s){throw t.aborted?s:s?.code==="ENOENT"?new y(`Notebook file not found: ${this.params.notebook_path}`,"file_not_found"):new y(`Error reading notebook: ${s instanceof Error?s.message:String(s)}`,"read_content_failure")}let p=await A(this.config,this.params.notebook_path,{expectExisting:!0});if(!p.ok)throw new y(p.rawMessage,p.type);try{return this.modifyMetadata?.modifiedNotebookContent!==void 0?{...re(o,this.modifyMetadata.modifiedNotebookContent,this.params),originalContent:o,bom:i,encoding:n,lineEnding:l}:{...O(o,this.params),originalContent:o,bom:i,encoding:n,lineEnding:l}}catch(s){throw s instanceof u?new y(s.message,s.type):s}}async execute(t){let e;try{e=await this.prepareEdit(t)}catch(o){if(t.aborted)throw o;let i=o instanceof y?o.errorType:"notebook_edit_failure",n=o instanceof Error?o.message:String(o);return{llmContent:n,returnDisplay:`Error: ${n}`,error:{message:n,type:i}}}try{try{await this.config.getFileHistoryService().trackEdit(this.params.notebook_path)}catch{}let o=await A(this.config,this.params.notebook_path,{expectExisting:!0});if(!o.ok)return{llmContent:o.rawMessage,returnDisplay:`Error: ${o.displayMessage}`,error:{message:o.rawMessage,type:o.type}};await this.config.getFileSystemService().writeTextFile({path:this.params.notebook_path,content:e.updatedContent,_meta:{bom:e.bom,encoding:e.encoding,lineEnding:e.lineEnding}}),this.modifyMetadata?.modifiedByUser||Q.getInstance().recordEdit(this.params.notebook_path,e.originalContent,e.updatedContent);try{let a=E.statSync(this.params.notebook_path),f=this.config.getFileReadCache();e.requiresReadAfterWrite?f.invalidate(a):f.recordWrite(this.params.notebook_path,a,{cacheable:!1})}catch(a){ee.warn(`[NotebookEdit] post-write cache update failed for ${this.params.notebook_path}: ${a instanceof Error?a.message:String(a)}`)}let i=m.basename(this.params.notebook_path),n=R(i,e.originalContent,e.updatedContent,"Current","Proposed",D),l=Y(i,e.originalContent,this.modifyMetadata?.aiProposedContent??e.updatedContent,e.updatedContent);z(this.config,new H(S.Name,"update",e.updatedContent.split(`
|
|
4
|
-
`).length,G(this.params.notebook_path),".ipynb",e.language));let p={fileDiff:n,fileName:i,originalContent:e.originalContent,newContent:e.updatedContent,diffStat:l},s=this.modifyMetadata?.modifiedNotebookContent!==void 0?`Notebook ${this.params.notebook_path} has been updated. Notebook content was modified by the user before approval; the final saved notebook may differ from the original ${e.mode} cell ${e.editedCellId} proposal.`:`Notebook ${this.params.notebook_path} has been updated. ${e.mode} cell ${e.editedCellId}.${e.mode==="delete"?"":`
|
|
5
|
-
|
|
6
|
-
Updated source:
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
${B(this.params.new_source??"")}`}`;try{let a=await Z(this.config,this.params.notebook_path);a&&(s+=`
|
|
11
|
-
|
|
12
|
-
${a}`)}catch{}return{llmContent:s,returnDisplay:p,resultFilePaths:[this.params.notebook_path]}}catch(o){let i=o instanceof Error?o.message:String(o);return{llmContent:`Error writing notebook: ${i}`,returnDisplay:`Error writing notebook: ${i}`,error:{message:i,type:"file_write_failure"}}}}},S=class d extends L{constructor(t){super(d.Name,x.NOTEBOOK_EDIT,`Edits a Jupyter notebook (.ipynb) safely at the cell level. Use this instead of ${c.EDIT} or ${c.WRITE_FILE} for notebook cells. Supports replacing, inserting, and deleting cells. Always read the notebook first with ${c.READ_FILE}; then use the cell IDs shown in that output.`,"edit",{properties:{notebook_path:{description:"Absolute path to the Jupyter notebook file to edit. Must end with .ipynb.",type:"string"},cell_id:{description:"Target cell ID from read_file output, or cell-N 0-based fallback. Required for replace and delete. For insert, the new cell is inserted after this cell; if omitted, inserted at the beginning.",type:"string"},new_source:{description:"New source content for replace and insert operations. Not required for delete.",type:"string"},cell_type:{description:"Cell type for inserted cells or type conversion on replace.",type:"string",enum:["code","markdown"]},edit_mode:{description:"Notebook edit operation. Defaults to replace.",type:"string",enum:["replace","insert","delete"]}},required:["notebook_path"],additionalProperties:!1,type:"object"});this.config=t}static Name=c.NOTEBOOK_EDIT;modifyMetadataByParams=new WeakMap;modifyMetadataByKey=new Map;validateToolParamValues(t){if(t.notebook_path=T(t.notebook_path.trim()),!t.notebook_path)return"The 'notebook_path' parameter must be non-empty.";if(!m.isAbsolute(t.notebook_path))return`Notebook path must be absolute: ${t.notebook_path}`;if(m.extname(t.notebook_path).toLowerCase()!==".ipynb")return"File must be a Jupyter notebook (.ipynb). Use the edit tool for other file types.";let e=t.edit_mode??"replace";return["replace","insert","delete"].includes(e)?t.cell_type&&!["code","markdown"].includes(t.cell_type)?"cell_type must be 'code' or 'markdown'.":e!=="insert"&&!t.cell_id?"cell_id is required for replace and delete operations.":e!=="delete"&&typeof t.new_source!="string"?`new_source is required when edit_mode is "${e}".`:this.config.getFileService().shouldMatildaIgnoreFile(t.notebook_path)?`File path '${t.notebook_path}' is ignored by .matildaignore pattern(s).`:null:"edit_mode must be 'replace', 'insert', or 'delete'."}createInvocation(t){return new P(this.config,t,this.consumeModifyMetadata(t))}getModifyMetadataKey(t){return JSON.stringify({notebook_path:T(t.notebook_path.trim()),cell_id:t.cell_id,new_source:t.new_source,cell_type:t.cell_type,edit_mode:t.edit_mode})}rememberModifyMetadata(t,e){this.modifyMetadataByParams.set(t,e);let o=this.getModifyMetadataKey(t),i=this.modifyMetadataByKey.get(o)??[];i.push(e),this.modifyMetadataByKey.set(o,i)}consumeModifyMetadata(t){let e=this.modifyMetadataByParams.get(t);if(e)return this.modifyMetadataByParams.delete(t),this.removeQueuedModifyMetadata(t,e),e;let o=this.getModifyMetadataKey(t),i=this.modifyMetadataByKey.get(o),n=i?.shift();return i&&i.length===0&&this.modifyMetadataByKey.delete(o),n}removeQueuedModifyMetadata(t,e){let o=this.getModifyMetadataKey(t),i=this.modifyMetadataByKey.get(o);if(!i)return;let n=i.indexOf(e);n!==-1&&i.splice(n,1),i.length===0&&this.modifyMetadataByKey.delete(o)}getModifyContext(t){let e=new Map,o=async i=>{let n=e.get(i.notebook_path);if(n!==void 0)return n;let{content:l}=await this.config.getFileSystemService().readTextFile({path:i.notebook_path});return e.set(i.notebook_path,l),l};return{getFilePath:i=>i.notebook_path,getCurrentContent:async i=>o(i),getProposedContent:async i=>{let n=await o(i);return O(n,i).updatedContent},createUpdatedParams:(i,n,l)=>{let p=this.modifyMetadataByParams.get(l)?.aiProposedContent;if(p===void 0)try{p=O(i,l).updatedContent}catch{p=n}let s={...l};return this.rememberModifyMetadata(s,{aiProposedContent:p,modifiedByUser:!0,modifiedNotebookContent:n}),s}}}};export{S as NotebookEditTool,O as applyNotebookEdit};
|
|
13
|
-
/**
|
|
14
|
-
* @license
|
|
15
|
-
* Copyright 2026 Matilda Team
|
|
16
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
17
|
-
*/
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{wc as a}from"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{a as ReadFileTool};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{$j as a,ak as b}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{b as RipGrepTool,a as _resetRipGrepCachesForTest};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{b as E}from"./chunk-7ZATDBWL.js";import{fb as P}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import{Q as l,ba as c}from"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as s}from"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";s();import{stat as V}from"node:fs/promises";import{join as p}from"node:path";s();import{readdir as N,stat as H,rm as F,rmdir as A}from"node:fs/promises";import{join as y}from"node:path";var k=c("HOUSEKEEPING"),U=24*60*60*1e3,$=60*60*1e3,_=20;function T(e){let t=e>0?e*U:$;return new Date(Date.now()-t)}async function b(e){let t={removed:0,errors:0},r=y(l.getGlobalMatildaDir(),P),i=e.excludeSessionIds??new Set,o;try{o=await N(r,{withFileTypes:!0})}catch(n){return G(n)||k.error("readdir failed",n),t}let a=o.filter(n=>n.isDirectory()&&!i.has(n.name)).map(n=>y(r,n.name));for(let n=0;n<a.length;n+=_){let v=a.slice(n,n+_);await Promise.all(v.map(async g=>{try{(await H(g)).mtime<e.cutoffDate&&(await F(g,{recursive:!0,force:!0}),t.removed++)}catch(w){t.errors++,k.error(`failed to sweep ${g}`,w)}}))}return await A(r).catch(()=>{}),t}function G(e){return e?.code==="ENOENT"}s();import{mkdir as Y,open as K,stat as I,unlink as D,writeFile as j}from"node:fs/promises";import{dirname as B}from"node:path";var m=c("HOUSEKEEPING"),q=24*60*60*1e3,J=60*60*1e3;async function R(e,t){let r=e.minIntervalMs??q,i=e.staleLockMs??J;if(await Y(B(e.lockPath),{recursive:!0,mode:448}).catch(()=>{}),await C(e.markerPath,r,e.name))return!1;let o=await h(e.lockPath);if(!o){try{let a=await I(e.lockPath);Date.now()-a.mtimeMs>i&&(await D(e.lockPath).catch(()=>{}),o=await h(e.lockPath))}catch{o=await h(e.lockPath)}if(!o)return m.debug(`${e.name}: skipping, lock held`),!1}try{if(await C(e.markerPath,r,e.name))return!1;let a=!1;try{await t(),a=!0}finally{if(a)try{await j(e.markerPath,new Date().toISOString())}catch(n){m.debug(`${e.name}: marker write failed (cleanup succeeded)`,n)}}return a}finally{await D(e.lockPath).catch(()=>{m.debug(`${e.name}: lock unlink failed (harmless)`)})}}async function C(e,t,r){try{let i=await I(e),o=Date.now()-i.mtimeMs;if(o<t)return m.debug(`${r}: skipping, ran ${o}ms ago`),!0}catch{}return!1}async function h(e){try{return await(await K(e,"wx")).close(),!0}catch(t){if(t?.code==="EEXIST")return!1;throw t}}var u=c("HOUSEKEEPING"),O=10*60*1e3,W=24*60*60*1e3,X=60*1e3,z=7*24*60*60*1e3,Q=60*1e3,f=".file-history-cleanup",d=!1;function pe(e,t){d||(d=!0,Z(e,t).catch(r=>{d=!1,u.error("scheduleFirstPass failed; chain will retry on next start",r)}))}async function Z(e,t){let r=p(l.getGlobalMatildaDir(),f),i=await L(r)?Q:O;u.debug(`first pass in ${i/1e3}s`),setTimeout(()=>S(e,t),i).unref()}async function L(e){try{let t=await V(e);return Date.now()-t.mtimeMs>z}catch{return!0}}async function M(e,t){if(E()<X){u.debug("user active, deferring 10 min"),setTimeout(()=>S(e,t),O).unref();return}try{await x(e,t)}catch(r){u.error("housekeeping pass failed; will retry next cycle",r)}setTimeout(()=>S(e,t),W).unref()}function S(e,t){M(e,t).catch(r=>{u.error("runPass rejected unexpectedly",r)})}async function x(e,t){let r=t.merged.general?.cleanupPeriodDays??30,i=T(r),o=e.getSessionId(),a=l.getGlobalMatildaDir();await R({name:"file-history-cleanup",markerPath:p(a,f),lockPath:p(a,f+".lock")},async()=>{let n=await b({cutoffDate:i,excludeSessionIds:new Set([o])});u.debug(`file-history: removed=${n.removed} errors=${n.errors}`)})}function Se(){d=!1}var we=L,Pe=x,Ee=M,ye=f;export{ye as _FILE_HISTORY_MARKER_FOR_TESTING,we as _needsCatchUpForTesting,Se as _resetForTesting,Pe as _runHousekeepingForTesting,Ee as _runPassForTesting,pe as startBackgroundHousekeeping};
|
|
4
|
-
/**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2025 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
-
*/
|
package/chunks/shell-PXR2AXDD.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Force strict mode and setup for ESM
|
|
2
|
-
"use strict";
|
|
3
|
-
import{Rf as a,Sf as b,Tf as c,Uf as d,Vf as e,Wf as f,Xf as g}from"./chunk-JRECUFB3.js";import"./chunk-M53RP3YP.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-2HTPVSGT.js";import"./chunk-MO2HXJG5.js";import"./chunk-2MOGYHWM.js";import"./chunk-S3CWEVTS.js";import"./chunk-TISQNFB5.js";import"./chunk-47XR7IMP.js";import"./chunk-MTMU7JYZ.js";import"./chunk-QKYGQLWC.js";import"./chunk-WV3IUPZS.js";import"./chunk-RNKDFE2S.js";import"./chunk-BVOCFLC4.js";import"./chunk-MCQUPLRE.js";import"./chunk-CZGZ3KK7.js";import"./chunk-HYVP4472.js";import"./chunk-WC2VTVCE.js";import"./chunk-KHHJYBR5.js";import"./chunk-6EQMZNIY.js";import"./chunk-DOOFGSRV.js";import"./chunk-DE3HKC2W.js";import"./chunk-GTVCJCHR.js";import"./chunk-QVCGLQCI.js";import"./chunk-VI74YQQO.js";import"./chunk-YV3PUOBU.js";import"./chunk-3IRGBRSP.js";import"./chunk-DC7LAFZZ.js";import"./chunk-4F4DA5UI.js";import"./chunk-3YLXGE6T.js";import"./chunk-JCE3JAVC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-SDTWBD62.js";import"./chunk-6Z2MV7ZY.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-PGXQZVLX.js";import"./chunk-LUNDTQ3G.js";import"./chunk-YRQP3SLC.js";import"./chunk-6E766NPX.js";import"./chunk-27Q5KW3A.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{b as OUTPUT_UPDATE_INTERVAL_MS,g as ShellTool,f as ShellToolInvocation,c as buildLongRunningForegroundHint,d as detectBlockedSleepPattern,a as parseNumstat,e as repairLeakedShellToolArgMarkup};
|