@sleep2agi/agent-network 2.3.0-preview.242 → 2.3.0-preview.244
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/build-info.json +2 -2
- package/dist/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +8 -8
- package/dist/src/normalize-runtime.d.ts +2 -2
- package/dist/src/opencode-agent-node-pair.d.ts +6 -6
- package/dist/src/rules-file.d.ts +25 -1
- package/dist/src/windows-runtime.d.ts +23 -2
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x566e4c=a0_0x22d8;(function(_0x1c3c53,_0x38c0ba){const _0x23d810=a0_0x22d8,_0x43d618=_0x1c3c53();while(!![]){try{const _0x3e4070=-parseInt(_0x23d810(0x108))/0x1+parseInt(_0x23d810(0x13d))/0x2+-parseInt(_0x23d810(0x135))/0x3*(parseInt(_0x23d810(0x119))/0x4)+-parseInt(_0x23d810(0x178))/0x5*(-parseInt(_0x23d810(0x12f))/0x6)+parseInt(_0x23d810(0x130))/0x7+parseInt(_0x23d810(0x12d))/0x8+parseInt(_0x23d810(0x11e))/0x9*(-parseInt(_0x23d810(0x14e))/0xa);if(_0x3e4070===_0x38c0ba)break;else _0x43d618['push'](_0x43d618['shift']());}catch(_0x51b5e7){_0x43d618['push'](_0x43d618['shift']());}}}(a0_0x1968,0xbb6cc));import{EventEmitter as a0_0x281258}from'events';import{hostname as a0_0x487300}from'os';function a0_0x22d8(_0xea7eef,_0x20f4bd){_0xea7eef=_0xea7eef-0x102;const _0x196856=a0_0x1968();let _0x22d88c=_0x196856[_0xea7eef];return _0x22d88c;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x43ff79,_0x5c38b8)=>(_0x43ff79??_0x5c38b8)[a0_0x566e4c(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x566e4c(0x114)](0x0,0xf0);function N(_0x2502e2){const _0x2c54f6=a0_0x566e4c;return(_0x2502e2 instanceof Error?_0x2502e2[_0x2c54f6(0x11d)]:String(_0x2502e2??_0x2c54f6(0x14d)))[_0x2c54f6(0x132)](K,_0x2c54f6(0x113))[_0x2c54f6(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2c54f6(0x114)](0x0,0xf0);}function O(_0x160896,_0x3e5729=process.env.ANET_TASK_TRACE_FORMAT===a0_0x566e4c(0x184)){const _0x4fa5a2=a0_0x566e4c;if(_0x3e5729)return JSON[_0x4fa5a2(0x153)](_0x160896);let _0x2a9c3f=L(_0x160896[_0x4fa5a2(0x17f)],_0x4fa5a2(0x16f)),_0x3abe31=L(_0x160896[_0x4fa5a2(0x185)],'<pending>'),_0x3625df=_0x160896[_0x4fa5a2(0x140)]?_0x4fa5a2(0x165)+_0x160896[_0x4fa5a2(0x140)]+':'+(_0x160896[_0x4fa5a2(0x169)]??''):'';return'[commhub:task]\x20'+_0x160896[_0x4fa5a2(0x148)]+'\x20from='+L(_0x160896['from_alias'],_0x4fa5a2(0x180))+'\x20to='+L(_0x160896[_0x4fa5a2(0x10e)],_0x4fa5a2(0x180))+_0x4fa5a2(0x171)+_0x3abe31+_0x4fa5a2(0x16a)+_0x2a9c3f+_0x4fa5a2(0x174)+L(_0x160896['network_id'],_0x4fa5a2(0x180))+_0x4fa5a2(0x15a)+_0x160896[_0x4fa5a2(0x183)]+_0x4fa5a2(0x18c)+_0x160896[_0x4fa5a2(0x104)]+_0x4fa5a2(0x17c)+_0x160896[_0x4fa5a2(0x187)]+_0x3625df;}function U(_0x35d7ed){const _0x3fc497=a0_0x566e4c;return{'event':{'sending':_0x3fc497(0x10f),'delivered':_0x3fc497(0x151),'failed':_0x3fc497(0x128),'acked':_0x3fc497(0x162),'started':_0x3fc497(0x134),'replied':_0x3fc497(0x11b),'expired':_0x3fc497(0x155)}[_0x35d7ed['status']],..._0x35d7ed};}function j(_0x59c984){const _0xc14c37=a0_0x566e4c;let _0x280017=_0x59c984?.[_0xc14c37(0x185)]||_0x59c984?.['message_id']||_0x59c984?.['id'];if(_0x280017)return String(_0x280017);let _0xce0281=_0x59c984?.[_0xc14c37(0x103)]?.[0x0]?.[_0xc14c37(0x177)];if(typeof _0xce0281!==_0xc14c37(0x102))return null;try{let _0x312dd5=JSON[_0xc14c37(0x133)](_0xce0281);return _0x312dd5?.[_0xc14c37(0x185)]||_0x312dd5?.[_0xc14c37(0x186)]||_0x312dd5?.['id']||null;}catch{return null;}}async function X(_0x2b256,_0xb8a151){const _0x169086=a0_0x566e4c;let _0x16b5a7=_0xb8a151[_0x169086(0x149)]??Date[_0x169086(0x149)],_0x1f5d0d=_0x16b5a7(),_0x26aa8b=(_0x6d588b,_0x1bedfa,_0x501026,_0x43e13f)=>{const _0x1b969c=_0x169086;_0xb8a151[_0x1b969c(0x107)](O(U({'from_alias':_0x2b256[_0x1b969c(0x163)],'to_alias':_0x2b256[_0x1b969c(0x175)],'task_id':_0x1bedfa,'parent_task_id':_0x2b256[_0x1b969c(0x112)],'network_id':_0x2b256['networkId'],'transport':_0x2b256[_0x1b969c(0x183)],'status':_0x6d588b,'duration_ms':_0x16b5a7()-_0x1f5d0d,'lifecycle_tracking':_0x2b256[_0x1b969c(0x118)],..._0x501026!==void 0x0?{'error_code':_0x43e13f||'send_failed','error_message':N(_0x501026)}:{}})));};_0x26aa8b(_0x169086(0x15f),null);try{let _0x46dbb0=await _0xb8a151[_0x169086(0x14f)](),_0x332ffa=j(_0x46dbb0);if(_0x332ffa)_0x26aa8b(_0x169086(0x10c),_0x332ffa);else{if(_0x46dbb0?.['ok']===!0x1||_0x46dbb0?.[_0x169086(0x12b)])_0x26aa8b(_0x169086(0x116),_0x332ffa,_0x46dbb0?.['error']||_0x169086(0x10b),'send_rejected');else _0x26aa8b(_0x169086(0x116),null,_0x169086(0x16e),_0x169086(0x12c));}return _0x46dbb0;}catch(_0x2a767d){throw _0x26aa8b(_0x169086(0x116),null,_0x2a767d,_0x169086(0x13a)),_0x2a767d;}}async function Y(_0x51ea43,_0x48ac51){const _0x4c4266=a0_0x566e4c;return X({'fromAlias':_0x51ea43[_0x4c4266(0x163)],'toAlias':_0x51ea43[_0x4c4266(0x14a)],'parentTaskId':_0x51ea43['parentTaskId']||null,'networkId':_0x51ea43[_0x4c4266(0x15d)]||null,'transport':_0x4c4266(0x17b),'lifecycleTracking':_0x4c4266(0x154)},_0x48ac51);}class $ extends a0_0x281258{[a0_0x566e4c(0x17d)];[a0_0x566e4c(0x14a)];[a0_0x566e4c(0x13b)];[a0_0x566e4c(0x176)];[a0_0x566e4c(0x181)];[a0_0x566e4c(0x106)];[a0_0x566e4c(0x11a)];['heartbeatTimer'];[a0_0x566e4c(0x189)];[a0_0x566e4c(0x13c)]=!0x1;constructor(_0x5602e8){const _0x483722=a0_0x566e4c;super();if(this[_0x483722(0x17d)]=_0x5602e8[_0x483722(0x17d)]['replace'](/\/$/,''),this[_0x483722(0x14a)]=_0x5602e8[_0x483722(0x14a)],this[_0x483722(0x13b)]=_0x5602e8[_0x483722(0x13b)],this[_0x483722(0x176)]=_0x5602e8[_0x483722(0x176)]||_0x483722(0x18a),this[_0x483722(0x181)]='sdk-'+_0x5602e8[_0x483722(0x14a)]+'-'+Date['now']()[_0x483722(0x126)](0x24),this[_0x483722(0x106)]=_0x5602e8[_0x483722(0x106)]??0x2bf20,this[_0x483722(0x11a)]=_0x5602e8[_0x483722(0x11a)]??0xbb8,_0x5602e8[_0x483722(0x12a)]!==!0x1)this[_0x483722(0x127)]();}[a0_0x566e4c(0x107)](_0x227440){const _0x28730d=a0_0x566e4c;console[_0x28730d(0x107)]('['+new Date()[_0x28730d(0x147)]()['slice'](0x0,0x8)+_0x28730d(0x150)+this[_0x28730d(0x14a)]+']\x20'+_0x227440);}async[a0_0x566e4c(0x14c)](_0x1f564e,_0x387f97){const _0x5c50e1=a0_0x566e4c;let _0xc7cdee={'Content-Type':_0x5c50e1(0x143),'Accept':_0x5c50e1(0x13e)};if(this[_0x5c50e1(0x13b)])_0xc7cdee[_0x5c50e1(0x159)]='Bearer\x20'+this[_0x5c50e1(0x13b)];let _0x9606a2=await(await fetch(this[_0x5c50e1(0x17d)]+_0x5c50e1(0x161),{'method':_0x5c50e1(0x157),'headers':_0xc7cdee,'body':JSON[_0x5c50e1(0x153)]({'jsonrpc':_0x5c50e1(0x173),'id':Date[_0x5c50e1(0x149)](),'method':_0x5c50e1(0x166),'params':{'name':_0x1f564e,'arguments':_0x387f97}})}))[_0x5c50e1(0x177)](),_0x2dea5b=_0x9606a2[_0x5c50e1(0x15c)](/data: (.+)/),_0x57cb6a=_0x2dea5b?JSON[_0x5c50e1(0x133)](_0x2dea5b[0x1]):JSON[_0x5c50e1(0x133)](_0x9606a2),_0x5a1408=_0x57cb6a?.[_0x5c50e1(0x182)]?.[_0x5c50e1(0x103)]?.[0x0]?.[_0x5c50e1(0x177)];return _0x5a1408?JSON[_0x5c50e1(0x133)](_0x5a1408):_0x57cb6a;}async[a0_0x566e4c(0x127)](){const _0x2935fa=a0_0x566e4c;if(this[_0x2935fa(0x13c)])return;this[_0x2935fa(0x13c)]=!0x0,await this[_0x2935fa(0x148)](_0x2935fa(0x158)),this['log'](_0x2935fa(0x120)),this[_0x2935fa(0x188)]=setInterval(()=>{const _0x3264cb=_0x2935fa;this[_0x3264cb(0x148)](_0x3264cb(0x158))[_0x3264cb(0x164)](_0x127e4a=>this['log'](_0x3264cb(0x15b)+_0x127e4a[_0x3264cb(0x11d)]));},this[_0x2935fa(0x106)]),this['connectSSE']();}async[a0_0x566e4c(0x138)](){const _0x1cd496=a0_0x566e4c;if(this[_0x1cd496(0x13c)]=!0x1,this[_0x1cd496(0x189)]?.[_0x1cd496(0x117)](),this[_0x1cd496(0x188)])clearInterval(this[_0x1cd496(0x188)]);await this[_0x1cd496(0x148)](_0x1cd496(0x15e))[_0x1cd496(0x164)](()=>{}),this[_0x1cd496(0x107)](_0x1cd496(0x16c));}async['send'](_0x2e38c1,_0x1f6206,_0x49d114=a0_0x566e4c(0x121)){const _0x1a60b8=a0_0x566e4c;return Y({'alias':_0x2e38c1,'fromAlias':this['alias']},{'log':_0x2ffcf6=>console[_0x1a60b8(0x107)](_0x2ffcf6),'send':()=>this[_0x1a60b8(0x14c)](_0x1a60b8(0x109),{'alias':_0x2e38c1,'task':_0x1f6206,'priority':_0x49d114,'from_session':this[_0x1a60b8(0x14a)]})});}async[a0_0x566e4c(0x11d)](_0x3bb6be,_0x5e1feb){const _0x33a9e4=a0_0x566e4c;return this[_0x33a9e4(0x14c)](_0x33a9e4(0x146),{'alias':_0x3bb6be,'message':_0x5e1feb,'from_session':this['alias']});}async[a0_0x566e4c(0x139)](_0x2f2a36,_0x202e80,_0x9e075f=a0_0x566e4c(0x115)){const _0x4a536e=a0_0x566e4c;return this[_0x4a536e(0x14c)](_0x4a536e(0x136),{'in_reply_to':_0x2f2a36,'text':_0x202e80,'status':_0x9e075f});}async[a0_0x566e4c(0x148)](_0x2a4260,_0x18c0cc){const _0x293184=a0_0x566e4c;return this[_0x293184(0x14c)](_0x293184(0x12e),{'resume_id':this[_0x293184(0x181)],'alias':this[_0x293184(0x14a)],'status':_0x2a4260,'server':a0_0x487300(),'hostname':a0_0x487300(),'agent':this[_0x293184(0x176)],'project_dir':process['cwd'](),..._0x18c0cc});}async[a0_0x566e4c(0x17e)](){const _0x185189=a0_0x566e4c;return this[_0x185189(0x14c)]('get_all_status',{});}async[a0_0x566e4c(0x14b)](_0x1c83f6,_0x18b3ac){const _0x4f55dd=a0_0x566e4c;return this[_0x4f55dd(0x14c)](_0x4f55dd(0x14b),{'message':_0x1c83f6,'filter_server':_0x18b3ac?.[_0x4f55dd(0x18d)],'filter_status':_0x18b3ac?.['status']});}async[a0_0x566e4c(0x11c)](){const _0x4bdc6d=a0_0x566e4c;let _0xb40063=encodeURIComponent(this['alias']),_0x5d5fd4=this['url']+_0x4bdc6d(0x122)+_0xb40063,_0x1fe9a1=this[_0x4bdc6d(0x11a)];while(this['running']){try{this[_0x4bdc6d(0x189)]=new AbortController();let _0x3ab9c4={'Accept':_0x4bdc6d(0x16b)};if(this[_0x4bdc6d(0x13b)])_0x3ab9c4[_0x4bdc6d(0x159)]=_0x4bdc6d(0x167)+this[_0x4bdc6d(0x13b)];let _0x58e150=await fetch(_0x5d5fd4,{'headers':_0x3ab9c4,'signal':this['sseAbort']['signal']});if(!_0x58e150['ok']||!_0x58e150[_0x4bdc6d(0x144)]){this[_0x4bdc6d(0x107)](_0x4bdc6d(0x123)+_0x58e150['status']),await this[_0x4bdc6d(0x10a)](_0x1fe9a1),_0x1fe9a1=Math[_0x4bdc6d(0x11f)](_0x1fe9a1*1.5,0xea60);continue;}_0x1fe9a1=this[_0x4bdc6d(0x11a)];let _0x2b8169=_0x58e150['body'][_0x4bdc6d(0x156)](),_0x336aaa=new TextDecoder(),_0x2eef60='';while(this[_0x4bdc6d(0x13c)]){let {done:_0x38f362,value:_0x30bd19}=await _0x2b8169[_0x4bdc6d(0x168)]();if(_0x38f362)break;_0x2eef60+=_0x336aaa[_0x4bdc6d(0x145)](_0x30bd19,{'stream':!0x0});let _0x293711=_0x2eef60['split']('\x0a');_0x2eef60=_0x293711[_0x4bdc6d(0x17a)]()||'';for(let _0xd6bca4 of _0x293711){if(!_0xd6bca4[_0x4bdc6d(0x170)](_0x4bdc6d(0x129)))continue;try{let _0x450eeb=JSON[_0x4bdc6d(0x133)](_0xd6bca4[_0x4bdc6d(0x114)](0x6));if(_0x450eeb['type']===_0x4bdc6d(0x125)){this[_0x4bdc6d(0x107)](_0x4bdc6d(0x179)),this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x125));continue;}if(_0x450eeb[_0x4bdc6d(0x18b)]===_0x4bdc6d(0x110)||_0x450eeb[_0x4bdc6d(0x18b)]===_0x4bdc6d(0x111)||_0x450eeb[_0x4bdc6d(0x18b)]==='broadcast')await this[_0x4bdc6d(0x10d)]();}catch{}}}}catch(_0x41fc10){if(_0x41fc10['name']===_0x4bdc6d(0x142))break;this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x12b),_0x41fc10),this[_0x4bdc6d(0x107)](_0x4bdc6d(0x152)+_0x41fc10[_0x4bdc6d(0x11d)]);}if(this[_0x4bdc6d(0x13c)])this[_0x4bdc6d(0x16d)](_0x4bdc6d(0x16c)),this['log'](_0x4bdc6d(0x13f)+_0x1fe9a1/0x3e8+_0x4bdc6d(0x137)),await this['sleep'](_0x1fe9a1),_0x1fe9a1=Math['min'](_0x1fe9a1*1.5,0xea60);}}async[a0_0x566e4c(0x10d)](){const _0xf1127c=a0_0x566e4c;try{let _0x270745=(await this['call'](_0xf1127c(0x160),{'alias':this[_0xf1127c(0x14a)],'limit':0xa}))?.[_0xf1127c(0x172)]||[];for(let _0x1ea553 of _0x270745)await this[_0xf1127c(0x14c)](_0xf1127c(0x105),{'alias':this[_0xf1127c(0x14a)],'message_id':_0x1ea553['id']}),this[_0xf1127c(0x107)]('←\x20'+_0x1ea553[_0xf1127c(0x124)]+':\x20'+_0x1ea553[_0xf1127c(0x103)][_0xf1127c(0x114)](0x0,0x3c)),this['emit'](_0xf1127c(0x131),_0x1ea553),this[_0xf1127c(0x16d)](_0xf1127c(0x11d),_0x1ea553);}catch(_0x20c304){this[_0xf1127c(0x107)](_0xf1127c(0x141)+_0x20c304['message']);}}[a0_0x566e4c(0x10a)](_0x412e2a){return new Promise(_0x20ce6e=>setTimeout(_0x20ce6e,_0x412e2a));}}function a0_0x1968(){const _0x53867f=['url','getAllStatus','parent_task_id','<unknown>','resumeId','result','transport','json','task_id','message_id','lifecycle_tracking','heartbeatTimer','sseAbort','sdk','type','\x20duration_ms=','server','string','content','duration_ms','ack_inbox','heartbeatInterval','log','262036Halccv','send_task','sleep','CommHub\x20rejected\x20task','delivered','processInbox','to_alias','task.send.start','new_task','new_message','parentTaskId','[REDACTED]','slice','completed','failed','abort','lifecycleTracking','4876724HWxplR','reconnectDelay','task.replied','connectSSE','message','4791015TAtbry','min','registered','normal','/events/','SSE\x20failed:\x20','from_session','connected','toString','connect','task.send.failed','data:\x20','autoConnect','error','missing_task_id','8884528gCsfeL','report_status','101826jfDwIg','2073953blvCDQ','task','replace','parse','task.started','3AWLzRy','send_reply','s...','disconnect','reply','send_failed','token','running','1900248VejHIJ','application/json,\x20text/event-stream','SSE\x20reconnecting\x20in\x20','error_code','inbox\x20error:\x20','AbortError','application/json','body','decode','send_message','toTimeString','status','now','alias','broadcast','call','unknown\x20error','10zTfDnR','send',']\x20[commhub:','task.send.delivered','SSE\x20error:\x20','stringify','not_tracked','task.expired','getReader','POST','idle','Authorization','\x20transport=','heartbeat\x20failed:\x20','match','networkId','offline','sending','get_inbox','/mcp','task.ack','fromAlias','catch','\x20error=','tools/call','Bearer\x20','read','error_message','\x20parent_task_id=','text/event-stream','disconnected','emit','CommHub\x20response\x20omitted\x20task_id','<missing>','startsWith','\x20task_id=','messages','2.0','\x20network_id=','toAlias','agent','text','125DGCxWr','SSE\x20connected','pop','mcp_http','\x20lifecycle='];a0_0x1968=function(){return _0x53867f;};return a0_0x1968();}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x3202f1=a0_0x1ba1;(function(_0xae77d3,_0x41acd6){const _0x49d876=a0_0x1ba1,_0x747006=_0xae77d3();while(!![]){try{const _0x25261b=-parseInt(_0x49d876(0x108))/0x1+parseInt(_0x49d876(0xf1))/0x2+parseInt(_0x49d876(0x149))/0x3*(-parseInt(_0x49d876(0xd7))/0x4)+-parseInt(_0x49d876(0x10d))/0x5*(parseInt(_0x49d876(0x114))/0x6)+parseInt(_0x49d876(0x122))/0x7+parseInt(_0x49d876(0x11f))/0x8+-parseInt(_0x49d876(0x121))/0x9*(-parseInt(_0x49d876(0x101))/0xa);if(_0x25261b===_0x41acd6)break;else _0x747006['push'](_0x747006['shift']());}catch(_0x47c0fd){_0x747006['push'](_0x747006['shift']());}}}(a0_0x188e,0xa58d7));import{EventEmitter as a0_0x1408d2}from'events';import{hostname as a0_0x5e1407}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2b6b91,_0x52bd46)=>(_0x2b6b91??_0x52bd46)[a0_0x3202f1(0x11a)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x3202f1(0xd2)](0x0,0xf0);function N(_0x20bb47){const _0x4d08ee=a0_0x3202f1;return(_0x20bb47 instanceof Error?_0x20bb47[_0x4d08ee(0x13e)]:String(_0x20bb47??_0x4d08ee(0xe9)))[_0x4d08ee(0x11a)](K,_0x4d08ee(0x13a))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4d08ee(0xd2)](0x0,0xf0);}function O(_0x31bc23,_0x1da239=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x1f11cb=a0_0x3202f1;if(_0x1da239)return JSON[_0x1f11cb(0x137)](_0x31bc23);let _0x8a08cc=L(_0x31bc23[_0x1f11cb(0xfb)],_0x1f11cb(0xdf)),_0x58446d=L(_0x31bc23[_0x1f11cb(0xf3)],_0x1f11cb(0x119)),_0xc0d95c=_0x31bc23[_0x1f11cb(0x12d)]?'\x20error='+_0x31bc23[_0x1f11cb(0x12d)]+':'+(_0x31bc23['error_message']??''):'';return'[commhub:task]\x20'+_0x31bc23[_0x1f11cb(0x105)]+_0x1f11cb(0xdc)+L(_0x31bc23['from_alias'],_0x1f11cb(0x11c))+_0x1f11cb(0xe3)+L(_0x31bc23[_0x1f11cb(0x12f)],_0x1f11cb(0x11c))+'\x20task_id='+_0x58446d+_0x1f11cb(0xfe)+_0x8a08cc+_0x1f11cb(0xd8)+L(_0x31bc23['network_id'],_0x1f11cb(0x11c))+_0x1f11cb(0x131)+_0x31bc23[_0x1f11cb(0x100)]+_0x1f11cb(0xfa)+_0x31bc23[_0x1f11cb(0xe5)]+_0x1f11cb(0x117)+_0x31bc23['lifecycle_tracking']+_0xc0d95c;}function U(_0x2da560){const _0x54a55b=a0_0x3202f1;return{'event':{'sending':_0x54a55b(0x10e),'delivered':'task.send.delivered','failed':_0x54a55b(0xee),'acked':_0x54a55b(0xe4),'started':_0x54a55b(0xf6),'replied':_0x54a55b(0xd6),'expired':_0x54a55b(0x148)}[_0x2da560[_0x54a55b(0x105)]],..._0x2da560};}function j(_0x8ae5ac){const _0x548fbe=a0_0x3202f1;let _0x17e93b=_0x8ae5ac?.[_0x548fbe(0xf3)]||_0x8ae5ac?.[_0x548fbe(0x125)]||_0x8ae5ac?.['id'];if(_0x17e93b)return String(_0x17e93b);let _0x5e9e9b=_0x8ae5ac?.['content']?.[0x0]?.[_0x548fbe(0xfc)];if(typeof _0x5e9e9b!==_0x548fbe(0x110))return null;try{let _0x2d56a1=JSON[_0x548fbe(0xf0)](_0x5e9e9b);return _0x2d56a1?.[_0x548fbe(0xf3)]||_0x2d56a1?.[_0x548fbe(0x125)]||_0x2d56a1?.['id']||null;}catch{return null;}}function a0_0x1ba1(_0x801137,_0x7187fd){_0x801137=_0x801137-0xd2;const _0x188ef6=a0_0x188e();let _0x1ba167=_0x188ef6[_0x801137];return _0x1ba167;}function a0_0x188e(){const _0x843026=['\x20to=','task.ack','duration_ms','pop','heartbeatTimer','failed','unknown\x20error','toAlias','completed','reconnectDelay','delivered','task.send.failed','body','parse','1144224cqQBtk',']\x20[commhub:','task_id','new_task','mcp_http','task.started','disconnect','send_message','get_all_status','\x20duration_ms=','parent_task_id','text','broadcast','\x20parent_task_id=','networkId','transport','10AkZdfY','tools/call','error','server','status','result','reply','1255308mfxUzd','data:\x20','SSE\x20reconnecting\x20in\x20','inbox\x20error:\x20','new_message','127440DtaMdE','task.send.start','text/event-stream','string','min','connectSSE','emit','234uOgFUw','registered','agent','\x20lifecycle=','/events/','<pending>','replace','token','<unknown>','abort','application/json','8948872vKfZRz','report_status','9728973CNmBmM','4183291MytEUA','split','url','message_id','application/json,\x20text/event-stream','send_rejected','send_failed','parentTaskId','running','CommHub\x20rejected\x20task','connect','error_code','processInbox','to_alias','autoConnect','\x20transport=','ack_inbox','Bearer\x20','lifecycleTracking','toString','call','stringify','sending','send_task','[REDACTED]','messages','connected','type','message','send_reply','alias','cwd','signal','SSE\x20failed:\x20','disconnected','startsWith','fromAlias','sseAbort','task.expired','3PHteDx','decode','not_tracked','now','SSE\x20error:\x20','toTimeString','missing_task_id','name','CommHub\x20response\x20omitted\x20task_id','slice','idle','offline','content','task.replied','1767552cyDndf','\x20network_id=','send','from_session','2.0','\x20from=','log','heartbeatInterval','<missing>','task','resumeId','catch'];a0_0x188e=function(){return _0x843026;};return a0_0x188e();}async function X(_0x5b0fec,_0x2bbbc5){const _0x457a8f=a0_0x3202f1;let _0x2a852a=_0x2bbbc5[_0x457a8f(0x14c)]??Date['now'],_0x3e4035=_0x2a852a(),_0x2fa989=(_0x233cc6,_0x1d0a3b,_0x3607d7,_0x295198)=>{const _0x3bada=_0x457a8f;_0x2bbbc5[_0x3bada(0xdd)](O(U({'from_alias':_0x5b0fec[_0x3bada(0x146)],'to_alias':_0x5b0fec[_0x3bada(0xea)],'task_id':_0x1d0a3b,'parent_task_id':_0x5b0fec[_0x3bada(0x129)],'network_id':_0x5b0fec[_0x3bada(0xff)],'transport':_0x5b0fec[_0x3bada(0x100)],'status':_0x233cc6,'duration_ms':_0x2a852a()-_0x3e4035,'lifecycle_tracking':_0x5b0fec[_0x3bada(0x134)],..._0x3607d7!==void 0x0?{'error_code':_0x295198||'send_failed','error_message':N(_0x3607d7)}:{}})));};_0x2fa989(_0x457a8f(0x138),null);try{let _0x31786f=await _0x2bbbc5[_0x457a8f(0xd9)](),_0x1f97de=j(_0x31786f);if(_0x1f97de)_0x2fa989(_0x457a8f(0xed),_0x1f97de);else{if(_0x31786f?.['ok']===!0x1||_0x31786f?.[_0x457a8f(0x103)])_0x2fa989(_0x457a8f(0xe8),_0x1f97de,_0x31786f?.[_0x457a8f(0x103)]||_0x457a8f(0x12b),_0x457a8f(0x127));else _0x2fa989(_0x457a8f(0xe8),null,_0x457a8f(0x151),_0x457a8f(0x14f));}return _0x31786f;}catch(_0x58d5eb){throw _0x2fa989(_0x457a8f(0xe8),null,_0x58d5eb,_0x457a8f(0x128)),_0x58d5eb;}}async function Y(_0x4084db,_0x51ce19){const _0x53b4e6=a0_0x3202f1;return X({'fromAlias':_0x4084db[_0x53b4e6(0x146)],'toAlias':_0x4084db[_0x53b4e6(0x140)],'parentTaskId':_0x4084db[_0x53b4e6(0x129)]||null,'networkId':_0x4084db[_0x53b4e6(0xff)]||null,'transport':_0x53b4e6(0xf5),'lifecycleTracking':_0x53b4e6(0x14b)},_0x51ce19);}class $ extends a0_0x1408d2{[a0_0x3202f1(0x124)];[a0_0x3202f1(0x140)];['token'];[a0_0x3202f1(0x116)];[a0_0x3202f1(0xe1)];['heartbeatInterval'];[a0_0x3202f1(0xec)];['heartbeatTimer'];['sseAbort'];[a0_0x3202f1(0x12a)]=!0x1;constructor(_0x370c0c){const _0x3491cd=a0_0x3202f1;super();if(this[_0x3491cd(0x124)]=_0x370c0c[_0x3491cd(0x124)][_0x3491cd(0x11a)](/\/$/,''),this[_0x3491cd(0x140)]=_0x370c0c['alias'],this[_0x3491cd(0x11b)]=_0x370c0c[_0x3491cd(0x11b)],this[_0x3491cd(0x116)]=_0x370c0c[_0x3491cd(0x116)]||'sdk',this[_0x3491cd(0xe1)]='sdk-'+_0x370c0c[_0x3491cd(0x140)]+'-'+Date['now']()[_0x3491cd(0x135)](0x24),this[_0x3491cd(0xde)]=_0x370c0c[_0x3491cd(0xde)]??0x2bf20,this[_0x3491cd(0xec)]=_0x370c0c['reconnectDelay']??0xbb8,_0x370c0c[_0x3491cd(0x130)]!==!0x1)this['connect']();}[a0_0x3202f1(0xdd)](_0x5905ae){const _0x5fe975=a0_0x3202f1;console['log']('['+new Date()[_0x5fe975(0x14e)]()[_0x5fe975(0xd2)](0x0,0x8)+_0x5fe975(0xf2)+this[_0x5fe975(0x140)]+']\x20'+_0x5905ae);}async['call'](_0x3dfa10,_0x3778d3){const _0x35ec58=a0_0x3202f1;let _0x855b97={'Content-Type':_0x35ec58(0x11e),'Accept':_0x35ec58(0x126)};if(this[_0x35ec58(0x11b)])_0x855b97['Authorization']=_0x35ec58(0x133)+this[_0x35ec58(0x11b)];let _0x1594da=await(await fetch(this['url']+'/mcp',{'method':'POST','headers':_0x855b97,'body':JSON[_0x35ec58(0x137)]({'jsonrpc':_0x35ec58(0xdb),'id':Date[_0x35ec58(0x14c)](),'method':_0x35ec58(0x102),'params':{'name':_0x3dfa10,'arguments':_0x3778d3}})}))['text'](),_0x56d749=_0x1594da['match'](/data: (.+)/),_0x36e6e5=_0x56d749?JSON['parse'](_0x56d749[0x1]):JSON[_0x35ec58(0xf0)](_0x1594da),_0xa6f538=_0x36e6e5?.[_0x35ec58(0x106)]?.[_0x35ec58(0xd5)]?.[0x0]?.[_0x35ec58(0xfc)];return _0xa6f538?JSON['parse'](_0xa6f538):_0x36e6e5;}async[a0_0x3202f1(0x12c)](){const _0x83430d=a0_0x3202f1;if(this[_0x83430d(0x12a)])return;this[_0x83430d(0x12a)]=!0x0,await this[_0x83430d(0x105)]('idle'),this[_0x83430d(0xdd)](_0x83430d(0x115)),this[_0x83430d(0xe7)]=setInterval(()=>{const _0x1c285f=_0x83430d;this[_0x1c285f(0x105)](_0x1c285f(0xd3))[_0x1c285f(0xe2)](_0x36f5b1=>this[_0x1c285f(0xdd)]('heartbeat\x20failed:\x20'+_0x36f5b1[_0x1c285f(0x13e)]));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x3202f1(0xf7)](){const _0x5fecbb=a0_0x3202f1;if(this[_0x5fecbb(0x12a)]=!0x1,this['sseAbort']?.[_0x5fecbb(0x11d)](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x5fecbb(0x105)](_0x5fecbb(0xd4))['catch'](()=>{}),this[_0x5fecbb(0xdd)](_0x5fecbb(0x144));}async[a0_0x3202f1(0xd9)](_0x465c47,_0x34eb43,_0x11d26d='normal'){const _0xf029c0=a0_0x3202f1;return Y({'alias':_0x465c47,'fromAlias':this['alias']},{'log':_0x4bcaf6=>console['log'](_0x4bcaf6),'send':()=>this[_0xf029c0(0x136)](_0xf029c0(0x139),{'alias':_0x465c47,'task':_0x34eb43,'priority':_0x11d26d,'from_session':this['alias']})});}async['message'](_0xd45c25,_0x226bda){const _0x55973f=a0_0x3202f1;return this[_0x55973f(0x136)](_0x55973f(0xf8),{'alias':_0xd45c25,'message':_0x226bda,'from_session':this[_0x55973f(0x140)]});}async[a0_0x3202f1(0x107)](_0x18f9ad,_0x32460c,_0x1e256c=a0_0x3202f1(0xeb)){const _0x320570=a0_0x3202f1;return this['call'](_0x320570(0x13f),{'in_reply_to':_0x18f9ad,'text':_0x32460c,'status':_0x1e256c});}async[a0_0x3202f1(0x105)](_0x5eb4ff,_0x214cdd){const _0x13a588=a0_0x3202f1;return this[_0x13a588(0x136)](_0x13a588(0x120),{'resume_id':this[_0x13a588(0xe1)],'alias':this[_0x13a588(0x140)],'status':_0x5eb4ff,'server':a0_0x5e1407(),'hostname':a0_0x5e1407(),'agent':this['agent'],'project_dir':process[_0x13a588(0x141)](),..._0x214cdd});}async['getAllStatus'](){const _0x3a3b59=a0_0x3202f1;return this['call'](_0x3a3b59(0xf9),{});}async[a0_0x3202f1(0xfd)](_0x303db7,_0x3c151f){const _0x3ccc8d=a0_0x3202f1;return this[_0x3ccc8d(0x136)](_0x3ccc8d(0xfd),{'message':_0x303db7,'filter_server':_0x3c151f?.[_0x3ccc8d(0x104)],'filter_status':_0x3c151f?.[_0x3ccc8d(0x105)]});}async[a0_0x3202f1(0x112)](){const _0x4e2f29=a0_0x3202f1;let _0x421715=encodeURIComponent(this[_0x4e2f29(0x140)]),_0xe65260=this['url']+_0x4e2f29(0x118)+_0x421715,_0x5ec7ba=this[_0x4e2f29(0xec)];while(this['running']){try{this[_0x4e2f29(0x147)]=new AbortController();let _0x112588={'Accept':_0x4e2f29(0x10f)};if(this[_0x4e2f29(0x11b)])_0x112588['Authorization']='Bearer\x20'+this[_0x4e2f29(0x11b)];let _0x56de16=await fetch(_0xe65260,{'headers':_0x112588,'signal':this[_0x4e2f29(0x147)][_0x4e2f29(0x142)]});if(!_0x56de16['ok']||!_0x56de16['body']){this['log'](_0x4e2f29(0x143)+_0x56de16[_0x4e2f29(0x105)]),await this['sleep'](_0x5ec7ba),_0x5ec7ba=Math[_0x4e2f29(0x111)](_0x5ec7ba*1.5,0xea60);continue;}_0x5ec7ba=this[_0x4e2f29(0xec)];let _0x147311=_0x56de16[_0x4e2f29(0xef)]['getReader'](),_0x1073aa=new TextDecoder(),_0x5ca052='';while(this[_0x4e2f29(0x12a)]){let {done:_0x1079e4,value:_0x1474e9}=await _0x147311['read']();if(_0x1079e4)break;_0x5ca052+=_0x1073aa[_0x4e2f29(0x14a)](_0x1474e9,{'stream':!0x0});let _0x333886=_0x5ca052[_0x4e2f29(0x123)]('\x0a');_0x5ca052=_0x333886[_0x4e2f29(0xe6)]()||'';for(let _0x2eded1 of _0x333886){if(!_0x2eded1[_0x4e2f29(0x145)](_0x4e2f29(0x109)))continue;try{let _0x407b67=JSON[_0x4e2f29(0xf0)](_0x2eded1[_0x4e2f29(0xd2)](0x6));if(_0x407b67[_0x4e2f29(0x13d)]==='connected'){this['log']('SSE\x20connected'),this[_0x4e2f29(0x113)](_0x4e2f29(0x13c));continue;}if(_0x407b67[_0x4e2f29(0x13d)]===_0x4e2f29(0xf4)||_0x407b67[_0x4e2f29(0x13d)]===_0x4e2f29(0x10c)||_0x407b67[_0x4e2f29(0x13d)]===_0x4e2f29(0xfd))await this[_0x4e2f29(0x12e)]();}catch{}}}}catch(_0x274ad0){if(_0x274ad0[_0x4e2f29(0x150)]==='AbortError')break;this[_0x4e2f29(0x113)](_0x4e2f29(0x103),_0x274ad0),this[_0x4e2f29(0xdd)](_0x4e2f29(0x14d)+_0x274ad0[_0x4e2f29(0x13e)]);}if(this[_0x4e2f29(0x12a)])this[_0x4e2f29(0x113)](_0x4e2f29(0x144)),this[_0x4e2f29(0xdd)](_0x4e2f29(0x10a)+_0x5ec7ba/0x3e8+'s...'),await this['sleep'](_0x5ec7ba),_0x5ec7ba=Math[_0x4e2f29(0x111)](_0x5ec7ba*1.5,0xea60);}}async[a0_0x3202f1(0x12e)](){const _0x493a77=a0_0x3202f1;try{let _0xe6fcfd=(await this['call']('get_inbox',{'alias':this['alias'],'limit':0xa}))?.[_0x493a77(0x13b)]||[];for(let _0x3a1850 of _0xe6fcfd)await this[_0x493a77(0x136)](_0x493a77(0x132),{'alias':this[_0x493a77(0x140)],'message_id':_0x3a1850['id']}),this[_0x493a77(0xdd)]('←\x20'+_0x3a1850[_0x493a77(0xda)]+':\x20'+_0x3a1850['content'][_0x493a77(0xd2)](0x0,0x3c)),this[_0x493a77(0x113)](_0x493a77(0xe0),_0x3a1850),this[_0x493a77(0x113)](_0x493a77(0x13e),_0x3a1850);}catch(_0x196d3d){this[_0x493a77(0xdd)](_0x493a77(0x10b)+_0x196d3d[_0x493a77(0x13e)]);}}['sleep'](_0xd7c6ad){return new Promise(_0x123e39=>setTimeout(_0x123e39,_0xd7c6ad));}}var F=$;export{F as default,$ as CommHub};
|