@sleep2agi/agent-network 2.3.0-preview.21 → 2.3.0-preview.23

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.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x433c2f=a0_0xb524;(function(_0xb2c8bd,_0x1229e0){const _0x359232=a0_0xb524,_0x32eac3=_0xb2c8bd();while(!![]){try{const _0x459b1f=parseInt(_0x359232(0x247))/0x1*(-parseInt(_0x359232(0x1b7))/0x2)+-parseInt(_0x359232(0x200))/0x3*(parseInt(_0x359232(0x1cc))/0x4)+-parseInt(_0x359232(0x201))/0x5*(parseInt(_0x359232(0x245))/0x6)+parseInt(_0x359232(0x205))/0x7*(parseInt(_0x359232(0x21c))/0x8)+parseInt(_0x359232(0x1cd))/0x9+parseInt(_0x359232(0x1e8))/0xa+parseInt(_0x359232(0x1f0))/0xb;if(_0x459b1f===_0x1229e0)break;else _0x32eac3['push'](_0x32eac3['shift']());}catch(_0x50c184){_0x32eac3['push'](_0x32eac3['shift']());}}}(a0_0xc9d3,0x9eda2));import{readFileSync as a0_0x21b53a,existsSync as a0_0x348584}from'fs';import{randomUUID as a0_0x3148f3}from'crypto';import{join as a0_0x41ccce}from'path';import{hostname as a0_0x5c6388}from'os';import{execSync as a0_0x370c54}from'child_process';function B(_0x4e7c98){const _0x564960=a0_0xb524;let _0x2b2732=_0x4e7c98[_0x564960(0x1c0)](/[^a-zA-Z0-9\-_]/g,'-');return _0x2b2732===''?_0x564960(0x204):_0x2b2732;}import{Server as a0_0x1e14c1}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x4af890}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x2595ff,CallToolRequestSchema as a0_0x120387}from'@modelcontextprotocol/sdk/types.js';function T(_0x1a3d17){const _0x250b01=a0_0xb524;if(!a0_0x348584(_0x1a3d17))return;for(let _0x1244e4 of a0_0x21b53a(_0x1a3d17,_0x250b01(0x23d))[_0x250b01(0x207)]('\x0a')){let _0x1291f4=_0x1244e4[_0x250b01(0x20c)]();if(!_0x1291f4||_0x1291f4[_0x250b01(0x21a)]('#'))continue;let _0x1ee40a=_0x1291f4[_0x250b01(0x21d)]('=');if(_0x1ee40a<0x0)continue;let _0x3a8581=_0x1291f4[_0x250b01(0x203)](0x0,_0x1ee40a)[_0x250b01(0x20c)](),_0x173986=_0x1291f4[_0x250b01(0x203)](_0x1ee40a+0x1)[_0x250b01(0x20c)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x3a8581])process.env[_0x3a8581]=_0x173986;}}var C=process.env.HOME||'~',r=a0_0x41ccce(C,a0_0x433c2f(0x1ff));T(a0_0x41ccce(r,a0_0x433c2f(0x211)));var H=B(process[a0_0x433c2f(0x21e)]());T(a0_0x41ccce(r,H,a0_0x433c2f(0x211)));function E(){const _0xd52e86=a0_0x433c2f;try{return a0_0x370c54(_0xd52e86(0x239),{'encoding':_0xd52e86(0x23d),'timeout':0x7d0})[_0xd52e86(0x20c)]();}catch{return'';}}function _(){const _0x12eb45=a0_0x433c2f;try{let _0x2a39cb=a0_0x41ccce(C,_0x12eb45(0x1e0),_0x12eb45(0x1b4));if(a0_0x348584(_0x2a39cb))return JSON[_0x12eb45(0x241)](a0_0x21b53a(_0x2a39cb,_0x12eb45(0x23d)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x433c2f(0x1fe)]||a0_0x433c2f(0x1b2),j=process.env.COMMHUB_TMUX||E();function S(){const _0x10dad6=a0_0x433c2f;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x10dad6(0x20c)]())return process.env.COMMHUB_ALIAS[_0x10dad6(0x20c)]();return process[_0x10dad6(0x20b)][_0x10dad6(0x1ac)]('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+('would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME='+(j||'(none)')+_0x10dad6(0x1ba)+a0_0x5c6388()+_0x10dad6(0x24c))),_0x10dad6(0x235)+process[_0x10dad6(0x1c2)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x3148f3(),k=process.env.COMMHUB_TOKEN||R[a0_0x433c2f(0x1c5)]||'';function a0_0xc9d3(){const _0x525fe2=['task','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','SSE\x20stream\x20ended,\x20reconnecting...','POST','\x20PROJECT_ENV=','working','Task\x20content','message_id','notification','.anet','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','cancelled','registered\x20as\x20\x22','exit','SSE\x20connection\x20error:\x20','messages','commhub_send_message','3067850VIJsat','priority','Authorization','min','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','send_message','session\x20disconnected','commhub_get_all_status','3074511CowflG','delete','commhub-channel','notifications/claude/channel',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','join','connected','\x22\x20after\x20SSE\x20reconnect','stringify','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','commhub_reply',':\x20inbox_count=','/mcp','new_task','hub','.claude/channels/commhub','1824mZhkSN','5dpCAtn','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','slice','unknown','14hsPUSu','text','split','Reply\x20text\x20/\x20result\x20summary','fatal:\x20','stdin','stderr','trim','ESRCH','body','alias','re-registered\x20as\x20\x22','.env','starting\x20SSE\x20listener...','application/json,\x20text/event-stream','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','from_session','shutting\x20down,\x20reporting\x20offline...','SSE\x20fatal:\x20','←\x20message\x20from\x20','error','startsWith','data:\x20','2032432WzkKbO','indexOf','cwd','none','find','\x20RESUME_ID=','ppid','in_progress','ready\x20—\x20waiting\x20for\x20events','broadcast','SIGINT','MCP\x20stdio\x20connected','Progress\x200-100','get_inbox','end','message','read','code','failed','function','params','Session\x20alias:\x20','offline','commhub_send_task','inbox_count','unattributed-','type','idle','parse\x20error:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','getReader','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','normal','utf-8','string','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','unknown\x20tool','parse','0.3.0','2.0','pop','1495170iyTcCH','init\x20failed:\x20','164062gmvStB','length','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','unref','send_task','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','blocked','from','Priority\x20(default:\x20normal)','object','catch','toTimeString','connect','write','report_status','kill','...\x20TMUX=','Bearer\x20','content','http://127.0.0.1:9200','\x22\x20(','config.json','result','SSE\x20error:\x20','4UUZCQr','get_all_status','number','\x20/\x20hostname=','→\x20injected\x20task\x20','CommHub\x20init\x20failed:\x20','completed','now','Current\x20task\x20description','replace','commhub_report_status','pid','status','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','token','decode','set','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','parent\x20claude\x20pid=','get','7656ixrpLQ','11675655CZaGsy','ack_inbox','low','claude-code','SIGTERM','high','setRequestHandler','application/json','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','Target\x20session\x20alias'];a0_0xc9d3=function(){return _0x525fe2;};return a0_0xc9d3();}function z(_0x20af38){const _0x3bd7f=a0_0x433c2f;let _0x4111d5=new Date()[_0x3bd7f(0x253)]()[_0x3bd7f(0x203)](0x0,0x8);process['stderr'][_0x3bd7f(0x1ac)]('['+_0x4111d5+']\x20[commhub]\x20'+_0x20af38+'\x0a');}function i(_0x4a3456){return new Promise(_0xa5f08f=>setTimeout(_0xa5f08f,_0x4a3456));}z('ENV:\x20URL='+Y+'\x20ALIAS='+p+a0_0x433c2f(0x221)+V[a0_0x433c2f(0x203)](0x0,0x8)+a0_0x433c2f(0x1af)+(j||a0_0x433c2f(0x21f))+'\x20CWD='+process[a0_0x433c2f(0x21e)]()+a0_0x433c2f(0x1db)+H);var G=new Map(),K=new a0_0x1e14c1({'name':'commhub-channel','version':a0_0x433c2f(0x242)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x433c2f(0x202),a0_0x433c2f(0x1c8),a0_0x433c2f(0x1ec),a0_0x433c2f(0x1c9),a0_0x433c2f(0x231)+p][a0_0x433c2f(0x1f5)]('\x0a')});K[a0_0x433c2f(0x1d3)](a0_0x2595ff,async()=>({'tools':[{'name':a0_0x433c2f(0x1fa),'description':a0_0x433c2f(0x1e1),'inputSchema':{'type':a0_0x433c2f(0x251),'properties':{'task_id':{'type':a0_0x433c2f(0x23e),'description':a0_0x433c2f(0x23b)},'text':{'type':'string','description':a0_0x433c2f(0x208)},'status':{'type':a0_0x433c2f(0x23e),'enum':[a0_0x433c2f(0x1bd),a0_0x433c2f(0x22e),a0_0x433c2f(0x1e2),a0_0x433c2f(0x24e),'error',a0_0x433c2f(0x223)],'description':a0_0x433c2f(0x249)}},'required':[a0_0x433c2f(0x206)]}},{'name':'commhub_report_status','description':a0_0x433c2f(0x1d5),'inputSchema':{'type':a0_0x433c2f(0x251),'properties':{'status':{'type':a0_0x433c2f(0x23e),'enum':[a0_0x433c2f(0x1dc),a0_0x433c2f(0x237),a0_0x433c2f(0x24e),a0_0x433c2f(0x219)]},'task':{'type':'string','description':a0_0x433c2f(0x1bf)},'progress':{'type':a0_0x433c2f(0x1b9),'description':a0_0x433c2f(0x228)}},'required':[a0_0x433c2f(0x1c3)]}},{'name':a0_0x433c2f(0x233),'description':a0_0x433c2f(0x1c4),'inputSchema':{'type':a0_0x433c2f(0x251),'properties':{'alias':{'type':a0_0x433c2f(0x23e),'description':a0_0x433c2f(0x1d6)},'task':{'type':a0_0x433c2f(0x23e),'description':a0_0x433c2f(0x1dd)},'priority':{'type':a0_0x433c2f(0x23e),'enum':[a0_0x433c2f(0x1d2),a0_0x433c2f(0x23c),a0_0x433c2f(0x1cf)],'description':a0_0x433c2f(0x250)}},'required':[a0_0x433c2f(0x20f),a0_0x433c2f(0x1d7)]}},{'name':a0_0x433c2f(0x1e7),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x433c2f(0x23e),'description':a0_0x433c2f(0x1d6)},'message':{'type':'string','description':'Message\x20content'}},'required':[a0_0x433c2f(0x20f),'message']}},{'name':'commhub_get_all_status','description':a0_0x433c2f(0x214),'inputSchema':{'type':a0_0x433c2f(0x251),'properties':{}}}]}));async function Q(_0x15d7de,_0x5d902d){const _0x3e1b3f=a0_0x433c2f;let _0x1f5756=await fetch(Y+_0x3e1b3f(0x1fc),{'method':_0x3e1b3f(0x1da),'headers':{'Content-Type':_0x3e1b3f(0x1d4),'Accept':_0x3e1b3f(0x213),...k?{'Authorization':_0x3e1b3f(0x1b0)+k}:{}},'body':JSON['stringify']({'jsonrpc':_0x3e1b3f(0x243),'id':0x1,'method':'initialize','params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x3e1b3f(0x1f2),'version':'0.3.0'}}})});if(!_0x1f5756['ok']){let _0x17acb9=await _0x1f5756[_0x3e1b3f(0x206)]();return z(_0x3e1b3f(0x1bc)+_0x1f5756[_0x3e1b3f(0x1c3)]+'\x20'+_0x17acb9['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x3e1b3f(0x246)+_0x1f5756[_0x3e1b3f(0x1c3)]};}await _0x1f5756[_0x3e1b3f(0x206)]();let _0x29c761=(await(await fetch(Y+_0x3e1b3f(0x1fc),{'method':_0x3e1b3f(0x1da),'headers':{'Content-Type':_0x3e1b3f(0x1d4),'Accept':_0x3e1b3f(0x213),...k?{'Authorization':_0x3e1b3f(0x1b0)+k}:{}},'body':JSON[_0x3e1b3f(0x1f8)]({'jsonrpc':_0x3e1b3f(0x243),'id':0x2,'method':'tools/call','params':{'name':_0x15d7de,'arguments':_0x5d902d}})}))[_0x3e1b3f(0x206)]())[_0x3e1b3f(0x207)]('\x0a')[_0x3e1b3f(0x220)](_0x38bd99=>_0x38bd99[_0x3e1b3f(0x21a)](_0x3e1b3f(0x21b)));if(_0x29c761){let _0x191075=JSON[_0x3e1b3f(0x241)](_0x29c761[_0x3e1b3f(0x203)](0x6));return _0x191075?.[_0x3e1b3f(0x1b5)]?.[_0x3e1b3f(0x1b1)]?.[0x0]?.['text']?JSON[_0x3e1b3f(0x241)](_0x191075[_0x3e1b3f(0x1b5)][_0x3e1b3f(0x1b1)][0x0][_0x3e1b3f(0x206)]):_0x191075;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x433c2f(0x1d3)](a0_0x120387,async _0x2cdfbb=>{const _0x34ea9c=a0_0x433c2f;let {name:_0x1fe37a,arguments:_0x3725d9}=_0x2cdfbb[_0x34ea9c(0x230)];if(_0x1fe37a===_0x34ea9c(0x1fa)){let {task_id:_0x2f0318,text:_0xb17867,status:_0x49daea}=_0x3725d9;if(_0x49daea===_0x34ea9c(0x1bd)||_0x49daea===_0x34ea9c(0x22e)||_0x49daea===_0x34ea9c(0x1e2)){let _0x1e432a=_0x49daea===_0x34ea9c(0x1bd)?'replied':_0x49daea,_0x47a1fb=_0x2f0318?G[_0x34ea9c(0x1cb)](_0x2f0318)||_0x34ea9c(0x1fe):_0x34ea9c(0x1fe),_0x13ee40=await Q('send_reply',{'alias':_0x47a1fb,'text':_0xb17867,'in_reply_to':_0x2f0318||void 0x0,'status':_0x1e432a,'from_session':p});if(_0x2f0318)G[_0x34ea9c(0x1f1)](_0x2f0318);return{'content':[{'type':'text','text':JSON['stringify'](_0x13ee40)}]};}let _0x314438=await Q(_0x34ea9c(0x1ad),{'resume_id':V,'alias':p,'status':_0x49daea===_0x34ea9c(0x24e)?_0x34ea9c(0x24e):_0x49daea===_0x34ea9c(0x219)?_0x34ea9c(0x219):_0x34ea9c(0x1dc),'task':_0xb17867[_0x34ea9c(0x203)](0x0,0xc8),'output':_0xb17867});return{'content':[{'type':_0x34ea9c(0x206),'text':JSON['stringify'](_0x314438)}]};}if(_0x1fe37a===_0x34ea9c(0x1c1)){let {status:_0xa997c2,task:_0x3b245d,progress:_0x2c7570}=_0x3725d9,_0x58dfa5=await Q('report_status',{'resume_id':V,'alias':p,'status':_0xa997c2,'task':_0x3b245d,'progress':_0x2c7570});return{'content':[{'type':_0x34ea9c(0x206),'text':JSON[_0x34ea9c(0x1f8)](_0x58dfa5)}]};}if(_0x1fe37a==='commhub_send_task'){let {alias:_0x4051fb,task:_0x28a03e,priority:_0x40f81b}=_0x3725d9,_0x257fe6=await Q(_0x34ea9c(0x24b),{'alias':_0x4051fb,'task':_0x28a03e,'priority':_0x40f81b||_0x34ea9c(0x23c),'from_session':p});return{'content':[{'type':_0x34ea9c(0x206),'text':JSON[_0x34ea9c(0x1f8)](_0x257fe6)}]};}if(_0x1fe37a===_0x34ea9c(0x1e7)){let {alias:_0x149ef6,message:_0x13bf87}=_0x3725d9,_0x2e03fb=await Q(_0x34ea9c(0x1ed),{'alias':_0x149ef6,'message':_0x13bf87,'from_session':p});return{'content':[{'type':_0x34ea9c(0x206),'text':JSON[_0x34ea9c(0x1f8)](_0x2e03fb)}]};}if(_0x1fe37a===_0x34ea9c(0x1ef)){let _0xd58fd9=await Q(_0x34ea9c(0x1b8),{});return{'content':[{'type':'text','text':JSON[_0x34ea9c(0x1f8)](_0xd58fd9)}]};}return{'content':[{'type':_0x34ea9c(0x206),'text':JSON['stringify']({'error':_0x34ea9c(0x240)})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x467ece=a0_0x433c2f;try{await Q('report_status',{'resume_id':V,'alias':p,'status':_0x467ece(0x237),'server':a0_0x5c6388(),'hostname':a0_0x5c6388(),'agent':'claude-code','project_dir':process[_0x467ece(0x21e)](),'tmux_name':j||void 0x0}),z(_0x467ece(0x210)+p+_0x467ece(0x1f7));}catch(_0x2c2e67){z('re-register\x20failed:\x20'+_0x2c2e67);}}async function l(){const _0x47d9a6=a0_0x433c2f;let _0x188125=Y+'/events/'+encodeURIComponent(p),_0x442e3a={};if(k)_0x442e3a[_0x47d9a6(0x1ea)]=_0x47d9a6(0x1b0)+k;z('connecting\x20to\x20'+_0x188125);let _0x4cce36=D,_0x11854d=!0x0,_0x1803b3=null;while(!0x0){try{let _0x6f7b6f=await fetch(_0x188125,{'headers':_0x442e3a});if(!_0x6f7b6f['ok']){if(z(_0x47d9a6(0x1b6)+_0x6f7b6f[_0x47d9a6(0x1c3)]+'\x20'+_0x6f7b6f['statusText']),_0x1803b3=_0x1803b3??Date[_0x47d9a6(0x1be)](),Date[_0x47d9a6(0x1be)]()-_0x1803b3>O){z('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+Y+_0x47d9a6(0x1f4));return;}await i(_0x4cce36),_0x4cce36=Math[_0x47d9a6(0x1eb)](_0x4cce36*0x2,v);continue;}let _0x314665=_0x6f7b6f[_0x47d9a6(0x20e)][_0x47d9a6(0x23a)](),_0x2b7c50=new TextDecoder(),_0x936229='';_0x4cce36=D;while(!0x0){let {done:_0xdd4069,value:_0x4def78}=await _0x314665[_0x47d9a6(0x22c)]();if(_0xdd4069)break;_0x936229+=_0x2b7c50[_0x47d9a6(0x1c6)](_0x4def78,{'stream':!0x0});let _0x4f8164=_0x936229[_0x47d9a6(0x207)]('\x0a\x0a');_0x936229=_0x4f8164[_0x47d9a6(0x244)]()||'';for(let _0x4f8506 of _0x4f8164){let _0x31fff8=_0x4f8506['split']('\x0a')[_0x47d9a6(0x220)](_0x554604=>_0x554604['startsWith']('data:\x20'));if(!_0x31fff8)continue;try{let _0x3d3528=JSON[_0x47d9a6(0x241)](_0x31fff8[_0x47d9a6(0x203)](0x6));if(await A(_0x3d3528),_0x3d3528[_0x47d9a6(0x236)]===_0x47d9a6(0x1f6)){if(_0x1803b3=null,!_0x11854d)await m();_0x11854d=!0x1;}}catch(_0x52745b){z(_0x47d9a6(0x238)+_0x52745b);}}}z(_0x47d9a6(0x1d9));}catch(_0x4e958b){z(_0x47d9a6(0x1e5)+_0x4e958b);}if(_0x1803b3=_0x1803b3??Date['now'](),Date[_0x47d9a6(0x1be)]()-_0x1803b3>O){z(_0x47d9a6(0x1f9)+Y+_0x47d9a6(0x1f4));return;}await i(_0x4cce36),_0x4cce36=Math['min'](_0x4cce36*0x2,v);}}async function A(_0x339286){const _0x17e996=a0_0x433c2f;if(_0x339286[_0x17e996(0x236)]===_0x17e996(0x1f6)){z('SSE\x20connected\x20as\x20\x22'+p+'\x22');return;}if(_0x339286[_0x17e996(0x236)]==='new_message'){if(z(_0x17e996(0x218)+_0x339286['from']+':\x20'+_0x339286[_0x17e996(0x22b)][_0x17e996(0x203)](0x0,0x3c)),await K['notification']({'method':_0x17e996(0x1f3),'params':{'content':_0x339286[_0x17e996(0x22b)],'meta':{'sender':_0x339286['from']||'hub','sender_id':'commhub','user':_0x339286[_0x17e996(0x24f)]||_0x17e996(0x1fe),'priority':'normal'}}}),_0x339286[_0x17e996(0x1de)])await Q(_0x17e996(0x1ce),{'alias':p,'message_id':_0x339286[_0x17e996(0x1de)]});return;}if(_0x339286[_0x17e996(0x236)]===_0x17e996(0x1fd)||_0x339286[_0x17e996(0x236)]===_0x17e996(0x225)){z('←\x20'+_0x339286['type']+_0x17e996(0x1fb)+_0x339286[_0x17e996(0x234)]+'\x20priority='+(_0x339286[_0x17e996(0x1e9)]||'normal'));let _0x124433=await Q(_0x17e996(0x229),{'alias':p,'limit':0x5});if(_0x124433?.['ok']&&_0x124433[_0x17e996(0x1e6)]?.[_0x17e996(0x248)]>0x0)for(let _0x5e7e8c of _0x124433[_0x17e996(0x1e6)]){let _0x4b3781={'sender':_0x5e7e8c[_0x17e996(0x215)]||_0x17e996(0x1fe),'sender_id':'commhub','user':_0x5e7e8c[_0x17e996(0x215)]||_0x17e996(0x1fe),'task_id':_0x5e7e8c['id'],'priority':_0x5e7e8c[_0x17e996(0x1e9)]||_0x17e996(0x23c)};G[_0x17e996(0x1c7)](_0x5e7e8c['id'],_0x5e7e8c['from_session']||_0x17e996(0x1fe)),await K[_0x17e996(0x1df)]({'method':_0x17e996(0x1f3),'params':{'content':_0x5e7e8c[_0x17e996(0x1b1)],'meta':_0x4b3781}}),z(_0x17e996(0x1bb)+_0x5e7e8c['id'][_0x17e996(0x203)](0x0,0x8)+'\x20from\x20'+_0x5e7e8c[_0x17e996(0x215)]+':\x20'+_0x5e7e8c[_0x17e996(0x1b1)][_0x17e996(0x203)](0x0,0x3c)),await Q(_0x17e996(0x1ce),{'alias':p,'message_id':_0x5e7e8c['id']});}}}async function t(){const _0x15faa8=a0_0x433c2f;let _0x159ca1=new a0_0x4af890();await K[_0x15faa8(0x1ab)](_0x159ca1),z(_0x15faa8(0x227)),z(_0x15faa8(0x212)),l()[_0x15faa8(0x252)](_0x3ede06=>z(_0x15faa8(0x217)+_0x3ede06)),Q(_0x15faa8(0x1ad),{'resume_id':V,'alias':p,'status':_0x15faa8(0x237),'server':a0_0x5c6388(),'hostname':a0_0x5c6388(),'agent':_0x15faa8(0x1d0),'project_dir':process[_0x15faa8(0x21e)](),'tmux_name':j||void 0x0})['then'](()=>z(_0x15faa8(0x1e3)+p+_0x15faa8(0x1b3)+V['slice'](0x0,0x8)+')'))[_0x15faa8(0x252)](_0x2d31b8=>z('warning:\x20could\x20not\x20register:\x20'+_0x2d31b8)),setInterval(()=>{const _0x3c0b03=_0x15faa8;Q(_0x3c0b03(0x1ad),{'resume_id':V,'alias':p,'status':_0x3c0b03(0x237),'server':a0_0x5c6388(),'hostname':a0_0x5c6388(),'agent':_0x3c0b03(0x1d0),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x3c0b03(0x252)](_0x58d4b8=>z('heartbeat\x20failed:\x20'+_0x58d4b8));},0x2bf20),z(_0x15faa8(0x224));}t()[a0_0x433c2f(0x252)](_0x4b25ac=>{const _0x38e8c7=a0_0x433c2f;z(_0x38e8c7(0x209)+_0x4b25ac),process['exit'](0x1);});async function b(){const _0x22a093=a0_0x433c2f;z(_0x22a093(0x216)),await Q(_0x22a093(0x1ad),{'resume_id':V,'alias':p,'status':_0x22a093(0x232),'task':_0x22a093(0x1ee)})['catch'](()=>{}),process[_0x22a093(0x1e4)](0x0);}process[a0_0x433c2f(0x20a)]['on'](a0_0x433c2f(0x22a),()=>b()),process['on'](a0_0x433c2f(0x1d1),()=>b()),process['on'](a0_0x433c2f(0x226),()=>b());var d=process['ppid'];function a0_0xb524(_0x7154d2,_0x154c93){_0x7154d2=_0x7154d2-0x1ab;const _0xc9d3f9=a0_0xc9d3();let _0xb52475=_0xc9d3f9[_0x7154d2];return _0xb52475;}if(d&&d>0x1){let h=setInterval(()=>{const _0xd1d9ec=a0_0x433c2f;if(process[_0xd1d9ec(0x222)]===0x1&&d!==0x1){z(_0xd1d9ec(0x23f)+d+_0xd1d9ec(0x24d)),b();return;}try{process[_0xd1d9ec(0x1ae)](d,0x0);}catch(_0x11fa9f){if(_0x11fa9f?.[_0xd1d9ec(0x22d)]===_0xd1d9ec(0x20d))z(_0xd1d9ec(0x1ca)+d+_0xd1d9ec(0x1d8)),b();}},0x7530);if(typeof h[a0_0x433c2f(0x24a)]===a0_0x433c2f(0x22f))h[a0_0x433c2f(0x24a)]();}
2
+ const a0_0x3b6422=a0_0xf80d;(function(_0x574999,_0x77944f){const _0x161710=a0_0xf80d,_0xea13ec=_0x574999();while(!![]){try{const _0x5ac65b=-parseInt(_0x161710(0x1d7))/0x1+-parseInt(_0x161710(0x1d6))/0x2+-parseInt(_0x161710(0x1f5))/0x3+-parseInt(_0x161710(0x183))/0x4+-parseInt(_0x161710(0x1ce))/0x5+-parseInt(_0x161710(0x209))/0x6*(-parseInt(_0x161710(0x1a2))/0x7)+-parseInt(_0x161710(0x1ba))/0x8*(-parseInt(_0x161710(0x1e3))/0x9);if(_0x5ac65b===_0x77944f)break;else _0xea13ec['push'](_0xea13ec['shift']());}catch(_0x8636e2){_0xea13ec['push'](_0xea13ec['shift']());}}}(a0_0x21d0,0x716aa));import{readFileSync as a0_0x91ce9,existsSync as a0_0x28dea3}from'fs';import{randomUUID as a0_0x510387}from'crypto';import{join as a0_0x362b52}from'path';import{hostname as a0_0x453644}from'os';import{execSync as a0_0x558b7a}from'child_process';function B(_0x1a0ce0){const _0x1f0e4e=a0_0xf80d;let _0x5d9e21=_0x1a0ce0[_0x1f0e4e(0x1c1)](/[^a-zA-Z0-9\-_]/g,'-');return _0x5d9e21===''?'unknown':_0x5d9e21;}import{Server as a0_0x3d67c8}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xc69828}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x643f8c,CallToolRequestSchema as a0_0x700957}from'@modelcontextprotocol/sdk/types.js';function T(_0x54347e){const _0x38d283=a0_0xf80d;if(!a0_0x28dea3(_0x54347e))return;for(let _0x280977 of a0_0x91ce9(_0x54347e,'utf-8')[_0x38d283(0x1f2)]('\x0a')){let _0x1bc511=_0x280977[_0x38d283(0x1f9)]();if(!_0x1bc511||_0x1bc511[_0x38d283(0x1fa)]('#'))continue;let _0x609a2c=_0x1bc511[_0x38d283(0x1a0)]('=');if(_0x609a2c<0x0)continue;let _0xbb42cb=_0x1bc511[_0x38d283(0x1cf)](0x0,_0x609a2c)[_0x38d283(0x1f9)](),_0x4b81fe=_0x1bc511['slice'](_0x609a2c+0x1)[_0x38d283(0x1f9)]()[_0x38d283(0x1c1)](/^["']|["']$/g,'');if(!process.env[_0xbb42cb])process.env[_0xbb42cb]=_0x4b81fe;}}var C=process.env.HOME||'~',r=a0_0x362b52(C,a0_0x3b6422(0x1d9));T(a0_0x362b52(r,a0_0x3b6422(0x1e0)));var H=B(process['cwd']());T(a0_0x362b52(r,H,a0_0x3b6422(0x1e0)));function E(){const _0x10e5d2=a0_0x3b6422;try{return a0_0x558b7a(_0x10e5d2(0x1b4),{'encoding':_0x10e5d2(0x1a8),'timeout':0x7d0})['trim']();}catch{return'';}}function _(){const _0x35605c=a0_0x3b6422;try{let _0x50f503=a0_0x362b52(C,_0x35605c(0x208),_0x35605c(0x191));if(a0_0x28dea3(_0x50f503))return JSON[_0x35605c(0x1c6)](a0_0x91ce9(_0x50f503,_0x35605c(0x1a8)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x3b6422(0x1d0)]||a0_0x3b6422(0x1da),j=process.env.COMMHUB_TMUX||E();function S(){const _0x2de900=a0_0x3b6422;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x2de900(0x1f9)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x2de900(0x19c)][_0x2de900(0x1b1)]('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+(_0x2de900(0x18e)+(j||_0x2de900(0x1c3))+'\x20/\x20hostname='+a0_0x453644()+_0x2de900(0x195))),'unattributed-'+process[_0x2de900(0x1bf)];}function a0_0xf80d(_0x2f8a46,_0xd7a82f){_0x2f8a46=_0x2f8a46-0x182;const _0x21d0fd=a0_0x21d0();let _0xf80d59=_0x21d0fd[_0x2f8a46];return _0xf80d59;}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x510387(),k=process.env.COMMHUB_TOKEN||R['token']||'';function z(_0x11da4f){const _0x283b69=a0_0x3b6422;let _0x2713bd=new Date()[_0x283b69(0x1ac)]()['slice'](0x0,0x8);process['stderr']['write']('['+_0x2713bd+']\x20[commhub]\x20'+_0x11da4f+'\x0a');}function i(_0x24ebdc){return new Promise(_0x3a48b4=>setTimeout(_0x3a48b4,_0x24ebdc));}z(a0_0x3b6422(0x1b6)+Y+a0_0x3b6422(0x192)+p+'\x20RESUME_ID='+V[a0_0x3b6422(0x1cf)](0x0,0x8)+a0_0x3b6422(0x1cc)+(j||'none')+a0_0x3b6422(0x217)+process[a0_0x3b6422(0x20b)]()+a0_0x3b6422(0x202)+H);var G=new Map(),K=new a0_0x3d67c8({'name':a0_0x3b6422(0x1a7),'version':a0_0x3b6422(0x1e5)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x3b6422(0x1f8),a0_0x3b6422(0x1a1),a0_0x3b6422(0x1fc),a0_0x3b6422(0x188),'Session\x20alias:\x20'+p]['join']('\x0a')});K[a0_0x3b6422(0x18b)](a0_0x643f8c,async()=>({'tools':[{'name':a0_0x3b6422(0x1ca),'description':a0_0x3b6422(0x1ee),'inputSchema':{'type':a0_0x3b6422(0x18f),'properties':{'task_id':{'type':a0_0x3b6422(0x207),'description':a0_0x3b6422(0x193)},'text':{'type':a0_0x3b6422(0x207),'description':a0_0x3b6422(0x204)},'status':{'type':a0_0x3b6422(0x207),'enum':['completed',a0_0x3b6422(0x1f0),'cancelled','blocked',a0_0x3b6422(0x1dd),a0_0x3b6422(0x1e1)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x3b6422(0x1d4)]}},{'name':a0_0x3b6422(0x199),'description':a0_0x3b6422(0x20e),'inputSchema':{'type':a0_0x3b6422(0x18f),'properties':{'status':{'type':'string','enum':[a0_0x3b6422(0x19e),a0_0x3b6422(0x1bc),a0_0x3b6422(0x1ab),a0_0x3b6422(0x1dd)]},'task':{'type':a0_0x3b6422(0x207),'description':a0_0x3b6422(0x182)},'progress':{'type':'number','description':a0_0x3b6422(0x1e6)}},'required':['status']}},{'name':a0_0x3b6422(0x1d1),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x3b6422(0x18f),'properties':{'alias':{'type':'string','description':a0_0x3b6422(0x1d8)},'task':{'type':a0_0x3b6422(0x207),'description':a0_0x3b6422(0x1d3)},'priority':{'type':a0_0x3b6422(0x207),'enum':[a0_0x3b6422(0x1db),a0_0x3b6422(0x1f7),a0_0x3b6422(0x1ad)],'description':'Priority\x20(default:\x20normal)'}},'required':[a0_0x3b6422(0x1f1),a0_0x3b6422(0x1c4)]}},{'name':a0_0x3b6422(0x1a5),'description':a0_0x3b6422(0x211),'inputSchema':{'type':a0_0x3b6422(0x18f),'properties':{'alias':{'type':a0_0x3b6422(0x207),'description':a0_0x3b6422(0x1d8)},'message':{'type':a0_0x3b6422(0x207),'description':'Message\x20content'}},'required':[a0_0x3b6422(0x1f1),a0_0x3b6422(0x1aa)]}},{'name':a0_0x3b6422(0x215),'description':a0_0x3b6422(0x1df),'inputSchema':{'type':a0_0x3b6422(0x18f),'properties':{}}}]}));function a0_0x21d0(){const _0x24ea14=['SSE\x20fatal:\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','MCP\x20stdio\x20connected','from','setRequestHandler','notifications/claude/channel','send_reply','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','object','connecting\x20to\x20','config.json','\x20ALIAS=','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','notification','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','\x22\x20after\x20SSE\x20reconnect','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','from_session','commhub_report_status','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','result','stderr',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','working','priority','indexOf','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','1631zAyssS','broadcast','warning:\x20could\x20not\x20register:\x20','commhub_send_message','claude-code','commhub-channel','utf-8','2025-03-26','message','blocked','toTimeString','low','unref','heartbeat\x20failed:\x20','report_status','write','SIGTERM','SSE\x20connection\x20error:\x20','tmux\x20display-message\x20-p\x20\x27#S\x27','shutting\x20down,\x20reporting\x20offline...','ENV:\x20URL=','session\x20disconnected','starting\x20SSE\x20listener...','Bearer\x20','11768lMKTjh','new_message','idle','ack_inbox','getReader','pid','now','replace','end','(none)','task','stringify','parse','2.0','read','offline','commhub_reply','cancelled','...\x20TMUX=','send_message','2423555VCexEf','slice','hub','commhub_send_task','/events/','Task\x20content','text','get_all_status','192662ghuabL','344026vvLOaB','Target\x20session\x20alias','.claude/channels/commhub','http://127.0.0.1:9200','high',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','error','initialize','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','.env','in_progress','function','8730TasCYa','length','0.3.0','Progress\x200-100','unknown\x20tool','kill','/mcp','parse\x20error:\x20','fatal:\x20','application/json','status','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','POST','failed','alias','split','\x22\x20(','SSE\x20stream\x20ended,\x20reconnecting...','486288ZWwGpN','exit','normal','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','trim','startsWith','statusText','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','application/json,\x20text/event-stream','catch','min','connected','connect','\x20PROJECT_ENV=','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','Reply\x20text\x20/\x20result\x20summary','ESRCH','code','string','.anet','10254yfOqyE','no\x20response','cwd','SSE\x20connected\x20as\x20\x22','data:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','commhub','message_id','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','completed','type','content','commhub_get_all_status','→\x20injected\x20task\x20','\x20CWD=','messages','replied','re-registered\x20as\x20\x22','Current\x20task\x20description','1093396CaTcMC','parent\x20claude\x20pid=','stdin','get_inbox'];a0_0x21d0=function(){return _0x24ea14;};return a0_0x21d0();}async function Q(_0xd6be26,_0x1f6996){const _0x5758ed=a0_0x3b6422;let _0x1e8ee9=await fetch(Y+'/mcp',{'method':_0x5758ed(0x1ef),'headers':{'Content-Type':_0x5758ed(0x1ec),'Accept':_0x5758ed(0x1fd),...k?{'Authorization':_0x5758ed(0x1b9)+k}:{}},'body':JSON[_0x5758ed(0x1c5)]({'jsonrpc':_0x5758ed(0x1c7),'id':0x1,'method':_0x5758ed(0x1de),'params':{'protocolVersion':_0x5758ed(0x1a9),'capabilities':{},'clientInfo':{'name':_0x5758ed(0x1a7),'version':'0.3.0'}}})});if(!_0x1e8ee9['ok']){let _0x410b38=await _0x1e8ee9[_0x5758ed(0x1d4)]();return z('CommHub\x20init\x20failed:\x20'+_0x1e8ee9[_0x5758ed(0x1ed)]+'\x20'+_0x410b38['slice'](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x1e8ee9['status']};}await _0x1e8ee9['text']();let _0x20ec5f=(await(await fetch(Y+_0x5758ed(0x1e9),{'method':_0x5758ed(0x1ef),'headers':{'Content-Type':_0x5758ed(0x1ec),'Accept':_0x5758ed(0x1fd),...k?{'Authorization':_0x5758ed(0x1b9)+k}:{}},'body':JSON['stringify']({'jsonrpc':_0x5758ed(0x1c7),'id':0x2,'method':'tools/call','params':{'name':_0xd6be26,'arguments':_0x1f6996}})}))['text']())[_0x5758ed(0x1f2)]('\x0a')['find'](_0x2a8db8=>_0x2a8db8[_0x5758ed(0x1fa)](_0x5758ed(0x20d)));if(_0x20ec5f){let _0x4c521c=JSON['parse'](_0x20ec5f[_0x5758ed(0x1cf)](0x6));return _0x4c521c?.[_0x5758ed(0x19b)]?.[_0x5758ed(0x214)]?.[0x0]?.[_0x5758ed(0x1d4)]?JSON['parse'](_0x4c521c['result'][_0x5758ed(0x214)][0x0][_0x5758ed(0x1d4)]):_0x4c521c;}return{'ok':!0x1,'error':_0x5758ed(0x20a)};}K[a0_0x3b6422(0x18b)](a0_0x700957,async _0xa151d2=>{const _0x9a0ebe=a0_0x3b6422;let {name:_0x2320e3,arguments:_0x23ceb2}=_0xa151d2['params'];if(_0x2320e3===_0x9a0ebe(0x1ca)){let {task_id:_0x52cdd2,text:_0x3b54c8,status:_0x300608}=_0x23ceb2;if(_0x300608===_0x9a0ebe(0x212)||_0x300608===_0x9a0ebe(0x1f0)||_0x300608===_0x9a0ebe(0x1cb)){let _0x2c8468=_0x300608==='completed'?_0x9a0ebe(0x219):_0x300608,_0x2445e9=_0x52cdd2?G['get'](_0x52cdd2)||_0x9a0ebe(0x1d0):_0x9a0ebe(0x1d0),_0x2c07f7=await Q(_0x9a0ebe(0x18d),{'alias':_0x2445e9,'text':_0x3b54c8,'in_reply_to':_0x52cdd2||void 0x0,'status':_0x2c8468,'from_session':p});if(_0x52cdd2)G['delete'](_0x52cdd2);return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON[_0x9a0ebe(0x1c5)](_0x2c07f7)}]};}let _0x306a01=await Q(_0x9a0ebe(0x1b0),{'resume_id':V,'alias':p,'status':_0x300608==='blocked'?'blocked':_0x300608===_0x9a0ebe(0x1dd)?_0x9a0ebe(0x1dd):'working','task':_0x3b54c8[_0x9a0ebe(0x1cf)](0x0,0xc8),'output':_0x3b54c8});return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON['stringify'](_0x306a01)}]};}if(_0x2320e3===_0x9a0ebe(0x199)){let {status:_0x4a2f1c,task:_0x3345c2,progress:_0x11dccc}=_0x23ceb2,_0x2ef8a0=await Q(_0x9a0ebe(0x1b0),{'resume_id':V,'alias':p,'status':_0x4a2f1c,'task':_0x3345c2,'progress':_0x11dccc});return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON[_0x9a0ebe(0x1c5)](_0x2ef8a0)}]};}if(_0x2320e3==='commhub_send_task'){let {alias:_0xd03809,task:_0x208804,priority:_0x548efb}=_0x23ceb2,_0x5744b5=await Q('send_task',{'alias':_0xd03809,'task':_0x208804,'priority':_0x548efb||_0x9a0ebe(0x1f7),'from_session':p});return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON['stringify'](_0x5744b5)}]};}if(_0x2320e3==='commhub_send_message'){let {alias:_0x786e64,message:_0x2f5871}=_0x23ceb2,_0xcfbef1=await Q(_0x9a0ebe(0x1cd),{'alias':_0x786e64,'message':_0x2f5871,'from_session':p});return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON[_0x9a0ebe(0x1c5)](_0xcfbef1)}]};}if(_0x2320e3==='commhub_get_all_status'){let _0x22f60c=await Q(_0x9a0ebe(0x1d5),{});return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON[_0x9a0ebe(0x1c5)](_0x22f60c)}]};}return{'content':[{'type':_0x9a0ebe(0x1d4),'text':JSON['stringify']({'error':_0x9a0ebe(0x1e7)})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x314ad8=a0_0x3b6422;try{await Q(_0x314ad8(0x1b0),{'resume_id':V,'alias':p,'status':_0x314ad8(0x1bc),'server':a0_0x453644(),'hostname':a0_0x453644(),'agent':_0x314ad8(0x1a6),'project_dir':process['cwd'](),'tmux_name':j||void 0x0}),z(_0x314ad8(0x21a)+p+_0x314ad8(0x196));}catch(_0x4775f2){z('re-register\x20failed:\x20'+_0x4775f2);}}async function l(){const _0xd92624=a0_0x3b6422;let _0x184204=Y+_0xd92624(0x1d2)+encodeURIComponent(p),_0x4eabaa={};if(k)_0x4eabaa['Authorization']=_0xd92624(0x1b9)+k;z(_0xd92624(0x190)+_0x184204);let _0x37cedf=D,_0x321365=!0x0,_0x2710b9=null;while(!0x0){try{let _0xe7d7d4=await fetch(_0x184204,{'headers':_0x4eabaa});if(!_0xe7d7d4['ok']){if(z('SSE\x20error:\x20'+_0xe7d7d4[_0xd92624(0x1ed)]+'\x20'+_0xe7d7d4[_0xd92624(0x1fb)]),_0x2710b9=_0x2710b9??Date[_0xd92624(0x1c0)](),Date[_0xd92624(0x1c0)]()-_0x2710b9>O){z(_0xd92624(0x19a)+Y+_0xd92624(0x19d));return;}await i(_0x37cedf),_0x37cedf=Math[_0xd92624(0x1ff)](_0x37cedf*0x2,v);continue;}let _0x5c2bb4=_0xe7d7d4['body'][_0xd92624(0x1be)](),_0x17c1ea=new TextDecoder(),_0x146e58='';_0x37cedf=D;while(!0x0){let {done:_0x36ebaa,value:_0x469c99}=await _0x5c2bb4[_0xd92624(0x1c8)]();if(_0x36ebaa)break;_0x146e58+=_0x17c1ea['decode'](_0x469c99,{'stream':!0x0});let _0x49fc8c=_0x146e58[_0xd92624(0x1f2)]('\x0a\x0a');_0x146e58=_0x49fc8c['pop']()||'';for(let _0x39e68b of _0x49fc8c){let _0x10d791=_0x39e68b['split']('\x0a')['find'](_0xaa2933=>_0xaa2933[_0xd92624(0x1fa)](_0xd92624(0x20d)));if(!_0x10d791)continue;try{let _0x111e22=JSON[_0xd92624(0x1c6)](_0x10d791[_0xd92624(0x1cf)](0x6));if(await A(_0x111e22),_0x111e22[_0xd92624(0x213)]===_0xd92624(0x200)){if(_0x2710b9=null,!_0x321365)await m();_0x321365=!0x1;}}catch(_0x3c3a71){z(_0xd92624(0x1ea)+_0x3c3a71);}}}z(_0xd92624(0x1f4));}catch(_0x29e3e3){z(_0xd92624(0x1b3)+_0x29e3e3);}if(_0x2710b9=_0x2710b9??Date['now'](),Date[_0xd92624(0x1c0)]()-_0x2710b9>O){z(_0xd92624(0x19a)+Y+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await i(_0x37cedf),_0x37cedf=Math['min'](_0x37cedf*0x2,v);}}async function A(_0x44db47){const _0x46402d=a0_0x3b6422;if(_0x44db47[_0x46402d(0x213)]===_0x46402d(0x200)){z(_0x46402d(0x20c)+p+'\x22');return;}if(_0x44db47[_0x46402d(0x213)]===_0x46402d(0x1bb)){if(z('←\x20message\x20from\x20'+_0x44db47[_0x46402d(0x18a)]+':\x20'+_0x44db47[_0x46402d(0x1aa)][_0x46402d(0x1cf)](0x0,0x3c)),await K[_0x46402d(0x194)]({'method':'notifications/claude/channel','params':{'content':_0x44db47[_0x46402d(0x1aa)],'meta':{'sender':_0x44db47[_0x46402d(0x18a)]||_0x46402d(0x1d0),'sender_id':_0x46402d(0x20f),'user':_0x44db47[_0x46402d(0x18a)]||_0x46402d(0x1d0),'priority':'normal'}}}),_0x44db47[_0x46402d(0x210)])await Q(_0x46402d(0x1bd),{'alias':p,'message_id':_0x44db47[_0x46402d(0x210)]});return;}if(_0x44db47[_0x46402d(0x213)]==='new_task'||_0x44db47[_0x46402d(0x213)]===_0x46402d(0x1a3)){z('←\x20'+_0x44db47[_0x46402d(0x213)]+':\x20inbox_count='+_0x44db47['inbox_count']+'\x20priority='+(_0x44db47[_0x46402d(0x19f)]||'normal'));let _0x293c38=await Q(_0x46402d(0x186),{'alias':p,'limit':0x5});if(_0x293c38?.['ok']&&_0x293c38[_0x46402d(0x218)]?.[_0x46402d(0x1e4)]>0x0)for(let _0x4fac11 of _0x293c38[_0x46402d(0x218)]){let _0x3a0145={'sender':_0x4fac11[_0x46402d(0x198)]||'hub','sender_id':_0x46402d(0x20f),'user':_0x4fac11[_0x46402d(0x198)]||_0x46402d(0x1d0),'task_id':_0x4fac11['id'],'priority':_0x4fac11[_0x46402d(0x19f)]||_0x46402d(0x1f7)};G['set'](_0x4fac11['id'],_0x4fac11[_0x46402d(0x198)]||'hub'),await K[_0x46402d(0x194)]({'method':_0x46402d(0x18c),'params':{'content':_0x4fac11['content'],'meta':_0x3a0145}}),z(_0x46402d(0x216)+_0x4fac11['id'][_0x46402d(0x1cf)](0x0,0x8)+'\x20from\x20'+_0x4fac11[_0x46402d(0x198)]+':\x20'+_0x4fac11[_0x46402d(0x214)][_0x46402d(0x1cf)](0x0,0x3c)),await Q(_0x46402d(0x1bd),{'alias':p,'message_id':_0x4fac11['id']});}}}async function t(){const _0x2298a3=a0_0x3b6422;let _0x2797e6=new a0_0xc69828();await K[_0x2298a3(0x201)](_0x2797e6),z(_0x2298a3(0x189)),z(_0x2298a3(0x1b8)),l()[_0x2298a3(0x1fe)](_0x2ec07d=>z(_0x2298a3(0x187)+_0x2ec07d)),Q(_0x2298a3(0x1b0),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x453644(),'hostname':a0_0x453644(),'agent':_0x2298a3(0x1a6),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})['then'](()=>z('registered\x20as\x20\x22'+p+_0x2298a3(0x1f3)+V[_0x2298a3(0x1cf)](0x0,0x8)+')'))[_0x2298a3(0x1fe)](_0x35baca=>z(_0x2298a3(0x1a4)+_0x35baca)),setInterval(()=>{const _0x4d2a97=_0x2298a3;Q('report_status',{'resume_id':V,'alias':p,'status':_0x4d2a97(0x1bc),'server':a0_0x453644(),'hostname':a0_0x453644(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x4d2a97(0x1fe)](_0x51b1db=>z(_0x4d2a97(0x1af)+_0x51b1db));},0x2bf20),z('ready\x20—\x20waiting\x20for\x20events');}t()[a0_0x3b6422(0x1fe)](_0x5ac334=>{const _0x2f911e=a0_0x3b6422;z(_0x2f911e(0x1eb)+_0x5ac334),process[_0x2f911e(0x1f6)](0x1);});async function b(){const _0x3af293=a0_0x3b6422;z(_0x3af293(0x1b5)),await Q(_0x3af293(0x1b0),{'resume_id':V,'alias':p,'status':_0x3af293(0x1c9),'task':_0x3af293(0x1b7)})[_0x3af293(0x1fe)](()=>{}),process[_0x3af293(0x1f6)](0x0);}process[a0_0x3b6422(0x185)]['on'](a0_0x3b6422(0x1c2),()=>b()),process['on'](a0_0x3b6422(0x1b2),()=>b()),process['on']('SIGINT',()=>b());var d=process['ppid'];if(d&&d>0x1){let h=setInterval(()=>{const _0x2d8840=a0_0x3b6422;if(process['ppid']===0x1&&d!==0x1){z(_0x2d8840(0x203)+d+_0x2d8840(0x1dc)),b();return;}try{process[_0x2d8840(0x1e8)](d,0x0);}catch(_0x3da0a1){if(_0x3da0a1?.[_0x2d8840(0x206)]===_0x2d8840(0x205))z(_0x2d8840(0x184)+d+_0x2d8840(0x197)),b();}},0x7530);if(typeof h['unref']===a0_0x3b6422(0x1e2))h[a0_0x3b6422(0x1ae)]();}
@@ -1,4 +1,4 @@
1
- export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "opencode-cli";
1
+ export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "grok-build-cli" | "opencode-cli" | "codex-app-server";
2
2
  /** Operator-facing default for any runtime slot that comes in empty / missing / unrecognized. */
3
3
  export declare const DEFAULT_RUNTIME: RuntimeName;
4
4
  type ProfileLike = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.3.0-preview.21",
4
- "description": "AI Agent Network CLI — Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
3
+ "version": "2.3.0-preview.23",
4
+ "description": "AI Agent Network CLI — Local-first multi-agent orchestration across Claude, Codex, Grok (ACP plus experimental co-presence TUI), and OpenCode runtimes. Apache 2.0.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",
7
7
  "types": "dist/client.d.ts",
@@ -36,6 +36,9 @@
36
36
  "grok",
37
37
  "xai",
38
38
  "grok-build-acp",
39
+ "grok-build-cli",
40
+ "grok-tui",
41
+ "copresence",
39
42
  "acp",
40
43
  "minimax",
41
44
  "mimo",
@@ -54,7 +57,8 @@
54
57
  "directory": "agent-network"
55
58
  },
56
59
  "publishConfig": {
57
- "access": "public"
60
+ "access": "public",
61
+ "tag": "preview"
58
62
  },
59
63
  "bugs": {
60
64
  "url": "https://github.com/sleep2agi/agent-network/issues"