@sleep2agi/agent-network 2.2.5 → 2.2.6-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
|
+
function a0_0x2a51(_0x444a45,_0x36f37a){_0x444a45=_0x444a45-0x154;const _0x8e1b71=a0_0x8e1b();let _0x2a5112=_0x8e1b71[_0x444a45];return _0x2a5112;}const a0_0x513285=a0_0x2a51;(function(_0x5a6479,_0x4ccca8){const _0x321baf=a0_0x2a51,_0x204ae7=_0x5a6479();while(!![]){try{const _0x2b1323=parseInt(_0x321baf(0x173))/0x1*(-parseInt(_0x321baf(0x1aa))/0x2)+-parseInt(_0x321baf(0x180))/0x3+-parseInt(_0x321baf(0x1a2))/0x4+parseInt(_0x321baf(0x158))/0x5*(parseInt(_0x321baf(0x188))/0x6)+parseInt(_0x321baf(0x15d))/0x7+-parseInt(_0x321baf(0x172))/0x8+-parseInt(_0x321baf(0x176))/0x9*(-parseInt(_0x321baf(0x19c))/0xa);if(_0x2b1323===_0x4ccca8)break;else _0x204ae7['push'](_0x204ae7['shift']());}catch(_0x5f499a){_0x204ae7['push'](_0x204ae7['shift']());}}}(a0_0x8e1b,0xd9f50));import{EventEmitter as a0_0x4e2992}from'events';import{hostname as a0_0x15fd20}from'os';class T extends a0_0x4e2992{[a0_0x513285(0x1a3)];['alias'];[a0_0x513285(0x175)];[a0_0x513285(0x1a9)];[a0_0x513285(0x182)];[a0_0x513285(0x15f)];[a0_0x513285(0x155)];[a0_0x513285(0x186)];[a0_0x513285(0x166)];[a0_0x513285(0x178)]=!0x1;constructor(_0x17a6aa){const _0x3df388=a0_0x513285;super();if(this[_0x3df388(0x1a3)]=_0x17a6aa[_0x3df388(0x1a3)][_0x3df388(0x195)](/\/$/,''),this['alias']=_0x17a6aa[_0x3df388(0x193)],this[_0x3df388(0x175)]=_0x17a6aa[_0x3df388(0x175)],this[_0x3df388(0x1a9)]=_0x17a6aa[_0x3df388(0x1a9)]||_0x3df388(0x19f),this['resumeId']=_0x3df388(0x17e)+_0x17a6aa['alias']+'-'+Date[_0x3df388(0x17a)]()['toString'](0x24),this[_0x3df388(0x15f)]=_0x17a6aa['heartbeatInterval']??0x2bf20,this[_0x3df388(0x155)]=_0x17a6aa['reconnectDelay']??0xbb8,_0x17a6aa['autoConnect']!==!0x1)this[_0x3df388(0x19d)]();}['log'](_0x281753){const _0x53d9df=a0_0x513285;console['log']('['+new Date()[_0x53d9df(0x16d)]()[_0x53d9df(0x17d)](0x0,0x8)+_0x53d9df(0x18f)+this[_0x53d9df(0x193)]+']\x20'+_0x281753);}async['call'](_0x183f81,_0x272531){const _0x154cfe=a0_0x513285;let _0x5e2d16={'Content-Type':'application/json','Accept':_0x154cfe(0x15a)};if(this[_0x154cfe(0x175)])_0x5e2d16[_0x154cfe(0x19a)]=_0x154cfe(0x174)+this[_0x154cfe(0x175)];let _0x57c7fe=await(await fetch(this['url']+_0x154cfe(0x171),{'method':_0x154cfe(0x199),'headers':_0x5e2d16,'body':JSON[_0x154cfe(0x1a5)]({'jsonrpc':_0x154cfe(0x1a4),'id':Date[_0x154cfe(0x17a)](),'method':'tools/call','params':{'name':_0x183f81,'arguments':_0x272531}})}))[_0x154cfe(0x194)](),_0x20d88e=_0x57c7fe[_0x154cfe(0x183)](/data: (.+)/),_0x400550=_0x20d88e?JSON[_0x154cfe(0x16a)](_0x20d88e[0x1]):JSON[_0x154cfe(0x16a)](_0x57c7fe),_0x4930c3=_0x400550?.[_0x154cfe(0x160)]?.[_0x154cfe(0x18e)]?.[0x0]?.[_0x154cfe(0x194)];return _0x4930c3?JSON[_0x154cfe(0x16a)](_0x4930c3):_0x400550;}async[a0_0x513285(0x19d)](){const _0x3a38d5=a0_0x513285;if(this['running'])return;this['running']=!0x0,await this[_0x3a38d5(0x17f)](_0x3a38d5(0x198)),this[_0x3a38d5(0x16e)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x678da6=_0x3a38d5;this[_0x678da6(0x17f)]('idle')['catch'](_0x3b43c4=>this[_0x678da6(0x16e)](_0x678da6(0x16c)+_0x3b43c4[_0x678da6(0x17c)]));},this['heartbeatInterval']),this[_0x3a38d5(0x18c)]();}async[a0_0x513285(0x187)](){const _0x449129=a0_0x513285;if(this[_0x449129(0x178)]=!0x1,this[_0x449129(0x166)]?.[_0x449129(0x184)](),this[_0x449129(0x186)])clearInterval(this['heartbeatTimer']);await this[_0x449129(0x17f)](_0x449129(0x18a))[_0x449129(0x19e)](()=>{}),this[_0x449129(0x16e)](_0x449129(0x196));}async[a0_0x513285(0x1a6)](_0x5c25a7,_0x5ac983,_0x328619=a0_0x513285(0x168)){const _0x1663c6=a0_0x513285;return this[_0x1663c6(0x159)](_0x1663c6(0x162),{'alias':_0x5c25a7,'task':_0x5ac983,'priority':_0x328619,'from_session':this[_0x1663c6(0x193)]});}async[a0_0x513285(0x17c)](_0x3f6aaf,_0x43dcd2){const _0x1d24a2=a0_0x513285;return this[_0x1d24a2(0x159)](_0x1d24a2(0x17b),{'alias':_0x3f6aaf,'message':_0x43dcd2,'from_session':this['alias']});}async[a0_0x513285(0x154)](_0x2cc709,_0x334e50,_0x4552b4=a0_0x513285(0x18b)){const _0x1470e3=a0_0x513285;return this[_0x1470e3(0x159)](_0x1470e3(0x170),{'in_reply_to':_0x2cc709,'text':_0x334e50,'status':_0x4552b4});}async[a0_0x513285(0x17f)](_0x5dc573,_0x3c90c0){const _0x19810c=a0_0x513285;return this['call'](_0x19810c(0x167),{'resume_id':this[_0x19810c(0x182)],'alias':this['alias'],'status':_0x5dc573,'server':a0_0x15fd20(),'hostname':a0_0x15fd20(),'agent':this['agent'],'project_dir':process[_0x19810c(0x163)](),..._0x3c90c0});}async[a0_0x513285(0x191)](){const _0x1678bc=a0_0x513285;return this[_0x1678bc(0x159)]('get_all_status',{});}async['broadcast'](_0x4d17fb,_0x12a67a){const _0x5ca949=a0_0x513285;return this['call'](_0x5ca949(0x19b),{'message':_0x4d17fb,'filter_server':_0x12a67a?.[_0x5ca949(0x1a0)],'filter_status':_0x12a67a?.[_0x5ca949(0x17f)]});}async[a0_0x513285(0x18c)](){const _0x58eb06=a0_0x513285;let _0xedce63=encodeURIComponent(this[_0x58eb06(0x193)]),_0xc6ee44=this['url']+_0x58eb06(0x164)+_0xedce63,_0x1ba87a=this['reconnectDelay'];while(this['running']){try{this[_0x58eb06(0x166)]=new AbortController();let _0x4abf50={'Accept':'text/event-stream'};if(this[_0x58eb06(0x175)])_0x4abf50['Authorization']=_0x58eb06(0x174)+this[_0x58eb06(0x175)];let _0x504d6d=await fetch(_0xc6ee44,{'headers':_0x4abf50,'signal':this[_0x58eb06(0x166)][_0x58eb06(0x15c)]});if(!_0x504d6d['ok']||!_0x504d6d[_0x58eb06(0x190)]){this['log'](_0x58eb06(0x165)+_0x504d6d[_0x58eb06(0x17f)]),await this[_0x58eb06(0x177)](_0x1ba87a),_0x1ba87a=Math['min'](_0x1ba87a*1.5,0xea60);continue;}_0x1ba87a=this['reconnectDelay'];let _0x233e5c=_0x504d6d[_0x58eb06(0x190)][_0x58eb06(0x181)](),_0x4f746=new TextDecoder(),_0x59b88a='';while(this['running']){let {done:_0x445f79,value:_0x12a5d4}=await _0x233e5c['read']();if(_0x445f79)break;_0x59b88a+=_0x4f746[_0x58eb06(0x157)](_0x12a5d4,{'stream':!0x0});let _0x26810a=_0x59b88a['split']('\x0a');_0x59b88a=_0x26810a[_0x58eb06(0x156)]()||'';for(let _0x2a5fea of _0x26810a){if(!_0x2a5fea[_0x58eb06(0x15b)]('data:\x20'))continue;try{let _0x2da2ff=JSON['parse'](_0x2a5fea['slice'](0x6));if(_0x2da2ff[_0x58eb06(0x1a7)]==='connected'){this[_0x58eb06(0x16e)](_0x58eb06(0x192)),this[_0x58eb06(0x169)](_0x58eb06(0x15e));continue;}if(_0x2da2ff[_0x58eb06(0x1a7)]==='new_task'||_0x2da2ff[_0x58eb06(0x1a7)]==='new_message'||_0x2da2ff['type']===_0x58eb06(0x19b))await this['processInbox']();}catch{}}}}catch(_0x37b929){if(_0x37b929[_0x58eb06(0x179)]===_0x58eb06(0x161))break;this['emit']('error',_0x37b929),this[_0x58eb06(0x16e)]('SSE\x20error:\x20'+_0x37b929[_0x58eb06(0x17c)]);}if(this['running'])this[_0x58eb06(0x169)](_0x58eb06(0x196)),this[_0x58eb06(0x16e)](_0x58eb06(0x185)+_0x1ba87a/0x3e8+'s...'),await this[_0x58eb06(0x177)](_0x1ba87a),_0x1ba87a=Math[_0x58eb06(0x16f)](_0x1ba87a*1.5,0xea60);}}async[a0_0x513285(0x18d)](){const _0x57aa78=a0_0x513285;try{let _0x35674f=(await this['call'](_0x57aa78(0x189),{'alias':this[_0x57aa78(0x193)],'limit':0xa}))?.[_0x57aa78(0x1a1)]||[];for(let _0xfc8825 of _0x35674f)await this[_0x57aa78(0x159)](_0x57aa78(0x197),{'alias':this['alias'],'message_id':_0xfc8825['id']}),this[_0x57aa78(0x16e)]('←\x20'+_0xfc8825[_0x57aa78(0x16b)]+':\x20'+_0xfc8825[_0x57aa78(0x18e)][_0x57aa78(0x17d)](0x0,0x3c)),this['emit'](_0x57aa78(0x1a8),_0xfc8825),this['emit'](_0x57aa78(0x17c),_0xfc8825);}catch(_0x34968f){this[_0x57aa78(0x16e)]('inbox\x20error:\x20'+_0x34968f[_0x57aa78(0x17c)]);}}[a0_0x513285(0x177)](_0x5acb07){return new Promise(_0x1d971f=>setTimeout(_0x1d971f,_0x5acb07));}}var $=T;export{$ as default,T as CommHub};function a0_0x8e1b(){const _0x39bd0a=['agent','611596GdjhHG','reply','reconnectDelay','pop','decode','135seDDSG','call','application/json,\x20text/event-stream','startsWith','signal','9992178eMosot','connected','heartbeatInterval','result','AbortError','send_task','cwd','/events/','SSE\x20failed:\x20','sseAbort','report_status','normal','emit','parse','from_session','heartbeat\x20failed:\x20','toTimeString','log','min','send_reply','/mcp','11229904YxwScq','3VvozPU','Bearer\x20','token','9cJicam','sleep','running','name','now','send_message','message','slice','sdk-','status','3341649EWxXCs','getReader','resumeId','match','abort','SSE\x20reconnecting\x20in\x20','heartbeatTimer','disconnect','317484YxjryM','get_inbox','offline','completed','connectSSE','processInbox','content',']\x20[commhub:','body','getAllStatus','SSE\x20connected','alias','text','replace','disconnected','ack_inbox','idle','POST','Authorization','broadcast','30238870GNIIfD','connect','catch','sdk','server','messages','6209008HgiVlP','url','2.0','stringify','send','type','task'];a0_0x8e1b=function(){return _0x39bd0a;};return a0_0x8e1b();}
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x53a9fb=a0_0x1fd4;(function(_0x31ea6c,_0x2d2ff9){const _0x54a74b=a0_0x1fd4,_0x9e49b9=_0x31ea6c();while(!![]){try{const _0x404f4e=-parseInt(_0x54a74b(0x220))/0x1*(-parseInt(_0x54a74b(0x200))/0x2)+-parseInt(_0x54a74b(0x22c))/0x3+parseInt(_0x54a74b(0x240))/0x4+-parseInt(_0x54a74b(0x236))/0x5+parseInt(_0x54a74b(0x23e))/0x6*(-parseInt(_0x54a74b(0x1f7))/0x7)+parseInt(_0x54a74b(0x254))/0x8+parseInt(_0x54a74b(0x1fc))/0x9;if(_0x404f4e===_0x2d2ff9)break;else _0x9e49b9['push'](_0x9e49b9['shift']());}catch(_0x46797e){_0x9e49b9['push'](_0x9e49b9['shift']());}}}(a0_0x3c9d,0xa8ef4));import{readFileSync as a0_0x144e86,existsSync as a0_0x5484f0}from'fs';import{randomUUID as a0_0x382fc9}from'crypto';import{join as a0_0xf6487}from'path';import{hostname as a0_0x153e36}from'os';import{execSync as a0_0x48a134}from'child_process';import{Server as a0_0x4afe9c}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x86034}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x39805c,CallToolRequestSchema as a0_0x35f265}from'@modelcontextprotocol/sdk/types.js';function p(_0x14ad97){const _0xf2ae0a=a0_0x1fd4;if(!a0_0x5484f0(_0x14ad97))return;for(let _0x4fe77c of a0_0x144e86(_0x14ad97,_0xf2ae0a(0x206))[_0xf2ae0a(0x1e3)]('\x0a')){let _0x548fc8=_0x4fe77c[_0xf2ae0a(0x252)]();if(!_0x548fc8||_0x548fc8['startsWith']('#'))continue;let _0x4eb1b8=_0x548fc8['indexOf']('=');if(_0x4eb1b8<0x0)continue;let _0x314bb=_0x548fc8[_0xf2ae0a(0x216)](0x0,_0x4eb1b8)[_0xf2ae0a(0x252)](),_0x8b075f=_0x548fc8[_0xf2ae0a(0x216)](_0x4eb1b8+0x1)[_0xf2ae0a(0x252)]()[_0xf2ae0a(0x20d)](/^["']|["']$/g,'');if(!process.env[_0x314bb])process.env[_0x314bb]=_0x8b075f;}}var C=process.env.HOME||'~',T=a0_0xf6487(C,a0_0x53a9fb(0x248));p(a0_0xf6487(T,'.env'));var L=process[a0_0x53a9fb(0x247)]()[a0_0x53a9fb(0x20d)](/\//g,'-');p(a0_0xf6487(T,L,a0_0x53a9fb(0x222)));function U(){const _0x5c2c8a=a0_0x53a9fb;try{return a0_0x48a134('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x5c2c8a(0x206),'timeout':0x7d0})[_0x5c2c8a(0x252)]();}catch{return'';}}function a0_0x3c9d(){const _0x11ed88=['inbox_count','from_session','init\x20failed:\x20','read','2289114ooScHH','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','commhub_send_task','send_reply','find','catch','body','commhub_send_message','Message\x20content','Session\x20alias:\x20','6631130RyipLU','Bearer\x20','→\x20injected\x20task\x20','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','...\x20TMUX=','exit','\x20CWD=','2.0','6DMCiQy','type','2366756wsdbPk','from','2025-03-26','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','shutting\x20down,\x20reporting\x20offline...','Reply\x20text\x20/\x20result\x20summary','commhub_report_status','cwd','.claude/channels/commhub','Target\x20session\x20alias','error','\x20RESUME_ID=','connect',']\x20[commhub]\x20','cancelled','get_inbox','ENV:\x20URL=','working','trim','Current\x20task\x20description','9033032iWcECH','http://127.0.0.1:9200','commhub_get_all_status','/mcp','blocked','\x22\x20(','SSE\x20connection\x20error:\x20','ack_inbox','string','completed','object','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','/events/','message','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','split','SSE\x20connected\x20as\x20\x22','no\x20response','ready\x20—\x20waiting\x20for\x20events','\x20from\x20','Priority\x20(default:\x20normal)','result','status','get','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','number','0.3.0','getReader','content','SIGTERM','idle','claude-code','hub','commhub','stderr','7279909pGvnBV','new_message','commhub-channel','end','SSE\x20error:\x20','7865649QHgJRI','toTimeString','alias','priority','2sbEYQv','warning:\x20could\x20not\x20register:\x20','text','parse','messages','stringify','utf-8','set','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','normal','none','Task\x20content','startsWith','replace','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','join','message_id','commhub_reply','connected','token','.anet','MCP\x20stdio\x20connected','slice','application/json,\x20text/event-stream','initialize','tools/call','starting\x20SSE\x20listener...','pop','data:\x20','low','setRequestHandler','params','1226428oVXRsp','failed','.env','in_progress','report_status','application/json','length','notifications/claude/channel'];a0_0x3c9d=function(){return _0x11ed88;};return a0_0x3c9d();}function v(){const _0x2b5034=a0_0x53a9fb;try{let _0x1e785e=a0_0xf6487(C,_0x2b5034(0x214),'config.json');if(a0_0x5484f0(_0x1e785e))return JSON[_0x2b5034(0x203)](a0_0x144e86(_0x1e785e,_0x2b5034(0x206)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x53a9fb(0x1f4)]||a0_0x53a9fb(0x255),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x153e36(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x382fc9(),X=process.env.COMMHUB_TOKEN||H[a0_0x53a9fb(0x213)]||'';function Y(_0x650ee9){const _0x1f9d69=a0_0x53a9fb;let _0x1292ef=new Date()[_0x1f9d69(0x1fd)]()['slice'](0x0,0x8);process[_0x1f9d69(0x1f6)]['write']('['+_0x1292ef+_0x1f9d69(0x24d)+_0x650ee9+'\x0a');}function a0_0x1fd4(_0x5c031b,_0x2f5ec2){_0x5c031b=_0x5c031b-0x1d7;const _0x3c9d0b=a0_0x3c9d();let _0x1fd479=_0x3c9d0b[_0x5c031b];return _0x1fd479;}function h(_0x4031b8){return new Promise(_0x4dfc1d=>setTimeout(_0x4dfc1d,_0x4031b8));}Y(a0_0x53a9fb(0x250)+f+'\x20ALIAS='+Z+a0_0x53a9fb(0x24b)+w[a0_0x53a9fb(0x216)](0x0,0x8)+a0_0x53a9fb(0x23a)+(j||a0_0x53a9fb(0x20a))+a0_0x53a9fb(0x23c)+process[a0_0x53a9fb(0x247)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x4afe9c({'name':a0_0x53a9fb(0x1f9),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x53a9fb(0x1df),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x53a9fb(0x239),a0_0x53a9fb(0x243),a0_0x53a9fb(0x235)+Z][a0_0x53a9fb(0x20f)]('\x0a')});K[a0_0x53a9fb(0x21e)](a0_0x39805c,async()=>({'tools':[{'name':a0_0x53a9fb(0x211),'description':a0_0x53a9fb(0x20e),'inputSchema':{'type':a0_0x53a9fb(0x1de),'properties':{'task_id':{'type':a0_0x53a9fb(0x1dc),'description':a0_0x53a9fb(0x22d)},'text':{'type':a0_0x53a9fb(0x1dc),'description':a0_0x53a9fb(0x245)},'status':{'type':a0_0x53a9fb(0x1dc),'enum':[a0_0x53a9fb(0x1dd),a0_0x53a9fb(0x221),a0_0x53a9fb(0x24e),a0_0x53a9fb(0x1d8),'error',a0_0x53a9fb(0x223)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x53a9fb(0x202)]}},{'name':a0_0x53a9fb(0x246),'description':a0_0x53a9fb(0x1e2),'inputSchema':{'type':a0_0x53a9fb(0x1de),'properties':{'status':{'type':a0_0x53a9fb(0x1dc),'enum':[a0_0x53a9fb(0x251),a0_0x53a9fb(0x1f2),a0_0x53a9fb(0x1d8),a0_0x53a9fb(0x24a)]},'task':{'type':a0_0x53a9fb(0x1dc),'description':a0_0x53a9fb(0x253)},'progress':{'type':a0_0x53a9fb(0x1ed),'description':'Progress\x200-100'}},'required':[a0_0x53a9fb(0x1ea)]}},{'name':a0_0x53a9fb(0x22e),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x53a9fb(0x1dc),'description':a0_0x53a9fb(0x249)},'task':{'type':a0_0x53a9fb(0x1dc),'description':a0_0x53a9fb(0x20b)},'priority':{'type':'string','enum':['high','normal',a0_0x53a9fb(0x21d)],'description':a0_0x53a9fb(0x1e8)}},'required':['alias','task']}},{'name':a0_0x53a9fb(0x233),'description':a0_0x53a9fb(0x208),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x53a9fb(0x1dc),'description':a0_0x53a9fb(0x249)},'message':{'type':'string','description':a0_0x53a9fb(0x234)}},'required':[a0_0x53a9fb(0x1fe),'message']}},{'name':'commhub_get_all_status','description':a0_0x53a9fb(0x1ec),'inputSchema':{'type':a0_0x53a9fb(0x1de),'properties':{}}}]}));async function P(_0x355608,_0x224c95){const _0x240c79=a0_0x53a9fb;let _0x5f1141=await fetch(f+_0x240c79(0x1d7),{'method':'POST','headers':{'Content-Type':_0x240c79(0x225),'Accept':_0x240c79(0x217),...X?{'Authorization':_0x240c79(0x237)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x240c79(0x23d),'id':0x1,'method':_0x240c79(0x218),'params':{'protocolVersion':_0x240c79(0x242),'capabilities':{},'clientInfo':{'name':_0x240c79(0x1f9),'version':_0x240c79(0x1ee)}}})});if(!_0x5f1141['ok']){let _0x3acae6=await _0x5f1141[_0x240c79(0x202)]();return Y('CommHub\x20init\x20failed:\x20'+_0x5f1141[_0x240c79(0x1ea)]+'\x20'+_0x3acae6[_0x240c79(0x216)](0x0,0x64)),{'ok':!0x1,'error':_0x240c79(0x22a)+_0x5f1141['status']};}await _0x5f1141[_0x240c79(0x202)]();let _0x4c552d=(await(await fetch(f+_0x240c79(0x1d7),{'method':'POST','headers':{'Content-Type':_0x240c79(0x225),'Accept':_0x240c79(0x217),...X?{'Authorization':_0x240c79(0x237)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':_0x240c79(0x219),'params':{'name':_0x355608,'arguments':_0x224c95}})}))['text']())[_0x240c79(0x1e3)]('\x0a')['find'](_0x217eca=>_0x217eca[_0x240c79(0x20c)](_0x240c79(0x21c)));if(_0x4c552d){let _0x1eea04=JSON['parse'](_0x4c552d[_0x240c79(0x216)](0x6));return _0x1eea04?.['result']?.[_0x240c79(0x1f0)]?.[0x0]?.[_0x240c79(0x202)]?JSON[_0x240c79(0x203)](_0x1eea04[_0x240c79(0x1e9)]['content'][0x0]['text']):_0x1eea04;}return{'ok':!0x1,'error':_0x240c79(0x1e5)};}K[a0_0x53a9fb(0x21e)](a0_0x35f265,async _0x552426=>{const _0xec80cc=a0_0x53a9fb;let {name:_0x347c16,arguments:_0x212d8c}=_0x552426[_0xec80cc(0x21f)];if(_0x347c16==='commhub_reply'){let {task_id:_0x55f365,text:_0x1b7795,status:_0x452d72}=_0x212d8c;if(_0x452d72===_0xec80cc(0x1dd)||_0x452d72===_0xec80cc(0x221)||_0x452d72===_0xec80cc(0x24e)){let _0x61e01c=_0x452d72===_0xec80cc(0x1dd)?'replied':_0x452d72,_0x134549=_0x55f365?k[_0xec80cc(0x1eb)](_0x55f365)||'hub':_0xec80cc(0x1f4),_0x4af78b=await P(_0xec80cc(0x22f),{'alias':_0x134549,'text':_0x1b7795,'in_reply_to':_0x55f365||void 0x0,'status':_0x61e01c,'from_session':Z});if(_0x55f365)k['delete'](_0x55f365);return{'content':[{'type':_0xec80cc(0x202),'text':JSON[_0xec80cc(0x205)](_0x4af78b)}]};}let _0x3bde3b=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x452d72===_0xec80cc(0x1d8)?_0xec80cc(0x1d8):_0x452d72===_0xec80cc(0x24a)?_0xec80cc(0x24a):_0xec80cc(0x251),'task':_0x1b7795['slice'](0x0,0xc8),'output':_0x1b7795});return{'content':[{'type':_0xec80cc(0x202),'text':JSON[_0xec80cc(0x205)](_0x3bde3b)}]};}if(_0x347c16==='commhub_report_status'){let {status:_0x558d20,task:_0x2fcaa6,progress:_0x1a40c4}=_0x212d8c,_0xf3cb93=await P(_0xec80cc(0x224),{'resume_id':w,'alias':Z,'status':_0x558d20,'task':_0x2fcaa6,'progress':_0x1a40c4});return{'content':[{'type':_0xec80cc(0x202),'text':JSON[_0xec80cc(0x205)](_0xf3cb93)}]};}if(_0x347c16===_0xec80cc(0x22e)){let {alias:_0xfed9f5,task:_0x4e7638,priority:_0x40fd26}=_0x212d8c,_0x3b9718=await P('send_task',{'alias':_0xfed9f5,'task':_0x4e7638,'priority':_0x40fd26||_0xec80cc(0x209),'from_session':Z});return{'content':[{'type':_0xec80cc(0x202),'text':JSON[_0xec80cc(0x205)](_0x3b9718)}]};}if(_0x347c16===_0xec80cc(0x233)){let {alias:_0x2defcb,message:_0x5598d7}=_0x212d8c,_0x380b5e=await P('send_message',{'alias':_0x2defcb,'message':_0x5598d7,'from_session':Z});return{'content':[{'type':_0xec80cc(0x202),'text':JSON['stringify'](_0x380b5e)}]};}if(_0x347c16===_0xec80cc(0x256)){let _0x216be2=await P('get_all_status',{});return{'content':[{'type':_0xec80cc(0x202),'text':JSON[_0xec80cc(0x205)](_0x216be2)}]};}return{'content':[{'type':_0xec80cc(0x202),'text':JSON[_0xec80cc(0x205)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x2c6203=a0_0x53a9fb;let _0x4a6324=f+_0x2c6203(0x1e0)+encodeURIComponent(Z),_0x1e7da5={};if(X)_0x1e7da5['Authorization']=_0x2c6203(0x237)+X;Y('connecting\x20to\x20'+_0x4a6324);while(!0x0){try{let _0x2fffbf=await fetch(_0x4a6324,{'headers':_0x1e7da5});if(!_0x2fffbf['ok']){Y(_0x2c6203(0x1fb)+_0x2fffbf[_0x2c6203(0x1ea)]+'\x20'+_0x2fffbf['statusText']),await h(0x1388);continue;}let _0x368c97=_0x2fffbf[_0x2c6203(0x232)][_0x2c6203(0x1ef)](),_0x4694a9=new TextDecoder(),_0x340623='';while(!0x0){let {done:_0x4e07c1,value:_0x55123a}=await _0x368c97[_0x2c6203(0x22b)]();if(_0x4e07c1)break;_0x340623+=_0x4694a9['decode'](_0x55123a,{'stream':!0x0});let _0x1f1b8a=_0x340623[_0x2c6203(0x1e3)]('\x0a\x0a');_0x340623=_0x1f1b8a[_0x2c6203(0x21b)]()||'';for(let _0x3eaa7a of _0x1f1b8a){let _0x3fd8aa=_0x3eaa7a[_0x2c6203(0x1e3)]('\x0a')[_0x2c6203(0x230)](_0x442741=>_0x442741[_0x2c6203(0x20c)](_0x2c6203(0x21c)));if(!_0x3fd8aa)continue;try{let _0x36334f=JSON[_0x2c6203(0x203)](_0x3fd8aa['slice'](0x6));await S(_0x36334f);}catch(_0x2b71dc){Y('parse\x20error:\x20'+_0x2b71dc);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x3dd2b7){Y(_0x2c6203(0x1da)+_0x3dd2b7);}await h(0xbb8);}}async function S(_0x5091ff){const _0x3bf2bb=a0_0x53a9fb;if(_0x5091ff['type']===_0x3bf2bb(0x212)){Y(_0x3bf2bb(0x1e4)+Z+'\x22');return;}if(_0x5091ff['type']===_0x3bf2bb(0x1f8)){if(Y('←\x20message\x20from\x20'+_0x5091ff[_0x3bf2bb(0x241)]+':\x20'+_0x5091ff[_0x3bf2bb(0x1e1)][_0x3bf2bb(0x216)](0x0,0x3c)),await K['notification']({'method':_0x3bf2bb(0x227),'params':{'content':_0x5091ff[_0x3bf2bb(0x1e1)],'meta':{'sender':_0x5091ff[_0x3bf2bb(0x241)]||_0x3bf2bb(0x1f4),'sender_id':'commhub','user':_0x5091ff[_0x3bf2bb(0x241)]||'hub','priority':_0x3bf2bb(0x209)}}}),_0x5091ff[_0x3bf2bb(0x210)])await P(_0x3bf2bb(0x1db),{'alias':Z,'message_id':_0x5091ff[_0x3bf2bb(0x210)]});return;}if(_0x5091ff[_0x3bf2bb(0x23f)]==='new_task'||_0x5091ff[_0x3bf2bb(0x23f)]==='broadcast'){Y('←\x20'+_0x5091ff[_0x3bf2bb(0x23f)]+':\x20inbox_count='+_0x5091ff[_0x3bf2bb(0x228)]+'\x20priority='+(_0x5091ff[_0x3bf2bb(0x1ff)]||'normal'));let _0x368d95=await P(_0x3bf2bb(0x24f),{'alias':Z,'limit':0x5});if(_0x368d95?.['ok']&&_0x368d95[_0x3bf2bb(0x204)]?.[_0x3bf2bb(0x226)]>0x0)for(let _0x5baadc of _0x368d95[_0x3bf2bb(0x204)]){let _0x5e003e={'sender':_0x5baadc[_0x3bf2bb(0x229)]||_0x3bf2bb(0x1f4),'sender_id':_0x3bf2bb(0x1f5),'user':_0x5baadc[_0x3bf2bb(0x229)]||_0x3bf2bb(0x1f4),'task_id':_0x5baadc['id'],'priority':_0x5baadc[_0x3bf2bb(0x1ff)]||'normal'};k[_0x3bf2bb(0x207)](_0x5baadc['id'],_0x5baadc['from_session']||'hub'),await K['notification']({'method':_0x3bf2bb(0x227),'params':{'content':_0x5baadc['content'],'meta':_0x5e003e}}),Y(_0x3bf2bb(0x238)+_0x5baadc['id']['slice'](0x0,0x8)+_0x3bf2bb(0x1e7)+_0x5baadc[_0x3bf2bb(0x229)]+':\x20'+_0x5baadc[_0x3bf2bb(0x1f0)][_0x3bf2bb(0x216)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x5baadc['id']});}}}async function A(){const _0x8063e5=a0_0x53a9fb;let _0x257769=new a0_0x86034();await K[_0x8063e5(0x24c)](_0x257769),Y(_0x8063e5(0x215)),Y(_0x8063e5(0x21a)),u()[_0x8063e5(0x231)](_0x4ecc0f=>Y('SSE\x20fatal:\x20'+_0x4ecc0f)),P(_0x8063e5(0x224),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x153e36(),'hostname':a0_0x153e36(),'agent':_0x8063e5(0x1f3),'project_dir':process[_0x8063e5(0x247)](),'tmux_name':j||void 0x0})['then'](()=>Y('registered\x20as\x20\x22'+Z+_0x8063e5(0x1d9)+w['slice'](0x0,0x8)+')'))[_0x8063e5(0x231)](_0x4105eb=>Y(_0x8063e5(0x201)+_0x4105eb)),setInterval(()=>{const _0x157073=_0x8063e5;P('report_status',{'resume_id':w,'alias':Z,'status':_0x157073(0x1f2),'server':a0_0x153e36(),'hostname':a0_0x153e36(),'agent':_0x157073(0x1f3),'project_dir':process[_0x157073(0x247)](),'tmux_name':j||void 0x0})['catch'](_0x45e4c9=>Y('heartbeat\x20failed:\x20'+_0x45e4c9));},0x2bf20),Y(_0x8063e5(0x1e6));}A()[a0_0x53a9fb(0x231)](_0xfe7712=>{const _0x2dbb2b=a0_0x53a9fb;Y('fatal:\x20'+_0xfe7712),process[_0x2dbb2b(0x23b)](0x1);});async function N(){const _0x5902a3=a0_0x53a9fb;Y(_0x5902a3(0x244)),await P('report_status',{'resume_id':w,'alias':Z,'status':'error','task':'session\x20disconnected'})[_0x5902a3(0x231)](()=>{}),process['exit'](0x0);}process['stdin']['on'](a0_0x53a9fb(0x1fa),()=>N()),process['on'](a0_0x53a9fb(0x1f1),()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x2c6966=a0_0x563f;(function(_0x25c594,_0x454268){const _0x3e9165=a0_0x563f,_0x261810=_0x25c594();while(!![]){try{const _0xae0309=parseInt(_0x3e9165(0x20a))/0x1*(parseInt(_0x3e9165(0x1ea))/0x2)+-parseInt(_0x3e9165(0x1da))/0x3*(parseInt(_0x3e9165(0x1d1))/0x4)+parseInt(_0x3e9165(0x204))/0x5+parseInt(_0x3e9165(0x1f8))/0x6*(parseInt(_0x3e9165(0x1e0))/0x7)+parseInt(_0x3e9165(0x203))/0x8*(parseInt(_0x3e9165(0x1dd))/0x9)+-parseInt(_0x3e9165(0x201))/0xa*(-parseInt(_0x3e9165(0x1b0))/0xb)+-parseInt(_0x3e9165(0x206))/0xc;if(_0xae0309===_0x454268)break;else _0x261810['push'](_0x261810['shift']());}catch(_0x526942){_0x261810['push'](_0x261810['shift']());}}}(a0_0x8d7b,0x3eac8));import{readFileSync as a0_0x133108,existsSync as a0_0x2673dd}from'fs';import{randomUUID as a0_0x5898e3}from'crypto';import{join as a0_0x5bb2c9}from'path';import{hostname as a0_0x4a6714}from'os';import{execSync as a0_0x5cd1b9}from'child_process';import{Server as a0_0x24638b}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x41583a}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x563f(_0x536c5b,_0x118048){_0x536c5b=_0x536c5b-0x1a3;const _0x8d7bdd=a0_0x8d7b();let _0x563ffc=_0x8d7bdd[_0x536c5b];return _0x563ffc;}import{ListToolsRequestSchema as a0_0x58ba7c,CallToolRequestSchema as a0_0x317fbf}from'@modelcontextprotocol/sdk/types.js';function p(_0x210f51){const _0x8aa3b0=a0_0x563f;if(!a0_0x2673dd(_0x210f51))return;for(let _0x3a3865 of a0_0x133108(_0x210f51,_0x8aa3b0(0x1ef))[_0x8aa3b0(0x1fd)]('\x0a')){let _0x1eac57=_0x3a3865[_0x8aa3b0(0x228)]();if(!_0x1eac57||_0x1eac57[_0x8aa3b0(0x213)]('#'))continue;let _0x1c2e98=_0x1eac57['indexOf']('=');if(_0x1c2e98<0x0)continue;let _0x4a386d=_0x1eac57['slice'](0x0,_0x1c2e98)[_0x8aa3b0(0x228)](),_0x747219=_0x1eac57['slice'](_0x1c2e98+0x1)[_0x8aa3b0(0x228)]()[_0x8aa3b0(0x1ee)](/^["']|["']$/g,'');if(!process.env[_0x4a386d])process.env[_0x4a386d]=_0x747219;}}var C=process.env.HOME||'~',T=a0_0x5bb2c9(C,a0_0x2c6966(0x226));p(a0_0x5bb2c9(T,a0_0x2c6966(0x1ce)));var L=process[a0_0x2c6966(0x1ed)]()[a0_0x2c6966(0x1ee)](/\//g,'-');p(a0_0x5bb2c9(T,L,a0_0x2c6966(0x1ce)));function U(){const _0x3f8fcc=a0_0x2c6966;try{return a0_0x5cd1b9('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x3f8fcc(0x1ef),'timeout':0x7d0})[_0x3f8fcc(0x228)]();}catch{return'';}}function v(){const _0x5e0add=a0_0x2c6966;try{let _0x8d3e19=a0_0x5bb2c9(C,_0x5e0add(0x223),_0x5e0add(0x1d4));if(a0_0x2673dd(_0x8d3e19))return JSON['parse'](a0_0x133108(_0x8d3e19,_0x5e0add(0x1ef)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x2c6966(0x1b6)]||a0_0x2c6966(0x209),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4a6714(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5898e3(),X=process.env.COMMHUB_TOKEN||H[a0_0x2c6966(0x1fe)]||'';function Y(_0x3a2e1c){const _0x15e7a7=a0_0x2c6966;let _0x5a650d=new Date()['toTimeString']()['slice'](0x0,0x8);process[_0x15e7a7(0x217)][_0x15e7a7(0x1cf)]('['+_0x5a650d+_0x15e7a7(0x237)+_0x3a2e1c+'\x0a');}function h(_0x2f6495){return new Promise(_0xd2c4b4=>setTimeout(_0xd2c4b4,_0x2f6495));}Y(a0_0x2c6966(0x1df)+f+a0_0x2c6966(0x222)+Z+a0_0x2c6966(0x235)+w[a0_0x2c6966(0x1cb)](0x0,0x8)+a0_0x2c6966(0x214)+(j||a0_0x2c6966(0x1b7))+a0_0x2c6966(0x1d3)+process[a0_0x2c6966(0x1ed)]()+a0_0x2c6966(0x22b)+L);var k=new Map(),K=new a0_0x24638b({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2c6966(0x1b5),a0_0x2c6966(0x1f2),a0_0x2c6966(0x1b1),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x2c6966(0x1f7)+Z]['join']('\x0a')});K[a0_0x2c6966(0x205)](a0_0x58ba7c,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x2c6966(0x1a4),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x2c6966(0x202),'description':a0_0x2c6966(0x20e)},'text':{'type':'string','description':a0_0x2c6966(0x1fc)},'status':{'type':a0_0x2c6966(0x202),'enum':[a0_0x2c6966(0x22d),a0_0x2c6966(0x1e3),'cancelled',a0_0x2c6966(0x20f),a0_0x2c6966(0x1c0),a0_0x2c6966(0x1c5)],'description':a0_0x2c6966(0x1f0)}},'required':[a0_0x2c6966(0x21f)]}},{'name':a0_0x2c6966(0x1c4),'description':a0_0x2c6966(0x22f),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x2c6966(0x202),'enum':[a0_0x2c6966(0x1ae),a0_0x2c6966(0x1c6),a0_0x2c6966(0x20f),a0_0x2c6966(0x1c0)]},'task':{'type':'string','description':a0_0x2c6966(0x1a7)},'progress':{'type':a0_0x2c6966(0x1e7),'description':a0_0x2c6966(0x1cd)}},'required':[a0_0x2c6966(0x1f4)]}},{'name':a0_0x2c6966(0x21b),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2c6966(0x1f9),'properties':{'alias':{'type':a0_0x2c6966(0x202),'description':a0_0x2c6966(0x1c9)},'task':{'type':a0_0x2c6966(0x202),'description':a0_0x2c6966(0x219)},'priority':{'type':a0_0x2c6966(0x202),'enum':['high',a0_0x2c6966(0x1bd),a0_0x2c6966(0x1c3)],'description':'Priority\x20(default:\x20normal)'}},'required':['alias','task']}},{'name':'commhub_send_message','description':a0_0x2c6966(0x225),'inputSchema':{'type':a0_0x2c6966(0x1f9),'properties':{'alias':{'type':a0_0x2c6966(0x202),'description':'Target\x20session\x20alias'},'message':{'type':a0_0x2c6966(0x202),'description':a0_0x2c6966(0x1db)}},'required':[a0_0x2c6966(0x216),a0_0x2c6966(0x212)]}},{'name':'commhub_get_all_status','description':a0_0x2c6966(0x1ff),'inputSchema':{'type':a0_0x2c6966(0x1f9),'properties':{}}}]}));async function P(_0x41fe26,_0x5ba7fb){const _0x16a44b=a0_0x2c6966;let _0x203174=await fetch(f+_0x16a44b(0x21a),{'method':_0x16a44b(0x238),'headers':{'Content-Type':_0x16a44b(0x236),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x16a44b(0x1c7)+X}:{}},'body':JSON[_0x16a44b(0x1b2)]({'jsonrpc':_0x16a44b(0x229),'id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x16a44b(0x1c2),'version':_0x16a44b(0x1aa)}}})});if(!_0x203174['ok']){let _0x4219a3=await _0x203174[_0x16a44b(0x21f)]();return Y(_0x16a44b(0x1f3)+_0x203174[_0x16a44b(0x1f4)]+'\x20'+_0x4219a3[_0x16a44b(0x1cb)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x203174[_0x16a44b(0x1f4)]};}await _0x203174[_0x16a44b(0x21f)]();let _0x18a401=(await(await fetch(f+_0x16a44b(0x21a),{'method':_0x16a44b(0x238),'headers':{'Content-Type':_0x16a44b(0x236),'Accept':_0x16a44b(0x1a9),...X?{'Authorization':_0x16a44b(0x1c7)+X}:{}},'body':JSON[_0x16a44b(0x1b2)]({'jsonrpc':'2.0','id':0x2,'method':_0x16a44b(0x211),'params':{'name':_0x41fe26,'arguments':_0x5ba7fb}})}))['text']())[_0x16a44b(0x1fd)]('\x0a')[_0x16a44b(0x234)](_0x266b52=>_0x266b52[_0x16a44b(0x213)](_0x16a44b(0x1f1)));if(_0x18a401){let _0x4e2184=JSON[_0x16a44b(0x1bf)](_0x18a401[_0x16a44b(0x1cb)](0x6));return _0x4e2184?.[_0x16a44b(0x1ba)]?.[_0x16a44b(0x1bb)]?.[0x0]?.['text']?JSON[_0x16a44b(0x1bf)](_0x4e2184[_0x16a44b(0x1ba)][_0x16a44b(0x1bb)][0x0]['text']):_0x4e2184;}return{'ok':!0x1,'error':_0x16a44b(0x215)};}K[a0_0x2c6966(0x205)](a0_0x317fbf,async _0x4e92a7=>{const _0x294daa=a0_0x2c6966;let {name:_0x4fa918,arguments:_0x2dad82}=_0x4e92a7[_0x294daa(0x1ca)];if(_0x4fa918===_0x294daa(0x20c)){let {task_id:_0x25be3f,text:_0x55581e,status:_0x5e3d7d}=_0x2dad82;if(_0x5e3d7d===_0x294daa(0x22d)||_0x5e3d7d===_0x294daa(0x1e3)||_0x5e3d7d===_0x294daa(0x1cc)){let _0x3ff322=_0x5e3d7d==='completed'?_0x294daa(0x20b):_0x5e3d7d,_0x1e82d5=_0x25be3f?k['get'](_0x25be3f)||_0x294daa(0x1b6):_0x294daa(0x1b6),_0x25f0ae=await P(_0x294daa(0x1c1),{'alias':_0x1e82d5,'text':_0x55581e,'in_reply_to':_0x25be3f||void 0x0,'status':_0x3ff322,'from_session':Z});if(_0x25be3f)k[_0x294daa(0x1a6)](_0x25be3f);return{'content':[{'type':'text','text':JSON['stringify'](_0x25f0ae)}]};}let _0x58eabf=await P(_0x294daa(0x20d),{'resume_id':w,'alias':Z,'status':_0x5e3d7d==='blocked'?_0x294daa(0x20f):_0x5e3d7d===_0x294daa(0x1c0)?'error':_0x294daa(0x1ae),'task':_0x55581e[_0x294daa(0x1cb)](0x0,0xc8),'output':_0x55581e});return{'content':[{'type':_0x294daa(0x21f),'text':JSON[_0x294daa(0x1b2)](_0x58eabf)}]};}if(_0x4fa918==='commhub_report_status'){let {status:_0x288723,task:_0x34ccd5,progress:_0x5365bf}=_0x2dad82,_0x31342e=await P(_0x294daa(0x20d),{'resume_id':w,'alias':Z,'status':_0x288723,'task':_0x34ccd5,'progress':_0x5365bf});return{'content':[{'type':'text','text':JSON[_0x294daa(0x1b2)](_0x31342e)}]};}if(_0x4fa918===_0x294daa(0x21b)){let {alias:_0x1c4f08,task:_0x450785,priority:_0x2d8bcb}=_0x2dad82,_0x5c1d42=await P('send_task',{'alias':_0x1c4f08,'task':_0x450785,'priority':_0x2d8bcb||_0x294daa(0x1bd),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x294daa(0x1b2)](_0x5c1d42)}]};}if(_0x4fa918===_0x294daa(0x22a)){let {alias:_0x2967ba,message:_0x32f466}=_0x2dad82,_0x5658cc=await P(_0x294daa(0x1de),{'alias':_0x2967ba,'message':_0x32f466,'from_session':Z});return{'content':[{'type':_0x294daa(0x21f),'text':JSON[_0x294daa(0x1b2)](_0x5658cc)}]};}if(_0x4fa918===_0x294daa(0x1e5)){let _0x2c6015=await P(_0x294daa(0x21c),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x2c6015)}]};}return{'content':[{'type':_0x294daa(0x21f),'text':JSON[_0x294daa(0x1b2)]({'error':_0x294daa(0x1d9)})}]};});function a0_0x8d7b(){const _0x331374=['5NoHJVr','replied','commhub_reply','report_status','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','blocked','MCP\x20stdio\x20connected','tools/call','message','startsWith','...\x20TMUX=','no\x20response','alias','stderr','←\x20message\x20from\x20','Task\x20content','/mcp','commhub_send_task','get_all_status','then','SSE\x20error:\x20','text','stdin','/events/','\x20ALIAS=','.anet','message_id','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','.claude/channels/commhub','connected','trim','2.0','commhub_send_message','\x20PROJECT_ENV=','messages','completed','read','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','length','commhub','from_session','warning:\x20could\x20not\x20register:\x20','find','\x20RESUME_ID=','application/json',']\x20[commhub]\x20','POST','new_message','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.',':\x20inbox_count=','delete','Current\x20task\x20description','priority','application/json,\x20text/event-stream','0.3.0','SSE\x20fatal:\x20','SIGINT','end','working','notifications/claude/channel','575839DarfrE','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','stringify','pop','shutting\x20down,\x20reporting\x20offline...','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','hub','none','connect','starting\x20SSE\x20listener...','result','content','SSE\x20connection\x20error:\x20','normal','catch','parse','error','send_reply','commhub-channel','low','commhub_report_status','in_progress','idle','Bearer\x20','connecting\x20to\x20','Target\x20session\x20alias','params','slice','cancelled','Progress\x200-100','.env','write','type','44aVsPiB','→\x20injected\x20task\x20','\x20CWD=','config.json','ack_inbox','session\x20disconnected','broadcast','new_task','unknown\x20tool','72927BZgnUF','Message\x20content','claude-code','324549jrsntU','send_message','ENV:\x20URL=','850871pbbBCG','ready\x20—\x20waiting\x20for\x20events','\x20from\x20','failed','exit','commhub_get_all_status','get_inbox','number','set','inbox_count','79462IupCNp','from','registered\x20as\x20\x22','cwd','replace','utf-8','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','data:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','CommHub\x20init\x20failed:\x20','status','\x20priority=','parse\x20error:\x20','Session\x20alias:\x20','6xPJxCM','object','heartbeat\x20failed:\x20','\x22\x20(','Reply\x20text\x20/\x20result\x20summary','split','token','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','decode','30jRGYcw','string','8luRcEK','2001520VvltNZ','setRequestHandler','4674108iizisl','fatal:\x20','notification','http://127.0.0.1:9200'];a0_0x8d7b=function(){return _0x331374;};return a0_0x8d7b();}async function u(){const _0x28dc1c=a0_0x2c6966;let _0x435ebb=f+_0x28dc1c(0x221)+encodeURIComponent(Z),_0x4b1f20={};if(X)_0x4b1f20['Authorization']='Bearer\x20'+X;Y(_0x28dc1c(0x1c8)+_0x435ebb);while(!0x0){try{let _0x38de73=await fetch(_0x435ebb,{'headers':_0x4b1f20});if(!_0x38de73['ok']){Y(_0x28dc1c(0x21e)+_0x38de73[_0x28dc1c(0x1f4)]+'\x20'+_0x38de73['statusText']),await h(0x1388);continue;}let _0x433089=_0x38de73['body']['getReader'](),_0x3505d2=new TextDecoder(),_0x153126='';while(!0x0){let {done:_0x3e8eda,value:_0x5ecb7b}=await _0x433089[_0x28dc1c(0x22e)]();if(_0x3e8eda)break;_0x153126+=_0x3505d2[_0x28dc1c(0x200)](_0x5ecb7b,{'stream':!0x0});let _0x4625eb=_0x153126[_0x28dc1c(0x1fd)]('\x0a\x0a');_0x153126=_0x4625eb[_0x28dc1c(0x1b3)]()||'';for(let _0x34096a of _0x4625eb){let _0x149c21=_0x34096a[_0x28dc1c(0x1fd)]('\x0a')[_0x28dc1c(0x234)](_0x32e816=>_0x32e816[_0x28dc1c(0x213)](_0x28dc1c(0x1f1)));if(!_0x149c21)continue;try{let _0x3db593=JSON['parse'](_0x149c21[_0x28dc1c(0x1cb)](0x6));await S(_0x3db593);}catch(_0x14be83){Y(_0x28dc1c(0x1f6)+_0x14be83);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x3885c6){Y(_0x28dc1c(0x1bc)+_0x3885c6);}await h(0xbb8);}}async function S(_0x38f44c){const _0x46c401=a0_0x2c6966;if(_0x38f44c['type']===_0x46c401(0x227)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x38f44c[_0x46c401(0x1d0)]===_0x46c401(0x1a3)){if(Y(_0x46c401(0x218)+_0x38f44c[_0x46c401(0x1eb)]+':\x20'+_0x38f44c['message']['slice'](0x0,0x3c)),await K['notification']({'method':_0x46c401(0x1af),'params':{'content':_0x38f44c[_0x46c401(0x212)],'meta':{'sender':_0x38f44c['from']||'hub','sender_id':_0x46c401(0x231),'user':_0x38f44c[_0x46c401(0x1eb)]||_0x46c401(0x1b6),'priority':'normal'}}}),_0x38f44c[_0x46c401(0x224)])await P(_0x46c401(0x1d5),{'alias':Z,'message_id':_0x38f44c[_0x46c401(0x224)]});return;}if(_0x38f44c[_0x46c401(0x1d0)]===_0x46c401(0x1d8)||_0x38f44c['type']===_0x46c401(0x1d7)){Y('←\x20'+_0x38f44c[_0x46c401(0x1d0)]+_0x46c401(0x1a5)+_0x38f44c[_0x46c401(0x1e9)]+_0x46c401(0x1f5)+(_0x38f44c[_0x46c401(0x1a8)]||_0x46c401(0x1bd)));let _0x3c6387=await P(_0x46c401(0x1e6),{'alias':Z,'limit':0x5});if(_0x3c6387?.['ok']&&_0x3c6387[_0x46c401(0x22c)]?.[_0x46c401(0x230)]>0x0)for(let _0x42a0c5 of _0x3c6387[_0x46c401(0x22c)]){let _0x5ef18e={'sender':_0x42a0c5[_0x46c401(0x232)]||_0x46c401(0x1b6),'sender_id':_0x46c401(0x231),'user':_0x42a0c5[_0x46c401(0x232)]||_0x46c401(0x1b6),'task_id':_0x42a0c5['id'],'priority':_0x42a0c5[_0x46c401(0x1a8)]||_0x46c401(0x1bd)};k[_0x46c401(0x1e8)](_0x42a0c5['id'],_0x42a0c5['from_session']||'hub'),await K[_0x46c401(0x208)]({'method':_0x46c401(0x1af),'params':{'content':_0x42a0c5[_0x46c401(0x1bb)],'meta':_0x5ef18e}}),Y(_0x46c401(0x1d2)+_0x42a0c5['id']['slice'](0x0,0x8)+_0x46c401(0x1e2)+_0x42a0c5[_0x46c401(0x232)]+':\x20'+_0x42a0c5[_0x46c401(0x1bb)][_0x46c401(0x1cb)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x42a0c5['id']});}}}async function A(){const _0x3e3ed4=a0_0x2c6966;let _0x9bc33f=new a0_0x41583a();await K[_0x3e3ed4(0x1b8)](_0x9bc33f),Y(_0x3e3ed4(0x210)),Y(_0x3e3ed4(0x1b9)),u()[_0x3e3ed4(0x1be)](_0x53487f=>Y(_0x3e3ed4(0x1ab)+_0x53487f)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4a6714(),'hostname':a0_0x4a6714(),'agent':_0x3e3ed4(0x1dc),'project_dir':process[_0x3e3ed4(0x1ed)](),'tmux_name':j||void 0x0})[_0x3e3ed4(0x21d)](()=>Y(_0x3e3ed4(0x1ec)+Z+_0x3e3ed4(0x1fb)+w[_0x3e3ed4(0x1cb)](0x0,0x8)+')'))['catch'](_0x2c5d80=>Y(_0x3e3ed4(0x233)+_0x2c5d80)),setInterval(()=>{const _0x31a41e=_0x3e3ed4;P(_0x31a41e(0x20d),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4a6714(),'hostname':a0_0x4a6714(),'agent':_0x31a41e(0x1dc),'project_dir':process[_0x31a41e(0x1ed)](),'tmux_name':j||void 0x0})[_0x31a41e(0x1be)](_0x5bad19=>Y(_0x31a41e(0x1fa)+_0x5bad19));},0x2bf20),Y(_0x3e3ed4(0x1e1));}A()[a0_0x2c6966(0x1be)](_0xd3919e=>{const _0x362603=a0_0x2c6966;Y(_0x362603(0x207)+_0xd3919e),process[_0x362603(0x1e4)](0x1);});async function N(){const _0x44ab4d=a0_0x2c6966;Y(_0x44ab4d(0x1b4)),await P(_0x44ab4d(0x20d),{'resume_id':w,'alias':Z,'status':'error','task':_0x44ab4d(0x1d6)})[_0x44ab4d(0x1be)](()=>{}),process[_0x44ab4d(0x1e4)](0x0);}process[a0_0x2c6966(0x220)]['on'](a0_0x2c6966(0x1ad),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x2c6966(0x1ac),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.6-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",
|