@sleep2agi/agent-network 2.0.0-preview.23 → 2.0.0-preview.25
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_0x1a26ba=a0_0x5850;(function(_0x4c0c1d,_0x1ec7d6){const _0x5a7f9f=a0_0x5850,_0x1756a3=_0x4c0c1d();while(!![]){try{const _0x77c333=-parseInt(_0x5a7f9f(0x1e0))/0x1*(parseInt(_0x5a7f9f(0x1d1))/0x2)+-parseInt(_0x5a7f9f(0x1d8))/0x3+-parseInt(_0x5a7f9f(0x20b))/0x4+-parseInt(_0x5a7f9f(0x1ef))/0x5+-parseInt(_0x5a7f9f(0x1e8))/0x6+parseInt(_0x5a7f9f(0x21a))/0x7*(-parseInt(_0x5a7f9f(0x1e3))/0x8)+-parseInt(_0x5a7f9f(0x203))/0x9*(-parseInt(_0x5a7f9f(0x1cd))/0xa);if(_0x77c333===_0x1ec7d6)break;else _0x1756a3['push'](_0x1756a3['shift']());}catch(_0x3eeb02){_0x1756a3['push'](_0x1756a3['shift']());}}}(a0_0x1904,0x40b24));import{EventEmitter as a0_0x36b051}from'events';import{hostname as a0_0x1892c4}from'os';class T extends a0_0x36b051{[a0_0x1a26ba(0x1fe)];[a0_0x1a26ba(0x1d6)];[a0_0x1a26ba(0x216)];[a0_0x1a26ba(0x210)];[a0_0x1a26ba(0x1e5)];[a0_0x1a26ba(0x1f8)];[a0_0x1a26ba(0x1d5)];['heartbeatTimer'];[a0_0x1a26ba(0x1ca)];['running']=!0x1;constructor(_0x5f023d){const _0x308d5f=a0_0x1a26ba;super();if(this[_0x308d5f(0x1fe)]=_0x5f023d['url'][_0x308d5f(0x1eb)](/\/$/,''),this['alias']=_0x5f023d['alias'],this[_0x308d5f(0x216)]=_0x5f023d[_0x308d5f(0x216)],this[_0x308d5f(0x210)]=_0x5f023d[_0x308d5f(0x210)]||_0x308d5f(0x1ec),this[_0x308d5f(0x1e5)]=_0x308d5f(0x21e)+_0x5f023d[_0x308d5f(0x1d6)]+'-'+Date[_0x308d5f(0x1fb)]()[_0x308d5f(0x1ff)](0x24),this[_0x308d5f(0x1f8)]=_0x5f023d['heartbeatInterval']??0x2bf20,this[_0x308d5f(0x1d5)]=_0x5f023d[_0x308d5f(0x1d5)]??0xbb8,_0x5f023d[_0x308d5f(0x1d7)]!==!0x1)this[_0x308d5f(0x20e)]();}['log'](_0x24ffe1){const _0x73f2e4=a0_0x1a26ba;console[_0x73f2e4(0x1e4)]('['+new Date()[_0x73f2e4(0x20c)]()[_0x73f2e4(0x1f3)](0x0,0x8)+_0x73f2e4(0x1e2)+this[_0x73f2e4(0x1d6)]+']\x20'+_0x24ffe1);}async[a0_0x1a26ba(0x221)](_0x36c885,_0x37dcba){const _0x269f40=a0_0x1a26ba;let _0x460006={'Content-Type':_0x269f40(0x1e9),'Accept':_0x269f40(0x1f6)};if(this[_0x269f40(0x216)])_0x460006['Authorization']=_0x269f40(0x208)+this[_0x269f40(0x216)];let _0x2acd87=await(await fetch(this[_0x269f40(0x1fe)]+_0x269f40(0x20d),{'method':_0x269f40(0x202),'headers':_0x460006,'body':JSON[_0x269f40(0x1de)]({'jsonrpc':_0x269f40(0x1f9),'id':Date[_0x269f40(0x1fb)](),'method':'tools/call','params':{'name':_0x36c885,'arguments':_0x37dcba}})}))['text'](),_0x1572b4=_0x2acd87['match'](/data: (.+)/),_0x38c197=_0x1572b4?JSON['parse'](_0x1572b4[0x1]):JSON[_0x269f40(0x21d)](_0x2acd87),_0x7d00c8=_0x38c197?.[_0x269f40(0x1fc)]?.[_0x269f40(0x21b)]?.[0x0]?.[_0x269f40(0x213)];return _0x7d00c8?JSON['parse'](_0x7d00c8):_0x38c197;}async[a0_0x1a26ba(0x20e)](){const _0xbfd54e=a0_0x1a26ba;if(this['running'])return;this['running']=!0x0,await this[_0xbfd54e(0x1f5)]('idle'),this[_0xbfd54e(0x1e4)]('registered'),this[_0xbfd54e(0x204)]=setInterval(()=>{const _0x4c32ff=_0xbfd54e;this[_0x4c32ff(0x1f5)](_0x4c32ff(0x201))['catch'](_0x11b68c=>this[_0x4c32ff(0x1e4)](_0x4c32ff(0x209)+_0x11b68c['message']));},this[_0xbfd54e(0x1f8)]),this[_0xbfd54e(0x1dc)]();}async['disconnect'](){const _0x4460e0=a0_0x1a26ba;if(this[_0x4460e0(0x215)]=!0x1,this['sseAbort']?.['abort'](),this[_0x4460e0(0x204)])clearInterval(this[_0x4460e0(0x204)]);await this[_0x4460e0(0x1f5)]('offline')['catch'](()=>{}),this[_0x4460e0(0x1e4)](_0x4460e0(0x1ce));}async[a0_0x1a26ba(0x1f1)](_0x3bdd86,_0x573c34,_0x4dda2a=a0_0x1a26ba(0x1cc)){const _0x47e2e9=a0_0x1a26ba;return this[_0x47e2e9(0x221)](_0x47e2e9(0x219),{'alias':_0x3bdd86,'task':_0x573c34,'priority':_0x4dda2a,'from_session':this[_0x47e2e9(0x1d6)]});}async[a0_0x1a26ba(0x205)](_0x51b94d,_0x5f4704){const _0xae5598=a0_0x1a26ba;return this[_0xae5598(0x221)]('send_message',{'alias':_0x51b94d,'message':_0x5f4704,'from_session':this[_0xae5598(0x1d6)]});}async[a0_0x1a26ba(0x1f7)](_0x5b8101,_0x1f9a1f,_0x571239=a0_0x1a26ba(0x1fa)){const _0x15bd91=a0_0x1a26ba;return this[_0x15bd91(0x221)](_0x15bd91(0x1f7),{'task_id':_0x5b8101,'text':_0x1f9a1f,'status':_0x571239});}async[a0_0x1a26ba(0x1f5)](_0x1d37ca,_0xec921b){const _0x6ee3d6=a0_0x1a26ba;return this[_0x6ee3d6(0x221)](_0x6ee3d6(0x1ea),{'resume_id':this[_0x6ee3d6(0x1e5)],'alias':this[_0x6ee3d6(0x1d6)],'status':_0x1d37ca,'server':a0_0x1892c4(),'hostname':a0_0x1892c4(),'agent':this[_0x6ee3d6(0x210)],'project_dir':process[_0x6ee3d6(0x1f2)](),..._0xec921b});}async[a0_0x1a26ba(0x1db)](){const _0x3a90f5=a0_0x1a26ba;return this[_0x3a90f5(0x221)](_0x3a90f5(0x1d9),{});}async['broadcast'](_0x1f864f,_0x24357e){const _0x4caa12=a0_0x1a26ba;return this[_0x4caa12(0x221)](_0x4caa12(0x1df),{'message':_0x1f864f,'filter_server':_0x24357e?.[_0x4caa12(0x206)],'filter_status':_0x24357e?.[_0x4caa12(0x1f5)]});}async[a0_0x1a26ba(0x1dc)](){const _0x13c4da=a0_0x1a26ba;let _0x169752=encodeURIComponent(this[_0x13c4da(0x1d6)]),_0x596c8c=this['url']+_0x13c4da(0x1f0)+_0x169752,_0x2fd503=this[_0x13c4da(0x1d5)];while(this[_0x13c4da(0x215)]){try{this[_0x13c4da(0x1ca)]=new AbortController();let _0x3c045b={'Accept':_0x13c4da(0x21f)};if(this['token'])_0x3c045b['Authorization']=_0x13c4da(0x208)+this[_0x13c4da(0x216)];let _0x4c4279=await fetch(_0x596c8c,{'headers':_0x3c045b,'signal':this[_0x13c4da(0x1ca)][_0x13c4da(0x214)]});if(!_0x4c4279['ok']||!_0x4c4279['body']){this['log'](_0x13c4da(0x1d4)+_0x4c4279[_0x13c4da(0x1f5)]),await this[_0x13c4da(0x1e6)](_0x2fd503),_0x2fd503=Math[_0x13c4da(0x1dd)](_0x2fd503*1.5,0xea60);continue;}_0x2fd503=this[_0x13c4da(0x1d5)];let _0x1267e8=_0x4c4279[_0x13c4da(0x1ee)]['getReader'](),_0x2d9b50=new TextDecoder(),_0x4a97fb='';while(this['running']){let {done:_0x3571cf,value:_0x41800c}=await _0x1267e8[_0x13c4da(0x1e1)]();if(_0x3571cf)break;_0x4a97fb+=_0x2d9b50[_0x13c4da(0x207)](_0x41800c,{'stream':!0x0});let _0x863401=_0x4a97fb[_0x13c4da(0x212)]('\x0a');_0x4a97fb=_0x863401[_0x13c4da(0x1cf)]()||'';for(let _0x3d2bbf of _0x863401){if(!_0x3d2bbf[_0x13c4da(0x1d2)](_0x13c4da(0x20a)))continue;try{let _0x2dbbe8=JSON[_0x13c4da(0x21d)](_0x3d2bbf[_0x13c4da(0x1f3)](0x6));if(_0x2dbbe8[_0x13c4da(0x1da)]===_0x13c4da(0x200)){this[_0x13c4da(0x1e4)]('SSE\x20connected'),this[_0x13c4da(0x1f4)](_0x13c4da(0x200));continue;}if(_0x2dbbe8[_0x13c4da(0x1da)]===_0x13c4da(0x1e7)||_0x2dbbe8['type']===_0x13c4da(0x217)||_0x2dbbe8['type']===_0x13c4da(0x1df))await this[_0x13c4da(0x1fd)]();}catch{}}}}catch(_0x52faa0){if(_0x52faa0[_0x13c4da(0x21c)]==='AbortError')break;this[_0x13c4da(0x1f4)](_0x13c4da(0x220),_0x52faa0),this['log'](_0x13c4da(0x20f)+_0x52faa0[_0x13c4da(0x205)]);}if(this['running'])this[_0x13c4da(0x1f4)](_0x13c4da(0x1ce)),this[_0x13c4da(0x1e4)](_0x13c4da(0x1cb)+_0x2fd503/0x3e8+_0x13c4da(0x1d0)),await this[_0x13c4da(0x1e6)](_0x2fd503),_0x2fd503=Math[_0x13c4da(0x1dd)](_0x2fd503*1.5,0xea60);}}async[a0_0x1a26ba(0x1fd)](){const _0x38ab64=a0_0x1a26ba;try{let _0x1c4381=(await this['call'](_0x38ab64(0x1d3),{'alias':this[_0x38ab64(0x1d6)],'limit':0xa}))?.[_0x38ab64(0x211)]||[];for(let _0x59d7f9 of _0x1c4381)await this[_0x38ab64(0x221)]('ack_inbox',{'alias':this[_0x38ab64(0x1d6)],'message_id':_0x59d7f9['id']}),this['log']('←\x20'+_0x59d7f9[_0x38ab64(0x218)]+':\x20'+_0x59d7f9[_0x38ab64(0x21b)][_0x38ab64(0x1f3)](0x0,0x3c)),this['emit'](_0x38ab64(0x1ed),_0x59d7f9),this[_0x38ab64(0x1f4)](_0x38ab64(0x205),_0x59d7f9);}catch(_0x5c58d6){this[_0x38ab64(0x1e4)]('inbox\x20error:\x20'+_0x5c58d6[_0x38ab64(0x205)]);}}['sleep'](_0x20ec76){return new Promise(_0x7a9b28=>setTimeout(_0x7a9b28,_0x20ec76));}}function a0_0x5850(_0x1b4e38,_0x27a880){_0x1b4e38=_0x1b4e38-0x1ca;const _0x190428=a0_0x1904();let _0x5850c4=_0x190428[_0x1b4e38];return _0x5850c4;}var $=T;function a0_0x1904(){const _0x50d08e=['signal','running','token','new_message','from_session','send_task','41594emwPOu','content','name','parse','sdk-','text/event-stream','error','call','sseAbort','SSE\x20reconnecting\x20in\x20','normal','10dPxvdh','disconnected','pop','s...','393128XALUeA','startsWith','get_inbox','SSE\x20failed:\x20','reconnectDelay','alias','autoConnect','805194nZghJX','get_all_status','type','getAllStatus','connectSSE','min','stringify','broadcast','1fGtqUn','read',']\x20[commhub:','224NSHPcw','log','resumeId','sleep','new_task','2700180RSOqud','application/json','report_status','replace','sdk','task','body','9055tBhBkX','/events/','send','cwd','slice','emit','status','application/json,\x20text/event-stream','reply','heartbeatInterval','2.0','completed','now','result','processInbox','url','toString','connected','idle','POST','15178518MFOrdu','heartbeatTimer','message','server','decode','Bearer\x20','heartbeat\x20failed:\x20','data:\x20','1353308CqJCAR','toTimeString','/mcp','connect','SSE\x20error:\x20','agent','messages','split','text'];a0_0x1904=function(){return _0x50d08e;};return a0_0x1904();}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_0xaf1b4d=a0_0x3a1b;(function(_0x36bed5,_0x3be8fd){const _0x22733a=a0_0x3a1b,_0x513acb=_0x36bed5();while(!![]){try{const _0x43933a=parseInt(_0x22733a(0x12b))/0x1*(-parseInt(_0x22733a(0x15c))/0x2)+-parseInt(_0x22733a(0x165))/0x3+-parseInt(_0x22733a(0x13f))/0x4+parseInt(_0x22733a(0x15d))/0x5+-parseInt(_0x22733a(0x163))/0x6+-parseInt(_0x22733a(0x161))/0x7*(-parseInt(_0x22733a(0x172))/0x8)+parseInt(_0x22733a(0x109))/0x9*(parseInt(_0x22733a(0x12c))/0xa);if(_0x43933a===_0x3be8fd)break;else _0x513acb['push'](_0x513acb['shift']());}catch(_0x2e2355){_0x513acb['push'](_0x513acb['shift']());}}}(a0_0x1457,0x3cd75));import{readFileSync as a0_0x2d475e,existsSync as a0_0x284e7f}from'fs';import{join as a0_0x384299}from'path';import{hostname as a0_0x2ae81f}from'os';import{execSync as a0_0x999a1f}from'child_process';import{Server as a0_0x73f1f9}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x3a1b(_0x584722,_0x4cbc8b){_0x584722=_0x584722-0xf1;const _0x1457df=a0_0x1457();let _0x3a1b10=_0x1457df[_0x584722];return _0x3a1b10;}import{StdioServerTransport as a0_0x482d48}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xd1454e,CallToolRequestSchema as a0_0x462085}from'@modelcontextprotocol/sdk/types.js';function p(_0x47164c){const _0x5a622=a0_0x3a1b;if(!a0_0x284e7f(_0x47164c))return;for(let _0x478d7e of a0_0x2d475e(_0x47164c,_0x5a622(0x114))[_0x5a622(0xf2)]('\x0a')){let _0x5ea864=_0x478d7e['trim']();if(!_0x5ea864||_0x5ea864['startsWith']('#'))continue;let _0x2fbac6=_0x5ea864[_0x5a622(0x164)]('=');if(_0x2fbac6<0x0)continue;let _0x43ab2b=_0x5ea864['slice'](0x0,_0x2fbac6)[_0x5a622(0x116)](),_0x2d8bd0=_0x5ea864[_0x5a622(0xf9)](_0x2fbac6+0x1)[_0x5a622(0x116)]()[_0x5a622(0x103)](/^["']|["']$/g,'');if(!process.env[_0x43ab2b])process.env[_0x43ab2b]=_0x2d8bd0;}}var C=process.env.HOME||'~',T=a0_0x384299(C,a0_0xaf1b4d(0x118));p(a0_0x384299(T,a0_0xaf1b4d(0x16a)));var L=process[a0_0xaf1b4d(0x150)]()[a0_0xaf1b4d(0x103)](/\//g,'-');p(a0_0x384299(T,L,a0_0xaf1b4d(0x16a)));function U(){const _0x4c72e8=a0_0xaf1b4d;try{return a0_0x999a1f('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4c72e8(0x114),'timeout':0x7d0})[_0x4c72e8(0x116)]();}catch{return'';}}function c(){const _0x56a00d=a0_0xaf1b4d;try{let _0x3a7282=a0_0x384299(C,_0x56a00d(0x147),'config.json');if(a0_0x284e7f(_0x3a7282))return JSON[_0x56a00d(0x10d)](a0_0x2d475e(_0x3a7282,_0x56a00d(0x114)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0xaf1b4d(0x137)]||a0_0xaf1b4d(0x17d),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x2ae81f(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0xaf1b4d(0x112)](),X=process.env.COMMHUB_TOKEN||H[a0_0xaf1b4d(0x162)]||'';function Y(_0x3d350b){const _0x4a1d03=a0_0xaf1b4d;let _0x203b60=new Date()[_0x4a1d03(0x11e)]()[_0x4a1d03(0xf9)](0x0,0x8);process[_0x4a1d03(0x104)][_0x4a1d03(0xfe)]('['+_0x203b60+_0x4a1d03(0x182)+_0x3d350b+'\x0a');}function h(_0x2f9a60){return new Promise(_0x388be0=>setTimeout(_0x388be0,_0x2f9a60));}function a0_0x1457(){const _0x45e5ca=['type','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','ack_inbox','inbox_count','\x20ALIAS=','parse\x20error:\x20','tools/call','from','set','25975halnGd','32890QvoxZU','then','string','2025-03-26','priority','SSE\x20connection\x20error:\x20','POST','content','application/json','commhub_send_message','SIGINT','hub','Bearer\x20','end','object','/mcp','2.0','\x20PROJECT_ENV=','commhub_get_all_status','1756412EpAQnJ','normal','pop','get','0.3.0','working','\x22\x20(','broadcast','.anet','report_status','idle','SSE\x20fatal:\x20','setRequestHandler','get_inbox','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','failed','statusText','cwd','commhub-channel','alias','warning:\x20could\x20not\x20register:\x20','get_all_status','messages','Session\x20alias:\x20','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Progress\x200-100','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','number','message','14sUcddx','540485PySDlN','catch','initialize','session\x20disconnected','229859whjnGs','token','2130318ZlrUUE','indexOf','939129kPrjCL','notifications/claude/channel','\x20from\x20','low','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','.env','heartbeat\x20failed:\x20','ENV:\x20URL=','\x20priority=','decode','SSE\x20error:\x20','←\x20message\x20from\x20','unknown\x20tool','88TqVOFK','new_task','starting\x20SSE\x20listener...','params','join','stringify','/events/','connecting\x20to\x20','text','cancelled','none','http://127.0.0.1:9200','shutting\x20down,\x20reporting\x20offline...','no\x20response','registered\x20as\x20\x22','commhub_send_task',']\x20[commhub]\x20','SSE\x20stream\x20ended,\x20reconnecting...','split','data:\x20','claude-code','error','status','length','init\x20failed:\x20','slice','Target\x20session\x20alias','from_session','high','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','write','\x20RESUME_ID=','stdin','exit','application/json,\x20text/event-stream','replace','stderr','completed','blocked','CommHub\x20init\x20failed:\x20','commhub_reply','2925nHNkrm','replied','Reply\x20text\x20/\x20result\x20summary','body','parse','Priority\x20(default:\x20normal)','new_message','commhub','find','randomUUID','Message\x20content','utf-8','send_reply','trim','...\x20TMUX=','.claude/channels/commhub','send_message','notification','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','connected','delete','toTimeString','message_id','in_progress','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.'];a0_0x1457=function(){return _0x45e5ca;};return a0_0x1457();}Y(a0_0xaf1b4d(0x16c)+D+a0_0xaf1b4d(0x126)+Z+a0_0xaf1b4d(0xff)+w[a0_0xaf1b4d(0xf9)](0x0,0x8)+a0_0xaf1b4d(0x117)+(f||a0_0xaf1b4d(0x17c))+'\x20CWD='+process[a0_0xaf1b4d(0x150)]()+a0_0xaf1b4d(0x13d)+L);var k=new Map(),K=new a0_0x73f1f9({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0xaf1b4d(0x11b),a0_0xaf1b4d(0x121),a0_0xaf1b4d(0x123),a0_0xaf1b4d(0x169),a0_0xaf1b4d(0x156)+Z][a0_0xaf1b4d(0x176)]('\x0a')});K[a0_0xaf1b4d(0x14b)](a0_0xd1454e,async()=>({'tools':[{'name':'commhub_reply','description':a0_0xaf1b4d(0xfd),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0x14d)},'text':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0x10b)},'status':{'type':'string','enum':['completed',a0_0xaf1b4d(0x14e),a0_0xaf1b4d(0x17b),'blocked',a0_0xaf1b4d(0xf5),a0_0xaf1b4d(0x120)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0xaf1b4d(0x17a)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{'status':{'type':'string','enum':[a0_0xaf1b4d(0x144),a0_0xaf1b4d(0x149),a0_0xaf1b4d(0x106),'error']},'task':{'type':a0_0xaf1b4d(0x12e),'description':'Current\x20task\x20description'},'progress':{'type':a0_0xaf1b4d(0x15a),'description':a0_0xaf1b4d(0x158)}},'required':[a0_0xaf1b4d(0xf6)]}},{'name':'commhub_send_task','description':a0_0xaf1b4d(0x157),'inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{'alias':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0xfa)},'task':{'type':a0_0xaf1b4d(0x12e),'description':'Task\x20content'},'priority':{'type':a0_0xaf1b4d(0x12e),'enum':[a0_0xaf1b4d(0xfc),a0_0xaf1b4d(0x140),a0_0xaf1b4d(0x168)],'description':a0_0xaf1b4d(0x10e)}},'required':[a0_0xaf1b4d(0x152),'task']}},{'name':a0_0xaf1b4d(0x135),'description':a0_0xaf1b4d(0x159),'inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{'alias':{'type':'string','description':a0_0xaf1b4d(0xfa)},'message':{'type':a0_0xaf1b4d(0x12e),'description':a0_0xaf1b4d(0x113)}},'required':[a0_0xaf1b4d(0x152),a0_0xaf1b4d(0x15b)]}},{'name':a0_0xaf1b4d(0x13e),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0xaf1b4d(0x13a),'properties':{}}}]}));async function P(_0x126e46,_0x52411a){const _0x3f13a6=a0_0xaf1b4d;let _0x20ef88=await fetch(D+'/mcp',{'method':_0x3f13a6(0x132),'headers':{'Content-Type':_0x3f13a6(0x134),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x3f13a6(0x138)+X}:{}},'body':JSON[_0x3f13a6(0x177)]({'jsonrpc':_0x3f13a6(0x13c),'id':0x1,'method':_0x3f13a6(0x15f),'params':{'protocolVersion':_0x3f13a6(0x12f),'capabilities':{},'clientInfo':{'name':_0x3f13a6(0x151),'version':_0x3f13a6(0x143)}}})});if(!_0x20ef88['ok']){let _0x402be8=await _0x20ef88['text']();return Y(_0x3f13a6(0x107)+_0x20ef88[_0x3f13a6(0xf6)]+'\x20'+_0x402be8[_0x3f13a6(0xf9)](0x0,0x64)),{'ok':!0x1,'error':_0x3f13a6(0xf8)+_0x20ef88[_0x3f13a6(0xf6)]};}await _0x20ef88[_0x3f13a6(0x17a)]();let _0x3603b0=(await(await fetch(D+_0x3f13a6(0x13b),{'method':_0x3f13a6(0x132),'headers':{'Content-Type':_0x3f13a6(0x134),'Accept':_0x3f13a6(0x102),...X?{'Authorization':_0x3f13a6(0x138)+X}:{}},'body':JSON[_0x3f13a6(0x177)]({'jsonrpc':'2.0','id':0x2,'method':_0x3f13a6(0x128),'params':{'name':_0x126e46,'arguments':_0x52411a}})}))[_0x3f13a6(0x17a)]())[_0x3f13a6(0xf2)]('\x0a')[_0x3f13a6(0x111)](_0xa745=>_0xa745['startsWith'](_0x3f13a6(0xf3)));if(_0x3603b0){let _0x12ea09=JSON[_0x3f13a6(0x10d)](_0x3603b0[_0x3f13a6(0xf9)](0x6));return _0x12ea09?.['result']?.[_0x3f13a6(0x133)]?.[0x0]?.[_0x3f13a6(0x17a)]?JSON[_0x3f13a6(0x10d)](_0x12ea09['result'][_0x3f13a6(0x133)][0x0]['text']):_0x12ea09;}return{'ok':!0x1,'error':_0x3f13a6(0x17f)};}K[a0_0xaf1b4d(0x14b)](a0_0x462085,async _0x372068=>{const _0x2b0b04=a0_0xaf1b4d;let {name:_0x25b500,arguments:_0x492503}=_0x372068[_0x2b0b04(0x175)];if(_0x25b500===_0x2b0b04(0x108)){let {task_id:_0x4bd18d,text:_0x450954,status:_0x52db43}=_0x492503;if(_0x52db43===_0x2b0b04(0x105)||_0x52db43===_0x2b0b04(0x14e)||_0x52db43===_0x2b0b04(0x17b)){let _0xa7167c=_0x52db43===_0x2b0b04(0x105)?_0x2b0b04(0x10a):_0x52db43,_0x125d0f=_0x4bd18d?k[_0x2b0b04(0x142)](_0x4bd18d)||_0x2b0b04(0x137):_0x2b0b04(0x137),_0x4b3f1c=await P(_0x2b0b04(0x115),{'alias':_0x125d0f,'text':_0x450954,'in_reply_to':_0x4bd18d||void 0x0,'status':_0xa7167c,'from_session':Z});if(_0x4bd18d)k[_0x2b0b04(0x11d)](_0x4bd18d);return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x4b3f1c)}]};}let _0x15960b=await P(_0x2b0b04(0x148),{'resume_id':w,'alias':Z,'status':_0x52db43===_0x2b0b04(0x106)?_0x2b0b04(0x106):_0x52db43==='error'?_0x2b0b04(0xf5):_0x2b0b04(0x144),'task':_0x450954[_0x2b0b04(0xf9)](0x0,0xc8),'output':_0x450954});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x15960b)}]};}if(_0x25b500==='commhub_report_status'){let {status:_0x21c8eb,task:_0x5cd6f9,progress:_0x48345e}=_0x492503,_0x5e23ac=await P(_0x2b0b04(0x148),{'resume_id':w,'alias':Z,'status':_0x21c8eb,'task':_0x5cd6f9,'progress':_0x48345e});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x5e23ac)}]};}if(_0x25b500===_0x2b0b04(0x181)){let {alias:_0x5a4e80,task:_0x4424d9,priority:_0x420037}=_0x492503,_0x53b325=await P('send_task',{'alias':_0x5a4e80,'task':_0x4424d9,'priority':_0x420037||'normal','from_session':Z});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x53b325)}]};}if(_0x25b500===_0x2b0b04(0x135)){let {alias:_0x842a4c,message:_0x42455f}=_0x492503,_0x5c0af6=await P(_0x2b0b04(0x119),{'alias':_0x842a4c,'message':_0x42455f,'from_session':Z});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON[_0x2b0b04(0x177)](_0x5c0af6)}]};}if(_0x25b500===_0x2b0b04(0x13e)){let _0x12e22b=await P(_0x2b0b04(0x154),{});return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON['stringify'](_0x12e22b)}]};}return{'content':[{'type':_0x2b0b04(0x17a),'text':JSON['stringify']({'error':_0x2b0b04(0x171)})}]};});async function v(){const _0x8a1b6e=a0_0xaf1b4d;let _0x475ebb=D+_0x8a1b6e(0x178)+encodeURIComponent(Z),_0x169c98={};if(X)_0x169c98['Authorization']='Bearer\x20'+X;Y(_0x8a1b6e(0x179)+_0x475ebb);while(!0x0){try{let _0x19da1e=await fetch(_0x475ebb,{'headers':_0x169c98});if(!_0x19da1e['ok']){Y(_0x8a1b6e(0x16f)+_0x19da1e['status']+'\x20'+_0x19da1e[_0x8a1b6e(0x14f)]),await h(0x1388);continue;}let _0x3c83c6=_0x19da1e[_0x8a1b6e(0x10c)]['getReader'](),_0x3d6430=new TextDecoder(),_0x5e2bc0='';while(!0x0){let {done:_0x4bed30,value:_0x47aba2}=await _0x3c83c6['read']();if(_0x4bed30)break;_0x5e2bc0+=_0x3d6430[_0x8a1b6e(0x16e)](_0x47aba2,{'stream':!0x0});let _0x90eb5a=_0x5e2bc0[_0x8a1b6e(0xf2)]('\x0a\x0a');_0x5e2bc0=_0x90eb5a[_0x8a1b6e(0x141)]()||'';for(let _0x2d550f of _0x90eb5a){let _0x57645d=_0x2d550f[_0x8a1b6e(0xf2)]('\x0a')[_0x8a1b6e(0x111)](_0x44fade=>_0x44fade['startsWith']('data:\x20'));if(!_0x57645d)continue;try{let _0x362f96=JSON[_0x8a1b6e(0x10d)](_0x57645d[_0x8a1b6e(0xf9)](0x6));await u(_0x362f96);}catch(_0xc6d6c9){Y(_0x8a1b6e(0x127)+_0xc6d6c9);}}}Y(_0x8a1b6e(0xf1));}catch(_0x41bbee){Y(_0x8a1b6e(0x131)+_0x41bbee);}await h(0xbb8);}}async function u(_0x26a5b5){const _0x3ebb50=a0_0xaf1b4d;if(_0x26a5b5[_0x3ebb50(0x122)]===_0x3ebb50(0x11c)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x26a5b5[_0x3ebb50(0x122)]===_0x3ebb50(0x10f)){if(Y(_0x3ebb50(0x170)+_0x26a5b5[_0x3ebb50(0x129)]+':\x20'+_0x26a5b5[_0x3ebb50(0x15b)]['slice'](0x0,0x3c)),await K[_0x3ebb50(0x11a)]({'method':'notifications/claude/channel','params':{'content':_0x26a5b5[_0x3ebb50(0x15b)],'meta':{'sender':_0x26a5b5[_0x3ebb50(0x129)]||_0x3ebb50(0x137),'sender_id':_0x3ebb50(0x110),'user':_0x26a5b5['from']||_0x3ebb50(0x137),'priority':_0x3ebb50(0x140)}}}),_0x26a5b5[_0x3ebb50(0x11f)])await P(_0x3ebb50(0x124),{'alias':Z,'message_id':_0x26a5b5[_0x3ebb50(0x11f)]});return;}if(_0x26a5b5['type']===_0x3ebb50(0x173)||_0x26a5b5[_0x3ebb50(0x122)]===_0x3ebb50(0x146)){Y('←\x20'+_0x26a5b5[_0x3ebb50(0x122)]+':\x20inbox_count='+_0x26a5b5[_0x3ebb50(0x125)]+_0x3ebb50(0x16d)+(_0x26a5b5['priority']||'normal'));let _0xa491af=await P(_0x3ebb50(0x14c),{'alias':Z,'limit':0x5});if(_0xa491af?.['ok']&&_0xa491af[_0x3ebb50(0x155)]?.[_0x3ebb50(0xf7)]>0x0)for(let _0xfcc31a of _0xa491af['messages']){let _0x3f70a9={'sender':_0xfcc31a['from_session']||_0x3ebb50(0x137),'sender_id':_0x3ebb50(0x110),'user':_0xfcc31a[_0x3ebb50(0xfb)]||'hub','task_id':_0xfcc31a['id'],'priority':_0xfcc31a[_0x3ebb50(0x130)]||'normal'};k[_0x3ebb50(0x12a)](_0xfcc31a['id'],_0xfcc31a[_0x3ebb50(0xfb)]||_0x3ebb50(0x137)),await K[_0x3ebb50(0x11a)]({'method':_0x3ebb50(0x166),'params':{'content':_0xfcc31a['content'],'meta':_0x3f70a9}}),Y('→\x20injected\x20task\x20'+_0xfcc31a['id'][_0x3ebb50(0xf9)](0x0,0x8)+_0x3ebb50(0x167)+_0xfcc31a['from_session']+':\x20'+_0xfcc31a[_0x3ebb50(0x133)][_0x3ebb50(0xf9)](0x0,0x3c)),await P(_0x3ebb50(0x124),{'alias':Z,'message_id':_0xfcc31a['id']});}}}async function S(){const _0x589905=a0_0xaf1b4d;let _0x3ef90b=new a0_0x482d48();await K['connect'](_0x3ef90b),Y('MCP\x20stdio\x20connected'),Y(_0x589905(0x174)),v()['catch'](_0x1a207d=>Y(_0x589905(0x14a)+_0x1a207d)),P(_0x589905(0x148),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x2ae81f(),'hostname':a0_0x2ae81f(),'agent':_0x589905(0xf4),'project_dir':process[_0x589905(0x150)](),'tmux_name':f||void 0x0})[_0x589905(0x12d)](()=>Y(_0x589905(0x180)+Z+_0x589905(0x145)+w[_0x589905(0xf9)](0x0,0x8)+')'))[_0x589905(0x15e)](_0xaf4576=>Y(_0x589905(0x153)+_0xaf4576)),setInterval(()=>{const _0x4b9326=_0x589905;P(_0x4b9326(0x148),{'resume_id':w,'alias':Z,'status':_0x4b9326(0x149),'server':a0_0x2ae81f(),'hostname':a0_0x2ae81f(),'agent':_0x4b9326(0xf4),'project_dir':process[_0x4b9326(0x150)](),'tmux_name':f||void 0x0})[_0x4b9326(0x15e)](_0xa2995a=>Y(_0x4b9326(0x16b)+_0xa2995a));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0xaf1b4d(0x15e)](_0x54a689=>{const _0x1006fe=a0_0xaf1b4d;Y('fatal:\x20'+_0x54a689),process[_0x1006fe(0x101)](0x1);});async function N(){const _0x11a380=a0_0xaf1b4d;Y(_0x11a380(0x17e)),await P(_0x11a380(0x148),{'resume_id':w,'alias':Z,'status':_0x11a380(0xf5),'task':_0x11a380(0x160)})[_0x11a380(0x15e)](()=>{}),process[_0x11a380(0x101)](0x0);}process[a0_0xaf1b4d(0x100)]['on'](a0_0xaf1b4d(0x139),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0xaf1b4d(0x136),()=>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.25",
|
|
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
|
+
}
|