@sleep2agi/agent-network 2.1.0 → 2.1.1
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/LICENSE +202 -0
- package/README.md +8 -8
- 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 +9 -3
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a0_0x4a96(_0x239321,_0x4dba44){_0x239321=_0x239321-0xb3;const _0x55d685=a0_0x55d6();let _0x4a9607=_0x55d685[_0x239321];return _0x4a9607;}const a0_0x2f58b1=a0_0x4a96;(function(_0x593300,_0x47f113){const _0x1980bc=a0_0x4a96,_0x280030=_0x593300();while(!![]){try{const _0x10b473=-parseInt(_0x1980bc(0x109))/0x1*(-parseInt(_0x1980bc(0xd7))/0x2)+-parseInt(_0x1980bc(0xd8))/0x3*(parseInt(_0x1980bc(0x102))/0x4)+-parseInt(_0x1980bc(0x103))/0x5+parseInt(_0x1980bc(0xe9))/0x6*(-parseInt(_0x1980bc(0xe1))/0x7)+-parseInt(_0x1980bc(0xe6))/0x8*(-parseInt(_0x1980bc(0xc2))/0x9)+-parseInt(_0x1980bc(0xf3))/0xa*(-parseInt(_0x1980bc(0xb4))/0xb)+parseInt(_0x1980bc(0xfb))/0xc*(parseInt(_0x1980bc(0xe0))/0xd);if(_0x10b473===_0x47f113)break;else _0x280030['push'](_0x280030['shift']());}catch(_0x4ae82d){_0x280030['push'](_0x280030['shift']());}}}(a0_0x55d6,0x64fd9));import{EventEmitter as a0_0x10552d}from'events';import{hostname as a0_0x24eb05}from'os';function a0_0x55d6(){const _0x123de4=[']\x20[commhub:','registered','1884DkleZd','pop','send_task','normal','application/json','token','application/json,\x20text/event-stream','319988FEkLpL','3599305VxSTyX','replace','inbox\x20error:\x20','get_inbox','catch','tools/call','263vHGWiz','disconnected','sleep','1256959cUgarx','messages','alias','now','autoConnect','call','Bearer\x20','reconnectDelay','resumeId','url','cwd','SSE\x20error:\x20','name','read','9VViBxG','match','sdk','parse','sseAbort','result','send','slice','task','type','message','toString','error','broadcast','emit','reply','split','data:\x20','get_all_status','log','Authorization','4510TRpgRg','12QNMuGr','idle','abort','SSE\x20failed:\x20','disconnect','processInbox','connected','text','23335zECOGK','5206033KeQWQX','connectSSE','min','send_message','heartbeatTimer','5093848GPPUdm','completed','connect','6jVEvRI','text/event-stream','POST','/mcp','content','SSE\x20connected','signal','stringify','report_status','running','60JctsME','offline','heartbeatInterval','2.0','agent','status'];a0_0x55d6=function(){return _0x123de4;};return a0_0x55d6();}class T extends a0_0x10552d{[a0_0x2f58b1(0xbd)];[a0_0x2f58b1(0xb6)];[a0_0x2f58b1(0x100)];['agent'];[a0_0x2f58b1(0xbc)];[a0_0x2f58b1(0xf5)];[a0_0x2f58b1(0xbb)];[a0_0x2f58b1(0xe5)];[a0_0x2f58b1(0xc6)];[a0_0x2f58b1(0xf2)]=!0x1;constructor(_0x11c083){const _0x1d0d87=a0_0x2f58b1;super();if(this['url']=_0x11c083[_0x1d0d87(0xbd)][_0x1d0d87(0x104)](/\/$/,''),this[_0x1d0d87(0xb6)]=_0x11c083[_0x1d0d87(0xb6)],this[_0x1d0d87(0x100)]=_0x11c083[_0x1d0d87(0x100)],this[_0x1d0d87(0xf7)]=_0x11c083[_0x1d0d87(0xf7)]||_0x1d0d87(0xc4),this[_0x1d0d87(0xbc)]='sdk-'+_0x11c083[_0x1d0d87(0xb6)]+'-'+Date[_0x1d0d87(0xb7)]()[_0x1d0d87(0xcd)](0x24),this[_0x1d0d87(0xf5)]=_0x11c083[_0x1d0d87(0xf5)]??0x2bf20,this[_0x1d0d87(0xbb)]=_0x11c083[_0x1d0d87(0xbb)]??0xbb8,_0x11c083[_0x1d0d87(0xb8)]!==!0x1)this[_0x1d0d87(0xe8)]();}[a0_0x2f58b1(0xd5)](_0x40eafe){const _0x59a254=a0_0x2f58b1;console['log']('['+new Date()['toTimeString']()[_0x59a254(0xc9)](0x0,0x8)+_0x59a254(0xf9)+this[_0x59a254(0xb6)]+']\x20'+_0x40eafe);}async[a0_0x2f58b1(0xb9)](_0x1e52d5,_0x419544){const _0x509f35=a0_0x2f58b1;let _0x395da0={'Content-Type':_0x509f35(0xff),'Accept':_0x509f35(0x101)};if(this[_0x509f35(0x100)])_0x395da0[_0x509f35(0xd6)]=_0x509f35(0xba)+this[_0x509f35(0x100)];let _0x2eee08=await(await fetch(this[_0x509f35(0xbd)]+_0x509f35(0xec),{'method':_0x509f35(0xeb),'headers':_0x395da0,'body':JSON[_0x509f35(0xf0)]({'jsonrpc':_0x509f35(0xf6),'id':Date[_0x509f35(0xb7)](),'method':_0x509f35(0x108),'params':{'name':_0x1e52d5,'arguments':_0x419544}})}))[_0x509f35(0xdf)](),_0xd1de2e=_0x2eee08[_0x509f35(0xc3)](/data: (.+)/),_0x32c500=_0xd1de2e?JSON[_0x509f35(0xc5)](_0xd1de2e[0x1]):JSON[_0x509f35(0xc5)](_0x2eee08),_0x4dd2e8=_0x32c500?.[_0x509f35(0xc7)]?.[_0x509f35(0xed)]?.[0x0]?.[_0x509f35(0xdf)];return _0x4dd2e8?JSON[_0x509f35(0xc5)](_0x4dd2e8):_0x32c500;}async[a0_0x2f58b1(0xe8)](){const _0x5af01f=a0_0x2f58b1;if(this[_0x5af01f(0xf2)])return;this['running']=!0x0,await this[_0x5af01f(0xf8)](_0x5af01f(0xd9)),this[_0x5af01f(0xd5)](_0x5af01f(0xfa)),this[_0x5af01f(0xe5)]=setInterval(()=>{const _0x39544d=_0x5af01f;this[_0x39544d(0xf8)](_0x39544d(0xd9))[_0x39544d(0x107)](_0x1671ee=>this[_0x39544d(0xd5)]('heartbeat\x20failed:\x20'+_0x1671ee[_0x39544d(0xcc)]));},this['heartbeatInterval']),this[_0x5af01f(0xe2)]();}async[a0_0x2f58b1(0xdc)](){const _0x4348e8=a0_0x2f58b1;if(this[_0x4348e8(0xf2)]=!0x1,this['sseAbort']?.[_0x4348e8(0xda)](),this[_0x4348e8(0xe5)])clearInterval(this[_0x4348e8(0xe5)]);await this[_0x4348e8(0xf8)](_0x4348e8(0xf4))[_0x4348e8(0x107)](()=>{}),this[_0x4348e8(0xd5)](_0x4348e8(0x10a));}async[a0_0x2f58b1(0xc8)](_0x4ebca2,_0x1e4589,_0x4847da=a0_0x2f58b1(0xfe)){const _0x21b621=a0_0x2f58b1;return this[_0x21b621(0xb9)](_0x21b621(0xfd),{'alias':_0x4ebca2,'task':_0x1e4589,'priority':_0x4847da,'from_session':this[_0x21b621(0xb6)]});}async['message'](_0x1303bf,_0x112960){const _0x30c3ed=a0_0x2f58b1;return this[_0x30c3ed(0xb9)](_0x30c3ed(0xe4),{'alias':_0x1303bf,'message':_0x112960,'from_session':this[_0x30c3ed(0xb6)]});}async[a0_0x2f58b1(0xd1)](_0x5239af,_0x394813,_0x33480b=a0_0x2f58b1(0xe7)){const _0x42c9c9=a0_0x2f58b1;return this[_0x42c9c9(0xb9)](_0x42c9c9(0xd1),{'task_id':_0x5239af,'text':_0x394813,'status':_0x33480b});}async[a0_0x2f58b1(0xf8)](_0x5ac2ba,_0x1fdc7d){const _0x2fbe7f=a0_0x2f58b1;return this['call'](_0x2fbe7f(0xf1),{'resume_id':this[_0x2fbe7f(0xbc)],'alias':this[_0x2fbe7f(0xb6)],'status':_0x5ac2ba,'server':a0_0x24eb05(),'hostname':a0_0x24eb05(),'agent':this[_0x2fbe7f(0xf7)],'project_dir':process[_0x2fbe7f(0xbe)](),..._0x1fdc7d});}async['getAllStatus'](){const _0x4b29c4=a0_0x2f58b1;return this[_0x4b29c4(0xb9)](_0x4b29c4(0xd4),{});}async['broadcast'](_0x548ead,_0x1a1f0d){const _0x15f67d=a0_0x2f58b1;return this[_0x15f67d(0xb9)](_0x15f67d(0xcf),{'message':_0x548ead,'filter_server':_0x1a1f0d?.['server'],'filter_status':_0x1a1f0d?.[_0x15f67d(0xf8)]});}async[a0_0x2f58b1(0xe2)](){const _0x3059e4=a0_0x2f58b1;let _0x56214f=encodeURIComponent(this[_0x3059e4(0xb6)]),_0x48e843=this[_0x3059e4(0xbd)]+'/events/'+_0x56214f,_0x2bcc10=this[_0x3059e4(0xbb)];while(this[_0x3059e4(0xf2)]){try{this[_0x3059e4(0xc6)]=new AbortController();let _0x10f8b9={'Accept':_0x3059e4(0xea)};if(this[_0x3059e4(0x100)])_0x10f8b9[_0x3059e4(0xd6)]=_0x3059e4(0xba)+this[_0x3059e4(0x100)];let _0xb857dc=await fetch(_0x48e843,{'headers':_0x10f8b9,'signal':this[_0x3059e4(0xc6)][_0x3059e4(0xef)]});if(!_0xb857dc['ok']||!_0xb857dc['body']){this[_0x3059e4(0xd5)](_0x3059e4(0xdb)+_0xb857dc['status']),await this['sleep'](_0x2bcc10),_0x2bcc10=Math[_0x3059e4(0xe3)](_0x2bcc10*1.5,0xea60);continue;}_0x2bcc10=this[_0x3059e4(0xbb)];let _0x32acac=_0xb857dc['body']['getReader'](),_0x17462c=new TextDecoder(),_0x460185='';while(this['running']){let {done:_0x42d7e2,value:_0x541b5f}=await _0x32acac[_0x3059e4(0xc1)]();if(_0x42d7e2)break;_0x460185+=_0x17462c['decode'](_0x541b5f,{'stream':!0x0});let _0x3d649c=_0x460185[_0x3059e4(0xd2)]('\x0a');_0x460185=_0x3d649c[_0x3059e4(0xfc)]()||'';for(let _0x4ec55d of _0x3d649c){if(!_0x4ec55d['startsWith'](_0x3059e4(0xd3)))continue;try{let _0x14a2cf=JSON[_0x3059e4(0xc5)](_0x4ec55d[_0x3059e4(0xc9)](0x6));if(_0x14a2cf[_0x3059e4(0xcb)]===_0x3059e4(0xde)){this['log'](_0x3059e4(0xee)),this['emit']('connected');continue;}if(_0x14a2cf[_0x3059e4(0xcb)]==='new_task'||_0x14a2cf[_0x3059e4(0xcb)]==='new_message'||_0x14a2cf[_0x3059e4(0xcb)]==='broadcast')await this[_0x3059e4(0xdd)]();}catch{}}}}catch(_0x5bb57f){if(_0x5bb57f[_0x3059e4(0xc0)]==='AbortError')break;this[_0x3059e4(0xd0)](_0x3059e4(0xce),_0x5bb57f),this['log'](_0x3059e4(0xbf)+_0x5bb57f[_0x3059e4(0xcc)]);}if(this[_0x3059e4(0xf2)])this[_0x3059e4(0xd0)](_0x3059e4(0x10a)),this[_0x3059e4(0xd5)]('SSE\x20reconnecting\x20in\x20'+_0x2bcc10/0x3e8+'s...'),await this[_0x3059e4(0xb3)](_0x2bcc10),_0x2bcc10=Math[_0x3059e4(0xe3)](_0x2bcc10*1.5,0xea60);}}async[a0_0x2f58b1(0xdd)](){const _0x374d90=a0_0x2f58b1;try{let _0x447d12=(await this['call'](_0x374d90(0x106),{'alias':this['alias'],'limit':0xa}))?.[_0x374d90(0xb5)]||[];for(let _0x585480 of _0x447d12)await this[_0x374d90(0xb9)]('ack_inbox',{'alias':this[_0x374d90(0xb6)],'message_id':_0x585480['id']}),this['log']('←\x20'+_0x585480['from_session']+':\x20'+_0x585480[_0x374d90(0xed)][_0x374d90(0xc9)](0x0,0x3c)),this['emit'](_0x374d90(0xca),_0x585480),this[_0x374d90(0xd0)](_0x374d90(0xcc),_0x585480);}catch(_0x47dd93){this[_0x374d90(0xd5)](_0x374d90(0x105)+_0x47dd93[_0x374d90(0xcc)]);}}['sleep'](_0x26beb0){return new Promise(_0x35da29=>setTimeout(_0x35da29,_0x26beb0));}}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_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());
|
|
2
|
+
const a0_0x158381=a0_0xf5ad;(function(_0x306d4a,_0x5f5daf){const _0x39c0da=a0_0xf5ad,_0x3d423a=_0x306d4a();while(!![]){try{const _0x1393f3=-parseInt(_0x39c0da(0x173))/0x1+-parseInt(_0x39c0da(0x1cf))/0x2+-parseInt(_0x39c0da(0x19d))/0x3*(parseInt(_0x39c0da(0x17e))/0x4)+parseInt(_0x39c0da(0x1b1))/0x5*(-parseInt(_0x39c0da(0x1d8))/0x6)+-parseInt(_0x39c0da(0x1b5))/0x7+-parseInt(_0x39c0da(0x17d))/0x8*(parseInt(_0x39c0da(0x17a))/0x9)+parseInt(_0x39c0da(0x165))/0xa;if(_0x1393f3===_0x5f5daf)break;else _0x3d423a['push'](_0x3d423a['shift']());}catch(_0x4d06fe){_0x3d423a['push'](_0x3d423a['shift']());}}}(a0_0x54b2,0x88302));import{readFileSync as a0_0x1ed82a,existsSync as a0_0x17f8bf}from'fs';import{randomUUID as a0_0x51ec75}from'crypto';import{join as a0_0x59f17f}from'path';import{hostname as a0_0x592bbe}from'os';import{execSync as a0_0x5b9049}from'child_process';import{Server as a0_0x43ba51}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3104be}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x253b39,CallToolRequestSchema as a0_0x4f97f4}from'@modelcontextprotocol/sdk/types.js';function p(_0x3a8aa6){const _0x5ad673=a0_0xf5ad;if(!a0_0x17f8bf(_0x3a8aa6))return;for(let _0x434adb of a0_0x1ed82a(_0x3a8aa6,'utf-8')['split']('\x0a')){let _0x1a1dea=_0x434adb[_0x5ad673(0x1ce)]();if(!_0x1a1dea||_0x1a1dea[_0x5ad673(0x1a7)]('#'))continue;let _0x10eea9=_0x1a1dea[_0x5ad673(0x16d)]('=');if(_0x10eea9<0x0)continue;let _0x322ea6=_0x1a1dea[_0x5ad673(0x1d3)](0x0,_0x10eea9)[_0x5ad673(0x1ce)](),_0x5ec558=_0x1a1dea[_0x5ad673(0x1d3)](_0x10eea9+0x1)[_0x5ad673(0x1ce)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x322ea6])process.env[_0x322ea6]=_0x5ec558;}}var C=process.env.HOME||'~',T=a0_0x59f17f(C,a0_0x158381(0x1b3));p(a0_0x59f17f(T,'.env'));var L=process['cwd']()[a0_0x158381(0x18b)](/\//g,'-');p(a0_0x59f17f(T,L,'.env'));function U(){const _0x820496=a0_0x158381;try{return a0_0x5b9049(_0x820496(0x1b4),{'encoding':_0x820496(0x175),'timeout':0x7d0})[_0x820496(0x1ce)]();}catch{return'';}}function v(){const _0x2394a9=a0_0x158381;try{let _0x45cfc2=a0_0x59f17f(C,_0x2394a9(0x194),_0x2394a9(0x15e));if(a0_0x17f8bf(_0x45cfc2))return JSON[_0x2394a9(0x163)](a0_0x1ed82a(_0x45cfc2,_0x2394a9(0x175)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x158381(0x1a5)]||a0_0x158381(0x187),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x592bbe(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x51ec75(),X=process.env.COMMHUB_TOKEN||H[a0_0x158381(0x1b9)]||'';function Y(_0x4d9f1b){const _0x1851ad=a0_0x158381;let _0x284be6=new Date()[_0x1851ad(0x1be)]()[_0x1851ad(0x1d3)](0x0,0x8);process[_0x1851ad(0x171)]['write']('['+_0x284be6+']\x20[commhub]\x20'+_0x4d9f1b+'\x0a');}function h(_0x4c327c){return new Promise(_0xcb323=>setTimeout(_0xcb323,_0x4c327c));}function a0_0xf5ad(_0x51b4d9,_0x116f96){_0x51b4d9=_0x51b4d9-0x15b;const _0x54b22d=a0_0x54b2();let _0xf5add3=_0x54b22d[_0x51b4d9];return _0xf5add3;}Y(a0_0x158381(0x178)+f+'\x20ALIAS='+Z+a0_0x158381(0x1e0)+w[a0_0x158381(0x1d3)](0x0,0x8)+a0_0x158381(0x1b0)+(j||a0_0x158381(0x18f))+a0_0x158381(0x16a)+process[a0_0x158381(0x1bd)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x43ba51({'name':a0_0x158381(0x196),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x158381(0x18c),a0_0x158381(0x19c),a0_0x158381(0x182),a0_0x158381(0x1e3),a0_0x158381(0x186)+Z][a0_0x158381(0x180)]('\x0a')});K['setRequestHandler'](a0_0x253b39,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x158381(0x1b6),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{'task_id':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x15c)},'text':{'type':a0_0x158381(0x1a9),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':'string','enum':[a0_0x158381(0x192),a0_0x158381(0x1a2),'cancelled',a0_0x158381(0x15d),a0_0x158381(0x1ab),'in_progress'],'description':a0_0x158381(0x1de)}},'required':[a0_0x158381(0x1a6)]}},{'name':'commhub_report_status','description':a0_0x158381(0x166),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{'status':{'type':a0_0x158381(0x1a9),'enum':[a0_0x158381(0x184),a0_0x158381(0x1dd),'blocked',a0_0x158381(0x1ab)]},'task':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x1ac)},'progress':{'type':a0_0x158381(0x1db),'description':a0_0x158381(0x164)}},'required':['status']}},{'name':a0_0x158381(0x15b),'description':a0_0x158381(0x1ae),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{'alias':{'type':a0_0x158381(0x1a9),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x1aa)},'priority':{'type':'string','enum':[a0_0x158381(0x199),a0_0x158381(0x1bb),'low'],'description':a0_0x158381(0x167)}},'required':[a0_0x158381(0x1c3),a0_0x158381(0x1a1)]}},{'name':a0_0x158381(0x1b7),'description':a0_0x158381(0x177),'inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'message':{'type':a0_0x158381(0x1a9),'description':a0_0x158381(0x1c5)}},'required':[a0_0x158381(0x1c3),a0_0x158381(0x188)]}},{'name':a0_0x158381(0x172),'description':a0_0x158381(0x170),'inputSchema':{'type':a0_0x158381(0x1bf),'properties':{}}}]}));async function P(_0x391961,_0x286c77){const _0x30faf3=a0_0x158381;let _0x456cc0=await fetch(f+_0x30faf3(0x1d9),{'method':_0x30faf3(0x183),'headers':{'Content-Type':_0x30faf3(0x1bc),'Accept':_0x30faf3(0x16c),...X?{'Authorization':_0x30faf3(0x19a)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x30faf3(0x189)}}})});if(!_0x456cc0['ok']){let _0x50730d=await _0x456cc0[_0x30faf3(0x1a6)]();return Y(_0x30faf3(0x1d2)+_0x456cc0[_0x30faf3(0x168)]+'\x20'+_0x50730d[_0x30faf3(0x1d3)](0x0,0x64)),{'ok':!0x1,'error':_0x30faf3(0x1e5)+_0x456cc0['status']};}await _0x456cc0[_0x30faf3(0x1a6)]();let _0xb72f72=(await(await fetch(f+_0x30faf3(0x1d9),{'method':_0x30faf3(0x183),'headers':{'Content-Type':_0x30faf3(0x1bc),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x30faf3(0x19a)+X}:{}},'body':JSON[_0x30faf3(0x181)]({'jsonrpc':'2.0','id':0x2,'method':_0x30faf3(0x1b8),'params':{'name':_0x391961,'arguments':_0x286c77}})}))[_0x30faf3(0x1a6)]())['split']('\x0a')[_0x30faf3(0x16b)](_0x59d7e8=>_0x59d7e8[_0x30faf3(0x1a7)](_0x30faf3(0x197)));if(_0xb72f72){let _0x5306a3=JSON[_0x30faf3(0x163)](_0xb72f72['slice'](0x6));return _0x5306a3?.['result']?.['content']?.[0x0]?.[_0x30faf3(0x1a6)]?JSON[_0x30faf3(0x163)](_0x5306a3[_0x30faf3(0x1cd)][_0x30faf3(0x179)][0x0][_0x30faf3(0x1a6)]):_0x5306a3;}return{'ok':!0x1,'error':_0x30faf3(0x191)};}K['setRequestHandler'](a0_0x4f97f4,async _0x4792da=>{const _0x3794d5=a0_0x158381;let {name:_0x29cb5a,arguments:_0x1f9fe5}=_0x4792da['params'];if(_0x29cb5a===_0x3794d5(0x1a3)){let {task_id:_0x450f94,text:_0x263368,status:_0x3bdf19}=_0x1f9fe5;if(_0x3bdf19===_0x3794d5(0x192)||_0x3bdf19===_0x3794d5(0x1a2)||_0x3bdf19===_0x3794d5(0x19f)){let _0x444892=_0x3bdf19===_0x3794d5(0x192)?_0x3794d5(0x1c0):_0x3bdf19,_0x2be51f=_0x450f94?k[_0x3794d5(0x190)](_0x450f94)||_0x3794d5(0x1a5):_0x3794d5(0x1a5),_0x387538=await P(_0x3794d5(0x1c6),{'alias':_0x2be51f,'text':_0x263368,'in_reply_to':_0x450f94||void 0x0,'status':_0x444892,'from_session':Z});if(_0x450f94)k[_0x3794d5(0x161)](_0x450f94);return{'content':[{'type':'text','text':JSON[_0x3794d5(0x181)](_0x387538)}]};}let _0x3e21b5=await P(_0x3794d5(0x1cc),{'resume_id':w,'alias':Z,'status':_0x3bdf19===_0x3794d5(0x15d)?_0x3794d5(0x15d):_0x3bdf19===_0x3794d5(0x1ab)?_0x3794d5(0x1ab):_0x3794d5(0x184),'task':_0x263368[_0x3794d5(0x1d3)](0x0,0xc8),'output':_0x263368});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON[_0x3794d5(0x181)](_0x3e21b5)}]};}if(_0x29cb5a===_0x3794d5(0x1e7)){let {status:_0x3b4f6b,task:_0x43c927,progress:_0x581db5}=_0x1f9fe5,_0x189285=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x3b4f6b,'task':_0x43c927,'progress':_0x581db5});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON['stringify'](_0x189285)}]};}if(_0x29cb5a==='commhub_send_task'){let {alias:_0x403709,task:_0x3f9e6a,priority:_0x2f5115}=_0x1f9fe5,_0x340f6f=await P('send_task',{'alias':_0x403709,'task':_0x3f9e6a,'priority':_0x2f5115||_0x3794d5(0x1bb),'from_session':Z});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON[_0x3794d5(0x181)](_0x340f6f)}]};}if(_0x29cb5a===_0x3794d5(0x1b7)){let {alias:_0x43868c,message:_0x15e748}=_0x1f9fe5,_0x3b1b79=await P(_0x3794d5(0x162),{'alias':_0x43868c,'message':_0x15e748,'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x3b1b79)}]};}if(_0x29cb5a===_0x3794d5(0x172)){let _0x47778a=await P(_0x3794d5(0x18d),{});return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON['stringify'](_0x47778a)}]};}return{'content':[{'type':_0x3794d5(0x1a6),'text':JSON[_0x3794d5(0x181)]({'error':_0x3794d5(0x1e4)})}]};});async function u(){const _0x32d053=a0_0x158381;let _0x28dfee=f+_0x32d053(0x1d4)+encodeURIComponent(Z),_0x1cd3e7={};if(X)_0x1cd3e7[_0x32d053(0x1c2)]=_0x32d053(0x19a)+X;Y(_0x32d053(0x198)+_0x28dfee);while(!0x0){try{let _0xedb4a5=await fetch(_0x28dfee,{'headers':_0x1cd3e7});if(!_0xedb4a5['ok']){Y(_0x32d053(0x1dc)+_0xedb4a5[_0x32d053(0x168)]+'\x20'+_0xedb4a5[_0x32d053(0x18e)]),await h(0x1388);continue;}let _0x448791=_0xedb4a5[_0x32d053(0x16e)][_0x32d053(0x1a4)](),_0x2d20df=new TextDecoder(),_0x27dd06='';while(!0x0){let {done:_0x5f0ae6,value:_0x3499eb}=await _0x448791[_0x32d053(0x169)]();if(_0x5f0ae6)break;_0x27dd06+=_0x2d20df[_0x32d053(0x1d0)](_0x3499eb,{'stream':!0x0});let _0x5eaec6=_0x27dd06['split']('\x0a\x0a');_0x27dd06=_0x5eaec6[_0x32d053(0x16f)]()||'';for(let _0x32cad4 of _0x5eaec6){let _0x864d99=_0x32cad4[_0x32d053(0x176)]('\x0a')[_0x32d053(0x16b)](_0x4414ca=>_0x4414ca[_0x32d053(0x1a7)](_0x32d053(0x197)));if(!_0x864d99)continue;try{let _0x5e1b00=JSON[_0x32d053(0x163)](_0x864d99[_0x32d053(0x1d3)](0x6));await S(_0x5e1b00);}catch(_0x210798){Y(_0x32d053(0x185)+_0x210798);}}}Y('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x54d55f){Y(_0x32d053(0x1a8)+_0x54d55f);}await h(0xbb8);}}async function S(_0xc0d174){const _0x918b61=a0_0x158381;if(_0xc0d174[_0x918b61(0x1e2)]==='connected'){Y(_0x918b61(0x1b2)+Z+'\x22');return;}if(_0xc0d174['type']==='new_message'){if(Y(_0x918b61(0x1af)+_0xc0d174[_0x918b61(0x1c9)]+':\x20'+_0xc0d174[_0x918b61(0x188)][_0x918b61(0x1d3)](0x0,0x3c)),await K[_0x918b61(0x17f)]({'method':_0x918b61(0x1e1),'params':{'content':_0xc0d174['message'],'meta':{'sender':_0xc0d174[_0x918b61(0x1c9)]||_0x918b61(0x1a5),'sender_id':'commhub','user':_0xc0d174['from']||_0x918b61(0x1a5),'priority':_0x918b61(0x1bb)}}}),_0xc0d174['message_id'])await P(_0x918b61(0x19e),{'alias':Z,'message_id':_0xc0d174[_0x918b61(0x1e6)]});return;}if(_0xc0d174[_0x918b61(0x1e2)]===_0x918b61(0x1df)||_0xc0d174['type']==='broadcast'){Y('←\x20'+_0xc0d174[_0x918b61(0x1e2)]+':\x20inbox_count='+_0xc0d174[_0x918b61(0x17b)]+'\x20priority='+(_0xc0d174[_0x918b61(0x1ca)]||_0x918b61(0x1bb)));let _0x4aa6ea=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x4aa6ea?.['ok']&&_0x4aa6ea[_0x918b61(0x1d5)]?.[_0x918b61(0x1ba)]>0x0)for(let _0x2213d3 of _0x4aa6ea['messages']){let _0xfd8e97={'sender':_0x2213d3[_0x918b61(0x1c7)]||'hub','sender_id':'commhub','user':_0x2213d3[_0x918b61(0x1c7)]||_0x918b61(0x1a5),'task_id':_0x2213d3['id'],'priority':_0x2213d3[_0x918b61(0x1ca)]||_0x918b61(0x1bb)};k[_0x918b61(0x1c8)](_0x2213d3['id'],_0x2213d3[_0x918b61(0x1c7)]||'hub'),await K['notification']({'method':_0x918b61(0x1e1),'params':{'content':_0x2213d3[_0x918b61(0x179)],'meta':_0xfd8e97}}),Y(_0x918b61(0x17c)+_0x2213d3['id'][_0x918b61(0x1d3)](0x0,0x8)+_0x918b61(0x160)+_0x2213d3[_0x918b61(0x1c7)]+':\x20'+_0x2213d3['content'][_0x918b61(0x1d3)](0x0,0x3c)),await P(_0x918b61(0x19e),{'alias':Z,'message_id':_0x2213d3['id']});}}}function a0_0x54b2(){const _0x399726=['length','normal','application/json','cwd','toTimeString','object','replied','stdin','Authorization','alias','claude-code','Message\x20content','send_reply','from_session','set','from','priority','shutting\x20down,\x20reporting\x20offline...','report_status','result','trim','1764292lwtAte','decode','then','CommHub\x20init\x20failed:\x20','slice','/events/','messages','registered\x20as\x20\x22','warning:\x20could\x20not\x20register:\x20','1206RtchPP','/mcp','SIGINT','number','SSE\x20error:\x20','idle','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','new_task','\x20RESUME_ID=','notifications/claude/channel','type','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','unknown\x20tool','init\x20failed:\x20','message_id','commhub_report_status','commhub_send_task','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','blocked','config.json','catch','\x20from\x20','delete','send_message','parse','Progress\x200-100','40636200nmudAX','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Priority\x20(default:\x20normal)','status','read','\x20CWD=','find','application/json,\x20text/event-stream','indexOf','body','pop','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','stderr','commhub_get_all_status','611952NqEwGM','exit','utf-8','split','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','ENV:\x20URL=','content','18QldZyj','inbox_count','→\x20injected\x20task\x20','92368zOcUxP','4384748kxkWnM','notification','join','stringify','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','POST','working','parse\x20error:\x20','Session\x20alias:\x20','http://127.0.0.1:9200','message','0.3.0','connect','replace','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','get_all_status','statusText','none','get','no\x20response','completed','end','.anet','SSE\x20fatal:\x20','commhub-channel','data:\x20','connecting\x20to\x20','high','Bearer\x20','\x22\x20(','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','3pSDlAv','ack_inbox','cancelled','fatal:\x20','task','failed','commhub_reply','getReader','hub','text','startsWith','SSE\x20connection\x20error:\x20','string','Task\x20content','error','Current\x20task\x20description','session\x20disconnected','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','←\x20message\x20from\x20','...\x20TMUX=','955wcDudw','SSE\x20connected\x20as\x20\x22','.claude/channels/commhub','tmux\x20display-message\x20-p\x20\x27#S\x27','5978182jUEjrb','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','commhub_send_message','tools/call','token'];a0_0x54b2=function(){return _0x399726;};return a0_0x54b2();}async function A(){const _0x3e4c25=a0_0x158381;let _0x4e0b5f=new a0_0x3104be();await K[_0x3e4c25(0x18a)](_0x4e0b5f),Y('MCP\x20stdio\x20connected'),Y('starting\x20SSE\x20listener...'),u()['catch'](_0x159475=>Y(_0x3e4c25(0x195)+_0x159475)),P(_0x3e4c25(0x1cc),{'resume_id':w,'alias':Z,'status':_0x3e4c25(0x1dd),'server':a0_0x592bbe(),'hostname':a0_0x592bbe(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x3e4c25(0x1d1)](()=>Y(_0x3e4c25(0x1d6)+Z+_0x3e4c25(0x19b)+w['slice'](0x0,0x8)+')'))[_0x3e4c25(0x15f)](_0x4d36ad=>Y(_0x3e4c25(0x1d7)+_0x4d36ad)),setInterval(()=>{const _0x4b594f=_0x3e4c25;P(_0x4b594f(0x1cc),{'resume_id':w,'alias':Z,'status':_0x4b594f(0x1dd),'server':a0_0x592bbe(),'hostname':a0_0x592bbe(),'agent':_0x4b594f(0x1c4),'project_dir':process[_0x4b594f(0x1bd)](),'tmux_name':j||void 0x0})[_0x4b594f(0x15f)](_0x4dc7f5=>Y('heartbeat\x20failed:\x20'+_0x4dc7f5));},0x2bf20),Y('ready\x20—\x20waiting\x20for\x20events');}A()[a0_0x158381(0x15f)](_0x2a8255=>{const _0x3a96ed=a0_0x158381;Y(_0x3a96ed(0x1a0)+_0x2a8255),process[_0x3a96ed(0x174)](0x1);});async function N(){const _0x2e996f=a0_0x158381;Y(_0x2e996f(0x1cb)),await P(_0x2e996f(0x1cc),{'resume_id':w,'alias':Z,'status':'error','task':_0x2e996f(0x1ad)})['catch'](()=>{}),process[_0x2e996f(0x174)](0x0);}process[a0_0x158381(0x1c1)]['on'](a0_0x158381(0x193),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x158381(0x1da),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
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",
|
|
@@ -40,13 +40,19 @@
|
|
|
40
40
|
"anet"
|
|
41
41
|
],
|
|
42
42
|
"author": "sleep2agi",
|
|
43
|
-
"license": "
|
|
44
|
-
"homepage": "https://anet.
|
|
43
|
+
"license": "Apache-2.0",
|
|
44
|
+
"homepage": "https://anet.sh",
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
|
47
47
|
"url": "https://github.com/sleep2agi/agent-network",
|
|
48
48
|
"directory": "agent-network"
|
|
49
49
|
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/sleep2agi/agent-network/issues"
|
|
55
|
+
},
|
|
50
56
|
"engines": {
|
|
51
57
|
"bun": ">=1.2.0"
|
|
52
58
|
},
|