@sleep2agi/agent-network 2.1.8-preview.6 → 2.1.8-preview.8
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 +3 -2
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x52ab30=a0_0x455e;(function(_0x2dd7e7,_0x13439a){const _0x300dd1=a0_0x455e,_0x179c53=_0x2dd7e7();while(!![]){try{const _0x5442f4=-parseInt(_0x300dd1(0x1af))/0x1*(parseInt(_0x300dd1(0x1d5))/0x2)+parseInt(_0x300dd1(0x1ce))/0x3*(-parseInt(_0x300dd1(0x1c7))/0x4)+-parseInt(_0x300dd1(0x1e2))/0x5*(parseInt(_0x300dd1(0x1a6))/0x6)+-parseInt(_0x300dd1(0x19e))/0x7+-parseInt(_0x300dd1(0x1bf))/0x8+parseInt(_0x300dd1(0x1a1))/0x9*(parseInt(_0x300dd1(0x1a7))/0xa)+parseInt(_0x300dd1(0x1e5))/0xb;if(_0x5442f4===_0x13439a)break;else _0x179c53['push'](_0x179c53['shift']());}catch(_0x5af5d7){_0x179c53['push'](_0x179c53['shift']());}}}(a0_0x4c5e,0x2681e));import{EventEmitter as a0_0x2a461a}from'events';function a0_0x455e(_0x35d138,_0x591a5a){_0x35d138=_0x35d138-0x194;const _0x4c5eee=a0_0x4c5e();let _0x455e4a=_0x4c5eee[_0x35d138];return _0x455e4a;}import{hostname as a0_0x206b30}from'os';function a0_0x4c5e(){const _0x360926=['SSE\x20connected','error','alias','autoConnect','registered','43MdosKa','inbox\x20error:\x20','/events/','split','emit','offline','heartbeat\x20failed:\x20','decode','reconnectDelay','application/json,\x20text/event-stream','AbortError','read','getAllStatus','match','messages','broadcast','476136qgcbzW','normal','SSE\x20failed:\x20','parse','server','disconnected','heartbeatInterval','now','46996DQHLqG','connect','catch','abort','agent','Authorization','POST','78EobPNW','token','running','getReader','data:\x20','connected','log','6756QRKXxt','min','sseAbort','replace','type','sdk','signal','connectSSE','processInbox',']\x20[commhub:','from_session','toString','send','30GvOJVi','call','tools/call','10738871EChsmk','text/event-stream','text','completed','slice','new_task','heartbeatTimer','SSE\x20reconnecting\x20in\x20','body','idle','content','url','SSE\x20error:\x20','message','sleep','stringify','531468RxGVId','result','resumeId','6930bMGGHw','Bearer\x20','startsWith','/mcp','s...','286266UFKxCc','700famrUZ','cwd','status'];a0_0x4c5e=function(){return _0x360926;};return a0_0x4c5e();}class T extends a0_0x2a461a{[a0_0x52ab30(0x199)];[a0_0x52ab30(0x1ac)];[a0_0x52ab30(0x1cf)];[a0_0x52ab30(0x1cb)];[a0_0x52ab30(0x1a0)];['heartbeatInterval'];[a0_0x52ab30(0x1b7)];['heartbeatTimer'];[a0_0x52ab30(0x1d7)];[a0_0x52ab30(0x1d0)]=!0x1;constructor(_0x5b0215){const _0x49cb1d=a0_0x52ab30;super();if(this[_0x49cb1d(0x199)]=_0x5b0215[_0x49cb1d(0x199)][_0x49cb1d(0x1d8)](/\/$/,''),this[_0x49cb1d(0x1ac)]=_0x5b0215[_0x49cb1d(0x1ac)],this[_0x49cb1d(0x1cf)]=_0x5b0215[_0x49cb1d(0x1cf)],this['agent']=_0x5b0215[_0x49cb1d(0x1cb)]||_0x49cb1d(0x1da),this[_0x49cb1d(0x1a0)]='sdk-'+_0x5b0215['alias']+'-'+Date[_0x49cb1d(0x1c6)]()[_0x49cb1d(0x1e0)](0x24),this[_0x49cb1d(0x1c5)]=_0x5b0215[_0x49cb1d(0x1c5)]??0x2bf20,this[_0x49cb1d(0x1b7)]=_0x5b0215[_0x49cb1d(0x1b7)]??0xbb8,_0x5b0215[_0x49cb1d(0x1ad)]!==!0x1)this[_0x49cb1d(0x1c8)]();}[a0_0x52ab30(0x1d4)](_0x3e8a40){const _0x1b0823=a0_0x52ab30;console['log']('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x1b0823(0x1de)+this[_0x1b0823(0x1ac)]+']\x20'+_0x3e8a40);}async[a0_0x52ab30(0x1e3)](_0x2117fb,_0x51a8d5){const _0x476011=a0_0x52ab30;let _0x4e3adc={'Content-Type':'application/json','Accept':_0x476011(0x1b8)};if(this[_0x476011(0x1cf)])_0x4e3adc[_0x476011(0x1cc)]=_0x476011(0x1a2)+this[_0x476011(0x1cf)];let _0x13bd29=await(await fetch(this[_0x476011(0x199)]+_0x476011(0x1a4),{'method':_0x476011(0x1cd),'headers':_0x4e3adc,'body':JSON[_0x476011(0x19d)]({'jsonrpc':'2.0','id':Date[_0x476011(0x1c6)](),'method':_0x476011(0x1e4),'params':{'name':_0x2117fb,'arguments':_0x51a8d5}})}))[_0x476011(0x1e7)](),_0x2db880=_0x13bd29[_0x476011(0x1bc)](/data: (.+)/),_0x78da9a=_0x2db880?JSON['parse'](_0x2db880[0x1]):JSON[_0x476011(0x1c2)](_0x13bd29),_0x6a10fe=_0x78da9a?.[_0x476011(0x19f)]?.[_0x476011(0x198)]?.[0x0]?.[_0x476011(0x1e7)];return _0x6a10fe?JSON[_0x476011(0x1c2)](_0x6a10fe):_0x78da9a;}async[a0_0x52ab30(0x1c8)](){const _0x4a19d2=a0_0x52ab30;if(this[_0x4a19d2(0x1d0)])return;this[_0x4a19d2(0x1d0)]=!0x0,await this[_0x4a19d2(0x1a9)]('idle'),this[_0x4a19d2(0x1d4)](_0x4a19d2(0x1ae)),this[_0x4a19d2(0x194)]=setInterval(()=>{const _0x3cbfed=_0x4a19d2;this[_0x3cbfed(0x1a9)](_0x3cbfed(0x197))[_0x3cbfed(0x1c9)](_0x3d33e5=>this['log'](_0x3cbfed(0x1b5)+_0x3d33e5[_0x3cbfed(0x19b)]));},this[_0x4a19d2(0x1c5)]),this[_0x4a19d2(0x1dc)]();}async['disconnect'](){const _0xc4d779=a0_0x52ab30;if(this[_0xc4d779(0x1d0)]=!0x1,this[_0xc4d779(0x1d7)]?.[_0xc4d779(0x1ca)](),this['heartbeatTimer'])clearInterval(this[_0xc4d779(0x194)]);await this[_0xc4d779(0x1a9)](_0xc4d779(0x1b4))[_0xc4d779(0x1c9)](()=>{}),this['log']('disconnected');}async[a0_0x52ab30(0x1e1)](_0x15cf1e,_0x150e6a,_0x1dfe6c=a0_0x52ab30(0x1c0)){const _0x5b106e=a0_0x52ab30;return this[_0x5b106e(0x1e3)]('send_task',{'alias':_0x15cf1e,'task':_0x150e6a,'priority':_0x1dfe6c,'from_session':this[_0x5b106e(0x1ac)]});}async[a0_0x52ab30(0x19b)](_0xe7df0b,_0x751d91){const _0x111a90=a0_0x52ab30;return this[_0x111a90(0x1e3)]('send_message',{'alias':_0xe7df0b,'message':_0x751d91,'from_session':this[_0x111a90(0x1ac)]});}async['reply'](_0x4499c6,_0x598a80,_0x2704e3=a0_0x52ab30(0x1e8)){const _0x1615f9=a0_0x52ab30;return this[_0x1615f9(0x1e3)]('send_reply',{'in_reply_to':_0x4499c6,'text':_0x598a80,'status':_0x2704e3});}async[a0_0x52ab30(0x1a9)](_0x5306a0,_0x45affa){const _0x3c341a=a0_0x52ab30;return this[_0x3c341a(0x1e3)]('report_status',{'resume_id':this[_0x3c341a(0x1a0)],'alias':this['alias'],'status':_0x5306a0,'server':a0_0x206b30(),'hostname':a0_0x206b30(),'agent':this[_0x3c341a(0x1cb)],'project_dir':process[_0x3c341a(0x1a8)](),..._0x45affa});}async[a0_0x52ab30(0x1bb)](){const _0xca8325=a0_0x52ab30;return this[_0xca8325(0x1e3)]('get_all_status',{});}async[a0_0x52ab30(0x1be)](_0x552d34,_0x39a429){const _0x56d9c1=a0_0x52ab30;return this['call'](_0x56d9c1(0x1be),{'message':_0x552d34,'filter_server':_0x39a429?.[_0x56d9c1(0x1c3)],'filter_status':_0x39a429?.[_0x56d9c1(0x1a9)]});}async[a0_0x52ab30(0x1dc)](){const _0x5ba605=a0_0x52ab30;let _0x5de8e8=encodeURIComponent(this['alias']),_0x4af76a=this[_0x5ba605(0x199)]+_0x5ba605(0x1b1)+_0x5de8e8,_0x12926c=this[_0x5ba605(0x1b7)];while(this[_0x5ba605(0x1d0)]){try{this[_0x5ba605(0x1d7)]=new AbortController();let _0x1132a3={'Accept':_0x5ba605(0x1e6)};if(this[_0x5ba605(0x1cf)])_0x1132a3['Authorization']='Bearer\x20'+this[_0x5ba605(0x1cf)];let _0x2096c0=await fetch(_0x4af76a,{'headers':_0x1132a3,'signal':this[_0x5ba605(0x1d7)][_0x5ba605(0x1db)]});if(!_0x2096c0['ok']||!_0x2096c0[_0x5ba605(0x196)]){this['log'](_0x5ba605(0x1c1)+_0x2096c0[_0x5ba605(0x1a9)]),await this[_0x5ba605(0x19c)](_0x12926c),_0x12926c=Math[_0x5ba605(0x1d6)](_0x12926c*1.5,0xea60);continue;}_0x12926c=this[_0x5ba605(0x1b7)];let _0x379d7f=_0x2096c0[_0x5ba605(0x196)][_0x5ba605(0x1d1)](),_0x17c8a0=new TextDecoder(),_0x7615d1='';while(this['running']){let {done:_0x7abb39,value:_0x506728}=await _0x379d7f[_0x5ba605(0x1ba)]();if(_0x7abb39)break;_0x7615d1+=_0x17c8a0[_0x5ba605(0x1b6)](_0x506728,{'stream':!0x0});let _0x58482e=_0x7615d1[_0x5ba605(0x1b2)]('\x0a');_0x7615d1=_0x58482e['pop']()||'';for(let _0x24cdda of _0x58482e){if(!_0x24cdda[_0x5ba605(0x1a3)](_0x5ba605(0x1d2)))continue;try{let _0x34029b=JSON[_0x5ba605(0x1c2)](_0x24cdda['slice'](0x6));if(_0x34029b['type']===_0x5ba605(0x1d3)){this[_0x5ba605(0x1d4)](_0x5ba605(0x1aa)),this[_0x5ba605(0x1b3)]('connected');continue;}if(_0x34029b[_0x5ba605(0x1d9)]===_0x5ba605(0x1ea)||_0x34029b['type']==='new_message'||_0x34029b[_0x5ba605(0x1d9)]==='broadcast')await this[_0x5ba605(0x1dd)]();}catch{}}}}catch(_0x2759ba){if(_0x2759ba['name']===_0x5ba605(0x1b9))break;this[_0x5ba605(0x1b3)](_0x5ba605(0x1ab),_0x2759ba),this[_0x5ba605(0x1d4)](_0x5ba605(0x19a)+_0x2759ba[_0x5ba605(0x19b)]);}if(this[_0x5ba605(0x1d0)])this[_0x5ba605(0x1b3)](_0x5ba605(0x1c4)),this['log'](_0x5ba605(0x195)+_0x12926c/0x3e8+_0x5ba605(0x1a5)),await this[_0x5ba605(0x19c)](_0x12926c),_0x12926c=Math[_0x5ba605(0x1d6)](_0x12926c*1.5,0xea60);}}async[a0_0x52ab30(0x1dd)](){const _0x22d111=a0_0x52ab30;try{let _0x4f2c3d=(await this[_0x22d111(0x1e3)]('get_inbox',{'alias':this[_0x22d111(0x1ac)],'limit':0xa}))?.[_0x22d111(0x1bd)]||[];for(let _0x48b612 of _0x4f2c3d)await this[_0x22d111(0x1e3)]('ack_inbox',{'alias':this[_0x22d111(0x1ac)],'message_id':_0x48b612['id']}),this[_0x22d111(0x1d4)]('←\x20'+_0x48b612[_0x22d111(0x1df)]+':\x20'+_0x48b612[_0x22d111(0x198)][_0x22d111(0x1e9)](0x0,0x3c)),this[_0x22d111(0x1b3)]('task',_0x48b612),this[_0x22d111(0x1b3)](_0x22d111(0x19b),_0x48b612);}catch(_0x539e0f){this[_0x22d111(0x1d4)](_0x22d111(0x1b0)+_0x539e0f[_0x22d111(0x19b)]);}}[a0_0x52ab30(0x19c)](_0x10abcd){return new Promise(_0x515374=>setTimeout(_0x515374,_0x10abcd));}}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_0x52c031=a0_0x5243;(function(_0x278a2e,_0xd22497){const _0x5c3727=a0_0x5243,_0x543405=_0x278a2e();while(!![]){try{const _0x27bc4c=-parseInt(_0x5c3727(0x22b))/0x1+parseInt(_0x5c3727(0x226))/0x2*(parseInt(_0x5c3727(0x1ce))/0x3)+-parseInt(_0x5c3727(0x1d6))/0x4+parseInt(_0x5c3727(0x223))/0x5+parseInt(_0x5c3727(0x1e9))/0x6*(-parseInt(_0x5c3727(0x225))/0x7)+-parseInt(_0x5c3727(0x239))/0x8+-parseInt(_0x5c3727(0x1c1))/0x9*(-parseInt(_0x5c3727(0x1e8))/0xa);if(_0x27bc4c===_0xd22497)break;else _0x543405['push'](_0x543405['shift']());}catch(_0x236021){_0x543405['push'](_0x543405['shift']());}}}(a0_0xd53c,0x6a849));import{readFileSync as a0_0x202286,existsSync as a0_0x4dfca6}from'fs';import{randomUUID as a0_0x51bffb}from'crypto';import{join as a0_0x561821}from'path';import{hostname as a0_0x3936f5}from'os';import{execSync as a0_0x4bd3f0}from'child_process';import{Server as a0_0xb06027}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4c09c9}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x46d2c5,CallToolRequestSchema as a0_0xf797f8}from'@modelcontextprotocol/sdk/types.js';function p(_0x4de18d){const _0x507c3e=a0_0x5243;if(!a0_0x4dfca6(_0x4de18d))return;for(let _0x567297 of a0_0x202286(_0x4de18d,_0x507c3e(0x21e))[_0x507c3e(0x21c)]('\x0a')){let _0x540053=_0x567297['trim']();if(!_0x540053||_0x540053[_0x507c3e(0x212)]('#'))continue;let _0x31ac32=_0x540053[_0x507c3e(0x1e6)]('=');if(_0x31ac32<0x0)continue;let _0x30d404=_0x540053[_0x507c3e(0x1f3)](0x0,_0x31ac32)[_0x507c3e(0x1ca)](),_0x1f6e28=_0x540053[_0x507c3e(0x1f3)](_0x31ac32+0x1)[_0x507c3e(0x1ca)]()[_0x507c3e(0x230)](/^["']|["']$/g,'');if(!process.env[_0x30d404])process.env[_0x30d404]=_0x1f6e28;}}var C=process.env.HOME||'~',T=a0_0x561821(C,a0_0x52c031(0x1b8));p(a0_0x561821(T,a0_0x52c031(0x1cb)));function a0_0x5243(_0x5eaee3,_0x3f8032){_0x5eaee3=_0x5eaee3-0x1b2;const _0xd53cff=a0_0xd53c();let _0x524301=_0xd53cff[_0x5eaee3];return _0x524301;}var L=process[a0_0x52c031(0x1c0)]()[a0_0x52c031(0x230)](/\//g,'-');p(a0_0x561821(T,L,a0_0x52c031(0x1cb)));function U(){const _0x441e33=a0_0x52c031;try{return a0_0x4bd3f0(_0x441e33(0x1da),{'encoding':_0x441e33(0x21e),'timeout':0x7d0})[_0x441e33(0x1ca)]();}catch{return'';}}function v(){const _0x44d6e6=a0_0x52c031;try{let _0x42d684=a0_0x561821(C,'.anet',_0x44d6e6(0x1e2));if(a0_0x4dfca6(_0x42d684))return JSON[_0x44d6e6(0x1f2)](a0_0x202286(_0x42d684,_0x44d6e6(0x21e)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0x52c031(0x202)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x3936f5(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x51bffb(),X=process.env.COMMHUB_TOKEN||H[a0_0x52c031(0x1fa)]||'';function Y(_0x1a8fc2){const _0x2ceb26=a0_0x52c031;let _0x3be9f3=new Date()[_0x2ceb26(0x237)]()[_0x2ceb26(0x1f3)](0x0,0x8);process[_0x2ceb26(0x235)][_0x2ceb26(0x1e1)]('['+_0x3be9f3+_0x2ceb26(0x200)+_0x1a8fc2+'\x0a');}function h(_0xc820db){return new Promise(_0x742a1=>setTimeout(_0x742a1,_0xc820db));}Y(a0_0x52c031(0x1ed)+f+a0_0x52c031(0x1ff)+Z+a0_0x52c031(0x1bd)+w[a0_0x52c031(0x1f3)](0x0,0x8)+a0_0x52c031(0x1db)+(j||a0_0x52c031(0x1cc))+a0_0x52c031(0x1d4)+process[a0_0x52c031(0x1c0)]()+'\x20PROJECT_ENV='+L);function a0_0xd53c(){const _0x43cd66=['\x20RESUME_ID=','init\x20failed:\x20','stringify','cwd','381429drIBvs','failed','warning:\x20could\x20not\x20register:\x20','SSE\x20connection\x20error:\x20','low','Current\x20task\x20description','normal','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','new_task','trim','.env','none','type','6HOZdGW','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','session\x20disconnected','message','\x20priority=','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x20CWD=','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','85508fFNGnP','text','ready\x20—\x20waiting\x20for\x20events','commhub','tmux\x20display-message\x20-p\x20\x27#S\x27','...\x20TMUX=','0.3.0','join','replied','notifications/claude/channel','idle','write','config.json','blocked','cancelled','SSE\x20error:\x20','indexOf','Message\x20content','310UESlWO','106068mWeyVy','high','notification','POST','ENV:\x20URL=','priority','data:\x20','SIGINT','then','parse','slice','number','completed','getReader','application/json,\x20text/event-stream','\x20from\x20','application/json','token','commhub-channel','←\x20message\x20from\x20','send_task','commhub_get_all_status','\x20ALIAS=',']\x20[commhub]\x20','/mcp','hub','Session\x20alias:\x20','report_status','new_message','pop','initialize','decode','messages','result','Priority\x20(default:\x20normal)','from','find','alias','message_id','get_all_status','commhub_report_status','startsWith','commhub_send_message','working','send_message','MCP\x20stdio\x20connected','read','in_progress','Progress\x200-100','error','catch','split','registered\x20as\x20\x22','utf-8','unknown\x20tool','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','2025-03-26','string','3904035fkLOoX','Target\x20session\x20alias','189vbCQyx','258740CpyJiw','broadcast','set','exit',':\x20inbox_count=','629762jIyLfI','delete','Authorization','CommHub\x20init\x20failed:\x20','claude-code','replace','from_session','object','get_inbox','commhub_reply','stderr','ack_inbox','toTimeString','SSE\x20stream\x20ended,\x20reconnecting...','6308928hCaUiL','status','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','2.0','content','Bearer\x20','setRequestHandler','SIGTERM','length','SSE\x20connected\x20as\x20\x22','SSE\x20fatal:\x20','→\x20injected\x20task\x20','.claude/channels/commhub','/events/','commhub_send_task','heartbeat\x20failed:\x20','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.'];a0_0xd53c=function(){return _0x43cd66;};return a0_0xd53c();}var k=new Map(),K=new a0_0xb06027({'name':'commhub-channel','version':a0_0x52c031(0x1dc)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x52c031(0x220),a0_0x52c031(0x1d5),a0_0x52c031(0x1d3),a0_0x52c031(0x1c8),a0_0x52c031(0x203)+Z][a0_0x52c031(0x1dd)]('\x0a')});K['setRequestHandler'](a0_0x46d2c5,async()=>({'tools':[{'name':a0_0x52c031(0x234),'description':a0_0x52c031(0x1bc),'inputSchema':{'type':a0_0x52c031(0x232),'properties':{'task_id':{'type':a0_0x52c031(0x222),'description':a0_0x52c031(0x1cf)},'text':{'type':a0_0x52c031(0x222),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x52c031(0x222),'enum':[a0_0x52c031(0x1f5),a0_0x52c031(0x1c2),a0_0x52c031(0x1e4),'blocked',a0_0x52c031(0x21a),a0_0x52c031(0x218)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':['text']}},{'name':a0_0x52c031(0x211),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x52c031(0x232),'properties':{'status':{'type':a0_0x52c031(0x222),'enum':[a0_0x52c031(0x214),a0_0x52c031(0x1e0),'blocked',a0_0x52c031(0x21a)]},'task':{'type':a0_0x52c031(0x222),'description':a0_0x52c031(0x1c6)},'progress':{'type':a0_0x52c031(0x1f4),'description':a0_0x52c031(0x219)}},'required':[a0_0x52c031(0x23a)]}},{'name':'commhub_send_task','description':a0_0x52c031(0x23b),'inputSchema':{'type':a0_0x52c031(0x232),'properties':{'alias':{'type':a0_0x52c031(0x222),'description':a0_0x52c031(0x224)},'task':{'type':a0_0x52c031(0x222),'description':'Task\x20content'},'priority':{'type':a0_0x52c031(0x222),'enum':[a0_0x52c031(0x1ea),'normal',a0_0x52c031(0x1c5)],'description':a0_0x52c031(0x20b)}},'required':['alias','task']}},{'name':a0_0x52c031(0x213),'description':a0_0x52c031(0x23c),'inputSchema':{'type':a0_0x52c031(0x232),'properties':{'alias':{'type':a0_0x52c031(0x222),'description':a0_0x52c031(0x224)},'message':{'type':a0_0x52c031(0x222),'description':a0_0x52c031(0x1e7)}},'required':[a0_0x52c031(0x20e),a0_0x52c031(0x1d1)]}},{'name':a0_0x52c031(0x1fe),'description':'Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','inputSchema':{'type':a0_0x52c031(0x232),'properties':{}}}]}));async function P(_0x223121,_0x10e9b1){const _0x4addc9=a0_0x52c031;let _0x35fbe9=await fetch(f+_0x4addc9(0x201),{'method':_0x4addc9(0x1ec),'headers':{'Content-Type':_0x4addc9(0x1f9),'Accept':_0x4addc9(0x1f7),...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x4addc9(0x1bf)]({'jsonrpc':_0x4addc9(0x23d),'id':0x1,'method':_0x4addc9(0x207),'params':{'protocolVersion':_0x4addc9(0x221),'capabilities':{},'clientInfo':{'name':_0x4addc9(0x1fb),'version':'0.3.0'}}})});if(!_0x35fbe9['ok']){let _0x5385c9=await _0x35fbe9[_0x4addc9(0x1d7)]();return Y(_0x4addc9(0x22e)+_0x35fbe9[_0x4addc9(0x23a)]+'\x20'+_0x5385c9[_0x4addc9(0x1f3)](0x0,0x64)),{'ok':!0x1,'error':_0x4addc9(0x1be)+_0x35fbe9['status']};}await _0x35fbe9[_0x4addc9(0x1d7)]();let _0x3c89b1=(await(await fetch(f+_0x4addc9(0x201),{'method':_0x4addc9(0x1ec),'headers':{'Content-Type':_0x4addc9(0x1f9),'Accept':_0x4addc9(0x1f7),...X?{'Authorization':_0x4addc9(0x23f)+X}:{}},'body':JSON['stringify']({'jsonrpc':_0x4addc9(0x23d),'id':0x2,'method':'tools/call','params':{'name':_0x223121,'arguments':_0x10e9b1}})}))['text']())[_0x4addc9(0x21c)]('\x0a')[_0x4addc9(0x20d)](_0x12cbd2=>_0x12cbd2['startsWith'](_0x4addc9(0x1ef)));if(_0x3c89b1){let _0x434264=JSON[_0x4addc9(0x1f2)](_0x3c89b1['slice'](0x6));return _0x434264?.[_0x4addc9(0x20a)]?.[_0x4addc9(0x23e)]?.[0x0]?.[_0x4addc9(0x1d7)]?JSON['parse'](_0x434264[_0x4addc9(0x20a)][_0x4addc9(0x23e)][0x0][_0x4addc9(0x1d7)]):_0x434264;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x52c031(0x1b2)](a0_0xf797f8,async _0x45dbd9=>{const _0x5d5d5e=a0_0x52c031;let {name:_0xe67755,arguments:_0x5b0fdd}=_0x45dbd9['params'];if(_0xe67755==='commhub_reply'){let {task_id:_0x2e80b4,text:_0x1fa776,status:_0x257244}=_0x5b0fdd;if(_0x257244===_0x5d5d5e(0x1f5)||_0x257244===_0x5d5d5e(0x1c2)||_0x257244==='cancelled'){let _0x260c95=_0x257244===_0x5d5d5e(0x1f5)?_0x5d5d5e(0x1de):_0x257244,_0x16e5b5=_0x2e80b4?k['get'](_0x2e80b4)||_0x5d5d5e(0x202):_0x5d5d5e(0x202),_0x159d92=await P('send_reply',{'alias':_0x16e5b5,'text':_0x1fa776,'in_reply_to':_0x2e80b4||void 0x0,'status':_0x260c95,'from_session':Z});if(_0x2e80b4)k[_0x5d5d5e(0x22c)](_0x2e80b4);return{'content':[{'type':_0x5d5d5e(0x1d7),'text':JSON['stringify'](_0x159d92)}]};}let _0x4fd128=await P(_0x5d5d5e(0x204),{'resume_id':w,'alias':Z,'status':_0x257244===_0x5d5d5e(0x1e3)?_0x5d5d5e(0x1e3):_0x257244==='error'?_0x5d5d5e(0x21a):_0x5d5d5e(0x214),'task':_0x1fa776[_0x5d5d5e(0x1f3)](0x0,0xc8),'output':_0x1fa776});return{'content':[{'type':'text','text':JSON['stringify'](_0x4fd128)}]};}if(_0xe67755===_0x5d5d5e(0x211)){let {status:_0x410e32,task:_0x6b7f49,progress:_0x3ba91a}=_0x5b0fdd,_0x1ba7fc=await P(_0x5d5d5e(0x204),{'resume_id':w,'alias':Z,'status':_0x410e32,'task':_0x6b7f49,'progress':_0x3ba91a});return{'content':[{'type':_0x5d5d5e(0x1d7),'text':JSON['stringify'](_0x1ba7fc)}]};}if(_0xe67755===_0x5d5d5e(0x1ba)){let {alias:_0x17de36,task:_0x240b66,priority:_0x5adaa4}=_0x5b0fdd,_0x356624=await P(_0x5d5d5e(0x1fd),{'alias':_0x17de36,'task':_0x240b66,'priority':_0x5adaa4||_0x5d5d5e(0x1c7),'from_session':Z});return{'content':[{'type':_0x5d5d5e(0x1d7),'text':JSON[_0x5d5d5e(0x1bf)](_0x356624)}]};}if(_0xe67755==='commhub_send_message'){let {alias:_0x7bc0e4,message:_0x244e7e}=_0x5b0fdd,_0x13ed33=await P(_0x5d5d5e(0x215),{'alias':_0x7bc0e4,'message':_0x244e7e,'from_session':Z});return{'content':[{'type':_0x5d5d5e(0x1d7),'text':JSON['stringify'](_0x13ed33)}]};}if(_0xe67755===_0x5d5d5e(0x1fe)){let _0x4c96c1=await P(_0x5d5d5e(0x210),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x4c96c1)}]};}return{'content':[{'type':_0x5d5d5e(0x1d7),'text':JSON[_0x5d5d5e(0x1bf)]({'error':_0x5d5d5e(0x21f)})}]};});async function u(){const _0x3de458=a0_0x52c031;let _0x5080d1=f+_0x3de458(0x1b9)+encodeURIComponent(Z),_0x36194b={};if(X)_0x36194b[_0x3de458(0x22d)]=_0x3de458(0x23f)+X;Y('connecting\x20to\x20'+_0x5080d1);while(!0x0){try{let _0x12dbb9=await fetch(_0x5080d1,{'headers':_0x36194b});if(!_0x12dbb9['ok']){Y(_0x3de458(0x1e5)+_0x12dbb9[_0x3de458(0x23a)]+'\x20'+_0x12dbb9['statusText']),await h(0x1388);continue;}let _0x5c60f4=_0x12dbb9['body'][_0x3de458(0x1f6)](),_0x506df5=new TextDecoder(),_0x154a56='';while(!0x0){let {done:_0x33e566,value:_0xd2fce9}=await _0x5c60f4[_0x3de458(0x217)]();if(_0x33e566)break;_0x154a56+=_0x506df5[_0x3de458(0x208)](_0xd2fce9,{'stream':!0x0});let _0x3f4629=_0x154a56[_0x3de458(0x21c)]('\x0a\x0a');_0x154a56=_0x3f4629[_0x3de458(0x206)]()||'';for(let _0x35a5af of _0x3f4629){let _0x57c5c7=_0x35a5af['split']('\x0a')[_0x3de458(0x20d)](_0x48236d=>_0x48236d[_0x3de458(0x212)](_0x3de458(0x1ef)));if(!_0x57c5c7)continue;try{let _0x225e66=JSON[_0x3de458(0x1f2)](_0x57c5c7[_0x3de458(0x1f3)](0x6));await S(_0x225e66);}catch(_0x48e7d9){Y('parse\x20error:\x20'+_0x48e7d9);}}}Y(_0x3de458(0x238));}catch(_0x4368f4){Y(_0x3de458(0x1c4)+_0x4368f4);}await h(0xbb8);}}async function S(_0x1966dc){const _0x28a57d=a0_0x52c031;if(_0x1966dc[_0x28a57d(0x1cd)]==='connected'){Y(_0x28a57d(0x1b5)+Z+'\x22');return;}if(_0x1966dc[_0x28a57d(0x1cd)]===_0x28a57d(0x205)){if(Y(_0x28a57d(0x1fc)+_0x1966dc['from']+':\x20'+_0x1966dc[_0x28a57d(0x1d1)][_0x28a57d(0x1f3)](0x0,0x3c)),await K[_0x28a57d(0x1eb)]({'method':'notifications/claude/channel','params':{'content':_0x1966dc[_0x28a57d(0x1d1)],'meta':{'sender':_0x1966dc[_0x28a57d(0x20c)]||_0x28a57d(0x202),'sender_id':_0x28a57d(0x1d9),'user':_0x1966dc['from']||_0x28a57d(0x202),'priority':_0x28a57d(0x1c7)}}}),_0x1966dc[_0x28a57d(0x20f)])await P(_0x28a57d(0x236),{'alias':Z,'message_id':_0x1966dc['message_id']});return;}if(_0x1966dc[_0x28a57d(0x1cd)]===_0x28a57d(0x1c9)||_0x1966dc['type']===_0x28a57d(0x227)){Y('←\x20'+_0x1966dc['type']+_0x28a57d(0x22a)+_0x1966dc['inbox_count']+_0x28a57d(0x1d2)+(_0x1966dc[_0x28a57d(0x1ee)]||_0x28a57d(0x1c7)));let _0x314ef9=await P(_0x28a57d(0x233),{'alias':Z,'limit':0x5});if(_0x314ef9?.['ok']&&_0x314ef9[_0x28a57d(0x209)]?.[_0x28a57d(0x1b4)]>0x0)for(let _0xda1ec9 of _0x314ef9[_0x28a57d(0x209)]){let _0x211612={'sender':_0xda1ec9[_0x28a57d(0x231)]||_0x28a57d(0x202),'sender_id':_0x28a57d(0x1d9),'user':_0xda1ec9[_0x28a57d(0x231)]||'hub','task_id':_0xda1ec9['id'],'priority':_0xda1ec9['priority']||_0x28a57d(0x1c7)};k[_0x28a57d(0x228)](_0xda1ec9['id'],_0xda1ec9[_0x28a57d(0x231)]||_0x28a57d(0x202)),await K[_0x28a57d(0x1eb)]({'method':_0x28a57d(0x1df),'params':{'content':_0xda1ec9[_0x28a57d(0x23e)],'meta':_0x211612}}),Y(_0x28a57d(0x1b7)+_0xda1ec9['id'][_0x28a57d(0x1f3)](0x0,0x8)+_0x28a57d(0x1f8)+_0xda1ec9[_0x28a57d(0x231)]+':\x20'+_0xda1ec9[_0x28a57d(0x23e)][_0x28a57d(0x1f3)](0x0,0x3c)),await P(_0x28a57d(0x236),{'alias':Z,'message_id':_0xda1ec9['id']});}}}async function A(){const _0xefeb04=a0_0x52c031;let _0xde6f50=new a0_0x4c09c9();await K['connect'](_0xde6f50),Y(_0xefeb04(0x216)),Y('starting\x20SSE\x20listener...'),u()[_0xefeb04(0x21b)](_0x3a561c=>Y(_0xefeb04(0x1b6)+_0x3a561c)),P(_0xefeb04(0x204),{'resume_id':w,'alias':Z,'status':_0xefeb04(0x1e0),'server':a0_0x3936f5(),'hostname':a0_0x3936f5(),'agent':_0xefeb04(0x22f),'project_dir':process[_0xefeb04(0x1c0)](),'tmux_name':j||void 0x0})[_0xefeb04(0x1f1)](()=>Y(_0xefeb04(0x21d)+Z+'\x22\x20('+w['slice'](0x0,0x8)+')'))[_0xefeb04(0x21b)](_0x4057af=>Y(_0xefeb04(0x1c3)+_0x4057af)),setInterval(()=>{const _0x1f9537=_0xefeb04;P(_0x1f9537(0x204),{'resume_id':w,'alias':Z,'status':'idle','server':a0_0x3936f5(),'hostname':a0_0x3936f5(),'agent':_0x1f9537(0x22f),'project_dir':process[_0x1f9537(0x1c0)](),'tmux_name':j||void 0x0})['catch'](_0x24ff68=>Y(_0x1f9537(0x1bb)+_0x24ff68));},0x2bf20),Y(_0xefeb04(0x1d8));}A()[a0_0x52c031(0x21b)](_0xf4155b=>{const _0x230ee7=a0_0x52c031;Y('fatal:\x20'+_0xf4155b),process[_0x230ee7(0x229)](0x1);});async function N(){const _0xf68062=a0_0x52c031;Y('shutting\x20down,\x20reporting\x20offline...'),await P(_0xf68062(0x204),{'resume_id':w,'alias':Z,'status':_0xf68062(0x21a),'task':_0xf68062(0x1d0)})[_0xf68062(0x21b)](()=>{}),process['exit'](0x0);}process['stdin']['on']('end',()=>N()),process['on'](a0_0x52c031(0x1b3),()=>N()),process['on'](a0_0x52c031(0x1f0),()=>N());
|
|
2
|
+
const a0_0xccdd88=a0_0x3a8d;function a0_0x276c(){const _0x42cc77=['warning:\x20could\x20not\x20register:\x20','2iAVarh','commhub_get_all_status','string','notifications/claude/channel','0.3.0','pop','content','451851vqpZNc','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','normal','150MHUdik','33QqpEQV','from_session','.env','commhub_reply','join','Message\x20content','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','type','replace','connecting\x20to\x20','registered\x20as\x20\x22','1785791qShxhP','stdin','starting\x20SSE\x20listener...','split','POST',':\x20inbox_count=','report_status','object','messages','Task\x20content','Current\x20task\x20description','connected','status','Session\x20alias:\x20','length','failed','2025-03-26','working','completed','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','http://127.0.0.1:9200','tools/call','delete','application/json','hub','broadcast','params','no\x20response','SSE\x20error:\x20','session\x20disconnected','replied','1642325eCZlfY','54tEPTNH','Priority\x20(default:\x20normal)','decode','inbox_count','exit','.claude/channels/commhub','←\x20message\x20from\x20','read','Reply\x20text\x20/\x20result\x20summary','end','set','send_message','599528uqTBbd','alias','\x20from\x20','commhub-channel','error','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','.anet','slice','stringify','...\x20TMUX=','get_inbox','data:\x20','Authorization','task','commhub','commhub_send_message','143430Oktbgm','find','shutting\x20down,\x20reporting\x20offline...','write','cwd','SIGINT','SSE\x20stream\x20ended,\x20reconnecting...','high','fatal:\x20','startsWith','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','/events/','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','parse\x20error:\x20','parse','message_id','utf-8','trim','priority','/mcp','2.0','number','idle','Bearer\x20','blocked','low','20556hPXtBB','6OjWIup','toTimeString','stderr','SIGTERM','result','connect','catch','ack_inbox','CommHub\x20init\x20failed:\x20','setRequestHandler','MCP\x20stdio\x20connected','indexOf','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','commhub_send_task','\x20priority=','text','message','commhub_report_status','Target\x20session\x20alias','new_task','from','ready\x20—\x20waiting\x20for\x20events','→\x20injected\x20task\x20','SSE\x20connected\x20as\x20\x22','then','1456896bbkagn','init\x20failed:\x20','send_reply','\x20RESUME_ID=','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','\x20ALIAS='];a0_0x276c=function(){return _0x42cc77;};return a0_0x276c();}(function(_0x4fd0d9,_0x33bcbf){const _0x498f6d=a0_0x3a8d,_0x1c173e=_0x4fd0d9();while(!![]){try{const _0x22e7a2=parseInt(_0x498f6d(0x1b4))/0x1*(-parseInt(_0x498f6d(0x1ad))/0x2)+-parseInt(_0x498f6d(0x1b8))/0x3*(parseInt(_0x498f6d(0x21a))/0x4)+parseInt(_0x498f6d(0x1e3))/0x5+-parseInt(_0x498f6d(0x21b))/0x6*(-parseInt(_0x498f6d(0x1c4))/0x7)+parseInt(_0x498f6d(0x1f0))/0x8+-parseInt(_0x498f6d(0x1e4))/0x9*(parseInt(_0x498f6d(0x200))/0xa)+-parseInt(_0x498f6d(0x1b9))/0xb*(-parseInt(_0x498f6d(0x1a6))/0xc);if(_0x22e7a2===_0x33bcbf)break;else _0x1c173e['push'](_0x1c173e['shift']());}catch(_0x12af75){_0x1c173e['push'](_0x1c173e['shift']());}}}(a0_0x276c,0x37a2c));import{readFileSync as a0_0x260740,existsSync as a0_0xc5220e}from'fs';import{randomUUID as a0_0x39f2ad}from'crypto';import{join as a0_0x5f0e24}from'path';import{hostname as a0_0x9eaea}from'os';import{execSync as a0_0x5c4780}from'child_process';import{Server as a0_0x5e9532}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1a8e10}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4ef641,CallToolRequestSchema as a0_0xfc25ca}from'@modelcontextprotocol/sdk/types.js';function p(_0x57bd38){const _0x3ba0c9=a0_0x3a8d;if(!a0_0xc5220e(_0x57bd38))return;for(let _0x118cdc of a0_0x260740(_0x57bd38,_0x3ba0c9(0x210))[_0x3ba0c9(0x1c7)]('\x0a')){let _0x33adc5=_0x118cdc[_0x3ba0c9(0x211)]();if(!_0x33adc5||_0x33adc5[_0x3ba0c9(0x209)]('#'))continue;let _0xa79fd3=_0x33adc5[_0x3ba0c9(0x198)]('=');if(_0xa79fd3<0x0)continue;let _0x457ace=_0x33adc5[_0x3ba0c9(0x1f7)](0x0,_0xa79fd3)['trim'](),_0x4ee579=_0x33adc5[_0x3ba0c9(0x1f7)](_0xa79fd3+0x1)[_0x3ba0c9(0x211)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x457ace])process.env[_0x457ace]=_0x4ee579;}}var C=process.env.HOME||'~',T=a0_0x5f0e24(C,a0_0xccdd88(0x1e9));p(a0_0x5f0e24(T,a0_0xccdd88(0x1bb)));var L=process[a0_0xccdd88(0x204)]()[a0_0xccdd88(0x1c1)](/\//g,'-');p(a0_0x5f0e24(T,L,'.env'));function U(){const _0x5ead4a=a0_0xccdd88;try{return a0_0x5c4780('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x5ead4a(0x210),'timeout':0x7d0})[_0x5ead4a(0x211)]();}catch{return'';}}function v(){const _0x35e3b0=a0_0xccdd88;try{let _0x1d58b7=a0_0x5f0e24(C,_0x35e3b0(0x1f6),'config.json');if(a0_0xc5220e(_0x1d58b7))return JSON[_0x35e3b0(0x20e)](a0_0x260740(_0x1d58b7,_0x35e3b0(0x210)));}catch{}return{};}var H=v(),f=process.env.COMMHUB_URL||H[a0_0xccdd88(0x1dc)]||a0_0xccdd88(0x1d8),j=process.env.COMMHUB_TMUX||U(),Z=process.env.COMMHUB_ALIAS||j||a0_0x9eaea(),w=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x39f2ad(),X=process.env.COMMHUB_TOKEN||H['token']||'';function Y(_0x4c05f8){const _0x203735=a0_0xccdd88;let _0x4b4621=new Date()[_0x203735(0x21c)]()['slice'](0x0,0x8);process[_0x203735(0x21d)][_0x203735(0x203)]('['+_0x4b4621+']\x20[commhub]\x20'+_0x4c05f8+'\x0a');}function h(_0x1de7d0){return new Promise(_0x40c2f3=>setTimeout(_0x40c2f3,_0x1de7d0));}Y('ENV:\x20URL='+f+a0_0xccdd88(0x1ab)+Z+a0_0xccdd88(0x1a9)+w[a0_0xccdd88(0x1f7)](0x0,0x8)+a0_0xccdd88(0x1f9)+(j||'none')+'\x20CWD='+process[a0_0xccdd88(0x204)]()+'\x20PROJECT_ENV='+L);var k=new Map(),K=new a0_0x5e9532({'name':a0_0xccdd88(0x1f3),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0xccdd88(0x20a),a0_0xccdd88(0x1b6),a0_0xccdd88(0x1d7),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0xccdd88(0x1d1)+Z][a0_0xccdd88(0x1bd)]('\x0a')});function a0_0x3a8d(_0x1a21b6,_0x4a849b){_0x1a21b6=_0x1a21b6-0x195;const _0x276c07=a0_0x276c();let _0x3a8dfb=_0x276c07[_0x1a21b6];return _0x3a8dfb;}K[a0_0xccdd88(0x196)](a0_0x4ef641,async()=>({'tools':[{'name':a0_0xccdd88(0x1bc),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0xccdd88(0x1cb),'properties':{'task_id':{'type':a0_0xccdd88(0x1af),'description':a0_0xccdd88(0x20c)},'text':{'type':a0_0xccdd88(0x1af),'description':a0_0xccdd88(0x1ec)},'status':{'type':a0_0xccdd88(0x1af),'enum':['completed','failed','cancelled','blocked',a0_0xccdd88(0x1f4),'in_progress'],'description':a0_0xccdd88(0x1aa)}},'required':['text']}},{'name':a0_0xccdd88(0x19e),'description':a0_0xccdd88(0x1f5),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0xccdd88(0x1af),'enum':[a0_0xccdd88(0x1d5),a0_0xccdd88(0x216),'blocked','error']},'task':{'type':'string','description':a0_0xccdd88(0x1ce)},'progress':{'type':a0_0xccdd88(0x215),'description':'Progress\x200-100'}},'required':[a0_0xccdd88(0x1d0)]}},{'name':'commhub_send_task','description':a0_0xccdd88(0x199),'inputSchema':{'type':a0_0xccdd88(0x1cb),'properties':{'alias':{'type':a0_0xccdd88(0x1af),'description':'Target\x20session\x20alias'},'task':{'type':a0_0xccdd88(0x1af),'description':a0_0xccdd88(0x1cd)},'priority':{'type':a0_0xccdd88(0x1af),'enum':[a0_0xccdd88(0x207),a0_0xccdd88(0x1b7),a0_0xccdd88(0x219)],'description':a0_0xccdd88(0x1e5)}},'required':[a0_0xccdd88(0x1f1),a0_0xccdd88(0x1fd)]}},{'name':a0_0xccdd88(0x1ff),'description':a0_0xccdd88(0x1bf),'inputSchema':{'type':a0_0xccdd88(0x1cb),'properties':{'alias':{'type':a0_0xccdd88(0x1af),'description':a0_0xccdd88(0x19f)},'message':{'type':'string','description':a0_0xccdd88(0x1be)}},'required':['alias',a0_0xccdd88(0x19d)]}},{'name':a0_0xccdd88(0x1ae),'description':a0_0xccdd88(0x1b5),'inputSchema':{'type':'object','properties':{}}}]}));async function P(_0x47d7c1,_0x37c613){const _0x14d67f=a0_0xccdd88;let _0x507567=await fetch(f+_0x14d67f(0x213),{'method':'POST','headers':{'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream',...X?{'Authorization':_0x14d67f(0x217)+X}:{}},'body':JSON[_0x14d67f(0x1f8)]({'jsonrpc':_0x14d67f(0x214),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x14d67f(0x1d4),'capabilities':{},'clientInfo':{'name':_0x14d67f(0x1f3),'version':_0x14d67f(0x1b1)}}})});if(!_0x507567['ok']){let _0xb2f295=await _0x507567['text']();return Y(_0x14d67f(0x195)+_0x507567['status']+'\x20'+_0xb2f295[_0x14d67f(0x1f7)](0x0,0x64)),{'ok':!0x1,'error':_0x14d67f(0x1a7)+_0x507567['status']};}await _0x507567[_0x14d67f(0x19c)]();let _0x67e88c=(await(await fetch(f+_0x14d67f(0x213),{'method':_0x14d67f(0x1c8),'headers':{'Content-Type':_0x14d67f(0x1db),'Accept':'application/json,\x20text/event-stream',...X?{'Authorization':'Bearer\x20'+X}:{}},'body':JSON[_0x14d67f(0x1f8)]({'jsonrpc':_0x14d67f(0x214),'id':0x2,'method':_0x14d67f(0x1d9),'params':{'name':_0x47d7c1,'arguments':_0x37c613}})}))[_0x14d67f(0x19c)]())['split']('\x0a')[_0x14d67f(0x201)](_0x449d8d=>_0x449d8d['startsWith'](_0x14d67f(0x1fb)));if(_0x67e88c){let _0x43cbe6=JSON['parse'](_0x67e88c['slice'](0x6));return _0x43cbe6?.[_0x14d67f(0x21f)]?.[_0x14d67f(0x1b3)]?.[0x0]?.[_0x14d67f(0x19c)]?JSON['parse'](_0x43cbe6[_0x14d67f(0x21f)][_0x14d67f(0x1b3)][0x0][_0x14d67f(0x19c)]):_0x43cbe6;}return{'ok':!0x1,'error':_0x14d67f(0x1df)};}K[a0_0xccdd88(0x196)](a0_0xfc25ca,async _0x172ec2=>{const _0x5c4da4=a0_0xccdd88;let {name:_0x387a47,arguments:_0x4f9f85}=_0x172ec2[_0x5c4da4(0x1de)];if(_0x387a47==='commhub_reply'){let {task_id:_0x21fda0,text:_0x18ccdd,status:_0x58d8f2}=_0x4f9f85;if(_0x58d8f2===_0x5c4da4(0x1d6)||_0x58d8f2===_0x5c4da4(0x1d3)||_0x58d8f2==='cancelled'){let _0xdd8a7c=_0x58d8f2==='completed'?_0x5c4da4(0x1e2):_0x58d8f2,_0x58f27b=_0x21fda0?k['get'](_0x21fda0)||_0x5c4da4(0x1dc):'hub',_0x2d2aa3=await P(_0x5c4da4(0x1a8),{'alias':_0x58f27b,'text':_0x18ccdd,'in_reply_to':_0x21fda0||void 0x0,'status':_0xdd8a7c,'from_session':Z});if(_0x21fda0)k[_0x5c4da4(0x1da)](_0x21fda0);return{'content':[{'type':_0x5c4da4(0x19c),'text':JSON[_0x5c4da4(0x1f8)](_0x2d2aa3)}]};}let _0x183d4e=await P(_0x5c4da4(0x1ca),{'resume_id':w,'alias':Z,'status':_0x58d8f2===_0x5c4da4(0x218)?'blocked':_0x58d8f2===_0x5c4da4(0x1f4)?'error':'working','task':_0x18ccdd['slice'](0x0,0xc8),'output':_0x18ccdd});return{'content':[{'type':_0x5c4da4(0x19c),'text':JSON['stringify'](_0x183d4e)}]};}if(_0x387a47===_0x5c4da4(0x19e)){let {status:_0x561fb5,task:_0x9ea58d,progress:_0x351504}=_0x4f9f85,_0x192922=await P(_0x5c4da4(0x1ca),{'resume_id':w,'alias':Z,'status':_0x561fb5,'task':_0x9ea58d,'progress':_0x351504});return{'content':[{'type':_0x5c4da4(0x19c),'text':JSON[_0x5c4da4(0x1f8)](_0x192922)}]};}if(_0x387a47===_0x5c4da4(0x19a)){let {alias:_0x5171b9,task:_0x39bc7d,priority:_0x9e89c6}=_0x4f9f85,_0x1c1cc3=await P('send_task',{'alias':_0x5171b9,'task':_0x39bc7d,'priority':_0x9e89c6||_0x5c4da4(0x1b7),'from_session':Z});return{'content':[{'type':_0x5c4da4(0x19c),'text':JSON[_0x5c4da4(0x1f8)](_0x1c1cc3)}]};}if(_0x387a47===_0x5c4da4(0x1ff)){let {alias:_0x121f96,message:_0x56bf23}=_0x4f9f85,_0x36b06b=await P(_0x5c4da4(0x1ef),{'alias':_0x121f96,'message':_0x56bf23,'from_session':Z});return{'content':[{'type':'text','text':JSON['stringify'](_0x36b06b)}]};}if(_0x387a47===_0x5c4da4(0x1ae)){let _0x14cc9c=await P('get_all_status',{});return{'content':[{'type':'text','text':JSON[_0x5c4da4(0x1f8)](_0x14cc9c)}]};}return{'content':[{'type':_0x5c4da4(0x19c),'text':JSON[_0x5c4da4(0x1f8)]({'error':'unknown\x20tool'})}]};});async function u(){const _0x201c12=a0_0xccdd88;let _0x2a0cd1=f+_0x201c12(0x20b)+encodeURIComponent(Z),_0x1ce8e2={};if(X)_0x1ce8e2[_0x201c12(0x1fc)]=_0x201c12(0x217)+X;Y(_0x201c12(0x1c2)+_0x2a0cd1);while(!0x0){try{let _0x2dc0d9=await fetch(_0x2a0cd1,{'headers':_0x1ce8e2});if(!_0x2dc0d9['ok']){Y(_0x201c12(0x1e0)+_0x2dc0d9[_0x201c12(0x1d0)]+'\x20'+_0x2dc0d9['statusText']),await h(0x1388);continue;}let _0x3038b8=_0x2dc0d9['body']['getReader'](),_0x1525b2=new TextDecoder(),_0x373f3a='';while(!0x0){let {done:_0x4dea90,value:_0x5b26d0}=await _0x3038b8[_0x201c12(0x1eb)]();if(_0x4dea90)break;_0x373f3a+=_0x1525b2[_0x201c12(0x1e6)](_0x5b26d0,{'stream':!0x0});let _0x533f99=_0x373f3a[_0x201c12(0x1c7)]('\x0a\x0a');_0x373f3a=_0x533f99[_0x201c12(0x1b2)]()||'';for(let _0x2675ee of _0x533f99){let _0x4d3a24=_0x2675ee[_0x201c12(0x1c7)]('\x0a')['find'](_0x49ac1c=>_0x49ac1c['startsWith']('data:\x20'));if(!_0x4d3a24)continue;try{let _0xa9bad5=JSON[_0x201c12(0x20e)](_0x4d3a24[_0x201c12(0x1f7)](0x6));await S(_0xa9bad5);}catch(_0x4660ac){Y(_0x201c12(0x20d)+_0x4660ac);}}}Y(_0x201c12(0x206));}catch(_0x2b54c3){Y('SSE\x20connection\x20error:\x20'+_0x2b54c3);}await h(0xbb8);}}async function S(_0x2a4693){const _0x1db0bf=a0_0xccdd88;if(_0x2a4693[_0x1db0bf(0x1c0)]===_0x1db0bf(0x1cf)){Y(_0x1db0bf(0x1a4)+Z+'\x22');return;}if(_0x2a4693[_0x1db0bf(0x1c0)]==='new_message'){if(Y(_0x1db0bf(0x1ea)+_0x2a4693[_0x1db0bf(0x1a1)]+':\x20'+_0x2a4693[_0x1db0bf(0x19d)]['slice'](0x0,0x3c)),await K['notification']({'method':_0x1db0bf(0x1b0),'params':{'content':_0x2a4693[_0x1db0bf(0x19d)],'meta':{'sender':_0x2a4693['from']||'hub','sender_id':_0x1db0bf(0x1fe),'user':_0x2a4693[_0x1db0bf(0x1a1)]||_0x1db0bf(0x1dc),'priority':_0x1db0bf(0x1b7)}}}),_0x2a4693[_0x1db0bf(0x20f)])await P(_0x1db0bf(0x222),{'alias':Z,'message_id':_0x2a4693['message_id']});return;}if(_0x2a4693['type']===_0x1db0bf(0x1a0)||_0x2a4693[_0x1db0bf(0x1c0)]===_0x1db0bf(0x1dd)){Y('←\x20'+_0x2a4693[_0x1db0bf(0x1c0)]+_0x1db0bf(0x1c9)+_0x2a4693[_0x1db0bf(0x1e7)]+_0x1db0bf(0x19b)+(_0x2a4693['priority']||_0x1db0bf(0x1b7)));let _0x47a541=await P(_0x1db0bf(0x1fa),{'alias':Z,'limit':0x5});if(_0x47a541?.['ok']&&_0x47a541[_0x1db0bf(0x1cc)]?.[_0x1db0bf(0x1d2)]>0x0)for(let _0x3b578f of _0x47a541[_0x1db0bf(0x1cc)]){let _0xec56d1={'sender':_0x3b578f['from_session']||'hub','sender_id':_0x1db0bf(0x1fe),'user':_0x3b578f['from_session']||'hub','task_id':_0x3b578f['id'],'priority':_0x3b578f[_0x1db0bf(0x212)]||_0x1db0bf(0x1b7)};k[_0x1db0bf(0x1ee)](_0x3b578f['id'],_0x3b578f[_0x1db0bf(0x1ba)]||'hub'),await K['notification']({'method':_0x1db0bf(0x1b0),'params':{'content':_0x3b578f[_0x1db0bf(0x1b3)],'meta':_0xec56d1}}),Y(_0x1db0bf(0x1a3)+_0x3b578f['id']['slice'](0x0,0x8)+_0x1db0bf(0x1f2)+_0x3b578f[_0x1db0bf(0x1ba)]+':\x20'+_0x3b578f['content'][_0x1db0bf(0x1f7)](0x0,0x3c)),await P(_0x1db0bf(0x222),{'alias':Z,'message_id':_0x3b578f['id']});}}}async function A(){const _0x14993a=a0_0xccdd88;let _0x5beefe=new a0_0x1a8e10();await K[_0x14993a(0x220)](_0x5beefe),Y(_0x14993a(0x197)),Y(_0x14993a(0x1c6)),u()[_0x14993a(0x221)](_0x3182a7=>Y('SSE\x20fatal:\x20'+_0x3182a7)),P(_0x14993a(0x1ca),{'resume_id':w,'alias':Z,'status':_0x14993a(0x216),'server':a0_0x9eaea(),'hostname':a0_0x9eaea(),'agent':'claude-code','project_dir':process[_0x14993a(0x204)](),'tmux_name':j||void 0x0})[_0x14993a(0x1a5)](()=>Y(_0x14993a(0x1c3)+Z+'\x22\x20('+w[_0x14993a(0x1f7)](0x0,0x8)+')'))['catch'](_0x1a4c3e=>Y(_0x14993a(0x1ac)+_0x1a4c3e)),setInterval(()=>{const _0x2c9540=_0x14993a;P('report_status',{'resume_id':w,'alias':Z,'status':_0x2c9540(0x216),'server':a0_0x9eaea(),'hostname':a0_0x9eaea(),'agent':'claude-code','project_dir':process[_0x2c9540(0x204)](),'tmux_name':j||void 0x0})[_0x2c9540(0x221)](_0x3ec6ba=>Y('heartbeat\x20failed:\x20'+_0x3ec6ba));},0x2bf20),Y(_0x14993a(0x1a2));}A()['catch'](_0x5112e6=>{const _0x4aba0d=a0_0xccdd88;Y(_0x4aba0d(0x208)+_0x5112e6),process[_0x4aba0d(0x1e8)](0x1);});async function N(){const _0x25e355=a0_0xccdd88;Y(_0x25e355(0x202)),await P(_0x25e355(0x1ca),{'resume_id':w,'alias':Z,'status':'error','task':_0x25e355(0x1e1)})['catch'](()=>{}),process[_0x25e355(0x1e8)](0x0);}process[a0_0xccdd88(0x1c5)]['on'](a0_0xccdd88(0x1ed),()=>N()),process['on'](a0_0xccdd88(0x21e),()=>N()),process['on'](a0_0xccdd88(0x205),()=>N());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.1.8-preview.
|
|
3
|
+
"version": "2.1.8-preview.8",
|
|
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",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"url": "https://github.com/sleep2agi/agent-network/issues"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
|
-
"bun": ">=1.2.0"
|
|
55
|
+
"bun": ">=1.2.0",
|
|
56
|
+
"node": ">=22.13.0"
|
|
56
57
|
},
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"@inquirer/prompts": "^8.4.3"
|