@sleep2agi/agent-network 2.1.3-preview.0 → 2.1.3-preview.1
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
|
-
function
|
|
1
|
+
const a0_0xf55a00=a0_0x5d73;(function(_0x5bb157,_0x4fce87){const _0x4b6984=a0_0x5d73,_0x110d7e=_0x5bb157();while(!![]){try{const _0x991410=parseInt(_0x4b6984(0x19a))/0x1*(parseInt(_0x4b6984(0x1c6))/0x2)+-parseInt(_0x4b6984(0x1a3))/0x3*(-parseInt(_0x4b6984(0x1bd))/0x4)+parseInt(_0x4b6984(0x1c4))/0x5*(parseInt(_0x4b6984(0x1ca))/0x6)+-parseInt(_0x4b6984(0x192))/0x7*(-parseInt(_0x4b6984(0x1d3))/0x8)+parseInt(_0x4b6984(0x193))/0x9+-parseInt(_0x4b6984(0x1a4))/0xa*(parseInt(_0x4b6984(0x1d9))/0xb)+parseInt(_0x4b6984(0x1d2))/0xc*(-parseInt(_0x4b6984(0x1be))/0xd);if(_0x991410===_0x4fce87)break;else _0x110d7e['push'](_0x110d7e['shift']());}catch(_0x55334b){_0x110d7e['push'](_0x110d7e['shift']());}}}(a0_0x1634,0xd83a2));function a0_0x1634(){const _0x411000=['text/event-stream','sdk','token','84mgbRFQ','8544dZbBOF','agent','send','SSE\x20connected','call','emit','19349QdtRJP',']\x20[commhub:','completed','slice','match','offline','/events/','sseAbort','get_inbox','registered','heartbeatTimer','running','now','normal','disconnected','read','heartbeat\x20failed:\x20','content','SSE\x20reconnecting\x20in\x20','SSE\x20error:\x20','catch','cwd','resumeId','4662LcHcJt','15272613LmoUZD','min','task','parse','data:\x20','decode','server','1BllzuV','s...','replace','broadcast','pop','inbox\x20error:\x20','from_session','send_reply','log','2528838UPJPpZ','7960LfKtTl','abort','tools/call','text','split','application/json,\x20text/event-stream','sleep','Authorization','/mcp','body','error','getAllStatus','sdk-','alias','type','result','reconnectDelay','disconnect','getReader','autoConnect','connected','connectSSE','toTimeString','AbortError','new_task','4aPVKKw','6562504zfbmmc','POST','heartbeatInterval','url','idle','status','5meFQcc','stringify','1881918eKGhBD','ack_inbox','connect','SSE\x20failed:\x20','9764016Nhxmqm','startsWith','Bearer\x20','message','signal'];a0_0x1634=function(){return _0x411000;};return a0_0x1634();}import{EventEmitter as a0_0x27c9da}from'events';import{hostname as a0_0x3ce612}from'os';class T extends a0_0x27c9da{[a0_0xf55a00(0x1c1)];[a0_0xf55a00(0x1b1)];['token'];[a0_0xf55a00(0x1d4)];[a0_0xf55a00(0x191)];[a0_0xf55a00(0x1c0)];[a0_0xf55a00(0x1b4)];['heartbeatTimer'];[a0_0xf55a00(0x1e0)];[a0_0xf55a00(0x186)]=!0x1;constructor(_0x426cc6){const _0x5d7f47=a0_0xf55a00;super();if(this[_0x5d7f47(0x1c1)]=_0x426cc6[_0x5d7f47(0x1c1)][_0x5d7f47(0x19c)](/\/$/,''),this[_0x5d7f47(0x1b1)]=_0x426cc6[_0x5d7f47(0x1b1)],this['token']=_0x426cc6[_0x5d7f47(0x1d1)],this[_0x5d7f47(0x1d4)]=_0x426cc6[_0x5d7f47(0x1d4)]||_0x5d7f47(0x1d0),this[_0x5d7f47(0x191)]=_0x5d7f47(0x1b0)+_0x426cc6[_0x5d7f47(0x1b1)]+'-'+Date[_0x5d7f47(0x187)]()['toString'](0x24),this[_0x5d7f47(0x1c0)]=_0x426cc6[_0x5d7f47(0x1c0)]??0x2bf20,this['reconnectDelay']=_0x426cc6[_0x5d7f47(0x1b4)]??0xbb8,_0x426cc6[_0x5d7f47(0x1b7)]!==!0x1)this[_0x5d7f47(0x1c8)]();}[a0_0xf55a00(0x1a2)](_0x4cecdc){const _0x2d4aa7=a0_0xf55a00;console['log']('['+new Date()[_0x2d4aa7(0x1ba)]()[_0x2d4aa7(0x1dc)](0x0,0x8)+_0x2d4aa7(0x1da)+this[_0x2d4aa7(0x1b1)]+']\x20'+_0x4cecdc);}async[a0_0xf55a00(0x1d7)](_0x2319cd,_0x58c4dc){const _0x2ca97f=a0_0xf55a00;let _0x43fadc={'Content-Type':'application/json','Accept':_0x2ca97f(0x1a9)};if(this['token'])_0x43fadc[_0x2ca97f(0x1ab)]=_0x2ca97f(0x1cc)+this[_0x2ca97f(0x1d1)];let _0x5db819=await(await fetch(this['url']+_0x2ca97f(0x1ac),{'method':_0x2ca97f(0x1bf),'headers':_0x43fadc,'body':JSON[_0x2ca97f(0x1c5)]({'jsonrpc':'2.0','id':Date['now'](),'method':_0x2ca97f(0x1a6),'params':{'name':_0x2319cd,'arguments':_0x58c4dc}})}))[_0x2ca97f(0x1a7)](),_0x4fe288=_0x5db819[_0x2ca97f(0x1dd)](/data: (.+)/),_0x84e603=_0x4fe288?JSON['parse'](_0x4fe288[0x1]):JSON[_0x2ca97f(0x196)](_0x5db819),_0x24a1da=_0x84e603?.[_0x2ca97f(0x1b3)]?.[_0x2ca97f(0x18c)]?.[0x0]?.[_0x2ca97f(0x1a7)];return _0x24a1da?JSON['parse'](_0x24a1da):_0x84e603;}async[a0_0xf55a00(0x1c8)](){const _0x918073=a0_0xf55a00;if(this[_0x918073(0x186)])return;this[_0x918073(0x186)]=!0x0,await this['status'](_0x918073(0x1c2)),this[_0x918073(0x1a2)](_0x918073(0x1e2)),this[_0x918073(0x185)]=setInterval(()=>{const _0x14708c=_0x918073;this[_0x14708c(0x1c3)]('idle')[_0x14708c(0x18f)](_0x563c3e=>this[_0x14708c(0x1a2)](_0x14708c(0x18b)+_0x563c3e[_0x14708c(0x1cd)]));},this['heartbeatInterval']),this[_0x918073(0x1b9)]();}async[a0_0xf55a00(0x1b5)](){const _0x222e79=a0_0xf55a00;if(this[_0x222e79(0x186)]=!0x1,this['sseAbort']?.[_0x222e79(0x1a5)](),this[_0x222e79(0x185)])clearInterval(this['heartbeatTimer']);await this['status'](_0x222e79(0x1de))['catch'](()=>{}),this[_0x222e79(0x1a2)](_0x222e79(0x189));}async[a0_0xf55a00(0x1d5)](_0x16ae43,_0x56ed30,_0x2a7295=a0_0xf55a00(0x188)){const _0x538fba=a0_0xf55a00;return this[_0x538fba(0x1d7)]('send_task',{'alias':_0x16ae43,'task':_0x56ed30,'priority':_0x2a7295,'from_session':this[_0x538fba(0x1b1)]});}async['message'](_0x46b859,_0x1ae0c0){const _0x135664=a0_0xf55a00;return this[_0x135664(0x1d7)]('send_message',{'alias':_0x46b859,'message':_0x1ae0c0,'from_session':this['alias']});}async['reply'](_0xadbf28,_0x343d8c,_0x36520c=a0_0xf55a00(0x1db)){const _0x2c9d23=a0_0xf55a00;return this[_0x2c9d23(0x1d7)](_0x2c9d23(0x1a1),{'in_reply_to':_0xadbf28,'text':_0x343d8c,'status':_0x36520c});}async[a0_0xf55a00(0x1c3)](_0xe33ca5,_0x14a1f6){const _0x2750a1=a0_0xf55a00;return this[_0x2750a1(0x1d7)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x2750a1(0x1b1)],'status':_0xe33ca5,'server':a0_0x3ce612(),'hostname':a0_0x3ce612(),'agent':this[_0x2750a1(0x1d4)],'project_dir':process[_0x2750a1(0x190)](),..._0x14a1f6});}async[a0_0xf55a00(0x1af)](){const _0x221386=a0_0xf55a00;return this[_0x221386(0x1d7)]('get_all_status',{});}async[a0_0xf55a00(0x19d)](_0xe3537,_0x41cbd2){const _0x1efee0=a0_0xf55a00;return this[_0x1efee0(0x1d7)](_0x1efee0(0x19d),{'message':_0xe3537,'filter_server':_0x41cbd2?.[_0x1efee0(0x199)],'filter_status':_0x41cbd2?.[_0x1efee0(0x1c3)]});}async[a0_0xf55a00(0x1b9)](){const _0x219b45=a0_0xf55a00;let _0x19e0c9=encodeURIComponent(this['alias']),_0x49be46=this[_0x219b45(0x1c1)]+_0x219b45(0x1df)+_0x19e0c9,_0x4f4a70=this['reconnectDelay'];while(this[_0x219b45(0x186)]){try{this[_0x219b45(0x1e0)]=new AbortController();let _0x149cc6={'Accept':_0x219b45(0x1cf)};if(this[_0x219b45(0x1d1)])_0x149cc6[_0x219b45(0x1ab)]='Bearer\x20'+this[_0x219b45(0x1d1)];let _0x29708a=await fetch(_0x49be46,{'headers':_0x149cc6,'signal':this['sseAbort'][_0x219b45(0x1ce)]});if(!_0x29708a['ok']||!_0x29708a[_0x219b45(0x1ad)]){this[_0x219b45(0x1a2)](_0x219b45(0x1c9)+_0x29708a[_0x219b45(0x1c3)]),await this[_0x219b45(0x1aa)](_0x4f4a70),_0x4f4a70=Math[_0x219b45(0x194)](_0x4f4a70*1.5,0xea60);continue;}_0x4f4a70=this['reconnectDelay'];let _0x1ecc12=_0x29708a[_0x219b45(0x1ad)][_0x219b45(0x1b6)](),_0x567711=new TextDecoder(),_0x4b1142='';while(this[_0x219b45(0x186)]){let {done:_0x410396,value:_0x431240}=await _0x1ecc12[_0x219b45(0x18a)]();if(_0x410396)break;_0x4b1142+=_0x567711[_0x219b45(0x198)](_0x431240,{'stream':!0x0});let _0x27aa3c=_0x4b1142[_0x219b45(0x1a8)]('\x0a');_0x4b1142=_0x27aa3c[_0x219b45(0x19e)]()||'';for(let _0x546874 of _0x27aa3c){if(!_0x546874[_0x219b45(0x1cb)](_0x219b45(0x197)))continue;try{let _0x2b9bf8=JSON[_0x219b45(0x196)](_0x546874[_0x219b45(0x1dc)](0x6));if(_0x2b9bf8[_0x219b45(0x1b2)]===_0x219b45(0x1b8)){this[_0x219b45(0x1a2)](_0x219b45(0x1d6)),this[_0x219b45(0x1d8)](_0x219b45(0x1b8));continue;}if(_0x2b9bf8[_0x219b45(0x1b2)]===_0x219b45(0x1bc)||_0x2b9bf8[_0x219b45(0x1b2)]==='new_message'||_0x2b9bf8[_0x219b45(0x1b2)]===_0x219b45(0x19d))await this['processInbox']();}catch{}}}}catch(_0x1fb823){if(_0x1fb823['name']===_0x219b45(0x1bb))break;this[_0x219b45(0x1d8)](_0x219b45(0x1ae),_0x1fb823),this[_0x219b45(0x1a2)](_0x219b45(0x18e)+_0x1fb823['message']);}if(this['running'])this[_0x219b45(0x1d8)](_0x219b45(0x189)),this[_0x219b45(0x1a2)](_0x219b45(0x18d)+_0x4f4a70/0x3e8+_0x219b45(0x19b)),await this[_0x219b45(0x1aa)](_0x4f4a70),_0x4f4a70=Math['min'](_0x4f4a70*1.5,0xea60);}}async['processInbox'](){const _0x2658e5=a0_0xf55a00;try{let _0x369e2b=(await this[_0x2658e5(0x1d7)](_0x2658e5(0x1e1),{'alias':this[_0x2658e5(0x1b1)],'limit':0xa}))?.['messages']||[];for(let _0x5613e6 of _0x369e2b)await this[_0x2658e5(0x1d7)](_0x2658e5(0x1c7),{'alias':this[_0x2658e5(0x1b1)],'message_id':_0x5613e6['id']}),this[_0x2658e5(0x1a2)]('←\x20'+_0x5613e6[_0x2658e5(0x1a0)]+':\x20'+_0x5613e6[_0x2658e5(0x18c)][_0x2658e5(0x1dc)](0x0,0x3c)),this['emit'](_0x2658e5(0x195),_0x5613e6),this[_0x2658e5(0x1d8)]('message',_0x5613e6);}catch(_0x3b1fde){this['log'](_0x2658e5(0x19f)+_0x3b1fde[_0x2658e5(0x1cd)]);}}[a0_0xf55a00(0x1aa)](_0x4d4854){return new Promise(_0x4a0e01=>setTimeout(_0x4a0e01,_0x4d4854));}}function a0_0x5d73(_0x4dab63,_0x434e85){_0x4dab63=_0x4dab63-0x185;const _0x1634e4=a0_0x1634();let _0x5d73f4=_0x1634e4[_0x4dab63];return _0x5d73f4;}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_0x590876=a0_0x10f1;(function(_0x97fd6,_0x31eb17){const _0x2ae8df=a0_0x10f1,_0x3f301d=_0x97fd6();while(!![]){try{const _0x4fba51=parseInt(_0x2ae8df(0x13f))/0x1*(parseInt(_0x2ae8df(0xf2))/0x2)+-parseInt(_0x2ae8df(0x168))/0x3+-parseInt(_0x2ae8df(0x13d))/0x4*(-parseInt(_0x2ae8df(0x11e))/0x5)+-parseInt(_0x2ae8df(0x101))/0x6+-parseInt(_0x2ae8df(0x162))/0x7*(parseInt(_0x2ae8df(0x13a))/0x8)+parseInt(_0x2ae8df(0x146))/0x9*(parseInt(_0x2ae8df(0x14d))/0xa)+parseInt(_0x2ae8df(0x152))/0xb;if(_0x4fba51===_0x31eb17)break;else _0x3f301d['push'](_0x3f301d['shift']());}catch(_0x3839cd){_0x3f301d['push'](_0x3f301d['shift']());}}}(a0_0x5afb,0xaeebd));import{readFileSync as a0_0x1863ec,existsSync as a0_0x1a7dd5}from'fs';import{randomUUID as a0_0x501545}from'crypto';import{join as a0_0x2b1168}from'path';import{hostname as a0_0x5df9a6}from'os';import{execSync as a0_0xd26412}from'child_process';import{Server as a0_0x54a809}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x69e475}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x345e7f,CallToolRequestSchema as a0_0x29da7d}from'@modelcontextprotocol/sdk/types.js';function p(_0x3f76a2){const _0x390a37=a0_0x10f1;if(!a0_0x1a7dd5(_0x3f76a2))return;for(let _0x2d5739 of a0_0x1863ec(_0x3f76a2,_0x390a37(0x15e))[_0x390a37(0x11c)]('\x0a')){let _0x39ab27=_0x2d5739['trim']();if(!_0x39ab27||_0x39ab27[_0x390a37(0x147)]('#'))continue;let _0x3c2680=_0x39ab27['indexOf']('=');if(_0x3c2680<0x0)continue;let _0x5b31ba=_0x39ab27['slice'](0x0,_0x3c2680)[_0x390a37(0xee)](),_0xaa983c=_0x39ab27[_0x390a37(0x142)](_0x3c2680+0x1)['trim']()[_0x390a37(0x10b)](/^["']|["']$/g,'');if(!process.env[_0x5b31ba])process.env[_0x5b31ba]=_0xaa983c;}}var C=process.env.HOME||'~',T=a0_0x2b1168(C,a0_0x590876(0x105));p(a0_0x2b1168(T,a0_0x590876(0x130)));function a0_0x5afb(){const _0x4c191c=['none','commhub_send_task','Target\x20session\x20alias','commhub_get_all_status','idle','stringify','then','get','split','\x20priority=','5EDYOdu','SSE\x20error:\x20','text','\x20from\x20','\x20ALIAS=','commhub','CommHub\x20init\x20failed:\x20','config.json','commhub_report_status','replied','Current\x20task\x20description','failed','priority','registered\x20as\x20\x22','POST','string','connecting\x20to\x20','normal','.env','status','object','.anet','\x20CWD=','session\x20disconnected','SSE\x20connected\x20as\x20\x22','unknown\x20tool','Session\x20alias:\x20','pop','16wBfCoQ','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','send_task','2298984oeoTgq','claude-code','12407uaheTX','Reply\x20text\x20/\x20result\x20summary','getReader','slice','SSE\x20fatal:\x20','length','commhub-channel','1053WXNjsH','startsWith','delete','setRequestHandler','new_message','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','tools/call','71350gCKfVA','2.0','exit','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','notifications/claude/channel','8156016wXDnRr','message','token','from','completed','heartbeat\x20failed:\x20','get_all_status','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','message_id','end','Priority\x20(default:\x20normal)','utf-8','Progress\x200-100','stdin','catch','4734723dJipEv','messages','blocked','commhub_reply','hub','commhub_send_message','3156453viJHTK','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','ack_inbox','params','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','read','→\x20injected\x20task\x20','Bearer\x20','/events/','ENV:\x20URL=','send_message','from_session','task','in_progress','connect','/mcp','starting\x20SSE\x20listener...','get_inbox','SIGINT','trim','tmux\x20display-message\x20-p\x20\x27#S\x27','shutting\x20down,\x20reporting\x20offline...',']\x20[commhub]\x20','166wNTIpB','new_task','cwd','0.3.0','cancelled','Authorization','Message\x20content','http://127.0.0.1:9200','MCP\x20stdio\x20connected','send_reply','alias','result','content','find','type','356232lgxDkT','no\x20response','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','\x20RESUME_ID=','.claude/channels/commhub','parse\x20error:\x20','report_status','notification','error','initialize','replace','SSE\x20stream\x20ended,\x20reconnecting...','2025-03-26','...\x20TMUX=','working','application/json','parse','data:\x20',':\x20inbox_count='];a0_0x5afb=function(){return _0x4c191c;};return a0_0x5afb();}var L=process['cwd']()[a0_0x590876(0x10b)](/\//g,'-');function a0_0x10f1(_0x48f889,_0x1d5f4f){_0x48f889=_0x48f889-0xed;const _0x5afb68=a0_0x5afb();let _0x10f19c=_0x5afb68[_0x48f889];return _0x10f19c;}p(a0_0x2b1168(T,L,'.env'));function U(){const _0x296b66=a0_0x590876;try{return a0_0xd26412(_0x296b66(0xef),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function v(){const _0x135566=a0_0x590876;try{let _0x1c04b1=a0_0x2b1168(C,_0x135566(0x133),_0x135566(0x125));if(a0_0x1a7dd5(_0x1c04b1))return JSON[_0x135566(0x111)](a0_0x1863ec(_0x1c04b1,_0x135566(0x15e)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x590876(0x166)]||a0_0x590876(0xf9),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x5df9a6(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x501545(),X=process.env.COMMHUB_TOKEN||H[a0_0x590876(0x154)]||'';function Y(_0x2fb427){const _0x55f1a2=a0_0x590876;let _0x27d0f6=new Date()['toTimeString']()[_0x55f1a2(0x142)](0x0,0x8);process['stderr']['write']('['+_0x27d0f6+_0x55f1a2(0xf1)+_0x2fb427+'\x0a');}function h(_0x1f20c6){return new Promise(_0x49bb98=>setTimeout(_0x49bb98,_0x1f20c6));}Y(a0_0x590876(0x171)+f+a0_0x590876(0x122)+Z+a0_0x590876(0x104)+w['slice'](0x0,0x8)+a0_0x590876(0x10e)+(j||a0_0x590876(0x114))+a0_0x590876(0x134)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x54a809({'name':a0_0x590876(0x145),'version':a0_0x590876(0xf5)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x590876(0x16c),a0_0x590876(0x169),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x590876(0x103),a0_0x590876(0x138)+Z]['join']('\x0a')});K[a0_0x590876(0x149)](a0_0x345e7f,async()=>({'tools':[{'name':a0_0x590876(0x165),'description':a0_0x590876(0x15a),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x590876(0x12d),'description':a0_0x590876(0x13b)},'text':{'type':a0_0x590876(0x12d),'description':a0_0x590876(0x140)},'status':{'type':'string','enum':[a0_0x590876(0x156),a0_0x590876(0x129),'cancelled',a0_0x590876(0x164),a0_0x590876(0x109),a0_0x590876(0x175)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x590876(0x120)]}},{'name':a0_0x590876(0x126),'description':a0_0x590876(0x159),'inputSchema':{'type':a0_0x590876(0x132),'properties':{'status':{'type':'string','enum':[a0_0x590876(0x10f),a0_0x590876(0x118),a0_0x590876(0x164),a0_0x590876(0x109)]},'task':{'type':a0_0x590876(0x12d),'description':a0_0x590876(0x128)},'progress':{'type':'number','description':a0_0x590876(0x15f)}},'required':[a0_0x590876(0x131)]}},{'name':a0_0x590876(0x115),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x590876(0x132),'properties':{'alias':{'type':a0_0x590876(0x12d),'description':a0_0x590876(0x116)},'task':{'type':a0_0x590876(0x12d),'description':'Task\x20content'},'priority':{'type':a0_0x590876(0x12d),'enum':['high',a0_0x590876(0x12f),'low'],'description':a0_0x590876(0x15d)}},'required':[a0_0x590876(0xfc),a0_0x590876(0x174)]}},{'name':a0_0x590876(0x167),'description':a0_0x590876(0x150),'inputSchema':{'type':a0_0x590876(0x132),'properties':{'alias':{'type':a0_0x590876(0x12d),'description':a0_0x590876(0x116)},'message':{'type':'string','description':a0_0x590876(0xf8)}},'required':[a0_0x590876(0xfc),'message']}},{'name':a0_0x590876(0x117),'description':a0_0x590876(0x14b),'inputSchema':{'type':a0_0x590876(0x132),'properties':{}}}]}));async function P(_0x59fc4b,_0x308272){const _0x9b492b=a0_0x590876;let _0x11f2ed=await fetch(f+_0x9b492b(0x177),{'method':_0x9b492b(0x12c),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x9b492b(0x16f)+X}:{}},'body':JSON[_0x9b492b(0x119)]({'jsonrpc':_0x9b492b(0x14e),'id':0x1,'method':_0x9b492b(0x10a),'params':{'protocolVersion':_0x9b492b(0x10d),'capabilities':{},'clientInfo':{'name':_0x9b492b(0x145),'version':_0x9b492b(0xf5)}}})});if(!_0x11f2ed['ok']){let _0x19f9d7=await _0x11f2ed['text']();return Y(_0x9b492b(0x124)+_0x11f2ed[_0x9b492b(0x131)]+'\x20'+_0x19f9d7['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x11f2ed['status']};}await _0x11f2ed['text']();let _0x43094c=(await(await fetch(f+_0x9b492b(0x177),{'method':_0x9b492b(0x12c),'headers':{'Content-Type':_0x9b492b(0x110),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x9b492b(0x16f)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x9b492b(0x14c),'params':{'name':_0x59fc4b,'arguments':_0x308272}})}))[_0x9b492b(0x120)]())[_0x9b492b(0x11c)]('\x0a')[_0x9b492b(0xff)](_0x23b081=>_0x23b081[_0x9b492b(0x147)](_0x9b492b(0x112)));if(_0x43094c){let _0x1c09a0=JSON[_0x9b492b(0x111)](_0x43094c[_0x9b492b(0x142)](0x6));return _0x1c09a0?.[_0x9b492b(0xfd)]?.[_0x9b492b(0xfe)]?.[0x0]?.[_0x9b492b(0x120)]?JSON[_0x9b492b(0x111)](_0x1c09a0['result']['content'][0x0][_0x9b492b(0x120)]):_0x1c09a0;}return{'ok':!0x1,'error':_0x9b492b(0x102)};}K[a0_0x590876(0x149)](a0_0x29da7d,async _0x139843=>{const _0x31b35c=a0_0x590876;let {name:_0x5ea47c,arguments:_0x3508c8}=_0x139843[_0x31b35c(0x16b)];if(_0x5ea47c===_0x31b35c(0x165)){let {task_id:_0x487764,text:_0x29a4f3,status:_0x4e7fda}=_0x3508c8;if(_0x4e7fda===_0x31b35c(0x156)||_0x4e7fda==='failed'||_0x4e7fda===_0x31b35c(0xf6)){let _0xc5e0d=_0x4e7fda==='completed'?_0x31b35c(0x127):_0x4e7fda,_0x1bd083=_0x487764?k[_0x31b35c(0x11b)](_0x487764)||_0x31b35c(0x166):_0x31b35c(0x166),_0xd707a7=await P(_0x31b35c(0xfb),{'alias':_0x1bd083,'text':_0x29a4f3,'in_reply_to':_0x487764||void 0x0,'status':_0xc5e0d,'from_session':Z});if(_0x487764)k[_0x31b35c(0x148)](_0x487764);return{'content':[{'type':_0x31b35c(0x120),'text':JSON['stringify'](_0xd707a7)}]};}let _0xb52c74=await P(_0x31b35c(0x107),{'resume_id':w,'alias':Z,'status':_0x4e7fda===_0x31b35c(0x164)?_0x31b35c(0x164):_0x4e7fda===_0x31b35c(0x109)?_0x31b35c(0x109):_0x31b35c(0x10f),'task':_0x29a4f3[_0x31b35c(0x142)](0x0,0xc8),'output':_0x29a4f3});return{'content':[{'type':_0x31b35c(0x120),'text':JSON['stringify'](_0xb52c74)}]};}if(_0x5ea47c==='commhub_report_status'){let {status:_0x3b638a,task:_0x54254d,progress:_0x13e545}=_0x3508c8,_0x52a1ef=await P(_0x31b35c(0x107),{'resume_id':w,'alias':Z,'status':_0x3b638a,'task':_0x54254d,'progress':_0x13e545});return{'content':[{'type':_0x31b35c(0x120),'text':JSON[_0x31b35c(0x119)](_0x52a1ef)}]};}if(_0x5ea47c==='commhub_send_task'){let {alias:_0x34ad58,task:_0x2e10ab,priority:_0x57ae2c}=_0x3508c8,_0xee8df5=await P(_0x31b35c(0x13c),{'alias':_0x34ad58,'task':_0x2e10ab,'priority':_0x57ae2c||_0x31b35c(0x12f),'from_session':Z});return{'content':[{'type':_0x31b35c(0x120),'text':JSON[_0x31b35c(0x119)](_0xee8df5)}]};}if(_0x5ea47c===_0x31b35c(0x167)){let {alias:_0x1e6e60,message:_0x34ce10}=_0x3508c8,_0x4c9253=await P(_0x31b35c(0x172),{'alias':_0x1e6e60,'message':_0x34ce10,'from_session':Z});return{'content':[{'type':_0x31b35c(0x120),'text':JSON['stringify'](_0x4c9253)}]};}if(_0x5ea47c===_0x31b35c(0x117)){let _0x166c3e=await P(_0x31b35c(0x158),{});return{'content':[{'type':_0x31b35c(0x120),'text':JSON[_0x31b35c(0x119)](_0x166c3e)}]};}return{'content':[{'type':_0x31b35c(0x120),'text':JSON[_0x31b35c(0x119)]({'error':_0x31b35c(0x137)})}]};});async function u(){const _0x4ab3c6=a0_0x590876;let _0x567ac2=f+_0x4ab3c6(0x170)+encodeURIComponent(Z),_0x4eee2e={};if(X)_0x4eee2e[_0x4ab3c6(0xf7)]='Bearer\x20'+X;Y(_0x4ab3c6(0x12e)+_0x567ac2);while(!0x0){try{let _0x104e37=await fetch(_0x567ac2,{'headers':_0x4eee2e});if(!_0x104e37['ok']){Y(_0x4ab3c6(0x11f)+_0x104e37[_0x4ab3c6(0x131)]+'\x20'+_0x104e37['statusText']),await h(0x1388);continue;}let _0x14b92b=_0x104e37['body'][_0x4ab3c6(0x141)](),_0x2a6a6c=new TextDecoder(),_0x24fc1a='';while(!0x0){let {done:_0x21faf0,value:_0x2c6d88}=await _0x14b92b[_0x4ab3c6(0x16d)]();if(_0x21faf0)break;_0x24fc1a+=_0x2a6a6c['decode'](_0x2c6d88,{'stream':!0x0});let _0x1f261f=_0x24fc1a[_0x4ab3c6(0x11c)]('\x0a\x0a');_0x24fc1a=_0x1f261f[_0x4ab3c6(0x139)]()||'';for(let _0x1d67e6 of _0x1f261f){let _0xd2b58b=_0x1d67e6[_0x4ab3c6(0x11c)]('\x0a')[_0x4ab3c6(0xff)](_0x2d9348=>_0x2d9348['startsWith'](_0x4ab3c6(0x112)));if(!_0xd2b58b)continue;try{let _0x4edf6b=JSON['parse'](_0xd2b58b[_0x4ab3c6(0x142)](0x6));await S(_0x4edf6b);}catch(_0xdb27e7){Y(_0x4ab3c6(0x106)+_0xdb27e7);}}}Y(_0x4ab3c6(0x10c));}catch(_0x15411f){Y('SSE\x20connection\x20error:\x20'+_0x15411f);}await h(0xbb8);}}async function S(_0x2d74b0){const _0x298d90=a0_0x590876;if(_0x2d74b0[_0x298d90(0x100)]==='connected'){Y(_0x298d90(0x136)+Z+'\x22');return;}if(_0x2d74b0[_0x298d90(0x100)]===_0x298d90(0x14a)){if(Y('←\x20message\x20from\x20'+_0x2d74b0[_0x298d90(0x155)]+':\x20'+_0x2d74b0[_0x298d90(0x153)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x298d90(0x151),'params':{'content':_0x2d74b0[_0x298d90(0x153)],'meta':{'sender':_0x2d74b0[_0x298d90(0x155)]||_0x298d90(0x166),'sender_id':'commhub','user':_0x2d74b0['from']||_0x298d90(0x166),'priority':_0x298d90(0x12f)}}}),_0x2d74b0[_0x298d90(0x15b)])await P(_0x298d90(0x16a),{'alias':Z,'message_id':_0x2d74b0[_0x298d90(0x15b)]});return;}if(_0x2d74b0['type']===_0x298d90(0xf3)||_0x2d74b0[_0x298d90(0x100)]==='broadcast'){Y('←\x20'+_0x2d74b0[_0x298d90(0x100)]+_0x298d90(0x113)+_0x2d74b0['inbox_count']+_0x298d90(0x11d)+(_0x2d74b0[_0x298d90(0x12a)]||_0x298d90(0x12f)));let _0x3453bf=await P(_0x298d90(0x179),{'alias':Z,'limit':0x5});if(_0x3453bf?.['ok']&&_0x3453bf[_0x298d90(0x163)]?.[_0x298d90(0x144)]>0x0)for(let _0x565cf5 of _0x3453bf[_0x298d90(0x163)]){let _0x35b4ab={'sender':_0x565cf5[_0x298d90(0x173)]||_0x298d90(0x166),'sender_id':_0x298d90(0x123),'user':_0x565cf5[_0x298d90(0x173)]||_0x298d90(0x166),'task_id':_0x565cf5['id'],'priority':_0x565cf5['priority']||_0x298d90(0x12f)};k['set'](_0x565cf5['id'],_0x565cf5[_0x298d90(0x173)]||_0x298d90(0x166)),await K[_0x298d90(0x108)]({'method':_0x298d90(0x151),'params':{'content':_0x565cf5['content'],'meta':_0x35b4ab}}),Y(_0x298d90(0x16e)+_0x565cf5['id'][_0x298d90(0x142)](0x0,0x8)+_0x298d90(0x121)+_0x565cf5[_0x298d90(0x173)]+':\x20'+_0x565cf5[_0x298d90(0xfe)][_0x298d90(0x142)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x565cf5['id']});}}}async function A(){const _0x1fe7f5=a0_0x590876;let _0x4f2c5a=new a0_0x69e475();await K[_0x1fe7f5(0x176)](_0x4f2c5a),Y(_0x1fe7f5(0xfa)),Y(_0x1fe7f5(0x178)),u()[_0x1fe7f5(0x161)](_0x411b44=>Y(_0x1fe7f5(0x143)+_0x411b44)),P(_0x1fe7f5(0x107),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x5df9a6(),'hostname':a0_0x5df9a6(),'agent':'claude-code','project_dir':process[_0x1fe7f5(0xf4)](),'tmux_name':j||void 0x0})[_0x1fe7f5(0x11a)](()=>Y(_0x1fe7f5(0x12b)+Z+'\x22\x20('+w[_0x1fe7f5(0x142)](0x0,0x8)+')'))['catch'](_0x2793e9=>Y('warning:\x20could\x20not\x20register:\x20'+_0x2793e9)),setInterval(()=>{const _0x26abce=_0x1fe7f5;P(_0x26abce(0x107),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x5df9a6(),'hostname':a0_0x5df9a6(),'agent':_0x26abce(0x13e),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x26abce(0x161)](_0x3d23f5=>Y(_0x26abce(0x157)+_0x3d23f5));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x590876(0x161)](_0x3bc93a=>{const _0x282ce6=a0_0x590876;Y('fatal:\x20'+_0x3bc93a),process[_0x282ce6(0x14f)](0x1);});async function N(){const _0x1cb17f=a0_0x590876;Y(_0x1cb17f(0xf0)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1cb17f(0x109),'task':_0x1cb17f(0x135)})[_0x1cb17f(0x161)](()=>{}),process[_0x1cb17f(0x14f)](0x0);}process[a0_0x590876(0x160)]['on'](a0_0x590876(0x15c),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x590876(0xed),()=>N());
|
|
2
|
+
const a0_0x2f6bfb=a0_0x35b7;function a0_0x35b7(_0x466ad3,_0x5565b8){_0x466ad3=_0x466ad3-0x1c1;const _0x1c28eb=a0_0x1c28();let _0x35b726=_0x1c28eb[_0x466ad3];return _0x35b726;}(function(_0x1a3bc2,_0x3c595c){const _0x536e14=a0_0x35b7,_0x2978f9=_0x1a3bc2();while(!![]){try{const _0x1ee6c4=parseInt(_0x536e14(0x1e4))/0x1*(-parseInt(_0x536e14(0x210))/0x2)+parseInt(_0x536e14(0x237))/0x3*(parseInt(_0x536e14(0x1d7))/0x4)+-parseInt(_0x536e14(0x21a))/0x5+-parseInt(_0x536e14(0x1e5))/0x6+-parseInt(_0x536e14(0x1fa))/0x7+-parseInt(_0x536e14(0x1cf))/0x8+parseInt(_0x536e14(0x23b))/0x9*(parseInt(_0x536e14(0x1d9))/0xa);if(_0x1ee6c4===_0x3c595c)break;else _0x2978f9['push'](_0x2978f9['shift']());}catch(_0x16c26c){_0x2978f9['push'](_0x2978f9['shift']());}}}(a0_0x1c28,0x94c4b));import{readFileSync as a0_0x527a3e,existsSync as a0_0x202abc}from'fs';import{randomUUID as a0_0x4d4210}from'crypto';import{join as a0_0x14515a}from'path';import{hostname as a0_0x17022b}from'os';import{execSync as a0_0x3fe4ff}from'child_process';function a0_0x1c28(){const _0x48df9d=['delete','3zRlBcS','1743606InFRGP','application/json,\x20text/event-stream','ENV:\x20URL=','commhub_report_status','commhub_reply','status','broadcast','←\x20message\x20from\x20','from','SIGINT','hub','decode','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Current\x20task\x20description','2.0','SSE\x20stream\x20ended,\x20reconnecting...','indexOf','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','alias','messages','commhub_get_all_status','1286621tCDGFE','result','number','write','Priority\x20(default:\x20normal)','notification','get_inbox','data:\x20','Bearer\x20','heartbeat\x20failed:\x20','catch','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','stringify','Reply\x20text\x20/\x20result\x20summary','config.json','failed','token','tmux\x20display-message\x20-p\x20\x27#S\x27','utf-8','0.3.0','then','commhub_send_message','164734eZFhEB','\x20PROJECT_ENV=','toTimeString','report_status','cwd','commhub','low','find','parse','\x20from\x20','5550045KawHHE','claude-code','blocked','SSE\x20fatal:\x20','SSE\x20connection\x20error:\x20','no\x20response','startsWith','in_progress','connected','getReader','SIGTERM','Message\x20content','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','cancelled','length','from_session','\x20RESUME_ID=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_send_task','http://127.0.0.1:9200','Task\x20content','content','pop','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','idle','.claude/channels/commhub','application/json','Target\x20session\x20alias','read','11127GGvmQo','replace','ready\x20—\x20waiting\x20for\x20events','object','7650nbJVmN','split','inbox_count','exit','send_reply','error','message','type','POST','2025-03-26','priority','.env','replied','\x22\x20(','Session\x20alias:\x20','slice','setRequestHandler','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','text','notifications/claude/channel','registered\x20as\x20\x22','string','statusText','completed','1493608DcAUeh','connect','join','body','→\x20injected\x20task\x20','init\x20failed:\x20','ack_inbox','unknown\x20tool','520HlnVgQ','get','25240yPAQCy','stderr','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','fatal:\x20','message_id','trim','SSE\x20connected\x20as\x20\x22','normal'];a0_0x1c28=function(){return _0x48df9d;};return a0_0x1c28();}import{Server as a0_0x21afd9}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x2d5b29}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x52dd7a,CallToolRequestSchema as a0_0x20a545}from'@modelcontextprotocol/sdk/types.js';function p(_0x59fd06){const _0x15a5f5=a0_0x35b7;if(!a0_0x202abc(_0x59fd06))return;for(let _0x209ea5 of a0_0x527a3e(_0x59fd06,_0x15a5f5(0x20c))['split']('\x0a')){let _0x423564=_0x209ea5[_0x15a5f5(0x1e0)]();if(!_0x423564||_0x423564[_0x15a5f5(0x220)]('#'))continue;let _0x266907=_0x423564[_0x15a5f5(0x1f5)]('=');if(_0x266907<0x0)continue;let _0x1adfde=_0x423564[_0x15a5f5(0x1c6)](0x0,_0x266907)[_0x15a5f5(0x1e0)](),_0x4e8f6c=_0x423564['slice'](_0x266907+0x1)[_0x15a5f5(0x1e0)]()[_0x15a5f5(0x238)](/^["']|["']$/g,'');if(!process.env[_0x1adfde])process.env[_0x1adfde]=_0x4e8f6c;}}var C=process.env.HOME||'~',T=a0_0x14515a(C,a0_0x2f6bfb(0x233));p(a0_0x14515a(T,a0_0x2f6bfb(0x1c2)));var L=process[a0_0x2f6bfb(0x214)]()[a0_0x2f6bfb(0x238)](/\//g,'-');p(a0_0x14515a(T,L,a0_0x2f6bfb(0x1c2)));function U(){const _0x2e5e6f=a0_0x2f6bfb;try{return a0_0x3fe4ff(_0x2e5e6f(0x20b),{'encoding':_0x2e5e6f(0x20c),'timeout':0x7d0})[_0x2e5e6f(0x1e0)]();}catch{return'';}}function v(){const _0x1475c7=a0_0x2f6bfb;try{let _0x4ee6ee=a0_0x14515a(C,'.anet',_0x1475c7(0x208));if(a0_0x202abc(_0x4ee6ee))return JSON[_0x1475c7(0x218)](a0_0x527a3e(_0x4ee6ee,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x2f6bfb(0x1ef)]||a0_0x2f6bfb(0x22d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x17022b(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x4d4210(),X=process.env.COMMHUB_TOKEN||H[a0_0x2f6bfb(0x20a)]||'';function Y(_0x1e065a){const _0x13250f=a0_0x2f6bfb;let _0x254ecf=new Date()[_0x13250f(0x212)]()[_0x13250f(0x1c6)](0x0,0x8);process[_0x13250f(0x1da)][_0x13250f(0x1fd)]('['+_0x254ecf+']\x20[commhub]\x20'+_0x1e065a+'\x0a');}function h(_0x2373de){return new Promise(_0x4a7f8f=>setTimeout(_0x4a7f8f,_0x2373de));}Y(a0_0x2f6bfb(0x1e7)+f+'\x20ALIAS='+Z+a0_0x2f6bfb(0x22a)+w[a0_0x2f6bfb(0x1c6)](0x0,0x8)+'...\x20TMUX='+(j||'none')+'\x20CWD='+process[a0_0x2f6bfb(0x214)]()+a0_0x2f6bfb(0x211)+L);var k=new Map(),K=new a0_0x21afd9({'name':'commhub-channel','version':a0_0x2f6bfb(0x20d)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2f6bfb(0x1dc),a0_0x2f6bfb(0x1f6),a0_0x2f6bfb(0x226),a0_0x2f6bfb(0x1f1),a0_0x2f6bfb(0x1c5)+Z][a0_0x2f6bfb(0x1d1)]('\x0a')});K[a0_0x2f6bfb(0x1c7)](a0_0x52dd7a,async()=>({'tools':[{'name':a0_0x2f6bfb(0x1e9),'description':a0_0x2f6bfb(0x205),'inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'task_id':{'type':'string','description':a0_0x2f6bfb(0x22b)},'text':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x207)},'status':{'type':a0_0x2f6bfb(0x1cc),'enum':['completed','failed','cancelled','blocked','error',a0_0x2f6bfb(0x221)],'description':a0_0x2f6bfb(0x1c8)}},'required':[a0_0x2f6bfb(0x1c9)]}},{'name':a0_0x2f6bfb(0x1e8),'description':a0_0x2f6bfb(0x1db),'inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'status':{'type':a0_0x2f6bfb(0x1cc),'enum':['working','idle',a0_0x2f6bfb(0x21c),a0_0x2f6bfb(0x240)]},'task':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x1f2)},'progress':{'type':a0_0x2f6bfb(0x1fc),'description':'Progress\x200-100'}},'required':[a0_0x2f6bfb(0x1ea)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'alias':{'type':'string','description':a0_0x2f6bfb(0x235)},'task':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x22e)},'priority':{'type':a0_0x2f6bfb(0x1cc),'enum':['high',a0_0x2f6bfb(0x1e2),a0_0x2f6bfb(0x216)],'description':a0_0x2f6bfb(0x1fe)}},'required':[a0_0x2f6bfb(0x1f7),'task']}},{'name':a0_0x2f6bfb(0x20f),'description':a0_0x2f6bfb(0x231),'inputSchema':{'type':a0_0x2f6bfb(0x23a),'properties':{'alias':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x235)},'message':{'type':a0_0x2f6bfb(0x1cc),'description':a0_0x2f6bfb(0x225)}},'required':[a0_0x2f6bfb(0x1f7),a0_0x2f6bfb(0x241)]}},{'name':'commhub_get_all_status','description':a0_0x2f6bfb(0x1dd),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0xe3f579,_0x48fe73){const _0x38a507=a0_0x2f6bfb;let _0x20d338=await fetch(f+'/mcp',{'method':'POST','headers':{'Content-Type':_0x38a507(0x234),'Accept':_0x38a507(0x1e6),...X?{'Authorization':_0x38a507(0x202)+X}:{}},'body':JSON[_0x38a507(0x206)]({'jsonrpc':_0x38a507(0x1f3),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x38a507(0x244),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x38a507(0x20d)}}})});if(!_0x20d338['ok']){let _0x28d97e=await _0x20d338[_0x38a507(0x1c9)]();return Y('CommHub\x20init\x20failed:\x20'+_0x20d338[_0x38a507(0x1ea)]+'\x20'+_0x28d97e[_0x38a507(0x1c6)](0x0,0x64)),{'ok':!0x1,'error':_0x38a507(0x1d4)+_0x20d338['status']};}await _0x20d338['text']();let _0x34d34b=(await(await fetch(f+'/mcp',{'method':_0x38a507(0x243),'headers':{'Content-Type':_0x38a507(0x234),'Accept':_0x38a507(0x1e6),...X?{'Authorization':_0x38a507(0x202)+X}:{}},'body':JSON[_0x38a507(0x206)]({'jsonrpc':_0x38a507(0x1f3),'id':0x2,'method':'tools/call','params':{'name':_0xe3f579,'arguments':_0x48fe73}})}))[_0x38a507(0x1c9)]())[_0x38a507(0x23c)]('\x0a')[_0x38a507(0x217)](_0x5e0a8e=>_0x5e0a8e[_0x38a507(0x220)](_0x38a507(0x201)));if(_0x34d34b){let _0x151c1f=JSON[_0x38a507(0x218)](_0x34d34b[_0x38a507(0x1c6)](0x6));return _0x151c1f?.[_0x38a507(0x1fb)]?.[_0x38a507(0x22f)]?.[0x0]?.[_0x38a507(0x1c9)]?JSON[_0x38a507(0x218)](_0x151c1f[_0x38a507(0x1fb)]['content'][0x0][_0x38a507(0x1c9)]):_0x151c1f;}return{'ok':!0x1,'error':_0x38a507(0x21f)};}K[a0_0x2f6bfb(0x1c7)](a0_0x20a545,async _0x47b6cb=>{const _0x2e2c33=a0_0x2f6bfb;let {name:_0x650a4b,arguments:_0xfc4a53}=_0x47b6cb['params'];if(_0x650a4b==='commhub_reply'){let {task_id:_0x9f1dfd,text:_0x303a6e,status:_0x23a726}=_0xfc4a53;if(_0x23a726===_0x2e2c33(0x1ce)||_0x23a726===_0x2e2c33(0x209)||_0x23a726===_0x2e2c33(0x227)){let _0x2022e7=_0x23a726==='completed'?_0x2e2c33(0x1c3):_0x23a726,_0x37cd00=_0x9f1dfd?k[_0x2e2c33(0x1d8)](_0x9f1dfd)||'hub':'hub',_0xab4bb8=await P(_0x2e2c33(0x23f),{'alias':_0x37cd00,'text':_0x303a6e,'in_reply_to':_0x9f1dfd||void 0x0,'status':_0x2022e7,'from_session':Z});if(_0x9f1dfd)k[_0x2e2c33(0x1e3)](_0x9f1dfd);return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON[_0x2e2c33(0x206)](_0xab4bb8)}]};}let _0x1faa44=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x23a726==='blocked'?'blocked':_0x23a726===_0x2e2c33(0x240)?_0x2e2c33(0x240):'working','task':_0x303a6e[_0x2e2c33(0x1c6)](0x0,0xc8),'output':_0x303a6e});return{'content':[{'type':'text','text':JSON[_0x2e2c33(0x206)](_0x1faa44)}]};}if(_0x650a4b===_0x2e2c33(0x1e8)){let {status:_0x16ceeb,task:_0x54ec90,progress:_0x779809}=_0xfc4a53,_0x5e0b1f=await P(_0x2e2c33(0x213),{'resume_id':w,'alias':Z,'status':_0x16ceeb,'task':_0x54ec90,'progress':_0x779809});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON[_0x2e2c33(0x206)](_0x5e0b1f)}]};}if(_0x650a4b===_0x2e2c33(0x22c)){let {alias:_0x425fc8,task:_0x530feb,priority:_0x4f0c56}=_0xfc4a53,_0x5085e8=await P('send_task',{'alias':_0x425fc8,'task':_0x530feb,'priority':_0x4f0c56||'normal','from_session':Z});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON[_0x2e2c33(0x206)](_0x5085e8)}]};}if(_0x650a4b===_0x2e2c33(0x20f)){let {alias:_0xce30b8,message:_0x182479}=_0xfc4a53,_0x3ed6d7=await P('send_message',{'alias':_0xce30b8,'message':_0x182479,'from_session':Z});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON['stringify'](_0x3ed6d7)}]};}if(_0x650a4b===_0x2e2c33(0x1f9)){let _0x399410=await P('get_all_status',{});return{'content':[{'type':_0x2e2c33(0x1c9),'text':JSON['stringify'](_0x399410)}]};}return{'content':[{'type':'text','text':JSON[_0x2e2c33(0x206)]({'error':_0x2e2c33(0x1d6)})}]};});async function u(){const _0x2d68d4=a0_0x2f6bfb;let _0x1fe77d=f+'/events/'+encodeURIComponent(Z),_0x44531c={};if(X)_0x44531c['Authorization']=_0x2d68d4(0x202)+X;Y('connecting\x20to\x20'+_0x1fe77d);while(!0x0){try{let _0x41c01d=await fetch(_0x1fe77d,{'headers':_0x44531c});if(!_0x41c01d['ok']){Y('SSE\x20error:\x20'+_0x41c01d[_0x2d68d4(0x1ea)]+'\x20'+_0x41c01d[_0x2d68d4(0x1cd)]),await h(0x1388);continue;}let _0x1e8f99=_0x41c01d[_0x2d68d4(0x1d2)][_0x2d68d4(0x223)](),_0x7fa0b4=new TextDecoder(),_0x11b9da='';while(!0x0){let {done:_0x31d382,value:_0x483cba}=await _0x1e8f99[_0x2d68d4(0x236)]();if(_0x31d382)break;_0x11b9da+=_0x7fa0b4[_0x2d68d4(0x1f0)](_0x483cba,{'stream':!0x0});let _0x2d92db=_0x11b9da[_0x2d68d4(0x23c)]('\x0a\x0a');_0x11b9da=_0x2d92db[_0x2d68d4(0x230)]()||'';for(let _0x22cb98 of _0x2d92db){let _0x386c28=_0x22cb98[_0x2d68d4(0x23c)]('\x0a')[_0x2d68d4(0x217)](_0x1c916b=>_0x1c916b[_0x2d68d4(0x220)](_0x2d68d4(0x201)));if(!_0x386c28)continue;try{let _0x47bb34=JSON[_0x2d68d4(0x218)](_0x386c28[_0x2d68d4(0x1c6)](0x6));await S(_0x47bb34);}catch(_0x20c1f2){Y('parse\x20error:\x20'+_0x20c1f2);}}}Y(_0x2d68d4(0x1f4));}catch(_0xc49142){Y(_0x2d68d4(0x21e)+_0xc49142);}await h(0xbb8);}}async function S(_0x388891){const _0x49c6cb=a0_0x2f6bfb;if(_0x388891[_0x49c6cb(0x242)]===_0x49c6cb(0x222)){Y(_0x49c6cb(0x1e1)+Z+'\x22');return;}if(_0x388891[_0x49c6cb(0x242)]==='new_message'){if(Y(_0x49c6cb(0x1ec)+_0x388891[_0x49c6cb(0x1ed)]+':\x20'+_0x388891[_0x49c6cb(0x241)]['slice'](0x0,0x3c)),await K[_0x49c6cb(0x1ff)]({'method':_0x49c6cb(0x1ca),'params':{'content':_0x388891[_0x49c6cb(0x241)],'meta':{'sender':_0x388891[_0x49c6cb(0x1ed)]||_0x49c6cb(0x1ef),'sender_id':_0x49c6cb(0x215),'user':_0x388891[_0x49c6cb(0x1ed)]||'hub','priority':_0x49c6cb(0x1e2)}}}),_0x388891['message_id'])await P(_0x49c6cb(0x1d5),{'alias':Z,'message_id':_0x388891[_0x49c6cb(0x1df)]});return;}if(_0x388891[_0x49c6cb(0x242)]==='new_task'||_0x388891[_0x49c6cb(0x242)]===_0x49c6cb(0x1eb)){Y('←\x20'+_0x388891[_0x49c6cb(0x242)]+':\x20inbox_count='+_0x388891[_0x49c6cb(0x23d)]+'\x20priority='+(_0x388891['priority']||_0x49c6cb(0x1e2)));let _0x373617=await P(_0x49c6cb(0x200),{'alias':Z,'limit':0x5});if(_0x373617?.['ok']&&_0x373617[_0x49c6cb(0x1f8)]?.[_0x49c6cb(0x228)]>0x0)for(let _0x56bfb0 of _0x373617[_0x49c6cb(0x1f8)]){let _0x23eaaa={'sender':_0x56bfb0[_0x49c6cb(0x229)]||_0x49c6cb(0x1ef),'sender_id':_0x49c6cb(0x215),'user':_0x56bfb0[_0x49c6cb(0x229)]||_0x49c6cb(0x1ef),'task_id':_0x56bfb0['id'],'priority':_0x56bfb0[_0x49c6cb(0x1c1)]||_0x49c6cb(0x1e2)};k['set'](_0x56bfb0['id'],_0x56bfb0[_0x49c6cb(0x229)]||_0x49c6cb(0x1ef)),await K[_0x49c6cb(0x1ff)]({'method':_0x49c6cb(0x1ca),'params':{'content':_0x56bfb0['content'],'meta':_0x23eaaa}}),Y(_0x49c6cb(0x1d3)+_0x56bfb0['id']['slice'](0x0,0x8)+_0x49c6cb(0x219)+_0x56bfb0['from_session']+':\x20'+_0x56bfb0[_0x49c6cb(0x22f)][_0x49c6cb(0x1c6)](0x0,0x3c)),await P(_0x49c6cb(0x1d5),{'alias':Z,'message_id':_0x56bfb0['id']});}}}async function A(){const _0x2bff8e=a0_0x2f6bfb;let _0xcfeda7=new a0_0x2d5b29();await K[_0x2bff8e(0x1d0)](_0xcfeda7),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()[_0x2bff8e(0x204)](_0x4a8dec=>Y(_0x2bff8e(0x21d)+_0x4a8dec)),P(_0x2bff8e(0x213),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x17022b(),'hostname':a0_0x17022b(),'agent':_0x2bff8e(0x21b),'project_dir':process[_0x2bff8e(0x214)](),'tmux_name':j||void 0x0})[_0x2bff8e(0x20e)](()=>Y(_0x2bff8e(0x1cb)+Z+_0x2bff8e(0x1c4)+w['slice'](0x0,0x8)+')'))['catch'](_0x2dc215=>Y('warning:\x20could\x20not\x20register:\x20'+_0x2dc215)),setInterval(()=>{const _0x22e937=_0x2bff8e;P('report_status',{'resume_id':w,'alias':Z,'status':_0x22e937(0x232),'server':a0_0x17022b(),'hostname':a0_0x17022b(),'agent':_0x22e937(0x21b),'project_dir':process[_0x22e937(0x214)](),'tmux_name':j||void 0x0})['catch'](_0x55225b=>Y(_0x22e937(0x203)+_0x55225b));},0x2bf20),Y(_0x2bff8e(0x239));}A()['catch'](_0x4e9e88=>{const _0x5655c9=a0_0x2f6bfb;Y(_0x5655c9(0x1de)+_0x4e9e88),process[_0x5655c9(0x23e)](0x1);});async function N(){const _0x4f555e=a0_0x2f6bfb;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4f555e(0x240),'task':'session\x20disconnected'})['catch'](()=>{}),process[_0x4f555e(0x23e)](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x2f6bfb(0x224),()=>N()),process['on'](a0_0x2f6bfb(0x1ee),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.3-preview.
|
|
3
|
+
"version": "2.1.3-preview.1",
|
|
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",
|