@sleep2agi/agent-network 2.0.0-preview.23 → 2.0.0-preview.24
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/README.md +25 -5
- 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 +7 -6
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x3d4295=a0_0x4722;(function(_0x86405e,_0xdedf92){const _0x5bef65=a0_0x4722,_0x1decdd=_0x86405e();while(!![]){try{const _0x1230f5=-parseInt(_0x5bef65(0x8b))/0x1*(-parseInt(_0x5bef65(0xac))/0x2)+parseInt(_0x5bef65(0xce))/0x3*(-parseInt(_0x5bef65(0x8f))/0x4)+-parseInt(_0x5bef65(0x94))/0x5+-parseInt(_0x5bef65(0x9b))/0x6*(-parseInt(_0x5bef65(0xa6))/0x7)+-parseInt(_0x5bef65(0x9e))/0x8*(-parseInt(_0x5bef65(0xab))/0x9)+parseInt(_0x5bef65(0x7d))/0xa+parseInt(_0x5bef65(0x98))/0xb*(parseInt(_0x5bef65(0xc6))/0xc);if(_0x1230f5===_0xdedf92)break;else _0x1decdd['push'](_0x1decdd['shift']());}catch(_0x2a8111){_0x1decdd['push'](_0x1decdd['shift']());}}}(a0_0x49f0,0x9ddb1));import{EventEmitter as a0_0x782336}from'events';import{hostname as a0_0x5aec6f}from'os';function a0_0x4722(_0x8065d,_0x57de87){_0x8065d=_0x8065d-0x7b;const _0x49f018=a0_0x49f0();let _0x4722b8=_0x49f018[_0x8065d];return _0x4722b8;}function a0_0x49f0(){const _0x4ee9ad=['reconnectDelay','min','7kJYxFB','AbortError','idle','send_task','SSE\x20reconnecting\x20in\x20','117NHbvsB','1083638UcHEyv','sdk','heartbeatInterval',']\x20[commhub:','agent','data:\x20','sleep','running','read','send','disconnect','cwd','2.0','connected','task','connect','POST','s...','toString','match','text/event-stream','name','reply','signal','now','getAllStatus','2858736JaTocH','/mcp','new_message','text','get_inbox','SSE\x20error:\x20','call','error','3nfdaLX','completed','split','sseAbort','Bearer\x20','application/json','7473030tdJvaA','log','replace','abort','heartbeat\x20failed:\x20','processInbox','catch','heartbeatTimer','connectSSE','get_all_status','parse','type','resumeId','Authorization','1KKFdMt','send_message','offline','content','3682524uIHGqb','from_session','application/json,\x20text/event-stream','slice','url','5594865HRWQRg','emit','alias','normal','11ykkcyY','startsWith','status','4437408NRXqdC','disconnected','decode','258008JxUbXn','body','server','message','inbox\x20error:\x20','token'];a0_0x49f0=function(){return _0x4ee9ad;};return a0_0x49f0();}class T extends a0_0x782336{['url'];[a0_0x3d4295(0x96)];[a0_0x3d4295(0xa3)];[a0_0x3d4295(0xb0)];[a0_0x3d4295(0x89)];[a0_0x3d4295(0xae)];['reconnectDelay'];[a0_0x3d4295(0x84)];[a0_0x3d4295(0xd1)];[a0_0x3d4295(0xb3)]=!0x1;constructor(_0x33e2b2){const _0xd11eaf=a0_0x3d4295;super();if(this['url']=_0x33e2b2[_0xd11eaf(0x93)][_0xd11eaf(0x7f)](/\/$/,''),this[_0xd11eaf(0x96)]=_0x33e2b2[_0xd11eaf(0x96)],this['token']=_0x33e2b2[_0xd11eaf(0xa3)],this[_0xd11eaf(0xb0)]=_0x33e2b2[_0xd11eaf(0xb0)]||_0xd11eaf(0xad),this[_0xd11eaf(0x89)]='sdk-'+_0x33e2b2[_0xd11eaf(0x96)]+'-'+Date[_0xd11eaf(0xc4)]()[_0xd11eaf(0xbe)](0x24),this[_0xd11eaf(0xae)]=_0x33e2b2['heartbeatInterval']??0x2bf20,this[_0xd11eaf(0xa4)]=_0x33e2b2[_0xd11eaf(0xa4)]??0xbb8,_0x33e2b2['autoConnect']!==!0x1)this[_0xd11eaf(0xbb)]();}[a0_0x3d4295(0x7e)](_0x1ee02d){const _0x4a5865=a0_0x3d4295;console[_0x4a5865(0x7e)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x4a5865(0xaf)+this[_0x4a5865(0x96)]+']\x20'+_0x1ee02d);}async[a0_0x3d4295(0xcc)](_0x411bb9,_0x41b3cc){const _0xf1fd89=a0_0x3d4295;let _0x4ca710={'Content-Type':_0xf1fd89(0x7c),'Accept':_0xf1fd89(0x91)};if(this[_0xf1fd89(0xa3)])_0x4ca710[_0xf1fd89(0x8a)]=_0xf1fd89(0x7b)+this[_0xf1fd89(0xa3)];let _0x2233cb=await(await fetch(this['url']+_0xf1fd89(0xc7),{'method':_0xf1fd89(0xbc),'headers':_0x4ca710,'body':JSON['stringify']({'jsonrpc':_0xf1fd89(0xb8),'id':Date[_0xf1fd89(0xc4)](),'method':'tools/call','params':{'name':_0x411bb9,'arguments':_0x41b3cc}})}))[_0xf1fd89(0xc9)](),_0x305e3c=_0x2233cb[_0xf1fd89(0xbf)](/data: (.+)/),_0x16a575=_0x305e3c?JSON['parse'](_0x305e3c[0x1]):JSON['parse'](_0x2233cb),_0x2d2926=_0x16a575?.['result']?.[_0xf1fd89(0x8e)]?.[0x0]?.[_0xf1fd89(0xc9)];return _0x2d2926?JSON[_0xf1fd89(0x87)](_0x2d2926):_0x16a575;}async['connect'](){const _0x316e05=a0_0x3d4295;if(this[_0x316e05(0xb3)])return;this['running']=!0x0,await this[_0x316e05(0x9a)](_0x316e05(0xa8)),this['log']('registered'),this[_0x316e05(0x84)]=setInterval(()=>{const _0x53de0b=_0x316e05;this[_0x53de0b(0x9a)](_0x53de0b(0xa8))[_0x53de0b(0x83)](_0x3e2b32=>this[_0x53de0b(0x7e)](_0x53de0b(0x81)+_0x3e2b32['message']));},this[_0x316e05(0xae)]),this[_0x316e05(0x85)]();}async[a0_0x3d4295(0xb6)](){const _0x13e44e=a0_0x3d4295;if(this['running']=!0x1,this[_0x13e44e(0xd1)]?.[_0x13e44e(0x80)](),this[_0x13e44e(0x84)])clearInterval(this[_0x13e44e(0x84)]);await this[_0x13e44e(0x9a)](_0x13e44e(0x8d))[_0x13e44e(0x83)](()=>{}),this['log'](_0x13e44e(0x9c));}async[a0_0x3d4295(0xb5)](_0x47ea08,_0x4c0ded,_0x32b82e=a0_0x3d4295(0x97)){const _0x5ddf35=a0_0x3d4295;return this['call'](_0x5ddf35(0xa9),{'alias':_0x47ea08,'task':_0x4c0ded,'priority':_0x32b82e,'from_session':this[_0x5ddf35(0x96)]});}async[a0_0x3d4295(0xa1)](_0x4aff24,_0x4ecfad){const _0x3ceb9e=a0_0x3d4295;return this[_0x3ceb9e(0xcc)](_0x3ceb9e(0x8c),{'alias':_0x4aff24,'message':_0x4ecfad,'from_session':this[_0x3ceb9e(0x96)]});}async['reply'](_0x39b03a,_0x5bb39e,_0x285932=a0_0x3d4295(0xcf)){const _0x5c85b0=a0_0x3d4295;return this[_0x5c85b0(0xcc)](_0x5c85b0(0xc2),{'task_id':_0x39b03a,'text':_0x5bb39e,'status':_0x285932});}async[a0_0x3d4295(0x9a)](_0x3aa0b8,_0x46bb47){const _0x4e2a88=a0_0x3d4295;return this['call']('report_status',{'resume_id':this[_0x4e2a88(0x89)],'alias':this[_0x4e2a88(0x96)],'status':_0x3aa0b8,'server':a0_0x5aec6f(),'hostname':a0_0x5aec6f(),'agent':this['agent'],'project_dir':process[_0x4e2a88(0xb7)](),..._0x46bb47});}async[a0_0x3d4295(0xc5)](){const _0x26d0dc=a0_0x3d4295;return this[_0x26d0dc(0xcc)](_0x26d0dc(0x86),{});}async['broadcast'](_0x4e0469,_0x1722ac){const _0x3cefee=a0_0x3d4295;return this[_0x3cefee(0xcc)]('broadcast',{'message':_0x4e0469,'filter_server':_0x1722ac?.[_0x3cefee(0xa0)],'filter_status':_0x1722ac?.[_0x3cefee(0x9a)]});}async[a0_0x3d4295(0x85)](){const _0x45e75e=a0_0x3d4295;let _0x188ba5=encodeURIComponent(this[_0x45e75e(0x96)]),_0x205128=this['url']+'/events/'+_0x188ba5,_0x25b590=this['reconnectDelay'];while(this['running']){try{this[_0x45e75e(0xd1)]=new AbortController();let _0x79a137={'Accept':_0x45e75e(0xc0)};if(this['token'])_0x79a137[_0x45e75e(0x8a)]=_0x45e75e(0x7b)+this[_0x45e75e(0xa3)];let _0x195d68=await fetch(_0x205128,{'headers':_0x79a137,'signal':this[_0x45e75e(0xd1)][_0x45e75e(0xc3)]});if(!_0x195d68['ok']||!_0x195d68[_0x45e75e(0x9f)]){this['log']('SSE\x20failed:\x20'+_0x195d68[_0x45e75e(0x9a)]),await this[_0x45e75e(0xb2)](_0x25b590),_0x25b590=Math[_0x45e75e(0xa5)](_0x25b590*1.5,0xea60);continue;}_0x25b590=this[_0x45e75e(0xa4)];let _0x52ee33=_0x195d68[_0x45e75e(0x9f)]['getReader'](),_0x4fe34d=new TextDecoder(),_0xc50c6='';while(this[_0x45e75e(0xb3)]){let {done:_0x4eed4b,value:_0x283461}=await _0x52ee33[_0x45e75e(0xb4)]();if(_0x4eed4b)break;_0xc50c6+=_0x4fe34d[_0x45e75e(0x9d)](_0x283461,{'stream':!0x0});let _0x19a6f0=_0xc50c6[_0x45e75e(0xd0)]('\x0a');_0xc50c6=_0x19a6f0['pop']()||'';for(let _0xfdf8a3 of _0x19a6f0){if(!_0xfdf8a3[_0x45e75e(0x99)](_0x45e75e(0xb1)))continue;try{let _0x80d684=JSON[_0x45e75e(0x87)](_0xfdf8a3[_0x45e75e(0x92)](0x6));if(_0x80d684['type']===_0x45e75e(0xb9)){this[_0x45e75e(0x7e)]('SSE\x20connected'),this[_0x45e75e(0x95)](_0x45e75e(0xb9));continue;}if(_0x80d684[_0x45e75e(0x88)]==='new_task'||_0x80d684[_0x45e75e(0x88)]===_0x45e75e(0xc8)||_0x80d684[_0x45e75e(0x88)]==='broadcast')await this[_0x45e75e(0x82)]();}catch{}}}}catch(_0x1ca832){if(_0x1ca832[_0x45e75e(0xc1)]===_0x45e75e(0xa7))break;this[_0x45e75e(0x95)](_0x45e75e(0xcd),_0x1ca832),this[_0x45e75e(0x7e)](_0x45e75e(0xcb)+_0x1ca832[_0x45e75e(0xa1)]);}if(this[_0x45e75e(0xb3)])this[_0x45e75e(0x95)]('disconnected'),this[_0x45e75e(0x7e)](_0x45e75e(0xaa)+_0x25b590/0x3e8+_0x45e75e(0xbd)),await this[_0x45e75e(0xb2)](_0x25b590),_0x25b590=Math[_0x45e75e(0xa5)](_0x25b590*1.5,0xea60);}}async[a0_0x3d4295(0x82)](){const _0x142c4b=a0_0x3d4295;try{let _0x18dc16=(await this[_0x142c4b(0xcc)](_0x142c4b(0xca),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x5352fa of _0x18dc16)await this[_0x142c4b(0xcc)]('ack_inbox',{'alias':this[_0x142c4b(0x96)],'message_id':_0x5352fa['id']}),this[_0x142c4b(0x7e)]('←\x20'+_0x5352fa[_0x142c4b(0x90)]+':\x20'+_0x5352fa[_0x142c4b(0x8e)][_0x142c4b(0x92)](0x0,0x3c)),this[_0x142c4b(0x95)](_0x142c4b(0xba),_0x5352fa),this[_0x142c4b(0x95)](_0x142c4b(0xa1),_0x5352fa);}catch(_0x2b5b6a){this[_0x142c4b(0x7e)](_0x142c4b(0xa2)+_0x2b5b6a['message']);}}[a0_0x3d4295(0xb2)](_0x25dde5){return new Promise(_0x52df1e=>setTimeout(_0x52df1e,_0x25dde5));}}var $=T;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_0x1120da=a0_0x4fb9;(function(_0xce1670,_0x3b0c4c){const _0x5123c6=a0_0x4fb9,_0x1346c4=_0xce1670();while(!![]){try{const _0x55be2d=-parseInt(_0x5123c6(0x1d0))/0x1+parseInt(_0x5123c6(0x1cc))/0x2*(parseInt(_0x5123c6(0x179))/0x3)+parseInt(_0x5123c6(0x1dd))/0x4+-parseInt(_0x5123c6(0x17c))/0x5+parseInt(_0x5123c6(0x174))/0x6+parseInt(_0x5123c6(0x167))/0x7+-parseInt(_0x5123c6(0x18d))/0x8;if(_0x55be2d===_0x3b0c4c)break;else _0x1346c4['push'](_0x1346c4['shift']());}catch(_0x1b07d0){_0x1346c4['push'](_0x1346c4['shift']());}}}(a0_0x2f51,0x6ce2c));import{readFileSync as a0_0x459b8d,existsSync as a0_0x36d345}from'fs';import{join as a0_0x5dd898}from'path';import{hostname as a0_0x4c6c2e}from'os';import{execSync as a0_0xe4fb5d}from'child_process';import{Server as a0_0x2570e2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x59380a}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3e87b5,CallToolRequestSchema as a0_0x32675a}from'@modelcontextprotocol/sdk/types.js';function p(_0x4dd11b){const _0x56da13=a0_0x4fb9;if(!a0_0x36d345(_0x4dd11b))return;for(let _0x54cbf6 of a0_0x459b8d(_0x4dd11b,_0x56da13(0x199))['split']('\x0a')){let _0x5995af=_0x54cbf6[_0x56da13(0x1a4)]();if(!_0x5995af||_0x5995af[_0x56da13(0x171)]('#'))continue;let _0x445ef1=_0x5995af[_0x56da13(0x1cf)]('=');if(_0x445ef1<0x0)continue;let _0x407f46=_0x5995af[_0x56da13(0x1e3)](0x0,_0x445ef1)[_0x56da13(0x1a4)](),_0x42c16b=_0x5995af[_0x56da13(0x1e3)](_0x445ef1+0x1)[_0x56da13(0x1a4)]()[_0x56da13(0x160)](/^["']|["']$/g,'');if(!process.env[_0x407f46])process.env[_0x407f46]=_0x42c16b;}}var C=process.env.HOME||'~',T=a0_0x5dd898(C,a0_0x1120da(0x16b));p(a0_0x5dd898(T,a0_0x1120da(0x164)));var L=process[a0_0x1120da(0x191)]()['replace'](/\//g,'-');p(a0_0x5dd898(T,L,a0_0x1120da(0x164)));function U(){const _0x9ce96f=a0_0x1120da;try{return a0_0xe4fb5d(_0x9ce96f(0x1b5),{'encoding':_0x9ce96f(0x199),'timeout':0x7d0})[_0x9ce96f(0x1a4)]();}catch{return'';}}function c(){const _0x3e09dc=a0_0x1120da;try{let _0x25272a=a0_0x5dd898(C,_0x3e09dc(0x1b8),_0x3e09dc(0x1bb));if(a0_0x36d345(_0x25272a))return JSON[_0x3e09dc(0x17e)](a0_0x459b8d(_0x25272a,'utf-8'));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1120da(0x1d7)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4c6c2e(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1120da(0x1a1)](),X=process.env.COMMHUB_TOKEN||H[a0_0x1120da(0x163)]||'';function Y(_0x8995fe){const _0x222632=a0_0x1120da;let _0x5baaa8=new Date()['toTimeString']()[_0x222632(0x1e3)](0x0,0x8);process[_0x222632(0x182)][_0x222632(0x166)]('['+_0x5baaa8+_0x222632(0x193)+_0x8995fe+'\x0a');}function h(_0x148d5a){return new Promise(_0x48e33c=>setTimeout(_0x48e33c,_0x148d5a));}Y(a0_0x1120da(0x181)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x1120da(0x1e3)](0x0,0x8)+a0_0x1120da(0x165)+(f||a0_0x1120da(0x1b4))+'\x20CWD='+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x2570e2({'name':a0_0x1120da(0x18c),'version':a0_0x1120da(0x1da)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x1120da(0x175),a0_0x1120da(0x1d6),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x1120da(0x183),a0_0x1120da(0x19f)+Z][a0_0x1120da(0x1e0)]('\x0a')});K[a0_0x1120da(0x1cd)](a0_0x3e87b5,async()=>({'tools':[{'name':a0_0x1120da(0x1c4),'description':a0_0x1120da(0x195),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x1120da(0x1a8),'description':a0_0x1120da(0x1b2)},'text':{'type':a0_0x1120da(0x1a8),'description':a0_0x1120da(0x15e)},'status':{'type':a0_0x1120da(0x1a8),'enum':[a0_0x1120da(0x19b),a0_0x1120da(0x1ad),a0_0x1120da(0x176),'blocked',a0_0x1120da(0x1e2),a0_0x1120da(0x15b)],'description':a0_0x1120da(0x1a5)}},'required':['text']}},{'name':a0_0x1120da(0x1d8),'description':a0_0x1120da(0x1c3),'inputSchema':{'type':a0_0x1120da(0x187),'properties':{'status':{'type':a0_0x1120da(0x1a8),'enum':[a0_0x1120da(0x1c6),a0_0x1120da(0x170),a0_0x1120da(0x19a),a0_0x1120da(0x1e2)]},'task':{'type':'string','description':a0_0x1120da(0x1bc)},'progress':{'type':a0_0x1120da(0x1db),'description':a0_0x1120da(0x17f)}},'required':[a0_0x1120da(0x1d5)]}},{'name':a0_0x1120da(0x188),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x1120da(0x1de)},'task':{'type':a0_0x1120da(0x1a8),'description':a0_0x1120da(0x1a9)},'priority':{'type':a0_0x1120da(0x1a8),'enum':[a0_0x1120da(0x1d3),a0_0x1120da(0x1c5),a0_0x1120da(0x16d)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x1120da(0x1b7)]}},{'name':a0_0x1120da(0x16a),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x1120da(0x1a8),'description':a0_0x1120da(0x1de)},'message':{'type':a0_0x1120da(0x1a8),'description':a0_0x1120da(0x159)}},'required':['alias',a0_0x1120da(0x190)]}},{'name':a0_0x1120da(0x16c),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x5680bc,_0x36004c){const _0x165bb6=a0_0x1120da;let _0x5dccc1=await fetch(D+_0x165bb6(0x162),{'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x165bb6(0x1b0)+X}:{}},'body':JSON[_0x165bb6(0x17b)]({'jsonrpc':'2.0','id':0x1,'method':_0x165bb6(0x1cb),'params':{'protocolVersion':_0x165bb6(0x18b),'capabilities':{},'clientInfo':{'name':_0x165bb6(0x18c),'version':_0x165bb6(0x1da)}}})});if(!_0x5dccc1['ok']){let _0xfb3244=await _0x5dccc1[_0x165bb6(0x19e)]();return Y(_0x165bb6(0x17a)+_0x5dccc1['status']+'\x20'+_0xfb3244['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x165bb6(0x1b9)+_0x5dccc1[_0x165bb6(0x1d5)]};}await _0x5dccc1['text']();let _0x52047c=(await(await fetch(D+_0x165bb6(0x162),{'method':'POST','headers':{'Content-Type':_0x165bb6(0x1ab),'Accept':_0x165bb6(0x1ac),...X?{'Authorization':_0x165bb6(0x1b0)+X}:{}},'body':JSON[_0x165bb6(0x17b)]({'jsonrpc':_0x165bb6(0x173),'id':0x2,'method':_0x165bb6(0x185),'params':{'name':_0x5680bc,'arguments':_0x36004c}})}))[_0x165bb6(0x19e)]())[_0x165bb6(0x180)]('\x0a')[_0x165bb6(0x194)](_0x5b9130=>_0x5b9130[_0x165bb6(0x171)](_0x165bb6(0x17d)));if(_0x52047c){let _0x1aaac0=JSON['parse'](_0x52047c['slice'](0x6));return _0x1aaac0?.['result']?.[_0x165bb6(0x169)]?.[0x0]?.[_0x165bb6(0x19e)]?JSON[_0x165bb6(0x17e)](_0x1aaac0['result'][_0x165bb6(0x169)][0x0][_0x165bb6(0x19e)]):_0x1aaac0;}return{'ok':!0x1,'error':_0x165bb6(0x1c2)};}K[a0_0x1120da(0x1cd)](a0_0x32675a,async _0x39d7ab=>{const _0x58078e=a0_0x1120da;let {name:_0x2cbdcc,arguments:_0x345c03}=_0x39d7ab[_0x58078e(0x177)];if(_0x2cbdcc===_0x58078e(0x1c4)){let {task_id:_0x167ebd,text:_0x538ab5,status:_0x40bc46}=_0x345c03;if(_0x40bc46===_0x58078e(0x19b)||_0x40bc46==='failed'||_0x40bc46==='cancelled'){let _0x19b30c=_0x40bc46==='completed'?_0x58078e(0x1b6):_0x40bc46,_0xff36a9=_0x167ebd?k[_0x58078e(0x1d2)](_0x167ebd)||'hub':_0x58078e(0x1d7),_0xc7fbbc=await P(_0x58078e(0x19c),{'alias':_0xff36a9,'text':_0x538ab5,'in_reply_to':_0x167ebd||void 0x0,'status':_0x19b30c,'from_session':Z});if(_0x167ebd)k['delete'](_0x167ebd);return{'content':[{'type':_0x58078e(0x19e),'text':JSON[_0x58078e(0x17b)](_0xc7fbbc)}]};}let _0x239326=await P(_0x58078e(0x1c9),{'resume_id':w,'alias':Z,'status':_0x40bc46==='blocked'?_0x58078e(0x19a):_0x40bc46===_0x58078e(0x1e2)?_0x58078e(0x1e2):_0x58078e(0x1c6),'task':_0x538ab5[_0x58078e(0x1e3)](0x0,0xc8),'output':_0x538ab5});return{'content':[{'type':_0x58078e(0x19e),'text':JSON[_0x58078e(0x17b)](_0x239326)}]};}if(_0x2cbdcc===_0x58078e(0x1d8)){let {status:_0x54d1fd,task:_0x373be8,progress:_0x3b00b5}=_0x345c03,_0x20afcd=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x54d1fd,'task':_0x373be8,'progress':_0x3b00b5});return{'content':[{'type':_0x58078e(0x19e),'text':JSON[_0x58078e(0x17b)](_0x20afcd)}]};}if(_0x2cbdcc===_0x58078e(0x188)){let {alias:_0x50fb18,task:_0x4c7ff6,priority:_0x382784}=_0x345c03,_0x227683=await P('send_task',{'alias':_0x50fb18,'task':_0x4c7ff6,'priority':_0x382784||_0x58078e(0x1c5),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x58078e(0x17b)](_0x227683)}]};}if(_0x2cbdcc==='commhub_send_message'){let {alias:_0x28cb72,message:_0x14b4e4}=_0x345c03,_0x1427e6=await P(_0x58078e(0x1aa),{'alias':_0x28cb72,'message':_0x14b4e4,'from_session':Z});return{'content':[{'type':_0x58078e(0x19e),'text':JSON[_0x58078e(0x17b)](_0x1427e6)}]};}if(_0x2cbdcc==='commhub_get_all_status'){let _0x46641c=await P(_0x58078e(0x189),{});return{'content':[{'type':_0x58078e(0x19e),'text':JSON[_0x58078e(0x17b)](_0x46641c)}]};}return{'content':[{'type':'text','text':JSON[_0x58078e(0x17b)]({'error':_0x58078e(0x1c7)})}]};});async function v(){const _0x3dc7bc=a0_0x1120da;let _0x24fc9=D+_0x3dc7bc(0x1b1)+encodeURIComponent(Z),_0x96bc68={};if(X)_0x96bc68['Authorization']=_0x3dc7bc(0x1b0)+X;Y(_0x3dc7bc(0x1be)+_0x24fc9);while(!0x0){try{let _0x34d41e=await fetch(_0x24fc9,{'headers':_0x96bc68});if(!_0x34d41e['ok']){Y(_0x3dc7bc(0x1ae)+_0x34d41e[_0x3dc7bc(0x1d5)]+'\x20'+_0x34d41e[_0x3dc7bc(0x1d9)]),await h(0x1388);continue;}let _0x4cd8c7=_0x34d41e[_0x3dc7bc(0x15c)][_0x3dc7bc(0x1d4)](),_0x53d11a=new TextDecoder(),_0x1fa201='';while(!0x0){let {done:_0x3fa8fa,value:_0x1e5e14}=await _0x4cd8c7[_0x3dc7bc(0x1a7)]();if(_0x3fa8fa)break;_0x1fa201+=_0x53d11a[_0x3dc7bc(0x15a)](_0x1e5e14,{'stream':!0x0});let _0x34e62c=_0x1fa201['split']('\x0a\x0a');_0x1fa201=_0x34e62c[_0x3dc7bc(0x196)]()||'';for(let _0x58359f of _0x34e62c){let _0x40ac1c=_0x58359f[_0x3dc7bc(0x180)]('\x0a')[_0x3dc7bc(0x194)](_0xdd77ff=>_0xdd77ff[_0x3dc7bc(0x171)](_0x3dc7bc(0x17d)));if(!_0x40ac1c)continue;try{let _0x55b40c=JSON['parse'](_0x40ac1c[_0x3dc7bc(0x1e3)](0x6));await u(_0x55b40c);}catch(_0x153902){Y(_0x3dc7bc(0x18e)+_0x153902);}}}Y(_0x3dc7bc(0x1a2));}catch(_0x4e5d4d){Y('SSE\x20connection\x20error:\x20'+_0x4e5d4d);}await h(0xbb8);}}async function u(_0x268164){const _0x52d337=a0_0x1120da;if(_0x268164[_0x52d337(0x1e1)]===_0x52d337(0x1dc)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x268164['type']==='new_message'){if(Y(_0x52d337(0x1af)+_0x268164[_0x52d337(0x178)]+':\x20'+_0x268164[_0x52d337(0x190)][_0x52d337(0x1e3)](0x0,0x3c)),await K[_0x52d337(0x1a6)]({'method':_0x52d337(0x1d1),'params':{'content':_0x268164['message'],'meta':{'sender':_0x268164[_0x52d337(0x178)]||'hub','sender_id':_0x52d337(0x1b3),'user':_0x268164[_0x52d337(0x178)]||_0x52d337(0x1d7),'priority':_0x52d337(0x1c5)}}}),_0x268164['message_id'])await P(_0x52d337(0x172),{'alias':Z,'message_id':_0x268164[_0x52d337(0x192)]});return;}if(_0x268164[_0x52d337(0x1e1)]===_0x52d337(0x197)||_0x268164[_0x52d337(0x1e1)]===_0x52d337(0x1c0)){Y('←\x20'+_0x268164[_0x52d337(0x1e1)]+_0x52d337(0x1ba)+_0x268164[_0x52d337(0x15f)]+'\x20priority='+(_0x268164[_0x52d337(0x18f)]||'normal'));let _0xd77c4a=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0xd77c4a?.['ok']&&_0xd77c4a['messages']?.[_0x52d337(0x1e4)]>0x0)for(let _0x49f3af of _0xd77c4a[_0x52d337(0x15d)]){let _0x40361f={'sender':_0x49f3af[_0x52d337(0x19d)]||_0x52d337(0x1d7),'sender_id':_0x52d337(0x1b3),'user':_0x49f3af[_0x52d337(0x19d)]||_0x52d337(0x1d7),'task_id':_0x49f3af['id'],'priority':_0x49f3af['priority']||_0x52d337(0x1c5)};k['set'](_0x49f3af['id'],_0x49f3af[_0x52d337(0x19d)]||_0x52d337(0x1d7)),await K['notification']({'method':_0x52d337(0x1d1),'params':{'content':_0x49f3af[_0x52d337(0x169)],'meta':_0x40361f}}),Y('→\x20injected\x20task\x20'+_0x49f3af['id'][_0x52d337(0x1e3)](0x0,0x8)+_0x52d337(0x186)+_0x49f3af['from_session']+':\x20'+_0x49f3af['content']['slice'](0x0,0x3c)),await P(_0x52d337(0x172),{'alias':Z,'message_id':_0x49f3af['id']});}}}function a0_0x4fb9(_0xb3eec0,_0x13abe8){_0xb3eec0=_0xb3eec0-0x159;const _0x2f51ad=a0_0x2f51();let _0x4fb9a3=_0x2f51ad[_0xb3eec0];return _0x4fb9a3;}async function S(){const _0x3c72ed=a0_0x1120da;let _0x141955=new a0_0x59380a();await K[_0x3c72ed(0x18a)](_0x141955),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),v()['catch'](_0x34f449=>Y(_0x3c72ed(0x16e)+_0x34f449)),P(_0x3c72ed(0x1c9),{'resume_id':w,'alias':Z,'status':_0x3c72ed(0x170),'server':a0_0x4c6c2e(),'hostname':a0_0x4c6c2e(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x3c72ed(0x1c1)](()=>Y('registered\x20as\x20\x22'+Z+_0x3c72ed(0x161)+w[_0x3c72ed(0x1e3)](0x0,0x8)+')'))['catch'](_0x2d33a5=>Y(_0x3c72ed(0x1df)+_0x2d33a5)),setInterval(()=>{const _0x28d4d2=_0x3c72ed;P('report_status',{'resume_id':w,'alias':Z,'status':_0x28d4d2(0x170),'server':a0_0x4c6c2e(),'hostname':a0_0x4c6c2e(),'agent':'claude-code','project_dir':process[_0x28d4d2(0x191)](),'tmux_name':f||void 0x0})['catch'](_0x16d6c4=>Y(_0x28d4d2(0x1a0)+_0x16d6c4));},0x2bf20),Y(_0x3c72ed(0x1a3));}function a0_0x2f51(){const _0x8e2e47=['high','getReader','status','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','hub','commhub_report_status','statusText','0.3.0','number','connected','1925344NqNdjp','Target\x20session\x20alias','warning:\x20could\x20not\x20register:\x20','join','type','error','slice','length','Message\x20content','decode','in_progress','body','messages','Reply\x20text\x20/\x20result\x20summary','inbox_count','replace','\x22\x20(','/mcp','token','.env','...\x20TMUX=','write','4467064AhslZr','catch','content','commhub_send_message','.claude/channels/commhub','commhub_get_all_status','low','SSE\x20fatal:\x20','SIGTERM','idle','startsWith','ack_inbox','2.0','4393260IVSTVy','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','cancelled','params','from','9SjkVmp','CommHub\x20init\x20failed:\x20','stringify','4285565Znvoru','data:\x20','parse','Progress\x200-100','split','ENV:\x20URL=','stderr','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','shutting\x20down,\x20reporting\x20offline...','tools/call','\x20from\x20','object','commhub_send_task','get_all_status','connect','2025-03-26','commhub-channel','915160OHGRXR','parse\x20error:\x20','priority','message','cwd','message_id',']\x20[commhub]\x20','find','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','pop','new_task','exit','utf-8','blocked','completed','send_reply','from_session','text','Session\x20alias:\x20','heartbeat\x20failed:\x20','randomUUID','SSE\x20stream\x20ended,\x20reconnecting...','ready\x20—\x20waiting\x20for\x20events','trim','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','notification','read','string','Task\x20content','send_message','application/json','application/json,\x20text/event-stream','failed','SSE\x20error:\x20','←\x20message\x20from\x20','Bearer\x20','/events/','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub','none','tmux\x20display-message\x20-p\x20\x27#S\x27','replied','task','.anet','init\x20failed:\x20',':\x20inbox_count=','config.json','Current\x20task\x20description','end','connecting\x20to\x20','SIGINT','broadcast','then','no\x20response','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','commhub_reply','normal','working','unknown\x20tool','fatal:\x20','report_status','session\x20disconnected','initialize','236124nGjXLD','setRequestHandler','stdin','indexOf','788380rBRfvJ','notifications/claude/channel','get'];a0_0x2f51=function(){return _0x8e2e47;};return a0_0x2f51();}S()[a0_0x1120da(0x168)](_0x58c2ed=>{const _0x5675b0=a0_0x1120da;Y(_0x5675b0(0x1c8)+_0x58c2ed),process[_0x5675b0(0x198)](0x1);});async function N(){const _0x3e6210=a0_0x1120da;Y(_0x3e6210(0x184)),await P(_0x3e6210(0x1c9),{'resume_id':w,'alias':Z,'status':_0x3e6210(0x1e2),'task':_0x3e6210(0x1ca)})['catch'](()=>{}),process[_0x3e6210(0x198)](0x0);}process[a0_0x1120da(0x1ce)]['on'](a0_0x1120da(0x1bd),()=>N()),process['on'](a0_0x1120da(0x16f),()=>N()),process['on'](a0_0x1120da(0x1bf),()=>N());
|
|
2
|
+
const a0_0x40110b=a0_0x329f;(function(_0x57be90,_0x378ccb){const _0x26bf78=a0_0x329f,_0x41c418=_0x57be90();while(!![]){try{const _0x7a745d=-parseInt(_0x26bf78(0xe0))/0x1+parseInt(_0x26bf78(0xa5))/0x2+parseInt(_0x26bf78(0x8b))/0x3*(parseInt(_0x26bf78(0x105))/0x4)+parseInt(_0x26bf78(0xbd))/0x5*(-parseInt(_0x26bf78(0xad))/0x6)+parseInt(_0x26bf78(0x90))/0x7*(-parseInt(_0x26bf78(0x10d))/0x8)+-parseInt(_0x26bf78(0x100))/0x9+parseInt(_0x26bf78(0xa0))/0xa*(parseInt(_0x26bf78(0xff))/0xb);if(_0x7a745d===_0x378ccb)break;else _0x41c418['push'](_0x41c418['shift']());}catch(_0x1f5485){_0x41c418['push'](_0x41c418['shift']());}}}(a0_0x169f,0xf4110));import{readFileSync as a0_0x138df9,existsSync as a0_0x2730fe}from'fs';import{join as a0_0x25d793}from'path';import{hostname as a0_0x159f86}from'os';import{execSync as a0_0x21d53c}from'child_process';import{Server as a0_0x55a0cd}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x151235}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xd0934e,CallToolRequestSchema as a0_0x3ce375}from'@modelcontextprotocol/sdk/types.js';function p(_0x2b12af){const _0x4085d6=a0_0x329f;if(!a0_0x2730fe(_0x2b12af))return;for(let _0x44dcfd of a0_0x138df9(_0x2b12af,'utf-8')['split']('\x0a')){let _0x5e3e09=_0x44dcfd['trim']();if(!_0x5e3e09||_0x5e3e09[_0x4085d6(0x10c)]('#'))continue;let _0x3c3706=_0x5e3e09[_0x4085d6(0xa4)]('=');if(_0x3c3706<0x0)continue;let _0x115dce=_0x5e3e09['slice'](0x0,_0x3c3706)['trim'](),_0x3acbc9=_0x5e3e09[_0x4085d6(0xa9)](_0x3c3706+0x1)[_0x4085d6(0xca)]()[_0x4085d6(0xa3)](/^["']|["']$/g,'');if(!process.env[_0x115dce])process.env[_0x115dce]=_0x3acbc9;}}var C=process.env.HOME||'~',T=a0_0x25d793(C,'.claude/channels/commhub');p(a0_0x25d793(T,'.env'));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x25d793(T,L,a0_0x40110b(0xee)));function U(){const _0x441461=a0_0x40110b;try{return a0_0x21d53c(_0x441461(0xf2),{'encoding':'utf-8','timeout':0x7d0})[_0x441461(0xca)]();}catch{return'';}}function c(){const _0x3fa979=a0_0x40110b;try{let _0x303d05=a0_0x25d793(C,'.anet',_0x3fa979(0xba));if(a0_0x2730fe(_0x303d05))return JSON[_0x3fa979(0xb7)](a0_0x138df9(_0x303d05,_0x3fa979(0xfd)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x40110b(0x9c)]||a0_0x40110b(0x116),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x159f86(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x40110b(0xbe)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x3634fa){const _0x1663dd=a0_0x40110b;let _0x11f768=new Date()[_0x1663dd(0x115)]()[_0x1663dd(0xa9)](0x0,0x8);process[_0x1663dd(0xd7)]['write']('['+_0x11f768+_0x1663dd(0x9d)+_0x3634fa+'\x0a');}function h(_0x29ab14){return new Promise(_0x53b572=>setTimeout(_0x53b572,_0x29ab14));}Y(a0_0x40110b(0xfb)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x40110b(0xa9)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x40110b(0xdd))+a0_0x40110b(0xeb)+process[a0_0x40110b(0x91)]()+a0_0x40110b(0xea)+L);var k=new Map(),K=new a0_0x55a0cd({'name':a0_0x40110b(0xc0),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x40110b(0x114),a0_0x40110b(0xe3),a0_0x40110b(0xc2),a0_0x40110b(0xe2),a0_0x40110b(0xce)+Z][a0_0x40110b(0xf3)]('\x0a')});function a0_0x169f(){const _0x98a070=['120qpvkKa','split','commhub_send_message','from_session','ack_inbox','28FBPxvj','cwd','new_task','commhub','Progress\x200-100','/events/','normal','set','tools/call','params','commhub_report_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','hub',']\x20[commhub]\x20','→\x20injected\x20task\x20','alias','1017890RQeTUc','SSE\x20error:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','replace','indexOf','3874376AfwUOt','session\x20disconnected','object','connecting\x20to\x20','slice','idle','failed','then','6cYzlHh','blocked','stringify','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','error','completed','exit','connect','message','setRequestHandler','parse','application/json','inbox_count','config.json','CommHub\x20init\x20failed:\x20','initialize','1415105sHzpef','randomUUID','send_task','commhub-channel','number','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','high','commhub_get_all_status','connected','POST','←\x20message\x20from\x20','message_id','unknown\x20tool','trim','SIGTERM','report_status','get','Session\x20alias:\x20','string','data:\x20','notification','replied','stdin','claude-code','Bearer\x20','status','stderr','delete','text','fatal:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Task\x20content','none','length','catch','1736362gJUfEg','content','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Target\x20session\x20alias','decode','commhub_reply','parse\x20error:\x20','MCP\x20stdio\x20connected','2025-03-26','\x20PROJECT_ENV=','\x20CWD=','getReader','SSE\x20connected\x20as\x20\x22','.env','\x20priority=','starting\x20SSE\x20listener...','new_message','tmux\x20display-message\x20-p\x20\x27#S\x27','join','from','messages',':\x20inbox_count=','2.0','commhub_send_task','statusText','Reply\x20text\x20/\x20result\x20summary','ENV:\x20URL=','working','utf-8','get_all_status','143OqBARp','5467050zwsMhK','SSE\x20connection\x20error:\x20','application/json,\x20text/event-stream','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','broadcast','116128KVKvKF','shutting\x20down,\x20reporting\x20offline...','pop','Current\x20task\x20description','no\x20response','cancelled','notifications/claude/channel','startsWith','1590392SVoezl','priority','find','read','SIGINT','type','warning:\x20could\x20not\x20register:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','toTimeString','http://127.0.0.1:9200','\x22\x20(','/mcp'];a0_0x169f=function(){return _0x98a070;};return a0_0x169f();}K[a0_0x40110b(0xb6)](a0_0xd0934e,async()=>({'tools':[{'name':a0_0x40110b(0xe6),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'task_id':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xa2)},'text':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xfa)},'status':{'type':a0_0x40110b(0xcf),'enum':[a0_0x40110b(0xb2),a0_0x40110b(0xab),a0_0x40110b(0x10a),a0_0x40110b(0xae),a0_0x40110b(0xb1),'in_progress'],'description':a0_0x40110b(0x103)}},'required':[a0_0x40110b(0xd9)]}},{'name':'commhub_report_status','description':a0_0x40110b(0xdb),'inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'status':{'type':'string','enum':['working',a0_0x40110b(0xaa),a0_0x40110b(0xae),a0_0x40110b(0xb1)]},'task':{'type':'string','description':a0_0x40110b(0x108)},'progress':{'type':a0_0x40110b(0xc1),'description':a0_0x40110b(0x94)}},'required':[a0_0x40110b(0xd6)]}},{'name':'commhub_send_task','description':a0_0x40110b(0xb0),'inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'alias':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xe4)},'task':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xdc)},'priority':{'type':a0_0x40110b(0xcf),'enum':[a0_0x40110b(0xc3),a0_0x40110b(0x96),'low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x40110b(0x9f),'task']}},{'name':a0_0x40110b(0x8d),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'alias':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xe4)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x40110b(0x9f),'message']}},{'name':a0_0x40110b(0xc4),'description':a0_0x40110b(0x9b),'inputSchema':{'type':a0_0x40110b(0xa7),'properties':{}}}]}));async function P(_0x5a0747,_0x5e851c){const _0x1f0efa=a0_0x40110b;let _0x5b56d6=await fetch(D+_0x1f0efa(0x8a),{'method':_0x1f0efa(0xc6),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x1f0efa(0xd5)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1f0efa(0xf7),'id':0x1,'method':_0x1f0efa(0xbc),'params':{'protocolVersion':_0x1f0efa(0xe9),'capabilities':{},'clientInfo':{'name':_0x1f0efa(0xc0),'version':'0.3.0'}}})});if(!_0x5b56d6['ok']){let _0x1e40cd=await _0x5b56d6['text']();return Y(_0x1f0efa(0xbb)+_0x5b56d6[_0x1f0efa(0xd6)]+'\x20'+_0x1e40cd[_0x1f0efa(0xa9)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x5b56d6[_0x1f0efa(0xd6)]};}await _0x5b56d6[_0x1f0efa(0xd9)]();let _0x152218=(await(await fetch(D+'/mcp',{'method':_0x1f0efa(0xc6),'headers':{'Content-Type':_0x1f0efa(0xb8),'Accept':_0x1f0efa(0x102),...X?{'Authorization':_0x1f0efa(0xd5)+X}:{}},'body':JSON[_0x1f0efa(0xaf)]({'jsonrpc':_0x1f0efa(0xf7),'id':0x2,'method':_0x1f0efa(0x98),'params':{'name':_0x5a0747,'arguments':_0x5e851c}})}))[_0x1f0efa(0xd9)]())[_0x1f0efa(0x8c)]('\x0a')[_0x1f0efa(0x10f)](_0x29df4b=>_0x29df4b['startsWith'](_0x1f0efa(0xd0)));if(_0x152218){let _0x110b01=JSON[_0x1f0efa(0xb7)](_0x152218[_0x1f0efa(0xa9)](0x6));return _0x110b01?.['result']?.[_0x1f0efa(0xe1)]?.[0x0]?.['text']?JSON[_0x1f0efa(0xb7)](_0x110b01['result']['content'][0x0]['text']):_0x110b01;}return{'ok':!0x1,'error':_0x1f0efa(0x109)};}K[a0_0x40110b(0xb6)](a0_0x3ce375,async _0x7c88fd=>{const _0xb6fd8b=a0_0x40110b;let {name:_0x3cc211,arguments:_0x559c05}=_0x7c88fd[_0xb6fd8b(0x99)];if(_0x3cc211===_0xb6fd8b(0xe6)){let {task_id:_0x46f7bc,text:_0x176a61,status:_0x391ce2}=_0x559c05;if(_0x391ce2==='completed'||_0x391ce2===_0xb6fd8b(0xab)||_0x391ce2==='cancelled'){let _0x46fda5=_0x391ce2===_0xb6fd8b(0xb2)?_0xb6fd8b(0xd2):_0x391ce2,_0x477bac=_0x46f7bc?k[_0xb6fd8b(0xcd)](_0x46f7bc)||_0xb6fd8b(0x9c):_0xb6fd8b(0x9c),_0x4cbabc=await P('send_reply',{'alias':_0x477bac,'text':_0x176a61,'in_reply_to':_0x46f7bc||void 0x0,'status':_0x46fda5,'from_session':Z});if(_0x46f7bc)k[_0xb6fd8b(0xd8)](_0x46f7bc);return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON[_0xb6fd8b(0xaf)](_0x4cbabc)}]};}let _0xbbaf3b=await P(_0xb6fd8b(0xcc),{'resume_id':w,'alias':Z,'status':_0x391ce2===_0xb6fd8b(0xae)?_0xb6fd8b(0xae):_0x391ce2===_0xb6fd8b(0xb1)?_0xb6fd8b(0xb1):_0xb6fd8b(0xfc),'task':_0x176a61[_0xb6fd8b(0xa9)](0x0,0xc8),'output':_0x176a61});return{'content':[{'type':'text','text':JSON[_0xb6fd8b(0xaf)](_0xbbaf3b)}]};}if(_0x3cc211===_0xb6fd8b(0x9a)){let {status:_0x17dac7,task:_0x433d7d,progress:_0x11c783}=_0x559c05,_0x16abde=await P(_0xb6fd8b(0xcc),{'resume_id':w,'alias':Z,'status':_0x17dac7,'task':_0x433d7d,'progress':_0x11c783});return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON[_0xb6fd8b(0xaf)](_0x16abde)}]};}if(_0x3cc211===_0xb6fd8b(0xf8)){let {alias:_0x123f28,task:_0x1ae5ab,priority:_0x1b8537}=_0x559c05,_0x18086f=await P(_0xb6fd8b(0xbf),{'alias':_0x123f28,'task':_0x1ae5ab,'priority':_0x1b8537||_0xb6fd8b(0x96),'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x18086f)}]};}if(_0x3cc211===_0xb6fd8b(0x8d)){let {alias:_0x19c66f,message:_0x5b43a4}=_0x559c05,_0x6bea33=await P('send_message',{'alias':_0x19c66f,'message':_0x5b43a4,'from_session':Z});return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON['stringify'](_0x6bea33)}]};}if(_0x3cc211==='commhub_get_all_status'){let _0x10c466=await P(_0xb6fd8b(0xfe),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x10c466)}]};}return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON['stringify']({'error':_0xb6fd8b(0xc9)})}]};});async function v(){const _0x59b925=a0_0x40110b;let _0x5c5d55=D+_0x59b925(0x95)+encodeURIComponent(Z),_0x1c49b={};if(X)_0x1c49b['Authorization']=_0x59b925(0xd5)+X;Y(_0x59b925(0xa8)+_0x5c5d55);while(!0x0){try{let _0x30d49a=await fetch(_0x5c5d55,{'headers':_0x1c49b});if(!_0x30d49a['ok']){Y(_0x59b925(0xa1)+_0x30d49a['status']+'\x20'+_0x30d49a[_0x59b925(0xf9)]),await h(0x1388);continue;}let _0xf9ad4a=_0x30d49a['body'][_0x59b925(0xec)](),_0x1d0877=new TextDecoder(),_0x31a854='';while(!0x0){let {done:_0x488c13,value:_0x3a9283}=await _0xf9ad4a[_0x59b925(0x110)]();if(_0x488c13)break;_0x31a854+=_0x1d0877[_0x59b925(0xe5)](_0x3a9283,{'stream':!0x0});let _0x456a79=_0x31a854[_0x59b925(0x8c)]('\x0a\x0a');_0x31a854=_0x456a79[_0x59b925(0x107)]()||'';for(let _0x5efdcf of _0x456a79){let _0x117e77=_0x5efdcf['split']('\x0a')[_0x59b925(0x10f)](_0x12609c=>_0x12609c[_0x59b925(0x10c)]('data:\x20'));if(!_0x117e77)continue;try{let _0x199dad=JSON[_0x59b925(0xb7)](_0x117e77[_0x59b925(0xa9)](0x6));await u(_0x199dad);}catch(_0x21696){Y(_0x59b925(0xe7)+_0x21696);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4c49ad){Y(_0x59b925(0x101)+_0x4c49ad);}await h(0xbb8);}}async function u(_0x395bbe){const _0x4bb643=a0_0x40110b;if(_0x395bbe[_0x4bb643(0x112)]===_0x4bb643(0xc5)){Y(_0x4bb643(0xed)+Z+'\x22');return;}if(_0x395bbe[_0x4bb643(0x112)]===_0x4bb643(0xf1)){if(Y(_0x4bb643(0xc7)+_0x395bbe[_0x4bb643(0xf4)]+':\x20'+_0x395bbe['message'][_0x4bb643(0xa9)](0x0,0x3c)),await K[_0x4bb643(0xd1)]({'method':_0x4bb643(0x10b),'params':{'content':_0x395bbe[_0x4bb643(0xb5)],'meta':{'sender':_0x395bbe[_0x4bb643(0xf4)]||_0x4bb643(0x9c),'sender_id':_0x4bb643(0x93),'user':_0x395bbe[_0x4bb643(0xf4)]||_0x4bb643(0x9c),'priority':_0x4bb643(0x96)}}}),_0x395bbe[_0x4bb643(0xc8)])await P(_0x4bb643(0x8f),{'alias':Z,'message_id':_0x395bbe[_0x4bb643(0xc8)]});return;}if(_0x395bbe[_0x4bb643(0x112)]===_0x4bb643(0x92)||_0x395bbe['type']===_0x4bb643(0x104)){Y('←\x20'+_0x395bbe[_0x4bb643(0x112)]+_0x4bb643(0xf6)+_0x395bbe[_0x4bb643(0xb9)]+_0x4bb643(0xef)+(_0x395bbe[_0x4bb643(0x10e)]||_0x4bb643(0x96)));let _0x43cb9e=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x43cb9e?.['ok']&&_0x43cb9e[_0x4bb643(0xf5)]?.[_0x4bb643(0xde)]>0x0)for(let _0x426af7 of _0x43cb9e['messages']){let _0x468090={'sender':_0x426af7[_0x4bb643(0x8e)]||_0x4bb643(0x9c),'sender_id':_0x4bb643(0x93),'user':_0x426af7[_0x4bb643(0x8e)]||_0x4bb643(0x9c),'task_id':_0x426af7['id'],'priority':_0x426af7['priority']||_0x4bb643(0x96)};k[_0x4bb643(0x97)](_0x426af7['id'],_0x426af7[_0x4bb643(0x8e)]||_0x4bb643(0x9c)),await K[_0x4bb643(0xd1)]({'method':_0x4bb643(0x10b),'params':{'content':_0x426af7[_0x4bb643(0xe1)],'meta':_0x468090}}),Y(_0x4bb643(0x9e)+_0x426af7['id'][_0x4bb643(0xa9)](0x0,0x8)+'\x20from\x20'+_0x426af7['from_session']+':\x20'+_0x426af7[_0x4bb643(0xe1)][_0x4bb643(0xa9)](0x0,0x3c)),await P(_0x4bb643(0x8f),{'alias':Z,'message_id':_0x426af7['id']});}}}async function S(){const _0xa6d671=a0_0x40110b;let _0x1cbc4d=new a0_0x151235();await K[_0xa6d671(0xb4)](_0x1cbc4d),Y(_0xa6d671(0xe8)),Y(_0xa6d671(0xf0)),v()[_0xa6d671(0xdf)](_0x3d74a6=>Y('SSE\x20fatal:\x20'+_0x3d74a6)),P(_0xa6d671(0xcc),{'resume_id':w,'alias':Z,'status':_0xa6d671(0xaa),'server':a0_0x159f86(),'hostname':a0_0x159f86(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0xa6d671(0xac)](()=>Y('registered\x20as\x20\x22'+Z+_0xa6d671(0x89)+w['slice'](0x0,0x8)+')'))[_0xa6d671(0xdf)](_0x20c186=>Y(_0xa6d671(0x113)+_0x20c186)),setInterval(()=>{const _0x1c0484=_0xa6d671;P(_0x1c0484(0xcc),{'resume_id':w,'alias':Z,'status':_0x1c0484(0xaa),'server':a0_0x159f86(),'hostname':a0_0x159f86(),'agent':_0x1c0484(0xd4),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x1c0484(0xdf)](_0xedc003=>Y('heartbeat\x20failed:\x20'+_0xedc003));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x40110b(0xdf)](_0x318c79=>{const _0x479e7b=a0_0x40110b;Y(_0x479e7b(0xda)+_0x318c79),process[_0x479e7b(0xb3)](0x1);});function a0_0x329f(_0x6ea8ae,_0x2ec823){_0x6ea8ae=_0x6ea8ae-0x89;const _0x169f94=a0_0x169f();let _0x329f41=_0x169f94[_0x6ea8ae];return _0x329f41;}async function N(){const _0x122551=a0_0x40110b;Y(_0x122551(0x106)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x122551(0xb1),'task':_0x122551(0xa6)})['catch'](()=>{}),process[_0x122551(0xb3)](0x0);}process[a0_0x40110b(0xd3)]['on']('end',()=>N()),process['on'](a0_0x40110b(0xcb),()=>N()),process['on'](a0_0x40110b(0x111),()=>N());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
4
|
-
"description": "AI Agent Network
|
|
3
|
+
"version": "2.0.0-preview.24",
|
|
4
|
+
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 34 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -31,12 +31,13 @@
|
|
|
31
31
|
"mcp",
|
|
32
32
|
"sse",
|
|
33
33
|
"claude",
|
|
34
|
+
"codex",
|
|
34
35
|
"openai",
|
|
35
36
|
"minimax",
|
|
36
37
|
"orchestration",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"multi-agent",
|
|
39
|
+
"cli",
|
|
40
|
+
"anet"
|
|
40
41
|
],
|
|
41
42
|
"author": "sleep2agi",
|
|
42
43
|
"license": "MIT",
|
|
@@ -57,4 +58,4 @@
|
|
|
57
58
|
"node-pty": "^1.1.0",
|
|
58
59
|
"typescript": "^5.0.0"
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
+
}
|