@sleep2agi/agent-network 2.0.0-preview.14 → 2.0.0-preview.15
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_0x351f9c=a0_0x238f;(function(_0x48c10a,_0x8c0360){const _0xf3d9a0=a0_0x238f,_0x4a1c2e=_0x48c10a();while(!![]){try{const _0x277d80=-parseInt(_0xf3d9a0(0x170))/0x1+parseInt(_0xf3d9a0(0x156))/0x2+parseInt(_0xf3d9a0(0x181))/0x3*(parseInt(_0xf3d9a0(0x15d))/0x4)+parseInt(_0xf3d9a0(0x171))/0x5+parseInt(_0xf3d9a0(0x18c))/0x6+-parseInt(_0xf3d9a0(0x14e))/0x7+-parseInt(_0xf3d9a0(0x152))/0x8*(parseInt(_0xf3d9a0(0x198))/0x9);if(_0x277d80===_0x8c0360)break;else _0x4a1c2e['push'](_0x4a1c2e['shift']());}catch(_0x41436e){_0x4a1c2e['push'](_0x4a1c2e['shift']());}}}(a0_0x3937,0x2c260));import{EventEmitter as a0_0x12d321}from'events';function a0_0x3937(){const _0x451f1d=['connect','min','connected','signal','sleep','2422242BeWgdZ','heartbeat\x20failed:\x20','completed','Bearer\x20','emit','task','disconnect','pop','broadcast','status','content','message','2352350NJlZyQ','running','agent','match','8jLpLSI','read','tools/call','offline','447356YvptiL','body','reply','server','send_task','getReader','registered','8ZsIbyC','AbortError','heartbeatInterval','autoConnect','sseAbort','toString','heartbeatTimer','url','/events/','type','name','parse','alias','catch','text','toTimeString','SSE\x20error:\x20','abort','application/json','187656VaGmgZ','1151740tELLdE','cwd','log','sdk','SSE\x20failed:\x20','new_task','SSE\x20connected','new_message','stringify','normal','ack_inbox','2.0','processInbox','s...','disconnected','reconnectDelay','414954kaLhgL','SSE\x20reconnecting\x20in\x20','get_all_status','error','inbox\x20error:\x20','startsWith','idle','call','get_inbox','now','/mcp','1458084fVJFjE','token','send','send_message','slice','connectSSE','result'];a0_0x3937=function(){return _0x451f1d;};return a0_0x3937();}import{hostname as a0_0x19c15d}from'os';class T extends a0_0x12d321{[a0_0x351f9c(0x164)];[a0_0x351f9c(0x169)];[a0_0x351f9c(0x18d)];[a0_0x351f9c(0x150)];['resumeId'];[a0_0x351f9c(0x15f)];[a0_0x351f9c(0x180)];['heartbeatTimer'];[a0_0x351f9c(0x161)];[a0_0x351f9c(0x14f)]=!0x1;constructor(_0x998d78){const _0x3b1c38=a0_0x351f9c;super();if(this[_0x3b1c38(0x164)]=_0x998d78[_0x3b1c38(0x164)]['replace'](/\/$/,''),this['alias']=_0x998d78[_0x3b1c38(0x169)],this[_0x3b1c38(0x18d)]=_0x998d78['token'],this[_0x3b1c38(0x150)]=_0x998d78['agent']||_0x3b1c38(0x174),this['resumeId']='sdk-'+_0x998d78[_0x3b1c38(0x169)]+'-'+Date[_0x3b1c38(0x18a)]()[_0x3b1c38(0x162)](0x24),this['heartbeatInterval']=_0x998d78[_0x3b1c38(0x15f)]??0x2bf20,this['reconnectDelay']=_0x998d78['reconnectDelay']??0xbb8,_0x998d78[_0x3b1c38(0x160)]!==!0x1)this[_0x3b1c38(0x193)]();}[a0_0x351f9c(0x173)](_0x2806af){const _0x42ef49=a0_0x351f9c;console[_0x42ef49(0x173)]('['+new Date()[_0x42ef49(0x16c)]()[_0x42ef49(0x190)](0x0,0x8)+']\x20[commhub:'+this[_0x42ef49(0x169)]+']\x20'+_0x2806af);}async['call'](_0x269031,_0x25c9a8){const _0x4379ad=a0_0x351f9c;let _0x269337={'Content-Type':_0x4379ad(0x16f),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x269337['Authorization']='Bearer\x20'+this[_0x4379ad(0x18d)];let _0x3f29d8=await(await fetch(this[_0x4379ad(0x164)]+_0x4379ad(0x18b),{'method':'POST','headers':_0x269337,'body':JSON[_0x4379ad(0x179)]({'jsonrpc':_0x4379ad(0x17c),'id':Date[_0x4379ad(0x18a)](),'method':_0x4379ad(0x154),'params':{'name':_0x269031,'arguments':_0x25c9a8}})}))[_0x4379ad(0x16b)](),_0x33ecec=_0x3f29d8[_0x4379ad(0x151)](/data: (.+)/),_0x4005ee=_0x33ecec?JSON[_0x4379ad(0x168)](_0x33ecec[0x1]):JSON[_0x4379ad(0x168)](_0x3f29d8),_0x4cbb0b=_0x4005ee?.[_0x4379ad(0x192)]?.[_0x4379ad(0x1a2)]?.[0x0]?.[_0x4379ad(0x16b)];return _0x4cbb0b?JSON['parse'](_0x4cbb0b):_0x4005ee;}async['connect'](){const _0x54c21d=a0_0x351f9c;if(this[_0x54c21d(0x14f)])return;this['running']=!0x0,await this[_0x54c21d(0x1a1)](_0x54c21d(0x187)),this[_0x54c21d(0x173)](_0x54c21d(0x15c)),this[_0x54c21d(0x163)]=setInterval(()=>{const _0x270fa9=_0x54c21d;this[_0x270fa9(0x1a1)](_0x270fa9(0x187))[_0x270fa9(0x16a)](_0x5b5256=>this['log'](_0x270fa9(0x199)+_0x5b5256[_0x270fa9(0x1a3)]));},this[_0x54c21d(0x15f)]),this[_0x54c21d(0x191)]();}async[a0_0x351f9c(0x19e)](){const _0x1d107c=a0_0x351f9c;if(this[_0x1d107c(0x14f)]=!0x1,this['sseAbort']?.[_0x1d107c(0x16e)](),this[_0x1d107c(0x163)])clearInterval(this[_0x1d107c(0x163)]);await this[_0x1d107c(0x1a1)](_0x1d107c(0x155))[_0x1d107c(0x16a)](()=>{}),this[_0x1d107c(0x173)]('disconnected');}async[a0_0x351f9c(0x18e)](_0x2fb18e,_0x5b27b8,_0x1101e3=a0_0x351f9c(0x17a)){const _0x14e9bb=a0_0x351f9c;return this[_0x14e9bb(0x188)](_0x14e9bb(0x15a),{'alias':_0x2fb18e,'task':_0x5b27b8,'priority':_0x1101e3,'from_session':this[_0x14e9bb(0x169)]});}async['message'](_0xf5f30c,_0x4b7d86){const _0x2870f1=a0_0x351f9c;return this[_0x2870f1(0x188)](_0x2870f1(0x18f),{'alias':_0xf5f30c,'message':_0x4b7d86,'from_session':this[_0x2870f1(0x169)]});}async[a0_0x351f9c(0x158)](_0x20c81a,_0x7615f3,_0x217233=a0_0x351f9c(0x19a)){const _0x105809=a0_0x351f9c;return this[_0x105809(0x188)]('reply',{'task_id':_0x20c81a,'text':_0x7615f3,'status':_0x217233});}async['status'](_0x3b7ed9,_0x1c481c){const _0x321ea6=a0_0x351f9c;return this[_0x321ea6(0x188)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x321ea6(0x169)],'status':_0x3b7ed9,'server':a0_0x19c15d(),'hostname':a0_0x19c15d(),'agent':this[_0x321ea6(0x150)],'project_dir':process[_0x321ea6(0x172)](),..._0x1c481c});}async['getAllStatus'](){const _0x393af7=a0_0x351f9c;return this['call'](_0x393af7(0x183),{});}async[a0_0x351f9c(0x1a0)](_0x1dbfea,_0x3d55d5){const _0x31b5ac=a0_0x351f9c;return this['call'](_0x31b5ac(0x1a0),{'message':_0x1dbfea,'filter_server':_0x3d55d5?.[_0x31b5ac(0x159)],'filter_status':_0x3d55d5?.['status']});}async[a0_0x351f9c(0x191)](){const _0x1c7065=a0_0x351f9c;let _0x1cfadb=encodeURIComponent(this[_0x1c7065(0x169)]),_0x8f784f=this[_0x1c7065(0x164)]+_0x1c7065(0x165)+_0x1cfadb,_0x477f70=this['reconnectDelay'];while(this['running']){try{this[_0x1c7065(0x161)]=new AbortController();let _0x4dedb5={'Accept':'text/event-stream'};if(this[_0x1c7065(0x18d)])_0x4dedb5['Authorization']=_0x1c7065(0x19b)+this[_0x1c7065(0x18d)];let _0x152f04=await fetch(_0x8f784f,{'headers':_0x4dedb5,'signal':this['sseAbort'][_0x1c7065(0x196)]});if(!_0x152f04['ok']||!_0x152f04[_0x1c7065(0x157)]){this[_0x1c7065(0x173)](_0x1c7065(0x175)+_0x152f04['status']),await this['sleep'](_0x477f70),_0x477f70=Math[_0x1c7065(0x194)](_0x477f70*1.5,0xea60);continue;}_0x477f70=this['reconnectDelay'];let _0x192a9a=_0x152f04[_0x1c7065(0x157)][_0x1c7065(0x15b)](),_0x66a788=new TextDecoder(),_0x199f4d='';while(this[_0x1c7065(0x14f)]){let {done:_0x383fbe,value:_0x5bff12}=await _0x192a9a[_0x1c7065(0x153)]();if(_0x383fbe)break;_0x199f4d+=_0x66a788['decode'](_0x5bff12,{'stream':!0x0});let _0x5d15a0=_0x199f4d['split']('\x0a');_0x199f4d=_0x5d15a0[_0x1c7065(0x19f)]()||'';for(let _0x2f7402 of _0x5d15a0){if(!_0x2f7402[_0x1c7065(0x186)]('data:\x20'))continue;try{let _0x2e59f8=JSON['parse'](_0x2f7402['slice'](0x6));if(_0x2e59f8[_0x1c7065(0x166)]===_0x1c7065(0x195)){this['log'](_0x1c7065(0x177)),this[_0x1c7065(0x19c)](_0x1c7065(0x195));continue;}if(_0x2e59f8[_0x1c7065(0x166)]===_0x1c7065(0x176)||_0x2e59f8[_0x1c7065(0x166)]===_0x1c7065(0x178)||_0x2e59f8[_0x1c7065(0x166)]===_0x1c7065(0x1a0))await this[_0x1c7065(0x17d)]();}catch{}}}}catch(_0x598ad0){if(_0x598ad0[_0x1c7065(0x167)]===_0x1c7065(0x15e))break;this[_0x1c7065(0x19c)](_0x1c7065(0x184),_0x598ad0),this[_0x1c7065(0x173)](_0x1c7065(0x16d)+_0x598ad0['message']);}if(this[_0x1c7065(0x14f)])this[_0x1c7065(0x19c)](_0x1c7065(0x17f)),this[_0x1c7065(0x173)](_0x1c7065(0x182)+_0x477f70/0x3e8+_0x1c7065(0x17e)),await this['sleep'](_0x477f70),_0x477f70=Math[_0x1c7065(0x194)](_0x477f70*1.5,0xea60);}}async[a0_0x351f9c(0x17d)](){const _0x1d007a=a0_0x351f9c;try{let _0x3d1b78=(await this[_0x1d007a(0x188)](_0x1d007a(0x189),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x3a43c6 of _0x3d1b78)await this[_0x1d007a(0x188)](_0x1d007a(0x17b),{'alias':this[_0x1d007a(0x169)],'message_id':_0x3a43c6['id']}),this[_0x1d007a(0x173)]('←\x20'+_0x3a43c6['from_session']+':\x20'+_0x3a43c6[_0x1d007a(0x1a2)][_0x1d007a(0x190)](0x0,0x3c)),this[_0x1d007a(0x19c)](_0x1d007a(0x19d),_0x3a43c6),this[_0x1d007a(0x19c)](_0x1d007a(0x1a3),_0x3a43c6);}catch(_0x39d753){this[_0x1d007a(0x173)](_0x1d007a(0x185)+_0x39d753[_0x1d007a(0x1a3)]);}}[a0_0x351f9c(0x197)](_0x365661){return new Promise(_0x3dc42b=>setTimeout(_0x3dc42b,_0x365661));}}function a0_0x238f(_0x4cbc61,_0x4f9ba1){_0x4cbc61=_0x4cbc61-0x14e;const _0x39373e=a0_0x3937();let _0x238f76=_0x39373e[_0x4cbc61];return _0x238f76;}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_0x1018bd=a0_0x2622;(function(_0x4ef47b,_0x4fe968){const _0x5eaf4f=a0_0x2622,_0x2584af=_0x4ef47b();while(!![]){try{const _0xe8c422=-parseInt(_0x5eaf4f(0x1a4))/0x1*(parseInt(_0x5eaf4f(0x1c4))/0x2)+parseInt(_0x5eaf4f(0x183))/0x3*(-parseInt(_0x5eaf4f(0x1ef))/0x4)+-parseInt(_0x5eaf4f(0x1bc))/0x5+parseInt(_0x5eaf4f(0x1d5))/0x6+-parseInt(_0x5eaf4f(0x1a9))/0x7+-parseInt(_0x5eaf4f(0x1ca))/0x8*(parseInt(_0x5eaf4f(0x1cb))/0x9)+parseInt(_0x5eaf4f(0x1e2))/0xa;if(_0xe8c422===_0x4fe968)break;else _0x2584af['push'](_0x2584af['shift']());}catch(_0x37f7d1){_0x2584af['push'](_0x2584af['shift']());}}}(a0_0x43c3,0x737b4));import{readFileSync as a0_0x4339de,existsSync as a0_0x9bb653}from'fs';import{join as a0_0x1167ff}from'path';import{hostname as a0_0x180297}from'os';import{execSync as a0_0x57a205}from'child_process';import{Server as a0_0x54200c}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xb02e0c}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1ca717,CallToolRequestSchema as a0_0x54a2dc}from'@modelcontextprotocol/sdk/types.js';function p(_0x1137e9){const _0x485ffc=a0_0x2622;if(!a0_0x9bb653(_0x1137e9))return;for(let _0x3befb5 of a0_0x4339de(_0x1137e9,_0x485ffc(0x1c3))[_0x485ffc(0x1e1)]('\x0a')){let _0x31bd13=_0x3befb5[_0x485ffc(0x1ff)]();if(!_0x31bd13||_0x31bd13[_0x485ffc(0x205)]('#'))continue;let _0x40260b=_0x31bd13[_0x485ffc(0x200)]('=');if(_0x40260b<0x0)continue;let _0x11d8da=_0x31bd13[_0x485ffc(0x20d)](0x0,_0x40260b)[_0x485ffc(0x1ff)](),_0x822390=_0x31bd13[_0x485ffc(0x20d)](_0x40260b+0x1)[_0x485ffc(0x1ff)]()[_0x485ffc(0x1fb)](/^["']|["']$/g,'');if(!process.env[_0x11d8da])process.env[_0x11d8da]=_0x822390;}}var C=process.env.HOME||'~',T=a0_0x1167ff(C,a0_0x1018bd(0x198));p(a0_0x1167ff(T,a0_0x1018bd(0x201)));var L=process[a0_0x1018bd(0x1fe)]()[a0_0x1018bd(0x1fb)](/\//g,'-');p(a0_0x1167ff(T,L,a0_0x1018bd(0x201)));function U(){const _0x4eb1f3=a0_0x1018bd;try{return a0_0x57a205('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4eb1f3(0x1c3),'timeout':0x7d0})[_0x4eb1f3(0x1ff)]();}catch{return'';}}function a0_0x43c3(){const _0x299930=['142623KvANnG','from_session','then','get_all_status','body','SSE\x20stream\x20ended,\x20reconnecting...','tools/call','toTimeString','working','ready\x20—\x20waiting\x20for\x20events','3596076pmKBEZ','high','replied','type','commhub_send_message','low','Priority\x20(default:\x20normal)','\x20PROJECT_ENV=','commhub-channel','0.3.0','connecting\x20to\x20','\x20CWD=','split','24311030SujlYl','application/json,\x20text/event-stream','ENV:\x20URL=','commhub_send_task','→\x20injected\x20task\x20','Session\x20alias:\x20','error','none','get_inbox','SSE\x20error:\x20','get','stringify','report_status','5960edBAEB','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','2.0','message','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','new_message','notification','application/json','setRequestHandler','warning:\x20could\x20not\x20register:\x20','SSE\x20fatal:\x20','Target\x20session\x20alias','replace','notifications/claude/channel','idle','cwd','trim','indexOf','.env','content','CommHub\x20init\x20failed:\x20','init\x20failed:\x20','startsWith','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','\x20ALIAS=','from','registered\x20as\x20\x22','catch','\x20from\x20','commhub_reply','slice','commhub','broadcast','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','send_task','1143CXqJHy','Bearer\x20','message_id','write','normal','fatal:\x20','data:\x20','join','randomUUID','object','pop','hub','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','failed','inbox_count','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','status','Task\x20content','delete','connected','blocked','.claude/channels/commhub','Progress\x200-100','commhub_report_status','exit','params','/events/','set','connect','statusText','parse','/mcp','SSE\x20connected\x20as\x20\x22','1vOkofn','string','completed','find','starting\x20SSE\x20listener...','4455948IaOTbC','Current\x20task\x20description','text','\x20RESUME_ID=','Authorization','alias','config.json','\x20priority=','\x22\x20(','task','SIGINT','parse\x20error:\x20','Message\x20content','SIGTERM','Reply\x20text\x20/\x20result\x20summary','POST','heartbeat\x20failed:\x20','commhub_get_all_status','initialize','3529755wQMjlj','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','result','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','...\x20TMUX=','cancelled','.anet','utf-8','1135994iQopSg','no\x20response',':\x20inbox_count=','ack_inbox','claude-code','←\x20message\x20from\x20','40UjBzFk'];a0_0x43c3=function(){return _0x299930;};return a0_0x43c3();}function c(){const _0x35952f=a0_0x1018bd;try{let _0x282276=a0_0x1167ff(C,_0x35952f(0x1c2),_0x35952f(0x1af));if(a0_0x9bb653(_0x282276))return JSON[_0x35952f(0x1a1)](a0_0x4339de(_0x282276,_0x35952f(0x1c3)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x1018bd(0x18e)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x180297(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x1018bd(0x18b)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x3ec004){const _0x22ef5b=a0_0x1018bd;let _0xcf436=new Date()[_0x22ef5b(0x1d2)]()['slice'](0x0,0x8);process['stderr'][_0x22ef5b(0x186)]('['+_0xcf436+']\x20[commhub]\x20'+_0x3ec004+'\x0a');}function h(_0x50b7fb){return new Promise(_0x255b91=>setTimeout(_0x255b91,_0x50b7fb));}Y(a0_0x1018bd(0x1e4)+D+a0_0x1018bd(0x207)+Z+a0_0x1018bd(0x1ac)+w[a0_0x1018bd(0x20d)](0x0,0x8)+a0_0x1018bd(0x1c0)+(f||a0_0x1018bd(0x1e9))+a0_0x1018bd(0x1e0)+process[a0_0x1018bd(0x1fe)]()+a0_0x1018bd(0x1dc)+L);var k=new Map(),K=new a0_0x54200c({'name':'commhub-channel','version':a0_0x1018bd(0x1de)},{'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_0x1018bd(0x18f),a0_0x1018bd(0x1bd),a0_0x1018bd(0x181),a0_0x1018bd(0x1e7)+Z][a0_0x1018bd(0x18a)]('\x0a')});K['setRequestHandler'](a0_0x1ca717,async()=>({'tools':[{'name':a0_0x1018bd(0x20c),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x1018bd(0x18c),'properties':{'task_id':{'type':a0_0x1018bd(0x1a5),'description':a0_0x1018bd(0x1f0)},'text':{'type':'string','description':a0_0x1018bd(0x1b7)},'status':{'type':'string','enum':[a0_0x1018bd(0x1a6),a0_0x1018bd(0x190),a0_0x1018bd(0x1c1),'blocked',a0_0x1018bd(0x1e8),'in_progress'],'description':a0_0x1018bd(0x206)}},'required':[a0_0x1018bd(0x1ab)]}},{'name':a0_0x1018bd(0x19a),'description':a0_0x1018bd(0x192),'inputSchema':{'type':a0_0x1018bd(0x18c),'properties':{'status':{'type':a0_0x1018bd(0x1a5),'enum':[a0_0x1018bd(0x1d3),a0_0x1018bd(0x1fd),'blocked',a0_0x1018bd(0x1e8)]},'task':{'type':a0_0x1018bd(0x1a5),'description':a0_0x1018bd(0x1aa)},'progress':{'type':'number','description':a0_0x1018bd(0x199)}},'required':[a0_0x1018bd(0x193)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x1018bd(0x1a5),'description':'Target\x20session\x20alias'},'task':{'type':'string','description':a0_0x1018bd(0x194)},'priority':{'type':a0_0x1018bd(0x1a5),'enum':[a0_0x1018bd(0x1d6),a0_0x1018bd(0x187),a0_0x1018bd(0x1da)],'description':a0_0x1018bd(0x1db)}},'required':['alias',a0_0x1018bd(0x1b2)]}},{'name':a0_0x1018bd(0x1d9),'description':a0_0x1018bd(0x1f3),'inputSchema':{'type':a0_0x1018bd(0x18c),'properties':{'alias':{'type':a0_0x1018bd(0x1a5),'description':a0_0x1018bd(0x1fa)},'message':{'type':a0_0x1018bd(0x1a5),'description':a0_0x1018bd(0x1b5)}},'required':[a0_0x1018bd(0x1ae),a0_0x1018bd(0x1f2)]}},{'name':'commhub_get_all_status','description':a0_0x1018bd(0x1bf),'inputSchema':{'type':a0_0x1018bd(0x18c),'properties':{}}}]}));async function P(_0xa2e14a,_0x25974f){const _0x42e5f6=a0_0x1018bd;let _0xe0a42b=await fetch(D+_0x42e5f6(0x1a2),{'method':'POST','headers':{'Content-Type':_0x42e5f6(0x1f6),'Accept':_0x42e5f6(0x1e3),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x42e5f6(0x1ed)]({'jsonrpc':_0x42e5f6(0x1f1),'id':0x1,'method':_0x42e5f6(0x1bb),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x42e5f6(0x1dd),'version':'0.3.0'}}})});if(!_0xe0a42b['ok']){let _0x381b73=await _0xe0a42b[_0x42e5f6(0x1ab)]();return Y(_0x42e5f6(0x203)+_0xe0a42b['status']+'\x20'+_0x381b73[_0x42e5f6(0x20d)](0x0,0x64)),{'ok':!0x1,'error':_0x42e5f6(0x204)+_0xe0a42b[_0x42e5f6(0x193)]};}await _0xe0a42b[_0x42e5f6(0x1ab)]();let _0x3bbfa4=(await(await fetch(D+_0x42e5f6(0x1a2),{'method':_0x42e5f6(0x1b8),'headers':{'Content-Type':_0x42e5f6(0x1f6),'Accept':_0x42e5f6(0x1e3),...X?{'Authorization':_0x42e5f6(0x184)+X}:{}},'body':JSON[_0x42e5f6(0x1ed)]({'jsonrpc':_0x42e5f6(0x1f1),'id':0x2,'method':_0x42e5f6(0x1d1),'params':{'name':_0xa2e14a,'arguments':_0x25974f}})}))[_0x42e5f6(0x1ab)]())[_0x42e5f6(0x1e1)]('\x0a')[_0x42e5f6(0x1a7)](_0x2679a1=>_0x2679a1[_0x42e5f6(0x205)](_0x42e5f6(0x189)));if(_0x3bbfa4){let _0x31cdd9=JSON[_0x42e5f6(0x1a1)](_0x3bbfa4[_0x42e5f6(0x20d)](0x6));return _0x31cdd9?.[_0x42e5f6(0x1be)]?.[_0x42e5f6(0x202)]?.[0x0]?.[_0x42e5f6(0x1ab)]?JSON[_0x42e5f6(0x1a1)](_0x31cdd9[_0x42e5f6(0x1be)][_0x42e5f6(0x202)][0x0][_0x42e5f6(0x1ab)]):_0x31cdd9;}return{'ok':!0x1,'error':_0x42e5f6(0x1c5)};}K[a0_0x1018bd(0x1f7)](a0_0x54a2dc,async _0x4171dd=>{const _0x41b9ae=a0_0x1018bd;let {name:_0x4b7597,arguments:_0x5c03ce}=_0x4171dd[_0x41b9ae(0x19c)];if(_0x4b7597===_0x41b9ae(0x20c)){let {task_id:_0x296420,text:_0x2ea039,status:_0xdaac10}=_0x5c03ce;if(_0xdaac10===_0x41b9ae(0x1a6)||_0xdaac10==='failed'||_0xdaac10==='cancelled'){let _0x233d7c=_0xdaac10===_0x41b9ae(0x1a6)?_0x41b9ae(0x1d7):_0xdaac10,_0x428204=_0x296420?k[_0x41b9ae(0x1ec)](_0x296420)||'hub':'hub',_0x4b081d=await P('send_reply',{'alias':_0x428204,'text':_0x2ea039,'in_reply_to':_0x296420||void 0x0,'status':_0x233d7c,'from_session':Z});if(_0x296420)k[_0x41b9ae(0x195)](_0x296420);return{'content':[{'type':'text','text':JSON['stringify'](_0x4b081d)}]};}let _0x44a9a3=await P(_0x41b9ae(0x1ee),{'resume_id':w,'alias':Z,'status':_0xdaac10===_0x41b9ae(0x197)?_0x41b9ae(0x197):_0xdaac10===_0x41b9ae(0x1e8)?_0x41b9ae(0x1e8):_0x41b9ae(0x1d3),'task':_0x2ea039[_0x41b9ae(0x20d)](0x0,0xc8),'output':_0x2ea039});return{'content':[{'type':_0x41b9ae(0x1ab),'text':JSON[_0x41b9ae(0x1ed)](_0x44a9a3)}]};}if(_0x4b7597==='commhub_report_status'){let {status:_0x19598b,task:_0x597eca,progress:_0x5cf034}=_0x5c03ce,_0x4cdc26=await P(_0x41b9ae(0x1ee),{'resume_id':w,'alias':Z,'status':_0x19598b,'task':_0x597eca,'progress':_0x5cf034});return{'content':[{'type':_0x41b9ae(0x1ab),'text':JSON[_0x41b9ae(0x1ed)](_0x4cdc26)}]};}if(_0x4b7597===_0x41b9ae(0x1e5)){let {alias:_0x4512f3,task:_0x4cec73,priority:_0x24a66b}=_0x5c03ce,_0xf837a8=await P(_0x41b9ae(0x182),{'alias':_0x4512f3,'task':_0x4cec73,'priority':_0x24a66b||_0x41b9ae(0x187),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x41b9ae(0x1ed)](_0xf837a8)}]};}if(_0x4b7597===_0x41b9ae(0x1d9)){let {alias:_0x12fc80,message:_0x449e59}=_0x5c03ce,_0x54136f=await P('send_message',{'alias':_0x12fc80,'message':_0x449e59,'from_session':Z});return{'content':[{'type':_0x41b9ae(0x1ab),'text':JSON[_0x41b9ae(0x1ed)](_0x54136f)}]};}if(_0x4b7597===_0x41b9ae(0x1ba)){let _0x5993a2=await P(_0x41b9ae(0x1ce),{});return{'content':[{'type':_0x41b9ae(0x1ab),'text':JSON[_0x41b9ae(0x1ed)](_0x5993a2)}]};}return{'content':[{'type':_0x41b9ae(0x1ab),'text':JSON[_0x41b9ae(0x1ed)]({'error':'unknown\x20tool'})}]};});async function v(){const _0x24a40e=a0_0x1018bd;let _0x21a331=D+_0x24a40e(0x19d)+encodeURIComponent(Z),_0x5a272a={};if(X)_0x5a272a[_0x24a40e(0x1ad)]=_0x24a40e(0x184)+X;Y(_0x24a40e(0x1df)+_0x21a331);while(!0x0){try{let _0x3ffc1e=await fetch(_0x21a331,{'headers':_0x5a272a});if(!_0x3ffc1e['ok']){Y(_0x24a40e(0x1eb)+_0x3ffc1e[_0x24a40e(0x193)]+'\x20'+_0x3ffc1e[_0x24a40e(0x1a0)]),await h(0x1388);continue;}let _0x4c3e78=_0x3ffc1e[_0x24a40e(0x1cf)]['getReader'](),_0x29d25b=new TextDecoder(),_0x427c11='';while(!0x0){let {done:_0x43f2f1,value:_0x328464}=await _0x4c3e78['read']();if(_0x43f2f1)break;_0x427c11+=_0x29d25b['decode'](_0x328464,{'stream':!0x0});let _0x29988a=_0x427c11['split']('\x0a\x0a');_0x427c11=_0x29988a[_0x24a40e(0x18d)]()||'';for(let _0x50c45b of _0x29988a){let _0x1d61b7=_0x50c45b[_0x24a40e(0x1e1)]('\x0a')[_0x24a40e(0x1a7)](_0x340c8e=>_0x340c8e[_0x24a40e(0x205)](_0x24a40e(0x189)));if(!_0x1d61b7)continue;try{let _0x3740d3=JSON['parse'](_0x1d61b7[_0x24a40e(0x20d)](0x6));await u(_0x3740d3);}catch(_0x4151de){Y(_0x24a40e(0x1b4)+_0x4151de);}}}Y(_0x24a40e(0x1d0));}catch(_0x1abd35){Y('SSE\x20connection\x20error:\x20'+_0x1abd35);}await h(0xbb8);}}async function u(_0x5386a8){const _0x4d071c=a0_0x1018bd;if(_0x5386a8[_0x4d071c(0x1d8)]===_0x4d071c(0x196)){Y(_0x4d071c(0x1a3)+Z+'\x22');return;}if(_0x5386a8[_0x4d071c(0x1d8)]===_0x4d071c(0x1f4)){if(Y(_0x4d071c(0x1c9)+_0x5386a8[_0x4d071c(0x208)]+':\x20'+_0x5386a8[_0x4d071c(0x1f2)][_0x4d071c(0x20d)](0x0,0x3c)),await K[_0x4d071c(0x1f5)]({'method':_0x4d071c(0x1fc),'params':{'content':_0x5386a8['message'],'meta':{'sender':_0x5386a8[_0x4d071c(0x208)]||_0x4d071c(0x18e),'sender_id':_0x4d071c(0x20e),'user':_0x5386a8[_0x4d071c(0x208)]||_0x4d071c(0x18e),'priority':_0x4d071c(0x187)}}}),_0x5386a8[_0x4d071c(0x185)])await P(_0x4d071c(0x1c7),{'alias':Z,'message_id':_0x5386a8['message_id']});return;}if(_0x5386a8[_0x4d071c(0x1d8)]==='new_task'||_0x5386a8[_0x4d071c(0x1d8)]===_0x4d071c(0x180)){Y('←\x20'+_0x5386a8['type']+_0x4d071c(0x1c6)+_0x5386a8[_0x4d071c(0x191)]+_0x4d071c(0x1b0)+(_0x5386a8['priority']||'normal'));let _0x55076f=await P(_0x4d071c(0x1ea),{'alias':Z,'limit':0x5});if(_0x55076f?.['ok']&&_0x55076f['messages']?.['length']>0x0)for(let _0xd99115 of _0x55076f['messages']){let _0x598e75={'sender':_0xd99115[_0x4d071c(0x1cc)]||_0x4d071c(0x18e),'sender_id':_0x4d071c(0x20e),'user':_0xd99115[_0x4d071c(0x1cc)]||'hub','task_id':_0xd99115['id'],'priority':_0xd99115['priority']||_0x4d071c(0x187)};k[_0x4d071c(0x19e)](_0xd99115['id'],_0xd99115[_0x4d071c(0x1cc)]||_0x4d071c(0x18e)),await K[_0x4d071c(0x1f5)]({'method':_0x4d071c(0x1fc),'params':{'content':_0xd99115['content'],'meta':_0x598e75}}),Y(_0x4d071c(0x1e6)+_0xd99115['id'][_0x4d071c(0x20d)](0x0,0x8)+_0x4d071c(0x20b)+_0xd99115[_0x4d071c(0x1cc)]+':\x20'+_0xd99115['content']['slice'](0x0,0x3c)),await P(_0x4d071c(0x1c7),{'alias':Z,'message_id':_0xd99115['id']});}}}async function S(){const _0x1c85ff=a0_0x1018bd;let _0x54728e=new a0_0xb02e0c();await K[_0x1c85ff(0x19f)](_0x54728e),Y('MCP\x20stdio\x20connected'),Y(_0x1c85ff(0x1a8)),v()[_0x1c85ff(0x20a)](_0xec7ab7=>Y(_0x1c85ff(0x1f9)+_0xec7ab7)),P(_0x1c85ff(0x1ee),{'resume_id':w,'alias':Z,'status':_0x1c85ff(0x1fd),'server':a0_0x180297(),'hostname':a0_0x180297(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x1c85ff(0x1cd)](()=>Y(_0x1c85ff(0x209)+Z+_0x1c85ff(0x1b1)+w['slice'](0x0,0x8)+')'))[_0x1c85ff(0x20a)](_0x39fee4=>Y(_0x1c85ff(0x1f8)+_0x39fee4)),setInterval(()=>{const _0x27bae9=_0x1c85ff;P('report_status',{'resume_id':w,'alias':Z,'status':_0x27bae9(0x1fd),'server':a0_0x180297(),'hostname':a0_0x180297(),'agent':_0x27bae9(0x1c8),'project_dir':process[_0x27bae9(0x1fe)](),'tmux_name':f||void 0x0})[_0x27bae9(0x20a)](_0x1b41b0=>Y(_0x27bae9(0x1b9)+_0x1b41b0));},0x2bf20),Y(_0x1c85ff(0x1d4));}S()[a0_0x1018bd(0x20a)](_0x1437f9=>{const _0x5c8400=a0_0x1018bd;Y(_0x5c8400(0x188)+_0x1437f9),process[_0x5c8400(0x19b)](0x1);});function a0_0x2622(_0x4ddaea,_0x448023){_0x4ddaea=_0x4ddaea-0x180;const _0x43c39b=a0_0x43c3();let _0x262294=_0x43c39b[_0x4ddaea];return _0x262294;}async function N(){const _0x1de7ea=a0_0x1018bd;Y('shutting\x20down,\x20reporting\x20offline...'),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x1de7ea(0x1e8),'task':'session\x20disconnected'})['catch'](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x1018bd(0x1b6),()=>N()),process['on'](a0_0x1018bd(0x1b3),()=>N());
|
|
2
|
+
const a0_0x196d7c=a0_0x19e8;(function(_0x54142f,_0x2b71cc){const _0x4d4f8b=a0_0x19e8,_0x496756=_0x54142f();while(!![]){try{const _0x206930=parseInt(_0x4d4f8b(0xa2))/0x1+parseInt(_0x4d4f8b(0xa6))/0x2+-parseInt(_0x4d4f8b(0xe9))/0x3+-parseInt(_0x4d4f8b(0xd5))/0x4+parseInt(_0x4d4f8b(0x8b))/0x5*(parseInt(_0x4d4f8b(0xc8))/0x6)+parseInt(_0x4d4f8b(0x95))/0x7+-parseInt(_0x4d4f8b(0xba))/0x8*(parseInt(_0x4d4f8b(0xc6))/0x9);if(_0x206930===_0x2b71cc)break;else _0x496756['push'](_0x496756['shift']());}catch(_0x2f4913){_0x496756['push'](_0x496756['shift']());}}}(a0_0x5274,0x73e95));import{readFileSync as a0_0x1df49d,existsSync as a0_0x4236d4}from'fs';import{join as a0_0x43c99c}from'path';import{hostname as a0_0x4d5f8a}from'os';import{execSync as a0_0x2628d9}from'child_process';import{Server as a0_0x524037}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x10a924}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x1078a5,CallToolRequestSchema as a0_0xfb936e}from'@modelcontextprotocol/sdk/types.js';function p(_0x2e1856){const _0x262137=a0_0x19e8;if(!a0_0x4236d4(_0x2e1856))return;for(let _0x4aa320 of a0_0x1df49d(_0x2e1856,_0x262137(0x111))[_0x262137(0xb9)]('\x0a')){let _0x1d8319=_0x4aa320[_0x262137(0x105)]();if(!_0x1d8319||_0x1d8319[_0x262137(0xbd)]('#'))continue;let _0x57cae3=_0x1d8319['indexOf']('=');if(_0x57cae3<0x0)continue;let _0x160af1=_0x1d8319[_0x262137(0xe7)](0x0,_0x57cae3)[_0x262137(0x105)](),_0x2d892c=_0x1d8319[_0x262137(0xe7)](_0x57cae3+0x1)['trim']()[_0x262137(0xa8)](/^["']|["']$/g,'');if(!process.env[_0x160af1])process.env[_0x160af1]=_0x2d892c;}}var C=process.env.HOME||'~',T=a0_0x43c99c(C,a0_0x196d7c(0xac));p(a0_0x43c99c(T,'.env'));var L=process[a0_0x196d7c(0xc9)]()[a0_0x196d7c(0xa8)](/\//g,'-');p(a0_0x43c99c(T,L,a0_0x196d7c(0x93)));function U(){const _0x22e668=a0_0x196d7c;try{return a0_0x2628d9(_0x22e668(0xaa),{'encoding':_0x22e668(0x111),'timeout':0x7d0})[_0x22e668(0x105)]();}catch{return'';}}function c(){const _0x5edb68=a0_0x196d7c;try{let _0x1dc678=a0_0x43c99c(C,'.anet',_0x5edb68(0x9a));if(a0_0x4236d4(_0x1dc678))return JSON[_0x5edb68(0x113)](a0_0x1df49d(_0x1dc678,_0x5edb68(0x111)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x196d7c(0x91)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x4d5f8a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x196d7c(0xaf)](),X=process.env.COMMHUB_TOKEN||H[a0_0x196d7c(0xe2)]||'';function Y(_0x11b794){const _0x14ab13=a0_0x196d7c;let _0x1a9c26=new Date()['toTimeString']()[_0x14ab13(0xe7)](0x0,0x8);process[_0x14ab13(0xd0)][_0x14ab13(0xdc)]('['+_0x1a9c26+_0x14ab13(0xee)+_0x11b794+'\x0a');}function h(_0xc0eec4){return new Promise(_0x4bfccc=>setTimeout(_0x4bfccc,_0xc0eec4));}Y(a0_0x196d7c(0xe6)+D+'\x20ALIAS='+Z+a0_0x196d7c(0x112)+w[a0_0x196d7c(0xe7)](0x0,0x8)+a0_0x196d7c(0x9f)+(f||'none')+a0_0x196d7c(0x108)+process[a0_0x196d7c(0xc9)]()+a0_0x196d7c(0x115)+L);var k=new Map(),K=new a0_0x524037({'name':a0_0x196d7c(0xb0),'version':a0_0x196d7c(0x104)},{'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_0x196d7c(0x8c),a0_0x196d7c(0xcd),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x196d7c(0x10f)+Z][a0_0x196d7c(0xbe)]('\x0a')});K[a0_0x196d7c(0xed)](a0_0x1078a5,async()=>({'tools':[{'name':a0_0x196d7c(0xda),'description':a0_0x196d7c(0x9c),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':'string','description':a0_0x196d7c(0xc0)},'status':{'type':a0_0x196d7c(0xbc),'enum':[a0_0x196d7c(0xf9),a0_0x196d7c(0xeb),a0_0x196d7c(0xb5),a0_0x196d7c(0x94),a0_0x196d7c(0xab),a0_0x196d7c(0xf3)],'description':a0_0x196d7c(0xf4)}},'required':[a0_0x196d7c(0xe1)]}},{'name':a0_0x196d7c(0x102),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x196d7c(0xa9),'properties':{'status':{'type':'string','enum':['working',a0_0x196d7c(0x101),'blocked',a0_0x196d7c(0xab)]},'task':{'type':'string','description':a0_0x196d7c(0xd8)},'progress':{'type':a0_0x196d7c(0xf2),'description':a0_0x196d7c(0x9d)}},'required':[a0_0x196d7c(0x97)]}},{'name':a0_0x196d7c(0xb7),'description':a0_0x196d7c(0x10a),'inputSchema':{'type':a0_0x196d7c(0xa9),'properties':{'alias':{'type':a0_0x196d7c(0xbc),'description':a0_0x196d7c(0xe5)},'task':{'type':a0_0x196d7c(0xbc),'description':'Task\x20content'},'priority':{'type':a0_0x196d7c(0xbc),'enum':[a0_0x196d7c(0xfb),'normal','low'],'description':a0_0x196d7c(0xdb)}},'required':[a0_0x196d7c(0xea),a0_0x196d7c(0xc7)]}},{'name':a0_0x196d7c(0x92),'description':a0_0x196d7c(0x9e),'inputSchema':{'type':a0_0x196d7c(0xa9),'properties':{'alias':{'type':a0_0x196d7c(0xbc),'description':a0_0x196d7c(0xe5)},'message':{'type':'string','description':a0_0x196d7c(0x107)}},'required':[a0_0x196d7c(0xea),a0_0x196d7c(0xb3)]}},{'name':a0_0x196d7c(0xae),'description':a0_0x196d7c(0xe3),'inputSchema':{'type':a0_0x196d7c(0xa9),'properties':{}}}]}));async function P(_0x5d6562,_0x3fe7af){const _0x398f59=a0_0x196d7c;let _0x1cd9a5=await fetch(D+_0x398f59(0x10d),{'method':_0x398f59(0xa3),'headers':{'Content-Type':_0x398f59(0xf7),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x398f59(0x99)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':'initialize','params':{'protocolVersion':_0x398f59(0xc4),'capabilities':{},'clientInfo':{'name':_0x398f59(0xb0),'version':_0x398f59(0x104)}}})});if(!_0x1cd9a5['ok']){let _0x522799=await _0x1cd9a5[_0x398f59(0xe1)]();return Y(_0x398f59(0x10b)+_0x1cd9a5[_0x398f59(0x97)]+'\x20'+_0x522799[_0x398f59(0xe7)](0x0,0x64)),{'ok':!0x1,'error':_0x398f59(0xcc)+_0x1cd9a5['status']};}await _0x1cd9a5[_0x398f59(0xe1)]();let _0x394295=(await(await fetch(D+_0x398f59(0x10d),{'method':_0x398f59(0xa3),'headers':{'Content-Type':_0x398f59(0xf7),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x398f59(0x99)+X}:{}},'body':JSON[_0x398f59(0x100)]({'jsonrpc':_0x398f59(0xb8),'id':0x2,'method':_0x398f59(0xdd),'params':{'name':_0x5d6562,'arguments':_0x3fe7af}})}))[_0x398f59(0xe1)]())[_0x398f59(0xb9)]('\x0a')[_0x398f59(0xe4)](_0x496020=>_0x496020[_0x398f59(0xbd)](_0x398f59(0x114)));if(_0x394295){let _0x411ab8=JSON[_0x398f59(0x113)](_0x394295[_0x398f59(0xe7)](0x6));return _0x411ab8?.[_0x398f59(0x9b)]?.[_0x398f59(0xb6)]?.[0x0]?.[_0x398f59(0xe1)]?JSON[_0x398f59(0x113)](_0x411ab8[_0x398f59(0x9b)][_0x398f59(0xb6)][0x0][_0x398f59(0xe1)]):_0x411ab8;}return{'ok':!0x1,'error':_0x398f59(0xad)};}K[a0_0x196d7c(0xed)](a0_0xfb936e,async _0xdbac49=>{const _0x355eb7=a0_0x196d7c;let {name:_0x138b93,arguments:_0x57f912}=_0xdbac49[_0x355eb7(0xbf)];if(_0x138b93===_0x355eb7(0xda)){let {task_id:_0x3bc34b,text:_0x5d00d3,status:_0x4e0747}=_0x57f912;if(_0x4e0747===_0x355eb7(0xf9)||_0x4e0747===_0x355eb7(0xeb)||_0x4e0747===_0x355eb7(0xb5)){let _0xc3f533=_0x4e0747==='completed'?_0x355eb7(0xa7):_0x4e0747,_0x4d47b6=_0x3bc34b?k[_0x355eb7(0x96)](_0x3bc34b)||_0x355eb7(0x91):_0x355eb7(0x91),_0x240555=await P('send_reply',{'alias':_0x4d47b6,'text':_0x5d00d3,'in_reply_to':_0x3bc34b||void 0x0,'status':_0xc3f533,'from_session':Z});if(_0x3bc34b)k[_0x355eb7(0x8f)](_0x3bc34b);return{'content':[{'type':_0x355eb7(0xe1),'text':JSON['stringify'](_0x240555)}]};}let _0x217d0f=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x4e0747===_0x355eb7(0x94)?'blocked':_0x4e0747===_0x355eb7(0xab)?_0x355eb7(0xab):'working','task':_0x5d00d3[_0x355eb7(0xe7)](0x0,0xc8),'output':_0x5d00d3});return{'content':[{'type':_0x355eb7(0xe1),'text':JSON['stringify'](_0x217d0f)}]};}if(_0x138b93===_0x355eb7(0x102)){let {status:_0xa8c782,task:_0x49c261,progress:_0x12d2d2}=_0x57f912,_0x616958=await P(_0x355eb7(0xa0),{'resume_id':w,'alias':Z,'status':_0xa8c782,'task':_0x49c261,'progress':_0x12d2d2});return{'content':[{'type':_0x355eb7(0xe1),'text':JSON['stringify'](_0x616958)}]};}if(_0x138b93==='commhub_send_task'){let {alias:_0x178604,task:_0x432e27,priority:_0x4f8a4b}=_0x57f912,_0x193f57=await P('send_task',{'alias':_0x178604,'task':_0x432e27,'priority':_0x4f8a4b||_0x355eb7(0xe8),'from_session':Z});return{'content':[{'type':_0x355eb7(0xe1),'text':JSON[_0x355eb7(0x100)](_0x193f57)}]};}if(_0x138b93===_0x355eb7(0x92)){let {alias:_0x7e3bad,message:_0x55bac4}=_0x57f912,_0x38b601=await P(_0x355eb7(0xde),{'alias':_0x7e3bad,'message':_0x55bac4,'from_session':Z});return{'content':[{'type':_0x355eb7(0xe1),'text':JSON[_0x355eb7(0x100)](_0x38b601)}]};}if(_0x138b93===_0x355eb7(0xae)){let _0x233f3a=await P(_0x355eb7(0xfc),{});return{'content':[{'type':_0x355eb7(0xe1),'text':JSON[_0x355eb7(0x100)](_0x233f3a)}]};}return{'content':[{'type':_0x355eb7(0xe1),'text':JSON[_0x355eb7(0x100)]({'error':_0x355eb7(0xdf)})}]};});function a0_0x19e8(_0xd1073c,_0x80dbe2){_0xd1073c=_0xd1073c-0x8b;const _0x5274f4=a0_0x5274();let _0x19e811=_0x5274f4[_0xd1073c];return _0x19e811;}async function v(){const _0x9b5b65=a0_0x196d7c;let _0x4e3804=D+'/events/'+encodeURIComponent(Z),_0x286635={};if(X)_0x286635[_0x9b5b65(0x8d)]='Bearer\x20'+X;Y(_0x9b5b65(0xb2)+_0x4e3804);while(!0x0){try{let _0x4d333a=await fetch(_0x4e3804,{'headers':_0x286635});if(!_0x4d333a['ok']){Y(_0x9b5b65(0xc3)+_0x4d333a[_0x9b5b65(0x97)]+'\x20'+_0x4d333a[_0x9b5b65(0xa1)]),await h(0x1388);continue;}let _0x18e8b4=_0x4d333a[_0x9b5b65(0xca)][_0x9b5b65(0xf5)](),_0xc7efd2=new TextDecoder(),_0xc2869d='';while(!0x0){let {done:_0x446aa8,value:_0x5c6a08}=await _0x18e8b4[_0x9b5b65(0x10e)]();if(_0x446aa8)break;_0xc2869d+=_0xc7efd2[_0x9b5b65(0x103)](_0x5c6a08,{'stream':!0x0});let _0x4468f7=_0xc2869d[_0x9b5b65(0xb9)]('\x0a\x0a');_0xc2869d=_0x4468f7[_0x9b5b65(0x90)]()||'';for(let _0x4695c6 of _0x4468f7){let _0x514b78=_0x4695c6['split']('\x0a')['find'](_0x7b1800=>_0x7b1800[_0x9b5b65(0xbd)](_0x9b5b65(0x114)));if(!_0x514b78)continue;try{let _0x4cb5ff=JSON[_0x9b5b65(0x113)](_0x514b78[_0x9b5b65(0xe7)](0x6));await u(_0x4cb5ff);}catch(_0x334bdc){Y(_0x9b5b65(0xbb)+_0x334bdc);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x3eeabb){Y('SSE\x20connection\x20error:\x20'+_0x3eeabb);}await h(0xbb8);}}async function u(_0x186fcd){const _0x3fed35=a0_0x196d7c;if(_0x186fcd['type']===_0x3fed35(0xf8)){Y(_0x3fed35(0xd9)+Z+'\x22');return;}if(_0x186fcd[_0x3fed35(0xf1)]==='new_message'){if(Y('←\x20message\x20from\x20'+_0x186fcd['from']+':\x20'+_0x186fcd['message'][_0x3fed35(0xe7)](0x0,0x3c)),await K[_0x3fed35(0x10c)]({'method':'notifications/claude/channel','params':{'content':_0x186fcd[_0x3fed35(0xb3)],'meta':{'sender':_0x186fcd['from']||_0x3fed35(0x91),'sender_id':_0x3fed35(0xff),'user':_0x186fcd[_0x3fed35(0xef)]||_0x3fed35(0x91),'priority':_0x3fed35(0xe8)}}}),_0x186fcd[_0x3fed35(0xc5)])await P(_0x3fed35(0xfe),{'alias':Z,'message_id':_0x186fcd[_0x3fed35(0xc5)]});return;}if(_0x186fcd['type']===_0x3fed35(0x109)||_0x186fcd['type']==='broadcast'){Y('←\x20'+_0x186fcd['type']+_0x3fed35(0xc2)+_0x186fcd[_0x3fed35(0xd6)]+'\x20priority='+(_0x186fcd[_0x3fed35(0xcf)]||_0x3fed35(0xe8)));let _0x978aa4=await P(_0x3fed35(0xa4),{'alias':Z,'limit':0x5});if(_0x978aa4?.['ok']&&_0x978aa4[_0x3fed35(0xe0)]?.[_0x3fed35(0x98)]>0x0)for(let _0xb73873 of _0x978aa4[_0x3fed35(0xe0)]){let _0x44ed94={'sender':_0xb73873[_0x3fed35(0xf6)]||_0x3fed35(0x91),'sender_id':'commhub','user':_0xb73873[_0x3fed35(0xf6)]||_0x3fed35(0x91),'task_id':_0xb73873['id'],'priority':_0xb73873['priority']||_0x3fed35(0xe8)};k[_0x3fed35(0x110)](_0xb73873['id'],_0xb73873['from_session']||_0x3fed35(0x91)),await K[_0x3fed35(0x10c)]({'method':_0x3fed35(0xc1),'params':{'content':_0xb73873[_0x3fed35(0xb6)],'meta':_0x44ed94}}),Y('→\x20injected\x20task\x20'+_0xb73873['id'][_0x3fed35(0xe7)](0x0,0x8)+_0x3fed35(0xfa)+_0xb73873[_0x3fed35(0xf6)]+':\x20'+_0xb73873['content'][_0x3fed35(0xe7)](0x0,0x3c)),await P(_0x3fed35(0xfe),{'alias':Z,'message_id':_0xb73873['id']});}}}async function S(){const _0x1efc53=a0_0x196d7c;let _0x4b2136=new a0_0x10a924();await K['connect'](_0x4b2136),Y(_0x1efc53(0x8e)),Y('starting\x20SSE\x20listener...'),v()[_0x1efc53(0xb1)](_0x47f97e=>Y(_0x1efc53(0xfd)+_0x47f97e)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4d5f8a(),'hostname':a0_0x4d5f8a(),'agent':_0x1efc53(0xf0),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x1efc53(0xd3)](()=>Y(_0x1efc53(0xd7)+Z+_0x1efc53(0xec)+w[_0x1efc53(0xe7)](0x0,0x8)+')'))[_0x1efc53(0xb1)](_0x13e86b=>Y('warning:\x20could\x20not\x20register:\x20'+_0x13e86b)),setInterval(()=>{const _0x4781a9=_0x1efc53;P(_0x4781a9(0xa0),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4d5f8a(),'hostname':a0_0x4d5f8a(),'agent':'claude-code','project_dir':process[_0x4781a9(0xc9)](),'tmux_name':f||void 0x0})[_0x4781a9(0xb1)](_0x51c231=>Y(_0x4781a9(0xa5)+_0x51c231));},0x2bf20),Y(_0x1efc53(0xb4));}S()[a0_0x196d7c(0xb1)](_0x15bd4e=>{const _0x554d4e=a0_0x196d7c;Y(_0x554d4e(0xd4)+_0x15bd4e),process['exit'](0x1);});async function N(){const _0x12a694=a0_0x196d7c;Y(_0x12a694(0xd1)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x12a694(0xab),'task':_0x12a694(0xd2)})['catch'](()=>{}),process[_0x12a694(0xce)](0x0);}process[a0_0x196d7c(0xcb)]['on']('end',()=>N()),process['on'](a0_0x196d7c(0x106),()=>N()),process['on']('SIGINT',()=>N());function a0_0x5274(){const _0x37270a=['text','token','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','find','Target\x20session\x20alias','ENV:\x20URL=','slice','normal','553335NIZuLU','alias','failed','\x22\x20(','setRequestHandler',']\x20[commhub]\x20','from','claude-code','type','number','in_progress','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','getReader','from_session','application/json','connected','completed','\x20from\x20','high','get_all_status','SSE\x20fatal:\x20','ack_inbox','commhub','stringify','idle','commhub_report_status','decode','0.3.0','trim','SIGTERM','Message\x20content','\x20CWD=','new_task','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','CommHub\x20init\x20failed:\x20','notification','/mcp','read','Session\x20alias:\x20','set','utf-8','\x20RESUME_ID=','parse','data:\x20','\x20PROJECT_ENV=','1195dOhwcl','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Authorization','MCP\x20stdio\x20connected','delete','pop','hub','commhub_send_message','.env','blocked','4631662AtuMdj','get','status','length','Bearer\x20','config.json','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','Progress\x200-100','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','...\x20TMUX=','report_status','statusText','338452srSJRH','POST','get_inbox','heartbeat\x20failed:\x20','504776NZkgzJ','replied','replace','object','tmux\x20display-message\x20-p\x20\x27#S\x27','error','.claude/channels/commhub','no\x20response','commhub_get_all_status','randomUUID','commhub-channel','catch','connecting\x20to\x20','message','ready\x20—\x20waiting\x20for\x20events','cancelled','content','commhub_send_task','2.0','split','1264QyIPHI','parse\x20error:\x20','string','startsWith','join','params','Reply\x20text\x20/\x20result\x20summary','notifications/claude/channel',':\x20inbox_count=','SSE\x20error:\x20','2025-03-26','message_id','45297GiZNwp','task','21606ONWcIo','cwd','body','stdin','init\x20failed:\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','exit','priority','stderr','shutting\x20down,\x20reporting\x20offline...','session\x20disconnected','then','fatal:\x20','2634852CdORQS','inbox_count','registered\x20as\x20\x22','Current\x20task\x20description','SSE\x20connected\x20as\x20\x22','commhub_reply','Priority\x20(default:\x20normal)','write','tools/call','send_message','unknown\x20tool','messages'];a0_0x5274=function(){return _0x37270a;};return a0_0x5274();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.15",
|
|
4
4
|
"description": "AI Agent Network — Server + Client + Setup in one package. SSE real-time communication for multi-agent orchestration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|