@wujie-shell/core 1.0.0 → 2.0.0

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.
@@ -0,0 +1 @@
1
+ const _0xf42e53=_0x18a6;(function(_0x1587fe,_0x1cdc44){const _0x54278b=_0x18a6,_0x5535dd=_0x1587fe();while(!![]){try{const _0x4550f0=parseInt(_0x54278b(0xf0))/0x1*(-parseInt(_0x54278b(0xed))/0x2)+parseInt(_0x54278b(0xf3))/0x3*(-parseInt(_0x54278b(0xea))/0x4)+parseInt(_0x54278b(0xeb))/0x5*(parseInt(_0x54278b(0xf8))/0x6)+parseInt(_0x54278b(0xf1))/0x7*(parseInt(_0x54278b(0xf6))/0x8)+-parseInt(_0x54278b(0xf2))/0x9+parseInt(_0x54278b(0xe8))/0xa*(parseInt(_0x54278b(0xf7))/0xb)+-parseInt(_0x54278b(0xee))/0xc;if(_0x4550f0===_0x1cdc44)break;else _0x5535dd['push'](_0x5535dd['shift']());}catch(_0x2c6009){_0x5535dd['push'](_0x5535dd['shift']());}}}(_0x40a8,0xeb83d));import{join}from'node:path';import{readJson,writeJson}from'./utils.mjs';const STORE_FILE='product-'+'preferen'+_0xf42e53(0xf5);function storePath(_0x3dfce8){return join(_0x3dfce8,STORE_FILE);}export function createProductPreferencesStore({stateDir:_0x10ae46}){async function _0x96696e(){return readJson(storePath(_0x10ae46),{});}async function _0xb1c81d(_0x3597f3,_0x1bf46b=null){const _0x130ecf=_0x18a6,_0x414c17=await _0x96696e();return Object[_0x130ecf(0xec)+'e'][_0x130ecf(0xef)+_0x130ecf(0xe9)][_0x130ecf(0xf4)](_0x414c17,_0x3597f3)?_0x414c17[_0x3597f3]:_0x1bf46b;}async function _0x20e32c(_0x40d745,_0x391f2a){const _0x149001=await _0x96696e(),_0x5558d4={..._0x149001,[_0x40d745]:_0x391f2a};return await writeJson(storePath(_0x10ae46),_0x5558d4),{'ok':!![],'key':_0x40d745,'value':_0x391f2a};}return{'read':_0x96696e,'get':_0xb1c81d,'set':_0x20e32c};}function _0x18a6(_0x26aacb,_0x5b6934){_0x26aacb=_0x26aacb-0xe8;const _0x40a853=_0x40a8();let _0x18a628=_0x40a853[_0x26aacb];return _0x18a628;}function _0x40a8(){const _0x5ed99d=['1601805BdWVvF','call','ces.json','528fPWruL','11StNARX','146922xyZrSt','6158030NaxrEk','operty','8CeHtdn','365Lpaxrm','prototyp','737606hQxePv','10784844ONiWnA','hasOwnPr','3ffeTeX','173495wnMHDH','13311dcHXbq'];_0x40a8=function(){return _0x5ed99d;};return _0x40a8();}
@@ -1 +1 @@
1
- function _0x1939(){const _0x2af7dc=['dAt','projectR','dataDir','logsDir','isArray','4581832EnYonR','openclaw','length','runtime','oot','pluginSp','6MTMZyp','23628708RCPErQ','set','productN','35574UIZaCs','Version','ame','workflow','logsDirN','ecs','dataDirN','ginPaths','resolved','logger','2855388aCnsse','generate','ath','has','wujiecla','532930WZnbwy','14DYUrFb','10CuBZva','ion','plugins','get','agents','1359134Lfgbah','6272588rxcPqR','skillsDi'];_0x1939=function(){return _0x2af7dc;};return _0x1939();}(function(_0x43a240,_0x1f0f54){const _0x2bbf7b=_0x1ebf,_0x4b5f42=_0x43a240();while(!![]){try{const _0x38f185=-parseInt(_0x2bbf7b(0x18d))/0x1+-parseInt(_0x2bbf7b(0x187))/0x2*(-parseInt(_0x2bbf7b(0x177))/0x3)+parseInt(_0x2bbf7b(0x181))/0x4+parseInt(_0x2bbf7b(0x186))/0x5+-parseInt(_0x2bbf7b(0x173))/0x6*(parseInt(_0x2bbf7b(0x18e))/0x7)+-parseInt(_0x2bbf7b(0x195))/0x8+parseInt(_0x2bbf7b(0x174))/0x9*(parseInt(_0x2bbf7b(0x188))/0xa);if(_0x38f185===_0x1f0f54)break;else _0x4b5f42['push'](_0x4b5f42['shift']());}catch(_0x5b9acf){_0x4b5f42['push'](_0x4b5f42['shift']());}}}(_0x1939,0xab1e8));function _0x1ebf(_0x2d902d,_0x5954c8){_0x2d902d=_0x2d902d-0x173;const _0x19395b=_0x1939();let _0x1ebfd6=_0x19395b[_0x2d902d];return _0x1ebfd6;}import{join}from'node:path';import{createFileLogger}from'@wujie-shell/logger';const RUNTIME_LOG_MAX_BYTES=0x2*0x400*0x400,RUNTIME_LOG_KEEP_COUNT=0x5,runtimeLoggers=new Map();export function createRuntimeLogger(_0x148361,_0x36e03='runtime'){const _0x565f4d=_0x1ebf,_0x3b4167=_0x148361?.['logsDir'];if(!_0x3b4167)return null;const _0x39420b=join(_0x3b4167,_0x565f4d(0x198),'runtime.'+'log'),_0x1e5821=_0x39420b+':'+_0x36e03;return!runtimeLoggers[_0x565f4d(0x184)](_0x1e5821)&&runtimeLoggers[_0x565f4d(0x175)](_0x1e5821,createFileLogger({'filePath':_0x39420b,'context':_0x36e03,'maxBytes':RUNTIME_LOG_MAX_BYTES,'keepCount':RUNTIME_LOG_KEEP_COUNT})),runtimeLoggers[_0x565f4d(0x18b)](_0x1e5821);}export function summarizeShellConfig(_0xdb1f1f){const _0x349498=_0x1ebf;return{'appId':_0xdb1f1f['appId'],'productName':_0xdb1f1f[_0x349498(0x176)+'ame'],'projectRoot':_0xdb1f1f[_0x349498(0x191)+_0x349498(0x199)],'dataDir':_0xdb1f1f[_0x349498(0x192)],'dataDirName':_0xdb1f1f[_0x349498(0x17d)+_0x349498(0x179)],'logsDirName':_0xdb1f1f[_0x349498(0x180)]?.[_0x349498(0x17b)+_0x349498(0x179)],'logsDir':_0xdb1f1f['logger']?.[_0x349498(0x193)],'openclawVersion':_0xdb1f1f[_0x349498(0x196)]?.[_0x349498(0x196)+'Version'],'nodeVersion':_0xdb1f1f[_0x349498(0x196)]?.['nodeVers'+_0x349498(0x189)],'pluginSpecCount':_0xdb1f1f[_0x349498(0x196)]?.['pluginSp'+_0x349498(0x17c)]?.[_0x349498(0x197)]??0x0,'localPluginCount':_0xdb1f1f[_0x349498(0x196)]?.[_0x349498(0x17f)+'LocalPlu'+_0x349498(0x17e)]?.['length']??0x0,'agentsDir':_0xdb1f1f[_0x349498(0x196)]?.['agentsDi'+'r'],'skillsDir':_0xdb1f1f[_0x349498(0x196)]?.[_0x349498(0x18f)+'r'],'workflowsDir':_0xdb1f1f[_0x349498(0x196)]?.[_0x349498(0x17a)+'sDir']};}export function summarizeRuntimeManifest(_0x249310){const _0x302203=_0x1ebf;return{'generatedAt':_0x249310?.[_0x302203(0x182)+_0x302203(0x190)],'openclawVersion':_0x249310?.['openclaw'+_0x302203(0x178)],'nodeVersion':_0x249310?.['nodeVers'+_0x302203(0x189)],'pluginCount':Array[_0x302203(0x194)](_0x249310?.[_0x302203(0x18a)])?_0x249310[_0x302203(0x18a)][_0x302203(0x197)]:0x0,'pluginSpecCount':Array[_0x302203(0x194)](_0x249310?.['pluginSp'+_0x302203(0x17c)])?_0x249310[_0x302203(0x19a)+'ecs'][_0x302203(0x197)]:0x0,'agentsInstallPath':_0x249310?.[_0x302203(0x18c)]?.['installP'+'ath'],'skillsInstallPath':_0x249310?.['skills']?.['installP'+_0x302203(0x183)],'wujieclawBin':_0x249310?.[_0x302203(0x185)+'wBin'],'product':_0x249310?.['product']};}
1
+ (function(_0x20eb6f,_0x124f1a){const _0x4706f8=_0x1cd6,_0xb39604=_0x20eb6f();while(!![]){try{const _0x2dc887=-parseInt(_0x4706f8(0x183))/0x1*(-parseInt(_0x4706f8(0x173))/0x2)+parseInt(_0x4706f8(0x179))/0x3*(-parseInt(_0x4706f8(0x16c))/0x4)+parseInt(_0x4706f8(0x167))/0x5+-parseInt(_0x4706f8(0x169))/0x6+parseInt(_0x4706f8(0x181))/0x7+parseInt(_0x4706f8(0x186))/0x8*(-parseInt(_0x4706f8(0x185))/0x9)+-parseInt(_0x4706f8(0x178))/0xa;if(_0x2dc887===_0x124f1a)break;else _0xb39604['push'](_0xb39604['shift']());}catch(_0x2ca428){_0xb39604['push'](_0xb39604['shift']());}}}(_0x52e5,0x28b0e));function _0x1cd6(_0x202a7f,_0x5195ce){_0x202a7f=_0x202a7f-0x167;const _0x52e506=_0x52e5();let _0x1cd6b0=_0x52e506[_0x202a7f];return _0x1cd6b0;}import{join}from'node:path';import{createFileLogger}from'@wujie-shell/logger';const RUNTIME_LOG_MAX_BYTES=0x2*0x400*0x400,RUNTIME_LOG_KEEP_COUNT=0x5,runtimeLoggers=new Map();export function createRuntimeLogger(_0x2f914e,_0x46d999='runtime'){const _0x249861=_0x1cd6,_0x1d0e71=_0x2f914e?.['logsDir'];if(!_0x1d0e71)return null;const _0x103340=join(_0x1d0e71,_0x249861(0x18c),'runtime.'+_0x249861(0x190)),_0x90c11a=_0x103340+':'+_0x46d999;return!runtimeLoggers[_0x249861(0x17a)](_0x90c11a)&&runtimeLoggers[_0x249861(0x180)](_0x90c11a,createFileLogger({'filePath':_0x103340,'context':_0x46d999,'maxBytes':RUNTIME_LOG_MAX_BYTES,'keepCount':RUNTIME_LOG_KEEP_COUNT})),runtimeLoggers[_0x249861(0x17d)](_0x90c11a);}export function summarizeShellConfig(_0x36c93e){const _0xa26e20=_0x1cd6;return{'appId':_0x36c93e['appId'],'productName':_0x36c93e[_0xa26e20(0x174)+_0xa26e20(0x18b)],'projectRoot':_0x36c93e[_0xa26e20(0x18f)+_0xa26e20(0x16f)],'dataDir':_0x36c93e['dataDir'],'dataDirName':_0x36c93e[_0xa26e20(0x17f)+_0xa26e20(0x18b)],'logsDirName':_0x36c93e['logger']?.['logsDirN'+'ame'],'logsDir':_0x36c93e['logger']?.[_0xa26e20(0x18e)],'openclawVersion':_0x36c93e['openclaw']?.[_0xa26e20(0x188)+_0xa26e20(0x171)],'nodeVersion':_0x36c93e[_0xa26e20(0x188)]?.[_0xa26e20(0x175)+_0xa26e20(0x18a)],'pluginSpecCount':_0x36c93e['openclaw']?.[_0xa26e20(0x189)+'ecs']?.[_0xa26e20(0x182)]??0x0,'localPluginCount':_0x36c93e['openclaw']?.[_0xa26e20(0x187)+_0xa26e20(0x176)+_0xa26e20(0x16a)]?.['length']??0x0,'agentsDir':_0x36c93e['openclaw']?.['agentsDi'+'r'],'skillsDir':_0x36c93e[_0xa26e20(0x188)]?.[_0xa26e20(0x177)+'r'],'workflowsDir':_0x36c93e[_0xa26e20(0x188)]?.[_0xa26e20(0x18d)+_0xa26e20(0x184)]};}export function summarizeRuntimeManifest(_0x232481){const _0xde283f=_0x1cd6;return{'generatedAt':_0x232481?.['generate'+_0xde283f(0x170)],'openclawVersion':_0x232481?.[_0xde283f(0x188)+_0xde283f(0x171)],'nodeVersion':_0x232481?.[_0xde283f(0x175)+_0xde283f(0x18a)],'pluginCount':Array[_0xde283f(0x17e)](_0x232481?.[_0xde283f(0x172)])?_0x232481[_0xde283f(0x172)][_0xde283f(0x182)]:0x0,'pluginSpecCount':Array[_0xde283f(0x17e)](_0x232481?.['pluginSp'+_0xde283f(0x16e)])?_0x232481[_0xde283f(0x189)+_0xde283f(0x16e)]['length']:0x0,'agentsInstallPath':_0x232481?.[_0xde283f(0x16d)]?.[_0xde283f(0x16b)+'ath'],'skillsInstallPath':_0x232481?.['skills']?.[_0xde283f(0x16b)+'ath'],'wujieclawBin':_0x232481?.[_0xde283f(0x17b)+_0xde283f(0x17c)],'product':_0x232481?.[_0xde283f(0x168)]};}function _0x52e5(){const _0x242a7e=['ecs','oot','dAt','Version','plugins','44008CkknOH','productN','nodeVers','LocalPlu','skillsDi','358580fhgSkC','93kuYgjL','has','wujiecla','wBin','get','isArray','dataDirN','set','630056YVqcjL','length','14wLFeYX','sDir','9927tQikpD','200fCywLR','resolved','openclaw','pluginSp','ion','ame','runtime','workflow','logsDir','projectR','log','371900vPdNVr','product','1123524YJviMU','ginPaths','installP','7108lERZvS','agents'];_0x52e5=function(){return _0x242a7e;};return _0x52e5();}
@@ -1 +1 @@
1
- const _0x17a6e2=_0x2a9a;(function(_0x4f71aa,_0x5cc382){const _0x2be597=_0x2a9a,_0x403210=_0x4f71aa();while(!![]){try{const _0x44f7ad=parseInt(_0x2be597(0x284))/0x1+-parseInt(_0x2be597(0x1e9))/0x2+-parseInt(_0x2be597(0x302))/0x3*(-parseInt(_0x2be597(0x2b1))/0x4)+parseInt(_0x2be597(0x1cd))/0x5*(-parseInt(_0x2be597(0x1e6))/0x6)+parseInt(_0x2be597(0x27f))/0x7*(parseInt(_0x2be597(0x267))/0x8)+parseInt(_0x2be597(0x1ca))/0x9+-parseInt(_0x2be597(0x1f5))/0xa*(parseInt(_0x2be597(0x273))/0xb);if(_0x44f7ad===_0x5cc382)break;else _0x403210['push'](_0x403210['shift']());}catch(_0x17d125){_0x403210['push'](_0x403210['shift']());}}}(_0x4be1,0xd76b9));import{existsSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,rename,rm,symlink,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{fileURLToPath}from'node:url';import{spawn}from'node:child_process';import{get}from'node:https';import{pipeline}from'node:stream/promises';function _0x2a9a(_0x420ce4,_0x11bc56){_0x420ce4=_0x420ce4-0x1c0;const _0x4be14f=_0x4be1();let _0x2a9a70=_0x4be14f[_0x420ce4];return _0x2a9a70;}import{getConfigPaths}from'@wujie-shell/config';import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'./runtime-logger.mjs';const RUNTIME_DIR=_0x17a6e2(0x1e1)+_0x17a6e2(0x2c6),MANIFEST_NAME=_0x17a6e2(0x2b8)+'manifest'+_0x17a6e2(0x304),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x2ae8e2){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x2ae8e2,RUNTIME_DIR);}export function resolveManifestPath(_0x1c96b7){return join(_0x1c96b7,MANIFEST_NAME);}export async function prepareRuntime(_0x359b26,{syncOnly:syncOnly=![]}={}){const _0x459261=_0x17a6e2,_0x2a4045=resolveRuntimeRoot(_0x359b26[_0x459261(0x1fd)+_0x459261(0x268)]),_0x31b096=createRuntimeLogger(getConfigPaths(_0x359b26),_0x459261(0x208)),_0x26c54d=Date[_0x459261(0x2ac)]();_0x31b096?.['info'](_0x459261(0x21e)+_0x459261(0x20f)+_0x459261(0x1c1),{'syncOnly':syncOnly,'runtimeRoot':_0x2a4045,'shellConfig':summarizeShellConfig(_0x359b26)});try{const _0x2c7c82=await ensureRuntimeBase(_0x359b26,_0x2a4045,{'runtimeLogger':_0x31b096,'syncOnly':syncOnly});_0x31b096?.[_0x459261(0x299)]('runtime\x20'+_0x459261(0x2b3)+_0x459261(0x2b5),{'manifestPath':resolveManifestPath(_0x2a4045),'manifest':summarizeRuntimeManifest(_0x2c7c82)}),validateRuntimeNodeVersion(_0x2c7c82,_0x359b26),_0x31b096?.['info'](_0x459261(0x20f)+_0x459261(0x230)+_0x459261(0x29b)+'idated',{'nodeVersion':_0x2c7c82[_0x459261(0x275)+_0x459261(0x2f8)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x2c7c82,_0x359b26),_0x31b096?.[_0x459261(0x299)](_0x459261(0x20f)+_0x459261(0x2ae)+_0x459261(0x2e4)+'\x20validat'+'ed',{'openclawVersion':_0x2c7c82[_0x459261(0x2ae)+_0x459261(0x1c7)]});else{if(_0x2c7c82[_0x459261(0x2ae)+'Version']!==_0x359b26[_0x459261(0x2ae)][_0x459261(0x2ae)+_0x459261(0x1c7)]){const _0x269624=await loadRuntimeInfo(_0x359b26[_0x459261(0x1fd)+_0x459261(0x268)]);_0x31b096?.[_0x459261(0x299)](_0x459261(0x2ae)+_0x459261(0x2d2)+_0x459261(0x2a8)+'\x20started',{'fromVersion':_0x2c7c82[_0x459261(0x2ae)+'Version']||_0x459261(0x1f2),'toVersion':_0x359b26[_0x459261(0x2ae)][_0x459261(0x2ae)+_0x459261(0x1c7)]}),await installOpenClawPackage(_0x269624,_0x359b26[_0x459261(0x2ae)][_0x459261(0x2ae)+_0x459261(0x1c7)]),_0x2c7c82[_0x459261(0x2ae)+'Version']=_0x359b26['openclaw'][_0x459261(0x2ae)+_0x459261(0x1c7)],_0x31b096?.[_0x459261(0x299)](_0x459261(0x2ae)+_0x459261(0x2d2)+_0x459261(0x2a8)+_0x459261(0x1df)+'ed',{'openclawVersion':_0x2c7c82[_0x459261(0x2ae)+_0x459261(0x1c7)]});}}_0x2c7c82['generate'+_0x459261(0x2bd)]=new Date()['toISOStr'+_0x459261(0x24f)](),_0x2c7c82[_0x459261(0x275)+_0x459261(0x2f8)]=_0x359b26['openclaw'][_0x459261(0x275)+_0x459261(0x2f8)],_0x2c7c82[_0x459261(0x2d5)]={'appId':_0x359b26[_0x459261(0x29f)],'productName':_0x359b26[_0x459261(0x204)+'ame'],'dataDirName':_0x359b26['dataDirN'+_0x459261(0x2ea)]};const _0x83ab51=Array[_0x459261(0x21c)](_0x2c7c82['plugins'])?_0x2c7c82[_0x459261(0x2dc)]['length']:0x0;return await syncManifestPluginScope(_0x359b26,_0x2a4045,_0x2c7c82),_0x31b096?.[_0x459261(0x299)](_0x459261(0x20f)+_0x459261(0x27a)+_0x459261(0x2b2)+_0x459261(0x24a),{'beforePluginCount':_0x83ab51,'afterPluginCount':Array['isArray'](_0x2c7c82[_0x459261(0x2dc)])?_0x2c7c82[_0x459261(0x2dc)][_0x459261(0x238)]:0x0,'pluginSpecCount':Array[_0x459261(0x21c)](_0x2c7c82[_0x459261(0x2c4)+'ecs'])?_0x2c7c82[_0x459261(0x2c4)+_0x459261(0x2cb)][_0x459261(0x238)]:0x0}),await syncProductPlugins(_0x359b26,_0x2a4045,_0x2c7c82),_0x31b096?.[_0x459261(0x299)]('product\x20'+_0x459261(0x2e0)+_0x459261(0x2e2),{'localPluginCount':_0x359b26[_0x459261(0x2ae)][_0x459261(0x1d0)+_0x459261(0x2a6)+'ginPaths'][_0x459261(0x238)],'pluginCount':Array[_0x459261(0x21c)](_0x2c7c82['plugins'])?_0x2c7c82[_0x459261(0x2dc)][_0x459261(0x238)]:0x0}),await syncProductAgents(_0x359b26,_0x2a4045,_0x2c7c82),_0x31b096?.[_0x459261(0x299)](_0x459261(0x25e)+_0x459261(0x2c0)+'ynced',{'source':_0x359b26[_0x459261(0x2ae)][_0x459261(0x241)+'r'],'installPath':_0x2c7c82[_0x459261(0x2a0)]?.[_0x459261(0x2d1)+_0x459261(0x2b6)]}),await syncProductSkills(_0x359b26,_0x2a4045,_0x2c7c82),_0x31b096?.['info'](_0x459261(0x25e)+_0x459261(0x211)+_0x459261(0x26a),{'source':_0x359b26[_0x459261(0x2ae)]['skillsDi'+'r'],'installPath':_0x2c7c82[_0x459261(0x21a)]?.[_0x459261(0x2d1)+_0x459261(0x2b6)]}),await syncRuntimeWrapper(_0x359b26,_0x2a4045,_0x2c7c82),_0x31b096?.[_0x459261(0x299)](_0x459261(0x20f)+_0x459261(0x1d3)+_0x459261(0x2e2),{'wujieclawBin':_0x2c7c82[_0x459261(0x23a)+'wBin']}),await writeJson(resolveManifestPath(_0x2a4045),_0x2c7c82),_0x31b096?.[_0x459261(0x299)](_0x459261(0x20f)+_0x459261(0x2b3)+_0x459261(0x2ec),{'manifestPath':resolveManifestPath(_0x2a4045),'manifest':summarizeRuntimeManifest(_0x2c7c82),'durationMs':Date[_0x459261(0x2ac)]()-_0x26c54d}),await _0x31b096?.[_0x459261(0x2ce)](),_0x2c7c82;}catch(_0x127e97){_0x31b096?.['error']('prepare\x20'+'runtime\x20'+'failed',{'syncOnly':syncOnly,'runtimeRoot':_0x2a4045,'durationMs':Date['now']()-_0x26c54d,'error':_0x127e97}),await _0x31b096?.['flush']();throw _0x127e97;}}async function syncRuntimeWrapper(_0x71ce8e,_0x1e1d71,_0x106e0a){const _0xb3b84d=_0x17a6e2,_0x5dd995=join(_0x1e1d71,_0xb3b84d(0x2e8),_0xb3b84d(0x23a)+'w'),_0x15a517=join(_0x1e1d71,_0xb3b84d(0x2e8),_0xb3b84d(0x23a)+'w.cmd'),_0x56c6d8=normalizeRuntimeRelativePath(relative(dirname(_0x5dd995),resolve(_0x1e1d71,_0x106e0a['nodeExec'+'utable']))),_0x4595dc=normalizeRuntimeRelativePath(relative(dirname(_0x5dd995),resolve(_0x1e1d71,_0x106e0a[_0xb3b84d(0x2ae)+_0xb3b84d(0x1d4)]))),_0x353b3b=_0xb3b84d(0x243)+_0x71ce8e[_0xb3b84d(0x2d8)+_0xb3b84d(0x2ea)],_0xde9a60=_0xb3b84d(0x2ad)+_0xb3b84d(0x203)+_0x71ce8e[_0xb3b84d(0x2d8)+_0xb3b84d(0x2ea)];await mkdir(dirname(_0x5dd995),{'recursive':!![]});const _0x17acf8=fileURLToPath(new URL(_0xb3b84d(0x2bc)+_0xb3b84d(0x25d)+_0xb3b84d(0x2e1),import.meta.url)),_0x20644f=join(_0x1e1d71,_0xb3b84d(0x2e8),_0xb3b84d(0x233)+_0xb3b84d(0x1d1));await cp(_0x17acf8,_0x20644f),await writeFile(_0x5dd995,['#!/bin/s'+'h',_0xb3b84d(0x2b9)+_0xb3b84d(0x20b)+_0xb3b84d(0x213)+_0xb3b84d(0x250)+'_HOME:-'+_0x353b3b+'}\x22','export\x20O'+'PENCLAW_'+_0xb3b84d(0x1e8)+_0xb3b84d(0x1f0)+'NCLAW_ST'+_0xb3b84d(0x27d)+'-'+_0x353b3b+'}\x22','export\x20O'+_0xb3b84d(0x20b)+_0xb3b84d(0x2c9)+_0xb3b84d(0x25a)+_0xb3b84d(0x20b)+_0xb3b84d(0x2c9)+'ATH:-'+_0x353b3b+(_0xb3b84d(0x207)+_0xb3b84d(0x22b)),_0xb3b84d(0x285)+_0xb3b84d(0x265)+'ATH=\x20cd\x20'+_0xb3b84d(0x269)+_0xb3b84d(0x301)+'\x20\x22$0\x22)\x22\x20'+_0xb3b84d(0x1ef),_0xb3b84d(0x2ee)+_0xb3b84d(0x1da)+_0xb3b84d(0x1f7)+_0xb3b84d(0x216)+_0xb3b84d(0x1c8)+_0xb3b84d(0x2bb),_0xb3b84d(0x272)+_0xb3b84d(0x1ec)+_0x56c6d8+(_0xb3b84d(0x2a7)+_0xb3b84d(0x2c1)+_0xb3b84d(0x21f)+'o.mjs\x22\x202'+'>/dev/nu'+'ll\x20||\x20tr'+'ue'),'fi',_0xb3b84d(0x249)+_0xb3b84d(0x1f8)+'R/'+_0x56c6d8+(_0xb3b84d(0x2a7)+_0xb3b84d(0x1ec))+_0x4595dc+_0xb3b84d(0x2f6),'']['join']('\x0a'),_0xb3b84d(0x257)),await chmod(_0x5dd995,0x1ed),await writeFile(_0x15a517,['@echo\x20of'+'f','if\x20\x22%OPE'+_0xb3b84d(0x259)+_0xb3b84d(0x1e4)+'\x20set\x20\x22OP'+_0xb3b84d(0x270)+_0xb3b84d(0x2e3)+_0xde9a60+'\x22',_0xb3b84d(0x210)+_0xb3b84d(0x296)+'ATE_DIR%'+_0xb3b84d(0x2dd)+_0xb3b84d(0x1db)+_0xb3b84d(0x281)+_0xb3b84d(0x253)+_0xde9a60+'\x22',_0xb3b84d(0x210)+_0xb3b84d(0x278)+'NFIG_PAT'+_0xb3b84d(0x2be)+_0xb3b84d(0x23b)+_0xb3b84d(0x278)+_0xb3b84d(0x214)+'H='+_0xde9a60+(_0xb3b84d(0x23e)+_0xb3b84d(0x1f6)),_0xb3b84d(0x2d3)+_0xb3b84d(0x2f9)+'%~dp0\x22','\x22%SCRIPT'+'_DIR%'+toWindowsPath(_0x56c6d8)+(_0xb3b84d(0x2fe)+_0xb3b84d(0x25c))+toWindowsPath(_0x4595dc)+_0xb3b84d(0x2c3),''][_0xb3b84d(0x2bf)]('\x0d\x0a'),_0xb3b84d(0x257)),_0x106e0a[_0xb3b84d(0x23a)+_0xb3b84d(0x256)]=toRuntimeRelative(_0x1e1d71,process['platform']===_0xb3b84d(0x24b)?_0x15a517:_0x5dd995);}function normalizeRuntimeRelativePath(_0x55b594){const _0x3d9f60=_0x17a6e2;return _0x55b594[_0x3d9f60(0x20d)+'ll']('\x5c','/');}function toWindowsPath(_0x26485e){const _0x2eb060=_0x17a6e2;return _0x26485e[_0x2eb060(0x20d)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x47cb2f,_0x3b3010){const _0x6edf39=_0x17a6e2;if(_0x47cb2f[_0x6edf39(0x275)+_0x6edf39(0x2f8)]===_0x3b3010[_0x6edf39(0x2ae)][_0x6edf39(0x275)+_0x6edf39(0x2f8)])return;throw new Error(_0x6edf39(0x20f)+_0x6edf39(0x275)+'ion\x20mism'+_0x6edf39(0x1dc)+_0x6edf39(0x24d)+(_0x47cb2f[_0x6edf39(0x275)+_0x6edf39(0x2f8)]||'unknown')+(_0x6edf39(0x1ff)+_0x6edf39(0x2ed))+_0x3b3010[_0x6edf39(0x2ae)][_0x6edf39(0x275)+_0x6edf39(0x2f8)]+'.\x20'+(_0x6edf39(0x2e7)+'ie-shell'+_0x6edf39(0x220)+_0x6edf39(0x27b)+_0x6edf39(0x21d)+_0x6edf39(0x219)+_0x6edf39(0x222)+_0x6edf39(0x263)+_0x6edf39(0x231)+_0x6edf39(0x26c)+'red\x20Node'+_0x6edf39(0x2e4)+'.'));}function validateRuntimeOpenClawVersion(_0x4a06d0,_0x338f20){const _0x1217b7=_0x17a6e2;if(_0x4a06d0['openclaw'+_0x1217b7(0x1c7)]===_0x338f20['openclaw'][_0x1217b7(0x2ae)+'Version'])return;throw new Error(_0x1217b7(0x20f)+_0x1217b7(0x2ae)+_0x1217b7(0x2a5)+_0x1217b7(0x235)+':\x20manife'+'st='+(_0x4a06d0['openclaw'+_0x1217b7(0x1c7)]||'unknown')+(_0x1217b7(0x1ff)+_0x1217b7(0x2ed))+_0x338f20[_0x1217b7(0x2ae)]['openclaw'+_0x1217b7(0x1c7)]+'.\x20'+(_0x1217b7(0x2e7)+_0x1217b7(0x282)+'\x20prepare'+_0x1217b7(0x27b)+_0x1217b7(0x219)+_0x1217b7(0x221)+_0x1217b7(0x290)+'\x20configu'+_0x1217b7(0x2d0)+_0x1217b7(0x22c)+_0x1217b7(0x24c)));}function parseNpmPackJson(_0x554424){const _0x5de9b3=_0x17a6e2,_0x233dd2=_0x554424[_0x5de9b3(0x2d6)](),_0x5cfce3=_0x233dd2['indexOf']('[');if(_0x5cfce3<0x0)throw new Error(_0x5de9b3(0x2da)+'\x20did\x20not'+_0x5de9b3(0x239)+_0x5de9b3(0x248)+_0x233dd2[_0x5de9b3(0x2d4)](0x0,0x1f4));const _0x53f0bb=JSON['parse'](_0x233dd2[_0x5de9b3(0x2d4)](_0x5cfce3)),_0x28e5d5=Array['isArray'](_0x53f0bb)?_0x53f0bb[0x0]:_0x53f0bb;if(!_0x28e5d5||typeof _0x28e5d5!==_0x5de9b3(0x244))throw new Error('npm\x20pack'+_0x5de9b3(0x289)+_0x5de9b3(0x1ea)+_0x5de9b3(0x2db)+_0x5de9b3(0x217)+_0x233dd2['slice'](0x0,0x1f4));return _0x28e5d5;}async function runProcess(_0x552f84,_0x106fa2,_0x1a6aa8={}){const _0x32516e=_0x17a6e2,_0x521af7=_0x1a6aa8[_0x32516e(0x279)]||[_0x552f84,..._0x106fa2][_0x32516e(0x2bf)]('\x20'),_0x3bb6d4=_0x1a6aa8[_0x32516e(0x2ba)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x1089d0=spawn(_0x552f84,_0x106fa2,{'cwd':_0x1a6aa8[_0x32516e(0x1fa)],'env':_0x1a6aa8['env'],'stdio':[_0x32516e(0x2aa),_0x32516e(0x2a2),_0x32516e(0x2a2)]});return await new Promise((_0x384e17,_0x24d54a)=>{const _0x3a9fda=_0x32516e;let _0x29b615='',_0x5ebc82='',_0xbd7495=![];const _0x450621=setTimeout(()=>{const _0x2a18c2=_0x2a9a;if(_0xbd7495)return;_0xbd7495=!![],_0x1089d0[_0x2a18c2(0x27c)](_0x2a18c2(0x218)),_0x24d54a(new Error(_0x521af7+(_0x2a18c2(0x2d7)+_0x2a18c2(0x205)+'\x20')+_0x3bb6d4+'ms'));},_0x3bb6d4);_0x1089d0['stdout']['on'](_0x3a9fda(0x2c7),_0x55cb71=>{const _0x2e1d0d=_0x3a9fda;_0x29b615+=_0x55cb71[_0x2e1d0d(0x1d2)]();}),_0x1089d0[_0x3a9fda(0x209)]['on'](_0x3a9fda(0x2c7),_0x517338=>{const _0x3105c7=_0x3a9fda;_0x5ebc82+=_0x517338[_0x3105c7(0x1d2)]();}),_0x1089d0['on'](_0x3a9fda(0x2fd),_0x371d34=>{if(_0xbd7495)return;_0xbd7495=!![],clearTimeout(_0x450621),_0x24d54a(_0x371d34);}),_0x1089d0['on'](_0x3a9fda(0x255),(_0x1caec2,_0x28d210)=>{const _0x157122=_0x3a9fda;if(_0xbd7495)return;_0xbd7495=!![],clearTimeout(_0x450621);if(_0x1caec2===0x0){_0x384e17({'stdout':_0x29b615,'stderr':_0x5ebc82});return;}_0x24d54a(new Error(_0x521af7+('\x20failed\x20'+'with\x20cod'+'e=')+(_0x1caec2??_0x157122(0x247))+_0x157122(0x20c)+(_0x28d210??_0x157122(0x247))+'\x0a'+(''+(_0x5ebc82||_0x29b615))[_0x157122(0x2d6)]()));});});}async function installOpenClawPackage(_0x244975,_0x414474){const _0x487141=_0x17a6e2,_0x409855=join(_0x244975[_0x487141(0x2f2)+_0x487141(0x268)],_0x487141(0x20a)),_0x39ad9f=join(_0x244975[_0x487141(0x2f2)+_0x487141(0x268)],_0x487141(0x26f)+_0x487141(0x2df)+'t');await mkdir(_0x409855,{'recursive':!![]}),await rm(_0x39ad9f,{'recursive':!![],'force':!![]}),await mkdir(_0x39ad9f,{'recursive':!![]});const _0x3a6d12=await createRuntimeEnv(_0x244975),_0x4e9735=_0x487141(0x2ae)+'@'+_0x414474;console[_0x487141(0x300)](_0x487141(0x2a4)+_0x487141(0x2af)+'time]\x20in'+_0x487141(0x240)+'\x20'+_0x4e9735);const _0x2d5e01=await runProcess(_0x244975[_0x487141(0x234)+_0x487141(0x24e)],[_0x244975[_0x487141(0x1cc)],_0x487141(0x1fe),_0x4e9735,_0x487141(0x242)],{'cwd':_0x409855,'env':_0x3a6d12,'label':'npm\x20pack'+'\x20'+_0x4e9735}),_0x1fde43=parseNpmPackJson(_0x2d5e01['stdout']);if(_0x1fde43[_0x487141(0x25b)]!==_0x414474)throw new Error(_0x487141(0x303)+_0x487141(0x22a)+_0x487141(0x2cc)+_0x414474+(_0x487141(0x21b)+_0x487141(0x251))+_0x1fde43['version']);const _0x5e4576=resolve(_0x409855,_0x1fde43['filename']);if(!existsSync(_0x5e4576))throw new Error('npm\x20pack'+_0x487141(0x274)+'\x20create\x20'+_0x487141(0x297)+'\x20'+_0x5e4576);await runProcess(_0x487141(0x2c2),['-xzf',_0x5e4576,'-C',_0x39ad9f],{'label':_0x487141(0x2ef)+_0x1fde43[_0x487141(0x2f1)]}),await rm(_0x244975[_0x487141(0x2ae)+_0x487141(0x2f0)+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x39ad9f,_0x487141(0x2de)),_0x244975[_0x487141(0x2ae)+_0x487141(0x2f0)+'ir']),await rm(_0x39ad9f,{'recursive':!![],'force':!![]}),await runProcess(_0x244975['nodeExec'+_0x487141(0x24e)],[_0x244975['npmCli'],_0x487141(0x2fa),_0x487141(0x236)+'ev',_0x487141(0x26d)+_0x487141(0x28c),'--no-aud'+'it','--no-fun'+'d',_0x487141(0x287)+_0x487141(0x200)+'ps'],{'cwd':_0x244975[_0x487141(0x2ae)+_0x487141(0x2f0)+'ir'],'env':_0x3a6d12,'label':_0x487141(0x237)+_0x487141(0x298)+_0x4e9735+(_0x487141(0x219)+_0x487141(0x2d9)+_0x487141(0x1dd))});if(!existsSync(_0x244975['openclaw'+_0x487141(0x1d4)]))throw new Error(_0x487141(0x262)+_0x487141(0x2cd)+_0x487141(0x246)+_0x487141(0x227)+_0x487141(0x2a8)+':\x20'+_0x244975[_0x487141(0x2ae)+'Bin']);}async function ensureRuntimeBase(_0x12f313,_0xa18e26,_0x1fe8a0={}){const _0x428c22=_0x17a6e2;await mkdir(_0xa18e26,{'recursive':!![]});let _0x4d3c0b=await readRuntimeManifest(_0xa18e26);const _0x2ef71d=_0x12f313[_0x428c22(0x2ae)][_0x428c22(0x275)+_0x428c22(0x2f8)],_0x2559c5=_0x12f313[_0x428c22(0x2ae)][_0x428c22(0x2ae)+'Version'],_0x237d2c=existsSync(resolveManifestPath(_0xa18e26)),_0x14aea5=runtimeHasRequiredPaths(_0xa18e26,_0x4d3c0b),_0xb5466e=_0x4d3c0b[_0x428c22(0x275)+_0x428c22(0x2f8)]===_0x2ef71d;!_0x237d2c||!_0x14aea5||!_0xb5466e?(_0x1fe8a0[_0x428c22(0x1f4)+'ogger']?.[_0x428c22(0x299)](_0x428c22(0x20f)+'base\x20bui'+'ld\x20start'+'ed',{'runtimeRoot':_0xa18e26,'reason':!_0x237d2c?'missing\x20'+_0x428c22(0x2b3):!_0x14aea5?_0x428c22(0x1d6)+'required'+_0x428c22(0x219)+_0x428c22(0x1e7):_0x428c22(0x230)+_0x428c22(0x28a)+_0x428c22(0x2a3),'syncOnly':_0x1fe8a0[_0x428c22(0x1d8)]}),_0x4d3c0b=await buildRuntimeBase(_0x12f313,_0xa18e26,_0x4d3c0b),_0x1fe8a0['runtimeL'+_0x428c22(0x1c3)]?.[_0x428c22(0x299)](_0x428c22(0x20f)+'base\x20bui'+_0x428c22(0x1d9)+'eted',{'manifest':summarizeRuntimeManifest(_0x4d3c0b)})):_0x1fe8a0[_0x428c22(0x1f4)+_0x428c22(0x1c3)]?.[_0x428c22(0x299)](_0x428c22(0x20f)+_0x428c22(0x1d5)+_0x428c22(0x2fc)+_0x428c22(0x2a9),{'manifest':summarizeRuntimeManifest(_0x4d3c0b)});if(!existsSync(resolve(_0xa18e26,_0x4d3c0b[_0x428c22(0x2ae)+_0x428c22(0x1d4)]))){const _0x50e096=createRuntimeInfoFromManifest(_0xa18e26,_0x4d3c0b,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x50e096,_0x2559c5),_0x4d3c0b[_0x428c22(0x2ae)+_0x428c22(0x1c7)]=_0x2559c5;}return _0x4d3c0b;}function runtimeHasRequiredPaths(_0x3959a7,_0x58e606){const _0x525a18=_0x17a6e2;return['nodeExec'+_0x525a18(0x24e),_0x525a18(0x1cc),_0x525a18(0x2ae)+'WorkingD'+'ir',_0x525a18(0x2ae)+_0x525a18(0x1d4)][_0x525a18(0x252)](_0x25e63c=>typeof _0x58e606[_0x25e63c]==='string'&&_0x58e606[_0x25e63c][_0x525a18(0x2d6)]())&&[_0x525a18(0x234)+_0x525a18(0x24e),_0x525a18(0x1cc)]['every'](_0x78afb9=>existsSync(resolve(_0x3959a7,_0x58e606[_0x78afb9])));}async function buildRuntimeBase(_0x355f7d,_0x5edfdb,_0x59ee6d={}){const _0xfe10fb=_0x17a6e2,_0x56873a=join(_0x5edfdb,_0xfe10fb(0x2ab));await ensureRuntimeNode(_0x355f7d,_0x56873a);const _0x56590e={..._0x59ee6d,'generatedAt':new Date()[_0xfe10fb(0x2c8)+_0xfe10fb(0x24f)](),'nodeVersion':_0x355f7d['openclaw'][_0xfe10fb(0x275)+'ion'],'openclawVersion':_0x59ee6d[_0xfe10fb(0x2ae)+'Version']||'','platform':process[_0xfe10fb(0x28e)],'arch':process[_0xfe10fb(0x280)],'nodeExecutable':_0xfe10fb(0x288)+_0xfe10fb(0x2b0),'npmCli':'node/lib'+_0xfe10fb(0x260)+_0xfe10fb(0x28f)+_0xfe10fb(0x1c6)+_0xfe10fb(0x291),'openclawWorkingDir':'openclaw','openclawBin':'openclaw'+_0xfe10fb(0x207)+_0xfe10fb(0x2b4)};return await writeJson(resolveManifestPath(_0x5edfdb),_0x56590e),_0x56590e;}async function ensureRuntimeNode(_0x14b403,_0x264713){const _0x2eed6c=_0x17a6e2,_0x145883=_0x14b403['openclaw'][_0x2eed6c(0x275)+_0x2eed6c(0x2f8)],_0x3d3339=join(_0x264713,_0x2eed6c(0x2e8),'node'),_0x3bf154=join(_0x264713,_0x2eed6c(0x26e),_0x2eed6c(0x1fc)+_0x2eed6c(0x1d7),_0x2eed6c(0x206),'bin',_0x2eed6c(0x228)+'js');if(existsSync(_0x3d3339)&&existsSync(_0x3bf154)&&await getNodeVersion(_0x3d3339)===_0x145883)return;await rm(_0x264713,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});if(process[_0x2eed6c(0x1f3)]['node']===_0x145883){await linkCurrentNodeRuntime(_0x264713);return;}await downloadNodeRuntime(_0x145883,_0x264713);}async function getNodeVersion(_0x17d578){const _0x5c8458=_0x17a6e2;try{const _0x55b2be=await runProcess(_0x17d578,['-p',_0x5c8458(0x2a1)+_0x5c8458(0x1f3)+_0x5c8458(0x2ff)],{'label':_0x17d578+_0x5c8458(0x2e4),'timeoutMs':0x7530});return _0x55b2be[_0x5c8458(0x29d)][_0x5c8458(0x2d6)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x398e3c){const _0x1923b6=_0x17a6e2,_0x6e057a=process[_0x1923b6(0x1cb)],_0x2844a9=resolve(dirname(_0x6e057a),'..'),_0x17765b=resolve(_0x2844a9,'lib/node'+_0x1923b6(0x23d)+'/npm'),_0xdd8109=join(_0x398e3c,'bin',_0x1923b6(0x2ab)),_0xe651ca=join(_0x398e3c,_0x1923b6(0x26e),_0x1923b6(0x1fc)+_0x1923b6(0x1d7),_0x1923b6(0x206));await mkdir(dirname(_0xdd8109),{'recursive':!![]}),await mkdir(dirname(_0xe651ca),{'recursive':!![]}),await symlink(_0x6e057a,_0xdd8109),existsSync(_0x17765b)?await symlink(_0x17765b,_0xe651ca):await symlink(await resolveNpmRoot(),_0xe651ca);}async function resolveNpmRoot(){const _0x371f5a=_0x17a6e2,_0x17ce31=await runProcess('npm',[_0x371f5a(0x1c0),'-g'],{'label':'npm\x20root'+'\x20-g','timeoutMs':0x7530}),_0x48087d=join(_0x17ce31[_0x371f5a(0x29d)][_0x371f5a(0x2d6)](),_0x371f5a(0x206));if(!existsSync(join(_0x48087d,_0x371f5a(0x2e8),_0x371f5a(0x228)+'js')))throw new Error('npm\x20pack'+'age\x20was\x20'+'not\x20foun'+_0x371f5a(0x20e)+'cal\x20runt'+_0x371f5a(0x2fb)+'d:\x20'+_0x48087d);return _0x48087d;}async function downloadNodeRuntime(_0x3e455a,_0x4c6e80){const _0xbd20db=_0x17a6e2,_0x4192f2=process[_0xbd20db(0x28e)]===_0xbd20db(0x24b)?_0xbd20db(0x266):process[_0xbd20db(0x28e)],_0x754060=process[_0xbd20db(0x280)]==='x64'?_0xbd20db(0x264):process[_0xbd20db(0x280)]==='arm64'?'arm64':process[_0xbd20db(0x280)],_0x1ee2d8=process[_0xbd20db(0x28e)]===_0xbd20db(0x24b)?'zip':_0xbd20db(0x1f1),_0x3fca83=_0xbd20db(0x224)+_0x3e455a+'-'+_0x4192f2+'-'+_0x754060,_0x505c54=_0x3fca83+'.'+_0x1ee2d8,_0x52fe40=join(dirname(_0x4c6e80),_0xbd20db(0x20a)),_0x119835=join(_0x52fe40,_0x505c54),_0x1f1f9a=join(_0x52fe40,_0x3fca83+(_0xbd20db(0x22e)+'-')+process[_0xbd20db(0x1ce)]+'-'+Date[_0xbd20db(0x2ac)]()),_0xbb96d8=_0xbd20db(0x292)+'nodejs.o'+_0xbd20db(0x212)+'v'+_0x3e455a+'/'+_0x505c54;await mkdir(_0x52fe40,{'recursive':!![]}),!existsSync(_0x119835)&&(console[_0xbd20db(0x300)](_0xbd20db(0x2a4)+_0xbd20db(0x2af)+_0xbd20db(0x293)+_0xbd20db(0x277)+'g\x20'+_0xbb96d8),await downloadFile(_0xbb96d8,_0x119835)),await rm(_0x1f1f9a,{'recursive':!![],'force':!![]}),await mkdir(_0x1f1f9a,{'recursive':!![]}),process[_0xbd20db(0x28e)]===_0xbd20db(0x24b)?await runProcess(_0xbd20db(0x229),['-q',_0x119835,'-d',_0x1f1f9a],{'label':'extract\x20'+_0x505c54}):await runProcess(_0xbd20db(0x2c2),[_0xbd20db(0x2f3),_0x119835,'-C',_0x1f1f9a],{'label':'extract\x20'+_0x505c54}),await rename(join(_0x1f1f9a,_0x3fca83),_0x4c6e80),await rm(_0x1f1f9a,{'recursive':!![],'force':!![]});}async function downloadFile(_0x37006f,_0x273953){await mkdir(dirname(_0x273953),{'recursive':!![]});const _0x2ed301=await new Promise((_0x25c5b7,_0x21b09a)=>{const _0x5b9ba2=_0x2a9a;get(_0x37006f,_0x5b1082=>{const _0x454f95=_0x2a9a;if(_0x5b1082[_0x454f95(0x1eb)+'de']>=0x12c&&_0x5b1082[_0x454f95(0x1eb)+'de']<0x190&&_0x5b1082[_0x454f95(0x1e0)][_0x454f95(0x1e2)]){_0x5b1082[_0x454f95(0x1c4)](),downloadFile(new URL(_0x5b1082['headers'][_0x454f95(0x1e2)],_0x37006f)['href'],_0x273953)['then'](()=>_0x25c5b7(null))[_0x454f95(0x1c5)](_0x21b09a);return;}if(_0x5b1082[_0x454f95(0x1eb)+'de']!==0xc8){_0x5b1082[_0x454f95(0x1c4)](),_0x21b09a(new Error(_0x454f95(0x286)+_0x454f95(0x223)+_0x5b1082['statusCo'+'de']+':\x20'+_0x37006f));return;}_0x25c5b7(_0x5b1082);})['on'](_0x5b9ba2(0x2fd),_0x21b09a);});_0x2ed301&&await pipeline(_0x2ed301,createWriteStream(_0x273953));}export async function ensureOpenClawDoctorFixed(_0x5c35b5,_0x287ffe={}){const _0x510f6f=_0x17a6e2,_0x18e1b4=await loadRuntimeInfo(_0x5c35b5[_0x510f6f(0x1fd)+_0x510f6f(0x268)]),_0x38dbd9=getConfigPaths(_0x5c35b5),_0x176866=join(_0x38dbd9[_0x510f6f(0x232)+'tateDir'],_0x510f6f(0x2ae)+_0x510f6f(0x23f)+'json'),_0x2d4006=await readJson(_0x176866,{});if(_0x2d4006[_0x510f6f(0x2ae)+_0x510f6f(0x1c7)]===_0x18e1b4[_0x510f6f(0x2ae)+_0x510f6f(0x1c7)])return _0x287ffe[_0x510f6f(0x1f4)+_0x510f6f(0x1c3)]?.['info'](_0x510f6f(0x2ae)+_0x510f6f(0x225)+_0x510f6f(0x276)+_0x510f6f(0x2cf)+'ent',{'openclawVersion':_0x18e1b4[_0x510f6f(0x2ae)+_0x510f6f(0x1c7)],'markerPath':_0x176866}),{'ran':![],'openclawVersion':_0x18e1b4[_0x510f6f(0x2ae)+_0x510f6f(0x1c7)],'markerPath':_0x176866};return await runOpenClawDoctorFix(_0x5c35b5,_0x18e1b4,{'fromVersion':_0x2d4006['openclaw'+_0x510f6f(0x1c7)]||_0x510f6f(0x1f2),'toVersion':_0x18e1b4['openclaw'+_0x510f6f(0x1c7)],'markerPath':_0x176866,'runtimeLogger':_0x287ffe[_0x510f6f(0x1f4)+_0x510f6f(0x1c3)]}),{'ran':!![],'openclawVersion':_0x18e1b4[_0x510f6f(0x2ae)+_0x510f6f(0x1c7)],'markerPath':_0x176866};}async function runOpenClawDoctorFix(_0x393651,_0x2bd607,{fromVersion:_0x5a270b,toVersion:_0x239981,markerPath:markerPath='',runtimeLogger:_0x557c68}={}){const _0x70be50=_0x17a6e2;_0x557c68?.[_0x70be50(0x299)](_0x70be50(0x2ae)+_0x70be50(0x225)+_0x70be50(0x1c2)+_0x70be50(0x271),{'fromVersion':_0x5a270b,'toVersion':_0x239981});const _0x15a32d=await createRuntimeEnv(_0x2bd607,{'OPENCLAW_HOME':_0x393651[_0x70be50(0x28d)],'OPENCLAW_STATE_DIR':_0x393651['dataDir'],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x393651)[_0x70be50(0x2ca)+'th']});console[_0x70be50(0x300)](_0x70be50(0x2a4)+_0x70be50(0x2af)+_0x70be50(0x215)+_0x70be50(0x23c)+'enclaw\x20d'+_0x70be50(0x261)+'fix');const _0x1c0674=await runProcess(_0x2bd607[_0x70be50(0x234)+_0x70be50(0x24e)],[_0x2bd607[_0x70be50(0x2ae)+_0x70be50(0x1d4)],'doctor','--fix'],{'cwd':_0x2bd607[_0x70be50(0x2ae)+_0x70be50(0x2f0)+'ir'],'env':_0x15a32d,'label':'openclaw'+'\x20doctor\x20'+'--fix','timeoutMs':0x1d4c0});_0x557c68?.[_0x70be50(0x299)](_0x70be50(0x2ae)+_0x70be50(0x225)+'fix\x20comp'+_0x70be50(0x2e5),{'fromVersion':_0x5a270b,'toVersion':_0x239981,'stdout':_0x1c0674[_0x70be50(0x29d)][_0x70be50(0x2d6)]()[_0x70be50(0x2d4)](-0xfa0),'stderr':_0x1c0674[_0x70be50(0x209)][_0x70be50(0x2d6)]()[_0x70be50(0x2d4)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x2bd607[_0x70be50(0x2ae)+_0x70be50(0x1c7)],'fixedAt':new Date()[_0x70be50(0x2c8)+_0x70be50(0x24f)]()}),_0x557c68?.[_0x70be50(0x299)](_0x70be50(0x2ae)+_0x70be50(0x225)+_0x70be50(0x283)+_0x70be50(0x1e5)+'en',{'markerPath':markerPath,'openclawVersion':_0x2bd607[_0x70be50(0x2ae)+_0x70be50(0x1c7)]}));}export async function readRuntimeManifest(_0xc286eb){return await readJson(resolveManifestPath(_0xc286eb),{});}function _0x4be1(){const _0x428ec7=['wnloadin','NCLAW_CO','label','plugin\x20s','\x22\x20so\x20the','kill','ATE_DIR:','l\x20prepar','5125582XTeuLx','arch','LAW_STAT','ie-shell','fix\x20mark','512561YxFYzu','SCRIPT_D','download','--legacy','node/bin','\x20returne','sion\x20mis','string','eer','dataDir','platform','dules/np','tall\x20the','m-cli.js','https://','time]\x20do','extensio','source','NCLAW_ST','tarball:','all\x20','info','\x20is\x20miss','sion\x20val','skillsDi','stdout','pluginId','appId','agents','process.','pipe','match','[wujie-s','Version\x20','LocalPlu','\x22\x20\x22$SCRI','\x20install','rent','ignore','node','now','%USERPRO','openclaw','hell:run','/node','88HhYjRZ','cope\x20syn','manifest','w.mjs','\x20loaded','ath','add','runtime-','export\x20O','timeoutM','then','../asset','dAt','H%\x22==\x22\x22\x20','join','agents\x20s','PT_DIR/w','tar','\x22\x20%*','pluginSp','npm-cach','time','data','toISOStr','CONFIG_P','configPa','ecs','law\x20','\x20bin\x20was','flush','ady\x20curr','red\x20Open','installP','\x20package','set\x20\x22SCR','slice','product','trim','\x20timed\x20o','dataDirN','\x20depende','npm\x20pack','alid\x20pay','plugins','\x22==\x22\x22\x20se','package','w-extrac','plugins\x20','logo.mjs','synced','OME=','\x20version','leted','map','Run\x20\x22wuj','bin','local:','ame','\x22\x20at\x20','\x20written','config=','if\x20[\x20-t\x20','extract\x20','WorkingD','filename','runtimeR','-xJf','npm-glob','split','\x22\x20\x22$@\x22','local','ion','IPT_DIR=','install','ime\x20buil','eady\x20cur','error','\x22\x20\x22%SCRI','.node','log','rname\x20--','117066Aswxlv','Configur','.json','root','started','fix\x20star','ogger','resume','catch','m/bin/np','Version','OGO\x22\x20];\x20','claw-run','13655142mGjhdP','execPath','npmCli','201125LbKebL','pid','jie-shel','resolved','go.mjs','toString','wrapper\x20','Bin','base\x20alr','missing\x20','ules','syncOnly','ld\x20compl','1\x20]\x20&&\x20[','t\x20\x22OPENC','atch:\x20ma','ncies','time-too','\x20complet','headers','.tmp/run','location','singOpen','ME%\x22==\x22\x22','er\x20writt','102lGswfN','\x20paths','STATE_DI','2292854bJkqjw','d\x20an\x20inv','statusCo','PT_DIR/','env','has','&&\x20pwd)','R=\x22${OPE','tar.xz','unknown','versions','runtimeL','119460cLrQrr','w.json\x22','\x20-z\x20\x22$WU','CRIPT_DI','push','cwd','replace','node_mod','projectR','pack',',\x20shell.','-peer-de','registry','startsWi','FILE%\x5c','productN','ut\x20after','npm','/opencla','runtime','stderr','.cache','PENCLAW_','\x20signal=','replaceA','d\x20for\x20lo','runtime\x20','if\x20\x22%OPE','skills\x20s','rg/dist/','HOME=\x22${','NFIG_PAT','time]\x20ru','JIE_NO_L','load:\x20','SIGTERM','\x20runtime','skills','\x20resolve','isArray','\x20product','prepare\x20','ujie-log','\x20prepare','\x20can\x20ins','\x20can\x20be\x20','\x20failed\x20','node-v','\x20doctor\x20','path:\x20','nd\x20after','npm-cli.','unzip','ed\x20OpenC','w.json}\x22','Claw\x20ver','ing\x20\x22','-extract','Spec','node\x20ver','with\x20the','runtimeS','wujie-lo','nodeExec','mismatch','--omit=d','npm\x20inst','length','\x20return\x20','wujiecla','set\x20\x22OPE','nning\x20op','_modules','\x5copencla','-doctor.','stalling','agentsDi','--json','$HOME/','object','filter','\x20not\x20fou','null','JSON:\x20','exec\x20\x22$S','ced','win32','sion.','nifest=','utable','ing','OPENCLAW','d\x20to\x20','every','E_DIR=','rg/','close','wBin','utf8','ginPaths','NCLAW_HO','ATH=\x22${O','version','PT_DIR%','s/wujie-','product\x20','dist','/node_mo','octor\x20--','OpenClaw','rebuilt\x20','x64','IR=$(CDP','win','8cXkTSJ','oot','--\x20\x22$(di','ynced','.npmjs.o','\x20configu','--omit=p','lib','.opencla','ENCLAW_H','ted','\x20\x20\x22$SCRI','836RVhRer','\x20did\x20not','nodeVers','fix\x20alre'];_0x4be1=function(){return _0x428ec7;};return _0x4be1();}export async function loadRuntimeInfo(_0x3ee1dc){const _0x1fa0e0=resolveRuntimeRoot(_0x3ee1dc),_0xc4af2d=await readRuntimeManifest(_0x1fa0e0);return createRuntimeInfoFromManifest(_0x1fa0e0,_0xc4af2d);}function createRuntimeInfoFromManifest(_0x13b78c,_0x49138d,_0x17ad2a={}){const _0x5c4138=_0x17a6e2;for(const _0x3b5ea8 of['nodeExec'+'utable',_0x5c4138(0x1cc),_0x5c4138(0x2ae)+_0x5c4138(0x2f0)+'ir',_0x5c4138(0x2ae)+_0x5c4138(0x1d4)]){if(typeof _0x49138d[_0x3b5ea8]!==_0x5c4138(0x28b)||!_0x49138d[_0x3b5ea8][_0x5c4138(0x2d6)]())throw new Error(_0x5c4138(0x20f)+_0x5c4138(0x2b3)+_0x5c4138(0x29a)+_0x5c4138(0x22d)+_0x3b5ea8+_0x5c4138(0x2eb)+resolveManifestPath(_0x13b78c)+(';\x20run\x20wu'+_0x5c4138(0x1cf)+_0x5c4138(0x27e)+'e'));}const _0x3af176=resolve(_0x13b78c,_0x49138d[_0x5c4138(0x234)+'utable']),_0x121453=resolve(_0x13b78c,_0x49138d[_0x5c4138(0x1cc)]),_0x57dc25=resolve(_0x13b78c,_0x49138d[_0x5c4138(0x2ae)+_0x5c4138(0x2f0)+'ir']),_0x213fc8=resolve(_0x13b78c,_0x49138d[_0x5c4138(0x2ae)+_0x5c4138(0x1d4)]),_0x28b8e1=Array[_0x5c4138(0x21c)](_0x49138d[_0x5c4138(0x2dc)])?_0x49138d[_0x5c4138(0x2dc)][_0x5c4138(0x2e6)](_0x3c59f6=>({..._0x3c59f6,'installPath':resolve(_0x13b78c,_0x3c59f6[_0x5c4138(0x2d1)+_0x5c4138(0x2b6)])})):[],_0x31fe58=_0x17ad2a['allowMis'+_0x5c4138(0x1e3)+'Claw']?[_0x3af176,_0x121453]:[_0x3af176,_0x121453,_0x57dc25,_0x213fc8];for(const _0x5b3e11 of _0x31fe58){if(!existsSync(_0x5b3e11))throw new Error('runtime\x20'+_0x5c4138(0x1d6)+_0x5c4138(0x226)+_0x5b3e11);}return{'runtimeRoot':_0x13b78c,'manifest':_0x49138d,'openclawVersion':_0x49138d[_0x5c4138(0x2ae)+_0x5c4138(0x1c7)]||_0x5c4138(0x1f2),'nodeExecutable':_0x3af176,'npmCli':_0x121453,'openclawWorkingDir':_0x57dc25,'openclawBin':_0x213fc8,'plugins':_0x28b8e1};}export async function spawnClaw(_0x9a40b6,_0x955069=[],_0x68b944={}){const _0x202616=_0x17a6e2,_0x447a90=await loadRuntimeInfo(_0x9a40b6),_0x2fe149=await createRuntimeEnv(_0x447a90,_0x68b944[_0x202616(0x1ed)]??{});return spawn(_0x447a90[_0x202616(0x234)+'utable'],[_0x447a90[_0x202616(0x2ae)+_0x202616(0x1d4)],..._0x955069],{'cwd':_0x447a90[_0x202616(0x2ae)+_0x202616(0x2f0)+'ir'],'stdio':_0x202616(0x2a2),..._0x68b944,'env':_0x2fe149});}export async function runClawOnce(_0x30ae3d,_0x302052=[],_0x48b7e1=0x15f90){const _0x3051ca=await spawnClaw(_0x30ae3d,_0x302052);return await new Promise((_0x4b31ac,_0x2aa072)=>{const _0x5ac713=_0x2a9a;let _0x4d95b8='',_0x4e4bc4='',_0x102b62=![];const _0x262ca4=setTimeout(()=>{const _0x1d853f=_0x2a9a;if(_0x102b62)return;_0x102b62=!![],_0x3051ca[_0x1d853f(0x27c)]('SIGTERM'),_0x2aa072(new Error('openclaw'+_0x1d853f(0x2d7)+_0x1d853f(0x205)+'\x20'+_0x48b7e1+'ms'));},_0x48b7e1);_0x3051ca[_0x5ac713(0x29d)]['on']('data',_0x14bfa1=>{_0x4d95b8+=_0x14bfa1['toString']();}),_0x3051ca[_0x5ac713(0x209)]['on'](_0x5ac713(0x2c7),_0x38a6b2=>{const _0x4c098c=_0x5ac713;_0x4e4bc4+=_0x38a6b2[_0x4c098c(0x1d2)]();}),_0x3051ca['on'](_0x5ac713(0x2fd),_0x76c814=>{if(_0x102b62)return;_0x102b62=!![],clearTimeout(_0x262ca4),_0x2aa072(_0x76c814);}),_0x3051ca['on'](_0x5ac713(0x255),(_0x2cae3b,_0x20b2c5)=>{if(_0x102b62)return;_0x102b62=!![],clearTimeout(_0x262ca4),_0x4b31ac({'code':_0x2cae3b,'signal':_0x20b2c5,'stdout':_0x4d95b8,'stderr':_0x4e4bc4});});});}async function createRuntimeEnv(_0x2d7f51,_0x10d089={}){const _0x670251=_0x17a6e2,_0x9a0e2d=process.env.OPENCLAW_STATE_DIR||'',_0x364760=_0x9a0e2d?join(_0x9a0e2d,_0x670251(0x1c9)+_0x670251(0x1de)+'ls'):join(_0x2d7f51[_0x670251(0x2f2)+'oot'],'.tools'),_0x2dbf50=join(_0x364760,_0x670251(0x2f4)+'al'),_0x56c92b=join(_0x364760,_0x670251(0x2c5)+'e'),_0x37e465=join(_0x2dbf50,_0x670251(0x2e8));await mkdir(_0x37e465,{'recursive':!![]}),await mkdir(_0x56c92b,{'recursive':!![]});const _0x2079f8=[_0x37e465,dirname(_0x2d7f51[_0x670251(0x234)+_0x670251(0x24e)]),process.env.PATH||''];return{...process.env,..._0x10d089,'PATH':_0x2079f8[_0x670251(0x245)](Boolean)[_0x670251(0x2bf)](delimiter),'npm_config_prefix':_0x2dbf50,'NPM_CONFIG_PREFIX':_0x2dbf50,'npm_config_cache':_0x56c92b,'NPM_CONFIG_CACHE':_0x56c92b,'npm_config_registry':_0x670251(0x292)+_0x670251(0x201)+_0x670251(0x26b)+_0x670251(0x254),'NPM_CONFIG_REGISTRY':_0x670251(0x292)+'registry'+_0x670251(0x26b)+_0x670251(0x254),'npm_execpath':_0x2d7f51[_0x670251(0x1cc)],'npm_node_execpath':_0x2d7f51['nodeExec'+_0x670251(0x24e)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x2dbf50,'OPENCLAW_RUNTIME_NPM_BIN':_0x37e465,'OPENCLAW_RUNTIME_NPM_REGISTRY':'https://'+_0x670251(0x201)+_0x670251(0x26b)+'rg/'};}async function syncProductPlugins(_0x4b7cc4,_0x146edd,_0xa1204b){const _0x20af7e=_0x17a6e2,_0x2cfe49=join(_0x146edd,_0x20af7e(0x2ae),_0x20af7e(0x25f),_0x20af7e(0x294)+'ns'),_0x10766b=[];for(const _0x1fbd32 of _0x4b7cc4[_0x20af7e(0x2ae)]['resolved'+_0x20af7e(0x2a6)+_0x20af7e(0x258)]){const _0x239969=await getPackageMetadata(_0x1fbd32),_0x21d28d=await readPluginManifest(_0x1fbd32),_0x73b00a=join(_0x2cfe49,_0x239969['pluginId']);await copyDirFresh(_0x1fbd32,_0x73b00a),_0x10766b[_0x20af7e(0x1f9)]({'pluginId':_0x239969[_0x20af7e(0x29e)],'source':'local','spec':'local:'+_0x1fbd32,'installPath':toRuntimeRelative(_0x146edd,_0x73b00a),'version':_0x239969['version'],'resolvedName':_0x239969['name'],'resolvedVersion':_0x239969[_0x20af7e(0x25b)],'resolvedSpec':_0x20af7e(0x2e9)+_0x1fbd32,'integrity':'','shasum':'','resolvedAt':new Date()[_0x20af7e(0x2c8)+_0x20af7e(0x24f)](),'installedAt':new Date()[_0x20af7e(0x2c8)+'ing'](),'agentScope':_0x21d28d['agentSco'+'pe'],'skills':_0x21d28d[_0x20af7e(0x21a)]});}const _0x592f33=new Set(_0x10766b[_0x20af7e(0x2e6)](_0x486b30=>_0x486b30['pluginId'])),_0x1b9007=Array[_0x20af7e(0x21c)](_0xa1204b[_0x20af7e(0x2dc)])?_0xa1204b[_0x20af7e(0x2dc)][_0x20af7e(0x245)](_0x480792=>!_0x592f33[_0x20af7e(0x1ee)](_0x480792[_0x20af7e(0x29e)])):[];_0xa1204b[_0x20af7e(0x2dc)]=[..._0x1b9007,..._0x10766b];}async function syncManifestPluginScope(_0x2134be,_0x2da22a,_0x55d87f){const _0x3c7471=_0x17a6e2,_0x46dd9f=join(_0x2da22a,'openclaw',_0x3c7471(0x25f),_0x3c7471(0x294)+'ns'),_0x572aa3=new Set(_0x2134be['openclaw'][_0x3c7471(0x2c4)+'ecs']??[]),_0x274904=new Set([..._0x572aa3][_0x3c7471(0x2e6)](_0x4c6614=>_0x4c6614[_0x3c7471(0x1fb)](/^npm:/,''))[_0x3c7471(0x2e6)](_0x550d1d=>{const _0x5b7120=_0x3c7471;if(_0x550d1d[_0x5b7120(0x202)+'th']('@')){const _0x11a26d=_0x550d1d['split']('@');return _0x11a26d['length']>=0x3?'@'+_0x11a26d[0x1]:_0x550d1d;}return _0x550d1d[_0x5b7120(0x2f5)]('@')[0x0];})[_0x3c7471(0x245)](Boolean)),_0x1d7268=new Set();for(const _0x33bbed of _0x2134be[_0x3c7471(0x2ae)][_0x3c7471(0x1d0)+_0x3c7471(0x2a6)+'ginPaths']){const _0x15962e=await getPackageMetadata(_0x33bbed);if(_0x15962e[_0x3c7471(0x29e)])_0x1d7268[_0x3c7471(0x2b7)](_0x15962e[_0x3c7471(0x29e)]);}const _0x11625b=Array['isArray'](_0x55d87f[_0x3c7471(0x2dc)])?_0x55d87f[_0x3c7471(0x2dc)]:[];_0x55d87f[_0x3c7471(0x2c4)+_0x3c7471(0x2cb)]=[..._0x2134be[_0x3c7471(0x2ae)][_0x3c7471(0x2c4)+_0x3c7471(0x2cb)],..._0x2134be[_0x3c7471(0x2ae)][_0x3c7471(0x1d0)+'LocalPlu'+_0x3c7471(0x258)]['map'](_0x42774b=>'local:'+_0x42774b)],_0x55d87f[_0x3c7471(0x2dc)]=_0x11625b['filter'](_0x14a20c=>{const _0xd04b52=_0x3c7471;if(!_0x14a20c||typeof _0x14a20c!==_0xd04b52(0x244))return![];if(_0x14a20c['source']===_0xd04b52(0x2f7))return _0x1d7268['has'](_0x14a20c[_0xd04b52(0x29e)]);if(_0x14a20c[_0xd04b52(0x295)]===_0xd04b52(0x206))return _0x572aa3['has'](_0x14a20c['spec'])||_0x572aa3[_0xd04b52(0x1ee)](_0x14a20c[_0xd04b52(0x1d0)+_0xd04b52(0x22f)])||_0x274904[_0xd04b52(0x1ee)](_0x14a20c[_0xd04b52(0x1d0)+'Name']);return![];});const _0xf04b29=new Set(_0x55d87f['plugins']['map'](_0x55f8a9=>_0x55f8a9[_0x3c7471(0x29e)]));for(const _0x4d28c3 of _0x11625b){if(!_0x4d28c3[_0x3c7471(0x29e)]||_0xf04b29['has'](_0x4d28c3['pluginId']))continue;const _0x38f2ab=typeof _0x4d28c3[_0x3c7471(0x2d1)+_0x3c7471(0x2b6)]===_0x3c7471(0x28b)&&_0x4d28c3[_0x3c7471(0x2d1)+_0x3c7471(0x2b6)][_0x3c7471(0x2d6)]()?resolve(_0x2da22a,_0x4d28c3['installP'+_0x3c7471(0x2b6)]):join(_0x46dd9f,_0x4d28c3[_0x3c7471(0x29e)]),_0x556fd9=relative(_0x46dd9f,_0x38f2ab);if(_0x556fd9[_0x3c7471(0x202)+'th']('..')||_0x556fd9==='')continue;await rm(_0x38f2ab,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x3df82b,_0x184f8d,_0x5a9f23){const _0x1e1f5f=_0x17a6e2,_0x30f033=join(_0x184f8d,_0x1e1f5f(0x2ae),_0x1e1f5f(0x2a0));await copyDirFresh(_0x3df82b[_0x1e1f5f(0x2ae)][_0x1e1f5f(0x241)+'r'],_0x30f033),_0x5a9f23[_0x1e1f5f(0x2a0)]={'source':_0x1e1f5f(0x2d5),'installPath':toRuntimeRelative(_0x184f8d,_0x30f033)};}async function syncProductSkills(_0xe72375,_0x29e93a,_0x7026a9){const _0x223ff5=_0x17a6e2,_0x410988=join(_0x29e93a,_0x223ff5(0x2ae),_0x223ff5(0x21a));await copyDirFresh(_0xe72375[_0x223ff5(0x2ae)][_0x223ff5(0x29c)+'r'],_0x410988),_0x7026a9[_0x223ff5(0x21a)]={'source':_0x223ff5(0x2d5),'installPath':toRuntimeRelative(_0x29e93a,_0x410988)};}
1
+ function _0xacd0(_0x101e0f,_0x3700cd){_0x101e0f=_0x101e0f-0x1cb;const _0x38713b=_0x3871();let _0xacd06d=_0x38713b[_0x101e0f];return _0xacd06d;}const _0x3edc6e=_0xacd0;(function(_0x3c06aa,_0x3b84da){const _0x4d0630=_0xacd0,_0x52c4bc=_0x3c06aa();while(!![]){try{const _0x289680=-parseInt(_0x4d0630(0x32a))/0x1+-parseInt(_0x4d0630(0x232))/0x2*(parseInt(_0x4d0630(0x22f))/0x3)+-parseInt(_0x4d0630(0x35b))/0x4+parseInt(_0x4d0630(0x207))/0x5*(-parseInt(_0x4d0630(0x27b))/0x6)+parseInt(_0x4d0630(0x2ae))/0x7+-parseInt(_0x4d0630(0x298))/0x8*(-parseInt(_0x4d0630(0x2e1))/0x9)+-parseInt(_0x4d0630(0x2e8))/0xa*(-parseInt(_0x4d0630(0x2b7))/0xb);if(_0x289680===_0x3b84da)break;else _0x52c4bc['push'](_0x52c4bc['shift']());}catch(_0x4ec5c4){_0x52c4bc['push'](_0x52c4bc['shift']());}}}(_0x3871,0x772ba));import{existsSync,readdirSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rename,rm,symlink,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{fileURLToPath}from'node:url';import{spawn}from'node:child_process';import{get}from'node:https';import{pipeline}from'node:stream/promises';import{getConfigPaths}from'@wujie-shell/config';import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'./runtime-logger.mjs';const RUNTIME_DIR=_0x3edc6e(0x316)+_0x3edc6e(0x357),MANIFEST_NAME=_0x3edc6e(0x2c3)+_0x3edc6e(0x294)+_0x3edc6e(0x2dc),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8,KDOCS_CLI_CDN_BASE=(process.env.KDOCS_CLI_CDN??_0x3edc6e(0x2fb)+'wpsai.wp'+'scdn.cn/'+_0x3edc6e(0x2f1)+_0x3edc6e(0x25b))[_0x3edc6e(0x203)](/\/$/,'');export function resolveRuntimeRoot(_0x227fb4){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x227fb4,RUNTIME_DIR);}export function resolveManifestPath(_0x58dc11){return join(_0x58dc11,MANIFEST_NAME);}export async function prepareRuntime(_0x2198ee,{syncOnly:syncOnly=![]}={}){const _0x335d03=_0x3edc6e,_0x3e3dab=resolveRuntimeRoot(_0x2198ee[_0x335d03(0x253)+_0x335d03(0x27d)]),_0x44eceb=createRuntimeLogger(getConfigPaths(_0x2198ee),_0x335d03(0x33b)),_0x500033=Date[_0x335d03(0x265)]();_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x1e3)+_0x335d03(0x2d6)+_0x335d03(0x301),{'syncOnly':syncOnly,'runtimeRoot':_0x3e3dab,'shellConfig':summarizeShellConfig(_0x2198ee)});try{const _0x5cebe4=await ensureRuntimeBase(_0x2198ee,_0x3e3dab,{'runtimeLogger':_0x44eceb,'syncOnly':syncOnly});_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2d6)+_0x335d03(0x294)+'\x20loaded',{'manifestPath':resolveManifestPath(_0x3e3dab),'manifest':summarizeRuntimeManifest(_0x5cebe4)}),validateRuntimeNodeVersion(_0x5cebe4,_0x2198ee),_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2d6)+_0x335d03(0x1d7)+'sion\x20val'+'idated',{'nodeVersion':_0x5cebe4[_0x335d03(0x2c0)+_0x335d03(0x1db)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x5cebe4,_0x2198ee),_0x44eceb?.['info'](_0x335d03(0x2d6)+_0x335d03(0x2bf)+_0x335d03(0x302)+_0x335d03(0x237)+'ed',{'openclawVersion':_0x5cebe4[_0x335d03(0x2bf)+'Version']});else{if(_0x5cebe4['openclaw'+_0x335d03(0x2eb)]!==_0x2198ee[_0x335d03(0x2bf)][_0x335d03(0x2bf)+'Version']){const _0x244b3b=await loadRuntimeInfo(_0x2198ee[_0x335d03(0x253)+_0x335d03(0x27d)]);_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2bf)+'\x20package'+_0x335d03(0x1ef)+_0x335d03(0x329),{'fromVersion':_0x5cebe4['openclaw'+_0x335d03(0x2eb)]||_0x335d03(0x266),'toVersion':_0x2198ee[_0x335d03(0x2bf)]['openclaw'+_0x335d03(0x2eb)]}),await installOpenClawPackage(_0x244b3b,_0x2198ee[_0x335d03(0x2bf)][_0x335d03(0x2bf)+'Version']),_0x5cebe4[_0x335d03(0x2bf)+_0x335d03(0x2eb)]=_0x2198ee['openclaw'][_0x335d03(0x2bf)+_0x335d03(0x2eb)],_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2bf)+_0x335d03(0x333)+_0x335d03(0x1ef)+_0x335d03(0x338)+'ed',{'openclawVersion':_0x5cebe4['openclaw'+'Version']});}}_0x5cebe4[_0x335d03(0x245)+_0x335d03(0x2d4)]=new Date()[_0x335d03(0x1f7)+_0x335d03(0x308)](),_0x5cebe4['nodeVers'+_0x335d03(0x1db)]=_0x2198ee['openclaw'][_0x335d03(0x2c0)+'ion'],_0x5cebe4['product']={'appId':_0x2198ee['appId'],'productName':_0x2198ee[_0x335d03(0x31d)+_0x335d03(0x240)],'dataDirName':_0x2198ee[_0x335d03(0x29b)+'ame']},await ensureBundledOpenClawTools(_0x2198ee,_0x3e3dab,_0x5cebe4,{'runtimeLogger':_0x44eceb,'syncOnly':syncOnly}),_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2d6)+_0x335d03(0x20f)+_0x335d03(0x24c)+_0x335d03(0x331));const _0x28c5d5=Array['isArray'](_0x5cebe4[_0x335d03(0x2e2)])?_0x5cebe4['plugins'][_0x335d03(0x2bd)]:0x0;return await syncManifestPluginScope(_0x2198ee,_0x3e3dab,_0x5cebe4),_0x44eceb?.['info'](_0x335d03(0x2d6)+'plugin\x20s'+_0x335d03(0x230)+'ced',{'beforePluginCount':_0x28c5d5,'afterPluginCount':Array['isArray'](_0x5cebe4[_0x335d03(0x2e2)])?_0x5cebe4['plugins']['length']:0x0,'pluginSpecCount':Array[_0x335d03(0x319)](_0x5cebe4[_0x335d03(0x1fc)+_0x335d03(0x1e9)])?_0x5cebe4[_0x335d03(0x1fc)+'ecs'][_0x335d03(0x2bd)]:0x0}),await syncConfiguredNpmPlugins(_0x2198ee,_0x3e3dab,_0x5cebe4,{'runtimeLogger':_0x44eceb,'syncOnly':syncOnly}),_0x44eceb?.['info'](_0x335d03(0x223)+_0x335d03(0x310)+_0x335d03(0x1fa)+'ynced',{'pluginSpecCount':_0x2198ee[_0x335d03(0x2bf)][_0x335d03(0x1fc)+_0x335d03(0x1e9)][_0x335d03(0x2bd)],'pluginCount':Array[_0x335d03(0x319)](_0x5cebe4['plugins'])?_0x5cebe4['plugins']['length']:0x0}),await syncProductPlugins(_0x2198ee,_0x3e3dab,_0x5cebe4,{'runtimeLogger':_0x44eceb}),_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2fa)+'plugins\x20'+_0x335d03(0x1f8),{'localPluginCount':_0x2198ee['openclaw']['resolved'+_0x335d03(0x32e)+_0x335d03(0x1ed)][_0x335d03(0x2bd)],'pluginCount':Array['isArray'](_0x5cebe4['plugins'])?_0x5cebe4[_0x335d03(0x2e2)][_0x335d03(0x2bd)]:0x0}),await syncProductAgents(_0x2198ee,_0x3e3dab,_0x5cebe4),_0x44eceb?.[_0x335d03(0x34b)]('product\x20'+_0x335d03(0x33d)+_0x335d03(0x1dc),{'source':_0x2198ee[_0x335d03(0x2bf)][_0x335d03(0x334)+'r'],'installPath':_0x5cebe4['agents']?.['installP'+'ath']}),await syncProductSkills(_0x2198ee,_0x3e3dab,_0x5cebe4),_0x44eceb?.[_0x335d03(0x34b)]('product\x20'+_0x335d03(0x221)+'ynced',{'source':_0x2198ee['openclaw']['skillsDi'+'r'],'installPath':_0x5cebe4[_0x335d03(0x307)]?.[_0x335d03(0x34d)+_0x335d03(0x31f)]}),await syncRuntimeWrapper(_0x2198ee,_0x3e3dab,_0x5cebe4),_0x44eceb?.[_0x335d03(0x34b)]('runtime\x20'+'wrapper\x20'+_0x335d03(0x1f8),{'wujieclawBin':_0x5cebe4[_0x335d03(0x2ce)+_0x335d03(0x320)]}),await writeJson(resolveManifestPath(_0x3e3dab),_0x5cebe4),_0x44eceb?.[_0x335d03(0x34b)](_0x335d03(0x2d6)+_0x335d03(0x294)+_0x335d03(0x27f),{'manifestPath':resolveManifestPath(_0x3e3dab),'manifest':summarizeRuntimeManifest(_0x5cebe4),'durationMs':Date[_0x335d03(0x265)]()-_0x500033}),await _0x44eceb?.[_0x335d03(0x323)](),_0x5cebe4;}catch(_0x1a9b9e){_0x44eceb?.[_0x335d03(0x26e)]('prepare\x20'+'runtime\x20'+_0x335d03(0x24d),{'syncOnly':syncOnly,'runtimeRoot':_0x3e3dab,'durationMs':Date[_0x335d03(0x265)]()-_0x500033,'error':_0x1a9b9e}),await _0x44eceb?.['flush']();throw _0x1a9b9e;}}async function syncRuntimeWrapper(_0x58433f,_0x3aa90d,_0x35ed2d){const _0x3c6875=_0x3edc6e,_0x555a57=_0x58433f['openclaw']?.[_0x3c6875(0x242)+_0x3c6875(0x208)]??_0x3c6875(0x322)+_0x3c6875(0x2c6),_0x2ec3c4=join(_0x3aa90d,_0x3c6875(0x281),_0x3c6875(0x2ce)+'w'),_0x4e9303=join(_0x3aa90d,_0x3c6875(0x281),'wujiecla'+'w.cmd'),_0x1f2118=normalizeRuntimeRelativePath(relative(dirname(_0x2ec3c4),resolve(_0x3aa90d,_0x35ed2d['nodeExec'+'utable']))),_0x123f30=normalizeRuntimeRelativePath(relative(dirname(_0x2ec3c4),resolve(_0x3aa90d,_0x35ed2d[_0x3c6875(0x2bf)+'Bin']))),_0x8fdbe9='$HOME/'+_0x58433f[_0x3c6875(0x29b)+_0x3c6875(0x240)],_0x598b73='%USERPRO'+'FILE%\x5c'+_0x58433f['dataDirN'+_0x3c6875(0x240)];await mkdir(dirname(_0x2ec3c4),{'recursive':!![]});const _0x221c42=fileURLToPath(new URL(_0x3c6875(0x2c8)+_0x3c6875(0x33a)+_0x3c6875(0x30d),import.meta.url)),_0x25ca57=join(_0x3aa90d,_0x3c6875(0x281),'wujie-lo'+'go.mjs');await cp(_0x221c42,_0x25ca57),await writeFile(_0x2ec3c4,['#!/bin/s'+'h',_0x3c6875(0x1dd)+_0x3c6875(0x2e0)+'HOME=\x22${'+_0x3c6875(0x343)+_0x3c6875(0x1d8)+_0x8fdbe9+'}\x22',_0x3c6875(0x1dd)+_0x3c6875(0x2e0)+_0x3c6875(0x2dd)+_0x3c6875(0x335)+_0x3c6875(0x22c)+_0x3c6875(0x2a5)+'-'+_0x8fdbe9+'}\x22',_0x3c6875(0x1dd)+_0x3c6875(0x2e0)+'CONFIG_P'+_0x3c6875(0x250)+_0x3c6875(0x2e0)+_0x3c6875(0x285)+_0x3c6875(0x2ef)+_0x8fdbe9+'/'+_0x555a57+'}\x22','SCRIPT_D'+_0x3c6875(0x23e)+_0x3c6875(0x1fe)+'--\x20\x22$(di'+_0x3c6875(0x2bb)+'\x20\x22$0\x22)\x22\x20'+'&&\x20pwd)',_0x3c6875(0x28a)+_0x3c6875(0x228)+_0x3c6875(0x2f2)+_0x3c6875(0x2b8)+_0x3c6875(0x1ff)+_0x3c6875(0x295),'\x20\x20\x22$SCRI'+_0x3c6875(0x303)+_0x1f2118+(_0x3c6875(0x2a2)+_0x3c6875(0x28b)+_0x3c6875(0x2f3)+_0x3c6875(0x2ea)+_0x3c6875(0x2e3)+_0x3c6875(0x1d4)+'ue'),'fi','exec\x20\x22$S'+_0x3c6875(0x318)+'R/'+_0x1f2118+(_0x3c6875(0x2a2)+_0x3c6875(0x303))+_0x123f30+_0x3c6875(0x214),'']['join']('\x0a'),_0x3c6875(0x2ed)),await chmod(_0x2ec3c4,0x1ed),await writeFile(_0x4e9303,['@echo\x20of'+'f',_0x3c6875(0x2e7)+_0x3c6875(0x22a)+'ME%\x22==\x22\x22'+'\x20set\x20\x22OP'+'ENCLAW_H'+'OME='+_0x598b73+'\x22',_0x3c6875(0x2e7)+'NCLAW_ST'+'ATE_DIR%'+_0x3c6875(0x305)+_0x3c6875(0x34e)+_0x3c6875(0x321)+_0x3c6875(0x2f6)+_0x598b73+'\x22',_0x3c6875(0x2e7)+'NCLAW_CO'+_0x3c6875(0x206)+_0x3c6875(0x32d)+_0x3c6875(0x2ca)+_0x3c6875(0x30a)+'NFIG_PAT'+'H='+_0x598b73+'\x5c'+_0x555a57+'\x22',_0x3c6875(0x339)+_0x3c6875(0x21d)+_0x3c6875(0x1eb),_0x3c6875(0x229)+'_DIR%'+toWindowsPath(_0x1f2118)+('\x22\x20\x22%SCRI'+_0x3c6875(0x327))+toWindowsPath(_0x123f30)+'\x22\x20%*',''][_0x3c6875(0x2aa)]('\x0d\x0a'),_0x3c6875(0x2ed)),_0x35ed2d[_0x3c6875(0x2ce)+_0x3c6875(0x320)]=toRuntimeRelative(_0x3aa90d,process['platform']==='win32'?_0x4e9303:_0x2ec3c4);}function normalizeRuntimeRelativePath(_0x503449){const _0x4fae62=_0x3edc6e;return _0x503449[_0x4fae62(0x239)+'ll']('\x5c','/');}function toWindowsPath(_0x1651c3){return _0x1651c3['replaceA'+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x5d9e4d,_0x5c3f0b){const _0x4a0fc2=_0x3edc6e;if(_0x5d9e4d['nodeVers'+_0x4a0fc2(0x1db)]===_0x5c3f0b['openclaw'][_0x4a0fc2(0x2c0)+'ion'])return;throw new Error(_0x4a0fc2(0x2d6)+_0x4a0fc2(0x2c0)+_0x4a0fc2(0x353)+'atch:\x20ma'+_0x4a0fc2(0x29e)+(_0x5d9e4d[_0x4a0fc2(0x2c0)+'ion']||_0x4a0fc2(0x266))+(_0x4a0fc2(0x234)+'config=')+_0x5c3f0b[_0x4a0fc2(0x2bf)]['nodeVers'+_0x4a0fc2(0x1db)]+'.\x20'+(_0x4a0fc2(0x256)+_0x4a0fc2(0x25f)+_0x4a0fc2(0x1d9)+_0x4a0fc2(0x23c)+'\x20product'+_0x4a0fc2(0x231)+_0x4a0fc2(0x341)+_0x4a0fc2(0x32b)+'with\x20the'+'\x20configu'+_0x4a0fc2(0x23b)+'\x20version'+'.'));}function validateRuntimeOpenClawVersion(_0x4c5e22,_0x423d80){const _0xdbcdd6=_0x3edc6e;if(_0x4c5e22[_0xdbcdd6(0x2bf)+'Version']===_0x423d80['openclaw'][_0xdbcdd6(0x2bf)+'Version'])return;throw new Error(_0xdbcdd6(0x2d6)+_0xdbcdd6(0x2bf)+'Version\x20'+'mismatch'+_0xdbcdd6(0x247)+_0xdbcdd6(0x2f8)+(_0x4c5e22[_0xdbcdd6(0x2bf)+'Version']||_0xdbcdd6(0x266))+(',\x20shell.'+_0xdbcdd6(0x282))+_0x423d80[_0xdbcdd6(0x2bf)][_0xdbcdd6(0x2bf)+'Version']+'.\x20'+(_0xdbcdd6(0x256)+'ie-shell'+_0xdbcdd6(0x1d9)+_0xdbcdd6(0x23c)+_0xdbcdd6(0x231)+'\x20can\x20ins'+_0xdbcdd6(0x222)+'\x20configu'+'red\x20Open'+'Claw\x20ver'+_0xdbcdd6(0x1fd)));}function parseNpmPackJson(_0x15615b){const _0xba68a1=_0x3edc6e,_0x25cf6c=_0x15615b[_0xba68a1(0x2df)](),_0x5f02cd=_0x25cf6c[_0xba68a1(0x30e)]('[');if(_0x5f02cd<0x0)throw new Error(_0xba68a1(0x1f1)+'\x20did\x20not'+_0xba68a1(0x218)+_0xba68a1(0x22b)+_0x25cf6c['slice'](0x0,0x1f4));const _0x1999ba=JSON[_0xba68a1(0x2be)](_0x25cf6c[_0xba68a1(0x2c2)](_0x5f02cd)),_0x2e9b57=Array['isArray'](_0x1999ba)?_0x1999ba[0x0]:_0x1999ba;if(!_0x2e9b57||typeof _0x2e9b57!==_0xba68a1(0x356))throw new Error('npm\x20pack'+_0xba68a1(0x344)+_0xba68a1(0x29d)+_0xba68a1(0x292)+_0xba68a1(0x342)+_0x25cf6c[_0xba68a1(0x2c2)](0x0,0x1f4));return _0x2e9b57;}function normalizePackedTarballFilename(_0x475522){const _0x5d3c8c=_0x3edc6e;return _0x475522[_0x5d3c8c(0x203)](/^@/,'')['replaceA'+'ll']('/','-')[_0x5d3c8c(0x239)+'ll']('\x5c','-');}async function runProcess(_0x53312c,_0x3300ac,_0x2139c4={}){const _0x1d10d4=_0x3edc6e,_0xf43696=_0x2139c4[_0x1d10d4(0x1f4)]||[_0x53312c,..._0x3300ac]['join']('\x20'),_0x6a14da=_0x2139c4[_0x1d10d4(0x27a)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x487126=spawn(_0x53312c,_0x3300ac,{'cwd':_0x2139c4[_0x1d10d4(0x1f5)],'env':_0x2139c4[_0x1d10d4(0x346)],'stdio':[_0x1d10d4(0x336),'pipe',_0x1d10d4(0x24f)]});return await new Promise((_0x5b98e2,_0x42818b)=>{const _0x321d03=_0x1d10d4;let _0x454ffe='',_0x2d77d2='',_0xf62813=![];const _0x5c5ce0=setTimeout(()=>{const _0x3424f9=_0xacd0;if(_0xf62813)return;_0xf62813=!![],_0x487126[_0x3424f9(0x355)](_0x3424f9(0x200)),_0x42818b(new Error(_0xf43696+(_0x3424f9(0x2b4)+_0x3424f9(0x2d8)+'\x20')+_0x6a14da+'ms'));},_0x6a14da);_0x487126[_0x321d03(0x1cb)]['on'](_0x321d03(0x350),_0x537f4f=>{_0x454ffe+=_0x537f4f['toString']();}),_0x487126[_0x321d03(0x32f)]['on']('data',_0x448637=>{const _0xabaa4a=_0x321d03;_0x2d77d2+=_0x448637[_0xabaa4a(0x267)]();}),_0x487126['on'](_0x321d03(0x26e),_0x545b99=>{if(_0xf62813)return;_0xf62813=!![],clearTimeout(_0x5c5ce0),_0x42818b(_0x545b99);}),_0x487126['on'](_0x321d03(0x2a3),(_0x4ee7b4,_0x1ecfe7)=>{const _0x2142ad=_0x321d03;if(_0xf62813)return;_0xf62813=!![],clearTimeout(_0x5c5ce0);if(_0x4ee7b4===0x0){_0x5b98e2({'stdout':_0x454ffe,'stderr':_0x2d77d2});return;}_0x42818b(new Error(_0xf43696+(_0x2142ad(0x293)+_0x2142ad(0x1e5)+'e=')+(_0x4ee7b4??_0x2142ad(0x1f3))+_0x2142ad(0x28f)+(_0x1ecfe7??_0x2142ad(0x1f3))+'\x0a'+(''+(_0x2d77d2||_0x454ffe))[_0x2142ad(0x2df)]()));});});}async function installOpenClawPackage(_0x14b8f1,_0x3efbfd){const _0x4f168d=_0x3edc6e,_0x465ce2=join(_0x14b8f1[_0x4f168d(0x311)+'oot'],_0x4f168d(0x28d)),_0x4deda0=join(_0x14b8f1[_0x4f168d(0x311)+'oot'],_0x4f168d(0x31c)+'w-extrac'+'t');await mkdir(_0x465ce2,{'recursive':!![]}),await rm(_0x4deda0,{'recursive':!![],'force':!![]}),await mkdir(_0x4deda0,{'recursive':!![]});const _0x29433f=await createRuntimeEnv(_0x14b8f1),_0x47f33e=_0x4f168d(0x2bf)+'@'+_0x3efbfd;console[_0x4f168d(0x2a4)](_0x4f168d(0x1f6)+_0x4f168d(0x289)+_0x4f168d(0x2c7)+_0x4f168d(0x235)+'\x20'+_0x47f33e);const _0x3d56c8=await runProcess(_0x14b8f1[_0x4f168d(0x283)+'utable'],[_0x14b8f1[_0x4f168d(0x1df)],_0x4f168d(0x29a),_0x47f33e,'--json'],{'cwd':_0x465ce2,'env':_0x29433f,'label':_0x4f168d(0x1f1)+'\x20'+_0x47f33e}),_0x2f9db4=parseNpmPackJson(_0x3d56c8[_0x4f168d(0x1cb)]);if(_0x2f9db4[_0x4f168d(0x2af)]!==_0x3efbfd)throw new Error(_0x4f168d(0x27e)+_0x4f168d(0x2fd)+'law\x20'+_0x3efbfd+(_0x4f168d(0x202)+'d\x20to\x20')+_0x2f9db4[_0x4f168d(0x2af)]);const _0x4a46da=resolve(_0x465ce2,_0x2f9db4[_0x4f168d(0x1d6)]);if(!existsSync(_0x4a46da))throw new Error(_0x4f168d(0x1f1)+_0x4f168d(0x1e6)+_0x4f168d(0x25d)+_0x4f168d(0x291)+'\x20'+_0x4a46da);await runProcess(_0x4f168d(0x254),[_0x4f168d(0x2d1),_0x4a46da,'-C',_0x4deda0],{'label':_0x4f168d(0x277)+_0x2f9db4[_0x4f168d(0x1d6)]}),await rm(_0x14b8f1[_0x4f168d(0x2bf)+_0x4f168d(0x290)+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x4deda0,'package'),_0x14b8f1['openclaw'+'WorkingD'+'ir']),await rm(_0x4deda0,{'recursive':!![],'force':!![]}),await runProcess(_0x14b8f1[_0x4f168d(0x283)+_0x4f168d(0x2cc)],[_0x14b8f1[_0x4f168d(0x1df)],_0x4f168d(0x224),_0x4f168d(0x345)+'ev',_0x4f168d(0x2c9)+_0x4f168d(0x1e1),_0x4f168d(0x262)+'it',_0x4f168d(0x272)+'d','--legacy'+_0x4f168d(0x2b6)+'ps'],{'cwd':_0x14b8f1[_0x4f168d(0x2bf)+_0x4f168d(0x290)+'ir'],'env':_0x29433f,'label':_0x4f168d(0x288)+_0x4f168d(0x20e)+_0x47f33e+(_0x4f168d(0x231)+_0x4f168d(0x20c)+'ncies')});if(!existsSync(_0x14b8f1[_0x4f168d(0x2bf)+_0x4f168d(0x2f7)]))throw new Error(_0x4f168d(0x32c)+_0x4f168d(0x204)+'\x20not\x20fou'+_0x4f168d(0x306)+_0x4f168d(0x1ef)+':\x20'+_0x14b8f1[_0x4f168d(0x2bf)+_0x4f168d(0x2f7)]);}async function ensureRuntimeBase(_0x2bd8dd,_0x833fcb,_0x1b7703={}){const _0x283da9=_0x3edc6e;await mkdir(_0x833fcb,{'recursive':!![]});let _0x46254d=await readRuntimeManifest(_0x833fcb);const _0x4ec2b9=_0x2bd8dd[_0x283da9(0x2bf)][_0x283da9(0x2c0)+_0x283da9(0x1db)],_0x808fdd=_0x2bd8dd['openclaw']['openclaw'+'Version'],_0x196aa0=existsSync(resolveManifestPath(_0x833fcb)),_0x423955=runtimeHasRequiredPaths(_0x833fcb,_0x46254d),_0x576501=_0x46254d[_0x283da9(0x2c0)+'ion']===_0x4ec2b9;!_0x196aa0||!_0x423955||!_0x576501?(_0x1b7703[_0x283da9(0x249)+'ogger']?.[_0x283da9(0x34b)](_0x283da9(0x2d6)+_0x283da9(0x26f)+_0x283da9(0x340)+'ed',{'runtimeRoot':_0x833fcb,'reason':!_0x196aa0?_0x283da9(0x24a)+_0x283da9(0x294):!_0x423955?_0x283da9(0x24a)+_0x283da9(0x259)+_0x283da9(0x231)+_0x283da9(0x2a7):_0x283da9(0x1d7)+'sion\x20mis'+_0x283da9(0x233),'syncOnly':_0x1b7703[_0x283da9(0x2d2)]}),_0x46254d=await buildRuntimeBase(_0x2bd8dd,_0x833fcb,_0x46254d),_0x1b7703[_0x283da9(0x249)+_0x283da9(0x274)]?.[_0x283da9(0x34b)](_0x283da9(0x2d6)+_0x283da9(0x26f)+_0x283da9(0x268)+_0x283da9(0x217),{'manifest':summarizeRuntimeManifest(_0x46254d)})):_0x1b7703['runtimeL'+_0x283da9(0x274)]?.['info']('runtime\x20'+_0x283da9(0x2ab)+_0x283da9(0x351)+_0x283da9(0x2fe),{'manifest':summarizeRuntimeManifest(_0x46254d)});if(!existsSync(resolve(_0x833fcb,_0x46254d[_0x283da9(0x2bf)+'Bin']))){const _0x55f1b7=createRuntimeInfoFromManifest(_0x833fcb,_0x46254d,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x55f1b7,_0x808fdd),_0x46254d[_0x283da9(0x2bf)+_0x283da9(0x2eb)]=_0x808fdd;}return _0x46254d;}function runtimeHasRequiredPaths(_0x4d5490,_0x36f75b){const _0x568cb4=_0x3edc6e;return[_0x568cb4(0x283)+_0x568cb4(0x2cc),'npmCli',_0x568cb4(0x2bf)+_0x568cb4(0x290)+'ir',_0x568cb4(0x2bf)+_0x568cb4(0x2f7)][_0x568cb4(0x25e)](_0x32dc70=>typeof _0x36f75b[_0x32dc70]===_0x568cb4(0x276)&&_0x36f75b[_0x32dc70][_0x568cb4(0x2df)]())&&['nodeExec'+'utable',_0x568cb4(0x1df)][_0x568cb4(0x25e)](_0x161fcc=>existsSync(resolve(_0x4d5490,_0x36f75b[_0x161fcc])));}async function buildRuntimeBase(_0x2acfbf,_0x1c154b,_0x32a2dc={}){const _0x115a1a=_0x3edc6e,_0x2fa2b2=join(_0x1c154b,_0x115a1a(0x261));await ensureRuntimeNode(_0x2acfbf,_0x2fa2b2);const _0x51057f={..._0x32a2dc,'generatedAt':new Date()[_0x115a1a(0x1f7)+_0x115a1a(0x308)](),'nodeVersion':_0x2acfbf['openclaw'][_0x115a1a(0x2c0)+_0x115a1a(0x1db)],'openclawVersion':_0x32a2dc[_0x115a1a(0x2bf)+'Version']||'','platform':process[_0x115a1a(0x2ac)],'arch':process[_0x115a1a(0x29c)],'nodeExecutable':_0x115a1a(0x1e4)+'/node','npmCli':_0x115a1a(0x2cb)+_0x115a1a(0x358)+'dules/np'+'m/bin/np'+'m-cli.js','openclawWorkingDir':_0x115a1a(0x2bf),'openclawBin':_0x115a1a(0x2bf)+'/opencla'+'w.mjs'};return await writeJson(resolveManifestPath(_0x1c154b),_0x51057f),_0x51057f;}async function ensureRuntimeNode(_0x3c59a1,_0xe8a491){const _0x279c35=_0x3edc6e,_0x422cda=_0x3c59a1[_0x279c35(0x2bf)]['nodeVers'+_0x279c35(0x1db)],_0x392939=join(_0xe8a491,_0x279c35(0x281),_0x279c35(0x261)),_0x3dd316=join(_0xe8a491,'lib','node_mod'+_0x279c35(0x30b),_0x279c35(0x26c),_0x279c35(0x281),_0x279c35(0x313)+'js');if(existsSync(_0x392939)&&existsSync(_0x3dd316)&&await getNodeVersion(_0x392939)===_0x422cda)return;await rm(_0xe8a491,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});if(process[_0x279c35(0x2fc)][_0x279c35(0x261)]===_0x422cda){await linkCurrentNodeRuntime(_0xe8a491);return;}await downloadNodeRuntime(_0x422cda,_0xe8a491);}async function getNodeVersion(_0x2b5cfb){const _0x149a68=_0x3edc6e;try{const _0x3d4f82=await runProcess(_0x2b5cfb,['-p',_0x149a68(0x348)+_0x149a68(0x2fc)+'.node'],{'label':_0x2b5cfb+'\x20version','timeoutMs':0x7530});return _0x3d4f82['stdout'][_0x149a68(0x2df)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x1c0677){const _0x3eba2f=_0x3edc6e,_0x7eebb0=process['execPath'],_0x42de8b=resolve(dirname(_0x7eebb0),'..'),_0x64f3a9=resolve(_0x42de8b,_0x3eba2f(0x241)+'_modules'+_0x3eba2f(0x34c)),_0x459558=join(_0x1c0677,_0x3eba2f(0x281),_0x3eba2f(0x261)),_0x708da=join(_0x1c0677,'lib',_0x3eba2f(0x257)+'ules',_0x3eba2f(0x26c));await mkdir(dirname(_0x459558),{'recursive':!![]}),await mkdir(dirname(_0x708da),{'recursive':!![]}),await symlink(_0x7eebb0,_0x459558),existsSync(_0x64f3a9)?await symlink(_0x64f3a9,_0x708da):await symlink(await resolveNpmRoot(),_0x708da);}async function resolveNpmRoot(){const _0x525d08=_0x3edc6e,_0x3d7f5a=await runProcess(_0x525d08(0x26c),[_0x525d08(0x2e4),'-g'],{'label':'npm\x20root'+_0x525d08(0x2f4),'timeoutMs':0x7530}),_0x5a70bd=join(_0x3d7f5a[_0x525d08(0x1cb)][_0x525d08(0x2df)](),_0x525d08(0x26c));if(!existsSync(join(_0x5a70bd,_0x525d08(0x281),_0x525d08(0x313)+'js')))throw new Error(_0x525d08(0x1f1)+'age\x20was\x20'+_0x525d08(0x28c)+_0x525d08(0x246)+_0x525d08(0x1ce)+_0x525d08(0x2d3)+'d:\x20'+_0x5a70bd);return _0x5a70bd;}async function downloadNodeRuntime(_0xbae527,_0x593494){const _0x124436=_0x3edc6e,_0x5bccdd=process[_0x124436(0x2ac)]===_0x124436(0x2b0)?_0x124436(0x2a8):process[_0x124436(0x2ac)],_0x1a3bad=process['arch']===_0x124436(0x212)?_0x124436(0x212):process[_0x124436(0x29c)]==='arm64'?_0x124436(0x260):process[_0x124436(0x29c)],_0x2d49dd=process['platform']===_0x124436(0x2b0)?_0x124436(0x317):'tar.xz',_0x266952=_0x124436(0x243)+_0xbae527+'-'+_0x5bccdd+'-'+_0x1a3bad,_0x1fd870=_0x266952+'.'+_0x2d49dd,_0xe7fc86=join(dirname(_0x593494),'.cache'),_0x4c4e8f=join(_0xe7fc86,_0x1fd870),_0xece081=join(_0xe7fc86,_0x266952+(_0x124436(0x2ee)+'-')+process[_0x124436(0x20d)]+'-'+Date['now']()),_0x2eae16=_0x124436(0x2fb)+_0x124436(0x236)+_0x124436(0x27c)+'v'+_0xbae527+'/'+_0x1fd870;await mkdir(_0xe7fc86,{'recursive':!![]}),!existsSync(_0x4c4e8f)&&(console[_0x124436(0x2a4)](_0x124436(0x1f6)+'hell:run'+_0x124436(0x21f)+_0x124436(0x280)+'g\x20'+_0x2eae16),await downloadFile(_0x2eae16,_0x4c4e8f)),await rm(_0xece081,{'recursive':!![],'force':!![]}),await mkdir(_0xece081,{'recursive':!![]}),process['platform']===_0x124436(0x2b0)?await runProcess('unzip',['-q',_0x4c4e8f,'-d',_0xece081],{'label':'extract\x20'+_0x1fd870}):await runProcess(_0x124436(0x254),['-xJf',_0x4c4e8f,'-C',_0xece081],{'label':_0x124436(0x277)+_0x1fd870}),await rename(join(_0xece081,_0x266952),_0x593494),await rm(_0xece081,{'recursive':!![],'force':!![]});}async function downloadFile(_0x3c14e0,_0x486646){await mkdir(dirname(_0x486646),{'recursive':!![]});const _0x4bad41=await new Promise((_0x4c9c0b,_0x3a805e)=>{const _0x7366ec=_0xacd0;get(_0x3c14e0,_0x3e20cb=>{const _0x5043c8=_0xacd0;if(_0x3e20cb[_0x5043c8(0x29f)+'de']>=0x12c&&_0x3e20cb[_0x5043c8(0x29f)+'de']<0x190&&_0x3e20cb[_0x5043c8(0x210)][_0x5043c8(0x201)]){_0x3e20cb[_0x5043c8(0x24e)](),downloadFile(new URL(_0x3e20cb[_0x5043c8(0x210)][_0x5043c8(0x201)],_0x3c14e0)[_0x5043c8(0x1de)],_0x486646)[_0x5043c8(0x295)](()=>_0x4c9c0b(null))[_0x5043c8(0x25a)](_0x3a805e);return;}if(_0x3e20cb[_0x5043c8(0x29f)+'de']!==0xc8){_0x3e20cb[_0x5043c8(0x24e)](),_0x3a805e(new Error(_0x5043c8(0x264)+_0x5043c8(0x293)+_0x3e20cb[_0x5043c8(0x29f)+'de']+':\x20'+_0x3c14e0));return;}_0x4c9c0b(_0x3e20cb);})['on'](_0x7366ec(0x26e),_0x3a805e);});_0x4bad41&&await pipeline(_0x4bad41,createWriteStream(_0x486646));}export async function ensureOpenClawDoctorFixed(_0x3488af,_0x3e7277={}){const _0x44c77f=_0x3edc6e,_0x1df7a0=await loadRuntimeInfo(_0x3488af['projectR'+_0x44c77f(0x27d)]),_0x5f665a=getConfigPaths(_0x3488af),_0x17ef4b=join(_0x5f665a[_0x44c77f(0x1fb)+_0x44c77f(0x2f9)],_0x44c77f(0x2bf)+_0x44c77f(0x1f0)+'json'),_0x5d1509=await readJson(_0x17ef4b,{});if(_0x5d1509[_0x44c77f(0x2bf)+'Version']===_0x1df7a0[_0x44c77f(0x2bf)+_0x44c77f(0x2eb)])return _0x3e7277['runtimeL'+_0x44c77f(0x274)]?.['info'](_0x44c77f(0x2bf)+_0x44c77f(0x297)+'fix\x20alre'+_0x44c77f(0x244)+'ent',{'openclawVersion':_0x1df7a0[_0x44c77f(0x2bf)+_0x44c77f(0x2eb)],'markerPath':_0x17ef4b}),{'ran':![],'openclawVersion':_0x1df7a0['openclaw'+_0x44c77f(0x2eb)],'markerPath':_0x17ef4b};return await runOpenClawDoctorFix(_0x3488af,_0x1df7a0,{'fromVersion':_0x5d1509[_0x44c77f(0x2bf)+'Version']||_0x44c77f(0x266),'toVersion':_0x1df7a0[_0x44c77f(0x2bf)+_0x44c77f(0x2eb)],'markerPath':_0x17ef4b,'runtimeLogger':_0x3e7277[_0x44c77f(0x249)+'ogger']}),{'ran':!![],'openclawVersion':_0x1df7a0[_0x44c77f(0x2bf)+_0x44c77f(0x2eb)],'markerPath':_0x17ef4b};}async function runOpenClawDoctorFix(_0x2428ac,_0x5af2b5,{fromVersion:_0x39d578,toVersion:_0x5cf859,markerPath:markerPath='',runtimeLogger:_0x5ccaa7}={}){const _0x5aa2db=_0x3edc6e;_0x5ccaa7?.['info']('openclaw'+_0x5aa2db(0x297)+_0x5aa2db(0x312)+_0x5aa2db(0x271),{'fromVersion':_0x39d578,'toVersion':_0x5cf859});const _0x574c61=await createRuntimeEnv(_0x5af2b5,{'OPENCLAW_HOME':_0x2428ac['dataDir'],'OPENCLAW_STATE_DIR':_0x2428ac[_0x5aa2db(0x2a1)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x2428ac)['configPa'+'th']});console[_0x5aa2db(0x2a4)]('[wujie-s'+_0x5aa2db(0x289)+_0x5aa2db(0x2c1)+_0x5aa2db(0x28e)+'enclaw\x20d'+_0x5aa2db(0x354)+_0x5aa2db(0x1e2));const _0x401071=await runProcess(_0x5af2b5[_0x5aa2db(0x283)+_0x5aa2db(0x2cc)],[_0x5af2b5[_0x5aa2db(0x2bf)+_0x5aa2db(0x2f7)],_0x5aa2db(0x2de),_0x5aa2db(0x215)],{'cwd':_0x5af2b5[_0x5aa2db(0x2bf)+'WorkingD'+'ir'],'env':_0x574c61,'label':_0x5aa2db(0x2bf)+'\x20doctor\x20'+_0x5aa2db(0x215),'timeoutMs':0x1d4c0});_0x5ccaa7?.['info']('openclaw'+'\x20doctor\x20'+_0x5aa2db(0x349)+_0x5aa2db(0x1d5),{'fromVersion':_0x39d578,'toVersion':_0x5cf859,'stdout':_0x401071[_0x5aa2db(0x1cb)][_0x5aa2db(0x2df)]()[_0x5aa2db(0x2c2)](-0xfa0),'stderr':_0x401071[_0x5aa2db(0x32f)]['trim']()[_0x5aa2db(0x2c2)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x5af2b5[_0x5aa2db(0x2bf)+'Version'],'fixedAt':new Date()['toISOStr'+'ing']()}),_0x5ccaa7?.['info'](_0x5aa2db(0x2bf)+_0x5aa2db(0x297)+_0x5aa2db(0x1ea)+'er\x20writt'+'en',{'markerPath':markerPath,'openclawVersion':_0x5af2b5['openclaw'+_0x5aa2db(0x2eb)]}));}export async function readRuntimeManifest(_0x290a5d){return await readJson(resolveManifestPath(_0x290a5d),{});}export async function loadRuntimeInfo(_0x528a1d){const _0x1224a4=resolveRuntimeRoot(_0x528a1d),_0x41614e=await readRuntimeManifest(_0x1224a4);return createRuntimeInfoFromManifest(_0x1224a4,_0x41614e);}function createRuntimeInfoFromManifest(_0x5b3836,_0x447d89,_0x1aea25={}){const _0x9e1991=_0x3edc6e;for(const _0x5b85ee of[_0x9e1991(0x283)+_0x9e1991(0x2cc),_0x9e1991(0x1df),'openclaw'+_0x9e1991(0x290)+'ir',_0x9e1991(0x2bf)+'Bin']){if(typeof _0x447d89[_0x5b85ee]!==_0x9e1991(0x276)||!_0x447d89[_0x5b85ee][_0x9e1991(0x2df)]())throw new Error(_0x9e1991(0x2d6)+_0x9e1991(0x294)+_0x9e1991(0x23d)+'ing\x20\x22'+_0x5b85ee+'\x22\x20at\x20'+resolveManifestPath(_0x5b3836)+(_0x9e1991(0x2cf)+_0x9e1991(0x2e6)+_0x9e1991(0x20a)+'e'));}const _0x465185=resolve(_0x5b3836,_0x447d89[_0x9e1991(0x283)+'utable']),_0x54fd78=resolve(_0x5b3836,_0x447d89['npmCli']),_0x5ad3ec=resolve(_0x5b3836,_0x447d89['openclaw'+'WorkingD'+'ir']),_0x2a939b=resolve(_0x5b3836,_0x447d89['openclaw'+_0x9e1991(0x2f7)]),_0x4bd6d9=Array[_0x9e1991(0x319)](_0x447d89[_0x9e1991(0x2e2)])?_0x447d89[_0x9e1991(0x2e2)][_0x9e1991(0x21a)](_0x523ece=>({..._0x523ece,'installPath':resolve(_0x5b3836,_0x523ece['installP'+_0x9e1991(0x31f)])})):[],_0x1576ba=_0x1aea25[_0x9e1991(0x1e8)+_0x9e1991(0x2ff)+'Claw']?[_0x465185,_0x54fd78]:[_0x465185,_0x54fd78,_0x5ad3ec,_0x2a939b];for(const _0xa0f6ef of _0x1576ba){if(!existsSync(_0xa0f6ef))throw new Error(_0x9e1991(0x2d6)+'missing\x20'+_0x9e1991(0x213)+_0xa0f6ef);}return{'runtimeRoot':_0x5b3836,'manifest':_0x447d89,'openclawVersion':_0x447d89[_0x9e1991(0x2bf)+_0x9e1991(0x2eb)]||_0x9e1991(0x266),'nodeExecutable':_0x465185,'npmCli':_0x54fd78,'openclawWorkingDir':_0x5ad3ec,'openclawBin':_0x2a939b,'plugins':_0x4bd6d9};}export async function spawnClaw(_0x409328,_0x16eb45=[],_0x3a27d5={}){const _0x10220d=_0x3edc6e,_0x14f586=await loadRuntimeInfo(_0x409328),_0x8c08=await createRuntimeEnv(_0x14f586,_0x3a27d5[_0x10220d(0x346)]??{});return spawn(_0x14f586[_0x10220d(0x283)+_0x10220d(0x2cc)],[_0x14f586['openclaw'+_0x10220d(0x2f7)],..._0x16eb45],{'cwd':_0x14f586[_0x10220d(0x2bf)+'WorkingD'+'ir'],'stdio':'pipe',..._0x3a27d5,'env':_0x8c08});}export async function runClawOnce(_0x3a2d86,_0x30e22f=[],_0x20d60b=0x15f90){const _0x260a4d=await spawnClaw(_0x3a2d86,_0x30e22f);return await new Promise((_0x578390,_0x153fd5)=>{const _0x2af4c3=_0xacd0;let _0xf99354='',_0x4b403a='',_0x5b9e32=![];const _0x222012=setTimeout(()=>{const _0x1179d0=_0xacd0;if(_0x5b9e32)return;_0x5b9e32=!![],_0x260a4d[_0x1179d0(0x355)](_0x1179d0(0x200)),_0x153fd5(new Error(_0x1179d0(0x2bf)+_0x1179d0(0x2b4)+_0x1179d0(0x2d8)+'\x20'+_0x20d60b+'ms'));},_0x20d60b);_0x260a4d[_0x2af4c3(0x1cb)]['on']('data',_0x5dfcc5=>{const _0x1b8831=_0x2af4c3;_0xf99354+=_0x5dfcc5[_0x1b8831(0x267)]();}),_0x260a4d[_0x2af4c3(0x32f)]['on']('data',_0x8fc3ce=>{const _0xcc7860=_0x2af4c3;_0x4b403a+=_0x8fc3ce[_0xcc7860(0x267)]();}),_0x260a4d['on'](_0x2af4c3(0x26e),_0x4d5e8a=>{if(_0x5b9e32)return;_0x5b9e32=!![],clearTimeout(_0x222012),_0x153fd5(_0x4d5e8a);}),_0x260a4d['on'](_0x2af4c3(0x2a3),(_0x4ae32b,_0xfc9ac4)=>{if(_0x5b9e32)return;_0x5b9e32=!![],clearTimeout(_0x222012),_0x578390({'code':_0x4ae32b,'signal':_0xfc9ac4,'stdout':_0xf99354,'stderr':_0x4b403a});});});}async function findRuntimeLarkCliBin(_0x31fc9c){const _0x2efde0=_0x3edc6e,_0x16b94e=join(_0x31fc9c[_0x2efde0(0x2bf)+_0x2efde0(0x290)+'ir'],_0x2efde0(0x257)+_0x2efde0(0x30b),'@larksui'+'te',_0x2efde0(0x269)),_0x1759bf=join(_0x16b94e,_0x2efde0(0x314)+'json');if(!existsSync(_0x1759bf))return{'packageDir':_0x16b94e,'binPath':null};try{const _0x216b9b=JSON['parse'](await readFile(_0x1759bf,_0x2efde0(0x2ed))),_0x2e19f7=typeof _0x216b9b[_0x2efde0(0x281)]==='string'?_0x216b9b['bin']:_0x216b9b[_0x2efde0(0x281)]&&typeof _0x216b9b[_0x2efde0(0x281)]===_0x2efde0(0x356)?_0x216b9b['bin']['lark-cli']||Object['values'](_0x216b9b['bin'])[0x0]:'';return{'packageDir':_0x16b94e,'binPath':_0x2e19f7?join(_0x16b94e,_0x2e19f7):null};}catch{return{'packageDir':_0x16b94e,'binPath':null};}}async function findRuntimeKdocsCliBin(_0x1fbdc0){const _0x1c68e4=_0x3edc6e,_0x43c907=join(_0x1fbdc0['openclaw'+'WorkingD'+'ir'],_0x1c68e4(0x324),'kdocs-cl'+'i'),_0x4ecd53=join(_0x43c907,process[_0x1c68e4(0x2ac)]===_0x1c68e4(0x2b0)?_0x1c68e4(0x30c)+_0x1c68e4(0x296):_0x1c68e4(0x30c)+'i');return{'installDir':_0x43c907,'binPath':existsSync(_0x4ecd53)?_0x4ecd53:null};}export async function resolveRuntimeLarkCliCommand(_0x1ad5be){const _0x4876b4=_0x3edc6e,{packageDir:_0x24d133,binPath:_0x4b2abe}=await findRuntimeLarkCliBin(_0x1ad5be);if(!_0x4b2abe||!existsSync(_0x4b2abe))throw new Error(_0x4876b4(0x21e)+_0x4876b4(0x286)+'te/cli\x20i'+_0x4876b4(0x34a)+_0x4876b4(0x31a)+'penClaw\x20'+'runtime:'+'\x20'+_0x24d133+('.\x20Run\x20\x22w'+_0x4876b4(0x23a)+_0x4876b4(0x248)+'re\x22\x20to\x20r'+_0x4876b4(0x252)+_0x4876b4(0x1f2)+_0x4876b4(0x2ec)));return{'nodeExecutable':_0x1ad5be['nodeExec'+_0x4876b4(0x2cc)],'scriptPath':_0x4b2abe,'packageDir':_0x24d133};}export async function resolveRuntimeKdocsCliCommand(_0x3b030e){const _0x519452=_0x3edc6e,{installDir:_0xb11145,binPath:_0x1cbf1c}=await findRuntimeKdocsCliBin(_0x3b030e);if(!_0x1cbf1c||!existsSync(_0x1cbf1c))throw new Error(_0x519452(0x21e)+_0x519452(0x30c)+_0x519452(0x2d9)+'sing\x20fro'+'m\x20OpenCl'+_0x519452(0x1da)+'me:\x20'+_0xb11145+('.\x20Run\x20\x22w'+_0x519452(0x23a)+'ll\x20prepa'+'re\x22\x20to\x20r'+_0x519452(0x252)+_0x519452(0x1f2)+_0x519452(0x2ec)));return{'executablePath':_0x1cbf1c,'installDir':_0xb11145};}async function createRuntimeEnv(_0xddd579,_0x3acb55={}){const _0x172def=_0x3edc6e,_0x356f8c=process.env.OPENCLAW_STATE_DIR||'',_0x58db48=_0x356f8c?join(_0x356f8c,_0x172def(0x2b2)+_0x172def(0x26d)+'ls'):join(_0xddd579[_0x172def(0x311)+_0x172def(0x27d)],_0x172def(0x251)),_0x554a91=join(_0x58db48,_0x172def(0x22e)+'al'),_0x556e85=join(_0x58db48,_0x172def(0x2a9)+'e'),_0x334638=join(_0x554a91,_0x172def(0x281));await mkdir(_0x334638,{'recursive':!![]}),await mkdir(_0x556e85,{'recursive':!![]});const _0xd5e029=[_0x334638,dirname(_0xddd579['nodeExec'+'utable']),process.env.PATH||''];return{...process.env,..._0x3acb55,'PATH':_0xd5e029[_0x172def(0x273)](Boolean)[_0x172def(0x2aa)](delimiter),'npm_config_prefix':_0x554a91,'NPM_CONFIG_PREFIX':_0x554a91,'npm_config_cache':_0x556e85,'NPM_CONFIG_CACHE':_0x556e85,'npm_config_registry':_0x172def(0x2fb)+_0x172def(0x227)+_0x172def(0x220)+_0x172def(0x326),'NPM_CONFIG_REGISTRY':'https://'+_0x172def(0x227)+_0x172def(0x220)+_0x172def(0x326),'npm_execpath':_0xddd579[_0x172def(0x1df)],'npm_node_execpath':_0xddd579['nodeExec'+_0x172def(0x2cc)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x554a91,'OPENCLAW_RUNTIME_NPM_BIN':_0x334638,'OPENCLAW_RUNTIME_NPM_REGISTRY':_0x172def(0x2fb)+_0x172def(0x227)+_0x172def(0x220)+_0x172def(0x326)};}export async function getRuntimeSpawnContext(_0x5a1b52,_0x5db733={}){const _0x59c3a4=_0x3edc6e,_0x280d54=await loadRuntimeInfo(_0x5a1b52),_0x42182d=await createRuntimeEnv(_0x280d54,_0x5db733);return{'cwd':_0x280d54['openclaw'+_0x59c3a4(0x290)+'ir'],'env':_0x42182d,'runtime':_0x280d54};}async function ensureBundledOpenClawTools(_0x412916,_0xa010a7,_0x8dc32,_0x31cf36={}){const _0x1a4c21=_0x3edc6e;if(_0x31cf36[_0x1a4c21(0x2d2)])return;const _0x4f9bc4=createRuntimeInfoFromManifest(_0xa010a7,_0x8dc32);await installKdocsCliBinary(_0x412916,_0x4f9bc4,_0x31cf36);}function toKdocsCliPlatform(_0x24844c){const _0x4c3a87=_0x3edc6e;if(_0x24844c===_0x4c3a87(0x2b0))return _0x4c3a87(0x287);return _0x24844c;}function toKdocsCliArch(_0x3ce7b7){const _0x458f54=_0x3edc6e;if(_0x3ce7b7===_0x458f54(0x212))return'amd64';return _0x3ce7b7;}async function resolveKdocsSkillVersion(_0x504f8d){const _0x1d26aa=_0x3edc6e,_0x2b98b2=_0x504f8d[_0x1d26aa(0x2bf)][_0x1d26aa(0x1d1)+'r'],_0x2fd513=existsSync(_0x2b98b2)?(await readdir(_0x2b98b2,{'withFileTypes':!![]}))[_0x1d26aa(0x273)](_0x1a07ee=>_0x1a07ee[_0x1d26aa(0x1ec)+_0x1d26aa(0x2bc)]())[_0x1d26aa(0x21a)](_0x1b7669=>join(_0x2b98b2,_0x1b7669[_0x1d26aa(0x2f5)],_0x1d26aa(0x33e))):[];for(const _0x3d6114 of _0x2fd513){if(!existsSync(_0x3d6114))continue;const _0x5bbd19=await readFile(_0x3d6114,'utf8');if(!/^name:\s*kdocs\s*$/m['test'](_0x5bbd19))continue;const _0x58769c=_0x5bbd19[_0x1d26aa(0x233)](/^version:\s*"?([^"\s]+)"?\s*$/m);if(_0x58769c?.[0x1])return _0x58769c[0x1];}throw new Error(_0x1d26aa(0x2da)+_0x1d26aa(0x332)+_0x1d26aa(0x2e5)+_0x1d26aa(0x337)+'rsion\x20fr'+_0x1d26aa(0x2b3)+_0x2b98b2);}function findFileByName(_0x5e3ee2,_0x47159b){const _0x4b62a1=_0x3edc6e;if(!existsSync(_0x5e3ee2))return null;for(const _0x59e278 of readdirSync(_0x5e3ee2,{'withFileTypes':!![]})){const _0x52986d=join(_0x5e3ee2,_0x59e278['name']);if(_0x59e278['isDirect'+'ory']()){const _0x1602fb=findFileByName(_0x52986d,_0x47159b);if(_0x1602fb)return _0x1602fb;continue;}if(_0x59e278[_0x4b62a1(0x1e7)]()&&_0x59e278[_0x4b62a1(0x2f5)]===_0x47159b)return _0x52986d;}return null;}async function installKdocsCliBinary(_0x5715ce,_0x21adc0,_0x278acb={}){const _0x20cbdc=_0x3edc6e,_0x168933=await resolveKdocsSkillVersion(_0x5715ce),_0x132fb4=toKdocsCliPlatform(process['platform']),_0x151d52=toKdocsCliArch(process[_0x20cbdc(0x29c)]),_0x4202c5=process['platform']===_0x20cbdc(0x2b0)?_0x20cbdc(0x30c)+_0x20cbdc(0x296):_0x20cbdc(0x30c)+'i',_0xa81fef=join(_0x21adc0['openclaw'+_0x20cbdc(0x290)+'ir'],_0x20cbdc(0x324),'kdocs-cl'+'i'),_0x56c498=join(_0xa81fef,_0x4202c5);if(existsSync(_0x56c498))try{const _0x248173=(await runProcess(_0x56c498,['version'],{'label':_0x20cbdc(0x30c)+'i\x20versio'+'n','timeoutMs':0x7530}))['stdout'][_0x20cbdc(0x2df)]();if(_0x248173===_0x168933){_0x278acb[_0x20cbdc(0x249)+_0x20cbdc(0x274)]?.[_0x20cbdc(0x34b)]('kdocs-cl'+_0x20cbdc(0x359)+'y\x20instal'+_0x20cbdc(0x21b),{'version':_0x168933,'installDir':_0xa81fef});return;}}catch{}const _0x2f7cc8=_0x132fb4===_0x20cbdc(0x287)?_0x20cbdc(0x23f):_0x20cbdc(0x21c),_0x2bddce=_0x20cbdc(0x30c)+'i-'+_0x168933+'-'+_0x132fb4+'-'+_0x151d52+_0x2f7cc8,_0x5dc96d=join(_0x21adc0['runtimeR'+'oot'],'.cache'),_0x305a15=join(_0x5dc96d,_0x2bddce),_0x33b764=join(_0x21adc0[_0x20cbdc(0x311)+'oot'],_0x20cbdc(0x24b)+_0x20cbdc(0x209)+_0x20cbdc(0x2db)+process['pid']+'-'+Date[_0x20cbdc(0x265)]()),_0x3d77b7=KDOCS_CLI_CDN_BASE+'/v'+_0x168933+('/release'+'s/')+_0x2bddce;await mkdir(_0x5dc96d,{'recursive':!![]});!existsSync(_0x305a15)&&(console['log'](_0x20cbdc(0x1f6)+'hell:run'+_0x20cbdc(0x21f)+'wnloadin'+'g\x20'+_0x3d77b7),await downloadFile(_0x3d77b7,_0x305a15));await rm(_0x33b764,{'recursive':!![],'force':!![]}),await mkdir(_0x33b764,{'recursive':!![]});_0x305a15[_0x20cbdc(0x279)](_0x20cbdc(0x23f))?await runProcess(_0x20cbdc(0x315),['-q',_0x305a15,'-d',_0x33b764],{'label':_0x20cbdc(0x277)+_0x2bddce}):await runProcess(_0x20cbdc(0x254),['-xzf',_0x305a15,'-C',_0x33b764],{'label':'extract\x20'+_0x2bddce});const _0x22cf03=findFileByName(_0x33b764,_0x4202c5);if(!_0x22cf03)throw new Error(_0x20cbdc(0x30c)+_0x20cbdc(0x284)+'\x20not\x20fou'+_0x20cbdc(0x304)+_0x20cbdc(0x2f0)+_0x2bddce);await rm(_0xa81fef,{'recursive':!![],'force':!![]}),await mkdir(_0xa81fef,{'recursive':!![]}),await cp(_0x22cf03,_0x56c498);if(process[_0x20cbdc(0x2ac)]!==_0x20cbdc(0x2b0))await chmod(_0x56c498,0x1ed);await writeFile(join(_0xa81fef,_0x20cbdc(0x1d2)),_0x20cbdc(0x2ad)+_0x20cbdc(0x1d3)+'ime\x0a',_0x20cbdc(0x2ed)),await rm(_0x33b764,{'recursive':!![],'force':!![]}),_0x278acb[_0x20cbdc(0x249)+_0x20cbdc(0x274)]?.[_0x20cbdc(0x34b)](_0x20cbdc(0x30c)+_0x20cbdc(0x211)+_0x20cbdc(0x21b),{'version':_0x168933,'installDir':_0xa81fef,'binPath':_0x56c498});}function resolvePackageNameFromNpmSpec(_0x289bff){const _0x2d5af6=_0x3edc6e,_0x2d7385=_0x289bff[_0x2d5af6(0x2df)]()[_0x2d5af6(0x203)](/^npm:/,'');if(!_0x2d7385)throw new Error(_0x2d5af6(0x263)+_0x2d5af6(0x258)+_0x2d5af6(0x20b)+'c');if(_0x2d7385[_0x2d5af6(0x278)+'th']('@')){const _0x41a35d=_0x2d7385['indexOf']('/');if(_0x41a35d===-0x1)throw new Error('Invalid\x20'+_0x2d5af6(0x1e0)+_0x2d5af6(0x2d7)+_0x289bff);const _0x4cb7b2=_0x2d7385['indexOf']('@',_0x41a35d+0x1);return _0x4cb7b2===-0x1?_0x2d7385:_0x2d7385[_0x2d5af6(0x2c2)](0x0,_0x4cb7b2);}const _0x40e08e=_0x2d7385[_0x2d5af6(0x30e)]('@');return _0x40e08e===-0x1?_0x2d7385:_0x2d7385[_0x2d5af6(0x2c2)](0x0,_0x40e08e);}function resolvePluginDirNameFromSpec(_0x1fb129){const _0x1527ec=_0x3edc6e,_0x3ef0c6=resolvePackageNameFromNpmSpec(_0x1fb129),_0x47940e=_0x3ef0c6[_0x1527ec(0x2d5)]('/')[_0x1527ec(0x273)](Boolean),_0x558530=_0x47940e['at'](-0x1)??'';if(!_0x558530)throw new Error(_0x1527ec(0x263)+'plugin\x20s'+_0x1527ec(0x2d7)+_0x1fb129);return _0x558530;}async function resolvePluginIdFromPackageDir(_0x5e8c4a,_0x2b1bf4){const _0x36ab2e=_0x3edc6e,_0x579d46=await readJson(join(_0x5e8c4a,'package.'+_0x36ab2e(0x2c6)),{}),_0x33b4e0=await readPluginManifest(_0x5e8c4a),_0x4bd0b9=[_0x33b4e0?.['id'],_0x33b4e0?.['pluginId'],_0x33b4e0?.[_0x36ab2e(0x2f5)],_0x579d46?.[_0x36ab2e(0x2bf)]?.['id'],_0x579d46?.[_0x36ab2e(0x2bf)+'Id'],_0x2b1bf4],_0x2b1fa4=_0x4bd0b9[_0x36ab2e(0x309)](_0x434f39=>typeof _0x434f39===_0x36ab2e(0x276)&&_0x434f39[_0x36ab2e(0x2df)]());if(!_0x2b1fa4)throw new Error(_0x36ab2e(0x2da)+_0x36ab2e(0x332)+_0x36ab2e(0x2a0)+_0x36ab2e(0x328)+'\x20'+_0x5e8c4a);return _0x2b1fa4['trim']();}function pluginSpecMatches(_0x1641ec,_0x4caaba){const _0xb0ec1a=_0x3edc6e,_0x1ca408=_0x4caaba[_0xb0ec1a(0x2df)](),_0x4680a7=resolvePackageNameFromNpmSpec(_0x1ca408);return[_0x1641ec['spec'],_0x1641ec[_0xb0ec1a(0x1cd)+'Spec'],_0x1641ec[_0xb0ec1a(0x1cd)+'Name']]['some'](_0x4bca65=>_0x4bca65===_0x1ca408||_0x4bca65===_0x4680a7);}async function installPluginFromNpmSpec(_0x3a896f,_0x5299aa,_0x3cb922={}){const _0x3a25dd=_0x3edc6e,_0x4510ab=_0x3a896f['trim']()[_0x3a25dd(0x203)](/^npm:/,''),_0xfb0c4f=resolvePluginDirNameFromSpec(_0x4510ab),_0x2a28bb=join(_0x5299aa[_0x3a25dd(0x2bf)+_0x3a25dd(0x290)+'ir'],_0x3a25dd(0x33c),'extensio'+'ns'),_0x5e854f=join(_0x2a28bb,_0xfb0c4f),_0x2c0b39=join(_0x5299aa[_0x3a25dd(0x311)+_0x3a25dd(0x27d)],_0x3a25dd(0x25c)+_0x3a25dd(0x2a6)+process[_0x3a25dd(0x20d)]+'-'+Date[_0x3a25dd(0x265)]()),_0x5169f7=await createRuntimeEnv(_0x5299aa),_0x167577=new Date()[_0x3a25dd(0x1f7)+_0x3a25dd(0x308)](),_0x5e13b0=join(_0x5299aa[_0x3a25dd(0x311)+_0x3a25dd(0x27d)],_0x3a25dd(0x28d));await mkdir(_0x5e13b0,{'recursive':!![]}),await rm(_0x2c0b39,{'recursive':!![],'force':!![]}),await rm(_0x5e854f,{'recursive':!![],'force':!![]}),await mkdir(_0x2c0b39,{'recursive':!![]}),await mkdir(_0x2a28bb,{'recursive':!![]}),console[_0x3a25dd(0x2a4)](_0x3a25dd(0x1f6)+'hell:run'+'time]\x20fe'+'tching\x20p'+_0x3a25dd(0x2b9)+_0x4510ab);const _0x50622a=await runProcess(_0x5299aa[_0x3a25dd(0x283)+_0x3a25dd(0x2cc)],[_0x5299aa[_0x3a25dd(0x1df)],_0x3a25dd(0x29a),_0x4510ab,'--json'],{'cwd':_0x5e13b0,'env':_0x5169f7,'label':_0x3a25dd(0x1f1)+'\x20'+_0x4510ab}),_0x74f8df=parseNpmPackJson(_0x50622a[_0x3a25dd(0x1cb)]),_0x238d33=normalizePackedTarballFilename(_0x74f8df['filename']),_0x4bcd71=join(_0x5e13b0,_0x238d33);if(!existsSync(_0x4bcd71))throw new Error('npm\x20pack'+'\x20did\x20not'+_0x3a25dd(0x25d)+_0x3a25dd(0x291)+'\x20'+_0x4bcd71);await runProcess(_0x3a25dd(0x254),[_0x3a25dd(0x2d1),_0x4bcd71,'-C',_0x2c0b39],{'label':_0x3a25dd(0x277)+_0x238d33}),await rename(join(_0x2c0b39,_0x3a25dd(0x300)),_0x5e854f),await rm(_0x2c0b39,{'recursive':!![],'force':!![]});const _0x4292b6=join(_0x5e854f,'package.'+'json'),_0x23c507=await readJson(_0x4292b6,{});(_0x23c507[_0x3a25dd(0x238)+_0x3a25dd(0x347)]||_0x23c507[_0x3a25dd(0x226)])&&(delete _0x23c507[_0x3a25dd(0x238)+'dencies'],delete _0x23c507[_0x3a25dd(0x226)],await writeJson(_0x4292b6,_0x23c507));await runProcess(_0x5299aa['nodeExec'+_0x3a25dd(0x2cc)],[_0x5299aa[_0x3a25dd(0x1df)],_0x3a25dd(0x224),'--omit=d'+'ev',_0x3a25dd(0x2c9)+_0x3a25dd(0x1e1),_0x3a25dd(0x262)+'it',_0x3a25dd(0x272)+'d','--legacy'+'-peer-de'+'ps'],{'cwd':_0x5e854f,'env':_0x5169f7,'label':'npm\x20inst'+_0x3a25dd(0x31e)+_0x3a25dd(0x1cc)+_0x4510ab});const _0x5e8563=new Date()[_0x3a25dd(0x1f7)+_0x3a25dd(0x308)](),_0x2b132c=await resolvePluginIdFromPackageDir(_0x5e854f,_0x74f8df[_0x3a25dd(0x2f5)]);return _0x3cb922[_0x3a25dd(0x249)+_0x3a25dd(0x274)]?.[_0x3a25dd(0x34b)](_0x3a25dd(0x30f)+'in\x20insta'+'lled',{'spec':_0x4510ab,'pluginId':_0x2b132c,'installPath':_0x5e854f}),{'pluginId':_0x2b132c,'source':'npm','spec':_0x4510ab,'installPath':toRuntimeRelative(_0x5299aa['runtimeR'+'oot'],_0x5e854f),'version':_0x74f8df[_0x3a25dd(0x2af)],'resolvedName':_0x74f8df['name'],'resolvedVersion':_0x74f8df[_0x3a25dd(0x2af)],'resolvedSpec':_0x74f8df['name']+'@'+_0x74f8df[_0x3a25dd(0x2af)],'integrity':typeof _0x74f8df[_0x3a25dd(0x330)+'y']===_0x3a25dd(0x276)?_0x74f8df[_0x3a25dd(0x330)+'y']:'','shasum':typeof _0x74f8df[_0x3a25dd(0x2ba)]===_0x3a25dd(0x276)?_0x74f8df['shasum']:'','resolvedAt':_0x167577,'installedAt':_0x5e8563};}async function syncConfiguredNpmPlugins(_0x3a59c8,_0x10a8e8,_0x2ae54b,_0x5121f1={}){const _0xf985bb=_0x3edc6e;if(_0x5121f1[_0xf985bb(0x2d2)])return;const _0x2249e8=createRuntimeInfoFromManifest(_0x10a8e8,_0x2ae54b),_0x5b6f35=Array[_0xf985bb(0x319)](_0x2ae54b[_0xf985bb(0x2e2)])?_0x2ae54b['plugins']:[],_0x205212=[];for(const _0x8f0edd of _0x3a59c8['openclaw'][_0xf985bb(0x1fc)+_0xf985bb(0x1e9)]){const _0x6f8a8b=_0x5b6f35[_0xf985bb(0x309)](_0x40160d=>_0x40160d?.[_0xf985bb(0x299)]==='npm'&&pluginSpecMatches(_0x40160d,_0x8f0edd)&&typeof _0x40160d[_0xf985bb(0x34d)+_0xf985bb(0x31f)]===_0xf985bb(0x276)&&existsSync(resolve(_0x10a8e8,_0x40160d[_0xf985bb(0x34d)+_0xf985bb(0x31f)])));if(_0x6f8a8b){_0x205212[_0xf985bb(0x352)](_0x6f8a8b);continue;}_0x205212[_0xf985bb(0x352)](await installPluginFromNpmSpec(_0x8f0edd,_0x2249e8,_0x5121f1));}const _0x3d29d7=new Set(_0x3a59c8[_0xf985bb(0x2bf)]['pluginSp'+_0xf985bb(0x1e9)]['map'](resolvePackageNameFromNpmSpec)),_0x332989=_0x5b6f35[_0xf985bb(0x273)](_0x55b3a5=>_0x55b3a5?.['source']!==_0xf985bb(0x26c)||!_0x3d29d7[_0xf985bb(0x2b5)](resolvePackageNameFromNpmSpec(_0x55b3a5[_0xf985bb(0x1cd)+_0xf985bb(0x35a)]||_0x55b3a5[_0xf985bb(0x225)]||'')));_0x2ae54b[_0xf985bb(0x2e2)]=[..._0x332989,..._0x205212];}function hasRuntimeDependencies(_0x14be4b){const _0x23fac5=_0x3edc6e,_0x5d8c3b=_0x14be4b?.[_0x23fac5(0x26b)+'cies']&&typeof _0x14be4b[_0x23fac5(0x26b)+_0x23fac5(0x1cf)]==='object'?Object['keys'](_0x14be4b[_0x23fac5(0x26b)+_0x23fac5(0x1cf)]):[],_0x533fd5=_0x14be4b?.['optional'+_0x23fac5(0x1d0)+_0x23fac5(0x1cf)]&&typeof _0x14be4b[_0x23fac5(0x26a)+'Dependen'+_0x23fac5(0x1cf)]===_0x23fac5(0x356)?Object[_0x23fac5(0x2c4)](_0x14be4b[_0x23fac5(0x26a)+_0x23fac5(0x1d0)+_0x23fac5(0x1cf)]):[];return _0x5d8c3b['length']>0x0||_0x533fd5[_0x23fac5(0x2bd)]>0x0;}async function installLocalPluginRuntimeDependencies(_0x581f85,_0x2110ad,_0x129f8b){const _0x4813c4=_0x3edc6e,_0x491a17=join(_0x581f85,_0x4813c4(0x314)+_0x4813c4(0x2c6)),_0x1fea4c=await readJson(_0x491a17,{});(_0x1fea4c['devDepen'+_0x4813c4(0x347)]||_0x1fea4c[_0x4813c4(0x226)])&&(delete _0x1fea4c[_0x4813c4(0x238)+_0x4813c4(0x347)],delete _0x1fea4c[_0x4813c4(0x226)],await writeJson(_0x491a17,_0x1fea4c));if(!hasRuntimeDependencies(_0x1fea4c))return;const _0x1f931a=await createRuntimeEnv(_0x2110ad);console['log']('[wujie-s'+_0x4813c4(0x289)+_0x4813c4(0x2c7)+_0x4813c4(0x235)+_0x4813c4(0x325)+_0x4813c4(0x275)+_0x4813c4(0x2d0)+_0x4813c4(0x2cd)+_0x581f85),await runProcess(_0x2110ad[_0x4813c4(0x283)+_0x4813c4(0x2cc)],[_0x2110ad[_0x4813c4(0x1df)],'install','--omit=d'+'ev','--omit=p'+_0x4813c4(0x1e1),_0x4813c4(0x262)+'it','--no-fun'+'d',_0x4813c4(0x33f)+_0x4813c4(0x2b6)+'ps'],{'cwd':_0x581f85,'env':_0x1f931a,'label':_0x4813c4(0x288)+_0x4813c4(0x255)+_0x4813c4(0x2c5)+'\x20'+_0x581f85}),_0x129f8b[_0x4813c4(0x249)+_0x4813c4(0x274)]?.[_0x4813c4(0x34b)]('local\x20pl'+'ugin\x20dep'+'endencie'+_0x4813c4(0x216)+_0x4813c4(0x21b),{'installPath':_0x581f85});}async function syncSharedPluginModules(_0x5d4eac,_0x511f54){const _0x3672b1=_0x3edc6e,_0x41a21b=new Set();for(const _0x252cfb of _0x5d4eac){const _0x43f58f=join(dirname(_0x252cfb),'_shared');if(existsSync(_0x43f58f))_0x41a21b[_0x3672b1(0x31b)](_0x43f58f);}for(const _0x509cf4 of _0x41a21b){await copyDirFresh(_0x509cf4,join(_0x511f54,_0x3672b1(0x219)));}}function _0x3871(){const _0x4d54c3=['path:\x20','\x22\x20\x22$@\x22','--fix','s\x20instal','eted','\x20return\x20','_shared','map','led','.tar.gz','IPT_DIR=','Bundled\x20','time]\x20do','.npmjs.o','skills\x20s','tall\x20the','configur','install','spec','scripts','registry','1\x20]\x20&&\x20[','\x22%SCRIPT','NCLAW_HO','JSON:\x20','NCLAW_ST','pluginId','npm-glob','314901LdrHko','cope\x20syn','\x20runtime','2ibLelT','match',',\x20shell.','stalling','nodejs.o','\x20validat','devDepen','replaceA','ujie-she','red\x20Node','\x22\x20so\x20the','\x20is\x20miss','IR=$(CDP','.zip','ame','lib/node','configFi','node-v','ady\x20curr','generate','d\x20for\x20lo',':\x20manife','ll\x20prepa','runtimeL','missing\x20','.kdocs-c','tools\x20sy','failed','resume','pipe','ATH=\x22${O','.tools','ebuild\x20t','projectR','tar','all\x20loca','Run\x20\x22wuj','node_mod','empty\x20pl','required','catch','/pro','.plugin-','\x20create\x20','every','ie-shell','arm64','node','--no-aud','Invalid\x20','download','now','unknown','toString','ld\x20compl','cli','optional','dependen','npm','time-too','error','base\x20bui','Spec','ted','--no-fun','filter','ogger','lugin\x20de','string','extract\x20','startsWi','endsWith','timeoutM','27474USaUDC','rg/dist/','oot','Configur','\x20written','wnloadin','bin','config=','nodeExec','i\x20binary','CONFIG_P','@larksui','windows','npm\x20inst','hell:run','if\x20[\x20-t\x20','PT_DIR/w','not\x20foun','.cache','nning\x20op','\x20signal=','WorkingD','tarball:','alid\x20pay','\x20failed\x20','manifest','then','i.exe','\x20doctor\x20','5000XlmPGI','source','pack','dataDirN','arch','d\x20an\x20inv','nifest=','statusCo','e\x20plugin','dataDir','\x22\x20\x22$SCRI','close','log','ATE_DIR:','extract-','\x20paths','win','npm-cach','join','base\x20alr','platform','wujie-sh','4948265gyZPtd','version','win32','local:','claw-run','om\x20','\x20timed\x20o','has','-peer-de','11759seRNHQ','JIE_NO_L','lugin\x20','shasum','rname\x20--','ory','length','parse','openclaw','nodeVers','time]\x20ru','slice','runtime-','keys','l\x20plugin','json','time]\x20in','../asset','--omit=p','set\x20\x22OPE','node/lib','utable','es\x20','wujiecla',';\x20run\x20wu','pendenci','-xzf','syncOnly','ime\x20buil','dAt','split','runtime\x20','pec:\x20','ut\x20after','i\x20is\x20mis','Unable\x20t','ct-','.json','STATE_DI','doctor','trim','PENCLAW_','11619VtMdhz','plugins','>/dev/nu','root','e\x20kdocs\x20','jie-shel','if\x20\x22%OPE','3860kXDKZK','agents','o.mjs\x22\x202','Version','me.','utf8','-extract','ATH:-','chive:\x20','skillhub','\x20-z\x20\x22$WU','ujie-log','\x20-g','name','E_DIR=','Bin','st=','tateDir','product\x20','https://','versions','ed\x20OpenC','rent','singOpen','package','started','\x20version','PT_DIR/','nd\x20in\x20ar','\x22==\x22\x22\x20se','nd\x20after','skills','ing','find','NCLAW_CO','ules','kdocs-cl','logo.mjs','indexOf','npm\x20plug','ed\x20npm\x20p','runtimeR','fix\x20star','npm-cli.','package.','unzip','.tmp/run','zip','CRIPT_DI','isArray','g\x20from\x20O','add','.opencla','productN','all\x20plug','ath','wBin','LAW_STAT','wujieai.','flush','tools','\x20local\x20p','rg/','PT_DIR%','\x20id\x20from','\x20started','581076Nmuaqc','rebuilt\x20','OpenClaw','H%\x22==\x22\x22\x20','LocalPlu','stderr','integrit','nced','o\x20resolv','\x20package','agentsDi','R=\x22${OPE','ignore','skill\x20ve','\x20complet','set\x20\x22SCR','s/wujie-','runtime','dist','agents\x20s','SKILL.md','--legacy','ld\x20start','\x20can\x20be\x20','load:\x20','OPENCLAW','\x20returne','--omit=d','env','dencies','process.','fix\x20comp','s\x20missin','info','/npm','installP','t\x20\x22OPENC','agentSco','data','eady\x20cur','push','ion\x20mism','octor\x20--','kill','object','time','/node_mo','i\x20alread','Name','2258000FSiaIs','stdout','in\x20','resolved','cal\x20runt','cies','Dependen','skillsDi','.source','ell-runt','ll\x20||\x20tr','leted','filename','node\x20ver','_HOME:-','\x20prepare','aw\x20runti','ion','ynced','export\x20O','href','npmCli','scoped\x20s','eer','fix','prepare\x20','node/bin','with\x20cod','\x20did\x20not','isFile','allowMis','ecs','fix\x20mark','%~dp0\x22','isDirect','ginPaths','product','\x20install','-doctor.','npm\x20pack','he\x20runti','null','label','cwd','[wujie-s','toISOStr','synced','extensio','lugins\x20s','runtimeS','pluginSp','sion.','ATH=\x20cd\x20','OGO\x22\x20];\x20','SIGTERM','location','\x20resolve','replace','\x20bin\x20was','local','NFIG_PAT','205RFtYCe','leName','li-extra','l\x20prepar','ugin\x20spe','\x20depende','pid','all\x20','bundled\x20','headers','i\x20instal','x64'];_0x3871=function(){return _0x4d54c3;};return _0x3871();}async function syncProductPlugins(_0x1c4a42,_0x11edad,_0x1744e3,_0x394427={}){const _0x469dc7=_0x3edc6e,_0x2e1f18=join(_0x11edad,'openclaw',_0x469dc7(0x33c),_0x469dc7(0x1f9)+'ns'),_0x2f024e=createRuntimeInfoFromManifest(_0x11edad,_0x1744e3),_0x56efbf=[];await syncSharedPluginModules(_0x1c4a42[_0x469dc7(0x2bf)][_0x469dc7(0x1cd)+_0x469dc7(0x32e)+_0x469dc7(0x1ed)],_0x2e1f18);for(const _0x386f02 of _0x1c4a42['openclaw'][_0x469dc7(0x1cd)+_0x469dc7(0x32e)+'ginPaths']){const _0x28ec82=await getPackageMetadata(_0x386f02),_0x4b1e19=await readPluginManifest(_0x386f02),_0x3f2958=join(_0x2e1f18,_0x28ec82[_0x469dc7(0x22d)]);await copyDirFresh(_0x386f02,_0x3f2958),await installLocalPluginRuntimeDependencies(_0x3f2958,_0x2f024e,_0x394427),_0x56efbf[_0x469dc7(0x352)]({'pluginId':_0x28ec82[_0x469dc7(0x22d)],'source':_0x469dc7(0x205),'spec':_0x469dc7(0x2b1)+_0x386f02,'installPath':toRuntimeRelative(_0x11edad,_0x3f2958),'version':_0x28ec82[_0x469dc7(0x2af)],'resolvedName':_0x28ec82['name'],'resolvedVersion':_0x28ec82[_0x469dc7(0x2af)],'resolvedSpec':_0x469dc7(0x2b1)+_0x386f02,'integrity':'','shasum':'','resolvedAt':new Date()[_0x469dc7(0x1f7)+_0x469dc7(0x308)](),'installedAt':new Date()[_0x469dc7(0x1f7)+_0x469dc7(0x308)](),'agentScope':_0x4b1e19[_0x469dc7(0x34f)+'pe'],'skills':_0x4b1e19[_0x469dc7(0x307)]});}const _0x1ecdf3=new Set(_0x56efbf['map'](_0x359c92=>_0x359c92[_0x469dc7(0x22d)])),_0x8d8a46=Array[_0x469dc7(0x319)](_0x1744e3[_0x469dc7(0x2e2)])?_0x1744e3[_0x469dc7(0x2e2)][_0x469dc7(0x273)](_0x1453a0=>!_0x1ecdf3[_0x469dc7(0x2b5)](_0x1453a0[_0x469dc7(0x22d)])):[];_0x1744e3[_0x469dc7(0x2e2)]=[..._0x8d8a46,..._0x56efbf];}async function syncManifestPluginScope(_0x1613d3,_0x1dd337,_0x4a0220){const _0x46228c=_0x3edc6e,_0x51f6e0=join(_0x1dd337,_0x46228c(0x2bf),_0x46228c(0x33c),_0x46228c(0x1f9)+'ns'),_0x27a98e=new Set(_0x1613d3[_0x46228c(0x2bf)][_0x46228c(0x1fc)+_0x46228c(0x1e9)]??[]),_0xcee129=new Set([..._0x27a98e]['map'](_0x1127bb=>_0x1127bb[_0x46228c(0x203)](/^npm:/,''))[_0x46228c(0x21a)](_0x491649=>{const _0x160126=_0x46228c;if(_0x491649['startsWi'+'th']('@')){const _0x3af446=_0x491649[_0x160126(0x2d5)]('@');return _0x3af446[_0x160126(0x2bd)]>=0x3?'@'+_0x3af446[0x1]:_0x491649;}return _0x491649['split']('@')[0x0];})[_0x46228c(0x273)](Boolean)),_0x2bffb2=new Set();for(const _0x4b29e8 of _0x1613d3[_0x46228c(0x2bf)][_0x46228c(0x1cd)+_0x46228c(0x32e)+_0x46228c(0x1ed)]){const _0xedbb09=await getPackageMetadata(_0x4b29e8);if(_0xedbb09[_0x46228c(0x22d)])_0x2bffb2['add'](_0xedbb09[_0x46228c(0x22d)]);}const _0x3d3add=Array[_0x46228c(0x319)](_0x4a0220[_0x46228c(0x2e2)])?_0x4a0220[_0x46228c(0x2e2)]:[];_0x4a0220[_0x46228c(0x1fc)+_0x46228c(0x1e9)]=[..._0x1613d3[_0x46228c(0x2bf)][_0x46228c(0x1fc)+'ecs'],..._0x1613d3[_0x46228c(0x2bf)][_0x46228c(0x1cd)+_0x46228c(0x32e)+_0x46228c(0x1ed)][_0x46228c(0x21a)](_0x385acb=>_0x46228c(0x2b1)+_0x385acb)],_0x4a0220['plugins']=_0x3d3add[_0x46228c(0x273)](_0x2a7599=>{const _0x284b8c=_0x46228c;if(!_0x2a7599||typeof _0x2a7599!=='object')return![];if(_0x2a7599['source']===_0x284b8c(0x205))return _0x2bffb2[_0x284b8c(0x2b5)](_0x2a7599[_0x284b8c(0x22d)]);if(_0x2a7599[_0x284b8c(0x299)]===_0x284b8c(0x26c))return _0x27a98e[_0x284b8c(0x2b5)](_0x2a7599[_0x284b8c(0x225)])||_0x27a98e[_0x284b8c(0x2b5)](_0x2a7599['resolved'+_0x284b8c(0x270)])||_0xcee129['has'](_0x2a7599[_0x284b8c(0x1cd)+'Name']);return![];});const _0xf8a4d5=new Set(_0x4a0220['plugins'][_0x46228c(0x21a)](_0x16a0d5=>_0x16a0d5[_0x46228c(0x22d)]));for(const _0x1ac634 of _0x3d3add){if(!_0x1ac634[_0x46228c(0x22d)]||_0xf8a4d5['has'](_0x1ac634['pluginId']))continue;const _0x25ef9f=typeof _0x1ac634[_0x46228c(0x34d)+_0x46228c(0x31f)]==='string'&&_0x1ac634['installP'+'ath'][_0x46228c(0x2df)]()?resolve(_0x1dd337,_0x1ac634[_0x46228c(0x34d)+_0x46228c(0x31f)]):join(_0x51f6e0,_0x1ac634[_0x46228c(0x22d)]),_0x19d9e7=relative(_0x51f6e0,_0x25ef9f);if(_0x19d9e7['startsWi'+'th']('..')||_0x19d9e7==='')continue;await rm(_0x25ef9f,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x4ac941,_0x6ec92e,_0x512b4b){const _0x57df85=_0x3edc6e,_0x116d93=join(_0x6ec92e,_0x57df85(0x2bf),_0x57df85(0x2e9));await copyDirFresh(_0x4ac941[_0x57df85(0x2bf)][_0x57df85(0x334)+'r'],_0x116d93),_0x512b4b[_0x57df85(0x2e9)]={'source':'product','installPath':toRuntimeRelative(_0x6ec92e,_0x116d93)};}async function syncProductSkills(_0x4968a2,_0x145a7f,_0x9f0397){const _0x528315=_0x3edc6e,_0x1d9c45=join(_0x145a7f,_0x528315(0x2bf),_0x528315(0x307));await copyDirFresh(_0x4968a2[_0x528315(0x2bf)][_0x528315(0x1d1)+'r'],_0x1d9c45),_0x9f0397[_0x528315(0x307)]={'source':_0x528315(0x1ee),'installPath':toRuntimeRelative(_0x145a7f,_0x1d9c45)};}
@@ -0,0 +1 @@
1
+ (function(_0x36e726,_0x503620){const _0x28d194=_0x8854,_0x1a7cfa=_0x36e726();while(!![]){try{const _0x28c25e=parseInt(_0x28d194(0x1ae))/0x1*(-parseInt(_0x28d194(0x15b))/0x2)+parseInt(_0x28d194(0x1b2))/0x3+-parseInt(_0x28d194(0x158))/0x4*(parseInt(_0x28d194(0x191))/0x5)+parseInt(_0x28d194(0x1cb))/0x6*(parseInt(_0x28d194(0x194))/0x7)+parseInt(_0x28d194(0x187))/0x8*(parseInt(_0x28d194(0x18b))/0x9)+-parseInt(_0x28d194(0x1a2))/0xa+parseInt(_0x28d194(0x1c1))/0xb*(-parseInt(_0x28d194(0x1a6))/0xc);if(_0x28c25e===_0x503620)break;else _0x1a7cfa['push'](_0x1a7cfa['shift']());}catch(_0x28cfc0){_0x1a7cfa['push'](_0x1a7cfa['shift']());}}}(_0x24de,0x7cc09));import{execFile}from'node:child_process';function _0x8854(_0x4c5d4e,_0x415042){_0x4c5d4e=_0x4c5d4e-0x14b;const _0x24dee4=_0x24de();let _0x88547=_0x24dee4[_0x4c5d4e];return _0x88547;}import{existsSync}from'node:fs';import{cp,mkdir,mkdtemp,readFile,readdir,rename,rm,writeFile}from'node:fs/promises';import{basename,dirname,join,parse}from'node:path';import{asRecord,dedupeStrings,getTrimmedString,writeJson}from'./utils.mjs';function sanitizeManagedSkillDirSegment(_0x55d6ee){const _0x42dd3b=_0x8854;let _0x236ad3=getTrimmedString(_0x55d6ee)[_0x42dd3b(0x197)](/[<>:"/\\|?*\u0000-\u001f]/g,'-');return _0x236ad3=_0x236ad3['replace'](/-+/g,'-')[_0x42dd3b(0x197)](/^[-.]+|[-.]+$/g,''),_0x236ad3[_0x42dd3b(0x157)](0x0,0x78);}function buildManagedSkillDirectoryName(_0x4d78d4,_0x264e7e,_0x36e596){const _0x43af3d=_0x8854,_0x553b3c=sanitizeManagedSkillDirSegment(_0x4d78d4)||sanitizeManagedSkillDirSegment(_0x36e596)||_0x43af3d(0x1c6)+'-skill',_0x43c184=sanitizeManagedSkillDirSegment(_0x264e7e),_0x3a24b3=_0x43c184?_0x553b3c+'-'+_0x43c184:_0x553b3c;return _0x3a24b3[_0x43af3d(0x157)](0x0,0xc8)||_0x43af3d(0x1c6)+_0x43af3d(0x19d);}function extractVersionFromZipUrl(_0x379da3){const _0x3a3d1d=_0x8854;if(!getTrimmedString(_0x379da3))return null;try{const _0x593333=basename(new URL(_0x379da3)[_0x3a3d1d(0x1ce)]),_0x388582=_0x593333[_0x3a3d1d(0x197)](/\.zip$/i,'');return _0x388582[_0x3a3d1d(0x174)](/(?:^|[-_v])(\d+\.\d+\.\d+(?:[-+][\w.-]+)?)(?:$|[-_])/i)?.[0x1]??null;}catch{return null;}}async function extractZipToDirectory(_0x155532,_0x4644b2){await new Promise((_0x4acdd9,_0x4e2895)=>{const _0xa3f96=_0x8854;let _0x17b08f;if(process['platform']===_0xa3f96(0x151)){const _0x2d5296=_0x155532[_0xa3f96(0x197)](/'/g,'\x27\x27'),_0x28b3f9=_0x4644b2[_0xa3f96(0x197)](/'/g,'\x27\x27');_0x17b08f=execFile(_0xa3f96(0x179)+_0xa3f96(0x1e0),[_0xa3f96(0x1b3)+'le','-NonInte'+_0xa3f96(0x1c7),'-Command',_0xa3f96(0x183)+_0xa3f96(0x196)+_0xa3f96(0x1b8)+_0xa3f96(0x17e)+_0x2d5296+('\x27\x20-Desti'+_0xa3f96(0x15f)+_0xa3f96(0x169))+_0x28b3f9+'\x27\x20-Force'],_0x3103f9=>_0x3103f9?_0x4e2895(_0x3103f9):_0x4acdd9());}else _0x17b08f=execFile(_0xa3f96(0x14c),['-q',_0x155532,'-d',_0x4644b2],_0xbd608=>_0xbd608?_0x4e2895(_0xbd608):_0x4acdd9());_0x17b08f['on'](_0xa3f96(0x1a1),_0x4e2895);});}async function findSkillManifestDirectories(_0x51489a){const _0x4ece85=[];async function _0x27e716(_0x1cb0fe){const _0x827a98=_0x8854,_0x452acd=await readdir(_0x1cb0fe,{'withFileTypes':!![]}),_0x4fb7db=new Set(_0x452acd['map'](_0x1a41a4=>_0x1a41a4[_0x827a98(0x173)]['toUpperC'+_0x827a98(0x19e)]()));if(_0x4fb7db[_0x827a98(0x1d9)](_0x827a98(0x1d3))||_0x4fb7db[_0x827a98(0x1d9)]('SKILLS.M'+'D')){_0x4ece85[_0x827a98(0x1c2)](_0x1cb0fe);return;}for(const _0x6e8337 of _0x452acd){if(!_0x6e8337['isDirect'+'ory']()||_0x6e8337[_0x827a98(0x173)]===_0x827a98(0x199)||_0x6e8337[_0x827a98(0x173)][_0x827a98(0x171)+'th']('.'))continue;await _0x27e716(join(_0x1cb0fe,_0x6e8337['name']));}}return await _0x27e716(_0x51489a),_0x4ece85;}async function normalizeImportedSkillManifest(_0x53878d){const _0x3010e8=_0x8854,_0x1cee4c=join(_0x53878d,_0x3010e8(0x1df)),_0x2ce30a=await readdir(_0x53878d,{'withFileTypes':!![]})[_0x3010e8(0x192)](()=>[]);let _0x38b0b5=null,_0x426119=null;for(const _0x65059 of _0x2ce30a){if(!_0x65059['isFile']())continue;const _0xca5df3=_0x65059[_0x3010e8(0x173)][_0x3010e8(0x19b)+_0x3010e8(0x19e)]();if(_0xca5df3===_0x3010e8(0x1d3))_0x38b0b5=_0x65059[_0x3010e8(0x173)];else{if(_0xca5df3===_0x3010e8(0x168)+'D')_0x426119=_0x65059[_0x3010e8(0x173)];}}if(_0x38b0b5==='SKILL.md')return;const _0x231535=_0x38b0b5??_0x426119;if(!_0x231535)return;const _0x3b22f7=join(_0x53878d,_0x231535);if(_0x3b22f7!==_0x1cee4c)await rename(_0x3b22f7,_0x1cee4c);}async function moveDirectoryWithOverwrite(_0xa52f7,_0xed8360){const _0x3fe44a=_0x8854;await mkdir(dirname(_0xed8360),{'recursive':!![]});try{await rename(_0xa52f7,_0xed8360);return;}catch(_0x8b8cbd){if(_0x8b8cbd?.[_0x3fe44a(0x17c)]!==_0x3fe44a(0x1ca))throw _0x8b8cbd;}await cp(_0xa52f7,_0xed8360,{'recursive':!![],'force':!![]}),await rm(_0xa52f7,{'recursive':!![],'force':!![]});}async function readManifestText(_0x5936b3){const _0x49279a=_0x8854,_0x2e09ec=[join(_0x5936b3,_0x49279a(0x1df)),join(_0x5936b3,'SKILLS.m'+'d')][_0x49279a(0x1ab)](_0x2b32f8=>existsSync(_0x2b32f8));if(!_0x2e09ec)return'';return await readFile(_0x2e09ec,_0x49279a(0x195))[_0x49279a(0x192)](()=>'');}function resolveFrontmatterValue(_0x512a21,_0x89921f){const _0x365223=_0x8854,_0xb38ea6=_0x512a21[_0x365223(0x174)](/^---\s*\r?\n([\s\S]*?)\r?\n---/),_0x36fcf3=_0xb38ea6?.[0x1]??'',_0x32fc0e=_0x36fcf3['match'](new RegExp(_0x365223(0x184)+_0x89921f+(':\x5cs*(.+)'+'$'),'m'))?.[0x1];return getTrimmedString(_0x32fc0e)[_0x365223(0x197)](/^["']|["']$/g,'')||null;}async function resolveSkillKeyFromManifest(_0x316048){const _0x214310=_0x8854,_0x294cf7=await readManifestText(_0x316048);if(!_0x294cf7[_0x214310(0x19c)]())return null;const _0x1c1ce4=_0x294cf7[_0x214310(0x174)](/"skillKey"\s*:\s*"([^"]+)"/);if(_0x1c1ce4?.[0x1])return getTrimmedString(_0x1c1ce4[0x1]);return resolveFrontmatterValue(_0x294cf7,_0x214310(0x175))||resolveFrontmatterValue(_0x294cf7,'name');}async function resolveSkillVersionFromManifest(_0x44797b){const _0x38f39c=_0x8854,_0xb6eeb7=await readManifestText(_0x44797b);if(!_0xb6eeb7[_0x38f39c(0x19c)]())return null;const _0x3f74ac=_0xb6eeb7['match'](/"version"\s*:\s*"([^"]+)"/);if(_0x3f74ac?.[0x1])return getTrimmedString(_0x3f74ac[0x1]);return resolveFrontmatterValue(_0xb6eeb7,_0x38f39c(0x1b7));}async function readMarketSkillRegistry(_0x5023f0){const _0x50a2ae=_0x8854;try{const _0x401a63=JSON['parse'](await readFile(_0x5023f0,'utf8'));if(!_0x401a63||typeof _0x401a63!==_0x50a2ae(0x1d0)||Array[_0x50a2ae(0x1ac)](_0x401a63))return{};return _0x401a63;}catch{return{};}}export async function readSkillMarketRegistry(_0x1e6616){const _0x16ab1f=_0x8854;return await readMarketSkillRegistry(join(_0x1e6616,_0x16ab1f(0x189)+_0x16ab1f(0x1af)+'on'));}async function removeMarketSkillRegistryKeys(_0x553b46,_0x2a296e){const _0x4375ca=_0x8854,_0x42e9da=new Set(_0x2a296e['map'](getTrimmedString)[_0x4375ca(0x170)](Boolean));if(_0x42e9da[_0x4375ca(0x1c4)]===0x0)return;const _0x273278=await readMarketSkillRegistry(_0x553b46);let _0x52141a=![];for(const _0x2f4b4e of Object[_0x4375ca(0x1b4)](_0x273278)){const _0x2aace2=asRecord(_0x273278[_0x2f4b4e]);(_0x42e9da['has'](_0x2f4b4e)||_0x42e9da[_0x4375ca(0x1d9)](getTrimmedString(_0x2aace2[_0x4375ca(0x17c)])))&&(delete _0x273278[_0x2f4b4e],_0x52141a=!![]);}if(_0x52141a){const _0x240c78=Object[_0x4375ca(0x19a)+'ies'](Object[_0x4375ca(0x1a9)](_0x273278)[_0x4375ca(0x16d)](([_0x4f2110],[_0x17e332])=>_0x4f2110[_0x4375ca(0x1ad)+'mpare'](_0x17e332)));await writeJson(_0x553b46,_0x240c78);}}async function collectSkillDirsUnderRoot(_0x326212,_0x3ece60,_0xa14693){const _0x43bd5c=_0x8854;if(!existsSync(_0x326212))return;for(const _0x51d7ef of await readdir(_0x326212,{'withFileTypes':!![]})[_0x43bd5c(0x192)](()=>[])){if(!_0x51d7ef[_0x43bd5c(0x1e2)+'ory']())continue;const _0x3156a3=join(_0x326212,_0x51d7ef[_0x43bd5c(0x173)]),_0x42835f=await resolveSkillKeyFromManifest(_0x3156a3);if(_0x42835f&&_0x3ece60[_0x43bd5c(0x1d9)](_0x42835f))_0xa14693['add'](_0x3156a3);}}async function removeSkillConfigEntries(_0x43ddf4,_0x22915b){const _0x294ce8=_0x8854,_0x3036ea=new Set(_0x22915b['map'](getTrimmedString)[_0x294ce8(0x170)](Boolean));if(_0x3036ea[_0x294ce8(0x1c4)]===0x0)return;const _0x2e7a9d=await _0x43ddf4[_0x294ce8(0x162)+'ig']()[_0x294ce8(0x192)](()=>({})),_0xf0663a=asRecord(_0x2e7a9d[_0x294ce8(0x1c9)]),_0x53f7b1={...asRecord(_0xf0663a[_0x294ce8(0x1a9)])};let _0x538cf1=![];for(const _0x20707d of _0x3036ea){Object[_0x294ce8(0x1d7)+'e'][_0x294ce8(0x193)+_0x294ce8(0x181)][_0x294ce8(0x1c0)](_0x53f7b1,_0x20707d)&&(delete _0x53f7b1[_0x20707d],_0x538cf1=!![]);}if(!_0x538cf1)return;_0xf0663a[_0x294ce8(0x1a9)]=_0x53f7b1,_0x2e7a9d[_0x294ce8(0x1c9)]=_0xf0663a,_0x43ddf4[_0x294ce8(0x18f)+_0x294ce8(0x14b)+_0x294ce8(0x163)+_0x294ce8(0x188)]?.(),await _0x43ddf4[_0x294ce8(0x18e)+_0x294ce8(0x18c)](_0x2e7a9d,'skill\x20co'+'nfig\x20ent'+'ries\x20rem'+_0x294ce8(0x1c3));}export async function deleteManagedSkill({payload:payload={},gateway:_0x1348ea,configController:_0x3ca8a5}){const _0x120d36=_0x8854,_0x232146=asRecord(payload),_0x10e891=getTrimmedString(_0x232146[_0x120d36(0x175)]??_0x232146[_0x120d36(0x173)]);if(!_0x10e891)throw new Error('Skill\x20ke'+_0x120d36(0x1cf)+_0x120d36(0x166));const _0x1955fb=await _0x1348ea[_0x120d36(0x1c9)]['status']()['catch'](()=>({'skills':[]})),_0x1439ee=Array[_0x120d36(0x1ac)](asRecord(_0x1955fb)[_0x120d36(0x1c9)])?asRecord(_0x1955fb)[_0x120d36(0x1c9)]:[],_0x561e79=_0x1439ee[_0x120d36(0x1bf)](asRecord)[_0x120d36(0x1ab)](_0x507fd8=>{const _0xc0b296=_0x120d36;return getTrimmedString(_0x507fd8['skillKey'])===_0x10e891||getTrimmedString(_0x507fd8[_0xc0b296(0x1e1)+_0xc0b296(0x153)])===_0x10e891||getTrimmedString(_0x507fd8[_0xc0b296(0x173)])===_0x10e891;});if(!_0x561e79)throw new Error(_0x120d36(0x160)+'除');if(_0x561e79[_0x120d36(0x15a)])throw new Error(_0x120d36(0x15e));if(_0x561e79[_0x120d36(0x16b)]||_0x561e79[_0x120d36(0x1d8)]===_0x120d36(0x1a8)+_0x120d36(0x1dc)||_0x561e79['source']===_0x120d36(0x1a8)+'-extra')throw new Error(_0x120d36(0x1b0)+_0x120d36(0x1da));if(!_0x561e79[_0x120d36(0x1cc)])throw new Error(_0x120d36(0x1a0)+'删除');const _0x3649f7=join(_0x3ca8a5['resolveS'+'tateDir'](),'market-s'+'kills.js'+'on'),_0xe8472f=await readMarketSkillRegistry(_0x3649f7),_0xc72452=asRecord(_0xe8472f[_0x10e891]),_0x35c3dc=getTrimmedString(_0x561e79[_0x120d36(0x1e1)+_0x120d36(0x153)])||getTrimmedString(_0xc72452[_0x120d36(0x17c)])||_0x10e891,_0xb816f8=new Set([_0x10e891,_0x35c3dc,getTrimmedString(_0x561e79[_0x120d36(0x173)])][_0x120d36(0x170)](Boolean)),_0x3b49e2=new Set([join(_0x3ca8a5[_0x120d36(0x198)+_0x120d36(0x16f)](),_0x120d36(0x1c9)),join(_0x3ca8a5[_0x120d36(0x198)+_0x120d36(0x16f)](),_0x120d36(0x1b1)+'e',_0x120d36(0x1c9))]),_0xe7161a=new Set();for(const _0x24a2e1 of _0x3b49e2)await collectSkillDirsUnderRoot(_0x24a2e1,_0xb816f8,_0xe7161a);if(_0xe7161a[_0x120d36(0x1c4)]===0x0)throw new Error('未找到该技能在磁'+_0x120d36(0x164)+'位于自定义\x20sk'+_0x120d36(0x156)+_0x120d36(0x185));for(const _0x382909 of _0xe7161a)await rm(_0x382909,{'recursive':!![],'force':!![]});return await removeMarketSkillRegistryKeys(_0x3649f7,[..._0xb816f8]),await removeSkillConfigEntries(_0x3ca8a5,[..._0xb816f8]),{'ok':!![],'skillKey':_0x10e891};}export async function updateManagedSkillConfig({payload:payload={},configController:_0x10513b}){const _0x5964ca=_0x8854,_0x2d88d7=asRecord(payload),_0x34d836=getTrimmedString(_0x2d88d7[_0x5964ca(0x175)]??_0x2d88d7['name']);if(!_0x34d836)throw new Error(_0x5964ca(0x155)+'y\x20is\x20req'+_0x5964ca(0x166));const _0x1216d8=await _0x10513b[_0x5964ca(0x162)+'ig']()['catch'](()=>({})),_0x4a8868=asRecord(_0x1216d8[_0x5964ca(0x1c9)]),_0x59595d={...asRecord(_0x4a8868['entries'])},_0x1c77aa=asRecord(_0x59595d[_0x34d836]),_0x593a80={..._0x1c77aa};typeof _0x2d88d7['enabled']===_0x5964ca(0x1bb)&&(_0x593a80[_0x5964ca(0x17d)]=_0x2d88d7[_0x5964ca(0x17d)]);const _0x5bffe2={...asRecord(_0x2d88d7['env'])},_0x2025bf=getTrimmedString(_0x2d88d7[_0x5964ca(0x190)]);if(_0x2025bf)_0x5bffe2[_0x5964ca(0x190)]=_0x2025bf;Object[_0x5964ca(0x1b4)](_0x5bffe2)[_0x5964ca(0x18d)]>0x0&&(_0x593a80['env']={...asRecord(_0x1c77aa['env']),..._0x5bffe2});const _0x473338=asRecord(_0x2d88d7['config']);return Object['keys'](_0x473338)[_0x5964ca(0x18d)]>0x0&&(_0x593a80['config']={...asRecord(_0x1c77aa[_0x5964ca(0x14f)]),..._0x473338}),_0x59595d[_0x34d836]=_0x593a80,_0x4a8868['entries']=_0x59595d,_0x1216d8[_0x5964ca(0x1c9)]=_0x4a8868,_0x10513b['markConf'+_0x5964ca(0x14b)+'andledIn'+_0x5964ca(0x188)]?.(),await _0x10513b[_0x5964ca(0x18e)+_0x5964ca(0x18c)](_0x1216d8,_0x5964ca(0x1a3)+'nfig\x20upd'+_0x5964ca(0x1d1)),{'ok':!![],'skillKey':_0x34d836};}function _0x24de(){const _0x3022c4=['ills\x20路径,','slice','33412ftMEZB','from','always','14iCuWrI','ory','mpare','该技能不允许删除','nationPa','技能不存在或已移','个\x20skill\x20','readConf','andledIn','盘上的目录,可能','kill.zip','uired','status','SKILLS.M','th\x20\x27','技能商店安装需要','bundled','导入技能\x20ZIP','sort','zipUrl','tateDir','filter','startsWi','showOpen','name','match','skillKey','openFile','Dialog','接口返回的\x20ve','powershe','toString','rt-','code','enabled','ath\x20\x27','rsion','已取消导入','operty','extracte','Expand-A','^\x5cs*','请手动删除','\x22已存在,请确认','5704MPiGrA','ternally','market-s','技能目录\x22','873YEvMES','fig','length','writeCon','markConf','apiKey','295JvnnaU','catch','hasOwnPr','7dDZoDo','utf8','rchive\x20-','replace','resolveS','__MACOSX','fromEntr','toUpperC','trim','-skill','ase','load','请先关闭技能后再','error','2318850MluFoC','skill\x20co','\x20SKILL.m','th\x20ensur','84YhBuiI','getPath','openclaw','entries','stringif','find','isArray','localeCo','5537DAuSwl','kills.js','内置/扩展技能无','workspac','2357301TdVHdn','-NoProfi','keys','ZIP\x20Arch','ZIP\x20中包含多','version','LiteralP','是否覆盖','extraDir','boolean','能导入一个','下载技能\x20ZIP','logoUrl','map','call','89221pcozPQ','push','oved','size','filePath','imported','ractive','skills\x20i','skills','EXDEV','2857830nTHAPJ','disabled','overwrit','pathname','y\x20is\x20req','object','ated','fer','SKILL.MD','temp','LS.md','接口返回的\x20na','prototyp','source','has','法删除','arrayBuf','-bundled','ive','ill-impo','SKILL.md','ll.exe','gatewayS','isDirect','managed\x20','igWriteH','unzip','ion','descript','config','market','win32','ZIP\x20中未找到','killKey','ies','Skill\x20ke'];_0x24de=function(){return _0x3022c4;};return _0x24de();}async function upsertMarketSkillRegistryEntry(_0x3312be,_0x3da5c6,_0x261fe5,_0x10c9de,_0x825e0f={}){const _0x23220c=_0x8854,_0x50cb51=getTrimmedString(_0x3da5c6),_0x1e8470=getTrimmedString(_0x261fe5),_0x444ac9=getTrimmedString(_0x10c9de);if(!_0x50cb51||!_0x1e8470||!_0x444ac9)return;const _0x399d37=await readMarketSkillRegistry(_0x3312be);_0x399d37[_0x50cb51]={'version':_0x444ac9,'code':_0x1e8470,...getTrimmedString(_0x825e0f['name'])?{'name':getTrimmedString(_0x825e0f[_0x23220c(0x173)])}:{},...getTrimmedString(_0x825e0f[_0x23220c(0x1be)])?{'logo_url':getTrimmedString(_0x825e0f[_0x23220c(0x1be)])}:{},...getTrimmedString(_0x825e0f[_0x23220c(0x14e)+_0x23220c(0x14d)])?{'description':getTrimmedString(_0x825e0f[_0x23220c(0x14e)+'ion'])}:{}};if(_0x399d37[_0x1e8470]&&_0x1e8470!==_0x50cb51)delete _0x399d37[_0x1e8470];for(const [_0xdfcfa4,_0x2a6106]of Object['entries'](_0x399d37)){if(_0xdfcfa4!==_0x50cb51&&asRecord(_0x2a6106)[_0x23220c(0x17c)]===_0x1e8470)delete _0x399d37[_0xdfcfa4];}const _0xf33bfc=Object[_0x23220c(0x19a)+_0x23220c(0x154)](Object[_0x23220c(0x1a9)](_0x399d37)['sort'](([_0x3d3bd1],[_0x3ec2e4])=>_0x3d3bd1[_0x23220c(0x1ad)+_0x23220c(0x15d)](_0x3ec2e4)));await writeJson(_0x3312be,_0xf33bfc);}async function ensureManagedSkillsExtraDir(_0x25b8df){const _0xabdf54=_0x8854,_0x745c40=await _0x25b8df[_0xabdf54(0x162)+'ig']()[_0xabdf54(0x192)](()=>({})),_0x20fb5e=asRecord(_0x745c40[_0xabdf54(0x1c9)]),_0x5cf6db=asRecord(_0x20fb5e['load']),_0x1f7581=Array[_0xabdf54(0x1ac)](_0x5cf6db[_0xabdf54(0x1ba)+'s'])?_0x5cf6db[_0xabdf54(0x1ba)+'s']:[],_0x4ec325=dedupeStrings([..._0x1f7581,_0xabdf54(0x1c9)]);if(JSON[_0xabdf54(0x1aa)+'y'](_0x1f7581)===JSON[_0xabdf54(0x1aa)+'y'](_0x4ec325))return;_0x5cf6db[_0xabdf54(0x1ba)+'s']=_0x4ec325,_0x20fb5e[_0xabdf54(0x19f)]=_0x5cf6db,_0x745c40[_0xabdf54(0x1c9)]=_0x20fb5e,_0x25b8df[_0xabdf54(0x18f)+'igWriteH'+'andledIn'+_0xabdf54(0x188)]?.(),await _0x25b8df[_0xabdf54(0x18e)+_0xabdf54(0x18c)](_0x745c40,_0xabdf54(0x1e3)+_0xabdf54(0x1c8)+'mport\x20pa'+_0xabdf54(0x1a5)+'ed');}async function resolveZipPath({payload:_0x5be518,app:_0x580921,dialog:_0x4c14fb,dialogWindow:_0xb39ff3}){const _0x4a30e4=_0x8854,_0x2e2f64=getTrimmedString(_0x5be518[_0x4a30e4(0x16e)]);let _0x4c48f6=getTrimmedString(_0x5be518['selected'+'ZipPath']),_0x8e404e=null;if(!_0x4c48f6&&_0x2e2f64){const _0x5b6780=new URL(_0x2e2f64);_0x8e404e=await mkdtemp(join(_0x580921[_0x4a30e4(0x1a7)]('temp'),'wujie-sk'+'ill-down'+'load-')),_0x4c48f6=join(_0x8e404e,basename(_0x5b6780[_0x4a30e4(0x1ce)])||_0x4a30e4(0x189)+_0x4a30e4(0x165));const _0xccbad7=await fetch(_0x5b6780[_0x4a30e4(0x17a)]());if(!_0xccbad7['ok'])throw new Error(_0x4a30e4(0x1bd)+'\x20失败(HTTP'+'\x20'+_0xccbad7[_0x4a30e4(0x167)]+')');await writeFile(_0x4c48f6,Buffer[_0x4a30e4(0x159)](await _0xccbad7[_0x4a30e4(0x1db)+_0x4a30e4(0x1d2)]()));}if(!_0x4c48f6){const _0x588f28={'title':_0x4a30e4(0x16c),'properties':[_0x4a30e4(0x176)],'filters':[{'name':_0x4a30e4(0x1b5)+_0x4a30e4(0x1dd),'extensions':['zip']}]},_0x4d6b4e=_0xb39ff3?await _0x4c14fb['showOpen'+'Dialog'](_0xb39ff3,_0x588f28):await _0x4c14fb[_0x4a30e4(0x172)+_0x4a30e4(0x177)](_0x588f28);if(_0x4d6b4e['canceled']||_0x4d6b4e[_0x4a30e4(0x1c5)+'s'][_0x4a30e4(0x18d)]===0x0)return{'cancelled':!![],'zipPath':null,'downloadedZipDir':_0x8e404e};_0x4c48f6=_0x4d6b4e[_0x4a30e4(0x1c5)+'s'][0x0];}return{'cancelled':![],'zipPath':_0x4c48f6,'downloadedZipDir':_0x8e404e};}export async function importSkillZip({payload:payload={},app:_0x193b60,dialog:_0x4a7dd5,dialogWindow:_0x5d8c85,configController:_0x265b1f}){const _0xaecc42=_0x8854,_0x34b10a=asRecord(payload),_0x346028=getTrimmedString(_0x34b10a['zipUrl']),{cancelled:_0x205165,zipPath:_0xd28db2,downloadedZipDir:_0x29f59f}=await resolveZipPath({'payload':_0x34b10a,'app':_0x193b60,'dialog':_0x4a7dd5,'dialogWindow':_0x5d8c85});if(_0x205165)return{'cancelled':!![],'imported':![],'overwritten':![],'skillDirName':null,'selectedZipPath':null,'zipUrl':_0x346028||null,'message':_0xaecc42(0x180)};const _0x4225c6=await mkdtemp(join(_0x193b60[_0xaecc42(0x1a7)](_0xaecc42(0x1d4)),'wujie-sk'+_0xaecc42(0x1de)+_0xaecc42(0x17b))),_0x55e3c1=join(_0x4225c6,_0xaecc42(0x182)+'d');try{await ensureManagedSkillsExtraDir(_0x265b1f),await mkdir(_0x55e3c1,{'recursive':!![]}),await extractZipToDirectory(_0xd28db2,_0x55e3c1);const _0x1466f4=await findSkillManifestDirectories(_0x55e3c1);if(_0x1466f4['length']===0x0)throw new Error(_0xaecc42(0x152)+_0xaecc42(0x1a4)+'d\x20或\x20SKIL'+_0xaecc42(0x1d5));if(_0x1466f4[_0xaecc42(0x18d)]>0x1)throw new Error(_0xaecc42(0x1b6)+_0xaecc42(0x161)+'目录,当前一次只'+_0xaecc42(0x1bc));const _0x4146d1=_0x1466f4[0x0];await normalizeImportedSkillManifest(_0x4146d1);const _0xcba69a=basename(_0x4146d1),_0x4683b7=parse(_0xd28db2)[_0xaecc42(0x173)][_0xaecc42(0x19c)]()||_0xaecc42(0x1c6)+_0xaecc42(0x19d),_0x2047d6=_0xcba69a==='extracte'+'d'?_0x4683b7:_0xcba69a,_0x2c4b89=await resolveSkillKeyFromManifest(_0x4146d1)??_0x2047d6,_0x5a4df6=_0x34b10a['source']===_0xaecc42(0x150),_0x7a116d=getTrimmedString(_0x34b10a['code']),_0x45a4f1=getTrimmedString(_0x34b10a[_0xaecc42(0x1b7)]),_0x520ffd=getTrimmedString(_0x34b10a['name']);if(_0x5a4df6&&!_0x7a116d)throw new Error(_0xaecc42(0x16a)+'接口返回的\x20co'+'de');if(_0x5a4df6&&!_0x45a4f1)throw new Error('技能商店安装需要'+_0xaecc42(0x178)+_0xaecc42(0x17f));if(_0x5a4df6&&!_0x520ffd)throw new Error(_0xaecc42(0x16a)+_0xaecc42(0x1d6)+'me');const _0x3914b9=_0x5a4df6?_0x45a4f1:await resolveSkillVersionFromManifest(_0x4146d1)??extractVersionFromZipUrl(_0x346028),_0x4da723=buildManagedSkillDirectoryName(_0x2c4b89,_0x3914b9,_0x2047d6),_0x4284e9=join(_0x265b1f[_0xaecc42(0x198)+_0xaecc42(0x16f)](),_0xaecc42(0x1c9)),_0x1244bb=join(_0x4284e9,_0x4da723);if(existsSync(_0x1244bb)){if(_0x34b10a['overwrit'+'e']!==!![])return{'cancelled':![],'imported':![],'overwritten':![],'needConfirmOverwrite':!![],'skillDirName':_0x4da723,'overwriteTargetPath':_0x1244bb,'selectedZipPath':_0xd28db2,'zipUrl':_0x346028||null,'message':_0xaecc42(0x18a)+_0x4da723+(_0xaecc42(0x186)+_0xaecc42(0x1b9))};await rm(_0x1244bb,{'recursive':!![],'force':!![]});}let _0xc16b53=_0x4146d1;_0xcba69a==='extracte'+'d'&&(_0xc16b53=join(_0x4225c6,_0x4da723),await rename(_0x4146d1,_0xc16b53));await moveDirectoryWithOverwrite(_0xc16b53,_0x1244bb);if(_0x5a4df6){for(const _0x48ef12 of await readdir(_0x4284e9,{'withFileTypes':!![]})[_0xaecc42(0x192)](()=>[])){if(!_0x48ef12[_0xaecc42(0x1e2)+_0xaecc42(0x15c)]())continue;const _0x18269b=join(_0x4284e9,_0x48ef12[_0xaecc42(0x173)]);if(_0x18269b===_0x1244bb)continue;const _0x576ff6=await resolveSkillKeyFromManifest(_0x18269b);_0x576ff6&&_0x576ff6['trim']()===_0x2c4b89[_0xaecc42(0x19c)]()&&await rm(_0x18269b,{'recursive':!![],'force':!![]});}await upsertMarketSkillRegistryEntry(join(_0x265b1f[_0xaecc42(0x198)+'tateDir'](),_0xaecc42(0x189)+_0xaecc42(0x1af)+'on'),_0x2c4b89,_0x7a116d,_0x45a4f1,{'name':_0x520ffd,'logoUrl':getTrimmedString(_0x34b10a[_0xaecc42(0x1be)]),'description':getTrimmedString(_0x34b10a[_0xaecc42(0x14e)+_0xaecc42(0x14d)])});}return{'cancelled':![],'imported':!![],'overwritten':_0x34b10a[_0xaecc42(0x1cd)+'e']===!![],'skillDirName':_0x4da723,'targetPath':_0x1244bb,'selectedZipPath':_0xd28db2,'zipUrl':_0x346028||null,'message':_0x4da723+'\x20添加成功'};}finally{await rm(_0x4225c6,{'recursive':!![],'force':!![]});if(_0x29f59f)await rm(_0x29f59f,{'recursive':!![],'force':!![]});}}
@@ -0,0 +1 @@
1
+ (function(_0x38a5b3,_0x538fd9){const _0x39fd55=_0x3127,_0x21fe21=_0x38a5b3();while(!![]){try{const _0x91580f=parseInt(_0x39fd55(0xfb))/0x1+-parseInt(_0x39fd55(0xf5))/0x2+-parseInt(_0x39fd55(0xde))/0x3*(parseInt(_0x39fd55(0xf8))/0x4)+parseInt(_0x39fd55(0xfe))/0x5*(parseInt(_0x39fd55(0x104))/0x6)+parseInt(_0x39fd55(0xdc))/0x7*(-parseInt(_0x39fd55(0x103))/0x8)+-parseInt(_0x39fd55(0xd8))/0x9*(-parseInt(_0x39fd55(0xd9))/0xa)+parseInt(_0x39fd55(0xfc))/0xb;if(_0x91580f===_0x538fd9)break;else _0x21fe21['push'](_0x21fe21['shift']());}catch(_0x2d261c){_0x21fe21['push'](_0x21fe21['shift']());}}}(_0x2889,0x73e1c));import{spawn}from'node:child_process';import{randomUUID}from'node:crypto';import{accessSync,constants,existsSync}from'node:fs';function _0x3127(_0x575964,_0x2752cd){_0x575964=_0x575964-0xc5;const _0x28891b=_0x2889();let _0x312798=_0x28891b[_0x575964];return _0x312798;}import{mkdir}from'node:fs/promises';import{basename,delimiter,join}from'node:path';const FILE_EXTENSION_REGEX=/\.[a-z0-9]+$/i;function resolvePathEntries(_0x2f8aa0){const _0x54d6c4=_0x3127,_0x5ad572=Object[_0x54d6c4(0xd7)](_0x2f8aa0)[_0x54d6c4(0xf4)](_0xfaef19=>_0xfaef19[_0x54d6c4(0xf0)+'ase']()===_0x54d6c4(0x100))??_0x54d6c4(0xe6);return String(_0x2f8aa0[_0x5ad572]||'')[_0x54d6c4(0xc7)](delimiter)[_0x54d6c4(0xed)](Boolean);}function _0x2889(){const _0x4a17a8=['data','darwin','al/bin/z','clear','set','X_OK','filter','win32','platform','toLowerC','pipe','push','/bin/zsh','find','1887610yNdBZA','stdin','ll\x20found','2804hHJuRG','cwd','object','330200zGyIUG','20254476emEbro','.bat','1129315lFwqAi','write','path','message','rted\x20Win','8rVWRjL','6rcdJVi','Terminal','xterm-25','/usr/loc','split','.exe','toString','kill','ebrew/bi','No\x20suppo','child','/bin/bas','env','al/bin/b','F_OK','trim','cmd','n/bash','dows\x20she','stderr','keys','480069BaiNwN','50muwwcz','includes','error','2840803IBdKQZ','get','3594bNmtLg','/opt/hom','truecolo','--login','sessionI','ash','-NoLogo','bash','PATH'];_0x2889=function(){return _0x4a17a8;};return _0x2889();}function canExecute(_0x3a141e){const _0x58117a=_0x3127;try{return accessSync(_0x3a141e,process[_0x58117a(0xef)]===_0x58117a(0xee)?constants[_0x58117a(0xd1)]:constants[_0x58117a(0xec)]),!![];}catch{return![];}}function resolveExecutableOnPath(_0x437d0c,_0x5d861e){const _0x27f701=_0x3127,_0x3e65d2=String(_0x437d0c||'')['trim']();if(!_0x3e65d2)return null;if(_0x3e65d2[_0x27f701(0xda)]('/')||_0x3e65d2[_0x27f701(0xda)]('\x5c'))return existsSync(_0x3e65d2)?_0x3e65d2:null;const _0x504fc8=[_0x3e65d2];process[_0x27f701(0xef)]==='win32'&&!FILE_EXTENSION_REGEX['test'](_0x3e65d2)&&_0x504fc8[_0x27f701(0xf2)](_0x3e65d2+_0x27f701(0xc8),_0x3e65d2+'.cmd',_0x3e65d2+_0x27f701(0xfd));for(const _0x43da11 of resolvePathEntries(_0x5d861e)){for(const _0x5b754f of _0x504fc8){const _0x3caa6e=join(_0x43da11,_0x5b754f);if(canExecute(_0x3caa6e))return _0x3caa6e;}}return null;}function resolveShellLaunchConfig(_0x5e20ff){const _0x1ec54b=_0x3127;if(process[_0x1ec54b(0xef)]===_0x1ec54b(0xee)){const _0x2f37ea=resolveExecutableOnPath('pwsh',_0x5e20ff)??resolveExecutableOnPath('powershe'+'ll',_0x5e20ff);if(_0x2f37ea)return{'command':_0x2f37ea,'args':[_0x1ec54b(0xe4)]};const _0x273183=resolveExecutableOnPath(_0x1ec54b(0xd3),_0x5e20ff);if(_0x273183)return{'command':_0x273183,'args':['/Q']};throw new Error(_0x1ec54b(0xcc)+_0x1ec54b(0x102)+_0x1ec54b(0xd5)+_0x1ec54b(0xf7));}if(process[_0x1ec54b(0xef)]===_0x1ec54b(0xe8)){const _0x25ad98=[_0x1ec54b(0xf3),_0x1ec54b(0xc6)+_0x1ec54b(0xe9)+'sh',_0x1ec54b(0xdf)+_0x1ec54b(0xcb)+'n/zsh']['find'](canExecute);if(_0x25ad98)return{'command':_0x25ad98,'args':['-i']};const _0x25ffda=[_0x1ec54b(0xce)+'h',_0x1ec54b(0xc6)+_0x1ec54b(0xd0)+_0x1ec54b(0xe3),_0x1ec54b(0xdf)+_0x1ec54b(0xcb)+_0x1ec54b(0xd4)][_0x1ec54b(0xf4)](canExecute);if(_0x25ffda)return{'command':_0x25ffda,'args':[_0x1ec54b(0xe1),'-i']};}const _0x540c74=resolveExecutableOnPath(process.env.SHELL||'',_0x5e20ff)??resolveExecutableOnPath(_0x1ec54b(0xe5),_0x5e20ff)??resolveExecutableOnPath('sh',_0x5e20ff);if(!_0x540c74)throw new Error(_0x1ec54b(0xcc)+'rted\x20she'+_0x1ec54b(0xf7));return{'command':_0x540c74,'args':['-l','-i']};}export function createTerminalManager({cwd:_0x56c50c,emitData:_0x4fe08b,emitExit:_0x3cdb2e}){const _0x3a1580=new Map();function _0x457e66(_0x26bfbc){const _0x8c3a03=_0x3127,_0x40925b=_0x3a1580[_0x8c3a03(0xdd)](_0x26bfbc);if(!_0x40925b)throw new Error(_0x8c3a03(0x105)+'\x20session'+'\x20not\x20fou'+'nd');return _0x40925b;}async function _0x520c6c(_0x11c495={}){const _0x1867c0=_0x3127,_0x536e7e={...process.env,'TERM':_0x1867c0(0xc5)+'6color','COLORTERM':_0x1867c0(0xe0)+'r',..._0x11c495[_0x1867c0(0xcf)]&&typeof _0x11c495['env']===_0x1867c0(0xfa)?_0x11c495[_0x1867c0(0xcf)]:{}},_0x3b2869=typeof _0x11c495[_0x1867c0(0xf9)]==='string'&&_0x11c495[_0x1867c0(0xf9)][_0x1867c0(0xd2)]()?_0x11c495[_0x1867c0(0xf9)]:'',_0x2617d4=_0x3b2869||_0x56c50c;await mkdir(_0x2617d4,{'recursive':!![]});const {command:_0x3283fb,args:_0x347ed4}=resolveShellLaunchConfig(_0x536e7e),_0x29324d=randomUUID(),_0x3a1c5d=spawn(_0x3283fb,_0x347ed4,{'cwd':_0x2617d4,'env':_0x536e7e,'stdio':_0x1867c0(0xf1)});return _0x3a1580[_0x1867c0(0xeb)](_0x29324d,{'sessionId':_0x29324d,'child':_0x3a1c5d}),_0x3a1c5d['stdout']['on']('data',_0x589cd5=>_0x4fe08b({'sessionId':_0x29324d,'data':_0x589cd5['toString']()})),_0x3a1c5d[_0x1867c0(0xd6)]['on'](_0x1867c0(0xe7),_0x479bd1=>_0x4fe08b({'sessionId':_0x29324d,'data':_0x479bd1[_0x1867c0(0xc9)]()})),_0x3a1c5d['on']('close',(_0x43401a,_0x28a953)=>{_0x3a1580['delete'](_0x29324d),_0x3cdb2e({'sessionId':_0x29324d,'exitCode':_0x43401a,'signal':_0x28a953});}),_0x3a1c5d['on'](_0x1867c0(0xdb),_0xc18851=>{const _0x271d69=_0x1867c0;_0x4fe08b({'sessionId':_0x29324d,'data':_0xc18851[_0x271d69(0x101)]+'\x0a'});}),{'sessionId':_0x29324d,'shell':basename(_0x3283fb),'cwd':_0x2617d4};}function _0x294f13(_0x87fd89={}){const _0x23d7d0=_0x3127,_0x4075ea=_0x457e66(String(_0x87fd89[_0x23d7d0(0xe2)+'d']||''));return _0x4075ea[_0x23d7d0(0xcd)][_0x23d7d0(0xf6)][_0x23d7d0(0xff)](String(_0x87fd89['data']||'')),{'ok':!![]};}function _0x53c24a(_0x5d476a={}){const _0xc8e74b=_0x3127,_0x502440=String(_0x5d476a[_0xc8e74b(0xe2)+'d']||'');return _0x457e66(_0x502440),{'ok':!![],'ignored':!![]};}function _0x15319f(_0x426479={}){const _0x1fe0b4=_0x3127,_0x32a56b=String(_0x426479[_0x1fe0b4(0xe2)+'d']||''),_0x217ecb=_0x3a1580[_0x1fe0b4(0xdd)](_0x32a56b);if(!_0x217ecb)return{'ok':!![],'closed':![]};return _0x3a1580['delete'](_0x32a56b),_0x217ecb['child']['kill'](),{'ok':!![],'closed':!![]};}function _0x3189e2(){const _0x1d25c8=_0x3127;for(const _0x32eb04 of _0x3a1580['values']())_0x32eb04[_0x1d25c8(0xcd)][_0x1d25c8(0xca)]();_0x3a1580[_0x1d25c8(0xea)]();}return{'create':_0x520c6c,'input':_0x294f13,'resize':_0x53c24a,'close':_0x15319f,'dispose':_0x3189e2};}
@@ -1 +1 @@
1
- (function(_0x5250e0,_0x212c1d){const _0x30615e=_0x382e,_0x29e927=_0x5250e0();while(!![]){try{const _0x38106a=-parseInt(_0x30615e(0xd6))/0x1*(parseInt(_0x30615e(0xc4))/0x2)+parseInt(_0x30615e(0xcb))/0x3+parseInt(_0x30615e(0xca))/0x4*(-parseInt(_0x30615e(0xc7))/0x5)+-parseInt(_0x30615e(0xdd))/0x6*(-parseInt(_0x30615e(0xc5))/0x7)+parseInt(_0x30615e(0xc3))/0x8*(-parseInt(_0x30615e(0xc9))/0x9)+-parseInt(_0x30615e(0xe0))/0xa*(parseInt(_0x30615e(0xdf))/0xb)+parseInt(_0x30615e(0xc8))/0xc;if(_0x38106a===_0x212c1d)break;else _0x29e927['push'](_0x29e927['shift']());}catch(_0x24e483){_0x29e927['push'](_0x29e927['shift']());}}}(_0x19ed,0x5fe85));import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';function _0x19ed(){const _0x11a5de=['8WqnNjf','272208PzaLvr','797881QjoZdM','name','19405TjtqMu','12245484yFxurJ','3503889spHQXX','316gnQMYy','1016094xJOYcX','filter','isFile','openclaw','string','.plugin.','0.0.0','version','isDirect','ory','map','4Jwtymt','replaceA','stringif','utf8','json','trim','parse','18juCAcU','package.','11SqepqQ','679310NJHbNt','isArray'];_0x19ed=function(){return _0x11a5de;};return _0x19ed();}import{basename,dirname,join,relative}from'node:path';export function asRecord(_0x3977d1){const _0x2fb10c=_0x382e;return _0x3977d1&&typeof _0x3977d1==='object'&&!Array[_0x2fb10c(0xc2)](_0x3977d1)?_0x3977d1:{};}export function asStringArray(_0x157ffe){const _0x1a86a6=_0x382e;return Array['isArray'](_0x157ffe)?_0x157ffe[_0x1a86a6(0xcc)](_0x328dcd=>typeof _0x328dcd===_0x1a86a6(0xcf)&&_0x328dcd['trim']())[_0x1a86a6(0xd5)](_0x5cf1d7=>_0x5cf1d7['trim']()):[];}export function dedupeStrings(_0x171ed0){const _0x49b7c6=_0x382e;return[...new Set(_0x171ed0[_0x49b7c6(0xcc)](Boolean))];}export function getTrimmedString(_0x51cd57){const _0x500382=_0x382e;return typeof _0x51cd57===_0x500382(0xcf)?_0x51cd57[_0x500382(0xdb)]():'';}export async function readJson(_0x318a6e,_0x4cdc82={}){const _0x8407=_0x382e;try{return JSON[_0x8407(0xdc)](await readFile(_0x318a6e,_0x8407(0xd9)));}catch{return _0x4cdc82;}}export async function writeJson(_0xadd7f2,_0x70f70a){const _0x4338f0=_0x382e;await mkdir(dirname(_0xadd7f2),{'recursive':!![]}),await writeFile(_0xadd7f2,JSON[_0x4338f0(0xd8)+'y'](_0x70f70a,null,0x2)+'\x0a',_0x4338f0(0xd9));}export async function copyDirFresh(_0x41dec7,_0x834a25){await rm(_0x834a25,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x834a25),{'recursive':!![]}),await cp(_0x41dec7,_0x834a25,{'recursive':!![]});}export async function ensureDir(_0x2661e0){await mkdir(_0x2661e0,{'recursive':!![]});}export function pathExists(_0x22d64a){return existsSync(_0x22d64a);}export async function listDirs(_0x2c7fb1){const _0x438aa2=_0x382e;try{const _0x5cb2e7=await readdir(_0x2c7fb1,{'withFileTypes':!![],'encoding':_0x438aa2(0xd9)});return _0x5cb2e7['filter'](_0x38a1e9=>_0x38a1e9[_0x438aa2(0xd3)+_0x438aa2(0xd4)]())[_0x438aa2(0xd5)](_0x4265e8=>_0x4265e8[_0x438aa2(0xc6)]);}catch{return[];}}export async function getPackageMetadata(_0xbb8724){const _0x5d3a19=_0x382e,_0x41dfb7=await readJson(join(_0xbb8724,_0x5d3a19(0xde)+_0x5d3a19(0xda)),{}),_0x46e07a=asRecord(_0x41dfb7['openclaw']);return{'name':getTrimmedString(_0x41dfb7['name'])||basename(_0xbb8724),'version':getTrimmedString(_0x41dfb7[_0x5d3a19(0xd2)])||_0x5d3a19(0xd1),'pluginId':getTrimmedString(_0x46e07a['id'])||getTrimmedString(_0x41dfb7[_0x5d3a19(0xce)+'Id'])||basename(_0xbb8724)};}export async function readPluginManifest(_0x3d07c2){const _0x23711f=_0x382e,_0x35e3dc=join(_0x3d07c2,_0x23711f(0xce)+_0x23711f(0xd0)+'json'),_0x27caf1=await readJson(_0x35e3dc,{});return asRecord(_0x27caf1);}function _0x382e(_0x39119d,_0x45a4c1){_0x39119d=_0x39119d-0xc2;const _0x19ed5f=_0x19ed();let _0x382e4f=_0x19ed5f[_0x39119d];return _0x382e4f;}export async function hasFile(_0x5c08e1){const _0x201fc0=_0x382e;try{const _0x421342=await stat(_0x5c08e1);return _0x421342[_0x201fc0(0xcd)]();}catch{return![];}}export function toRuntimeRelative(_0x4a7b8c,_0x5d2e5c){const _0x36aaa5=_0x382e;return relative(_0x4a7b8c,_0x5d2e5c)[_0x36aaa5(0xd7)+'ll']('\x5c','/');}
1
+ (function(_0x4475ba,_0x452b8e){const _0x3d3fe8=_0x5b42,_0x50e2e3=_0x4475ba();while(!![]){try{const _0x25c9bd=parseInt(_0x3d3fe8(0x162))/0x1+-parseInt(_0x3d3fe8(0x16e))/0x2+-parseInt(_0x3d3fe8(0x160))/0x3*(parseInt(_0x3d3fe8(0x16f))/0x4)+parseInt(_0x3d3fe8(0x175))/0x5*(parseInt(_0x3d3fe8(0x171))/0x6)+parseInt(_0x3d3fe8(0x170))/0x7+parseInt(_0x3d3fe8(0x174))/0x8*(-parseInt(_0x3d3fe8(0x172))/0x9)+parseInt(_0x3d3fe8(0x15d))/0xa*(parseInt(_0x3d3fe8(0x16b))/0xb);if(_0x25c9bd===_0x452b8e)break;else _0x50e2e3['push'](_0x50e2e3['shift']());}catch(_0x3b3c7a){_0x50e2e3['push'](_0x50e2e3['shift']());}}}(_0x5d4d,0x9a907));function _0x5d4d(){const _0x510018=['json','480MwHHeA','.plugin.','346055yjysAW','name','ory','utf8','object','isDirect','isFile','trim','map','312609heQrQU','isArray','openclaw','1454350vYpHLB','18488pAGSxd','2430057KQWpjj','6dVvbzk','6950403cchjzv','filter','8OpzxTq','2652745NDoxKy','580orUyny','0.0.0'];_0x5d4d=function(){return _0x510018;};return _0x5d4d();}import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';export function asRecord(_0x2ec205){const _0x57606f=_0x5b42;return _0x2ec205&&typeof _0x2ec205===_0x57606f(0x166)&&!Array[_0x57606f(0x16c)](_0x2ec205)?_0x2ec205:{};}export function asStringArray(_0x2b1d55){const _0x1f3baf=_0x5b42;return Array['isArray'](_0x2b1d55)?_0x2b1d55[_0x1f3baf(0x173)](_0x47fe4e=>typeof _0x47fe4e==='string'&&_0x47fe4e[_0x1f3baf(0x169)]())[_0x1f3baf(0x16a)](_0xb149b8=>_0xb149b8['trim']()):[];}export function dedupeStrings(_0x2fde3e){const _0x98e0d2=_0x5b42;return[...new Set(_0x2fde3e[_0x98e0d2(0x173)](Boolean))];}export function getTrimmedString(_0xa16874){const _0x18aeeb=_0x5b42;return typeof _0xa16874==='string'?_0xa16874[_0x18aeeb(0x169)]():'';}export async function readJson(_0x23dfa2,_0xe39e79={}){const _0x499054=_0x5b42;try{return JSON['parse'](await readFile(_0x23dfa2,_0x499054(0x165)));}catch{return _0xe39e79;}}export async function writeJson(_0x25c27a,_0x3f4c0e){const _0x1badc9=_0x5b42;await mkdir(dirname(_0x25c27a),{'recursive':!![]}),await writeFile(_0x25c27a,JSON['stringif'+'y'](_0x3f4c0e,null,0x2)+'\x0a',_0x1badc9(0x165));}export async function copyDirFresh(_0x27d446,_0x578b7d){await rm(_0x578b7d,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x578b7d),{'recursive':!![]}),await cp(_0x27d446,_0x578b7d,{'recursive':!![]});}export async function ensureDir(_0x389175){await mkdir(_0x389175,{'recursive':!![]});}export function pathExists(_0x1730cf){return existsSync(_0x1730cf);}export async function listDirs(_0x123091){const _0x3d0884=_0x5b42;try{const _0x3a0c03=await readdir(_0x123091,{'withFileTypes':!![],'encoding':_0x3d0884(0x165)});return _0x3a0c03[_0x3d0884(0x173)](_0x1cd053=>_0x1cd053[_0x3d0884(0x167)+_0x3d0884(0x164)]())[_0x3d0884(0x16a)](_0x9b65f6=>_0x9b65f6[_0x3d0884(0x163)]);}catch{return[];}}export async function getPackageMetadata(_0x2c3079){const _0x2052b5=_0x5b42,_0x59d183=await readJson(join(_0x2c3079,'package.'+_0x2052b5(0x15f)),{}),_0x35a457=asRecord(_0x59d183[_0x2052b5(0x16d)]);return{'name':getTrimmedString(_0x59d183[_0x2052b5(0x163)])||basename(_0x2c3079),'version':getTrimmedString(_0x59d183['version'])||_0x2052b5(0x15e),'pluginId':getTrimmedString(_0x35a457['id'])||getTrimmedString(_0x59d183[_0x2052b5(0x16d)+'Id'])||basename(_0x2c3079)};}export async function readPluginManifest(_0x42d1b9){const _0x282cd9=_0x5b42,_0x40b3ab=join(_0x42d1b9,_0x282cd9(0x16d)+_0x282cd9(0x161)+_0x282cd9(0x15f)),_0x1de3da=await readJson(_0x40b3ab,{});return asRecord(_0x1de3da);}function _0x5b42(_0x14fef6,_0xab949f){_0x14fef6=_0x14fef6-0x15d;const _0x5d4df1=_0x5d4d();let _0x5b42ec=_0x5d4df1[_0x14fef6];return _0x5b42ec;}export async function hasFile(_0x398adc){const _0xa8ab4=_0x5b42;try{const _0x563820=await stat(_0x398adc);return _0x563820[_0xa8ab4(0x168)]();}catch{return![];}}export function toRuntimeRelative(_0x275419,_0x669f11){return relative(_0x275419,_0x669f11)['replaceA'+'ll']('\x5c','/');}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wujie-shell/core",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.mjs",
6
6
  "exports": {
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "get-port": "^7.2.0",
29
29
  "ws": "^8.20.0",
30
- "@wujie-shell/config": "1.0.0",
31
- "@wujie-shell/logger": "1.0.0"
30
+ "@wujie-shell/logger": "2.0.0",
31
+ "@wujie-shell/config": "2.0.0"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "node ../../scripts/build-packages.mjs --package @wujie-shell/core"