@wujie-shell/core 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/bin/wujie-shell.mjs +1 -1
- package/dist/src/bundled-agent-skills.mjs +1 -1
- package/dist/src/bundled-agents.mjs +1 -1
- package/dist/src/config-controller.mjs +1 -1
- package/dist/src/electron/main.mjs +1 -1
- package/dist/src/electron/preload.mjs +1 -1
- package/dist/src/gateway-controller.mjs +1 -1
- package/dist/src/gateway-ws.mjs +1 -1
- package/dist/src/index.mjs +1 -1
- package/dist/src/logging.mjs +1 -1
- package/dist/src/plugin-sync.mjs +1 -1
- package/dist/src/runtime-logger.mjs +1 -1
- package/dist/src/runtime.mjs +1 -1
- package/dist/src/utils.mjs +1 -1
- package/package.json +3 -3
package/dist/src/runtime.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x51e383=_0x2d02;(function(_0xbbca86,_0x55ae2c){const _0x396310=_0x2d02,_0x4614ba=_0xbbca86();while(!![]){try{const _0x4f8eb3=parseInt(_0x396310(0x165))/0x1+-parseInt(_0x396310(0x183))/0x2*(parseInt(_0x396310(0xaf))/0x3)+parseInt(_0x396310(0x15c))/0x4+-parseInt(_0x396310(0x12d))/0x5+parseInt(_0x396310(0xa1))/0x6*(-parseInt(_0x396310(0x109))/0x7)+parseInt(_0x396310(0x144))/0x8*(parseInt(_0x396310(0x14c))/0x9)+-parseInt(_0x396310(0x13a))/0xa;if(_0x4f8eb3===_0x55ae2c)break;else _0x4614ba['push'](_0x4614ba['shift']());}catch(_0x225010){_0x4614ba['push'](_0x4614ba['shift']());}}}(_0x503b,0x58166));import{existsSync}from'node:fs';import{chmod,cp,mkdir,rename,rm,writeFile}from'node:fs/promises';import{delimiter,dirname,join,relative,resolve}from'node:path';import{spawn}from'node:child_process';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=_0x51e383(0x127)+'time',MANIFEST_NAME='runtime-'+_0x51e383(0x173)+'.json',NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x351422){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x351422,RUNTIME_DIR);}export function resolveManifestPath(_0x3a99d8){return join(_0x3a99d8,MANIFEST_NAME);}export async function prepareRuntime(_0x3b5842,{syncOnly:syncOnly=![]}={}){const _0x274394=_0x51e383,_0x4db234=resolveRuntimeRoot(_0x3b5842[_0x274394(0x177)+_0x274394(0xfc)]),_0x5626a9=_0x3b5842[_0x274394(0x17c)][_0x274394(0x124)+'pRuntime'+'Dir'],_0x3329a9=createRuntimeLogger(getConfigPaths(_0x3b5842),_0x274394(0x17d)),_0x34bc78=Date['now']();_0x3329a9?.[_0x274394(0xc9)](_0x274394(0xff)+_0x274394(0x142)+_0x274394(0x129),{'syncOnly':syncOnly,'runtimeRoot':_0x4db234,'shellConfig':summarizeShellConfig(_0x3b5842)});try{if(!existsSync(join(_0x5626a9,MANIFEST_NAME)))throw new Error(_0x274394(0x124)+_0x274394(0x123)+_0x274394(0x134)+_0x274394(0xdf)+_0x5626a9+('.\x20For\x20MV'+_0x274394(0xc3)+_0x274394(0x14a)+_0x274394(0x9e)+'ime\x20firs'+'t.'));_0x3329a9?.[_0x274394(0xc9)]('bootstra'+_0x274394(0x123)+_0x274394(0x152)+'d',{'bootstrapRuntimeDir':_0x5626a9});const _0x205166=!syncOnly||!existsSync(resolveManifestPath(_0x4db234));_0x205166?(_0x3329a9?.['info'](_0x274394(0x142)+'replacem'+_0x274394(0x146)+_0x274394(0x9f),{'from':_0x5626a9,'to':_0x4db234,'reason':syncOnly?_0x274394(0x19c)+_0x274394(0x173):_0x274394(0xff)+'command'}),await replaceRuntimeFromBootstrap(_0x5626a9,_0x4db234),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x106)+_0x274394(0xe4)+_0x274394(0x187),{'runtimeRoot':_0x4db234})):_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x106)+_0x274394(0x12c)+_0x274394(0x13e),{'reason':_0x274394(0xa2)+_0x274394(0x17f)+_0x274394(0x185)+'s','manifestPath':resolveManifestPath(_0x4db234)});const _0x2de632=await readRuntimeManifest(_0x4db234);_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x173)+'\x20loaded',{'manifestPath':resolveManifestPath(_0x4db234),'manifest':summarizeRuntimeManifest(_0x2de632)}),validateRuntimeNodeVersion(_0x2de632,_0x3b5842),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+'node\x20ver'+_0x274394(0x162)+'idated',{'nodeVersion':_0x2de632[_0x274394(0x143)+_0x274394(0xf7)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x2de632,_0x3b5842),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x17c)+_0x274394(0xfa)+_0x274394(0x155)+'ed',{'openclawVersion':_0x2de632[_0x274394(0x17c)+_0x274394(0x101)]});else{if(_0x2de632[_0x274394(0x17c)+'Version']!==_0x3b5842[_0x274394(0x17c)][_0x274394(0x17c)+'Version']){const _0x83a918=await loadRuntimeInfo(_0x3b5842[_0x274394(0x177)+_0x274394(0xfc)]);_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x17c)+_0x274394(0x14e)+_0x274394(0x121)+'\x20started',{'fromVersion':_0x2de632[_0x274394(0x17c)+_0x274394(0x101)]||_0x274394(0xbd),'toVersion':_0x3b5842['openclaw'][_0x274394(0x17c)+_0x274394(0x101)]}),await installOpenClawPackage(_0x83a918,_0x3b5842['openclaw']['openclaw'+_0x274394(0x101)]),_0x2de632['openclaw'+_0x274394(0x101)]=_0x3b5842[_0x274394(0x17c)][_0x274394(0x17c)+_0x274394(0x101)],_0x3329a9?.['info'](_0x274394(0x17c)+_0x274394(0x14e)+'\x20install'+'\x20complet'+'ed',{'openclawVersion':_0x2de632[_0x274394(0x17c)+_0x274394(0x101)]});}}_0x2de632['generate'+_0x274394(0x139)]=new Date()[_0x274394(0x167)+_0x274394(0x19b)](),_0x2de632[_0x274394(0x143)+'ion']=_0x3b5842[_0x274394(0x17c)][_0x274394(0x143)+_0x274394(0xf7)],_0x2de632['product']={'appId':_0x3b5842[_0x274394(0xdb)],'productName':_0x3b5842[_0x274394(0x13c)+_0x274394(0x189)],'dataDirName':_0x3b5842['dataDirN'+_0x274394(0x189)]};const _0x287aa2=Array[_0x274394(0x108)](_0x2de632[_0x274394(0x15d)])?_0x2de632[_0x274394(0x15d)]['length']:0x0;return await syncManifestPluginScope(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.['info'](_0x274394(0x142)+_0x274394(0x114)+'cope\x20syn'+_0x274394(0x14b),{'beforePluginCount':_0x287aa2,'afterPluginCount':Array['isArray'](_0x2de632['plugins'])?_0x2de632['plugins']['length']:0x0,'pluginSpecCount':Array[_0x274394(0x108)](_0x2de632['pluginSp'+_0x274394(0x9d)])?_0x2de632['pluginSp'+_0x274394(0x9d)]['length']:0x0}),await syncProductPlugins(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x16e)+'plugins\x20'+_0x274394(0xdc),{'localPluginCount':_0x3b5842[_0x274394(0x17c)][_0x274394(0xe2)+'LocalPlu'+_0x274394(0x19e)][_0x274394(0x11e)],'pluginCount':Array[_0x274394(0x108)](_0x2de632[_0x274394(0x15d)])?_0x2de632[_0x274394(0x15d)][_0x274394(0x11e)]:0x0}),await syncProductAgents(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.['info'](_0x274394(0x16e)+'agents\x20s'+'ynced',{'source':_0x3b5842['openclaw'][_0x274394(0x18f)+'r'],'installPath':_0x2de632[_0x274394(0x158)]?.['installP'+'ath']}),await syncProductSkills(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.['info'](_0x274394(0x16e)+_0x274394(0x120)+'ynced',{'source':_0x3b5842['openclaw'][_0x274394(0xa5)+'r'],'installPath':_0x2de632[_0x274394(0x11a)]?.[_0x274394(0x126)+_0x274394(0xf5)]}),await syncRuntimeWrapper(_0x3b5842,_0x4db234,_0x2de632),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+_0x274394(0x107)+_0x274394(0xdc),{'wujieclawBin':_0x2de632[_0x274394(0x11f)+_0x274394(0xe6)]}),await writeJson(resolveManifestPath(_0x4db234),_0x2de632),_0x3329a9?.[_0x274394(0xc9)](_0x274394(0x142)+'manifest'+_0x274394(0xb3),{'manifestPath':resolveManifestPath(_0x4db234),'manifest':summarizeRuntimeManifest(_0x2de632),'durationMs':Date[_0x274394(0x164)]()-_0x34bc78}),await _0x3329a9?.[_0x274394(0x17b)](),_0x2de632;}catch(_0x30f89a){_0x3329a9?.[_0x274394(0x178)](_0x274394(0xff)+_0x274394(0x142)+_0x274394(0x136),{'syncOnly':syncOnly,'runtimeRoot':_0x4db234,'durationMs':Date['now']()-_0x34bc78,'error':_0x30f89a}),await _0x3329a9?.['flush']();throw _0x30f89a;}}async function syncRuntimeWrapper(_0x37f005,_0x1e1f26,_0x378641){const _0x4ba4b8=_0x51e383,_0x3c5e0a=join(_0x1e1f26,'bin',_0x4ba4b8(0x11f)+'w'),_0x3a387c=join(_0x1e1f26,_0x4ba4b8(0x122),_0x4ba4b8(0x11f)+_0x4ba4b8(0x18d)),_0x222982=normalizeRuntimeRelativePath(relative(dirname(_0x3c5e0a),resolve(_0x1e1f26,_0x378641[_0x4ba4b8(0x157)+_0x4ba4b8(0x166)]))),_0x489f74=normalizeRuntimeRelativePath(relative(dirname(_0x3c5e0a),resolve(_0x1e1f26,_0x378641[_0x4ba4b8(0x17c)+_0x4ba4b8(0xc6)]))),_0x4a6e52=_0x4ba4b8(0x18a)+_0x37f005[_0x4ba4b8(0xd9)+_0x4ba4b8(0x189)],_0xc8eaef=_0x4ba4b8(0xd3)+_0x4ba4b8(0x160)+_0x37f005[_0x4ba4b8(0xd9)+_0x4ba4b8(0x189)];await mkdir(dirname(_0x3c5e0a),{'recursive':!![]}),await writeFile(_0x3c5e0a,[_0x4ba4b8(0x133)+'h',_0x4ba4b8(0x159)+_0x4ba4b8(0xd5)+_0x4ba4b8(0x16a)+'OPENCLAW'+'_HOME:-'+_0x4a6e52+'}\x22',_0x4ba4b8(0x159)+_0x4ba4b8(0xd5)+_0x4ba4b8(0x13d)+_0x4ba4b8(0xa9)+_0x4ba4b8(0xb6)+_0x4ba4b8(0x16b)+'-'+_0x4a6e52+'}\x22',_0x4ba4b8(0x159)+_0x4ba4b8(0xd5)+_0x4ba4b8(0x10b)+_0x4ba4b8(0xf8)+_0x4ba4b8(0xd5)+'CONFIG_P'+_0x4ba4b8(0xbf)+_0x4a6e52+('/opencla'+'w.json}\x22'),_0x4ba4b8(0x154)+'IR=$(CDP'+_0x4ba4b8(0xd4)+_0x4ba4b8(0x131)+_0x4ba4b8(0x15a)+_0x4ba4b8(0x112)+'&&\x20pwd)',_0x4ba4b8(0xc4)+_0x4ba4b8(0x181)+'R/'+_0x222982+('\x22\x20\x22$SCRI'+_0x4ba4b8(0x11b))+_0x489f74+'\x22\x20\x22$@\x22','']['join']('\x0a'),_0x4ba4b8(0xab)),await chmod(_0x3c5e0a,0x1ed),await writeFile(_0x3a387c,['@echo\x20of'+'f',_0x4ba4b8(0xd7)+_0x4ba4b8(0x148)+_0x4ba4b8(0x179)+_0x4ba4b8(0xa6)+'ENCLAW_H'+_0x4ba4b8(0x117)+_0xc8eaef+'\x22',_0x4ba4b8(0xd7)+_0x4ba4b8(0xb6)+'ATE_DIR%'+'\x22==\x22\x22\x20se'+_0x4ba4b8(0xc8)+_0x4ba4b8(0x10d)+_0x4ba4b8(0x103)+_0xc8eaef+'\x22',_0x4ba4b8(0xd7)+'NCLAW_CO'+'NFIG_PAT'+_0x4ba4b8(0x191)+_0x4ba4b8(0x147)+_0x4ba4b8(0x110)+'NFIG_PAT'+'H='+_0xc8eaef+(_0x4ba4b8(0x12f)+'w.json\x22'),_0x4ba4b8(0xbe)+_0x4ba4b8(0xae)+_0x4ba4b8(0x182),_0x4ba4b8(0x161)+_0x4ba4b8(0x197)+toWindowsPath(_0x222982)+(_0x4ba4b8(0x171)+'PT_DIR%')+toWindowsPath(_0x489f74)+_0x4ba4b8(0xc2),''][_0x4ba4b8(0xea)]('\x0d\x0a'),_0x4ba4b8(0xab)),_0x378641[_0x4ba4b8(0x11f)+_0x4ba4b8(0xe6)]=toRuntimeRelative(_0x1e1f26,process['platform']===_0x4ba4b8(0xda)?_0x3a387c:_0x3c5e0a);}function normalizeRuntimeRelativePath(_0x18f02c){return _0x18f02c['replaceA'+'ll']('\x5c','/');}function toWindowsPath(_0x322943){return _0x322943['replaceA'+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x5d51fa,_0xc8fbb5){const _0x3e2a7c=_0x51e383;if(_0x5d51fa[_0x3e2a7c(0x143)+_0x3e2a7c(0xf7)]===_0xc8fbb5[_0x3e2a7c(0x17c)][_0x3e2a7c(0x143)+'ion'])return;throw new Error(_0x3e2a7c(0x142)+_0x3e2a7c(0x143)+'ion\x20mism'+_0x3e2a7c(0xcb)+'nifest='+(_0x5d51fa['nodeVers'+_0x3e2a7c(0xf7)]||'unknown')+(_0x3e2a7c(0x150)+_0x3e2a7c(0x135))+_0xc8fbb5[_0x3e2a7c(0x17c)][_0x3e2a7c(0x143)+_0x3e2a7c(0xf7)]+'.\x20'+('Rebuild\x20'+_0x3e2a7c(0x132)+_0x3e2a7c(0xed)+'ntime\x20wi'+_0x3e2a7c(0xa7)+_0x3e2a7c(0xfe)+_0x3e2a7c(0x138)+_0x3e2a7c(0x18e)+_0x3e2a7c(0xb1)+_0x3e2a7c(0xc7)+'wujie-sh'+_0x3e2a7c(0xf6)));}function _0x503b(){const _0x5793fe=['\x22\x20at\x20','filename','w.cmd','ersion\x20b','agentsDi','.cache','H%\x22==\x22\x22\x20','map','Version\x20','tall\x20the','hell:run','pid','_DIR%','er\x20writt','source','npm\x20pack','ing','missing\x20','startsWi','ginPaths','\x22\x20so\x20the','ecs','-ai\x20runt','ted','push','6MvxgKO','sync-onl','with\x20cod','\x20can\x20ins','skillsDi','\x20set\x20\x22OP','th\x20the\x20c','stalling','R=\x22${OPE','fix\x20comp','utf8','rg/','replace','IPT_DIR=','12zfJEbx','parse','efore\x20pr','pluginSp','\x20written','\x20create\x20','Name','NCLAW_ST','ent','sion.','dist','--fix','Run\x20\x22wuj','\x20timed\x20o','unknown','set\x20\x22SCR','ATH:-','npmCli','red\x20Open','\x22\x20%*','P,\x20prepa','exec\x20\x22$S','nd\x20after','Bin','eparing\x20','t\x20\x22OPENC','info','json','atch:\x20ma','WorkingD','cwd','configPa','-xzf','fix\x20alre','ogger','close','%USERPRO','ATH=\x20cd\x20','PENCLAW_','st=','if\x20\x22%OPE','-peer-de','dataDirN','win32','appId','synced','ing\x20\x22','spec','und:\x20','log','\x20resolve','resolved','\x20doctor\x20','ent\x20comp','timeoutM','wBin','ie-shell','kill','SIGTERM','join','has','--omit=d','strap\x20ru','data','.tools','runtimeS','--legacy','[wujie-s','string','--no-aud','ath','ell.','ion','ATH=\x22${O','toString','\x20version','Configur','oot','\x20bin\x20was','onfigure','prepare\x20','ut\x20after','Version','pipe','E_DIR=','claw-run','registry','replacem','wrapper\x20','isArray','766815MrARft',';\x20run\x20wu','CONFIG_P','time]\x20in','LAW_STAT','alid\x20pay','pluginId','NCLAW_CO','package','\x20\x22$0\x22)\x22\x20','load:\x20','plugin\x20s','Spec','mismatch','OME=','pack','stdout','skills','PT_DIR/','extensio','time-too','length','wujiecla','skills\x20s','\x20install','bin','p\x20runtim','bootstra','filter','installP','.tmp/run','product','started','fix\x20star','local','ent\x20skip','3075310TcJPRV','object','\x5copencla','name','--\x20\x22$(di','the\x20boot','#!/bin/s','e\x20not\x20fo','config=','failed','local:','d\x20Node\x20v','dAt','274500nytTmL','version','productN','STATE_DI','ped','slice','law\x20','runtimeR','runtime\x20','nodeVers','728SoCZyf','\x20depende','ent\x20star','set\x20\x22OPE','NCLAW_HO','add','re\x20wujie','ced','5013rQAWVU','.npmjs.o','\x20package','l\x20prepar',',\x20shell.','time]\x20ru','e\x20checke','split','SCRIPT_D','\x20validat','\x20did\x20not','nodeExec','agents','export\x20O','rname\x20--','octor\x20--','1599880LpMGxH','plugins','dataDir','https://','FILE%\x5c','\x22%SCRIPT','sion\x20val','stderr','now','706398pkQypF','utable','toISOStr','d\x20to\x20','\x20returne','HOME=\x22${','ATE_DIR:','extract\x20','LocalPlu','product\x20','--json','JSON:\x20','\x22\x20\x22%SCRI','trim','manifest','fix','tar','w-extrac','projectR','error','ME%\x22==\x22\x22','\x20runtime','flush','openclaw','runtime','ady\x20curr','y\x20manife','null','CRIPT_DI','%~dp0\x22','22096moWWpY','fix\x20mark','st\x20exist','ed\x20OpenC','leted','\x20is\x20miss','ame','$HOME/'];_0x503b=function(){return _0x5793fe;};return _0x503b();}function validateRuntimeOpenClawVersion(_0x9883f1,_0x1cb5c1){const _0x171c24=_0x51e383;if(_0x9883f1[_0x171c24(0x17c)+_0x171c24(0x101)]===_0x1cb5c1[_0x171c24(0x17c)][_0x171c24(0x17c)+'Version'])return;throw new Error(_0x171c24(0x142)+'openclaw'+_0x171c24(0x193)+_0x171c24(0x116)+':\x20manife'+_0x171c24(0xd6)+(_0x9883f1[_0x171c24(0x17c)+_0x171c24(0x101)]||_0x171c24(0xbd))+(_0x171c24(0x150)+_0x171c24(0x135))+_0x1cb5c1[_0x171c24(0x17c)]['openclaw'+'Version']+'.\x20'+(_0x171c24(0xbb)+_0x171c24(0xe7)+'\x20prepare'+_0x171c24(0x19f)+_0x171c24(0x17a)+_0x171c24(0xa4)+_0x171c24(0x194)+'\x20configu'+_0x171c24(0xc1)+'Claw\x20ver'+_0x171c24(0xb8)));}function parseNpmPackJson(_0x14daa2){const _0x25ebb8=_0x51e383,_0xcecbb=_0x14daa2[_0x25ebb8(0x172)](),_0x2bcb12=_0xcecbb['indexOf']('[');if(_0x2bcb12<0x0)throw new Error(_0x25ebb8(0x19a)+_0x25ebb8(0x156)+'\x20return\x20'+_0x25ebb8(0x170)+_0xcecbb[_0x25ebb8(0x13f)](0x0,0x1f4));const _0x59b48b=JSON[_0x25ebb8(0xb0)](_0xcecbb[_0x25ebb8(0x13f)](_0x2bcb12)),_0x48a1e6=Array[_0x25ebb8(0x108)](_0x59b48b)?_0x59b48b[0x0]:_0x59b48b;if(!_0x48a1e6||typeof _0x48a1e6!==_0x25ebb8(0x12e))throw new Error(_0x25ebb8(0x19a)+_0x25ebb8(0x169)+'d\x20an\x20inv'+_0x25ebb8(0x10e)+_0x25ebb8(0x113)+_0xcecbb[_0x25ebb8(0x13f)](0x0,0x1f4));return _0x48a1e6;}async function runProcess(_0x2e6457,_0x229974,_0x684bb8={}){const _0x3ae77b=_0x51e383,_0x17c68f=_0x684bb8['label']||[_0x2e6457,..._0x229974][_0x3ae77b(0xea)]('\x20'),_0x39b058=_0x684bb8[_0x3ae77b(0xe5)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x566db1=spawn(_0x2e6457,_0x229974,{'cwd':_0x684bb8[_0x3ae77b(0xcd)],'env':_0x684bb8['env'],'stdio':['ignore',_0x3ae77b(0x102),_0x3ae77b(0x102)]});return await new Promise((_0x1a28e8,_0x20420b)=>{const _0x1a6db7=_0x3ae77b;let _0x3697bf='',_0x134c52='',_0xed8e2c=![];const _0x656fb2=setTimeout(()=>{const _0x2ae848=_0x2d02;if(_0xed8e2c)return;_0xed8e2c=!![],_0x566db1[_0x2ae848(0xe8)](_0x2ae848(0xe9)),_0x20420b(new Error(_0x17c68f+(_0x2ae848(0xbc)+_0x2ae848(0x100)+'\x20')+_0x39b058+'ms'));},_0x39b058);_0x566db1[_0x1a6db7(0x119)]['on']('data',_0xa41e6d=>{const _0x57f171=_0x1a6db7;_0x3697bf+=_0xa41e6d[_0x57f171(0xf9)]();}),_0x566db1['stderr']['on'](_0x1a6db7(0xee),_0x3b1747=>{_0x134c52+=_0x3b1747['toString']();}),_0x566db1['on'](_0x1a6db7(0x178),_0x5ae0dd=>{if(_0xed8e2c)return;_0xed8e2c=!![],clearTimeout(_0x656fb2),_0x20420b(_0x5ae0dd);}),_0x566db1['on'](_0x1a6db7(0xd2),(_0xe34365,_0x2b1759)=>{const _0x3069c6=_0x1a6db7;if(_0xed8e2c)return;_0xed8e2c=!![],clearTimeout(_0x656fb2);if(_0xe34365===0x0){_0x1a28e8({'stdout':_0x3697bf,'stderr':_0x134c52});return;}_0x20420b(new Error(_0x17c68f+('\x20failed\x20'+_0x3069c6(0xa3)+'e=')+(_0xe34365??_0x3069c6(0x180))+'\x20signal='+(_0x2b1759??'null')+'\x0a'+(''+(_0x134c52||_0x3697bf))['trim']()));});});}async function installOpenClawPackage(_0x48f8de,_0x17ae97){const _0x2b4327=_0x51e383,_0x4a3903=join(_0x48f8de['runtimeR'+'oot'],_0x2b4327(0x190)),_0x323549=join(_0x48f8de[_0x2b4327(0x141)+'oot'],'.opencla'+_0x2b4327(0x176)+'t');await mkdir(_0x4a3903,{'recursive':!![]}),await rm(_0x323549,{'recursive':!![],'force':!![]}),await mkdir(_0x323549,{'recursive':!![]});const _0x50bbf3=await createRuntimeEnv(_0x48f8de),_0x35d9ec=_0x2b4327(0x17c)+'@'+_0x17ae97;console[_0x2b4327(0xe0)](_0x2b4327(0xf2)+_0x2b4327(0x195)+_0x2b4327(0x10c)+_0x2b4327(0xa8)+'\x20'+_0x35d9ec);const _0x3ec5c1=await runProcess(_0x48f8de[_0x2b4327(0x157)+_0x2b4327(0x166)],[_0x48f8de[_0x2b4327(0xc0)],_0x2b4327(0x118),_0x35d9ec,_0x2b4327(0x16f)],{'cwd':_0x4a3903,'env':_0x50bbf3,'label':_0x2b4327(0x19a)+'\x20'+_0x35d9ec}),_0x175e4a=parseNpmPackJson(_0x3ec5c1['stdout']);if(_0x175e4a[_0x2b4327(0x13b)]!==_0x17ae97)throw new Error(_0x2b4327(0xfb)+_0x2b4327(0x186)+_0x2b4327(0x140)+_0x17ae97+(_0x2b4327(0xe1)+_0x2b4327(0x168))+_0x175e4a['version']);const _0x4705cb=resolve(_0x4a3903,_0x175e4a[_0x2b4327(0x18c)]);if(!existsSync(_0x4705cb))throw new Error(_0x2b4327(0x19a)+'\x20did\x20not'+_0x2b4327(0xb4)+'tarball:'+'\x20'+_0x4705cb);await runProcess(_0x2b4327(0x175),[_0x2b4327(0xcf),_0x4705cb,'-C',_0x323549],{'label':_0x2b4327(0x16c)+_0x175e4a[_0x2b4327(0x18c)]}),await rm(_0x48f8de[_0x2b4327(0x17c)+'WorkingD'+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x323549,_0x2b4327(0x111)),_0x48f8de[_0x2b4327(0x17c)+_0x2b4327(0xcc)+'ir']),await rm(_0x323549,{'recursive':!![],'force':!![]}),await runProcess(_0x48f8de[_0x2b4327(0x157)+'utable'],[_0x48f8de[_0x2b4327(0xc0)],'install',_0x2b4327(0xec)+'ev','--omit=p'+'eer',_0x2b4327(0xf4)+'it','--no-fun'+'d',_0x2b4327(0xf1)+_0x2b4327(0xd8)+'ps'],{'cwd':_0x48f8de[_0x2b4327(0x17c)+_0x2b4327(0xcc)+'ir'],'env':_0x50bbf3,'label':'npm\x20inst'+'all\x20'+_0x35d9ec+('\x20runtime'+_0x2b4327(0x145)+'ncies')});if(!existsSync(_0x48f8de[_0x2b4327(0x17c)+'Bin']))throw new Error('OpenClaw'+_0x2b4327(0xfd)+'\x20not\x20fou'+_0x2b4327(0xc5)+'\x20install'+':\x20'+_0x48f8de['openclaw'+'Bin']);}export async function ensureOpenClawDoctorFixed(_0x42363d,_0x33d3bd={}){const _0x3b6d1d=_0x51e383,_0x46c2ad=await loadRuntimeInfo(_0x42363d[_0x3b6d1d(0x177)+_0x3b6d1d(0xfc)]),_0x5c2f8a=getConfigPaths(_0x42363d),_0x5e20b3=join(_0x5c2f8a[_0x3b6d1d(0xf0)+'tateDir'],'openclaw'+'-doctor.'+_0x3b6d1d(0xca)),_0xb24d2d=await readJson(_0x5e20b3,{});if(_0xb24d2d[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)]===_0x46c2ad['openclaw'+_0x3b6d1d(0x101)])return _0x33d3bd['runtimeL'+'ogger']?.[_0x3b6d1d(0xc9)](_0x3b6d1d(0x17c)+_0x3b6d1d(0xe3)+_0x3b6d1d(0xd0)+_0x3b6d1d(0x17e)+_0x3b6d1d(0xb7),{'openclawVersion':_0x46c2ad['openclaw'+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3}),{'ran':![],'openclawVersion':_0x46c2ad[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3};return await runOpenClawDoctorFix(_0x42363d,_0x46c2ad,{'fromVersion':_0xb24d2d[_0x3b6d1d(0x17c)+'Version']||_0x3b6d1d(0xbd),'toVersion':_0x46c2ad[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3,'runtimeLogger':_0x33d3bd['runtimeL'+_0x3b6d1d(0xd1)]}),{'ran':!![],'openclawVersion':_0x46c2ad[_0x3b6d1d(0x17c)+_0x3b6d1d(0x101)],'markerPath':_0x5e20b3};}async function runOpenClawDoctorFix(_0x24c542,_0x58020c,{fromVersion:_0x21c9d7,toVersion:_0x58cce7,markerPath:markerPath='',runtimeLogger:_0x17d596}={}){const _0x58b0a9=_0x51e383;_0x17d596?.[_0x58b0a9(0xc9)](_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0x12a)+_0x58b0a9(0x9f),{'fromVersion':_0x21c9d7,'toVersion':_0x58cce7});const _0x245092=await createRuntimeEnv(_0x58020c,{'OPENCLAW_HOME':_0x24c542[_0x58b0a9(0x15e)],'OPENCLAW_STATE_DIR':_0x24c542[_0x58b0a9(0x15e)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x24c542)[_0x58b0a9(0xce)+'th']});console[_0x58b0a9(0xe0)]('[wujie-s'+'hell:run'+_0x58b0a9(0x151)+'nning\x20op'+'enclaw\x20d'+_0x58b0a9(0x15b)+_0x58b0a9(0x174));const _0x334657=await runProcess(_0x58020c[_0x58b0a9(0x157)+'utable'],[_0x58020c[_0x58b0a9(0x17c)+'Bin'],'doctor',_0x58b0a9(0xba)],{'cwd':_0x58020c[_0x58b0a9(0x17c)+_0x58b0a9(0xcc)+'ir'],'env':_0x245092,'label':_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0xba),'timeoutMs':0x1d4c0});_0x17d596?.[_0x58b0a9(0xc9)](_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0xaa)+'leted',{'fromVersion':_0x21c9d7,'toVersion':_0x58cce7,'stdout':_0x334657['stdout'][_0x58b0a9(0x172)]()[_0x58b0a9(0x13f)](-0xfa0),'stderr':_0x334657[_0x58b0a9(0x163)]['trim']()[_0x58b0a9(0x13f)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x58020c['openclaw'+_0x58b0a9(0x101)],'fixedAt':new Date()[_0x58b0a9(0x167)+_0x58b0a9(0x19b)]()}),_0x17d596?.[_0x58b0a9(0xc9)](_0x58b0a9(0x17c)+_0x58b0a9(0xe3)+_0x58b0a9(0x184)+_0x58b0a9(0x198)+'en',{'markerPath':markerPath,'openclawVersion':_0x58020c[_0x58b0a9(0x17c)+_0x58b0a9(0x101)]}));}async function replaceRuntimeFromBootstrap(_0x58e758,_0x2887e9){const _0x502815=_0x51e383;await mkdir(dirname(_0x2887e9),{'recursive':!![]});const _0x2d49eb=_0x2887e9+'.next-'+process['pid']+'-'+Date[_0x502815(0x164)](),_0x3fb2f7=_0x2887e9+'.old-'+process[_0x502815(0x196)]+'-'+Date[_0x502815(0x164)]();await rm(_0x2d49eb,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await rm(_0x3fb2f7,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await cp(_0x58e758,_0x2d49eb,{'recursive':!![],'force':!![]}),existsSync(_0x2887e9)&&(await rm(_0x3fb2f7,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await rename(_0x2887e9,_0x3fb2f7)),await rename(_0x2d49eb,_0x2887e9),await rm(_0x3fb2f7,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}export async function readRuntimeManifest(_0x2289a2){return await readJson(resolveManifestPath(_0x2289a2),{});}export async function loadRuntimeInfo(_0x16b6d3){const _0x4dce2c=_0x51e383,_0x47c1ee=resolveRuntimeRoot(_0x16b6d3),_0xe5f917=await readRuntimeManifest(_0x47c1ee);for(const _0x7b864 of[_0x4dce2c(0x157)+_0x4dce2c(0x166),_0x4dce2c(0xc0),_0x4dce2c(0x17c)+_0x4dce2c(0xcc)+'ir',_0x4dce2c(0x17c)+_0x4dce2c(0xc6)]){if(typeof _0xe5f917[_0x7b864]!==_0x4dce2c(0xf3)||!_0xe5f917[_0x7b864][_0x4dce2c(0x172)]())throw new Error(_0x4dce2c(0x142)+_0x4dce2c(0x173)+_0x4dce2c(0x188)+_0x4dce2c(0xdd)+_0x7b864+_0x4dce2c(0x18b)+resolveManifestPath(_0x47c1ee)+(_0x4dce2c(0x10a)+'jie-shel'+_0x4dce2c(0x14f)+'e'));}const _0xb67e74=resolve(_0x47c1ee,_0xe5f917[_0x4dce2c(0x157)+'utable']),_0x56e7a7=resolve(_0x47c1ee,_0xe5f917[_0x4dce2c(0xc0)]),_0xec8156=resolve(_0x47c1ee,_0xe5f917[_0x4dce2c(0x17c)+_0x4dce2c(0xcc)+'ir']),_0x3bb678=resolve(_0x47c1ee,_0xe5f917['openclaw'+_0x4dce2c(0xc6)]),_0x242e27=Array[_0x4dce2c(0x108)](_0xe5f917[_0x4dce2c(0x15d)])?_0xe5f917[_0x4dce2c(0x15d)][_0x4dce2c(0x192)](_0x55b67e=>({..._0x55b67e,'installPath':resolve(_0x47c1ee,_0x55b67e[_0x4dce2c(0x126)+_0x4dce2c(0xf5)])})):[];for(const _0x411f22 of[_0xb67e74,_0x56e7a7,_0xec8156,_0x3bb678]){if(!existsSync(_0x411f22))throw new Error(_0x4dce2c(0x142)+_0x4dce2c(0x19c)+'path:\x20'+_0x411f22);}return{'runtimeRoot':_0x47c1ee,'manifest':_0xe5f917,'openclawVersion':_0xe5f917[_0x4dce2c(0x17c)+'Version']||_0x4dce2c(0xbd),'nodeExecutable':_0xb67e74,'npmCli':_0x56e7a7,'openclawWorkingDir':_0xec8156,'openclawBin':_0x3bb678,'plugins':_0x242e27};}export async function spawnClaw(_0x3549b6,_0x51a4fa=[],_0x4a2ef1={}){const _0x417fe4=_0x51e383,_0x7bdaa3=await loadRuntimeInfo(_0x3549b6),_0x31c9ec=await createRuntimeEnv(_0x7bdaa3,_0x4a2ef1['env']??{});return spawn(_0x7bdaa3[_0x417fe4(0x157)+'utable'],[_0x7bdaa3['openclaw'+_0x417fe4(0xc6)],..._0x51a4fa],{'cwd':_0x7bdaa3['openclaw'+_0x417fe4(0xcc)+'ir'],'stdio':_0x417fe4(0x102),..._0x4a2ef1,'env':_0x31c9ec});}export async function runClawOnce(_0x3aa679,_0x35e152=[],_0x35f19e=0x15f90){const _0x808a78=await spawnClaw(_0x3aa679,_0x35e152);return await new Promise((_0x5864d8,_0x318674)=>{const _0x481405=_0x2d02;let _0x2ad22e='',_0x29ef92='',_0x542b43=![];const _0x45b5bb=setTimeout(()=>{const _0x1eb6c1=_0x2d02;if(_0x542b43)return;_0x542b43=!![],_0x808a78[_0x1eb6c1(0xe8)](_0x1eb6c1(0xe9)),_0x318674(new Error(_0x1eb6c1(0x17c)+_0x1eb6c1(0xbc)+_0x1eb6c1(0x100)+'\x20'+_0x35f19e+'ms'));},_0x35f19e);_0x808a78[_0x481405(0x119)]['on'](_0x481405(0xee),_0x163e0c=>{const _0x180776=_0x481405;_0x2ad22e+=_0x163e0c[_0x180776(0xf9)]();}),_0x808a78[_0x481405(0x163)]['on'](_0x481405(0xee),_0x128e4c=>{const _0x41ab4e=_0x481405;_0x29ef92+=_0x128e4c[_0x41ab4e(0xf9)]();}),_0x808a78['on'](_0x481405(0x178),_0x3bf5e8=>{if(_0x542b43)return;_0x542b43=!![],clearTimeout(_0x45b5bb),_0x318674(_0x3bf5e8);}),_0x808a78['on'](_0x481405(0xd2),(_0x424e17,_0x2e1288)=>{if(_0x542b43)return;_0x542b43=!![],clearTimeout(_0x45b5bb),_0x5864d8({'code':_0x424e17,'signal':_0x2e1288,'stdout':_0x2ad22e,'stderr':_0x29ef92});});});}function _0x2d02(_0x12f09a,_0x4d29b7){_0x12f09a=_0x12f09a-0x9d;const _0x503b5a=_0x503b();let _0x2d02ad=_0x503b5a[_0x12f09a];return _0x2d02ad;}async function createRuntimeEnv(_0x25cfb0,_0x21d17e={}){const _0x5680d6=_0x51e383,_0x69acbf=process.env.OPENCLAW_STATE_DIR||'',_0xa7e5e1=_0x69acbf?join(_0x69acbf,_0x5680d6(0x104)+_0x5680d6(0x11d)+'ls'):join(_0x25cfb0[_0x5680d6(0x141)+_0x5680d6(0xfc)],_0x5680d6(0xef)),_0x35e54d=join(_0xa7e5e1,'npm-glob'+'al'),_0x3ce0f9=join(_0xa7e5e1,'npm-cach'+'e'),_0x1fb833=join(_0x35e54d,'bin');await mkdir(_0x1fb833,{'recursive':!![]}),await mkdir(_0x3ce0f9,{'recursive':!![]});const _0x26ca0b=[_0x1fb833,dirname(_0x25cfb0['nodeExec'+'utable']),process.env.PATH||''];return{...process.env,..._0x21d17e,'PATH':_0x26ca0b[_0x5680d6(0x125)](Boolean)[_0x5680d6(0xea)](delimiter),'npm_config_prefix':_0x35e54d,'NPM_CONFIG_PREFIX':_0x35e54d,'npm_config_cache':_0x3ce0f9,'NPM_CONFIG_CACHE':_0x3ce0f9,'npm_config_registry':_0x5680d6(0x15f)+_0x5680d6(0x105)+_0x5680d6(0x14d)+'rg/','NPM_CONFIG_REGISTRY':_0x5680d6(0x15f)+_0x5680d6(0x105)+'.npmjs.o'+_0x5680d6(0xac),'npm_execpath':_0x25cfb0[_0x5680d6(0xc0)],'npm_node_execpath':_0x25cfb0[_0x5680d6(0x157)+_0x5680d6(0x166)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x35e54d,'OPENCLAW_RUNTIME_NPM_BIN':_0x1fb833,'OPENCLAW_RUNTIME_NPM_REGISTRY':_0x5680d6(0x15f)+_0x5680d6(0x105)+_0x5680d6(0x14d)+_0x5680d6(0xac)};}async function syncProductPlugins(_0x467167,_0xb47306,_0x2d97aa){const _0xc9c782=_0x51e383,_0x178d23=join(_0xb47306,'openclaw','dist',_0xc9c782(0x11c)+'ns'),_0x23a54d=[];for(const _0x5c1510 of _0x467167[_0xc9c782(0x17c)][_0xc9c782(0xe2)+_0xc9c782(0x16d)+_0xc9c782(0x19e)]){const _0xeff200=await getPackageMetadata(_0x5c1510),_0x50022e=await readPluginManifest(_0x5c1510),_0x2f269d=join(_0x178d23,_0xeff200['pluginId']);await copyDirFresh(_0x5c1510,_0x2f269d),_0x23a54d[_0xc9c782(0xa0)]({'pluginId':_0xeff200[_0xc9c782(0x10f)],'source':'local','spec':'local:'+_0x5c1510,'installPath':toRuntimeRelative(_0xb47306,_0x2f269d),'version':_0xeff200['version'],'resolvedName':_0xeff200[_0xc9c782(0x130)],'resolvedVersion':_0xeff200['version'],'resolvedSpec':_0xc9c782(0x137)+_0x5c1510,'integrity':'','shasum':'','resolvedAt':new Date()[_0xc9c782(0x167)+'ing'](),'installedAt':new Date()[_0xc9c782(0x167)+'ing'](),'agentScope':_0x50022e['agentSco'+'pe'],'skills':_0x50022e[_0xc9c782(0x11a)]});}const _0x31c806=new Set(_0x23a54d['map'](_0x3c4709=>_0x3c4709[_0xc9c782(0x10f)])),_0x16100d=Array[_0xc9c782(0x108)](_0x2d97aa['plugins'])?_0x2d97aa[_0xc9c782(0x15d)]['filter'](_0x1f856f=>!_0x31c806[_0xc9c782(0xeb)](_0x1f856f['pluginId'])):[];_0x2d97aa['plugins']=[..._0x16100d,..._0x23a54d];}async function syncManifestPluginScope(_0x59591d,_0x6da86b,_0x25d07d){const _0xae7b1=_0x51e383,_0x40fc66=join(_0x6da86b,_0xae7b1(0x17c),_0xae7b1(0xb9),'extensio'+'ns'),_0x48d719=new Set(_0x59591d[_0xae7b1(0x17c)][_0xae7b1(0xb2)+_0xae7b1(0x9d)]??[]),_0x8d32cf=new Set([..._0x48d719][_0xae7b1(0x192)](_0x19fd1f=>_0x19fd1f[_0xae7b1(0xad)](/^npm:/,''))[_0xae7b1(0x192)](_0x51ea9c=>{const _0x3eebb2=_0xae7b1;if(_0x51ea9c['startsWi'+'th']('@')){const _0x51bfcc=_0x51ea9c[_0x3eebb2(0x153)]('@');return _0x51bfcc[_0x3eebb2(0x11e)]>=0x3?'@'+_0x51bfcc[0x1]:_0x51ea9c;}return _0x51ea9c[_0x3eebb2(0x153)]('@')[0x0];})['filter'](Boolean)),_0x2cedfc=new Set();for(const _0x4f105e of _0x59591d[_0xae7b1(0x17c)][_0xae7b1(0xe2)+_0xae7b1(0x16d)+_0xae7b1(0x19e)]){const _0x5d964c=await getPackageMetadata(_0x4f105e);if(_0x5d964c[_0xae7b1(0x10f)])_0x2cedfc[_0xae7b1(0x149)](_0x5d964c[_0xae7b1(0x10f)]);}const _0x246ee2=Array[_0xae7b1(0x108)](_0x25d07d['plugins'])?_0x25d07d['plugins']:[];_0x25d07d['pluginSp'+_0xae7b1(0x9d)]=[..._0x59591d[_0xae7b1(0x17c)][_0xae7b1(0xb2)+_0xae7b1(0x9d)],..._0x59591d['openclaw'][_0xae7b1(0xe2)+_0xae7b1(0x16d)+_0xae7b1(0x19e)][_0xae7b1(0x192)](_0x5e5fd8=>'local:'+_0x5e5fd8)],_0x25d07d['plugins']=_0x246ee2[_0xae7b1(0x125)](_0x5ecf14=>{const _0x40a9a8=_0xae7b1;if(!_0x5ecf14||typeof _0x5ecf14!==_0x40a9a8(0x12e))return![];if(_0x5ecf14['source']===_0x40a9a8(0x12b))return _0x2cedfc[_0x40a9a8(0xeb)](_0x5ecf14['pluginId']);if(_0x5ecf14[_0x40a9a8(0x199)]==='npm')return _0x48d719[_0x40a9a8(0xeb)](_0x5ecf14[_0x40a9a8(0xde)])||_0x48d719[_0x40a9a8(0xeb)](_0x5ecf14[_0x40a9a8(0xe2)+_0x40a9a8(0x115)])||_0x8d32cf[_0x40a9a8(0xeb)](_0x5ecf14[_0x40a9a8(0xe2)+_0x40a9a8(0xb5)]);return![];});const _0x3d7183=new Set(_0x25d07d[_0xae7b1(0x15d)]['map'](_0x5620aa=>_0x5620aa['pluginId']));for(const _0x3464b7 of _0x246ee2){if(!_0x3464b7[_0xae7b1(0x10f)]||_0x3d7183[_0xae7b1(0xeb)](_0x3464b7[_0xae7b1(0x10f)]))continue;const _0x43fe55=typeof _0x3464b7[_0xae7b1(0x126)+'ath']===_0xae7b1(0xf3)&&_0x3464b7[_0xae7b1(0x126)+_0xae7b1(0xf5)]['trim']()?resolve(_0x6da86b,_0x3464b7['installP'+_0xae7b1(0xf5)]):join(_0x40fc66,_0x3464b7[_0xae7b1(0x10f)]),_0x331856=relative(_0x40fc66,_0x43fe55);if(_0x331856[_0xae7b1(0x19d)+'th']('..')||_0x331856==='')continue;await rm(_0x43fe55,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x4bbef6,_0x4fc248,_0x1514f7){const _0x524eea=_0x51e383,_0x9bb43b=join(_0x4fc248,_0x524eea(0x17c),_0x524eea(0x158));await copyDirFresh(_0x4bbef6[_0x524eea(0x17c)]['agentsDi'+'r'],_0x9bb43b),_0x1514f7[_0x524eea(0x158)]={'source':_0x524eea(0x128),'installPath':toRuntimeRelative(_0x4fc248,_0x9bb43b)};}async function syncProductSkills(_0x2c6127,_0x3bdbb2,_0xfaff86){const _0xca9f4e=_0x51e383,_0x4e56dd=join(_0x3bdbb2,_0xca9f4e(0x17c),_0xca9f4e(0x11a));await copyDirFresh(_0x2c6127[_0xca9f4e(0x17c)][_0xca9f4e(0xa5)+'r'],_0x4e56dd),_0xfaff86['skills']={'source':_0xca9f4e(0x128),'installPath':toRuntimeRelative(_0x3bdbb2,_0x4e56dd)};}
|
|
1
|
+
const _0x406343=_0x481c;(function(_0x4fb4b9,_0x4e1dc3){const _0x32833e=_0x481c,_0x50a984=_0x4fb4b9();while(!![]){try{const _0x205749=parseInt(_0x32833e(0x23a))/0x1*(parseInt(_0x32833e(0x2a9))/0x2)+parseInt(_0x32833e(0x218))/0x3+parseInt(_0x32833e(0x1d1))/0x4+-parseInt(_0x32833e(0x28c))/0x5*(-parseInt(_0x32833e(0x193))/0x6)+parseInt(_0x32833e(0x1f3))/0x7+-parseInt(_0x32833e(0x26e))/0x8+-parseInt(_0x32833e(0x20e))/0x9;if(_0x205749===_0x4e1dc3)break;else _0x50a984['push'](_0x50a984['shift']());}catch(_0x46b776){_0x50a984['push'](_0x50a984['shift']());}}}(_0x2e9d,0x7c690));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';import{getConfigPaths}from'@wujie-shell/config';function _0x2e9d(){const _0x42a536=['node/lib','Configur','arch','Claw','E_DIR=','root','NCLAW_ST','registry','stdout','\x20return\x20','missing\x20','\x20started','%~dp0\x22','red\x20Node','SCRIPT_D','1902328HmnBPM','ing','dist','\x20resolve','LAW_STAT','\x20depende','npm\x20inst','octor\x20--','null','\x20version','download','alid\x20pay','nodeVers','unzip','.cache','ATE_DIR%','OME=','wujie-lo','pluginSp','join','replaceA','NCLAW_CO','PT_DIR%','PT_DIR/w','FILE%\x5c','export\x20O','ignore',',\x20shell.','\x20configu','timeoutM','5weCnEZ','eady\x20cur','utable','ie-shell','node','ut\x20after','wujiecla','eted','agentSco','skillsDi','go.mjs','with\x20cod','fix\x20mark','m-cli.js','\x20timed\x20o','sion.','set\x20\x22SCR','Version\x20','.json','local','npm','now','\x20did\x20not','indexOf','ecs','plugins\x20','nning\x20op','spec','w-extrac','1531038CQJJsx','rebuilt\x20','m/bin/np','lib','\x20\x20\x22$SCRI','ncies','stderr','with\x20the','agentsDi','config=','ady\x20curr','tar','/node_mo','pluginId','npmCli','prepare\x20','cwd','w.json}\x22','CRIPT_DI','nodejs.o','fix\x20comp','win32','t\x20\x22OPENC','close','ed\x20OpenC','log','\x20-z\x20\x22$WU','rg/dist/','isArray','-peer-de','if\x20[\x20-t\x20','product\x20','nodeExec','label','LocalPlu','has','push','@echo\x20of','runtime-','4787490QHgPKe','dAt','[wujie-s','Claw\x20ver','plugins','--omit=d','ent','d\x20to\x20','fix','ENCLAW_H','idated','rg/','sion\x20val','ing\x20\x22','location','npm\x20root','\x22\x20so\x20the','arm64','ginPaths','Spec','\x20paths','plugin\x20s','st=','red\x20Open','\x20-g','\x20create\x20','HOME=\x22${','ion\x20mism','base\x20alr','startsWi','error','object','name','tarball:','win','resolved','-doctor.','pid','Version','%USERPRO','enclaw\x20d','\x20\x22$0\x22)\x22\x20','-extract','split','ATH=\x22${O','slice','unknown','openclaw','zip','syncOnly','dataDirN','every','toString','.tools','d:\x20','\x20is\x20miss','stalling','OGO\x22\x20];\x20','wnloadin','\x20product','utf8','node_mod','204916hkwqNW','ynced','NCLAW_HO','er\x20writt','info','agents','productN','https://','ogger','flush','skills\x20s','bin','ath','\x20prepare','\x20runtime','\x20doctor\x20','if\x20\x22%OPE','CONFIG_P','pipe','statusCo','local:','ME%\x22==\x22\x22','SIGTERM','runtimeL','runtimeR','json','/opencla','PT_DIR/','-xJf','ced','IR=$(CDP','synced','eer','/node','5606839bDSjsF','extract\x20','ATH:-','\x20not\x20fou','then','href','nd\x20after','npm\x20pack','dataDir','base\x20bui','\x22%SCRIPT','tar.xz','toISOStr','OpenClaw','>/dev/nu','node-v','\x20returne','hell:run','\x20package','load:\x20','projectR','extensio','installP','\x20install','\x20validat','jie-shel','atch:\x20ma','18004014GLuhrN','failed','l\x20prepar','configPa','skills','doctor','kill','tall\x20the','ame','.npmjs.o','996543lJOyMB','H%\x22==\x22\x22\x20','runtime\x20','PENCLAW_','.opencla','sion\x20mis','npm-cach','STATE_DI','\x5copencla','w.json\x22','product','ld\x20start','platform','fix\x20star','agents\x20s','manifest','replace','JSON:\x20','--omit=p','filename','s/wujie-','set\x20\x22OPE','rname\x20--','ules','\x20signal=','\x22\x20%*','node\x20ver','\x22\x20\x22$SCRI','trim','length','node/bin','wBin','path:\x20','not\x20foun','1tCRYVA','match','JIE_NO_L','data','version','ion','ld\x20compl',';\x20run\x20wu','source','d\x20an\x20inv',':\x20manife','--no-aud','pack','add','generate','dules/np','x64','\x20failed\x20','oot','Run\x20\x22wuj','NFIG_PAT','map','\x20complet','filter','versions','package','cal\x20runt','env','ujie-log','string','headers','appId','--legacy','Bin','WorkingD','--fix','_modules'];_0x2e9d=function(){return _0x42a536;};return _0x2e9d();}import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'./utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'./runtime-logger.mjs';const RUNTIME_DIR='.tmp/run'+'time',MANIFEST_NAME=_0x406343(0x192)+_0x406343(0x227)+_0x406343(0x29e),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x4cce0e){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x4cce0e,RUNTIME_DIR);}export function resolveManifestPath(_0x42fc87){return join(_0x42fc87,MANIFEST_NAME);}export async function prepareRuntime(_0x5e07c1,{syncOnly:syncOnly=![]}={}){const _0x3e299a=_0x406343,_0x3cc1a1=resolveRuntimeRoot(_0x5e07c1['projectR'+_0x3e299a(0x24c)]),_0x2327ee=createRuntimeLogger(getConfigPaths(_0x5e07c1),'runtime'),_0xa925e=Date[_0x3e299a(0x2a1)]();_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x2b8)+_0x3e299a(0x21a)+'started',{'syncOnly':syncOnly,'runtimeRoot':_0x3cc1a1,'shellConfig':summarizeShellConfig(_0x5e07c1)});try{const _0xc5d0d3=await ensureRuntimeBase(_0x5e07c1,_0x3cc1a1,{'runtimeLogger':_0x2327ee,'syncOnly':syncOnly});_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+'manifest'+'\x20loaded',{'manifestPath':resolveManifestPath(_0x3cc1a1),'manifest':summarizeRuntimeManifest(_0xc5d0d3)}),validateRuntimeNodeVersion(_0xc5d0d3,_0x5e07c1),_0x2327ee?.[_0x3e299a(0x1d5)]('runtime\x20'+_0x3e299a(0x232)+_0x3e299a(0x19f)+_0x3e299a(0x19d),{'nodeVersion':_0xc5d0d3[_0x3e299a(0x27a)+_0x3e299a(0x23f)]});if(syncOnly)validateRuntimeOpenClawVersion(_0xc5d0d3,_0x5e07c1),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+_0x3e299a(0x1c2)+_0x3e299a(0x277)+_0x3e299a(0x20b)+'ed',{'openclawVersion':_0xc5d0d3['openclaw'+'Version']});else{if(_0xc5d0d3[_0x3e299a(0x1c2)+'Version']!==_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]){const _0x17a6ac=await loadRuntimeInfo(_0x5e07c1['projectR'+'oot']);_0x2327ee?.['info'](_0x3e299a(0x1c2)+_0x3e299a(0x205)+_0x3e299a(0x20a)+_0x3e299a(0x26a),{'fromVersion':_0xc5d0d3['openclaw'+_0x3e299a(0x1b9)]||_0x3e299a(0x1c1),'toVersion':_0x5e07c1[_0x3e299a(0x1c2)]['openclaw'+_0x3e299a(0x1b9)]}),await installOpenClawPackage(_0x17a6ac,_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]),_0xc5d0d3[_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]=_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x1c2)+_0x3e299a(0x1b9)],_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x1c2)+'\x20package'+_0x3e299a(0x20a)+_0x3e299a(0x250)+'ed',{'openclawVersion':_0xc5d0d3[_0x3e299a(0x1c2)+_0x3e299a(0x1b9)]});}}_0xc5d0d3[_0x3e299a(0x248)+_0x3e299a(0x194)]=new Date()['toISOStr'+_0x3e299a(0x26f)](),_0xc5d0d3[_0x3e299a(0x27a)+_0x3e299a(0x23f)]=_0x5e07c1[_0x3e299a(0x1c2)]['nodeVers'+_0x3e299a(0x23f)],_0xc5d0d3[_0x3e299a(0x222)]={'appId':_0x5e07c1[_0x3e299a(0x259)],'productName':_0x5e07c1[_0x3e299a(0x1d7)+_0x3e299a(0x216)],'dataDirName':_0x5e07c1[_0x3e299a(0x1c5)+_0x3e299a(0x216)]};const _0x245b48=Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x197)])?_0xc5d0d3[_0x3e299a(0x197)][_0x3e299a(0x235)]:0x0;return await syncManifestPluginScope(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+_0x3e299a(0x1a8)+'cope\x20syn'+_0x3e299a(0x1ee),{'beforePluginCount':_0x245b48,'afterPluginCount':Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x197)])?_0xc5d0d3[_0x3e299a(0x197)]['length']:0x0,'pluginSpecCount':Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x280)+_0x3e299a(0x2a4)])?_0xc5d0d3[_0x3e299a(0x280)+_0x3e299a(0x2a4)][_0x3e299a(0x235)]:0x0}),await syncProductPlugins(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)]('product\x20'+_0x3e299a(0x2a5)+'synced',{'localPluginCount':_0x5e07c1[_0x3e299a(0x1c2)]['resolved'+'LocalPlu'+_0x3e299a(0x1a5)][_0x3e299a(0x235)],'pluginCount':Array[_0x3e299a(0x188)](_0xc5d0d3[_0x3e299a(0x197)])?_0xc5d0d3[_0x3e299a(0x197)][_0x3e299a(0x235)]:0x0}),await syncProductAgents(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x18b)+_0x3e299a(0x226)+'ynced',{'source':_0x5e07c1['openclaw'][_0x3e299a(0x2b1)+'r'],'installPath':_0xc5d0d3[_0x3e299a(0x1d6)]?.[_0x3e299a(0x209)+'ath']}),await syncProductSkills(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x18b)+_0x3e299a(0x1db)+_0x3e299a(0x1d2),{'source':_0x5e07c1[_0x3e299a(0x1c2)][_0x3e299a(0x295)+'r'],'installPath':_0xc5d0d3[_0x3e299a(0x212)]?.[_0x3e299a(0x209)+'ath']}),await syncRuntimeWrapper(_0x5e07c1,_0x3cc1a1,_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+'wrapper\x20'+_0x3e299a(0x1f0),{'wujieclawBin':_0xc5d0d3[_0x3e299a(0x292)+_0x3e299a(0x237)]}),await writeJson(resolveManifestPath(_0x3cc1a1),_0xc5d0d3),_0x2327ee?.[_0x3e299a(0x1d5)](_0x3e299a(0x21a)+_0x3e299a(0x227)+'\x20written',{'manifestPath':resolveManifestPath(_0x3cc1a1),'manifest':summarizeRuntimeManifest(_0xc5d0d3),'durationMs':Date['now']()-_0xa925e}),await _0x2327ee?.['flush'](),_0xc5d0d3;}catch(_0x4c01db){_0x2327ee?.[_0x3e299a(0x1b1)](_0x3e299a(0x2b8)+_0x3e299a(0x21a)+_0x3e299a(0x20f),{'syncOnly':syncOnly,'runtimeRoot':_0x3cc1a1,'durationMs':Date[_0x3e299a(0x2a1)]()-_0xa925e,'error':_0x4c01db}),await _0x2327ee?.[_0x3e299a(0x1da)]();throw _0x4c01db;}}function _0x481c(_0x956dfd,_0x512305){_0x956dfd=_0x956dfd-0x17e;const _0x2e9d75=_0x2e9d();let _0x481c1e=_0x2e9d75[_0x956dfd];return _0x481c1e;}async function syncRuntimeWrapper(_0xcebaba,_0x253ba9,_0x4746b1){const _0x1c8bbd=_0x406343,_0x8a2b9=join(_0x253ba9,'bin','wujiecla'+'w'),_0x36ca7a=join(_0x253ba9,'bin',_0x1c8bbd(0x292)+'w.cmd'),_0x2dd18b=normalizeRuntimeRelativePath(relative(dirname(_0x8a2b9),resolve(_0x253ba9,_0x4746b1['nodeExec'+_0x1c8bbd(0x28e)]))),_0x17a929=normalizeRuntimeRelativePath(relative(dirname(_0x8a2b9),resolve(_0x253ba9,_0x4746b1[_0x1c8bbd(0x1c2)+'Bin']))),_0x3767a8='$HOME/'+_0xcebaba[_0x1c8bbd(0x1c5)+'ame'],_0x51b0ef=_0x1c8bbd(0x1ba)+_0x1c8bbd(0x286)+_0xcebaba['dataDirN'+'ame'];await mkdir(dirname(_0x8a2b9),{'recursive':!![]});const _0x1e3873=fileURLToPath(new URL('../asset'+_0x1c8bbd(0x22c)+'logo.mjs',import.meta.url)),_0x51a596=join(_0x253ba9,_0x1c8bbd(0x1dc),_0x1c8bbd(0x27f)+_0x1c8bbd(0x296));await cp(_0x1e3873,_0x51a596),await writeFile(_0x8a2b9,['#!/bin/s'+'h',_0x1c8bbd(0x287)+_0x1c8bbd(0x21b)+_0x1c8bbd(0x1ad)+'OPENCLAW'+'_HOME:-'+_0x3767a8+'}\x22',_0x1c8bbd(0x287)+_0x1c8bbd(0x21b)+_0x1c8bbd(0x21f)+'R=\x22${OPE'+_0x1c8bbd(0x265)+'ATE_DIR:'+'-'+_0x3767a8+'}\x22',_0x1c8bbd(0x287)+_0x1c8bbd(0x21b)+_0x1c8bbd(0x1e2)+_0x1c8bbd(0x1bf)+_0x1c8bbd(0x21b)+'CONFIG_P'+_0x1c8bbd(0x1f5)+_0x3767a8+('/opencla'+_0x1c8bbd(0x2ba)),_0x1c8bbd(0x26d)+_0x1c8bbd(0x1ef)+'ATH=\x20cd\x20'+'--\x20\x22$(di'+_0x1c8bbd(0x22e)+_0x1c8bbd(0x1bc)+'&&\x20pwd)',_0x1c8bbd(0x18a)+'1\x20]\x20&&\x20['+_0x1c8bbd(0x186)+_0x1c8bbd(0x23c)+_0x1c8bbd(0x1cc)+_0x1c8bbd(0x1f7),_0x1c8bbd(0x2ad)+_0x1c8bbd(0x1ec)+_0x2dd18b+('\x22\x20\x22$SCRI'+_0x1c8bbd(0x285)+_0x1c8bbd(0x256)+'o.mjs\x22\x202'+_0x1c8bbd(0x201)+'ll\x20||\x20tr'+'ue'),'fi','exec\x20\x22$S'+_0x1c8bbd(0x17e)+'R/'+_0x2dd18b+(_0x1c8bbd(0x233)+_0x1c8bbd(0x1ec))+_0x17a929+'\x22\x20\x22$@\x22','']['join']('\x0a'),_0x1c8bbd(0x1cf)),await chmod(_0x8a2b9,0x1ed),await writeFile(_0x36ca7a,[_0x1c8bbd(0x191)+'f',_0x1c8bbd(0x1e1)+_0x1c8bbd(0x1d3)+_0x1c8bbd(0x1e6)+'\x20set\x20\x22OP'+_0x1c8bbd(0x19c)+_0x1c8bbd(0x27e)+_0x51b0ef+'\x22',_0x1c8bbd(0x1e1)+_0x1c8bbd(0x265)+_0x1c8bbd(0x27d)+'\x22==\x22\x22\x20se'+_0x1c8bbd(0x182)+_0x1c8bbd(0x272)+_0x1c8bbd(0x263)+_0x51b0ef+'\x22',_0x1c8bbd(0x1e1)+_0x1c8bbd(0x283)+'NFIG_PAT'+_0x1c8bbd(0x219)+_0x1c8bbd(0x22d)+_0x1c8bbd(0x283)+_0x1c8bbd(0x24e)+'H='+_0x51b0ef+(_0x1c8bbd(0x220)+_0x1c8bbd(0x221)),_0x1c8bbd(0x29c)+'IPT_DIR='+_0x1c8bbd(0x26b),_0x1c8bbd(0x1fd)+'_DIR%'+toWindowsPath(_0x2dd18b)+('\x22\x20\x22%SCRI'+_0x1c8bbd(0x284))+toWindowsPath(_0x17a929)+_0x1c8bbd(0x231),''][_0x1c8bbd(0x281)]('\x0d\x0a'),'utf8'),_0x4746b1['wujiecla'+_0x1c8bbd(0x237)]=toRuntimeRelative(_0x253ba9,process['platform']===_0x1c8bbd(0x181)?_0x36ca7a:_0x8a2b9);}function normalizeRuntimeRelativePath(_0x4218f4){const _0x15c660=_0x406343;return _0x4218f4[_0x15c660(0x282)+'ll']('\x5c','/');}function toWindowsPath(_0x487bd2){const _0x15833a=_0x406343;return _0x487bd2[_0x15833a(0x282)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x3ae81a,_0x51729d){const _0xa9167f=_0x406343;if(_0x3ae81a['nodeVers'+_0xa9167f(0x23f)]===_0x51729d[_0xa9167f(0x1c2)][_0xa9167f(0x27a)+'ion'])return;throw new Error(_0xa9167f(0x21a)+_0xa9167f(0x27a)+_0xa9167f(0x1ae)+_0xa9167f(0x20d)+'nifest='+(_0x3ae81a[_0xa9167f(0x27a)+_0xa9167f(0x23f)]||_0xa9167f(0x1c1))+(',\x20shell.'+_0xa9167f(0x2b2))+_0x51729d['openclaw'][_0xa9167f(0x27a)+_0xa9167f(0x23f)]+'.\x20'+(_0xa9167f(0x24d)+_0xa9167f(0x28f)+_0xa9167f(0x1de)+_0xa9167f(0x1a3)+_0xa9167f(0x1ce)+_0xa9167f(0x1df)+'\x20can\x20be\x20'+_0xa9167f(0x2aa)+_0xa9167f(0x2b0)+_0xa9167f(0x28a)+_0xa9167f(0x26c)+_0xa9167f(0x277)+'.'));}function validateRuntimeOpenClawVersion(_0xc79dae,_0x29552c){const _0x281b69=_0x406343;if(_0xc79dae['openclaw'+'Version']===_0x29552c['openclaw'][_0x281b69(0x1c2)+'Version'])return;throw new Error(_0x281b69(0x21a)+_0x281b69(0x1c2)+_0x281b69(0x29d)+'mismatch'+_0x281b69(0x244)+_0x281b69(0x1a9)+(_0xc79dae[_0x281b69(0x1c2)+'Version']||_0x281b69(0x1c1))+(_0x281b69(0x289)+_0x281b69(0x2b2))+_0x29552c['openclaw'][_0x281b69(0x1c2)+'Version']+'.\x20'+(_0x281b69(0x24d)+_0x281b69(0x28f)+'\x20prepare'+_0x281b69(0x1a3)+_0x281b69(0x1df)+'\x20can\x20ins'+_0x281b69(0x215)+'\x20configu'+_0x281b69(0x1aa)+_0x281b69(0x196)+_0x281b69(0x29b)));}function parseNpmPackJson(_0x2ad07c){const _0x529de1=_0x406343,_0xf3b591=_0x2ad07c[_0x529de1(0x234)](),_0x155f4f=_0xf3b591[_0x529de1(0x2a3)]('[');if(_0x155f4f<0x0)throw new Error(_0x529de1(0x1fa)+_0x529de1(0x2a2)+_0x529de1(0x268)+_0x529de1(0x229)+_0xf3b591['slice'](0x0,0x1f4));const _0x1fda0c=JSON['parse'](_0xf3b591['slice'](_0x155f4f)),_0x3bee0f=Array[_0x529de1(0x188)](_0x1fda0c)?_0x1fda0c[0x0]:_0x1fda0c;if(!_0x3bee0f||typeof _0x3bee0f!==_0x529de1(0x1b2))throw new Error('npm\x20pack'+_0x529de1(0x203)+_0x529de1(0x243)+_0x529de1(0x279)+_0x529de1(0x206)+_0xf3b591['slice'](0x0,0x1f4));return _0x3bee0f;}async function runProcess(_0x129cac,_0x238c6c,_0x258d9c={}){const _0x4a4488=_0x406343,_0xd6015d=_0x258d9c[_0x4a4488(0x18d)]||[_0x129cac,..._0x238c6c][_0x4a4488(0x281)]('\x20'),_0x55432c=_0x258d9c[_0x4a4488(0x28b)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x1c5416=spawn(_0x129cac,_0x238c6c,{'cwd':_0x258d9c[_0x4a4488(0x2b9)],'env':_0x258d9c[_0x4a4488(0x255)],'stdio':[_0x4a4488(0x288),_0x4a4488(0x1e3),_0x4a4488(0x1e3)]});return await new Promise((_0xcb2a07,_0x2b40d4)=>{const _0x228a7e=_0x4a4488;let _0x4a63b9='',_0x5ee78f='',_0x5e0d44=![];const _0x11c7b3=setTimeout(()=>{const _0x1e3fc2=_0x481c;if(_0x5e0d44)return;_0x5e0d44=!![],_0x1c5416['kill']('SIGTERM'),_0x2b40d4(new Error(_0xd6015d+(_0x1e3fc2(0x29a)+'ut\x20after'+'\x20')+_0x55432c+'ms'));},_0x55432c);_0x1c5416[_0x228a7e(0x267)]['on'](_0x228a7e(0x23d),_0xf14f8a=>{const _0x39fce3=_0x228a7e;_0x4a63b9+=_0xf14f8a[_0x39fce3(0x1c7)]();}),_0x1c5416[_0x228a7e(0x2af)]['on']('data',_0x125228=>{_0x5ee78f+=_0x125228['toString']();}),_0x1c5416['on'](_0x228a7e(0x1b1),_0x3c0d33=>{if(_0x5e0d44)return;_0x5e0d44=!![],clearTimeout(_0x11c7b3),_0x2b40d4(_0x3c0d33);}),_0x1c5416['on'](_0x228a7e(0x183),(_0x44f5e0,_0x2c6517)=>{const _0x53dd8c=_0x228a7e;if(_0x5e0d44)return;_0x5e0d44=!![],clearTimeout(_0x11c7b3);if(_0x44f5e0===0x0){_0xcb2a07({'stdout':_0x4a63b9,'stderr':_0x5ee78f});return;}_0x2b40d4(new Error(_0xd6015d+(_0x53dd8c(0x24b)+_0x53dd8c(0x297)+'e=')+(_0x44f5e0??_0x53dd8c(0x276))+_0x53dd8c(0x230)+(_0x2c6517??_0x53dd8c(0x276))+'\x0a'+(''+(_0x5ee78f||_0x4a63b9))[_0x53dd8c(0x234)]()));});});}async function installOpenClawPackage(_0x63dbd4,_0x21b652){const _0x8487b5=_0x406343,_0x362120=join(_0x63dbd4[_0x8487b5(0x1e9)+_0x8487b5(0x24c)],_0x8487b5(0x27c)),_0x210a1e=join(_0x63dbd4[_0x8487b5(0x1e9)+'oot'],_0x8487b5(0x21c)+_0x8487b5(0x2a8)+'t');await mkdir(_0x362120,{'recursive':!![]}),await rm(_0x210a1e,{'recursive':!![],'force':!![]}),await mkdir(_0x210a1e,{'recursive':!![]});const _0x43ca40=await createRuntimeEnv(_0x63dbd4),_0x67badc='openclaw'+'@'+_0x21b652;console[_0x8487b5(0x185)](_0x8487b5(0x195)+_0x8487b5(0x204)+'time]\x20in'+_0x8487b5(0x1cb)+'\x20'+_0x67badc);const _0x417827=await runProcess(_0x63dbd4[_0x8487b5(0x18c)+'utable'],[_0x63dbd4[_0x8487b5(0x2b7)],_0x8487b5(0x246),_0x67badc,'--json'],{'cwd':_0x362120,'env':_0x43ca40,'label':_0x8487b5(0x1fa)+'\x20'+_0x67badc}),_0x1f2488=parseNpmPackJson(_0x417827['stdout']);if(_0x1f2488[_0x8487b5(0x23e)]!==_0x21b652)throw new Error(_0x8487b5(0x260)+_0x8487b5(0x184)+'law\x20'+_0x21b652+(_0x8487b5(0x271)+_0x8487b5(0x19a))+_0x1f2488['version']);const _0x29c6c5=resolve(_0x362120,_0x1f2488['filename']);if(!existsSync(_0x29c6c5))throw new Error(_0x8487b5(0x1fa)+_0x8487b5(0x2a2)+_0x8487b5(0x1ac)+_0x8487b5(0x1b4)+'\x20'+_0x29c6c5);await runProcess(_0x8487b5(0x2b4),['-xzf',_0x29c6c5,'-C',_0x210a1e],{'label':_0x8487b5(0x1f4)+_0x1f2488[_0x8487b5(0x22b)]}),await rm(_0x63dbd4['openclaw'+_0x8487b5(0x25c)+'ir'],{'recursive':!![],'force':!![]}),await rename(join(_0x210a1e,_0x8487b5(0x253)),_0x63dbd4[_0x8487b5(0x1c2)+_0x8487b5(0x25c)+'ir']),await rm(_0x210a1e,{'recursive':!![],'force':!![]}),await runProcess(_0x63dbd4['nodeExec'+_0x8487b5(0x28e)],[_0x63dbd4[_0x8487b5(0x2b7)],'install',_0x8487b5(0x198)+'ev',_0x8487b5(0x22a)+_0x8487b5(0x1f1),_0x8487b5(0x245)+'it','--no-fun'+'d',_0x8487b5(0x25a)+_0x8487b5(0x189)+'ps'],{'cwd':_0x63dbd4[_0x8487b5(0x1c2)+'WorkingD'+'ir'],'env':_0x43ca40,'label':_0x8487b5(0x274)+'all\x20'+_0x67badc+(_0x8487b5(0x1df)+_0x8487b5(0x273)+_0x8487b5(0x2ae))});if(!existsSync(_0x63dbd4[_0x8487b5(0x1c2)+_0x8487b5(0x25b)]))throw new Error(_0x8487b5(0x200)+'\x20bin\x20was'+_0x8487b5(0x1f6)+_0x8487b5(0x1f9)+'\x20install'+':\x20'+_0x63dbd4[_0x8487b5(0x1c2)+_0x8487b5(0x25b)]);}async function ensureRuntimeBase(_0x485a5f,_0x336a0c,_0xcea732={}){const _0x57a739=_0x406343;await mkdir(_0x336a0c,{'recursive':!![]});let _0x268861=await readRuntimeManifest(_0x336a0c);const _0x4db818=_0x485a5f[_0x57a739(0x1c2)][_0x57a739(0x27a)+'ion'],_0x1c09a9=_0x485a5f['openclaw'][_0x57a739(0x1c2)+_0x57a739(0x1b9)],_0x2ad0c4=existsSync(resolveManifestPath(_0x336a0c)),_0x4be956=runtimeHasRequiredPaths(_0x336a0c,_0x268861),_0x180064=_0x268861[_0x57a739(0x27a)+_0x57a739(0x23f)]===_0x4db818;!_0x2ad0c4||!_0x4be956||!_0x180064?(_0xcea732[_0x57a739(0x1e8)+'ogger']?.[_0x57a739(0x1d5)]('runtime\x20'+_0x57a739(0x1fc)+_0x57a739(0x223)+'ed',{'runtimeRoot':_0x336a0c,'reason':!_0x2ad0c4?'missing\x20'+_0x57a739(0x227):!_0x4be956?'missing\x20'+'required'+_0x57a739(0x1df)+_0x57a739(0x1a7):_0x57a739(0x232)+_0x57a739(0x21d)+_0x57a739(0x23b),'syncOnly':_0xcea732[_0x57a739(0x1c4)]}),_0x268861=await buildRuntimeBase(_0x485a5f,_0x336a0c,_0x268861),_0xcea732['runtimeL'+_0x57a739(0x1d9)]?.[_0x57a739(0x1d5)]('runtime\x20'+_0x57a739(0x1fc)+_0x57a739(0x240)+_0x57a739(0x293),{'manifest':summarizeRuntimeManifest(_0x268861)})):_0xcea732[_0x57a739(0x1e8)+_0x57a739(0x1d9)]?.[_0x57a739(0x1d5)]('runtime\x20'+_0x57a739(0x1af)+_0x57a739(0x28d)+'rent',{'manifest':summarizeRuntimeManifest(_0x268861)});if(!existsSync(resolve(_0x336a0c,_0x268861[_0x57a739(0x1c2)+_0x57a739(0x25b)]))){const _0x4e41ce=createRuntimeInfoFromManifest(_0x336a0c,_0x268861,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x4e41ce,_0x1c09a9),_0x268861[_0x57a739(0x1c2)+_0x57a739(0x1b9)]=_0x1c09a9;}return _0x268861;}function runtimeHasRequiredPaths(_0x1ae522,_0x49be6b){const _0x3a6e4d=_0x406343;return[_0x3a6e4d(0x18c)+_0x3a6e4d(0x28e),_0x3a6e4d(0x2b7),_0x3a6e4d(0x1c2)+_0x3a6e4d(0x25c)+'ir',_0x3a6e4d(0x1c2)+'Bin'][_0x3a6e4d(0x1c6)](_0x455e8b=>typeof _0x49be6b[_0x455e8b]==='string'&&_0x49be6b[_0x455e8b][_0x3a6e4d(0x234)]())&&[_0x3a6e4d(0x18c)+_0x3a6e4d(0x28e),_0x3a6e4d(0x2b7)][_0x3a6e4d(0x1c6)](_0x5d2b75=>existsSync(resolve(_0x1ae522,_0x49be6b[_0x5d2b75])));}async function buildRuntimeBase(_0x3cc529,_0x40990a,_0xf1a18c={}){const _0x3a6d5f=_0x406343,_0x46b63f=join(_0x40990a,'node');await ensureRuntimeNode(_0x3cc529,_0x46b63f);const _0x56299f={..._0xf1a18c,'generatedAt':new Date()[_0x3a6d5f(0x1ff)+_0x3a6d5f(0x26f)](),'nodeVersion':_0x3cc529['openclaw']['nodeVers'+_0x3a6d5f(0x23f)],'openclawVersion':_0xf1a18c[_0x3a6d5f(0x1c2)+_0x3a6d5f(0x1b9)]||'','platform':process[_0x3a6d5f(0x224)],'arch':process[_0x3a6d5f(0x261)],'nodeExecutable':_0x3a6d5f(0x236)+_0x3a6d5f(0x1f2),'npmCli':_0x3a6d5f(0x25f)+_0x3a6d5f(0x2b5)+_0x3a6d5f(0x249)+_0x3a6d5f(0x2ab)+_0x3a6d5f(0x299),'openclawWorkingDir':_0x3a6d5f(0x1c2),'openclawBin':_0x3a6d5f(0x1c2)+_0x3a6d5f(0x1eb)+'w.mjs'};return await writeJson(resolveManifestPath(_0x40990a),_0x56299f),_0x56299f;}async function ensureRuntimeNode(_0x4e9ad8,_0x5c7f70){const _0x1b2a95=_0x406343,_0xebee2c=_0x4e9ad8['openclaw']['nodeVers'+'ion'],_0x1e27fb=join(_0x5c7f70,'bin','node'),_0xcc7fcc=join(_0x5c7f70,_0x1b2a95(0x2ac),_0x1b2a95(0x1d0)+_0x1b2a95(0x22f),_0x1b2a95(0x2a0),'bin','npm-cli.'+'js');if(existsSync(_0x1e27fb)&&existsSync(_0xcc7fcc)&&await getNodeVersion(_0x1e27fb)===_0xebee2c)return;await rm(_0x5c7f70,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});if(process['versions'][_0x1b2a95(0x290)]===_0xebee2c){await linkCurrentNodeRuntime(_0x5c7f70);return;}await downloadNodeRuntime(_0xebee2c,_0x5c7f70);}async function getNodeVersion(_0xcfc2b){const _0x28529d=_0x406343;try{const _0x228698=await runProcess(_0xcfc2b,['-p','process.'+_0x28529d(0x252)+'.node'],{'label':_0xcfc2b+_0x28529d(0x277),'timeoutMs':0x7530});return _0x228698[_0x28529d(0x267)][_0x28529d(0x234)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0xc176f){const _0x2faf78=_0x406343,_0x4eb652=process['execPath'],_0xf86ead=resolve(dirname(_0x4eb652),'..'),_0x230401=resolve(_0xf86ead,'lib/node'+_0x2faf78(0x25e)+'/npm'),_0x2626c7=join(_0xc176f,_0x2faf78(0x1dc),_0x2faf78(0x290)),_0x2c62a1=join(_0xc176f,'lib',_0x2faf78(0x1d0)+_0x2faf78(0x22f),'npm');await mkdir(dirname(_0x2626c7),{'recursive':!![]}),await mkdir(dirname(_0x2c62a1),{'recursive':!![]}),await symlink(_0x4eb652,_0x2626c7),existsSync(_0x230401)?await symlink(_0x230401,_0x2c62a1):await symlink(await resolveNpmRoot(),_0x2c62a1);}async function resolveNpmRoot(){const _0x558f1d=_0x406343,_0x14f7dd=await runProcess(_0x558f1d(0x2a0),[_0x558f1d(0x264),'-g'],{'label':_0x558f1d(0x1a2)+_0x558f1d(0x1ab),'timeoutMs':0x7530}),_0x239ea9=join(_0x14f7dd['stdout'][_0x558f1d(0x234)](),_0x558f1d(0x2a0));if(!existsSync(join(_0x239ea9,_0x558f1d(0x1dc),'npm-cli.'+'js')))throw new Error('npm\x20pack'+'age\x20was\x20'+_0x558f1d(0x239)+'d\x20for\x20lo'+_0x558f1d(0x254)+'ime\x20buil'+_0x558f1d(0x1c9)+_0x239ea9);return _0x239ea9;}async function downloadNodeRuntime(_0x1107a4,_0x43fbad){const _0x366732=_0x406343,_0x412663=process[_0x366732(0x224)]===_0x366732(0x181)?_0x366732(0x1b5):process[_0x366732(0x224)],_0x538f34=process[_0x366732(0x261)]===_0x366732(0x24a)?_0x366732(0x24a):process[_0x366732(0x261)]===_0x366732(0x1a4)?_0x366732(0x1a4):process[_0x366732(0x261)],_0x9f1046=process['platform']===_0x366732(0x181)?_0x366732(0x1c3):_0x366732(0x1fe),_0x22e7ff=_0x366732(0x202)+_0x1107a4+'-'+_0x412663+'-'+_0x538f34,_0x3153ad=_0x22e7ff+'.'+_0x9f1046,_0x22977=join(dirname(_0x43fbad),'.cache'),_0x4a846e=join(_0x22977,_0x3153ad),_0x2df631=join(_0x22977,_0x22e7ff+(_0x366732(0x1bd)+'-')+process[_0x366732(0x1b8)]+'-'+Date[_0x366732(0x2a1)]()),_0x3c53bc=_0x366732(0x1d8)+_0x366732(0x17f)+_0x366732(0x187)+'v'+_0x1107a4+'/'+_0x3153ad;await mkdir(_0x22977,{'recursive':!![]}),!existsSync(_0x4a846e)&&(console[_0x366732(0x185)]('[wujie-s'+_0x366732(0x204)+'time]\x20do'+_0x366732(0x1cd)+'g\x20'+_0x3c53bc),await downloadFile(_0x3c53bc,_0x4a846e)),await rm(_0x2df631,{'recursive':!![],'force':!![]}),await mkdir(_0x2df631,{'recursive':!![]}),process[_0x366732(0x224)]===_0x366732(0x181)?await runProcess(_0x366732(0x27b),['-q',_0x4a846e,'-d',_0x2df631],{'label':_0x366732(0x1f4)+_0x3153ad}):await runProcess(_0x366732(0x2b4),[_0x366732(0x1ed),_0x4a846e,'-C',_0x2df631],{'label':_0x366732(0x1f4)+_0x3153ad}),await rename(join(_0x2df631,_0x22e7ff),_0x43fbad),await rm(_0x2df631,{'recursive':!![],'force':!![]});}async function downloadFile(_0x5cc1df,_0x4e1d20){await mkdir(dirname(_0x4e1d20),{'recursive':!![]});const _0x3d370b=await new Promise((_0x1dbc20,_0x23049c)=>{const _0xed3f15=_0x481c;get(_0x5cc1df,_0x4c6ffc=>{const _0x4050d1=_0x481c;if(_0x4c6ffc['statusCo'+'de']>=0x12c&&_0x4c6ffc[_0x4050d1(0x1e4)+'de']<0x190&&_0x4c6ffc[_0x4050d1(0x258)][_0x4050d1(0x1a1)]){_0x4c6ffc['resume'](),downloadFile(new URL(_0x4c6ffc['headers'][_0x4050d1(0x1a1)],_0x5cc1df)[_0x4050d1(0x1f8)],_0x4e1d20)[_0x4050d1(0x1f7)](()=>_0x1dbc20(null))['catch'](_0x23049c);return;}if(_0x4c6ffc['statusCo'+'de']!==0xc8){_0x4c6ffc['resume'](),_0x23049c(new Error(_0x4050d1(0x278)+_0x4050d1(0x24b)+_0x4c6ffc[_0x4050d1(0x1e4)+'de']+':\x20'+_0x5cc1df));return;}_0x1dbc20(_0x4c6ffc);})['on'](_0xed3f15(0x1b1),_0x23049c);});_0x3d370b&&await pipeline(_0x3d370b,createWriteStream(_0x4e1d20));}export async function ensureOpenClawDoctorFixed(_0x3079b8,_0x2c99e7={}){const _0x4960ea=_0x406343,_0x54897d=await loadRuntimeInfo(_0x3079b8[_0x4960ea(0x207)+_0x4960ea(0x24c)]),_0x2b6881=getConfigPaths(_0x3079b8),_0x4799cf=join(_0x2b6881['runtimeS'+'tateDir'],_0x4960ea(0x1c2)+_0x4960ea(0x1b7)+_0x4960ea(0x1ea)),_0x36e661=await readJson(_0x4799cf,{});if(_0x36e661[_0x4960ea(0x1c2)+'Version']===_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)])return _0x2c99e7[_0x4960ea(0x1e8)+'ogger']?.[_0x4960ea(0x1d5)](_0x4960ea(0x1c2)+_0x4960ea(0x1e0)+'fix\x20alre'+_0x4960ea(0x2b3)+_0x4960ea(0x199),{'openclawVersion':_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)],'markerPath':_0x4799cf}),{'ran':![],'openclawVersion':_0x54897d[_0x4960ea(0x1c2)+'Version'],'markerPath':_0x4799cf};return await runOpenClawDoctorFix(_0x3079b8,_0x54897d,{'fromVersion':_0x36e661[_0x4960ea(0x1c2)+'Version']||_0x4960ea(0x1c1),'toVersion':_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)],'markerPath':_0x4799cf,'runtimeLogger':_0x2c99e7[_0x4960ea(0x1e8)+_0x4960ea(0x1d9)]}),{'ran':!![],'openclawVersion':_0x54897d[_0x4960ea(0x1c2)+_0x4960ea(0x1b9)],'markerPath':_0x4799cf};}async function runOpenClawDoctorFix(_0x33725f,_0x45d7a0,{fromVersion:_0x2109be,toVersion:_0x174811,markerPath:markerPath='',runtimeLogger:_0x35e5cd}={}){const _0x14e76a=_0x406343;_0x35e5cd?.[_0x14e76a(0x1d5)](_0x14e76a(0x1c2)+_0x14e76a(0x1e0)+_0x14e76a(0x225)+'ted',{'fromVersion':_0x2109be,'toVersion':_0x174811});const _0x5b1009=await createRuntimeEnv(_0x45d7a0,{'OPENCLAW_HOME':_0x33725f[_0x14e76a(0x1fb)],'OPENCLAW_STATE_DIR':_0x33725f[_0x14e76a(0x1fb)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x33725f)[_0x14e76a(0x211)+'th']});console[_0x14e76a(0x185)]('[wujie-s'+_0x14e76a(0x204)+'time]\x20ru'+_0x14e76a(0x2a6)+_0x14e76a(0x1bb)+_0x14e76a(0x275)+_0x14e76a(0x19b));const _0x212e76=await runProcess(_0x45d7a0[_0x14e76a(0x18c)+'utable'],[_0x45d7a0[_0x14e76a(0x1c2)+_0x14e76a(0x25b)],_0x14e76a(0x213),_0x14e76a(0x25d)],{'cwd':_0x45d7a0['openclaw'+'WorkingD'+'ir'],'env':_0x5b1009,'label':_0x14e76a(0x1c2)+_0x14e76a(0x1e0)+_0x14e76a(0x25d),'timeoutMs':0x1d4c0});_0x35e5cd?.[_0x14e76a(0x1d5)](_0x14e76a(0x1c2)+_0x14e76a(0x1e0)+_0x14e76a(0x180)+'leted',{'fromVersion':_0x2109be,'toVersion':_0x174811,'stdout':_0x212e76['stdout'][_0x14e76a(0x234)]()['slice'](-0xfa0),'stderr':_0x212e76[_0x14e76a(0x2af)][_0x14e76a(0x234)]()[_0x14e76a(0x1c0)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x45d7a0[_0x14e76a(0x1c2)+_0x14e76a(0x1b9)],'fixedAt':new Date()[_0x14e76a(0x1ff)+_0x14e76a(0x26f)]()}),_0x35e5cd?.['info'](_0x14e76a(0x1c2)+'\x20doctor\x20'+_0x14e76a(0x298)+_0x14e76a(0x1d4)+'en',{'markerPath':markerPath,'openclawVersion':_0x45d7a0[_0x14e76a(0x1c2)+'Version']}));}export async function readRuntimeManifest(_0x428707){return await readJson(resolveManifestPath(_0x428707),{});}export async function loadRuntimeInfo(_0x4f289b){const _0x4e81a8=resolveRuntimeRoot(_0x4f289b),_0x40beec=await readRuntimeManifest(_0x4e81a8);return createRuntimeInfoFromManifest(_0x4e81a8,_0x40beec);}function createRuntimeInfoFromManifest(_0x35135e,_0x31df19,_0x4ee885={}){const _0x1b81b2=_0x406343;for(const _0x5057b1 of['nodeExec'+'utable',_0x1b81b2(0x2b7),_0x1b81b2(0x1c2)+_0x1b81b2(0x25c)+'ir',_0x1b81b2(0x1c2)+'Bin']){if(typeof _0x31df19[_0x5057b1]!==_0x1b81b2(0x257)||!_0x31df19[_0x5057b1][_0x1b81b2(0x234)]())throw new Error(_0x1b81b2(0x21a)+_0x1b81b2(0x227)+_0x1b81b2(0x1ca)+_0x1b81b2(0x1a0)+_0x5057b1+'\x22\x20at\x20'+resolveManifestPath(_0x35135e)+(_0x1b81b2(0x241)+_0x1b81b2(0x20c)+_0x1b81b2(0x210)+'e'));}const _0x4e3aa0=resolve(_0x35135e,_0x31df19['nodeExec'+'utable']),_0xa615cc=resolve(_0x35135e,_0x31df19[_0x1b81b2(0x2b7)]),_0x2b3909=resolve(_0x35135e,_0x31df19['openclaw'+'WorkingD'+'ir']),_0x221e26=resolve(_0x35135e,_0x31df19[_0x1b81b2(0x1c2)+_0x1b81b2(0x25b)]),_0xcdf769=Array[_0x1b81b2(0x188)](_0x31df19[_0x1b81b2(0x197)])?_0x31df19[_0x1b81b2(0x197)][_0x1b81b2(0x24f)](_0x5e6957=>({..._0x5e6957,'installPath':resolve(_0x35135e,_0x5e6957[_0x1b81b2(0x209)+'ath'])})):[],_0x16eef4=_0x4ee885['allowMis'+'singOpen'+_0x1b81b2(0x262)]?[_0x4e3aa0,_0xa615cc]:[_0x4e3aa0,_0xa615cc,_0x2b3909,_0x221e26];for(const _0x4f586e of _0x16eef4){if(!existsSync(_0x4f586e))throw new Error('runtime\x20'+_0x1b81b2(0x269)+_0x1b81b2(0x238)+_0x4f586e);}return{'runtimeRoot':_0x35135e,'manifest':_0x31df19,'openclawVersion':_0x31df19['openclaw'+_0x1b81b2(0x1b9)]||'unknown','nodeExecutable':_0x4e3aa0,'npmCli':_0xa615cc,'openclawWorkingDir':_0x2b3909,'openclawBin':_0x221e26,'plugins':_0xcdf769};}export async function spawnClaw(_0xf2190e,_0x40a256=[],_0x2ca547={}){const _0x3dd08a=_0x406343,_0x15aa0a=await loadRuntimeInfo(_0xf2190e),_0x2783f0=await createRuntimeEnv(_0x15aa0a,_0x2ca547[_0x3dd08a(0x255)]??{});return spawn(_0x15aa0a['nodeExec'+'utable'],[_0x15aa0a['openclaw'+_0x3dd08a(0x25b)],..._0x40a256],{'cwd':_0x15aa0a[_0x3dd08a(0x1c2)+_0x3dd08a(0x25c)+'ir'],'stdio':_0x3dd08a(0x1e3),..._0x2ca547,'env':_0x2783f0});}export async function runClawOnce(_0x37d722,_0x146716=[],_0x59c232=0x15f90){const _0x47a162=await spawnClaw(_0x37d722,_0x146716);return await new Promise((_0x51c1cd,_0x59d722)=>{const _0x35266f=_0x481c;let _0x43f9b6='',_0x112000='',_0xfade53=![];const _0xeda6=setTimeout(()=>{const _0x5589fc=_0x481c;if(_0xfade53)return;_0xfade53=!![],_0x47a162[_0x5589fc(0x214)](_0x5589fc(0x1e7)),_0x59d722(new Error(_0x5589fc(0x1c2)+_0x5589fc(0x29a)+_0x5589fc(0x291)+'\x20'+_0x59c232+'ms'));},_0x59c232);_0x47a162['stdout']['on']('data',_0x1645ad=>{const _0x3ca055=_0x481c;_0x43f9b6+=_0x1645ad[_0x3ca055(0x1c7)]();}),_0x47a162['stderr']['on'](_0x35266f(0x23d),_0x2b1d73=>{const _0x392750=_0x35266f;_0x112000+=_0x2b1d73[_0x392750(0x1c7)]();}),_0x47a162['on']('error',_0x2272d6=>{if(_0xfade53)return;_0xfade53=!![],clearTimeout(_0xeda6),_0x59d722(_0x2272d6);}),_0x47a162['on'](_0x35266f(0x183),(_0x2c1bb2,_0x1e37ed)=>{if(_0xfade53)return;_0xfade53=!![],clearTimeout(_0xeda6),_0x51c1cd({'code':_0x2c1bb2,'signal':_0x1e37ed,'stdout':_0x43f9b6,'stderr':_0x112000});});});}async function createRuntimeEnv(_0x53ddea,_0x45d8c7={}){const _0x132c51=_0x406343,_0x20e690=process.env.OPENCLAW_STATE_DIR||'',_0x12d0f5=_0x20e690?join(_0x20e690,'claw-run'+'time-too'+'ls'):join(_0x53ddea[_0x132c51(0x1e9)+_0x132c51(0x24c)],_0x132c51(0x1c8)),_0xbf2835=join(_0x12d0f5,'npm-glob'+'al'),_0x51402d=join(_0x12d0f5,_0x132c51(0x21e)+'e'),_0x8803c7=join(_0xbf2835,_0x132c51(0x1dc));await mkdir(_0x8803c7,{'recursive':!![]}),await mkdir(_0x51402d,{'recursive':!![]});const _0x10e32e=[_0x8803c7,dirname(_0x53ddea['nodeExec'+_0x132c51(0x28e)]),process.env.PATH||''];return{...process.env,..._0x45d8c7,'PATH':_0x10e32e[_0x132c51(0x251)](Boolean)[_0x132c51(0x281)](delimiter),'npm_config_prefix':_0xbf2835,'NPM_CONFIG_PREFIX':_0xbf2835,'npm_config_cache':_0x51402d,'NPM_CONFIG_CACHE':_0x51402d,'npm_config_registry':_0x132c51(0x1d8)+_0x132c51(0x266)+_0x132c51(0x217)+'rg/','NPM_CONFIG_REGISTRY':_0x132c51(0x1d8)+_0x132c51(0x266)+_0x132c51(0x217)+'rg/','npm_execpath':_0x53ddea[_0x132c51(0x2b7)],'npm_node_execpath':_0x53ddea[_0x132c51(0x18c)+'utable'],'OPENCLAW_RUNTIME_NPM_PREFIX':_0xbf2835,'OPENCLAW_RUNTIME_NPM_BIN':_0x8803c7,'OPENCLAW_RUNTIME_NPM_REGISTRY':_0x132c51(0x1d8)+_0x132c51(0x266)+_0x132c51(0x217)+_0x132c51(0x19e)};}async function syncProductPlugins(_0x34e4a1,_0x10f5f9,_0x2c02f9){const _0x553b29=_0x406343,_0x33cfdc=join(_0x10f5f9,'openclaw',_0x553b29(0x270),'extensio'+'ns'),_0x2fb4c6=[];for(const _0x127918 of _0x34e4a1[_0x553b29(0x1c2)]['resolved'+_0x553b29(0x18e)+_0x553b29(0x1a5)]){const _0x2b9096=await getPackageMetadata(_0x127918),_0x34a5e3=await readPluginManifest(_0x127918),_0x113d48=join(_0x33cfdc,_0x2b9096['pluginId']);await copyDirFresh(_0x127918,_0x113d48),_0x2fb4c6[_0x553b29(0x190)]({'pluginId':_0x2b9096[_0x553b29(0x2b6)],'source':_0x553b29(0x29f),'spec':_0x553b29(0x1e5)+_0x127918,'installPath':toRuntimeRelative(_0x10f5f9,_0x113d48),'version':_0x2b9096[_0x553b29(0x23e)],'resolvedName':_0x2b9096[_0x553b29(0x1b3)],'resolvedVersion':_0x2b9096[_0x553b29(0x23e)],'resolvedSpec':_0x553b29(0x1e5)+_0x127918,'integrity':'','shasum':'','resolvedAt':new Date()[_0x553b29(0x1ff)+_0x553b29(0x26f)](),'installedAt':new Date()[_0x553b29(0x1ff)+'ing'](),'agentScope':_0x34a5e3[_0x553b29(0x294)+'pe'],'skills':_0x34a5e3[_0x553b29(0x212)]});}const _0x3ce38b=new Set(_0x2fb4c6[_0x553b29(0x24f)](_0x3f020f=>_0x3f020f[_0x553b29(0x2b6)])),_0x4a664f=Array['isArray'](_0x2c02f9['plugins'])?_0x2c02f9[_0x553b29(0x197)]['filter'](_0x3f8808=>!_0x3ce38b[_0x553b29(0x18f)](_0x3f8808[_0x553b29(0x2b6)])):[];_0x2c02f9[_0x553b29(0x197)]=[..._0x4a664f,..._0x2fb4c6];}async function syncManifestPluginScope(_0x53e894,_0x4039d3,_0xa4a173){const _0x353792=_0x406343,_0x4c6660=join(_0x4039d3,'openclaw',_0x353792(0x270),_0x353792(0x208)+'ns'),_0x5d383b=new Set(_0x53e894[_0x353792(0x1c2)][_0x353792(0x280)+'ecs']??[]),_0x1aabd7=new Set([..._0x5d383b][_0x353792(0x24f)](_0x4d0c0d=>_0x4d0c0d[_0x353792(0x228)](/^npm:/,''))[_0x353792(0x24f)](_0x3446e7=>{const _0xf02212=_0x353792;if(_0x3446e7[_0xf02212(0x1b0)+'th']('@')){const _0x581ae3=_0x3446e7['split']('@');return _0x581ae3[_0xf02212(0x235)]>=0x3?'@'+_0x581ae3[0x1]:_0x3446e7;}return _0x3446e7[_0xf02212(0x1be)]('@')[0x0];})['filter'](Boolean)),_0x18b8a0=new Set();for(const _0x577725 of _0x53e894[_0x353792(0x1c2)][_0x353792(0x1b6)+_0x353792(0x18e)+_0x353792(0x1a5)]){const _0x2437a1=await getPackageMetadata(_0x577725);if(_0x2437a1[_0x353792(0x2b6)])_0x18b8a0[_0x353792(0x247)](_0x2437a1[_0x353792(0x2b6)]);}const _0x26a72d=Array[_0x353792(0x188)](_0xa4a173[_0x353792(0x197)])?_0xa4a173[_0x353792(0x197)]:[];_0xa4a173['pluginSp'+_0x353792(0x2a4)]=[..._0x53e894[_0x353792(0x1c2)][_0x353792(0x280)+_0x353792(0x2a4)],..._0x53e894['openclaw'][_0x353792(0x1b6)+_0x353792(0x18e)+_0x353792(0x1a5)][_0x353792(0x24f)](_0x1fb80e=>'local:'+_0x1fb80e)],_0xa4a173[_0x353792(0x197)]=_0x26a72d[_0x353792(0x251)](_0x1a9c1b=>{const _0x1d0c3b=_0x353792;if(!_0x1a9c1b||typeof _0x1a9c1b!=='object')return![];if(_0x1a9c1b[_0x1d0c3b(0x242)]===_0x1d0c3b(0x29f))return _0x18b8a0[_0x1d0c3b(0x18f)](_0x1a9c1b['pluginId']);if(_0x1a9c1b['source']===_0x1d0c3b(0x2a0))return _0x5d383b[_0x1d0c3b(0x18f)](_0x1a9c1b[_0x1d0c3b(0x2a7)])||_0x5d383b[_0x1d0c3b(0x18f)](_0x1a9c1b[_0x1d0c3b(0x1b6)+_0x1d0c3b(0x1a6)])||_0x1aabd7[_0x1d0c3b(0x18f)](_0x1a9c1b[_0x1d0c3b(0x1b6)+'Name']);return![];});const _0x5df8b3=new Set(_0xa4a173[_0x353792(0x197)]['map'](_0x11edde=>_0x11edde[_0x353792(0x2b6)]));for(const _0x390444 of _0x26a72d){if(!_0x390444[_0x353792(0x2b6)]||_0x5df8b3[_0x353792(0x18f)](_0x390444[_0x353792(0x2b6)]))continue;const _0x26e540=typeof _0x390444[_0x353792(0x209)+_0x353792(0x1dd)]===_0x353792(0x257)&&_0x390444[_0x353792(0x209)+_0x353792(0x1dd)]['trim']()?resolve(_0x4039d3,_0x390444['installP'+_0x353792(0x1dd)]):join(_0x4c6660,_0x390444[_0x353792(0x2b6)]),_0x1be864=relative(_0x4c6660,_0x26e540);if(_0x1be864[_0x353792(0x1b0)+'th']('..')||_0x1be864==='')continue;await rm(_0x26e540,{'recursive':!![],'force':!![]});}}async function syncProductAgents(_0x304437,_0x42e0d1,_0x2c4e39){const _0x163a5d=_0x406343,_0x193071=join(_0x42e0d1,_0x163a5d(0x1c2),'agents');await copyDirFresh(_0x304437[_0x163a5d(0x1c2)][_0x163a5d(0x2b1)+'r'],_0x193071),_0x2c4e39['agents']={'source':_0x163a5d(0x222),'installPath':toRuntimeRelative(_0x42e0d1,_0x193071)};}async function syncProductSkills(_0x22c14c,_0x274dcb,_0xf1c5bf){const _0x37d7ab=_0x406343,_0x495911=join(_0x274dcb,_0x37d7ab(0x1c2),'skills');await copyDirFresh(_0x22c14c[_0x37d7ab(0x1c2)][_0x37d7ab(0x295)+'r'],_0x495911),_0xf1c5bf[_0x37d7ab(0x212)]={'source':'product','installPath':toRuntimeRelative(_0x274dcb,_0x495911)};}
|
package/dist/src/utils.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x3a65(_0x4bb7f5,_0xab1f35){_0x4bb7f5=_0x4bb7f5-0x163;const _0x586bc6=_0x586b();let _0x3a650d=_0x586bc6[_0x4bb7f5];return _0x3a650d;}(function(_0x3ec189,_0x306e33){const _0x2ea3d8=_0x3a65,_0x118248=_0x3ec189();while(!![]){try{const _0x452b01=parseInt(_0x2ea3d8(0x173))/0x1*(parseInt(_0x2ea3d8(0x16e))/0x2)+parseInt(_0x2ea3d8(0x16d))/0x3*(-parseInt(_0x2ea3d8(0x177))/0x4)+parseInt(_0x2ea3d8(0x165))/0x5+-parseInt(_0x2ea3d8(0x170))/0x6*(-parseInt(_0x2ea3d8(0x17a))/0x7)+parseInt(_0x2ea3d8(0x16a))/0x8+parseInt(_0x2ea3d8(0x17c))/0x9+-parseInt(_0x2ea3d8(0x171))/0xa;if(_0x452b01===_0x306e33)break;else _0x118248['push'](_0x118248['shift']());}catch(_0x58318e){_0x118248['push'](_0x118248['shift']());}}}(_0x586b,0xdef23));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';function _0x586b(){const _0x6da628=['isDirect','filter','6794320kcZTeT','isArray','name','4993818CveGJV','1173734bhyOxH','map','140226JpMFnh','17147920sAtLIe','string','1PaIDpZ','package.','utf8','.plugin.','4qPxzeQ','stringif','replaceA','511VlHcoB','ory','5208588mtZcKK','json','openclaw','2858065WpIqHh','trim','object'];_0x586b=function(){return _0x6da628;};return _0x586b();}export function asRecord(_0x1a1fd4){const _0x8e9c87=_0x3a65;return _0x1a1fd4&&typeof _0x1a1fd4===_0x8e9c87(0x167)&&!Array[_0x8e9c87(0x16b)](_0x1a1fd4)?_0x1a1fd4:{};}export function asStringArray(_0x15dbda){const _0x4bf78f=_0x3a65;return Array['isArray'](_0x15dbda)?_0x15dbda['filter'](_0x587225=>typeof _0x587225===_0x4bf78f(0x172)&&_0x587225[_0x4bf78f(0x166)]())[_0x4bf78f(0x16f)](_0x51eb15=>_0x51eb15[_0x4bf78f(0x166)]()):[];}export function dedupeStrings(_0x3878b0){const _0xe4cf86=_0x3a65;return[...new Set(_0x3878b0[_0xe4cf86(0x169)](Boolean))];}export function getTrimmedString(_0x29847e){const _0x141af4=_0x3a65;return typeof _0x29847e===_0x141af4(0x172)?_0x29847e[_0x141af4(0x166)]():'';}export async function readJson(_0xe61177,_0x419c9a={}){const _0x1f7a7c=_0x3a65;try{return JSON['parse'](await readFile(_0xe61177,_0x1f7a7c(0x175)));}catch{return _0x419c9a;}}export async function writeJson(_0x5a9b32,_0x450867){const _0x5897c5=_0x3a65;await mkdir(dirname(_0x5a9b32),{'recursive':!![]}),await writeFile(_0x5a9b32,JSON[_0x5897c5(0x178)+'y'](_0x450867,null,0x2)+'\x0a',_0x5897c5(0x175));}export async function copyDirFresh(_0x1f99a5,_0x3d88f2){await rm(_0x3d88f2,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x3d88f2),{'recursive':!![]}),await cp(_0x1f99a5,_0x3d88f2,{'recursive':!![]});}export async function ensureDir(_0x2ea847){await mkdir(_0x2ea847,{'recursive':!![]});}export function pathExists(_0x51fc0e){return existsSync(_0x51fc0e);}export async function listDirs(_0x9b2681){const _0x42bc91=_0x3a65;try{const _0x1e1fb4=await readdir(_0x9b2681,{'withFileTypes':!![],'encoding':_0x42bc91(0x175)});return _0x1e1fb4['filter'](_0x549c49=>_0x549c49[_0x42bc91(0x168)+_0x42bc91(0x17b)]())[_0x42bc91(0x16f)](_0x21fc29=>_0x21fc29[_0x42bc91(0x16c)]);}catch{return[];}}export async function getPackageMetadata(_0x2317fc){const _0x1a7e9c=_0x3a65,_0x200428=await readJson(join(_0x2317fc,_0x1a7e9c(0x174)+'json'),{}),_0x338cd4=asRecord(_0x200428['openclaw']);return{'name':getTrimmedString(_0x200428[_0x1a7e9c(0x16c)])||basename(_0x2317fc),'version':getTrimmedString(_0x200428['version'])||'0.0.0','pluginId':getTrimmedString(_0x338cd4['id'])||getTrimmedString(_0x200428[_0x1a7e9c(0x164)+'Id'])||basename(_0x2317fc)};}export async function readPluginManifest(_0x5d687e){const _0x375fbe=_0x3a65,_0x56586a=join(_0x5d687e,_0x375fbe(0x164)+_0x375fbe(0x176)+_0x375fbe(0x163)),_0x58d589=await readJson(_0x56586a,{});return asRecord(_0x58d589);}export async function hasFile(_0x222297){try{const _0x1d1c47=await stat(_0x222297);return _0x1d1c47['isFile']();}catch{return![];}}export function toRuntimeRelative(_0x1baba5,_0xa17811){const _0x2ec0d3=_0x3a65;return relative(_0x1baba5,_0xa17811)[_0x2ec0d3(0x179)+'ll']('\x5c','/');}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wujie-shell/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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": "0.1.
|
|
31
|
-
"@wujie-shell/logger": "0.1.
|
|
30
|
+
"@wujie-shell/config": "0.1.4",
|
|
31
|
+
"@wujie-shell/logger": "0.1.4"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "node ../../scripts/build-packages.mjs --package @wujie-shell/core"
|