@sleep2agi/agent-network 2.2.2 → 2.2.3-preview.0
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 +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a0_0x4b95(){const _0x52e522=['type','report_status','6SNtwpD','7TJcfKa','4RHZGEw','4386800kWsnmF','cwd','result','autoConnect','url','307345YKMEvJ','startsWith','status','sseAbort','server','alias','catch','POST','normal','decode','toTimeString','disconnect','s...','abort','heartbeatInterval','completed','broadcast','replace','pop','1384696yRweCs','getAllStatus','message','get_inbox','/events/','body','read','idle','SSE\x20connected','task','/mcp','22410uWfGzO','send_message','offline','application/json','slice','SSE\x20failed:\x20','log','connected','split','registered','Authorization','agent','toString','sdk-','new_task','messages','stringify','parse','data:\x20','11720462XctyKV','12Eegeym','new_message','tools/call','emit','call','18729FcvENt','content','send','2.0','send_reply','1719OcGfen','running','heartbeat\x20failed:\x20','heartbeatTimer','2zVqcmw','disconnected','Bearer\x20','reconnectDelay','token','min','connect','text','application/json,\x20text/event-stream','reply','sleep','match','error','send_task','2356825CotkWq','resumeId','SSE\x20error:\x20'];a0_0x4b95=function(){return _0x52e522;};return a0_0x4b95();}const a0_0x4977ce=a0_0x1b6f;(function(_0x17e80e,_0x147dbd){const _0x28f046=a0_0x1b6f,_0x2ed8b0=_0x17e80e();while(!![]){try{const _0x456278=parseInt(_0x28f046(0x160))/0x1*(-parseInt(_0x28f046(0x145))/0x2)+parseInt(_0x28f046(0x197))/0x3*(-parseInt(_0x28f046(0x15a))/0x4)+-parseInt(_0x28f046(0x153))/0x5*(parseInt(_0x28f046(0x158))/0x6)+parseInt(_0x28f046(0x159))/0x7*(parseInt(_0x28f046(0x173))/0x8)+parseInt(_0x28f046(0x19c))/0x9*(-parseInt(_0x28f046(0x17e))/0xa)+parseInt(_0x28f046(0x15b))/0xb+-parseInt(_0x28f046(0x192))/0xc*(-parseInt(_0x28f046(0x191))/0xd);if(_0x456278===_0x147dbd)break;else _0x2ed8b0['push'](_0x2ed8b0['shift']());}catch(_0x4e21f9){_0x2ed8b0['push'](_0x2ed8b0['shift']());}}}(a0_0x4b95,0x3f97d));import{EventEmitter as a0_0x18fa14}from'events';import{hostname as a0_0x387df7}from'os';class T extends a0_0x18fa14{[a0_0x4977ce(0x15f)];[a0_0x4977ce(0x165)];[a0_0x4977ce(0x149)];[a0_0x4977ce(0x189)];[a0_0x4977ce(0x154)];['heartbeatInterval'];[a0_0x4977ce(0x148)];[a0_0x4977ce(0x144)];[a0_0x4977ce(0x163)];['running']=!0x1;constructor(_0x3ca0b8){const _0x3165f9=a0_0x4977ce;super();if(this[_0x3165f9(0x15f)]=_0x3ca0b8[_0x3165f9(0x15f)][_0x3165f9(0x171)](/\/$/,''),this[_0x3165f9(0x165)]=_0x3ca0b8[_0x3165f9(0x165)],this[_0x3165f9(0x149)]=_0x3ca0b8[_0x3165f9(0x149)],this[_0x3165f9(0x189)]=_0x3ca0b8[_0x3165f9(0x189)]||'sdk',this[_0x3165f9(0x154)]=_0x3165f9(0x18b)+_0x3ca0b8[_0x3165f9(0x165)]+'-'+Date['now']()[_0x3165f9(0x18a)](0x24),this[_0x3165f9(0x16e)]=_0x3ca0b8[_0x3165f9(0x16e)]??0x2bf20,this['reconnectDelay']=_0x3ca0b8['reconnectDelay']??0xbb8,_0x3ca0b8[_0x3165f9(0x15e)]!==!0x1)this[_0x3165f9(0x14b)]();}['log'](_0x3d29e8){const _0x36163a=a0_0x4977ce;console[_0x36163a(0x184)]('['+new Date()[_0x36163a(0x16a)]()[_0x36163a(0x182)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x3d29e8);}async[a0_0x4977ce(0x196)](_0x1d0e2d,_0x447b31){const _0x17fed5=a0_0x4977ce;let _0x13c492={'Content-Type':_0x17fed5(0x181),'Accept':_0x17fed5(0x14d)};if(this[_0x17fed5(0x149)])_0x13c492[_0x17fed5(0x188)]='Bearer\x20'+this[_0x17fed5(0x149)];let _0x4410b3=await(await fetch(this[_0x17fed5(0x15f)]+_0x17fed5(0x17d),{'method':_0x17fed5(0x167),'headers':_0x13c492,'body':JSON[_0x17fed5(0x18e)]({'jsonrpc':_0x17fed5(0x19a),'id':Date['now'](),'method':_0x17fed5(0x194),'params':{'name':_0x1d0e2d,'arguments':_0x447b31}})}))[_0x17fed5(0x14c)](),_0x3d4367=_0x4410b3[_0x17fed5(0x150)](/data: (.+)/),_0x369053=_0x3d4367?JSON[_0x17fed5(0x18f)](_0x3d4367[0x1]):JSON[_0x17fed5(0x18f)](_0x4410b3),_0x579f25=_0x369053?.[_0x17fed5(0x15d)]?.[_0x17fed5(0x198)]?.[0x0]?.[_0x17fed5(0x14c)];return _0x579f25?JSON[_0x17fed5(0x18f)](_0x579f25):_0x369053;}async[a0_0x4977ce(0x14b)](){const _0x19057c=a0_0x4977ce;if(this[_0x19057c(0x19d)])return;this[_0x19057c(0x19d)]=!0x0,await this[_0x19057c(0x162)](_0x19057c(0x17a)),this[_0x19057c(0x184)](_0x19057c(0x187)),this[_0x19057c(0x144)]=setInterval(()=>{const _0x292f56=_0x19057c;this[_0x292f56(0x162)](_0x292f56(0x17a))[_0x292f56(0x166)](_0x229e99=>this[_0x292f56(0x184)](_0x292f56(0x19e)+_0x229e99['message']));},this[_0x19057c(0x16e)]),this['connectSSE']();}async[a0_0x4977ce(0x16b)](){const _0x5aeb2f=a0_0x4977ce;if(this[_0x5aeb2f(0x19d)]=!0x1,this[_0x5aeb2f(0x163)]?.[_0x5aeb2f(0x16d)](),this[_0x5aeb2f(0x144)])clearInterval(this[_0x5aeb2f(0x144)]);await this['status'](_0x5aeb2f(0x180))[_0x5aeb2f(0x166)](()=>{}),this[_0x5aeb2f(0x184)](_0x5aeb2f(0x146));}async[a0_0x4977ce(0x199)](_0x57c2cd,_0x2c89a9,_0x4b74f4=a0_0x4977ce(0x168)){const _0x37ab81=a0_0x4977ce;return this[_0x37ab81(0x196)](_0x37ab81(0x152),{'alias':_0x57c2cd,'task':_0x2c89a9,'priority':_0x4b74f4,'from_session':this[_0x37ab81(0x165)]});}async['message'](_0x442530,_0x337924){const _0x3a6d2a=a0_0x4977ce;return this[_0x3a6d2a(0x196)](_0x3a6d2a(0x17f),{'alias':_0x442530,'message':_0x337924,'from_session':this[_0x3a6d2a(0x165)]});}async[a0_0x4977ce(0x14e)](_0x572c66,_0x53b5db,_0x3ca623=a0_0x4977ce(0x16f)){const _0x20ae6b=a0_0x4977ce;return this['call'](_0x20ae6b(0x19b),{'in_reply_to':_0x572c66,'text':_0x53b5db,'status':_0x3ca623});}async[a0_0x4977ce(0x162)](_0x39244d,_0x294aa7){const _0xc50be0=a0_0x4977ce;return this[_0xc50be0(0x196)](_0xc50be0(0x157),{'resume_id':this['resumeId'],'alias':this[_0xc50be0(0x165)],'status':_0x39244d,'server':a0_0x387df7(),'hostname':a0_0x387df7(),'agent':this[_0xc50be0(0x189)],'project_dir':process[_0xc50be0(0x15c)](),..._0x294aa7});}async[a0_0x4977ce(0x174)](){return this['call']('get_all_status',{});}async[a0_0x4977ce(0x170)](_0x226310,_0x50df45){const _0xf810d2=a0_0x4977ce;return this['call'](_0xf810d2(0x170),{'message':_0x226310,'filter_server':_0x50df45?.[_0xf810d2(0x164)],'filter_status':_0x50df45?.[_0xf810d2(0x162)]});}async['connectSSE'](){const _0x4a1913=a0_0x4977ce;let _0x594f42=encodeURIComponent(this['alias']),_0x4df422=this[_0x4a1913(0x15f)]+_0x4a1913(0x177)+_0x594f42,_0x1b3074=this[_0x4a1913(0x148)];while(this[_0x4a1913(0x19d)]){try{this[_0x4a1913(0x163)]=new AbortController();let _0x126713={'Accept':'text/event-stream'};if(this[_0x4a1913(0x149)])_0x126713[_0x4a1913(0x188)]=_0x4a1913(0x147)+this['token'];let _0x1b0c84=await fetch(_0x4df422,{'headers':_0x126713,'signal':this[_0x4a1913(0x163)]['signal']});if(!_0x1b0c84['ok']||!_0x1b0c84[_0x4a1913(0x178)]){this[_0x4a1913(0x184)](_0x4a1913(0x183)+_0x1b0c84[_0x4a1913(0x162)]),await this[_0x4a1913(0x14f)](_0x1b3074),_0x1b3074=Math[_0x4a1913(0x14a)](_0x1b3074*1.5,0xea60);continue;}_0x1b3074=this[_0x4a1913(0x148)];let _0x34c414=_0x1b0c84[_0x4a1913(0x178)]['getReader'](),_0x143ade=new TextDecoder(),_0x185232='';while(this[_0x4a1913(0x19d)]){let {done:_0x7f66ba,value:_0x49660e}=await _0x34c414[_0x4a1913(0x179)]();if(_0x7f66ba)break;_0x185232+=_0x143ade[_0x4a1913(0x169)](_0x49660e,{'stream':!0x0});let _0x265f38=_0x185232[_0x4a1913(0x186)]('\x0a');_0x185232=_0x265f38[_0x4a1913(0x172)]()||'';for(let _0x5ecc91 of _0x265f38){if(!_0x5ecc91[_0x4a1913(0x161)](_0x4a1913(0x190)))continue;try{let _0x4e59b8=JSON[_0x4a1913(0x18f)](_0x5ecc91['slice'](0x6));if(_0x4e59b8[_0x4a1913(0x156)]===_0x4a1913(0x185)){this[_0x4a1913(0x184)](_0x4a1913(0x17b)),this[_0x4a1913(0x195)]('connected');continue;}if(_0x4e59b8[_0x4a1913(0x156)]===_0x4a1913(0x18c)||_0x4e59b8['type']===_0x4a1913(0x193)||_0x4e59b8[_0x4a1913(0x156)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x5e4364){if(_0x5e4364['name']==='AbortError')break;this[_0x4a1913(0x195)](_0x4a1913(0x151),_0x5e4364),this[_0x4a1913(0x184)](_0x4a1913(0x155)+_0x5e4364[_0x4a1913(0x175)]);}if(this[_0x4a1913(0x19d)])this[_0x4a1913(0x195)](_0x4a1913(0x146)),this[_0x4a1913(0x184)]('SSE\x20reconnecting\x20in\x20'+_0x1b3074/0x3e8+_0x4a1913(0x16c)),await this[_0x4a1913(0x14f)](_0x1b3074),_0x1b3074=Math[_0x4a1913(0x14a)](_0x1b3074*1.5,0xea60);}}async['processInbox'](){const _0x100879=a0_0x4977ce;try{let _0x4cddaf=(await this['call'](_0x100879(0x176),{'alias':this[_0x100879(0x165)],'limit':0xa}))?.[_0x100879(0x18d)]||[];for(let _0x29df34 of _0x4cddaf)await this[_0x100879(0x196)]('ack_inbox',{'alias':this[_0x100879(0x165)],'message_id':_0x29df34['id']}),this[_0x100879(0x184)]('←\x20'+_0x29df34['from_session']+':\x20'+_0x29df34[_0x100879(0x198)]['slice'](0x0,0x3c)),this[_0x100879(0x195)](_0x100879(0x17c),_0x29df34),this[_0x100879(0x195)](_0x100879(0x175),_0x29df34);}catch(_0x331cd6){this['log']('inbox\x20error:\x20'+_0x331cd6[_0x100879(0x175)]);}}[a0_0x4977ce(0x14f)](_0x3a5dc){return new Promise(_0xd22782=>setTimeout(_0xd22782,_0x3a5dc));}}var $=T;function a0_0x1b6f(_0x2da118,_0x3ab116){_0x2da118=_0x2da118-0x144;const _0x4b9532=a0_0x4b95();let _0x1b6ffd=_0x4b9532[_0x2da118];return _0x1b6ffd;}export{$ as default,T as CommHub};
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x3b1832=a0_0x5975;(function(_0x4afaa9,_0x17d161){const _0x912061=a0_0x5975,_0xc77a6a=_0x4afaa9();while(!![]){try{const _0x5a7747=-parseInt(_0x912061(0x1b0))/0x1+parseInt(_0x912061(0x216))/0x2+-parseInt(_0x912061(0x21b))/0x3*(-parseInt(_0x912061(0x1b5))/0x4)+-parseInt(_0x912061(0x1db))/0x5+-parseInt(_0x912061(0x197))/0x6*(-parseInt(_0x912061(0x215))/0x7)+parseInt(_0x912061(0x200))/0x8*(-parseInt(_0x912061(0x204))/0x9)+-parseInt(_0x912061(0x18e))/0xa*(-parseInt(_0x912061(0x1bd))/0xb);if(_0x5a7747===_0x17d161)break;else _0xc77a6a['push'](_0xc77a6a['shift']());}catch(_0x1bcf46){_0xc77a6a['push'](_0xc77a6a['shift']());}}}(a0_0x5861,0x83ade));import{readFileSync as a0_0xc3da35,existsSync as a0_0x1f98cb}from'fs';import{randomUUID as a0_0x47835b}from'crypto';import{join as a0_0x1ed1a1}from'path';import{hostname as a0_0x418ff2}from'os';import{execSync as a0_0x23db1e}from'child_process';function a0_0x5861(){const _0x174f6d=['data:\x20','\x22\x20(','777934bBLpKw','ready\x20—\x20waiting\x20for\x20events','join','token','toTimeString','8FBLgKF','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.',']\x20[commhub]\x20','registered\x20as\x20\x22','config.json','initialize','starting\x20SSE\x20listener...','Task\x20content','583piPTgd','connected','commhub_get_all_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','startsWith','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','SSE\x20connection\x20error:\x20','tools/call','params','.anet','get_all_status','new_task','string','init\x20failed:\x20','unknown\x20tool','\x20CWD=','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','result','CommHub\x20init\x20failed:\x20','priority','body','normal','warning:\x20could\x20not\x20register:\x20','send_message','delete','Reply\x20text\x20/\x20result\x20summary','catch','.claude/channels/commhub','replace','claude-code','4430650sHwOBC','commhub_send_task','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','hub','slice','working','MCP\x20stdio\x20connected','SIGINT','find','stderr','trim','number','replied','shutting\x20down,\x20reporting\x20offline...','cancelled','notifications/claude/channel','commhub_send_message','getReader','commhub','send_task','alias','stringify','read','object','\x20RESUME_ID=','message_id','Bearer\x20','Priority\x20(default:\x20normal)','no\x20response','statusText','type','SSE\x20stream\x20ended,\x20reconnecting...','low','\x20from\x20','pop','utf-8','/events/','64tlktBn','indexOf','messages','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','1154133iXSoRa','idle','commhub-channel','get_inbox','text','\x20PROJECT_ENV=','setRequestHandler','from_session','message','SSE\x20fatal:\x20','Authorization',':\x20inbox_count=','completed','get','status','in_progress','error','29246cEnluz','1351384IYmgfR','parse\x20error:\x20','ack_inbox','notification','decode','1510641KmfOet','Target\x20session\x20alias','→\x20injected\x20task\x20','/mcp','212180SnWQMg','application/json,\x20text/event-stream','ENV:\x20URL=','...\x20TMUX=','cwd','SSE\x20connected\x20as\x20\x22','SIGTERM','new_message','failed','606DJznJt','blocked','.env','broadcast','report_status','application/json','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','set','2.0','Current\x20task\x20description','commhub_report_status','2025-03-26','content','Progress\x200-100','POST','0.3.0','task','split','parse','send_reply','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','from','\x20ALIAS='];a0_0x5861=function(){return _0x174f6d;};return a0_0x5861();}import{Server as a0_0x1f3d38}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3d44d8}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x25c473,CallToolRequestSchema as a0_0x5cc9b8}from'@modelcontextprotocol/sdk/types.js';function p(_0x2783ef){const _0x5b465d=a0_0x5975;if(!a0_0x1f98cb(_0x2783ef))return;for(let _0x2db1bd of a0_0xc3da35(_0x2783ef,'utf-8')[_0x5b465d(0x1a8)]('\x0a')){let _0x151259=_0x2db1bd[_0x5b465d(0x1e5)]();if(!_0x151259||_0x151259['startsWith']('#'))continue;let _0x50324f=_0x151259[_0x5b465d(0x201)]('=');if(_0x50324f<0x0)continue;let _0x31759a=_0x151259[_0x5b465d(0x1df)](0x0,_0x50324f)[_0x5b465d(0x1e5)](),_0x1ab181=_0x151259[_0x5b465d(0x1df)](_0x50324f+0x1)[_0x5b465d(0x1e5)]()[_0x5b465d(0x1d9)](/^["']|["']$/g,'');if(!process.env[_0x31759a])process.env[_0x31759a]=_0x1ab181;}}var C=process.env.HOME||'~',T=a0_0x1ed1a1(C,a0_0x3b1832(0x1d8));p(a0_0x1ed1a1(T,a0_0x3b1832(0x199)));var L=process['cwd']()[a0_0x3b1832(0x1d9)](/\//g,'-');p(a0_0x1ed1a1(T,L,a0_0x3b1832(0x199)));function U(){const _0x4fa540=a0_0x3b1832;try{return a0_0x23db1e('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4fa540(0x1fe),'timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x3fef90=a0_0x3b1832;try{let _0x17b864=a0_0x1ed1a1(C,_0x3fef90(0x1c6),_0x3fef90(0x1b9));if(a0_0x1f98cb(_0x17b864))return JSON[_0x3fef90(0x1a9)](a0_0xc3da35(_0x17b864,_0x3fef90(0x1fe)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3b1832(0x1de)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x418ff2(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x47835b(),X=process.env.COMMHUB_TOKEN||H[a0_0x3b1832(0x1b3)]||'';function Y(_0xb48c75){const _0x4d075e=a0_0x3b1832;let _0x2e7ee8=new Date()[_0x4d075e(0x1b4)]()[_0x4d075e(0x1df)](0x0,0x8);process[_0x4d075e(0x1e4)]['write']('['+_0x2e7ee8+_0x4d075e(0x1b7)+_0xb48c75+'\x0a');}function h(_0x4d449e){return new Promise(_0x2fb00f=>setTimeout(_0x2fb00f,_0x4d449e));}Y(a0_0x3b1832(0x190)+f+a0_0x3b1832(0x1ad)+Z+a0_0x3b1832(0x1f3)+w[a0_0x3b1832(0x1df)](0x0,0x8)+a0_0x3b1832(0x191)+(j||'none')+a0_0x3b1832(0x1cc)+process[a0_0x3b1832(0x192)]()+a0_0x3b1832(0x209)+L);var k=new Map(),K=new a0_0x1f3d38({'name':a0_0x3b1832(0x206),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x3b1832(0x1ab),a0_0x3b1832(0x19d),'Session\x20alias:\x20'+Z][a0_0x3b1832(0x1b2)]('\x0a')});K[a0_0x3b1832(0x20a)](a0_0x25c473,async()=>({'tools':[{'name':'commhub_reply','description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x1dd)},'text':{'type':'string','description':a0_0x3b1832(0x1d6)},'status':{'type':'string','enum':[a0_0x3b1832(0x210),a0_0x3b1832(0x196),a0_0x3b1832(0x1e9),'blocked',a0_0x3b1832(0x214),a0_0x3b1832(0x213)],'description':a0_0x3b1832(0x203)}},'required':[a0_0x3b1832(0x208)]}},{'name':a0_0x3b1832(0x1a1),'description':a0_0x3b1832(0x1b6),'inputSchema':{'type':a0_0x3b1832(0x1f2),'properties':{'status':{'type':'string','enum':[a0_0x3b1832(0x1e0),a0_0x3b1832(0x205),a0_0x3b1832(0x198),a0_0x3b1832(0x214)]},'task':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x1a0)},'progress':{'type':a0_0x3b1832(0x1e6),'description':a0_0x3b1832(0x1a4)}},'required':[a0_0x3b1832(0x212)]}},{'name':a0_0x3b1832(0x1dc),'description':a0_0x3b1832(0x1cd),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x3b1832(0x21c)},'task':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x1bc)},'priority':{'type':a0_0x3b1832(0x1c9),'enum':['high',a0_0x3b1832(0x1d2),a0_0x3b1832(0x1fb)],'description':a0_0x3b1832(0x1f6)}},'required':['alias',a0_0x3b1832(0x1a7)]}},{'name':a0_0x3b1832(0x1eb),'description':a0_0x3b1832(0x1c2),'inputSchema':{'type':a0_0x3b1832(0x1f2),'properties':{'alias':{'type':a0_0x3b1832(0x1c9),'description':a0_0x3b1832(0x21c)},'message':{'type':a0_0x3b1832(0x1c9),'description':'Message\x20content'}},'required':[a0_0x3b1832(0x1ef),a0_0x3b1832(0x20c)]}},{'name':a0_0x3b1832(0x1bf),'description':a0_0x3b1832(0x1c0),'inputSchema':{'type':a0_0x3b1832(0x1f2),'properties':{}}}]}));async function P(_0x3600cf,_0x5473c7){const _0x5e7b0d=a0_0x3b1832;let _0x8cd001=await fetch(f+_0x5e7b0d(0x18d),{'method':_0x5e7b0d(0x1a5),'headers':{'Content-Type':_0x5e7b0d(0x19c),'Accept':_0x5e7b0d(0x18f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x5e7b0d(0x1f0)]({'jsonrpc':_0x5e7b0d(0x19f),'id':0x1,'method':_0x5e7b0d(0x1ba),'params':{'protocolVersion':_0x5e7b0d(0x1a2),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x5e7b0d(0x1a6)}}})});if(!_0x8cd001['ok']){let _0x4e835f=await _0x8cd001[_0x5e7b0d(0x208)]();return Y(_0x5e7b0d(0x1cf)+_0x8cd001[_0x5e7b0d(0x212)]+'\x20'+_0x4e835f[_0x5e7b0d(0x1df)](0x0,0x64)),{'ok':!0x1,'error':_0x5e7b0d(0x1ca)+_0x8cd001['status']};}await _0x8cd001['text']();let _0xb005ba=(await(await fetch(f+_0x5e7b0d(0x18d),{'method':_0x5e7b0d(0x1a5),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x5e7b0d(0x1f5)+X}:{}},'body':JSON[_0x5e7b0d(0x1f0)]({'jsonrpc':_0x5e7b0d(0x19f),'id':0x2,'method':_0x5e7b0d(0x1c4),'params':{'name':_0x3600cf,'arguments':_0x5473c7}})}))['text']())['split']('\x0a')[_0x5e7b0d(0x1e3)](_0x5fc4d1=>_0x5fc4d1[_0x5e7b0d(0x1c1)]('data:\x20'));if(_0xb005ba){let _0x41df4f=JSON[_0x5e7b0d(0x1a9)](_0xb005ba[_0x5e7b0d(0x1df)](0x6));return _0x41df4f?.['result']?.[_0x5e7b0d(0x1a3)]?.[0x0]?.['text']?JSON[_0x5e7b0d(0x1a9)](_0x41df4f[_0x5e7b0d(0x1ce)][_0x5e7b0d(0x1a3)][0x0]['text']):_0x41df4f;}return{'ok':!0x1,'error':_0x5e7b0d(0x1f7)};}K['setRequestHandler'](a0_0x5cc9b8,async _0x5ba395=>{const _0xa4534d=a0_0x3b1832;let {name:_0x3d5137,arguments:_0x128bc5}=_0x5ba395[_0xa4534d(0x1c5)];if(_0x3d5137==='commhub_reply'){let {task_id:_0x417b62,text:_0x2ee6f0,status:_0x3d5457}=_0x128bc5;if(_0x3d5457===_0xa4534d(0x210)||_0x3d5457===_0xa4534d(0x196)||_0x3d5457===_0xa4534d(0x1e9)){let _0x187737=_0x3d5457===_0xa4534d(0x210)?_0xa4534d(0x1e7):_0x3d5457,_0x425037=_0x417b62?k[_0xa4534d(0x211)](_0x417b62)||_0xa4534d(0x1de):_0xa4534d(0x1de),_0x16cd9a=await P(_0xa4534d(0x1aa),{'alias':_0x425037,'text':_0x2ee6f0,'in_reply_to':_0x417b62||void 0x0,'status':_0x187737,'from_session':Z});if(_0x417b62)k[_0xa4534d(0x1d5)](_0x417b62);return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x16cd9a)}]};}let _0x58b411=await P(_0xa4534d(0x19b),{'resume_id':w,'alias':Z,'status':_0x3d5457==='blocked'?_0xa4534d(0x198):_0x3d5457===_0xa4534d(0x214)?_0xa4534d(0x214):'working','task':_0x2ee6f0[_0xa4534d(0x1df)](0x0,0xc8),'output':_0x2ee6f0});return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x58b411)}]};}if(_0x3d5137===_0xa4534d(0x1a1)){let {status:_0x4ab2f5,task:_0x4d0819,progress:_0xea98a8}=_0x128bc5,_0x28783a=await P(_0xa4534d(0x19b),{'resume_id':w,'alias':Z,'status':_0x4ab2f5,'task':_0x4d0819,'progress':_0xea98a8});return{'content':[{'type':'text','text':JSON['stringify'](_0x28783a)}]};}if(_0x3d5137===_0xa4534d(0x1dc)){let {alias:_0x4d8934,task:_0x674fb3,priority:_0x5c9845}=_0x128bc5,_0x219ab2=await P(_0xa4534d(0x1ee),{'alias':_0x4d8934,'task':_0x674fb3,'priority':_0x5c9845||_0xa4534d(0x1d2),'from_session':Z});return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x219ab2)}]};}if(_0x3d5137==='commhub_send_message'){let {alias:_0x447f04,message:_0x27d62a}=_0x128bc5,_0x5d564d=await P(_0xa4534d(0x1d4),{'alias':_0x447f04,'message':_0x27d62a,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0xa4534d(0x1f0)](_0x5d564d)}]};}if(_0x3d5137==='commhub_get_all_status'){let _0x11a680=await P(_0xa4534d(0x1c7),{});return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)](_0x11a680)}]};}return{'content':[{'type':_0xa4534d(0x208),'text':JSON[_0xa4534d(0x1f0)]({'error':_0xa4534d(0x1cb)})}]};});async function u(){const _0x2f2a7d=a0_0x3b1832;let _0x41c2b7=f+_0x2f2a7d(0x1ff)+encodeURIComponent(Z),_0x5015dd={};if(X)_0x5015dd[_0x2f2a7d(0x20e)]='Bearer\x20'+X;Y('connecting\x20to\x20'+_0x41c2b7);while(!0x0){try{let _0x19de01=await fetch(_0x41c2b7,{'headers':_0x5015dd});if(!_0x19de01['ok']){Y('SSE\x20error:\x20'+_0x19de01[_0x2f2a7d(0x212)]+'\x20'+_0x19de01[_0x2f2a7d(0x1f8)]),await h(0x1388);continue;}let _0x2d30de=_0x19de01[_0x2f2a7d(0x1d1)][_0x2f2a7d(0x1ec)](),_0xd1a900=new TextDecoder(),_0x24c099='';while(!0x0){let {done:_0x47a1e6,value:_0x247222}=await _0x2d30de[_0x2f2a7d(0x1f1)]();if(_0x47a1e6)break;_0x24c099+=_0xd1a900[_0x2f2a7d(0x21a)](_0x247222,{'stream':!0x0});let _0x2ddceb=_0x24c099[_0x2f2a7d(0x1a8)]('\x0a\x0a');_0x24c099=_0x2ddceb[_0x2f2a7d(0x1fd)]()||'';for(let _0x2f9413 of _0x2ddceb){let _0x6a7e80=_0x2f9413['split']('\x0a')[_0x2f2a7d(0x1e3)](_0x4a0c87=>_0x4a0c87[_0x2f2a7d(0x1c1)](_0x2f2a7d(0x1ae)));if(!_0x6a7e80)continue;try{let _0xd14098=JSON[_0x2f2a7d(0x1a9)](_0x6a7e80[_0x2f2a7d(0x1df)](0x6));await S(_0xd14098);}catch(_0x5c32c3){Y(_0x2f2a7d(0x217)+_0x5c32c3);}}}Y(_0x2f2a7d(0x1fa));}catch(_0x4cf035){Y(_0x2f2a7d(0x1c3)+_0x4cf035);}await h(0xbb8);}}async function S(_0x237d0c){const _0x85be88=a0_0x3b1832;if(_0x237d0c['type']===_0x85be88(0x1be)){Y(_0x85be88(0x193)+Z+'\x22');return;}if(_0x237d0c['type']===_0x85be88(0x195)){if(Y('←\x20message\x20from\x20'+_0x237d0c[_0x85be88(0x1ac)]+':\x20'+_0x237d0c['message'][_0x85be88(0x1df)](0x0,0x3c)),await K[_0x85be88(0x219)]({'method':_0x85be88(0x1ea),'params':{'content':_0x237d0c[_0x85be88(0x20c)],'meta':{'sender':_0x237d0c[_0x85be88(0x1ac)]||_0x85be88(0x1de),'sender_id':_0x85be88(0x1ed),'user':_0x237d0c[_0x85be88(0x1ac)]||_0x85be88(0x1de),'priority':_0x85be88(0x1d2)}}}),_0x237d0c[_0x85be88(0x1f4)])await P(_0x85be88(0x218),{'alias':Z,'message_id':_0x237d0c[_0x85be88(0x1f4)]});return;}if(_0x237d0c[_0x85be88(0x1f9)]===_0x85be88(0x1c8)||_0x237d0c[_0x85be88(0x1f9)]===_0x85be88(0x19a)){Y('←\x20'+_0x237d0c[_0x85be88(0x1f9)]+_0x85be88(0x20f)+_0x237d0c['inbox_count']+'\x20priority='+(_0x237d0c[_0x85be88(0x1d0)]||_0x85be88(0x1d2)));let _0x45480e=await P(_0x85be88(0x207),{'alias':Z,'limit':0x5});if(_0x45480e?.['ok']&&_0x45480e[_0x85be88(0x202)]?.['length']>0x0)for(let _0x4711d7 of _0x45480e[_0x85be88(0x202)]){let _0x198309={'sender':_0x4711d7[_0x85be88(0x20b)]||_0x85be88(0x1de),'sender_id':_0x85be88(0x1ed),'user':_0x4711d7['from_session']||_0x85be88(0x1de),'task_id':_0x4711d7['id'],'priority':_0x4711d7['priority']||_0x85be88(0x1d2)};k[_0x85be88(0x19e)](_0x4711d7['id'],_0x4711d7[_0x85be88(0x20b)]||'hub'),await K[_0x85be88(0x219)]({'method':_0x85be88(0x1ea),'params':{'content':_0x4711d7['content'],'meta':_0x198309}}),Y(_0x85be88(0x21d)+_0x4711d7['id'][_0x85be88(0x1df)](0x0,0x8)+_0x85be88(0x1fc)+_0x4711d7['from_session']+':\x20'+_0x4711d7[_0x85be88(0x1a3)][_0x85be88(0x1df)](0x0,0x3c)),await P(_0x85be88(0x218),{'alias':Z,'message_id':_0x4711d7['id']});}}}async function A(){const _0x9ed7b9=a0_0x3b1832;let _0x5b66f7=new a0_0x3d44d8();await K['connect'](_0x5b66f7),Y(_0x9ed7b9(0x1e1)),Y(_0x9ed7b9(0x1bb)),u()[_0x9ed7b9(0x1d7)](_0x1067c9=>Y(_0x9ed7b9(0x20d)+_0x1067c9)),P(_0x9ed7b9(0x19b),{'resume_id':w,'alias':Z,'status':_0x9ed7b9(0x205),'server':a0_0x418ff2(),'hostname':a0_0x418ff2(),'agent':_0x9ed7b9(0x1da),'project_dir':process[_0x9ed7b9(0x192)](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x9ed7b9(0x1b8)+Z+_0x9ed7b9(0x1af)+w[_0x9ed7b9(0x1df)](0x0,0x8)+')'))['catch'](_0x58b332=>Y(_0x9ed7b9(0x1d3)+_0x58b332)),setInterval(()=>{const _0x2f2a38=_0x9ed7b9;P(_0x2f2a38(0x19b),{'resume_id':w,'alias':Z,'status':_0x2f2a38(0x205),'server':a0_0x418ff2(),'hostname':a0_0x418ff2(),'agent':_0x2f2a38(0x1da),'project_dir':process[_0x2f2a38(0x192)](),'tmux_name':j||void 0x0})[_0x2f2a38(0x1d7)](_0x520c17=>Y('heartbeat\x20failed:\x20'+_0x520c17));},0x2bf20),Y(_0x9ed7b9(0x1b1));}function a0_0x5975(_0x13f503,_0x4a3557){_0x13f503=_0x13f503-0x18d;const _0x5861b1=a0_0x5861();let _0x597591=_0x5861b1[_0x13f503];return _0x597591;}A()['catch'](_0x4c95da=>{Y('fatal:\x20'+_0x4c95da),process['exit'](0x1);});async function N(){const _0x3db3bd=a0_0x3b1832;Y(_0x3db3bd(0x1e8)),await P(_0x3db3bd(0x19b),{'resume_id':w,'alias':Z,'status':_0x3db3bd(0x214),'task':'session\x20disconnected'})[_0x3db3bd(0x1d7)](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x3b1832(0x194),()=>N()),process['on'](a0_0x3b1832(0x1e2),()=>N());
|
|
2
|
+
const a0_0x23baf6=a0_0x5ffd;(function(_0x471f9c,_0x47f5bc){const _0x56f52c=a0_0x5ffd,_0x58a749=_0x471f9c();while(!![]){try{const _0x42c60f=parseInt(_0x56f52c(0xe7))/0x1*(-parseInt(_0x56f52c(0x104))/0x2)+parseInt(_0x56f52c(0x7d))/0x3*(parseInt(_0x56f52c(0x105))/0x4)+-parseInt(_0x56f52c(0x94))/0x5*(parseInt(_0x56f52c(0xa9))/0x6)+parseInt(_0x56f52c(0x9c))/0x7+-parseInt(_0x56f52c(0xa2))/0x8+parseInt(_0x56f52c(0x92))/0x9*(-parseInt(_0x56f52c(0xc3))/0xa)+parseInt(_0x56f52c(0xb3))/0xb;if(_0x42c60f===_0x47f5bc)break;else _0x58a749['push'](_0x58a749['shift']());}catch(_0x50e99e){_0x58a749['push'](_0x58a749['shift']());}}}(a0_0x441a,0x9053a));import{readFileSync as a0_0x50b915,existsSync as a0_0x359098}from'fs';import{randomUUID as a0_0x2692f7}from'crypto';import{join as a0_0x26a64d}from'path';import{hostname as a0_0x201dd8}from'os';import{execSync as a0_0x41dda2}from'child_process';import{Server as a0_0x17a361}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x7d2bfd}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xa68fd7,CallToolRequestSchema as a0_0x1fbed3}from'@modelcontextprotocol/sdk/types.js';function p(_0x4b52ac){const _0x277795=a0_0x5ffd;if(!a0_0x359098(_0x4b52ac))return;for(let _0x4f7c2b of a0_0x50b915(_0x4b52ac,_0x277795(0xd0))[_0x277795(0x8b)]('\x0a')){let _0x50dd00=_0x4f7c2b['trim']();if(!_0x50dd00||_0x50dd00[_0x277795(0x88)]('#'))continue;let _0x2a8831=_0x50dd00[_0x277795(0xde)]('=');if(_0x2a8831<0x0)continue;let _0x573378=_0x50dd00['slice'](0x0,_0x2a8831)[_0x277795(0xc9)](),_0x5efd2b=_0x50dd00[_0x277795(0xdc)](_0x2a8831+0x1)[_0x277795(0xc9)]()[_0x277795(0xcb)](/^["']|["']$/g,'');if(!process.env[_0x573378])process.env[_0x573378]=_0x5efd2b;}}var C=process.env.HOME||'~',T=a0_0x26a64d(C,a0_0x23baf6(0xbc));p(a0_0x26a64d(T,a0_0x23baf6(0xb6)));var L=process[a0_0x23baf6(0x84)]()[a0_0x23baf6(0xcb)](/\//g,'-');p(a0_0x26a64d(T,L,'.env'));function U(){const _0x4a95bb=a0_0x23baf6;try{return a0_0x41dda2(_0x4a95bb(0xab),{'encoding':_0x4a95bb(0xd0),'timeout':0x7d0})[_0x4a95bb(0xc9)]();}catch{return'';}}function v(){const _0x3f15eb=a0_0x23baf6;try{let _0x7a2f27=a0_0x26a64d(C,_0x3f15eb(0xe5),_0x3f15eb(0x9b));if(a0_0x359098(_0x7a2f27))return JSON[_0x3f15eb(0x98)](a0_0x50b915(_0x7a2f27,_0x3f15eb(0xd0)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x23baf6(0x8c)]||a0_0x23baf6(0x9d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x201dd8(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x2692f7(),X=process.env.COMMHUB_TOKEN||H[a0_0x23baf6(0x7e)]||'';function Y(_0x2b52fe){const _0x4c940b=a0_0x23baf6;let _0x85b0dd=new Date()[_0x4c940b(0x82)]()['slice'](0x0,0x8);process[_0x4c940b(0xd8)][_0x4c940b(0xa6)]('['+_0x85b0dd+_0x4c940b(0xb1)+_0x2b52fe+'\x0a');}function h(_0x1c8f59){return new Promise(_0x56b374=>setTimeout(_0x56b374,_0x1c8f59));}Y(a0_0x23baf6(0xcf)+f+'\x20ALIAS='+Z+'\x20RESUME_ID='+w['slice'](0x0,0x8)+a0_0x23baf6(0x96)+(j||a0_0x23baf6(0xa8))+a0_0x23baf6(0xcc)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x17a361({'name':a0_0x23baf6(0xd2),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x23baf6(0x91),a0_0x23baf6(0xb4),a0_0x23baf6(0xaf),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+Z][a0_0x23baf6(0xc0)]('\x0a')});K['setRequestHandler'](a0_0xa68fd7,async()=>({'tools':[{'name':a0_0x23baf6(0xff),'description':a0_0x23baf6(0xba),'inputSchema':{'type':a0_0x23baf6(0x9a),'properties':{'task_id':{'type':a0_0x23baf6(0x103),'description':a0_0x23baf6(0xa4)},'text':{'type':a0_0x23baf6(0x103),'description':a0_0x23baf6(0x89)},'status':{'type':a0_0x23baf6(0x103),'enum':[a0_0x23baf6(0xef),a0_0x23baf6(0xad),a0_0x23baf6(0x80),a0_0x23baf6(0xee),a0_0x23baf6(0xec),'in_progress'],'description':a0_0x23baf6(0xf8)}},'required':[a0_0x23baf6(0xd7)]}},{'name':a0_0x23baf6(0xe0),'description':a0_0x23baf6(0xd1),'inputSchema':{'type':a0_0x23baf6(0x9a),'properties':{'status':{'type':'string','enum':[a0_0x23baf6(0x8a),a0_0x23baf6(0xfd),a0_0x23baf6(0xee),'error']},'task':{'type':'string','description':a0_0x23baf6(0xc6)},'progress':{'type':a0_0x23baf6(0xae),'description':'Progress\x200-100'}},'required':[a0_0x23baf6(0xa3)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x23baf6(0x103),'description':a0_0x23baf6(0xed)},'task':{'type':a0_0x23baf6(0x103),'description':a0_0x23baf6(0xf1)},'priority':{'type':a0_0x23baf6(0x103),'enum':['high',a0_0x23baf6(0xeb),a0_0x23baf6(0xf4)],'description':a0_0x23baf6(0x81)}},'required':[a0_0x23baf6(0xe2),'task']}},{'name':a0_0x23baf6(0x93),'description':a0_0x23baf6(0xcd),'inputSchema':{'type':a0_0x23baf6(0x9a),'properties':{'alias':{'type':a0_0x23baf6(0x103),'description':a0_0x23baf6(0xed)},'message':{'type':a0_0x23baf6(0x103),'description':a0_0x23baf6(0xc4)}},'required':['alias',a0_0x23baf6(0xc5)]}},{'name':a0_0x23baf6(0xb0),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x23baf6(0x9a),'properties':{}}}]}));async function P(_0x21bfb8,_0x328d0d){const _0x18919b=a0_0x23baf6;let _0x2e6aa7=await fetch(f+_0x18919b(0xfb),{'method':_0x18919b(0xdd),'headers':{'Content-Type':'application/json','Accept':_0x18919b(0xf5),...X?{'Authorization':_0x18919b(0x97)+X}:{}},'body':JSON[_0x18919b(0xe3)]({'jsonrpc':'2.0','id':0x1,'method':_0x18919b(0xe6),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x18919b(0xd2),'version':_0x18919b(0xda)}}})});if(!_0x2e6aa7['ok']){let _0xaa3f07=await _0x2e6aa7[_0x18919b(0xd7)]();return Y(_0x18919b(0xfe)+_0x2e6aa7[_0x18919b(0xa3)]+'\x20'+_0xaa3f07[_0x18919b(0xdc)](0x0,0x64)),{'ok':!0x1,'error':_0x18919b(0x85)+_0x2e6aa7[_0x18919b(0xa3)]};}await _0x2e6aa7[_0x18919b(0xd7)]();let _0x1cadd6=(await(await fetch(f+'/mcp',{'method':_0x18919b(0xdd),'headers':{'Content-Type':_0x18919b(0xf9),'Accept':_0x18919b(0xf5),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x18919b(0xe3)]({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0x21bfb8,'arguments':_0x328d0d}})}))[_0x18919b(0xd7)]())[_0x18919b(0x8b)]('\x0a')[_0x18919b(0xdb)](_0x2f0535=>_0x2f0535[_0x18919b(0x88)](_0x18919b(0xbf)));if(_0x1cadd6){let _0xf271b3=JSON[_0x18919b(0x98)](_0x1cadd6[_0x18919b(0xdc)](0x6));return _0xf271b3?.[_0x18919b(0x7c)]?.[_0x18919b(0x83)]?.[0x0]?.['text']?JSON[_0x18919b(0x98)](_0xf271b3[_0x18919b(0x7c)][_0x18919b(0x83)][0x0]['text']):_0xf271b3;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x23baf6(0xc1)](a0_0x1fbed3,async _0x474757=>{const _0x148718=a0_0x23baf6;let {name:_0x42d11f,arguments:_0x4ca2b3}=_0x474757[_0x148718(0x8e)];if(_0x42d11f===_0x148718(0xff)){let {task_id:_0x5d587a,text:_0x5f3fb2,status:_0x6454ca}=_0x4ca2b3;if(_0x6454ca===_0x148718(0xef)||_0x6454ca===_0x148718(0xad)||_0x6454ca==='cancelled'){let _0x54ed05=_0x6454ca===_0x148718(0xef)?_0x148718(0xe8):_0x6454ca,_0x37007a=_0x5d587a?k['get'](_0x5d587a)||_0x148718(0x8c):_0x148718(0x8c),_0x2c7e5a=await P(_0x148718(0xc2),{'alias':_0x37007a,'text':_0x5f3fb2,'in_reply_to':_0x5d587a||void 0x0,'status':_0x54ed05,'from_session':Z});if(_0x5d587a)k[_0x148718(0xa5)](_0x5d587a);return{'content':[{'type':_0x148718(0xd7),'text':JSON['stringify'](_0x2c7e5a)}]};}let _0x4cf2ea=await P(_0x148718(0xb5),{'resume_id':w,'alias':Z,'status':_0x6454ca===_0x148718(0xee)?'blocked':_0x6454ca===_0x148718(0xec)?'error':_0x148718(0x8a),'task':_0x5f3fb2[_0x148718(0xdc)](0x0,0xc8),'output':_0x5f3fb2});return{'content':[{'type':_0x148718(0xd7),'text':JSON[_0x148718(0xe3)](_0x4cf2ea)}]};}if(_0x42d11f===_0x148718(0xe0)){let {status:_0x26ac0d,task:_0x486b88,progress:_0x3c206c}=_0x4ca2b3,_0x438cc5=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x26ac0d,'task':_0x486b88,'progress':_0x3c206c});return{'content':[{'type':_0x148718(0xd7),'text':JSON['stringify'](_0x438cc5)}]};}if(_0x42d11f===_0x148718(0xf0)){let {alias:_0x199109,task:_0x503719,priority:_0x46603a}=_0x4ca2b3,_0x148a95=await P(_0x148718(0x7f),{'alias':_0x199109,'task':_0x503719,'priority':_0x46603a||_0x148718(0xeb),'from_session':Z});return{'content':[{'type':_0x148718(0xd7),'text':JSON[_0x148718(0xe3)](_0x148a95)}]};}if(_0x42d11f===_0x148718(0x93)){let {alias:_0x39326c,message:_0x191ac1}=_0x4ca2b3,_0x30066e=await P(_0x148718(0xf2),{'alias':_0x39326c,'message':_0x191ac1,'from_session':Z});return{'content':[{'type':_0x148718(0xd7),'text':JSON[_0x148718(0xe3)](_0x30066e)}]};}if(_0x42d11f===_0x148718(0xb0)){let _0x52583a=await P('get_all_status',{});return{'content':[{'type':_0x148718(0xd7),'text':JSON[_0x148718(0xe3)](_0x52583a)}]};}return{'content':[{'type':_0x148718(0xd7),'text':JSON['stringify']({'error':_0x148718(0xce)})}]};});async function u(){const _0x61582e=a0_0x23baf6;let _0x436adb=f+_0x61582e(0xac)+encodeURIComponent(Z),_0x31a1a2={};if(X)_0x31a1a2[_0x61582e(0xd9)]=_0x61582e(0x97)+X;Y(_0x61582e(0xfc)+_0x436adb);while(!0x0){try{let _0x5c9aff=await fetch(_0x436adb,{'headers':_0x31a1a2});if(!_0x5c9aff['ok']){Y('SSE\x20error:\x20'+_0x5c9aff['status']+'\x20'+_0x5c9aff[_0x61582e(0xe4)]),await h(0x1388);continue;}let _0x106990=_0x5c9aff['body'][_0x61582e(0xca)](),_0x35c5fb=new TextDecoder(),_0x1f7685='';while(!0x0){let {done:_0xe1c95e,value:_0x3dffda}=await _0x106990[_0x61582e(0xe1)]();if(_0xe1c95e)break;_0x1f7685+=_0x35c5fb['decode'](_0x3dffda,{'stream':!0x0});let _0x307deb=_0x1f7685[_0x61582e(0x8b)]('\x0a\x0a');_0x1f7685=_0x307deb['pop']()||'';for(let _0x475fd8 of _0x307deb){let _0x300357=_0x475fd8[_0x61582e(0x8b)]('\x0a')[_0x61582e(0xdb)](_0x257154=>_0x257154[_0x61582e(0x88)](_0x61582e(0xbf)));if(!_0x300357)continue;try{let _0x44cbf1=JSON[_0x61582e(0x98)](_0x300357[_0x61582e(0xdc)](0x6));await S(_0x44cbf1);}catch(_0x5cf525){Y('parse\x20error:\x20'+_0x5cf525);}}}Y(_0x61582e(0x8d));}catch(_0x2e7031){Y(_0x61582e(0x106)+_0x2e7031);}await h(0xbb8);}}async function S(_0x4cd0ac){const _0x5264c4=a0_0x23baf6;if(_0x4cd0ac[_0x5264c4(0x86)]===_0x5264c4(0xd3)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x4cd0ac[_0x5264c4(0x86)]===_0x5264c4(0x100)){if(Y('←\x20message\x20from\x20'+_0x4cd0ac[_0x5264c4(0xf6)]+':\x20'+_0x4cd0ac[_0x5264c4(0xc5)]['slice'](0x0,0x3c)),await K[_0x5264c4(0x95)]({'method':'notifications/claude/channel','params':{'content':_0x4cd0ac[_0x5264c4(0xc5)],'meta':{'sender':_0x4cd0ac[_0x5264c4(0xf6)]||'hub','sender_id':_0x5264c4(0xfa),'user':_0x4cd0ac[_0x5264c4(0xf6)]||'hub','priority':_0x5264c4(0xeb)}}}),_0x4cd0ac[_0x5264c4(0xb9)])await P('ack_inbox',{'alias':Z,'message_id':_0x4cd0ac[_0x5264c4(0xb9)]});return;}if(_0x4cd0ac['type']==='new_task'||_0x4cd0ac[_0x5264c4(0x86)]===_0x5264c4(0xdf)){Y('←\x20'+_0x4cd0ac['type']+_0x5264c4(0xb7)+_0x4cd0ac['inbox_count']+_0x5264c4(0x101)+(_0x4cd0ac[_0x5264c4(0x87)]||_0x5264c4(0xeb)));let _0x58f9f3=await P(_0x5264c4(0xc7),{'alias':Z,'limit':0x5});if(_0x58f9f3?.['ok']&&_0x58f9f3[_0x5264c4(0xd6)]?.['length']>0x0)for(let _0x486c18 of _0x58f9f3[_0x5264c4(0xd6)]){let _0x4d2e2c={'sender':_0x486c18[_0x5264c4(0x102)]||_0x5264c4(0x8c),'sender_id':_0x5264c4(0xfa),'user':_0x486c18['from_session']||'hub','task_id':_0x486c18['id'],'priority':_0x486c18[_0x5264c4(0x87)]||_0x5264c4(0xeb)};k[_0x5264c4(0xbb)](_0x486c18['id'],_0x486c18[_0x5264c4(0x102)]||_0x5264c4(0x8c)),await K[_0x5264c4(0x95)]({'method':_0x5264c4(0xd5),'params':{'content':_0x486c18[_0x5264c4(0x83)],'meta':_0x4d2e2c}}),Y(_0x5264c4(0xea)+_0x486c18['id'][_0x5264c4(0xdc)](0x0,0x8)+'\x20from\x20'+_0x486c18[_0x5264c4(0x102)]+':\x20'+_0x486c18[_0x5264c4(0x83)]['slice'](0x0,0x3c)),await P(_0x5264c4(0xf3),{'alias':Z,'message_id':_0x486c18['id']});}}}async function A(){const _0x5994af=a0_0x23baf6;let _0x23da29=new a0_0x7d2bfd();await K['connect'](_0x23da29),Y(_0x5994af(0xf7)),Y(_0x5994af(0xd4)),u()[_0x5994af(0xbe)](_0x5e8382=>Y(_0x5994af(0x99)+_0x5e8382)),P(_0x5994af(0xb5),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x201dd8(),'hostname':a0_0x201dd8(),'agent':_0x5994af(0x9e),'project_dir':process[_0x5994af(0x84)](),'tmux_name':j||void 0x0})[_0x5994af(0xc8)](()=>Y('registered\x20as\x20\x22'+Z+_0x5994af(0xa1)+w[_0x5994af(0xdc)](0x0,0x8)+')'))[_0x5994af(0xbe)](_0x3b45c6=>Y(_0x5994af(0xa0)+_0x3b45c6)),setInterval(()=>{const _0x427053=_0x5994af;P('report_status',{'resume_id':w,'alias':Z,'status':_0x427053(0xfd),'server':a0_0x201dd8(),'hostname':a0_0x201dd8(),'agent':_0x427053(0x9e),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x427053(0xbe)](_0x16480e=>Y(_0x427053(0x90)+_0x16480e));},0x2bf20),Y(_0x5994af(0xb2));}A()[a0_0x23baf6(0xbe)](_0x2b71a2=>{const _0x4c12f5=a0_0x23baf6;Y(_0x4c12f5(0xbd)+_0x2b71a2),process[_0x4c12f5(0xb8)](0x1);});function a0_0x441a(){const _0x1d5cef=['normal','error','Target\x20session\x20alias','blocked','completed','commhub_send_task','Task\x20content','send_message','ack_inbox','low','application/json,\x20text/event-stream','from','MCP\x20stdio\x20connected','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','application/json','commhub','/mcp','connecting\x20to\x20','idle','CommHub\x20init\x20failed:\x20','commhub_reply','new_message','\x20priority=','from_session','string','359332RGcoBI','8GWAlwf','SSE\x20connection\x20error:\x20','result','1698609eiWPLe','token','send_task','cancelled','Priority\x20(default:\x20normal)','toTimeString','content','cwd','init\x20failed:\x20','type','priority','startsWith','Reply\x20text\x20/\x20result\x20summary','working','split','hub','SSE\x20stream\x20ended,\x20reconnecting...','params','session\x20disconnected','heartbeat\x20failed:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','4887AsKQdj','commhub_send_message','386765EWFbco','notification','...\x20TMUX=','Bearer\x20','parse','SSE\x20fatal:\x20','object','config.json','5648734FbAZGp','http://127.0.0.1:9200','claude-code','shutting\x20down,\x20reporting\x20offline...','warning:\x20could\x20not\x20register:\x20','\x22\x20(','5627552DJcndO','status','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','delete','write','stdin','none','78GACSqT','SIGINT','tmux\x20display-message\x20-p\x20\x27#S\x27','/events/','failed','number','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub_get_all_status',']\x20[commhub]\x20','ready\x20—\x20waiting\x20for\x20events','25915450mrAFgb','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','report_status','.env',':\x20inbox_count=','exit','message_id','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','set','.claude/channels/commhub','fatal:\x20','catch','data:\x20','join','setRequestHandler','send_reply','16890ctWlTA','Message\x20content','message','Current\x20task\x20description','get_inbox','then','trim','getReader','replace','\x20CWD=','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','unknown\x20tool','ENV:\x20URL=','utf-8','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','commhub-channel','connected','starting\x20SSE\x20listener...','notifications/claude/channel','messages','text','stderr','Authorization','0.3.0','find','slice','POST','indexOf','broadcast','commhub_report_status','read','alias','stringify','statusText','.anet','initialize','6HHRiYW','replied','SIGTERM','→\x20injected\x20task\x20'];a0_0x441a=function(){return _0x1d5cef;};return a0_0x441a();}function a0_0x5ffd(_0x5a690b,_0x2b9d7b){_0x5a690b=_0x5a690b-0x7c;const _0x441a57=a0_0x441a();let _0x5ffd46=_0x441a57[_0x5a690b];return _0x5ffd46;}async function N(){const _0x21900e=a0_0x23baf6;Y(_0x21900e(0x9f)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x21900e(0xec),'task':_0x21900e(0x8f)})[_0x21900e(0xbe)](()=>{}),process[_0x21900e(0xb8)](0x0);}process[a0_0x23baf6(0xa7)]['on']('end',()=>N()),process['on'](a0_0x23baf6(0xe9),()=>N()),process['on'](a0_0x23baf6(0xaa),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3-preview.0",
|
|
4
4
|
"description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|