@sleep2agi/agent-network 2.3.0-preview.115 → 2.3.0-preview.117
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/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x12d0e6=a0_0x1e4d;(function(_0x4b1108,_0x12bfa9){const _0x9037e0=a0_0x1e4d,_0x463273=_0x4b1108();while(!![]){try{const _0x564b5d=-parseInt(_0x9037e0(0x17e))/0x1*(parseInt(_0x9037e0(0x167))/0x2)+-parseInt(_0x9037e0(0x11f))/0x3+parseInt(_0x9037e0(0x14d))/0x4+parseInt(_0x9037e0(0x146))/0x5*(parseInt(_0x9037e0(0x16e))/0x6)+-parseInt(_0x9037e0(0x166))/0x7*(-parseInt(_0x9037e0(0x125))/0x8)+parseInt(_0x9037e0(0x113))/0x9*(-parseInt(_0x9037e0(0x14c))/0xa)+parseInt(_0x9037e0(0x18c))/0xb;if(_0x564b5d===_0x12bfa9)break;else _0x463273['push'](_0x463273['shift']());}catch(_0xd18516){_0x463273['push'](_0x463273['shift']());}}}(a0_0x3faa,0x5442e));import{EventEmitter as a0_0x39d877}from'events';import{hostname as a0_0x503d6d}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x48ff48,_0x476cf8)=>(_0x48ff48??_0x476cf8)[a0_0x12d0e6(0x11b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x12d0e6(0x179)](0x0,0xf0);function N(_0x25917a){const _0x494b7e=a0_0x12d0e6;return(_0x25917a instanceof Error?_0x25917a['message']:String(_0x25917a??'unknown\x20error'))[_0x494b7e(0x11b)](K,_0x494b7e(0x189))[_0x494b7e(0x11b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x494b7e(0x179)](0x0,0xf0);}function O(_0x5c7fed,_0x52a127=process.env.ANET_TASK_TRACE_FORMAT===a0_0x12d0e6(0x143)){const _0xac0015=a0_0x12d0e6;if(_0x52a127)return JSON[_0xac0015(0x17a)](_0x5c7fed);let _0x4ecd82=L(_0x5c7fed[_0xac0015(0x127)],_0xac0015(0x11d)),_0x4a24e2=L(_0x5c7fed[_0xac0015(0x121)],_0xac0015(0x11a)),_0x46c112=_0x5c7fed[_0xac0015(0x165)]?_0xac0015(0x160)+_0x5c7fed[_0xac0015(0x165)]+':'+(_0x5c7fed[_0xac0015(0x17d)]??''):'';return _0xac0015(0x168)+_0x5c7fed[_0xac0015(0x180)]+_0xac0015(0x18a)+L(_0x5c7fed[_0xac0015(0x144)],'<unknown>')+_0xac0015(0x141)+L(_0x5c7fed[_0xac0015(0x184)],_0xac0015(0x14a))+_0xac0015(0x131)+_0x4a24e2+_0xac0015(0x119)+_0x4ecd82+_0xac0015(0x120)+L(_0x5c7fed['network_id'],_0xac0015(0x14a))+_0xac0015(0x12d)+_0x5c7fed[_0xac0015(0x116)]+_0xac0015(0x161)+_0x5c7fed['duration_ms']+_0xac0015(0x14f)+_0x5c7fed[_0xac0015(0x169)]+_0x46c112;}function a0_0x3faa(){const _0x48836e=['offline','now','<unknown>','parse','3092210Gqmtko','208840tNBBli','inbox\x20error:\x20','\x20lifecycle=','parentTaskId','split','task.send.delivered','completed','body','POST','url','2.0','type','failed','toTimeString','text/event-stream','CommHub\x20rejected\x20task','task.started','connect','toString','\x20error=','\x20duration_ms=','send_failed','signal','call','error_code','14bgNXVc','4KlxNmI','[commhub:task]\x20','lifecycle_tracking','match','sdk','log','running','3802362awicfn','heartbeat\x20failed:\x20','sdk-','fromAlias','Authorization','report_status','/mcp','ack_inbox','connected','sleep','idle','slice','stringify','sseAbort','toAlias','error_message','317787VjtAdx',']\x20[commhub:','status','disconnected','send_task','message_id','to_alias','decode','send_reply','token','delivered','[REDACTED]','\x20from=','heartbeatInterval','9099299XozFYt','alias','send','task.ack','mcp_http','messages','SSE\x20failed:\x20','application/json','networkId','get_all_status','cwd','SSE\x20error:\x20','connectSSE','text','missing_task_id','data:\x20','18YgxONG','heartbeatTimer','send_rejected','transport','getAllStatus','s...','\x20parent_task_id=','<pending>','replace','error','<missing>','string','1212780rRmePb','\x20network_id=','task_id','result','resumeId','min','1961056tqRIIJ','abort','parent_task_id','task','from_session','processInbox','registered','Bearer\x20','\x20transport=','server','not_tracked','task.replied','\x20task_id=','broadcast','get_inbox','task.send.failed','normal','task.send.start','emit','lifecycleTracking','/events/','reconnectDelay','task.expired','autoConnect','tools/call','content','catch','read','\x20to=','message','json','from_alias','agent','5MPkawM','reply'];a0_0x3faa=function(){return _0x48836e;};return a0_0x3faa();}function U(_0x12aeab){const _0x1e7c42=a0_0x12d0e6;return{'event':{'sending':_0x1e7c42(0x136),'delivered':_0x1e7c42(0x152),'failed':_0x1e7c42(0x134),'acked':_0x1e7c42(0x18f),'started':_0x1e7c42(0x15d),'replied':_0x1e7c42(0x130),'expired':_0x1e7c42(0x13b)}[_0x12aeab['status']],..._0x12aeab};}function j(_0x5ef867){const _0x1ccbed=a0_0x12d0e6;let _0x587d3c=_0x5ef867?.[_0x1ccbed(0x121)]||_0x5ef867?.[_0x1ccbed(0x183)]||_0x5ef867?.['id'];if(_0x587d3c)return String(_0x587d3c);let _0x5df99f=_0x5ef867?.[_0x1ccbed(0x13e)]?.[0x0]?.[_0x1ccbed(0x199)];if(typeof _0x5df99f!==_0x1ccbed(0x11e))return null;try{let _0x8a062f=JSON[_0x1ccbed(0x14b)](_0x5df99f);return _0x8a062f?.['task_id']||_0x8a062f?.[_0x1ccbed(0x183)]||_0x8a062f?.['id']||null;}catch{return null;}}function a0_0x1e4d(_0x40839d,_0x21e219){_0x40839d=_0x40839d-0x113;const _0x3faaa8=a0_0x3faa();let _0x1e4dcb=_0x3faaa8[_0x40839d];return _0x1e4dcb;}async function X(_0x1dc1e7,_0x3ff9fc){const _0x24e7a7=a0_0x12d0e6;let _0x2b2c53=_0x3ff9fc[_0x24e7a7(0x149)]??Date[_0x24e7a7(0x149)],_0x289a41=_0x2b2c53(),_0x1a1da0=(_0xe2dcdc,_0x16e65d,_0x4d3c72,_0x36ec5e)=>{const _0x353f5f=_0x24e7a7;_0x3ff9fc['log'](O(U({'from_alias':_0x1dc1e7[_0x353f5f(0x171)],'to_alias':_0x1dc1e7[_0x353f5f(0x17c)],'task_id':_0x16e65d,'parent_task_id':_0x1dc1e7[_0x353f5f(0x150)],'network_id':_0x1dc1e7['networkId'],'transport':_0x1dc1e7[_0x353f5f(0x116)],'status':_0xe2dcdc,'duration_ms':_0x2b2c53()-_0x289a41,'lifecycle_tracking':_0x1dc1e7[_0x353f5f(0x138)],..._0x4d3c72!==void 0x0?{'error_code':_0x36ec5e||_0x353f5f(0x162),'error_message':N(_0x4d3c72)}:{}})));};_0x1a1da0('sending',null);try{let _0xdaee33=await _0x3ff9fc[_0x24e7a7(0x18e)](),_0x5d5bd8=j(_0xdaee33);if(_0x5d5bd8)_0x1a1da0(_0x24e7a7(0x188),_0x5d5bd8);else{if(_0xdaee33?.['ok']===!0x1||_0xdaee33?.[_0x24e7a7(0x11c)])_0x1a1da0(_0x24e7a7(0x159),_0x5d5bd8,_0xdaee33?.[_0x24e7a7(0x11c)]||_0x24e7a7(0x15c),_0x24e7a7(0x115));else _0x1a1da0(_0x24e7a7(0x159),null,'CommHub\x20response\x20omitted\x20task_id',_0x24e7a7(0x19a));}return _0xdaee33;}catch(_0x1b6986){throw _0x1a1da0(_0x24e7a7(0x159),null,_0x1b6986,'send_failed'),_0x1b6986;}}async function Y(_0x215af2,_0x536878){const _0x268b80=a0_0x12d0e6;return X({'fromAlias':_0x215af2[_0x268b80(0x171)],'toAlias':_0x215af2[_0x268b80(0x18d)],'parentTaskId':_0x215af2[_0x268b80(0x150)]||null,'networkId':_0x215af2[_0x268b80(0x194)]||null,'transport':_0x268b80(0x190),'lifecycleTracking':_0x268b80(0x12f)},_0x536878);}class $ extends a0_0x39d877{[a0_0x12d0e6(0x156)];[a0_0x12d0e6(0x18d)];[a0_0x12d0e6(0x187)];['agent'];[a0_0x12d0e6(0x123)];['heartbeatInterval'];[a0_0x12d0e6(0x13a)];[a0_0x12d0e6(0x114)];[a0_0x12d0e6(0x17b)];[a0_0x12d0e6(0x16d)]=!0x1;constructor(_0x2b3f01){const _0x5413e1=a0_0x12d0e6;super();if(this[_0x5413e1(0x156)]=_0x2b3f01[_0x5413e1(0x156)][_0x5413e1(0x11b)](/\/$/,''),this[_0x5413e1(0x18d)]=_0x2b3f01[_0x5413e1(0x18d)],this['token']=_0x2b3f01[_0x5413e1(0x187)],this['agent']=_0x2b3f01[_0x5413e1(0x145)]||_0x5413e1(0x16b),this[_0x5413e1(0x123)]=_0x5413e1(0x170)+_0x2b3f01['alias']+'-'+Date['now']()[_0x5413e1(0x15f)](0x24),this[_0x5413e1(0x18b)]=_0x2b3f01['heartbeatInterval']??0x2bf20,this['reconnectDelay']=_0x2b3f01[_0x5413e1(0x13a)]??0xbb8,_0x2b3f01[_0x5413e1(0x13c)]!==!0x1)this[_0x5413e1(0x15e)]();}[a0_0x12d0e6(0x16c)](_0x50ecfa){const _0x4495b1=a0_0x12d0e6;console[_0x4495b1(0x16c)]('['+new Date()[_0x4495b1(0x15a)]()[_0x4495b1(0x179)](0x0,0x8)+_0x4495b1(0x17f)+this[_0x4495b1(0x18d)]+']\x20'+_0x50ecfa);}async[a0_0x12d0e6(0x164)](_0x24923b,_0x39399d){const _0x225ae9=a0_0x12d0e6;let _0x1d45dd={'Content-Type':_0x225ae9(0x193),'Accept':'application/json,\x20text/event-stream'};if(this[_0x225ae9(0x187)])_0x1d45dd[_0x225ae9(0x172)]=_0x225ae9(0x12c)+this['token'];let _0x51d25a=await(await fetch(this[_0x225ae9(0x156)]+_0x225ae9(0x174),{'method':_0x225ae9(0x155),'headers':_0x1d45dd,'body':JSON['stringify']({'jsonrpc':_0x225ae9(0x157),'id':Date[_0x225ae9(0x149)](),'method':_0x225ae9(0x13d),'params':{'name':_0x24923b,'arguments':_0x39399d}})}))[_0x225ae9(0x199)](),_0x4ab2ac=_0x51d25a[_0x225ae9(0x16a)](/data: (.+)/),_0x5d9f7b=_0x4ab2ac?JSON[_0x225ae9(0x14b)](_0x4ab2ac[0x1]):JSON['parse'](_0x51d25a),_0x1b9747=_0x5d9f7b?.[_0x225ae9(0x122)]?.[_0x225ae9(0x13e)]?.[0x0]?.[_0x225ae9(0x199)];return _0x1b9747?JSON[_0x225ae9(0x14b)](_0x1b9747):_0x5d9f7b;}async['connect'](){const _0xb5738a=a0_0x12d0e6;if(this[_0xb5738a(0x16d)])return;this[_0xb5738a(0x16d)]=!0x0,await this[_0xb5738a(0x180)](_0xb5738a(0x178)),this[_0xb5738a(0x16c)](_0xb5738a(0x12b)),this['heartbeatTimer']=setInterval(()=>{const _0x478378=_0xb5738a;this['status']('idle')[_0x478378(0x13f)](_0x5d7418=>this[_0x478378(0x16c)](_0x478378(0x16f)+_0x5d7418[_0x478378(0x142)]));},this[_0xb5738a(0x18b)]),this[_0xb5738a(0x198)]();}async['disconnect'](){const _0x3bf2d3=a0_0x12d0e6;if(this['running']=!0x1,this[_0x3bf2d3(0x17b)]?.[_0x3bf2d3(0x126)](),this[_0x3bf2d3(0x114)])clearInterval(this[_0x3bf2d3(0x114)]);await this['status'](_0x3bf2d3(0x148))[_0x3bf2d3(0x13f)](()=>{}),this[_0x3bf2d3(0x16c)](_0x3bf2d3(0x181));}async['send'](_0x2cf00b,_0x1805ca,_0x40f9d3=a0_0x12d0e6(0x135)){const _0x19310b=a0_0x12d0e6;return Y({'alias':_0x2cf00b,'fromAlias':this[_0x19310b(0x18d)]},{'log':_0x2e605b=>console['log'](_0x2e605b),'send':()=>this['call'](_0x19310b(0x182),{'alias':_0x2cf00b,'task':_0x1805ca,'priority':_0x40f9d3,'from_session':this['alias']})});}async[a0_0x12d0e6(0x142)](_0x3ef5b1,_0x480069){const _0x50daa5=a0_0x12d0e6;return this[_0x50daa5(0x164)]('send_message',{'alias':_0x3ef5b1,'message':_0x480069,'from_session':this['alias']});}async[a0_0x12d0e6(0x147)](_0x301d04,_0x30ab46,_0x44466f=a0_0x12d0e6(0x153)){const _0x33504f=a0_0x12d0e6;return this[_0x33504f(0x164)](_0x33504f(0x186),{'in_reply_to':_0x301d04,'text':_0x30ab46,'status':_0x44466f});}async[a0_0x12d0e6(0x180)](_0x3a0425,_0xa44efc){const _0x14e8d0=a0_0x12d0e6;return this[_0x14e8d0(0x164)](_0x14e8d0(0x173),{'resume_id':this[_0x14e8d0(0x123)],'alias':this['alias'],'status':_0x3a0425,'server':a0_0x503d6d(),'hostname':a0_0x503d6d(),'agent':this[_0x14e8d0(0x145)],'project_dir':process[_0x14e8d0(0x196)](),..._0xa44efc});}async[a0_0x12d0e6(0x117)](){const _0x35b585=a0_0x12d0e6;return this[_0x35b585(0x164)](_0x35b585(0x195),{});}async[a0_0x12d0e6(0x132)](_0x3f4c84,_0x4176ec){const _0x540dcf=a0_0x12d0e6;return this[_0x540dcf(0x164)](_0x540dcf(0x132),{'message':_0x3f4c84,'filter_server':_0x4176ec?.[_0x540dcf(0x12e)],'filter_status':_0x4176ec?.[_0x540dcf(0x180)]});}async[a0_0x12d0e6(0x198)](){const _0x535b46=a0_0x12d0e6;let _0x511eab=encodeURIComponent(this['alias']),_0x18741a=this[_0x535b46(0x156)]+_0x535b46(0x139)+_0x511eab,_0x38ea70=this[_0x535b46(0x13a)];while(this['running']){try{this[_0x535b46(0x17b)]=new AbortController();let _0x50c431={'Accept':_0x535b46(0x15b)};if(this[_0x535b46(0x187)])_0x50c431[_0x535b46(0x172)]=_0x535b46(0x12c)+this['token'];let _0x56e14a=await fetch(_0x18741a,{'headers':_0x50c431,'signal':this[_0x535b46(0x17b)][_0x535b46(0x163)]});if(!_0x56e14a['ok']||!_0x56e14a['body']){this[_0x535b46(0x16c)](_0x535b46(0x192)+_0x56e14a[_0x535b46(0x180)]),await this[_0x535b46(0x177)](_0x38ea70),_0x38ea70=Math[_0x535b46(0x124)](_0x38ea70*1.5,0xea60);continue;}_0x38ea70=this['reconnectDelay'];let _0x449192=_0x56e14a[_0x535b46(0x154)]['getReader'](),_0x31ef91=new TextDecoder(),_0x5a3279='';while(this['running']){let {done:_0xf124b7,value:_0x40334e}=await _0x449192[_0x535b46(0x140)]();if(_0xf124b7)break;_0x5a3279+=_0x31ef91[_0x535b46(0x185)](_0x40334e,{'stream':!0x0});let _0x233597=_0x5a3279[_0x535b46(0x151)]('\x0a');_0x5a3279=_0x233597['pop']()||'';for(let _0x44dec8 of _0x233597){if(!_0x44dec8['startsWith'](_0x535b46(0x19b)))continue;try{let _0x2e385f=JSON['parse'](_0x44dec8[_0x535b46(0x179)](0x6));if(_0x2e385f['type']===_0x535b46(0x176)){this[_0x535b46(0x16c)]('SSE\x20connected'),this[_0x535b46(0x137)](_0x535b46(0x176));continue;}if(_0x2e385f['type']==='new_task'||_0x2e385f[_0x535b46(0x158)]==='new_message'||_0x2e385f[_0x535b46(0x158)]==='broadcast')await this[_0x535b46(0x12a)]();}catch{}}}}catch(_0x15247f){if(_0x15247f['name']==='AbortError')break;this['emit']('error',_0x15247f),this[_0x535b46(0x16c)](_0x535b46(0x197)+_0x15247f[_0x535b46(0x142)]);}if(this[_0x535b46(0x16d)])this[_0x535b46(0x137)](_0x535b46(0x181)),this[_0x535b46(0x16c)]('SSE\x20reconnecting\x20in\x20'+_0x38ea70/0x3e8+_0x535b46(0x118)),await this[_0x535b46(0x177)](_0x38ea70),_0x38ea70=Math[_0x535b46(0x124)](_0x38ea70*1.5,0xea60);}}async[a0_0x12d0e6(0x12a)](){const _0xa1cd4c=a0_0x12d0e6;try{let _0x26e992=(await this[_0xa1cd4c(0x164)](_0xa1cd4c(0x133),{'alias':this['alias'],'limit':0xa}))?.[_0xa1cd4c(0x191)]||[];for(let _0x307e37 of _0x26e992)await this[_0xa1cd4c(0x164)](_0xa1cd4c(0x175),{'alias':this['alias'],'message_id':_0x307e37['id']}),this[_0xa1cd4c(0x16c)]('←\x20'+_0x307e37[_0xa1cd4c(0x129)]+':\x20'+_0x307e37[_0xa1cd4c(0x13e)][_0xa1cd4c(0x179)](0x0,0x3c)),this[_0xa1cd4c(0x137)](_0xa1cd4c(0x128),_0x307e37),this[_0xa1cd4c(0x137)]('message',_0x307e37);}catch(_0x16c0aa){this[_0xa1cd4c(0x16c)](_0xa1cd4c(0x14e)+_0x16c0aa[_0xa1cd4c(0x142)]);}}[a0_0x12d0e6(0x177)](_0x184e2d){return new Promise(_0x9166a9=>setTimeout(_0x9166a9,_0x184e2d));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x3407f7=a0_0x2fd3;(function(_0x442008,_0x438a35){const _0x2d57ad=a0_0x2fd3,_0x125fe0=_0x442008();while(!![]){try{const _0x285107=parseInt(_0x2d57ad(0x20b))/0x1+-parseInt(_0x2d57ad(0x1c7))/0x2+-parseInt(_0x2d57ad(0x1ea))/0x3*(-parseInt(_0x2d57ad(0x226))/0x4)+-parseInt(_0x2d57ad(0x22e))/0x5*(-parseInt(_0x2d57ad(0x1fc))/0x6)+parseInt(_0x2d57ad(0x1cc))/0x7*(parseInt(_0x2d57ad(0x1f6))/0x8)+parseInt(_0x2d57ad(0x1eb))/0x9*(-parseInt(_0x2d57ad(0x21c))/0xa)+-parseInt(_0x2d57ad(0x210))/0xb*(-parseInt(_0x2d57ad(0x204))/0xc);if(_0x285107===_0x438a35)break;else _0x125fe0['push'](_0x125fe0['shift']());}catch(_0x142f37){_0x125fe0['push'](_0x125fe0['shift']());}}}(a0_0x15c7,0xb701e));function a0_0x15c7(){const _0x25fca5=['reply','running','CommHub\x20rejected\x20task','connected','SSE\x20connected','get_all_status','100XXGDwY','SSE\x20error:\x20','lifecycleTracking','token','error_code','send_failed','fromAlias','connectSSE','heartbeatInterval','heartbeatTimer','4aDCgSy','\x20error=','\x20transport=','offline','unknown\x20error','abort','\x20task_id=','read','2119810TyFXwe','send_reply','disconnect','data:\x20','task.send.start','task.replied','\x20to=','toAlias','\x20lifecycle=','toTimeString','broadcast','idle','s...','sseAbort','delivered','match','2.0','body','[commhub:task]\x20','reconnectDelay','send_rejected','result','application/json,\x20text/event-stream','error_message','get_inbox','2236084siMoyD','sdk-','task_id','Authorization','log','714kyvJsm','message_id','tools/call','server','\x20parent_task_id=','new_task','string','<pending>','agent','split','report_status','alias','decode','send_message','application/json','cwd','call','name','transport','SSE\x20failed:\x20','task.send.delivered','heartbeat\x20failed:\x20','duration_ms','content','text/event-stream','registered','normal','stringify','lifecycle_tracking','emit','2320161XGZEXt','1052379SSkPLi','send','getAllStatus','[REDACTED]','from_session','disconnected','catch','networkId','error','message','text','48568yaTdPf','status','slice','from_alias','connect','missing_task_id','6MbzRVa','sdk','type','toString','replace','/mcp','autoConnect','failed','1608PPYfLJ','parentTaskId','sleep','Bearer\x20','min','now','not_tracked','551297pLQLru','url','parse','inbox\x20error:\x20','<unknown>','54923UGXIFa','completed','messages','resumeId','\x20duration_ms=','SSE\x20reconnecting\x20in\x20'];a0_0x15c7=function(){return _0x25fca5;};return a0_0x15c7();}import{EventEmitter as a0_0xa54f8c}from'events';function a0_0x2fd3(_0xe9432c,_0x191a2e){_0xe9432c=_0xe9432c-0x1b6;const _0x15c731=a0_0x15c7();let _0x2fd37f=_0x15c731[_0xe9432c];return _0x2fd37f;}import{hostname as a0_0x3e0cbb}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x475dc5,_0x2cb23f)=>(_0x475dc5??_0x2cb23f)[a0_0x3407f7(0x200)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x3407f7(0x1f8)](0x0,0xf0);function N(_0x33b851){const _0x1cc20c=a0_0x3407f7;return(_0x33b851 instanceof Error?_0x33b851[_0x1cc20c(0x1f4)]:String(_0x33b851??_0x1cc20c(0x22a)))['replace'](K,_0x1cc20c(0x1ee))[_0x1cc20c(0x200)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x1cc20c(0x1f8)](0x0,0xf0);}function O(_0x9ae564,_0xd07b08=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x9a6c22=a0_0x3407f7;if(_0xd07b08)return JSON[_0x9a6c22(0x1e7)](_0x9ae564);let _0x2a84cd=L(_0x9ae564['parent_task_id'],'<missing>'),_0x33ffb0=L(_0x9ae564[_0x9a6c22(0x1c9)],_0x9a6c22(0x1d3)),_0x25a60b=_0x9ae564[_0x9a6c22(0x220)]?_0x9a6c22(0x227)+_0x9ae564[_0x9a6c22(0x220)]+':'+(_0x9ae564[_0x9a6c22(0x1c5)]??''):'';return _0x9a6c22(0x1c0)+_0x9ae564[_0x9a6c22(0x1f7)]+'\x20from='+L(_0x9ae564[_0x9a6c22(0x1f9)],_0x9a6c22(0x20f))+_0x9a6c22(0x234)+L(_0x9ae564['to_alias'],'<unknown>')+_0x9a6c22(0x22c)+_0x33ffb0+_0x9a6c22(0x1d0)+_0x2a84cd+'\x20network_id='+L(_0x9ae564['network_id'],_0x9a6c22(0x20f))+_0x9a6c22(0x228)+_0x9ae564[_0x9a6c22(0x1de)]+_0x9a6c22(0x214)+_0x9ae564[_0x9a6c22(0x1e2)]+_0x9a6c22(0x1b6)+_0x9ae564[_0x9a6c22(0x1e8)]+_0x25a60b;}function U(_0x135f9f){const _0x2734a1=a0_0x3407f7;return{'event':{'sending':_0x2734a1(0x232),'delivered':_0x2734a1(0x1e0),'failed':'task.send.failed','acked':'task.ack','started':'task.started','replied':_0x2734a1(0x233),'expired':'task.expired'}[_0x135f9f[_0x2734a1(0x1f7)]],..._0x135f9f};}function j(_0x373d2a){const _0x513221=a0_0x3407f7;let _0xd4e70d=_0x373d2a?.[_0x513221(0x1c9)]||_0x373d2a?.[_0x513221(0x1cd)]||_0x373d2a?.['id'];if(_0xd4e70d)return String(_0xd4e70d);let _0x48894e=_0x373d2a?.[_0x513221(0x1e3)]?.[0x0]?.[_0x513221(0x1f5)];if(typeof _0x48894e!==_0x513221(0x1d2))return null;try{let _0x1b235a=JSON[_0x513221(0x20d)](_0x48894e);return _0x1b235a?.[_0x513221(0x1c9)]||_0x1b235a?.['message_id']||_0x1b235a?.['id']||null;}catch{return null;}}async function X(_0x5d0818,_0x4c8b85){const _0x537b4c=a0_0x3407f7;let _0x1fbb11=_0x4c8b85[_0x537b4c(0x209)]??Date[_0x537b4c(0x209)],_0x3c4ca1=_0x1fbb11(),_0x437f2c=(_0x1e4bda,_0x236e7a,_0x118d6c,_0x1c160d)=>{const _0x161f0a=_0x537b4c;_0x4c8b85[_0x161f0a(0x1cb)](O(U({'from_alias':_0x5d0818['fromAlias'],'to_alias':_0x5d0818[_0x161f0a(0x235)],'task_id':_0x236e7a,'parent_task_id':_0x5d0818['parentTaskId'],'network_id':_0x5d0818['networkId'],'transport':_0x5d0818[_0x161f0a(0x1de)],'status':_0x1e4bda,'duration_ms':_0x1fbb11()-_0x3c4ca1,'lifecycle_tracking':_0x5d0818[_0x161f0a(0x21e)],..._0x118d6c!==void 0x0?{'error_code':_0x1c160d||_0x161f0a(0x221),'error_message':N(_0x118d6c)}:{}})));};_0x437f2c('sending',null);try{let _0x9e8f54=await _0x4c8b85[_0x537b4c(0x1ec)](),_0x879227=j(_0x9e8f54);if(_0x879227)_0x437f2c(_0x537b4c(0x1bc),_0x879227);else{if(_0x9e8f54?.['ok']===!0x1||_0x9e8f54?.[_0x537b4c(0x1f3)])_0x437f2c('failed',_0x879227,_0x9e8f54?.[_0x537b4c(0x1f3)]||_0x537b4c(0x218),_0x537b4c(0x1c2));else _0x437f2c(_0x537b4c(0x203),null,'CommHub\x20response\x20omitted\x20task_id',_0x537b4c(0x1fb));}return _0x9e8f54;}catch(_0x46e4be){throw _0x437f2c('failed',null,_0x46e4be,'send_failed'),_0x46e4be;}}async function Y(_0x19b55a,_0x28f318){const _0x48091f=a0_0x3407f7;return X({'fromAlias':_0x19b55a[_0x48091f(0x222)],'toAlias':_0x19b55a[_0x48091f(0x1d7)],'parentTaskId':_0x19b55a[_0x48091f(0x205)]||null,'networkId':_0x19b55a[_0x48091f(0x1f2)]||null,'transport':'mcp_http','lifecycleTracking':_0x48091f(0x20a)},_0x28f318);}class $ extends a0_0xa54f8c{[a0_0x3407f7(0x20c)];['alias'];[a0_0x3407f7(0x21f)];[a0_0x3407f7(0x1d4)];[a0_0x3407f7(0x213)];[a0_0x3407f7(0x224)];['reconnectDelay'];[a0_0x3407f7(0x225)];['sseAbort'];[a0_0x3407f7(0x217)]=!0x1;constructor(_0x557b8b){const _0xc0d34d=a0_0x3407f7;super();if(this[_0xc0d34d(0x20c)]=_0x557b8b[_0xc0d34d(0x20c)][_0xc0d34d(0x200)](/\/$/,''),this[_0xc0d34d(0x1d7)]=_0x557b8b[_0xc0d34d(0x1d7)],this[_0xc0d34d(0x21f)]=_0x557b8b[_0xc0d34d(0x21f)],this[_0xc0d34d(0x1d4)]=_0x557b8b[_0xc0d34d(0x1d4)]||_0xc0d34d(0x1fd),this[_0xc0d34d(0x213)]=_0xc0d34d(0x1c8)+_0x557b8b[_0xc0d34d(0x1d7)]+'-'+Date[_0xc0d34d(0x209)]()[_0xc0d34d(0x1ff)](0x24),this['heartbeatInterval']=_0x557b8b[_0xc0d34d(0x224)]??0x2bf20,this['reconnectDelay']=_0x557b8b[_0xc0d34d(0x1c1)]??0xbb8,_0x557b8b[_0xc0d34d(0x202)]!==!0x1)this['connect']();}[a0_0x3407f7(0x1cb)](_0x181a1d){const _0x559a8d=a0_0x3407f7;console['log']('['+new Date()[_0x559a8d(0x1b7)]()['slice'](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x181a1d);}async['call'](_0x3f20c8,_0x3ee428){const _0xda8a5c=a0_0x3407f7;let _0x9ad633={'Content-Type':_0xda8a5c(0x1da),'Accept':_0xda8a5c(0x1c4)};if(this[_0xda8a5c(0x21f)])_0x9ad633[_0xda8a5c(0x1ca)]=_0xda8a5c(0x207)+this[_0xda8a5c(0x21f)];let _0x273e3a=await(await fetch(this[_0xda8a5c(0x20c)]+_0xda8a5c(0x201),{'method':'POST','headers':_0x9ad633,'body':JSON[_0xda8a5c(0x1e7)]({'jsonrpc':_0xda8a5c(0x1be),'id':Date[_0xda8a5c(0x209)](),'method':_0xda8a5c(0x1ce),'params':{'name':_0x3f20c8,'arguments':_0x3ee428}})}))[_0xda8a5c(0x1f5)](),_0x4f9cfd=_0x273e3a[_0xda8a5c(0x1bd)](/data: (.+)/),_0x5660fa=_0x4f9cfd?JSON[_0xda8a5c(0x20d)](_0x4f9cfd[0x1]):JSON[_0xda8a5c(0x20d)](_0x273e3a),_0x2d6563=_0x5660fa?.[_0xda8a5c(0x1c3)]?.['content']?.[0x0]?.['text'];return _0x2d6563?JSON['parse'](_0x2d6563):_0x5660fa;}async[a0_0x3407f7(0x1fa)](){const _0xb569ab=a0_0x3407f7;if(this[_0xb569ab(0x217)])return;this[_0xb569ab(0x217)]=!0x0,await this[_0xb569ab(0x1f7)](_0xb569ab(0x1b9)),this[_0xb569ab(0x1cb)](_0xb569ab(0x1e5)),this['heartbeatTimer']=setInterval(()=>{const _0x3bbe83=_0xb569ab;this[_0x3bbe83(0x1f7)](_0x3bbe83(0x1b9))[_0x3bbe83(0x1f1)](_0x4bd55f=>this['log'](_0x3bbe83(0x1e1)+_0x4bd55f[_0x3bbe83(0x1f4)]));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x3407f7(0x230)](){const _0x359ffd=a0_0x3407f7;if(this[_0x359ffd(0x217)]=!0x1,this[_0x359ffd(0x1bb)]?.[_0x359ffd(0x22b)](),this[_0x359ffd(0x225)])clearInterval(this['heartbeatTimer']);await this[_0x359ffd(0x1f7)](_0x359ffd(0x229))[_0x359ffd(0x1f1)](()=>{}),this[_0x359ffd(0x1cb)](_0x359ffd(0x1f0));}async[a0_0x3407f7(0x1ec)](_0x4d5133,_0x29a053,_0x4321cc=a0_0x3407f7(0x1e6)){const _0x46cc88=a0_0x3407f7;return Y({'alias':_0x4d5133,'fromAlias':this[_0x46cc88(0x1d7)]},{'log':_0x59d98c=>console['log'](_0x59d98c),'send':()=>this[_0x46cc88(0x1dc)]('send_task',{'alias':_0x4d5133,'task':_0x29a053,'priority':_0x4321cc,'from_session':this[_0x46cc88(0x1d7)]})});}async['message'](_0x2e3c0e,_0x15d78a){const _0x1077af=a0_0x3407f7;return this[_0x1077af(0x1dc)](_0x1077af(0x1d9),{'alias':_0x2e3c0e,'message':_0x15d78a,'from_session':this[_0x1077af(0x1d7)]});}async[a0_0x3407f7(0x216)](_0x17ee11,_0x3531f3,_0x26a287=a0_0x3407f7(0x211)){const _0x1e0cad=a0_0x3407f7;return this[_0x1e0cad(0x1dc)](_0x1e0cad(0x22f),{'in_reply_to':_0x17ee11,'text':_0x3531f3,'status':_0x26a287});}async[a0_0x3407f7(0x1f7)](_0x57794c,_0x52f946){const _0x448fce=a0_0x3407f7;return this[_0x448fce(0x1dc)](_0x448fce(0x1d6),{'resume_id':this['resumeId'],'alias':this[_0x448fce(0x1d7)],'status':_0x57794c,'server':a0_0x3e0cbb(),'hostname':a0_0x3e0cbb(),'agent':this[_0x448fce(0x1d4)],'project_dir':process[_0x448fce(0x1db)](),..._0x52f946});}async[a0_0x3407f7(0x1ed)](){const _0x4931da=a0_0x3407f7;return this['call'](_0x4931da(0x21b),{});}async[a0_0x3407f7(0x1b8)](_0x104b72,_0x62479a){const _0x1a4c60=a0_0x3407f7;return this[_0x1a4c60(0x1dc)](_0x1a4c60(0x1b8),{'message':_0x104b72,'filter_server':_0x62479a?.[_0x1a4c60(0x1cf)],'filter_status':_0x62479a?.[_0x1a4c60(0x1f7)]});}async[a0_0x3407f7(0x223)](){const _0x119cea=a0_0x3407f7;let _0x440241=encodeURIComponent(this[_0x119cea(0x1d7)]),_0x5e6862=this[_0x119cea(0x20c)]+'/events/'+_0x440241,_0x3d64c6=this[_0x119cea(0x1c1)];while(this['running']){try{this[_0x119cea(0x1bb)]=new AbortController();let _0x54341f={'Accept':_0x119cea(0x1e4)};if(this[_0x119cea(0x21f)])_0x54341f[_0x119cea(0x1ca)]='Bearer\x20'+this[_0x119cea(0x21f)];let _0x5b737b=await fetch(_0x5e6862,{'headers':_0x54341f,'signal':this['sseAbort']['signal']});if(!_0x5b737b['ok']||!_0x5b737b[_0x119cea(0x1bf)]){this[_0x119cea(0x1cb)](_0x119cea(0x1df)+_0x5b737b[_0x119cea(0x1f7)]),await this[_0x119cea(0x206)](_0x3d64c6),_0x3d64c6=Math['min'](_0x3d64c6*1.5,0xea60);continue;}_0x3d64c6=this[_0x119cea(0x1c1)];let _0x54b148=_0x5b737b['body']['getReader'](),_0x3eec06=new TextDecoder(),_0x241f4a='';while(this[_0x119cea(0x217)]){let {done:_0x4330fa,value:_0x3ffe3c}=await _0x54b148[_0x119cea(0x22d)]();if(_0x4330fa)break;_0x241f4a+=_0x3eec06[_0x119cea(0x1d8)](_0x3ffe3c,{'stream':!0x0});let _0x5c3609=_0x241f4a[_0x119cea(0x1d5)]('\x0a');_0x241f4a=_0x5c3609['pop']()||'';for(let _0x813615 of _0x5c3609){if(!_0x813615['startsWith'](_0x119cea(0x231)))continue;try{let _0x511b87=JSON[_0x119cea(0x20d)](_0x813615['slice'](0x6));if(_0x511b87[_0x119cea(0x1fe)]===_0x119cea(0x219)){this['log'](_0x119cea(0x21a)),this[_0x119cea(0x1e9)](_0x119cea(0x219));continue;}if(_0x511b87[_0x119cea(0x1fe)]===_0x119cea(0x1d1)||_0x511b87[_0x119cea(0x1fe)]==='new_message'||_0x511b87[_0x119cea(0x1fe)]===_0x119cea(0x1b8))await this['processInbox']();}catch{}}}}catch(_0x34c4d6){if(_0x34c4d6[_0x119cea(0x1dd)]==='AbortError')break;this[_0x119cea(0x1e9)](_0x119cea(0x1f3),_0x34c4d6),this[_0x119cea(0x1cb)](_0x119cea(0x21d)+_0x34c4d6[_0x119cea(0x1f4)]);}if(this['running'])this['emit']('disconnected'),this[_0x119cea(0x1cb)](_0x119cea(0x215)+_0x3d64c6/0x3e8+_0x119cea(0x1ba)),await this[_0x119cea(0x206)](_0x3d64c6),_0x3d64c6=Math[_0x119cea(0x208)](_0x3d64c6*1.5,0xea60);}}async['processInbox'](){const _0x4738aa=a0_0x3407f7;try{let _0x51f427=(await this[_0x4738aa(0x1dc)](_0x4738aa(0x1c6),{'alias':this[_0x4738aa(0x1d7)],'limit':0xa}))?.[_0x4738aa(0x212)]||[];for(let _0x2c5503 of _0x51f427)await this[_0x4738aa(0x1dc)]('ack_inbox',{'alias':this[_0x4738aa(0x1d7)],'message_id':_0x2c5503['id']}),this[_0x4738aa(0x1cb)]('←\x20'+_0x2c5503[_0x4738aa(0x1ef)]+':\x20'+_0x2c5503['content'][_0x4738aa(0x1f8)](0x0,0x3c)),this[_0x4738aa(0x1e9)]('task',_0x2c5503),this[_0x4738aa(0x1e9)](_0x4738aa(0x1f4),_0x2c5503);}catch(_0x39e93e){this['log'](_0x4738aa(0x20e)+_0x39e93e[_0x4738aa(0x1f4)]);}}[a0_0x3407f7(0x206)](_0x2fef06){return new Promise(_0x231efa=>setTimeout(_0x231efa,_0x2fef06));}}var F=$;export{F as default,$ as CommHub};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** One-line limitation list shown wherever co-presence is offered (CLI help,
|
|
2
|
+
* picker, create warning). Keep it one line — it is appended to menus. */
|
|
3
|
+
export declare const GROK_COPRESENCE_EXPERIMENTAL_NOTE_ZH = "\u5B9E\u9A8C\u6027\uFF1A\u4EBA\u5728 TUI \u8F93\u5165\u6846\u6253\u5B57\u65F6\u7F51\u7EDC\u4EFB\u52A1\u4F1A\u6392\u961F\u76F4\u5230\u8D85\u65F6\uFF1Bgrok \u987B\u9489\u5728\u5DF2\u9A8C\u8BC1\u7248\u672C\uFF08\u65B0\u7248\u4F1A\u62D2\u7EDD\u542F\u52A8\uFF09\uFF1BmacOS \u9700\u7279\u6B8A\u5904\u7406\uFF1B\u4E0D\u52A0\u8F7D .agents/skills \u6280\u80FD\u3002\u8981\u7A33\u5B9A\u63A5\u6D3B\u7528\u9ED8\u8BA4\u7684 ACP\u3002";
|
|
4
|
+
export declare const GROK_COPRESENCE_EXPERIMENTAL_NOTE_EN = "Experimental: network tasks queue until timeout while a human is typing in the TUI; grok must be pinned to a verified build (newer builds refuse to start); macOS needs special handling; .agents/skills skills are not loaded. For a stable node use the default ACP mode.";
|
|
5
|
+
export type GrokCreateModeResult = {
|
|
6
|
+
ok: true;
|
|
7
|
+
runtime: string | undefined;
|
|
8
|
+
copresenceRequested: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
ok: false;
|
|
11
|
+
error: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the runtime string a NEW node is created with.
|
|
15
|
+
*
|
|
16
|
+
* Non-Grok runtimes (and an absent runtime) pass through untouched — this
|
|
17
|
+
* helper only decides between the two Grok lanes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveGrokCreateRuntime(rawRuntime: string | undefined, copresence: unknown): GrokCreateModeResult;
|