@sleep2agi/agent-network 2.3.0-preview.192 → 2.3.0-preview.194
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/im/feishu/worker.js +97 -97
- package/dist/src/node-server.js +8 -8
- package/dist/src/opencode-agent-node-pair.d.ts +6 -6
- package/dist/src/private-state.d.ts +8 -0
- package/dist/src/windows-rename-retry.d.ts +13 -0
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x58d40f=a0_0x13e3;function a0_0x469b(){const _0x636664=['idle','message','send','emit','text','tools/call','network_id','token','210RSFYig','delivered','abort','url','disconnected','ack_inbox','networkId','task.send.start','resumeId','parentTaskId','completed','missing_task_id','\x20lifecycle=','send_reply','lifecycle_tracking','Bearer\x20','failed','inbox\x20error:\x20','sseAbort','cwd','task.replied','send_rejected','connect','startsWith','/events/','alias','running','error_message','1783784NNNWfi','send_task','send_failed','agent','now','normal','result','SSE\x20failed:\x20','error','getAllStatus','processInbox','task.expired','task_id','string','394974TFaqcR','application/json','get_inbox','slice','data:\x20','log','messages','connected','\x20transport=','replace','task','mcp_http','task.ack','sdk-','autoConnect','Authorization','decode',']\x20[commhub:','\x20parent_task_id=','type','unknown\x20error','\x20network_id=','match','SSE\x20connected','error_code','POST','<missing>','parent_task_id','duration_ms','sending','21uEvAZi','transport','\x20to=','pop','min','2cudiIf','connectSSE','not_tracked','from_session','task.started','\x20from=','187032MRtzoB','<unknown>','heartbeatInterval','fromAlias','heartbeatTimer','broadcast','to_alias','parse','\x20error=','new_message','lifecycleTracking','catch','1123936gooaDp','status','call','content','text/event-stream','<pending>','1901520zzkpsN','[commhub:task]\x20','offline','reconnectDelay','message_id','CommHub\x20rejected\x20task','registered','3159295vPMghA','\x20task_id=','416828cZpOgW','name','CommHub\x20response\x20omitted\x20task_id','getReader','report_status','split'];a0_0x469b=function(){return _0x636664;};return a0_0x469b();}(function(_0x37a6c3,_0x27e9df){const _0x1055c1=a0_0x13e3,_0x53cda5=_0x37a6c3();while(!![]){try{const _0x5dd0bf=-parseInt(_0x1055c1(0x203))/0x1*(-parseInt(_0x1055c1(0x1e2))/0x2)+parseInt(_0x1055c1(0x1fa))/0x3+-parseInt(_0x1055c1(0x1b1))/0x4+-parseInt(_0x1055c1(0x201))/0x5+parseInt(_0x1055c1(0x1e8))/0x6+parseInt(_0x1055c1(0x1dd))/0x7*(-parseInt(_0x1055c1(0x1f4))/0x8)+parseInt(_0x1055c1(0x1bf))/0x9*(parseInt(_0x1055c1(0x195))/0xa);if(_0x5dd0bf===_0x27e9df)break;else _0x53cda5['push'](_0x53cda5['shift']());}catch(_0x1dbe5a){_0x53cda5['push'](_0x53cda5['shift']());}}}(a0_0x469b,0x7b165));import{EventEmitter as a0_0x2bae8d}from'events';import{hostname as a0_0x25084e}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x33f97b,_0x2f32e0)=>(_0x33f97b??_0x2f32e0)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x1725fd){const _0x21a0bd=a0_0x13e3;return(_0x1725fd instanceof Error?_0x1725fd[_0x21a0bd(0x18e)]:String(_0x1725fd??_0x21a0bd(0x1d3)))[_0x21a0bd(0x1c8)](K,'[REDACTED]')[_0x21a0bd(0x1c8)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x379929,_0x697e0a=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0xb5a59e=a0_0x13e3;if(_0x697e0a)return JSON['stringify'](_0x379929);let _0x1ab59e=L(_0x379929[_0xb5a59e(0x1da)],_0xb5a59e(0x1d9)),_0x5d9e9e=L(_0x379929[_0xb5a59e(0x1bd)],_0xb5a59e(0x1f9)),_0x1af058=_0x379929[_0xb5a59e(0x1d7)]?_0xb5a59e(0x1f0)+_0x379929['error_code']+':'+(_0x379929[_0xb5a59e(0x1b0)]??''):'';return _0xb5a59e(0x1fb)+_0x379929[_0xb5a59e(0x1f5)]+_0xb5a59e(0x1e7)+L(_0x379929['from_alias'],_0xb5a59e(0x1e9))+_0xb5a59e(0x1df)+L(_0x379929[_0xb5a59e(0x1ee)],_0xb5a59e(0x1e9))+_0xb5a59e(0x202)+_0x5d9e9e+_0xb5a59e(0x1d1)+_0x1ab59e+_0xb5a59e(0x1d4)+L(_0x379929[_0xb5a59e(0x193)],_0xb5a59e(0x1e9))+_0xb5a59e(0x1c7)+_0x379929[_0xb5a59e(0x1de)]+'\x20duration_ms='+_0x379929[_0xb5a59e(0x1db)]+_0xb5a59e(0x1a1)+_0x379929[_0xb5a59e(0x1a3)]+_0x1af058;}function U(_0x4dd518){const _0x158244=a0_0x13e3;return{'event':{'sending':_0x158244(0x19c),'delivered':'task.send.delivered','failed':'task.send.failed','acked':_0x158244(0x1cb),'started':_0x158244(0x1e6),'replied':_0x158244(0x1a9),'expired':_0x158244(0x1bc)}[_0x4dd518[_0x158244(0x1f5)]],..._0x4dd518};}function j(_0x4f2217){const _0x5a04b9=a0_0x13e3;let _0x194e14=_0x4f2217?.['task_id']||_0x4f2217?.[_0x5a04b9(0x1fe)]||_0x4f2217?.['id'];if(_0x194e14)return String(_0x194e14);let _0x257e90=_0x4f2217?.['content']?.[0x0]?.[_0x5a04b9(0x191)];if(typeof _0x257e90!==_0x5a04b9(0x1be))return null;try{let _0x5e14d4=JSON['parse'](_0x257e90);return _0x5e14d4?.[_0x5a04b9(0x1bd)]||_0x5e14d4?.[_0x5a04b9(0x1fe)]||_0x5e14d4?.['id']||null;}catch{return null;}}async function X(_0x3bab27,_0x47cb84){const _0x20b2a1=a0_0x13e3;let _0x217e40=_0x47cb84[_0x20b2a1(0x1b5)]??Date[_0x20b2a1(0x1b5)],_0x5bfed2=_0x217e40(),_0x2c8099=(_0x2c2410,_0x45a8bf,_0x3f6a57,_0x257051)=>{const _0x2601dd=_0x20b2a1;_0x47cb84[_0x2601dd(0x1c4)](O(U({'from_alias':_0x3bab27[_0x2601dd(0x1eb)],'to_alias':_0x3bab27['toAlias'],'task_id':_0x45a8bf,'parent_task_id':_0x3bab27['parentTaskId'],'network_id':_0x3bab27['networkId'],'transport':_0x3bab27[_0x2601dd(0x1de)],'status':_0x2c2410,'duration_ms':_0x217e40()-_0x5bfed2,'lifecycle_tracking':_0x3bab27[_0x2601dd(0x1f2)],..._0x3f6a57!==void 0x0?{'error_code':_0x257051||_0x2601dd(0x1b3),'error_message':N(_0x3f6a57)}:{}})));};_0x2c8099(_0x20b2a1(0x1dc),null);try{let _0x340574=await _0x47cb84[_0x20b2a1(0x18f)](),_0x52079e=j(_0x340574);if(_0x52079e)_0x2c8099(_0x20b2a1(0x196),_0x52079e);else{if(_0x340574?.['ok']===!0x1||_0x340574?.[_0x20b2a1(0x1b9)])_0x2c8099(_0x20b2a1(0x1a5),_0x52079e,_0x340574?.['error']||_0x20b2a1(0x1ff),_0x20b2a1(0x1aa));else _0x2c8099(_0x20b2a1(0x1a5),null,_0x20b2a1(0x189),_0x20b2a1(0x1a0));}return _0x340574;}catch(_0x13490a){throw _0x2c8099(_0x20b2a1(0x1a5),null,_0x13490a,_0x20b2a1(0x1b3)),_0x13490a;}}async function Y(_0x2cf2d8,_0x6b941e){const _0x254719=a0_0x13e3;return X({'fromAlias':_0x2cf2d8[_0x254719(0x1eb)],'toAlias':_0x2cf2d8[_0x254719(0x1ae)],'parentTaskId':_0x2cf2d8[_0x254719(0x19e)]||null,'networkId':_0x2cf2d8[_0x254719(0x19b)]||null,'transport':_0x254719(0x1ca),'lifecycleTracking':_0x254719(0x1e4)},_0x6b941e);}class $ extends a0_0x2bae8d{[a0_0x58d40f(0x198)];[a0_0x58d40f(0x1ae)];[a0_0x58d40f(0x194)];[a0_0x58d40f(0x1b4)];['resumeId'];[a0_0x58d40f(0x1ea)];['reconnectDelay'];[a0_0x58d40f(0x1ec)];[a0_0x58d40f(0x1a7)];[a0_0x58d40f(0x1af)]=!0x1;constructor(_0x41fd26){const _0x53a6c1=a0_0x58d40f;super();if(this[_0x53a6c1(0x198)]=_0x41fd26['url'][_0x53a6c1(0x1c8)](/\/$/,''),this[_0x53a6c1(0x1ae)]=_0x41fd26[_0x53a6c1(0x1ae)],this[_0x53a6c1(0x194)]=_0x41fd26[_0x53a6c1(0x194)],this[_0x53a6c1(0x1b4)]=_0x41fd26[_0x53a6c1(0x1b4)]||'sdk',this[_0x53a6c1(0x19d)]=_0x53a6c1(0x1cc)+_0x41fd26[_0x53a6c1(0x1ae)]+'-'+Date[_0x53a6c1(0x1b5)]()['toString'](0x24),this[_0x53a6c1(0x1ea)]=_0x41fd26['heartbeatInterval']??0x2bf20,this[_0x53a6c1(0x1fd)]=_0x41fd26[_0x53a6c1(0x1fd)]??0xbb8,_0x41fd26[_0x53a6c1(0x1cd)]!==!0x1)this[_0x53a6c1(0x1ab)]();}[a0_0x58d40f(0x1c4)](_0x37455b){const _0x561c5f=a0_0x58d40f;console[_0x561c5f(0x1c4)]('['+new Date()['toTimeString']()[_0x561c5f(0x1c2)](0x0,0x8)+_0x561c5f(0x1d0)+this[_0x561c5f(0x1ae)]+']\x20'+_0x37455b);}async[a0_0x58d40f(0x1f6)](_0x22ae2a,_0x1ee200){const _0x353c3f=a0_0x58d40f;let _0x59b0fc={'Content-Type':_0x353c3f(0x1c0),'Accept':'application/json,\x20text/event-stream'};if(this[_0x353c3f(0x194)])_0x59b0fc[_0x353c3f(0x1ce)]='Bearer\x20'+this[_0x353c3f(0x194)];let _0x37adf5=await(await fetch(this[_0x353c3f(0x198)]+'/mcp',{'method':_0x353c3f(0x1d8),'headers':_0x59b0fc,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x353c3f(0x1b5)](),'method':_0x353c3f(0x192),'params':{'name':_0x22ae2a,'arguments':_0x1ee200}})}))['text'](),_0x476b91=_0x37adf5[_0x353c3f(0x1d5)](/data: (.+)/),_0x33c69c=_0x476b91?JSON[_0x353c3f(0x1ef)](_0x476b91[0x1]):JSON[_0x353c3f(0x1ef)](_0x37adf5),_0x3180e9=_0x33c69c?.[_0x353c3f(0x1b7)]?.[_0x353c3f(0x1f7)]?.[0x0]?.[_0x353c3f(0x191)];return _0x3180e9?JSON[_0x353c3f(0x1ef)](_0x3180e9):_0x33c69c;}async['connect'](){const _0x529e64=a0_0x58d40f;if(this[_0x529e64(0x1af)])return;this[_0x529e64(0x1af)]=!0x0,await this[_0x529e64(0x1f5)](_0x529e64(0x18d)),this[_0x529e64(0x1c4)](_0x529e64(0x200)),this[_0x529e64(0x1ec)]=setInterval(()=>{const _0x22dbf5=_0x529e64;this[_0x22dbf5(0x1f5)](_0x22dbf5(0x18d))['catch'](_0x24ac65=>this['log']('heartbeat\x20failed:\x20'+_0x24ac65['message']));},this[_0x529e64(0x1ea)]),this[_0x529e64(0x1e3)]();}async['disconnect'](){const _0x45817a=a0_0x58d40f;if(this['running']=!0x1,this['sseAbort']?.[_0x45817a(0x197)](),this[_0x45817a(0x1ec)])clearInterval(this[_0x45817a(0x1ec)]);await this[_0x45817a(0x1f5)](_0x45817a(0x1fc))[_0x45817a(0x1f3)](()=>{}),this[_0x45817a(0x1c4)]('disconnected');}async[a0_0x58d40f(0x18f)](_0x4256cf,_0x5a2a49,_0x1062b5=a0_0x58d40f(0x1b6)){const _0xb046ce=a0_0x58d40f;return Y({'alias':_0x4256cf,'fromAlias':this[_0xb046ce(0x1ae)]},{'log':_0x2d284c=>console[_0xb046ce(0x1c4)](_0x2d284c),'send':()=>this['call'](_0xb046ce(0x1b2),{'alias':_0x4256cf,'task':_0x5a2a49,'priority':_0x1062b5,'from_session':this[_0xb046ce(0x1ae)]})});}async[a0_0x58d40f(0x18e)](_0x3914c9,_0x3d0284){const _0x36bae8=a0_0x58d40f;return this[_0x36bae8(0x1f6)]('send_message',{'alias':_0x3914c9,'message':_0x3d0284,'from_session':this[_0x36bae8(0x1ae)]});}async['reply'](_0x134b28,_0x472227,_0x2c044d=a0_0x58d40f(0x19f)){const _0x22a9e2=a0_0x58d40f;return this['call'](_0x22a9e2(0x1a2),{'in_reply_to':_0x134b28,'text':_0x472227,'status':_0x2c044d});}async[a0_0x58d40f(0x1f5)](_0x578949,_0x37679b){const _0x12b1b7=a0_0x58d40f;return this['call'](_0x12b1b7(0x18b),{'resume_id':this[_0x12b1b7(0x19d)],'alias':this['alias'],'status':_0x578949,'server':a0_0x25084e(),'hostname':a0_0x25084e(),'agent':this[_0x12b1b7(0x1b4)],'project_dir':process[_0x12b1b7(0x1a8)](),..._0x37679b});}async[a0_0x58d40f(0x1ba)](){return this['call']('get_all_status',{});}async[a0_0x58d40f(0x1ed)](_0x574ab5,_0x4ab8cc){const _0x19e089=a0_0x58d40f;return this['call'](_0x19e089(0x1ed),{'message':_0x574ab5,'filter_server':_0x4ab8cc?.['server'],'filter_status':_0x4ab8cc?.[_0x19e089(0x1f5)]});}async[a0_0x58d40f(0x1e3)](){const _0x23050e=a0_0x58d40f;let _0x2fd041=encodeURIComponent(this[_0x23050e(0x1ae)]),_0x5758a3=this[_0x23050e(0x198)]+_0x23050e(0x1ad)+_0x2fd041,_0x4067fb=this[_0x23050e(0x1fd)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x3c56ac={'Accept':_0x23050e(0x1f8)};if(this[_0x23050e(0x194)])_0x3c56ac['Authorization']=_0x23050e(0x1a4)+this[_0x23050e(0x194)];let _0x2f27cb=await fetch(_0x5758a3,{'headers':_0x3c56ac,'signal':this[_0x23050e(0x1a7)]['signal']});if(!_0x2f27cb['ok']||!_0x2f27cb['body']){this[_0x23050e(0x1c4)](_0x23050e(0x1b8)+_0x2f27cb[_0x23050e(0x1f5)]),await this['sleep'](_0x4067fb),_0x4067fb=Math[_0x23050e(0x1e1)](_0x4067fb*1.5,0xea60);continue;}_0x4067fb=this[_0x23050e(0x1fd)];let _0x49e03e=_0x2f27cb['body'][_0x23050e(0x18a)](),_0x13201e=new TextDecoder(),_0x328f6e='';while(this[_0x23050e(0x1af)]){let {done:_0x2c28ab,value:_0x4d0c67}=await _0x49e03e['read']();if(_0x2c28ab)break;_0x328f6e+=_0x13201e[_0x23050e(0x1cf)](_0x4d0c67,{'stream':!0x0});let _0x52f9d1=_0x328f6e[_0x23050e(0x18c)]('\x0a');_0x328f6e=_0x52f9d1[_0x23050e(0x1e0)]()||'';for(let _0x570f87 of _0x52f9d1){if(!_0x570f87[_0x23050e(0x1ac)](_0x23050e(0x1c3)))continue;try{let _0x4a416a=JSON[_0x23050e(0x1ef)](_0x570f87[_0x23050e(0x1c2)](0x6));if(_0x4a416a[_0x23050e(0x1d2)]===_0x23050e(0x1c6)){this[_0x23050e(0x1c4)](_0x23050e(0x1d6)),this['emit']('connected');continue;}if(_0x4a416a[_0x23050e(0x1d2)]==='new_task'||_0x4a416a[_0x23050e(0x1d2)]===_0x23050e(0x1f1)||_0x4a416a['type']==='broadcast')await this[_0x23050e(0x1bb)]();}catch{}}}}catch(_0xfb9588){if(_0xfb9588[_0x23050e(0x204)]==='AbortError')break;this[_0x23050e(0x190)](_0x23050e(0x1b9),_0xfb9588),this[_0x23050e(0x1c4)]('SSE\x20error:\x20'+_0xfb9588[_0x23050e(0x18e)]);}if(this[_0x23050e(0x1af)])this[_0x23050e(0x190)](_0x23050e(0x199)),this[_0x23050e(0x1c4)]('SSE\x20reconnecting\x20in\x20'+_0x4067fb/0x3e8+'s...'),await this['sleep'](_0x4067fb),_0x4067fb=Math[_0x23050e(0x1e1)](_0x4067fb*1.5,0xea60);}}async[a0_0x58d40f(0x1bb)](){const _0x53b637=a0_0x58d40f;try{let _0x4dc42d=(await this[_0x53b637(0x1f6)](_0x53b637(0x1c1),{'alias':this[_0x53b637(0x1ae)],'limit':0xa}))?.[_0x53b637(0x1c5)]||[];for(let _0x357b0f of _0x4dc42d)await this[_0x53b637(0x1f6)](_0x53b637(0x19a),{'alias':this[_0x53b637(0x1ae)],'message_id':_0x357b0f['id']}),this[_0x53b637(0x1c4)]('←\x20'+_0x357b0f[_0x53b637(0x1e5)]+':\x20'+_0x357b0f[_0x53b637(0x1f7)]['slice'](0x0,0x3c)),this['emit'](_0x53b637(0x1c9),_0x357b0f),this['emit'](_0x53b637(0x18e),_0x357b0f);}catch(_0x21fd77){this['log'](_0x53b637(0x1a6)+_0x21fd77[_0x53b637(0x18e)]);}}['sleep'](_0x17c109){return new Promise(_0x4d7439=>setTimeout(_0x4d7439,_0x17c109));}}function a0_0x13e3(_0x26385e,_0x24962e){_0x26385e=_0x26385e-0x189;const _0x469b51=a0_0x469b();let _0x13e3f6=_0x469b51[_0x26385e];return _0x13e3f6;}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x2672d9=a0_0x80b9;(function(_0x43523d,_0x21f408){const _0x5a4322=a0_0x80b9,_0xd03e95=_0x43523d();while(!![]){try{const _0x3927b1=-parseInt(_0x5a4322(0x269))/0x1*(parseInt(_0x5a4322(0x1fc))/0x2)+-parseInt(_0x5a4322(0x259))/0x3*(-parseInt(_0x5a4322(0x23d))/0x4)+-parseInt(_0x5a4322(0x1f5))/0x5+-parseInt(_0x5a4322(0x205))/0x6+-parseInt(_0x5a4322(0x24a))/0x7+-parseInt(_0x5a4322(0x260))/0x8+parseInt(_0x5a4322(0x1fa))/0x9*(parseInt(_0x5a4322(0x1ff))/0xa);if(_0x3927b1===_0x21f408)break;else _0xd03e95['push'](_0xd03e95['shift']());}catch(_0x1cf0e9){_0xd03e95['push'](_0xd03e95['shift']());}}}(a0_0xcafd,0x3ba01));import{EventEmitter as a0_0x4c7d84}from'events';import{hostname as a0_0x11d06b}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x12ee79,_0x5bc061)=>(_0x12ee79??_0x5bc061)[a0_0x2672d9(0x230)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2672d9(0x1f9)](0x0,0xf0);function N(_0x4023ba){const _0x276d15=a0_0x2672d9;return(_0x4023ba instanceof Error?_0x4023ba[_0x276d15(0x228)]:String(_0x4023ba??_0x276d15(0x264)))['replace'](K,_0x276d15(0x23f))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x276d15(0x1f9)](0x0,0xf0);}function a0_0x80b9(_0x1b888a,_0x3c5536){_0x1b888a=_0x1b888a-0x1ef;const _0xcafda0=a0_0xcafd();let _0x80b99f=_0xcafda0[_0x1b888a];return _0x80b99f;}function O(_0x527f8a,_0x40f579=process.env.ANET_TASK_TRACE_FORMAT===a0_0x2672d9(0x237)){const _0x5e2b02=a0_0x2672d9;if(_0x40f579)return JSON[_0x5e2b02(0x20e)](_0x527f8a);let _0x11c25f=L(_0x527f8a[_0x5e2b02(0x20c)],'<missing>'),_0x3560d4=L(_0x527f8a[_0x5e2b02(0x24c)],_0x5e2b02(0x24f)),_0x58a5db=_0x527f8a[_0x5e2b02(0x241)]?_0x5e2b02(0x22e)+_0x527f8a[_0x5e2b02(0x241)]+':'+(_0x527f8a[_0x5e2b02(0x252)]??''):'';return _0x5e2b02(0x263)+_0x527f8a['status']+_0x5e2b02(0x26a)+L(_0x527f8a[_0x5e2b02(0x245)],_0x5e2b02(0x239))+'\x20to='+L(_0x527f8a[_0x5e2b02(0x22c)],_0x5e2b02(0x239))+_0x5e2b02(0x202)+_0x3560d4+_0x5e2b02(0x20b)+_0x11c25f+'\x20network_id='+L(_0x527f8a['network_id'],_0x5e2b02(0x239))+_0x5e2b02(0x20a)+_0x527f8a['transport']+_0x5e2b02(0x201)+_0x527f8a[_0x5e2b02(0x254)]+_0x5e2b02(0x20d)+_0x527f8a['lifecycle_tracking']+_0x58a5db;}function U(_0x5755a0){const _0x319fce=a0_0x2672d9;return{'event':{'sending':_0x319fce(0x24e),'delivered':_0x319fce(0x225),'failed':_0x319fce(0x266),'acked':_0x319fce(0x25f),'started':_0x319fce(0x24b),'replied':_0x319fce(0x265),'expired':_0x319fce(0x23b)}[_0x5755a0[_0x319fce(0x1fb)]],..._0x5755a0};}function j(_0x27d539){const _0x39ccc3=a0_0x2672d9;let _0x404887=_0x27d539?.[_0x39ccc3(0x24c)]||_0x27d539?.[_0x39ccc3(0x250)]||_0x27d539?.['id'];if(_0x404887)return String(_0x404887);let _0x586282=_0x27d539?.[_0x39ccc3(0x219)]?.[0x0]?.['text'];if(typeof _0x586282!=='string')return null;try{let _0x23459a=JSON[_0x39ccc3(0x224)](_0x586282);return _0x23459a?.[_0x39ccc3(0x24c)]||_0x23459a?.['message_id']||_0x23459a?.['id']||null;}catch{return null;}}function a0_0xcafd(){const _0x53a80e=['244030LpvACl','heartbeatInterval','application/json,\x20text/event-stream','410cHYyKZ','running','\x20duration_ms=','\x20task_id=','SSE\x20error:\x20','failed','1640568zSrkOF','send_rejected','disconnected','missing_task_id','SSE\x20connected','\x20transport=','\x20parent_task_id=','parent_task_id','\x20lifecycle=','stringify','messages','heartbeat\x20failed:\x20','text','sending','server','normal','min','Bearer\x20','/mcp','read','content','sdk-','processInbox','match','reply','offline','toTimeString','registered','AbortError',']\x20[commhub:','url','parse','task.send.delivered','split','token','message','broadcast','text/event-stream','not_tracked','to_alias','startsWith','\x20error=','get_all_status','replace','s...','alias','2.0','parentTaskId','body','call','json','cwd','<unknown>','result','task.expired','autoConnect','430372HZeFSW','send_message','[REDACTED]','signal','error_code','lifecycleTracking','error','type','from_alias','agent','/events/','sleep','connected','2378999qIVDPs','task.started','task_id','send','task.send.start','<pending>','message_id','connectSSE','error_message','send_failed','duration_ms','now','emit','send_reply','sseAbort','3IYsCMU','idle','data:\x20','fromAlias','connect','application/json','task.ack','401856hPWsxE','get_inbox','POST','[commhub:task]\x20','unknown\x20error','task.replied','task.send.failed','heartbeatTimer','sdk','4hXlAhn','\x20from=','log','resumeId','networkId','Authorization','reconnectDelay','SSE\x20failed:\x20','700950ubyMWN','catch','CommHub\x20response\x20omitted\x20task_id','tools/call','slice','313551FPBLwP','status'];a0_0xcafd=function(){return _0x53a80e;};return a0_0xcafd();}async function X(_0x40daea,_0x3127f5){const _0x59148b=a0_0x2672d9;let _0x28ba39=_0x3127f5[_0x59148b(0x255)]??Date[_0x59148b(0x255)],_0x54d137=_0x28ba39(),_0x470d5c=(_0x9de847,_0x1ed101,_0xf3542b,_0x9a85b1)=>{const _0x30b4e8=_0x59148b;_0x3127f5[_0x30b4e8(0x1ef)](O(U({'from_alias':_0x40daea[_0x30b4e8(0x25c)],'to_alias':_0x40daea['toAlias'],'task_id':_0x1ed101,'parent_task_id':_0x40daea[_0x30b4e8(0x234)],'network_id':_0x40daea[_0x30b4e8(0x1f1)],'transport':_0x40daea['transport'],'status':_0x9de847,'duration_ms':_0x28ba39()-_0x54d137,'lifecycle_tracking':_0x40daea[_0x30b4e8(0x242)],..._0xf3542b!==void 0x0?{'error_code':_0x9a85b1||'send_failed','error_message':N(_0xf3542b)}:{}})));};_0x470d5c(_0x59148b(0x212),null);try{let _0x3beded=await _0x3127f5[_0x59148b(0x24d)](),_0x8a499f=j(_0x3beded);if(_0x8a499f)_0x470d5c('delivered',_0x8a499f);else{if(_0x3beded?.['ok']===!0x1||_0x3beded?.[_0x59148b(0x243)])_0x470d5c(_0x59148b(0x204),_0x8a499f,_0x3beded?.[_0x59148b(0x243)]||'CommHub\x20rejected\x20task',_0x59148b(0x206));else _0x470d5c(_0x59148b(0x204),null,_0x59148b(0x1f7),_0x59148b(0x208));}return _0x3beded;}catch(_0x292981){throw _0x470d5c(_0x59148b(0x204),null,_0x292981,_0x59148b(0x253)),_0x292981;}}async function Y(_0x4c1606,_0x3c51b1){const _0x449e1e=a0_0x2672d9;return X({'fromAlias':_0x4c1606[_0x449e1e(0x25c)],'toAlias':_0x4c1606[_0x449e1e(0x232)],'parentTaskId':_0x4c1606[_0x449e1e(0x234)]||null,'networkId':_0x4c1606['networkId']||null,'transport':'mcp_http','lifecycleTracking':_0x449e1e(0x22b)},_0x3c51b1);}class $ extends a0_0x4c7d84{[a0_0x2672d9(0x223)];[a0_0x2672d9(0x232)];['token'];[a0_0x2672d9(0x246)];[a0_0x2672d9(0x1f0)];[a0_0x2672d9(0x1fd)];[a0_0x2672d9(0x1f3)];[a0_0x2672d9(0x267)];[a0_0x2672d9(0x258)];[a0_0x2672d9(0x200)]=!0x1;constructor(_0x422d6b){const _0x1fd7a3=a0_0x2672d9;super();if(this[_0x1fd7a3(0x223)]=_0x422d6b[_0x1fd7a3(0x223)][_0x1fd7a3(0x230)](/\/$/,''),this['alias']=_0x422d6b[_0x1fd7a3(0x232)],this[_0x1fd7a3(0x227)]=_0x422d6b[_0x1fd7a3(0x227)],this[_0x1fd7a3(0x246)]=_0x422d6b[_0x1fd7a3(0x246)]||_0x1fd7a3(0x268),this[_0x1fd7a3(0x1f0)]=_0x1fd7a3(0x21a)+_0x422d6b['alias']+'-'+Date[_0x1fd7a3(0x255)]()['toString'](0x24),this[_0x1fd7a3(0x1fd)]=_0x422d6b[_0x1fd7a3(0x1fd)]??0x2bf20,this[_0x1fd7a3(0x1f3)]=_0x422d6b[_0x1fd7a3(0x1f3)]??0xbb8,_0x422d6b[_0x1fd7a3(0x23c)]!==!0x1)this[_0x1fd7a3(0x25d)]();}['log'](_0x2e5b85){const _0x50b34f=a0_0x2672d9;console[_0x50b34f(0x1ef)]('['+new Date()[_0x50b34f(0x21f)]()[_0x50b34f(0x1f9)](0x0,0x8)+_0x50b34f(0x222)+this[_0x50b34f(0x232)]+']\x20'+_0x2e5b85);}async[a0_0x2672d9(0x236)](_0x2465c6,_0x357ec3){const _0x2472f5=a0_0x2672d9;let _0x4c7a38={'Content-Type':_0x2472f5(0x25e),'Accept':_0x2472f5(0x1fe)};if(this[_0x2472f5(0x227)])_0x4c7a38[_0x2472f5(0x1f2)]='Bearer\x20'+this[_0x2472f5(0x227)];let _0xa5edb5=await(await fetch(this[_0x2472f5(0x223)]+_0x2472f5(0x217),{'method':_0x2472f5(0x262),'headers':_0x4c7a38,'body':JSON[_0x2472f5(0x20e)]({'jsonrpc':_0x2472f5(0x233),'id':Date[_0x2472f5(0x255)](),'method':_0x2472f5(0x1f8),'params':{'name':_0x2465c6,'arguments':_0x357ec3}})}))[_0x2472f5(0x211)](),_0x143532=_0xa5edb5[_0x2472f5(0x21c)](/data: (.+)/),_0x2b3553=_0x143532?JSON[_0x2472f5(0x224)](_0x143532[0x1]):JSON['parse'](_0xa5edb5),_0x4f3bbd=_0x2b3553?.[_0x2472f5(0x23a)]?.[_0x2472f5(0x219)]?.[0x0]?.['text'];return _0x4f3bbd?JSON[_0x2472f5(0x224)](_0x4f3bbd):_0x2b3553;}async[a0_0x2672d9(0x25d)](){const _0x1769fd=a0_0x2672d9;if(this[_0x1769fd(0x200)])return;this[_0x1769fd(0x200)]=!0x0,await this[_0x1769fd(0x1fb)](_0x1769fd(0x25a)),this[_0x1769fd(0x1ef)](_0x1769fd(0x220)),this[_0x1769fd(0x267)]=setInterval(()=>{const _0x50acf2=_0x1769fd;this[_0x50acf2(0x1fb)](_0x50acf2(0x25a))[_0x50acf2(0x1f6)](_0x32df28=>this[_0x50acf2(0x1ef)](_0x50acf2(0x210)+_0x32df28['message']));},this[_0x1769fd(0x1fd)]),this['connectSSE']();}async['disconnect'](){const _0x4aa201=a0_0x2672d9;if(this[_0x4aa201(0x200)]=!0x1,this['sseAbort']?.['abort'](),this[_0x4aa201(0x267)])clearInterval(this[_0x4aa201(0x267)]);await this[_0x4aa201(0x1fb)](_0x4aa201(0x21e))['catch'](()=>{}),this[_0x4aa201(0x1ef)](_0x4aa201(0x207));}async['send'](_0x13bf3e,_0x5ee5f3,_0xd0cb9e=a0_0x2672d9(0x214)){const _0x34f3ad=a0_0x2672d9;return Y({'alias':_0x13bf3e,'fromAlias':this[_0x34f3ad(0x232)]},{'log':_0x1d8aad=>console['log'](_0x1d8aad),'send':()=>this[_0x34f3ad(0x236)]('send_task',{'alias':_0x13bf3e,'task':_0x5ee5f3,'priority':_0xd0cb9e,'from_session':this[_0x34f3ad(0x232)]})});}async['message'](_0x5093f3,_0x443c9d){const _0xc2e440=a0_0x2672d9;return this['call'](_0xc2e440(0x23e),{'alias':_0x5093f3,'message':_0x443c9d,'from_session':this[_0xc2e440(0x232)]});}async[a0_0x2672d9(0x21d)](_0x427aa2,_0x49b46b,_0x53db40='completed'){const _0xba654b=a0_0x2672d9;return this[_0xba654b(0x236)](_0xba654b(0x257),{'in_reply_to':_0x427aa2,'text':_0x49b46b,'status':_0x53db40});}async[a0_0x2672d9(0x1fb)](_0x22c5cf,_0x2b19ff){const _0x56320d=a0_0x2672d9;return this[_0x56320d(0x236)]('report_status',{'resume_id':this[_0x56320d(0x1f0)],'alias':this[_0x56320d(0x232)],'status':_0x22c5cf,'server':a0_0x11d06b(),'hostname':a0_0x11d06b(),'agent':this[_0x56320d(0x246)],'project_dir':process[_0x56320d(0x238)](),..._0x2b19ff});}async['getAllStatus'](){const _0x436c8f=a0_0x2672d9;return this['call'](_0x436c8f(0x22f),{});}async[a0_0x2672d9(0x229)](_0x5f37a5,_0x25d8b3){const _0x51e0d1=a0_0x2672d9;return this[_0x51e0d1(0x236)](_0x51e0d1(0x229),{'message':_0x5f37a5,'filter_server':_0x25d8b3?.[_0x51e0d1(0x213)],'filter_status':_0x25d8b3?.[_0x51e0d1(0x1fb)]});}async[a0_0x2672d9(0x251)](){const _0x4e9dab=a0_0x2672d9;let _0x3ba555=encodeURIComponent(this[_0x4e9dab(0x232)]),_0x5afe6b=this[_0x4e9dab(0x223)]+_0x4e9dab(0x247)+_0x3ba555,_0x15c39b=this[_0x4e9dab(0x1f3)];while(this[_0x4e9dab(0x200)]){try{this[_0x4e9dab(0x258)]=new AbortController();let _0x241de3={'Accept':_0x4e9dab(0x22a)};if(this[_0x4e9dab(0x227)])_0x241de3[_0x4e9dab(0x1f2)]=_0x4e9dab(0x216)+this[_0x4e9dab(0x227)];let _0x305d08=await fetch(_0x5afe6b,{'headers':_0x241de3,'signal':this[_0x4e9dab(0x258)][_0x4e9dab(0x240)]});if(!_0x305d08['ok']||!_0x305d08[_0x4e9dab(0x235)]){this[_0x4e9dab(0x1ef)](_0x4e9dab(0x1f4)+_0x305d08['status']),await this[_0x4e9dab(0x248)](_0x15c39b),_0x15c39b=Math[_0x4e9dab(0x215)](_0x15c39b*1.5,0xea60);continue;}_0x15c39b=this[_0x4e9dab(0x1f3)];let _0x1d86b4=_0x305d08[_0x4e9dab(0x235)]['getReader'](),_0x3cf270=new TextDecoder(),_0x509ca5='';while(this[_0x4e9dab(0x200)]){let {done:_0x3699b6,value:_0x498516}=await _0x1d86b4[_0x4e9dab(0x218)]();if(_0x3699b6)break;_0x509ca5+=_0x3cf270['decode'](_0x498516,{'stream':!0x0});let _0x1304f3=_0x509ca5[_0x4e9dab(0x226)]('\x0a');_0x509ca5=_0x1304f3['pop']()||'';for(let _0x52f72b of _0x1304f3){if(!_0x52f72b[_0x4e9dab(0x22d)](_0x4e9dab(0x25b)))continue;try{let _0x4e039e=JSON[_0x4e9dab(0x224)](_0x52f72b[_0x4e9dab(0x1f9)](0x6));if(_0x4e039e['type']==='connected'){this['log'](_0x4e9dab(0x209)),this[_0x4e9dab(0x256)](_0x4e9dab(0x249));continue;}if(_0x4e039e[_0x4e9dab(0x244)]==='new_task'||_0x4e039e[_0x4e9dab(0x244)]==='new_message'||_0x4e039e['type']===_0x4e9dab(0x229))await this[_0x4e9dab(0x21b)]();}catch{}}}}catch(_0x265859){if(_0x265859['name']===_0x4e9dab(0x221))break;this[_0x4e9dab(0x256)](_0x4e9dab(0x243),_0x265859),this[_0x4e9dab(0x1ef)](_0x4e9dab(0x203)+_0x265859['message']);}if(this['running'])this[_0x4e9dab(0x256)](_0x4e9dab(0x207)),this[_0x4e9dab(0x1ef)]('SSE\x20reconnecting\x20in\x20'+_0x15c39b/0x3e8+_0x4e9dab(0x231)),await this[_0x4e9dab(0x248)](_0x15c39b),_0x15c39b=Math[_0x4e9dab(0x215)](_0x15c39b*1.5,0xea60);}}async[a0_0x2672d9(0x21b)](){const _0x1d6a2f=a0_0x2672d9;try{let _0x3f580c=(await this[_0x1d6a2f(0x236)](_0x1d6a2f(0x261),{'alias':this[_0x1d6a2f(0x232)],'limit':0xa}))?.[_0x1d6a2f(0x20f)]||[];for(let _0x4c8e99 of _0x3f580c)await this[_0x1d6a2f(0x236)]('ack_inbox',{'alias':this[_0x1d6a2f(0x232)],'message_id':_0x4c8e99['id']}),this['log']('←\x20'+_0x4c8e99['from_session']+':\x20'+_0x4c8e99[_0x1d6a2f(0x219)][_0x1d6a2f(0x1f9)](0x0,0x3c)),this[_0x1d6a2f(0x256)]('task',_0x4c8e99),this['emit']('message',_0x4c8e99);}catch(_0x29f621){this[_0x1d6a2f(0x1ef)]('inbox\x20error:\x20'+_0x29f621['message']);}}[a0_0x2672d9(0x248)](_0x1dacc1){return new Promise(_0x5cdad9=>setTimeout(_0x5cdad9,_0x1dacc1));}}var F=$;export{F as default,$ as CommHub};
|