@sleep2agi/agent-network 2.2.7-preview.0 → 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_0x5b891c=a0_0xdf5e;(function(_0x188ed6,_0x3c7dff){const _0x219b41=a0_0xdf5e,_0x564c93=_0x188ed6();while(!![]){try{const _0x1b27d6=parseInt(_0x219b41(0x14d))/0x1*(parseInt(_0x219b41(0x191))/0x2)+-parseInt(_0x219b41(0x15d))/0x3+parseInt(_0x219b41(0x134))/0x4+-parseInt(_0x219b41(0x181))/0x5*(-parseInt(_0x219b41(0x136))/0x6)+parseInt(_0x219b41(0x186))/0x7+-parseInt(_0x219b41(0x192))/0x8+-parseInt(_0x219b41(0x129))/0x9;if(_0x1b27d6===_0x3c7dff)break;else _0x564c93['push'](_0x564c93['shift']());}catch(_0x3f4a8a){_0x564c93['push'](_0x564c93['shift']());}}}(a0_0x50ba,0x3effe));import{readFileSync as a0_0x1c2b74,existsSync as a0_0x14a8bf}from'fs';import{randomUUID as a0_0x30081d}from'crypto';import{join as a0_0x3f3592}from'path';function a0_0xdf5e(_0x33a16a,_0x490b39){_0x33a16a=_0x33a16a-0x11c;const _0x50ba69=a0_0x50ba();let _0xdf5ed5=_0x50ba69[_0x33a16a];return _0xdf5ed5;}import{hostname as a0_0x147a21}from'os';import{execSync as a0_0x3b8484}from'child_process';import{Server as a0_0x559d84}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x40d803}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x5e3723,CallToolRequestSchema as a0_0x31a010}from'@modelcontextprotocol/sdk/types.js';function p(_0x1f5233){const _0x39b7f5=a0_0xdf5e;if(!a0_0x14a8bf(_0x1f5233))return;for(let _0x65c900 of a0_0x1c2b74(_0x1f5233,_0x39b7f5(0x189))['split']('\x0a')){let _0x45b0ff=_0x65c900['trim']();if(!_0x45b0ff||_0x45b0ff['startsWith']('#'))continue;let _0x58cfde=_0x45b0ff[_0x39b7f5(0x144)]('=');if(_0x58cfde<0x0)continue;let _0x2c7d59=_0x45b0ff[_0x39b7f5(0x12b)](0x0,_0x58cfde)[_0x39b7f5(0x175)](),_0x206439=_0x45b0ff[_0x39b7f5(0x12b)](_0x58cfde+0x1)[_0x39b7f5(0x175)]()[_0x39b7f5(0x183)](/^["']|["']$/g,'');if(!process.env[_0x2c7d59])process.env[_0x2c7d59]=_0x206439;}}var C=process.env.HOME||'~',T=a0_0x3f3592(C,a0_0x5b891c(0x177));p(a0_0x3f3592(T,a0_0x5b891c(0x17d)));var L=process[a0_0x5b891c(0x133)]()[a0_0x5b891c(0x183)](/\//g,'-');p(a0_0x3f3592(T,L,a0_0x5b891c(0x17d)));function U(){const _0x50c6cc=a0_0x5b891c;try{return a0_0x3b8484('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':'utf-8','timeout':0x7d0})[_0x50c6cc(0x175)]();}catch{return'';}}function v(){const _0x4195b8=a0_0x5b891c;try{let _0x17bce8=a0_0x3f3592(C,_0x4195b8(0x17e),_0x4195b8(0x166));if(a0_0x14a8bf(_0x17bce8))return JSON[_0x4195b8(0x149)](a0_0x1c2b74(_0x17bce8,'utf-8'));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H['hub']||a0_0x5b891c(0x123),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x147a21(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x30081d(),X=process.env.COMMHUB_TOKEN||H[a0_0x5b891c(0x14e)]||'';function Y(_0x247ef9){const _0xf26c1=a0_0x5b891c;let _0x2f3bb7=new Date()[_0xf26c1(0x194)]()['slice'](0x0,0x8);process[_0xf26c1(0x155)]['write']('['+_0x2f3bb7+']\x20[commhub]\x20'+_0x247ef9+'\x0a');}function h(_0x22ab04){return new Promise(_0x20c07d=>setTimeout(_0x20c07d,_0x22ab04));}Y(a0_0x5b891c(0x12c)+f+a0_0x5b891c(0x1a3)+Z+a0_0x5b891c(0x148)+w[a0_0x5b891c(0x12b)](0x0,0x8)+a0_0x5b891c(0x16f)+(j||'none')+'\x20CWD='+process[a0_0x5b891c(0x133)]()+a0_0x5b891c(0x11c)+L);function a0_0x50ba(){const _0x5671d9=['You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','string','no\x20response','normal','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','6742341gcuAvp','broadcast','slice','ENV:\x20URL=','body','heartbeat\x20failed:\x20','→\x20injected\x20task\x20','commhub','statusText','status','cwd','866784wbbXXf','commhub_reply','75582vfYgWo','2.0','alias','type','data:\x20','SIGINT','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','object','from','ready\x20—\x20waiting\x20for\x20events','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','ack_inbox','high','application/json','indexOf','report_status','/mcp','/events/','\x20RESUME_ID=','parse','idle','params','notification','8297kqdxEx','token','blocked','find','messages','failed','error','replied','stderr','commhub_get_all_status','new_message','pop','connecting\x20to\x20','Bearer\x20','2025-03-26','from_session','631938zotzNc','send_task','application/json,\x20text/event-stream','Priority\x20(default:\x20normal)','text','cancelled','end','priority','startsWith','config.json','\x20from\x20','warning:\x20could\x20not\x20register:\x20','working','CommHub\x20init\x20failed:\x20','split','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','join','length','...\x20TMUX=','catch','connect','hub','shutting\x20down,\x20reporting\x20offline...',':\x20inbox_count=','trim','number','.claude/channels/commhub','parse\x20error:\x20','\x22\x20(','get_inbox','content','claude-code','.env','.anet','connected','0.3.0','155hSjGJb','notifications/claude/channel','replace','←\x20message\x20from\x20','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','3413550dgntMW','commhub_send_task','initialize','utf-8','SSE\x20fatal:\x20','exit','get','tools/call','\x20priority=','message','SSE\x20error:\x20','122bPClaC','3065032hZXJdc','commhub_report_status','toTimeString','Message\x20content','setRequestHandler','POST','SSE\x20connected\x20as\x20\x22','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','completed','SSE\x20connection\x20error:\x20','Task\x20content','message_id','getReader','registered\x20as\x20\x22','session\x20disconnected','SSE\x20stream\x20ended,\x20reconnecting...','Current\x20task\x20description','\x20ALIAS=','stdin','send_reply','decode','Target\x20session\x20alias','result','MCP\x20stdio\x20connected','\x20PROJECT_ENV=','Progress\x200-100','commhub_send_message','stringify','new_task','starting\x20SSE\x20listener...','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','http://127.0.0.1:9200'];a0_0x50ba=function(){return _0x5671d9;};return a0_0x50ba();}var k=new Map(),K=new a0_0x559d84({'name':'commhub-channel','version':a0_0x5b891c(0x180)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x5b891c(0x128),a0_0x5b891c(0x140),a0_0x5b891c(0x124),'Session\x20alias:\x20'+Z][a0_0x5b891c(0x16d)]('\x0a')});K[a0_0x5b891c(0x196)](a0_0x5e3723,async()=>({'tools':[{'name':a0_0x5b891c(0x135),'description':a0_0x5b891c(0x13c),'inputSchema':{'type':a0_0x5b891c(0x13d),'properties':{'task_id':{'type':a0_0x5b891c(0x125),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x5b891c(0x125),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x5b891c(0x125),'enum':[a0_0x5b891c(0x19a),a0_0x5b891c(0x152),a0_0x5b891c(0x162),a0_0x5b891c(0x14f),a0_0x5b891c(0x153),'in_progress'],'description':a0_0x5b891c(0x199)}},'required':[a0_0x5b891c(0x161)]}},{'name':a0_0x5b891c(0x193),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x5b891c(0x13d),'properties':{'status':{'type':a0_0x5b891c(0x125),'enum':['working','idle','blocked','error']},'task':{'type':a0_0x5b891c(0x125),'description':a0_0x5b891c(0x1a2)},'progress':{'type':a0_0x5b891c(0x176),'description':a0_0x5b891c(0x11d)}},'required':[a0_0x5b891c(0x132)]}},{'name':a0_0x5b891c(0x187),'description':a0_0x5b891c(0x16c),'inputSchema':{'type':a0_0x5b891c(0x13d),'properties':{'alias':{'type':a0_0x5b891c(0x125),'description':a0_0x5b891c(0x1a7)},'task':{'type':a0_0x5b891c(0x125),'description':a0_0x5b891c(0x19c)},'priority':{'type':a0_0x5b891c(0x125),'enum':[a0_0x5b891c(0x142),a0_0x5b891c(0x127),'low'],'description':a0_0x5b891c(0x160)}},'required':[a0_0x5b891c(0x138),'task']}},{'name':a0_0x5b891c(0x11e),'description':a0_0x5b891c(0x185),'inputSchema':{'type':a0_0x5b891c(0x13d),'properties':{'alias':{'type':a0_0x5b891c(0x125),'description':a0_0x5b891c(0x1a7)},'message':{'type':a0_0x5b891c(0x125),'description':a0_0x5b891c(0x195)}},'required':['alias','message']}},{'name':a0_0x5b891c(0x156),'description':a0_0x5b891c(0x122),'inputSchema':{'type':a0_0x5b891c(0x13d),'properties':{}}}]}));async function P(_0x3a3a55,_0x31cb36){const _0x19651c=a0_0x5b891c;let _0x146b8b=await fetch(f+_0x19651c(0x146),{'method':_0x19651c(0x197),'headers':{'Content-Type':_0x19651c(0x143),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x19651c(0x15a)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x19651c(0x137),'id':0x1,'method':_0x19651c(0x188),'params':{'protocolVersion':_0x19651c(0x15b),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x19651c(0x180)}}})});if(!_0x146b8b['ok']){let _0x42211f=await _0x146b8b[_0x19651c(0x161)]();return Y(_0x19651c(0x16a)+_0x146b8b[_0x19651c(0x132)]+'\x20'+_0x42211f[_0x19651c(0x12b)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x146b8b['status']};}await _0x146b8b['text']();let _0xc4fd67=(await(await fetch(f+_0x19651c(0x146),{'method':_0x19651c(0x197),'headers':{'Content-Type':_0x19651c(0x143),'Accept':_0x19651c(0x15f),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x19651c(0x11f)]({'jsonrpc':'2.0','id':0x2,'method':_0x19651c(0x18d),'params':{'name':_0x3a3a55,'arguments':_0x31cb36}})}))['text']())['split']('\x0a')[_0x19651c(0x150)](_0x1af3fe=>_0x1af3fe[_0x19651c(0x165)](_0x19651c(0x13a)));if(_0xc4fd67){let _0xa63d72=JSON[_0x19651c(0x149)](_0xc4fd67['slice'](0x6));return _0xa63d72?.[_0x19651c(0x1a8)]?.[_0x19651c(0x17b)]?.[0x0]?.['text']?JSON[_0x19651c(0x149)](_0xa63d72['result'][_0x19651c(0x17b)][0x0][_0x19651c(0x161)]):_0xa63d72;}return{'ok':!0x1,'error':_0x19651c(0x126)};}K[a0_0x5b891c(0x196)](a0_0x31a010,async _0x22ecbb=>{const _0x44cc22=a0_0x5b891c;let {name:_0x2298fa,arguments:_0x47abf0}=_0x22ecbb[_0x44cc22(0x14b)];if(_0x2298fa===_0x44cc22(0x135)){let {task_id:_0x4cab99,text:_0x4e9b56,status:_0x4512c4}=_0x47abf0;if(_0x4512c4===_0x44cc22(0x19a)||_0x4512c4==='failed'||_0x4512c4==='cancelled'){let _0x58a991=_0x4512c4===_0x44cc22(0x19a)?_0x44cc22(0x154):_0x4512c4,_0x4a855a=_0x4cab99?k[_0x44cc22(0x18c)](_0x4cab99)||_0x44cc22(0x172):_0x44cc22(0x172),_0x263111=await P(_0x44cc22(0x1a5),{'alias':_0x4a855a,'text':_0x4e9b56,'in_reply_to':_0x4cab99||void 0x0,'status':_0x58a991,'from_session':Z});if(_0x4cab99)k['delete'](_0x4cab99);return{'content':[{'type':_0x44cc22(0x161),'text':JSON[_0x44cc22(0x11f)](_0x263111)}]};}let _0x1507e7=await P(_0x44cc22(0x145),{'resume_id':w,'alias':Z,'status':_0x4512c4===_0x44cc22(0x14f)?_0x44cc22(0x14f):_0x4512c4==='error'?_0x44cc22(0x153):_0x44cc22(0x169),'task':_0x4e9b56[_0x44cc22(0x12b)](0x0,0xc8),'output':_0x4e9b56});return{'content':[{'type':_0x44cc22(0x161),'text':JSON[_0x44cc22(0x11f)](_0x1507e7)}]};}if(_0x2298fa===_0x44cc22(0x193)){let {status:_0x5a8eca,task:_0x4f5081,progress:_0x304a6a}=_0x47abf0,_0x270eba=await P(_0x44cc22(0x145),{'resume_id':w,'alias':Z,'status':_0x5a8eca,'task':_0x4f5081,'progress':_0x304a6a});return{'content':[{'type':'text','text':JSON['stringify'](_0x270eba)}]};}if(_0x2298fa==='commhub_send_task'){let {alias:_0x55736a,task:_0x222036,priority:_0x5f4a8c}=_0x47abf0,_0x522f54=await P(_0x44cc22(0x15e),{'alias':_0x55736a,'task':_0x222036,'priority':_0x5f4a8c||'normal','from_session':Z});return{'content':[{'type':_0x44cc22(0x161),'text':JSON[_0x44cc22(0x11f)](_0x522f54)}]};}if(_0x2298fa==='commhub_send_message'){let {alias:_0x2fc004,message:_0x590513}=_0x47abf0,_0x385d5f=await P('send_message',{'alias':_0x2fc004,'message':_0x590513,'from_session':Z});return{'content':[{'type':_0x44cc22(0x161),'text':JSON[_0x44cc22(0x11f)](_0x385d5f)}]};}if(_0x2298fa===_0x44cc22(0x156)){let _0x4b47b8=await P('get_all_status',{});return{'content':[{'type':_0x44cc22(0x161),'text':JSON[_0x44cc22(0x11f)](_0x4b47b8)}]};}return{'content':[{'type':_0x44cc22(0x161),'text':JSON[_0x44cc22(0x11f)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x2589d0=a0_0x5b891c;let _0x294bee=f+_0x2589d0(0x147)+encodeURIComponent(Z),_0x38a87e={};if(X)_0x38a87e['Authorization']=_0x2589d0(0x15a)+X;Y(_0x2589d0(0x159)+_0x294bee);while(!0x0){try{let _0x591ecd=await fetch(_0x294bee,{'headers':_0x38a87e});if(!_0x591ecd['ok']){Y(_0x2589d0(0x190)+_0x591ecd[_0x2589d0(0x132)]+'\x20'+_0x591ecd[_0x2589d0(0x131)]),await h(0x1388);continue;}let _0x2c0cdd=_0x591ecd[_0x2589d0(0x12d)][_0x2589d0(0x19e)](),_0x574988=new TextDecoder(),_0x457907='';while(!0x0){let {done:_0x529155,value:_0x3cbe5f}=await _0x2c0cdd['read']();if(_0x529155)break;_0x457907+=_0x574988[_0x2589d0(0x1a6)](_0x3cbe5f,{'stream':!0x0});let _0x343faa=_0x457907[_0x2589d0(0x16b)]('\x0a\x0a');_0x457907=_0x343faa[_0x2589d0(0x158)]()||'';for(let _0x46c34d of _0x343faa){let _0x42128b=_0x46c34d[_0x2589d0(0x16b)]('\x0a')[_0x2589d0(0x150)](_0x587a9e=>_0x587a9e[_0x2589d0(0x165)]('data:\x20'));if(!_0x42128b)continue;try{let _0x3f8093=JSON['parse'](_0x42128b[_0x2589d0(0x12b)](0x6));await S(_0x3f8093);}catch(_0x34fc6a){Y(_0x2589d0(0x178)+_0x34fc6a);}}}Y(_0x2589d0(0x1a1));}catch(_0x9ea231){Y(_0x2589d0(0x19b)+_0x9ea231);}await h(0xbb8);}}async function S(_0x5502c8){const _0x598015=a0_0x5b891c;if(_0x5502c8[_0x598015(0x139)]===_0x598015(0x17f)){Y(_0x598015(0x198)+Z+'\x22');return;}if(_0x5502c8[_0x598015(0x139)]===_0x598015(0x157)){if(Y(_0x598015(0x184)+_0x5502c8[_0x598015(0x13e)]+':\x20'+_0x5502c8[_0x598015(0x18f)][_0x598015(0x12b)](0x0,0x3c)),await K[_0x598015(0x14c)]({'method':'notifications/claude/channel','params':{'content':_0x5502c8[_0x598015(0x18f)],'meta':{'sender':_0x5502c8[_0x598015(0x13e)]||_0x598015(0x172),'sender_id':_0x598015(0x130),'user':_0x5502c8[_0x598015(0x13e)]||_0x598015(0x172),'priority':_0x598015(0x127)}}}),_0x5502c8[_0x598015(0x19d)])await P(_0x598015(0x141),{'alias':Z,'message_id':_0x5502c8[_0x598015(0x19d)]});return;}if(_0x5502c8[_0x598015(0x139)]===_0x598015(0x120)||_0x5502c8[_0x598015(0x139)]===_0x598015(0x12a)){Y('←\x20'+_0x5502c8[_0x598015(0x139)]+_0x598015(0x174)+_0x5502c8['inbox_count']+_0x598015(0x18e)+(_0x5502c8[_0x598015(0x164)]||_0x598015(0x127)));let _0x360392=await P(_0x598015(0x17a),{'alias':Z,'limit':0x5});if(_0x360392?.['ok']&&_0x360392[_0x598015(0x151)]?.[_0x598015(0x16e)]>0x0)for(let _0x19d1e3 of _0x360392['messages']){let _0x524885={'sender':_0x19d1e3[_0x598015(0x15c)]||_0x598015(0x172),'sender_id':'commhub','user':_0x19d1e3[_0x598015(0x15c)]||_0x598015(0x172),'task_id':_0x19d1e3['id'],'priority':_0x19d1e3[_0x598015(0x164)]||'normal'};k['set'](_0x19d1e3['id'],_0x19d1e3[_0x598015(0x15c)]||_0x598015(0x172)),await K[_0x598015(0x14c)]({'method':_0x598015(0x182),'params':{'content':_0x19d1e3[_0x598015(0x17b)],'meta':_0x524885}}),Y(_0x598015(0x12f)+_0x19d1e3['id'][_0x598015(0x12b)](0x0,0x8)+_0x598015(0x167)+_0x19d1e3[_0x598015(0x15c)]+':\x20'+_0x19d1e3['content'][_0x598015(0x12b)](0x0,0x3c)),await P(_0x598015(0x141),{'alias':Z,'message_id':_0x19d1e3['id']});}}}async function A(){const _0x45ee88=a0_0x5b891c;let _0x58d740=new a0_0x40d803();await K[_0x45ee88(0x171)](_0x58d740),Y(_0x45ee88(0x1a9)),Y(_0x45ee88(0x121)),u()[_0x45ee88(0x170)](_0x4e27e7=>Y(_0x45ee88(0x18a)+_0x4e27e7)),P('report_status',{'resume_id':w,'alias':Z,'status':_0x45ee88(0x14a),'server':a0_0x147a21(),'hostname':a0_0x147a21(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})['then'](()=>Y(_0x45ee88(0x19f)+Z+_0x45ee88(0x179)+w[_0x45ee88(0x12b)](0x0,0x8)+')'))[_0x45ee88(0x170)](_0x247e60=>Y(_0x45ee88(0x168)+_0x247e60)),setInterval(()=>{const _0x1a89e9=_0x45ee88;P('report_status',{'resume_id':w,'alias':Z,'status':_0x1a89e9(0x14a),'server':a0_0x147a21(),'hostname':a0_0x147a21(),'agent':_0x1a89e9(0x17c),'project_dir':process[_0x1a89e9(0x133)](),'tmux_name':j||void 0x0})[_0x1a89e9(0x170)](_0x24662a=>Y(_0x1a89e9(0x12e)+_0x24662a));},0x2bf20),Y(_0x45ee88(0x13f));}A()[a0_0x5b891c(0x170)](_0x3a27fb=>{const _0x23bce8=a0_0x5b891c;Y('fatal:\x20'+_0x3a27fb),process[_0x23bce8(0x18b)](0x1);});async function N(){const _0x6ff2a6=a0_0x5b891c;Y(_0x6ff2a6(0x173)),await P('report_status',{'resume_id':w,'alias':Z,'status':_0x6ff2a6(0x153),'task':_0x6ff2a6(0x1a0)})[_0x6ff2a6(0x170)](()=>{}),process[_0x6ff2a6(0x18b)](0x0);}process[a0_0x5b891c(0x1a4)]['on'](a0_0x5b891c(0x163),()=>N()),process['on']('SIGTERM',()=>N()),process['on'](a0_0x5b891c(0x13b),()=>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.7-preview.
|
|
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",
|