UNPKG

@cloudbase/cloudbase-mcp

Version:

腾讯云开发 MCP Server,通过AI提示词和MCP协议+云开发,让开发更智能、更高效,当你在Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。

2 lines 4.08 MB
/*! For license information please see index.cjs.LICENSE.txt */ (()=>{var e,t,n={71:(e,t,n)=>{"use strict";e.exports={CRC32Stream:n(35485),DeflateCRC32Stream:n(63332)}},85:(e,t,n)=>{var a=n(28354),r=n(28768);function i(e,t,n){e[t]=function(){return delete e[t],n.apply(this,arguments),this[t].apply(this,arguments)}}function o(e,t){if(!(this instanceof o))return new o(e,t);r.call(this,t),i(this,"_read",function(){var n=e.call(this,t),a=this.emit.bind(this,"error");n.on("error",a),n.pipe(this)}),this.emit("readable")}function s(e,t){if(!(this instanceof s))return new s(e,t);r.call(this,t),i(this,"_write",function(){var n=e.call(this,t),a=this.emit.bind(this,"error");n.on("error",a),this.pipe(n)}),this.emit("writable")}e.exports={Readable:o,Writable:s},a.inherits(o,r),a.inherits(s,r)},95:function(e,t,n){"use strict";var a=this&&this.__decorate||function(e,t,n,a){var r,i=arguments.length,o=i<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(i<3?r(o):i>3?r(t,n,o):r(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudRunService=void 0,t.codeToZip=l;const i=r(n(99133)),o=n(21605),s=r(n(39902)),c=n(62358);class p{constructor(e){this.environment=e,this.tcbrService=new c.CloudService(e.cloudBaseContext,"tcbr","2022-02-17"),this.tcbService=new c.CloudService(e.cloudBaseContext,"tcb","2018-06-08")}async init(e){const{serverName:t,template:n="helloworld",targetPath:a="."}=e||{},r=(await this.getTemplates()).find(e=>e.identifier===n);if(!r||!r.zipFileStore)throw new Error(`未找到匹配的模板: ${n}`);const i=r.zipFileStore,o=s.default.resolve(a,t);return await(0,c.downloadAndExtractRemoteZip)(i,o),{projectDir:o}}async download(e){var t,n;const a=this.environment.lazyEnvironmentConfig,{serverName:r,targetPath:i}=e,o=null===(n=null===(t=(await this.detail({serverName:r})).OnlineVersionInfos)||void 0===t?void 0:t[0])||void 0===n?void 0:n.VersionName;if(!o)throw new Error("未找到云托管服务版本");const p=await this.tcbService.request("DescribeCloudBaseBuildService",{EnvId:a.EnvId,ServiceName:r,ServiceVersion:o});if(!(null==p?void 0:p.DownloadUrl))throw new Error(`云托管代码下载地址为空(请求ID: ${p.RequestId})`);await(0,c.downloadAndExtractRemoteZip)(null==p?void 0:p.DownloadUrl,s.default.resolve(i))}async list(e){const t=this.environment.lazyEnvironmentConfig;return this.tcbrService.request("DescribeCloudRunServers",Object.assign({EnvId:t.EnvId},{PageSize:(null==e?void 0:e.pageSize)||10,PageNum:(null==e?void 0:e.pageNum)||1,ServerName:null==e?void 0:e.serverName,ServerType:null==e?void 0:e.serverType}))}async detail(e){const t=this.environment.lazyEnvironmentConfig;return this.tcbrService.request("DescribeCloudRunServerDetail",{EnvId:t.EnvId,ServerName:e.serverName})}async delete(e){const t=this.environment.lazyEnvironmentConfig;return this.tcbrService.request("DeleteCloudRunServer",{EnvId:t.EnvId,ServerName:e.serverName})}async deploy(e){const{serverName:t,targetPath:n=process.cwd(),serverConfig:a}=e;if(!t)throw new Error("Missing required parameters: serviceName");const r=this.environment.lazyEnvironmentConfig,{UploadUrl:i,UploadHeaders:p,PackageName:u,PackageVersion:d}=await this.tcbService.request("DescribeCloudBaseBuildService",{EnvId:r.EnvId,ServiceName:t}),m={DeployType:"package",PackageName:u,PackageVersion:d},f=await l(n,{installDependency:!0});if(await(0,c.upload)({url:i,file:f,headers:(p||[]).reduce((e,t)=>(e[t.Key]=t.Value,e),{})||{},method:"PUT"}),await this._checkFunctionExist(t)){const e=await this.detail({serverName:t}),n=Object.assign(Object.assign(Object.assign({},(null==e?void 0:e.ServerConfig)||{}),a),"function:"===(null==e?void 0:e.ServerConfig.Tag)?{Port:3e3}:{});return m.ReleaseType="FULL",this._upsertFunction(!1,{name:t,deployInfo:m,serverConfig:n})}{let e="function";((null==a?void 0:a.Dockerfile)||await(0,o.pathExists)(s.default.join(n,"Dockerfile")))&&(e="container"),"function"===e&&(m.BuildPacks={LanguageVersion:"20.18",RepoLanguage:"Node.js"});const i=Object.assign(Object.assign(Object.assign({OpenAccessTypes:["OA","PUBLIC"],Cpu:0,Mem:0,MinNum:0,MaxNum:0,PolicyDetails:[],EnvParams:JSON.stringify({}),InitialDelaySeconds:0,CustomLogs:"",HasDockerfile:!0,CreateTime:"",EnvId:r.EnvId,ServerName:t,Port:"container"===e?80:3e3,Dockerfile:"Dockerfile",BuildDir:""},a),"function"===e?{Port:3e3}:{}),{Tag:"container"===e?"":"function:"});return this._upsertFunction(!0,{name:t,deployInfo:m,serverConfig:i})}}async getTemplates(){return(0,c.fetchTemplates)(["tcbrFunc","tcbrContainer"])}async _checkFunctionExist(e){try{return await this.detail({serverName:e}),!0}catch(e){if("ResourceNotFound"===e.code||"InvalidParameter"===e.code&&"service data illegal"===e.original.Message)return!1;throw e}}_upsertFunction(e,t){const{name:n,deployInfo:a,serverConfig:r}=t,i=this.environment.lazyEnvironmentConfig;return this.tcbrService.request(e?"CreateCloudRunServer":"UpdateCloudRunServer",{EnvId:i.EnvId,ServerName:n,DeployInfo:a,ServerConfig:r})}}async function l(e,t){const n=(0,i.default)("zip",{zlib:{level:1}}),a=[],r=new Promise((e,t)=>{n.on("data",e=>{a.push(e)}),n.on("end",()=>{e(Buffer.concat(a))}),n.on("error",e=>{t(e)})});return await async function e(a,r=!1,i=""){const c=await(0,o.readdir)(a,{withFileTypes:!0});for(let o of c){const c=s.default.join(a,o.name),p=s.default.join(i,o.name);if(o.isDirectory()){if(["logs",".git"].includes(o.name))continue;if((null==t?void 0:t.installDependency)&&["node_modules"].includes(o.name))continue;await e(c,!1,p)}else{if(r&&[""].includes(o.name))continue;n.file(c,{name:p})}}}(s.default.resolve(e),!0),await n.finalize(),r}t.CloudRunService=p,a([(0,c.preLazy)()],p.prototype,"init",null),a([(0,c.preLazy)()],p.prototype,"download",null),a([(0,c.preLazy)()],p.prototype,"list",null),a([(0,c.preLazy)()],p.prototype,"detail",null),a([(0,c.preLazy)()],p.prototype,"delete",null),a([(0,c.preLazy)()],p.prototype,"deploy",null)},149:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(39902),r=n(98631),i=n(57705);t.default=class{constructor(e){this._settings=e,this._fsStatSettings=new r.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return a.resolve(this._settings.cwd,e)}_makeEntry(e,t){const n={name:t,path:t,dirent:i.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!i.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}}},199:(e,t,n)=>{const a=n(28354),r=n(74075),i=n(27910),o=n(17437),s=n(12994),c=n(51324),p=n(58189),l=n(3214),u=i.pipeline,d=n(8325),m=Buffer.alloc(4);function f(e){if(!(this instanceof f))return new f(e);const t=this;t._opts=e||{verbose:!1},o.call(t,t._opts),t.on("finish",function(){t.emit("end"),t.emit("close")}),t._readRecord().catch(function(e){t.__emittedError&&t.__emittedError===e||t.emit("error",e)})}m.writeUInt32LE(101010256,0),a.inherits(f,o),f.prototype._readRecord=function(){const e=this;return e.pull(4).then(function(t){if(0===t.length)return;const n=t.readUInt32LE(0);if(875721283===n)return e._readCrxHeader();if(67324752===n)return e._readFile();if(33639248===n)return e.reachedCD=!0,e._readCentralDirectoryFileHeader();if(101010256===n)return e._readEndOfCentralDirectoryRecord();if(e.reachedCD){const t=!0;return e.pull(m,t).then(function(){return e._readEndOfCentralDirectoryRecord()})}e.emit("error",new Error("invalid signature: 0x"+n.toString(16)))}).then(function(t){if(t)return e._readRecord()})},f.prototype._readCrxHeader=function(){const e=this;return e.pull(12).then(function(t){return e.crxHeader=d.parse(t,[["version",4],["pubKeyLength",4],["signatureLength",4]]),e.pull(e.crxHeader.pubKeyLength+e.crxHeader.signatureLength)}).then(function(t){return e.crxHeader.publicKey=t.slice(0,e.crxHeader.pubKeyLength),e.crxHeader.signature=t.slice(e.crxHeader.pubKeyLength),e.emit("crx-header",e.crxHeader),!0})},f.prototype._readFile=function(){const e=this;return e.pull(26).then(function(t){const n=d.parse(t,[["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return n.lastModifiedDateTime=l(n.lastModifiedDate,n.lastModifiedTime),e.crxHeader&&(n.crxHeader=e.crxHeader),e.pull(n.fileNameLength).then(function(t){const a=t.toString("utf8"),o=i.PassThrough();let l=!1;return o.autodrain=function(){l=!0;const e=o.pipe(s());return e.promise=function(){return new Promise(function(t,n){e.on("finish",t),e.on("error",n)})},e},o.buffer=function(){return c(o)},o.path=a,o.props={},o.props.path=a,o.props.pathBuffer=t,o.props.flags={isUnicode:!!(2048&n.flags)},o.type=0===n.uncompressedSize&&/[/\\]$/.test(a)?"Directory":"File",e._opts.verbose&&("Directory"===o.type?console.log(" creating:",a):"File"===o.type&&(0===n.compressionMethod?console.log(" extracting:",a):console.log(" inflating:",a))),e.pull(n.extraFieldLength).then(function(t){const s=p(t,n);o.vars=n,o.extra=s,e._opts.forceStream?e.push(o):(e.emit("entry",o),(e._readableState.pipesCount||e._readableState.pipes&&e._readableState.pipes.length)&&e.push(o)),e._opts.verbose&&console.log({filename:a,vars:n,extra:s});const c=!(8&n.flags)||n.compressedSize>0;let d;o.__autodraining=l;const m=n.compressionMethod&&!l?r.createInflateRaw():i.PassThrough();return c?(o.size=n.uncompressedSize,d=n.compressedSize):(d=Buffer.alloc(4),d.writeUInt32LE(134695760,0)),new Promise(function(t,n){u(e.stream(d),m,o,function(a){return a?n(a):c?t(c):e._processDataDescriptor(o).then(t).catch(n)})})})})})},f.prototype._processDataDescriptor=function(e){return this.pull(16).then(function(t){const n=d.parse(t,[["dataDescriptorSignature",4],["crc32",4],["compressedSize",4],["uncompressedSize",4]]);return e.size=n.uncompressedSize,!0})},f.prototype._readCentralDirectoryFileHeader=function(){const e=this;return e.pull(42).then(function(t){const n=d.parse(t,[["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return e.pull(n.fileNameLength).then(function(t){return n.fileName=t.toString("utf8"),e.pull(n.extraFieldLength)}).then(function(){return e.pull(n.fileCommentLength)}).then(function(){return!0})})},f.prototype._readEndOfCentralDirectoryRecord=function(){const e=this;return e.pull(18).then(function(t){const n=d.parse(t,[["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]);return e.pull(n.commentLength).then(function(){e.end(),e.push(null)})})},f.prototype.promise=function(){const e=this;return new Promise(function(t,n){e.on("finish",t),e.on("error",n)})},e.exports=f},247:e=>{"use strict";e.exports=JSON.parse('{"$id":"query.json#","$schema":"http://json-schema.org/draft-06/schema#","type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"},"comment":{"type":"string"}}}')},259:e=>{function t(e){this.name="Bzip2Error",this.message=e,this.stack=(new Error).stack}t.prototype=new Error;var n=function(e){throw new t(e)},a={};a.Bzip2Error=t,a.crcTable=[0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188],a.array=function(e){var t=0,n=0,a=[0,1,3,7,15,31,63,127,255];return function(r){for(var i=0;r>0;){var o=8-t;r>=o?(i<<=o,i|=a[o]&e[n++],t=0,r-=o):(i<<=r,i|=(e[n]&a[r]<<8-r-t)>>8-r-t,t+=r,r=0)}return i}},a.simple=function(e,t){var n=a.array(e),r=!1,i=1e5*a.header(n),o=new Int32Array(i);do{r=a.decompress(n,t,o,i)}while(!r)},a.header=function(e){this.byteCount=new Int32Array(256),this.symToByte=new Uint8Array(256),this.mtfSymbol=new Int32Array(256),this.selectors=new Uint8Array(32768),4348520!=e(24)&&n("No magic number found");var t=e(8)-48;return(t<1||t>9)&&n("Not a BZIP archive"),t},a.decompress=function(e,t,a,r,i){for(var o=-1,s="",c=0;c<6;c++)s+=e(8).toString(16);if("177245385090"==s)return(0|e(32))!==i&&n("Error in bzip2: crc32 do not match"),e(null),null;"314159265359"!=s&&n("eek not valid bzip data");var p=0|e(32);e(1)&&n("unsupported obsolete version");var l=e(24);l>r&&n("Initial position larger than buffer size");var u=e(16),d=0;for(c=0;c<16;c++)if(u&1<<15-c){var m=e(16);for(g=0;g<16;g++)m&1<<15-g&&(this.symToByte[d++]=16*c+g)}var f=e(3);(f<2||f>6)&&n("another error");var h=e(15);for(0==h&&n("meh"),c=0;c<f;c++)this.mtfSymbol[c]=c;for(c=0;c<h;c++){for(var g=0;e(1);g++)g>=f&&n("whoops another error");var v=this.mtfSymbol[g];for(m=g-1;m>=0;m--)this.mtfSymbol[m+1]=this.mtfSymbol[m];this.mtfSymbol[0]=v,this.selectors[c]=v}var y,b,x,w,_=d+2,k=[],E=new Uint8Array(258),S=new Uint16Array(21);for(g=0;g<f;g++){for(u=e(5),c=0;c<_;c++){for(;(u<1||u>20)&&n("I gave up a while ago on writing error messages"),e(1);)e(1)?u--:u++;E[c]=u}var j,C;for(j=C=E[0],c=1;c<_;c++)E[c]>C?C=E[c]:E[c]<j&&(j=E[c]);(y=k[g]={}).permute=new Int32Array(258),y.limit=new Int32Array(21),y.base=new Int32Array(21),y.minLen=j,y.maxLen=C;var D=y.base,T=y.limit,O=0;for(c=j;c<=C;c++)for(u=0;u<_;u++)E[u]==c&&(y.permute[O++]=u);for(c=j;c<=C;c++)S[c]=T[c]=0;for(c=0;c<_;c++)S[E[c]]++;for(O=u=0,c=j;c<C;c++)O+=S[c],T[c]=O-1,O<<=1,D[c+1]=O-(u+=S[c]);T[C]=O+S[C]-1,D[j]=0}for(c=0;c<256;c++)this.mtfSymbol[c]=c,this.byteCount[c]=0;for(b=x=_=w=0;;){for(_--||(_=49,w>=h&&n("meow i'm a kitty, that's an error"),D=(y=k[this.selectors[w++]]).base,T=y.limit),g=e(c=y.minLen);c>y.maxLen&&n("rawr i'm a dinosaur"),!(g<=T[c]);)c++,g=g<<1|e(1);((g-=D[c])<0||g>=258)&&n("moo i'm a cow");var P=y.permute[g];if(0!=P&&1!=P){if(b)for(b=0,x+u>r&&n("Boom."),v=this.symToByte[this.mtfSymbol[0]],this.byteCount[v]+=u;u--;)a[x++]=v;if(P>d)break;for(x>=r&&n("I can't think of anything. Error"),c=P-1,v=this.mtfSymbol[c],m=c-1;m>=0;m--)this.mtfSymbol[m+1]=this.mtfSymbol[m];this.mtfSymbol[0]=v,v=this.symToByte[v],this.byteCount[v]++,a[x++]=v}else b||(b=1,u=0),u+=0==P?b:2*b,b<<=1}for((l<0||l>=x)&&n("I'm a monkey and I'm throwing something at someone, namely you"),g=0,c=0;c<256;c++)m=g+this.byteCount[c],this.byteCount[c]=g,g=m;for(c=0;c<x;c++)v=255&a[c],a[this.byteCount[v]]|=c<<8,this.byteCount[v]++;var A,I,R,N=0,F=0,L=0;for(x&&(F=255&(N=a[l]),N>>=8,L=-1);x;){for(x--,I=F,F=255&(N=a[N]),N>>=8,3==L++?(A=F,R=I,F=-1):(A=1,R=F);A--;)o=4294967295&(o<<8^this.crcTable[255&(o>>24^R)]),t(R);F!=I&&(L=0)}return(0|(o=(-1^o)>>>0))!=(0|p)&&n("Error in bzip2: crc32 do not match"),4294967295&(o^(i<<1|i>>>31))},e.exports=a},270:(e,t,n)=>{"use strict";const a=n(53908),r=n(78311);e.exports=(e,t,n)=>{let i=null,o=null,s=null;try{s=new r(t,n)}catch(e){return null}return e.forEach(e=>{s.test(e)&&(i&&1!==o.compare(e)||(i=e,o=new a(i,n)))}),i}},528:e=>{"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},622:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerEnvTools=function(e){const t=e.cloudBaseOptions,n=()=>(0,r.getCloudBaseManager)({cloudBaseOptions:t});e.registerTool?.("login",{title:"登录云开发",description:"登录云开发环境并选择要使用的环境",inputSchema:{forceUpdate:a.z.boolean().optional().describe("是否强制重新选择环境")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0,category:"env"}},async({forceUpdate:t=!1})=>{try{const{selectedEnvId:n,cancelled:a,error:r,noEnvs:i}=await(0,o._promptAndSetEnvironmentId)(t,e);if((0,s.debug)("login",{selectedEnvId:n,cancelled:a,error:r,noEnvs:i}),r)return{content:[{type:"text",text:r}]};if(i)return{content:[{type:"text",text:"当前账户下暂无可用的云开发环境,请先在腾讯云控制台创建环境 https://tcb.cloud.tencent.com/dev?from=AIToolkit"}]};if(a)return{content:[{type:"text",text:"用户取消了登录"}]};if(n)return{content:[{type:"text",text:`✅ 登录成功,当前环境: ${n}`}]};throw new Error("登录失败")}catch(e){return{content:[{type:"text",text:`登录失败: ${e instanceof Error?e.message:String(e)}`}]}}}),e.registerTool?.("logout",{title:"退出登录",description:"退出云开发环境",inputSchema:{confirm:a.z.literal("yes").describe("确认操作,默认传 yes")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1,category:"env"}},async()=>{try{return await(0,i.logout)(),await(0,o.clearUserEnvId)(),(0,r.resetCloudBaseManagerCache)(),{content:[{type:"text",text:"✅ 已退出登录"}]}}catch(e){return{content:[{type:"text",text:`退出失败: ${e instanceof Error?e.message:String(e)}`}]}}}),e.registerTool?.("envQuery",{title:"环境查询",description:"查询云开发环境相关信息,支持查询环境列表、当前环境信息和安全域名。(原工具名:listEnvs/getEnvInfo/getEnvAuthDomains,为兼容旧AI规则可继续使用这些名称)",inputSchema:{action:a.z.enum(["list","info","domains"]).describe("查询类型:list=环境列表,info=当前环境信息,domains=安全域名列表")},annotations:{readOnlyHint:!0,openWorldHint:!0,category:"env"}},async({action:e})=>{try{let a;switch(e){case"list":try{const e=await(0,r.getCloudBaseManager)({cloudBaseOptions:t,requireEnvId:!1});a=await e.env.listEnvs()}catch(e){return(0,s.debug)("获取环境列表时出错:",e),{content:[{type:"text",text:"当前账户下暂无可用的云开发环境,请先在腾讯云控制台创建环境 https://tcb.cloud.tencent.com/dev?from=AIToolkit \n错误信息:"+(e instanceof Error?e.message:String(e))}]}}break;case"info":const i=await n();a=await i.env.getEnvInfo();break;case"domains":const o=await n();a=await o.env.getEnvAuthDomains();break;default:throw new Error(`不支持的查询类型: ${e}`)}return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}}catch(e){return{content:[{type:"text",text:`环境查询失败: ${e instanceof Error?e.message:String(e)}`}]}}}),e.registerTool?.("envDomainManagement",{title:"环境域名管理",description:"管理云开发环境的安全域名,支持添加和删除操作。(原工具名:createEnvDomain/deleteEnvDomain,为兼容旧AI规则可继续使用这些名称)",inputSchema:{action:a.z.enum(["create","delete"]).describe("操作类型:create=添加域名,delete=删除域名"),domains:a.z.array(a.z.string()).describe("安全域名数组")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0,category:"env"}},async({action:e,domains:t})=>{try{const a=await n();let r;switch(e){case"create":r=await a.env.createEnvDomain(t);break;case"delete":r=await a.env.deleteEnvDomain(t);break;default:throw new Error(`不支持的操作类型: ${e}`)}return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(e){return{content:[{type:"text",text:`域名管理操作失败: ${e instanceof Error?e.message:String(e)}`}]}}}),e.registerTool?.("updateEnvInfo",{title:"更新环境信息",description:"更新云开发环境信息",inputSchema:{alias:a.z.string().describe("环境别名")},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0,category:"env"}},async({alias:e})=>{const t=await n(),a=await t.env.updateEnvInfo(e);return{content:[{type:"text",text:JSON.stringify(a,null,2)}]}})};const a=n(21614),r=n(3431),i=n(77291),o=n(3461),s=n(13039)},687:(e,t,n)=>{var a=n(19534).BigInteger,r=n(92236).ECCurveFp;function i(e,t,n,a){this.curve=e,this.g=t,this.n=n,this.h=a}function o(e){return new a(e,16)}i.prototype.getCurve=function(){return this.curve},i.prototype.getG=function(){return this.g},i.prototype.getN=function(){return this.n},i.prototype.getH=function(){return this.h},e.exports={secp128r1:function(){var e=o("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF"),t=o("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC"),n=o("E87579C11079F43DD824993C2CEE5ED3"),s=o("FFFFFFFE0000000075A30D1B9038A115"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("04161FF7528B899B2D0C28607CA52C5B86CF5AC8395BAFEB13C02DA292DDED7A83");return new i(p,l,s,c)},secp160k1:function(){var e=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73"),t=a.ZERO,n=o("7"),s=o("0100000000000000000001B8FA16DFAB9ACA16B6B3"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("043B4C382CE37AA192A4019E763036F4F5DD4D7EBB938CF935318FDCED6BC28286531733C3F03C4FEE");return new i(p,l,s,c)},secp160r1:function(){var e=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"),t=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"),n=o("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"),s=o("0100000000000000000001F4C8F927AED3CA752257"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("044A96B5688EF573284664698968C38BB913CBFC8223A628553168947D59DCC912042351377AC5FB32");return new i(p,l,s,c)},secp192k1:function(){var e=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37"),t=a.ZERO,n=o("3"),s=o("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("04DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D");return new i(p,l,s,c)},secp192r1:function(){var e=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"),t=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"),n=o("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"),s=o("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("04188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF101207192B95FFC8DA78631011ED6B24CDD573F977A11E794811");return new i(p,l,s,c)},secp224r1:function(){var e=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"),t=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"),n=o("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"),s=o("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("04B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34");return new i(p,l,s,c)},secp256r1:function(){var e=o("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"),t=o("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"),n=o("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"),s=o("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"),c=a.ONE,p=new r(e,t,n),l=p.decodePointHex("046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5");return new i(p,l,s,c)}}},743:(e,t,n)=>{var a=n(28354).inherits,r=n(89007).ZipArchiveOutputStream,i=n(89007).ZipArchiveEntry,o=n(97727),s=e.exports=function(e){if(!(this instanceof s))return new s(e);(e=this.options=e||{}).zlib=e.zlib||{},r.call(this,e),"number"==typeof e.level&&e.level>=0&&(e.zlib.level=e.level,delete e.level),e.forceZip64||"number"!=typeof e.zlib.level||0!==e.zlib.level||(e.store=!0),e.namePrependSlash=e.namePrependSlash||!1,e.comment&&e.comment.length>0&&this.setComment(e.comment)};a(s,r),s.prototype._normalizeFileData=function(e){var t="directory"===(e=o.defaults(e,{type:"file",name:null,namePrependSlash:this.options.namePrependSlash,linkname:null,date:null,mode:null,store:this.options.store,comment:""})).type,n="symlink"===e.type;return e.name&&(e.name=o.sanitizePath(e.name),n||"/"!==e.name.slice(-1)?t&&(e.name+="/"):(t=!0,e.type="directory")),(t||n)&&(e.store=!0),e.date=o.dateify(e.date),e},s.prototype.entry=function(e,t,n){if("function"!=typeof n&&(n=this._emitErrorCallback.bind(this)),"file"===(t=this._normalizeFileData(t)).type||"directory"===t.type||"symlink"===t.type)if("string"==typeof t.name&&0!==t.name.length){if("symlink"!==t.type||"string"==typeof t.linkname){var a=new i(t.name);return a.setTime(t.date,this.options.forceLocalTime),t.namePrependSlash&&a.setName(t.name,!0),t.store&&a.setMethod(0),t.comment.length>0&&a.setComment(t.comment),"symlink"===t.type&&"number"!=typeof t.mode&&(t.mode=40960),"number"==typeof t.mode&&("symlink"===t.type&&(t.mode|=40960),a.setUnixMode(t.mode)),"symlink"===t.type&&"string"==typeof t.linkname&&(e=Buffer.from(t.linkname)),r.prototype.entry.call(this,a,e,n)}n(new Error("entry linkname must be a non-empty string value when type equals symlink"))}else n(new Error("entry name must be a non-empty string value"));else n(new Error(t.type+" entries not currently supported"))},s.prototype.finalize=function(){this.finish()}},757:(e,t,n)=>{"use strict";var a=n(79551),r=n(54926),i=n(70388),o=n(12550),s=n(15442),c=n(55511),p=n(92861).Buffer;function l(e){this.request=e,this.params=null}l.prototype.buildParams=function(e,t,n,a,r,i){var c={};for(var p in e)c["oauth_"+p]=e[p];c.oauth_version||(c.oauth_version="1.0"),c.oauth_timestamp||(c.oauth_timestamp=Math.floor(Date.now()/1e3).toString()),c.oauth_nonce||(c.oauth_nonce=o().replace(/-/g,"")),c.oauth_signature_method||(c.oauth_signature_method="HMAC-SHA1");var l=c.oauth_consumer_secret||c.oauth_private_key;delete c.oauth_consumer_secret,delete c.oauth_private_key;var u=c.oauth_token_secret;delete c.oauth_token_secret;var d=c.oauth_realm;delete c.oauth_realm,delete c.oauth_transport_method;var m=t.protocol+"//"+t.host+t.pathname,f=i.parse([].concat(a,r,i.stringify(c)).join("&"));return c.oauth_signature=s.sign(c.oauth_signature_method,n,m,f,l,u),d&&(c.realm=d),c},l.prototype.buildBodyHash=function(e,t){["HMAC-SHA1","RSA-SHA1"].indexOf(e.signature_method||"HMAC-SHA1")<0&&this.request.emit("error",new Error("oauth: "+e.signature_method+" signature_method not supported with body_hash signing."));var n=c.createHash("sha1");n.update(t||"");var a=n.digest("hex");return p.from(a,"hex").toString("base64")},l.prototype.concatParams=function(e,t,n){n=n||"";var a=Object.keys(e).filter(function(e){return"realm"!==e&&"oauth_signature"!==e}).sort();return e.realm&&a.splice(0,0,"realm"),a.push("oauth_signature"),a.map(function(t){return t+"="+n+s.rfc3986(e[t])+n}).join(t)},l.prototype.onRequest=function(e){var t=this;t.params=e;var n,o,s=t.request.uri||{},c=t.request.method||"",p=i(t.request.headers),l=t.request.body||"",u=t.request.qsLib||r,d=p.get("content-type")||"",m="application/x-www-form-urlencoded",f=e.transport_method||"header";d.slice(0,33)===m&&(d=m,n=l),s.query&&(o=s.query),"body"!==f||"POST"===c&&d===m||t.request.emit("error",new Error("oauth: transport_method of body requires POST and content-type "+m)),n||"boolean"!=typeof e.body_hash||(e.body_hash=t.buildBodyHash(e,t.request.body.toString()));var h=t.buildParams(e,s,c,o,n,u);switch(f){case"header":t.request.setHeader("Authorization","OAuth "+t.concatParams(h,",",'"'));break;case"query":var g=t.request.uri.href+=(o?"&":"?")+t.concatParams(h,"&");t.request.uri=a.parse(g),t.request.path=t.request.uri.path;break;case"body":t.request.body=(n?n+"&":"")+t.concatParams(h,"&");break;default:t.request.emit("error",new Error("oauth: transport_method invalid"))}},t.W=l},920:(e,t,n)=>{"use strict";var a=n(69675),r=n(58859),i=n(14803),o=n(80507),s=n(72271)||o||i;e.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new a("Side channel does not contain "+r(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,n){e||(e=s()),e.set(t,n)}};return t}},1045:e=>{"use strict";e.exports=JSON.parse('{"$id":"cache.json#","$schema":"http://json-schema.org/draft-06/schema#","properties":{"beforeRequest":{"oneOf":[{"type":"null"},{"$ref":"beforeRequest.json#"}]},"afterRequest":{"oneOf":[{"type":"null"},{"$ref":"afterRequest.json#"}]},"comment":{"type":"string"}}}')},1143:(e,t,n)=>{var a=n(12412),r=n(28354);function i(e){var t,n,i,o,p,l,u,d,m,f=["([^%]*)","%","(['\\-+ #0]*?)","([1-9]\\d*)?","(\\.([1-9]\\d*))?","[lhjztL]*?","([diouxXfFeEgGaAcCsSp%jr])"].join(""),h=new RegExp(f),g=Array.prototype.slice.call(arguments,1),v="",y=1;for(a.equal("string",typeof e);null!==(m=h.exec(e));)if(v+=m[1],e=e.substring(m[0].length),t=m[2]||"",n=m[3]||0,i=m[4]||"",p=!1,u=!1,l=" ","%"!=(o=m[6])){if(0===g.length)throw new Error("too few args to sprintf");if(d=g.shift(),y++,t.match(/[\' #]/))throw new Error("unsupported flags: "+t);if(i.length>0)throw new Error("non-zero precision not supported");switch(t.match(/-/)&&(p=!0),t.match(/0/)&&(l="0"),t.match(/\+/)&&(u=!0),o){case"s":if(null==d)throw new Error("argument "+y+": attempted to print undefined or null as a string");v+=s(l,n,p,d.toString());break;case"d":d=Math.floor(d);case"f":v+=(u=u&&d>0?"+":"")+s(l,n,p,d.toString());break;case"x":v+=s(l,n,p,d.toString(16));break;case"j":0===n&&(n=10),v+=r.inspect(d,!1,n);break;case"r":v+=c(d);break;default:throw new Error("unsupported conversion: "+o)}}else v+="%";return v+e}function o(e){var t=Array.prototype.slice.call(arguments,1);return e.write(i.apply(this,t))}function s(e,t,n,a){for(var r=a;r.length<t;)n?r+=e:r=e+r;return r}function c(e){var t;if(!(e instanceof Error))throw new Error(i("invalid type for %%r: %j",e));if(t="EXCEPTION: "+e.constructor.name+": "+e.stack,e.cause&&"function"==typeof e.cause){var n=e.cause();n&&(t+="\nCaused by: "+c(n))}return t}t.sprintf=i,t.printf=function(){var e=Array.prototype.slice.call(arguments);e.unshift(process.stdout),o.apply(null,e)},t.fprintf=o},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=n(99029),r=n(94227),i=n(62586),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>a.str`should match "${e.ifClause}" schema`,params:({params:e})=>a._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:r}=e;void 0===n.then&&void 0===n.else&&i.checkStrictMode(r,'"if" without "then" and "else" is ignored');const o=s(r,"then"),c=s(r,"else");if(!o&&!c)return;const p=t.let("valid",!0),l=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);e.mergeEvaluated(t)}(),e.reset(),o&&c){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(l,u("then",n),u("else",n))}else o?t.if(l,u("then")):t.if(a.not(l),u("else"));function u(n,r){return()=>{const i=e.subschema({keyword:n},l);t.assign(p,l),e.mergeValidEvaluated(i,p),r?t.assign(r,a._`${n}`):e.setParams({ifClause:n})}}e.pass(p,()=>e.error(!0))}};function s(e,t){const n=e.schema[t];return void 0!==n&&!r.alwaysValidSchema(e,n)}t.default=o},1243:(e,t)=>{const n={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function a(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||"")),new Error("ADM-ZIP: "+e)}}for(const e of Object.keys(n))t[e]=a(n[e])},1283:e=>{"use strict";e.exports=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var n={__proto__:t(e)};else n=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}),n};var t=Object.getPrototypeOf||function(e){return e.__proto__}},1294:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsubscribeRequestSchema=t.SubscribeRequestSchema=t.ResourceListChangedNotificationSchema=t.ReadResourceResultSchema=t.ReadResourceRequestSchema=t.ListResourceTemplatesResultSchema=t.ListResourceTemplatesRequestSchema=t.ListResourcesResultSchema=t.ListResourcesRequestSchema=t.ResourceTemplateSchema=t.ResourceSchema=t.BlobResourceContentsSchema=t.TextResourceContentsSchema=t.ResourceContentsSchema=t.PaginatedResultSchema=t.PaginatedRequestSchema=t.ProgressNotificationSchema=t.ProgressSchema=t.PingRequestSchema=t.isInitializedNotification=t.InitializedNotificationSchema=t.InitializeResultSchema=t.ServerCapabilitiesSchema=t.isInitializeRequest=t.InitializeRequestSchema=t.ClientCapabilitiesSchema=t.ImplementationSchema=t.BaseMetadataSchema=t.CancelledNotificationSchema=t.EmptyResultSchema=t.JSONRPCMessageSchema=t.isJSONRPCError=t.JSONRPCErrorSchema=t.ErrorCode=t.isJSONRPCResponse=t.JSONRPCResponseSchema=t.isJSONRPCNotification=t.JSONRPCNotificationSchema=t.isJSONRPCRequest=t.JSONRPCRequestSchema=t.RequestIdSchema=t.ResultSchema=t.NotificationSchema=t.RequestSchema=t.CursorSchema=t.ProgressTokenSchema=t.JSONRPC_VERSION=t.SUPPORTED_PROTOCOL_VERSIONS=t.DEFAULT_NEGOTIATED_PROTOCOL_VERSION=t.LATEST_PROTOCOL_VERSION=void 0,t.ClientResultSchema=t.ClientNotificationSchema=t.ClientRequestSchema=t.RootsListChangedNotificationSchema=t.ListRootsResultSchema=t.ListRootsRequestSchema=t.RootSchema=t.CompleteResultSchema=t.CompleteRequestSchema=t.PromptReferenceSchema=t.ResourceReferenceSchema=t.ResourceTemplateReferenceSchema=t.ElicitResultSchema=t.ElicitRequestSchema=t.PrimitiveSchemaDefinitionSchema=t.EnumSchemaSchema=t.NumberSchemaSchema=t.StringSchemaSchema=t.BooleanSchemaSchema=t.CreateMessageResultSchema=t.CreateMessageRequestSchema=t.SamplingMessageSchema=t.ModelPreferencesSchema=t.ModelHintSchema=t.LoggingMessageNotificationSchema=t.SetLevelRequestSchema=t.LoggingLevelSchema=t.ToolListChangedNotificationSchema=t.CallToolRequestSchema=t.CompatibilityCallToolResultSchema=t.CallToolResultSchema=t.ListToolsResultSchema=t.ListToolsRequestSchema=t.ToolSchema=t.ToolAnnotationsSchema=t.PromptListChangedNotificationSchema=t.GetPromptResultSchema=t.PromptMessageSchema=t.ContentBlockSchema=t.ResourceLinkSchema=t.EmbeddedResourceSchema=t.AudioContentSchema=t.ImageContentSchema=t.TextContentSchema=t.GetPromptRequestSchema=t.ListPromptsResultSchema=t.ListPromptsRequestSchema=t.PromptSchema=t.PromptArgumentSchema=t.ResourceUpdatedNotificationSchema=void 0,t.McpError=t.ServerResultSchema=t.ServerNotificationSchema=t.ServerRequestSchema=void 0;const a=n(21614);t.LATEST_PROTOCOL_VERSION="2025-06-18",t.DEFAULT_NEGOTIATED_PROTOCOL_VERSION="2025-03-26",t.SUPPORTED_PROTOCOL_VERSIONS=[t.LATEST_PROTOCOL_VERSION,"2025-03-26","2024-11-05","2024-10-07"],t.JSONRPC_VERSION="2.0",t.ProgressTokenSchema=a.z.union([a.z.string(),a.z.number().int()]),t.CursorSchema=a.z.string();const r=a.z.object({progressToken:a.z.optional(t.ProgressTokenSchema)}).passthrough(),i=a.z.object({_meta:a.z.optional(r)}).passthrough();t.RequestSchema=a.z.object({method:a.z.string(),params:a.z.optional(i)});const o=a.z.object({_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough();var s;t.NotificationSchema=a.z.object({method:a.z.string(),params:a.z.optional(o)}),t.ResultSchema=a.z.object({_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),t.RequestIdSchema=a.z.union([a.z.string(),a.z.number().int()]),t.JSONRPCRequestSchema=a.z.object({jsonrpc:a.z.literal(t.JSONRPC_VERSION),id:t.RequestIdSchema}).merge(t.RequestSchema).strict(),t.isJSONRPCRequest=e=>t.JSONRPCRequestSchema.safeParse(e).success,t.JSONRPCNotificationSchema=a.z.object({jsonrpc:a.z.literal(t.JSONRPC_VERSION)}).merge(t.NotificationSchema).strict(),t.isJSONRPCNotification=e=>t.JSONRPCNotificationSchema.safeParse(e).success,t.JSONRPCResponseSchema=a.z.object({jsonrpc:a.z.literal(t.JSONRPC_VERSION),id:t.RequestIdSchema,result:t.ResultSchema}).strict(),t.isJSONRPCResponse=e=>t.JSONRPCResponseSchema.safeParse(e).success,function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(s||(t.ErrorCode=s={})),t.JSONRPCErrorSchema=a.z.object({jsonrpc:a.z.literal(t.JSONRPC_VERSION),id:t.RequestIdSchema,error:a.z.object({code:a.z.number().int(),message:a.z.string(),data:a.z.optional(a.z.unknown())})}).strict(),t.isJSONRPCError=e=>t.JSONRPCErrorSchema.safeParse(e).success,t.JSONRPCMessageSchema=a.z.union([t.JSONRPCRequestSchema,t.JSONRPCNotificationSchema,t.JSONRPCResponseSchema,t.JSONRPCErrorSchema]),t.EmptyResultSchema=t.ResultSchema.strict(),t.CancelledNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/cancelled"),params:o.extend({requestId:t.RequestIdSchema,reason:a.z.string().optional()})}),t.BaseMetadataSchema=a.z.object({name:a.z.string(),title:a.z.optional(a.z.string())}).passthrough(),t.ImplementationSchema=t.BaseMetadataSchema.extend({version:a.z.string()}),t.ClientCapabilitiesSchema=a.z.object({experimental:a.z.optional(a.z.object({}).passthrough()),sampling:a.z.optional(a.z.object({}).passthrough()),elicitation:a.z.optional(a.z.object({}).passthrough()),roots:a.z.optional(a.z.object({listChanged:a.z.optional(a.z.boolean())}).passthrough())}).passthrough(),t.InitializeRequestSchema=t.RequestSchema.extend({method:a.z.literal("initialize"),params:i.extend({protocolVersion:a.z.string(),capabilities:t.ClientCapabilitiesSchema,clientInfo:t.ImplementationSchema})}),t.isInitializeRequest=e=>t.InitializeRequestSchema.safeParse(e).success,t.ServerCapabilitiesSchema=a.z.object({experimental:a.z.optional(a.z.object({}).passthrough()),logging:a.z.optional(a.z.object({}).passthrough()),completions:a.z.optional(a.z.object({}).passthrough()),prompts:a.z.optional(a.z.object({listChanged:a.z.optional(a.z.boolean())}).passthrough()),resources:a.z.optional(a.z.object({subscribe:a.z.optional(a.z.boolean()),listChanged:a.z.optional(a.z.boolean())}).passthrough()),tools:a.z.optional(a.z.object({listChanged:a.z.optional(a.z.boolean())}).passthrough())}).passthrough(),t.InitializeResultSchema=t.ResultSchema.extend({protocolVersion:a.z.string(),capabilities:t.ServerCapabilitiesSchema,serverInfo:t.ImplementationSchema,instructions:a.z.optional(a.z.string())}),t.InitializedNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/initialized")}),t.isInitializedNotification=e=>t.InitializedNotificationSchema.safeParse(e).success,t.PingRequestSchema=t.RequestSchema.extend({method:a.z.literal("ping")}),t.ProgressSchema=a.z.object({progress:a.z.number(),total:a.z.optional(a.z.number()),message:a.z.optional(a.z.string())}).passthrough(),t.ProgressNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/progress"),params:o.merge(t.ProgressSchema).extend({progressToken:t.ProgressTokenSchema})}),t.PaginatedRequestSchema=t.RequestSchema.extend({params:i.extend({cursor:a.z.optional(t.CursorSchema)}).optional()}),t.PaginatedResultSchema=t.ResultSchema.extend({nextCursor:a.z.optional(t.CursorSchema)}),t.ResourceContentsSchema=a.z.object({uri:a.z.string(),mimeType:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),t.TextResourceContentsSchema=t.ResourceContentsSchema.extend({text:a.z.string()}),t.BlobResourceContentsSchema=t.ResourceContentsSchema.extend({blob:a.z.string().base64()}),t.ResourceSchema=t.BaseMetadataSchema.extend({uri:a.z.string(),description:a.z.optional(a.z.string()),mimeType:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}),t.ResourceTemplateSchema=t.BaseMetadataSchema.extend({uriTemplate:a.z.string(),description:a.z.optional(a.z.string()),mimeType:a.z.optional(a.z.string()),_meta:a.z.optional(a.z.object({}).passthrough())}),t.ListResourcesRequestSchema=t.PaginatedRequestSchema.extend({method:a.z.literal("resources/list")}),t.ListResourcesResultSchema=t.PaginatedResultSchema.extend({resources:a.z.array(t.ResourceSchema)}),t.ListResourceTemplatesRequestSchema=t.PaginatedRequestSchema.extend({method:a.z.literal("resources/templates/list")}),t.ListResourceTemplatesResultSchema=t.PaginatedResultSchema.extend({resourceTemplates:a.z.array(t.ResourceTemplateSchema)}),t.ReadResourceRequestSchema=t.RequestSchema.extend({method:a.z.literal("resources/read"),params:i.extend({uri:a.z.string()})}),t.ReadResourceResultSchema=t.ResultSchema.extend({contents:a.z.array(a.z.union([t.TextResourceContentsSchema,t.BlobResourceContentsSchema]))}),t.ResourceListChangedNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/resources/list_changed")}),t.SubscribeRequestSchema=t.RequestSchema.extend({method:a.z.literal("resources/subscribe"),params:i.extend({uri:a.z.string()})}),t.UnsubscribeRequestSchema=t.RequestSchema.extend({method:a.z.literal("resources/unsubscribe"),params:i.extend({uri:a.z.string()})}),t.ResourceUpdatedNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/resources/updated"),params:o.extend({uri:a.z.string()})}),t.PromptArgumentSchema=a.z.object({name:a.z.string(),description:a.z.optional(a.z.string()),required:a.z.optional(a.z.boolean())}).passthrough(),t.PromptSchema=t.BaseMetadataSchema.extend({description:a.z.optional(a.z.string()),arguments:a.z.optional(a.z.array(t.PromptArgumentSchema)),_meta:a.z.optional(a.z.object({}).passthrough())}),t.ListPromptsRequestSchema=t.PaginatedRequestSchema.extend({method:a.z.literal("prompts/list")}),t.ListPromptsResultSchema=t.PaginatedResultSchema.extend({prompts:a.z.array(t.PromptSchema)}),t.GetPromptRequestSchema=t.RequestSchema.extend({method:a.z.literal("prompts/get"),params:i.extend({name:a.z.string(),arguments:a.z.optional(a.z.record(a.z.string()))})}),t.TextContentSchema=a.z.object({type:a.z.literal("text"),text:a.z.string(),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),t.ImageContentSchema=a.z.object({type:a.z.literal("image"),data:a.z.string().base64(),mimeType:a.z.string(),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),t.AudioContentSchema=a.z.object({type:a.z.literal("audio"),data:a.z.string().base64(),mimeType:a.z.string(),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),t.EmbeddedResourceSchema=a.z.object({type:a.z.literal("resource"),resource:a.z.union([t.TextResourceContentsSchema,t.BlobResourceContentsSchema]),_meta:a.z.optional(a.z.object({}).passthrough())}).passthrough(),t.ResourceLinkSchema=t.ResourceSchema.extend({type:a.z.literal("resource_link")}),t.ContentBlockSchema=a.z.union([t.TextContentSchema,t.ImageContentSchema,t.AudioContentSchema,t.ResourceLinkSchema,t.EmbeddedResourceSchema]),t.PromptMessageSchema=a.z.object({role:a.z.enum(["user","assistant"]),content:t.ContentBlockSchema}).passthrough(),t.GetPromptResultSchema=t.ResultSchema.extend({description:a.z.optional(a.z.string()),messages:a.z.array(t.PromptMessageSchema)}),t.PromptListChangedNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/prompts/list_changed")}),t.ToolAnnotationsSchema=a.z.object({title:a.z.optional(a.z.string()),readOnlyHint:a.z.optional(a.z.boolean()),destructiveHint:a.z.optional(a.z.boolean()),idempotentHint:a.z.optional(a.z.boolean()),openWorldHint:a.z.optional(a.z.boolean())}).passthrough(),t.ToolSchema=t.BaseMetadataSchema.extend({description:a.z.optional(a.z.string()),inputSchema:a.z.object({type:a.z.literal("object"),properties:a.z.optional(a.z.object({}).passthrough()),required:a.z.optional(a.z.array(a.z.string()))}).passthrough(),outputSchema:a.z.optional(a.z.object({type:a.z.literal("object"),properties:a.z.optional(a.z.object({}).passthrough()),required:a.z.optional(a.z.array(a.z.string()))}).passthrough()),annotations:a.z.optional(t.ToolAnnotationsSchema),_meta:a.z.optional(a.z.object({}).passthrough())}),t.ListToolsRequestSchema=t.PaginatedRequestSchema.extend({method:a.z.literal("tools/list")}),t.ListToolsResultSchema=t.PaginatedResultSchema.extend({tools:a.z.array(t.ToolSchema)}),t.CallToolResultSchema=t.ResultSchema.extend({content:a.z.array(t.ContentBlockSchema).default([]),structuredContent:a.z.object({}).passthrough().optional(),isError:a.z.optional(a.z.boolean())}),t.CompatibilityCallToolResultSchema=t.CallToolResultSchema.or(t.ResultSchema.extend({toolResult:a.z.unknown()})),t.CallToolRequestSchema=t.RequestSchema.extend({method:a.z.literal("tools/call"),params:i.extend({name:a.z.string(),arguments:a.z.optional(a.z.record(a.z.unknown()))})}),t.ToolListChangedNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/tools/list_changed")}),t.LoggingLevelSchema=a.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),t.SetLevelRequestSchema=t.RequestSchema.extend({method:a.z.literal("logging/setLevel"),params:i.extend({level:t.LoggingLevelSchema})}),t.LoggingMessageNotificationSchema=t.NotificationSchema.extend({method:a.z.literal("notifications/message"),params:o.extend({level:t.LoggingLevelSchema,logger:a.z.optional(a.z.string()),data:a.z.unknown()})}),t.ModelHintSchema=a.z.object({name:a.z.string().optional()}).passthrough(),t.ModelPreferencesSchema=a.z.object({hints:a.z.optional(a.z.array(t.ModelHintSchema)),costPriority:a.z.optional(a.z.number().min(0).max(1)),speedPriority:a.z.optional(a.z.number().min(0).max(1)),intelligencePriority:a.z.optional(a.z.number().min(0).max(1))}).passthrough(),t.SamplingMessageSchema=a.z.object({role:a.z.enum(["user","assistant"]),content:a.z.union([t.TextContentSchema,t.ImageContentSchema,t.AudioContentSchema])}).passthrough(),t.CreateMessageRequestSchema=t.RequestSchema.extend({method:a.z.literal("sampling/createMessage"),params:i.extend({messages:a.z.array(t.SamplingMessageSchema),systemPrompt:a.z.optional(a.z.string()),includeContext:a.z.optional(a.z.enum(["none","thisServer","allServers"])),temperature:a.z.optional(a.z.number()),maxTokens:a.z.number().int(),stopSequences:a.z.optional(a.z.array(a.z.string())),metadata:a.z.optional(a.z.object({}).passthrough()),modelPreferences:a.z.optional(t.ModelPreferencesSchema)})}),t.CreateMessageResultSchema=t.ResultSchema.extend({model:a.z.string(),stopReason:a.z.optional(a.z.enum(["endTurn","stopSequence","maxTokens"]).or(a.z.string())),role:a.z.enum(["user","assistant"]),content:a.z.discriminatedUnion("type",[t.TextContentSchema,t.ImageContentSchema,t.AudioContentSchema])}),t.BooleanSchemaSchema=a.z.object({type:a.z.literal("boolean"),title:a.z.optional(a.z.string()),description:a.z.optional(a.z.string()),default:a.z.optional(a.z.boolean())}).passthrough(),t.StringSchemaSchema=a.z.object({type:a.z.literal("string"),title:a