@sleep2agi/agent-network 2.3.0-preview.96 → 2.3.0-preview.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a0_0x2c82(_0x29e3b4,_0x50df15){_0x29e3b4=_0x29e3b4-0x16e;const _0x9a1373=a0_0x9a13();let _0x2c82be=_0x9a1373[_0x29e3b4];return _0x2c82be;}const a0_0x4bafa8=a0_0x2c82;(function(_0xd5fb87,_0x15a97d){const _0x2311d=a0_0x2c82,_0x3744a7=_0xd5fb87();while(!![]){try{const _0x1314e3=parseInt(_0x2311d(0x188))/0x1*(-parseInt(_0x2311d(0x1b5))/0x2)+-parseInt(_0x2311d(0x1ab))/0x3*(-parseInt(_0x2311d(0x1de))/0x4)+parseInt(_0x2311d(0x1bb))/0x5*(parseInt(_0x2311d(0x173))/0x6)+parseInt(_0x2311d(0x186))/0x7*(parseInt(_0x2311d(0x1d9))/0x8)+-parseInt(_0x2311d(0x1bd))/0x9+-parseInt(_0x2311d(0x1e5))/0xa*(-parseInt(_0x2311d(0x1d1))/0xb)+-parseInt(_0x2311d(0x1b6))/0xc*(-parseInt(_0x2311d(0x181))/0xd);if(_0x1314e3===_0x15a97d)break;else _0x3744a7['push'](_0x3744a7['shift']());}catch(_0x3381fa){_0x3744a7['push'](_0x3744a7['shift']());}}}(a0_0x9a13,0xb8152));import{EventEmitter as a0_0x59605c}from'events';import{hostname as a0_0x37c631}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1bd959,_0x3fdeec)=>(_0x1bd959??_0x3fdeec)[a0_0x4bafa8(0x172)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x4bafa8(0x179)](0x0,0xf0);function N(_0x3f2a42){const _0x44a16d=a0_0x4bafa8;return(_0x3f2a42 instanceof Error?_0x3f2a42[_0x44a16d(0x1c7)]:String(_0x3f2a42??_0x44a16d(0x19e)))[_0x44a16d(0x172)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x1d418a,_0x8245c2=process.env.ANET_TASK_TRACE_FORMAT===a0_0x4bafa8(0x197)){const _0x5d1a50=a0_0x4bafa8;if(_0x8245c2)return JSON[_0x5d1a50(0x199)](_0x1d418a);let _0x35c2ab=L(_0x1d418a[_0x5d1a50(0x18b)],_0x5d1a50(0x1ad)),_0x41d074=L(_0x1d418a['task_id'],_0x5d1a50(0x1e1)),_0x1d61e3=_0x1d418a[_0x5d1a50(0x1e6)]?_0x5d1a50(0x1e9)+_0x1d418a[_0x5d1a50(0x1e6)]+':'+(_0x1d418a['error_message']??''):'';return _0x5d1a50(0x18e)+_0x1d418a[_0x5d1a50(0x19b)]+'\x20from='+L(_0x1d418a[_0x5d1a50(0x189)],_0x5d1a50(0x19d))+'\x20to='+L(_0x1d418a[_0x5d1a50(0x16f)],_0x5d1a50(0x19d))+_0x5d1a50(0x175)+_0x41d074+_0x5d1a50(0x1af)+_0x35c2ab+_0x5d1a50(0x1a1)+L(_0x1d418a['network_id'],_0x5d1a50(0x19d))+_0x5d1a50(0x1c6)+_0x1d418a[_0x5d1a50(0x1a7)]+'\x20duration_ms='+_0x1d418a[_0x5d1a50(0x193)]+_0x5d1a50(0x1c9)+_0x1d418a[_0x5d1a50(0x1c5)]+_0x1d61e3;}function a0_0x9a13(){const _0x2830c5=['231GIglRz','sdk','4006mxQvkc','from_alias','signal','parent_task_id','not_tracked','delivered','[commhub:task]\x20','normal','task.replied','mcp_http','broadcast','duration_ms','networkId','connected','AbortError','json','task.send.delivered','stringify','failed','status','application/json,\x20text/event-stream','<unknown>','unknown\x20error','catch','messages','\x20network_id=','processInbox','task_id','lifecycleTracking','sleep','error','transport','task.ack','SSE\x20connected','decode','9789ulwsQJ','match','<missing>','send_task','\x20parent_task_id=','connectSSE','completed','resumeId','call','CommHub\x20response\x20omitted\x20task_id','654BYeAvX','24642444NdAWVf','task.expired','emit','task','text/event-stream','398060XSnUfF','content','11564136lebJaN','SSE\x20failed:\x20','send_reply','registered','send_failed','parse','cwd','alias','lifecycle_tracking','\x20transport=','message','idle','\x20lifecycle=','parentTaskId','send_message','pop','reconnectDelay','send','token','POST','82049eAlPEj','heartbeatInterval','text','tools/call','/mcp','send_rejected','heartbeat\x20failed:\x20','connect','72344QgloPw','disconnected','s...','startsWith','sseAbort','652CFlFdk','running','split','<pending>','url','new_message','inbox\x20error:\x20','410trUCSU','error_code','ack_inbox','SSE\x20reconnecting\x20in\x20','\x20error=','get_inbox','sdk-','to_alias','body','now','replace','12YSDbRp','getAllStatus','\x20task_id=','from_session','type','2.0','slice','Bearer\x20','heartbeatTimer','message_id','Authorization','string','disconnect','agent','13VlHEYb',']\x20[commhub:','log','task.send.failed','getReader'];a0_0x9a13=function(){return _0x2830c5;};return a0_0x9a13();}function U(_0x2ddd22){const _0x4d7772=a0_0x4bafa8;return{'event':{'sending':'task.send.start','delivered':_0x4d7772(0x198),'failed':_0x4d7772(0x184),'acked':_0x4d7772(0x1a8),'started':'task.started','replied':_0x4d7772(0x190),'expired':_0x4d7772(0x1b7)}[_0x2ddd22['status']],..._0x2ddd22};}function j(_0x285d05){const _0x48daf7=a0_0x4bafa8;let _0x4850f0=_0x285d05?.[_0x48daf7(0x1a3)]||_0x285d05?.[_0x48daf7(0x17c)]||_0x285d05?.['id'];if(_0x4850f0)return String(_0x4850f0);let _0x671a1d=_0x285d05?.['content']?.[0x0]?.[_0x48daf7(0x1d3)];if(typeof _0x671a1d!==_0x48daf7(0x17e))return null;try{let _0x252119=JSON[_0x48daf7(0x1c2)](_0x671a1d);return _0x252119?.['task_id']||_0x252119?.[_0x48daf7(0x17c)]||_0x252119?.['id']||null;}catch{return null;}}async function X(_0xbaaaaf,_0x22258e){const _0x2a03c7=a0_0x4bafa8;let _0x28ddf7=_0x22258e[_0x2a03c7(0x171)]??Date[_0x2a03c7(0x171)],_0x52105f=_0x28ddf7(),_0x29947=(_0x1527e3,_0x109547,_0x85e226,_0xfa6a56)=>{const _0x4e5c42=_0x2a03c7;_0x22258e[_0x4e5c42(0x183)](O(U({'from_alias':_0xbaaaaf['fromAlias'],'to_alias':_0xbaaaaf['toAlias'],'task_id':_0x109547,'parent_task_id':_0xbaaaaf[_0x4e5c42(0x1ca)],'network_id':_0xbaaaaf[_0x4e5c42(0x194)],'transport':_0xbaaaaf[_0x4e5c42(0x1a7)],'status':_0x1527e3,'duration_ms':_0x28ddf7()-_0x52105f,'lifecycle_tracking':_0xbaaaaf[_0x4e5c42(0x1a4)],..._0x85e226!==void 0x0?{'error_code':_0xfa6a56||_0x4e5c42(0x1c1),'error_message':N(_0x85e226)}:{}})));};_0x29947('sending',null);try{let _0x574cf5=await _0x22258e[_0x2a03c7(0x1ce)](),_0x4543e8=j(_0x574cf5);if(_0x4543e8)_0x29947(_0x2a03c7(0x18d),_0x4543e8);else{if(_0x574cf5?.['ok']===!0x1||_0x574cf5?.[_0x2a03c7(0x1a6)])_0x29947(_0x2a03c7(0x19a),_0x4543e8,_0x574cf5?.[_0x2a03c7(0x1a6)]||'CommHub\x20rejected\x20task',_0x2a03c7(0x1d6));else _0x29947(_0x2a03c7(0x19a),null,_0x2a03c7(0x1b4),'missing_task_id');}return _0x574cf5;}catch(_0x4612e8){throw _0x29947(_0x2a03c7(0x19a),null,_0x4612e8,'send_failed'),_0x4612e8;}}async function Y(_0x36c523,_0x8c14d5){const _0x55c4f9=a0_0x4bafa8;return X({'fromAlias':_0x36c523['fromAlias'],'toAlias':_0x36c523[_0x55c4f9(0x1c4)],'parentTaskId':_0x36c523[_0x55c4f9(0x1ca)]||null,'networkId':_0x36c523[_0x55c4f9(0x194)]||null,'transport':_0x55c4f9(0x191),'lifecycleTracking':_0x55c4f9(0x18c)},_0x8c14d5);}class $ extends a0_0x59605c{[a0_0x4bafa8(0x1e2)];['alias'];[a0_0x4bafa8(0x1cf)];[a0_0x4bafa8(0x180)];['resumeId'];['heartbeatInterval'];[a0_0x4bafa8(0x1cd)];[a0_0x4bafa8(0x17b)];[a0_0x4bafa8(0x1dd)];[a0_0x4bafa8(0x1df)]=!0x1;constructor(_0x5ec976){const _0x1ee2a3=a0_0x4bafa8;super();if(this[_0x1ee2a3(0x1e2)]=_0x5ec976[_0x1ee2a3(0x1e2)]['replace'](/\/$/,''),this['alias']=_0x5ec976[_0x1ee2a3(0x1c4)],this[_0x1ee2a3(0x1cf)]=_0x5ec976[_0x1ee2a3(0x1cf)],this[_0x1ee2a3(0x180)]=_0x5ec976[_0x1ee2a3(0x180)]||_0x1ee2a3(0x187),this[_0x1ee2a3(0x1b2)]=_0x1ee2a3(0x16e)+_0x5ec976[_0x1ee2a3(0x1c4)]+'-'+Date[_0x1ee2a3(0x171)]()['toString'](0x24),this['heartbeatInterval']=_0x5ec976[_0x1ee2a3(0x1d2)]??0x2bf20,this[_0x1ee2a3(0x1cd)]=_0x5ec976['reconnectDelay']??0xbb8,_0x5ec976['autoConnect']!==!0x1)this['connect']();}[a0_0x4bafa8(0x183)](_0x419303){const _0x18e13d=a0_0x4bafa8;console[_0x18e13d(0x183)]('['+new Date()['toTimeString']()[_0x18e13d(0x179)](0x0,0x8)+_0x18e13d(0x182)+this[_0x18e13d(0x1c4)]+']\x20'+_0x419303);}async[a0_0x4bafa8(0x1b3)](_0x150364,_0x11bcaa){const _0x3ac380=a0_0x4bafa8;let _0x3e2d13={'Content-Type':'application/json','Accept':_0x3ac380(0x19c)};if(this[_0x3ac380(0x1cf)])_0x3e2d13[_0x3ac380(0x17d)]=_0x3ac380(0x17a)+this[_0x3ac380(0x1cf)];let _0x4fe97d=await(await fetch(this[_0x3ac380(0x1e2)]+_0x3ac380(0x1d5),{'method':_0x3ac380(0x1d0),'headers':_0x3e2d13,'body':JSON[_0x3ac380(0x199)]({'jsonrpc':_0x3ac380(0x178),'id':Date['now'](),'method':_0x3ac380(0x1d4),'params':{'name':_0x150364,'arguments':_0x11bcaa}})}))[_0x3ac380(0x1d3)](),_0x1f00b2=_0x4fe97d[_0x3ac380(0x1ac)](/data: (.+)/),_0x2335f7=_0x1f00b2?JSON[_0x3ac380(0x1c2)](_0x1f00b2[0x1]):JSON[_0x3ac380(0x1c2)](_0x4fe97d),_0x2e277e=_0x2335f7?.['result']?.[_0x3ac380(0x1bc)]?.[0x0]?.[_0x3ac380(0x1d3)];return _0x2e277e?JSON['parse'](_0x2e277e):_0x2335f7;}async[a0_0x4bafa8(0x1d8)](){const _0x43b052=a0_0x4bafa8;if(this[_0x43b052(0x1df)])return;this[_0x43b052(0x1df)]=!0x0,await this['status'](_0x43b052(0x1c8)),this[_0x43b052(0x183)](_0x43b052(0x1c0)),this[_0x43b052(0x17b)]=setInterval(()=>{const _0x1ae2c3=_0x43b052;this[_0x1ae2c3(0x19b)](_0x1ae2c3(0x1c8))[_0x1ae2c3(0x19f)](_0x4f2af1=>this[_0x1ae2c3(0x183)](_0x1ae2c3(0x1d7)+_0x4f2af1[_0x1ae2c3(0x1c7)]));},this['heartbeatInterval']),this[_0x43b052(0x1b0)]();}async[a0_0x4bafa8(0x17f)](){const _0x36559f=a0_0x4bafa8;if(this[_0x36559f(0x1df)]=!0x1,this[_0x36559f(0x1dd)]?.['abort'](),this[_0x36559f(0x17b)])clearInterval(this[_0x36559f(0x17b)]);await this['status']('offline')['catch'](()=>{}),this[_0x36559f(0x183)]('disconnected');}async[a0_0x4bafa8(0x1ce)](_0x424513,_0x5aacf3,_0x33f0f0=a0_0x4bafa8(0x18f)){const _0x3a9e7a=a0_0x4bafa8;return Y({'alias':_0x424513,'fromAlias':this[_0x3a9e7a(0x1c4)]},{'log':_0x449526=>console[_0x3a9e7a(0x183)](_0x449526),'send':()=>this[_0x3a9e7a(0x1b3)](_0x3a9e7a(0x1ae),{'alias':_0x424513,'task':_0x5aacf3,'priority':_0x33f0f0,'from_session':this[_0x3a9e7a(0x1c4)]})});}async['message'](_0x5a6a47,_0xc86cf2){const _0x462919=a0_0x4bafa8;return this['call'](_0x462919(0x1cb),{'alias':_0x5a6a47,'message':_0xc86cf2,'from_session':this[_0x462919(0x1c4)]});}async['reply'](_0x1bbe0b,_0x4d35d8,_0x272584=a0_0x4bafa8(0x1b1)){const _0x14ed27=a0_0x4bafa8;return this[_0x14ed27(0x1b3)](_0x14ed27(0x1bf),{'in_reply_to':_0x1bbe0b,'text':_0x4d35d8,'status':_0x272584});}async[a0_0x4bafa8(0x19b)](_0x1eb430,_0x4d4f6a){const _0x59fce4=a0_0x4bafa8;return this[_0x59fce4(0x1b3)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x59fce4(0x1c4)],'status':_0x1eb430,'server':a0_0x37c631(),'hostname':a0_0x37c631(),'agent':this[_0x59fce4(0x180)],'project_dir':process[_0x59fce4(0x1c3)](),..._0x4d4f6a});}async[a0_0x4bafa8(0x174)](){const _0x4ae976=a0_0x4bafa8;return this[_0x4ae976(0x1b3)]('get_all_status',{});}async[a0_0x4bafa8(0x192)](_0x13adad,_0x318360){const _0x140c4=a0_0x4bafa8;return this[_0x140c4(0x1b3)](_0x140c4(0x192),{'message':_0x13adad,'filter_server':_0x318360?.['server'],'filter_status':_0x318360?.[_0x140c4(0x19b)]});}async[a0_0x4bafa8(0x1b0)](){const _0x533a69=a0_0x4bafa8;let _0x284025=encodeURIComponent(this[_0x533a69(0x1c4)]),_0x2f5e88=this[_0x533a69(0x1e2)]+'/events/'+_0x284025,_0xe3b1fd=this[_0x533a69(0x1cd)];while(this[_0x533a69(0x1df)]){try{this[_0x533a69(0x1dd)]=new AbortController();let _0x2fde69={'Accept':_0x533a69(0x1ba)};if(this[_0x533a69(0x1cf)])_0x2fde69[_0x533a69(0x17d)]=_0x533a69(0x17a)+this[_0x533a69(0x1cf)];let _0x379b3d=await fetch(_0x2f5e88,{'headers':_0x2fde69,'signal':this[_0x533a69(0x1dd)][_0x533a69(0x18a)]});if(!_0x379b3d['ok']||!_0x379b3d['body']){this[_0x533a69(0x183)](_0x533a69(0x1be)+_0x379b3d[_0x533a69(0x19b)]),await this['sleep'](_0xe3b1fd),_0xe3b1fd=Math['min'](_0xe3b1fd*1.5,0xea60);continue;}_0xe3b1fd=this['reconnectDelay'];let _0x27b566=_0x379b3d[_0x533a69(0x170)][_0x533a69(0x185)](),_0x434fcd=new TextDecoder(),_0x58c9b5='';while(this[_0x533a69(0x1df)]){let {done:_0x46c981,value:_0x549e43}=await _0x27b566['read']();if(_0x46c981)break;_0x58c9b5+=_0x434fcd[_0x533a69(0x1aa)](_0x549e43,{'stream':!0x0});let _0x171388=_0x58c9b5[_0x533a69(0x1e0)]('\x0a');_0x58c9b5=_0x171388[_0x533a69(0x1cc)]()||'';for(let _0xe1fa20 of _0x171388){if(!_0xe1fa20[_0x533a69(0x1dc)]('data:\x20'))continue;try{let _0x4567f1=JSON['parse'](_0xe1fa20['slice'](0x6));if(_0x4567f1[_0x533a69(0x177)]===_0x533a69(0x195)){this[_0x533a69(0x183)](_0x533a69(0x1a9)),this[_0x533a69(0x1b8)](_0x533a69(0x195));continue;}if(_0x4567f1[_0x533a69(0x177)]==='new_task'||_0x4567f1['type']===_0x533a69(0x1e3)||_0x4567f1[_0x533a69(0x177)]==='broadcast')await this[_0x533a69(0x1a2)]();}catch{}}}}catch(_0x14be2b){if(_0x14be2b['name']===_0x533a69(0x196))break;this[_0x533a69(0x1b8)](_0x533a69(0x1a6),_0x14be2b),this['log']('SSE\x20error:\x20'+_0x14be2b[_0x533a69(0x1c7)]);}if(this['running'])this['emit'](_0x533a69(0x1da)),this[_0x533a69(0x183)](_0x533a69(0x1e8)+_0xe3b1fd/0x3e8+_0x533a69(0x1db)),await this['sleep'](_0xe3b1fd),_0xe3b1fd=Math['min'](_0xe3b1fd*1.5,0xea60);}}async[a0_0x4bafa8(0x1a2)](){const _0x4efed8=a0_0x4bafa8;try{let _0x2bbef4=(await this['call'](_0x4efed8(0x1ea),{'alias':this[_0x4efed8(0x1c4)],'limit':0xa}))?.[_0x4efed8(0x1a0)]||[];for(let _0x29661c of _0x2bbef4)await this[_0x4efed8(0x1b3)](_0x4efed8(0x1e7),{'alias':this[_0x4efed8(0x1c4)],'message_id':_0x29661c['id']}),this[_0x4efed8(0x183)]('←\x20'+_0x29661c[_0x4efed8(0x176)]+':\x20'+_0x29661c['content'][_0x4efed8(0x179)](0x0,0x3c)),this[_0x4efed8(0x1b8)](_0x4efed8(0x1b9),_0x29661c),this[_0x4efed8(0x1b8)]('message',_0x29661c);}catch(_0xd0a5cc){this[_0x4efed8(0x183)](_0x4efed8(0x1e4)+_0xd0a5cc[_0x4efed8(0x1c7)]);}}[a0_0x4bafa8(0x1a5)](_0xfcde18){return new Promise(_0x507b15=>setTimeout(_0x507b15,_0xfcde18));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x5ce150=a0_0x4c89;(function(_0x21ab87,_0x3d289f){const _0x4cf448=a0_0x4c89,_0x40eb47=_0x21ab87();while(!![]){try{const _0x1a7e71=-parseInt(_0x4cf448(0x18e))/0x1+parseInt(_0x4cf448(0x1cd))/0x2+parseInt(_0x4cf448(0x19e))/0x3+-parseInt(_0x4cf448(0x198))/0x4*(-parseInt(_0x4cf448(0x1b8))/0x5)+-parseInt(_0x4cf448(0x1a7))/0x6+parseInt(_0x4cf448(0x1e9))/0x7+-parseInt(_0x4cf448(0x1a1))/0x8*(parseInt(_0x4cf448(0x1c5))/0x9);if(_0x1a7e71===_0x3d289f)break;else _0x40eb47['push'](_0x40eb47['shift']());}catch(_0x5f445b){_0x40eb47['push'](_0x40eb47['shift']());}}}(a0_0x5349,0xa0ae0));import{EventEmitter as a0_0x4b6e45}from'events';import{hostname as a0_0xabc1ad}from'os';function a0_0x4c89(_0x28d206,_0x2bbda6){_0x28d206=_0x28d206-0x182;const _0x534949=a0_0x5349();let _0x4c8921=_0x534949[_0x28d206];return _0x4c8921;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x489f7a,_0x5b86d7)=>(_0x489f7a??_0x5b86d7)[a0_0x5ce150(0x1a3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x5ce150(0x1ac)](0x0,0xf0);function N(_0x1eef63){const _0x1f84b1=a0_0x5ce150;return(_0x1eef63 instanceof Error?_0x1eef63[_0x1f84b1(0x1d5)]:String(_0x1eef63??_0x1f84b1(0x188)))[_0x1f84b1(0x1a3)](K,_0x1f84b1(0x1ae))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x21881f,_0xe95d2d=process.env.ANET_TASK_TRACE_FORMAT===a0_0x5ce150(0x1b1)){const _0x52c4eb=a0_0x5ce150;if(_0xe95d2d)return JSON[_0x52c4eb(0x1ef)](_0x21881f);let _0x375e24=L(_0x21881f['parent_task_id'],_0x52c4eb(0x1d1)),_0x1a9463=L(_0x21881f['task_id'],_0x52c4eb(0x1fa)),_0x39ec6e=_0x21881f[_0x52c4eb(0x192)]?'\x20error='+_0x21881f[_0x52c4eb(0x192)]+':'+(_0x21881f['error_message']??''):'';return _0x52c4eb(0x1b6)+_0x21881f[_0x52c4eb(0x1bf)]+'\x20from='+L(_0x21881f[_0x52c4eb(0x18b)],_0x52c4eb(0x182))+_0x52c4eb(0x1c6)+L(_0x21881f[_0x52c4eb(0x193)],_0x52c4eb(0x182))+_0x52c4eb(0x1dc)+_0x1a9463+'\x20parent_task_id='+_0x375e24+_0x52c4eb(0x1d0)+L(_0x21881f[_0x52c4eb(0x1c4)],_0x52c4eb(0x182))+'\x20transport='+_0x21881f[_0x52c4eb(0x1e3)]+_0x52c4eb(0x1d7)+_0x21881f[_0x52c4eb(0x1cf)]+_0x52c4eb(0x1f0)+_0x21881f[_0x52c4eb(0x1f9)]+_0x39ec6e;}function U(_0x10b219){const _0xf000ac=a0_0x5ce150;return{'event':{'sending':_0xf000ac(0x1a5),'delivered':_0xf000ac(0x18a),'failed':_0xf000ac(0x1dd),'acked':'task.ack','started':_0xf000ac(0x1ed),'replied':_0xf000ac(0x1ec),'expired':'task.expired'}[_0x10b219['status']],..._0x10b219};}function j(_0x27faf0){const _0x447825=a0_0x5ce150;let _0x563c9a=_0x27faf0?.[_0x447825(0x1f5)]||_0x27faf0?.[_0x447825(0x1ab)]||_0x27faf0?.['id'];if(_0x563c9a)return String(_0x563c9a);let _0x51829e=_0x27faf0?.['content']?.[0x0]?.['text'];if(typeof _0x51829e!=='string')return null;try{let _0x49f72b=JSON[_0x447825(0x191)](_0x51829e);return _0x49f72b?.[_0x447825(0x1f5)]||_0x49f72b?.['message_id']||_0x49f72b?.['id']||null;}catch{return null;}}async function X(_0x20f4a4,_0x59f919){const _0x1dc49e=a0_0x5ce150;let _0x1f88c2=_0x59f919[_0x1dc49e(0x1b0)]??Date['now'],_0x22c188=_0x1f88c2(),_0x33cc92=(_0x294cc3,_0x3668c9,_0x38f778,_0x329b6d)=>{const _0x86ed17=_0x1dc49e;_0x59f919['log'](O(U({'from_alias':_0x20f4a4['fromAlias'],'to_alias':_0x20f4a4[_0x86ed17(0x1b7)],'task_id':_0x3668c9,'parent_task_id':_0x20f4a4[_0x86ed17(0x1e8)],'network_id':_0x20f4a4[_0x86ed17(0x190)],'transport':_0x20f4a4[_0x86ed17(0x1e3)],'status':_0x294cc3,'duration_ms':_0x1f88c2()-_0x22c188,'lifecycle_tracking':_0x20f4a4[_0x86ed17(0x1c2)],..._0x38f778!==void 0x0?{'error_code':_0x329b6d||_0x86ed17(0x186),'error_message':N(_0x38f778)}:{}})));};_0x33cc92(_0x1dc49e(0x1d3),null);try{let _0x2e85a9=await _0x59f919[_0x1dc49e(0x1a0)](),_0xda4e78=j(_0x2e85a9);if(_0xda4e78)_0x33cc92(_0x1dc49e(0x1e4),_0xda4e78);else{if(_0x2e85a9?.['ok']===!0x1||_0x2e85a9?.['error'])_0x33cc92(_0x1dc49e(0x1a2),_0xda4e78,_0x2e85a9?.[_0x1dc49e(0x19c)]||_0x1dc49e(0x1e1),_0x1dc49e(0x1d8));else _0x33cc92(_0x1dc49e(0x1a2),null,'CommHub\x20response\x20omitted\x20task_id',_0x1dc49e(0x19a));}return _0x2e85a9;}catch(_0x4fb411){throw _0x33cc92(_0x1dc49e(0x1a2),null,_0x4fb411,_0x1dc49e(0x186)),_0x4fb411;}}async function Y(_0x5e2608,_0x54c36c){const _0xd304bc=a0_0x5ce150;return X({'fromAlias':_0x5e2608['fromAlias'],'toAlias':_0x5e2608[_0xd304bc(0x19b)],'parentTaskId':_0x5e2608[_0xd304bc(0x1e8)]||null,'networkId':_0x5e2608['networkId']||null,'transport':_0xd304bc(0x1e7),'lifecycleTracking':'not_tracked'},_0x54c36c);}class $ extends a0_0x4b6e45{[a0_0x5ce150(0x1d6)];[a0_0x5ce150(0x19b)];['token'];[a0_0x5ce150(0x1bd)];[a0_0x5ce150(0x1ba)];[a0_0x5ce150(0x195)];[a0_0x5ce150(0x1a4)];[a0_0x5ce150(0x1b5)];[a0_0x5ce150(0x1df)];[a0_0x5ce150(0x1c7)]=!0x1;constructor(_0x98701d){const _0x4d60f8=a0_0x5ce150;super();if(this['url']=_0x98701d[_0x4d60f8(0x1d6)][_0x4d60f8(0x1a3)](/\/$/,''),this[_0x4d60f8(0x19b)]=_0x98701d['alias'],this[_0x4d60f8(0x1cb)]=_0x98701d[_0x4d60f8(0x1cb)],this[_0x4d60f8(0x1bd)]=_0x98701d[_0x4d60f8(0x1bd)]||_0x4d60f8(0x1ea),this[_0x4d60f8(0x1ba)]='sdk-'+_0x98701d['alias']+'-'+Date[_0x4d60f8(0x1b0)]()[_0x4d60f8(0x187)](0x24),this[_0x4d60f8(0x195)]=_0x98701d['heartbeatInterval']??0x2bf20,this[_0x4d60f8(0x1a4)]=_0x98701d[_0x4d60f8(0x1a4)]??0xbb8,_0x98701d['autoConnect']!==!0x1)this[_0x4d60f8(0x1b3)]();}[a0_0x5ce150(0x1e2)](_0x5ed5ae){const _0x16b128=a0_0x5ce150;console[_0x16b128(0x1e2)]('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x16b128(0x1de)+this[_0x16b128(0x19b)]+']\x20'+_0x5ed5ae);}async[a0_0x5ce150(0x184)](_0x22dcc3,_0x3c754c){const _0x5b9b03=a0_0x5ce150;let _0x1c81a4={'Content-Type':'application/json','Accept':_0x5b9b03(0x1c8)};if(this[_0x5b9b03(0x1cb)])_0x1c81a4[_0x5b9b03(0x18f)]=_0x5b9b03(0x19f)+this[_0x5b9b03(0x1cb)];let _0x1cf32a=await(await fetch(this['url']+'/mcp',{'method':'POST','headers':_0x1c81a4,'body':JSON[_0x5b9b03(0x1ef)]({'jsonrpc':_0x5b9b03(0x1c3),'id':Date[_0x5b9b03(0x1b0)](),'method':'tools/call','params':{'name':_0x22dcc3,'arguments':_0x3c754c}})}))[_0x5b9b03(0x1be)](),_0x59f5f3=_0x1cf32a[_0x5b9b03(0x1bb)](/data: (.+)/),_0xe22b83=_0x59f5f3?JSON['parse'](_0x59f5f3[0x1]):JSON[_0x5b9b03(0x191)](_0x1cf32a),_0x2aea2f=_0xe22b83?.[_0x5b9b03(0x1eb)]?.[_0x5b9b03(0x1ce)]?.[0x0]?.[_0x5b9b03(0x1be)];return _0x2aea2f?JSON[_0x5b9b03(0x191)](_0x2aea2f):_0xe22b83;}async['connect'](){const _0x1ab9ea=a0_0x5ce150;if(this[_0x1ab9ea(0x1c7)])return;this[_0x1ab9ea(0x1c7)]=!0x0,await this['status'](_0x1ab9ea(0x1a9)),this[_0x1ab9ea(0x1e2)](_0x1ab9ea(0x1d2)),this[_0x1ab9ea(0x1b5)]=setInterval(()=>{const _0x591a77=_0x1ab9ea;this['status'](_0x591a77(0x1a9))[_0x591a77(0x1f3)](_0x4dc4c8=>this[_0x591a77(0x1e2)]('heartbeat\x20failed:\x20'+_0x4dc4c8['message']));},this[_0x1ab9ea(0x195)]),this[_0x1ab9ea(0x1c0)]();}async['disconnect'](){const _0x1098f7=a0_0x5ce150;if(this[_0x1098f7(0x1c7)]=!0x1,this['sseAbort']?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x1098f7(0x1b5)]);await this[_0x1098f7(0x1bf)](_0x1098f7(0x1f6))[_0x1098f7(0x1f3)](()=>{}),this['log']('disconnected');}async[a0_0x5ce150(0x1a0)](_0x208463,_0x1823dc,_0x5c7760=a0_0x5ce150(0x197)){const _0x16c310=a0_0x5ce150;return Y({'alias':_0x208463,'fromAlias':this[_0x16c310(0x19b)]},{'log':_0x57e8e1=>console[_0x16c310(0x1e2)](_0x57e8e1),'send':()=>this[_0x16c310(0x184)](_0x16c310(0x194),{'alias':_0x208463,'task':_0x1823dc,'priority':_0x5c7760,'from_session':this[_0x16c310(0x19b)]})});}async[a0_0x5ce150(0x1d5)](_0x2bbb65,_0x5ca9e6){const _0x323824=a0_0x5ce150;return this[_0x323824(0x184)](_0x323824(0x1ad),{'alias':_0x2bbb65,'message':_0x5ca9e6,'from_session':this[_0x323824(0x19b)]});}async[a0_0x5ce150(0x1db)](_0x44823c,_0x576077,_0x1f4ea9='completed'){const _0x5a5aaf=a0_0x5ce150;return this[_0x5a5aaf(0x184)](_0x5a5aaf(0x189),{'in_reply_to':_0x44823c,'text':_0x576077,'status':_0x1f4ea9});}async[a0_0x5ce150(0x1bf)](_0x2897a4,_0x8ce420){const _0xd78f81=a0_0x5ce150;return this['call'](_0xd78f81(0x1af),{'resume_id':this[_0xd78f81(0x1ba)],'alias':this[_0xd78f81(0x19b)],'status':_0x2897a4,'server':a0_0xabc1ad(),'hostname':a0_0xabc1ad(),'agent':this[_0xd78f81(0x1bd)],'project_dir':process['cwd'](),..._0x8ce420});}async[a0_0x5ce150(0x1b9)](){const _0x21a073=a0_0x5ce150;return this[_0x21a073(0x184)](_0x21a073(0x19d),{});}async[a0_0x5ce150(0x18c)](_0x5b2b3d,_0x5358bc){const _0x1aa2c9=a0_0x5ce150;return this[_0x1aa2c9(0x184)](_0x1aa2c9(0x18c),{'message':_0x5b2b3d,'filter_server':_0x5358bc?.[_0x1aa2c9(0x1bc)],'filter_status':_0x5358bc?.[_0x1aa2c9(0x1bf)]});}async[a0_0x5ce150(0x1c0)](){const _0x16ed68=a0_0x5ce150;let _0x47eaf6=encodeURIComponent(this[_0x16ed68(0x19b)]),_0x29b45b=this[_0x16ed68(0x1d6)]+_0x16ed68(0x1da)+_0x47eaf6,_0x343516=this[_0x16ed68(0x1a4)];while(this[_0x16ed68(0x1c7)]){try{this[_0x16ed68(0x1df)]=new AbortController();let _0x5c093f={'Accept':_0x16ed68(0x1ca)};if(this[_0x16ed68(0x1cb)])_0x5c093f[_0x16ed68(0x18f)]=_0x16ed68(0x19f)+this[_0x16ed68(0x1cb)];let _0x3a7b3e=await fetch(_0x29b45b,{'headers':_0x5c093f,'signal':this[_0x16ed68(0x1df)][_0x16ed68(0x185)]});if(!_0x3a7b3e['ok']||!_0x3a7b3e[_0x16ed68(0x1f8)]){this['log'](_0x16ed68(0x1d4)+_0x3a7b3e[_0x16ed68(0x1bf)]),await this['sleep'](_0x343516),_0x343516=Math['min'](_0x343516*1.5,0xea60);continue;}_0x343516=this[_0x16ed68(0x1a4)];let _0x27e596=_0x3a7b3e['body'][_0x16ed68(0x1d9)](),_0x2f35cf=new TextDecoder(),_0x28d283='';while(this[_0x16ed68(0x1c7)]){let {done:_0x42605b,value:_0x2b1afb}=await _0x27e596[_0x16ed68(0x1a6)]();if(_0x42605b)break;_0x28d283+=_0x2f35cf[_0x16ed68(0x1b4)](_0x2b1afb,{'stream':!0x0});let _0x39d8ac=_0x28d283[_0x16ed68(0x1f7)]('\x0a');_0x28d283=_0x39d8ac[_0x16ed68(0x1f2)]()||'';for(let _0xbf586 of _0x39d8ac){if(!_0xbf586[_0x16ed68(0x1e0)]('data:\x20'))continue;try{let _0x49ea99=JSON['parse'](_0xbf586[_0x16ed68(0x1ac)](0x6));if(_0x49ea99[_0x16ed68(0x1a8)]===_0x16ed68(0x183)){this[_0x16ed68(0x1e2)](_0x16ed68(0x1f4)),this[_0x16ed68(0x18d)](_0x16ed68(0x183));continue;}if(_0x49ea99['type']==='new_task'||_0x49ea99[_0x16ed68(0x1a8)]===_0x16ed68(0x196)||_0x49ea99[_0x16ed68(0x1a8)]===_0x16ed68(0x18c))await this[_0x16ed68(0x1e6)]();}catch{}}}}catch(_0x92c90c){if(_0x92c90c[_0x16ed68(0x1c1)]==='AbortError')break;this[_0x16ed68(0x18d)](_0x16ed68(0x19c),_0x92c90c),this[_0x16ed68(0x1e2)](_0x16ed68(0x1c9)+_0x92c90c[_0x16ed68(0x1d5)]);}if(this[_0x16ed68(0x1c7)])this[_0x16ed68(0x18d)](_0x16ed68(0x1b2)),this[_0x16ed68(0x1e2)]('SSE\x20reconnecting\x20in\x20'+_0x343516/0x3e8+_0x16ed68(0x1e5)),await this[_0x16ed68(0x1ee)](_0x343516),_0x343516=Math['min'](_0x343516*1.5,0xea60);}}async[a0_0x5ce150(0x1e6)](){const _0x30e77b=a0_0x5ce150;try{let _0x1331a5=(await this[_0x30e77b(0x184)](_0x30e77b(0x1aa),{'alias':this[_0x30e77b(0x19b)],'limit':0xa}))?.['messages']||[];for(let _0x305ef3 of _0x1331a5)await this['call'](_0x30e77b(0x199),{'alias':this[_0x30e77b(0x19b)],'message_id':_0x305ef3['id']}),this['log']('←\x20'+_0x305ef3['from_session']+':\x20'+_0x305ef3['content'][_0x30e77b(0x1ac)](0x0,0x3c)),this[_0x30e77b(0x18d)](_0x30e77b(0x1cc),_0x305ef3),this['emit'](_0x30e77b(0x1d5),_0x305ef3);}catch(_0x285fad){this[_0x30e77b(0x1e2)](_0x30e77b(0x1f1)+_0x285fad[_0x30e77b(0x1d5)]);}}[a0_0x5ce150(0x1ee)](_0x3e0384){return new Promise(_0x29db68=>setTimeout(_0x29db68,_0x3e0384));}}var F=$;function a0_0x5349(){const _0x4d5e64=['5359314fFYdtX','type','idle','get_inbox','message_id','slice','send_message','[REDACTED]','report_status','now','json','disconnected','connect','decode','heartbeatTimer','[commhub:task]\x20','toAlias','25LEzsGg','getAllStatus','resumeId','match','server','agent','text','status','connectSSE','name','lifecycleTracking','2.0','network_id','9NwxMPN','\x20to=','running','application/json,\x20text/event-stream','SSE\x20error:\x20','text/event-stream','token','task','1740606SfTJmU','content','duration_ms','\x20network_id=','<missing>','registered','sending','SSE\x20failed:\x20','message','url','\x20duration_ms=','send_rejected','getReader','/events/','reply','\x20task_id=','task.send.failed',']\x20[commhub:','sseAbort','startsWith','CommHub\x20rejected\x20task','log','transport','delivered','s...','processInbox','mcp_http','parentTaskId','6356805OiSPtK','sdk','result','task.replied','task.started','sleep','stringify','\x20lifecycle=','inbox\x20error:\x20','pop','catch','SSE\x20connected','task_id','offline','split','body','lifecycle_tracking','<pending>','<unknown>','connected','call','signal','send_failed','toString','unknown\x20error','send_reply','task.send.delivered','from_alias','broadcast','emit','205650YRNAwj','Authorization','networkId','parse','error_code','to_alias','send_task','heartbeatInterval','new_message','normal','120568pncWDT','ack_inbox','missing_task_id','alias','error','get_all_status','2406156xehTnD','Bearer\x20','send','7793336VsdzVq','failed','replace','reconnectDelay','task.send.start','read'];a0_0x5349=function(){return _0x4d5e64;};return a0_0x5349();}export{F as default,$ as CommHub};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** Per-node record, written into the node dir next to the other state files. */
|
|
2
|
+
export declare const CODEX_AUTH_FINGERPRINT_FILE = ".codex-auth-fingerprint.json";
|
|
3
|
+
/** Length of the stored fingerprint. Collisions at 8 hex are ~1 in 4 billion;
|
|
4
|
+
* a false "these two share a login" warning costs a second look, while the
|
|
5
|
+
* value staying short keeps it obviously non-reversible in logs. */
|
|
6
|
+
export declare const FINGERPRINT_LENGTH = 8;
|
|
7
|
+
/** Access tokens measured on the reference fleet: `exp - iat` was exactly this,
|
|
8
|
+
* on 29 of 29 samples, with no jitter. Used only to phrase "how long until the
|
|
9
|
+
* shared copy dies" when we have an `exp` but no `iat`. */
|
|
10
|
+
export declare const ACCESS_TOKEN_LIFETIME_SECONDS = 864000;
|
|
11
|
+
export interface CodexAuthFingerprintRecord {
|
|
12
|
+
readonly schema_version: 1 | 2;
|
|
13
|
+
readonly alias: string;
|
|
14
|
+
/** sha256(refresh_token) truncated — never the token. */
|
|
15
|
+
readonly fingerprint: string;
|
|
16
|
+
readonly written_at: string;
|
|
17
|
+
/** v2: when this copy's ACCESS token expires, ISO-8601, or null if unreadable.
|
|
18
|
+
* A timestamp, not a credential. Two nodes holding one copied file share this
|
|
19
|
+
* instant exactly — which is how "they stop together" becomes observable. */
|
|
20
|
+
readonly access_expires_at?: string | null;
|
|
21
|
+
/** v2: the CODEX_HOME this record was read from. Distinguishes "two copies of
|
|
22
|
+
* one credential" from "two nodes pointed at one directory", which need
|
|
23
|
+
* different fixes. */
|
|
24
|
+
readonly codex_home?: string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Hash the refresh token out of an auth.json body.
|
|
28
|
+
*
|
|
29
|
+
* Accepts both shapes seen in the wild: the current codex layout nests it
|
|
30
|
+
* under `tokens` (`{auth_mode, tokens:{id_token, access_token, refresh_token,
|
|
31
|
+
* account_id}, last_refresh}`), and older/plain bodies put `refresh_token` at
|
|
32
|
+
* the top level. Anything else — unparsable, absent, empty, non-string —
|
|
33
|
+
* returns null, because "we cannot tell" must not be reported as "no
|
|
34
|
+
* collision".
|
|
35
|
+
*/
|
|
36
|
+
export declare function fingerprintRefreshToken(authJsonText: string): string | null;
|
|
37
|
+
/**
|
|
38
|
+
* When this copy's access token expires, read out of the JWT's own payload.
|
|
39
|
+
*
|
|
40
|
+
* The signature is NOT verified and nothing here authenticates: we are reading
|
|
41
|
+
* a timestamp the token states about itself, the same way `jwt.io` would. A
|
|
42
|
+
* token that is not a JWT, or carries no numeric `exp`, yields null — unknown
|
|
43
|
+
* stays unknown.
|
|
44
|
+
*/
|
|
45
|
+
export declare function accessTokenExpiry(authJsonText: string): Date | null;
|
|
46
|
+
export interface NodeFingerprint {
|
|
47
|
+
readonly alias: string;
|
|
48
|
+
/** null when the node has no auth.json, or one we could not read. */
|
|
49
|
+
readonly fingerprint: string | null;
|
|
50
|
+
/** When the record was written; used to say how stale a claim is. */
|
|
51
|
+
readonly writtenAt?: string | null;
|
|
52
|
+
/** When this copy's access token expires, if we could read it. */
|
|
53
|
+
readonly accessExpiresAt?: Date | null;
|
|
54
|
+
/** The CODEX_HOME this fingerprint came from, if known. */
|
|
55
|
+
readonly codexHome?: string | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Other nodes holding the same credential chain as `self`.
|
|
59
|
+
*
|
|
60
|
+
* Records with no fingerprint are skipped rather than grouped: "unknown" is
|
|
61
|
+
* not a match. Self is excluded by alias, so re-reading one's own record is
|
|
62
|
+
* harmless.
|
|
63
|
+
*/
|
|
64
|
+
export declare function collidingNodes(records: readonly NodeFingerprint[], self: NodeFingerprint): NodeFingerprint[];
|
|
65
|
+
/**
|
|
66
|
+
* The warning an operator sees at start. Returns [] when nothing collides —
|
|
67
|
+
* callers print exactly what they get, so silence is representable and the
|
|
68
|
+
* "no collision" path cannot accidentally print a scary empty banner.
|
|
69
|
+
*
|
|
70
|
+
* Deliberately a warning and never a refusal: every node on a host shares one
|
|
71
|
+
* login today, so refusing to start would take the whole box down at once
|
|
72
|
+
* over a condition that is survivable until the next refresh.
|
|
73
|
+
*
|
|
74
|
+
* 🔴 Two outcomes, and the wrong one is actively misleading. The default text
|
|
75
|
+
* ("whichever node refreshes first keeps working") assumes refresh WORKS.
|
|
76
|
+
* On a host that cannot reach the OAuth token endpoint — egress blocked, or
|
|
77
|
+
* a proxy that allowlists the model API and 403s everything else — nobody
|
|
78
|
+
* refreshes, and the nodes holding one copy do not degrade one at a time:
|
|
79
|
+
* they stop together the moment the shared access token expires. Field case:
|
|
80
|
+
* three nodes whose auth.json files were byte-identical, carrying one access
|
|
81
|
+
* token, all expired at the same instant.
|
|
82
|
+
*
|
|
83
|
+
* We do NOT probe the network to tell these apart — a start path is the wrong
|
|
84
|
+
* place to open a socket, and a probe would answer for this moment rather
|
|
85
|
+
* than for the window that matters. We branch on evidence already in the
|
|
86
|
+
* file: an access token whose `exp` has passed is a copy that demonstrably
|
|
87
|
+
* stopped being refreshed, which is the observable the field case exhibits.
|
|
88
|
+
* When `exp` is still in the future we cannot prove reachability either way,
|
|
89
|
+
* and the default wording is the right one to print.
|
|
90
|
+
*/
|
|
91
|
+
export declare function sharedCredentialWarningLines(self: NodeFingerprint, colliding: readonly NodeFingerprint[], now?: Date): string[];
|
|
92
|
+
/**
|
|
93
|
+
* Two different things both read as "codex cannot refresh", and they need
|
|
94
|
+
* opposite remedies. Telling them apart is the whole value of this mapping:
|
|
95
|
+
* treating a transport failure as a rotation conflict sends an operator to
|
|
96
|
+
* copy someone else's auth.json, which is precisely how a shared-credential
|
|
97
|
+
* chain gets created.
|
|
98
|
+
*/
|
|
99
|
+
export type CodexRefreshFailureKind =
|
|
100
|
+
/** Someone else spent this refresh token first. */
|
|
101
|
+
"rotation-conflict"
|
|
102
|
+
/** The token endpoint is unreachable — nobody's token is rotating. */
|
|
103
|
+
| "token-endpoint-unreachable";
|
|
104
|
+
export interface CodexRefreshFailure {
|
|
105
|
+
readonly kind: CodexRefreshFailureKind;
|
|
106
|
+
readonly lines: string[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Name what actually went wrong with a codex refresh, and say what to do.
|
|
110
|
+
*
|
|
111
|
+
* Returns null for anything else, so callers fall through to whatever they
|
|
112
|
+
* printed before — an unrelated error must pass through unchanged.
|
|
113
|
+
*
|
|
114
|
+
* Order matters: a reuse rejection is a server answer and is checked first; a
|
|
115
|
+
* transport failure means no answer arrived at all.
|
|
116
|
+
*/
|
|
117
|
+
export declare function describeCodexRefreshFailure(text: string, colliding?: readonly NodeFingerprint[]): CodexRefreshFailure | null;
|
|
118
|
+
export interface CodexCredentialSharingCheck {
|
|
119
|
+
/** This node's own directory — where its record is written. */
|
|
120
|
+
readonly nodeDir: string;
|
|
121
|
+
/** Shown to the operator; also how a node recognises its own record. */
|
|
122
|
+
readonly alias: string;
|
|
123
|
+
/** The CODEX_HOME whose auth.json this node will actually use. */
|
|
124
|
+
readonly codexHome: string;
|
|
125
|
+
/** Where the warning goes. Defaults to stderr. */
|
|
126
|
+
readonly say?: (message: string) => void;
|
|
127
|
+
/** Injected for tests; production passes nothing. */
|
|
128
|
+
readonly now?: Date;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The whole operation: read this node's credential, publish an 8-hex record,
|
|
132
|
+
* read what the *other* nodes published, and warn if any of them is on the
|
|
133
|
+
* same chain. Returns the colliding nodes so a caller can name them again if
|
|
134
|
+
* codex later fails to refresh.
|
|
135
|
+
*
|
|
136
|
+
* 🔴 Reads the neighbours' published fingerprint files, never their
|
|
137
|
+
* credentials. A guard against credential sharing must not itself become a
|
|
138
|
+
* reason to open every node's auth.json.
|
|
139
|
+
*
|
|
140
|
+
* 🔴 Always recomputes. The fingerprint changes every time codex refreshes in
|
|
141
|
+
* place, so a stale record is a wrong answer; both call paths may run for
|
|
142
|
+
* one node in sequence, and whichever runs last must leave the current
|
|
143
|
+
* value, never an older one.
|
|
144
|
+
*
|
|
145
|
+
* Never throws and never refuses: observability must not be the reason a node
|
|
146
|
+
* will not start.
|
|
147
|
+
*/
|
|
148
|
+
export declare function checkCodexCredentialSharing(opts: CodexCredentialSharingCheck): NodeFingerprint[];
|