@easbot/gateway 0.2.45 → 0.2.47

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.
@@ -0,0 +1 @@
1
+ 'use strict';var chunkAUPHFE34_cjs=require('./chunk-AUPHFE34.cjs');require('./chunk-GY3SWWW3.cjs');Object.defineProperty(exports,"Log",{enumerable:true,get:function(){return chunkAUPHFE34_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as Log}from'./chunk-7OFQ65NG.mjs';import'./chunk-HAMGVOQD.mjs';
@@ -0,0 +1 @@
1
+ export{e as clearPermissionStateForTests,d as consumePendingPermission,b as getActivePermissionChat,c as savePendingPermission,a as setActivePermissionChat}from'./chunk-NXFFFRVB.mjs';import'./chunk-HAMGVOQD.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkTQ74GHLT_cjs=require('./chunk-TQ74GHLT.cjs');require('./chunk-GY3SWWW3.cjs');Object.defineProperty(exports,"clearPermissionStateForTests",{enumerable:true,get:function(){return chunkTQ74GHLT_cjs.e}});Object.defineProperty(exports,"consumePendingPermission",{enumerable:true,get:function(){return chunkTQ74GHLT_cjs.d}});Object.defineProperty(exports,"getActivePermissionChat",{enumerable:true,get:function(){return chunkTQ74GHLT_cjs.b}});Object.defineProperty(exports,"savePendingPermission",{enumerable:true,get:function(){return chunkTQ74GHLT_cjs.c}});Object.defineProperty(exports,"setActivePermissionChat",{enumerable:true,get:function(){return chunkTQ74GHLT_cjs.a}});
@@ -0,0 +1 @@
1
+ 'use strict';var chunkEKVLJAIP_cjs=require('./chunk-EKVLJAIP.cjs');require('./chunk-AUPHFE34.cjs'),require('./chunk-GY3SWWW3.cjs');Object.defineProperty(exports,"ChannelPluginLoader",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.oa}});Object.defineProperty(exports,"GatewayServer",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.$a}});Object.defineProperty(exports,"GatewayWebSocketServer",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.pa}});
@@ -0,0 +1 @@
1
+ export{oa as ChannelPluginLoader,$a as GatewayServer,pa as GatewayWebSocketServer}from'./chunk-VEA6YZG4.mjs';import'./chunk-7OFQ65NG.mjs';import'./chunk-HAMGVOQD.mjs';
package/dist/index.cjs CHANGED
@@ -1 +1,37 @@
1
- 'use strict';var chunkY6LH4FW3_cjs=require('./chunks/chunk-Y6LH4FW3.cjs'),chunk3SBZTZXS_cjs=require('./chunks/chunk-3SBZTZXS.cjs'),utils=require('@easbot/utils');var a=chunk3SBZTZXS_cjs.b.create({service:"gateway"}),s=class t extends Error{constructor(e,d,v){super(e);chunk3SBZTZXS_cjs.a(this,"type");chunk3SBZTZXS_cjs.a(this,"stage");chunk3SBZTZXS_cjs.a(this,"cause");this.type="GatewayInitializationError",this.stage=d,this.cause=v,Error.captureStackTrace&&Error.captureStackTrace(this,t);}};function E(t){let i=["ECONNRESET","EPIPE","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EHOSTUNREACH","ENETUNREACH"],e=t.code;return i.includes(e??"")}function rt(){process.on("unhandledRejection",t=>{let i=t instanceof Error?t:new Error(String(t));E(i)||a.error("unhandled promise rejection",{error:i.message,stack:i.stack});}),process.on("uncaughtException",t=>{E(t)||(a.error("uncaught exception",{error:t.message,stack:t.stack}),process.exit(1));});}exports.Gateway=void 0;(lt=>{let t={initialized:false,initPromise:null,directory:".easbot",config:null},i,e={server:null,config:null,initialized:false,status:"stopped"};async function d(n={}){if(t.initialized)return;if(t.initPromise)return t.initPromise;let o={directory:n.directory??".easbot",printLogs:n.printLogs??false,logLevel:n.logLevel??"INFO"};return t.directory=o.directory,t.initPromise=(async()=>{let u=chunkY6LH4FW3_cjs.Z();try{await chunk3SBZTZXS_cjs.b.init({logDir:u.Path.log,print:o.printLogs,level:o.logLevel});}catch(r){throw new s("Failed to initialize log infrastructure","log",r instanceof Error?r:void 0)}try{rt();}catch(r){throw new s("Failed to install unhandled exception handlers","server",r instanceof Error?r:void 0)}utils.Fetch.hasProxyConfigured()&&(utils.Fetch.enableProxy({connectTimeout:1e4,keepAliveTimeout:3e4}),a.info("global proxy enabled",{proxyUrl:utils.Fetch.getProxyUrl()}));try{t.config=await chunkY6LH4FW3_cjs.w(o.directory);}catch(r){throw new s("Failed to load gateway configuration","config",r instanceof Error?r:void 0)}t.initialized=true,a.info("gateway runtime initialized",{directory:o.directory,logLevel:o.logLevel});})(),t.initPromise}lt.init=d;function v(){return t.initialized}lt.isInitialized=v;function b(){return i||(i=async()=>{if(!t.initialized)throw new s("Gateway not initialized. Call init() first.","server");let n=chunkY6LH4FW3_cjs._(),o=await chunkY6LH4FW3_cjs.w(n.directory);return o.server?.enabled?(e={server:null,config:o,initialized:true,status:"stopped"},a.info("gateway initialized",{port:o.server?.port,hostname:o.server?.hostname}),e):(a.debug("gateway server disabled or not configured"),{server:null,config:o,initialized:true,status:"stopped"})}),i}function f(){return b()()}lt.state=f;async function nt(){return (await f()).server}lt.get=nt;async function ot(){return (await f()).config?.server?.enabled??false}lt.isEnabled=ot;async function at(){return (await f()).config}lt.config=at;function it(){return e.status}lt.getStatus=it;async function P(n){a.debug("Gateway.start: called"),t.initialized||await d();let o=await f();if(!(o.config?.server?.enabled??true))throw a.warn("gateway server is disabled"),new Error("Gateway server is disabled");if(e.status==="running"){a.info("gateway server is already running");return}if(e.status==="starting"){a.info("gateway server is starting");return}e.status="starting";try{let r={...o.config?.server,...n};a.debug("gateway start: creating server with config",{port:r.port,hostname:r.hostname,path:r.path,https:r.https?.enabled});let C=await G(r);e.server=C,e.status="running",e.error=void 0,a.info("gateway server started",{port:r.port,hostname:r.hostname});}catch(r){throw e.status="error",e.error=r instanceof Error?r.message:String(r),a.error("failed to start gateway server",{error:e.error}),r}}lt.start=P;async function A(){if(e.status==="stopped"){a.info("gateway server is already stopped");return}if(e.status==="stopping"){a.info("gateway server is stopping");return}e.status="stopping";try{e.server&&await e.server.stop(),e.server=null,e.status="stopped",e.error=void 0,await chunk3SBZTZXS_cjs.b.close(),a.info("gateway server stopped");}catch(n){throw e.status="error",e.error=n instanceof Error?n.message:String(n),a.error("failed to stop gateway server",{error:e.error}),n}}lt.stop=A;async function st(n){a.info("restarting gateway server"),(e.status==="running"||e.status==="starting")&&await A(),await P(n);}lt.restart=st;async function gt(){let n=chunkY6LH4FW3_cjs._(),o=await chunkY6LH4FW3_cjs.w(n.directory);return e.config=o,t.config=o,a.info("gateway config reloaded"),o}lt.reloadConfig=gt;async function G(n,o){a.debug("createGatewayServer: starting");let{GatewayServer:u}=await import('./chunks/server-YANYGRJZ.cjs'),r=new u(n),C=o?.startupTimeout??3e4;if(await(async()=>{let g=new Promise((l,T)=>{setTimeout(()=>{T(new Error(`Gateway server startup timeout after ${C}ms`));},C);});try{await Promise.race([r.start(),g]);}catch(l){a.error("gateway server start failed, attempting cleanup",{error:l instanceof Error?l.message:String(l)});try{await r.stop();}catch{}throw l}})(),o?.onStarted)try{await o.onStarted(r);}catch(g){a.warn("server started but onStarted callback failed",{error:g instanceof Error?g.message:String(g)});}return a.info("gateway server created and started",{port:n.port,hostname:n.hostname}),r}lt.createGatewayServer=G;})(exports.Gateway||(exports.Gateway={}));async function ht(t){let{Log:i}=await import('./chunks/log-VLMXTUPA.cjs'),e=false;await i.init({logDir:t.logDir??process.env.EASBOT_LOG_PATH??process.cwd(),print:t.print??false,dev:t.dev??e,level:t.level??("INFO")});}Object.defineProperty(exports,"AgentRegistry",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Ca}});Object.defineProperty(exports,"AgentRegistryConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.p}});Object.defineProperty(exports,"AgentSyncConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.k}});Object.defineProperty(exports,"AgentSyncManager",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Da}});Object.defineProperty(exports,"AuthConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.j}});Object.defineProperty(exports,"BaseChannelPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.qa}});Object.defineProperty(exports,"ChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.h}});Object.defineProperty(exports,"ChannelPluginLoader",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.oa}});Object.defineProperty(exports,"ChannelPluginRegistry",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Aa}});Object.defineProperty(exports,"CircuitBreakerConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.o}});Object.defineProperty(exports,"ConnectionPoolConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.m}});Object.defineProperty(exports,"DEBUG_AGENT_FILTER",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.T}});Object.defineProperty(exports,"DEFAULT_AGENT_FILTER",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.S}});Object.defineProperty(exports,"DEFAULT_AGENT_REGISTRY_CONFIG",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ha}});Object.defineProperty(exports,"DEFAULT_CONNECTION_POOL_CONFIG",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ja}});Object.defineProperty(exports,"DEFAULT_SYNC_CONFIG",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ia}});Object.defineProperty(exports,"DEFAULT_TOKEN_AUTH_CONFIG",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ga}});Object.defineProperty(exports,"DEFAULT_WEBSOCKET_SERVER_CONFIG",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.fa}});Object.defineProperty(exports,"DiscordPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.sa}});Object.defineProperty(exports,"FeishuChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.c}});Object.defineProperty(exports,"FeishuPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ua}});Object.defineProperty(exports,"GatewayClientConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.s}});Object.defineProperty(exports,"GatewayClusterConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.l}});Object.defineProperty(exports,"GatewayConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.t}});Object.defineProperty(exports,"GatewayServer",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Ea}});Object.defineProperty(exports,"GatewayServerConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.r}});Object.defineProperty(exports,"GatewaySessionManager",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.na}});Object.defineProperty(exports,"HTTPSConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.i}});Object.defineProperty(exports,"MessageQueueConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.n}});Object.defineProperty(exports,"MessageRouter",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ka}});Object.defineProperty(exports,"MessageStore",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.la}});Object.defineProperty(exports,"NostrChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.g}});Object.defineProperty(exports,"NostrPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ya}});Object.defineProperty(exports,"SdkEventBridge",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.R}});Object.defineProperty(exports,"SdkEventBus",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Q}});Object.defineProperty(exports,"SdkEventType",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.P}});Object.defineProperty(exports,"SdkMessagetCollector",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.U}});Object.defineProperty(exports,"SessionConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.q}});Object.defineProperty(exports,"SessionStore",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ma}});Object.defineProperty(exports,"SignalChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.f}});Object.defineProperty(exports,"SignalPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.xa}});Object.defineProperty(exports,"SlackChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.b}});Object.defineProperty(exports,"SlackPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ta}});Object.defineProperty(exports,"TelegramChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.a}});Object.defineProperty(exports,"TelegramPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ra}});Object.defineProperty(exports,"WeChatChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.d}});Object.defineProperty(exports,"WeChatPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.va}});Object.defineProperty(exports,"WebChatChannelConfigSchema",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.e}});Object.defineProperty(exports,"WebChatPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.wa}});Object.defineProperty(exports,"clearConfigCache",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.z}});Object.defineProperty(exports,"convertToGatewayMessage",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ba}});Object.defineProperty(exports,"createChannelPlugin",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.za}});Object.defineProperty(exports,"createDefaultSessionState",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.da}});Object.defineProperty(exports,"createGatewayMessage",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.$}});Object.defineProperty(exports,"createTextMessage",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.aa}});Object.defineProperty(exports,"generateSessionId",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ca}});Object.defineProperty(exports,"generateSubscriptionId",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.ea}});Object.defineProperty(exports,"getAgentAdapter",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.W}});Object.defineProperty(exports,"getAgentRegistryConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.G}});Object.defineProperty(exports,"getAuthConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.L}});Object.defineProperty(exports,"getChannelConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.C}});Object.defineProperty(exports,"getCircuitBreakerConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.F}});Object.defineProperty(exports,"getClusterConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.M}});Object.defineProperty(exports,"getConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.x}});Object.defineProperty(exports,"getConfigDirectory",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.A}});Object.defineProperty(exports,"getConnectionPoolConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.D}});Object.defineProperty(exports,"getDefaultAgent",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.N}});Object.defineProperty(exports,"getGatewayClientConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.I}});Object.defineProperty(exports,"getGatewayClientUrl",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.J}});Object.defineProperty(exports,"getHTTPSConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.K}});Object.defineProperty(exports,"getLogLevel",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.O}});Object.defineProperty(exports,"getMessageQueueConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.E}});Object.defineProperty(exports,"getServerConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.B}});Object.defineProperty(exports,"getSessionConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.H}});Object.defineProperty(exports,"getSupportedPlatforms",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Ba}});Object.defineProperty(exports,"hasAgentAdapter",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.X}});Object.defineProperty(exports,"isConfigLoaded",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.y}});Object.defineProperty(exports,"loadConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.w}});Object.defineProperty(exports,"parsePartialConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.v}});Object.defineProperty(exports,"requireAgentAdapter",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.Y}});Object.defineProperty(exports,"setAgentAdapter",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.V}});Object.defineProperty(exports,"validateConfig",{enumerable:true,get:function(){return chunkY6LH4FW3_cjs.u}});exports.initLog=ht;
1
+ 'use strict';var chunkTQ74GHLT_cjs=require('./chunks/chunk-TQ74GHLT.cjs'),chunkEKVLJAIP_cjs=require('./chunks/chunk-EKVLJAIP.cjs'),chunkAUPHFE34_cjs=require('./chunks/chunk-AUPHFE34.cjs'),chunkGY3SWWW3_cjs=require('./chunks/chunk-GY3SWWW3.cjs'),utils=require('@easbot/utils'),qrcode=require('qrcode'),fs=require('fs'),index_js=require('@modelcontextprotocol/sdk/server/index.js'),stdio_js=require('@modelcontextprotocol/sdk/server/stdio.js'),types_js=require('@modelcontextprotocol/sdk/types.js');var d=chunkAUPHFE34_cjs.a.create({service:"gateway"}),w=class e extends Error{constructor(t,n,o){super(t);chunkGY3SWWW3_cjs.a(this,"type");chunkGY3SWWW3_cjs.a(this,"stage");chunkGY3SWWW3_cjs.a(this,"cause");this.type="GatewayInitializationError",this.stage=n,this.cause=o,Error.captureStackTrace&&Error.captureStackTrace(this,e);}};function oe(e){let r=["ECONNRESET","EPIPE","ETIMEDOUT","ECONNREFUSED","ENOTFOUND","EHOSTUNREACH","ENETUNREACH"],t=e.code;return r.includes(t??"")}function Ft(){process.on("unhandledRejection",e=>{let r=e instanceof Error?e:new Error(String(e));oe(r)||d.error("unhandled promise rejection",{error:r.message,stack:r.stack});}),process.on("uncaughtException",e=>{oe(e)||(d.error("uncaught exception",{error:e.message,stack:e.stack}),process.exit(1));});}exports.Gateway=void 0;(er=>{let e={initialized:false,initPromise:null,directory:".easbot",config:null},r,t={server:null,config:null,initialized:false,status:"stopped"};async function n(l={}){if(e.initialized)return;if(e.initPromise)return e.initPromise;let g={directory:l.directory??".easbot",printLogs:l.printLogs??false,logLevel:l.logLevel??"INFO"};return e.directory=g.directory,e.initPromise=(async()=>{let R=chunkEKVLJAIP_cjs.Z();try{await chunkAUPHFE34_cjs.a.init({logDir:R.Path.log,print:g.printLogs,level:g.logLevel});}catch(a){throw new w("Failed to initialize log infrastructure","log",a instanceof Error?a:void 0)}try{Ft();}catch(a){throw new w("Failed to install unhandled exception handlers","server",a instanceof Error?a:void 0)}utils.Fetch.hasProxyConfigured()&&(utils.Fetch.enableProxy({connectTimeout:1e4,keepAliveTimeout:3e4}),d.info("global proxy enabled",{proxyUrl:utils.Fetch.getProxyUrl()}));try{e.config=await chunkEKVLJAIP_cjs.w(g.directory);}catch(a){throw new w("Failed to load gateway configuration","config",a instanceof Error?a:void 0)}e.initialized=true,d.info("gateway runtime initialized",{directory:g.directory,logLevel:g.logLevel});})(),e.initPromise}er.init=n;function o(){return e.initialized}er.isInitialized=o;function c(){return r||(r=async()=>{if(!e.initialized)throw new w("Gateway not initialized. Call init() first.","server");let l=chunkEKVLJAIP_cjs._(),g=await chunkEKVLJAIP_cjs.w(l.directory);return g.server?.enabled?(t={server:null,config:g,initialized:true,status:"stopped"},d.info("gateway initialized",{port:g.server?.port,hostname:g.server?.hostname}),t):(d.debug("gateway server disabled or not configured"),{server:null,config:g,initialized:true,status:"stopped"})}),r}function u(){return c()()}er.state=u;async function C(){return (await u()).server}er.get=C;async function i(){return (await u()).config?.server?.enabled??false}er.isEnabled=i;async function f(){return (await u()).config}er.config=f;function p(){return t.status}er.getStatus=p;async function s(l){d.debug("Gateway.start: called"),e.initialized||await n();let g=await u();if(!(g.config?.server?.enabled??true))throw d.warn("gateway server is disabled"),new Error("Gateway server is disabled");if(t.status==="running"){d.info("gateway server is already running");return}if(t.status==="starting"){d.info("gateway server is starting");return}t.status="starting";try{let a={...g.config?.server,...l};d.debug("gateway start: creating server with config",{port:a.port,hostname:a.hostname,path:a.path,https:a.https?.enabled});let T=await ae(a);t.server=T,t.status="running",t.error=void 0,d.info("gateway server started",{port:a.port,hostname:a.hostname});}catch(a){throw t.status="error",t.error=a instanceof Error?a.message:String(a),d.error("failed to start gateway server",{error:t.error}),a}}er.start=s;async function m(){if(t.status==="stopped"){d.info("gateway server is already stopped");return}if(t.status==="stopping"){d.info("gateway server is stopping");return}t.status="stopping";try{t.server&&await t.server.stop(),t.server=null,t.status="stopped",t.error=void 0,await chunkAUPHFE34_cjs.a.close(),d.info("gateway server stopped");}catch(l){throw t.status="error",t.error=l instanceof Error?l.message:String(l),d.error("failed to stop gateway server",{error:t.error}),l}}er.stop=m;async function h(l){d.info("restarting gateway server"),(t.status==="running"||t.status==="starting")&&await m(),await s(l);}er.restart=h;async function Y(){let l=chunkEKVLJAIP_cjs._(),g=await chunkEKVLJAIP_cjs.w(l.directory);return t.config=g,e.config=g,d.info("gateway config reloaded"),g}er.reloadConfig=Y;async function ae(l,g){d.debug("createGatewayServer: starting");let{GatewayServer:R}=await import('./chunks/server-JXSJH7GK.cjs'),a=new R(l),T=g?.startupTimeout??3e4;if(await(async()=>{let v=new Promise((x,ce)=>{setTimeout(()=>{ce(new Error(`Gateway server startup timeout after ${T}ms`));},T);});try{await Promise.race([a.start(),v]);}catch(x){d.error("gateway server start failed, attempting cleanup",{error:x instanceof Error?x.message:String(x)});try{await a.stop();}catch{}throw x}})(),g?.onStarted)try{await g.onStarted(a);}catch(v){d.warn("server started but onStarted callback failed",{error:v instanceof Error?v.message:String(v)});}return d.info("gateway server created and started",{port:l.port,hostname:l.hostname}),a}er.createGatewayServer=ae;})(exports.Gateway||(exports.Gateway={}));async function qt(e){let r=await qrcode.toString(e,{type:"terminal",errorCorrectionLevel:"L",small:true});process.stderr.write(`${r}
2
+ `);}async function L(e){let r=await fetch(`${e}/ilink/bot/get_bot_qrcode?bot_type=3`);if(!r.ok)throw new Error(`Failed to get QR code: HTTP ${r.status}`);let t=await r.json();if(!t.qrcode)throw new Error("No qrcode in response");let n=t.qrcode_img_content||"";return n&&await qt(n),{qrcodeUrl:n,qrcodeId:t.qrcode,message:"Scan the QR code with WeChat to connect."}}async function K(e){let{qrcodeId:r,apiBaseUrl:t,timeoutMs:n=48e4,maxRetries:o=3}=e,c=Date.now()+n,u=r,C=0;for(;Date.now()<c;){try{let i=new AbortController,f=setTimeout(()=>i.abort(),6e4),p=await fetch(`${t}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(u)}`,{headers:{"iLink-App-ClientVersion":"1"},signal:i.signal});if(clearTimeout(f),!p.ok)throw new Error(`HTTP ${p.status}`);let s=await p.json();switch(s.status){case "confirmed":return {connected:!0,token:s.bot_token,accountId:s.ilink_bot_id,baseUrl:s.baseurl,userId:s.ilink_user_id,message:"Connected to WeChat successfully!"};case "scaned":process.stderr.write(`QR code scanned, waiting for confirmation...
3
+ `);break;case "expired":{if(C+=1,C>=o)return {connected:!1,message:"QR code expired after maximum retries."};process.stderr.write(`QR code expired, refreshing...
4
+ `),u=(await L(t)).qrcodeId;break}case "wait":process.stderr.write(`QR code waiting, please wait...
5
+ `);break;default:break}}catch(i){if(i instanceof Error&&i.name==="AbortError")continue;throw i}await new Promise(i=>setTimeout(i,1e3));}return {connected:false,message:"Login timed out."}}function zt(e){return ["Claude Code needs your approval.","",`Tool: ${e.tool_name}`,`Reason: ${e.description}`,`Input: ${e.input_preview}`,"",`Reply with: yes ${e.request_id}`,`Or deny with: no ${e.request_id}`].join(`
6
+ `)}function Qt(e){let r=new index_js.Server({name:"weixin",version:e},{capabilities:{experimental:{"claude/channel":{},"claude/channel/permission":{}},tools:{}},instructions:'Messages from WeChat arrive as <channel source="plugin:weixin:weixin" chat_id="..." sender_id="...">. Reply using the reply tool with the chat_id from the channel tag. Use absolute paths for file attachments.'});return r.setRequestHandler(types_js.ListToolsRequestSchema,async()=>({tools:[{name:"reply",description:"Reply to a WeChat message. Pass the chat_id from the channel tag.",inputSchema:{type:"object",properties:{chat_id:{type:"string",description:"The chat_id from the channel notification"},text:{type:"string",description:"The reply text"},files:{type:"array",items:{type:"string"},description:"Optional absolute file paths to attach"}},required:["chat_id","text"]}},{name:"send_typing",description:"Send a typing indicator to a WeChat user.",inputSchema:{type:"object",properties:{chat_id:{type:"string",description:"The chat_id (user ID)"}},required:["chat_id"]}}]})),r.setRequestHandler(types_js.CallToolRequestSchema,async t=>{let{name:n,arguments:o}=t.params,c=chunkEKVLJAIP_cjs.Ha();if(!c)return {content:[{type:"text",text:"WeChat not connected. Run `easbot weixin login` first."}],isError:true};let u=c.baseUrl||chunkEKVLJAIP_cjs.Ea,C=chunkEKVLJAIP_cjs.Fa;switch(n){case "reply":{let i=typeof o?.chat_id=="string"?o.chat_id:"",f=typeof o?.text=="string"?o.text:"",p=Array.isArray(o?.files)?o.files.filter(m=>typeof m=="string"):void 0;if(!i||!f)return {content:[{type:"text",text:"Missing chat_id or text parameter."}],isError:true};let s=chunkEKVLJAIP_cjs.Qa(i)||"";try{if(p&&p.length>0){for(let[m,h]of p.entries()){if(!fs.existsSync(h))return {content:[{type:"text",text:`File not found: ${h}`}],isError:!0};await chunkEKVLJAIP_cjs.Pa({filePath:h,to:i,text:m===0?f:"",baseUrl:u,token:c.token,contextToken:s,cdnBaseUrl:C});}return {content:[{type:"text",text:"Message sent with attachments."}]}}return await chunkEKVLJAIP_cjs.Oa({to:i,text:f,baseUrl:u,token:c.token,contextToken:s}),{content:[{type:"text",text:"Message sent."}]}}catch(m){return {content:[{type:"text",text:`Failed to send: ${m}`}],isError:true}}}case "send_typing":{let i=typeof o?.chat_id=="string"?o.chat_id:"";if(!i)return {content:[{type:"text",text:"Missing chat_id parameter."}],isError:true};try{let f=chunkEKVLJAIP_cjs.Qa(i),p=await chunkEKVLJAIP_cjs.Ka(u,c.token,i,f);return p.typing_ticket&&await chunkEKVLJAIP_cjs.La(u,c.token,{ilink_user_id:i,typing_ticket:p.typing_ticket,status:chunkEKVLJAIP_cjs.Ma.TYPING}),{content:[{type:"text",text:"Typing indicator sent."}]}}catch(f){return {content:[{type:"text",text:`Failed to send typing: ${f}`}],isError:true}}}default:return {content:[{type:"text",text:`Unknown tool: ${n}`}],isError:true}}}),r}async function se(e,r){r.enableConfigs(),r.initializeAnalyticsSink();let t=chunkEKVLJAIP_cjs.Ha();t||(process.stderr.write("[weixin] No account configured. Run `easbot weixin login` to connect your WeChat account.\n"),await Promise.all([r.shutdown1PEventLogging(),r.shutdownDatadog()]),process.exit(1));let n=Qt(e),o=new stdio_js.StdioServerTransport;r.registerPermissionHandler(n,async s=>{let m=s.channel_context?.chat_id,h=m?{chatId:m,contextToken:chunkEKVLJAIP_cjs.Qa(m)}:chunkTQ74GHLT_cjs.b();if(!h){r.logForDebugging(`[Weixin MCP] No active chat available for permission request ${s.request_id}`);return}try{chunkTQ74GHLT_cjs.c(s,h.chatId,h.contextToken),await chunkEKVLJAIP_cjs.Oa({to:h.chatId,text:zt(s),baseUrl:c,token:t.token,contextToken:h.contextToken||""});}catch(Y){process.stderr.write(`[weixin] Failed to relay permission request ${s.request_id}: ${Y}
7
+ `);}}),await n.connect(o);let c=t.baseUrl||chunkEKVLJAIP_cjs.Ea,u=new AbortController,C=false,i=async()=>{C||(C=true,u.signal.aborted||u.abort(),await Promise.all([r.shutdown1PEventLogging(),r.shutdownDatadog()]),process.exit(0));};process.stdin.on("end",()=>{i();}),process.stdin.on("error",()=>{i();}),process.on("SIGINT",()=>{i();}),process.on("SIGTERM",()=>{i();}),process.on("SIGHUP",()=>{i();});let f=process.ppid,p=setInterval(()=>{try{process.kill(f,0);}catch{process.stderr.write(`[weixin] Parent process exited, shutting down...
8
+ `),clearInterval(p),i();}},5e3);r.logForDebugging("[Weixin MCP] Starting poll loop"),await chunkEKVLJAIP_cjs.Ra({baseUrl:c,cdnBaseUrl:chunkEKVLJAIP_cjs.Fa,token:t.token,onMessage:async s=>{await n.notification({method:"notifications/claude/channel",params:{content:s.text,meta:{chat_id:s.fromUserId,sender_id:s.fromUserId,message_id:s.messageId,...s.attachmentPath&&{attachment_path:s.attachmentPath},...s.attachmentType&&{attachment_type:s.attachmentType}}}});},onPermissionResponse:async s=>{await n.notification({method:"notifications/claude/channel/permission",params:{request_id:s.requestId,behavior:s.behavior}});},abortSignal:u.signal}),clearInterval(p),await i();}function ie(){process.stdout.write(["Usage:"," easbot weixin serve"," easbot weixin login"," easbot weixin login clear"," easbot weixin access pair <code>","","User routing:",' easbot weixin ensure-user <userId> [--display-name "<name>"] [--username "<u>"] [--channel-id <id>]'," easbot weixin list-users"," easbot weixin remove-user <userId> [--channel-id <id>]"].join(`
9
+ `)+`
10
+ `);}async function jt(e=false){if(e){chunkEKVLJAIP_cjs.Ja(),process.stdout.write(`WeChat account cleared.
11
+ `);return}let r=chunkEKVLJAIP_cjs.Ha();if(r){process.stdout.write(["Already connected:",` User ID: ${r.userId||"unknown"}`,` Connected since: ${r.savedAt}`,"","Run `easbot weixin login clear` to disconnect."].join(`
12
+ `)+`
13
+ `);return}process.stdout.write(`Starting WeChat QR login...
14
+
15
+ `);let t=await L(chunkEKVLJAIP_cjs.Ea);process.stdout.write(`
16
+ Scan the QR code above with WeChat, or open this URL:
17
+ ${t.qrcodeUrl||""}
18
+
19
+ `);let n=await K({qrcodeId:t.qrcodeId,apiBaseUrl:chunkEKVLJAIP_cjs.Ea});(!n.connected||!n.token)&&(process.stderr.write(`Login failed: ${n.message}
20
+ `),process.exit(1)),chunkEKVLJAIP_cjs.Ia({token:n.token,baseUrl:n.baseUrl||chunkEKVLJAIP_cjs.Ea,userId:n.userId,savedAt:new Date().toISOString()}),process.stdout.write(["Connected successfully!",` User ID: ${n.userId||"unknown"}`,` Base URL: ${n.baseUrl||chunkEKVLJAIP_cjs.Ea}`].join(`
21
+ `)+`
22
+ `);}function Vt(e){(e[0]!=="pair"||!e[1])&&(ie(),process.exit(1));let r=chunkEKVLJAIP_cjs.Na(e[1]);r||(process.stderr.write(`Invalid or expired pairing code.
23
+ `),process.exit(1)),process.stdout.write(`Paired successfully: ${r}
24
+ `);}function Kt(e){if(e.length===0)return 'Usage: easbot weixin ensure-user <userId> [--display-name "<name>"] [--username "<u>"] [--channel-id <id>]';let r=e[0];if(!r)return "userId is required";let t={userId:r};for(let n=1;n<e.length;n++){let o=e[n];if(o==="--display-name"||o==="-d"){let c=e[++n];if(!c)return "--display-name requires a value";t.displayName=c;}else if(o==="--username"||o==="-u"){let c=e[++n];if(!c)return "--username requires a value";t.username=c;}else if(o==="--channel-id"||o==="-c"){let c=e[++n];if(!c)return "--channel-id requires a value";t.channelId=c;}}return t}function Yt(e){let r=Kt(e);typeof r=="string"&&(process.stderr.write(`${r}
25
+ `),process.exit(1)),chunkEKVLJAIP_cjs.Ba(r).then(t=>{let{contact:n,session:o,created:c}=t,u=c.contact&&c.session?"\u5DF2\u521B\u5EFA":"\u5DF2\u5B58\u5728\uFF08\u5DF2\u66F4\u65B0\uFF09";process.stdout.write([`[weixin routing] ${u} user: ${r.userId}`,` contact.uid: ${n.uid}`,` contact.path: ${chunkEKVLJAIP_cjs.xa()}/contacts/${n.platform}/${n.stableId}.json`,` session.id: ${o.id}`,` session.path: ${chunkEKVLJAIP_cjs.ya()}/sessions.json`,` profile: ${JSON.stringify(n.profile)}`].join(`
26
+ `)+`
27
+ `);}).catch(t=>{process.stderr.write(`ensure-user failed: ${t}
28
+ `),process.exit(1);});}function Jt(){chunkEKVLJAIP_cjs.Da().then(e=>{if(e.length===0){process.stdout.write(`No weixin users registered.
29
+ `),process.stdout.write("Use `easbot weixin ensure-user <userId>` to add one.\n");return}process.stdout.write(`weixin users (${e.length}):
30
+ `);for(let r of e){let t=r.profile.displayName??r.profile.username??"(no name)";process.stdout.write(` - ${r.stableId} ${t} lastSeen=${new Date(r.lastSeenAt).toISOString()}
31
+ `);}}).catch(e=>{process.stderr.write(`list-users failed: ${e}
32
+ `),process.exit(1);});}function Xt(e){e.length===0&&(process.stderr.write(`Usage: easbot weixin remove-user <userId> [--channel-id <id>]
33
+ `),process.exit(1));let r=e[0];r||(process.stderr.write(`userId is required
34
+ `),process.exit(1));let t="weixin-main";for(let n=1;n<e.length;n++)(e[n]==="--channel-id"||e[n]==="-c")&&(t=e[++n]??t);chunkEKVLJAIP_cjs.Ca(r,t).then(n=>{process.stdout.write(`[weixin routing] removed user: ${r} contact=${n.removed.contact} session=${n.removed.session}
35
+ `);}).catch(n=>{process.stderr.write(`remove-user failed: ${n}
36
+ `),process.exit(1);});}async function Zt(e,r,t){let[n,...o]=e;switch(n){case "serve":r||(process.stderr.write(`[weixin] serve handler not available in this context.
37
+ `),process.exit(1)),await se(t??"0.0.0",r);return;case "login":await jt(o[0]==="clear");return;case "access":Vt(o);return;case "ensure-user":Yt(o);return;case "list-users":Jt();return;case "remove-user":Xt(o);return;default:ie();}}async function un(e){let{Log:r}=await import('./chunks/log-JFEBRH2W.cjs'),t=false;await r.init({logDir:e.logDir??process.env.EASBOT_LOG_PATH??process.cwd(),print:e.print??false,dev:e.dev??t,level:e.level??("INFO")});}Object.defineProperty(exports,"AgentRegistry",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Za}});Object.defineProperty(exports,"AgentRegistryConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.p}});Object.defineProperty(exports,"AgentSyncConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.k}});Object.defineProperty(exports,"AgentSyncManager",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs._a}});Object.defineProperty(exports,"AuthConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.j}});Object.defineProperty(exports,"BaseChannelPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.qa}});Object.defineProperty(exports,"ChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.h}});Object.defineProperty(exports,"ChannelPluginLoader",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.oa}});Object.defineProperty(exports,"ChannelPluginRegistry",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Xa}});Object.defineProperty(exports,"CircuitBreakerConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.o}});Object.defineProperty(exports,"ConnectionPoolConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.m}});Object.defineProperty(exports,"DEBUG_AGENT_FILTER",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.T}});Object.defineProperty(exports,"DEFAULT_AGENT_FILTER",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.S}});Object.defineProperty(exports,"DEFAULT_AGENT_REGISTRY_CONFIG",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ha}});Object.defineProperty(exports,"DEFAULT_CONNECTION_POOL_CONFIG",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ja}});Object.defineProperty(exports,"DEFAULT_SYNC_CONFIG",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ia}});Object.defineProperty(exports,"DEFAULT_TOKEN_AUTH_CONFIG",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ga}});Object.defineProperty(exports,"DEFAULT_WEBSOCKET_SERVER_CONFIG",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.fa}});Object.defineProperty(exports,"DiscordPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.sa}});Object.defineProperty(exports,"FeishuChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.c}});Object.defineProperty(exports,"FeishuPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ua}});Object.defineProperty(exports,"GatewayClientConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.s}});Object.defineProperty(exports,"GatewayClusterConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.l}});Object.defineProperty(exports,"GatewayConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.t}});Object.defineProperty(exports,"GatewayServer",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.$a}});Object.defineProperty(exports,"GatewayServerConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.r}});Object.defineProperty(exports,"GatewaySessionManager",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.na}});Object.defineProperty(exports,"HTTPSConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.i}});Object.defineProperty(exports,"MessageQueueConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.n}});Object.defineProperty(exports,"MessageRouter",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ka}});Object.defineProperty(exports,"MessageStore",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.la}});Object.defineProperty(exports,"NostrChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.g}});Object.defineProperty(exports,"NostrPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Va}});Object.defineProperty(exports,"SdkEventBridge",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.R}});Object.defineProperty(exports,"SdkEventBus",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Q}});Object.defineProperty(exports,"SdkEventType",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.P}});Object.defineProperty(exports,"SdkMessageCollector",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.U}});Object.defineProperty(exports,"SessionConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.q}});Object.defineProperty(exports,"SessionStore",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ma}});Object.defineProperty(exports,"SignalChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.f}});Object.defineProperty(exports,"SignalPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Ua}});Object.defineProperty(exports,"SlackChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.b}});Object.defineProperty(exports,"SlackPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ta}});Object.defineProperty(exports,"TelegramChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.a}});Object.defineProperty(exports,"TelegramPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ra}});Object.defineProperty(exports,"WEIXIN_PLATFORM",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.wa}});Object.defineProperty(exports,"WeChatChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.d}});Object.defineProperty(exports,"WeChatPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.va}});Object.defineProperty(exports,"WebChatChannelConfigSchema",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.e}});Object.defineProperty(exports,"WebChatPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Ta}});Object.defineProperty(exports,"WeixinPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Sa}});Object.defineProperty(exports,"clearConfigCache",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.z}});Object.defineProperty(exports,"convertToGatewayMessage",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ba}});Object.defineProperty(exports,"createChannelPlugin",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Wa}});Object.defineProperty(exports,"createDefaultSessionState",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.da}});Object.defineProperty(exports,"createGatewayMessage",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.$}});Object.defineProperty(exports,"createTextMessage",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.aa}});Object.defineProperty(exports,"ensureContact",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.za}});Object.defineProperty(exports,"ensureSession",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Aa}});Object.defineProperty(exports,"ensureUser",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Ba}});Object.defineProperty(exports,"generateSessionId",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ca}});Object.defineProperty(exports,"generateSubscriptionId",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.ea}});Object.defineProperty(exports,"getAgentAdapter",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.W}});Object.defineProperty(exports,"getAgentRegistryConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.G}});Object.defineProperty(exports,"getAuthConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.L}});Object.defineProperty(exports,"getChannelConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.C}});Object.defineProperty(exports,"getCircuitBreakerConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.F}});Object.defineProperty(exports,"getClusterConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.M}});Object.defineProperty(exports,"getConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.x}});Object.defineProperty(exports,"getConfigDirectory",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.A}});Object.defineProperty(exports,"getConnectionPoolConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.D}});Object.defineProperty(exports,"getDefaultAgent",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.N}});Object.defineProperty(exports,"getGatewayClientConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.I}});Object.defineProperty(exports,"getGatewayClientUrl",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.J}});Object.defineProperty(exports,"getHTTPSConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.K}});Object.defineProperty(exports,"getLogLevel",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.O}});Object.defineProperty(exports,"getMessageQueueConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.E}});Object.defineProperty(exports,"getServerConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.B}});Object.defineProperty(exports,"getSessionConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.H}});Object.defineProperty(exports,"getSupportedPlatforms",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Ya}});Object.defineProperty(exports,"hasAgentAdapter",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.X}});Object.defineProperty(exports,"isConfigLoaded",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.y}});Object.defineProperty(exports,"listWeixinContacts",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Da}});Object.defineProperty(exports,"loadConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.w}});Object.defineProperty(exports,"parsePartialConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.v}});Object.defineProperty(exports,"removeUser",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Ca}});Object.defineProperty(exports,"requireAgentAdapter",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Y}});Object.defineProperty(exports,"setAgentAdapter",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.V}});Object.defineProperty(exports,"validateConfig",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.u}});Object.defineProperty(exports,"weixinSetStateDir",{enumerable:true,get:function(){return chunkEKVLJAIP_cjs.Ga}});exports.handleWeixinCli=Zt;exports.initLog=un;
package/dist/index.d.cts CHANGED
@@ -3,6 +3,7 @@ export { AgentAdapter, AgentInfo, ChannelInfo, ChannelListResponse, GatewayMessa
3
3
  import z, { z as z$1 } from 'zod';
4
4
  import { WSContext } from '@easbot/utils';
5
5
  import { Command, EasbotClient } from '@easbot/sdk';
6
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
7
 
7
8
  declare namespace Gateway {
8
9
  export interface BootstrapConfig {
@@ -40,6 +41,7 @@ declare const ChannelTypeSchema: z.ZodEnum<{
40
41
  slack: "slack";
41
42
  feishu: "feishu";
42
43
  wechat: "wechat";
44
+ weixin: "weixin";
43
45
  webchat: "webchat";
44
46
  signal: "signal";
45
47
  nostr: "nostr";
@@ -171,6 +173,14 @@ declare const ChannelConfigSchema: z.ZodObject<{
171
173
  maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
172
174
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
173
175
  }, z.core.$strip>>;
176
+ weixin: z.ZodOptional<z.ZodObject<{
177
+ enabled: z.ZodDefault<z.ZodBoolean>;
178
+ stateDir: z.ZodOptional<z.ZodString>;
179
+ baseUrl: z.ZodOptional<z.ZodString>;
180
+ cdnBaseUrl: z.ZodOptional<z.ZodString>;
181
+ maxMessageLength: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
182
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
183
+ }, z.core.$strip>>;
174
184
  webchat: z.ZodOptional<z.ZodObject<{
175
185
  enabled: z.ZodDefault<z.ZodBoolean>;
176
186
  path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -549,6 +559,14 @@ declare const GatewayConfigSchema: z.ZodObject<{
549
559
  maxConnections: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
550
560
  timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
551
561
  }, z.core.$strip>>;
562
+ weixin: z.ZodOptional<z.ZodObject<{
563
+ enabled: z.ZodDefault<z.ZodBoolean>;
564
+ stateDir: z.ZodOptional<z.ZodString>;
565
+ baseUrl: z.ZodOptional<z.ZodString>;
566
+ cdnBaseUrl: z.ZodOptional<z.ZodString>;
567
+ maxMessageLength: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
568
+ timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
569
+ }, z.core.$strip>>;
552
570
  webchat: z.ZodOptional<z.ZodObject<{
553
571
  enabled: z.ZodDefault<z.ZodBoolean>;
554
572
  path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -1667,6 +1685,25 @@ interface LocalCommandResult {
1667
1685
  reply?: string;
1668
1686
  continueProcessing?: boolean;
1669
1687
  }
1688
+ interface CommandContext {
1689
+ text: string;
1690
+ sessionId: string;
1691
+ chatId: string;
1692
+ channelInfo: {
1693
+ platform: string;
1694
+ channelId: string;
1695
+ userId?: string;
1696
+ chatId?: string;
1697
+ [key: string]: unknown;
1698
+ };
1699
+ messageId?: string;
1700
+ replyToMessageId?: string;
1701
+ }
1702
+ interface CommandResult {
1703
+ handled: boolean;
1704
+ reply?: string;
1705
+ gatewayMessage?: GatewayMessage;
1706
+ }
1670
1707
  declare abstract class BaseChannelPlugin implements ChannelPlugin {
1671
1708
  abstract readonly id: string;
1672
1709
  abstract readonly platform: PlatformType;
@@ -1699,8 +1736,10 @@ declare abstract class BaseChannelPlugin implements ChannelPlugin {
1699
1736
  protected handleEvent(type: string, data?: unknown): Promise<void>;
1700
1737
  protected getCommandList(): Promise<Command[]>;
1701
1738
  protected processLocalCommand(command: string, sessionId: string, chatId: string): Promise<LocalCommandResult>;
1739
+ private handleCommandsCommand;
1702
1740
  private handleNewCommand;
1703
1741
  private handleStatusCommand;
1742
+ processCommand(ctx: CommandContext): Promise<CommandResult>;
1704
1743
  private formatStatusReport;
1705
1744
  private formatUptime;
1706
1745
  }
@@ -2075,6 +2114,7 @@ declare class GatewayServer implements IGatewayServer {
2075
2114
  private running;
2076
2115
  private connections;
2077
2116
  private gatewayAgent;
2117
+ private bindingLocks;
2078
2118
  constructor(config: GatewayServerConfig$1);
2079
2119
  private loadChannelPlugins;
2080
2120
  start(): Promise<void>;
@@ -2095,6 +2135,7 @@ declare class GatewayServer implements IGatewayServer {
2095
2135
  private dispatchToAgent;
2096
2136
  private getGatewayAgent;
2097
2137
  private dispatchToGatewayAgent;
2138
+ private resolveAndBindBackendSession;
2098
2139
  private buildChannelContext;
2099
2140
  private executeGatewayAgent;
2100
2141
  private handleAgentResult;
@@ -2600,6 +2641,61 @@ declare class WeChatPlugin extends BaseChannelPlugin {
2600
2641
  protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
2601
2642
  }
2602
2643
 
2644
+ interface WeixinBotConfig {
2645
+ stateDir?: string;
2646
+ baseUrl?: string;
2647
+ cdnBaseUrl?: string;
2648
+ maxMessageLength?: number;
2649
+ timeout?: number;
2650
+ }
2651
+ declare class WeixinPlugin extends BaseChannelPlugin {
2652
+ readonly id: string;
2653
+ readonly platform: "weixin";
2654
+ readonly name = "WeChat iLink";
2655
+ private botConfig;
2656
+ private account;
2657
+ private abortController;
2658
+ private processedMessageIds;
2659
+ private sentMessages;
2660
+ private retryState;
2661
+ private pollingStopped;
2662
+ constructor(id?: string);
2663
+ protected doStart(): Promise<void>;
2664
+ private resolveStateDir;
2665
+ protected doStop(): Promise<void>;
2666
+ protected doHealthCheck(): Promise<boolean>;
2667
+ send(message: GatewayMessage): Promise<string>;
2668
+ getCapabilities(): {
2669
+ supportsText: boolean;
2670
+ supportsMedia: boolean;
2671
+ supportsReply: boolean;
2672
+ supportsThread: boolean;
2673
+ supportsEdit: boolean;
2674
+ supportsDelete: boolean;
2675
+ supportsTyping: boolean;
2676
+ supportsBatchSend: boolean;
2677
+ supportsMarkdown: boolean;
2678
+ supportsHtml: boolean;
2679
+ supportsDeliveryReceipt: boolean;
2680
+ supportsReadReceipt: boolean;
2681
+ supportsSlashCommands: boolean;
2682
+ supportsNativeCommands: boolean;
2683
+ commandPrefix: string;
2684
+ maxMessageLength: number;
2685
+ maxMediaCount: number;
2686
+ };
2687
+ private resolveDownloadDir;
2688
+ private runPollLoop;
2689
+ private restartPollLoop;
2690
+ private handleWeixinMessage;
2691
+ private sendCommandReply;
2692
+ private parseContent;
2693
+ private resolveAttachmentToPath;
2694
+ private downloadUrlToLocal;
2695
+ sendTyping(userId: string): Promise<void>;
2696
+ protected buildSessionId(channelId: string, chatId: string, userId?: string): string;
2697
+ }
2698
+
2603
2699
  interface WebChatConfig {
2604
2700
  port: number;
2605
2701
  hostname: string;
@@ -2851,6 +2947,63 @@ declare function createChannelPlugin<TConfig = unknown, TProbe = unknown>(option
2851
2947
  declare const ChannelPluginRegistry: Record<string, new (id?: string) => ChannelPlugin>;
2852
2948
  declare function getSupportedPlatforms(): string[];
2853
2949
 
2950
+ declare function setStateDir(dir: string): void;
2951
+
2952
+ declare const WEIXIN_PLATFORM: PlatformType;
2953
+ interface EnsureUserOptions {
2954
+ userId: string;
2955
+ channelId?: string;
2956
+ displayName?: string;
2957
+ username?: string;
2958
+ aliases?: PlatformAliases;
2959
+ metadata?: Record<string, unknown>;
2960
+ }
2961
+ declare function ensureContact(opts: EnsureUserOptions): Promise<{
2962
+ contact: Contact;
2963
+ created: boolean;
2964
+ }>;
2965
+ declare function ensureSession(opts: EnsureUserOptions): Promise<{
2966
+ session: SerializableSession;
2967
+ created: boolean;
2968
+ }>;
2969
+ declare function ensureUser(opts: EnsureUserOptions): Promise<{
2970
+ contact: Contact;
2971
+ session: SerializableSession;
2972
+ created: {
2973
+ contact: boolean;
2974
+ session: boolean;
2975
+ };
2976
+ }>;
2977
+ declare function removeUser(userId: string, channelId?: string): Promise<{
2978
+ removed: {
2979
+ contact: boolean;
2980
+ session: boolean;
2981
+ };
2982
+ }>;
2983
+ declare function listWeixinContacts(): Promise<Contact[]>;
2984
+
2985
+ interface ChannelPermissionRequestParams {
2986
+ request_id: string;
2987
+ tool_name: string;
2988
+ description: string;
2989
+ input_preview: string;
2990
+ channel_context?: {
2991
+ source_server?: string;
2992
+ chat_id?: string;
2993
+ };
2994
+ }
2995
+
2996
+ interface WeixinServerDeps {
2997
+ enableConfigs(): void;
2998
+ initializeAnalyticsSink(): void;
2999
+ shutdownDatadog(): Promise<void>;
3000
+ shutdown1PEventLogging(): Promise<void>;
3001
+ logForDebugging(message: string): void;
3002
+ registerPermissionHandler(server: Server, handler: (request: ChannelPermissionRequestParams) => Promise<void>): void;
3003
+ }
3004
+
3005
+ declare function handleWeixinCli(args: string[], serverDeps?: WeixinServerDeps, version?: string): Promise<void>;
3006
+
2854
3007
  declare enum SdkEventType {
2855
3008
  SDK_SESSION_STATUS = "agent.status",
2856
3009
  SDK_ERROR = "sdk.error",
@@ -2876,7 +3029,7 @@ declare const SdkErrorSchema: z$1.ZodObject<{
2876
3029
  type SdkErrorProps = z$1.infer<typeof SdkErrorSchema>;
2877
3030
  declare const SdkSessionUpdateSchema: z$1.ZodObject<{
2878
3031
  sessionId: z$1.ZodString;
2879
- update: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
3032
+ sessionEvent: z$1.ZodUnknown;
2880
3033
  timestamp: z$1.ZodNumber;
2881
3034
  }, z$1.core.$strip>;
2882
3035
  type SdkSessionUpdateProps = z$1.infer<typeof SdkSessionUpdateSchema>;
@@ -2910,6 +3063,7 @@ declare class SdkEventBus {
2910
3063
  subscribeAll(callback: LocalEventCallback): () => void;
2911
3064
  publish(event: LocalEvent): Promise<void>;
2912
3065
  publishSync(event: LocalEvent): void;
3066
+ private collectCallbacks;
2913
3067
  subscriberCount(eventType?: SdkEventType): number;
2914
3068
  totalSubscribers(): number;
2915
3069
  hasSubscribers(eventType?: SdkEventType): boolean;
@@ -2925,8 +3079,11 @@ declare class SdkEventBridge {
2925
3079
  private started;
2926
3080
  private readonly sessionFilter?;
2927
3081
  private _cachedPrimaryAgents;
3082
+ private readonly _messageMetaCache;
2928
3083
  constructor(sdk: EasbotClient, localEventBus?: SdkEventBus, sessionFilter?: (sessionId: string) => boolean);
2929
- private pushEvent;
3084
+ private getMessageMeta;
3085
+ private clearMessageMetaCache;
3086
+ private pushSessionEvent;
2930
3087
  start(): Promise<void>;
2931
3088
  stop(): Promise<void>;
2932
3089
  isStarted(): boolean;
@@ -2958,9 +3115,12 @@ interface AgentMessage {
2958
3115
  thinking?: string;
2959
3116
  tools?: Array<{
2960
3117
  name: string;
3118
+ callId?: string;
3119
+ title?: string;
2961
3120
  status: 'completed' | 'error';
2962
3121
  output?: unknown;
2963
3122
  error?: string;
3123
+ input?: Record<string, unknown>;
2964
3124
  }>;
2965
3125
  metadata: {
2966
3126
  sessionId: string;
@@ -3012,10 +3172,14 @@ interface PartData {
3012
3172
  end?: number;
3013
3173
  };
3014
3174
  tool?: string;
3175
+ callId?: string;
3015
3176
  state?: {
3016
- status?: 'running' | 'completed' | 'error';
3177
+ status?: 'pending' | 'running' | 'completed' | 'error';
3178
+ input?: Record<string, unknown>;
3017
3179
  output?: unknown;
3018
3180
  error?: string;
3181
+ title?: string;
3182
+ metadata?: Record<string, unknown>;
3019
3183
  };
3020
3184
  tokens?: {
3021
3185
  input: number;
@@ -3023,7 +3187,7 @@ interface PartData {
3023
3187
  reasoning: number;
3024
3188
  };
3025
3189
  }
3026
- declare class SdkMessagetCollector {
3190
+ declare class SdkMessageCollector {
3027
3191
  private filterConfig;
3028
3192
  events: SessionEvent[];
3029
3193
  isComplete: boolean;
@@ -3041,6 +3205,7 @@ declare class SdkMessagetCollector {
3041
3205
  hasTextEndReady(): boolean;
3042
3206
  isTextOnlyComplete(): boolean;
3043
3207
  resetForNextMessage(): void;
3208
+ getSessionStatus(): 'idle' | 'busy' | 'retry' | 'error';
3044
3209
  getCurrentMessageId(): string;
3045
3210
  assembleMessage(): AgentMessage;
3046
3211
  reset(): void;
@@ -3059,4 +3224,4 @@ declare function initLog(options: {
3059
3224
  level?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
3060
3225
  }): Promise<void>;
3061
3226
 
3062
- export { type AgentClientFilterConfig, type AgentDeregisterMessage, type AgentHealthStatus, type AgentHeartbeat, type AgentHeartbeatSyncMessage, type AgentListRequestMessage, type AgentListResponseMessage, type AgentMessage, type AgentRegisterMessage, type AgentRegistration, type AgentRegistrationRequest, AgentRegistry, type AgentRegistryConfig, AgentRegistryConfigSchema, type AgentRegistryStats, type AgentSelectionOptions, type AgentSelectionRecord, type AgentSelectionStrategy, type AgentStatusChangeMessage, type AgentSyncConfig, AgentSyncConfigSchema, type AgentSyncInfo, AgentSyncManager, type AuthConfig, AuthConfigSchema, type AuthResult, BaseChannelPlugin, type CancelEvent, type CancelEventHandler, type ChannelConfig, ChannelConfigSchema, type ChannelEvent, type ChannelEventType, type ChannelHealth, type ChannelPlugin, ChannelPluginLoader, ChannelPluginRegistry, type SessionConfig as ChannelSessionConfig, type ChannelStatus, type ChannelStatusType, type ChannelType, type CircuitBreakerConfig, CircuitBreakerConfigSchema, type ClientInterruptMessage, type ClientMessage, type ClientMessageMessage, type ClientMessageType, type ClientPingMessage, type ClientReleaseSubscriptionMessage, type ClientSubscribeMessage, type ClientSubscription, type ClientUnsubscribeMessage, type ConflictResolutionStrategy, type ConnectionCloser, type ConnectionFactory, type ConnectionHealthChecker, type ConnectionPoolConfig, ConnectionPoolConfigSchema, type ConnectionPoolEvent, type ConnectionPoolEventCallback, type ConnectionPoolEventType, type ConnectionPoolStats, type ConnectionState, type CreateSessionRequest, type CreateSessionResponse, DEBUG_AGENT_FILTER, DEFAULT_AGENT_FILTER, DEFAULT_AGENT_REGISTRY_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TOKEN_AUTH_CONFIG, DEFAULT_WEBSOCKET_SERVER_CONFIG, type DiscordBotConfig, DiscordPlugin, type FeishuBotConfig, type FeishuChannelConfig, FeishuChannelConfigSchema, FeishuPlugin, Gateway, type GatewayClientConfig, GatewayClientConfigSchema, type GatewayClusterConfig, GatewayClusterConfigSchema, type GatewayConfig, GatewayConfigSchema, type GatewayNodeConfig, type GatewayNodeInfo, GatewayServer, type GatewayServerConfig, GatewayServerConfigSchema, type GatewaySession, GatewaySessionManager, type HTTPSConfig, HTTPSConfigSchema, type HealthCheckResponse, type IAuthProvider, type MessageHandler, type MessagePriority, type MessageQueueConfig, MessageQueueConfigSchema, type MessageRecord, MessageRouter, type MessageStatus, MessageStore, type MessageStoreConfig, type NostrBotConfig, type NostrChannelConfig, NostrChannelConfigSchema, NostrPlugin, type OAuth2AuthConfig, type PluginLoaderConfig, type PooledConnection, type PushEventType, type RouteResult, type RoutingConfig, SdkEventBridge, SdkEventBus, SdkEventType, SdkMessagetCollector, type SdkSessionStatusProps, type SendMessageRequest, type SendMessageResponse, type SerializableSession, type ServerConnectedMessage, type ServerErrorMessage, type ServerEventMessage, type ServerInterruptedMessage, type ServerMessage, type ServerMessageType, type ServerPongMessage, type ServerResponseMessage, type ServerStatusResponse, type ServerSubscribedMessage, type ServerSubscriptionReleasedMessage, type ServerUnsubscribedMessage, type SessionChannelInfo, type SessionConfig$1 as SessionConfig, SessionConfigSchema, type SessionContext, type SessionEventPayload, type SessionEventType$1 as SessionEventType, type SessionFilter, type SessionManagerConfig, type SessionResetPolicy, type SessionState, type SessionStatusType, SessionStore, type SessionStoreConfig, type SignalBotConfig, type SignalChannelConfig, SignalChannelConfigSchema, SignalPlugin, type SlackBotConfig, type SlackChannelConfig, SlackChannelConfigSchema, SlackPlugin, type Subscriber, type SubscriberConnection, type SubscriberType, type Subscription, type SubscriptionOptions, type SubscriptionsResponse, type SyncConfig, type SyncMessage, type SyncMode, type SyncState, type SyncStats, type TelegramBotConfig, type TelegramChannelConfig, TelegramChannelConfigSchema, TelegramPlugin, type TokenAuthConfig, type TokenAuthItem, type TokenConfig, type WeChatBotConfig, type WeChatChannelConfig, WeChatChannelConfigSchema, WeChatPlugin, type WebChatChannelConfig, WebChatChannelConfigSchema, type WebChatConfig, WebChatPlugin, type WebSocketConnectionInfo, type WebSocketConnectionState, type WebSocketMessage, type WebSocketMessageBase, clearConfigCache, convertToGatewayMessage, createChannelPlugin, createDefaultSessionState, createGatewayMessage, createTextMessage, generateSessionId, generateSubscriptionId, getAgentAdapter, getAgentRegistryConfig, getAuthConfig, getChannelConfig, getCircuitBreakerConfig, getClusterConfig, getConfig, getConfigDirectory, getConnectionPoolConfig, getDefaultAgent, getGatewayClientConfig, getGatewayClientUrl, getHTTPSConfig, getLogLevel, getMessageQueueConfig, getServerConfig, getSessionConfig, getSupportedPlatforms, hasAgentAdapter, initLog, isConfigLoaded, loadConfig, parsePartialConfig, requireAgentAdapter, setAgentAdapter, validateConfig };
3227
+ export { type AgentClientFilterConfig, type AgentDeregisterMessage, type AgentHealthStatus, type AgentHeartbeat, type AgentHeartbeatSyncMessage, type AgentListRequestMessage, type AgentListResponseMessage, type AgentMessage, type AgentRegisterMessage, type AgentRegistration, type AgentRegistrationRequest, AgentRegistry, type AgentRegistryConfig, AgentRegistryConfigSchema, type AgentRegistryStats, type AgentSelectionOptions, type AgentSelectionRecord, type AgentSelectionStrategy, type AgentStatusChangeMessage, type AgentSyncConfig, AgentSyncConfigSchema, type AgentSyncInfo, AgentSyncManager, type AuthConfig, AuthConfigSchema, type AuthResult, BaseChannelPlugin, type CancelEvent, type CancelEventHandler, type ChannelConfig, ChannelConfigSchema, type ChannelEvent, type ChannelEventType, type ChannelHealth, type ChannelPlugin, ChannelPluginLoader, ChannelPluginRegistry, type SessionConfig as ChannelSessionConfig, type ChannelStatus, type ChannelStatusType, type ChannelType, type CircuitBreakerConfig, CircuitBreakerConfigSchema, type ClientInterruptMessage, type ClientMessage, type ClientMessageMessage, type ClientMessageType, type ClientPingMessage, type ClientReleaseSubscriptionMessage, type ClientSubscribeMessage, type ClientSubscription, type ClientUnsubscribeMessage, type ConflictResolutionStrategy, type ConnectionCloser, type ConnectionFactory, type ConnectionHealthChecker, type ConnectionPoolConfig, ConnectionPoolConfigSchema, type ConnectionPoolEvent, type ConnectionPoolEventCallback, type ConnectionPoolEventType, type ConnectionPoolStats, type ConnectionState, type CreateSessionRequest, type CreateSessionResponse, DEBUG_AGENT_FILTER, DEFAULT_AGENT_FILTER, DEFAULT_AGENT_REGISTRY_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_SYNC_CONFIG, DEFAULT_TOKEN_AUTH_CONFIG, DEFAULT_WEBSOCKET_SERVER_CONFIG, type DiscordBotConfig, DiscordPlugin, type EnsureUserOptions, type FeishuBotConfig, type FeishuChannelConfig, FeishuChannelConfigSchema, FeishuPlugin, Gateway, type GatewayClientConfig, GatewayClientConfigSchema, type GatewayClusterConfig, GatewayClusterConfigSchema, type GatewayConfig, GatewayConfigSchema, type GatewayNodeConfig, type GatewayNodeInfo, GatewayServer, type GatewayServerConfig, GatewayServerConfigSchema, type GatewaySession, GatewaySessionManager, type HTTPSConfig, HTTPSConfigSchema, type HealthCheckResponse, type IAuthProvider, type MessageHandler, type MessagePriority, type MessageQueueConfig, MessageQueueConfigSchema, type MessageRecord, MessageRouter, type MessageStatus, MessageStore, type MessageStoreConfig, type NostrBotConfig, type NostrChannelConfig, NostrChannelConfigSchema, NostrPlugin, type OAuth2AuthConfig, type PartData, type PluginLoaderConfig, type PooledConnection, type PushEventType, type RouteResult, type RoutingConfig, SdkEventBridge, SdkEventBus, SdkEventType, SdkMessageCollector, type SdkSessionStatusProps, type SendMessageRequest, type SendMessageResponse, type SerializableSession, type ServerConnectedMessage, type ServerErrorMessage, type ServerEventMessage, type ServerInterruptedMessage, type ServerMessage, type ServerMessageType, type ServerPongMessage, type ServerResponseMessage, type ServerStatusResponse, type ServerSubscribedMessage, type ServerSubscriptionReleasedMessage, type ServerUnsubscribedMessage, type SessionChannelInfo, type SessionConfig$1 as SessionConfig, SessionConfigSchema, type SessionContext, type SessionEvent, type SessionEventPayload, type SessionEventType$1 as SessionEventType, type SessionFilter, type SessionManagerConfig, type SessionResetPolicy, type SessionState, type SessionStatusType, SessionStore, type SessionStoreConfig, type SignalBotConfig, type SignalChannelConfig, SignalChannelConfigSchema, SignalPlugin, type SlackBotConfig, type SlackChannelConfig, SlackChannelConfigSchema, SlackPlugin, type Subscriber, type SubscriberConnection, type SubscriberType, type Subscription, type SubscriptionOptions, type SubscriptionsResponse, type SyncConfig, type SyncMessage, type SyncMode, type SyncState, type SyncStats, type TelegramBotConfig, type TelegramChannelConfig, TelegramChannelConfigSchema, TelegramPlugin, type TokenAuthConfig, type TokenAuthItem, type TokenConfig, WEIXIN_PLATFORM, type WeChatBotConfig, type WeChatChannelConfig, WeChatChannelConfigSchema, WeChatPlugin, type WebChatChannelConfig, WebChatChannelConfigSchema, type WebChatConfig, WebChatPlugin, type WebSocketConnectionInfo, type WebSocketConnectionState, type WebSocketMessage, type WebSocketMessageBase, type WeixinBotConfig, WeixinPlugin, type WeixinServerDeps, clearConfigCache, convertToGatewayMessage, createChannelPlugin, createDefaultSessionState, createGatewayMessage, createTextMessage, ensureContact, ensureSession, ensureUser, generateSessionId, generateSubscriptionId, getAgentAdapter, getAgentRegistryConfig, getAuthConfig, getChannelConfig, getCircuitBreakerConfig, getClusterConfig, getConfig, getConfigDirectory, getConnectionPoolConfig, getDefaultAgent, getGatewayClientConfig, getGatewayClientUrl, getHTTPSConfig, getLogLevel, getMessageQueueConfig, getServerConfig, getSessionConfig, getSupportedPlatforms, handleWeixinCli, hasAgentAdapter, initLog, isConfigLoaded, listWeixinContacts, loadConfig, parsePartialConfig, removeUser, requireAgentAdapter, setAgentAdapter, validateConfig, setStateDir as weixinSetStateDir };