@sleep2agi/agent-network 2.3.0-preview.181 → 2.3.0-preview.182

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 +1 @@
1
- function a0_0x2045(){const _0x30d566=['898992pVSRvv','running','get_all_status','SSE\x20reconnecting\x20in\x20','call','processInbox','355CzYpVw','task.started','agent','send_message','signal','lifecycleTracking','CommHub\x20response\x20omitted\x20task_id','from_alias','networkId','send_rejected','application/json,\x20text/event-stream','848607jRuAlf','alias','[REDACTED]','error_message','message','replace','[commhub:task]\x20',']\x20[commhub:','registered','autoConnect','\x20transport=','idle','\x20error=','send_reply','slice','319558ImumPh','5333148CqsCmu','lifecycle_tracking','sdk-','parentTaskId','url','from_session','toString','min','emit','status','new_task','2358020iTEdXy','broadcast','duration_ms','delivered','\x20network_id=','catch','Authorization','2717416ENiGfm','task_id','getAllStatus','SSE\x20error:\x20','text','resumeId','heartbeatTimer','task.ack','sseAbort','SSE\x20connected','error_code','application/json','parent_task_id','network_id','body','messages','failed','new_message','abort','<unknown>','token','send','get_inbox','s...','toTimeString','connected','string','\x20from=','ack_inbox','unknown\x20error','parse','read','send_failed','\x20task_id=','data:\x20','tools/call','\x20to=','content','connect','name','/events/','1poZono','not_tracked','message_id','disconnected','disconnect','error','reconnectDelay','\x20parent_task_id=','fromAlias','AbortError','sending','2.0','task.send.delivered','transport','Bearer\x20','getReader','\x20lifecycle=','reply','SSE\x20failed:\x20','startsWith','send_task','CommHub\x20rejected\x20task','sdk','cwd','now','json','task.send.failed','4596mNvAhB','task.replied','/mcp','text/event-stream','split','connectSSE','sleep','match','POST','inbox\x20error:\x20','type','log','heartbeatInterval','stringify'];a0_0x2045=function(){return _0x30d566;};return a0_0x2045();}function a0_0x2f88(_0x54999f,_0x19eaa9){_0x54999f=_0x54999f-0x1de;const _0x204512=a0_0x2045();let _0x2f884a=_0x204512[_0x54999f];return _0x2f884a;}const a0_0x32cf33=a0_0x2f88;(function(_0x4c090d,_0x2b1fe6){const _0x19c426=a0_0x2f88,_0x3a618c=_0x4c090d();while(!![]){try{const _0x5c3ea9=-parseInt(_0x19c426(0x22a))/0x1*(parseInt(_0x19c426(0x1ee))/0x2)+parseInt(_0x19c426(0x1df))/0x3+parseInt(_0x19c426(0x253))/0x4+-parseInt(_0x19c426(0x259))/0x5*(parseInt(_0x19c426(0x245))/0x6)+-parseInt(_0x19c426(0x1fa))/0x7+-parseInt(_0x19c426(0x201))/0x8+parseInt(_0x19c426(0x1ef))/0x9;if(_0x5c3ea9===_0x2b1fe6)break;else _0x3a618c['push'](_0x3a618c['shift']());}catch(_0x2404f5){_0x3a618c['push'](_0x3a618c['shift']());}}}(a0_0x2045,0x3324f));import{EventEmitter as a0_0x3b27ed}from'events';import{hostname as a0_0x497543}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2fd6c8,_0x380f4d)=>(_0x2fd6c8??_0x380f4d)[a0_0x32cf33(0x1e4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x32cf33(0x1ed)](0x0,0xf0);function N(_0x24d8aa){const _0x17d297=a0_0x32cf33;return(_0x24d8aa instanceof Error?_0x24d8aa[_0x17d297(0x1e3)]:String(_0x24d8aa??_0x17d297(0x21e)))[_0x17d297(0x1e4)](K,_0x17d297(0x1e1))[_0x17d297(0x1e4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x17d297(0x1ed)](0x0,0xf0);}function O(_0x34c24f,_0x133462=process.env.ANET_TASK_TRACE_FORMAT===a0_0x32cf33(0x243)){const _0x1e6cfc=a0_0x32cf33;if(_0x133462)return JSON['stringify'](_0x34c24f);let _0x182678=L(_0x34c24f[_0x1e6cfc(0x20d)],'<missing>'),_0x543377=L(_0x34c24f[_0x1e6cfc(0x202)],'<pending>'),_0x348da1=_0x34c24f[_0x1e6cfc(0x20b)]?_0x1e6cfc(0x1eb)+_0x34c24f[_0x1e6cfc(0x20b)]+':'+(_0x34c24f[_0x1e6cfc(0x1e2)]??''):'';return _0x1e6cfc(0x1e5)+_0x34c24f[_0x1e6cfc(0x1f8)]+_0x1e6cfc(0x21c)+L(_0x34c24f[_0x1e6cfc(0x260)],_0x1e6cfc(0x214))+_0x1e6cfc(0x225)+L(_0x34c24f['to_alias'],_0x1e6cfc(0x214))+_0x1e6cfc(0x222)+_0x543377+_0x1e6cfc(0x231)+_0x182678+_0x1e6cfc(0x1fe)+L(_0x34c24f[_0x1e6cfc(0x20e)],_0x1e6cfc(0x214))+_0x1e6cfc(0x1e9)+_0x34c24f[_0x1e6cfc(0x237)]+'\x20duration_ms='+_0x34c24f[_0x1e6cfc(0x1fc)]+_0x1e6cfc(0x23a)+_0x34c24f[_0x1e6cfc(0x1f0)]+_0x348da1;}function U(_0x153209){const _0xcb07e0=a0_0x32cf33;return{'event':{'sending':'task.send.start','delivered':_0xcb07e0(0x236),'failed':_0xcb07e0(0x244),'acked':_0xcb07e0(0x208),'started':_0xcb07e0(0x25a),'replied':_0xcb07e0(0x246),'expired':'task.expired'}[_0x153209[_0xcb07e0(0x1f8)]],..._0x153209};}function j(_0x38f774){const _0x2ef376=a0_0x32cf33;let _0x36604a=_0x38f774?.[_0x2ef376(0x202)]||_0x38f774?.[_0x2ef376(0x22c)]||_0x38f774?.['id'];if(_0x36604a)return String(_0x36604a);let _0x291ec5=_0x38f774?.[_0x2ef376(0x226)]?.[0x0]?.[_0x2ef376(0x205)];if(typeof _0x291ec5!==_0x2ef376(0x21b))return null;try{let _0x172a61=JSON[_0x2ef376(0x21f)](_0x291ec5);return _0x172a61?.['task_id']||_0x172a61?.[_0x2ef376(0x22c)]||_0x172a61?.['id']||null;}catch{return null;}}async function X(_0x3ec07c,_0x516016){const _0x3a7276=a0_0x32cf33;let _0x38e66c=_0x516016[_0x3a7276(0x242)]??Date[_0x3a7276(0x242)],_0x259a29=_0x38e66c(),_0x3e4bec=(_0x249bd6,_0x5c4c44,_0x5a7d7,_0x57b306)=>{const _0x4f0fd5=_0x3a7276;_0x516016[_0x4f0fd5(0x250)](O(U({'from_alias':_0x3ec07c[_0x4f0fd5(0x232)],'to_alias':_0x3ec07c['toAlias'],'task_id':_0x5c4c44,'parent_task_id':_0x3ec07c[_0x4f0fd5(0x1f2)],'network_id':_0x3ec07c['networkId'],'transport':_0x3ec07c['transport'],'status':_0x249bd6,'duration_ms':_0x38e66c()-_0x259a29,'lifecycle_tracking':_0x3ec07c[_0x4f0fd5(0x25e)],..._0x5a7d7!==void 0x0?{'error_code':_0x57b306||_0x4f0fd5(0x221),'error_message':N(_0x5a7d7)}:{}})));};_0x3e4bec(_0x3a7276(0x234),null);try{let _0x37eefa=await _0x516016['send'](),_0x3a061a=j(_0x37eefa);if(_0x3a061a)_0x3e4bec(_0x3a7276(0x1fd),_0x3a061a);else{if(_0x37eefa?.['ok']===!0x1||_0x37eefa?.['error'])_0x3e4bec('failed',_0x3a061a,_0x37eefa?.[_0x3a7276(0x22f)]||_0x3a7276(0x23f),_0x3a7276(0x262));else _0x3e4bec(_0x3a7276(0x211),null,_0x3a7276(0x25f),'missing_task_id');}return _0x37eefa;}catch(_0x56e82c){throw _0x3e4bec('failed',null,_0x56e82c,_0x3a7276(0x221)),_0x56e82c;}}async function Y(_0x154f3b,_0xa82bd9){const _0x4733f8=a0_0x32cf33;return X({'fromAlias':_0x154f3b[_0x4733f8(0x232)],'toAlias':_0x154f3b[_0x4733f8(0x1e0)],'parentTaskId':_0x154f3b[_0x4733f8(0x1f2)]||null,'networkId':_0x154f3b[_0x4733f8(0x261)]||null,'transport':'mcp_http','lifecycleTracking':_0x4733f8(0x22b)},_0xa82bd9);}class $ extends a0_0x3b27ed{['url'];[a0_0x32cf33(0x1e0)];['token'];[a0_0x32cf33(0x25b)];[a0_0x32cf33(0x206)];[a0_0x32cf33(0x251)];[a0_0x32cf33(0x230)];['heartbeatTimer'];['sseAbort'];[a0_0x32cf33(0x254)]=!0x1;constructor(_0x1f21f0){const _0x282766=a0_0x32cf33;super();if(this[_0x282766(0x1f3)]=_0x1f21f0[_0x282766(0x1f3)][_0x282766(0x1e4)](/\/$/,''),this['alias']=_0x1f21f0[_0x282766(0x1e0)],this['token']=_0x1f21f0['token'],this[_0x282766(0x25b)]=_0x1f21f0[_0x282766(0x25b)]||_0x282766(0x240),this['resumeId']=_0x282766(0x1f1)+_0x1f21f0['alias']+'-'+Date[_0x282766(0x242)]()[_0x282766(0x1f5)](0x24),this[_0x282766(0x251)]=_0x1f21f0['heartbeatInterval']??0x2bf20,this[_0x282766(0x230)]=_0x1f21f0[_0x282766(0x230)]??0xbb8,_0x1f21f0[_0x282766(0x1e8)]!==!0x1)this[_0x282766(0x227)]();}[a0_0x32cf33(0x250)](_0x254961){const _0x40f27d=a0_0x32cf33;console[_0x40f27d(0x250)]('['+new Date()[_0x40f27d(0x219)]()[_0x40f27d(0x1ed)](0x0,0x8)+_0x40f27d(0x1e6)+this['alias']+']\x20'+_0x254961);}async['call'](_0x43a562,_0x218bfb){const _0x6ee5b=a0_0x32cf33;let _0x776743={'Content-Type':_0x6ee5b(0x20c),'Accept':_0x6ee5b(0x1de)};if(this['token'])_0x776743[_0x6ee5b(0x200)]=_0x6ee5b(0x238)+this['token'];let _0x2ddb11=await(await fetch(this[_0x6ee5b(0x1f3)]+_0x6ee5b(0x247),{'method':_0x6ee5b(0x24d),'headers':_0x776743,'body':JSON[_0x6ee5b(0x252)]({'jsonrpc':_0x6ee5b(0x235),'id':Date[_0x6ee5b(0x242)](),'method':_0x6ee5b(0x224),'params':{'name':_0x43a562,'arguments':_0x218bfb}})}))['text'](),_0x58eb7d=_0x2ddb11[_0x6ee5b(0x24c)](/data: (.+)/),_0x3d2417=_0x58eb7d?JSON[_0x6ee5b(0x21f)](_0x58eb7d[0x1]):JSON['parse'](_0x2ddb11),_0x1c69a3=_0x3d2417?.['result']?.['content']?.[0x0]?.['text'];return _0x1c69a3?JSON['parse'](_0x1c69a3):_0x3d2417;}async[a0_0x32cf33(0x227)](){const _0x12a2b5=a0_0x32cf33;if(this[_0x12a2b5(0x254)])return;this[_0x12a2b5(0x254)]=!0x0,await this['status']('idle'),this[_0x12a2b5(0x250)](_0x12a2b5(0x1e7)),this[_0x12a2b5(0x207)]=setInterval(()=>{const _0x120255=_0x12a2b5;this['status'](_0x120255(0x1ea))[_0x120255(0x1ff)](_0xfc128f=>this[_0x120255(0x250)]('heartbeat\x20failed:\x20'+_0xfc128f[_0x120255(0x1e3)]));},this[_0x12a2b5(0x251)]),this['connectSSE']();}async[a0_0x32cf33(0x22e)](){const _0xab3fc=a0_0x32cf33;if(this[_0xab3fc(0x254)]=!0x1,this[_0xab3fc(0x209)]?.[_0xab3fc(0x213)](),this[_0xab3fc(0x207)])clearInterval(this[_0xab3fc(0x207)]);await this[_0xab3fc(0x1f8)]('offline')[_0xab3fc(0x1ff)](()=>{}),this[_0xab3fc(0x250)](_0xab3fc(0x22d));}async[a0_0x32cf33(0x216)](_0x27c40e,_0x4ee14b,_0x55ef18='normal'){const _0x4d011f=a0_0x32cf33;return Y({'alias':_0x27c40e,'fromAlias':this[_0x4d011f(0x1e0)]},{'log':_0x3779f8=>console[_0x4d011f(0x250)](_0x3779f8),'send':()=>this[_0x4d011f(0x257)](_0x4d011f(0x23e),{'alias':_0x27c40e,'task':_0x4ee14b,'priority':_0x55ef18,'from_session':this[_0x4d011f(0x1e0)]})});}async[a0_0x32cf33(0x1e3)](_0x5e91e1,_0x3fa960){const _0x45ed3e=a0_0x32cf33;return this['call'](_0x45ed3e(0x25c),{'alias':_0x5e91e1,'message':_0x3fa960,'from_session':this[_0x45ed3e(0x1e0)]});}async[a0_0x32cf33(0x23b)](_0x39836c,_0x53af3b,_0xb3d124='completed'){const _0x3a2c01=a0_0x32cf33;return this[_0x3a2c01(0x257)](_0x3a2c01(0x1ec),{'in_reply_to':_0x39836c,'text':_0x53af3b,'status':_0xb3d124});}async['status'](_0x45b0b8,_0x223f88){const _0x543fb0=a0_0x32cf33;return this[_0x543fb0(0x257)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x543fb0(0x1e0)],'status':_0x45b0b8,'server':a0_0x497543(),'hostname':a0_0x497543(),'agent':this[_0x543fb0(0x25b)],'project_dir':process[_0x543fb0(0x241)](),..._0x223f88});}async[a0_0x32cf33(0x203)](){const _0x38a1cd=a0_0x32cf33;return this['call'](_0x38a1cd(0x255),{});}async[a0_0x32cf33(0x1fb)](_0x387792,_0x3720df){const _0x3e5eb8=a0_0x32cf33;return this[_0x3e5eb8(0x257)]('broadcast',{'message':_0x387792,'filter_server':_0x3720df?.['server'],'filter_status':_0x3720df?.['status']});}async[a0_0x32cf33(0x24a)](){const _0x1ed0d7=a0_0x32cf33;let _0x25dfa9=encodeURIComponent(this['alias']),_0x4195e7=this[_0x1ed0d7(0x1f3)]+_0x1ed0d7(0x229)+_0x25dfa9,_0x42fcf1=this[_0x1ed0d7(0x230)];while(this[_0x1ed0d7(0x254)]){try{this[_0x1ed0d7(0x209)]=new AbortController();let _0x26052e={'Accept':_0x1ed0d7(0x248)};if(this[_0x1ed0d7(0x215)])_0x26052e[_0x1ed0d7(0x200)]=_0x1ed0d7(0x238)+this[_0x1ed0d7(0x215)];let _0x46086d=await fetch(_0x4195e7,{'headers':_0x26052e,'signal':this['sseAbort'][_0x1ed0d7(0x25d)]});if(!_0x46086d['ok']||!_0x46086d[_0x1ed0d7(0x20f)]){this[_0x1ed0d7(0x250)](_0x1ed0d7(0x23c)+_0x46086d[_0x1ed0d7(0x1f8)]),await this[_0x1ed0d7(0x24b)](_0x42fcf1),_0x42fcf1=Math[_0x1ed0d7(0x1f6)](_0x42fcf1*1.5,0xea60);continue;}_0x42fcf1=this[_0x1ed0d7(0x230)];let _0x5743a0=_0x46086d['body'][_0x1ed0d7(0x239)](),_0x5c0217=new TextDecoder(),_0xa030d7='';while(this[_0x1ed0d7(0x254)]){let {done:_0x3df6b0,value:_0x51c677}=await _0x5743a0[_0x1ed0d7(0x220)]();if(_0x3df6b0)break;_0xa030d7+=_0x5c0217['decode'](_0x51c677,{'stream':!0x0});let _0x40ec4e=_0xa030d7[_0x1ed0d7(0x249)]('\x0a');_0xa030d7=_0x40ec4e['pop']()||'';for(let _0x31d781 of _0x40ec4e){if(!_0x31d781[_0x1ed0d7(0x23d)](_0x1ed0d7(0x223)))continue;try{let _0x1f5adc=JSON['parse'](_0x31d781[_0x1ed0d7(0x1ed)](0x6));if(_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x21a)){this[_0x1ed0d7(0x250)](_0x1ed0d7(0x20a)),this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x21a));continue;}if(_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x1f9)||_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x212)||_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x1fb))await this[_0x1ed0d7(0x258)]();}catch{}}}}catch(_0x56f073){if(_0x56f073[_0x1ed0d7(0x228)]===_0x1ed0d7(0x233))break;this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x22f),_0x56f073),this[_0x1ed0d7(0x250)](_0x1ed0d7(0x204)+_0x56f073[_0x1ed0d7(0x1e3)]);}if(this[_0x1ed0d7(0x254)])this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x22d)),this[_0x1ed0d7(0x250)](_0x1ed0d7(0x256)+_0x42fcf1/0x3e8+_0x1ed0d7(0x218)),await this[_0x1ed0d7(0x24b)](_0x42fcf1),_0x42fcf1=Math[_0x1ed0d7(0x1f6)](_0x42fcf1*1.5,0xea60);}}async[a0_0x32cf33(0x258)](){const _0x5d87d7=a0_0x32cf33;try{let _0x298ebc=(await this[_0x5d87d7(0x257)](_0x5d87d7(0x217),{'alias':this[_0x5d87d7(0x1e0)],'limit':0xa}))?.[_0x5d87d7(0x210)]||[];for(let _0x3c3bf5 of _0x298ebc)await this[_0x5d87d7(0x257)](_0x5d87d7(0x21d),{'alias':this[_0x5d87d7(0x1e0)],'message_id':_0x3c3bf5['id']}),this[_0x5d87d7(0x250)]('←\x20'+_0x3c3bf5[_0x5d87d7(0x1f4)]+':\x20'+_0x3c3bf5[_0x5d87d7(0x226)][_0x5d87d7(0x1ed)](0x0,0x3c)),this[_0x5d87d7(0x1f7)]('task',_0x3c3bf5),this[_0x5d87d7(0x1f7)](_0x5d87d7(0x1e3),_0x3c3bf5);}catch(_0x4c5a91){this[_0x5d87d7(0x250)](_0x5d87d7(0x24e)+_0x4c5a91[_0x5d87d7(0x1e3)]);}}[a0_0x32cf33(0x24b)](_0x235d31){return new Promise(_0x2182c1=>setTimeout(_0x2182c1,_0x235d31));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x272b16=a0_0x39a9;(function(_0x228720,_0xb42387){const _0x1efa33=a0_0x39a9,_0x5df8b5=_0x228720();while(!![]){try{const _0x578b08=-parseInt(_0x1efa33(0xe9))/0x1*(parseInt(_0x1efa33(0xf4))/0x2)+-parseInt(_0x1efa33(0x144))/0x3*(-parseInt(_0x1efa33(0xef))/0x4)+-parseInt(_0x1efa33(0xd8))/0x5+parseInt(_0x1efa33(0x122))/0x6+parseInt(_0x1efa33(0x11c))/0x7+parseInt(_0x1efa33(0x134))/0x8*(-parseInt(_0x1efa33(0xd6))/0x9)+parseInt(_0x1efa33(0xe2))/0xa;if(_0x578b08===_0xb42387)break;else _0x5df8b5['push'](_0x5df8b5['shift']());}catch(_0x17b8d1){_0x5df8b5['push'](_0x5df8b5['shift']());}}}(a0_0x4c4b,0x8e650));import{EventEmitter as a0_0x118283}from'events';import{hostname as a0_0xcf1272}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x5a7b6d,_0x28fe92)=>(_0x5a7b6d??_0x28fe92)[a0_0x272b16(0x12b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x272b16(0x13c)](0x0,0xf0);function N(_0x2f223e){const _0x2c47ee=a0_0x272b16;return(_0x2f223e instanceof Error?_0x2f223e['message']:String(_0x2f223e??_0x2c47ee(0xe1)))['replace'](K,_0x2c47ee(0x104))[_0x2c47ee(0x12b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2c47ee(0x13c)](0x0,0xf0);}function O(_0x5f1e83,_0xc81180=process.env.ANET_TASK_TRACE_FORMAT===a0_0x272b16(0x10e)){const _0x1df865=a0_0x272b16;if(_0xc81180)return JSON[_0x1df865(0x115)](_0x5f1e83);let _0x2fc3c6=L(_0x5f1e83[_0x1df865(0x141)],'<missing>'),_0x4d4ba7=L(_0x5f1e83[_0x1df865(0xfd)],_0x1df865(0x100)),_0x3f4792=_0x5f1e83[_0x1df865(0x12a)]?_0x1df865(0xe5)+_0x5f1e83[_0x1df865(0x12a)]+':'+(_0x5f1e83[_0x1df865(0xdc)]??''):'';return'[commhub:task]\x20'+_0x5f1e83[_0x1df865(0xd4)]+_0x1df865(0xce)+L(_0x5f1e83['from_alias'],_0x1df865(0x109))+_0x1df865(0x117)+L(_0x5f1e83[_0x1df865(0xf6)],_0x1df865(0x109))+_0x1df865(0xd2)+_0x4d4ba7+'\x20parent_task_id='+_0x2fc3c6+_0x1df865(0xe3)+L(_0x5f1e83['network_id'],_0x1df865(0x109))+'\x20transport='+_0x5f1e83[_0x1df865(0x132)]+_0x1df865(0xcd)+_0x5f1e83['duration_ms']+'\x20lifecycle='+_0x5f1e83[_0x1df865(0xec)]+_0x3f4792;}function U(_0x35941a){const _0xa9f8b2=a0_0x272b16;return{'event':{'sending':_0xa9f8b2(0x133),'delivered':_0xa9f8b2(0x11a),'failed':_0xa9f8b2(0xe8),'acked':_0xa9f8b2(0x114),'started':'task.started','replied':_0xa9f8b2(0x10d),'expired':_0xa9f8b2(0x13e)}[_0x35941a[_0xa9f8b2(0xd4)]],..._0x35941a};}function j(_0x339724){const _0x5d5650=a0_0x272b16;let _0x954df8=_0x339724?.[_0x5d5650(0xfd)]||_0x339724?.[_0x5d5650(0x107)]||_0x339724?.['id'];if(_0x954df8)return String(_0x954df8);let _0x530762=_0x339724?.[_0x5d5650(0xd5)]?.[0x0]?.[_0x5d5650(0x125)];if(typeof _0x530762!==_0x5d5650(0x10a))return null;try{let _0x276ed4=JSON[_0x5d5650(0xf8)](_0x530762);return _0x276ed4?.[_0x5d5650(0xfd)]||_0x276ed4?.['message_id']||_0x276ed4?.['id']||null;}catch{return null;}}async function X(_0x195757,_0x328eea){const _0x197d40=a0_0x272b16;let _0x5a2a31=_0x328eea[_0x197d40(0x140)]??Date[_0x197d40(0x140)],_0x3260a6=_0x5a2a31(),_0x2ebb66=(_0x4838d3,_0x3b6388,_0x539ee4,_0x382b84)=>{const _0x512a7d=_0x197d40;_0x328eea[_0x512a7d(0xd3)](O(U({'from_alias':_0x195757[_0x512a7d(0xe0)],'to_alias':_0x195757['toAlias'],'task_id':_0x3b6388,'parent_task_id':_0x195757[_0x512a7d(0x119)],'network_id':_0x195757['networkId'],'transport':_0x195757[_0x512a7d(0x132)],'status':_0x4838d3,'duration_ms':_0x5a2a31()-_0x3260a6,'lifecycle_tracking':_0x195757[_0x512a7d(0xf9)],..._0x539ee4!==void 0x0?{'error_code':_0x382b84||_0x512a7d(0x123),'error_message':N(_0x539ee4)}:{}})));};_0x2ebb66(_0x197d40(0xe6),null);try{let _0x5a5809=await _0x328eea['send'](),_0x3f1e63=j(_0x5a5809);if(_0x3f1e63)_0x2ebb66('delivered',_0x3f1e63);else{if(_0x5a5809?.['ok']===!0x1||_0x5a5809?.['error'])_0x2ebb66(_0x197d40(0x120),_0x3f1e63,_0x5a5809?.['error']||_0x197d40(0x13b),_0x197d40(0x135));else _0x2ebb66('failed',null,'CommHub\x20response\x20omitted\x20task_id','missing_task_id');}return _0x5a5809;}catch(_0x1fd465){throw _0x2ebb66('failed',null,_0x1fd465,_0x197d40(0x123)),_0x1fd465;}}async function Y(_0x1eed83,_0x26a584){const _0x2e07b4=a0_0x272b16;return X({'fromAlias':_0x1eed83[_0x2e07b4(0xe0)],'toAlias':_0x1eed83[_0x2e07b4(0x11e)],'parentTaskId':_0x1eed83[_0x2e07b4(0x119)]||null,'networkId':_0x1eed83['networkId']||null,'transport':_0x2e07b4(0xd9),'lifecycleTracking':_0x2e07b4(0x121)},_0x26a584);}class $ extends a0_0x118283{[a0_0x272b16(0xfa)];[a0_0x272b16(0x11e)];['token'];[a0_0x272b16(0xf2)];['resumeId'];['heartbeatInterval'];['reconnectDelay'];[a0_0x272b16(0x110)];[a0_0x272b16(0xf1)];[a0_0x272b16(0xd1)]=!0x1;constructor(_0x1f6853){const _0x19f57e=a0_0x272b16;super();if(this[_0x19f57e(0xfa)]=_0x1f6853[_0x19f57e(0xfa)][_0x19f57e(0x12b)](/\/$/,''),this[_0x19f57e(0x11e)]=_0x1f6853[_0x19f57e(0x11e)],this['token']=_0x1f6853[_0x19f57e(0x11f)],this[_0x19f57e(0xf2)]=_0x1f6853['agent']||'sdk',this['resumeId']=_0x19f57e(0xf0)+_0x1f6853['alias']+'-'+Date['now']()['toString'](0x24),this[_0x19f57e(0x12c)]=_0x1f6853[_0x19f57e(0x12c)]??0x2bf20,this[_0x19f57e(0x128)]=_0x1f6853[_0x19f57e(0x128)]??0xbb8,_0x1f6853[_0x19f57e(0x10b)]!==!0x1)this['connect']();}[a0_0x272b16(0xd3)](_0x251477){const _0x2d6208=a0_0x272b16;console[_0x2d6208(0xd3)]('['+new Date()[_0x2d6208(0x136)]()[_0x2d6208(0x13c)](0x0,0x8)+']\x20[commhub:'+this['alias']+']\x20'+_0x251477);}async[a0_0x272b16(0xed)](_0x4e0bad,_0x48c5db){const _0x5b08d8=a0_0x272b16;let _0x18719a={'Content-Type':_0x5b08d8(0xda),'Accept':_0x5b08d8(0x12e)};if(this[_0x5b08d8(0x11f)])_0x18719a['Authorization']=_0x5b08d8(0xee)+this[_0x5b08d8(0x11f)];let _0x4fcafa=await(await fetch(this[_0x5b08d8(0xfa)]+_0x5b08d8(0xfe),{'method':_0x5b08d8(0xff),'headers':_0x18719a,'body':JSON[_0x5b08d8(0x115)]({'jsonrpc':'2.0','id':Date['now'](),'method':_0x5b08d8(0x116),'params':{'name':_0x4e0bad,'arguments':_0x48c5db}})}))[_0x5b08d8(0x125)](),_0x5f11fc=_0x4fcafa[_0x5b08d8(0x106)](/data: (.+)/),_0x5e38dd=_0x5f11fc?JSON[_0x5b08d8(0xf8)](_0x5f11fc[0x1]):JSON[_0x5b08d8(0xf8)](_0x4fcafa),_0x5ad017=_0x5e38dd?.[_0x5b08d8(0xcf)]?.[_0x5b08d8(0xd5)]?.[0x0]?.[_0x5b08d8(0x125)];return _0x5ad017?JSON[_0x5b08d8(0xf8)](_0x5ad017):_0x5e38dd;}async[a0_0x272b16(0x113)](){const _0x33c4bb=a0_0x272b16;if(this[_0x33c4bb(0xd1)])return;this[_0x33c4bb(0xd1)]=!0x0,await this[_0x33c4bb(0xd4)]('idle'),this[_0x33c4bb(0xd3)]('registered'),this[_0x33c4bb(0x110)]=setInterval(()=>{const _0x244cfe=_0x33c4bb;this[_0x244cfe(0xd4)](_0x244cfe(0xea))[_0x244cfe(0xd0)](_0x28c3c8=>this[_0x244cfe(0xd3)](_0x244cfe(0x118)+_0x28c3c8[_0x244cfe(0x103)]));},this['heartbeatInterval']),this[_0x33c4bb(0x10f)]();}async['disconnect'](){const _0x5186c4=a0_0x272b16;if(this[_0x5186c4(0xd1)]=!0x1,this[_0x5186c4(0xf1)]?.[_0x5186c4(0xd7)](),this[_0x5186c4(0x110)])clearInterval(this[_0x5186c4(0x110)]);await this[_0x5186c4(0xd4)](_0x5186c4(0x11b))[_0x5186c4(0xd0)](()=>{}),this[_0x5186c4(0xd3)](_0x5186c4(0xdb));}async[a0_0x272b16(0x105)](_0x490db8,_0x3d1ae6,_0x292c89='normal'){const _0x49ba99=a0_0x272b16;return Y({'alias':_0x490db8,'fromAlias':this[_0x49ba99(0x11e)]},{'log':_0xf9a978=>console['log'](_0xf9a978),'send':()=>this[_0x49ba99(0xed)]('send_task',{'alias':_0x490db8,'task':_0x3d1ae6,'priority':_0x292c89,'from_session':this[_0x49ba99(0x11e)]})});}async[a0_0x272b16(0x103)](_0x2b8ef5,_0x29e79e){const _0xdf15b8=a0_0x272b16;return this[_0xdf15b8(0xed)](_0xdf15b8(0x13f),{'alias':_0x2b8ef5,'message':_0x29e79e,'from_session':this[_0xdf15b8(0x11e)]});}async['reply'](_0x4944cd,_0x15b034,_0xb36331=a0_0x272b16(0x10c)){const _0x35b24d=a0_0x272b16;return this[_0x35b24d(0xed)](_0x35b24d(0xf7),{'in_reply_to':_0x4944cd,'text':_0x15b034,'status':_0xb36331});}async[a0_0x272b16(0xd4)](_0x1c76b1,_0x7a6ce9){const _0x1174ce=a0_0x272b16;return this[_0x1174ce(0xed)](_0x1174ce(0x142),{'resume_id':this[_0x1174ce(0x131)],'alias':this[_0x1174ce(0x11e)],'status':_0x1c76b1,'server':a0_0xcf1272(),'hostname':a0_0xcf1272(),'agent':this[_0x1174ce(0xf2)],'project_dir':process['cwd'](),..._0x7a6ce9});}async[a0_0x272b16(0x127)](){const _0x38ac2f=a0_0x272b16;return this[_0x38ac2f(0xed)](_0x38ac2f(0xdf),{});}async[a0_0x272b16(0x124)](_0x4db7a5,_0x4156b8){const _0x1e0973=a0_0x272b16;return this['call'](_0x1e0973(0x124),{'message':_0x4db7a5,'filter_server':_0x4156b8?.[_0x1e0973(0x101)],'filter_status':_0x4156b8?.[_0x1e0973(0xd4)]});}async['connectSSE'](){const _0x59d162=a0_0x272b16;let _0x2b9394=encodeURIComponent(this[_0x59d162(0x11e)]),_0x422fbd=this['url']+'/events/'+_0x2b9394,_0x5a48ab=this[_0x59d162(0x128)];while(this[_0x59d162(0xd1)]){try{this['sseAbort']=new AbortController();let _0x13c024={'Accept':_0x59d162(0x13d)};if(this[_0x59d162(0x11f)])_0x13c024['Authorization']='Bearer\x20'+this[_0x59d162(0x11f)];let _0x98c9ca=await fetch(_0x422fbd,{'headers':_0x13c024,'signal':this[_0x59d162(0xf1)][_0x59d162(0x112)]});if(!_0x98c9ca['ok']||!_0x98c9ca[_0x59d162(0x129)]){this[_0x59d162(0xd3)](_0x59d162(0xe7)+_0x98c9ca[_0x59d162(0xd4)]),await this[_0x59d162(0x130)](_0x5a48ab),_0x5a48ab=Math[_0x59d162(0x12f)](_0x5a48ab*1.5,0xea60);continue;}_0x5a48ab=this[_0x59d162(0x128)];let _0x115b6b=_0x98c9ca[_0x59d162(0x129)][_0x59d162(0x137)](),_0x3970d6=new TextDecoder(),_0xfaec9b='';while(this[_0x59d162(0xd1)]){let {done:_0x33f9ba,value:_0x25fc65}=await _0x115b6b['read']();if(_0x33f9ba)break;_0xfaec9b+=_0x3970d6['decode'](_0x25fc65,{'stream':!0x0});let _0x390ba1=_0xfaec9b[_0x59d162(0x126)]('\x0a');_0xfaec9b=_0x390ba1[_0x59d162(0xfb)]()||'';for(let _0x1a4350 of _0x390ba1){if(!_0x1a4350['startsWith'](_0x59d162(0xdd)))continue;try{let _0x3d3585=JSON[_0x59d162(0xf8)](_0x1a4350['slice'](0x6));if(_0x3d3585[_0x59d162(0x138)]===_0x59d162(0xf5)){this['log'](_0x59d162(0xfc)),this['emit'](_0x59d162(0xf5));continue;}if(_0x3d3585[_0x59d162(0x138)]==='new_task'||_0x3d3585[_0x59d162(0x138)]===_0x59d162(0xf3)||_0x3d3585[_0x59d162(0x138)]===_0x59d162(0x124))await this[_0x59d162(0x12d)]();}catch{}}}}catch(_0x4d4c27){if(_0x4d4c27[_0x59d162(0xe4)]===_0x59d162(0x108))break;this[_0x59d162(0xde)](_0x59d162(0x111),_0x4d4c27),this[_0x59d162(0xd3)](_0x59d162(0x102)+_0x4d4c27[_0x59d162(0x103)]);}if(this[_0x59d162(0xd1)])this[_0x59d162(0xde)](_0x59d162(0xdb)),this['log'](_0x59d162(0x11d)+_0x5a48ab/0x3e8+_0x59d162(0x13a)),await this[_0x59d162(0x130)](_0x5a48ab),_0x5a48ab=Math[_0x59d162(0x12f)](_0x5a48ab*1.5,0xea60);}}async['processInbox'](){const _0x32801b=a0_0x272b16;try{let _0x34ab7c=(await this[_0x32801b(0xed)](_0x32801b(0x143),{'alias':this[_0x32801b(0x11e)],'limit':0xa}))?.[_0x32801b(0x139)]||[];for(let _0x3a52d4 of _0x34ab7c)await this[_0x32801b(0xed)]('ack_inbox',{'alias':this['alias'],'message_id':_0x3a52d4['id']}),this[_0x32801b(0xd3)]('←\x20'+_0x3a52d4[_0x32801b(0xeb)]+':\x20'+_0x3a52d4[_0x32801b(0xd5)][_0x32801b(0x13c)](0x0,0x3c)),this[_0x32801b(0xde)]('task',_0x3a52d4),this[_0x32801b(0xde)](_0x32801b(0x103),_0x3a52d4);}catch(_0x189603){this[_0x32801b(0xd3)]('inbox\x20error:\x20'+_0x189603[_0x32801b(0x103)]);}}[a0_0x272b16(0x130)](_0x44e3e3){return new Promise(_0x13d7a9=>setTimeout(_0x13d7a9,_0x44e3e3));}}function a0_0x39a9(_0x2e690b,_0x25daf0){_0x2e690b=_0x2e690b-0xcd;const _0x4c4b51=a0_0x4c4b();let _0x39a9dd=_0x4c4b51[_0x2e690b];return _0x39a9dd;}var F=$;export{F as default,$ as CommHub};function a0_0x4c4b(){const _0x3855ff=['failed','not_tracked','4104774GMBTNG','send_failed','broadcast','text','split','getAllStatus','reconnectDelay','body','error_code','replace','heartbeatInterval','processInbox','application/json,\x20text/event-stream','min','sleep','resumeId','transport','task.send.start','247152HkrfPj','send_rejected','toTimeString','getReader','type','messages','s...','CommHub\x20rejected\x20task','slice','text/event-stream','task.expired','send_message','now','parent_task_id','report_status','get_inbox','3FABeIc','\x20duration_ms=','\x20from=','result','catch','running','\x20task_id=','log','status','content','252cJkZvE','abort','1097330riagYz','mcp_http','application/json','disconnected','error_message','data:\x20','emit','get_all_status','fromAlias','unknown\x20error','8472280dNkAFS','\x20network_id=','name','\x20error=','sending','SSE\x20failed:\x20','task.send.failed','71700htYTjB','idle','from_session','lifecycle_tracking','call','Bearer\x20','2607916BtUUIv','sdk-','sseAbort','agent','new_message','24sLwFhI','connected','to_alias','send_reply','parse','lifecycleTracking','url','pop','SSE\x20connected','task_id','/mcp','POST','<pending>','server','SSE\x20error:\x20','message','[REDACTED]','send','match','message_id','AbortError','<unknown>','string','autoConnect','completed','task.replied','json','connectSSE','heartbeatTimer','error','signal','connect','task.ack','stringify','tools/call','\x20to=','heartbeat\x20failed:\x20','parentTaskId','task.send.delivered','offline','2413670MFwwbg','SSE\x20reconnecting\x20in\x20','alias','token'];a0_0x4c4b=function(){return _0x3855ff;};return a0_0x4c4b();}
@@ -0,0 +1,32 @@
1
+ export declare const SECRET_KEYS_FILE = "secrets.env";
2
+ export declare const NODE_SECRET_KEYS_MAX = 50;
3
+ export declare function nodeSecretFilePath(nodeDir: string): string;
4
+ export type NodeSecretKeysRead = {
5
+ kind: "ok";
6
+ keys: string[];
7
+ } | {
8
+ kind: "missing";
9
+ } | {
10
+ kind: "unsafe";
11
+ reason: string;
12
+ };
13
+ /** Names only. Never returns values, and never throws. */
14
+ export declare function readNodeSecretKeys(nodeDir: string): NodeSecretKeysRead;
15
+ /** File mode warning: the loader refuses a secrets.env that is not 0600, so the
16
+ * CLI should say so instead of printing a list the node will silently skip. */
17
+ export declare function nodeSecretFileModeWarning(nodeDir: string): string | null;
18
+ export type NodeSecretWriteResult = {
19
+ kind: "ok";
20
+ changed: boolean;
21
+ } | {
22
+ kind: "rejected";
23
+ reason: string;
24
+ };
25
+ /** Replace the value of one key, or append it. Line-based so comments and the
26
+ * operator's own ordering survive; only the matching line is rewritten.
27
+ *
28
+ * The value arrives from the caller (CLI reads stdin) — it is never logged,
29
+ * never echoed, and never put in an error message. */
30
+ export declare function writeNodeSecret(nodeDir: string, key: string, value: string): NodeSecretWriteResult;
31
+ /** Drop the key's line(s). Returns changed=false when the key was not present. */
32
+ export declare function removeNodeSecret(nodeDir: string, key: string): NodeSecretWriteResult;
@@ -1,14 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- /**
3
- * CommHub Channel Plugin for Claude Code
4
- *
5
- * Alias resolution (priority order):
6
- * 1. COMMHUB_ALIAS env var
7
- * 2. Project .env: ~/.claude/channels/commhub/{project-path}/.env
8
- * 3. tmux session name
9
- * 4. hostname
10
- *
11
- * Shared config from: ~/.claude/channels/commhub/.env
12
- * COMMHUB_URL, COMMHUB_TOKEN
13
- */
14
2
  export {};