@sleep2agi/agent-network 2.0.0-preview.24 → 2.0.0-preview.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x2102b0=a0_0x2a2e;(function(_0x177dcb,_0x24e9dd){const _0x529566=a0_0x2a2e,_0x1a8b77=_0x177dcb();while(!![]){try{const _0x5ea71b=parseInt(_0x529566(0xa0))/0x1+-parseInt(_0x529566(0xe9))/0x2*(parseInt(_0x529566(0xa3))/0x3)+parseInt(_0x529566(0xa6))/0x4*(parseInt(_0x529566(0xe1))/0x5)+-parseInt(_0x529566(0xe0))/0x6*(-parseInt(_0x529566(0xf3))/0x7)+parseInt(_0x529566(0xd1))/0x8*(parseInt(_0x529566(0xe6))/0x9)+parseInt(_0x529566(0xd5))/0xa*(parseInt(_0x529566(0xdc))/0xb)+-parseInt(_0x529566(0xa7))/0xc;if(_0x5ea71b===_0x24e9dd)break;else _0x1a8b77['push'](_0x1a8b77['shift']());}catch(_0x3fd5c8){_0x1a8b77['push'](_0x1a8b77['shift']());}}}(a0_0x7602,0xed22c));import{EventEmitter as a0_0x4bb4cd}from'events';function a0_0x2a2e(_0xe66631,_0x30f55a){_0xe66631=_0xe66631-0x9f;const _0x7602f8=a0_0x7602();let _0x2a2e47=_0x7602f8[_0xe66631];return _0x2a2e47;}import{hostname as a0_0x2b4ca5}from'os';class T extends a0_0x4bb4cd{[a0_0x2102b0(0xe8)];[a0_0x2102b0(0xa1)];[a0_0x2102b0(0xba)];['agent'];[a0_0x2102b0(0xb8)];[a0_0x2102b0(0xaa)];[a0_0x2102b0(0xc5)];[a0_0x2102b0(0xb1)];[a0_0x2102b0(0xec)];['running']=!0x1;constructor(_0x52b74f){const _0xce8712=a0_0x2102b0;super();if(this[_0xce8712(0xe8)]=_0x52b74f[_0xce8712(0xe8)][_0xce8712(0xf5)](/\/$/,''),this[_0xce8712(0xa1)]=_0x52b74f[_0xce8712(0xa1)],this['token']=_0x52b74f['token'],this[_0xce8712(0xb4)]=_0x52b74f['agent']||_0xce8712(0xe3),this['resumeId']='sdk-'+_0x52b74f['alias']+'-'+Date[_0xce8712(0xbd)]()['toString'](0x24),this[_0xce8712(0xaa)]=_0x52b74f['heartbeatInterval']??0x2bf20,this[_0xce8712(0xc5)]=_0x52b74f[_0xce8712(0xc5)]??0xbb8,_0x52b74f[_0xce8712(0xc4)]!==!0x1)this[_0xce8712(0xf4)]();}['log'](_0x99040){const _0x38dcc0=a0_0x2102b0;console[_0x38dcc0(0xb0)]('['+new Date()[_0x38dcc0(0xc1)]()[_0x38dcc0(0xca)](0x0,0x8)+_0x38dcc0(0xdf)+this['alias']+']\x20'+_0x99040);}async[a0_0x2102b0(0xc6)](_0x4c8a4f,_0x235602){const _0x519573=a0_0x2102b0;let _0x45f3fa={'Content-Type':_0x519573(0xd0),'Accept':_0x519573(0xa9)};if(this[_0x519573(0xba)])_0x45f3fa[_0x519573(0xb5)]=_0x519573(0xde)+this[_0x519573(0xba)];let _0x3c7a7b=await(await fetch(this[_0x519573(0xe8)]+_0x519573(0xea),{'method':_0x519573(0xcc),'headers':_0x45f3fa,'body':JSON[_0x519573(0xa5)]({'jsonrpc':_0x519573(0xd8),'id':Date['now'](),'method':_0x519573(0xa4),'params':{'name':_0x4c8a4f,'arguments':_0x235602}})}))['text'](),_0x5d55cf=_0x3c7a7b[_0x519573(0xed)](/data: (.+)/),_0xa71a5d=_0x5d55cf?JSON[_0x519573(0xf8)](_0x5d55cf[0x1]):JSON[_0x519573(0xf8)](_0x3c7a7b),_0x2757e9=_0xa71a5d?.['result']?.[_0x519573(0xbb)]?.[0x0]?.[_0x519573(0xb9)];return _0x2757e9?JSON[_0x519573(0xf8)](_0x2757e9):_0xa71a5d;}async[a0_0x2102b0(0xf4)](){const _0x10405c=a0_0x2102b0;if(this[_0x10405c(0xee)])return;this[_0x10405c(0xee)]=!0x0,await this[_0x10405c(0xb3)]('idle'),this[_0x10405c(0xb0)](_0x10405c(0xac)),this[_0x10405c(0xb1)]=setInterval(()=>{const _0x1af245=_0x10405c;this[_0x1af245(0xb3)](_0x1af245(0xf0))[_0x1af245(0xbe)](_0x2aae01=>this[_0x1af245(0xb0)](_0x1af245(0xd4)+_0x2aae01[_0x1af245(0xb6)]));},this['heartbeatInterval']),this[_0x10405c(0xd3)]();}async[a0_0x2102b0(0xe2)](){const _0x38e15e=a0_0x2102b0;if(this[_0x38e15e(0xee)]=!0x1,this['sseAbort']?.[_0x38e15e(0xbc)](),this[_0x38e15e(0xb1)])clearInterval(this['heartbeatTimer']);await this[_0x38e15e(0xb3)](_0x38e15e(0xeb))[_0x38e15e(0xbe)](()=>{}),this['log'](_0x38e15e(0xef));}async[a0_0x2102b0(0xf6)](_0x4b9b21,_0x19eca3,_0x1f06a2='normal'){const _0x494207=a0_0x2102b0;return this[_0x494207(0xc6)](_0x494207(0xa8),{'alias':_0x4b9b21,'task':_0x19eca3,'priority':_0x1f06a2,'from_session':this[_0x494207(0xa1)]});}async[a0_0x2102b0(0xb6)](_0x41da49,_0x37d9cc){const _0xad2796=a0_0x2102b0;return this[_0xad2796(0xc6)](_0xad2796(0xce),{'alias':_0x41da49,'message':_0x37d9cc,'from_session':this['alias']});}async[a0_0x2102b0(0xc7)](_0x2f79df,_0x2009ed,_0x11fe05=a0_0x2102b0(0xc2)){const _0x493d8e=a0_0x2102b0;return this['call'](_0x493d8e(0xc7),{'task_id':_0x2f79df,'text':_0x2009ed,'status':_0x11fe05});}async[a0_0x2102b0(0xb3)](_0x306f73,_0x4da296){const _0x7fd085=a0_0x2102b0;return this['call']('report_status',{'resume_id':this[_0x7fd085(0xb8)],'alias':this[_0x7fd085(0xa1)],'status':_0x306f73,'server':a0_0x2b4ca5(),'hostname':a0_0x2b4ca5(),'agent':this[_0x7fd085(0xb4)],'project_dir':process[_0x7fd085(0xc3)](),..._0x4da296});}async['getAllStatus'](){const _0x32cfd3=a0_0x2102b0;return this[_0x32cfd3(0xc6)](_0x32cfd3(0xd7),{});}async['broadcast'](_0x4b94e0,_0x3dba05){const _0x154c2b=a0_0x2102b0;return this['call'](_0x154c2b(0xc0),{'message':_0x4b94e0,'filter_server':_0x3dba05?.[_0x154c2b(0xaf)],'filter_status':_0x3dba05?.[_0x154c2b(0xb3)]});}async[a0_0x2102b0(0xd3)](){const _0x3deccd=a0_0x2102b0;let _0x584572=encodeURIComponent(this[_0x3deccd(0xa1)]),_0xb64f24=this[_0x3deccd(0xe8)]+'/events/'+_0x584572,_0xe7797d=this['reconnectDelay'];while(this[_0x3deccd(0xee)]){try{this[_0x3deccd(0xec)]=new AbortController();let _0x4dd804={'Accept':_0x3deccd(0xab)};if(this[_0x3deccd(0xba)])_0x4dd804[_0x3deccd(0xb5)]=_0x3deccd(0xde)+this['token'];let _0x1ddaa2=await fetch(_0xb64f24,{'headers':_0x4dd804,'signal':this['sseAbort'][_0x3deccd(0xcb)]});if(!_0x1ddaa2['ok']||!_0x1ddaa2['body']){this[_0x3deccd(0xb0)](_0x3deccd(0xe4)+_0x1ddaa2[_0x3deccd(0xb3)]),await this['sleep'](_0xe7797d),_0xe7797d=Math['min'](_0xe7797d*1.5,0xea60);continue;}_0xe7797d=this[_0x3deccd(0xc5)];let _0x29e099=_0x1ddaa2['body']['getReader'](),_0x125d8d=new TextDecoder(),_0x202db9='';while(this[_0x3deccd(0xee)]){let {done:_0x5e6dfd,value:_0x2b059e}=await _0x29e099[_0x3deccd(0x9f)]();if(_0x5e6dfd)break;_0x202db9+=_0x125d8d[_0x3deccd(0xd9)](_0x2b059e,{'stream':!0x0});let _0x4e08df=_0x202db9[_0x3deccd(0xe5)]('\x0a');_0x202db9=_0x4e08df[_0x3deccd(0xcf)]()||'';for(let _0x3fcc22 of _0x4e08df){if(!_0x3fcc22[_0x3deccd(0xcd)](_0x3deccd(0xd2)))continue;try{let _0x2c352f=JSON[_0x3deccd(0xf8)](_0x3fcc22[_0x3deccd(0xca)](0x6));if(_0x2c352f[_0x3deccd(0xda)]===_0x3deccd(0xf2)){this[_0x3deccd(0xb0)](_0x3deccd(0xc9)),this[_0x3deccd(0xb7)](_0x3deccd(0xf2));continue;}if(_0x2c352f[_0x3deccd(0xda)]===_0x3deccd(0xf7)||_0x2c352f['type']==='new_message'||_0x2c352f['type']===_0x3deccd(0xc0))await this[_0x3deccd(0xae)]();}catch{}}}}catch(_0x61f823){if(_0x61f823[_0x3deccd(0xb2)]===_0x3deccd(0xdb))break;this[_0x3deccd(0xb7)](_0x3deccd(0xd6),_0x61f823),this['log']('SSE\x20error:\x20'+_0x61f823[_0x3deccd(0xb6)]);}if(this[_0x3deccd(0xee)])this['emit'](_0x3deccd(0xef)),this[_0x3deccd(0xb0)](_0x3deccd(0xc8)+_0xe7797d/0x3e8+'s...'),await this[_0x3deccd(0xe7)](_0xe7797d),_0xe7797d=Math[_0x3deccd(0xdd)](_0xe7797d*1.5,0xea60);}}async[a0_0x2102b0(0xae)](){const _0x3e96c4=a0_0x2102b0;try{let _0x4d7996=(await this['call']('get_inbox',{'alias':this[_0x3e96c4(0xa1)],'limit':0xa}))?.[_0x3e96c4(0xbf)]||[];for(let _0x3d7b08 of _0x4d7996)await this[_0x3e96c4(0xc6)](_0x3e96c4(0xa2),{'alias':this[_0x3e96c4(0xa1)],'message_id':_0x3d7b08['id']}),this['log']('←\x20'+_0x3d7b08[_0x3e96c4(0xad)]+':\x20'+_0x3d7b08[_0x3e96c4(0xbb)][_0x3e96c4(0xca)](0x0,0x3c)),this[_0x3e96c4(0xb7)]('task',_0x3d7b08),this['emit'](_0x3e96c4(0xb6),_0x3d7b08);}catch(_0x105731){this[_0x3e96c4(0xb0)](_0x3e96c4(0xf1)+_0x105731[_0x3e96c4(0xb6)]);}}['sleep'](_0x4adc7d){return new Promise(_0x48b019=>setTimeout(_0x48b019,_0x4adc7d));}}function a0_0x7602(){const _0x5ae777=['stringify','106936LvmUKU','24483552NaXskA','send_task','application/json,\x20text/event-stream','heartbeatInterval','text/event-stream','registered','from_session','processInbox','server','log','heartbeatTimer','name','status','agent','Authorization','message','emit','resumeId','text','token','content','abort','now','catch','messages','broadcast','toTimeString','completed','cwd','autoConnect','reconnectDelay','call','reply','SSE\x20reconnecting\x20in\x20','SSE\x20connected','slice','signal','POST','startsWith','send_message','pop','application/json','24tRXChY','data:\x20','connectSSE','heartbeat\x20failed:\x20','2490eaOhHe','error','get_all_status','2.0','decode','type','AbortError','9031Qzzeyp','min','Bearer\x20',']\x20[commhub:','4029990akdCyA','45GArLZE','disconnect','sdk','SSE\x20failed:\x20','split','5240583sCGKkC','sleep','url','6lRiATz','/mcp','offline','sseAbort','match','running','disconnected','idle','inbox\x20error:\x20','connected','7PXBYoZ','connect','replace','send','new_task','parse','read','189548xUbgoH','alias','ack_inbox','41505xvjrcI','tools/call'];a0_0x7602=function(){return _0x5ae777;};return a0_0x7602();}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_0x40110b=a0_0x329f;(function(_0x57be90,_0x378ccb){const _0x26bf78=a0_0x329f,_0x41c418=_0x57be90();while(!![]){try{const _0x7a745d=-parseInt(_0x26bf78(0xe0))/0x1+parseInt(_0x26bf78(0xa5))/0x2+parseInt(_0x26bf78(0x8b))/0x3*(parseInt(_0x26bf78(0x105))/0x4)+parseInt(_0x26bf78(0xbd))/0x5*(-parseInt(_0x26bf78(0xad))/0x6)+parseInt(_0x26bf78(0x90))/0x7*(-parseInt(_0x26bf78(0x10d))/0x8)+-parseInt(_0x26bf78(0x100))/0x9+parseInt(_0x26bf78(0xa0))/0xa*(parseInt(_0x26bf78(0xff))/0xb);if(_0x7a745d===_0x378ccb)break;else _0x41c418['push'](_0x41c418['shift']());}catch(_0x1f5485){_0x41c418['push'](_0x41c418['shift']());}}}(a0_0x169f,0xf4110));import{readFileSync as a0_0x138df9,existsSync as a0_0x2730fe}from'fs';import{join as a0_0x25d793}from'path';import{hostname as a0_0x159f86}from'os';import{execSync as a0_0x21d53c}from'child_process';import{Server as a0_0x55a0cd}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x151235}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xd0934e,CallToolRequestSchema as a0_0x3ce375}from'@modelcontextprotocol/sdk/types.js';function p(_0x2b12af){const _0x4085d6=a0_0x329f;if(!a0_0x2730fe(_0x2b12af))return;for(let _0x44dcfd of a0_0x138df9(_0x2b12af,'utf-8')['split']('\x0a')){let _0x5e3e09=_0x44dcfd['trim']();if(!_0x5e3e09||_0x5e3e09[_0x4085d6(0x10c)]('#'))continue;let _0x3c3706=_0x5e3e09[_0x4085d6(0xa4)]('=');if(_0x3c3706<0x0)continue;let _0x115dce=_0x5e3e09['slice'](0x0,_0x3c3706)['trim'](),_0x3acbc9=_0x5e3e09[_0x4085d6(0xa9)](_0x3c3706+0x1)[_0x4085d6(0xca)]()[_0x4085d6(0xa3)](/^["']|["']$/g,'');if(!process.env[_0x115dce])process.env[_0x115dce]=_0x3acbc9;}}var C=process.env.HOME||'~',T=a0_0x25d793(C,'.claude/channels/commhub');p(a0_0x25d793(T,'.env'));var L=process['cwd']()['replace'](/\//g,'-');p(a0_0x25d793(T,L,a0_0x40110b(0xee)));function U(){const _0x441461=a0_0x40110b;try{return a0_0x21d53c(_0x441461(0xf2),{'encoding':'utf-8','timeout':0x7d0})[_0x441461(0xca)]();}catch{return'';}}function c(){const _0x3fa979=a0_0x40110b;try{let _0x303d05=a0_0x25d793(C,'.anet',_0x3fa979(0xba));if(a0_0x2730fe(_0x303d05))return JSON[_0x3fa979(0xb7)](a0_0x138df9(_0x303d05,_0x3fa979(0xfd)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x40110b(0x9c)]||a0_0x40110b(0x116),f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x159f86(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto[a0_0x40110b(0xbe)](),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x3634fa){const _0x1663dd=a0_0x40110b;let _0x11f768=new Date()[_0x1663dd(0x115)]()[_0x1663dd(0xa9)](0x0,0x8);process[_0x1663dd(0xd7)]['write']('['+_0x11f768+_0x1663dd(0x9d)+_0x3634fa+'\x0a');}function h(_0x29ab14){return new Promise(_0x53b572=>setTimeout(_0x53b572,_0x29ab14));}Y(a0_0x40110b(0xfb)+D+'\x20ALIAS='+Z+'\x20RESUME_ID='+w[a0_0x40110b(0xa9)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x40110b(0xdd))+a0_0x40110b(0xeb)+process[a0_0x40110b(0x91)]()+a0_0x40110b(0xea)+L);var k=new Map(),K=new a0_0x55a0cd({'name':a0_0x40110b(0xc0),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x40110b(0x114),a0_0x40110b(0xe3),a0_0x40110b(0xc2),a0_0x40110b(0xe2),a0_0x40110b(0xce)+Z][a0_0x40110b(0xf3)]('\x0a')});function a0_0x169f(){const _0x98a070=['120qpvkKa','split','commhub_send_message','from_session','ack_inbox','28FBPxvj','cwd','new_task','commhub','Progress\x200-100','/events/','normal','set','tools/call','params','commhub_report_status','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','hub',']\x20[commhub]\x20','→\x20injected\x20task\x20','alias','1017890RQeTUc','SSE\x20error:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','replace','indexOf','3874376AfwUOt','session\x20disconnected','object','connecting\x20to\x20','slice','idle','failed','then','6cYzlHh','blocked','stringify','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','error','completed','exit','connect','message','setRequestHandler','parse','application/json','inbox_count','config.json','CommHub\x20init\x20failed:\x20','initialize','1415105sHzpef','randomUUID','send_task','commhub-channel','number','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','high','commhub_get_all_status','connected','POST','←\x20message\x20from\x20','message_id','unknown\x20tool','trim','SIGTERM','report_status','get','Session\x20alias:\x20','string','data:\x20','notification','replied','stdin','claude-code','Bearer\x20','status','stderr','delete','text','fatal:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Task\x20content','none','length','catch','1736362gJUfEg','content','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Target\x20session\x20alias','decode','commhub_reply','parse\x20error:\x20','MCP\x20stdio\x20connected','2025-03-26','\x20PROJECT_ENV=','\x20CWD=','getReader','SSE\x20connected\x20as\x20\x22','.env','\x20priority=','starting\x20SSE\x20listener...','new_message','tmux\x20display-message\x20-p\x20\x27#S\x27','join','from','messages',':\x20inbox_count=','2.0','commhub_send_task','statusText','Reply\x20text\x20/\x20result\x20summary','ENV:\x20URL=','working','utf-8','get_all_status','143OqBARp','5467050zwsMhK','SSE\x20connection\x20error:\x20','application/json,\x20text/event-stream','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','broadcast','116128KVKvKF','shutting\x20down,\x20reporting\x20offline...','pop','Current\x20task\x20description','no\x20response','cancelled','notifications/claude/channel','startsWith','1590392SVoezl','priority','find','read','SIGINT','type','warning:\x20could\x20not\x20register:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','toTimeString','http://127.0.0.1:9200','\x22\x20(','/mcp'];a0_0x169f=function(){return _0x98a070;};return a0_0x169f();}K[a0_0x40110b(0xb6)](a0_0xd0934e,async()=>({'tools':[{'name':a0_0x40110b(0xe6),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'task_id':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xa2)},'text':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xfa)},'status':{'type':a0_0x40110b(0xcf),'enum':[a0_0x40110b(0xb2),a0_0x40110b(0xab),a0_0x40110b(0x10a),a0_0x40110b(0xae),a0_0x40110b(0xb1),'in_progress'],'description':a0_0x40110b(0x103)}},'required':[a0_0x40110b(0xd9)]}},{'name':'commhub_report_status','description':a0_0x40110b(0xdb),'inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'status':{'type':'string','enum':['working',a0_0x40110b(0xaa),a0_0x40110b(0xae),a0_0x40110b(0xb1)]},'task':{'type':'string','description':a0_0x40110b(0x108)},'progress':{'type':a0_0x40110b(0xc1),'description':a0_0x40110b(0x94)}},'required':[a0_0x40110b(0xd6)]}},{'name':'commhub_send_task','description':a0_0x40110b(0xb0),'inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'alias':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xe4)},'task':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xdc)},'priority':{'type':a0_0x40110b(0xcf),'enum':[a0_0x40110b(0xc3),a0_0x40110b(0x96),'low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x40110b(0x9f),'task']}},{'name':a0_0x40110b(0x8d),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x40110b(0xa7),'properties':{'alias':{'type':a0_0x40110b(0xcf),'description':a0_0x40110b(0xe4)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x40110b(0x9f),'message']}},{'name':a0_0x40110b(0xc4),'description':a0_0x40110b(0x9b),'inputSchema':{'type':a0_0x40110b(0xa7),'properties':{}}}]}));async function P(_0x5a0747,_0x5e851c){const _0x1f0efa=a0_0x40110b;let _0x5b56d6=await fetch(D+_0x1f0efa(0x8a),{'method':_0x1f0efa(0xc6),'headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x1f0efa(0xd5)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x1f0efa(0xf7),'id':0x1,'method':_0x1f0efa(0xbc),'params':{'protocolVersion':_0x1f0efa(0xe9),'capabilities':{},'clientInfo':{'name':_0x1f0efa(0xc0),'version':'0.3.0'}}})});if(!_0x5b56d6['ok']){let _0x1e40cd=await _0x5b56d6['text']();return Y(_0x1f0efa(0xbb)+_0x5b56d6[_0x1f0efa(0xd6)]+'\x20'+_0x1e40cd[_0x1f0efa(0xa9)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x5b56d6[_0x1f0efa(0xd6)]};}await _0x5b56d6[_0x1f0efa(0xd9)]();let _0x152218=(await(await fetch(D+'/mcp',{'method':_0x1f0efa(0xc6),'headers':{'Content-Type':_0x1f0efa(0xb8),'Accept':_0x1f0efa(0x102),...X?{'Authorization':_0x1f0efa(0xd5)+X}:{}},'body':JSON[_0x1f0efa(0xaf)]({'jsonrpc':_0x1f0efa(0xf7),'id':0x2,'method':_0x1f0efa(0x98),'params':{'name':_0x5a0747,'arguments':_0x5e851c}})}))[_0x1f0efa(0xd9)]())[_0x1f0efa(0x8c)]('\x0a')[_0x1f0efa(0x10f)](_0x29df4b=>_0x29df4b['startsWith'](_0x1f0efa(0xd0)));if(_0x152218){let _0x110b01=JSON[_0x1f0efa(0xb7)](_0x152218[_0x1f0efa(0xa9)](0x6));return _0x110b01?.['result']?.[_0x1f0efa(0xe1)]?.[0x0]?.['text']?JSON[_0x1f0efa(0xb7)](_0x110b01['result']['content'][0x0]['text']):_0x110b01;}return{'ok':!0x1,'error':_0x1f0efa(0x109)};}K[a0_0x40110b(0xb6)](a0_0x3ce375,async _0x7c88fd=>{const _0xb6fd8b=a0_0x40110b;let {name:_0x3cc211,arguments:_0x559c05}=_0x7c88fd[_0xb6fd8b(0x99)];if(_0x3cc211===_0xb6fd8b(0xe6)){let {task_id:_0x46f7bc,text:_0x176a61,status:_0x391ce2}=_0x559c05;if(_0x391ce2==='completed'||_0x391ce2===_0xb6fd8b(0xab)||_0x391ce2==='cancelled'){let _0x46fda5=_0x391ce2===_0xb6fd8b(0xb2)?_0xb6fd8b(0xd2):_0x391ce2,_0x477bac=_0x46f7bc?k[_0xb6fd8b(0xcd)](_0x46f7bc)||_0xb6fd8b(0x9c):_0xb6fd8b(0x9c),_0x4cbabc=await P('send_reply',{'alias':_0x477bac,'text':_0x176a61,'in_reply_to':_0x46f7bc||void 0x0,'status':_0x46fda5,'from_session':Z});if(_0x46f7bc)k[_0xb6fd8b(0xd8)](_0x46f7bc);return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON[_0xb6fd8b(0xaf)](_0x4cbabc)}]};}let _0xbbaf3b=await P(_0xb6fd8b(0xcc),{'resume_id':w,'alias':Z,'status':_0x391ce2===_0xb6fd8b(0xae)?_0xb6fd8b(0xae):_0x391ce2===_0xb6fd8b(0xb1)?_0xb6fd8b(0xb1):_0xb6fd8b(0xfc),'task':_0x176a61[_0xb6fd8b(0xa9)](0x0,0xc8),'output':_0x176a61});return{'content':[{'type':'text','text':JSON[_0xb6fd8b(0xaf)](_0xbbaf3b)}]};}if(_0x3cc211===_0xb6fd8b(0x9a)){let {status:_0x17dac7,task:_0x433d7d,progress:_0x11c783}=_0x559c05,_0x16abde=await P(_0xb6fd8b(0xcc),{'resume_id':w,'alias':Z,'status':_0x17dac7,'task':_0x433d7d,'progress':_0x11c783});return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON[_0xb6fd8b(0xaf)](_0x16abde)}]};}if(_0x3cc211===_0xb6fd8b(0xf8)){let {alias:_0x123f28,task:_0x1ae5ab,priority:_0x1b8537}=_0x559c05,_0x18086f=await P(_0xb6fd8b(0xbf),{'alias':_0x123f28,'task':_0x1ae5ab,'priority':_0x1b8537||_0xb6fd8b(0x96),'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x18086f)}]};}if(_0x3cc211===_0xb6fd8b(0x8d)){let {alias:_0x19c66f,message:_0x5b43a4}=_0x559c05,_0x6bea33=await P('send_message',{'alias':_0x19c66f,'message':_0x5b43a4,'from_session':Z});return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON['stringify'](_0x6bea33)}]};}if(_0x3cc211==='commhub_get_all_status'){let _0x10c466=await P(_0xb6fd8b(0xfe),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x10c466)}]};}return{'content':[{'type':_0xb6fd8b(0xd9),'text':JSON['stringify']({'error':_0xb6fd8b(0xc9)})}]};});async function v(){const _0x59b925=a0_0x40110b;let _0x5c5d55=D+_0x59b925(0x95)+encodeURIComponent(Z),_0x1c49b={};if(X)_0x1c49b['Authorization']=_0x59b925(0xd5)+X;Y(_0x59b925(0xa8)+_0x5c5d55);while(!0x0){try{let _0x30d49a=await fetch(_0x5c5d55,{'headers':_0x1c49b});if(!_0x30d49a['ok']){Y(_0x59b925(0xa1)+_0x30d49a['status']+'\x20'+_0x30d49a[_0x59b925(0xf9)]),await h(0x1388);continue;}let _0xf9ad4a=_0x30d49a['body'][_0x59b925(0xec)](),_0x1d0877=new TextDecoder(),_0x31a854='';while(!0x0){let {done:_0x488c13,value:_0x3a9283}=await _0xf9ad4a[_0x59b925(0x110)]();if(_0x488c13)break;_0x31a854+=_0x1d0877[_0x59b925(0xe5)](_0x3a9283,{'stream':!0x0});let _0x456a79=_0x31a854[_0x59b925(0x8c)]('\x0a\x0a');_0x31a854=_0x456a79[_0x59b925(0x107)]()||'';for(let _0x5efdcf of _0x456a79){let _0x117e77=_0x5efdcf['split']('\x0a')[_0x59b925(0x10f)](_0x12609c=>_0x12609c[_0x59b925(0x10c)]('data:\x20'));if(!_0x117e77)continue;try{let _0x199dad=JSON[_0x59b925(0xb7)](_0x117e77[_0x59b925(0xa9)](0x6));await u(_0x199dad);}catch(_0x21696){Y(_0x59b925(0xe7)+_0x21696);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x4c49ad){Y(_0x59b925(0x101)+_0x4c49ad);}await h(0xbb8);}}async function u(_0x395bbe){const _0x4bb643=a0_0x40110b;if(_0x395bbe[_0x4bb643(0x112)]===_0x4bb643(0xc5)){Y(_0x4bb643(0xed)+Z+'\x22');return;}if(_0x395bbe[_0x4bb643(0x112)]===_0x4bb643(0xf1)){if(Y(_0x4bb643(0xc7)+_0x395bbe[_0x4bb643(0xf4)]+':\x20'+_0x395bbe['message'][_0x4bb643(0xa9)](0x0,0x3c)),await K[_0x4bb643(0xd1)]({'method':_0x4bb643(0x10b),'params':{'content':_0x395bbe[_0x4bb643(0xb5)],'meta':{'sender':_0x395bbe[_0x4bb643(0xf4)]||_0x4bb643(0x9c),'sender_id':_0x4bb643(0x93),'user':_0x395bbe[_0x4bb643(0xf4)]||_0x4bb643(0x9c),'priority':_0x4bb643(0x96)}}}),_0x395bbe[_0x4bb643(0xc8)])await P(_0x4bb643(0x8f),{'alias':Z,'message_id':_0x395bbe[_0x4bb643(0xc8)]});return;}if(_0x395bbe[_0x4bb643(0x112)]===_0x4bb643(0x92)||_0x395bbe['type']===_0x4bb643(0x104)){Y('←\x20'+_0x395bbe[_0x4bb643(0x112)]+_0x4bb643(0xf6)+_0x395bbe[_0x4bb643(0xb9)]+_0x4bb643(0xef)+(_0x395bbe[_0x4bb643(0x10e)]||_0x4bb643(0x96)));let _0x43cb9e=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x43cb9e?.['ok']&&_0x43cb9e[_0x4bb643(0xf5)]?.[_0x4bb643(0xde)]>0x0)for(let _0x426af7 of _0x43cb9e['messages']){let _0x468090={'sender':_0x426af7[_0x4bb643(0x8e)]||_0x4bb643(0x9c),'sender_id':_0x4bb643(0x93),'user':_0x426af7[_0x4bb643(0x8e)]||_0x4bb643(0x9c),'task_id':_0x426af7['id'],'priority':_0x426af7['priority']||_0x4bb643(0x96)};k[_0x4bb643(0x97)](_0x426af7['id'],_0x426af7[_0x4bb643(0x8e)]||_0x4bb643(0x9c)),await K[_0x4bb643(0xd1)]({'method':_0x4bb643(0x10b),'params':{'content':_0x426af7[_0x4bb643(0xe1)],'meta':_0x468090}}),Y(_0x4bb643(0x9e)+_0x426af7['id'][_0x4bb643(0xa9)](0x0,0x8)+'\x20from\x20'+_0x426af7['from_session']+':\x20'+_0x426af7[_0x4bb643(0xe1)][_0x4bb643(0xa9)](0x0,0x3c)),await P(_0x4bb643(0x8f),{'alias':Z,'message_id':_0x426af7['id']});}}}async function S(){const _0xa6d671=a0_0x40110b;let _0x1cbc4d=new a0_0x151235();await K[_0xa6d671(0xb4)](_0x1cbc4d),Y(_0xa6d671(0xe8)),Y(_0xa6d671(0xf0)),v()[_0xa6d671(0xdf)](_0x3d74a6=>Y('SSE\x20fatal:\x20'+_0x3d74a6)),P(_0xa6d671(0xcc),{'resume_id':w,'alias':Z,'status':_0xa6d671(0xaa),'server':a0_0x159f86(),'hostname':a0_0x159f86(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0xa6d671(0xac)](()=>Y('registered\x20as\x20\x22'+Z+_0xa6d671(0x89)+w['slice'](0x0,0x8)+')'))[_0xa6d671(0xdf)](_0x20c186=>Y(_0xa6d671(0x113)+_0x20c186)),setInterval(()=>{const _0x1c0484=_0xa6d671;P(_0x1c0484(0xcc),{'resume_id':w,'alias':Z,'status':_0x1c0484(0xaa),'server':a0_0x159f86(),'hostname':a0_0x159f86(),'agent':_0x1c0484(0xd4),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x1c0484(0xdf)](_0xedc003=>Y('heartbeat\x20failed:\x20'+_0xedc003));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}S()[a0_0x40110b(0xdf)](_0x318c79=>{const _0x479e7b=a0_0x40110b;Y(_0x479e7b(0xda)+_0x318c79),process[_0x479e7b(0xb3)](0x1);});function a0_0x329f(_0x6ea8ae,_0x2ec823){_0x6ea8ae=_0x6ea8ae-0x89;const _0x169f94=a0_0x169f();let _0x329f41=_0x169f94[_0x6ea8ae];return _0x329f41;}async function N(){const _0x122551=a0_0x40110b;Y(_0x122551(0x106)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x122551(0xb1),'task':_0x122551(0xa6)})['catch'](()=>{}),process[_0x122551(0xb3)](0x0);}process[a0_0x40110b(0xd3)]['on']('end',()=>N()),process['on'](a0_0x40110b(0xcb),()=>N()),process['on'](a0_0x40110b(0x111),()=>N());
|
|
2
|
+
const a0_0x499f72=a0_0x5111;(function(_0x54b761,_0x104e43){const _0x1b6b97=a0_0x5111,_0x590f53=_0x54b761();while(!![]){try{const _0x5ba491=parseInt(_0x1b6b97(0x1f6))/0x1+-parseInt(_0x1b6b97(0x213))/0x2+-parseInt(_0x1b6b97(0x1f9))/0x3+parseInt(_0x1b6b97(0x255))/0x4*(-parseInt(_0x1b6b97(0x214))/0x5)+-parseInt(_0x1b6b97(0x26e))/0x6*(-parseInt(_0x1b6b97(0x209))/0x7)+-parseInt(_0x1b6b97(0x21e))/0x8*(parseInt(_0x1b6b97(0x1f4))/0x9)+parseInt(_0x1b6b97(0x258))/0xa*(parseInt(_0x1b6b97(0x266))/0xb);if(_0x5ba491===_0x104e43)break;else _0x590f53['push'](_0x590f53['shift']());}catch(_0x189aa5){_0x590f53['push'](_0x590f53['shift']());}}}(a0_0x1655,0x396f2));import{readFileSync as a0_0x30c045,existsSync as a0_0x36485a}from'fs';import{join as a0_0x5d5e4c}from'path';import{hostname as a0_0x1bf7b1}from'os';import{execSync as a0_0x5e2245}from'child_process';function a0_0x1655(){const _0x18d5e5=['text','MCP\x20stdio\x20connected','\x20CWD=','.anet','completed','message','join','cwd','→\x20injected\x20task\x20','decode','replied','no\x20response','error','503944ZbCZwg','low','in_progress','15430gWxDLX','0.3.0','/mcp','working','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','Priority\x20(default:\x20normal)','task','application/json,\x20text/event-stream','replace','ready\x20—\x20waiting\x20for\x20events','result','indexOf','type','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','4037woPmsk','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','read','then','stdin','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','.claude/channels/commhub','398958kWmsQR','slice','ack_inbox','getReader','startsWith','Task\x20content','failed','SSE\x20connected\x20as\x20\x22','2025-03-26','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','\x20PROJECT_ENV=','split','body','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','fatal:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','content','object','normal','token','report_status','unknown\x20tool','toTimeString','messages','185292dBaEqK','high','177067QfVCQw','data:\x20','Authorization','780609wNSXJX','message_id','initialize','setRequestHandler','POST','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','write','parse\x20error:\x20','string','stderr','none','send_task','end','new_message','from_session','commhub_send_message','28eiEdmJ','set','commhub_send_task','Target\x20session\x20alias','find','connecting\x20to\x20','trim','notifications/claude/channel','cancelled','stringify','446354JpSAAt','5YhqMWB','delete','←\x20message\x20from\x20','blocked','Bearer\x20','get','\x20priority=','SIGTERM','commhub','\x22\x20(','64gJBJfg','shutting\x20down,\x20reporting\x20offline...','priority','...\x20TMUX=','application/json','utf-8','SSE\x20stream\x20ended,\x20reconnecting...','parse','starting\x20SSE\x20listener...','Current\x20task\x20description','from','config.json','2.0','send_message','\x20from\x20',']\x20[commhub]\x20','alias','\x20ALIAS=','/events/','catch',':\x20inbox_count=','commhub_get_all_status','status','Reply\x20text\x20/\x20result\x20summary','SSE\x20connection\x20error:\x20','claude-code','broadcast','\x20RESUME_ID=','hub','session\x20disconnected','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','get_all_status','Session\x20alias:\x20','commhub_report_status','.env','CommHub\x20init\x20failed:\x20','idle','new_task','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','statusText','init\x20failed:\x20','commhub_reply'];a0_0x1655=function(){return _0x18d5e5;};return a0_0x1655();}import{Server as a0_0x565864}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1e1653}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2d0675,CallToolRequestSchema as a0_0xdd2322}from'@modelcontextprotocol/sdk/types.js';function p(_0x54a714){const _0x528583=a0_0x5111;if(!a0_0x36485a(_0x54a714))return;for(let _0x20fd12 of a0_0x30c045(_0x54a714,_0x528583(0x223))[_0x528583(0x1e7)]('\x0a')){let _0x1c406f=_0x20fd12[_0x528583(0x20f)]();if(!_0x1c406f||_0x1c406f[_0x528583(0x272)]('#'))continue;let _0x160a50=_0x1c406f[_0x528583(0x263)]('=');if(_0x160a50<0x0)continue;let _0x35072b=_0x1c406f[_0x528583(0x26f)](0x0,_0x160a50)['trim'](),_0x281633=_0x1c406f[_0x528583(0x26f)](_0x160a50+0x1)['trim']()[_0x528583(0x260)](/^["']|["']$/g,'');if(!process.env[_0x35072b])process.env[_0x35072b]=_0x281633;}}var C=process.env.HOME||'~',T=a0_0x5d5e4c(C,a0_0x499f72(0x26d));p(a0_0x5d5e4c(T,a0_0x499f72(0x240)));var L=process[a0_0x499f72(0x24f)]()[a0_0x499f72(0x260)](/\//g,'-');p(a0_0x5d5e4c(T,L,a0_0x499f72(0x240)));function U(){const _0x522f34=a0_0x499f72;try{return a0_0x5e2245(_0x522f34(0x1eb),{'encoding':'utf-8','timeout':0x7d0})[_0x522f34(0x20f)]();}catch{return'';}}function c(){const _0x361890=a0_0x499f72;try{let _0x166269=a0_0x5d5e4c(C,_0x361890(0x24b),_0x361890(0x229));if(a0_0x36485a(_0x166269))return JSON['parse'](a0_0x30c045(_0x166269,_0x361890(0x223)));}catch{}return{};}var H=c(),D=process.env.COMMHUB_URL||H[a0_0x499f72(0x23a)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||f||a0_0x1bf7b1(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||crypto['randomUUID'](),X=process.env.COMMHUB_TOKEN||H[a0_0x499f72(0x1ef)]||'';function a0_0x5111(_0x2ce17c,_0x292086){_0x2ce17c=_0x2ce17c-0x1e4;const _0x165555=a0_0x1655();let _0x5111ce=_0x165555[_0x2ce17c];return _0x5111ce;}function Y(_0x59536d){const _0xd49e40=a0_0x499f72;let _0x3c4fbc=new Date()[_0xd49e40(0x1f2)]()[_0xd49e40(0x26f)](0x0,0x8);process[_0xd49e40(0x202)][_0xd49e40(0x1ff)]('['+_0x3c4fbc+_0xd49e40(0x22d)+_0x59536d+'\x0a');}function h(_0x1eb3a9){return new Promise(_0x81347b=>setTimeout(_0x81347b,_0x1eb3a9));}Y('ENV:\x20URL='+D+a0_0x499f72(0x22f)+Z+a0_0x499f72(0x239)+w[a0_0x499f72(0x26f)](0x0,0x8)+a0_0x499f72(0x221)+(f||a0_0x499f72(0x203))+a0_0x499f72(0x24a)+process[a0_0x499f72(0x24f)]()+a0_0x499f72(0x1e6)+L);var k=new Map(),K=new a0_0x565864({'name':'commhub-channel','version':a0_0x499f72(0x259)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x499f72(0x23c),a0_0x499f72(0x26b),a0_0x499f72(0x265),a0_0x499f72(0x1e9),a0_0x499f72(0x23e)+Z][a0_0x499f72(0x24e)]('\x0a')});K['setRequestHandler'](a0_0x2d0675,async()=>({'tools':[{'name':a0_0x499f72(0x247),'description':a0_0x499f72(0x244),'inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{'task_id':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x26c)},'text':{'type':'string','description':a0_0x499f72(0x235)},'status':{'type':a0_0x499f72(0x201),'enum':['completed',a0_0x499f72(0x274),a0_0x499f72(0x211),a0_0x499f72(0x217),a0_0x499f72(0x254),a0_0x499f72(0x257)],'description':a0_0x499f72(0x25c)}},'required':[a0_0x499f72(0x248)]}},{'name':a0_0x499f72(0x23f),'description':a0_0x499f72(0x267),'inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{'status':{'type':'string','enum':[a0_0x499f72(0x25b),a0_0x499f72(0x242),a0_0x499f72(0x217),'error']},'task':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x227)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':['status']}},{'name':a0_0x499f72(0x20b),'description':a0_0x499f72(0x1e5),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x499f72(0x201),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x499f72(0x201),'description':a0_0x499f72(0x273)},'priority':{'type':a0_0x499f72(0x201),'enum':[a0_0x499f72(0x1f5),a0_0x499f72(0x1ee),a0_0x499f72(0x256)],'description':a0_0x499f72(0x25d)}},'required':[a0_0x499f72(0x22e),a0_0x499f72(0x25e)]}},{'name':a0_0x499f72(0x208),'description':a0_0x499f72(0x1fe),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x499f72(0x20c)},'message':{'type':a0_0x499f72(0x201),'description':'Message\x20content'}},'required':['alias',a0_0x499f72(0x24d)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x499f72(0x1ed),'properties':{}}}]}));async function P(_0x927259,_0x371dc8){const _0x10e9d7=a0_0x499f72;let _0x27292d=await fetch(D+_0x10e9d7(0x25a),{'method':_0x10e9d7(0x1fd),'headers':{'Content-Type':_0x10e9d7(0x222),'Accept':_0x10e9d7(0x25f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x10e9d7(0x212)]({'jsonrpc':_0x10e9d7(0x22a),'id':0x1,'method':_0x10e9d7(0x1fb),'params':{'protocolVersion':_0x10e9d7(0x1e4),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x10e9d7(0x259)}}})});if(!_0x27292d['ok']){let _0x25db72=await _0x27292d[_0x10e9d7(0x248)]();return Y(_0x10e9d7(0x241)+_0x27292d[_0x10e9d7(0x234)]+'\x20'+_0x25db72[_0x10e9d7(0x26f)](0x0,0x64)),{'ok':!0x1,'error':_0x10e9d7(0x246)+_0x27292d[_0x10e9d7(0x234)]};}await _0x27292d[_0x10e9d7(0x248)]();let _0xced4ad=(await(await fetch(D+'/mcp',{'method':_0x10e9d7(0x1fd),'headers':{'Content-Type':_0x10e9d7(0x222),'Accept':_0x10e9d7(0x25f),...X?{'Authorization':_0x10e9d7(0x218)+X}:{}},'body':JSON[_0x10e9d7(0x212)]({'jsonrpc':_0x10e9d7(0x22a),'id':0x2,'method':'tools/call','params':{'name':_0x927259,'arguments':_0x371dc8}})}))['text']())[_0x10e9d7(0x1e7)]('\x0a')[_0x10e9d7(0x20d)](_0x43400a=>_0x43400a['startsWith']('data:\x20'));if(_0xced4ad){let _0x157160=JSON[_0x10e9d7(0x225)](_0xced4ad[_0x10e9d7(0x26f)](0x6));return _0x157160?.[_0x10e9d7(0x262)]?.[_0x10e9d7(0x1ec)]?.[0x0]?.['text']?JSON[_0x10e9d7(0x225)](_0x157160[_0x10e9d7(0x262)][_0x10e9d7(0x1ec)][0x0][_0x10e9d7(0x248)]):_0x157160;}return{'ok':!0x1,'error':_0x10e9d7(0x253)};}K[a0_0x499f72(0x1fc)](a0_0xdd2322,async _0x3c289e=>{const _0x55df36=a0_0x499f72;let {name:_0x439682,arguments:_0x2c8fb0}=_0x3c289e['params'];if(_0x439682===_0x55df36(0x247)){let {task_id:_0x4c168a,text:_0x382c15,status:_0x4794fb}=_0x2c8fb0;if(_0x4794fb===_0x55df36(0x24c)||_0x4794fb===_0x55df36(0x274)||_0x4794fb===_0x55df36(0x211)){let _0x2211ce=_0x4794fb===_0x55df36(0x24c)?_0x55df36(0x252):_0x4794fb,_0x3190b8=_0x4c168a?k[_0x55df36(0x219)](_0x4c168a)||'hub':_0x55df36(0x23a),_0x8ec866=await P('send_reply',{'alias':_0x3190b8,'text':_0x382c15,'in_reply_to':_0x4c168a||void 0x0,'status':_0x2211ce,'from_session':Z});if(_0x4c168a)k[_0x55df36(0x215)](_0x4c168a);return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0x8ec866)}]};}let _0x147cdf=await P(_0x55df36(0x1f0),{'resume_id':w,'alias':Z,'status':_0x4794fb===_0x55df36(0x217)?_0x55df36(0x217):_0x4794fb==='error'?_0x55df36(0x254):_0x55df36(0x25b),'task':_0x382c15[_0x55df36(0x26f)](0x0,0xc8),'output':_0x382c15});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x147cdf)}]};}if(_0x439682===_0x55df36(0x23f)){let {status:_0xcb65ed,task:_0x42253f,progress:_0x96f293}=_0x2c8fb0,_0xb08848=await P(_0x55df36(0x1f0),{'resume_id':w,'alias':Z,'status':_0xcb65ed,'task':_0x42253f,'progress':_0x96f293});return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0xb08848)}]};}if(_0x439682==='commhub_send_task'){let {alias:_0x299323,task:_0x2dd347,priority:_0x2d1848}=_0x2c8fb0,_0x4e3718=await P(_0x55df36(0x204),{'alias':_0x299323,'task':_0x2dd347,'priority':_0x2d1848||_0x55df36(0x1ee),'from_session':Z});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x4e3718)}]};}if(_0x439682===_0x55df36(0x208)){let {alias:_0x5e9384,message:_0x2648f4}=_0x2c8fb0,_0x37842c=await P(_0x55df36(0x22b),{'alias':_0x5e9384,'message':_0x2648f4,'from_session':Z});return{'content':[{'type':_0x55df36(0x248),'text':JSON[_0x55df36(0x212)](_0x37842c)}]};}if(_0x439682===_0x55df36(0x233)){let _0x7759ee=await P(_0x55df36(0x23d),{});return{'content':[{'type':_0x55df36(0x248),'text':JSON['stringify'](_0x7759ee)}]};}return{'content':[{'type':'text','text':JSON[_0x55df36(0x212)]({'error':_0x55df36(0x1f1)})}]};});async function v(){const _0x212750=a0_0x499f72;let _0x1de250=D+_0x212750(0x230)+encodeURIComponent(Z),_0x2ce99d={};if(X)_0x2ce99d[_0x212750(0x1f8)]=_0x212750(0x218)+X;Y(_0x212750(0x20e)+_0x1de250);while(!0x0){try{let _0x37055a=await fetch(_0x1de250,{'headers':_0x2ce99d});if(!_0x37055a['ok']){Y('SSE\x20error:\x20'+_0x37055a['status']+'\x20'+_0x37055a[_0x212750(0x245)]),await h(0x1388);continue;}let _0x196c4a=_0x37055a[_0x212750(0x1e8)][_0x212750(0x271)](),_0x3d9377=new TextDecoder(),_0x11b316='';while(!0x0){let {done:_0x5f54b5,value:_0x339c06}=await _0x196c4a[_0x212750(0x268)]();if(_0x5f54b5)break;_0x11b316+=_0x3d9377[_0x212750(0x251)](_0x339c06,{'stream':!0x0});let _0x2277c1=_0x11b316['split']('\x0a\x0a');_0x11b316=_0x2277c1['pop']()||'';for(let _0x2df77a of _0x2277c1){let _0xb6225d=_0x2df77a['split']('\x0a')[_0x212750(0x20d)](_0x28b37b=>_0x28b37b[_0x212750(0x272)](_0x212750(0x1f7)));if(!_0xb6225d)continue;try{let _0x3114e6=JSON[_0x212750(0x225)](_0xb6225d[_0x212750(0x26f)](0x6));await u(_0x3114e6);}catch(_0x28ee94){Y(_0x212750(0x200)+_0x28ee94);}}}Y(_0x212750(0x224));}catch(_0x48049a){Y(_0x212750(0x236)+_0x48049a);}await h(0xbb8);}}async function u(_0x5b06d6){const _0x2ca962=a0_0x499f72;if(_0x5b06d6['type']==='connected'){Y(_0x2ca962(0x275)+Z+'\x22');return;}if(_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x206)){if(Y(_0x2ca962(0x216)+_0x5b06d6[_0x2ca962(0x228)]+':\x20'+_0x5b06d6['message'][_0x2ca962(0x26f)](0x0,0x3c)),await K['notification']({'method':_0x2ca962(0x210),'params':{'content':_0x5b06d6['message'],'meta':{'sender':_0x5b06d6[_0x2ca962(0x228)]||_0x2ca962(0x23a),'sender_id':_0x2ca962(0x21c),'user':_0x5b06d6[_0x2ca962(0x228)]||_0x2ca962(0x23a),'priority':_0x2ca962(0x1ee)}}}),_0x5b06d6['message_id'])await P(_0x2ca962(0x270),{'alias':Z,'message_id':_0x5b06d6[_0x2ca962(0x1fa)]});return;}if(_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x243)||_0x5b06d6[_0x2ca962(0x264)]===_0x2ca962(0x238)){Y('←\x20'+_0x5b06d6[_0x2ca962(0x264)]+_0x2ca962(0x232)+_0x5b06d6['inbox_count']+_0x2ca962(0x21a)+(_0x5b06d6[_0x2ca962(0x220)]||_0x2ca962(0x1ee)));let _0x3a3053=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x3a3053?.['ok']&&_0x3a3053[_0x2ca962(0x1f3)]?.['length']>0x0)for(let _0x104f44 of _0x3a3053[_0x2ca962(0x1f3)]){let _0x3ecefc={'sender':_0x104f44['from_session']||'hub','sender_id':_0x2ca962(0x21c),'user':_0x104f44[_0x2ca962(0x207)]||'hub','task_id':_0x104f44['id'],'priority':_0x104f44[_0x2ca962(0x220)]||_0x2ca962(0x1ee)};k[_0x2ca962(0x20a)](_0x104f44['id'],_0x104f44[_0x2ca962(0x207)]||_0x2ca962(0x23a)),await K['notification']({'method':_0x2ca962(0x210),'params':{'content':_0x104f44[_0x2ca962(0x1ec)],'meta':_0x3ecefc}}),Y(_0x2ca962(0x250)+_0x104f44['id'][_0x2ca962(0x26f)](0x0,0x8)+_0x2ca962(0x22c)+_0x104f44[_0x2ca962(0x207)]+':\x20'+_0x104f44[_0x2ca962(0x1ec)]['slice'](0x0,0x3c)),await P(_0x2ca962(0x270),{'alias':Z,'message_id':_0x104f44['id']});}}}async function S(){const _0x12509c=a0_0x499f72;let _0x290684=new a0_0x1e1653();await K['connect'](_0x290684),Y(_0x12509c(0x249)),Y(_0x12509c(0x226)),v()[_0x12509c(0x231)](_0x2a6615=>Y('SSE\x20fatal:\x20'+_0x2a6615)),P(_0x12509c(0x1f0),{'resume_id':w,'alias':Z,'status':_0x12509c(0x242),'server':a0_0x1bf7b1(),'hostname':a0_0x1bf7b1(),'agent':_0x12509c(0x237),'project_dir':process[_0x12509c(0x24f)](),'tmux_name':f||void 0x0})[_0x12509c(0x269)](()=>Y('registered\x20as\x20\x22'+Z+_0x12509c(0x21d)+w['slice'](0x0,0x8)+')'))['catch'](_0xa75799=>Y('warning:\x20could\x20not\x20register:\x20'+_0xa75799)),setInterval(()=>{const _0x1c2c75=_0x12509c;P('report_status',{'resume_id':w,'alias':Z,'status':_0x1c2c75(0x242),'server':a0_0x1bf7b1(),'hostname':a0_0x1bf7b1(),'agent':_0x1c2c75(0x237),'project_dir':process[_0x1c2c75(0x24f)](),'tmux_name':f||void 0x0})[_0x1c2c75(0x231)](_0x291297=>Y('heartbeat\x20failed:\x20'+_0x291297));},0x2bf20),Y(_0x12509c(0x261));}S()[a0_0x499f72(0x231)](_0x203cfa=>{const _0x25e217=a0_0x499f72;Y(_0x25e217(0x1ea)+_0x203cfa),process['exit'](0x1);});async function N(){const _0x5f0061=a0_0x499f72;Y(_0x5f0061(0x21f)),await P(_0x5f0061(0x1f0),{'resume_id':w,'alias':Z,'status':'error','task':_0x5f0061(0x23b)})[_0x5f0061(0x231)](()=>{}),process['exit'](0x0);}process[a0_0x499f72(0x26a)]['on'](a0_0x499f72(0x205),()=>N()),process['on'](a0_0x499f72(0x21b),()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.0.0-preview.
|
|
3
|
+
"version": "2.0.0-preview.26",
|
|
4
4
|
"description": "AI Agent Network CLI \u2014 Create multi-agent networks with user management, network isolation, and 3 AI runtimes (Claude/Codex/MiniMax). 34 commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|