@sleep2agi/agent-network 2.3.0-preview.228 → 2.3.0-preview.229

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.
@@ -1 +1 @@
1
- const a0_0x63ad68=a0_0x5b23;(function(_0x613d0a,_0xc86186){const _0x139193=a0_0x5b23,_0x4471aa=_0x613d0a();while(!![]){try{const _0x32dced=-parseInt(_0x139193(0x22b))/0x1*(parseInt(_0x139193(0x239))/0x2)+parseInt(_0x139193(0x230))/0x3+parseInt(_0x139193(0x241))/0x4+parseInt(_0x139193(0x20c))/0x5+parseInt(_0x139193(0x20f))/0x6+parseInt(_0x139193(0x20b))/0x7*(parseInt(_0x139193(0x221))/0x8)+-parseInt(_0x139193(0x1f6))/0x9;if(_0x32dced===_0xc86186)break;else _0x4471aa['push'](_0x4471aa['shift']());}catch(_0x99db62){_0x4471aa['push'](_0x4471aa['shift']());}}}(a0_0x2df6,0x61ad9));function a0_0x5b23(_0x271da4,_0x440929){_0x271da4=_0x271da4-0x1cc;const _0x2df6cc=a0_0x2df6();let _0x5b23cc=_0x2df6cc[_0x271da4];return _0x5b23cc;}import{EventEmitter as a0_0x342cd7}from'events';import{hostname as a0_0x22f7a2}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2d08b8,_0x2b239e)=>(_0x2d08b8??_0x2b239e)[a0_0x63ad68(0x205)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0xd6c1){const _0x5ab026=a0_0x63ad68;return(_0xd6c1 instanceof Error?_0xd6c1[_0x5ab026(0x1f2)]:String(_0xd6c1??_0x5ab026(0x202)))[_0x5ab026(0x205)](K,_0x5ab026(0x244))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x5ab026(0x232)](0x0,0xf0);}function O(_0x46cc5a,_0x2e814f=process.env.ANET_TASK_TRACE_FORMAT===a0_0x63ad68(0x1d5)){const _0x2fecaa=a0_0x63ad68;if(_0x2e814f)return JSON[_0x2fecaa(0x231)](_0x46cc5a);let _0x392d29=L(_0x46cc5a[_0x2fecaa(0x203)],_0x2fecaa(0x1f7)),_0x3545b2=L(_0x46cc5a[_0x2fecaa(0x1e8)],_0x2fecaa(0x1f1)),_0x10ceaf=_0x46cc5a[_0x2fecaa(0x224)]?_0x2fecaa(0x1e2)+_0x46cc5a[_0x2fecaa(0x224)]+':'+(_0x46cc5a[_0x2fecaa(0x223)]??''):'';return'[commhub:task]\x20'+_0x46cc5a[_0x2fecaa(0x1db)]+_0x2fecaa(0x218)+L(_0x46cc5a[_0x2fecaa(0x1ff)],_0x2fecaa(0x23b))+'\x20to='+L(_0x46cc5a[_0x2fecaa(0x1cf)],_0x2fecaa(0x23b))+'\x20task_id='+_0x3545b2+_0x2fecaa(0x1e3)+_0x392d29+_0x2fecaa(0x1df)+L(_0x46cc5a[_0x2fecaa(0x1ce)],'<unknown>')+_0x2fecaa(0x214)+_0x46cc5a['transport']+_0x2fecaa(0x1ec)+_0x46cc5a[_0x2fecaa(0x1fd)]+'\x20lifecycle='+_0x46cc5a[_0x2fecaa(0x245)]+_0x10ceaf;}function U(_0x255a03){const _0x4204f3=a0_0x63ad68;return{'event':{'sending':_0x4204f3(0x233),'delivered':_0x4204f3(0x215),'failed':'task.send.failed','acked':'task.ack','started':_0x4204f3(0x1dd),'replied':_0x4204f3(0x22e),'expired':_0x4204f3(0x1d4)}[_0x255a03[_0x4204f3(0x1db)]],..._0x255a03};}function j(_0x566e33){const _0x6f8b55=a0_0x63ad68;let _0x196add=_0x566e33?.['task_id']||_0x566e33?.[_0x6f8b55(0x1ea)]||_0x566e33?.['id'];if(_0x196add)return String(_0x196add);let _0x2a54d1=_0x566e33?.[_0x6f8b55(0x23a)]?.[0x0]?.[_0x6f8b55(0x21f)];if(typeof _0x2a54d1!=='string')return null;try{let _0x1d1a1c=JSON[_0x6f8b55(0x1eb)](_0x2a54d1);return _0x1d1a1c?.[_0x6f8b55(0x1e8)]||_0x1d1a1c?.[_0x6f8b55(0x1ea)]||_0x1d1a1c?.['id']||null;}catch{return null;}}async function X(_0x45f186,_0x4d7973){const _0x4766b7=a0_0x63ad68;let _0x50a187=_0x4d7973[_0x4766b7(0x1d7)]??Date[_0x4766b7(0x1d7)],_0x875302=_0x50a187(),_0x59e262=(_0x42cb68,_0x416224,_0x3c91ff,_0xe4a3f7)=>{const _0x2d7ab7=_0x4766b7;_0x4d7973[_0x2d7ab7(0x20a)](O(U({'from_alias':_0x45f186[_0x2d7ab7(0x238)],'to_alias':_0x45f186[_0x2d7ab7(0x237)],'task_id':_0x416224,'parent_task_id':_0x45f186[_0x2d7ab7(0x1f8)],'network_id':_0x45f186[_0x2d7ab7(0x1fa)],'transport':_0x45f186[_0x2d7ab7(0x22d)],'status':_0x42cb68,'duration_ms':_0x50a187()-_0x875302,'lifecycle_tracking':_0x45f186[_0x2d7ab7(0x20e)],..._0x3c91ff!==void 0x0?{'error_code':_0xe4a3f7||_0x2d7ab7(0x206),'error_message':N(_0x3c91ff)}:{}})));};_0x59e262(_0x4766b7(0x22a),null);try{let _0x534649=await _0x4d7973[_0x4766b7(0x228)](),_0x4ff505=j(_0x534649);if(_0x4ff505)_0x59e262(_0x4766b7(0x1f9),_0x4ff505);else{if(_0x534649?.['ok']===!0x1||_0x534649?.[_0x4766b7(0x1fb)])_0x59e262(_0x4766b7(0x1cc),_0x4ff505,_0x534649?.[_0x4766b7(0x1fb)]||_0x4766b7(0x226),_0x4766b7(0x1e0));else _0x59e262('failed',null,'CommHub\x20response\x20omitted\x20task_id','missing_task_id');}return _0x534649;}catch(_0x59ab2d){throw _0x59e262(_0x4766b7(0x1cc),null,_0x59ab2d,_0x4766b7(0x206)),_0x59ab2d;}}async function Y(_0x18e063,_0x56fbae){const _0x11b400=a0_0x63ad68;return X({'fromAlias':_0x18e063[_0x11b400(0x238)],'toAlias':_0x18e063[_0x11b400(0x210)],'parentTaskId':_0x18e063['parentTaskId']||null,'networkId':_0x18e063[_0x11b400(0x1fa)]||null,'transport':_0x11b400(0x229),'lifecycleTracking':_0x11b400(0x242)},_0x56fbae);}class $ extends a0_0x342cd7{[a0_0x63ad68(0x21b)];[a0_0x63ad68(0x210)];[a0_0x63ad68(0x208)];[a0_0x63ad68(0x240)];[a0_0x63ad68(0x235)];[a0_0x63ad68(0x1e1)];[a0_0x63ad68(0x1d6)];[a0_0x63ad68(0x1cd)];[a0_0x63ad68(0x1da)];[a0_0x63ad68(0x217)]=!0x1;constructor(_0xd92f76){const _0x56cdf5=a0_0x63ad68;super();if(this['url']=_0xd92f76['url'][_0x56cdf5(0x205)](/\/$/,''),this['alias']=_0xd92f76['alias'],this[_0x56cdf5(0x208)]=_0xd92f76[_0x56cdf5(0x208)],this[_0x56cdf5(0x240)]=_0xd92f76['agent']||_0x56cdf5(0x21e),this[_0x56cdf5(0x235)]='sdk-'+_0xd92f76[_0x56cdf5(0x210)]+'-'+Date['now']()[_0x56cdf5(0x247)](0x24),this[_0x56cdf5(0x1e1)]=_0xd92f76[_0x56cdf5(0x1e1)]??0x2bf20,this[_0x56cdf5(0x1d6)]=_0xd92f76[_0x56cdf5(0x1d6)]??0xbb8,_0xd92f76[_0x56cdf5(0x1fe)]!==!0x1)this[_0x56cdf5(0x1f5)]();}[a0_0x63ad68(0x20a)](_0xdbc59){const _0x5c4701=a0_0x63ad68;console[_0x5c4701(0x20a)]('['+new Date()[_0x5c4701(0x1d8)]()[_0x5c4701(0x232)](0x0,0x8)+']\x20[commhub:'+this[_0x5c4701(0x210)]+']\x20'+_0xdbc59);}async[a0_0x63ad68(0x236)](_0x30d201,_0x3661ff){const _0x59cde2=a0_0x63ad68;let _0x36c226={'Content-Type':_0x59cde2(0x204),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x36c226[_0x59cde2(0x1fc)]=_0x59cde2(0x246)+this[_0x59cde2(0x208)];let _0x28d16f=await(await fetch(this[_0x59cde2(0x21b)]+_0x59cde2(0x1ef),{'method':_0x59cde2(0x22c),'headers':_0x36c226,'body':JSON[_0x59cde2(0x231)]({'jsonrpc':_0x59cde2(0x213),'id':Date[_0x59cde2(0x1d7)](),'method':_0x59cde2(0x201),'params':{'name':_0x30d201,'arguments':_0x3661ff}})}))[_0x59cde2(0x21f)](),_0x5cfb24=_0x28d16f[_0x59cde2(0x20d)](/data: (.+)/),_0x5330f4=_0x5cfb24?JSON['parse'](_0x5cfb24[0x1]):JSON[_0x59cde2(0x1eb)](_0x28d16f),_0x5aa2ff=_0x5330f4?.['result']?.[_0x59cde2(0x23a)]?.[0x0]?.[_0x59cde2(0x21f)];return _0x5aa2ff?JSON[_0x59cde2(0x1eb)](_0x5aa2ff):_0x5330f4;}async[a0_0x63ad68(0x1f5)](){const _0x19fed8=a0_0x63ad68;if(this[_0x19fed8(0x217)])return;this[_0x19fed8(0x217)]=!0x0,await this[_0x19fed8(0x1db)](_0x19fed8(0x23e)),this[_0x19fed8(0x20a)](_0x19fed8(0x1d3)),this[_0x19fed8(0x1cd)]=setInterval(()=>{const _0x198ea3=_0x19fed8;this['status'](_0x198ea3(0x23e))['catch'](_0x4f2ba2=>this['log'](_0x198ea3(0x21a)+_0x4f2ba2[_0x198ea3(0x1f2)]));},this[_0x19fed8(0x1e1)]),this[_0x19fed8(0x225)]();}async['disconnect'](){const _0x449b0c=a0_0x63ad68;if(this[_0x449b0c(0x217)]=!0x1,this[_0x449b0c(0x1da)]?.['abort'](),this[_0x449b0c(0x1cd)])clearInterval(this['heartbeatTimer']);await this['status']('offline')[_0x449b0c(0x23f)](()=>{}),this['log']('disconnected');}async['send'](_0x21b385,_0x240237,_0x4bc307=a0_0x63ad68(0x222)){const _0x3100b2=a0_0x63ad68;return Y({'alias':_0x21b385,'fromAlias':this['alias']},{'log':_0x472dec=>console[_0x3100b2(0x20a)](_0x472dec),'send':()=>this['call'](_0x3100b2(0x1ee),{'alias':_0x21b385,'task':_0x240237,'priority':_0x4bc307,'from_session':this[_0x3100b2(0x210)]})});}async[a0_0x63ad68(0x1f2)](_0x2b0491,_0x5ece0c){const _0x14db0d=a0_0x63ad68;return this[_0x14db0d(0x236)]('send_message',{'alias':_0x2b0491,'message':_0x5ece0c,'from_session':this[_0x14db0d(0x210)]});}async[a0_0x63ad68(0x1d9)](_0x31a901,_0x4ab2a8,_0x260e14=a0_0x63ad68(0x1dc)){const _0x340d2c=a0_0x63ad68;return this[_0x340d2c(0x236)]('send_reply',{'in_reply_to':_0x31a901,'text':_0x4ab2a8,'status':_0x260e14});}async[a0_0x63ad68(0x1db)](_0xb10327,_0x26ca4d){const _0xad1335=a0_0x63ad68;return this[_0xad1335(0x236)](_0xad1335(0x1d1),{'resume_id':this[_0xad1335(0x235)],'alias':this[_0xad1335(0x210)],'status':_0xb10327,'server':a0_0x22f7a2(),'hostname':a0_0x22f7a2(),'agent':this['agent'],'project_dir':process[_0xad1335(0x1de)](),..._0x26ca4d});}async[a0_0x63ad68(0x23c)](){return this['call']('get_all_status',{});}async['broadcast'](_0x584b2c,_0x3359e8){const _0x29e438=a0_0x63ad68;return this[_0x29e438(0x236)]('broadcast',{'message':_0x584b2c,'filter_server':_0x3359e8?.[_0x29e438(0x21d)],'filter_status':_0x3359e8?.[_0x29e438(0x1db)]});}async[a0_0x63ad68(0x225)](){const _0x40e14a=a0_0x63ad68;let _0x1b4b53=encodeURIComponent(this[_0x40e14a(0x210)]),_0x377b92=this[_0x40e14a(0x21b)]+_0x40e14a(0x1e6)+_0x1b4b53,_0x37a25c=this[_0x40e14a(0x1d6)];while(this['running']){try{this[_0x40e14a(0x1da)]=new AbortController();let _0x5cc3c1={'Accept':_0x40e14a(0x216)};if(this['token'])_0x5cc3c1['Authorization']='Bearer\x20'+this['token'];let _0x291327=await fetch(_0x377b92,{'headers':_0x5cc3c1,'signal':this['sseAbort'][_0x40e14a(0x21c)]});if(!_0x291327['ok']||!_0x291327['body']){this[_0x40e14a(0x20a)](_0x40e14a(0x1ed)+_0x291327['status']),await this[_0x40e14a(0x1f0)](_0x37a25c),_0x37a25c=Math[_0x40e14a(0x220)](_0x37a25c*1.5,0xea60);continue;}_0x37a25c=this[_0x40e14a(0x1d6)];let _0x4b2971=_0x291327[_0x40e14a(0x22f)][_0x40e14a(0x209)](),_0x1a1af5=new TextDecoder(),_0x23587e='';while(this[_0x40e14a(0x217)]){let {done:_0x53d16c,value:_0x1d6d2c}=await _0x4b2971[_0x40e14a(0x207)]();if(_0x53d16c)break;_0x23587e+=_0x1a1af5[_0x40e14a(0x1e9)](_0x1d6d2c,{'stream':!0x0});let _0x5d73ab=_0x23587e[_0x40e14a(0x1d0)]('\x0a');_0x23587e=_0x5d73ab['pop']()||'';for(let _0x49ad99 of _0x5d73ab){if(!_0x49ad99[_0x40e14a(0x243)]('data:\x20'))continue;try{let _0x1f8d3f=JSON[_0x40e14a(0x1eb)](_0x49ad99[_0x40e14a(0x232)](0x6));if(_0x1f8d3f['type']===_0x40e14a(0x1e4)){this['log'](_0x40e14a(0x212)),this[_0x40e14a(0x23d)]('connected');continue;}if(_0x1f8d3f[_0x40e14a(0x227)]===_0x40e14a(0x234)||_0x1f8d3f[_0x40e14a(0x227)]==='new_message'||_0x1f8d3f['type']==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x1fd3d4){if(_0x1fd3d4['name']===_0x40e14a(0x219))break;this[_0x40e14a(0x23d)](_0x40e14a(0x1fb),_0x1fd3d4),this[_0x40e14a(0x20a)](_0x40e14a(0x211)+_0x1fd3d4[_0x40e14a(0x1f2)]);}if(this[_0x40e14a(0x217)])this['emit'](_0x40e14a(0x1d2)),this[_0x40e14a(0x20a)]('SSE\x20reconnecting\x20in\x20'+_0x37a25c/0x3e8+'s...'),await this[_0x40e14a(0x1f0)](_0x37a25c),_0x37a25c=Math[_0x40e14a(0x220)](_0x37a25c*1.5,0xea60);}}async['processInbox'](){const _0x2b1602=a0_0x63ad68;try{let _0x2783c5=(await this[_0x2b1602(0x236)]('get_inbox',{'alias':this['alias'],'limit':0xa}))?.[_0x2b1602(0x1e7)]||[];for(let _0x24ee56 of _0x2783c5)await this['call'](_0x2b1602(0x200),{'alias':this[_0x2b1602(0x210)],'message_id':_0x24ee56['id']}),this[_0x2b1602(0x20a)]('←\x20'+_0x24ee56[_0x2b1602(0x1f4)]+':\x20'+_0x24ee56['content'][_0x2b1602(0x232)](0x0,0x3c)),this[_0x2b1602(0x23d)](_0x2b1602(0x1e5),_0x24ee56),this[_0x2b1602(0x23d)]('message',_0x24ee56);}catch(_0x1137b9){this[_0x2b1602(0x20a)](_0x2b1602(0x1f3)+_0x1137b9[_0x2b1602(0x1f2)]);}}[a0_0x63ad68(0x1f0)](_0x5039c5){return new Promise(_0x17e9c1=>setTimeout(_0x17e9c1,_0x5039c5));}}function a0_0x2df6(){const _0x29408f=['<missing>','parentTaskId','delivered','networkId','error','Authorization','duration_ms','autoConnect','from_alias','ack_inbox','tools/call','unknown\x20error','parent_task_id','application/json','replace','send_failed','read','token','getReader','log','1015macGRr','3524425rpfilQ','match','lifecycleTracking','4762374MDRKoe','alias','SSE\x20error:\x20','SSE\x20connected','2.0','\x20transport=','task.send.delivered','text/event-stream','running','\x20from=','AbortError','heartbeat\x20failed:\x20','url','signal','server','sdk','text','min','3592cxbChM','normal','error_message','error_code','connectSSE','CommHub\x20rejected\x20task','type','send','mcp_http','sending','9rdcnbD','POST','transport','task.replied','body','2148717ZdoIHX','stringify','slice','task.send.start','new_task','resumeId','call','toAlias','fromAlias','165486haKDZA','content','<unknown>','getAllStatus','emit','idle','catch','agent','890216dPUQgm','not_tracked','startsWith','[REDACTED]','lifecycle_tracking','Bearer\x20','toString','failed','heartbeatTimer','network_id','to_alias','split','report_status','disconnected','registered','task.expired','json','reconnectDelay','now','toTimeString','reply','sseAbort','status','completed','task.started','cwd','\x20network_id=','send_rejected','heartbeatInterval','\x20error=','\x20parent_task_id=','connected','task','/events/','messages','task_id','decode','message_id','parse','\x20duration_ms=','SSE\x20failed:\x20','send_task','/mcp','sleep','<pending>','message','inbox\x20error:\x20','from_session','connect','12219624WAeARF'];a0_0x2df6=function(){return _0x29408f;};return a0_0x2df6();}var F=$;export{F as default,$ as CommHub};
1
+ function a0_0x2be2(_0x3e391f,_0x12350f){_0x3e391f=_0x3e391f-0xcb;const _0x20cd5e=a0_0x20cd();let _0x2be285=_0x20cd5e[_0x3e391f];return _0x2be285;}const a0_0x5cf1b6=a0_0x2be2;(function(_0x117ca9,_0x4cbdff){const _0xa151a6=a0_0x2be2,_0x8cd9c2=_0x117ca9();while(!![]){try{const _0x9414b9=parseInt(_0xa151a6(0xe1))/0x1+parseInt(_0xa151a6(0x13d))/0x2+-parseInt(_0xa151a6(0xd3))/0x3+parseInt(_0xa151a6(0x112))/0x4+parseInt(_0xa151a6(0xee))/0x5*(-parseInt(_0xa151a6(0x104))/0x6)+parseInt(_0xa151a6(0x101))/0x7+parseInt(_0xa151a6(0x11a))/0x8;if(_0x9414b9===_0x4cbdff)break;else _0x8cd9c2['push'](_0x8cd9c2['shift']());}catch(_0x192a51){_0x8cd9c2['push'](_0x8cd9c2['shift']());}}}(a0_0x20cd,0xa6972));import{EventEmitter as a0_0x416f38}from'events';import{hostname as a0_0x3adae1}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1957fb,_0x557a61)=>(_0x1957fb??_0x557a61)[a0_0x5cf1b6(0x134)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x3ebce3){const _0x2c125e=a0_0x5cf1b6;return(_0x3ebce3 instanceof Error?_0x3ebce3[_0x2c125e(0xe5)]:String(_0x3ebce3??'unknown\x20error'))['replace'](K,_0x2c125e(0xf3))[_0x2c125e(0x134)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x308dce,_0x3749dd=process.env.ANET_TASK_TRACE_FORMAT===a0_0x5cf1b6(0xf9)){const _0x487890=a0_0x5cf1b6;if(_0x3749dd)return JSON[_0x487890(0xe6)](_0x308dce);let _0xf08c8=L(_0x308dce[_0x487890(0x130)],_0x487890(0xfd)),_0xf8961e=L(_0x308dce[_0x487890(0xd4)],_0x487890(0x118)),_0x3c3934=_0x308dce[_0x487890(0xdf)]?_0x487890(0x10d)+_0x308dce[_0x487890(0xdf)]+':'+(_0x308dce[_0x487890(0xff)]??''):'';return _0x487890(0xdb)+_0x308dce[_0x487890(0x115)]+_0x487890(0xd5)+L(_0x308dce['from_alias'],'<unknown>')+_0x487890(0xf5)+L(_0x308dce[_0x487890(0xda)],'<unknown>')+_0x487890(0x146)+_0xf8961e+'\x20parent_task_id='+_0xf08c8+_0x487890(0x127)+L(_0x308dce[_0x487890(0x116)],_0x487890(0x12b))+_0x487890(0x147)+_0x308dce[_0x487890(0x144)]+_0x487890(0x13c)+_0x308dce[_0x487890(0x143)]+_0x487890(0x133)+_0x308dce[_0x487890(0x136)]+_0x3c3934;}function U(_0x53f472){const _0xc5e292=a0_0x5cf1b6;return{'event':{'sending':'task.send.start','delivered':_0xc5e292(0xd0),'failed':_0xc5e292(0x128),'acked':_0xc5e292(0xd8),'started':'task.started','replied':_0xc5e292(0x12f),'expired':_0xc5e292(0xf1)}[_0x53f472['status']],..._0x53f472};}function a0_0x20cd(){const _0x58166b=['Authorization','heartbeatTimer','type','error_code','split','189774mQtNnQ','/mcp','send_message','sdk-','message','stringify','connectSSE','now','SSE\x20error:\x20','alias','CommHub\x20response\x20omitted\x20task_id','lifecycleTracking','emit','1881935UVwJyh','ack_inbox','sseAbort','task.expired','send_reply','[REDACTED]','normal','\x20to=','error','application/json,\x20text/event-stream','reply','json','registered','slice','abort','<missing>','url','error_message','get_inbox','3422321ZExptD','connect','new_task','6NjmuGM','string','completed','name','pop','s...','Bearer\x20','SSE\x20failed:\x20','from_session','\x20error=','send','CommHub\x20rejected\x20task','parse','min','998460lzQJdZ','failed','tools/call','status','network_id','disconnect','<pending>','token','1710968bFIAGD','mcp_http','networkId','get_all_status','POST','not_tracked','parentTaskId','result','delivered','sleep','startsWith','reconnectDelay','sending','\x20network_id=','task.send.failed','body','call','<unknown>','heartbeat\x20failed:\x20','agent','server','task.replied','parent_task_id','fromAlias','running','\x20lifecycle=','replace','missing_task_id','lifecycle_tracking','resumeId','cwd','log','send_failed','toAlias','\x20duration_ms=','2327510Yknqkt','AbortError','match','toString','content',']\x20[commhub:','duration_ms','transport','catch','\x20task_id=','\x20transport=','new_message','2.0','SSE\x20reconnecting\x20in\x20','heartbeatInterval','idle','task.send.delivered','message_id','inbox\x20error:\x20','3741531DKEURu','task_id','\x20from=','send_task','text','task.ack','connected','to_alias','[commhub:task]\x20'];a0_0x20cd=function(){return _0x58166b;};return a0_0x20cd();}function j(_0x34c5be){const _0x5b92aa=a0_0x5cf1b6;let _0x4c813b=_0x34c5be?.[_0x5b92aa(0xd4)]||_0x34c5be?.[_0x5b92aa(0xd1)]||_0x34c5be?.['id'];if(_0x4c813b)return String(_0x4c813b);let _0x4ebc95=_0x34c5be?.[_0x5b92aa(0x141)]?.[0x0]?.[_0x5b92aa(0xd7)];if(typeof _0x4ebc95!==_0x5b92aa(0x105))return null;try{let _0x1921f7=JSON[_0x5b92aa(0x110)](_0x4ebc95);return _0x1921f7?.[_0x5b92aa(0xd4)]||_0x1921f7?.['message_id']||_0x1921f7?.['id']||null;}catch{return null;}}async function X(_0x5a100f,_0x3900f8){const _0x17b8cc=a0_0x5cf1b6;let _0xb33e=_0x3900f8['now']??Date['now'],_0x45c384=_0xb33e(),_0x303c83=(_0x563ae4,_0x332602,_0x3abeaa,_0x19c1f0)=>{const _0x22044c=a0_0x2be2;_0x3900f8[_0x22044c(0x139)](O(U({'from_alias':_0x5a100f[_0x22044c(0x131)],'to_alias':_0x5a100f[_0x22044c(0x13b)],'task_id':_0x332602,'parent_task_id':_0x5a100f[_0x22044c(0x120)],'network_id':_0x5a100f[_0x22044c(0x11c)],'transport':_0x5a100f[_0x22044c(0x144)],'status':_0x563ae4,'duration_ms':_0xb33e()-_0x45c384,'lifecycle_tracking':_0x5a100f[_0x22044c(0xec)],..._0x3abeaa!==void 0x0?{'error_code':_0x19c1f0||_0x22044c(0x13a),'error_message':N(_0x3abeaa)}:{}})));};_0x303c83(_0x17b8cc(0x126),null);try{let _0x2e0bfc=await _0x3900f8[_0x17b8cc(0x10e)](),_0x5224f9=j(_0x2e0bfc);if(_0x5224f9)_0x303c83(_0x17b8cc(0x122),_0x5224f9);else{if(_0x2e0bfc?.['ok']===!0x1||_0x2e0bfc?.[_0x17b8cc(0xf6)])_0x303c83(_0x17b8cc(0x113),_0x5224f9,_0x2e0bfc?.[_0x17b8cc(0xf6)]||_0x17b8cc(0x10f),'send_rejected');else _0x303c83(_0x17b8cc(0x113),null,_0x17b8cc(0xeb),_0x17b8cc(0x135));}return _0x2e0bfc;}catch(_0x440f4e){throw _0x303c83(_0x17b8cc(0x113),null,_0x440f4e,_0x17b8cc(0x13a)),_0x440f4e;}}async function Y(_0x58c1c6,_0x3a1220){const _0xadb9d3=a0_0x5cf1b6;return X({'fromAlias':_0x58c1c6['fromAlias'],'toAlias':_0x58c1c6[_0xadb9d3(0xea)],'parentTaskId':_0x58c1c6[_0xadb9d3(0x120)]||null,'networkId':_0x58c1c6[_0xadb9d3(0x11c)]||null,'transport':_0xadb9d3(0x11b),'lifecycleTracking':_0xadb9d3(0x11f)},_0x3a1220);}class $ extends a0_0x416f38{[a0_0x5cf1b6(0xfe)];[a0_0x5cf1b6(0xea)];['token'];[a0_0x5cf1b6(0x12d)];[a0_0x5cf1b6(0x137)];[a0_0x5cf1b6(0xce)];['reconnectDelay'];['heartbeatTimer'];['sseAbort'];[a0_0x5cf1b6(0x132)]=!0x1;constructor(_0x482d03){const _0x56c9d4=a0_0x5cf1b6;super();if(this['url']=_0x482d03[_0x56c9d4(0xfe)][_0x56c9d4(0x134)](/\/$/,''),this[_0x56c9d4(0xea)]=_0x482d03[_0x56c9d4(0xea)],this[_0x56c9d4(0x119)]=_0x482d03[_0x56c9d4(0x119)],this['agent']=_0x482d03['agent']||'sdk',this[_0x56c9d4(0x137)]=_0x56c9d4(0xe4)+_0x482d03[_0x56c9d4(0xea)]+'-'+Date[_0x56c9d4(0xe8)]()[_0x56c9d4(0x140)](0x24),this[_0x56c9d4(0xce)]=_0x482d03['heartbeatInterval']??0x2bf20,this[_0x56c9d4(0x125)]=_0x482d03[_0x56c9d4(0x125)]??0xbb8,_0x482d03['autoConnect']!==!0x1)this[_0x56c9d4(0x102)]();}[a0_0x5cf1b6(0x139)](_0x1db1e0){const _0x2e30fd=a0_0x5cf1b6;console['log']('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x2e30fd(0x142)+this[_0x2e30fd(0xea)]+']\x20'+_0x1db1e0);}async[a0_0x5cf1b6(0x12a)](_0x5a3d22,_0x652bd7){const _0x511cbf=a0_0x5cf1b6;let _0x4d8ed3={'Content-Type':'application/json','Accept':_0x511cbf(0xf7)};if(this[_0x511cbf(0x119)])_0x4d8ed3[_0x511cbf(0xdc)]=_0x511cbf(0x10a)+this[_0x511cbf(0x119)];let _0x174912=await(await fetch(this['url']+_0x511cbf(0xe2),{'method':_0x511cbf(0x11e),'headers':_0x4d8ed3,'body':JSON[_0x511cbf(0xe6)]({'jsonrpc':_0x511cbf(0xcc),'id':Date[_0x511cbf(0xe8)](),'method':_0x511cbf(0x114),'params':{'name':_0x5a3d22,'arguments':_0x652bd7}})}))[_0x511cbf(0xd7)](),_0x527f91=_0x174912[_0x511cbf(0x13f)](/data: (.+)/),_0x3de943=_0x527f91?JSON[_0x511cbf(0x110)](_0x527f91[0x1]):JSON[_0x511cbf(0x110)](_0x174912),_0x371256=_0x3de943?.[_0x511cbf(0x121)]?.[_0x511cbf(0x141)]?.[0x0]?.['text'];return _0x371256?JSON[_0x511cbf(0x110)](_0x371256):_0x3de943;}async['connect'](){const _0x50bb4b=a0_0x5cf1b6;if(this[_0x50bb4b(0x132)])return;this[_0x50bb4b(0x132)]=!0x0,await this[_0x50bb4b(0x115)](_0x50bb4b(0xcf)),this['log'](_0x50bb4b(0xfa)),this[_0x50bb4b(0xdd)]=setInterval(()=>{const _0x45aa40=_0x50bb4b;this[_0x45aa40(0x115)](_0x45aa40(0xcf))[_0x45aa40(0x145)](_0x1bf4f6=>this['log'](_0x45aa40(0x12c)+_0x1bf4f6[_0x45aa40(0xe5)]));},this[_0x50bb4b(0xce)]),this[_0x50bb4b(0xe7)]();}async[a0_0x5cf1b6(0x117)](){const _0x4012fa=a0_0x5cf1b6;if(this['running']=!0x1,this['sseAbort']?.[_0x4012fa(0xfc)](),this['heartbeatTimer'])clearInterval(this[_0x4012fa(0xdd)]);await this['status']('offline')[_0x4012fa(0x145)](()=>{}),this[_0x4012fa(0x139)]('disconnected');}async['send'](_0x3143f2,_0x3b0256,_0x55ad53=a0_0x5cf1b6(0xf4)){const _0x166c2b=a0_0x5cf1b6;return Y({'alias':_0x3143f2,'fromAlias':this[_0x166c2b(0xea)]},{'log':_0x57b14e=>console[_0x166c2b(0x139)](_0x57b14e),'send':()=>this['call'](_0x166c2b(0xd6),{'alias':_0x3143f2,'task':_0x3b0256,'priority':_0x55ad53,'from_session':this[_0x166c2b(0xea)]})});}async[a0_0x5cf1b6(0xe5)](_0x2099ff,_0x185f23){const _0x5b3252=a0_0x5cf1b6;return this[_0x5b3252(0x12a)](_0x5b3252(0xe3),{'alias':_0x2099ff,'message':_0x185f23,'from_session':this[_0x5b3252(0xea)]});}async[a0_0x5cf1b6(0xf8)](_0x583efa,_0x177772,_0x23a412=a0_0x5cf1b6(0x106)){const _0x5c9064=a0_0x5cf1b6;return this[_0x5c9064(0x12a)](_0x5c9064(0xf2),{'in_reply_to':_0x583efa,'text':_0x177772,'status':_0x23a412});}async[a0_0x5cf1b6(0x115)](_0x156c1f,_0x379f5f){const _0x96d09c=a0_0x5cf1b6;return this[_0x96d09c(0x12a)]('report_status',{'resume_id':this[_0x96d09c(0x137)],'alias':this[_0x96d09c(0xea)],'status':_0x156c1f,'server':a0_0x3adae1(),'hostname':a0_0x3adae1(),'agent':this['agent'],'project_dir':process[_0x96d09c(0x138)](),..._0x379f5f});}async['getAllStatus'](){const _0x14a8f4=a0_0x5cf1b6;return this['call'](_0x14a8f4(0x11d),{});}async['broadcast'](_0x1301fa,_0x187b3a){const _0xbe541f=a0_0x5cf1b6;return this['call']('broadcast',{'message':_0x1301fa,'filter_server':_0x187b3a?.[_0xbe541f(0x12e)],'filter_status':_0x187b3a?.[_0xbe541f(0x115)]});}async[a0_0x5cf1b6(0xe7)](){const _0x1d82b7=a0_0x5cf1b6;let _0x385c8f=encodeURIComponent(this['alias']),_0x573d9f=this[_0x1d82b7(0xfe)]+'/events/'+_0x385c8f,_0x3130e3=this[_0x1d82b7(0x125)];while(this['running']){try{this[_0x1d82b7(0xf0)]=new AbortController();let _0x32f062={'Accept':'text/event-stream'};if(this[_0x1d82b7(0x119)])_0x32f062[_0x1d82b7(0xdc)]=_0x1d82b7(0x10a)+this[_0x1d82b7(0x119)];let _0x5dbd34=await fetch(_0x573d9f,{'headers':_0x32f062,'signal':this['sseAbort']['signal']});if(!_0x5dbd34['ok']||!_0x5dbd34[_0x1d82b7(0x129)]){this[_0x1d82b7(0x139)](_0x1d82b7(0x10b)+_0x5dbd34[_0x1d82b7(0x115)]),await this[_0x1d82b7(0x123)](_0x3130e3),_0x3130e3=Math[_0x1d82b7(0x111)](_0x3130e3*1.5,0xea60);continue;}_0x3130e3=this['reconnectDelay'];let _0x53569f=_0x5dbd34[_0x1d82b7(0x129)]['getReader'](),_0x58357c=new TextDecoder(),_0x5e8638='';while(this[_0x1d82b7(0x132)]){let {done:_0x5f37f5,value:_0x19f2a6}=await _0x53569f['read']();if(_0x5f37f5)break;_0x5e8638+=_0x58357c['decode'](_0x19f2a6,{'stream':!0x0});let _0x3e22e1=_0x5e8638[_0x1d82b7(0xe0)]('\x0a');_0x5e8638=_0x3e22e1[_0x1d82b7(0x108)]()||'';for(let _0x4deb78 of _0x3e22e1){if(!_0x4deb78[_0x1d82b7(0x124)]('data:\x20'))continue;try{let _0x47e66e=JSON[_0x1d82b7(0x110)](_0x4deb78[_0x1d82b7(0xfb)](0x6));if(_0x47e66e[_0x1d82b7(0xde)]===_0x1d82b7(0xd9)){this[_0x1d82b7(0x139)]('SSE\x20connected'),this[_0x1d82b7(0xed)](_0x1d82b7(0xd9));continue;}if(_0x47e66e[_0x1d82b7(0xde)]===_0x1d82b7(0x103)||_0x47e66e[_0x1d82b7(0xde)]===_0x1d82b7(0xcb)||_0x47e66e['type']==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x143612){if(_0x143612[_0x1d82b7(0x107)]===_0x1d82b7(0x13e))break;this[_0x1d82b7(0xed)](_0x1d82b7(0xf6),_0x143612),this[_0x1d82b7(0x139)](_0x1d82b7(0xe9)+_0x143612[_0x1d82b7(0xe5)]);}if(this['running'])this[_0x1d82b7(0xed)]('disconnected'),this[_0x1d82b7(0x139)](_0x1d82b7(0xcd)+_0x3130e3/0x3e8+_0x1d82b7(0x109)),await this['sleep'](_0x3130e3),_0x3130e3=Math['min'](_0x3130e3*1.5,0xea60);}}async['processInbox'](){const _0xb5aa7d=a0_0x5cf1b6;try{let _0x30b526=(await this['call'](_0xb5aa7d(0x100),{'alias':this[_0xb5aa7d(0xea)],'limit':0xa}))?.['messages']||[];for(let _0x422b34 of _0x30b526)await this[_0xb5aa7d(0x12a)](_0xb5aa7d(0xef),{'alias':this['alias'],'message_id':_0x422b34['id']}),this['log']('←\x20'+_0x422b34[_0xb5aa7d(0x10c)]+':\x20'+_0x422b34[_0xb5aa7d(0x141)]['slice'](0x0,0x3c)),this[_0xb5aa7d(0xed)]('task',_0x422b34),this['emit'](_0xb5aa7d(0xe5),_0x422b34);}catch(_0x33afee){this['log'](_0xb5aa7d(0xd2)+_0x33afee[_0xb5aa7d(0xe5)]);}}[a0_0x5cf1b6(0x123)](_0x33a155){return new Promise(_0x460c2c=>setTimeout(_0x460c2c,_0x33a155));}}var F=$;export{F as default,$ as CommHub};
@@ -0,0 +1,74 @@
1
+ export declare const NODE_PERM_MODES: readonly ["normal", "readonly", "restricted"];
2
+ export type NodePermMode = (typeof NODE_PERM_MODES)[number];
3
+ export declare const NODE_PERM_USAGE = "Usage: anet node perm <node> [--json]\n anet node perm <node> [--mode normal|readonly|restricted]\n [--peers <a,b,\u2026>|none] [--peers-add <x>] [--peers-remove <x>]\n [--inbox <a,user:bob,\u2026>|none] [--inbox-add <x>] [--inbox-remove <x>]\n [--hub <url>] [--json]\n\nShow or change a node's permissions on the Hub.\n\n --mode normal | readonly | restricted\n --peers send-to allowlist: who this node may dispatch to (alias or node_id)\n --inbox receive-from allowlist: who may send tasks/messages to this node\n <alias> | <node_id> an agent\n user:<username> | user:<id> a person (Dashboard / app)\n user:* any person\n !strict also require the node's owner and\n network owner/admin to be listed\n none clears that allowlist (no restriction)\n --*-add/--*-remove edit one entry; removing the last entry is refused (use none)\n\n<node> is a local node name, a node_id, or a Hub alias. Changes need your user\nlogin (anet login) as the node's owner or a network owner/admin.\nWithout a change flag it only prints the current settings.\n\nExamples:\n anet node perm reviewer\n anet node perm reviewer --inbox planner,user:alice\n anet node perm reviewer --inbox-add user:bob\n anet node perm reviewer --peers none --mode normal --json";
4
+ type ListEdit = {
5
+ set: string[] | null;
6
+ } | {
7
+ add: string[];
8
+ remove: string[];
9
+ };
10
+ export type NodePermArgs = {
11
+ ref: string;
12
+ json: boolean;
13
+ hub?: string;
14
+ mode?: NodePermMode;
15
+ peers?: ListEdit;
16
+ inbox?: ListEdit;
17
+ };
18
+ export type NodePermState = {
19
+ node_id: string;
20
+ alias: string | null;
21
+ network_id: string | null;
22
+ permission_mode: string;
23
+ peer_allowlist: string[] | null;
24
+ /** undefined = this Hub does not know inbox allowlists yet (no node_inbox_allowlist capability). */
25
+ inbox_allowlist: string[] | null | undefined;
26
+ tool_allowlist: string[] | null;
27
+ rest_allowlist: string[] | null;
28
+ can_set_mode: boolean | null;
29
+ };
30
+ export declare function parseNodePermArgs(argv: string[]): {
31
+ ok: true;
32
+ args: NodePermArgs;
33
+ } | {
34
+ ok: false;
35
+ error: string;
36
+ };
37
+ export declare function hasNodePermChange(args: NodePermArgs): boolean;
38
+ /** Apply an edit to the current list. Returns the list to PUT (null = clear), or an error. */
39
+ export declare function applyListEdit(current: string[] | null, edit: ListEdit, label: string): {
40
+ ok: true;
41
+ next: string[] | null;
42
+ } | {
43
+ ok: false;
44
+ error: string;
45
+ };
46
+ export declare function stateFromNodeRow(row: Record<string, any>): NodePermState;
47
+ export declare function formatNodePerm(s: NodePermState): string[];
48
+ type HubCtx = {
49
+ hub: string;
50
+ token: string;
51
+ fetchImpl?: typeof fetch;
52
+ timeoutMs?: number;
53
+ };
54
+ export declare function describeHubFailure(status: number, body: any, what: string): string;
55
+ /** Find the node on the Hub: exact node_id first, then alias (must be unique across the networks you can see). */
56
+ export declare function findHubNode(ctx: HubCtx, ref: string, localNodeId?: string): Promise<{
57
+ ok: true;
58
+ row: Record<string, any>;
59
+ } | {
60
+ ok: false;
61
+ error: string;
62
+ }>;
63
+ export type NodePermResult = {
64
+ ok: true;
65
+ state: NodePermState;
66
+ changed: string[];
67
+ } | {
68
+ ok: false;
69
+ error: string;
70
+ state?: NodePermState;
71
+ changed?: string[];
72
+ };
73
+ export declare function runNodePerm(ctx: HubCtx, args: NodePermArgs, localNodeId?: string): Promise<NodePermResult>;
74
+ export {};