@sleep2agi/agent-network 2.1.9 → 2.1.10-preview.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x22272=a0_0x19d2;function a0_0x19d2(_0x44cde8,_0x3fe16c){_0x44cde8=_0x44cde8-0x1d6;const _0x449792=a0_0x4497();let _0x19d2dc=_0x449792[_0x44cde8];return _0x19d2dc;}(function(_0xd9066a,_0x5cb6a2){const _0x50def6=a0_0x19d2,_0x3f26b4=_0xd9066a();while(!![]){try{const _0x2f6917=-parseInt(_0x50def6(0x1d8))/0x1+parseInt(_0x50def6(0x1e6))/0x2+parseInt(_0x50def6(0x21b))/0x3*(parseInt(_0x50def6(0x22d))/0x4)+-parseInt(_0x50def6(0x1f2))/0x5*(parseInt(_0x50def6(0x22b))/0x6)+-parseInt(_0x50def6(0x227))/0x7+parseInt(_0x50def6(0x209))/0x8+parseInt(_0x50def6(0x1f5))/0x9*(parseInt(_0x50def6(0x1f4))/0xa);if(_0x2f6917===_0x5cb6a2)break;else _0x3f26b4['push'](_0x3f26b4['shift']());}catch(_0x317861){_0x3f26b4['push'](_0x3f26b4['shift']());}}}(a0_0x4497,0x403a1));import{EventEmitter as a0_0x649004}from'events';import{hostname as a0_0x46c1d1}from'os';class T extends a0_0x649004{[a0_0x22272(0x1e4)];[a0_0x22272(0x1ff)];[a0_0x22272(0x208)];['agent'];['resumeId'];['heartbeatInterval'];[a0_0x22272(0x22c)];[a0_0x22272(0x1ea)];['sseAbort'];['running']=!0x1;constructor(_0x5b3aa5){const _0x423b11=a0_0x22272;super();if(this[_0x423b11(0x1e4)]=_0x5b3aa5['url'][_0x423b11(0x211)](/\/$/,''),this[_0x423b11(0x1ff)]=_0x5b3aa5[_0x423b11(0x1ff)],this[_0x423b11(0x208)]=_0x5b3aa5[_0x423b11(0x208)],this['agent']=_0x5b3aa5[_0x423b11(0x1e9)]||_0x423b11(0x231),this[_0x423b11(0x1f6)]=_0x423b11(0x213)+_0x5b3aa5[_0x423b11(0x1ff)]+'-'+Date[_0x423b11(0x229)]()[_0x423b11(0x203)](0x24),this[_0x423b11(0x1dc)]=_0x5b3aa5[_0x423b11(0x1dc)]??0x2bf20,this[_0x423b11(0x22c)]=_0x5b3aa5['reconnectDelay']??0xbb8,_0x5b3aa5[_0x423b11(0x232)]!==!0x1)this['connect']();}['log'](_0x4d0dcf){const _0x13d3ae=a0_0x22272;console[_0x13d3ae(0x21f)]('['+new Date()[_0x13d3ae(0x223)]()[_0x13d3ae(0x1e7)](0x0,0x8)+']\x20[commhub:'+this[_0x13d3ae(0x1ff)]+']\x20'+_0x4d0dcf);}async['call'](_0x37c6dc,_0x21543d){const _0x38077c=a0_0x22272;let _0x32f7d1={'Content-Type':_0x38077c(0x22f),'Accept':_0x38077c(0x220)};if(this[_0x38077c(0x208)])_0x32f7d1['Authorization']=_0x38077c(0x226)+this['token'];let _0x162daf=await(await fetch(this['url']+'/mcp',{'method':_0x38077c(0x200),'headers':_0x32f7d1,'body':JSON[_0x38077c(0x1e0)]({'jsonrpc':_0x38077c(0x1f8),'id':Date[_0x38077c(0x229)](),'method':_0x38077c(0x205),'params':{'name':_0x37c6dc,'arguments':_0x21543d}})}))['text'](),_0xb80e61=_0x162daf[_0x38077c(0x233)](/data: (.+)/),_0x326c58=_0xb80e61?JSON[_0x38077c(0x1fe)](_0xb80e61[0x1]):JSON[_0x38077c(0x1fe)](_0x162daf),_0x1da9d9=_0x326c58?.[_0x38077c(0x1ec)]?.[_0x38077c(0x1f0)]?.[0x0]?.[_0x38077c(0x1ed)];return _0x1da9d9?JSON[_0x38077c(0x1fe)](_0x1da9d9):_0x326c58;}async['connect'](){const _0x4f1c3f=a0_0x22272;if(this[_0x4f1c3f(0x218)])return;this['running']=!0x0,await this['status'](_0x4f1c3f(0x20b)),this[_0x4f1c3f(0x21f)](_0x4f1c3f(0x214)),this[_0x4f1c3f(0x1ea)]=setInterval(()=>{const _0x202e8f=_0x4f1c3f;this[_0x202e8f(0x1fd)](_0x202e8f(0x20b))[_0x202e8f(0x225)](_0x535872=>this[_0x202e8f(0x21f)](_0x202e8f(0x230)+_0x535872['message']));},this[_0x4f1c3f(0x1dc)]),this[_0x4f1c3f(0x22e)]();}async[a0_0x22272(0x210)](){const _0x23c974=a0_0x22272;if(this[_0x23c974(0x218)]=!0x1,this['sseAbort']?.[_0x23c974(0x1df)](),this[_0x23c974(0x1ea)])clearInterval(this['heartbeatTimer']);await this[_0x23c974(0x1fd)](_0x23c974(0x228))['catch'](()=>{}),this[_0x23c974(0x21f)](_0x23c974(0x1fc));}async[a0_0x22272(0x1fb)](_0xfec47e,_0x4b7b3a,_0x2033bd=a0_0x22272(0x20f)){const _0x4bb089=a0_0x22272;return this[_0x4bb089(0x1e3)](_0x4bb089(0x221),{'alias':_0xfec47e,'task':_0x4b7b3a,'priority':_0x2033bd,'from_session':this[_0x4bb089(0x1ff)]});}async[a0_0x22272(0x201)](_0x3867f1,_0x2528d9){const _0x48da1d=a0_0x22272;return this[_0x48da1d(0x1e3)](_0x48da1d(0x21c),{'alias':_0x3867f1,'message':_0x2528d9,'from_session':this[_0x48da1d(0x1ff)]});}async[a0_0x22272(0x222)](_0x3a7e6a,_0x3a83f2,_0x2bd182=a0_0x22272(0x1f7)){const _0x334243=a0_0x22272;return this['call'](_0x334243(0x1d6),{'in_reply_to':_0x3a7e6a,'text':_0x3a83f2,'status':_0x2bd182});}async[a0_0x22272(0x1fd)](_0x3e3e99,_0x4d4474){const _0x116b70=a0_0x22272;return this[_0x116b70(0x1e3)](_0x116b70(0x21e),{'resume_id':this['resumeId'],'alias':this[_0x116b70(0x1ff)],'status':_0x3e3e99,'server':a0_0x46c1d1(),'hostname':a0_0x46c1d1(),'agent':this['agent'],'project_dir':process[_0x116b70(0x1f9)](),..._0x4d4474});}async[a0_0x22272(0x207)](){const _0x541197=a0_0x22272;return this[_0x541197(0x1e3)](_0x541197(0x20c),{});}async['broadcast'](_0x5282c5,_0x39d26e){const _0x376277=a0_0x22272;return this[_0x376277(0x1e3)](_0x376277(0x1ef),{'message':_0x5282c5,'filter_server':_0x39d26e?.[_0x376277(0x1e5)],'filter_status':_0x39d26e?.[_0x376277(0x1fd)]});}async[a0_0x22272(0x22e)](){const _0x1cd463=a0_0x22272;let _0x528b2c=encodeURIComponent(this[_0x1cd463(0x1ff)]),_0xdda0a8=this[_0x1cd463(0x1e4)]+_0x1cd463(0x1e2)+_0x528b2c,_0x16da15=this[_0x1cd463(0x22c)];while(this[_0x1cd463(0x218)]){try{this[_0x1cd463(0x22a)]=new AbortController();let _0x44d814={'Accept':_0x1cd463(0x215)};if(this['token'])_0x44d814[_0x1cd463(0x1db)]='Bearer\x20'+this['token'];let _0x476f6b=await fetch(_0xdda0a8,{'headers':_0x44d814,'signal':this[_0x1cd463(0x22a)][_0x1cd463(0x20e)]});if(!_0x476f6b['ok']||!_0x476f6b['body']){this[_0x1cd463(0x21f)](_0x1cd463(0x216)+_0x476f6b[_0x1cd463(0x1fd)]),await this[_0x1cd463(0x20d)](_0x16da15),_0x16da15=Math[_0x1cd463(0x1fa)](_0x16da15*1.5,0xea60);continue;}_0x16da15=this[_0x1cd463(0x22c)];let _0x10d115=_0x476f6b[_0x1cd463(0x21d)][_0x1cd463(0x1dd)](),_0x8834f8=new TextDecoder(),_0x19f105='';while(this['running']){let {done:_0x559110,value:_0xff483e}=await _0x10d115[_0x1cd463(0x1f1)]();if(_0x559110)break;_0x19f105+=_0x8834f8[_0x1cd463(0x1da)](_0xff483e,{'stream':!0x0});let _0x29aaeb=_0x19f105[_0x1cd463(0x206)]('\x0a');_0x19f105=_0x29aaeb[_0x1cd463(0x1e1)]()||'';for(let _0x4dd055 of _0x29aaeb){if(!_0x4dd055[_0x1cd463(0x202)](_0x1cd463(0x1d7)))continue;try{let _0x12e54f=JSON[_0x1cd463(0x1fe)](_0x4dd055[_0x1cd463(0x1e7)](0x6));if(_0x12e54f['type']==='connected'){this[_0x1cd463(0x21f)](_0x1cd463(0x1e8)),this[_0x1cd463(0x21a)](_0x1cd463(0x20a));continue;}if(_0x12e54f[_0x1cd463(0x1de)]===_0x1cd463(0x204)||_0x12e54f['type']==='new_message'||_0x12e54f[_0x1cd463(0x1de)]===_0x1cd463(0x1ef))await this['processInbox']();}catch{}}}}catch(_0x3010f2){if(_0x3010f2[_0x1cd463(0x1eb)]==='AbortError')break;this['emit'](_0x1cd463(0x224),_0x3010f2),this[_0x1cd463(0x21f)]('SSE\x20error:\x20'+_0x3010f2[_0x1cd463(0x201)]);}if(this[_0x1cd463(0x218)])this[_0x1cd463(0x21a)](_0x1cd463(0x1fc)),this['log']('SSE\x20reconnecting\x20in\x20'+_0x16da15/0x3e8+'s...'),await this['sleep'](_0x16da15),_0x16da15=Math[_0x1cd463(0x1fa)](_0x16da15*1.5,0xea60);}}async[a0_0x22272(0x1f3)](){const _0x533761=a0_0x22272;try{let _0xdcb018=(await this[_0x533761(0x1e3)](_0x533761(0x212),{'alias':this['alias'],'limit':0xa}))?.[_0x533761(0x219)]||[];for(let _0xbf9ca0 of _0xdcb018)await this[_0x533761(0x1e3)](_0x533761(0x1ee),{'alias':this[_0x533761(0x1ff)],'message_id':_0xbf9ca0['id']}),this[_0x533761(0x21f)]('←\x20'+_0xbf9ca0[_0x533761(0x1d9)]+':\x20'+_0xbf9ca0[_0x533761(0x1f0)][_0x533761(0x1e7)](0x0,0x3c)),this[_0x533761(0x21a)](_0x533761(0x217),_0xbf9ca0),this[_0x533761(0x21a)](_0x533761(0x201),_0xbf9ca0);}catch(_0x694c82){this['log']('inbox\x20error:\x20'+_0x694c82[_0x533761(0x201)]);}}[a0_0x22272(0x20d)](_0x25a416){return new Promise(_0x51a20e=>setTimeout(_0x51a20e,_0x25a416));}}var $=T;export{$ as default,T as CommHub};function a0_0x4497(){const _0x49f37a=['body','report_status','log','application/json,\x20text/event-stream','send_task','reply','toTimeString','error','catch','Bearer\x20','2356662fbCldr','offline','now','sseAbort','66IjQWYn','reconnectDelay','364AFZWeT','connectSSE','application/json','heartbeat\x20failed:\x20','sdk','autoConnect','match','send_reply','data:\x20','351375ndLqmC','from_session','decode','Authorization','heartbeatInterval','getReader','type','abort','stringify','pop','/events/','call','url','server','907694TxwICs','slice','SSE\x20connected','agent','heartbeatTimer','name','result','text','ack_inbox','broadcast','content','read','138680ZgqSpp','processInbox','74220cqgLGE','549TxAKwK','resumeId','completed','2.0','cwd','min','send','disconnected','status','parse','alias','POST','message','startsWith','toString','new_task','tools/call','split','getAllStatus','token','421504tPzbjm','connected','idle','get_all_status','sleep','signal','normal','disconnect','replace','get_inbox','sdk-','registered','text/event-stream','SSE\x20failed:\x20','task','running','messages','emit','9789ilzKqH','send_message'];a0_0x4497=function(){return _0x49f37a;};return a0_0x4497();}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0xbe730c=a0_0x648b;(function(_0x18a0f6,_0x457523){const _0x515177=a0_0x648b,_0x3bae61=_0x18a0f6();while(!![]){try{const _0x3a8290=-parseInt(_0x515177(0x13b))/0x1+parseInt(_0x515177(0x127))/0x2+parseInt(_0x515177(0x184))/0x3*(parseInt(_0x515177(0x13d))/0x4)+-parseInt(_0x515177(0x115))/0x5+parseInt(_0x515177(0x132))/0x6*(-parseInt(_0x515177(0x12c))/0x7)+-parseInt(_0x515177(0x146))/0x8*(-parseInt(_0x515177(0x19e))/0x9)+parseInt(_0x515177(0x123))/0xa*(parseInt(_0x515177(0x181))/0xb);if(_0x3a8290===_0x457523)break;else _0x3bae61['push'](_0x3bae61['shift']());}catch(_0x6528f5){_0x3bae61['push'](_0x3bae61['shift']());}}}(a0_0x2470,0x84522));import{readFileSync as a0_0x321d9c,existsSync as a0_0x10f767}from'fs';import{randomUUID as a0_0x120571}from'crypto';import{join as a0_0xfd789c}from'path';import{hostname as a0_0x185e2f}from'os';import{execSync as a0_0x4b6388}from'child_process';import{Server as a0_0x3e6ef2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x14707b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2ed2f7,CallToolRequestSchema as a0_0x89ef28}from'@modelcontextprotocol/sdk/types.js';function p(_0x31c114){const _0x58385e=a0_0x648b;if(!a0_0x10f767(_0x31c114))return;for(let _0x2859f0 of a0_0x321d9c(_0x31c114,'utf-8')['split']('\x0a')){let _0x2272e9=_0x2859f0[_0x58385e(0x16f)]();if(!_0x2272e9||_0x2272e9[_0x58385e(0x13e)]('#'))continue;let _0x22b478=_0x2272e9[_0x58385e(0x151)]('=');if(_0x22b478<0x0)continue;let _0x4ebb79=_0x2272e9[_0x58385e(0x197)](0x0,_0x22b478)['trim'](),_0x1b9e57=_0x2272e9[_0x58385e(0x197)](_0x22b478+0x1)[_0x58385e(0x16f)]()[_0x58385e(0x133)](/^["']|["']$/g,'');if(!process.env[_0x4ebb79])process.env[_0x4ebb79]=_0x1b9e57;}}var C=process.env.HOME||'~',T=a0_0xfd789c(C,'.claude/channels/commhub');p(a0_0xfd789c(T,a0_0xbe730c(0x14c)));var L=process[a0_0xbe730c(0x141)]()[a0_0xbe730c(0x133)](/\//g,'-');p(a0_0xfd789c(T,L,'.env'));function U(){const _0x3fb68d=a0_0xbe730c;try{return a0_0x4b6388(_0x3fb68d(0x14a),{'encoding':_0x3fb68d(0x131),'timeout':0x7d0})[_0x3fb68d(0x16f)]();}catch{return'';}}function v(){const _0x25f3b5=a0_0xbe730c;try{let _0x20c762=a0_0xfd789c(C,_0x25f3b5(0x143),_0x25f3b5(0x17e));if(a0_0x10f767(_0x20c762))return JSON[_0x25f3b5(0x19f)](a0_0x321d9c(_0x20c762,_0x25f3b5(0x131)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0xbe730c(0x16e)]||a0_0xbe730c(0x158),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x185e2f(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x120571(),X=process.env.COMMHUB_TOKEN||H[a0_0xbe730c(0x1a0)]||'';function Y(_0x3ca8ef){const _0x27a0ae=a0_0xbe730c;let _0x572f49=new Date()[_0x27a0ae(0x150)]()[_0x27a0ae(0x197)](0x0,0x8);process[_0x27a0ae(0x183)][_0x27a0ae(0x130)]('['+_0x572f49+_0x27a0ae(0x162)+_0x3ca8ef+'\x0a');}function h(_0x33d5db){return new Promise(_0x277639=>setTimeout(_0x277639,_0x33d5db));}Y('ENV:\x20URL='+f+a0_0xbe730c(0x16c)+Z+a0_0xbe730c(0x12a)+w[a0_0xbe730c(0x197)](0x0,0x8)+a0_0xbe730c(0x194)+(j||a0_0xbe730c(0x163))+a0_0xbe730c(0x14e)+process[a0_0xbe730c(0x141)]()+a0_0xbe730c(0x12b)+L);function a0_0x2470(){const _0x2dbb06=['decode','send_task','read','...\x20TMUX=','get','completed','slice','notification','delete','notifications/claude/channel','params','exit','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','18etACVR','parse','token','heartbeat\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','5388125OfjrHv','blocked','new_task','stringify','error','2.0','join','task','object','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x22\x20(','message','←\x20message\x20from\x20','70GoAGrM','find','init\x20failed:\x20','/mcp','172378XRVTrd','pop','priority','\x20RESUME_ID=','\x20PROJECT_ENV=','490014gnQcJF','body','starting\x20SSE\x20listener...','send_message','write','utf-8','48uPwhFq','replace','→\x20injected\x20task\x20','end','commhub_reply','application/json,\x20text/event-stream','result','broadcast','commhub_send_message','231152DATemL','connect','132XxdPue','startsWith','low','commhub_get_all_status','cwd','/events/','.anet','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',':\x20inbox_count=','2102408ZzZNdQ','in_progress','connected','ack_inbox','tmux\x20display-message\x20-p\x20\x27#S\x27','string','.env','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','\x20CWD=','number','toTimeString','indexOf','cancelled','Session\x20alias:\x20','new_message','high','alias','from_session','http://127.0.0.1:9200','SSE\x20connected\x20as\x20\x22','Bearer\x20','Authorization','commhub_send_task','messages','status','Target\x20session\x20alias','SSE\x20stream\x20ended,\x20reconnecting...','text',']\x20[commhub]\x20','none','MCP\x20stdio\x20connected','normal','session\x20disconnected','Progress\x200-100','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','\x20from\x20','tools/call','get_inbox','\x20ALIAS=','message_id','hub','trim','type','POST','content','working','0.3.0','SSE\x20error:\x20','catch','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','split','commhub-channel','initialize','from','Reply\x20text\x20/\x20result\x20summary','data:\x20','config.json','replied','\x20priority=','2437171KscOcJ','failed','stderr','22551fNNEnK','CommHub\x20init\x20failed:\x20','Priority\x20(default:\x20normal)','stdin','get_all_status','application/json','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_report_status','setRequestHandler','send_reply','report_status','2025-03-26','ready\x20—\x20waiting\x20for\x20events'];a0_0x2470=function(){return _0x2dbb06;};return a0_0x2470();}var k=new Map(),K=new a0_0x3e6ef2({'name':a0_0xbe730c(0x179),'version':a0_0xbe730c(0x174)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0xbe730c(0x14d),a0_0xbe730c(0x11f),a0_0xbe730c(0x144),a0_0xbe730c(0x153)+Z][a0_0xbe730c(0x11b)]('\x0a')});K[a0_0xbe730c(0x18c)](a0_0x2ed2f7,async()=>({'tools':[{'name':'commhub_reply','description':a0_0xbe730c(0x1a2),'inputSchema':{'type':a0_0xbe730c(0x11d),'properties':{'task_id':{'type':a0_0xbe730c(0x14b),'description':a0_0xbe730c(0x18a)},'text':{'type':'string','description':a0_0xbe730c(0x17c)},'status':{'type':a0_0xbe730c(0x14b),'enum':[a0_0xbe730c(0x196),'failed',a0_0xbe730c(0x152),a0_0xbe730c(0x116),a0_0xbe730c(0x119),a0_0xbe730c(0x147)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0xbe730c(0x161)]}},{'name':a0_0xbe730c(0x18b),'description':a0_0xbe730c(0x19d),'inputSchema':{'type':a0_0xbe730c(0x11d),'properties':{'status':{'type':a0_0xbe730c(0x14b),'enum':['working','idle',a0_0xbe730c(0x116),a0_0xbe730c(0x119)]},'task':{'type':a0_0xbe730c(0x14b),'description':'Current\x20task\x20description'},'progress':{'type':a0_0xbe730c(0x14f),'description':a0_0xbe730c(0x167)}},'required':[a0_0xbe730c(0x15e)]}},{'name':'commhub_send_task','description':a0_0xbe730c(0x177),'inputSchema':{'type':a0_0xbe730c(0x11d),'properties':{'alias':{'type':a0_0xbe730c(0x14b),'description':'Target\x20session\x20alias'},'task':{'type':a0_0xbe730c(0x14b),'description':'Task\x20content'},'priority':{'type':a0_0xbe730c(0x14b),'enum':[a0_0xbe730c(0x155),a0_0xbe730c(0x165),a0_0xbe730c(0x13f)],'description':a0_0xbe730c(0x186)}},'required':['alias',a0_0xbe730c(0x11c)]}},{'name':a0_0xbe730c(0x13a),'description':a0_0xbe730c(0x168),'inputSchema':{'type':a0_0xbe730c(0x11d),'properties':{'alias':{'type':a0_0xbe730c(0x14b),'description':a0_0xbe730c(0x15f)},'message':{'type':a0_0xbe730c(0x14b),'description':'Message\x20content'}},'required':[a0_0xbe730c(0x156),'message']}},{'name':'commhub_get_all_status','description':a0_0xbe730c(0x11e),'inputSchema':{'type':a0_0xbe730c(0x11d),'properties':{}}}]}));async function P(_0x1d3e99,_0x287b20){const _0x517039=a0_0xbe730c;let _0x381b90=await fetch(f+'/mcp',{'method':_0x517039(0x171),'headers':{'Content-Type':_0x517039(0x189),'Accept':_0x517039(0x137),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x517039(0x11a),'id':0x1,'method':_0x517039(0x17a),'params':{'protocolVersion':_0x517039(0x18f),'capabilities':{},'clientInfo':{'name':_0x517039(0x179),'version':_0x517039(0x174)}}})});if(!_0x381b90['ok']){let _0x2a5eb3=await _0x381b90[_0x517039(0x161)]();return Y(_0x517039(0x185)+_0x381b90[_0x517039(0x15e)]+'\x20'+_0x2a5eb3['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x517039(0x125)+_0x381b90['status']};}await _0x381b90['text']();let _0x4241c6=(await(await fetch(f+_0x517039(0x126),{'method':'POST','headers':{'Content-Type':_0x517039(0x189),'Accept':_0x517039(0x137),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x517039(0x11a),'id':0x2,'method':_0x517039(0x16a),'params':{'name':_0x1d3e99,'arguments':_0x287b20}})}))[_0x517039(0x161)]())[_0x517039(0x178)]('\x0a')[_0x517039(0x124)](_0x2f4189=>_0x2f4189[_0x517039(0x13e)]('data:\x20'));if(_0x4241c6){let _0x57c7b0=JSON[_0x517039(0x19f)](_0x4241c6['slice'](0x6));return _0x57c7b0?.[_0x517039(0x138)]?.[_0x517039(0x172)]?.[0x0]?.[_0x517039(0x161)]?JSON[_0x517039(0x19f)](_0x57c7b0[_0x517039(0x138)]['content'][0x0][_0x517039(0x161)]):_0x57c7b0;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0xbe730c(0x18c)](a0_0x89ef28,async _0x13a5ee=>{const _0x8a8ecd=a0_0xbe730c;let {name:_0x401ee5,arguments:_0xeb1121}=_0x13a5ee[_0x8a8ecd(0x19b)];if(_0x401ee5===_0x8a8ecd(0x136)){let {task_id:_0x4220fb,text:_0x45ca33,status:_0x12cc0c}=_0xeb1121;if(_0x12cc0c==='completed'||_0x12cc0c===_0x8a8ecd(0x182)||_0x12cc0c==='cancelled'){let _0xdd6bed=_0x12cc0c===_0x8a8ecd(0x196)?_0x8a8ecd(0x17f):_0x12cc0c,_0x4460d5=_0x4220fb?k[_0x8a8ecd(0x195)](_0x4220fb)||_0x8a8ecd(0x16e):_0x8a8ecd(0x16e),_0x5d8fd5=await P(_0x8a8ecd(0x18d),{'alias':_0x4460d5,'text':_0x45ca33,'in_reply_to':_0x4220fb||void 0x0,'status':_0xdd6bed,'from_session':Z});if(_0x4220fb)k[_0x8a8ecd(0x199)](_0x4220fb);return{'content':[{'type':_0x8a8ecd(0x161),'text':JSON[_0x8a8ecd(0x118)](_0x5d8fd5)}]};}let _0x128de7=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x12cc0c==='blocked'?_0x8a8ecd(0x116):_0x12cc0c===_0x8a8ecd(0x119)?_0x8a8ecd(0x119):_0x8a8ecd(0x173),'task':_0x45ca33[_0x8a8ecd(0x197)](0x0,0xc8),'output':_0x45ca33});return{'content':[{'type':'text','text':JSON['stringify'](_0x128de7)}]};}if(_0x401ee5===_0x8a8ecd(0x18b)){let {status:_0x3a091c,task:_0x6e2876,progress:_0x31e55e}=_0xeb1121,_0x5bf12b=await P(_0x8a8ecd(0x18e),{'resume_id':w,'alias':Z,'status':_0x3a091c,'task':_0x6e2876,'progress':_0x31e55e});return{'content':[{'type':_0x8a8ecd(0x161),'text':JSON[_0x8a8ecd(0x118)](_0x5bf12b)}]};}if(_0x401ee5===_0x8a8ecd(0x15c)){let {alias:_0x3cdcba,task:_0x1699cb,priority:_0x3a4502}=_0xeb1121,_0x5d289f=await P(_0x8a8ecd(0x192),{'alias':_0x3cdcba,'task':_0x1699cb,'priority':_0x3a4502||_0x8a8ecd(0x165),'from_session':Z});return{'content':[{'type':_0x8a8ecd(0x161),'text':JSON[_0x8a8ecd(0x118)](_0x5d289f)}]};}if(_0x401ee5===_0x8a8ecd(0x13a)){let {alias:_0x3b3c92,message:_0x52da45}=_0xeb1121,_0x1799d0=await P(_0x8a8ecd(0x12f),{'alias':_0x3b3c92,'message':_0x52da45,'from_session':Z});return{'content':[{'type':_0x8a8ecd(0x161),'text':JSON[_0x8a8ecd(0x118)](_0x1799d0)}]};}if(_0x401ee5===_0x8a8ecd(0x140)){let _0x10c14f=await P(_0x8a8ecd(0x188),{});return{'content':[{'type':_0x8a8ecd(0x161),'text':JSON[_0x8a8ecd(0x118)](_0x10c14f)}]};}return{'content':[{'type':_0x8a8ecd(0x161),'text':JSON[_0x8a8ecd(0x118)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x358ef0=a0_0xbe730c;let _0x556dce=f+_0x358ef0(0x142)+encodeURIComponent(Z),_0x3531c6={};if(X)_0x3531c6[_0x358ef0(0x15b)]=_0x358ef0(0x15a)+X;Y('connecting\x20to\x20'+_0x556dce);while(!0x0){try{let _0x586c00=await fetch(_0x556dce,{'headers':_0x3531c6});if(!_0x586c00['ok']){Y(_0x358ef0(0x175)+_0x586c00[_0x358ef0(0x15e)]+'\x20'+_0x586c00['statusText']),await h(0x1388);continue;}let _0x5143fa=_0x586c00[_0x358ef0(0x12d)]['getReader'](),_0x44c849=new TextDecoder(),_0x465ea4='';while(!0x0){let {done:_0x303618,value:_0x183335}=await _0x5143fa[_0x358ef0(0x193)]();if(_0x303618)break;_0x465ea4+=_0x44c849[_0x358ef0(0x191)](_0x183335,{'stream':!0x0});let _0x2c735b=_0x465ea4[_0x358ef0(0x178)]('\x0a\x0a');_0x465ea4=_0x2c735b[_0x358ef0(0x128)]()||'';for(let _0x1afd24 of _0x2c735b){let _0x5d72b1=_0x1afd24[_0x358ef0(0x178)]('\x0a')[_0x358ef0(0x124)](_0x553898=>_0x553898[_0x358ef0(0x13e)](_0x358ef0(0x17d)));if(!_0x5d72b1)continue;try{let _0x474c60=JSON['parse'](_0x5d72b1[_0x358ef0(0x197)](0x6));await S(_0x474c60);}catch(_0x54c26e){Y('parse\x20error:\x20'+_0x54c26e);}}}Y(_0x358ef0(0x160));}catch(_0x3f4f87){Y('SSE\x20connection\x20error:\x20'+_0x3f4f87);}await h(0xbb8);}}async function S(_0x166398){const _0x4e4d3c=a0_0xbe730c;if(_0x166398[_0x4e4d3c(0x170)]===_0x4e4d3c(0x148)){Y(_0x4e4d3c(0x159)+Z+'\x22');return;}if(_0x166398['type']===_0x4e4d3c(0x154)){if(Y(_0x4e4d3c(0x122)+_0x166398[_0x4e4d3c(0x17b)]+':\x20'+_0x166398['message']['slice'](0x0,0x3c)),await K[_0x4e4d3c(0x198)]({'method':_0x4e4d3c(0x19a),'params':{'content':_0x166398[_0x4e4d3c(0x121)],'meta':{'sender':_0x166398['from']||'hub','sender_id':'commhub','user':_0x166398[_0x4e4d3c(0x17b)]||_0x4e4d3c(0x16e),'priority':_0x4e4d3c(0x165)}}}),_0x166398[_0x4e4d3c(0x16d)])await P(_0x4e4d3c(0x149),{'alias':Z,'message_id':_0x166398[_0x4e4d3c(0x16d)]});return;}if(_0x166398[_0x4e4d3c(0x170)]===_0x4e4d3c(0x117)||_0x166398['type']===_0x4e4d3c(0x139)){Y('←\x20'+_0x166398[_0x4e4d3c(0x170)]+_0x4e4d3c(0x145)+_0x166398['inbox_count']+_0x4e4d3c(0x180)+(_0x166398['priority']||'normal'));let _0x5b4b73=await P(_0x4e4d3c(0x16b),{'alias':Z,'limit':0x5});if(_0x5b4b73?.['ok']&&_0x5b4b73[_0x4e4d3c(0x15d)]?.['length']>0x0)for(let _0x3e0cce of _0x5b4b73[_0x4e4d3c(0x15d)]){let _0xfa8590={'sender':_0x3e0cce[_0x4e4d3c(0x157)]||_0x4e4d3c(0x16e),'sender_id':'commhub','user':_0x3e0cce[_0x4e4d3c(0x157)]||'hub','task_id':_0x3e0cce['id'],'priority':_0x3e0cce[_0x4e4d3c(0x129)]||_0x4e4d3c(0x165)};k['set'](_0x3e0cce['id'],_0x3e0cce[_0x4e4d3c(0x157)]||_0x4e4d3c(0x16e)),await K[_0x4e4d3c(0x198)]({'method':'notifications/claude/channel','params':{'content':_0x3e0cce[_0x4e4d3c(0x172)],'meta':_0xfa8590}}),Y(_0x4e4d3c(0x134)+_0x3e0cce['id'][_0x4e4d3c(0x197)](0x0,0x8)+_0x4e4d3c(0x169)+_0x3e0cce[_0x4e4d3c(0x157)]+':\x20'+_0x3e0cce[_0x4e4d3c(0x172)]['slice'](0x0,0x3c)),await P(_0x4e4d3c(0x149),{'alias':Z,'message_id':_0x3e0cce['id']});}}}async function A(){const _0x3963c7=a0_0xbe730c;let _0x372b1e=new a0_0x14707b();await K[_0x3963c7(0x13c)](_0x372b1e),Y(_0x3963c7(0x164)),Y(_0x3963c7(0x12e)),u()[_0x3963c7(0x176)](_0x541e69=>Y('SSE\x20fatal:\x20'+_0x541e69)),P(_0x3963c7(0x18e),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x185e2f(),'hostname':a0_0x185e2f(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+_0x3963c7(0x120)+w[_0x3963c7(0x197)](0x0,0x8)+')'))['catch'](_0x2231f7=>Y('warning:\x20could\x20not\x20register:\x20'+_0x2231f7)),setInterval(()=>{const _0x268dc8=_0x3963c7;P(_0x268dc8(0x18e),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x185e2f(),'hostname':a0_0x185e2f(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})['catch'](_0x12a33c=>Y(_0x268dc8(0x1a1)+_0x12a33c));},0x2bf20),Y(_0x3963c7(0x190));}function a0_0x648b(_0x2acc54,_0x5f4cfb){_0x2acc54=_0x2acc54-0x115;const _0x247003=a0_0x2470();let _0x648bb=_0x247003[_0x2acc54];return _0x648bb;}A()[a0_0xbe730c(0x176)](_0x42bdf4=>{const _0x558993=a0_0xbe730c;Y('fatal:\x20'+_0x42bdf4),process[_0x558993(0x19c)](0x1);});async function N(){const _0x1a2ab7=a0_0xbe730c;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x1a2ab7(0x18e),{'resume_id':w,'alias':Z,'status':_0x1a2ab7(0x119),'task':_0x1a2ab7(0x166)})[_0x1a2ab7(0x176)](()=>{}),process[_0x1a2ab7(0x19c)](0x0);}process[a0_0xbe730c(0x187)]['on'](a0_0xbe730c(0x135),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x52bbdc=a0_0x250e;(function(_0x18ea8c,_0x39b332){const _0x34b338=a0_0x250e,_0x33e680=_0x18ea8c();while(!![]){try{const _0x351db6=-parseInt(_0x34b338(0x21d))/0x1+parseInt(_0x34b338(0x1eb))/0x2+-parseInt(_0x34b338(0x21f))/0x3*(-parseInt(_0x34b338(0x249))/0x4)+parseInt(_0x34b338(0x220))/0x5+-parseInt(_0x34b338(0x210))/0x6*(parseInt(_0x34b338(0x22d))/0x7)+-parseInt(_0x34b338(0x1ff))/0x8*(-parseInt(_0x34b338(0x20a))/0x9)+-parseInt(_0x34b338(0x213))/0xa*(parseInt(_0x34b338(0x236))/0xb);if(_0x351db6===_0x39b332)break;else _0x33e680['push'](_0x33e680['shift']());}catch(_0x1e73da){_0x33e680['push'](_0x33e680['shift']());}}}(a0_0x4f56,0x28096));import{readFileSync as a0_0x21a876,existsSync as a0_0x2c53d8}from'fs';import{randomUUID as a0_0x16f3a8}from'crypto';import{join as a0_0xacfc47}from'path';import{hostname as a0_0xbe43f3}from'os';import{execSync as a0_0x205802}from'child_process';import{Server as a0_0x30ee14}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x37debf}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x3e6577,CallToolRequestSchema as a0_0x53b3cc}from'@modelcontextprotocol/sdk/types.js';function p(_0xa95185){const _0x290b46=a0_0x250e;if(!a0_0x2c53d8(_0xa95185))return;for(let _0xfb91c4 of a0_0x21a876(_0xa95185,'utf-8')[_0x290b46(0x21b)]('\x0a')){let _0x37fd84=_0xfb91c4[_0x290b46(0x256)]();if(!_0x37fd84||_0x37fd84[_0x290b46(0x20f)]('#'))continue;let _0x4f711c=_0x37fd84['indexOf']('=');if(_0x4f711c<0x0)continue;let _0x4894c8=_0x37fd84['slice'](0x0,_0x4f711c)[_0x290b46(0x256)](),_0x4e6295=_0x37fd84[_0x290b46(0x1e4)](_0x4f711c+0x1)['trim']()[_0x290b46(0x1f1)](/^["']|["']$/g,'');if(!process.env[_0x4894c8])process.env[_0x4894c8]=_0x4e6295;}}var C=process.env.HOME||'~',T=a0_0xacfc47(C,'.claude/channels/commhub');p(a0_0xacfc47(T,a0_0x52bbdc(0x225)));var L=process[a0_0x52bbdc(0x22a)]()['replace'](/\//g,'-');p(a0_0xacfc47(T,L,'.env'));function U(){const _0x34674b=a0_0x52bbdc;try{return a0_0x205802(_0x34674b(0x1f0),{'encoding':_0x34674b(0x1e5),'timeout':0x7d0})[_0x34674b(0x256)]();}catch{return'';}}function v(){const _0x4862a2=a0_0x52bbdc;try{let _0xf66d5d=a0_0xacfc47(C,_0x4862a2(0x268),_0x4862a2(0x227));if(a0_0x2c53d8(_0xf66d5d))return JSON[_0x4862a2(0x1f3)](a0_0x21a876(_0xf66d5d,_0x4862a2(0x1e5)));}catch{}return{};}function a0_0x4f56(){const _0x58d00d=['connected',']\x20[commhub]\x20','Bearer\x20','commhub_send_message','claude-code','notification','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','\x20RESUME_ID=','2025-03-26','application/json,\x20text/event-stream','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','warning:\x20could\x20not\x20register:\x20','398488VBAzZa','end','type','Current\x20task\x20description','→\x20injected\x20task\x20','heartbeat\x20failed:\x20','low','unknown\x20tool','commhub_send_task','catch','join','idle','stdin','trim','from_session','working','priority','initialize','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','result','commhub','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','message','SIGINT','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','stringify','2.0','\x20priority=','normal','POST','send_task','.anet','content','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','setRequestHandler','...\x20TMUX=','connecting\x20to\x20','notifications/claude/channel','starting\x20SSE\x20listener...','Reply\x20text\x20/\x20result\x20summary','slice','utf-8','message_id','status','\x20PROJECT_ENV=','tools/call','\x22\x20(','303504IBpvee','statusText','report_status','SIGTERM','object','tmux\x20display-message\x20-p\x20\x27#S\x27','replace','CommHub\x20init\x20failed:\x20','parse','parse\x20error:\x20','token','commhub_reply','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','get','init\x20failed:\x20','high','task','session\x20disconnected','get_inbox','37616Ddxzsc','completed','Target\x20session\x20alias','Progress\x200-100','body','http://127.0.0.1:9200','application/json','ack_inbox','send_reply','broadcast','new_message','513oQZNRI','hub','fatal:\x20','SSE\x20stream\x20ended,\x20reconnecting...','Message\x20content','startsWith','164472mverKB','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','error','3571430anGwqD','\x20CWD=','get_all_status','pop','/mcp','stderr','Task\x20content','Authorization','split','then','154909VqKhwA','send_message','9whLSzN','61170sCCepQ','SSE\x20error:\x20','set','/events/','from','.env','data:\x20','config.json','0.3.0','blocked','cwd','write','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','14lvVsmv','find','commhub_get_all_status','cancelled','failed','string','shutting\x20down,\x20reporting\x20offline...','text','SSE\x20connection\x20error:\x20','11WFBVWi','length','exit','number','none','messages','replied'];a0_0x4f56=function(){return _0x58d00d;};return a0_0x4f56();}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x52bbdc(0x204),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0xbe43f3(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x16f3a8(),X=process.env.COMMHUB_TOKEN||H[a0_0x52bbdc(0x1f5)]||'';function a0_0x250e(_0x2e29db,_0x1c3fdd){_0x2e29db=_0x2e29db-0x1de;const _0x4f56d4=a0_0x4f56();let _0x250e5f=_0x4f56d4[_0x2e29db];return _0x250e5f;}function Y(_0x3e0db6){const _0x4d9cdc=a0_0x52bbdc;let _0x11f1a1=new Date()['toTimeString']()['slice'](0x0,0x8);process[_0x4d9cdc(0x218)][_0x4d9cdc(0x22b)]('['+_0x11f1a1+_0x4d9cdc(0x23e)+_0x3e0db6+'\x0a');}function h(_0x52619e){return new Promise(_0x4deee9=>setTimeout(_0x4deee9,_0x52619e));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+a0_0x52bbdc(0x244)+w['slice'](0x0,0x8)+a0_0x52bbdc(0x1df)+(j||a0_0x52bbdc(0x23a))+a0_0x52bbdc(0x214)+process[a0_0x52bbdc(0x22a)]()+a0_0x52bbdc(0x1e8)+L);var k=new Map(),K=new a0_0x30ee14({'name':'commhub-channel','version':a0_0x52bbdc(0x228)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x52bbdc(0x261),a0_0x52bbdc(0x25b),a0_0x52bbdc(0x247),a0_0x52bbdc(0x22c),'Session\x20alias:\x20'+Z][a0_0x52bbdc(0x253)]('\x0a')});K['setRequestHandler'](a0_0x3e6577,async()=>({'tools':[{'name':a0_0x52bbdc(0x1f6),'description':a0_0x52bbdc(0x211),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'task_id':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x243)},'text':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x1e3)},'status':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x200),a0_0x52bbdc(0x231),'cancelled',a0_0x52bbdc(0x229),a0_0x52bbdc(0x212),'in_progress'],'description':a0_0x52bbdc(0x1f8)}},'required':[a0_0x52bbdc(0x234)]}},{'name':'commhub_report_status','description':a0_0x52bbdc(0x26a),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'status':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x258),a0_0x52bbdc(0x254),a0_0x52bbdc(0x229),a0_0x52bbdc(0x212)]},'task':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x24c)},'progress':{'type':a0_0x52bbdc(0x239),'description':a0_0x52bbdc(0x202)}},'required':[a0_0x52bbdc(0x1e7)]}},{'name':a0_0x52bbdc(0x251),'description':a0_0x52bbdc(0x1f7),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'alias':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x201)},'task':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x219)},'priority':{'type':a0_0x52bbdc(0x232),'enum':[a0_0x52bbdc(0x1fb),'normal',a0_0x52bbdc(0x24f)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias',a0_0x52bbdc(0x1fc)]}},{'name':a0_0x52bbdc(0x240),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{'alias':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x201)},'message':{'type':a0_0x52bbdc(0x232),'description':a0_0x52bbdc(0x20e)}},'required':['alias',a0_0x52bbdc(0x25f)]}},{'name':a0_0x52bbdc(0x22f),'description':a0_0x52bbdc(0x25e),'inputSchema':{'type':a0_0x52bbdc(0x1ef),'properties':{}}}]}));async function P(_0x4ee747,_0x3f61ac){const _0x2d26d3=a0_0x52bbdc;let _0x1db480=await fetch(f+_0x2d26d3(0x217),{'method':_0x2d26d3(0x266),'headers':{'Content-Type':_0x2d26d3(0x205),'Accept':_0x2d26d3(0x246),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x2d26d3(0x262)]({'jsonrpc':_0x2d26d3(0x263),'id':0x1,'method':_0x2d26d3(0x25a),'params':{'protocolVersion':_0x2d26d3(0x245),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x2d26d3(0x228)}}})});if(!_0x1db480['ok']){let _0x74db3a=await _0x1db480[_0x2d26d3(0x234)]();return Y(_0x2d26d3(0x1f2)+_0x1db480[_0x2d26d3(0x1e7)]+'\x20'+_0x74db3a[_0x2d26d3(0x1e4)](0x0,0x64)),{'ok':!0x1,'error':_0x2d26d3(0x1fa)+_0x1db480[_0x2d26d3(0x1e7)]};}await _0x1db480[_0x2d26d3(0x234)]();let _0x473466=(await(await fetch(f+_0x2d26d3(0x217),{'method':'POST','headers':{'Content-Type':_0x2d26d3(0x205),'Accept':_0x2d26d3(0x246),...X?{'Authorization':_0x2d26d3(0x23f)+X}:{}},'body':JSON[_0x2d26d3(0x262)]({'jsonrpc':_0x2d26d3(0x263),'id':0x2,'method':_0x2d26d3(0x1e9),'params':{'name':_0x4ee747,'arguments':_0x3f61ac}})}))[_0x2d26d3(0x234)]())[_0x2d26d3(0x21b)]('\x0a')[_0x2d26d3(0x22e)](_0x702a40=>_0x702a40['startsWith'](_0x2d26d3(0x226)));if(_0x473466){let _0x425675=JSON['parse'](_0x473466[_0x2d26d3(0x1e4)](0x6));return _0x425675?.[_0x2d26d3(0x25c)]?.[_0x2d26d3(0x269)]?.[0x0]?.[_0x2d26d3(0x234)]?JSON[_0x2d26d3(0x1f3)](_0x425675[_0x2d26d3(0x25c)][_0x2d26d3(0x269)][0x0][_0x2d26d3(0x234)]):_0x425675;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x52bbdc(0x1de)](a0_0x53b3cc,async _0x351ef0=>{const _0x6fef36=a0_0x52bbdc;let {name:_0x190361,arguments:_0x2f7355}=_0x351ef0['params'];if(_0x190361===_0x6fef36(0x1f6)){let {task_id:_0x1b3ec9,text:_0x56a23e,status:_0x386669}=_0x2f7355;if(_0x386669==='completed'||_0x386669===_0x6fef36(0x231)||_0x386669===_0x6fef36(0x230)){let _0x137a8e=_0x386669===_0x6fef36(0x200)?_0x6fef36(0x23c):_0x386669,_0x20fb1c=_0x1b3ec9?k[_0x6fef36(0x1f9)](_0x1b3ec9)||_0x6fef36(0x20b):_0x6fef36(0x20b),_0x26527e=await P(_0x6fef36(0x207),{'alias':_0x20fb1c,'text':_0x56a23e,'in_reply_to':_0x1b3ec9||void 0x0,'status':_0x137a8e,'from_session':Z});if(_0x1b3ec9)k['delete'](_0x1b3ec9);return{'content':[{'type':'text','text':JSON[_0x6fef36(0x262)](_0x26527e)}]};}let _0x80d99a=await P(_0x6fef36(0x1ed),{'resume_id':w,'alias':Z,'status':_0x386669===_0x6fef36(0x229)?_0x6fef36(0x229):_0x386669===_0x6fef36(0x212)?'error':_0x6fef36(0x258),'task':_0x56a23e[_0x6fef36(0x1e4)](0x0,0xc8),'output':_0x56a23e});return{'content':[{'type':_0x6fef36(0x234),'text':JSON['stringify'](_0x80d99a)}]};}if(_0x190361==='commhub_report_status'){let {status:_0x56103d,task:_0x177e8b,progress:_0x4213b1}=_0x2f7355,_0x2fa32f=await P(_0x6fef36(0x1ed),{'resume_id':w,'alias':Z,'status':_0x56103d,'task':_0x177e8b,'progress':_0x4213b1});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x2fa32f)}]};}if(_0x190361===_0x6fef36(0x251)){let {alias:_0xe65640,task:_0x2a083d,priority:_0x33f281}=_0x2f7355,_0x369a69=await P(_0x6fef36(0x267),{'alias':_0xe65640,'task':_0x2a083d,'priority':_0x33f281||_0x6fef36(0x265),'from_session':Z});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x369a69)}]};}if(_0x190361===_0x6fef36(0x240)){let {alias:_0x509e7c,message:_0x263b54}=_0x2f7355,_0x4d98f3=await P(_0x6fef36(0x21e),{'alias':_0x509e7c,'message':_0x263b54,'from_session':Z});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x4d98f3)}]};}if(_0x190361===_0x6fef36(0x22f)){let _0x1affe5=await P(_0x6fef36(0x215),{});return{'content':[{'type':_0x6fef36(0x234),'text':JSON[_0x6fef36(0x262)](_0x1affe5)}]};}return{'content':[{'type':_0x6fef36(0x234),'text':JSON['stringify']({'error':_0x6fef36(0x250)})}]};});async function u(){const _0x31d8f=a0_0x52bbdc;let _0xfac32c=f+_0x31d8f(0x223)+encodeURIComponent(Z),_0x2404f4={};if(X)_0x2404f4[_0x31d8f(0x21a)]=_0x31d8f(0x23f)+X;Y(_0x31d8f(0x1e0)+_0xfac32c);while(!0x0){try{let _0x401695=await fetch(_0xfac32c,{'headers':_0x2404f4});if(!_0x401695['ok']){Y(_0x31d8f(0x221)+_0x401695[_0x31d8f(0x1e7)]+'\x20'+_0x401695[_0x31d8f(0x1ec)]),await h(0x1388);continue;}let _0x30f520=_0x401695[_0x31d8f(0x203)]['getReader'](),_0x2da09e=new TextDecoder(),_0x5a4313='';while(!0x0){let {done:_0x6aae45,value:_0xc53875}=await _0x30f520['read']();if(_0x6aae45)break;_0x5a4313+=_0x2da09e['decode'](_0xc53875,{'stream':!0x0});let _0x5ae5cf=_0x5a4313[_0x31d8f(0x21b)]('\x0a\x0a');_0x5a4313=_0x5ae5cf[_0x31d8f(0x216)]()||'';for(let _0x103939 of _0x5ae5cf){let _0x2b5ddd=_0x103939[_0x31d8f(0x21b)]('\x0a')[_0x31d8f(0x22e)](_0x1b0b1a=>_0x1b0b1a['startsWith'](_0x31d8f(0x226)));if(!_0x2b5ddd)continue;try{let _0x201a7d=JSON[_0x31d8f(0x1f3)](_0x2b5ddd[_0x31d8f(0x1e4)](0x6));await S(_0x201a7d);}catch(_0x4808c9){Y(_0x31d8f(0x1f4)+_0x4808c9);}}}Y(_0x31d8f(0x20d));}catch(_0x5c3b26){Y(_0x31d8f(0x235)+_0x5c3b26);}await h(0xbb8);}}async function S(_0x230ff0){const _0x166403=a0_0x52bbdc;if(_0x230ff0[_0x166403(0x24b)]===_0x166403(0x23d)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x230ff0['type']===_0x166403(0x209)){if(Y('←\x20message\x20from\x20'+_0x230ff0[_0x166403(0x224)]+':\x20'+_0x230ff0[_0x166403(0x25f)][_0x166403(0x1e4)](0x0,0x3c)),await K['notification']({'method':_0x166403(0x1e1),'params':{'content':_0x230ff0['message'],'meta':{'sender':_0x230ff0['from']||_0x166403(0x20b),'sender_id':_0x166403(0x25d),'user':_0x230ff0[_0x166403(0x224)]||_0x166403(0x20b),'priority':_0x166403(0x265)}}}),_0x230ff0[_0x166403(0x1e6)])await P(_0x166403(0x206),{'alias':Z,'message_id':_0x230ff0[_0x166403(0x1e6)]});return;}if(_0x230ff0[_0x166403(0x24b)]==='new_task'||_0x230ff0[_0x166403(0x24b)]===_0x166403(0x208)){Y('←\x20'+_0x230ff0['type']+':\x20inbox_count='+_0x230ff0['inbox_count']+_0x166403(0x264)+(_0x230ff0['priority']||_0x166403(0x265)));let _0x3f58e2=await P(_0x166403(0x1fe),{'alias':Z,'limit':0x5});if(_0x3f58e2?.['ok']&&_0x3f58e2[_0x166403(0x23b)]?.[_0x166403(0x237)]>0x0)for(let _0x38e1ab of _0x3f58e2['messages']){let _0x101c3c={'sender':_0x38e1ab[_0x166403(0x257)]||'hub','sender_id':_0x166403(0x25d),'user':_0x38e1ab[_0x166403(0x257)]||_0x166403(0x20b),'task_id':_0x38e1ab['id'],'priority':_0x38e1ab[_0x166403(0x259)]||_0x166403(0x265)};k[_0x166403(0x222)](_0x38e1ab['id'],_0x38e1ab[_0x166403(0x257)]||_0x166403(0x20b)),await K[_0x166403(0x242)]({'method':'notifications/claude/channel','params':{'content':_0x38e1ab[_0x166403(0x269)],'meta':_0x101c3c}}),Y(_0x166403(0x24d)+_0x38e1ab['id'][_0x166403(0x1e4)](0x0,0x8)+'\x20from\x20'+_0x38e1ab[_0x166403(0x257)]+':\x20'+_0x38e1ab[_0x166403(0x269)][_0x166403(0x1e4)](0x0,0x3c)),await P(_0x166403(0x206),{'alias':Z,'message_id':_0x38e1ab['id']});}}}async function A(){const _0x7b3b30=a0_0x52bbdc;let _0x118f0e=new a0_0x37debf();await K['connect'](_0x118f0e),Y('MCP\x20stdio\x20connected'),Y(_0x7b3b30(0x1e2)),u()[_0x7b3b30(0x252)](_0x514f32=>Y('SSE\x20fatal:\x20'+_0x514f32)),P(_0x7b3b30(0x1ed),{'resume_id':w,'alias':Z,'status':_0x7b3b30(0x254),'server':a0_0xbe43f3(),'hostname':a0_0xbe43f3(),'agent':_0x7b3b30(0x241),'project_dir':process[_0x7b3b30(0x22a)](),'tmux_name':j||void 0x0})[_0x7b3b30(0x21c)](()=>Y('registered\x20as\x20\x22'+Z+_0x7b3b30(0x1ea)+w[_0x7b3b30(0x1e4)](0x0,0x8)+')'))['catch'](_0x362126=>Y(_0x7b3b30(0x248)+_0x362126)),setInterval(()=>{const _0x1d3fe1=_0x7b3b30;P(_0x1d3fe1(0x1ed),{'resume_id':w,'alias':Z,'status':_0x1d3fe1(0x254),'server':a0_0xbe43f3(),'hostname':a0_0xbe43f3(),'agent':_0x1d3fe1(0x241),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x1d3fe1(0x252)](_0x3ecae5=>Y(_0x1d3fe1(0x24e)+_0x3ecae5));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x52bbdc(0x252)](_0x272e8b=>{const _0x18e83c=a0_0x52bbdc;Y(_0x18e83c(0x20c)+_0x272e8b),process[_0x18e83c(0x238)](0x1);});async function N(){const _0x2b8b9a=a0_0x52bbdc;Y(_0x2b8b9a(0x233)),await P(_0x2b8b9a(0x1ed),{'resume_id':w,'alias':Z,'status':_0x2b8b9a(0x212),'task':_0x2b8b9a(0x1fd)})[_0x2b8b9a(0x252)](()=>{}),process[_0x2b8b9a(0x238)](0x0);}process[a0_0x52bbdc(0x255)]['on'](a0_0x52bbdc(0x24a),()=>N()),process['on'](a0_0x52bbdc(0x1ee),()=>N()),process['on'](a0_0x52bbdc(0x260),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10-preview.0",
|
|
4
4
|
"description": "AI Agent Network CLI — Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 39 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|