@sleep2agi/agent-network 2.2.6 → 2.2.7-preview.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/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_0xe56496=a0_0x21aa;function a0_0x3f8d(){const _0x4a9137=['2578740piEjvK','match','alias','content','agent','signal','6HfLHqt','20919771fedgok','/events/','startsWith','AbortError','heartbeatInterval','body','cwd','name','server','send_message','7136792qcmnvK','Bearer\x20','POST','get_inbox','heartbeatTimer','min','split','196Pibald','sdk','SSE\x20reconnecting\x20in\x20','inbox\x20error:\x20','connected','error','Authorization','stringify','application/json,\x20text/event-stream','resumeId','slice','getReader','data:\x20','broadcast','SSE\x20failed:\x20','message','replace','2.0','send_task','SSE\x20connected','catch','running','sdk-','SSE\x20error:\x20','reconnectDelay','connectSSE','text/event-stream','decode','application/json','processInbox','url','1839250uQdbnk','get_all_status','disconnected','read','text','status','parse','type','/mcp','getAllStatus','sleep','token','toTimeString','99335fIloNt','tools/call','disconnect','log','now','reply','call','messages','result','120378GoPuqt','emit','connect','normal','sseAbort','abort','autoConnect','56176UGbDEl','from_session','registered','offline','pop',']\x20[commhub:','send'];a0_0x3f8d=function(){return _0x4a9137;};return a0_0x3f8d();}(function(_0x34082c,_0x501ea9){const _0x53b2d3=a0_0x21aa,_0x5582ac=_0x34082c();while(!![]){try{const _0x5093cf=-parseInt(_0x53b2d3(0xe3))/0x1+-parseInt(_0x53b2d3(0xd6))/0x2+parseInt(_0x53b2d3(0x100))/0x3*(parseInt(_0x53b2d3(0xf3))/0x4)+-parseInt(_0x53b2d3(0xfa))/0x5+parseInt(_0x53b2d3(0xec))/0x6*(parseInt(_0x53b2d3(0x112))/0x7)+-parseInt(_0x53b2d3(0x10b))/0x8+parseInt(_0x53b2d3(0x101))/0x9;if(_0x5093cf===_0x501ea9)break;else _0x5582ac['push'](_0x5582ac['shift']());}catch(_0x5745a3){_0x5582ac['push'](_0x5582ac['shift']());}}}(a0_0x3f8d,0x77028));import{EventEmitter as a0_0x4ba4d5}from'events';function a0_0x21aa(_0x236b3b,_0x5e9125){_0x236b3b=_0x236b3b-0xc9;const _0x3f8d50=a0_0x3f8d();let _0x21aa57=_0x3f8d50[_0x236b3b];return _0x21aa57;}import{hostname as a0_0x59d8ff}from'os';class T extends a0_0x4ba4d5{[a0_0xe56496(0xd5)];[a0_0xe56496(0xfc)];['token'];['agent'];[a0_0xe56496(0x11b)];[a0_0xe56496(0x105)];['reconnectDelay'];[a0_0xe56496(0x10f)];[a0_0xe56496(0xf0)];[a0_0xe56496(0xcc)]=!0x1;constructor(_0x3ee33a){const _0x5b2b26=a0_0xe56496;super();if(this[_0x5b2b26(0xd5)]=_0x3ee33a[_0x5b2b26(0xd5)][_0x5b2b26(0x122)](/\/$/,''),this[_0x5b2b26(0xfc)]=_0x3ee33a['alias'],this[_0x5b2b26(0xe1)]=_0x3ee33a[_0x5b2b26(0xe1)],this[_0x5b2b26(0xfe)]=_0x3ee33a['agent']||_0x5b2b26(0x113),this[_0x5b2b26(0x11b)]=_0x5b2b26(0xcd)+_0x3ee33a[_0x5b2b26(0xfc)]+'-'+Date[_0x5b2b26(0xe7)]()['toString'](0x24),this['heartbeatInterval']=_0x3ee33a[_0x5b2b26(0x105)]??0x2bf20,this[_0x5b2b26(0xcf)]=_0x3ee33a[_0x5b2b26(0xcf)]??0xbb8,_0x3ee33a[_0x5b2b26(0xf2)]!==!0x1)this[_0x5b2b26(0xee)]();}[a0_0xe56496(0xe6)](_0x39ae2f){const _0x34a88d=a0_0xe56496;console[_0x34a88d(0xe6)]('['+new Date()[_0x34a88d(0xe2)]()[_0x34a88d(0x11c)](0x0,0x8)+_0x34a88d(0xf8)+this[_0x34a88d(0xfc)]+']\x20'+_0x39ae2f);}async['call'](_0xd2f045,_0x130a7c){const _0x2ad07c=a0_0xe56496;let _0x40851a={'Content-Type':_0x2ad07c(0xd3),'Accept':_0x2ad07c(0x11a)};if(this[_0x2ad07c(0xe1)])_0x40851a[_0x2ad07c(0x118)]=_0x2ad07c(0x10c)+this['token'];let _0x2dae39=await(await fetch(this['url']+_0x2ad07c(0xde),{'method':_0x2ad07c(0x10d),'headers':_0x40851a,'body':JSON[_0x2ad07c(0x119)]({'jsonrpc':_0x2ad07c(0x123),'id':Date[_0x2ad07c(0xe7)](),'method':_0x2ad07c(0xe4),'params':{'name':_0xd2f045,'arguments':_0x130a7c}})}))['text'](),_0x5ee0df=_0x2dae39[_0x2ad07c(0xfb)](/data: (.+)/),_0x175e3c=_0x5ee0df?JSON[_0x2ad07c(0xdc)](_0x5ee0df[0x1]):JSON[_0x2ad07c(0xdc)](_0x2dae39),_0x124f37=_0x175e3c?.[_0x2ad07c(0xeb)]?.[_0x2ad07c(0xfd)]?.[0x0]?.[_0x2ad07c(0xda)];return _0x124f37?JSON[_0x2ad07c(0xdc)](_0x124f37):_0x175e3c;}async[a0_0xe56496(0xee)](){const _0x3e0afd=a0_0xe56496;if(this['running'])return;this[_0x3e0afd(0xcc)]=!0x0,await this['status']('idle'),this[_0x3e0afd(0xe6)](_0x3e0afd(0xf5)),this[_0x3e0afd(0x10f)]=setInterval(()=>{const _0x4d9496=_0x3e0afd;this[_0x4d9496(0xdb)]('idle')[_0x4d9496(0xcb)](_0x168bff=>this[_0x4d9496(0xe6)]('heartbeat\x20failed:\x20'+_0x168bff[_0x4d9496(0x121)]));},this['heartbeatInterval']),this[_0x3e0afd(0xd0)]();}async[a0_0xe56496(0xe5)](){const _0x882e0a=a0_0xe56496;if(this[_0x882e0a(0xcc)]=!0x1,this['sseAbort']?.[_0x882e0a(0xf1)](),this['heartbeatTimer'])clearInterval(this[_0x882e0a(0x10f)]);await this[_0x882e0a(0xdb)](_0x882e0a(0xf6))[_0x882e0a(0xcb)](()=>{}),this['log'](_0x882e0a(0xd8));}async[a0_0xe56496(0xf9)](_0x3e3bd5,_0x1c55a3,_0xdec2c7=a0_0xe56496(0xef)){const _0x233664=a0_0xe56496;return this[_0x233664(0xe9)](_0x233664(0xc9),{'alias':_0x3e3bd5,'task':_0x1c55a3,'priority':_0xdec2c7,'from_session':this[_0x233664(0xfc)]});}async[a0_0xe56496(0x121)](_0x5b69c3,_0x5d53d4){const _0x2c7576=a0_0xe56496;return this[_0x2c7576(0xe9)](_0x2c7576(0x10a),{'alias':_0x5b69c3,'message':_0x5d53d4,'from_session':this[_0x2c7576(0xfc)]});}async[a0_0xe56496(0xe8)](_0x1418b7,_0x106c8c,_0x30f7da='completed'){return this['call']('send_reply',{'in_reply_to':_0x1418b7,'text':_0x106c8c,'status':_0x30f7da});}async[a0_0xe56496(0xdb)](_0x368b79,_0x34ceba){const _0x378cd1=a0_0xe56496;return this[_0x378cd1(0xe9)]('report_status',{'resume_id':this[_0x378cd1(0x11b)],'alias':this[_0x378cd1(0xfc)],'status':_0x368b79,'server':a0_0x59d8ff(),'hostname':a0_0x59d8ff(),'agent':this[_0x378cd1(0xfe)],'project_dir':process[_0x378cd1(0x107)](),..._0x34ceba});}async[a0_0xe56496(0xdf)](){const _0x27b375=a0_0xe56496;return this['call'](_0x27b375(0xd7),{});}async[a0_0xe56496(0x11f)](_0x2503e3,_0x12b8af){const _0x2c2b26=a0_0xe56496;return this[_0x2c2b26(0xe9)](_0x2c2b26(0x11f),{'message':_0x2503e3,'filter_server':_0x12b8af?.[_0x2c2b26(0x109)],'filter_status':_0x12b8af?.[_0x2c2b26(0xdb)]});}async['connectSSE'](){const _0x129d93=a0_0xe56496;let _0x3a9d4=encodeURIComponent(this[_0x129d93(0xfc)]),_0x4643b5=this[_0x129d93(0xd5)]+_0x129d93(0x102)+_0x3a9d4,_0x34b290=this[_0x129d93(0xcf)];while(this[_0x129d93(0xcc)]){try{this[_0x129d93(0xf0)]=new AbortController();let _0x32079e={'Accept':_0x129d93(0xd1)};if(this[_0x129d93(0xe1)])_0x32079e[_0x129d93(0x118)]='Bearer\x20'+this[_0x129d93(0xe1)];let _0x4576f3=await fetch(_0x4643b5,{'headers':_0x32079e,'signal':this[_0x129d93(0xf0)][_0x129d93(0xff)]});if(!_0x4576f3['ok']||!_0x4576f3['body']){this[_0x129d93(0xe6)](_0x129d93(0x120)+_0x4576f3[_0x129d93(0xdb)]),await this[_0x129d93(0xe0)](_0x34b290),_0x34b290=Math[_0x129d93(0x110)](_0x34b290*1.5,0xea60);continue;}_0x34b290=this[_0x129d93(0xcf)];let _0x1fecf5=_0x4576f3[_0x129d93(0x106)][_0x129d93(0x11d)](),_0x206f52=new TextDecoder(),_0x2c0fc0='';while(this['running']){let {done:_0x4702c9,value:_0x59f073}=await _0x1fecf5[_0x129d93(0xd9)]();if(_0x4702c9)break;_0x2c0fc0+=_0x206f52[_0x129d93(0xd2)](_0x59f073,{'stream':!0x0});let _0x21ee4b=_0x2c0fc0[_0x129d93(0x111)]('\x0a');_0x2c0fc0=_0x21ee4b[_0x129d93(0xf7)]()||'';for(let _0x343d8e of _0x21ee4b){if(!_0x343d8e[_0x129d93(0x103)](_0x129d93(0x11e)))continue;try{let _0x2f160b=JSON['parse'](_0x343d8e['slice'](0x6));if(_0x2f160b[_0x129d93(0xdd)]==='connected'){this[_0x129d93(0xe6)](_0x129d93(0xca)),this[_0x129d93(0xed)](_0x129d93(0x116));continue;}if(_0x2f160b[_0x129d93(0xdd)]==='new_task'||_0x2f160b[_0x129d93(0xdd)]==='new_message'||_0x2f160b[_0x129d93(0xdd)]===_0x129d93(0x11f))await this[_0x129d93(0xd4)]();}catch{}}}}catch(_0x36c6ac){if(_0x36c6ac[_0x129d93(0x108)]===_0x129d93(0x104))break;this[_0x129d93(0xed)](_0x129d93(0x117),_0x36c6ac),this[_0x129d93(0xe6)](_0x129d93(0xce)+_0x36c6ac[_0x129d93(0x121)]);}if(this[_0x129d93(0xcc)])this[_0x129d93(0xed)](_0x129d93(0xd8)),this[_0x129d93(0xe6)](_0x129d93(0x114)+_0x34b290/0x3e8+'s...'),await this[_0x129d93(0xe0)](_0x34b290),_0x34b290=Math[_0x129d93(0x110)](_0x34b290*1.5,0xea60);}}async[a0_0xe56496(0xd4)](){const _0x59e435=a0_0xe56496;try{let _0x5bde6d=(await this[_0x59e435(0xe9)](_0x59e435(0x10e),{'alias':this[_0x59e435(0xfc)],'limit':0xa}))?.[_0x59e435(0xea)]||[];for(let _0x4a1fee of _0x5bde6d)await this['call']('ack_inbox',{'alias':this['alias'],'message_id':_0x4a1fee['id']}),this[_0x59e435(0xe6)]('←\x20'+_0x4a1fee[_0x59e435(0xf4)]+':\x20'+_0x4a1fee[_0x59e435(0xfd)][_0x59e435(0x11c)](0x0,0x3c)),this[_0x59e435(0xed)]('task',_0x4a1fee),this[_0x59e435(0xed)](_0x59e435(0x121),_0x4a1fee);}catch(_0x2e008e){this['log'](_0x59e435(0x115)+_0x2e008e[_0x59e435(0x121)]);}}[a0_0xe56496(0xe0)](_0x4f07db){return new Promise(_0x39f9c6=>setTimeout(_0x39f9c6,_0x4f07db));}}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_0x4591e0=a0_0x3493;(function(_0x881268,_0x3dd974){const _0x338b9e=a0_0x3493,_0x214f61=_0x881268();while(!![]){try{const _0x1e5920=parseInt(_0x338b9e(0x16c))/0x1+parseInt(_0x338b9e(0xf4))/0x2+parseInt(_0x338b9e(0x113))/0x3+parseInt(_0x338b9e(0x147))/0x4+parseInt(_0x338b9e(0x15a))/0x5*(parseInt(_0x338b9e(0x141))/0x6)+parseInt(_0x338b9e(0x15e))/0x7*(-parseInt(_0x338b9e(0x115))/0x8)+-parseInt(_0x338b9e(0x142))/0x9;if(_0x1e5920===_0x3dd974)break;else _0x214f61['push'](_0x214f61['shift']());}catch(_0x4832b9){_0x214f61['push'](_0x214f61['shift']());}}}(a0_0xa148,0x65731));import{readFileSync as a0_0x5ecde2,existsSync as a0_0x82ca33}from'fs';import{randomUUID as a0_0xb40cef}from'crypto';function a0_0xa148(){const _0x235aee=['Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','status','\x20CWD=','SSE\x20fatal:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','commhub_send_task','commhub_send_message','commhub','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','find','SSE\x20stream\x20ended,\x20reconnecting...','text','idle','send_task','hub','utf-8','message','then','fatal:\x20','broadcast','send_message','ready\x20—\x20waiting\x20for\x20events','shutting\x20down,\x20reporting\x20offline...','2.0','\x20priority=','config.json','2279724GqhmAt','14914836QoBFwz','content','MCP\x20stdio\x20connected','/events/','split','2504192KLrxUI','task','\x22\x20(','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','send_reply','initialize','replied','from_session',':\x20inbox_count=','SSE\x20error:\x20','\x20from\x20','http://127.0.0.1:9200','message_id','read','working','claude-code','POST','session\x20disconnected','stdin','5OWjraN','Task\x20content','report_status','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','561981wdMKCQ','error','2025-03-26','get','←\x20message\x20from\x20','startsWith','slice','init\x20failed:\x20','from','low','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','inbox_count','none','stderr','723879BqyiEv','heartbeat\x20failed:\x20','/mcp','set','type','catch','data:\x20','SSE\x20connected\x20as\x20\x22','in_progress','Session\x20alias:\x20','getReader','blocked','stringify','replace','registered\x20as\x20\x22','0.3.0','1249606saqPMy','length','starting\x20SSE\x20listener...','messages','notification','Priority\x20(default:\x20normal)','notifications/claude/channel','Current\x20task\x20description','trim','CommHub\x20init\x20failed:\x20','Progress\x200-100','normal','high','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','completed','alias','failed','cwd','connect','unknown\x20tool','result','commhub_get_all_status','end','application/json','commhub-channel','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','toTimeString','new_message','Bearer\x20','commhub_reply','connected','1321812NpWIPu','commhub_report_status','72qsxboh','no\x20response','object','parse','pop','priority','ack_inbox','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','cancelled','statusText','.env','→\x20injected\x20task\x20','token','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','string','setRequestHandler','Target\x20session\x20alias','delete'];a0_0xa148=function(){return _0x235aee;};return a0_0xa148();}import{join as a0_0xdce509}from'path';function a0_0x3493(_0x424867,_0x1d91ca){_0x424867=_0x424867-0xee;const _0xa148c0=a0_0xa148();let _0x3493ae=_0xa148c0[_0x424867];return _0x3493ae;}import{hostname as a0_0x4d297a}from'os';import{execSync as a0_0x13af87}from'child_process';import{Server as a0_0x14e982}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x204c7c}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2095c0,CallToolRequestSchema as a0_0x53b12e}from'@modelcontextprotocol/sdk/types.js';function p(_0x54ab75){const _0x267a30=a0_0x3493;if(!a0_0x82ca33(_0x54ab75))return;for(let _0x47d731 of a0_0x5ecde2(_0x54ab75,_0x267a30(0x136))[_0x267a30(0x146)]('\x0a')){let _0x4d23a9=_0x47d731[_0x267a30(0xfc)]();if(!_0x4d23a9||_0x4d23a9[_0x267a30(0x163)]('#'))continue;let _0x22010f=_0x4d23a9['indexOf']('=');if(_0x22010f<0x0)continue;let _0x5b18f9=_0x4d23a9['slice'](0x0,_0x22010f)[_0x267a30(0xfc)](),_0x7dac86=_0x4d23a9[_0x267a30(0x164)](_0x22010f+0x1)[_0x267a30(0xfc)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x5b18f9])process.env[_0x5b18f9]=_0x7dac86;}}var C=process.env.HOME||'~',T=a0_0xdce509(C,'.claude/channels/commhub');p(a0_0xdce509(T,a0_0x4591e0(0x11f)));var L=process[a0_0x4591e0(0x105)]()[a0_0x4591e0(0xf1)](/\//g,'-');p(a0_0xdce509(T,L,a0_0x4591e0(0x11f)));function U(){const _0x2d7f11=a0_0x4591e0;try{return a0_0x13af87(_0x2d7f11(0x12b),{'encoding':'utf-8','timeout':0x7d0})[_0x2d7f11(0xfc)]();}catch{return'';}}function v(){const _0x402950=a0_0x4591e0;try{let _0x276d1d=a0_0xdce509(C,'.anet',_0x402950(0x140));if(a0_0x82ca33(_0x276d1d))return JSON['parse'](a0_0x5ecde2(_0x276d1d,_0x402950(0x136)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x4591e0(0x135)]||a0_0x4591e0(0x152),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x4d297a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xb40cef(),X=process.env.COMMHUB_TOKEN||H[a0_0x4591e0(0x121)]||'';function Y(_0x4ab43a){const _0x260d69=a0_0x4591e0;let _0xfd2aa9=new Date()[_0x260d69(0x10e)]()['slice'](0x0,0x8);process[_0x260d69(0x16b)]['write']('['+_0xfd2aa9+']\x20[commhub]\x20'+_0x4ab43a+'\x0a');}function h(_0x2427f6){return new Promise(_0x41533c=>setTimeout(_0x41533c,_0x2427f6));}Y('ENV:\x20URL='+f+'\x20ALIAS='+Z+'\x20RESUME_ID='+w['slice'](0x0,0x8)+'...\x20TMUX='+(j||a0_0x4591e0(0x16a))+a0_0x4591e0(0x129)+process['cwd']()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x14e982({'name':a0_0x4591e0(0x10c),'version':a0_0x4591e0(0xf3)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x4591e0(0x10d),a0_0x4591e0(0x15d),a0_0x4591e0(0x101),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x4591e0(0x175)+Z]['join']('\x0a')});K['setRequestHandler'](a0_0x2095c0,async()=>({'tools':[{'name':a0_0x4591e0(0x111),'description':a0_0x4591e0(0x122),'inputSchema':{'type':a0_0x4591e0(0x117),'properties':{'task_id':{'type':a0_0x4591e0(0x123),'description':a0_0x4591e0(0x168)},'text':{'type':'string','description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x4591e0(0x123),'enum':[a0_0x4591e0(0x102),a0_0x4591e0(0x104),'cancelled',a0_0x4591e0(0xef),a0_0x4591e0(0x15f),a0_0x4591e0(0x174)],'description':a0_0x4591e0(0x11c)}},'required':[a0_0x4591e0(0x132)]}},{'name':a0_0x4591e0(0x114),'description':a0_0x4591e0(0x14a),'inputSchema':{'type':a0_0x4591e0(0x117),'properties':{'status':{'type':a0_0x4591e0(0x123),'enum':[a0_0x4591e0(0x155),a0_0x4591e0(0x133),a0_0x4591e0(0xef),a0_0x4591e0(0x15f)]},'task':{'type':a0_0x4591e0(0x123),'description':a0_0x4591e0(0xfb)},'progress':{'type':'number','description':a0_0x4591e0(0xfe)}},'required':['status']}},{'name':a0_0x4591e0(0x12c),'description':a0_0x4591e0(0x12f),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x4591e0(0x123),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x4591e0(0x123),'description':a0_0x4591e0(0x15b)},'priority':{'type':'string','enum':[a0_0x4591e0(0x100),a0_0x4591e0(0xff),a0_0x4591e0(0x167)],'description':a0_0x4591e0(0xf9)}},'required':[a0_0x4591e0(0x103),a0_0x4591e0(0x148)]}},{'name':a0_0x4591e0(0x12d),'description':a0_0x4591e0(0x127),'inputSchema':{'type':a0_0x4591e0(0x117),'properties':{'alias':{'type':a0_0x4591e0(0x123),'description':a0_0x4591e0(0x125)},'message':{'type':a0_0x4591e0(0x123),'description':'Message\x20content'}},'required':[a0_0x4591e0(0x103),a0_0x4591e0(0x137)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':'object','properties':{}}}]}));async function P(_0xfe3fb5,_0x1d9c3d){const _0x13f62b=a0_0x4591e0;let _0x20b663=await fetch(f+_0x13f62b(0x16e),{'method':'POST','headers':{'Content-Type':_0x13f62b(0x10b),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x13f62b(0x110)+X}:{}},'body':JSON[_0x13f62b(0xf0)]({'jsonrpc':_0x13f62b(0x13e),'id':0x1,'method':_0x13f62b(0x14c),'params':{'protocolVersion':_0x13f62b(0x160),'capabilities':{},'clientInfo':{'name':_0x13f62b(0x10c),'version':_0x13f62b(0xf3)}}})});if(!_0x20b663['ok']){let _0x4be6d2=await _0x20b663['text']();return Y(_0x13f62b(0xfd)+_0x20b663[_0x13f62b(0x128)]+'\x20'+_0x4be6d2[_0x13f62b(0x164)](0x0,0x64)),{'ok':!0x1,'error':_0x13f62b(0x165)+_0x20b663[_0x13f62b(0x128)]};}await _0x20b663[_0x13f62b(0x132)]();let _0x2a7842=(await(await fetch(f+_0x13f62b(0x16e),{'method':_0x13f62b(0x157),'headers':{'Content-Type':_0x13f62b(0x10b),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x13f62b(0x110)+X}:{}},'body':JSON['stringify']({'jsonrpc':'2.0','id':0x2,'method':'tools/call','params':{'name':_0xfe3fb5,'arguments':_0x1d9c3d}})}))['text']())[_0x13f62b(0x146)]('\x0a')[_0x13f62b(0x130)](_0x3471ef=>_0x3471ef[_0x13f62b(0x163)]('data:\x20'));if(_0x2a7842){let _0x312c6e=JSON[_0x13f62b(0x118)](_0x2a7842['slice'](0x6));return _0x312c6e?.[_0x13f62b(0x108)]?.[_0x13f62b(0x143)]?.[0x0]?.[_0x13f62b(0x132)]?JSON[_0x13f62b(0x118)](_0x312c6e[_0x13f62b(0x108)][_0x13f62b(0x143)][0x0][_0x13f62b(0x132)]):_0x312c6e;}return{'ok':!0x1,'error':_0x13f62b(0x116)};}K[a0_0x4591e0(0x124)](a0_0x53b12e,async _0x17c716=>{const _0x2a3b8f=a0_0x4591e0;let {name:_0x2c883b,arguments:_0x198854}=_0x17c716['params'];if(_0x2c883b==='commhub_reply'){let {task_id:_0x5acee3,text:_0x73541d,status:_0x264cdc}=_0x198854;if(_0x264cdc==='completed'||_0x264cdc==='failed'||_0x264cdc===_0x2a3b8f(0x11d)){let _0x2580c0=_0x264cdc===_0x2a3b8f(0x102)?_0x2a3b8f(0x14d):_0x264cdc,_0x4f6cf=_0x5acee3?k[_0x2a3b8f(0x161)](_0x5acee3)||_0x2a3b8f(0x135):_0x2a3b8f(0x135),_0x3e4de9=await P(_0x2a3b8f(0x14b),{'alias':_0x4f6cf,'text':_0x73541d,'in_reply_to':_0x5acee3||void 0x0,'status':_0x2580c0,'from_session':Z});if(_0x5acee3)k[_0x2a3b8f(0x126)](_0x5acee3);return{'content':[{'type':'text','text':JSON[_0x2a3b8f(0xf0)](_0x3e4de9)}]};}let _0x378829=await P('report_status',{'resume_id':w,'alias':Z,'status':_0x264cdc==='blocked'?_0x2a3b8f(0xef):_0x264cdc===_0x2a3b8f(0x15f)?'error':'working','task':_0x73541d[_0x2a3b8f(0x164)](0x0,0xc8),'output':_0x73541d});return{'content':[{'type':_0x2a3b8f(0x132),'text':JSON[_0x2a3b8f(0xf0)](_0x378829)}]};}if(_0x2c883b===_0x2a3b8f(0x114)){let {status:_0x4175e2,task:_0x48a8e3,progress:_0x39f68d}=_0x198854,_0x4724e9=await P(_0x2a3b8f(0x15c),{'resume_id':w,'alias':Z,'status':_0x4175e2,'task':_0x48a8e3,'progress':_0x39f68d});return{'content':[{'type':_0x2a3b8f(0x132),'text':JSON[_0x2a3b8f(0xf0)](_0x4724e9)}]};}if(_0x2c883b==='commhub_send_task'){let {alias:_0x1c8b6e,task:_0x183b12,priority:_0x573c1b}=_0x198854,_0x389ba1=await P(_0x2a3b8f(0x134),{'alias':_0x1c8b6e,'task':_0x183b12,'priority':_0x573c1b||'normal','from_session':Z});return{'content':[{'type':_0x2a3b8f(0x132),'text':JSON['stringify'](_0x389ba1)}]};}if(_0x2c883b===_0x2a3b8f(0x12d)){let {alias:_0x437142,message:_0x255a72}=_0x198854,_0x25e080=await P(_0x2a3b8f(0x13b),{'alias':_0x437142,'message':_0x255a72,'from_session':Z});return{'content':[{'type':_0x2a3b8f(0x132),'text':JSON[_0x2a3b8f(0xf0)](_0x25e080)}]};}if(_0x2c883b===_0x2a3b8f(0x109)){let _0x1fdc1a=await P('get_all_status',{});return{'content':[{'type':_0x2a3b8f(0x132),'text':JSON[_0x2a3b8f(0xf0)](_0x1fdc1a)}]};}return{'content':[{'type':'text','text':JSON[_0x2a3b8f(0xf0)]({'error':_0x2a3b8f(0x107)})}]};});async function u(){const _0x3a4239=a0_0x4591e0;let _0x4ad2ec=f+_0x3a4239(0x145)+encodeURIComponent(Z),_0x19c109={};if(X)_0x19c109['Authorization']=_0x3a4239(0x110)+X;Y('connecting\x20to\x20'+_0x4ad2ec);while(!0x0){try{let _0x58b6c9=await fetch(_0x4ad2ec,{'headers':_0x19c109});if(!_0x58b6c9['ok']){Y(_0x3a4239(0x150)+_0x58b6c9['status']+'\x20'+_0x58b6c9[_0x3a4239(0x11e)]),await h(0x1388);continue;}let _0x28488c=_0x58b6c9['body'][_0x3a4239(0xee)](),_0x2a9049=new TextDecoder(),_0x1c0849='';while(!0x0){let {done:_0x3e6a2e,value:_0x4c612c}=await _0x28488c[_0x3a4239(0x154)]();if(_0x3e6a2e)break;_0x1c0849+=_0x2a9049['decode'](_0x4c612c,{'stream':!0x0});let _0x44a8cf=_0x1c0849['split']('\x0a\x0a');_0x1c0849=_0x44a8cf[_0x3a4239(0x119)]()||'';for(let _0xd55b31 of _0x44a8cf){let _0x1585d3=_0xd55b31[_0x3a4239(0x146)]('\x0a')[_0x3a4239(0x130)](_0x349fc0=>_0x349fc0[_0x3a4239(0x163)](_0x3a4239(0x172)));if(!_0x1585d3)continue;try{let _0x278d45=JSON[_0x3a4239(0x118)](_0x1585d3[_0x3a4239(0x164)](0x6));await S(_0x278d45);}catch(_0x5bc5ff){Y('parse\x20error:\x20'+_0x5bc5ff);}}}Y(_0x3a4239(0x131));}catch(_0xa8918c){Y('SSE\x20connection\x20error:\x20'+_0xa8918c);}await h(0xbb8);}}async function S(_0x3ef172){const _0x5a5ace=a0_0x4591e0;if(_0x3ef172[_0x5a5ace(0x170)]===_0x5a5ace(0x112)){Y(_0x5a5ace(0x173)+Z+'\x22');return;}if(_0x3ef172[_0x5a5ace(0x170)]===_0x5a5ace(0x10f)){if(Y(_0x5a5ace(0x162)+_0x3ef172[_0x5a5ace(0x166)]+':\x20'+_0x3ef172[_0x5a5ace(0x137)][_0x5a5ace(0x164)](0x0,0x3c)),await K[_0x5a5ace(0xf8)]({'method':'notifications/claude/channel','params':{'content':_0x3ef172[_0x5a5ace(0x137)],'meta':{'sender':_0x3ef172[_0x5a5ace(0x166)]||'hub','sender_id':_0x5a5ace(0x12e),'user':_0x3ef172['from']||_0x5a5ace(0x135),'priority':_0x5a5ace(0xff)}}}),_0x3ef172[_0x5a5ace(0x153)])await P(_0x5a5ace(0x11b),{'alias':Z,'message_id':_0x3ef172['message_id']});return;}if(_0x3ef172[_0x5a5ace(0x170)]==='new_task'||_0x3ef172['type']===_0x5a5ace(0x13a)){Y('←\x20'+_0x3ef172[_0x5a5ace(0x170)]+_0x5a5ace(0x14f)+_0x3ef172[_0x5a5ace(0x169)]+_0x5a5ace(0x13f)+(_0x3ef172[_0x5a5ace(0x11a)]||'normal'));let _0x346f5a=await P('get_inbox',{'alias':Z,'limit':0x5});if(_0x346f5a?.['ok']&&_0x346f5a[_0x5a5ace(0xf7)]?.[_0x5a5ace(0xf5)]>0x0)for(let _0x20fa7b of _0x346f5a[_0x5a5ace(0xf7)]){let _0x1b5ae0={'sender':_0x20fa7b['from_session']||_0x5a5ace(0x135),'sender_id':_0x5a5ace(0x12e),'user':_0x20fa7b[_0x5a5ace(0x14e)]||_0x5a5ace(0x135),'task_id':_0x20fa7b['id'],'priority':_0x20fa7b[_0x5a5ace(0x11a)]||_0x5a5ace(0xff)};k[_0x5a5ace(0x16f)](_0x20fa7b['id'],_0x20fa7b[_0x5a5ace(0x14e)]||'hub'),await K[_0x5a5ace(0xf8)]({'method':_0x5a5ace(0xfa),'params':{'content':_0x20fa7b[_0x5a5ace(0x143)],'meta':_0x1b5ae0}}),Y(_0x5a5ace(0x120)+_0x20fa7b['id']['slice'](0x0,0x8)+_0x5a5ace(0x151)+_0x20fa7b[_0x5a5ace(0x14e)]+':\x20'+_0x20fa7b[_0x5a5ace(0x143)]['slice'](0x0,0x3c)),await P(_0x5a5ace(0x11b),{'alias':Z,'message_id':_0x20fa7b['id']});}}}async function A(){const _0x5d603f=a0_0x4591e0;let _0x398224=new a0_0x204c7c();await K[_0x5d603f(0x106)](_0x398224),Y(_0x5d603f(0x144)),Y(_0x5d603f(0xf6)),u()[_0x5d603f(0x171)](_0x50c572=>Y(_0x5d603f(0x12a)+_0x50c572)),P(_0x5d603f(0x15c),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x4d297a(),'hostname':a0_0x4d297a(),'agent':_0x5d603f(0x156),'project_dir':process[_0x5d603f(0x105)](),'tmux_name':j||void 0x0})[_0x5d603f(0x138)](()=>Y(_0x5d603f(0xf2)+Z+_0x5d603f(0x149)+w['slice'](0x0,0x8)+')'))[_0x5d603f(0x171)](_0x5d81a9=>Y('warning:\x20could\x20not\x20register:\x20'+_0x5d81a9)),setInterval(()=>{const _0x2a2505=_0x5d603f;P(_0x2a2505(0x15c),{'resume_id':w,'alias':Z,'status':_0x2a2505(0x133),'server':a0_0x4d297a(),'hostname':a0_0x4d297a(),'agent':'claude-code','project_dir':process[_0x2a2505(0x105)](),'tmux_name':j||void 0x0})[_0x2a2505(0x171)](_0x459243=>Y(_0x2a2505(0x16d)+_0x459243));},0x2bf20),Y(_0x5d603f(0x13c));}A()[a0_0x4591e0(0x171)](_0x25f99b=>{const _0x14e72f=a0_0x4591e0;Y(_0x14e72f(0x139)+_0x25f99b),process['exit'](0x1);});async function N(){const _0x155c56=a0_0x4591e0;Y(_0x155c56(0x13d)),await P(_0x155c56(0x15c),{'resume_id':w,'alias':Z,'status':_0x155c56(0x15f),'task':_0x155c56(0x158)})['catch'](()=>{}),process['exit'](0x0);}process[a0_0x4591e0(0x159)]['on'](a0_0x4591e0(0x10a),()=>N()),process['on']('SIGTERM',()=>N()),process['on']('SIGINT',()=>N());
|
|
2
|
+
const a0_0x2e1510=a0_0x5823;(function(_0x2d5b84,_0x4e7b8b){const _0x537a52=a0_0x5823,_0x312afe=_0x2d5b84();while(!![]){try{const _0x5656ec=-parseInt(_0x537a52(0x22f))/0x1*(-parseInt(_0x537a52(0x230))/0x2)+parseInt(_0x537a52(0x207))/0x3+parseInt(_0x537a52(0x266))/0x4+-parseInt(_0x537a52(0x224))/0x5+-parseInt(_0x537a52(0x272))/0x6+parseInt(_0x537a52(0x256))/0x7*(-parseInt(_0x537a52(0x265))/0x8)+parseInt(_0x537a52(0x26a))/0x9*(parseInt(_0x537a52(0x24b))/0xa);if(_0x5656ec===_0x4e7b8b)break;else _0x312afe['push'](_0x312afe['shift']());}catch(_0x34247f){_0x312afe['push'](_0x312afe['shift']());}}}(a0_0x352f,0xd917d));import{readFileSync as a0_0x566543,existsSync as a0_0xe8655c}from'fs';import{randomUUID as a0_0x150588}from'crypto';import{join as a0_0x11249b}from'path';import{hostname as a0_0x56c48a}from'os';import{execSync as a0_0x1c8edb}from'child_process';import{Server as a0_0x288d38}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x352f(){const _0x2a49dc=['ready\x20—\x20waiting\x20for\x20events','parse','init\x20failed:\x20','connected','priority','starting\x20SSE\x20listener...','messages','toTimeString','...\x20TMUX=','replied','send_message','commhub_reply','statusText','high','stdin','claude-code','SSE\x20connected\x20as\x20\x22','set','getReader','\x20ALIAS=','12923410ZuoMia','normal','commhub','config.json','get_inbox','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','ack_inbox','slice','setRequestHandler','\x20priority=','catch','7BfjRDK','SSE\x20fatal:\x20','trim','send_reply','replace','then','←\x20message\x20from\x20','Reply\x20text\x20/\x20result\x20summary','parse\x20error:\x20','failed','Bearer\x20','message_id','notification','CommHub\x20init\x20failed:\x20','object','13991280YXUKFh','5003912eYwmhn','result','number','delete','27bMUHPx','stderr','ENV:\x20URL=','working','length','content','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','error','9976062tajeoo','idle','new_task','Session\x20alias:\x20','status','alias','unknown\x20tool','registered\x20as\x20\x22','cwd','application/json','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','commhub_send_message','0.3.0','connecting\x20to\x20','type','connect','initialize','\x22\x20(','split','string','read','\x20from\x20','SSE\x20connection\x20error:\x20','Target\x20session\x20alias','SIGTERM','application/json,\x20text/event-stream','\x20RESUME_ID=','report_status','/events/',':\x20inbox_count=','notifications/claude/channel','session\x20disconnected','.env','find','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','stringify','2243166alxEXN','token','join','tmux\x20display-message\x20-p\x20\x27#S\x27','cancelled','from','\x20PROJECT_ENV=','exit','utf-8','commhub_report_status','from_session','hub','Authorization','broadcast','Progress\x200-100','get','\x20CWD=','commhub_send_task','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','send_task','2.0','commhub-channel','text','.anet','message','/mcp','data:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','startsWith','7996710UdOmQN','POST','warning:\x20could\x20not\x20register:\x20','decode','indexOf','.claude/channels/commhub','SSE\x20stream\x20ended,\x20reconnecting...','→\x20injected\x20task\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','completed','24419Ouhdga','2RbquUu','none','MCP\x20stdio\x20connected','get_all_status','Message\x20content','blocked','new_message'];a0_0x352f=function(){return _0x2a49dc;};return a0_0x352f();}import{StdioServerTransport as a0_0x14ed2c}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x426b8c,CallToolRequestSchema as a0_0x2eadca}from'@modelcontextprotocol/sdk/types.js';function p(_0x571ea7){const _0x162c31=a0_0x5823;if(!a0_0xe8655c(_0x571ea7))return;for(let _0x266154 of a0_0x566543(_0x571ea7,_0x162c31(0x20f))['split']('\x0a')){let _0x59dd0d=_0x266154[_0x162c31(0x258)]();if(!_0x59dd0d||_0x59dd0d[_0x162c31(0x223)]('#'))continue;let _0x1ad316=_0x59dd0d[_0x162c31(0x228)]('=');if(_0x1ad316<0x0)continue;let _0x234343=_0x59dd0d['slice'](0x0,_0x1ad316)['trim'](),_0x2fd496=_0x59dd0d[_0x162c31(0x252)](_0x1ad316+0x1)['trim']()[_0x162c31(0x25a)](/^["']|["']$/g,'');if(!process.env[_0x234343])process.env[_0x234343]=_0x2fd496;}}var C=process.env.HOME||'~',T=a0_0x11249b(C,a0_0x2e1510(0x229));p(a0_0x11249b(T,a0_0x2e1510(0x203)));function a0_0x5823(_0x4f71a5,_0x529631){_0x4f71a5=_0x4f71a5-0x1e6;const _0x352fb6=a0_0x352f();let _0x582332=_0x352fb6[_0x4f71a5];return _0x582332;}var L=process[a0_0x2e1510(0x1eb)]()['replace'](/\//g,'-');p(a0_0x11249b(T,L,a0_0x2e1510(0x203)));function U(){const _0x48892f=a0_0x2e1510;try{return a0_0x1c8edb(_0x48892f(0x20a),{'encoding':_0x48892f(0x20f),'timeout':0x7d0})[_0x48892f(0x258)]();}catch{return'';}}function v(){const _0x402d93=a0_0x2e1510;try{let _0x5a130d=a0_0x11249b(C,_0x402d93(0x21e),_0x402d93(0x24e));if(a0_0xe8655c(_0x5a130d))return JSON[_0x402d93(0x238)](a0_0x566543(_0x5a130d,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x2e1510(0x212)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x56c48a(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x150588(),X=process.env.COMMHUB_TOKEN||H[a0_0x2e1510(0x208)]||'';function Y(_0x23c53e){const _0x11f672=a0_0x2e1510;let _0x105ea7=new Date()[_0x11f672(0x23e)]()[_0x11f672(0x252)](0x0,0x8);process[_0x11f672(0x26b)]['write']('['+_0x105ea7+']\x20[commhub]\x20'+_0x23c53e+'\x0a');}function h(_0x3badb9){return new Promise(_0x52d519=>setTimeout(_0x52d519,_0x3badb9));}Y(a0_0x2e1510(0x26c)+f+a0_0x2e1510(0x24a)+Z+a0_0x2e1510(0x1fd)+w[a0_0x2e1510(0x252)](0x0,0x8)+a0_0x2e1510(0x23f)+(j||a0_0x2e1510(0x231))+a0_0x2e1510(0x217)+process['cwd']()+a0_0x2e1510(0x20d)+L);var k=new Map(),K=new a0_0x288d38({'name':a0_0x2e1510(0x21c),'version':a0_0x2e1510(0x1ef)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2e1510(0x250),a0_0x2e1510(0x22c),a0_0x2e1510(0x219),a0_0x2e1510(0x205),a0_0x2e1510(0x1e6)+Z][a0_0x2e1510(0x209)]('\x0a')});K[a0_0x2e1510(0x253)](a0_0x426b8c,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x2e1510(0x22d),'inputSchema':{'type':a0_0x2e1510(0x264),'properties':{'task_id':{'type':a0_0x2e1510(0x1f6),'description':a0_0x2e1510(0x222)},'text':{'type':a0_0x2e1510(0x1f6),'description':a0_0x2e1510(0x25d)},'status':{'type':a0_0x2e1510(0x1f6),'enum':[a0_0x2e1510(0x22e),a0_0x2e1510(0x25f),a0_0x2e1510(0x20b),'blocked',a0_0x2e1510(0x271),'in_progress'],'description':a0_0x2e1510(0x1ed)}},'required':[a0_0x2e1510(0x21d)]}},{'name':a0_0x2e1510(0x210),'description':a0_0x2e1510(0x270),'inputSchema':{'type':a0_0x2e1510(0x264),'properties':{'status':{'type':a0_0x2e1510(0x1f6),'enum':[a0_0x2e1510(0x26d),a0_0x2e1510(0x273),a0_0x2e1510(0x235),a0_0x2e1510(0x271)]},'task':{'type':a0_0x2e1510(0x1f6),'description':'Current\x20task\x20description'},'progress':{'type':a0_0x2e1510(0x268),'description':a0_0x2e1510(0x215)}},'required':[a0_0x2e1510(0x1e7)]}},{'name':a0_0x2e1510(0x218),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2e1510(0x264),'properties':{'alias':{'type':'string','description':'Target\x20session\x20alias'},'task':{'type':a0_0x2e1510(0x1f6),'description':'Task\x20content'},'priority':{'type':'string','enum':[a0_0x2e1510(0x244),a0_0x2e1510(0x24c),'low'],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x2e1510(0x1e8),'task']}},{'name':a0_0x2e1510(0x1ee),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x2e1510(0x264),'properties':{'alias':{'type':a0_0x2e1510(0x1f6),'description':a0_0x2e1510(0x1fa)},'message':{'type':'string','description':a0_0x2e1510(0x234)}},'required':[a0_0x2e1510(0x1e8),a0_0x2e1510(0x21f)]}},{'name':'commhub_get_all_status','description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x2e1510(0x264),'properties':{}}}]}));async function P(_0x2ca91c,_0x3d91a3){const _0x148e70=a0_0x2e1510;let _0x359971=await fetch(f+_0x148e70(0x220),{'method':_0x148e70(0x225),'headers':{'Content-Type':_0x148e70(0x1ec),'Accept':_0x148e70(0x1fc),...X?{'Authorization':_0x148e70(0x260)+X}:{}},'body':JSON[_0x148e70(0x206)]({'jsonrpc':_0x148e70(0x21b),'id':0x1,'method':_0x148e70(0x1f3),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x148e70(0x21c),'version':_0x148e70(0x1ef)}}})});if(!_0x359971['ok']){let _0x5c68b9=await _0x359971['text']();return Y(_0x148e70(0x263)+_0x359971[_0x148e70(0x1e7)]+'\x20'+_0x5c68b9['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x148e70(0x239)+_0x359971[_0x148e70(0x1e7)]};}await _0x359971[_0x148e70(0x21d)]();let _0x320e80=(await(await fetch(f+_0x148e70(0x220),{'method':_0x148e70(0x225),'headers':{'Content-Type':_0x148e70(0x1ec),'Accept':_0x148e70(0x1fc),...X?{'Authorization':_0x148e70(0x260)+X}:{}},'body':JSON[_0x148e70(0x206)]({'jsonrpc':_0x148e70(0x21b),'id':0x2,'method':'tools/call','params':{'name':_0x2ca91c,'arguments':_0x3d91a3}})}))[_0x148e70(0x21d)]())[_0x148e70(0x1f5)]('\x0a')[_0x148e70(0x204)](_0x1bd091=>_0x1bd091[_0x148e70(0x223)](_0x148e70(0x221)));if(_0x320e80){let _0x533f65=JSON['parse'](_0x320e80[_0x148e70(0x252)](0x6));return _0x533f65?.[_0x148e70(0x267)]?.['content']?.[0x0]?.[_0x148e70(0x21d)]?JSON[_0x148e70(0x238)](_0x533f65['result'][_0x148e70(0x26f)][0x0][_0x148e70(0x21d)]):_0x533f65;}return{'ok':!0x1,'error':'no\x20response'};}K['setRequestHandler'](a0_0x2eadca,async _0x3607fd=>{const _0x4a6fa7=a0_0x2e1510;let {name:_0x3d6d5e,arguments:_0x134181}=_0x3607fd['params'];if(_0x3d6d5e===_0x4a6fa7(0x242)){let {task_id:_0x307ff9,text:_0x51b5ef,status:_0x41fc93}=_0x134181;if(_0x41fc93==='completed'||_0x41fc93===_0x4a6fa7(0x25f)||_0x41fc93===_0x4a6fa7(0x20b)){let _0x317d17=_0x41fc93===_0x4a6fa7(0x22e)?_0x4a6fa7(0x240):_0x41fc93,_0x275754=_0x307ff9?k[_0x4a6fa7(0x216)](_0x307ff9)||'hub':_0x4a6fa7(0x212),_0x13aea6=await P(_0x4a6fa7(0x259),{'alias':_0x275754,'text':_0x51b5ef,'in_reply_to':_0x307ff9||void 0x0,'status':_0x317d17,'from_session':Z});if(_0x307ff9)k[_0x4a6fa7(0x269)](_0x307ff9);return{'content':[{'type':'text','text':JSON[_0x4a6fa7(0x206)](_0x13aea6)}]};}let _0xee553e=await P(_0x4a6fa7(0x1fe),{'resume_id':w,'alias':Z,'status':_0x41fc93===_0x4a6fa7(0x235)?'blocked':_0x41fc93===_0x4a6fa7(0x271)?_0x4a6fa7(0x271):'working','task':_0x51b5ef[_0x4a6fa7(0x252)](0x0,0xc8),'output':_0x51b5ef});return{'content':[{'type':_0x4a6fa7(0x21d),'text':JSON[_0x4a6fa7(0x206)](_0xee553e)}]};}if(_0x3d6d5e===_0x4a6fa7(0x210)){let {status:_0x414778,task:_0x3a82dc,progress:_0x56cf93}=_0x134181,_0x3d5420=await P(_0x4a6fa7(0x1fe),{'resume_id':w,'alias':Z,'status':_0x414778,'task':_0x3a82dc,'progress':_0x56cf93});return{'content':[{'type':_0x4a6fa7(0x21d),'text':JSON[_0x4a6fa7(0x206)](_0x3d5420)}]};}if(_0x3d6d5e===_0x4a6fa7(0x218)){let {alias:_0x2a9efc,task:_0x5de3bb,priority:_0x2fe922}=_0x134181,_0x3b44ee=await P(_0x4a6fa7(0x21a),{'alias':_0x2a9efc,'task':_0x5de3bb,'priority':_0x2fe922||'normal','from_session':Z});return{'content':[{'type':_0x4a6fa7(0x21d),'text':JSON[_0x4a6fa7(0x206)](_0x3b44ee)}]};}if(_0x3d6d5e==='commhub_send_message'){let {alias:_0x3b6f8f,message:_0x3fda8d}=_0x134181,_0x5ce08d=await P(_0x4a6fa7(0x241),{'alias':_0x3b6f8f,'message':_0x3fda8d,'from_session':Z});return{'content':[{'type':'text','text':JSON[_0x4a6fa7(0x206)](_0x5ce08d)}]};}if(_0x3d6d5e==='commhub_get_all_status'){let _0x5b03af=await P(_0x4a6fa7(0x233),{});return{'content':[{'type':_0x4a6fa7(0x21d),'text':JSON[_0x4a6fa7(0x206)](_0x5b03af)}]};}return{'content':[{'type':_0x4a6fa7(0x21d),'text':JSON[_0x4a6fa7(0x206)]({'error':_0x4a6fa7(0x1e9)})}]};});async function u(){const _0x55a925=a0_0x2e1510;let _0x4da42b=f+_0x55a925(0x1ff)+encodeURIComponent(Z),_0x2ce4c3={};if(X)_0x2ce4c3[_0x55a925(0x213)]=_0x55a925(0x260)+X;Y(_0x55a925(0x1f0)+_0x4da42b);while(!0x0){try{let _0x57df8e=await fetch(_0x4da42b,{'headers':_0x2ce4c3});if(!_0x57df8e['ok']){Y('SSE\x20error:\x20'+_0x57df8e[_0x55a925(0x1e7)]+'\x20'+_0x57df8e[_0x55a925(0x243)]),await h(0x1388);continue;}let _0x631817=_0x57df8e['body'][_0x55a925(0x249)](),_0x518a1b=new TextDecoder(),_0x424c54='';while(!0x0){let {done:_0x23e23d,value:_0x4324e6}=await _0x631817[_0x55a925(0x1f7)]();if(_0x23e23d)break;_0x424c54+=_0x518a1b[_0x55a925(0x227)](_0x4324e6,{'stream':!0x0});let _0x3330c7=_0x424c54[_0x55a925(0x1f5)]('\x0a\x0a');_0x424c54=_0x3330c7['pop']()||'';for(let _0x45160f of _0x3330c7){let _0x53c656=_0x45160f[_0x55a925(0x1f5)]('\x0a')[_0x55a925(0x204)](_0x9d137f=>_0x9d137f[_0x55a925(0x223)](_0x55a925(0x221)));if(!_0x53c656)continue;try{let _0x53bcc6=JSON[_0x55a925(0x238)](_0x53c656[_0x55a925(0x252)](0x6));await S(_0x53bcc6);}catch(_0x4f999a){Y(_0x55a925(0x25e)+_0x4f999a);}}}Y(_0x55a925(0x22a));}catch(_0x2147e9){Y(_0x55a925(0x1f9)+_0x2147e9);}await h(0xbb8);}}async function S(_0x41ca36){const _0x36f336=a0_0x2e1510;if(_0x41ca36[_0x36f336(0x1f1)]===_0x36f336(0x23a)){Y(_0x36f336(0x247)+Z+'\x22');return;}if(_0x41ca36['type']===_0x36f336(0x236)){if(Y(_0x36f336(0x25c)+_0x41ca36[_0x36f336(0x20c)]+':\x20'+_0x41ca36[_0x36f336(0x21f)][_0x36f336(0x252)](0x0,0x3c)),await K[_0x36f336(0x262)]({'method':_0x36f336(0x201),'params':{'content':_0x41ca36[_0x36f336(0x21f)],'meta':{'sender':_0x41ca36[_0x36f336(0x20c)]||_0x36f336(0x212),'sender_id':_0x36f336(0x24d),'user':_0x41ca36[_0x36f336(0x20c)]||_0x36f336(0x212),'priority':_0x36f336(0x24c)}}}),_0x41ca36['message_id'])await P(_0x36f336(0x251),{'alias':Z,'message_id':_0x41ca36[_0x36f336(0x261)]});return;}if(_0x41ca36[_0x36f336(0x1f1)]===_0x36f336(0x274)||_0x41ca36[_0x36f336(0x1f1)]===_0x36f336(0x214)){Y('←\x20'+_0x41ca36['type']+_0x36f336(0x200)+_0x41ca36['inbox_count']+_0x36f336(0x254)+(_0x41ca36[_0x36f336(0x23b)]||_0x36f336(0x24c)));let _0x117874=await P(_0x36f336(0x24f),{'alias':Z,'limit':0x5});if(_0x117874?.['ok']&&_0x117874[_0x36f336(0x23d)]?.[_0x36f336(0x26e)]>0x0)for(let _0x598ee1 of _0x117874['messages']){let _0x33318f={'sender':_0x598ee1[_0x36f336(0x211)]||_0x36f336(0x212),'sender_id':'commhub','user':_0x598ee1['from_session']||_0x36f336(0x212),'task_id':_0x598ee1['id'],'priority':_0x598ee1[_0x36f336(0x23b)]||_0x36f336(0x24c)};k[_0x36f336(0x248)](_0x598ee1['id'],_0x598ee1[_0x36f336(0x211)]||_0x36f336(0x212)),await K[_0x36f336(0x262)]({'method':_0x36f336(0x201),'params':{'content':_0x598ee1[_0x36f336(0x26f)],'meta':_0x33318f}}),Y(_0x36f336(0x22b)+_0x598ee1['id'][_0x36f336(0x252)](0x0,0x8)+_0x36f336(0x1f8)+_0x598ee1[_0x36f336(0x211)]+':\x20'+_0x598ee1[_0x36f336(0x26f)]['slice'](0x0,0x3c)),await P(_0x36f336(0x251),{'alias':Z,'message_id':_0x598ee1['id']});}}}async function A(){const _0x392693=a0_0x2e1510;let _0x42e23b=new a0_0x14ed2c();await K[_0x392693(0x1f2)](_0x42e23b),Y(_0x392693(0x232)),Y(_0x392693(0x23c)),u()[_0x392693(0x255)](_0x5f1fcf=>Y(_0x392693(0x257)+_0x5f1fcf)),P(_0x392693(0x1fe),{'resume_id':w,'alias':Z,'status':_0x392693(0x273),'server':a0_0x56c48a(),'hostname':a0_0x56c48a(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x392693(0x25b)](()=>Y(_0x392693(0x1ea)+Z+_0x392693(0x1f4)+w['slice'](0x0,0x8)+')'))['catch'](_0x4e0c2d=>Y(_0x392693(0x226)+_0x4e0c2d)),setInterval(()=>{const _0x50bc99=_0x392693;P(_0x50bc99(0x1fe),{'resume_id':w,'alias':Z,'status':_0x50bc99(0x273),'server':a0_0x56c48a(),'hostname':a0_0x56c48a(),'agent':_0x50bc99(0x246),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})['catch'](_0x5c4d40=>Y('heartbeat\x20failed:\x20'+_0x5c4d40));},0x2bf20),Y(_0x392693(0x237));}A()['catch'](_0x573f17=>{const _0x180e2b=a0_0x2e1510;Y('fatal:\x20'+_0x573f17),process[_0x180e2b(0x20e)](0x1);});async function N(){const _0x31e9aa=a0_0x2e1510;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0x31e9aa(0x1fe),{'resume_id':w,'alias':Z,'status':_0x31e9aa(0x271),'task':_0x31e9aa(0x202)})[_0x31e9aa(0x255)](()=>{}),process[_0x31e9aa(0x20e)](0x0);}process[a0_0x2e1510(0x245)]['on']('end',()=>N()),process['on'](a0_0x2e1510(0x1fb),()=>N()),process['on']('SIGINT',()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7-preview.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",
|