@sleep2agi/agent-network 2.0.3-preview.8 → 2.1.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
|
-
function
|
|
1
|
+
function a0_0x405b(_0x22765c,_0x29f12a){_0x22765c=_0x22765c-0x72;const _0x451c68=a0_0x451c();let _0x405bf5=_0x451c68[_0x22765c];return _0x405bf5;}const a0_0x58c682=a0_0x405b;(function(_0x7e7d53,_0x32c8a7){const _0x349de4=a0_0x405b,_0x471087=_0x7e7d53();while(!![]){try{const _0x1729bd=-parseInt(_0x349de4(0xc6))/0x1+-parseInt(_0x349de4(0x9e))/0x2*(-parseInt(_0x349de4(0x8c))/0x3)+-parseInt(_0x349de4(0x76))/0x4*(-parseInt(_0x349de4(0x9c))/0x5)+-parseInt(_0x349de4(0xac))/0x6*(-parseInt(_0x349de4(0x82))/0x7)+-parseInt(_0x349de4(0xc8))/0x8*(-parseInt(_0x349de4(0xbb))/0x9)+-parseInt(_0x349de4(0xb0))/0xa*(parseInt(_0x349de4(0x97))/0xb)+-parseInt(_0x349de4(0xb8))/0xc*(parseInt(_0x349de4(0x7a))/0xd);if(_0x1729bd===_0x32c8a7)break;else _0x471087['push'](_0x471087['shift']());}catch(_0x23a47f){_0x471087['push'](_0x471087['shift']());}}}(a0_0x451c,0x87fd6));import{EventEmitter as a0_0x1aeff1}from'events';import{hostname as a0_0x45ec76}from'os';class T extends a0_0x1aeff1{[a0_0x58c682(0xa5)];['alias'];[a0_0x58c682(0xa3)];['agent'];[a0_0x58c682(0x80)];['heartbeatInterval'];[a0_0x58c682(0x7d)];[a0_0x58c682(0xb5)];['sseAbort'];[a0_0x58c682(0x7c)]=!0x1;constructor(_0x3224d1){const _0x48ef99=a0_0x58c682;super();if(this[_0x48ef99(0xa5)]=_0x3224d1[_0x48ef99(0xa5)]['replace'](/\/$/,''),this[_0x48ef99(0xa7)]=_0x3224d1[_0x48ef99(0xa7)],this['token']=_0x3224d1['token'],this[_0x48ef99(0x83)]=_0x3224d1[_0x48ef99(0x83)]||'sdk',this[_0x48ef99(0x80)]='sdk-'+_0x3224d1[_0x48ef99(0xa7)]+'-'+Date['now']()[_0x48ef99(0xba)](0x24),this[_0x48ef99(0xc5)]=_0x3224d1[_0x48ef99(0xc5)]??0x2bf20,this[_0x48ef99(0x7d)]=_0x3224d1[_0x48ef99(0x7d)]??0xbb8,_0x3224d1[_0x48ef99(0xc9)]!==!0x1)this['connect']();}[a0_0x58c682(0x98)](_0xc595a4){const _0x4d9b11=a0_0x58c682;console['log']('['+new Date()['toTimeString']()[_0x4d9b11(0x90)](0x0,0x8)+_0x4d9b11(0x85)+this[_0x4d9b11(0xa7)]+']\x20'+_0xc595a4);}async[a0_0x58c682(0xbc)](_0x1f36dd,_0x5e42f6){const _0x3db04e=a0_0x58c682;let _0x544970={'Content-Type':_0x3db04e(0x75),'Accept':_0x3db04e(0xb4)};if(this[_0x3db04e(0xa3)])_0x544970[_0x3db04e(0x99)]=_0x3db04e(0x7f)+this[_0x3db04e(0xa3)];let _0x39d342=await(await fetch(this[_0x3db04e(0xa5)]+_0x3db04e(0x87),{'method':_0x3db04e(0x96),'headers':_0x544970,'body':JSON[_0x3db04e(0x8f)]({'jsonrpc':_0x3db04e(0x94),'id':Date[_0x3db04e(0x8e)](),'method':'tools/call','params':{'name':_0x1f36dd,'arguments':_0x5e42f6}})}))[_0x3db04e(0xb1)](),_0x33033c=_0x39d342[_0x3db04e(0x77)](/data: (.+)/),_0x1393fc=_0x33033c?JSON[_0x3db04e(0xa9)](_0x33033c[0x1]):JSON[_0x3db04e(0xa9)](_0x39d342),_0x4133cc=_0x1393fc?.[_0x3db04e(0x89)]?.[_0x3db04e(0xa6)]?.[0x0]?.[_0x3db04e(0xb1)];return _0x4133cc?JSON[_0x3db04e(0xa9)](_0x4133cc):_0x1393fc;}async['connect'](){const _0x230381=a0_0x58c682;if(this['running'])return;this[_0x230381(0x7c)]=!0x0,await this[_0x230381(0x74)](_0x230381(0x95)),this[_0x230381(0x98)](_0x230381(0xa2)),this[_0x230381(0xb5)]=setInterval(()=>{const _0x17333e=_0x230381;this['status'](_0x17333e(0x95))[_0x17333e(0x84)](_0x5a96f5=>this[_0x17333e(0x98)]('heartbeat\x20failed:\x20'+_0x5a96f5[_0x17333e(0x92)]));},this['heartbeatInterval']),this[_0x230381(0xbf)]();}async[a0_0x58c682(0x73)](){const _0x329888=a0_0x58c682;if(this['running']=!0x1,this['sseAbort']?.[_0x329888(0x91)](),this[_0x329888(0xb5)])clearInterval(this[_0x329888(0xb5)]);await this[_0x329888(0x74)](_0x329888(0x8b))[_0x329888(0x84)](()=>{}),this[_0x329888(0x98)](_0x329888(0xc2));}async[a0_0x58c682(0xbd)](_0x5aed2d,_0x35cfb7,_0x19ee55=a0_0x58c682(0x9b)){const _0x3cf3a5=a0_0x58c682;return this['call']('send_task',{'alias':_0x5aed2d,'task':_0x35cfb7,'priority':_0x19ee55,'from_session':this[_0x3cf3a5(0xa7)]});}async['message'](_0x3c30d9,_0x341063){const _0x5e9cde=a0_0x58c682;return this[_0x5e9cde(0xbc)]('send_message',{'alias':_0x3c30d9,'message':_0x341063,'from_session':this[_0x5e9cde(0xa7)]});}async[a0_0x58c682(0xa0)](_0x4d18cf,_0x5e0411,_0x2226b5=a0_0x58c682(0xcb)){const _0x3997d1=a0_0x58c682;return this['call'](_0x3997d1(0xa0),{'task_id':_0x4d18cf,'text':_0x5e0411,'status':_0x2226b5});}async[a0_0x58c682(0x74)](_0x542135,_0x40623f){const _0xfe3e07=a0_0x58c682;return this[_0xfe3e07(0xbc)](_0xfe3e07(0x9a),{'resume_id':this[_0xfe3e07(0x80)],'alias':this['alias'],'status':_0x542135,'server':a0_0x45ec76(),'hostname':a0_0x45ec76(),'agent':this['agent'],'project_dir':process[_0xfe3e07(0x8d)](),..._0x40623f});}async[a0_0x58c682(0xa1)](){const _0x538400=a0_0x58c682;return this[_0x538400(0xbc)]('get_all_status',{});}async['broadcast'](_0x50ecf2,_0x563288){const _0x40d152=a0_0x58c682;return this[_0x40d152(0xbc)](_0x40d152(0xca),{'message':_0x50ecf2,'filter_server':_0x563288?.[_0x40d152(0x7b)],'filter_status':_0x563288?.[_0x40d152(0x74)]});}async[a0_0x58c682(0xbf)](){const _0x587cc7=a0_0x58c682;let _0x3848fe=encodeURIComponent(this[_0x587cc7(0xa7)]),_0x2311d3=this[_0x587cc7(0xa5)]+'/events/'+_0x3848fe,_0x802ef7=this[_0x587cc7(0x7d)];while(this[_0x587cc7(0x7c)]){try{this[_0x587cc7(0xb7)]=new AbortController();let _0xf5faba={'Accept':_0x587cc7(0xb6)};if(this[_0x587cc7(0xa3)])_0xf5faba['Authorization']=_0x587cc7(0x7f)+this['token'];let _0x2f8ce2=await fetch(_0x2311d3,{'headers':_0xf5faba,'signal':this['sseAbort'][_0x587cc7(0xb3)]});if(!_0x2f8ce2['ok']||!_0x2f8ce2[_0x587cc7(0x79)]){this[_0x587cc7(0x98)](_0x587cc7(0xbe)+_0x2f8ce2['status']),await this[_0x587cc7(0x88)](_0x802ef7),_0x802ef7=Math[_0x587cc7(0xae)](_0x802ef7*1.5,0xea60);continue;}_0x802ef7=this['reconnectDelay'];let _0x3c2bf5=_0x2f8ce2['body'][_0x587cc7(0x8a)](),_0x5bd741=new TextDecoder(),_0x5e693f='';while(this[_0x587cc7(0x7c)]){let {done:_0x494439,value:_0x38b899}=await _0x3c2bf5['read']();if(_0x494439)break;_0x5e693f+=_0x5bd741[_0x587cc7(0xa4)](_0x38b899,{'stream':!0x0});let _0x250d28=_0x5e693f[_0x587cc7(0x7e)]('\x0a');_0x5e693f=_0x250d28[_0x587cc7(0x93)]()||'';for(let _0x4d76eb of _0x250d28){if(!_0x4d76eb[_0x587cc7(0xc0)]('data:\x20'))continue;try{let _0x2604b7=JSON[_0x587cc7(0xa9)](_0x4d76eb['slice'](0x6));if(_0x2604b7['type']===_0x587cc7(0x78)){this['log'](_0x587cc7(0xc7)),this[_0x587cc7(0x72)](_0x587cc7(0x78));continue;}if(_0x2604b7[_0x587cc7(0xb2)]===_0x587cc7(0xc4)||_0x2604b7[_0x587cc7(0xb2)]===_0x587cc7(0x86)||_0x2604b7[_0x587cc7(0xb2)]===_0x587cc7(0xca))await this[_0x587cc7(0xad)]();}catch{}}}}catch(_0x8efa90){if(_0x8efa90['name']===_0x587cc7(0xaf))break;this[_0x587cc7(0x72)](_0x587cc7(0xc1),_0x8efa90),this[_0x587cc7(0x98)](_0x587cc7(0x81)+_0x8efa90[_0x587cc7(0x92)]);}if(this[_0x587cc7(0x7c)])this['emit'](_0x587cc7(0xc2)),this['log'](_0x587cc7(0x9d)+_0x802ef7/0x3e8+_0x587cc7(0xa8)),await this[_0x587cc7(0x88)](_0x802ef7),_0x802ef7=Math['min'](_0x802ef7*1.5,0xea60);}}async[a0_0x58c682(0xad)](){const _0x3701c1=a0_0x58c682;try{let _0x547102=(await this[_0x3701c1(0xbc)](_0x3701c1(0xaa),{'alias':this[_0x3701c1(0xa7)],'limit':0xa}))?.['messages']||[];for(let _0x363ac5 of _0x547102)await this['call'](_0x3701c1(0x9f),{'alias':this[_0x3701c1(0xa7)],'message_id':_0x363ac5['id']}),this[_0x3701c1(0x98)]('←\x20'+_0x363ac5[_0x3701c1(0xab)]+':\x20'+_0x363ac5[_0x3701c1(0xa6)]['slice'](0x0,0x3c)),this[_0x3701c1(0x72)](_0x3701c1(0xb9),_0x363ac5),this[_0x3701c1(0x72)](_0x3701c1(0x92),_0x363ac5);}catch(_0xdb18ea){this['log'](_0x3701c1(0xc3)+_0xdb18ea[_0x3701c1(0x92)]);}}[a0_0x58c682(0x88)](_0x35379d){return new Promise(_0x462af4=>setTimeout(_0x462af4,_0x35379d));}}var $=T;function a0_0x451c(){const _0x2b365d=['SSE\x20failed:\x20','connectSSE','startsWith','error','disconnected','inbox\x20error:\x20','new_task','heartbeatInterval','988702tuNhfE','SSE\x20connected','776NHdAGM','autoConnect','broadcast','completed','emit','disconnect','status','application/json','4sDtmyx','match','connected','body','286GImjBA','server','running','reconnectDelay','split','Bearer\x20','resumeId','SSE\x20error:\x20','1330175KcrtVW','agent','catch',']\x20[commhub:','new_message','/mcp','sleep','result','getReader','offline','3UZRQPh','cwd','now','stringify','slice','abort','message','pop','2.0','idle','POST','1023528DYvcru','log','Authorization','report_status','normal','3479675WSPEle','SSE\x20reconnecting\x20in\x20','2045294EDKRBM','ack_inbox','reply','getAllStatus','registered','token','decode','url','content','alias','s...','parse','get_inbox','from_session','18IVTcyc','processInbox','min','AbortError','10YpBzRK','text','type','signal','application/json,\x20text/event-stream','heartbeatTimer','text/event-stream','sseAbort','382476mPsdmT','task','toString','4761vBfLTf','call','send'];a0_0x451c=function(){return _0x2b365d;};return a0_0x451c();}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_0x3cdc6d=a0_0x1ddf;(function(_0xa5ccd5,_0x6b8032){const _0x57815c=a0_0x1ddf,_0x45ac01=_0xa5ccd5();while(!![]){try{const _0x407bea=-parseInt(_0x57815c(0x130))/0x1+parseInt(_0x57815c(0x10d))/0x2+-parseInt(_0x57815c(0x160))/0x3+-parseInt(_0x57815c(0x117))/0x4*(parseInt(_0x57815c(0x147))/0x5)+-parseInt(_0x57815c(0x16a))/0x6+-parseInt(_0x57815c(0xfd))/0x7+-parseInt(_0x57815c(0x131))/0x8*(-parseInt(_0x57815c(0x14d))/0x9);if(_0x407bea===_0x6b8032)break;else _0x45ac01['push'](_0x45ac01['shift']());}catch(_0x4f8d89){_0x45ac01['push'](_0x45ac01['shift']());}}}(a0_0x466d,0x834f7));import{readFileSync as a0_0x24596e,existsSync as a0_0x46cf61}from'fs';import{randomUUID as a0_0x436cfd}from'crypto';import{join as a0_0x1dc3d2}from'path';import{hostname as a0_0x50d3aa}from'os';import{execSync as a0_0x3c4ef6}from'child_process';import{Server as a0_0x1ea5f3}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x317865}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x342c09,CallToolRequestSchema as a0_0x21dfe5}from'@modelcontextprotocol/sdk/types.js';function a0_0x466d(){const _0x119a42=['commhub-channel','\x22\x20(','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','broadcast','/mcp','completed','SSE\x20fatal:\x20','low','.env','then','\x20ALIAS=','application/json,\x20text/event-stream','stringify','commhub_reply','Bearer\x20','commhub_send_message','\x20RESUME_ID=','send_reply','\x20PROJECT_ENV=','290865CSPuty','content','.claude/channels/commhub','initialize','working','failed','22242078DUjxav','messages','parse\x20error:\x20','type','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','←\x20message\x20from\x20','token','number','get','claude-code','notifications/claude/channel','ENV:\x20URL=','unknown\x20tool','send_message','getReader','stdin','cancelled','fatal:\x20','priority','1376814suSmCo','result','trim','slice','cwd','blocked','in_progress','connect','0.3.0','inbox_count','2720892jEjNSb','text','SIGINT','length','\x20from\x20','join','idle','Target\x20session\x20alias','exit','Progress\x200-100','stderr','replace','heartbeat\x20failed:\x20','catch','startsWith','from_session','indexOf','2.0','SSE\x20connected\x20as\x20\x22','starting\x20SSE\x20listener...','.anet','object','string','setRequestHandler','2540272CvruDf','new_message','set','params','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','utf-8','get_all_status','2025-03-26','registered\x20as\x20\x22',':\x20inbox_count=','ready\x20—\x20waiting\x20for\x20events','POST','normal','message','ack_inbox','report_status','1459566qJURKD','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','commhub_send_task','parse','CommHub\x20init\x20failed:\x20','send_task','session\x20disconnected','split','...\x20TMUX=','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','36VzAdhN','hub','notification','Priority\x20(default:\x20normal)','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','pop','Reply\x20text\x20/\x20result\x20summary','commhub_report_status','commhub','get_inbox','SSE\x20connection\x20error:\x20','message_id','/events/','high','find','status','SIGTERM',']\x20[commhub]\x20','Task\x20content','from','init\x20failed:\x20','connecting\x20to\x20','shutting\x20down,\x20reporting\x20offline...','Session\x20alias:\x20','replied','864405xYWwZB','8PYUiZf','Current\x20task\x20description','error'];a0_0x466d=function(){return _0x119a42;};return a0_0x466d();}function p(_0x72baf3){const _0x2e7531=a0_0x1ddf;if(!a0_0x46cf61(_0x72baf3))return;for(let _0x28f43e of a0_0x24596e(_0x72baf3,_0x2e7531(0x102))[_0x2e7531(0x114)]('\x0a')){let _0x42e717=_0x28f43e[_0x2e7531(0x162)]();if(!_0x42e717||_0x42e717['startsWith']('#'))continue;let _0x48b3e2=_0x42e717[_0x2e7531(0x17a)]('=');if(_0x48b3e2<0x0)continue;let _0x2ca38a=_0x42e717[_0x2e7531(0x163)](0x0,_0x48b3e2)[_0x2e7531(0x162)](),_0x48d37e=_0x42e717[_0x2e7531(0x163)](_0x48b3e2+0x1)[_0x2e7531(0x162)]()[_0x2e7531(0x175)](/^["']|["']$/g,'');if(!process.env[_0x2ca38a])process.env[_0x2ca38a]=_0x48d37e;}}var C=process.env.HOME||'~',T=a0_0x1dc3d2(C,a0_0x3cdc6d(0x149));p(a0_0x1dc3d2(T,'.env'));var L=process['cwd']()[a0_0x3cdc6d(0x175)](/\//g,'-');p(a0_0x1dc3d2(T,L,a0_0x3cdc6d(0x13c)));function U(){const _0x4080b0=a0_0x3cdc6d;try{return a0_0x3c4ef6('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x4080b0(0x102),'timeout':0x7d0})[_0x4080b0(0x162)]();}catch{return'';}}function v(){const _0x35c949=a0_0x3cdc6d;try{let _0x52790e=a0_0x1dc3d2(C,_0x35c949(0x17e),'config.json');if(a0_0x46cf61(_0x52790e))return JSON[_0x35c949(0x110)](a0_0x24596e(_0x52790e,_0x35c949(0x102)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x3cdc6d(0x118)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x50d3aa(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x436cfd(),X=process.env.COMMHUB_TOKEN||H[a0_0x3cdc6d(0x153)]||'';function Y(_0x5220b4){const _0x5be9ae=a0_0x3cdc6d;let _0x572c6e=new Date()['toTimeString']()[_0x5be9ae(0x163)](0x0,0x8);process[_0x5be9ae(0x174)]['write']('['+_0x572c6e+_0x5be9ae(0x128)+_0x5220b4+'\x0a');}function h(_0x2b6083){return new Promise(_0x34f95e=>setTimeout(_0x34f95e,_0x2b6083));}function a0_0x1ddf(_0x395c30,_0x522e6a){_0x395c30=_0x395c30-0xfd;const _0x466d66=a0_0x466d();let _0x1ddff8=_0x466d66[_0x395c30];return _0x1ddff8;}Y(a0_0x3cdc6d(0x158)+f+a0_0x3cdc6d(0x13e)+Z+a0_0x3cdc6d(0x144)+w['slice'](0x0,0x8)+a0_0x3cdc6d(0x115)+(j||'none')+'\x20CWD='+process['cwd']()+a0_0x3cdc6d(0x146)+L);var k=new Map(),K=new a0_0x1ea5f3({'name':a0_0x3cdc6d(0x134),'version':a0_0x3cdc6d(0x168)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3cdc6d(0x10e),a0_0x3cdc6d(0x136),a0_0x3cdc6d(0x101),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x3cdc6d(0x12e)+Z][a0_0x3cdc6d(0x16f)]('\x0a')});K[a0_0x3cdc6d(0x181)](a0_0x342c09,async()=>({'tools':[{'name':a0_0x3cdc6d(0x141),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{'task_id':{'type':a0_0x3cdc6d(0x180),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x11d)},'status':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x139),a0_0x3cdc6d(0x14c),a0_0x3cdc6d(0x15d),a0_0x3cdc6d(0x165),a0_0x3cdc6d(0x133),a0_0x3cdc6d(0x166)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3cdc6d(0x16b)]}},{'name':a0_0x3cdc6d(0x11e),'description':a0_0x3cdc6d(0x11b),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x14b),'idle',a0_0x3cdc6d(0x165),'error']},'task':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x132)},'progress':{'type':a0_0x3cdc6d(0x154),'description':a0_0x3cdc6d(0x173)}},'required':[a0_0x3cdc6d(0x126)]}},{'name':'commhub_send_task','description':a0_0x3cdc6d(0x151),'inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{'alias':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x171)},'task':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x129)},'priority':{'type':a0_0x3cdc6d(0x180),'enum':[a0_0x3cdc6d(0x124),a0_0x3cdc6d(0x109),a0_0x3cdc6d(0x13b)],'description':a0_0x3cdc6d(0x11a)}},'required':['alias','task']}},{'name':a0_0x3cdc6d(0x143),'description':a0_0x3cdc6d(0x116),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x3cdc6d(0x180),'description':a0_0x3cdc6d(0x171)},'message':{'type':a0_0x3cdc6d(0x180),'description':'Message\x20content'}},'required':['alias',a0_0x3cdc6d(0x10a)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x3cdc6d(0x17f),'properties':{}}}]}));async function P(_0x47ae8c,_0x350fbf){const _0x37b017=a0_0x3cdc6d;let _0x109bd4=await fetch(f+'/mcp',{'method':_0x37b017(0x108),'headers':{'Content-Type':'application/json','Accept':_0x37b017(0x13f),...X?{'Authorization':_0x37b017(0x142)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x37b017(0x17b),'id':0x1,'method':_0x37b017(0x14a),'params':{'protocolVersion':_0x37b017(0x104),'capabilities':{},'clientInfo':{'name':_0x37b017(0x134),'version':'0.3.0'}}})});if(!_0x109bd4['ok']){let _0x10f848=await _0x109bd4[_0x37b017(0x16b)]();return Y(_0x37b017(0x111)+_0x109bd4[_0x37b017(0x126)]+'\x20'+_0x10f848[_0x37b017(0x163)](0x0,0x64)),{'ok':!0x1,'error':_0x37b017(0x12b)+_0x109bd4[_0x37b017(0x126)]};}await _0x109bd4[_0x37b017(0x16b)]();let _0x44cc69=(await(await fetch(f+_0x37b017(0x138),{'method':_0x37b017(0x108),'headers':{'Content-Type':'application/json','Accept':_0x37b017(0x13f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x37b017(0x17b),'id':0x2,'method':'tools/call','params':{'name':_0x47ae8c,'arguments':_0x350fbf}})}))['text']())[_0x37b017(0x114)]('\x0a')[_0x37b017(0x125)](_0x5037a8=>_0x5037a8[_0x37b017(0x178)]('data:\x20'));if(_0x44cc69){let _0x460977=JSON[_0x37b017(0x110)](_0x44cc69[_0x37b017(0x163)](0x6));return _0x460977?.[_0x37b017(0x161)]?.[_0x37b017(0x148)]?.[0x0]?.['text']?JSON['parse'](_0x460977['result'][_0x37b017(0x148)][0x0][_0x37b017(0x16b)]):_0x460977;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x3cdc6d(0x181)](a0_0x21dfe5,async _0x2f466e=>{const _0x4274f3=a0_0x3cdc6d;let {name:_0x5aa1ef,arguments:_0x48e82f}=_0x2f466e[_0x4274f3(0x100)];if(_0x5aa1ef===_0x4274f3(0x141)){let {task_id:_0x557f76,text:_0x44369d,status:_0x11ecce}=_0x48e82f;if(_0x11ecce===_0x4274f3(0x139)||_0x11ecce===_0x4274f3(0x14c)||_0x11ecce===_0x4274f3(0x15d)){let _0x4db73c=_0x11ecce==='completed'?_0x4274f3(0x12f):_0x11ecce,_0x554602=_0x557f76?k[_0x4274f3(0x155)](_0x557f76)||_0x4274f3(0x118):'hub',_0x546db1=await P(_0x4274f3(0x145),{'alias':_0x554602,'text':_0x44369d,'in_reply_to':_0x557f76||void 0x0,'status':_0x4db73c,'from_session':Z});if(_0x557f76)k['delete'](_0x557f76);return{'content':[{'type':'text','text':JSON[_0x4274f3(0x140)](_0x546db1)}]};}let _0x4ef87f=await P(_0x4274f3(0x10c),{'resume_id':w,'alias':Z,'status':_0x11ecce===_0x4274f3(0x165)?_0x4274f3(0x165):_0x11ecce===_0x4274f3(0x133)?_0x4274f3(0x133):_0x4274f3(0x14b),'task':_0x44369d[_0x4274f3(0x163)](0x0,0xc8),'output':_0x44369d});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x4ef87f)}]};}if(_0x5aa1ef===_0x4274f3(0x11e)){let {status:_0x499cbd,task:_0x48bb5b,progress:_0x45c8f7}=_0x48e82f,_0x463f93=await P(_0x4274f3(0x10c),{'resume_id':w,'alias':Z,'status':_0x499cbd,'task':_0x48bb5b,'progress':_0x45c8f7});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x463f93)}]};}if(_0x5aa1ef===_0x4274f3(0x10f)){let {alias:_0x2f58f6,task:_0x2b913b,priority:_0x51fdce}=_0x48e82f,_0xac5a81=await P(_0x4274f3(0x112),{'alias':_0x2f58f6,'task':_0x2b913b,'priority':_0x51fdce||_0x4274f3(0x109),'from_session':Z});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0xac5a81)}]};}if(_0x5aa1ef===_0x4274f3(0x143)){let {alias:_0x287a13,message:_0x211042}=_0x48e82f,_0x5240f7=await P(_0x4274f3(0x15a),{'alias':_0x287a13,'message':_0x211042,'from_session':Z});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON['stringify'](_0x5240f7)}]};}if(_0x5aa1ef==='commhub_get_all_status'){let _0x5c30e0=await P(_0x4274f3(0x103),{});return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)](_0x5c30e0)}]};}return{'content':[{'type':_0x4274f3(0x16b),'text':JSON[_0x4274f3(0x140)]({'error':_0x4274f3(0x159)})}]};});async function u(){const _0x3b890e=a0_0x3cdc6d;let _0x3a1743=f+_0x3b890e(0x123)+encodeURIComponent(Z),_0x4e6897={};if(X)_0x4e6897['Authorization']=_0x3b890e(0x142)+X;Y(_0x3b890e(0x12c)+_0x3a1743);while(!0x0){try{let _0x2eb1c0=await fetch(_0x3a1743,{'headers':_0x4e6897});if(!_0x2eb1c0['ok']){Y('SSE\x20error:\x20'+_0x2eb1c0[_0x3b890e(0x126)]+'\x20'+_0x2eb1c0['statusText']),await h(0x1388);continue;}let _0x390275=_0x2eb1c0['body'][_0x3b890e(0x15b)](),_0x2b3665=new TextDecoder(),_0x3991dd='';while(!0x0){let {done:_0x36df9e,value:_0x5189ec}=await _0x390275['read']();if(_0x36df9e)break;_0x3991dd+=_0x2b3665['decode'](_0x5189ec,{'stream':!0x0});let _0x5c54c1=_0x3991dd['split']('\x0a\x0a');_0x3991dd=_0x5c54c1[_0x3b890e(0x11c)]()||'';for(let _0x15080c of _0x5c54c1){let _0x1801b1=_0x15080c[_0x3b890e(0x114)]('\x0a')[_0x3b890e(0x125)](_0x1fbce7=>_0x1fbce7['startsWith']('data:\x20'));if(!_0x1801b1)continue;try{let _0x801a2d=JSON[_0x3b890e(0x110)](_0x1801b1[_0x3b890e(0x163)](0x6));await S(_0x801a2d);}catch(_0x2b76aa){Y(_0x3b890e(0x14f)+_0x2b76aa);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x331d90){Y(_0x3b890e(0x121)+_0x331d90);}await h(0xbb8);}}async function S(_0x31b33c){const _0x21ae69=a0_0x3cdc6d;if(_0x31b33c[_0x21ae69(0x150)]==='connected'){Y(_0x21ae69(0x17c)+Z+'\x22');return;}if(_0x31b33c[_0x21ae69(0x150)]===_0x21ae69(0xfe)){if(Y(_0x21ae69(0x152)+_0x31b33c['from']+':\x20'+_0x31b33c['message']['slice'](0x0,0x3c)),await K[_0x21ae69(0x119)]({'method':_0x21ae69(0x157),'params':{'content':_0x31b33c[_0x21ae69(0x10a)],'meta':{'sender':_0x31b33c[_0x21ae69(0x12a)]||_0x21ae69(0x118),'sender_id':_0x21ae69(0x11f),'user':_0x31b33c[_0x21ae69(0x12a)]||_0x21ae69(0x118),'priority':'normal'}}}),_0x31b33c[_0x21ae69(0x122)])await P(_0x21ae69(0x10b),{'alias':Z,'message_id':_0x31b33c[_0x21ae69(0x122)]});return;}if(_0x31b33c[_0x21ae69(0x150)]==='new_task'||_0x31b33c[_0x21ae69(0x150)]===_0x21ae69(0x137)){Y('←\x20'+_0x31b33c[_0x21ae69(0x150)]+_0x21ae69(0x106)+_0x31b33c[_0x21ae69(0x169)]+'\x20priority='+(_0x31b33c[_0x21ae69(0x15f)]||_0x21ae69(0x109)));let _0x5bc2bc=await P(_0x21ae69(0x120),{'alias':Z,'limit':0x5});if(_0x5bc2bc?.['ok']&&_0x5bc2bc['messages']?.[_0x21ae69(0x16d)]>0x0)for(let _0x12de38 of _0x5bc2bc[_0x21ae69(0x14e)]){let _0x122393={'sender':_0x12de38[_0x21ae69(0x179)]||'hub','sender_id':_0x21ae69(0x11f),'user':_0x12de38[_0x21ae69(0x179)]||'hub','task_id':_0x12de38['id'],'priority':_0x12de38['priority']||_0x21ae69(0x109)};k[_0x21ae69(0xff)](_0x12de38['id'],_0x12de38['from_session']||_0x21ae69(0x118)),await K[_0x21ae69(0x119)]({'method':_0x21ae69(0x157),'params':{'content':_0x12de38[_0x21ae69(0x148)],'meta':_0x122393}}),Y('→\x20injected\x20task\x20'+_0x12de38['id']['slice'](0x0,0x8)+_0x21ae69(0x16e)+_0x12de38[_0x21ae69(0x179)]+':\x20'+_0x12de38[_0x21ae69(0x148)][_0x21ae69(0x163)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x12de38['id']});}}}async function A(){const _0x4c61e7=a0_0x3cdc6d;let _0x3224f5=new a0_0x317865();await K[_0x4c61e7(0x167)](_0x3224f5),Y('MCP\x20stdio\x20connected'),Y(_0x4c61e7(0x17d)),u()[_0x4c61e7(0x177)](_0x1a7cb1=>Y(_0x4c61e7(0x13a)+_0x1a7cb1)),P(_0x4c61e7(0x10c),{'resume_id':w,'alias':Z,'status':_0x4c61e7(0x170),'server':a0_0x50d3aa(),'hostname':a0_0x50d3aa(),'agent':'claude-code','project_dir':process[_0x4c61e7(0x164)](),'tmux_name':j||void 0x0})[_0x4c61e7(0x13d)](()=>Y(_0x4c61e7(0x105)+Z+_0x4c61e7(0x135)+w[_0x4c61e7(0x163)](0x0,0x8)+')'))['catch'](_0x733b9c=>Y('warning:\x20could\x20not\x20register:\x20'+_0x733b9c)),setInterval(()=>{const _0x53886d=_0x4c61e7;P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x50d3aa(),'hostname':a0_0x50d3aa(),'agent':_0x53886d(0x156),'project_dir':process[_0x53886d(0x164)](),'tmux_name':j||void 0x0})[_0x53886d(0x177)](_0x2832cd=>Y(_0x53886d(0x176)+_0x2832cd));},0x2bf20),Y(_0x4c61e7(0x107));}A()[a0_0x3cdc6d(0x177)](_0x56a953=>{const _0x11b615=a0_0x3cdc6d;Y(_0x11b615(0x15e)+_0x56a953),process[_0x11b615(0x172)](0x1);});async function N(){const _0x37858c=a0_0x3cdc6d;Y(_0x37858c(0x12d)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x37858c(0x133),'task':_0x37858c(0x113)})[_0x37858c(0x177)](()=>{}),process[_0x37858c(0x172)](0x0);}process[a0_0x3cdc6d(0x15c)]['on']('end',()=>N()),process['on'](a0_0x3cdc6d(0x127),()=>N()),process['on'](a0_0x3cdc6d(0x16c),()=>N());
|
|
2
|
+
const a0_0x4eb00a=a0_0x279e;(function(_0x357d5e,_0x59c0bf){const _0x459576=a0_0x279e,_0xc7ff5b=_0x357d5e();while(!![]){try{const _0x38bb63=-parseInt(_0x459576(0x211))/0x1*(-parseInt(_0x459576(0x1d5))/0x2)+-parseInt(_0x459576(0x21f))/0x3*(-parseInt(_0x459576(0x206))/0x4)+parseInt(_0x459576(0x1dc))/0x5+-parseInt(_0x459576(0x20b))/0x6*(-parseInt(_0x459576(0x21b))/0x7)+parseInt(_0x459576(0x249))/0x8+parseInt(_0x459576(0x1d6))/0x9*(parseInt(_0x459576(0x23d))/0xa)+-parseInt(_0x459576(0x1de))/0xb*(parseInt(_0x459576(0x227))/0xc);if(_0x38bb63===_0x59c0bf)break;else _0xc7ff5b['push'](_0xc7ff5b['shift']());}catch(_0x4b6cc6){_0xc7ff5b['push'](_0xc7ff5b['shift']());}}}(a0_0x441a,0x546d7));import{readFileSync as a0_0x4a338c,existsSync as a0_0x57606d}from'fs';import{randomUUID as a0_0xa73832}from'crypto';import{join as a0_0x1a3ec3}from'path';import{hostname as a0_0x4680fe}from'os';import{execSync as a0_0x4ee0c6}from'child_process';import{Server as a0_0x4ccaff}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x223c8e}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x271a40,CallToolRequestSchema as a0_0x59ccac}from'@modelcontextprotocol/sdk/types.js';function p(_0x190ee8){const _0x86c244=a0_0x279e;if(!a0_0x57606d(_0x190ee8))return;for(let _0x357265 of a0_0x4a338c(_0x190ee8,_0x86c244(0x1ea))[_0x86c244(0x1e0)]('\x0a')){let _0x1ff25b=_0x357265['trim']();if(!_0x1ff25b||_0x1ff25b['startsWith']('#'))continue;let _0x4b9dad=_0x1ff25b[_0x86c244(0x1fa)]('=');if(_0x4b9dad<0x0)continue;let _0x52dbdb=_0x1ff25b[_0x86c244(0x1cd)](0x0,_0x4b9dad)[_0x86c244(0x248)](),_0x4dcc10=_0x1ff25b['slice'](_0x4b9dad+0x1)[_0x86c244(0x248)]()[_0x86c244(0x20c)](/^["']|["']$/g,'');if(!process.env[_0x52dbdb])process.env[_0x52dbdb]=_0x4dcc10;}}var C=process.env.HOME||'~',T=a0_0x1a3ec3(C,'.claude/channels/commhub');p(a0_0x1a3ec3(T,a0_0x4eb00a(0x20d)));var L=process[a0_0x4eb00a(0x21d)]()[a0_0x4eb00a(0x20c)](/\//g,'-');function a0_0x441a(){const _0x3aaaaa=['data:\x20','Reply\x20text\x20/\x20result\x20summary','idle','MCP\x20stdio\x20connected','60ZjoTEz','exit','failed','from','message','stringify','http://127.0.0.1:9200','type','application/json,\x20text/event-stream','POST','\x22\x20(','session\x20disconnected','parse\x20error:\x20','body','tools/call','connecting\x20to\x20','string','SSE\x20stream\x20ended,\x20reconnecting...','then','warning:\x20could\x20not\x20register:\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','toTimeString','110tQBYgG','commhub_reply','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','messages','commhub','application/json','error','none','claude-code','ack_inbox','init\x20failed:\x20','trim','4098312rnQEjj','commhub_send_message','new_task','Session\x20alias:\x20','SIGINT','getReader','get_inbox','SSE\x20fatal:\x20','end','params','connected','normal','task','replied','shutting\x20down,\x20reporting\x20offline...','/events/','object','number','blocked','slice','Message\x20content','\x20ALIAS=','get_all_status','from_session','CommHub\x20init\x20failed:\x20','unknown\x20tool','stderr','2wPmYbO','332964PaTQxi','Bearer\x20','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','set','working','low','2211990qMojSO','catch','4755212BbyKwO','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','split',':\x20inbox_count=','0.3.0','.anet','send_message','commhub_send_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','setRequestHandler','token','report_status','utf-8','SSE\x20error:\x20','notifications/claude/channel','ENV:\x20URL=','message_id','hub','\x20from\x20','no\x20response','Priority\x20(default:\x20normal)','starting\x20SSE\x20listener...','commhub_get_all_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','/mcp','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Authorization','tmux\x20display-message\x20-p\x20\x27#S\x27','indexOf','commhub-channel','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','status','text','parse','priority','get','config.json','notification','pop','read','268ORjOoO','high','SSE\x20connection\x20error:\x20','send_task','alias','6qFeYNn','replace','.env','completed','find','initialize','551788BtzQPN','connect','commhub_report_status','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','content','\x20RESUME_ID=','fatal:\x20','\x20priority=','\x20PROJECT_ENV=','Task\x20content','278747suGrpW','ready\x20—\x20waiting\x20for\x20events','cwd','stdin','24807iFpziQ','new_message','statusText','2025-03-26'];a0_0x441a=function(){return _0x3aaaaa;};return a0_0x441a();}p(a0_0x1a3ec3(T,L,a0_0x4eb00a(0x20d)));function U(){const _0x4c62bb=a0_0x4eb00a;try{return a0_0x4ee0c6(_0x4c62bb(0x1f9),{'encoding':_0x4c62bb(0x1ea),'timeout':0x7d0})[_0x4c62bb(0x248)]();}catch{return'';}}function v(){const _0x43f7d3=a0_0x4eb00a;try{let _0xc60eb7=a0_0x1a3ec3(C,_0x43f7d3(0x1e3),_0x43f7d3(0x202));if(a0_0x57606d(_0xc60eb7))return JSON['parse'](a0_0x4a338c(_0xc60eb7,_0x43f7d3(0x1ea)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x4eb00a(0x1ef)]||a0_0x4eb00a(0x22d),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4680fe(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xa73832(),X=process.env.COMMHUB_TOKEN||H[a0_0x4eb00a(0x1e8)]||'';function Y(_0x517774){const _0x399ada=a0_0x4eb00a;let _0x402d88=new Date()[_0x399ada(0x23c)]()[_0x399ada(0x1cd)](0x0,0x8);process[_0x399ada(0x1d4)]['write']('['+_0x402d88+']\x20[commhub]\x20'+_0x517774+'\x0a');}function h(_0x582e65){return new Promise(_0x3d7f22=>setTimeout(_0x3d7f22,_0x582e65));}Y(a0_0x4eb00a(0x1ed)+f+a0_0x4eb00a(0x1cf)+Z+a0_0x4eb00a(0x216)+w[a0_0x4eb00a(0x1cd)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x4eb00a(0x244))+'\x20CWD='+process[a0_0x4eb00a(0x21d)]()+a0_0x4eb00a(0x219)+L);function a0_0x279e(_0x57859b,_0x41d4df){_0x57859b=_0x57859b-0x1be;const _0x441a7b=a0_0x441a();let _0x279e34=_0x441a7b[_0x57859b];return _0x279e34;}var k=new Map(),K=new a0_0x4ccaff({'name':a0_0x4eb00a(0x1fb),'version':a0_0x4eb00a(0x1e2)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4eb00a(0x1df),a0_0x4eb00a(0x23f),'Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.',a0_0x4eb00a(0x214),a0_0x4eb00a(0x24c)+Z]['join']('\x0a')});K[a0_0x4eb00a(0x1e7)](a0_0x271a40,async()=>({'tools':[{'name':a0_0x4eb00a(0x23e),'description':a0_0x4eb00a(0x1e6),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x4eb00a(0x1fc)},'text':{'type':a0_0x4eb00a(0x237),'description':a0_0x4eb00a(0x224)},'status':{'type':'string','enum':[a0_0x4eb00a(0x20e),a0_0x4eb00a(0x229),'cancelled',a0_0x4eb00a(0x1cc),a0_0x4eb00a(0x243),'in_progress'],'description':a0_0x4eb00a(0x23b)}},'required':[a0_0x4eb00a(0x1fe)]}},{'name':a0_0x4eb00a(0x213),'description':a0_0x4eb00a(0x1f7),'inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{'status':{'type':a0_0x4eb00a(0x237),'enum':[a0_0x4eb00a(0x1da),a0_0x4eb00a(0x225),a0_0x4eb00a(0x1cc),a0_0x4eb00a(0x243)]},'task':{'type':a0_0x4eb00a(0x237),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x4eb00a(0x1cb),'description':'Progress\x200-100'}},'required':[a0_0x4eb00a(0x1fd)]}},{'name':a0_0x4eb00a(0x1e5),'description':a0_0x4eb00a(0x1d8),'inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{'alias':{'type':a0_0x4eb00a(0x237),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x4eb00a(0x237),'description':a0_0x4eb00a(0x21a)},'priority':{'type':a0_0x4eb00a(0x237),'enum':[a0_0x4eb00a(0x207),a0_0x4eb00a(0x1c5),a0_0x4eb00a(0x1db)],'description':a0_0x4eb00a(0x1f2)}},'required':[a0_0x4eb00a(0x20a),a0_0x4eb00a(0x1c6)]}},{'name':a0_0x4eb00a(0x24a),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':a0_0x4eb00a(0x237),'description':a0_0x4eb00a(0x1ce)}},'required':[a0_0x4eb00a(0x20a),a0_0x4eb00a(0x22b)]}},{'name':'commhub_get_all_status','description':a0_0x4eb00a(0x1f5),'inputSchema':{'type':a0_0x4eb00a(0x1ca),'properties':{}}}]}));async function P(_0x1f1142,_0xb413a){const _0x499cf6=a0_0x4eb00a;let _0x1c6604=await fetch(f+_0x499cf6(0x1f6),{'method':_0x499cf6(0x230),'headers':{'Content-Type':_0x499cf6(0x242),'Accept':_0x499cf6(0x22f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x499cf6(0x22c)]({'jsonrpc':'2.0','id':0x1,'method':_0x499cf6(0x210),'params':{'protocolVersion':_0x499cf6(0x222),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x499cf6(0x1e2)}}})});if(!_0x1c6604['ok']){let _0x1e7aaa=await _0x1c6604[_0x499cf6(0x1fe)]();return Y(_0x499cf6(0x1d2)+_0x1c6604['status']+'\x20'+_0x1e7aaa[_0x499cf6(0x1cd)](0x0,0x64)),{'ok':!0x1,'error':_0x499cf6(0x247)+_0x1c6604[_0x499cf6(0x1fd)]};}await _0x1c6604['text']();let _0x24c976=(await(await fetch(f+_0x499cf6(0x1f6),{'method':_0x499cf6(0x230),'headers':{'Content-Type':_0x499cf6(0x242),'Accept':_0x499cf6(0x22f),...X?{'Authorization':_0x499cf6(0x1d7)+X}:{}},'body':JSON[_0x499cf6(0x22c)]({'jsonrpc':'2.0','id':0x2,'method':_0x499cf6(0x235),'params':{'name':_0x1f1142,'arguments':_0xb413a}})}))[_0x499cf6(0x1fe)]())['split']('\x0a')[_0x499cf6(0x20f)](_0x497bc5=>_0x497bc5['startsWith']('data:\x20'));if(_0x24c976){let _0x34b291=JSON[_0x499cf6(0x1ff)](_0x24c976[_0x499cf6(0x1cd)](0x6));return _0x34b291?.['result']?.['content']?.[0x0]?.[_0x499cf6(0x1fe)]?JSON[_0x499cf6(0x1ff)](_0x34b291['result'][_0x499cf6(0x215)][0x0][_0x499cf6(0x1fe)]):_0x34b291;}return{'ok':!0x1,'error':_0x499cf6(0x1f1)};}K[a0_0x4eb00a(0x1e7)](a0_0x59ccac,async _0x13d469=>{const _0x35a493=a0_0x4eb00a;let {name:_0x320e8d,arguments:_0x1c2fb6}=_0x13d469[_0x35a493(0x1c3)];if(_0x320e8d===_0x35a493(0x23e)){let {task_id:_0x6d3288,text:_0x3698dd,status:_0x1a0513}=_0x1c2fb6;if(_0x1a0513===_0x35a493(0x20e)||_0x1a0513===_0x35a493(0x229)||_0x1a0513==='cancelled'){let _0x46886e=_0x1a0513===_0x35a493(0x20e)?_0x35a493(0x1c7):_0x1a0513,_0x1e0f39=_0x6d3288?k[_0x35a493(0x201)](_0x6d3288)||_0x35a493(0x1ef):_0x35a493(0x1ef),_0x277356=await P('send_reply',{'alias':_0x1e0f39,'text':_0x3698dd,'in_reply_to':_0x6d3288||void 0x0,'status':_0x46886e,'from_session':Z});if(_0x6d3288)k['delete'](_0x6d3288);return{'content':[{'type':'text','text':JSON[_0x35a493(0x22c)](_0x277356)}]};}let _0x4afaa9=await P(_0x35a493(0x1e9),{'resume_id':w,'alias':Z,'status':_0x1a0513===_0x35a493(0x1cc)?_0x35a493(0x1cc):_0x1a0513===_0x35a493(0x243)?_0x35a493(0x243):_0x35a493(0x1da),'task':_0x3698dd[_0x35a493(0x1cd)](0x0,0xc8),'output':_0x3698dd});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON['stringify'](_0x4afaa9)}]};}if(_0x320e8d===_0x35a493(0x213)){let {status:_0x25a14a,task:_0x1c3302,progress:_0x3afcc2}=_0x1c2fb6,_0x222cae=await P(_0x35a493(0x1e9),{'resume_id':w,'alias':Z,'status':_0x25a14a,'task':_0x1c3302,'progress':_0x3afcc2});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON['stringify'](_0x222cae)}]};}if(_0x320e8d===_0x35a493(0x1e5)){let {alias:_0x317caa,task:_0x2f0361,priority:_0x2ab9e6}=_0x1c2fb6,_0x3b4ff6=await P(_0x35a493(0x209),{'alias':_0x317caa,'task':_0x2f0361,'priority':_0x2ab9e6||'normal','from_session':Z});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)](_0x3b4ff6)}]};}if(_0x320e8d==='commhub_send_message'){let {alias:_0x273751,message:_0x248b97}=_0x1c2fb6,_0x57afcb=await P(_0x35a493(0x1e4),{'alias':_0x273751,'message':_0x248b97,'from_session':Z});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)](_0x57afcb)}]};}if(_0x320e8d===_0x35a493(0x1f4)){let _0x36ba85=await P(_0x35a493(0x1d0),{});return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)](_0x36ba85)}]};}return{'content':[{'type':_0x35a493(0x1fe),'text':JSON[_0x35a493(0x22c)]({'error':_0x35a493(0x1d3)})}]};});async function u(){const _0x5321a6=a0_0x4eb00a;let _0x114714=f+_0x5321a6(0x1c9)+encodeURIComponent(Z),_0x34695c={};if(X)_0x34695c[_0x5321a6(0x1f8)]='Bearer\x20'+X;Y(_0x5321a6(0x236)+_0x114714);while(!0x0){try{let _0x597c67=await fetch(_0x114714,{'headers':_0x34695c});if(!_0x597c67['ok']){Y(_0x5321a6(0x1eb)+_0x597c67[_0x5321a6(0x1fd)]+'\x20'+_0x597c67[_0x5321a6(0x221)]),await h(0x1388);continue;}let _0xe53878=_0x597c67[_0x5321a6(0x234)][_0x5321a6(0x1bf)](),_0x3e69e7=new TextDecoder(),_0x46b18a='';while(!0x0){let {done:_0x22e39e,value:_0x374b47}=await _0xe53878[_0x5321a6(0x205)]();if(_0x22e39e)break;_0x46b18a+=_0x3e69e7['decode'](_0x374b47,{'stream':!0x0});let _0x47a0a9=_0x46b18a['split']('\x0a\x0a');_0x46b18a=_0x47a0a9[_0x5321a6(0x204)]()||'';for(let _0x20a756 of _0x47a0a9){let _0x4951a0=_0x20a756[_0x5321a6(0x1e0)]('\x0a')['find'](_0x1f1db3=>_0x1f1db3['startsWith'](_0x5321a6(0x223)));if(!_0x4951a0)continue;try{let _0x16d3b2=JSON[_0x5321a6(0x1ff)](_0x4951a0[_0x5321a6(0x1cd)](0x6));await S(_0x16d3b2);}catch(_0x1a37cd){Y(_0x5321a6(0x233)+_0x1a37cd);}}}Y(_0x5321a6(0x238));}catch(_0x199166){Y(_0x5321a6(0x208)+_0x199166);}await h(0xbb8);}}async function S(_0x35b29e){const _0x2c9b0a=a0_0x4eb00a;if(_0x35b29e['type']===_0x2c9b0a(0x1c4)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x35b29e[_0x2c9b0a(0x22e)]===_0x2c9b0a(0x220)){if(Y('←\x20message\x20from\x20'+_0x35b29e[_0x2c9b0a(0x22a)]+':\x20'+_0x35b29e['message'][_0x2c9b0a(0x1cd)](0x0,0x3c)),await K[_0x2c9b0a(0x203)]({'method':_0x2c9b0a(0x1ec),'params':{'content':_0x35b29e[_0x2c9b0a(0x22b)],'meta':{'sender':_0x35b29e[_0x2c9b0a(0x22a)]||_0x2c9b0a(0x1ef),'sender_id':_0x2c9b0a(0x241),'user':_0x35b29e[_0x2c9b0a(0x22a)]||_0x2c9b0a(0x1ef),'priority':_0x2c9b0a(0x1c5)}}}),_0x35b29e[_0x2c9b0a(0x1ee)])await P(_0x2c9b0a(0x246),{'alias':Z,'message_id':_0x35b29e[_0x2c9b0a(0x1ee)]});return;}if(_0x35b29e['type']===_0x2c9b0a(0x24b)||_0x35b29e[_0x2c9b0a(0x22e)]==='broadcast'){Y('←\x20'+_0x35b29e['type']+_0x2c9b0a(0x1e1)+_0x35b29e['inbox_count']+_0x2c9b0a(0x218)+(_0x35b29e[_0x2c9b0a(0x200)]||_0x2c9b0a(0x1c5)));let _0x5459fd=await P(_0x2c9b0a(0x1c0),{'alias':Z,'limit':0x5});if(_0x5459fd?.['ok']&&_0x5459fd[_0x2c9b0a(0x240)]?.['length']>0x0)for(let _0x3d6893 of _0x5459fd[_0x2c9b0a(0x240)]){let _0xcfee30={'sender':_0x3d6893[_0x2c9b0a(0x1d1)]||_0x2c9b0a(0x1ef),'sender_id':_0x2c9b0a(0x241),'user':_0x3d6893['from_session']||_0x2c9b0a(0x1ef),'task_id':_0x3d6893['id'],'priority':_0x3d6893[_0x2c9b0a(0x200)]||_0x2c9b0a(0x1c5)};k[_0x2c9b0a(0x1d9)](_0x3d6893['id'],_0x3d6893[_0x2c9b0a(0x1d1)]||'hub'),await K[_0x2c9b0a(0x203)]({'method':'notifications/claude/channel','params':{'content':_0x3d6893[_0x2c9b0a(0x215)],'meta':_0xcfee30}}),Y('→\x20injected\x20task\x20'+_0x3d6893['id'][_0x2c9b0a(0x1cd)](0x0,0x8)+_0x2c9b0a(0x1f0)+_0x3d6893[_0x2c9b0a(0x1d1)]+':\x20'+_0x3d6893[_0x2c9b0a(0x215)][_0x2c9b0a(0x1cd)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x3d6893['id']});}}}async function A(){const _0x53de57=a0_0x4eb00a;let _0x5853e5=new a0_0x223c8e();await K[_0x53de57(0x212)](_0x5853e5),Y(_0x53de57(0x226)),Y(_0x53de57(0x1f3)),u()[_0x53de57(0x1dd)](_0x3b1e9a=>Y(_0x53de57(0x1c1)+_0x3b1e9a)),P(_0x53de57(0x1e9),{'resume_id':w,'alias':Z,'status':_0x53de57(0x225),'server':a0_0x4680fe(),'hostname':a0_0x4680fe(),'agent':_0x53de57(0x245),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x53de57(0x239)](()=>Y('registered\x20as\x20\x22'+Z+_0x53de57(0x231)+w['slice'](0x0,0x8)+')'))[_0x53de57(0x1dd)](_0x4d5d53=>Y(_0x53de57(0x23a)+_0x4d5d53)),setInterval(()=>{const _0xcb412=_0x53de57;P('report_status',{'resume_id':w,'alias':Z,'status':_0xcb412(0x225),'server':a0_0x4680fe(),'hostname':a0_0x4680fe(),'agent':'claude-code','project_dir':process[_0xcb412(0x21d)](),'tmux_name':j||void 0x0})[_0xcb412(0x1dd)](_0x20b507=>Y('heartbeat\x20failed:\x20'+_0x20b507));},0x2bf20),Y(_0x53de57(0x21c));}A()[a0_0x4eb00a(0x1dd)](_0x1a35c9=>{const _0xae849=a0_0x4eb00a;Y(_0xae849(0x217)+_0x1a35c9),process['exit'](0x1);});async function N(){const _0x23e724=a0_0x4eb00a;Y(_0x23e724(0x1c8)),await P(_0x23e724(0x1e9),{'resume_id':w,'alias':Z,'status':_0x23e724(0x243),'task':_0x23e724(0x232)})[_0x23e724(0x1dd)](()=>{}),process[_0x23e724(0x228)](0x0);}process[a0_0x4eb00a(0x21e)]['on'](a0_0x4eb00a(0x1c2),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x4eb00a(0x1be),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.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",
|