@univer-cli/daemon 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- const _0xb61e7b=_0x5236;(function(_0x2741e2,_0x131cd4){const _0x3d8280=_0x5236,_0x63c1c=_0x2741e2();while(!![]){try{const _0x4b1cd1=-parseInt(_0x3d8280(0x17a))/0x1*(parseInt(_0x3d8280(0x199))/0x2)+-parseInt(_0x3d8280(0x1c3))/0x3+-parseInt(_0x3d8280(0x191))/0x4+parseInt(_0x3d8280(0x1a0))/0x5*(parseInt(_0x3d8280(0x1d0))/0x6)+-parseInt(_0x3d8280(0x1b6))/0x7+parseInt(_0x3d8280(0x1d1))/0x8*(-parseInt(_0x3d8280(0x1cc))/0x9)+parseInt(_0x3d8280(0x1ba))/0xa;if(_0x4b1cd1===_0x131cd4)break;else _0x63c1c['push'](_0x63c1c['shift']());}catch(_0xc5b552){_0x63c1c['push'](_0x63c1c['shift']());}}}(_0x2116,0xb8c13));import{randomUUID as _0x185db3}from'node:crypto';import{spawn as _0x4b60cb}from'node:child_process';import{connect as _0x209893,createServer as _0x37ad10}from'node:net';import{fileURLToPath as _0x2a7430}from'node:url';import{lstat as _0xf2bcb1,mkdir as _0x5736d8,unlink as _0x23a158}from'node:fs/promises';import{dirname as _0x1636c7}from'node:path';function l(_0x5165eb){return JSON['stringify'](_0x5165eb)+'\x0a';}function u(_0x515aff){let _0x120537='';return{'end'(){const _0x32a2af=_0x5236;_0x120537[_0x32a2af(0x1d2)]()[_0x32a2af(0x190)]>0x0&&_0x515aff(_0x120537),_0x120537='';},'push'(_0x4336e7){const _0x8162e8=_0x5236;for(_0x120537+=_0x4336e7[_0x8162e8(0x18f)](_0x8162e8(0x17c));;){let _0x4934f6=_0x120537[_0x8162e8(0x1b8)]('\x0a');if(_0x4934f6<0x0)return;let _0xd021b5=_0x120537['slice'](0x0,_0x4934f6);_0x120537=_0x120537[_0x8162e8(0x172)](_0x4934f6+0x1),_0xd021b5[_0x8162e8(0x1d2)]()['length']>0x0&&_0x515aff(_0xd021b5);}}};}function _0x5236(_0xeb9836,_0x127bec){_0xeb9836=_0xeb9836-0x15d;const _0x2116ca=_0x2116();let _0x523605=_0x2116ca[_0xeb9836];return _0x523605;}var d='UNIVER_CLI_SDK_DAEMON_SOCKET';async function f(_0x3893e2){const _0x3ae2ca=_0x5236;_0x4b60cb(process['execPath'],[_0x2a7430(_0x3893e2[_0x3ae2ca(0x16b)])],{'detached':!0x0,'env':{...process.env,..._0x3893e2['options'][_0x3ae2ca(0x1c0)],[d]:_0x3893e2[_0x3ae2ca(0x1a1)]['socketPath']},'stdio':'ignore'})[_0x3ae2ca(0x1b2)]();let _0x7830ab=Date[_0x3ae2ca(0x181)]();for(;Date['now']()-_0x7830ab<_0x3893e2[_0x3ae2ca(0x1bb)];){try{return await _0x3893e2[_0x3ae2ca(0x182)]();}catch(_0x2eecce){if(!h(_0x2eecce))throw _0x2eecce;}await new Promise(_0x444395=>setTimeout(_0x444395,0x19));}throw Object['assign'](Error(_0x3ae2ca(0x19c)+String(_0x3893e2['timeoutMs'])+'ms'),{'code':_0x3ae2ca(0x15f)});}function p(_0x27ace5,_0x5daa05,_0x16d689,_0x5a1534){return new Promise((_0x20b42d,_0xcfeac9)=>{const _0x1c038b=_0x5236;let _0x561678=_0x209893(_0x27ace5),_0x205465=_0x185db3(),_0x1d68df=!0x1,_0x3780df=setTimeout(()=>{const _0x587112=_0x5236;_0x561678[_0x587112(0x196)](),_0xcfeac9(Object[_0x587112(0x160)](Error('Daemon\x20request\x20timed\x20out\x20after\x20'+String(_0x5a1534)+'ms'),{'code':_0x587112(0x1c2)}));},_0x5a1534),_0xf54c38=_0x48ccec=>{_0x1d68df||(_0x1d68df=!0x0,clearTimeout(_0x3780df),_0x48ccec());},_0x27375a=u(_0x157b3f=>{try{let _0x4436d8=_(_0x157b3f,_0x205465);_0xf54c38(()=>{const _0x489aa7=_0x5236;_0x561678[_0x489aa7(0x187)](),_0x4436d8[_0x489aa7(0x1b9)]===_0x489aa7(0x164)?_0xcfeac9(v(_0x4436d8[_0x489aa7(0x164)])):_0x20b42d(_0x4436d8[_0x489aa7(0x1cd)]);});}catch(_0x3e409e){_0xf54c38(()=>{const _0x2af43c=_0x5236;_0x561678[_0x2af43c(0x196)](),_0xcfeac9(_0x3e409e);});}});_0x561678[_0x1c038b(0x1ac)]('error',_0xb0aebf=>_0xf54c38(()=>{const _0x5cc1d8=_0x1c038b;_0x561678[_0x5cc1d8(0x196)](),_0xcfeac9(_0xb0aebf);})),_0x561678['on'](_0x1c038b(0x16f),_0x4e2905=>_0x27375a[_0x1c038b(0x1c8)](_0x4e2905)),_0x561678['on'](_0x1c038b(0x187),()=>{_0x27375a['end'](),_0xf54c38(()=>{_0x561678['destroy'](),_0xcfeac9(g());});}),_0x561678['on'](_0x1c038b(0x16c),()=>_0xf54c38(()=>{const _0x23f137=_0x1c038b;_0x561678[_0x23f137(0x196)](),_0xcfeac9(g());})),_0x561678[_0x1c038b(0x1ac)]('connect',()=>{const _0x27a9a8=_0x1c038b;_0x561678[_0x27a9a8(0x188)](l({'id':_0x205465,'method':_0x5daa05,'payload':_0x16d689}));});});}function m(_0xd48173){const _0xb15090=_0x5236;let _0x474f4a=_0xd48173 instanceof URL?_0xd48173['href']:_0xd48173;try{let _0x154a76=new URL(_0x474f4a);if(_0x154a76[_0xb15090(0x163)]!=='file:')throw Error();return _0x154a76[_0xb15090(0x186)];}catch{throw Error('Daemon\x20entry\x20must\x20be\x20an\x20absolute\x20file\x20URL');}}function h(_0x5ada65){const _0x237a41=_0x5236;return y(_0x5ada65)?_0x5ada65[_0x237a41(0x18c)]===_0x237a41(0x192)||_0x5ada65[_0x237a41(0x18c)]===_0x237a41(0x1b0):!0x1;}function g(){const _0x21f273=_0x5236;return Object[_0x21f273(0x160)](Error('Daemon\x20connection\x20closed\x20before\x20a\x20response\x20was\x20received'),{'code':'DAEMON_CONNECTION_CLOSED'});}function _(_0x5b7b06,_0x4f2a7b){const _0xe23653=_0x5236;let _0x4412fb=JSON[_0xe23653(0x18e)](_0x5b7b06);if(!y(_0x4412fb)||_0x4412fb['id']!==_0x4f2a7b)throw Error('Invalid\x20daemon\x20response');if(_0x4412fb[_0xe23653(0x1b9)]==='result'&&'result'in _0x4412fb||_0x4412fb[_0xe23653(0x1b9)]===_0xe23653(0x164)&&y(_0x4412fb[_0xe23653(0x164)]))return _0x4412fb;throw Error(_0xe23653(0x1c4));}function v(_0x130555){const _0x361cf6=_0x5236;let _0x28b150=Error(_0x130555['message']);return _0x130555[_0x361cf6(0x18c)]!==void 0x0&&Object[_0x361cf6(0x160)](_0x28b150,{'code':_0x130555['code']}),_0x28b150[_0x361cf6(0x18b)]=_0x130555[_0x361cf6(0x18b)],_0x28b150;}function y(_0x482701){const _0x5a1511=_0x5236;return typeof _0x482701==_0x5a1511(0x1be)&&!!_0x482701&&!Array[_0x5a1511(0x1cb)](_0x482701);}function b(_0xa77397){const _0x9cd39b=_0x5236;S(_0xa77397['id'],_0x9cd39b(0x1b3)),S(_0xa77397[_0x9cd39b(0x169)],'identity.version'),_0xa77397[_0x9cd39b(0x1b5)]!==void 0x0&&S(_0xa77397[_0x9cd39b(0x1b5)],'identity.buildId');}function x(_0x29d67e){const _0x157253=_0x5236;return ee(_0x29d67e)&&typeof _0x29d67e['id']==_0x157253(0x1cf)&&_0x29d67e['id'][_0x157253(0x190)]>0x0&&typeof _0x29d67e[_0x157253(0x169)]==_0x157253(0x1cf)&&_0x29d67e[_0x157253(0x169)][_0x157253(0x190)]>0x0&&(_0x29d67e[_0x157253(0x1b5)]===void 0x0||typeof _0x29d67e[_0x157253(0x1b5)]=='string'&&_0x29d67e[_0x157253(0x1b5)][_0x157253(0x190)]>0x0);}function S(_0x128d09,_0x527b5e){const _0xe98922=_0x5236;if(_0x128d09['length']===0x0)throw Error(_0x527b5e+_0xe98922(0x175));}function ee(_0x565aca){const _0x104166=_0x5236;return typeof _0x565aca==_0x104166(0x1be)&&!!_0x565aca&&!Array['isArray'](_0x565aca);}var C=0x1,w=_0xb61e7b(0x189),T=_0xb61e7b(0x19b);function E(_0x4732aa){const _0xc72092=_0xb61e7b;return _0x4732aa[_0xc72092(0x1a2)](_0xc72092(0x162));}var D=0x2710,O=0x19;function k(_0x281d5e){const _0x1a20c3=_0xb61e7b;b(_0x281d5e[_0x1a20c3(0x17e)]);let _0x353597=m(_0x281d5e['entry']),_0x12cb45=_0x281d5e[_0x1a20c3(0x1c1)]??0x7530,_0x152598=_0x281d5e[_0x1a20c3(0x17b)]??0x2710,_0x122c56=_0x281d5e[_0x1a20c3(0x171)]??D;z(_0x12cb45,'requestTimeoutMs'),z(_0x152598,_0x1a20c3(0x17b)),z(_0x122c56,_0x1a20c3(0x171));let _0x57e266=()=>({'socketPath':_0x281d5e[_0x1a20c3(0x18a)],'state':_0x1a20c3(0x1b1)}),_0x17b170=async()=>{const _0x7e477a=_0x1a20c3;try{let _0x48e3c3=N(await p(_0x281d5e[_0x7e477a(0x18a)],w,null,_0x12cb45),_0x281d5e[_0x7e477a(0x18a)]),_0x166ce9=te(_0x281d5e[_0x7e477a(0x17e)],_0x48e3c3);return _0x166ce9===void 0x0?_0x48e3c3:ne(_0x281d5e[_0x7e477a(0x17e)],_0x48e3c3,_0x166ce9,_0x281d5e[_0x7e477a(0x18a)]);}catch(_0x817deb){if(h(_0x817deb))return _0x57e266();let _0x152221=L(_0x817deb);return _0x152221[_0x7e477a(0x18c)]===_0x7e477a(0x16a)?j(_0x281d5e[_0x7e477a(0x17e)],'legacy-protocol',_0x281d5e[_0x7e477a(0x18a)],_0x152221):_0x152221[_0x7e477a(0x18c)]===_0x7e477a(0x197)?j(_0x281d5e[_0x7e477a(0x17e)],'invalid-health',_0x281d5e['socketPath'],_0x152221):{'diagnostic':_0x152221,'socketPath':_0x281d5e[_0x7e477a(0x18a)],'state':_0x7e477a(0x167)};}},_0x46df46=async()=>{const _0x293826=_0x1a20c3;let _0x426f66=await _0x17b170();if(_0x426f66[_0x293826(0x173)]===_0x293826(0x1a5))return{..._0x426f66,'started':!0x1};if(_0x426f66[_0x293826(0x173)]!==_0x293826(0x1b1))throw M(_0x426f66);return{...await f({'entry':_0x353597,'options':_0x281d5e,'ready':async()=>{const _0x188b2a=_0x293826;let _0x144c66=await _0x17b170();if(_0x144c66['state']===_0x188b2a(0x1b1))throw F(_0x281d5e['socketPath']);if(_0x144c66['state']!==_0x188b2a(0x1a5))throw M(_0x144c66);return _0x144c66;},'timeoutMs':_0x152598}),'started':!0x0};},_0xa6bcec=async()=>{const _0x1fd061=_0x1a20c3;let _0x337058=await _0x17b170();if(_0x337058[_0x1fd061(0x173)]===_0x1fd061(0x1b1))return{..._0x337058,'stopped':!0x1};if(_0x337058[_0x1fd061(0x173)]!==_0x1fd061(0x1a5)&&!A(_0x337058))throw M(_0x337058);try{await p(_0x281d5e['socketPath'],T,null,_0x12cb45);}catch(_0x2477fe){if(!I(_0x2477fe))throw _0x2477fe;}return await P(_0x17b170,_0x122c56),{..._0x57e266(),'stopped':!0x0};};return{async 'restart'(){const _0x235ce1=_0x1a20c3;let _0x1abfa6=await _0x17b170();if(_0x1abfa6[_0x235ce1(0x173)]!==_0x235ce1(0x1a5)&&_0x1abfa6[_0x235ce1(0x173)]!==_0x235ce1(0x1b1)&&!A(_0x1abfa6))throw M(_0x1abfa6);(_0x1abfa6['state']===_0x235ce1(0x1a5)||A(_0x1abfa6))&&await _0xa6bcec();let _0x1f929c=await _0x46df46(),_0x6b4a51=_0x1abfa6[_0x235ce1(0x173)]===_0x235ce1(0x1a5)?_0x1abfa6[_0x235ce1(0x16d)]:A(_0x1abfa6)?_0x1abfa6['actual']['pid']:void 0x0;return{'identity':_0x1f929c[_0x235ce1(0x17e)],'pid':_0x1f929c['pid'],..._0x6b4a51===void 0x0?{}:{'previousPid':_0x6b4a51},'restarted':_0x1abfa6[_0x235ce1(0x173)]!==_0x235ce1(0x1b1),'protocolVersion':_0x1f929c[_0x235ce1(0x178)],'socketPath':_0x1f929c[_0x235ce1(0x18a)],'startedAt':_0x1f929c['startedAt'],'state':'running'};},'start':_0x46df46,'status':_0x17b170,'stop':_0xa6bcec};}function A(_0x325b2d){const _0x198aed=_0xb61e7b;return _0x325b2d[_0x198aed(0x173)]==='incompatible'&&_0x325b2d[_0x198aed(0x1ce)]!==void 0x0&&(_0x325b2d[_0x198aed(0x170)]===_0x198aed(0x1c6)||_0x325b2d[_0x198aed(0x170)]==='build-id-mismatch');}function te(_0x5627d6,_0x1db4d2){const _0x1b1998=_0xb61e7b;if(_0x1db4d2[_0x1b1998(0x178)]!==0x1)return _0x1b1998(0x1bf);if(_0x1db4d2[_0x1b1998(0x17e)]['id']!==_0x5627d6['id'])return _0x1b1998(0x16e);if(_0x1db4d2[_0x1b1998(0x17e)][_0x1b1998(0x169)]!==_0x5627d6[_0x1b1998(0x169)])return _0x1b1998(0x1c6);if(_0x5627d6[_0x1b1998(0x1b5)]!==void 0x0&&_0x1db4d2['identity'][_0x1b1998(0x1b5)]!==_0x5627d6[_0x1b1998(0x1b5)])return _0x1b1998(0x1c7);}function ne(_0x5352ab,_0x4032f6,_0x3ddb3b,_0x599ac3){const _0x2a83fa=_0xb61e7b;return{'actual':{'identity':_0x4032f6[_0x2a83fa(0x17e)],'pid':_0x4032f6[_0x2a83fa(0x16d)],'protocolVersion':_0x4032f6[_0x2a83fa(0x178)],'socketPath':_0x4032f6[_0x2a83fa(0x18a)],'startedAt':_0x4032f6[_0x2a83fa(0x1a8)]},'expected':{'identity':_0x5352ab,'protocolVersion':0x1},'reason':_0x3ddb3b,'socketPath':_0x599ac3,'state':_0x2a83fa(0x19e)};}function j(_0x2f8567,_0x4abab2,_0x384c0e,_0x395535){const _0x13d881=_0xb61e7b;return{'diagnostic':_0x395535,'expected':{'identity':_0x2f8567,'protocolVersion':0x1},'reason':_0x4abab2,'socketPath':_0x384c0e,'state':_0x13d881(0x19e)};}function M(_0x318211){const _0x3e2e4c=_0xb61e7b;let _0x1ccbec=_0x318211[_0x3e2e4c(0x173)]===_0x3e2e4c(0x19e)?_0x318211[_0x3e2e4c(0x170)]:_0x318211[_0x3e2e4c(0x177)][_0x3e2e4c(0x1a6)];return R(_0x318211[_0x3e2e4c(0x173)]===_0x3e2e4c(0x19e)?_0x3e2e4c(0x165):_0x3e2e4c(0x15e),_0x3e2e4c(0x180)+_0x1ccbec);}function N(_0x43e523,_0x494159){const _0x3edf7e=_0xb61e7b;if(!B(_0x43e523)||_0x43e523[_0x3edf7e(0x173)]!==_0x3edf7e(0x1a5)||_0x43e523[_0x3edf7e(0x18a)]!==_0x494159||!x(_0x43e523[_0x3edf7e(0x17e)])||typeof _0x43e523[_0x3edf7e(0x16d)]!=_0x3edf7e(0x1af)||!Number['isSafeInteger'](_0x43e523[_0x3edf7e(0x16d)])||_0x43e523[_0x3edf7e(0x16d)]<=0x0||typeof _0x43e523[_0x3edf7e(0x178)]!=_0x3edf7e(0x1af)||!Number[_0x3edf7e(0x19a)](_0x43e523[_0x3edf7e(0x178)])||_0x43e523[_0x3edf7e(0x178)]<=0x0||typeof _0x43e523['startedAt']!=_0x3edf7e(0x1cf)||Number[_0x3edf7e(0x184)](Date[_0x3edf7e(0x18e)](_0x43e523[_0x3edf7e(0x1a8)])))throw R('DAEMON_CONTROL_INVALID_RESPONSE',_0x3edf7e(0x1ae));return{'identity':_0x43e523['identity'],'pid':_0x43e523[_0x3edf7e(0x16d)],'protocolVersion':_0x43e523[_0x3edf7e(0x178)],'socketPath':_0x494159,'startedAt':_0x43e523[_0x3edf7e(0x1a8)],'state':'running'};}async function P(_0x572aa3,_0x335f81){const _0x4db011=_0xb61e7b;let _0x1d8071=Date['now']();for(;Date[_0x4db011(0x181)]()-_0x1d8071<_0x335f81;){if((await _0x572aa3())[_0x4db011(0x173)]===_0x4db011(0x1b1))return;await new Promise(_0x477f35=>setTimeout(_0x477f35,O));}throw R(_0x4db011(0x1c9),_0x4db011(0x198)+String(_0x335f81)+'ms');}function F(_0x5265e5){const _0x45d8ea=_0xb61e7b;return Object[_0x45d8ea(0x160)](Error('Daemon\x20is\x20not\x20listening\x20on\x20'+_0x5265e5),{'code':_0x45d8ea(0x1b0)});}function I(_0x22da65){const _0x407cee=_0xb61e7b;return h(_0x22da65)||B(_0x22da65)&&(_0x22da65['code']===_0x407cee(0x19f)||_0x22da65[_0x407cee(0x18c)]===_0x407cee(0x1d3)||_0x22da65[_0x407cee(0x18c)]===_0x407cee(0x176)||_0x22da65[_0x407cee(0x18c)]===_0x407cee(0x179));}function L(_0x8e2665){const _0x4be8e8=_0xb61e7b;let _0x4447ba=_0x8e2665 instanceof Error?_0x8e2665[_0x4be8e8(0x1a6)]:String(_0x8e2665);return B(_0x8e2665)&&typeof _0x8e2665[_0x4be8e8(0x18c)]=='string'?{'code':_0x8e2665[_0x4be8e8(0x18c)],'message':_0x4447ba}:{'message':_0x4447ba};}function R(_0x53bdda,_0x3169b4){const _0xd6ba2e=_0xb61e7b;return Object[_0xd6ba2e(0x160)](Error(_0x3169b4),{'code':_0x53bdda});}function z(_0x5b23a3,_0x5da565){const _0x2f7415=_0xb61e7b;if(!Number[_0x2f7415(0x1b4)](_0x5b23a3)||_0x5b23a3<=0x0)throw Error(_0x5da565+'\x20must\x20be\x20a\x20finite\x20positive\x20number');}function B(_0x4e4a6d){const _0x281168=_0xb61e7b;return typeof _0x4e4a6d==_0x281168(0x1be)&&!!_0x4e4a6d&&!Array[_0x281168(0x1cb)](_0x4e4a6d);}function V(_0x54c4ab){const _0x17a2e8=_0xb61e7b;let _0x3307b2=_0x54c4ab[_0x17a2e8(0x1c1)]??0x7530,_0x25404b=k(_0x54c4ab),_0x503b17,_0x3bb325=async()=>{const _0x29e26b=_0x17a2e8;let _0x547409=await _0x25404b['status']();if(_0x547409[_0x29e26b(0x173)]===_0x29e26b(0x1a5))return _0x547409;if(_0x547409[_0x29e26b(0x173)]!==_0x29e26b(0x1b1))throw M(_0x547409);let _0x522a01=_0x503b17??=_0x25404b[_0x29e26b(0x166)]();try{return await _0x522a01;}finally{_0x503b17===_0x522a01&&(_0x503b17=void 0x0);}};return{async 'request'(_0x274c92,_0x954983){const _0x913236=_0x17a2e8;if(_0x274c92['length']===0x0)throw Error('Daemon\x20method\x20must\x20not\x20be\x20empty');await _0x3bb325();try{return await p(_0x54c4ab[_0x913236(0x18a)],_0x274c92,_0x954983,_0x3307b2);}catch(_0x1706c7){if(!h(_0x1706c7))throw _0x1706c7;}return await _0x3bb325(),await p(_0x54c4ab[_0x913236(0x18a)],_0x274c92,_0x954983,_0x3307b2);}};}function H(_0x4bb1fc){const _0xe786cf=_0xb61e7b;oe(_0x4bb1fc[_0xe786cf(0x18a)]),b(_0x4bb1fc[_0xe786cf(0x17e)]);let _0x3e197f=new Map(),_0x3febcd=new Set(),_0xe9a7d7,_0x1dc761=!0x1,_0x31c252,_0x127407,_0x1d43b3={async 'close'(){_0x31c252??=_0x4ed526(),await _0x31c252;},'handle'(_0x53e375,_0x57026a){const _0x1e6574=_0xe786cf;if(_0x1dc761)throw Error(_0x1e6574(0x195));if(_0x53e375[_0x1e6574(0x190)]===0x0)throw Error('Daemon\x20method\x20must\x20not\x20be\x20empty');if(E(_0x53e375))throw Error(_0x1e6574(0x1a3)+_0x53e375);if(_0x3e197f[_0x1e6574(0x1ca)](_0x53e375))throw Error(_0x1e6574(0x1a4)+_0x53e375+_0x1e6574(0x183));_0x3e197f[_0x1e6574(0x1ad)](_0x53e375,_0x57026a);},async 'listen'(){const _0x283b41=_0xe786cf;if(!_0x1dc761){if(_0x31c252)throw Error(_0x283b41(0x1aa));await _0x5736d8(_0x1636c7(_0x4bb1fc[_0x283b41(0x18a)]),{'recursive':!0x0}),await Y(_0x4bb1fc[_0x283b41(0x18a)]),_0xe9a7d7=_0x37ad10(_0x3340fd=>U(_0x3340fd,_0x3e197f,_0x3febcd,{'shutdown':()=>{const _0x4f5e07=_0x283b41;_0x1d43b3[_0x4f5e07(0x16c)]()[_0x4f5e07(0x15d)](()=>{process['exitCode']=0x1;});},'status':()=>G(_0x4bb1fc[_0x283b41(0x17e)],_0x4bb1fc[_0x283b41(0x18a)],_0x127407)})),await new Promise((_0x5cd589,_0x4096b2)=>{const _0x1c901b=_0x283b41;let _0x55e18d=_0xe9a7d7,_0x5d1c47=_0x54b66c=>_0x4096b2(ae(_0x54b66c)?Z(_0x4bb1fc['socketPath']):_0x54b66c);_0x55e18d[_0x1c901b(0x1ac)](_0x1c901b(0x164),_0x5d1c47),_0x55e18d['listen'](_0x4bb1fc[_0x1c901b(0x18a)],()=>{const _0x3c0f10=_0x1c901b;_0x55e18d[_0x3c0f10(0x194)](_0x3c0f10(0x164),_0x5d1c47),_0x1dc761=!0x0,_0x127407=new Date()['toISOString'](),_0x5cd589();});});}}};return _0x1d43b3;async function _0x4ed526(){const _0x56df30=_0xe786cf;for(let _0x246ce5 of _0x3febcd)_0x246ce5[_0x56df30(0x196)]();_0x3febcd['clear'](),_0xe9a7d7&&_0x1dc761&&await new Promise((_0x44959b,_0x3b97ba)=>{const _0x4ff515=_0x56df30;_0xe9a7d7[_0x4ff515(0x16c)](_0x26e72b=>_0x26e72b?_0x3b97ba(_0x26e72b):_0x44959b());}),_0x1dc761=!0x1;try{await _0x4bb1fc['onShutdown']?.();}finally{await re(_0x4bb1fc[_0x56df30(0x18a)]);}}}function U(_0x2d8f14,_0x3bf7e4,_0x5cf488,_0x25c511){const _0x26ed62=_0xb61e7b;_0x5cf488[_0x26ed62(0x1b7)](_0x2d8f14);let _0x43b6cc=!0x1,_0xd4a5df=u(_0x38b131=>{_0x43b6cc||(_0x43b6cc=!0x0,W(_0x2d8f14,_0x38b131,_0x3bf7e4,_0x25c511));});_0x2d8f14['on']('data',_0x43e85e=>_0xd4a5df[_0x26ed62(0x1c8)](_0x43e85e)),_0x2d8f14['on'](_0x26ed62(0x187),()=>_0xd4a5df[_0x26ed62(0x187)]()),_0x2d8f14['on'](_0x26ed62(0x16c),()=>_0x5cf488[_0x26ed62(0x193)](_0x2d8f14)),_0x2d8f14['on'](_0x26ed62(0x164),()=>_0x2d8f14[_0x26ed62(0x196)]());}async function W(_0x64ffdf,_0xb96db1,_0x4d037e,_0xea001f){const _0x5cb9ce=_0xb61e7b;let _0x3ba288='unknown',_0x5aceec,_0x592cce=!0x1;try{let _0x1aa2b3=K(_0xb96db1);_0x3ba288=_0x1aa2b3['id'];let _0x4ba334;if(_0x1aa2b3['method']===_0x5cb9ce(0x189)){let _0x500039=_0xea001f[_0x5cb9ce(0x185)]();_0x4ba334={'identity':{..._0x500039[_0x5cb9ce(0x17e)]['buildId']===void 0x0?{}:{'buildId':_0x500039[_0x5cb9ce(0x17e)][_0x5cb9ce(0x1b5)]},'id':_0x500039[_0x5cb9ce(0x17e)]['id'],'version':_0x500039['identity']['version']},'pid':_0x500039[_0x5cb9ce(0x16d)],'protocolVersion':_0x500039[_0x5cb9ce(0x178)],'socketPath':_0x500039[_0x5cb9ce(0x18a)],'startedAt':_0x500039['startedAt'],'state':_0x500039['state']};}else{if(_0x1aa2b3[_0x5cb9ce(0x1a9)]===_0x5cb9ce(0x19b))_0x4ba334=null,_0x592cce=!0x0;else{let _0x52c687=_0x4d037e[_0x5cb9ce(0x1bd)](_0x1aa2b3[_0x5cb9ce(0x1a9)]);if(!_0x52c687)throw J(_0x5cb9ce(0x16a),'Unknown\x20daemon\x20method\x20'+_0x1aa2b3[_0x5cb9ce(0x1a9)]);_0x4ba334=await _0x52c687(_0x1aa2b3['payload']);}}_0x5aceec={'id':_0x3ba288,'result':_0x4ba334,'type':_0x5cb9ce(0x1cd)};}catch(_0x2654c0){_0x5aceec={'error':q(_0x2654c0),'id':_0x3ba288,'type':'error'};}_0x64ffdf[_0x5cb9ce(0x187)](l(_0x5aceec),()=>{_0x592cce&&_0xea001f['shutdown']();});}function G(_0x1c7714,_0x42ec88,_0x42f507){const _0x32779f=_0xb61e7b;if(_0x42f507===void 0x0)throw Error(_0x32779f(0x17d));return{'identity':_0x1c7714,'pid':process[_0x32779f(0x16d)],'protocolVersion':0x1,'socketPath':_0x42ec88,'startedAt':_0x42f507,'state':_0x32779f(0x1a5)};}function K(_0x2e3e3f){const _0x1d1f7c=_0xb61e7b;let _0x2de8b9=JSON[_0x1d1f7c(0x18e)](_0x2e3e3f);if(!$(_0x2de8b9)||typeof _0x2de8b9['id']!=_0x1d1f7c(0x1cf)||typeof _0x2de8b9[_0x1d1f7c(0x1a9)]!=_0x1d1f7c(0x1cf)||!(_0x1d1f7c(0x1ab)in _0x2de8b9))throw J(_0x1d1f7c(0x161),_0x1d1f7c(0x1c5));return _0x2de8b9;}function q(_0x570c0e){const _0x11be80=_0xb61e7b;if(_0x570c0e instanceof Error){let _0x26f831=_0x570c0e[_0x11be80(0x18c)];return{...typeof _0x26f831==_0x11be80(0x1cf)?{'code':_0x26f831}:{},'message':_0x570c0e[_0x11be80(0x1a6)],'name':_0x570c0e[_0x11be80(0x18b)]};}return{'message':String(_0x570c0e),'name':'Error'};}function J(_0x5a0b15,_0xaa6141){const _0x5d0c0b=_0xb61e7b;return Object[_0x5d0c0b(0x160)](Error(_0xaa6141),{'code':_0x5a0b15});}async function Y(_0x1be09d){const _0x44cb09=_0xb61e7b;try{if(!(await _0xf2bcb1(_0x1be09d))['isSocket']())throw Error(_0x44cb09(0x168)+_0x1be09d);if(await X(_0x1be09d))throw Z(_0x1be09d);await _0x23a158(_0x1be09d);}catch(_0x12b1dc){if(Q(_0x12b1dc))return;throw _0x12b1dc;}}function X(_0x4b2ec9){return new Promise((_0x3b9b7c,_0x2e4185)=>{const _0x3664f9=_0x5236;let _0x3ff931=_0x209893(_0x4b2ec9);_0x3ff931['once'](_0x3664f9(0x174),()=>{const _0x50adc3=_0x3664f9;_0x3ff931[_0x50adc3(0x196)](),_0x3b9b7c(!0x0);}),_0x3ff931[_0x3664f9(0x1ac)](_0x3664f9(0x164),_0x37c114=>{_0x3ff931['destroy'](),ie(_0x37c114)||Q(_0x37c114)?_0x3b9b7c(!0x1):_0x2e4185(_0x37c114);});});}function Z(_0x22c300){const _0x3d0330=_0xb61e7b;return Object['assign'](Error(_0x3d0330(0x1bc)+_0x22c300),{'code':_0x3d0330(0x1a7)});}async function re(_0x4efa4d){const _0x3d5626=_0xb61e7b;try{(await _0xf2bcb1(_0x4efa4d))[_0x3d5626(0x19d)]()&&await _0x23a158(_0x4efa4d);}catch(_0x30b88a){if(!Q(_0x30b88a))throw _0x30b88a;}}function Q(_0x243c02){const _0x25c048=_0xb61e7b;return $(_0x243c02)&&_0x243c02[_0x25c048(0x18c)]===_0x25c048(0x192);}function _0x2116(){const _0x2ca348=['version-mismatch','build-id-mismatch','push','DAEMON_STOP_TIMEOUT','has','isArray','9fMZKqt','result','actual','string','6558XFBNqw','7986584lbfjRE','trim','ECONNRESET','catch','DAEMON_UNREACHABLE','DAEMON_START_TIMEOUT','assign','DAEMON_INVALID_REQUEST','daemon.','protocol','error','DAEMON_INCOMPATIBLE','start','unreachable','Refusing\x20to\x20replace\x20non-socket\x20path\x20','version','DAEMON_METHOD_NOT_FOUND','entry','close','pid','identity-mismatch','data','reason','stopTimeoutMs','slice','state','connect','\x20must\x20not\x20be\x20empty','ENOTCONN','diagnostic','protocolVersion','EPIPE','5567xVPdvU','startTimeoutMs','utf8','Daemon\x20server\x20has\x20not\x20started\x20listening','identity','EADDRINUSE','Daemon\x20is\x20not\x20ready:\x20','now','ready','\x20is\x20already\x20registered','isNaN','status','href','end','write','daemon.status','socketPath','name','code','socketPath\x20must\x20not\x20be\x20empty','parse','toString','length','1654080xRxmug','ENOENT','delete','off','Daemon\x20handlers\x20must\x20be\x20registered\x20before\x20listen()','destroy','DAEMON_CONTROL_INVALID_RESPONSE','Daemon\x20did\x20not\x20stop\x20within\x20','292nBJtov','isSafeInteger','daemon.shutdown','Daemon\x20did\x20not\x20start\x20within\x20','isSocket','incompatible','DAEMON_CONNECTION_CLOSED','4960UGFJSA','options','startsWith','Daemon\x20method\x20namespace\x20is\x20reserved:\x20','Daemon\x20method\x20','running','message','DAEMON_ALREADY_RUNNING','startedAt','method','Daemon\x20server\x20is\x20closed','payload','once','set','Daemon\x20status\x20response\x20is\x20invalid','number','ECONNREFUSED','stopped','unref','identity.id','isFinite','buildId','7713748srvrhd','add','indexOf','type','31350740xIVSNN','timeoutMs','A\x20daemon\x20is\x20already\x20listening\x20on\x20','get','object','protocol-mismatch','env','requestTimeoutMs','DAEMON_REQUEST_TIMEOUT','407958rgxlWv','Invalid\x20daemon\x20response','Invalid\x20daemon\x20request'];_0x2116=function(){return _0x2ca348;};return _0x2116();}function ie(_0xcdc62c){const _0x5f3f20=_0xb61e7b;return $(_0xcdc62c)&&_0xcdc62c[_0x5f3f20(0x18c)]===_0x5f3f20(0x1b0);}function ae(_0x1b6308){const _0x50363a=_0xb61e7b;return $(_0x1b6308)&&_0x1b6308[_0x50363a(0x18c)]===_0x50363a(0x17f);}function oe(_0x11acfa){const _0x1b51dc=_0xb61e7b;if(_0x11acfa['length']===0x0)throw Error(_0x1b51dc(0x18d));}function $(_0x76ed5f){const _0x429468=_0xb61e7b;return typeof _0x76ed5f==_0x429468(0x1be)&&!!_0x76ed5f&&!Array['isArray'](_0x76ed5f);}export{C as DAEMON_PROTOCOL_VERSION,T as DAEMON_SHUTDOWN_METHOD,d as DAEMON_SOCKET_ENV,w as DAEMON_STATUS_METHOD,V as createDaemonClient,k as createDaemonControl,H as createDaemonServer};
1
+ const _0x28408b=_0x31e2;(function(_0x15182c,_0x2c31e0){const _0x409721=_0x31e2,_0x2f5355=_0x15182c();while(!![]){try{const _0x3ba0cf=-parseInt(_0x409721(0x145))/0x1+parseInt(_0x409721(0x189))/0x2+parseInt(_0x409721(0x18a))/0x3+parseInt(_0x409721(0x1ac))/0x4*(parseInt(_0x409721(0x192))/0x5)+-parseInt(_0x409721(0x184))/0x6+-parseInt(_0x409721(0x17a))/0x7+parseInt(_0x409721(0x169))/0x8*(-parseInt(_0x409721(0x19e))/0x9);if(_0x3ba0cf===_0x2c31e0)break;else _0x2f5355['push'](_0x2f5355['shift']());}catch(_0x839fd9){_0x2f5355['push'](_0x2f5355['shift']());}}}(_0x2d5e,0xe6d1e));import{randomUUID as _0x513b98}from'node:crypto';import{spawn as _0x3f14b3}from'node:child_process';import{connect as _0x25d23b,createServer as _0x10fcf5}from'node:net';import{fileURLToPath as _0x102002}from'node:url';import{lstat as _0x1152d7,mkdir as _0x1ec961,unlink as _0x1de755}from'node:fs/promises';import{dirname as _0x364e6f}from'node:path';function l(_0x4cede4){const _0x3bfb3c=_0x31e2;return JSON[_0x3bfb3c(0x146)](_0x4cede4)+'\x0a';}function u(_0x1e3bf7){let _0x529a60='';return{'end'(){const _0x977f3a=_0x31e2;_0x529a60['trim']()[_0x977f3a(0x14c)]>0x0&&_0x1e3bf7(_0x529a60),_0x529a60='';},'push'(_0x36b843){const _0x2eec52=_0x31e2;for(_0x529a60+=_0x36b843[_0x2eec52(0x148)]('utf8');;){let _0x5cc9dd=_0x529a60[_0x2eec52(0x178)]('\x0a');if(_0x5cc9dd<0x0)return;let _0x448b80=_0x529a60['slice'](0x0,_0x5cc9dd);_0x529a60=_0x529a60[_0x2eec52(0x185)](_0x5cc9dd+0x1),_0x448b80[_0x2eec52(0x19a)]()['length']>0x0&&_0x1e3bf7(_0x448b80);}}};}var d=_0x28408b(0x183);async function f(_0x3bb2de){const _0x59d930=_0x28408b;_0x3f14b3(process['execPath'],[_0x102002(_0x3bb2de[_0x59d930(0x15e)])],{'detached':!0x0,'env':{...process.env,..._0x3bb2de[_0x59d930(0x187)][_0x59d930(0x1a4)],[d]:_0x3bb2de[_0x59d930(0x187)]['socketPath']},'stdio':_0x59d930(0x194)})[_0x59d930(0x157)]();let _0x34ba0a=Date[_0x59d930(0x152)]();for(;Date[_0x59d930(0x152)]()-_0x34ba0a<_0x3bb2de[_0x59d930(0x17b)];){try{return await _0x3bb2de[_0x59d930(0x177)]();}catch(_0xf42232){if(!h(_0xf42232))throw _0xf42232;}await new Promise(_0x56db72=>setTimeout(_0x56db72,0x19));}throw Object['assign'](Error('Daemon\x20did\x20not\x20start\x20within\x20'+String(_0x3bb2de[_0x59d930(0x17b)])+'ms'),{'code':'DAEMON_START_TIMEOUT'});}function p(_0xf7a1b1,_0x58caf9,_0x562956,_0x2cba0d){return new Promise((_0x51c3e3,_0x536c25)=>{const _0x330fbd=_0x31e2;let _0x4da215=_0x25d23b(_0xf7a1b1),_0x3de707=_0x513b98(),_0x43239f=!0x1,_0x392188=setTimeout(()=>{const _0x51a817=_0x31e2;_0x4da215[_0x51a817(0x191)](),_0x536c25(Object[_0x51a817(0x1bd)](Error(_0x51a817(0x173)+String(_0x2cba0d)+'ms'),{'code':'DAEMON_REQUEST_TIMEOUT'}));},_0x2cba0d),_0x3fd99c=_0x524fb9=>{_0x43239f||(_0x43239f=!0x0,clearTimeout(_0x392188),_0x524fb9());},_0x10890a=u(_0x12589b=>{try{let _0x1fe43a=_(_0x12589b,_0x3de707);_0x3fd99c(()=>{const _0x429965=_0x31e2;_0x4da215[_0x429965(0x182)](),_0x1fe43a[_0x429965(0x197)]===_0x429965(0x1b4)?_0x536c25(v(_0x1fe43a[_0x429965(0x1b4)])):_0x51c3e3(_0x1fe43a['result']);});}catch(_0x2ff5f6){_0x3fd99c(()=>{const _0x3c5eaf=_0x31e2;_0x4da215[_0x3c5eaf(0x191)](),_0x536c25(_0x2ff5f6);});}});_0x4da215[_0x330fbd(0x17d)]('error',_0x14e561=>_0x3fd99c(()=>{const _0x9aa3e5=_0x330fbd;_0x4da215[_0x9aa3e5(0x191)](),_0x536c25(_0x14e561);})),_0x4da215['on'](_0x330fbd(0x179),_0x2eb2e4=>_0x10890a[_0x330fbd(0x165)](_0x2eb2e4)),_0x4da215['on'](_0x330fbd(0x182),()=>{_0x10890a['end'](),_0x3fd99c(()=>{const _0x5bc6ec=_0x31e2;_0x4da215[_0x5bc6ec(0x191)](),_0x536c25(g());});}),_0x4da215['on'](_0x330fbd(0x1ae),()=>_0x3fd99c(()=>{const _0x53cca1=_0x330fbd;_0x4da215[_0x53cca1(0x191)](),_0x536c25(g());})),_0x4da215[_0x330fbd(0x17d)](_0x330fbd(0x1a2),()=>{const _0x1864dc=_0x330fbd;_0x4da215[_0x1864dc(0x14a)](l({'id':_0x3de707,'method':_0x58caf9,'payload':_0x562956}));});});}function m(_0x3e7a8e){const _0x4c4ae0=_0x28408b;let _0x9ab7cb=_0x3e7a8e instanceof URL?_0x3e7a8e[_0x4c4ae0(0x196)]:_0x3e7a8e;try{let _0x1504a7=new URL(_0x9ab7cb);if(_0x1504a7[_0x4c4ae0(0x1b0)]!==_0x4c4ae0(0x16c))throw Error();return _0x1504a7[_0x4c4ae0(0x196)];}catch{throw Error('Daemon\x20entry\x20must\x20be\x20an\x20absolute\x20file\x20URL');}}function h(_0x4d3ef3){const _0xd6bd36=_0x28408b;return y(_0x4d3ef3)?_0x4d3ef3['code']==='ENOENT'||_0x4d3ef3[_0xd6bd36(0x15d)]===_0xd6bd36(0x16f):!0x1;}function g(){const _0x8b13d7=_0x28408b;return Object[_0x8b13d7(0x1bd)](Error('Daemon\x20connection\x20closed\x20before\x20a\x20response\x20was\x20received'),{'code':_0x8b13d7(0x19f)});}function _(_0x2e18b7,_0x4da7a6){const _0x19b14c=_0x28408b;let _0x2d79ac=JSON[_0x19b14c(0x195)](_0x2e18b7);if(!y(_0x2d79ac)||_0x2d79ac['id']!==_0x4da7a6)throw Error(_0x19b14c(0x172));if(_0x2d79ac['type']===_0x19b14c(0x15b)&&_0x19b14c(0x15b)in _0x2d79ac||_0x2d79ac[_0x19b14c(0x197)]===_0x19b14c(0x1b4)&&y(_0x2d79ac['error']))return _0x2d79ac;throw Error(_0x19b14c(0x172));}function v(_0x328edc){const _0xc090c2=_0x28408b;let _0x206b66=Error(_0x328edc[_0xc090c2(0x1b6)]);return _0x328edc[_0xc090c2(0x15d)]!==void 0x0&&Object[_0xc090c2(0x1bd)](_0x206b66,{'code':_0x328edc['code']}),_0x206b66['name']=_0x328edc[_0xc090c2(0x163)],_0x206b66;}function y(_0x16365a){const _0x278194=_0x28408b;return typeof _0x16365a=='object'&&!!_0x16365a&&!Array[_0x278194(0x14f)](_0x16365a);}function b(_0x1e9af7){const _0x7629a9=_0x28408b;S(_0x1e9af7['id'],_0x7629a9(0x1ba)),S(_0x1e9af7[_0x7629a9(0x168)],_0x7629a9(0x199)),_0x1e9af7[_0x7629a9(0x166)]!==void 0x0&&S(_0x1e9af7[_0x7629a9(0x166)],_0x7629a9(0x171));}function x(_0x281e74){const _0x5a89f8=_0x28408b;return ee(_0x281e74)&&typeof _0x281e74['id']==_0x5a89f8(0x190)&&_0x281e74['id'][_0x5a89f8(0x14c)]>0x0&&typeof _0x281e74['version']=='string'&&_0x281e74[_0x5a89f8(0x168)][_0x5a89f8(0x14c)]>0x0&&(_0x281e74[_0x5a89f8(0x166)]===void 0x0||typeof _0x281e74[_0x5a89f8(0x166)]==_0x5a89f8(0x190)&&_0x281e74[_0x5a89f8(0x166)][_0x5a89f8(0x14c)]>0x0);}function S(_0x24558b,_0x3d1830){const _0x30867d=_0x28408b;if(_0x24558b[_0x30867d(0x14c)]===0x0)throw Error(_0x3d1830+_0x30867d(0x1ad));}function ee(_0x1f8303){const _0x949ac1=_0x28408b;return typeof _0x1f8303==_0x949ac1(0x18d)&&!!_0x1f8303&&!Array[_0x949ac1(0x14f)](_0x1f8303);}var C=0x1,w='daemon.status',T=_0x28408b(0x151);function _0x31e2(_0x13bd41,_0x592182){_0x13bd41=_0x13bd41-0x145;const _0x2d5ec2=_0x2d5e();let _0x31e29c=_0x2d5ec2[_0x13bd41];return _0x31e29c;}function E(_0x1520cd){const _0x53ce6d=_0x28408b;return _0x1520cd[_0x53ce6d(0x198)](_0x53ce6d(0x15a));}var D=0x2710,O=0x19;function k(_0xacfe5c){const _0x5761ed=_0x28408b;b(_0xacfe5c['identity']);let _0x2f0eb8=m(_0xacfe5c['entry']),_0x53e6c1=_0xacfe5c[_0x5761ed(0x14b)]??0x7530,_0x51707a=_0xacfe5c[_0x5761ed(0x1a1)]??0x2710,_0xfe5246=_0xacfe5c[_0x5761ed(0x1b7)]??D;z(_0x53e6c1,_0x5761ed(0x14b)),z(_0x51707a,'startTimeoutMs'),z(_0xfe5246,'stopTimeoutMs');let _0x548784=()=>({'socketPath':_0xacfe5c[_0x5761ed(0x18c)],'state':_0x5761ed(0x16e)}),_0x390264=async()=>{const _0x451ad9=_0x5761ed;try{let _0x2af529=N(await p(_0xacfe5c[_0x451ad9(0x18c)],w,null,_0x53e6c1),_0xacfe5c[_0x451ad9(0x18c)]),_0x4ba38d=te(_0xacfe5c[_0x451ad9(0x19c)],_0x2af529);return _0x4ba38d===void 0x0?_0x2af529:ne(_0xacfe5c[_0x451ad9(0x19c)],_0x2af529,_0x4ba38d,_0xacfe5c[_0x451ad9(0x18c)]);}catch(_0x17dfef){if(h(_0x17dfef))return _0x548784();let _0x561cf0=L(_0x17dfef);return _0x561cf0[_0x451ad9(0x15d)]===_0x451ad9(0x1a8)?j(_0xacfe5c[_0x451ad9(0x19c)],_0x451ad9(0x186),_0xacfe5c[_0x451ad9(0x18c)],_0x561cf0):_0x561cf0[_0x451ad9(0x15d)]==='DAEMON_CONTROL_INVALID_RESPONSE'?j(_0xacfe5c[_0x451ad9(0x19c)],_0x451ad9(0x14d),_0xacfe5c[_0x451ad9(0x18c)],_0x561cf0):{'diagnostic':_0x561cf0,'socketPath':_0xacfe5c[_0x451ad9(0x18c)],'state':_0x451ad9(0x1bb)};}},_0x50b7de=async()=>{const _0x1af98a=_0x5761ed;let _0x2432a9=await _0x390264();if(_0x2432a9[_0x1af98a(0x1b8)]==='running')return{..._0x2432a9,'started':!0x1};if(_0x2432a9[_0x1af98a(0x1b8)]!=='stopped')throw M(_0x2432a9);return{...await f({'entry':_0x2f0eb8,'options':_0xacfe5c,'ready':async()=>{const _0x3b993e=_0x1af98a;let _0x3be172=await _0x390264();if(_0x3be172[_0x3b993e(0x1b8)]===_0x3b993e(0x16e))throw F(_0xacfe5c['socketPath']);if(_0x3be172[_0x3b993e(0x1b8)]!==_0x3b993e(0x159))throw M(_0x3be172);return _0x3be172;},'timeoutMs':_0x51707a}),'started':!0x0};},_0x4446db=async()=>{const _0x332f28=_0x5761ed;let _0x351a18=await _0x390264();if(_0x351a18[_0x332f28(0x1b8)]===_0x332f28(0x16e))return{..._0x351a18,'stopped':!0x1};if(_0x351a18['state']!==_0x332f28(0x159)&&!A(_0x351a18))throw M(_0x351a18);try{await p(_0xacfe5c[_0x332f28(0x18c)],T,null,_0x53e6c1);}catch(_0x44c1bd){if(!I(_0x44c1bd))throw _0x44c1bd;}return await P(_0x390264,_0xfe5246),{..._0x548784(),'stopped':!0x0};};return{async 'restart'(){const _0x426ab8=_0x5761ed;let _0xae786b=await _0x390264();if(_0xae786b['state']!=='running'&&_0xae786b[_0x426ab8(0x1b8)]!==_0x426ab8(0x16e)&&!A(_0xae786b))throw M(_0xae786b);(_0xae786b[_0x426ab8(0x1b8)]===_0x426ab8(0x159)||A(_0xae786b))&&await _0x4446db();let _0x29da43=await _0x50b7de(),_0x106f17=_0xae786b[_0x426ab8(0x1b8)]==='running'?_0xae786b[_0x426ab8(0x1b1)]:A(_0xae786b)?_0xae786b[_0x426ab8(0x155)]['pid']:void 0x0;return{'identity':_0x29da43['identity'],'pid':_0x29da43[_0x426ab8(0x1b1)],..._0x106f17===void 0x0?{}:{'previousPid':_0x106f17},'restarted':_0xae786b['state']!=='stopped','protocolVersion':_0x29da43[_0x426ab8(0x164)],'socketPath':_0x29da43[_0x426ab8(0x18c)],'startedAt':_0x29da43[_0x426ab8(0x1be)],'state':_0x426ab8(0x159)};},'start':_0x50b7de,'status':_0x390264,'stop':_0x4446db};}function A(_0x4ec6c5){const _0x479c3d=_0x28408b;return _0x4ec6c5[_0x479c3d(0x1b8)]==='incompatible'&&_0x4ec6c5[_0x479c3d(0x155)]!==void 0x0&&(_0x4ec6c5[_0x479c3d(0x1a7)]==='version-mismatch'||_0x4ec6c5[_0x479c3d(0x1a7)]==='build-id-mismatch');}function te(_0x157d56,_0x397141){const _0x3bf41b=_0x28408b;if(_0x397141[_0x3bf41b(0x164)]!==0x1)return'protocol-mismatch';if(_0x397141['identity']['id']!==_0x157d56['id'])return _0x3bf41b(0x17e);if(_0x397141[_0x3bf41b(0x19c)][_0x3bf41b(0x168)]!==_0x157d56['version'])return _0x3bf41b(0x1ab);if(_0x157d56[_0x3bf41b(0x166)]!==void 0x0&&_0x397141[_0x3bf41b(0x19c)][_0x3bf41b(0x166)]!==_0x157d56[_0x3bf41b(0x166)])return _0x3bf41b(0x15c);}function ne(_0x5c22c7,_0x10031a,_0x564835,_0x3b9273){const _0xfc271=_0x28408b;return{'actual':{'identity':_0x10031a[_0xfc271(0x19c)],'pid':_0x10031a[_0xfc271(0x1b1)],'protocolVersion':_0x10031a[_0xfc271(0x164)],'socketPath':_0x10031a[_0xfc271(0x18c)],'startedAt':_0x10031a[_0xfc271(0x1be)]},'expected':{'identity':_0x5c22c7,'protocolVersion':0x1},'reason':_0x564835,'socketPath':_0x3b9273,'state':_0xfc271(0x1b5)};}function j(_0x347a1c,_0x2e7d58,_0x6c93fa,_0xbbbce0){return{'diagnostic':_0xbbbce0,'expected':{'identity':_0x347a1c,'protocolVersion':0x1},'reason':_0x2e7d58,'socketPath':_0x6c93fa,'state':'incompatible'};}function M(_0x30ecd6){const _0x13b118=_0x28408b;let _0x7ceb9c=_0x30ecd6[_0x13b118(0x1b8)]===_0x13b118(0x1b5)?_0x30ecd6['reason']:_0x30ecd6[_0x13b118(0x1a0)][_0x13b118(0x1b6)];return R(_0x30ecd6[_0x13b118(0x1b8)]===_0x13b118(0x1b5)?_0x13b118(0x1af):_0x13b118(0x158),_0x13b118(0x18f)+_0x7ceb9c);}function N(_0xf62aa,_0x460368){const _0xaa4e25=_0x28408b;if(!B(_0xf62aa)||_0xf62aa[_0xaa4e25(0x1b8)]!==_0xaa4e25(0x159)||_0xf62aa[_0xaa4e25(0x18c)]!==_0x460368||!x(_0xf62aa[_0xaa4e25(0x19c)])||typeof _0xf62aa[_0xaa4e25(0x1b1)]!=_0xaa4e25(0x156)||!Number['isSafeInteger'](_0xf62aa[_0xaa4e25(0x1b1)])||_0xf62aa[_0xaa4e25(0x1b1)]<=0x0||typeof _0xf62aa[_0xaa4e25(0x164)]!=_0xaa4e25(0x156)||!Number[_0xaa4e25(0x16b)](_0xf62aa[_0xaa4e25(0x164)])||_0xf62aa[_0xaa4e25(0x164)]<=0x0||typeof _0xf62aa[_0xaa4e25(0x1be)]!=_0xaa4e25(0x190)||Number[_0xaa4e25(0x1b9)](Date[_0xaa4e25(0x195)](_0xf62aa['startedAt'])))throw R('DAEMON_CONTROL_INVALID_RESPONSE',_0xaa4e25(0x176));return{'identity':_0xf62aa['identity'],'pid':_0xf62aa[_0xaa4e25(0x1b1)],'protocolVersion':_0xf62aa[_0xaa4e25(0x164)],'socketPath':_0x460368,'startedAt':_0xf62aa[_0xaa4e25(0x1be)],'state':_0xaa4e25(0x159)};}async function P(_0xc4ff13,_0x400c64){const _0x3ebf8a=_0x28408b;let _0xd7f2b6=Date[_0x3ebf8a(0x152)]();for(;Date[_0x3ebf8a(0x152)]()-_0xd7f2b6<_0x400c64;){if((await _0xc4ff13())[_0x3ebf8a(0x1b8)]==='stopped')return;await new Promise(_0x36d318=>setTimeout(_0x36d318,O));}throw R(_0x3ebf8a(0x162),'Daemon\x20did\x20not\x20stop\x20within\x20'+String(_0x400c64)+'ms');}function F(_0x36e294){const _0x1a5465=_0x28408b;return Object[_0x1a5465(0x1bd)](Error(_0x1a5465(0x19d)+_0x36e294),{'code':_0x1a5465(0x16f)});}function I(_0x2f0698){const _0x5aaf42=_0x28408b;return h(_0x2f0698)||B(_0x2f0698)&&(_0x2f0698[_0x5aaf42(0x15d)]==='DAEMON_CONNECTION_CLOSED'||_0x2f0698['code']===_0x5aaf42(0x167)||_0x2f0698[_0x5aaf42(0x15d)]===_0x5aaf42(0x16a)||_0x2f0698[_0x5aaf42(0x15d)]==='EPIPE');}function L(_0x208d0f){const _0x30b722=_0x28408b;let _0x14466f=_0x208d0f instanceof Error?_0x208d0f[_0x30b722(0x1b6)]:String(_0x208d0f);return B(_0x208d0f)&&typeof _0x208d0f['code']==_0x30b722(0x190)?{'code':_0x208d0f[_0x30b722(0x15d)],'message':_0x14466f}:{'message':_0x14466f};}function R(_0x1d5c55,_0x51d1a3){return Object['assign'](Error(_0x51d1a3),{'code':_0x1d5c55});}function _0x2d5e(){const _0xbca5ab=['destroy','43290EGgsoG','shutdown','ignore','parse','href','type','startsWith','identity.version','trim','Daemon\x20server\x20has\x20not\x20started\x20listening','identity','Daemon\x20is\x20not\x20listening\x20on\x20','9EBdhzG','DAEMON_CONNECTION_CLOSED','diagnostic','startTimeoutMs','connect','\x20is\x20already\x20registered','env','ENOENT','set','reason','DAEMON_METHOD_NOT_FOUND','DAEMON_ALREADY_RUNNING','Daemon\x20server\x20is\x20closed','version-mismatch','620sNgMmo','\x20must\x20not\x20be\x20empty','close','DAEMON_INCOMPATIBLE','protocol','pid','Daemon\x20method\x20must\x20not\x20be\x20empty','Daemon\x20handlers\x20must\x20be\x20registered\x20before\x20listen()','error','incompatible','message','stopTimeoutMs','state','isNaN','identity.id','unreachable','payload','assign','startedAt','method','23944uRgTTu','stringify','Invalid\x20daemon\x20request','toString','exitCode','write','requestTimeoutMs','length','invalid-health','unknown','isArray','listen','daemon.shutdown','now','isSocket','has','actual','number','unref','DAEMON_UNREACHABLE','running','daemon.','result','build-id-mismatch','code','entry','off','\x20must\x20be\x20a\x20finite\x20positive\x20number','Unknown\x20daemon\x20method\x20','DAEMON_STOP_TIMEOUT','name','protocolVersion','push','buildId','ECONNRESET','version','10713784ybmAKI','ENOTCONN','isSafeInteger','file:','toISOString','stopped','ECONNREFUSED','socketPath\x20must\x20not\x20be\x20empty','identity.buildId','Invalid\x20daemon\x20response','Daemon\x20request\x20timed\x20out\x20after\x20','A\x20daemon\x20is\x20already\x20listening\x20on\x20','DAEMON_INVALID_REQUEST','Daemon\x20status\x20response\x20is\x20invalid','ready','indexOf','data','3057999TiMHGw','timeoutMs','Error','once','identity-mismatch','EADDRINUSE','status','onShutdown','end','UNIVER_CLI_SDK_DAEMON_SOCKET','4758378XTZxKH','slice','legacy-protocol','options','catch','2196154RLsksu','3295374xTXgxw','delete','socketPath','object','Daemon\x20method\x20','Daemon\x20is\x20not\x20ready:\x20','string'];_0x2d5e=function(){return _0xbca5ab;};return _0x2d5e();}function z(_0x492615,_0x5f3de){const _0x460c5e=_0x28408b;if(!Number['isFinite'](_0x492615)||_0x492615<=0x0)throw Error(_0x5f3de+_0x460c5e(0x160));}function B(_0x336f98){const _0x4ba155=_0x28408b;return typeof _0x336f98==_0x4ba155(0x18d)&&!!_0x336f98&&!Array[_0x4ba155(0x14f)](_0x336f98);}function V(_0x3b650e){const _0x21dbb0=_0x28408b;let _0x419adb=_0x3b650e[_0x21dbb0(0x14b)]??0x7530,_0x2dd270=k(_0x3b650e),_0x50c6c0,_0x3f9c87=async()=>{const _0x14543d=_0x21dbb0;let _0x1d1caa=await _0x2dd270['status']();if(_0x1d1caa[_0x14543d(0x1b8)]===_0x14543d(0x159))return _0x1d1caa;if(_0x1d1caa['state']!==_0x14543d(0x16e))throw M(_0x1d1caa);let _0x3e0805=_0x50c6c0??=_0x2dd270['start']();try{return await _0x3e0805;}finally{_0x50c6c0===_0x3e0805&&(_0x50c6c0=void 0x0);}};return{async 'request'(_0x3e0f45,_0xb0599){const _0x22f636=_0x21dbb0;if(_0x3e0f45['length']===0x0)throw Error(_0x22f636(0x1b2));await _0x3f9c87();try{return await p(_0x3b650e[_0x22f636(0x18c)],_0x3e0f45,_0xb0599,_0x419adb);}catch(_0x2cd50f){if(!h(_0x2cd50f))throw _0x2cd50f;}return await _0x3f9c87(),await p(_0x3b650e[_0x22f636(0x18c)],_0x3e0f45,_0xb0599,_0x419adb);}};}function H(_0x7ef49a){const _0x4b0209=_0x28408b;oe(_0x7ef49a[_0x4b0209(0x18c)]),b(_0x7ef49a[_0x4b0209(0x19c)]);let _0x5a4884=new Map(),_0x1b9b2c=new Set(),_0x3de7f2,_0x328411=!0x1,_0xd48e34,_0x61e906,_0x4b951a={async 'close'(){_0xd48e34??=_0x1484a1(),await _0xd48e34;},'handle'(_0x17c459,_0x561f38){const _0x36cf94=_0x4b0209;if(_0x328411)throw Error(_0x36cf94(0x1b3));if(_0x17c459[_0x36cf94(0x14c)]===0x0)throw Error('Daemon\x20method\x20must\x20not\x20be\x20empty');if(E(_0x17c459))throw Error('Daemon\x20method\x20namespace\x20is\x20reserved:\x20'+_0x17c459);if(_0x5a4884[_0x36cf94(0x154)](_0x17c459))throw Error(_0x36cf94(0x18e)+_0x17c459+_0x36cf94(0x1a3));_0x5a4884[_0x36cf94(0x1a6)](_0x17c459,_0x561f38);},async 'listen'(){const _0x985d8b=_0x4b0209;if(!_0x328411){if(_0xd48e34)throw Error(_0x985d8b(0x1aa));await _0x1ec961(_0x364e6f(_0x7ef49a[_0x985d8b(0x18c)]),{'recursive':!0x0}),await Y(_0x7ef49a[_0x985d8b(0x18c)]),_0x3de7f2=_0x10fcf5(_0x305ef9=>U(_0x305ef9,_0x5a4884,_0x1b9b2c,{'shutdown':()=>{const _0x4f945b=_0x985d8b;_0x4b951a['close']()[_0x4f945b(0x188)](()=>{const _0x256c23=_0x4f945b;process[_0x256c23(0x149)]=0x1;});},'status':()=>G(_0x7ef49a['identity'],_0x7ef49a[_0x985d8b(0x18c)],_0x61e906)})),await new Promise((_0x4b9cfe,_0x3f36f5)=>{const _0x27d8dc=_0x985d8b;let _0x25109d=_0x3de7f2,_0x4ca27b=_0x4eb259=>_0x3f36f5(ae(_0x4eb259)?Z(_0x7ef49a[_0x27d8dc(0x18c)]):_0x4eb259);_0x25109d['once'](_0x27d8dc(0x1b4),_0x4ca27b),_0x25109d[_0x27d8dc(0x150)](_0x7ef49a[_0x27d8dc(0x18c)],()=>{const _0x15f7f6=_0x27d8dc;_0x25109d[_0x15f7f6(0x15f)](_0x15f7f6(0x1b4),_0x4ca27b),_0x328411=!0x0,_0x61e906=new Date()[_0x15f7f6(0x16d)](),_0x4b9cfe();});});}}};return _0x4b951a;async function _0x1484a1(){const _0x552eaf=_0x4b0209;for(let _0x2955e1 of _0x1b9b2c)_0x2955e1[_0x552eaf(0x191)]();_0x1b9b2c['clear'](),_0x3de7f2&&_0x328411&&await new Promise((_0x59b82b,_0x3326f0)=>{const _0x33f6b4=_0x552eaf;_0x3de7f2[_0x33f6b4(0x1ae)](_0x517ba1=>_0x517ba1?_0x3326f0(_0x517ba1):_0x59b82b());}),_0x328411=!0x1;try{await _0x7ef49a[_0x552eaf(0x181)]?.();}finally{await re(_0x7ef49a[_0x552eaf(0x18c)]);}}}function U(_0x7ce50a,_0x560f2e,_0x3e52ab,_0x52d5d3){const _0x2747d6=_0x28408b;_0x3e52ab['add'](_0x7ce50a);let _0x4ea98d=!0x1,_0x1e9ee3=u(_0x2017c6=>{_0x4ea98d||(_0x4ea98d=!0x0,W(_0x7ce50a,_0x2017c6,_0x560f2e,_0x52d5d3));});_0x7ce50a['on'](_0x2747d6(0x179),_0x20c026=>_0x1e9ee3[_0x2747d6(0x165)](_0x20c026)),_0x7ce50a['on'](_0x2747d6(0x182),()=>_0x1e9ee3[_0x2747d6(0x182)]()),_0x7ce50a['on'](_0x2747d6(0x1ae),()=>_0x3e52ab[_0x2747d6(0x18b)](_0x7ce50a)),_0x7ce50a['on']('error',()=>_0x7ce50a['destroy']());}async function W(_0x22f9ad,_0xd90a97,_0x46c4aa,_0x179021){const _0x3aca9f=_0x28408b;let _0x381c63=_0x3aca9f(0x14e),_0xf61e33,_0x101587=!0x1;try{let _0x17b955=K(_0xd90a97);_0x381c63=_0x17b955['id'];let _0x306cbd;if(_0x17b955[_0x3aca9f(0x1bf)]==='daemon.status'){let _0x1c6e29=_0x179021[_0x3aca9f(0x180)]();_0x306cbd={'identity':{..._0x1c6e29['identity'][_0x3aca9f(0x166)]===void 0x0?{}:{'buildId':_0x1c6e29[_0x3aca9f(0x19c)][_0x3aca9f(0x166)]},'id':_0x1c6e29[_0x3aca9f(0x19c)]['id'],'version':_0x1c6e29['identity'][_0x3aca9f(0x168)]},'pid':_0x1c6e29['pid'],'protocolVersion':_0x1c6e29[_0x3aca9f(0x164)],'socketPath':_0x1c6e29[_0x3aca9f(0x18c)],'startedAt':_0x1c6e29['startedAt'],'state':_0x1c6e29[_0x3aca9f(0x1b8)]};}else{if(_0x17b955[_0x3aca9f(0x1bf)]===_0x3aca9f(0x151))_0x306cbd=null,_0x101587=!0x0;else{let _0x154a0d=_0x46c4aa['get'](_0x17b955['method']);if(!_0x154a0d)throw J(_0x3aca9f(0x1a8),_0x3aca9f(0x161)+_0x17b955[_0x3aca9f(0x1bf)]);_0x306cbd=await _0x154a0d(_0x17b955[_0x3aca9f(0x1bc)]);}}_0xf61e33={'id':_0x381c63,'result':_0x306cbd,'type':_0x3aca9f(0x15b)};}catch(_0x509ecb){_0xf61e33={'error':q(_0x509ecb),'id':_0x381c63,'type':_0x3aca9f(0x1b4)};}_0x22f9ad[_0x3aca9f(0x182)](l(_0xf61e33),()=>{const _0x2a4a33=_0x3aca9f;_0x101587&&_0x179021[_0x2a4a33(0x193)]();});}function G(_0x1505df,_0x582ffc,_0x544227){const _0xfa26e2=_0x28408b;if(_0x544227===void 0x0)throw Error(_0xfa26e2(0x19b));return{'identity':_0x1505df,'pid':process[_0xfa26e2(0x1b1)],'protocolVersion':0x1,'socketPath':_0x582ffc,'startedAt':_0x544227,'state':_0xfa26e2(0x159)};}function K(_0x15d02f){const _0x4124e1=_0x28408b;let _0x4a7660=JSON['parse'](_0x15d02f);if(!$(_0x4a7660)||typeof _0x4a7660['id']!=_0x4124e1(0x190)||typeof _0x4a7660['method']!='string'||!('payload'in _0x4a7660))throw J(_0x4124e1(0x175),_0x4124e1(0x147));return _0x4a7660;}function q(_0x5f0495){const _0x833bf4=_0x28408b;if(_0x5f0495 instanceof Error){let _0xb5897c=_0x5f0495[_0x833bf4(0x15d)];return{...typeof _0xb5897c=='string'?{'code':_0xb5897c}:{},'message':_0x5f0495[_0x833bf4(0x1b6)],'name':_0x5f0495[_0x833bf4(0x163)]};}return{'message':String(_0x5f0495),'name':_0x833bf4(0x17c)};}function J(_0x367a44,_0x28294a){const _0x71f4be=_0x28408b;return Object[_0x71f4be(0x1bd)](Error(_0x28294a),{'code':_0x367a44});}async function Y(_0x12607d){const _0x124d8f=_0x28408b;try{if(!(await _0x1152d7(_0x12607d))[_0x124d8f(0x153)]())throw Error('Refusing\x20to\x20replace\x20non-socket\x20path\x20'+_0x12607d);if(await X(_0x12607d))throw Z(_0x12607d);await _0x1de755(_0x12607d);}catch(_0x182ed7){if(Q(_0x182ed7))return;throw _0x182ed7;}}function X(_0x28350b){return new Promise((_0x312784,_0x3cc645)=>{const _0x394559=_0x31e2;let _0x4b1da1=_0x25d23b(_0x28350b);_0x4b1da1[_0x394559(0x17d)]('connect',()=>{_0x4b1da1['destroy'](),_0x312784(!0x0);}),_0x4b1da1[_0x394559(0x17d)]('error',_0x39506d=>{_0x4b1da1['destroy'](),ie(_0x39506d)||Q(_0x39506d)?_0x312784(!0x1):_0x3cc645(_0x39506d);});});}function Z(_0x569a75){const _0x2811ca=_0x28408b;return Object['assign'](Error(_0x2811ca(0x174)+_0x569a75),{'code':_0x2811ca(0x1a9)});}async function re(_0x1c0368){try{(await _0x1152d7(_0x1c0368))['isSocket']()&&await _0x1de755(_0x1c0368);}catch(_0x506ddd){if(!Q(_0x506ddd))throw _0x506ddd;}}function Q(_0x1c791d){const _0x270bad=_0x28408b;return $(_0x1c791d)&&_0x1c791d[_0x270bad(0x15d)]===_0x270bad(0x1a5);}function ie(_0x354b44){const _0x1841c0=_0x28408b;return $(_0x354b44)&&_0x354b44[_0x1841c0(0x15d)]===_0x1841c0(0x16f);}function ae(_0x2e218b){const _0xe035ad=_0x28408b;return $(_0x2e218b)&&_0x2e218b['code']===_0xe035ad(0x17f);}function oe(_0x592127){const _0x537a30=_0x28408b;if(_0x592127[_0x537a30(0x14c)]===0x0)throw Error(_0x537a30(0x170));}function $(_0x5e27e1){const _0x6f1a5e=_0x28408b;return typeof _0x5e27e1==_0x6f1a5e(0x18d)&&!!_0x5e27e1&&!Array[_0x6f1a5e(0x14f)](_0x5e27e1);}export{C as DAEMON_PROTOCOL_VERSION,T as DAEMON_SHUTDOWN_METHOD,d as DAEMON_SOCKET_ENV,w as DAEMON_STATUS_METHOD,V as createDaemonClient,k as createDaemonControl,H as createDaemonServer};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univer-cli/daemon",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",