@sleep2agi/agent-network 2.3.0-preview.1 → 2.3.0-preview.11

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.
@@ -115,6 +115,14 @@ export interface NormalizedIMMessage {
115
115
  replyToMessageId?: string;
116
116
  /** Ephemeral / visible-to-sender-only. Slack only; others ignore. */
117
117
  ephemeral?: boolean;
118
+ /** Caption-mode hint (RFC-020 §15.2): bypass markdown-card / markdown→PNG
119
+ * rendering and send as plain text. Set by the bridge when the same
120
+ * dispatch loop is also sending one or more attachment files — the text
121
+ * is a caption ("here's the report"), not the deliverable. Without this
122
+ * hint, Vincent's "make me a PDF" UAT had the bot's accompanying
123
+ * description heading + bullet list rendered to PNG via #329, which
124
+ * read as "you sent another image" instead of "you sent my file". */
125
+ forceTextOnly?: boolean;
118
126
  /** Tie back to the commhub task that produced this message. */
119
127
  correlation: {
120
128
  taskId: string;
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x2f6489=a0_0x910f;(function(_0x10285f,_0x31ae8e){const _0x252300=a0_0x910f,_0x29240d=_0x10285f();while(!![]){try{const _0x240ff0=-parseInt(_0x252300(0x1d7))/0x1*(-parseInt(_0x252300(0x235))/0x2)+-parseInt(_0x252300(0x1d5))/0x3*(-parseInt(_0x252300(0x220))/0x4)+-parseInt(_0x252300(0x1b3))/0x5+-parseInt(_0x252300(0x221))/0x6+-parseInt(_0x252300(0x23e))/0x7*(parseInt(_0x252300(0x1cd))/0x8)+parseInt(_0x252300(0x20b))/0x9+parseInt(_0x252300(0x201))/0xa;if(_0x240ff0===_0x31ae8e)break;else _0x29240d['push'](_0x29240d['shift']());}catch(_0x7d01d6){_0x29240d['push'](_0x29240d['shift']());}}}(a0_0x26a1,0x6ff10));import{readFileSync as a0_0x125c3b,existsSync as a0_0x4d8313}from'fs';import{randomUUID as a0_0x57c336}from'crypto';import{join as a0_0x293d60}from'path';import{hostname as a0_0x26e9c9}from'os';import{execSync as a0_0x4c624f}from'child_process';import{Server as a0_0x11b58c}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x57ed7a}from'@modelcontextprotocol/sdk/server/stdio.js';function a0_0x910f(_0x5d44f4,_0x2fe00d){_0x5d44f4=_0x5d44f4-0x1af;const _0x26a11c=a0_0x26a1();let _0x910f7=_0x26a11c[_0x5d44f4];return _0x910f7;}import{ListToolsRequestSchema as a0_0x4a3abc,CallToolRequestSchema as a0_0x49d6db}from'@modelcontextprotocol/sdk/types.js';function I(_0x912882){const _0x5b7df3=a0_0x910f;if(!a0_0x4d8313(_0x912882))return;for(let _0x161f68 of a0_0x125c3b(_0x912882,_0x5b7df3(0x236))[_0x5b7df3(0x1d4)]('\x0a')){let _0x28c117=_0x161f68[_0x5b7df3(0x244)]();if(!_0x28c117||_0x28c117[_0x5b7df3(0x246)]('#'))continue;let _0x13a768=_0x28c117['indexOf']('=');if(_0x13a768<0x0)continue;let _0x3ed58c=_0x28c117[_0x5b7df3(0x210)](0x0,_0x13a768)[_0x5b7df3(0x244)](),_0x287877=_0x28c117[_0x5b7df3(0x210)](_0x13a768+0x1)[_0x5b7df3(0x244)]()[_0x5b7df3(0x208)](/^["']|["']$/g,'');if(!process.env[_0x3ed58c])process.env[_0x3ed58c]=_0x287877;}}var L=process.env.HOME||'~',U=a0_0x293d60(L,a0_0x2f6489(0x1e3));I(a0_0x293d60(U,a0_0x2f6489(0x1e1)));var v=process[a0_0x2f6489(0x1dd)]()[a0_0x2f6489(0x208)](/\//g,'-');I(a0_0x293d60(U,v,a0_0x2f6489(0x1e1)));function d(){const _0x3b3e6c=a0_0x2f6489;try{return a0_0x4c624f(_0x3b3e6c(0x1c1),{'encoding':_0x3b3e6c(0x236),'timeout':0x7d0})[_0x3b3e6c(0x244)]();}catch{return'';}}function m(){const _0x1c7b18=a0_0x2f6489;try{let _0x2f66c3=a0_0x293d60(L,'.anet',_0x1c7b18(0x1d9));if(a0_0x4d8313(_0x2f66c3))return JSON['parse'](a0_0x125c3b(_0x2f66c3,_0x1c7b18(0x236)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x2f6489(0x1ce)]||a0_0x2f6489(0x24b),f=process.env.COMMHUB_TMUX||d();function r(){const _0x3a4531=a0_0x2f6489;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS['trim']())return process.env.COMMHUB_ALIAS['trim']();return process[_0x3a4531(0x22d)][_0x3a4531(0x1bc)](_0x3a4531(0x21c)+(_0x3a4531(0x1c7)+(f||_0x3a4531(0x1ff))+_0x3a4531(0x1c9)+a0_0x26e9c9()+_0x3a4531(0x230))),_0x3a4531(0x243)+process[_0x3a4531(0x234)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x57c336(),F=process.env.COMMHUB_TOKEN||u[a0_0x2f6489(0x1d6)]||'';function W(_0x432d7e){const _0x1f663a=a0_0x2f6489;let _0x3ac2ec=new Date()[_0x1f663a(0x1f3)]()[_0x1f663a(0x210)](0x0,0x8);process['stderr']['write']('['+_0x3ac2ec+_0x1f663a(0x23b)+_0x432d7e+'\x0a');}function N(_0x5b13a9){return new Promise(_0x32ec43=>setTimeout(_0x32ec43,_0x5b13a9));}W(a0_0x2f6489(0x24a)+j+a0_0x2f6489(0x245)+G+a0_0x2f6489(0x1cb)+K[a0_0x2f6489(0x210)](0x0,0x8)+'...\x20TMUX='+(f||a0_0x2f6489(0x218))+a0_0x2f6489(0x242)+process[a0_0x2f6489(0x1dd)]()+a0_0x2f6489(0x1cc)+v);var D=new Map(),x=new a0_0x11b58c({'name':a0_0x2f6489(0x228),'version':a0_0x2f6489(0x20d)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x2f6489(0x1af),a0_0x2f6489(0x1b8),a0_0x2f6489(0x240),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+G][a0_0x2f6489(0x1f5)]('\x0a')});x[a0_0x2f6489(0x214)](a0_0x4a3abc,async()=>({'tools':[{'name':a0_0x2f6489(0x1f4),'description':a0_0x2f6489(0x204),'inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{'task_id':{'type':a0_0x2f6489(0x1c6),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x2f6489(0x1c6),'description':'Reply\x20text\x20/\x20result\x20summary'},'status':{'type':a0_0x2f6489(0x1c6),'enum':[a0_0x2f6489(0x1c0),a0_0x2f6489(0x1b7),a0_0x2f6489(0x1be),'blocked','error','in_progress'],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x2f6489(0x1e4)]}},{'name':a0_0x2f6489(0x1ea),'description':a0_0x2f6489(0x1b0),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x2f6489(0x1c6),'enum':[a0_0x2f6489(0x1f9),'idle',a0_0x2f6489(0x20e),a0_0x2f6489(0x1fa)]},'task':{'type':'string','description':a0_0x2f6489(0x21a)},'progress':{'type':a0_0x2f6489(0x224),'description':'Progress\x200-100'}},'required':[a0_0x2f6489(0x1b2)]}},{'name':a0_0x2f6489(0x22f),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{'alias':{'type':a0_0x2f6489(0x1c6),'description':a0_0x2f6489(0x1ef)},'task':{'type':a0_0x2f6489(0x1c6),'description':a0_0x2f6489(0x1ba)},'priority':{'type':a0_0x2f6489(0x1c6),'enum':[a0_0x2f6489(0x206),a0_0x2f6489(0x1bd),'low'],'description':a0_0x2f6489(0x1f1)}},'required':[a0_0x2f6489(0x1d1),'task']}},{'name':a0_0x2f6489(0x241),'description':a0_0x2f6489(0x203),'inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{'alias':{'type':a0_0x2f6489(0x1c6),'description':a0_0x2f6489(0x1ef)},'message':{'type':'string','description':a0_0x2f6489(0x1da)}},'required':[a0_0x2f6489(0x1d1),a0_0x2f6489(0x225)]}},{'name':'commhub_get_all_status','description':a0_0x2f6489(0x219),'inputSchema':{'type':a0_0x2f6489(0x1dc),'properties':{}}}]}));async function Y(_0x43e00e,_0x330ede){const _0x5ad611=a0_0x2f6489;let _0xeb0fe3=await fetch(j+_0x5ad611(0x1bf),{'method':'POST','headers':{'Content-Type':_0x5ad611(0x1fd),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x5ad611(0x21d)+F}:{}},'body':JSON[_0x5ad611(0x1c4)]({'jsonrpc':'2.0','id':0x1,'method':_0x5ad611(0x215),'params':{'protocolVersion':_0x5ad611(0x20c),'capabilities':{},'clientInfo':{'name':_0x5ad611(0x228),'version':_0x5ad611(0x20d)}}})});if(!_0xeb0fe3['ok']){let _0x21e042=await _0xeb0fe3['text']();return W(_0x5ad611(0x216)+_0xeb0fe3[_0x5ad611(0x1b2)]+'\x20'+_0x21e042[_0x5ad611(0x210)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0xeb0fe3[_0x5ad611(0x1b2)]};}await _0xeb0fe3[_0x5ad611(0x1e4)]();let _0x2e6801=(await(await fetch(j+_0x5ad611(0x1bf),{'method':_0x5ad611(0x223),'headers':{'Content-Type':_0x5ad611(0x1fd),'Accept':'application/json,\x20text/event-stream',...F?{'Authorization':_0x5ad611(0x21d)+F}:{}},'body':JSON[_0x5ad611(0x1c4)]({'jsonrpc':_0x5ad611(0x232),'id':0x2,'method':_0x5ad611(0x1b9),'params':{'name':_0x43e00e,'arguments':_0x330ede}})}))[_0x5ad611(0x1e4)]())[_0x5ad611(0x1d4)]('\x0a')[_0x5ad611(0x239)](_0x50e346=>_0x50e346[_0x5ad611(0x246)](_0x5ad611(0x226)));if(_0x2e6801){let _0x558dbe=JSON[_0x5ad611(0x231)](_0x2e6801[_0x5ad611(0x210)](0x6));return _0x558dbe?.[_0x5ad611(0x238)]?.[_0x5ad611(0x1c8)]?.[0x0]?.[_0x5ad611(0x1e4)]?JSON[_0x5ad611(0x231)](_0x558dbe[_0x5ad611(0x238)][_0x5ad611(0x1c8)][0x0][_0x5ad611(0x1e4)]):_0x558dbe;}return{'ok':!0x1,'error':_0x5ad611(0x247)};}x[a0_0x2f6489(0x214)](a0_0x49d6db,async _0x6c7e78=>{const _0x67f01=a0_0x2f6489;let {name:_0x5d7ba4,arguments:_0x4bd0a8}=_0x6c7e78['params'];if(_0x5d7ba4===_0x67f01(0x1f4)){let {task_id:_0x97858b,text:_0x2a3a1a,status:_0x27e114}=_0x4bd0a8;if(_0x27e114===_0x67f01(0x1c0)||_0x27e114==='failed'||_0x27e114===_0x67f01(0x1be)){let _0x25d572=_0x27e114==='completed'?_0x67f01(0x233):_0x27e114,_0x368820=_0x97858b?D[_0x67f01(0x213)](_0x97858b)||_0x67f01(0x1ce):_0x67f01(0x1ce),_0x143467=await Y(_0x67f01(0x1f8),{'alias':_0x368820,'text':_0x2a3a1a,'in_reply_to':_0x97858b||void 0x0,'status':_0x25d572,'from_session':G});if(_0x97858b)D[_0x67f01(0x1e6)](_0x97858b);return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x143467)}]};}let _0x45b44e=await Y(_0x67f01(0x1d0),{'resume_id':K,'alias':G,'status':_0x27e114==='blocked'?'blocked':_0x27e114==='error'?_0x67f01(0x1fa):_0x67f01(0x1f9),'task':_0x2a3a1a[_0x67f01(0x210)](0x0,0xc8),'output':_0x2a3a1a});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x45b44e)}]};}if(_0x5d7ba4===_0x67f01(0x1ea)){let {status:_0x243ced,task:_0x6b3607,progress:_0x24b30b}=_0x4bd0a8,_0x5cf599=await Y(_0x67f01(0x1d0),{'resume_id':K,'alias':G,'status':_0x243ced,'task':_0x6b3607,'progress':_0x24b30b});return{'content':[{'type':'text','text':JSON[_0x67f01(0x1c4)](_0x5cf599)}]};}if(_0x5d7ba4===_0x67f01(0x22f)){let {alias:_0x2774a0,task:_0x21befa,priority:_0x718814}=_0x4bd0a8,_0x5adf2f=await Y(_0x67f01(0x209),{'alias':_0x2774a0,'task':_0x21befa,'priority':_0x718814||_0x67f01(0x1bd),'from_session':G});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x5adf2f)}]};}if(_0x5d7ba4==='commhub_send_message'){let {alias:_0x55f867,message:_0x119296}=_0x4bd0a8,_0x37cfcf=await Y(_0x67f01(0x237),{'alias':_0x55f867,'message':_0x119296,'from_session':G});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x37cfcf)}]};}if(_0x5d7ba4===_0x67f01(0x249)){let _0x475d0b=await Y(_0x67f01(0x1f0),{});return{'content':[{'type':_0x67f01(0x1e4),'text':JSON[_0x67f01(0x1c4)](_0x475d0b)}]};}return{'content':[{'type':_0x67f01(0x1e4),'text':JSON['stringify']({'error':_0x67f01(0x1b4)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x328c5e=a0_0x2f6489;try{await Y(_0x328c5e(0x1d0),{'resume_id':K,'alias':G,'status':_0x328c5e(0x1e9),'server':a0_0x26e9c9(),'hostname':a0_0x26e9c9(),'agent':_0x328c5e(0x1f2),'project_dir':process[_0x328c5e(0x1dd)](),'tmux_name':f||void 0x0}),W(_0x328c5e(0x21f)+G+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x807f81){W(_0x328c5e(0x1cf)+_0x807f81);}}async function o(){const _0x462214=a0_0x2f6489;let _0x2b4bf=j+_0x462214(0x20a)+encodeURIComponent(G),_0x6d743f={};if(F)_0x6d743f[_0x462214(0x1fe)]=_0x462214(0x21d)+F;W(_0x462214(0x1e0)+_0x2b4bf);let _0x29848f=O,_0x4dd33d=!0x0,_0x85c049=null;while(!0x0){try{let _0x2ce17d=await fetch(_0x2b4bf,{'headers':_0x6d743f});if(!_0x2ce17d['ok']){if(W(_0x462214(0x1f6)+_0x2ce17d[_0x462214(0x1b2)]+'\x20'+_0x2ce17d['statusText']),_0x85c049=_0x85c049??Date[_0x462214(0x1db)](),Date['now']()-_0x85c049>T){W(_0x462214(0x217)+j+_0x462214(0x22a));return;}await N(_0x29848f),_0x29848f=Math[_0x462214(0x24c)](_0x29848f*0x2,R);continue;}let _0x68713e=_0x2ce17d[_0x462214(0x1c3)][_0x462214(0x1ee)](),_0x37bc22=new TextDecoder(),_0x48b9e8='';_0x29848f=O;while(!0x0){let {done:_0x5848e3,value:_0x48e64b}=await _0x68713e[_0x462214(0x22e)]();if(_0x5848e3)break;_0x48b9e8+=_0x37bc22[_0x462214(0x1b6)](_0x48e64b,{'stream':!0x0});let _0x109970=_0x48b9e8[_0x462214(0x1d4)]('\x0a\x0a');_0x48b9e8=_0x109970[_0x462214(0x207)]()||'';for(let _0x464724 of _0x109970){let _0x5bb1ec=_0x464724[_0x462214(0x1d4)]('\x0a')[_0x462214(0x239)](_0x257d8a=>_0x257d8a['startsWith'](_0x462214(0x226)));if(!_0x5bb1ec)continue;try{let _0x3904b3=JSON['parse'](_0x5bb1ec[_0x462214(0x210)](0x6));if(await a(_0x3904b3),_0x3904b3['type']===_0x462214(0x205)){if(_0x85c049=null,!_0x4dd33d)await l();_0x4dd33d=!0x1;}}catch(_0x195748){W('parse\x20error:\x20'+_0x195748);}}}W(_0x462214(0x248));}catch(_0x208427){W(_0x462214(0x1e7)+_0x208427);}if(_0x85c049=_0x85c049??Date['now'](),Date[_0x462214(0x1db)]()-_0x85c049>T){W(_0x462214(0x217)+j+_0x462214(0x22a));return;}await N(_0x29848f),_0x29848f=Math[_0x462214(0x24c)](_0x29848f*0x2,R);}}async function a(_0x3cb4d0){const _0x177a92=a0_0x2f6489;if(_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x205)){W(_0x177a92(0x1b1)+G+'\x22');return;}if(_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x23f)){if(W(_0x177a92(0x23d)+_0x3cb4d0[_0x177a92(0x1d2)]+':\x20'+_0x3cb4d0[_0x177a92(0x225)][_0x177a92(0x210)](0x0,0x3c)),await x['notification']({'method':_0x177a92(0x1fc),'params':{'content':_0x3cb4d0[_0x177a92(0x225)],'meta':{'sender':_0x3cb4d0[_0x177a92(0x1d2)]||_0x177a92(0x1ce),'sender_id':_0x177a92(0x1eb),'user':_0x3cb4d0['from']||_0x177a92(0x1ce),'priority':_0x177a92(0x1bd)}}}),_0x3cb4d0[_0x177a92(0x23a)])await Y('ack_inbox',{'alias':G,'message_id':_0x3cb4d0['message_id']});return;}if(_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x222)||_0x3cb4d0[_0x177a92(0x23c)]===_0x177a92(0x229)){W('←\x20'+_0x3cb4d0[_0x177a92(0x23c)]+':\x20inbox_count='+_0x3cb4d0[_0x177a92(0x20f)]+'\x20priority='+(_0x3cb4d0[_0x177a92(0x1c5)]||_0x177a92(0x1bd)));let _0x45477f=await Y(_0x177a92(0x227),{'alias':G,'limit':0x5});if(_0x45477f?.['ok']&&_0x45477f['messages']?.['length']>0x0)for(let _0x1456fe of _0x45477f[_0x177a92(0x1df)]){let _0x2867d5={'sender':_0x1456fe[_0x177a92(0x1d8)]||_0x177a92(0x1ce),'sender_id':_0x177a92(0x1eb),'user':_0x1456fe[_0x177a92(0x1d8)]||'hub','task_id':_0x1456fe['id'],'priority':_0x1456fe[_0x177a92(0x1c5)]||_0x177a92(0x1bd)};D[_0x177a92(0x1fb)](_0x1456fe['id'],_0x1456fe['from_session']||_0x177a92(0x1ce)),await x[_0x177a92(0x22c)]({'method':_0x177a92(0x1fc),'params':{'content':_0x1456fe[_0x177a92(0x1c8)],'meta':_0x2867d5}}),W(_0x177a92(0x21b)+_0x1456fe['id'][_0x177a92(0x210)](0x0,0x8)+_0x177a92(0x1f7)+_0x1456fe[_0x177a92(0x1d8)]+':\x20'+_0x1456fe[_0x177a92(0x1c8)]['slice'](0x0,0x3c)),await Y(_0x177a92(0x1de),{'alias':G,'message_id':_0x1456fe['id']});}}}async function n(){const _0x67c7e0=a0_0x2f6489;let _0x4b278a=new a0_0x57ed7a();await x[_0x67c7e0(0x1d3)](_0x4b278a),W(_0x67c7e0(0x1bb)),W(_0x67c7e0(0x1ed)),o()[_0x67c7e0(0x21e)](_0x44845c=>W('SSE\x20fatal:\x20'+_0x44845c)),Y(_0x67c7e0(0x1d0),{'resume_id':K,'alias':G,'status':_0x67c7e0(0x1e9),'server':a0_0x26e9c9(),'hostname':a0_0x26e9c9(),'agent':_0x67c7e0(0x1f2),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x67c7e0(0x22b)](()=>W(_0x67c7e0(0x1ca)+G+_0x67c7e0(0x212)+K['slice'](0x0,0x8)+')'))['catch'](_0x2d793d=>W(_0x67c7e0(0x1c2)+_0x2d793d)),setInterval(()=>{const _0x29e1c4=_0x67c7e0;Y(_0x29e1c4(0x1d0),{'resume_id':K,'alias':G,'status':_0x29e1c4(0x1e9),'server':a0_0x26e9c9(),'hostname':a0_0x26e9c9(),'agent':'claude-code','project_dir':process[_0x29e1c4(0x1dd)](),'tmux_name':f||void 0x0})['catch'](_0x3266a1=>W(_0x29e1c4(0x1b5)+_0x3266a1));},0x2bf20),W('ready\x20—\x20waiting\x20for\x20events');}n()[a0_0x2f6489(0x21e)](_0x5cf806=>{const _0x544197=a0_0x2f6489;W(_0x544197(0x200)+_0x5cf806),process[_0x544197(0x1e2)](0x1);});async function b(){const _0x4792be=a0_0x2f6489;W(_0x4792be(0x1ec)),await Y(_0x4792be(0x1d0),{'resume_id':K,'alias':G,'status':_0x4792be(0x1e5),'task':_0x4792be(0x202)})['catch'](()=>{}),process['exit'](0x0);}function a0_0x26a1(){const _0x16e9a3=['Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','connected','high','pop','replace','send_task','/events/','2098539ewpQsv','2025-03-26','0.3.0','blocked','inbox_count','slice','SIGINT','\x22\x20(','get','setRequestHandler','initialize','CommHub\x20init\x20failed:\x20','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','none','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','Current\x20task\x20description','→\x20injected\x20task\x20','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','Bearer\x20','catch','re-registered\x20as\x20\x22','135384SjeJgn','1809060PeZmym','new_task','POST','number','message','data:\x20','get_inbox','commhub-channel','broadcast',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','then','notification','stderr','read','commhub_send_task','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','parse','2.0','replied','pid','4vEJiwy','utf-8','send_message','result','find','message_id',']\x20[commhub]\x20','type','←\x20message\x20from\x20','105WmlXAI','new_message','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub_send_message','\x20CWD=','unattributed-','trim','\x20ALIAS=','startsWith','no\x20response','SSE\x20stream\x20ended,\x20reconnecting...','commhub_get_all_status','ENV:\x20URL=','http://127.0.0.1:9200','min','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','SSE\x20connected\x20as\x20\x22','status','1671705ttOHou','unknown\x20tool','heartbeat\x20failed:\x20','decode','failed','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','tools/call','Task\x20content','MCP\x20stdio\x20connected','write','normal','cancelled','/mcp','completed','tmux\x20display-message\x20-p\x20\x27#S\x27','warning:\x20could\x20not\x20register:\x20','body','stringify','priority','string','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','content','\x20/\x20hostname=','registered\x20as\x20\x22','\x20RESUME_ID=','\x20PROJECT_ENV=','206224mpKvdl','hub','re-register\x20failed:\x20','report_status','alias','from','connect','split','51PSphXB','token','253513AuHoLA','from_session','config.json','Message\x20content','now','object','cwd','ack_inbox','messages','connecting\x20to\x20','.env','exit','.claude/channels/commhub','text','offline','delete','SSE\x20connection\x20error:\x20','SIGTERM','idle','commhub_report_status','commhub','shutting\x20down,\x20reporting\x20offline...','starting\x20SSE\x20listener...','getReader','Target\x20session\x20alias','get_all_status','Priority\x20(default:\x20normal)','claude-code','toTimeString','commhub_reply','join','SSE\x20error:\x20','\x20from\x20','send_reply','working','error','set','notifications/claude/channel','application/json','Authorization','(none)','fatal:\x20','1654540KfjULG','session\x20disconnected','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.'];a0_0x26a1=function(){return _0x16e9a3;};return a0_0x26a1();}process['stdin']['on']('end',()=>b()),process['on'](a0_0x2f6489(0x1e8),()=>b()),process['on'](a0_0x2f6489(0x211),()=>b());
2
+ const a0_0xde0de9=a0_0xf89e;(function(_0x18d8fb,_0x3a1628){const _0x233680=a0_0xf89e,_0x2b360d=_0x18d8fb();while(!![]){try{const _0x43cf8c=-parseInt(_0x233680(0xf5))/0x1+-parseInt(_0x233680(0xfb))/0x2*(parseInt(_0x233680(0xa8))/0x3)+parseInt(_0x233680(0xba))/0x4*(-parseInt(_0x233680(0xd7))/0x5)+parseInt(_0x233680(0x7b))/0x6+parseInt(_0x233680(0x109))/0x7*(parseInt(_0x233680(0xa4))/0x8)+parseInt(_0x233680(0x10d))/0x9+parseInt(_0x233680(0x77))/0xa;if(_0x43cf8c===_0x3a1628)break;else _0x2b360d['push'](_0x2b360d['shift']());}catch(_0x1d56a1){_0x2b360d['push'](_0x2b360d['shift']());}}}(a0_0x18c1,0xee118));import{readFileSync as a0_0x30f608,existsSync as a0_0x16fa5b}from'fs';import{randomUUID as a0_0x50b48e}from'crypto';function a0_0x18c1(){const _0x2ad29f=['Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','number','4500330Cckgnf','alias','stringify','stderr','5463852pnWXXU','no\x20response','\x20priority=','\x20/\x20hostname=','new_message','in_progress','low','notification','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','SSE\x20connection\x20error:\x20','→\x20injected\x20task\x20','SIGINT','ENV:\x20URL=','SSE\x20fatal:\x20','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','message_id','tools/call','startsWith','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','commhub_send_message','delete','normal','join','unknown\x20tool','get','messages','/mcp','token','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','trim','indexOf','set','...\x20TMUX=','Bearer\x20','from','completed','\x22\x20(','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','commhub_get_all_status','\x20PROJECT_ENV=','8VynnaD','message','send_task','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','291741QWLBTh','heartbeat\x20failed:\x20','priority','broadcast','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','object','claude-code','commhub-channel','Target\x20session\x20alias',':\x20inbox_count=','2.0','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','parse','cancelled','.env','write','split','notifications/claude/channel','13724hQZcyX','blocked','high','getReader','starting\x20SSE\x20listener...','\x20from\x20','idle','catch','utf-8','report_status','connected','get_all_status','error','re-registered\x20as\x20\x22','hub','application/json,\x20text/event-stream','none','Reply\x20text\x20/\x20result\x20summary',']\x20[commhub]\x20','commhub','POST','commhub_report_status','content','ready\x20—\x20waiting\x20for\x20events','result','replace','now','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','/events/','1240xxbIbR','session\x20disconnected','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','connect','get_inbox','failed','.claude/channels/commhub','exit','config.json','unattributed-','body','commhub_send_task','new_task','MCP\x20stdio\x20connected','ack_inbox','find','from_session','\x22\x20after\x20SSE\x20reconnect','.anet','replied','initialize','type','Priority\x20(default:\x20normal)','cwd','min','fatal:\x20','commhub_reply','slice','tmux\x20display-message\x20-p\x20\x27#S\x27','status','1312248FESlcb','application/json','setRequestHandler','parse\x20error:\x20','0.3.0','Current\x20task\x20description','4ayJUAU','SIGTERM','(none)','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','toTimeString','data:\x20','Progress\x200-100','connecting\x20to\x20','\x20ALIAS=','\x20RESUME_ID=','params','read','CommHub\x20init\x20failed:\x20','statusText','9921555uWHxmZ','text','inbox_count','Task\x20content','4992462vCBNld','Session\x20alias:\x20','string','decode'];a0_0x18c1=function(){return _0x2ad29f;};return a0_0x18c1();}import{join as a0_0x468e1a}from'path';import{hostname as a0_0x19539f}from'os';import{execSync as a0_0x23f8c3}from'child_process';import{Server as a0_0x3c1269}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0xbeab5b}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xaaf5d5,CallToolRequestSchema as a0_0x3f10d8}from'@modelcontextprotocol/sdk/types.js';function I(_0x5761af){const _0x56425d=a0_0xf89e;if(!a0_0x16fa5b(_0x5761af))return;for(let _0x3de513 of a0_0x30f608(_0x5761af,_0x56425d(0xc2))['split']('\x0a')){let _0x313b74=_0x3de513[_0x56425d(0x99)]();if(!_0x313b74||_0x313b74[_0x56425d(0x8c)]('#'))continue;let _0x16de66=_0x313b74[_0x56425d(0x9a)]('=');if(_0x16de66<0x0)continue;let _0x4ff2a1=_0x313b74[_0x56425d(0xf2)](0x0,_0x16de66)['trim'](),_0x2553fb=_0x313b74[_0x56425d(0xf2)](_0x16de66+0x1)[_0x56425d(0x99)]()[_0x56425d(0xd3)](/^["']|["']$/g,'');if(!process.env[_0x4ff2a1])process.env[_0x4ff2a1]=_0x2553fb;}}var L=process.env.HOME||'~',U=a0_0x468e1a(L,a0_0xde0de9(0xdd));I(a0_0x468e1a(U,a0_0xde0de9(0xb6)));var v=process['cwd']()[a0_0xde0de9(0xd3)](/\//g,'-');I(a0_0x468e1a(U,v,a0_0xde0de9(0xb6)));function d(){const _0x3c95f2=a0_0xde0de9;try{return a0_0x23f8c3(_0x3c95f2(0xf3),{'encoding':'utf-8','timeout':0x7d0})[_0x3c95f2(0x99)]();}catch{return'';}}function m(){const _0x51dbdc=a0_0xde0de9;try{let _0x2960a4=a0_0x468e1a(L,_0x51dbdc(0xe9),_0x51dbdc(0xdf));if(a0_0x16fa5b(_0x2960a4))return JSON[_0x51dbdc(0xb4)](a0_0x30f608(_0x2960a4,_0x51dbdc(0xc2)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0xde0de9(0xc8)]||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||d();function r(){const _0x27ff66=a0_0xde0de9;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS['trim']())return process.env.COMMHUB_ALIAS[_0x27ff66(0x99)]();return process[_0x27ff66(0x7a)][_0x27ff66(0xb7)](_0x27ff66(0xfe)+('would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME='+(f||_0x27ff66(0xfd))+_0x27ff66(0x7e)+a0_0x19539f()+_0x27ff66(0x89))),_0x27ff66(0xe0)+process['pid'];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x50b48e(),F=process.env.COMMHUB_TOKEN||u[a0_0xde0de9(0x96)]||'';function W(_0x10980d){const _0x55d614=a0_0xde0de9;let _0x270375=new Date()[_0x55d614(0xff)]()[_0x55d614(0xf2)](0x0,0x8);process['stderr'][_0x55d614(0xb7)]('['+_0x270375+_0x55d614(0xcc)+_0x10980d+'\x0a');}function N(_0x123406){return new Promise(_0x27256f=>setTimeout(_0x27256f,_0x123406));}W(a0_0xde0de9(0x87)+j+a0_0xde0de9(0x103)+G+a0_0xde0de9(0x104)+K[a0_0xde0de9(0xf2)](0x0,0x8)+a0_0xde0de9(0x9c)+(f||a0_0xde0de9(0xca))+'\x20CWD='+process[a0_0xde0de9(0xee)]()+a0_0xde0de9(0xa3)+v);var D=new Map(),x=new a0_0x3c1269({'name':a0_0xde0de9(0xaf),'version':a0_0xde0de9(0xf9)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0xde0de9(0xd9),a0_0xde0de9(0xd5),a0_0xde0de9(0x8d),a0_0xde0de9(0xa1),a0_0xde0de9(0x10e)+G][a0_0xde0de9(0x91)]('\x0a')});x[a0_0xde0de9(0xf7)](a0_0xaaf5d5,async()=>({'tools':[{'name':a0_0xde0de9(0xf1),'description':a0_0xde0de9(0xb3),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0xde0de9(0x10f),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0xde0de9(0x10f),'description':a0_0xde0de9(0xcb)},'status':{'type':'string','enum':[a0_0xde0de9(0x9f),a0_0xde0de9(0xdc),a0_0xde0de9(0xb5),'blocked',a0_0xde0de9(0xc6),a0_0xde0de9(0x80)],'description':a0_0xde0de9(0x97)}},'required':[a0_0xde0de9(0x10a)]}},{'name':a0_0xde0de9(0xcf),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0xde0de9(0xad),'properties':{'status':{'type':a0_0xde0de9(0x10f),'enum':['working','idle',a0_0xde0de9(0xbb),'error']},'task':{'type':'string','description':a0_0xde0de9(0xfa)},'progress':{'type':a0_0xde0de9(0x76),'description':a0_0xde0de9(0x101)}},'required':[a0_0xde0de9(0xf4)]}},{'name':a0_0xde0de9(0xe2),'description':a0_0xde0de9(0xac),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0xde0de9(0x10f),'description':a0_0xde0de9(0xb0)},'task':{'type':a0_0xde0de9(0x10f),'description':a0_0xde0de9(0x10c)},'priority':{'type':a0_0xde0de9(0x10f),'enum':[a0_0xde0de9(0xbc),a0_0xde0de9(0x90),a0_0xde0de9(0x81)],'description':a0_0xde0de9(0xed)}},'required':['alias','task']}},{'name':a0_0xde0de9(0x8e),'description':a0_0xde0de9(0xa7),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0xde0de9(0x10f),'description':a0_0xde0de9(0xb0)},'message':{'type':a0_0xde0de9(0x10f),'description':'Message\x20content'}},'required':[a0_0xde0de9(0x78),a0_0xde0de9(0xa5)]}},{'name':a0_0xde0de9(0xa2),'description':a0_0xde0de9(0x75),'inputSchema':{'type':'object','properties':{}}}]}));async function Y(_0x554c41,_0x1ddc97){const _0x266ee7=a0_0xde0de9;let _0x2c4deb=await fetch(j+_0x266ee7(0x95),{'method':_0x266ee7(0xce),'headers':{'Content-Type':_0x266ee7(0xf6),'Accept':_0x266ee7(0xc9),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x266ee7(0x79)]({'jsonrpc':'2.0','id':0x1,'method':_0x266ee7(0xeb),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x266ee7(0xaf),'version':'0.3.0'}}})});if(!_0x2c4deb['ok']){let _0x2ce772=await _0x2c4deb[_0x266ee7(0x10a)]();return W(_0x266ee7(0x107)+_0x2c4deb[_0x266ee7(0xf4)]+'\x20'+_0x2ce772[_0x266ee7(0xf2)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x2c4deb['status']};}await _0x2c4deb['text']();let _0x2686f7=(await(await fetch(j+_0x266ee7(0x95),{'method':_0x266ee7(0xce),'headers':{'Content-Type':'application/json','Accept':_0x266ee7(0xc9),...F?{'Authorization':_0x266ee7(0x9d)+F}:{}},'body':JSON['stringify']({'jsonrpc':_0x266ee7(0xb2),'id':0x2,'method':_0x266ee7(0x8b),'params':{'name':_0x554c41,'arguments':_0x1ddc97}})}))[_0x266ee7(0x10a)]())['split']('\x0a')[_0x266ee7(0xe6)](_0x24af8a=>_0x24af8a['startsWith'](_0x266ee7(0x100)));if(_0x2686f7){let _0x4a8a84=JSON['parse'](_0x2686f7[_0x266ee7(0xf2)](0x6));return _0x4a8a84?.[_0x266ee7(0xd2)]?.['content']?.[0x0]?.['text']?JSON[_0x266ee7(0xb4)](_0x4a8a84['result'][_0x266ee7(0xd0)][0x0]['text']):_0x4a8a84;}return{'ok':!0x1,'error':_0x266ee7(0x7c)};}x[a0_0xde0de9(0xf7)](a0_0x3f10d8,async _0x6d656e=>{const _0x57293=a0_0xde0de9;let {name:_0x194e63,arguments:_0x440e3c}=_0x6d656e[_0x57293(0x105)];if(_0x194e63===_0x57293(0xf1)){let {task_id:_0x406677,text:_0xd5b7a3,status:_0x5f14fb}=_0x440e3c;if(_0x5f14fb==='completed'||_0x5f14fb===_0x57293(0xdc)||_0x5f14fb===_0x57293(0xb5)){let _0x29201e=_0x5f14fb===_0x57293(0x9f)?_0x57293(0xea):_0x5f14fb,_0x57feba=_0x406677?D[_0x57293(0x93)](_0x406677)||_0x57293(0xc8):_0x57293(0xc8),_0x2a52cb=await Y('send_reply',{'alias':_0x57feba,'text':_0xd5b7a3,'in_reply_to':_0x406677||void 0x0,'status':_0x29201e,'from_session':G});if(_0x406677)D[_0x57293(0x8f)](_0x406677);return{'content':[{'type':'text','text':JSON['stringify'](_0x2a52cb)}]};}let _0x19c24e=await Y('report_status',{'resume_id':K,'alias':G,'status':_0x5f14fb==='blocked'?'blocked':_0x5f14fb==='error'?_0x57293(0xc6):'working','task':_0xd5b7a3['slice'](0x0,0xc8),'output':_0xd5b7a3});return{'content':[{'type':_0x57293(0x10a),'text':JSON[_0x57293(0x79)](_0x19c24e)}]};}if(_0x194e63===_0x57293(0xcf)){let {status:_0x46a9ba,task:_0x58d4bb,progress:_0x1f248b}=_0x440e3c,_0x5554d8=await Y(_0x57293(0xc3),{'resume_id':K,'alias':G,'status':_0x46a9ba,'task':_0x58d4bb,'progress':_0x1f248b});return{'content':[{'type':'text','text':JSON[_0x57293(0x79)](_0x5554d8)}]};}if(_0x194e63===_0x57293(0xe2)){let {alias:_0x7fa7b1,task:_0x429c2c,priority:_0x2bd287}=_0x440e3c,_0x510389=await Y(_0x57293(0xa6),{'alias':_0x7fa7b1,'task':_0x429c2c,'priority':_0x2bd287||_0x57293(0x90),'from_session':G});return{'content':[{'type':_0x57293(0x10a),'text':JSON[_0x57293(0x79)](_0x510389)}]};}if(_0x194e63===_0x57293(0x8e)){let {alias:_0x266ca0,message:_0x210af8}=_0x440e3c,_0x5db17e=await Y('send_message',{'alias':_0x266ca0,'message':_0x210af8,'from_session':G});return{'content':[{'type':_0x57293(0x10a),'text':JSON['stringify'](_0x5db17e)}]};}if(_0x194e63===_0x57293(0xa2)){let _0x50b7f8=await Y(_0x57293(0xc5),{});return{'content':[{'type':_0x57293(0x10a),'text':JSON['stringify'](_0x50b7f8)}]};}return{'content':[{'type':'text','text':JSON[_0x57293(0x79)]({'error':_0x57293(0x92)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x421780=a0_0xde0de9;try{await Y(_0x421780(0xc3),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x19539f(),'hostname':a0_0x19539f(),'agent':'claude-code','project_dir':process[_0x421780(0xee)](),'tmux_name':f||void 0x0}),W(_0x421780(0xc7)+G+_0x421780(0xe8));}catch(_0x5bd2d5){W('re-register\x20failed:\x20'+_0x5bd2d5);}}async function o(){const _0x588f15=a0_0xde0de9;let _0x32dff7=j+_0x588f15(0xd6)+encodeURIComponent(G),_0x44c7ab={};if(F)_0x44c7ab['Authorization']='Bearer\x20'+F;W(_0x588f15(0x102)+_0x32dff7);let _0x94d745=O,_0x28fd4c=!0x0,_0x24d6a0=null;while(!0x0){try{let _0x14b8fd=await fetch(_0x32dff7,{'headers':_0x44c7ab});if(!_0x14b8fd['ok']){if(W('SSE\x20error:\x20'+_0x14b8fd[_0x588f15(0xf4)]+'\x20'+_0x14b8fd[_0x588f15(0x108)]),_0x24d6a0=_0x24d6a0??Date[_0x588f15(0xd4)](),Date[_0x588f15(0xd4)]()-_0x24d6a0>T){W(_0x588f15(0x83)+j+_0x588f15(0x98));return;}await N(_0x94d745),_0x94d745=Math['min'](_0x94d745*0x2,R);continue;}let _0x14bcef=_0x14b8fd[_0x588f15(0xe1)][_0x588f15(0xbd)](),_0x35dad6=new TextDecoder(),_0x268c4c='';_0x94d745=O;while(!0x0){let {done:_0x4fe1d8,value:_0x2f4165}=await _0x14bcef[_0x588f15(0x106)]();if(_0x4fe1d8)break;_0x268c4c+=_0x35dad6[_0x588f15(0x74)](_0x2f4165,{'stream':!0x0});let _0x3bce66=_0x268c4c['split']('\x0a\x0a');_0x268c4c=_0x3bce66['pop']()||'';for(let _0x43baff of _0x3bce66){let _0xd695a4=_0x43baff[_0x588f15(0xb8)]('\x0a')['find'](_0x2f4314=>_0x2f4314['startsWith'](_0x588f15(0x100)));if(!_0xd695a4)continue;try{let _0x39ec05=JSON[_0x588f15(0xb4)](_0xd695a4[_0x588f15(0xf2)](0x6));if(await a(_0x39ec05),_0x39ec05[_0x588f15(0xec)]===_0x588f15(0xc4)){if(_0x24d6a0=null,!_0x28fd4c)await l();_0x28fd4c=!0x1;}}catch(_0x405be5){W(_0x588f15(0xf8)+_0x405be5);}}}W('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x510120){W(_0x588f15(0x84)+_0x510120);}if(_0x24d6a0=_0x24d6a0??Date[_0x588f15(0xd4)](),Date[_0x588f15(0xd4)]()-_0x24d6a0>T){W('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+j+_0x588f15(0x98));return;}await N(_0x94d745),_0x94d745=Math[_0x588f15(0xef)](_0x94d745*0x2,R);}}async function a(_0x4495d4){const _0x3d23fb=a0_0xde0de9;if(_0x4495d4[_0x3d23fb(0xec)]===_0x3d23fb(0xc4)){W('SSE\x20connected\x20as\x20\x22'+G+'\x22');return;}if(_0x4495d4['type']===_0x3d23fb(0x7f)){if(W('←\x20message\x20from\x20'+_0x4495d4['from']+':\x20'+_0x4495d4['message'][_0x3d23fb(0xf2)](0x0,0x3c)),await x[_0x3d23fb(0x82)]({'method':_0x3d23fb(0xb9),'params':{'content':_0x4495d4[_0x3d23fb(0xa5)],'meta':{'sender':_0x4495d4[_0x3d23fb(0x9e)]||'hub','sender_id':_0x3d23fb(0xcd),'user':_0x4495d4['from']||_0x3d23fb(0xc8),'priority':'normal'}}}),_0x4495d4['message_id'])await Y('ack_inbox',{'alias':G,'message_id':_0x4495d4[_0x3d23fb(0x8a)]});return;}if(_0x4495d4[_0x3d23fb(0xec)]===_0x3d23fb(0xe3)||_0x4495d4[_0x3d23fb(0xec)]===_0x3d23fb(0xab)){W('←\x20'+_0x4495d4[_0x3d23fb(0xec)]+_0x3d23fb(0xb1)+_0x4495d4[_0x3d23fb(0x10b)]+_0x3d23fb(0x7d)+(_0x4495d4[_0x3d23fb(0xaa)]||_0x3d23fb(0x90)));let _0x1cd9d9=await Y(_0x3d23fb(0xdb),{'alias':G,'limit':0x5});if(_0x1cd9d9?.['ok']&&_0x1cd9d9[_0x3d23fb(0x94)]?.['length']>0x0)for(let _0x5d5998 of _0x1cd9d9[_0x3d23fb(0x94)]){let _0x24d0fb={'sender':_0x5d5998[_0x3d23fb(0xe7)]||'hub','sender_id':'commhub','user':_0x5d5998[_0x3d23fb(0xe7)]||_0x3d23fb(0xc8),'task_id':_0x5d5998['id'],'priority':_0x5d5998[_0x3d23fb(0xaa)]||'normal'};D[_0x3d23fb(0x9b)](_0x5d5998['id'],_0x5d5998['from_session']||'hub'),await x[_0x3d23fb(0x82)]({'method':'notifications/claude/channel','params':{'content':_0x5d5998[_0x3d23fb(0xd0)],'meta':_0x24d0fb}}),W(_0x3d23fb(0x85)+_0x5d5998['id']['slice'](0x0,0x8)+_0x3d23fb(0xbf)+_0x5d5998['from_session']+':\x20'+_0x5d5998[_0x3d23fb(0xd0)][_0x3d23fb(0xf2)](0x0,0x3c)),await Y(_0x3d23fb(0xe5),{'alias':G,'message_id':_0x5d5998['id']});}}}async function n(){const _0x935f2=a0_0xde0de9;let _0x4e4a40=new a0_0xbeab5b();await x[_0x935f2(0xda)](_0x4e4a40),W(_0x935f2(0xe4)),W(_0x935f2(0xbe)),o()[_0x935f2(0xc1)](_0x2ca865=>W(_0x935f2(0x88)+_0x2ca865)),Y(_0x935f2(0xc3),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x19539f(),'hostname':a0_0x19539f(),'agent':_0x935f2(0xae),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})['then'](()=>W('registered\x20as\x20\x22'+G+_0x935f2(0xa0)+K[_0x935f2(0xf2)](0x0,0x8)+')'))['catch'](_0x2971c6=>W('warning:\x20could\x20not\x20register:\x20'+_0x2971c6)),setInterval(()=>{const _0x1896eb=_0x935f2;Y('report_status',{'resume_id':K,'alias':G,'status':_0x1896eb(0xc0),'server':a0_0x19539f(),'hostname':a0_0x19539f(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x1896eb(0xc1)](_0x1bd5c=>W(_0x1896eb(0xa9)+_0x1bd5c));},0x2bf20),W(_0x935f2(0xd1));}n()[a0_0xde0de9(0xc1)](_0x14c86b=>{const _0x473cdb=a0_0xde0de9;W(_0x473cdb(0xf0)+_0x14c86b),process[_0x473cdb(0xde)](0x1);});async function b(){const _0x20fbd8=a0_0xde0de9;W('shutting\x20down,\x20reporting\x20offline...'),await Y(_0x20fbd8(0xc3),{'resume_id':K,'alias':G,'status':'offline','task':_0x20fbd8(0xd8)})[_0x20fbd8(0xc1)](()=>{}),process['exit'](0x0);}function a0_0xf89e(_0xafa2b7,_0x50d1bc){_0xafa2b7=_0xafa2b7-0x74;const _0x18c1cf=a0_0x18c1();let _0xf89e7e=_0x18c1cf[_0xafa2b7];return _0xf89e7e;}process['stdin']['on']('end',()=>b()),process['on'](a0_0xde0de9(0xfc),()=>b()),process['on'](a0_0xde0de9(0x86),()=>b());
@@ -0,0 +1,9 @@
1
+ export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp";
2
+ /** Operator-facing default for any runtime slot that comes in empty / missing / unrecognized. */
3
+ export declare const DEFAULT_RUNTIME: RuntimeName;
4
+ type ProfileLike = {
5
+ runtime?: string;
6
+ codexRuntime?: string;
7
+ };
8
+ export declare function normalizeRuntime(profileOrRuntime?: ProfileLike | string): RuntimeName;
9
+ export {};
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Per-iteration controller passed into `runOnce`. Today exposes only
3
+ * `markStable`; a future stop-the-current-iteration affordance would
4
+ * be a sibling field on this interface.
5
+ */
6
+ export interface SupervisedIterationController {
7
+ /**
8
+ * Signal that this iteration crossed the "actually working" threshold.
9
+ * Resets the backoff to `baseDelayMs` and zeroes the cumulative
10
+ * downtime counter. Safe to call multiple times per iteration — only
11
+ * the first call has effect within a single iteration.
12
+ */
13
+ markStable(): void;
14
+ }
15
+ export interface SuperviseChildOpts {
16
+ /** Short label for log / error messages. e.g. "feishu" / "sse". */
17
+ label: string;
18
+ /** Returns true when the supervisor should stop without rescheduling. */
19
+ shutdownGate: () => boolean;
20
+ /**
21
+ * One iteration of the supervised child. Resolves when the iteration
22
+ * ends (child exits / stream closes); throws to log + reschedule.
23
+ * Receives a controller for the iteration to call `markStable` on
24
+ * once the work crosses its "really working" threshold.
25
+ */
26
+ runOnce: (ctrl: SupervisedIterationController) => Promise<void>;
27
+ /** Initial backoff delay in ms. Default 1_000. */
28
+ baseDelayMs?: number;
29
+ /** Maximum backoff after exponential growth. Default 30_000. */
30
+ maxDelayMs?: number;
31
+ /**
32
+ * Jitter ratio (±N×delay). Default 0.25 (±25%). Set 0 to disable.
33
+ * The waited time per backoff is `max(100, delay + delay * jitter *
34
+ * (Math.random() * 2 - 1))`.
35
+ */
36
+ jitterRatio?: number;
37
+ /**
38
+ * If cumulative downtime (consecutive iterations that did NOT call
39
+ * markStable, plus their inter-iteration sleeps) exceeds this, the
40
+ * supervisor invokes `onAbandon` and returns. Default `Infinity`
41
+ * (never abandon). Set to a finite value (e.g. 3_600_000 = 1 h) to
42
+ * give up after a long unsuccessful run.
43
+ */
44
+ abandonAfterMs?: number;
45
+ /** Called once if the supervisor abandons. */
46
+ onAbandon?: () => void;
47
+ /** Called with the runOnce error before scheduling the next iteration. */
48
+ onError?: (err: unknown) => void;
49
+ /** Called before sleeping with the resolved backoff (and the jittered wait). */
50
+ onRetryWait?: (waitMs: number, backoffMs: number) => void;
51
+ /**
52
+ * Sleep primitive — overridden by tests to skip real timers. Default
53
+ * uses `setTimeout`. Must respect `ms <= 0` as "no wait".
54
+ */
55
+ sleep?: (ms: number) => Promise<void>;
56
+ /**
57
+ * Random source — overridden by tests for deterministic jitter.
58
+ * Default `Math.random`.
59
+ */
60
+ random?: () => number;
61
+ /** Current-time source — overridden by tests. Default `Date.now`. */
62
+ now?: () => number;
63
+ }
64
+ /**
65
+ * Run the supervisor loop. Resolves when the shutdown gate triggers or
66
+ * the abandon threshold fires; never throws (runOnce errors are routed
67
+ * to `onError`).
68
+ */
69
+ export declare function superviseChild(opts: SuperviseChildOpts): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.3.0-preview.1",
4
- "description": "AI Agent Network CLI \u2014 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.11",
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.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",
7
7
  "types": "dist/client.d.ts",
@@ -65,10 +65,13 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@inquirer/prompts": "^8.4.3",
68
- "@larksuiteoapi/node-sdk": "^1.42.0"
68
+ "@larksuiteoapi/node-sdk": "^1.42.0",
69
+ "markdown-it": "^14.1.0",
70
+ "puppeteer-core": "^24.10.2"
69
71
  },
70
72
  "devDependencies": {
71
73
  "@modelcontextprotocol/sdk": "^1.12.0",
74
+ "@types/markdown-it": "^14.1.2",
72
75
  "@types/node": "^25.0.0",
73
76
  "javascript-obfuscator": "^5.4.1",
74
77
  "node-pty": "^1.1.0",