@sleep2agi/agent-network 2.1.4-preview.7 → 2.1.4-preview.9
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_0x2f20(){const _0x53988c=['sseAbort','split','text','heartbeatInterval','read','message','cwd','24hznPXZ','min','3509289Fqrwlp','inbox\x20error:\x20','stringify','get_inbox','heartbeat\x20failed:\x20','AbortError','report_status','catch','status','application/json','2.0','parse','slice','POST','body','connectSSE','task','log','13094874bjSXxS','send_message','connect','heartbeatTimer','SSE\x20failed:\x20','pop','emit','send_reply','toTimeString','get_all_status','toString','83152MRNUjQ','broadcast','match','135MDnrEe','running','new_message','2746347PRrpbv','content','signal','from_session','11116600yIVNDv','Authorization','s...','Bearer\x20','data:\x20','SSE\x20error:\x20','idle','text/event-stream','autoConnect','type','ack_inbox','decode','2epJSqT','reply','getReader','SSE\x20reconnecting\x20in\x20','sleep','new_task','offline','application/json,\x20text/event-stream','replace','getAllStatus','disconnected','processInbox','registered','completed','agent','call','6042612JHBvPS','abort','alias','url','now','sdk','775639Quaqte','reconnectDelay','result','/events/','token','resumeId','error'];a0_0x2f20=function(){return _0x53988c;};return a0_0x2f20();}function a0_0x1782(_0x14144e,_0x512fef){_0x14144e=_0x14144e-0x173;const _0x2f2012=a0_0x2f20();let _0x178286=_0x2f2012[_0x14144e];return _0x178286;}const a0_0x480d82=a0_0x1782;(function(_0x40476d,_0x21f9ef){const _0x560619=a0_0x1782,_0x448b4c=_0x40476d();while(!![]){try{const _0x3f459f=-parseInt(_0x560619(0x1c1))/0x1*(parseInt(_0x560619(0x1ab))/0x2)+parseInt(_0x560619(0x19b))/0x3+-parseInt(_0x560619(0x195))/0x4*(-parseInt(_0x560619(0x198))/0x5)+-parseInt(_0x560619(0x1bb))/0x6+-parseInt(_0x560619(0x178))/0x7*(parseInt(_0x560619(0x176))/0x8)+parseInt(_0x560619(0x18a))/0x9+parseInt(_0x560619(0x19f))/0xa;if(_0x3f459f===_0x21f9ef)break;else _0x448b4c['push'](_0x448b4c['shift']());}catch(_0x4d937b){_0x448b4c['push'](_0x448b4c['shift']());}}}(a0_0x2f20,0xb8ba9));import{EventEmitter as a0_0x32682b}from'events';import{hostname as a0_0x40dbf6}from'os';class T extends a0_0x32682b{[a0_0x480d82(0x1be)];[a0_0x480d82(0x1bd)];['token'];[a0_0x480d82(0x1b9)];[a0_0x480d82(0x1c6)];[a0_0x480d82(0x1cb)];[a0_0x480d82(0x1c2)];[a0_0x480d82(0x18d)];[a0_0x480d82(0x1c8)];[a0_0x480d82(0x199)]=!0x1;constructor(_0x1b88ad){const _0x17ca5d=a0_0x480d82;super();if(this[_0x17ca5d(0x1be)]=_0x1b88ad[_0x17ca5d(0x1be)][_0x17ca5d(0x1b3)](/\/$/,''),this[_0x17ca5d(0x1bd)]=_0x1b88ad['alias'],this[_0x17ca5d(0x1c5)]=_0x1b88ad[_0x17ca5d(0x1c5)],this['agent']=_0x1b88ad[_0x17ca5d(0x1b9)]||_0x17ca5d(0x1c0),this[_0x17ca5d(0x1c6)]='sdk-'+_0x1b88ad['alias']+'-'+Date[_0x17ca5d(0x1bf)]()[_0x17ca5d(0x194)](0x24),this[_0x17ca5d(0x1cb)]=_0x1b88ad[_0x17ca5d(0x1cb)]??0x2bf20,this['reconnectDelay']=_0x1b88ad[_0x17ca5d(0x1c2)]??0xbb8,_0x1b88ad[_0x17ca5d(0x1a7)]!==!0x1)this[_0x17ca5d(0x18c)]();}[a0_0x480d82(0x189)](_0x1803e1){const _0x5079c9=a0_0x480d82;console['log']('['+new Date()[_0x5079c9(0x192)]()[_0x5079c9(0x184)](0x0,0x8)+']\x20[commhub:'+this[_0x5079c9(0x1bd)]+']\x20'+_0x1803e1);}async[a0_0x480d82(0x1ba)](_0x4f458b,_0x57da91){const _0x52ea40=a0_0x480d82;let _0x2af967={'Content-Type':_0x52ea40(0x181),'Accept':_0x52ea40(0x1b2)};if(this[_0x52ea40(0x1c5)])_0x2af967[_0x52ea40(0x1a0)]=_0x52ea40(0x1a2)+this[_0x52ea40(0x1c5)];let _0x152694=await(await fetch(this[_0x52ea40(0x1be)]+'/mcp',{'method':_0x52ea40(0x185),'headers':_0x2af967,'body':JSON[_0x52ea40(0x17a)]({'jsonrpc':_0x52ea40(0x182),'id':Date[_0x52ea40(0x1bf)](),'method':'tools/call','params':{'name':_0x4f458b,'arguments':_0x57da91}})}))['text'](),_0x5e7e64=_0x152694[_0x52ea40(0x197)](/data: (.+)/),_0x5cacb5=_0x5e7e64?JSON[_0x52ea40(0x183)](_0x5e7e64[0x1]):JSON[_0x52ea40(0x183)](_0x152694),_0x1d6c39=_0x5cacb5?.[_0x52ea40(0x1c3)]?.[_0x52ea40(0x19c)]?.[0x0]?.[_0x52ea40(0x1ca)];return _0x1d6c39?JSON[_0x52ea40(0x183)](_0x1d6c39):_0x5cacb5;}async['connect'](){const _0x3f6dc0=a0_0x480d82;if(this['running'])return;this[_0x3f6dc0(0x199)]=!0x0,await this[_0x3f6dc0(0x180)](_0x3f6dc0(0x1a5)),this[_0x3f6dc0(0x189)](_0x3f6dc0(0x1b7)),this[_0x3f6dc0(0x18d)]=setInterval(()=>{const _0x1d8390=_0x3f6dc0;this[_0x1d8390(0x180)](_0x1d8390(0x1a5))[_0x1d8390(0x17f)](_0x445daa=>this[_0x1d8390(0x189)](_0x1d8390(0x17c)+_0x445daa[_0x1d8390(0x174)]));},this['heartbeatInterval']),this[_0x3f6dc0(0x187)]();}async['disconnect'](){const _0x80416f=a0_0x480d82;if(this[_0x80416f(0x199)]=!0x1,this[_0x80416f(0x1c8)]?.[_0x80416f(0x1bc)](),this[_0x80416f(0x18d)])clearInterval(this[_0x80416f(0x18d)]);await this[_0x80416f(0x180)](_0x80416f(0x1b1))['catch'](()=>{}),this[_0x80416f(0x189)](_0x80416f(0x1b5));}async['send'](_0x23de77,_0x58fe10,_0x23f007='normal'){return this['call']('send_task',{'alias':_0x23de77,'task':_0x58fe10,'priority':_0x23f007,'from_session':this['alias']});}async[a0_0x480d82(0x174)](_0x54a500,_0x22e33d){const _0x4795ab=a0_0x480d82;return this[_0x4795ab(0x1ba)](_0x4795ab(0x18b),{'alias':_0x54a500,'message':_0x22e33d,'from_session':this['alias']});}async[a0_0x480d82(0x1ac)](_0x59c02d,_0x421fd7,_0x265f2a=a0_0x480d82(0x1b8)){const _0x337f16=a0_0x480d82;return this['call'](_0x337f16(0x191),{'in_reply_to':_0x59c02d,'text':_0x421fd7,'status':_0x265f2a});}async[a0_0x480d82(0x180)](_0x3574c6,_0x1dcb4e){const _0x471a81=a0_0x480d82;return this[_0x471a81(0x1ba)](_0x471a81(0x17e),{'resume_id':this[_0x471a81(0x1c6)],'alias':this[_0x471a81(0x1bd)],'status':_0x3574c6,'server':a0_0x40dbf6(),'hostname':a0_0x40dbf6(),'agent':this[_0x471a81(0x1b9)],'project_dir':process[_0x471a81(0x175)](),..._0x1dcb4e});}async[a0_0x480d82(0x1b4)](){const _0x3cb98c=a0_0x480d82;return this['call'](_0x3cb98c(0x193),{});}async[a0_0x480d82(0x196)](_0x5e0349,_0x5e999f){const _0x464a41=a0_0x480d82;return this[_0x464a41(0x1ba)](_0x464a41(0x196),{'message':_0x5e0349,'filter_server':_0x5e999f?.['server'],'filter_status':_0x5e999f?.[_0x464a41(0x180)]});}async[a0_0x480d82(0x187)](){const _0x504832=a0_0x480d82;let _0x5a00ed=encodeURIComponent(this[_0x504832(0x1bd)]),_0x5906a7=this[_0x504832(0x1be)]+_0x504832(0x1c4)+_0x5a00ed,_0x46f572=this['reconnectDelay'];while(this[_0x504832(0x199)]){try{this['sseAbort']=new AbortController();let _0x51dee4={'Accept':_0x504832(0x1a6)};if(this[_0x504832(0x1c5)])_0x51dee4[_0x504832(0x1a0)]='Bearer\x20'+this[_0x504832(0x1c5)];let _0x2db125=await fetch(_0x5906a7,{'headers':_0x51dee4,'signal':this['sseAbort'][_0x504832(0x19d)]});if(!_0x2db125['ok']||!_0x2db125[_0x504832(0x186)]){this[_0x504832(0x189)](_0x504832(0x18e)+_0x2db125[_0x504832(0x180)]),await this[_0x504832(0x1af)](_0x46f572),_0x46f572=Math['min'](_0x46f572*1.5,0xea60);continue;}_0x46f572=this[_0x504832(0x1c2)];let _0x3e6081=_0x2db125[_0x504832(0x186)][_0x504832(0x1ad)](),_0x4793d4=new TextDecoder(),_0x27b4a8='';while(this['running']){let {done:_0x22c5bc,value:_0x53cab0}=await _0x3e6081[_0x504832(0x173)]();if(_0x22c5bc)break;_0x27b4a8+=_0x4793d4[_0x504832(0x1aa)](_0x53cab0,{'stream':!0x0});let _0x26c8e5=_0x27b4a8[_0x504832(0x1c9)]('\x0a');_0x27b4a8=_0x26c8e5[_0x504832(0x18f)]()||'';for(let _0x24e160 of _0x26c8e5){if(!_0x24e160['startsWith'](_0x504832(0x1a3)))continue;try{let _0x4cb17e=JSON[_0x504832(0x183)](_0x24e160[_0x504832(0x184)](0x6));if(_0x4cb17e[_0x504832(0x1a8)]==='connected'){this[_0x504832(0x189)]('SSE\x20connected'),this['emit']('connected');continue;}if(_0x4cb17e[_0x504832(0x1a8)]===_0x504832(0x1b0)||_0x4cb17e[_0x504832(0x1a8)]===_0x504832(0x19a)||_0x4cb17e['type']===_0x504832(0x196))await this['processInbox']();}catch{}}}}catch(_0x138e21){if(_0x138e21['name']===_0x504832(0x17d))break;this[_0x504832(0x190)](_0x504832(0x1c7),_0x138e21),this['log'](_0x504832(0x1a4)+_0x138e21[_0x504832(0x174)]);}if(this[_0x504832(0x199)])this[_0x504832(0x190)](_0x504832(0x1b5)),this[_0x504832(0x189)](_0x504832(0x1ae)+_0x46f572/0x3e8+_0x504832(0x1a1)),await this[_0x504832(0x1af)](_0x46f572),_0x46f572=Math[_0x504832(0x177)](_0x46f572*1.5,0xea60);}}async[a0_0x480d82(0x1b6)](){const _0x3506aa=a0_0x480d82;try{let _0xa586a6=(await this[_0x3506aa(0x1ba)](_0x3506aa(0x17b),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0xac745b of _0xa586a6)await this['call'](_0x3506aa(0x1a9),{'alias':this[_0x3506aa(0x1bd)],'message_id':_0xac745b['id']}),this['log']('←\x20'+_0xac745b[_0x3506aa(0x19e)]+':\x20'+_0xac745b[_0x3506aa(0x19c)][_0x3506aa(0x184)](0x0,0x3c)),this[_0x3506aa(0x190)](_0x3506aa(0x188),_0xac745b),this[_0x3506aa(0x190)](_0x3506aa(0x174),_0xac745b);}catch(_0x1ebb9c){this['log'](_0x3506aa(0x179)+_0x1ebb9c[_0x3506aa(0x174)]);}}['sleep'](_0x1b9b2d){return new Promise(_0x5e633f=>setTimeout(_0x5e633f,_0x1b9b2d));}}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_0x22540a=a0_0x3a42;(function(_0x50d005,_0x4d4027){const _0x320c41=a0_0x3a42,_0x2480c4=_0x50d005();while(!![]){try{const _0x251f7b=-parseInt(_0x320c41(0x12d))/0x1*(parseInt(_0x320c41(0x13c))/0x2)+-parseInt(_0x320c41(0x111))/0x3+-parseInt(_0x320c41(0x142))/0x4*(parseInt(_0x320c41(0x114))/0x5)+-parseInt(_0x320c41(0x143))/0x6+parseInt(_0x320c41(0x13f))/0x7+-parseInt(_0x320c41(0x106))/0x8+-parseInt(_0x320c41(0x155))/0x9*(-parseInt(_0x320c41(0x163))/0xa);if(_0x251f7b===_0x4d4027)break;else _0x2480c4['push'](_0x2480c4['shift']());}catch(_0x3b49d8){_0x2480c4['push'](_0x2480c4['shift']());}}}(a0_0x37f5,0x87ad2));import{readFileSync as a0_0x41de6f,existsSync as a0_0x2c21e8}from'fs';import{randomUUID as a0_0x769621}from'crypto';import{join as a0_0x5bc03a}from'path';import{hostname as a0_0x2ddb19}from'os';import{execSync as a0_0x6fbee7}from'child_process';import{Server as a0_0x4a6855}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x12aa36}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4d9ba4,CallToolRequestSchema as a0_0x41d55c}from'@modelcontextprotocol/sdk/types.js';function p(_0x504508){const _0x83f5b0=a0_0x3a42;if(!a0_0x2c21e8(_0x504508))return;for(let _0x8ca514 of a0_0x41de6f(_0x504508,_0x83f5b0(0xfe))[_0x83f5b0(0x15c)]('\x0a')){let _0x542a8a=_0x8ca514['trim']();if(!_0x542a8a||_0x542a8a[_0x83f5b0(0xec)]('#'))continue;let _0x2849dd=_0x542a8a[_0x83f5b0(0x119)]('=');if(_0x2849dd<0x0)continue;let _0x1a9d6d=_0x542a8a[_0x83f5b0(0xe8)](0x0,_0x2849dd)['trim'](),_0x3e6f21=_0x542a8a[_0x83f5b0(0xe8)](_0x2849dd+0x1)[_0x83f5b0(0xf1)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x1a9d6d])process.env[_0x1a9d6d]=_0x3e6f21;}}var C=process.env.HOME||'~',T=a0_0x5bc03a(C,a0_0x22540a(0x126));p(a0_0x5bc03a(T,'.env'));var L=process[a0_0x22540a(0xed)]()['replace'](/\//g,'-');p(a0_0x5bc03a(T,L,a0_0x22540a(0x136)));function U(){const _0x359ee6=a0_0x22540a;try{return a0_0x6fbee7(_0x359ee6(0x158),{'encoding':_0x359ee6(0xfe),'timeout':0x7d0})[_0x359ee6(0xf1)]();}catch{return'';}}function v(){const _0x1667bf=a0_0x22540a;try{let _0x1c210d=a0_0x5bc03a(C,_0x1667bf(0x151),'config.json');if(a0_0x2c21e8(_0x1c210d))return JSON[_0x1667bf(0x156)](a0_0x41de6f(_0x1c210d,_0x1667bf(0xfe)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x22540a(0x14e)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x2ddb19(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x769621(),X=process.env.COMMHUB_TOKEN||H[a0_0x22540a(0x10b)]||'';function Y(_0x385549){const _0x447d5d=a0_0x22540a;let _0x5e7b41=new Date()[_0x447d5d(0x133)]()['slice'](0x0,0x8);process[_0x447d5d(0x16b)][_0x447d5d(0xe7)]('['+_0x5e7b41+']\x20[commhub]\x20'+_0x385549+'\x0a');}function h(_0x5a17a6){return new Promise(_0x4e9bc8=>setTimeout(_0x4e9bc8,_0x5a17a6));}function a0_0x3a42(_0x210b2d,_0x17e1f2){_0x210b2d=_0x210b2d-0xe6;const _0x37f5d8=a0_0x37f5();let _0x3a422e=_0x37f5d8[_0x210b2d];return _0x3a422e;}Y('ENV:\x20URL='+f+a0_0x22540a(0x116)+Z+'\x20RESUME_ID='+w[a0_0x22540a(0xe8)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x22540a(0x16c))+a0_0x22540a(0x110)+process[a0_0x22540a(0xed)]()+a0_0x22540a(0x127)+L);var k=new Map(),K=new a0_0x4a6855({'name':a0_0x22540a(0x166),'version':a0_0x22540a(0x165)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x22540a(0x140),a0_0x22540a(0x107),a0_0x22540a(0xef),a0_0x22540a(0x10d),'Session\x20alias:\x20'+Z][a0_0x22540a(0x115)]('\x0a')});K[a0_0x22540a(0x14d)](a0_0x4d9ba4,async()=>({'tools':[{'name':a0_0x22540a(0xfa),'description':a0_0x22540a(0xf4),'inputSchema':{'type':a0_0x22540a(0x10a),'properties':{'task_id':{'type':a0_0x22540a(0x138),'description':a0_0x22540a(0x14b)},'text':{'type':a0_0x22540a(0x138),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x22540a(0x138),'enum':[a0_0x22540a(0x121),a0_0x22540a(0x102),a0_0x22540a(0x124),a0_0x22540a(0x11a),a0_0x22540a(0x105),a0_0x22540a(0x12b)],'description':a0_0x22540a(0x134)}},'required':[a0_0x22540a(0x12f)]}},{'name':a0_0x22540a(0x117),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x22540a(0x10a),'properties':{'status':{'type':'string','enum':['working',a0_0x22540a(0xea),a0_0x22540a(0x11a),a0_0x22540a(0x105)]},'task':{'type':a0_0x22540a(0x138),'description':a0_0x22540a(0x118)},'progress':{'type':a0_0x22540a(0xf6),'description':'Progress\x200-100'}},'required':[a0_0x22540a(0x11c)]}},{'name':'commhub_send_task','description':a0_0x22540a(0x159),'inputSchema':{'type':a0_0x22540a(0x10a),'properties':{'alias':{'type':a0_0x22540a(0x138),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x22540a(0x138),'description':'Task\x20content'},'priority':{'type':a0_0x22540a(0x138),'enum':[a0_0x22540a(0x104),a0_0x22540a(0x129),'low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x22540a(0x14c),a0_0x22540a(0x141)]}},{'name':a0_0x22540a(0x128),'description':a0_0x22540a(0x15f),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x22540a(0x138),'description':a0_0x22540a(0xfc)},'message':{'type':a0_0x22540a(0x138),'description':a0_0x22540a(0xf9)}},'required':[a0_0x22540a(0x14c),a0_0x22540a(0xff)]}},{'name':'commhub_get_all_status','description':a0_0x22540a(0x15e),'inputSchema':{'type':a0_0x22540a(0x10a),'properties':{}}}]}));async function P(_0x44f8ed,_0x37e29c){const _0x4bf457=a0_0x22540a;let _0x33241a=await fetch(f+_0x4bf457(0x12a),{'method':_0x4bf457(0x15d),'headers':{'Content-Type':'application/json','Accept':_0x4bf457(0x161),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x4bf457(0xe6),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x4bf457(0x137),'capabilities':{},'clientInfo':{'name':_0x4bf457(0x166),'version':_0x4bf457(0x165)}}})});if(!_0x33241a['ok']){let _0x5dc532=await _0x33241a[_0x4bf457(0x12f)]();return Y(_0x4bf457(0xfb)+_0x33241a[_0x4bf457(0x11c)]+'\x20'+_0x5dc532[_0x4bf457(0xe8)](0x0,0x64)),{'ok':!0x1,'error':_0x4bf457(0x112)+_0x33241a[_0x4bf457(0x11c)]};}await _0x33241a[_0x4bf457(0x12f)]();let _0x34ea9c=(await(await fetch(f+_0x4bf457(0x12a),{'method':_0x4bf457(0x15d),'headers':{'Content-Type':'application/json','Accept':_0x4bf457(0x161),...X?{'Authorization':_0x4bf457(0x120)+X}:{}},'body':JSON[_0x4bf457(0x146)]({'jsonrpc':_0x4bf457(0xe6),'id':0x2,'method':_0x4bf457(0x144),'params':{'name':_0x44f8ed,'arguments':_0x37e29c}})}))[_0x4bf457(0x12f)]())[_0x4bf457(0x15c)]('\x0a')['find'](_0x2a5720=>_0x2a5720[_0x4bf457(0xec)]('data:\x20'));if(_0x34ea9c){let _0x30008d=JSON[_0x4bf457(0x156)](_0x34ea9c[_0x4bf457(0xe8)](0x6));return _0x30008d?.[_0x4bf457(0xf3)]?.[_0x4bf457(0x169)]?.[0x0]?.[_0x4bf457(0x12f)]?JSON[_0x4bf457(0x156)](_0x30008d[_0x4bf457(0xf3)][_0x4bf457(0x169)][0x0][_0x4bf457(0x12f)]):_0x30008d;}return{'ok':!0x1,'error':_0x4bf457(0x15a)};}function a0_0x37f5(){const _0x102794=['ready\x20—\x20waiting\x20for\x20events','510461FVlThr','messages','text','report_status','exit','\x22\x20(','toTimeString','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','heartbeat\x20failed:\x20','.env','2025-03-26','string','fatal:\x20','message_id','SSE\x20error:\x20','2pqKjOP','parse\x20error:\x20','catch','5702291WdYlYE','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','task','8XLfABn','1544388MetrdA','tools/call','SSE\x20stream\x20ended,\x20reconnecting...','stringify','find','get_all_status','statusText','notifications/claude/channel','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','alias','setRequestHandler','hub','from','data:\x20','.anet','length','notification','\x20priority=','18UCaEOb','parse','params','tmux\x20display-message\x20-p\x20\x27#S\x27','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','no\x20response','decode','split','POST','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','connecting\x20to\x20','application/json,\x20text/event-stream','delete','12133670eBtWOc','type','0.3.0','commhub-channel','new_task','registered\x20as\x20\x22','content','claude-code','stderr','none','2.0','write','slice','←\x20message\x20from\x20','idle','SSE\x20connection\x20error:\x20','startsWith','cwd','broadcast','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','new_message','trim','unknown\x20tool','result','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','priority','number','→\x20injected\x20task\x20','/events/','Message\x20content','commhub_reply','CommHub\x20init\x20failed:\x20','Target\x20session\x20alias','getReader','utf-8','message','commhub','connected','failed','working','high','error','6991176gprMYc','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','body','then','object','token','set','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','end','from_session','\x20CWD=','1555149QOYngg','init\x20failed:\x20','replied','1313695TaKAVb','join','\x20ALIAS=','commhub_report_status','Current\x20task\x20description','indexOf','blocked','get_inbox','status','pop','Authorization','connect','Bearer\x20','completed','MCP\x20stdio\x20connected',':\x20inbox_count=','cancelled','starting\x20SSE\x20listener...','.claude/channels/commhub','\x20PROJECT_ENV=','commhub_send_message','normal','/mcp','in_progress'];a0_0x37f5=function(){return _0x102794;};return a0_0x37f5();}K['setRequestHandler'](a0_0x41d55c,async _0x77e3e1=>{const _0x3aa515=a0_0x22540a;let {name:_0x573be1,arguments:_0x2796ac}=_0x77e3e1[_0x3aa515(0x157)];if(_0x573be1===_0x3aa515(0xfa)){let {task_id:_0x153e4d,text:_0x15aa51,status:_0x544152}=_0x2796ac;if(_0x544152===_0x3aa515(0x121)||_0x544152===_0x3aa515(0x102)||_0x544152==='cancelled'){let _0x53ba84=_0x544152===_0x3aa515(0x121)?_0x3aa515(0x113):_0x544152,_0x50b3a6=_0x153e4d?k['get'](_0x153e4d)||_0x3aa515(0x14e):_0x3aa515(0x14e),_0x2bdb79=await P('send_reply',{'alias':_0x50b3a6,'text':_0x15aa51,'in_reply_to':_0x153e4d||void 0x0,'status':_0x53ba84,'from_session':Z});if(_0x153e4d)k[_0x3aa515(0x162)](_0x153e4d);return{'content':[{'type':_0x3aa515(0x12f),'text':JSON[_0x3aa515(0x146)](_0x2bdb79)}]};}let _0xa400ae=await P(_0x3aa515(0x130),{'resume_id':w,'alias':Z,'status':_0x544152===_0x3aa515(0x11a)?_0x3aa515(0x11a):_0x544152===_0x3aa515(0x105)?_0x3aa515(0x105):_0x3aa515(0x103),'task':_0x15aa51[_0x3aa515(0xe8)](0x0,0xc8),'output':_0x15aa51});return{'content':[{'type':_0x3aa515(0x12f),'text':JSON[_0x3aa515(0x146)](_0xa400ae)}]};}if(_0x573be1===_0x3aa515(0x117)){let {status:_0x59ccb5,task:_0x4e2b78,progress:_0x5201bc}=_0x2796ac,_0x2ce492=await P(_0x3aa515(0x130),{'resume_id':w,'alias':Z,'status':_0x59ccb5,'task':_0x4e2b78,'progress':_0x5201bc});return{'content':[{'type':_0x3aa515(0x12f),'text':JSON[_0x3aa515(0x146)](_0x2ce492)}]};}if(_0x573be1==='commhub_send_task'){let {alias:_0x2c8d70,task:_0x6f5c1b,priority:_0x3d6248}=_0x2796ac,_0x2ed5a4=await P('send_task',{'alias':_0x2c8d70,'task':_0x6f5c1b,'priority':_0x3d6248||_0x3aa515(0x129),'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x3aa515(0x146)](_0x2ed5a4)}]};}if(_0x573be1===_0x3aa515(0x128)){let {alias:_0x469925,message:_0x5bbcac}=_0x2796ac,_0x377f18=await P('send_message',{'alias':_0x469925,'message':_0x5bbcac,'from_session':Z});return{'content':[{'type':_0x3aa515(0x12f),'text':JSON['stringify'](_0x377f18)}]};}if(_0x573be1==='commhub_get_all_status'){let _0x145803=await P(_0x3aa515(0x148),{});return{'content':[{'type':'text','text':JSON[_0x3aa515(0x146)](_0x145803)}]};}return{'content':[{'type':'text','text':JSON[_0x3aa515(0x146)]({'error':_0x3aa515(0xf2)})}]};});async function u(){const _0x146492=a0_0x22540a;let _0x1f61ea=f+_0x146492(0xf8)+encodeURIComponent(Z),_0x65d8f={};if(X)_0x65d8f[_0x146492(0x11e)]='Bearer\x20'+X;Y(_0x146492(0x160)+_0x1f61ea);while(!0x0){try{let _0x2f90ab=await fetch(_0x1f61ea,{'headers':_0x65d8f});if(!_0x2f90ab['ok']){Y(_0x146492(0x13b)+_0x2f90ab[_0x146492(0x11c)]+'\x20'+_0x2f90ab[_0x146492(0x149)]),await h(0x1388);continue;}let _0x333fcd=_0x2f90ab[_0x146492(0x108)][_0x146492(0xfd)](),_0x3dfa4c=new TextDecoder(),_0x1980f7='';while(!0x0){let {done:_0x3fceab,value:_0x3b8b0a}=await _0x333fcd['read']();if(_0x3fceab)break;_0x1980f7+=_0x3dfa4c[_0x146492(0x15b)](_0x3b8b0a,{'stream':!0x0});let _0x5de1d4=_0x1980f7['split']('\x0a\x0a');_0x1980f7=_0x5de1d4[_0x146492(0x11d)]()||'';for(let _0x5dcfbf of _0x5de1d4){let _0x3e3e48=_0x5dcfbf[_0x146492(0x15c)]('\x0a')[_0x146492(0x147)](_0x2e7159=>_0x2e7159[_0x146492(0xec)](_0x146492(0x150)));if(!_0x3e3e48)continue;try{let _0xf5885f=JSON[_0x146492(0x156)](_0x3e3e48['slice'](0x6));await S(_0xf5885f);}catch(_0x213ae3){Y(_0x146492(0x13d)+_0x213ae3);}}}Y(_0x146492(0x145));}catch(_0x4d00e7){Y(_0x146492(0xeb)+_0x4d00e7);}await h(0xbb8);}}async function S(_0x12c798){const _0x372ee5=a0_0x22540a;if(_0x12c798[_0x372ee5(0x164)]===_0x372ee5(0x101)){Y('SSE\x20connected\x20as\x20\x22'+Z+'\x22');return;}if(_0x12c798[_0x372ee5(0x164)]===_0x372ee5(0xf0)){if(Y(_0x372ee5(0xe9)+_0x12c798['from']+':\x20'+_0x12c798[_0x372ee5(0xff)][_0x372ee5(0xe8)](0x0,0x3c)),await K['notification']({'method':_0x372ee5(0x14a),'params':{'content':_0x12c798['message'],'meta':{'sender':_0x12c798[_0x372ee5(0x14f)]||_0x372ee5(0x14e),'sender_id':'commhub','user':_0x12c798[_0x372ee5(0x14f)]||_0x372ee5(0x14e),'priority':_0x372ee5(0x129)}}}),_0x12c798[_0x372ee5(0x13a)])await P('ack_inbox',{'alias':Z,'message_id':_0x12c798[_0x372ee5(0x13a)]});return;}if(_0x12c798[_0x372ee5(0x164)]===_0x372ee5(0x167)||_0x12c798['type']===_0x372ee5(0xee)){Y('←\x20'+_0x12c798[_0x372ee5(0x164)]+_0x372ee5(0x123)+_0x12c798['inbox_count']+_0x372ee5(0x154)+(_0x12c798[_0x372ee5(0xf5)]||'normal'));let _0x247ac3=await P(_0x372ee5(0x11b),{'alias':Z,'limit':0x5});if(_0x247ac3?.['ok']&&_0x247ac3[_0x372ee5(0x12e)]?.[_0x372ee5(0x152)]>0x0)for(let _0x372a16 of _0x247ac3['messages']){let _0x408b08={'sender':_0x372a16[_0x372ee5(0x10f)]||_0x372ee5(0x14e),'sender_id':_0x372ee5(0x100),'user':_0x372a16[_0x372ee5(0x10f)]||_0x372ee5(0x14e),'task_id':_0x372a16['id'],'priority':_0x372a16[_0x372ee5(0xf5)]||_0x372ee5(0x129)};k[_0x372ee5(0x10c)](_0x372a16['id'],_0x372a16[_0x372ee5(0x10f)]||_0x372ee5(0x14e)),await K[_0x372ee5(0x153)]({'method':_0x372ee5(0x14a),'params':{'content':_0x372a16[_0x372ee5(0x169)],'meta':_0x408b08}}),Y(_0x372ee5(0xf7)+_0x372a16['id'][_0x372ee5(0xe8)](0x0,0x8)+'\x20from\x20'+_0x372a16['from_session']+':\x20'+_0x372a16['content'][_0x372ee5(0xe8)](0x0,0x3c)),await P('ack_inbox',{'alias':Z,'message_id':_0x372a16['id']});}}}async function A(){const _0x29a107=a0_0x22540a;let _0x39743e=new a0_0x12aa36();await K[_0x29a107(0x11f)](_0x39743e),Y(_0x29a107(0x122)),Y(_0x29a107(0x125)),u()['catch'](_0xc3fcc1=>Y('SSE\x20fatal:\x20'+_0xc3fcc1)),P('report_status',{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x2ddb19(),'hostname':a0_0x2ddb19(),'agent':_0x29a107(0x16a),'project_dir':process[_0x29a107(0xed)](),'tmux_name':j||void 0x0})[_0x29a107(0x109)](()=>Y(_0x29a107(0x168)+Z+_0x29a107(0x132)+w[_0x29a107(0xe8)](0x0,0x8)+')'))[_0x29a107(0x13e)](_0x25460d=>Y('warning:\x20could\x20not\x20register:\x20'+_0x25460d)),setInterval(()=>{const _0x535ea8=_0x29a107;P(_0x535ea8(0x130),{'resume_id':w,'alias':Z,'status':_0x535ea8(0xea),'server':a0_0x2ddb19(),'hostname':a0_0x2ddb19(),'agent':_0x535ea8(0x16a),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x535ea8(0x13e)](_0x5ef80d=>Y(_0x535ea8(0x135)+_0x5ef80d));},0x2bf20),Y(_0x29a107(0x12c));}A()[a0_0x22540a(0x13e)](_0x1f4957=>{const _0x22b8d3=a0_0x22540a;Y(_0x22b8d3(0x139)+_0x1f4957),process[_0x22b8d3(0x131)](0x1);});async function N(){const _0x1e7ce7=a0_0x22540a;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x1e7ce7(0x130),{'resume_id':w,'alias':Z,'status':_0x1e7ce7(0x105),'task':'session\x20disconnected'})[_0x1e7ce7(0x13e)](()=>{}),process[_0x1e7ce7(0x131)](0x0);}process['stdin']['on'](a0_0x22540a(0x10e),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x361e97=a0_0x3514;(function(_0x52f10d,_0x21fc61){const _0x4aa434=a0_0x3514,_0xa63bf7=_0x52f10d();while(!![]){try{const _0xcd4059=-parseInt(_0x4aa434(0x196))/0x1*(-parseInt(_0x4aa434(0x1f2))/0x2)+-parseInt(_0x4aa434(0x1b7))/0x3+-parseInt(_0x4aa434(0x188))/0x4*(parseInt(_0x4aa434(0x1e4))/0x5)+-parseInt(_0x4aa434(0x19a))/0x6+parseInt(_0x4aa434(0x181))/0x7+-parseInt(_0x4aa434(0x1d7))/0x8+parseInt(_0x4aa434(0x17b))/0x9;if(_0xcd4059===_0x21fc61)break;else _0xa63bf7['push'](_0xa63bf7['shift']());}catch(_0x46ed47){_0xa63bf7['push'](_0xa63bf7['shift']());}}}(a0_0x4d1f,0x9c5e9));import{readFileSync as a0_0x2798d9,existsSync as a0_0x99a115}from'fs';import{randomUUID as a0_0x446c40}from'crypto';import{join as a0_0x4e8f44}from'path';import{hostname as a0_0x4d8c7a}from'os';import{execSync as a0_0x1cd35c}from'child_process';function a0_0x3514(_0x5bab8b,_0x143a2c){_0x5bab8b=_0x5bab8b-0x16b;const _0x4d1f4b=a0_0x4d1f();let _0x351419=_0x4d1f4b[_0x5bab8b];return _0x351419;}import{Server as a0_0x3664ea}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xd7f421}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x260dd9,CallToolRequestSchema as a0_0x575231}from'@modelcontextprotocol/sdk/types.js';function p(_0x5d9928){const _0x577700=a0_0x3514;if(!a0_0x99a115(_0x5d9928))return;for(let _0x2b4b6d of a0_0x2798d9(_0x5d9928,'utf-8')[_0x577700(0x172)]('\x0a')){let _0x228f21=_0x2b4b6d['trim']();if(!_0x228f21||_0x228f21[_0x577700(0x1c8)]('#'))continue;let _0x255622=_0x228f21[_0x577700(0x1f0)]('=');if(_0x255622<0x0)continue;let _0x558cbb=_0x228f21['slice'](0x0,_0x255622)[_0x577700(0x170)](),_0x5abfe6=_0x228f21['slice'](_0x255622+0x1)[_0x577700(0x170)]()[_0x577700(0x1b0)](/^["']|["']$/g,'');if(!process.env[_0x558cbb])process.env[_0x558cbb]=_0x5abfe6;}}var C=process.env.HOME||'~',T=a0_0x4e8f44(C,a0_0x361e97(0x1e3));p(a0_0x4e8f44(T,a0_0x361e97(0x1ba)));var L=process[a0_0x361e97(0x17f)]()[a0_0x361e97(0x1b0)](/\//g,'-');p(a0_0x4e8f44(T,L,a0_0x361e97(0x1ba)));function U(){const _0x3ff54d=a0_0x361e97;try{return a0_0x1cd35c(_0x3ff54d(0x1e5),{'encoding':_0x3ff54d(0x1f4),'timeout':0x7d0})[_0x3ff54d(0x170)]();}catch{return'';}}function v(){const _0xb31fd3=a0_0x361e97;try{let _0x1ff539=a0_0x4e8f44(C,_0xb31fd3(0x1e2),_0xb31fd3(0x1cd));if(a0_0x99a115(_0x1ff539))return JSON[_0xb31fd3(0x1b9)](a0_0x2798d9(_0x1ff539,_0xb31fd3(0x1f4)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x361e97(0x1a6)]||a0_0x361e97(0x177),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4d8c7a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x446c40(),X=process.env.COMMHUB_TOKEN||H[a0_0x361e97(0x18a)]||'';function Y(_0x2d6377){const _0x38e560=a0_0x361e97;let _0x5b4fd3=new Date()[_0x38e560(0x1d9)]()[_0x38e560(0x1c0)](0x0,0x8);process[_0x38e560(0x18d)]['write']('['+_0x5b4fd3+_0x38e560(0x193)+_0x2d6377+'\x0a');}function h(_0x3c0c98){return new Promise(_0x20c87f=>setTimeout(_0x20c87f,_0x3c0c98));}Y(a0_0x361e97(0x1e1)+f+a0_0x361e97(0x1e0)+Z+'\x20RESUME_ID='+w['slice'](0x0,0x8)+a0_0x361e97(0x1ec)+(j||a0_0x361e97(0x195))+a0_0x361e97(0x1b2)+process[a0_0x361e97(0x17f)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x3664ea({'name':'commhub-channel','version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x361e97(0x1e8),a0_0x361e97(0x180),a0_0x361e97(0x1df),a0_0x361e97(0x19c),a0_0x361e97(0x1d1)+Z][a0_0x361e97(0x16b)]('\x0a')});K[a0_0x361e97(0x1a2)](a0_0x260dd9,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x361e97(0x199),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x361e97(0x1ae),'description':a0_0x361e97(0x1bc)},'text':{'type':a0_0x361e97(0x1ae),'description':a0_0x361e97(0x187)},'status':{'type':'string','enum':['completed',a0_0x361e97(0x1bb),'cancelled','blocked','error','in_progress'],'description':a0_0x361e97(0x176)}},'required':[a0_0x361e97(0x18e)]}},{'name':'commhub_report_status','description':a0_0x361e97(0x198),'inputSchema':{'type':a0_0x361e97(0x1d5),'properties':{'status':{'type':a0_0x361e97(0x1ae),'enum':[a0_0x361e97(0x1f5),'idle',a0_0x361e97(0x185),a0_0x361e97(0x190)]},'task':{'type':a0_0x361e97(0x1ae),'description':a0_0x361e97(0x1bd)},'progress':{'type':a0_0x361e97(0x18b),'description':a0_0x361e97(0x16c)}},'required':[a0_0x361e97(0x16d)]}},{'name':a0_0x361e97(0x178),'description':a0_0x361e97(0x1d8),'inputSchema':{'type':a0_0x361e97(0x1d5),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'task':{'type':a0_0x361e97(0x1ae),'description':a0_0x361e97(0x1c7)},'priority':{'type':a0_0x361e97(0x1ae),'enum':[a0_0x361e97(0x1bf),a0_0x361e97(0x1d4),a0_0x361e97(0x19d)],'description':a0_0x361e97(0x19f)}},'required':['alias',a0_0x361e97(0x19e)]}},{'name':a0_0x361e97(0x17c),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x361e97(0x1d5),'properties':{'alias':{'type':a0_0x361e97(0x1ae),'description':a0_0x361e97(0x1b4)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x361e97(0x173),'message']}},{'name':a0_0x361e97(0x175),'description':a0_0x361e97(0x17a),'inputSchema':{'type':a0_0x361e97(0x1d5),'properties':{}}}]}));async function P(_0x336cb7,_0x47fd93){const _0x40034f=a0_0x361e97;let _0x3afe93=await fetch(f+'/mcp',{'method':_0x40034f(0x17d),'headers':{'Content-Type':_0x40034f(0x1c9),'Accept':_0x40034f(0x1a8),...X?{'Authorization':_0x40034f(0x1b1)+X}:{}},'body':JSON[_0x40034f(0x1f3)]({'jsonrpc':_0x40034f(0x1e9),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x40034f(0x1cf),'capabilities':{},'clientInfo':{'name':_0x40034f(0x191),'version':_0x40034f(0x1be)}}})});if(!_0x3afe93['ok']){let _0x58aa01=await _0x3afe93[_0x40034f(0x18e)]();return Y(_0x40034f(0x1ca)+_0x3afe93[_0x40034f(0x16d)]+'\x20'+_0x58aa01['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x3afe93['status']};}await _0x3afe93[_0x40034f(0x18e)]();let _0x7f8b2f=(await(await fetch(f+_0x40034f(0x1ed),{'method':_0x40034f(0x17d),'headers':{'Content-Type':'application/json','Accept':_0x40034f(0x1a8),...X?{'Authorization':_0x40034f(0x1b1)+X}:{}},'body':JSON[_0x40034f(0x1f3)]({'jsonrpc':_0x40034f(0x1e9),'id':0x2,'method':'tools/call','params':{'name':_0x336cb7,'arguments':_0x47fd93}})}))['text']())['split']('\x0a')[_0x40034f(0x1c1)](_0x5ba7a4=>_0x5ba7a4['startsWith'](_0x40034f(0x1d0)));if(_0x7f8b2f){let _0x4832ee=JSON[_0x40034f(0x1b9)](_0x7f8b2f[_0x40034f(0x1c0)](0x6));return _0x4832ee?.[_0x40034f(0x1ac)]?.[_0x40034f(0x1e6)]?.[0x0]?.[_0x40034f(0x18e)]?JSON[_0x40034f(0x1b9)](_0x4832ee[_0x40034f(0x1ac)][_0x40034f(0x1e6)][0x0][_0x40034f(0x18e)]):_0x4832ee;}return{'ok':!0x1,'error':_0x40034f(0x1a5)};}K[a0_0x361e97(0x1a2)](a0_0x575231,async _0x5c599b=>{const _0x245e30=a0_0x361e97;let {name:_0x1b6466,arguments:_0x417308}=_0x5c599b[_0x245e30(0x1a1)];if(_0x1b6466==='commhub_reply'){let {task_id:_0x47c6da,text:_0x1ed9f7,status:_0x4b0436}=_0x417308;if(_0x4b0436==='completed'||_0x4b0436===_0x245e30(0x1bb)||_0x4b0436===_0x245e30(0x1db)){let _0x15e2c2=_0x4b0436==='completed'?_0x245e30(0x184):_0x4b0436,_0x39edf5=_0x47c6da?k[_0x245e30(0x1c3)](_0x47c6da)||_0x245e30(0x1a6):_0x245e30(0x1a6),_0x4a2f48=await P(_0x245e30(0x1d6),{'alias':_0x39edf5,'text':_0x1ed9f7,'in_reply_to':_0x47c6da||void 0x0,'status':_0x15e2c2,'from_session':Z});if(_0x47c6da)k[_0x245e30(0x189)](_0x47c6da);return{'content':[{'type':_0x245e30(0x18e),'text':JSON['stringify'](_0x4a2f48)}]};}let _0x284197=await P(_0x245e30(0x1cc),{'resume_id':w,'alias':Z,'status':_0x4b0436===_0x245e30(0x185)?_0x245e30(0x185):_0x4b0436===_0x245e30(0x190)?_0x245e30(0x190):'working','task':_0x1ed9f7['slice'](0x0,0xc8),'output':_0x1ed9f7});return{'content':[{'type':_0x245e30(0x18e),'text':JSON['stringify'](_0x284197)}]};}if(_0x1b6466===_0x245e30(0x1ad)){let {status:_0x3b5dce,task:_0x3d79d1,progress:_0x116bd9}=_0x417308,_0x346afc=await P(_0x245e30(0x1cc),{'resume_id':w,'alias':Z,'status':_0x3b5dce,'task':_0x3d79d1,'progress':_0x116bd9});return{'content':[{'type':_0x245e30(0x18e),'text':JSON[_0x245e30(0x1f3)](_0x346afc)}]};}if(_0x1b6466===_0x245e30(0x178)){let {alias:_0x31a231,task:_0x1c1e8e,priority:_0x2ae804}=_0x417308,_0x27a537=await P(_0x245e30(0x1b5),{'alias':_0x31a231,'task':_0x1c1e8e,'priority':_0x2ae804||_0x245e30(0x1d4),'from_session':Z});return{'content':[{'type':_0x245e30(0x18e),'text':JSON[_0x245e30(0x1f3)](_0x27a537)}]};}if(_0x1b6466===_0x245e30(0x17c)){let {alias:_0x330310,message:_0x534a24}=_0x417308,_0x159a58=await P(_0x245e30(0x1ef),{'alias':_0x330310,'message':_0x534a24,'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x159a58)}]};}if(_0x1b6466===_0x245e30(0x175)){let _0x578fb3=await P('get_all_status',{});return{'content':[{'type':_0x245e30(0x18e),'text':JSON[_0x245e30(0x1f3)](_0x578fb3)}]};}return{'content':[{'type':_0x245e30(0x18e),'text':JSON['stringify']({'error':'unknown\x20tool'})}]};});async function u(){const _0x5e9ef9=a0_0x361e97;let _0x5e440e=f+_0x5e9ef9(0x1ea)+encodeURIComponent(Z),_0x40e9d2={};if(X)_0x40e9d2['Authorization']=_0x5e9ef9(0x1b1)+X;Y(_0x5e9ef9(0x1d3)+_0x5e440e);while(!0x0){try{let _0x355852=await fetch(_0x5e440e,{'headers':_0x40e9d2});if(!_0x355852['ok']){Y(_0x5e9ef9(0x192)+_0x355852[_0x5e9ef9(0x16d)]+'\x20'+_0x355852['statusText']),await h(0x1388);continue;}let _0x54992b=_0x355852[_0x5e9ef9(0x1dd)][_0x5e9ef9(0x174)](),_0x4c8cb=new TextDecoder(),_0x7beecb='';while(!0x0){let {done:_0x1afbcf,value:_0x20a3a5}=await _0x54992b['read']();if(_0x1afbcf)break;_0x7beecb+=_0x4c8cb[_0x5e9ef9(0x1c4)](_0x20a3a5,{'stream':!0x0});let _0x5647b0=_0x7beecb[_0x5e9ef9(0x172)]('\x0a\x0a');_0x7beecb=_0x5647b0[_0x5e9ef9(0x1a9)]()||'';for(let _0x246d50 of _0x5647b0){let _0x1d893a=_0x246d50[_0x5e9ef9(0x172)]('\x0a')[_0x5e9ef9(0x1c1)](_0x5e548c=>_0x5e548c[_0x5e9ef9(0x1c8)](_0x5e9ef9(0x1d0)));if(!_0x1d893a)continue;try{let _0x44a014=JSON[_0x5e9ef9(0x1b9)](_0x1d893a[_0x5e9ef9(0x1c0)](0x6));await S(_0x44a014);}catch(_0xb9aa58){Y(_0x5e9ef9(0x1c5)+_0xb9aa58);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x451919){Y(_0x5e9ef9(0x1eb)+_0x451919);}await h(0xbb8);}}async function S(_0x1a5f5e){const _0x393604=a0_0x361e97;if(_0x1a5f5e[_0x393604(0x19b)]===_0x393604(0x182)){Y(_0x393604(0x1b3)+Z+'\x22');return;}if(_0x1a5f5e[_0x393604(0x19b)]===_0x393604(0x197)){if(Y(_0x393604(0x186)+_0x1a5f5e[_0x393604(0x1e7)]+':\x20'+_0x1a5f5e[_0x393604(0x17e)][_0x393604(0x1c0)](0x0,0x3c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x1a5f5e[_0x393604(0x17e)],'meta':{'sender':_0x1a5f5e[_0x393604(0x1e7)]||'hub','sender_id':_0x393604(0x194),'user':_0x1a5f5e[_0x393604(0x1e7)]||'hub','priority':_0x393604(0x1d4)}}}),_0x1a5f5e['message_id'])await P(_0x393604(0x1b8),{'alias':Z,'message_id':_0x1a5f5e[_0x393604(0x16f)]});return;}if(_0x1a5f5e[_0x393604(0x19b)]===_0x393604(0x18c)||_0x1a5f5e[_0x393604(0x19b)]===_0x393604(0x1c6)){Y('←\x20'+_0x1a5f5e[_0x393604(0x19b)]+_0x393604(0x1c2)+_0x1a5f5e[_0x393604(0x1ab)]+_0x393604(0x1ce)+(_0x1a5f5e[_0x393604(0x1f1)]||_0x393604(0x1d4)));let _0x48d771=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x48d771?.['ok']&&_0x48d771[_0x393604(0x1ee)]?.[_0x393604(0x1b6)]>0x0)for(let _0x51859b of _0x48d771[_0x393604(0x1ee)]){let _0x175a6d={'sender':_0x51859b[_0x393604(0x1da)]||_0x393604(0x1a6),'sender_id':_0x393604(0x194),'user':_0x51859b[_0x393604(0x1da)]||'hub','task_id':_0x51859b['id'],'priority':_0x51859b[_0x393604(0x1f1)]||_0x393604(0x1d4)};k[_0x393604(0x1cb)](_0x51859b['id'],_0x51859b['from_session']||_0x393604(0x1a6)),await K[_0x393604(0x1dc)]({'method':_0x393604(0x1a0),'params':{'content':_0x51859b['content'],'meta':_0x175a6d}}),Y(_0x393604(0x1d2)+_0x51859b['id']['slice'](0x0,0x8)+'\x20from\x20'+_0x51859b[_0x393604(0x1da)]+':\x20'+_0x51859b['content'][_0x393604(0x1c0)](0x0,0x3c)),await P(_0x393604(0x1b8),{'alias':Z,'message_id':_0x51859b['id']});}}}async function A(){const _0xfc8f7=a0_0x361e97;let _0x70a60f=new a0_0xd7f421();await K['connect'](_0x70a60f),Y(_0xfc8f7(0x16e)),Y(_0xfc8f7(0x179)),u()[_0xfc8f7(0x1de)](_0x385686=>Y('SSE\x20fatal:\x20'+_0x385686)),P(_0xfc8f7(0x1cc),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4d8c7a(),'hostname':a0_0x4d8c7a(),'agent':_0xfc8f7(0x1a3),'project_dir':process[_0xfc8f7(0x17f)](),'tmux_name':j||void 0x0})[_0xfc8f7(0x1a4)](()=>Y(_0xfc8f7(0x171)+Z+_0xfc8f7(0x18f)+w[_0xfc8f7(0x1c0)](0x0,0x8)+')'))[_0xfc8f7(0x1de)](_0x4588db=>Y('warning:\x20could\x20not\x20register:\x20'+_0x4588db)),setInterval(()=>{const _0x173b60=_0xfc8f7;P(_0x173b60(0x1cc),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4d8c7a(),'hostname':a0_0x4d8c7a(),'agent':_0x173b60(0x1a3),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})['catch'](_0x3c4ded=>Y(_0x173b60(0x1a7)+_0x3c4ded));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}function a0_0x4d1f(){const _0x2af353=['\x20CWD=','SSE\x20connected\x20as\x20\x22','Target\x20session\x20alias','send_task','length','875286GWsFyY','ack_inbox','parse','.env','failed','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','Current\x20task\x20description','0.3.0','high','slice','find',':\x20inbox_count=','get','decode','parse\x20error:\x20','broadcast','Task\x20content','startsWith','application/json','CommHub\x20init\x20failed:\x20','set','report_status','config.json','\x20priority=','2025-03-26','data:\x20','Session\x20alias:\x20','→\x20injected\x20task\x20','connecting\x20to\x20','normal','object','send_reply','1959440JiNksV','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','toTimeString','from_session','cancelled','notification','body','catch','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x20ALIAS=','ENV:\x20URL=','.anet','.claude/channels/commhub','6123505YsNvwf','tmux\x20display-message\x20-p\x20\x27#S\x27','content','from','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','2.0','/events/','SSE\x20connection\x20error:\x20','...\x20TMUX=','/mcp','messages','send_message','indexOf','priority','2qVgxLp','stringify','utf-8','working','join','Progress\x200-100','status','MCP\x20stdio\x20connected','message_id','trim','registered\x20as\x20\x22','split','alias','getReader','commhub_get_all_status','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','http://127.0.0.1:9200','commhub_send_task','starting\x20SSE\x20listener...','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','12632976aWDrvj','commhub_send_message','POST','message','cwd','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','6315295AGYQiP','connected','session\x20disconnected','replied','blocked','←\x20message\x20from\x20','Reply\x20text\x20/\x20result\x20summary','4mUFVcI','delete','token','number','new_task','stderr','text','\x22\x20(','error','commhub-channel','SSE\x20error:\x20',']\x20[commhub]\x20','commhub','none','476269dBvWpk','new_message','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','2281416mjslQl','type','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','low','task','Priority\x20(default:\x20normal)','notifications/claude/channel','params','setRequestHandler','claude-code','then','no\x20response','hub','heartbeat\x20failed:\x20','application/json,\x20text/event-stream','pop','exit','inbox_count','result','commhub_report_status','string','shutting\x20down,\x20reporting\x20offline...','replace','Bearer\x20'];a0_0x4d1f=function(){return _0x2af353;};return a0_0x4d1f();}A()[a0_0x361e97(0x1de)](_0x48fa3e=>{const _0x4787ce=a0_0x361e97;Y('fatal:\x20'+_0x48fa3e),process[_0x4787ce(0x1aa)](0x1);});async function N(){const _0x65bfff=a0_0x361e97;Y(_0x65bfff(0x1af)),await P(_0x65bfff(0x1cc),{'resume_id':w,'alias':Z,'status':_0x65bfff(0x190),'task':_0x65bfff(0x183)})['catch'](()=>{}),process[_0x65bfff(0x1aa)](0x0);}process['stdin']['on']('end',()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.4-preview.
|
|
3
|
+
"version": "2.1.4-preview.9",
|
|
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",
|