@wujie-shell/core 1.0.3 → 1.0.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.
Files changed (60) hide show
  1. package/dist/bin/wujie-shell.mjs +1 -1
  2. package/dist/src/agents/bundled-agent-skills.mjs +1 -1
  3. package/dist/src/agents/bundled-agents.mjs +1 -1
  4. package/dist/src/agents/runtime-config.mjs +1 -1
  5. package/dist/src/chat/media-archive.mjs +1 -1
  6. package/dist/src/chat/queue.mjs +1 -1
  7. package/dist/src/common/cron-session-key.mjs +1 -1
  8. package/dist/src/common/diagnostics.mjs +1 -1
  9. package/dist/src/common/logging.mjs +1 -1
  10. package/dist/src/common/runtime-logger.mjs +1 -1
  11. package/dist/src/common/sqlite-paths.mjs +1 -1
  12. package/dist/src/common/user-events.mjs +1 -1
  13. package/dist/src/common/utils.mjs +1 -1
  14. package/dist/src/config/controller.mjs +1 -1
  15. package/dist/src/connectors/config-utils.mjs +1 -1
  16. package/dist/src/connectors/constants.mjs +1 -1
  17. package/dist/src/connectors/controller.mjs +1 -1
  18. package/dist/src/connectors/kdocs-cli.mjs +1 -1
  19. package/dist/src/connectors/lark-cli.mjs +1 -1
  20. package/dist/src/electron/main.mjs +1 -1
  21. package/dist/src/electron/preload.mjs +1 -1
  22. package/dist/src/electron/protocol-url-state.mjs +1 -1
  23. package/dist/src/events/domain-event-journal.mjs +1 -1
  24. package/dist/src/files/generated-files-store.mjs +1 -1
  25. package/dist/src/files/handlers.mjs +1 -1
  26. package/dist/src/gateway/chat-delta.mjs +1 -1
  27. package/dist/src/gateway/controller.mjs +1 -1
  28. package/dist/src/gateway/request-id-title-events.mjs +1 -1
  29. package/dist/src/gateway/ws-client.mjs +1 -1
  30. package/dist/src/index.mjs +1 -1
  31. package/dist/src/log-reporting/handlers.mjs +1 -1
  32. package/dist/src/log-reporting/report-logs.mjs +1 -1
  33. package/dist/src/models/handlers.mjs +1 -1
  34. package/dist/src/preferences/store.mjs +1 -1
  35. package/dist/src/request-id/handlers.mjs +1 -1
  36. package/dist/src/request-id/runtime-bridge.mjs +1 -1
  37. package/dist/src/request-id/session-store.mjs +1 -1
  38. package/dist/src/request-id/title.mjs +1 -1
  39. package/dist/src/runtime/cron-missed-run-policy.mjs +1 -1
  40. package/dist/src/runtime/index.mjs +1 -1
  41. package/dist/src/runtime/patch-channel-plugin-runtime.mjs +1 -1
  42. package/dist/src/runtime/patch-chat-history-mixed-tool-content.mjs +1 -1
  43. package/dist/src/runtime/patch-provider-request-id-header.mjs +1 -1
  44. package/dist/src/runtime/patch-qqbot-outbound-session-route.mjs +1 -1
  45. package/dist/src/runtime/patch-request-id-title-runtime.mjs +1 -1
  46. package/dist/src/runtime/patch-session-store-sqlite.mjs +1 -1
  47. package/dist/src/runtime/patch-weixin-outbound-session-route.mjs +1 -1
  48. package/dist/src/runtime/plugin-sync.mjs +1 -1
  49. package/dist/src/sessions/agent-sessions-map-store.mjs +1 -1
  50. package/dist/src/sessions/runtime-bridge.mjs +1 -1
  51. package/dist/src/sessions/session-data-service.mjs +1 -1
  52. package/dist/src/sessions/session-runtime-state-service.mjs +1 -1
  53. package/dist/src/sessions/session-runtime-state.mjs +1 -1
  54. package/dist/src/sessions/session-sqlite-store.mjs +1 -1
  55. package/dist/src/skills/import.mjs +1 -1
  56. package/dist/src/skills/market.mjs +1 -1
  57. package/dist/src/terminal/manager.mjs +1 -1
  58. package/dist/src/updates/controller.mjs +1 -1
  59. package/dist/src/updates/loader.mjs +1 -1
  60. package/package.json +3 -3
@@ -1 +1 @@
1
- const _0x280435=_0x1993;(function(_0xe98428,_0x2f4442){const _0x438555=_0x1993,_0x596def=_0xe98428();while(!![]){try{const _0x29645c=-parseInt(_0x438555(0x15d))/0x1*(parseInt(_0x438555(0x1ac))/0x2)+parseInt(_0x438555(0x16c))/0x3+parseInt(_0x438555(0x1c2))/0x4*(parseInt(_0x438555(0x19d))/0x5)+-parseInt(_0x438555(0x191))/0x6*(parseInt(_0x438555(0x1d1))/0x7)+-parseInt(_0x438555(0x159))/0x8*(parseInt(_0x438555(0x1c5))/0x9)+parseInt(_0x438555(0x1c9))/0xa+-parseInt(_0x438555(0x196))/0xb*(-parseInt(_0x438555(0x15f))/0xc);if(_0x29645c===_0x2f4442)break;else _0x596def['push'](_0x596def['shift']());}catch(_0x548dc7){_0x596def['push'](_0x596def['shift']());}}}(_0x3a54,0x418ff));import{existsSync}from'node:fs';import{readdir}from'node:fs/promises';import{DatabaseSync}from'node:sqlite';import{join,resolve}from'node:path';import{pathToFileURL}from'node:url';import{asRecord,getTrimmedString}from'../common/utils.mjs';import{loadRuntimeInfo}from'./index.mjs';const CRON_DB_FILE=_0x280435(0x1bf)+_0x280435(0x1bb),CRON_TABLE_NAME=_0x280435(0x183)+'s',SCHEDULE_MODULE_PREFIX=_0x280435(0x16f)+'-',SCHEDULE_MODULE_SUFFIX='.js';function toFiniteMs(_0x44d056){const _0x3a92f7=Number(_0x44d056);return Number['isFinite'](_0x3a92f7)?_0x3a92f7:undefined;}function safeJsonParse(_0x38b00d,_0x58937d={}){const _0x9c571c=_0x280435;if(typeof _0x38b00d!==_0x9c571c(0x169)||!_0x38b00d[_0x9c571c(0x156)]())return _0x58937d;try{return JSON['parse'](_0x38b00d);}catch{return _0x58937d;}}function createScheduleFromRow(_0x1222d4){const _0x2e679f=_0x280435,_0x5153cd=getTrimmedString(_0x1222d4[_0x2e679f(0x16f)+_0x2e679f(0x189)]);if(_0x5153cd===_0x2e679f(0x1c6)){const _0x44e312=getTrimmedString(_0x1222d4[_0x2e679f(0x16f)+_0x2e679f(0x19b)]);if(!_0x44e312)return null;const _0x1dec7b=getTrimmedString(_0x1222d4[_0x2e679f(0x16f)+'_tz']);return{'kind':_0x5153cd,'expr':_0x44e312,..._0x1dec7b?{'tz':_0x1dec7b}:{}};}if(_0x5153cd===_0x2e679f(0x1a9)){const _0x590a83=toFiniteMs(_0x1222d4[_0x2e679f(0x178)]);if(_0x590a83===undefined)return null;const _0x14725b=toFiniteMs(_0x1222d4[_0x2e679f(0x168)+'s']);return{'kind':_0x5153cd,'everyMs':_0x590a83,..._0x14725b===undefined?{}:{'anchorMs':_0x14725b}};}if(_0x5153cd==='at'){const _0x27df94=getTrimmedString(_0x1222d4['at']);return _0x27df94?{'kind':_0x5153cd,'at':_0x27df94}:null;}return null;}function _0x3a54(){const _0x49da9c=['name','ate_json','3820840MKmcHf','ame\x20FROM','job_json','message','tz,\x0a\x20\x20\x20\x20','\x20\x20\x20\x20\x20job','state','un_at_ms','7spxNTQ','endsWith','COMMIT','ey\x20=\x20?\x20A','\x20store_k','ULL,\x0a\x20\x20\x20','sed-run\x20','_at_ms\x20I','n_at_ms\x20','trim','unning_a','\x20env','10952xTjVYr','\x20gateway','\x20\x20\x20\x20\x20\x20\x20\x20','dist','587pBmIlj','ET\x20next_','68616mXTFdt','\x20\x20\x20\x20\x20\x20AN','info','_jobs\x0a\x20\x20','next_run','skip\x20fai','\x20\x20job_id','nd\x20in\x20','get','anchor_m','string','le\x27\x20AND\x20','\x20schedul','848862QISeLn','\x20at,\x0a\x20\x20\x20','ROM\x20cron','schedule','t_run_at','\x20\x20\x20state','all','\x20sqlite_','cron\x20mis','chor_ms,','ms,\x0a\x20\x20\x20\x20','\x20start','every_ms','\x20LIMIT\x201','ed_at_ms','\x20\x20\x20\x20\x20AND','e\x20=\x20\x27tab','ron_jobs','store_ke','?,\x0a\x20\x20\x20\x20\x20','enabled,','\x20\x20\x20\x20\x20\x20\x20s','ed\x20=\x200,\x0a','cron_job','stringif','\x20=\x20?\x0a\x20\x20\x20','\x20\x20name,\x0a','me_updat','name\x20=\x20?','_kind','logger','\x20\x20\x20\x20\x20\x20st','kind','t_ms\x20=\x20N','_json\x20=\x20','\x20\x20\x20WHERE','\x20NULL,\x0a\x20','2920494zTPtiE','tore_key','\x0a\x20\x20\x20\x20\x20\x20S','ND\x20job_i','ssed\x20run','814wuBqLF','stateDir','dataDir','ning_at_','e_kind,\x0a','_expr','d\x20=\x201\x0a\x20\x20','572245TTDbzx','s\x20=\x20?,\x0a\x20','isFile','importan','\x20\x20\x20\x20\x20\x20an','floor','push','length','\x0a\x20\x20\x20\x20\x20\x20\x20','\x20\x20\x20\x20\x20run','oot','MEDIATE','every','E\x20enable','job_id','386MiHWzk','projectR','close','\x20\x20\x20runti','now',',\x0a\x20\x20\x20\x20\x20\x20','run','isFinite','led','S\x20NULL','<=\x20?\x0a\x20\x20\x20','json,\x0a\x20\x20','UPDATE\x20c','\x20\x20\x20\x20\x20\x20\x20r','s\x20before','.sqlite','\x0a\x20\x20\x20\x20\x20\x20F','exec','ET\x20enabl','openclaw','prepare','d\x20=\x20?','4uQYJis','\x20\x20\x20\x20ever','NULL\x0a\x20\x20\x20','2196daNowI','cron'];_0x3a54=function(){return _0x49da9c;};return _0x3a54();}function patchStateJson(_0x145a2f,_0x39ed9c){const _0x78415d=asRecord(safeJsonParse(_0x145a2f,{}));return JSON['stringif'+'y']({..._0x78415d,'nextRunAtMs':_0x39ed9c,'runningAtMs':undefined});}function patchJobJson(_0x114f2d,{enabled:_0x41a8aa,nextRunAtMs:_0x4b4109}){const _0x5e9a24=_0x280435,_0x4a8111=asRecord(safeJsonParse(_0x114f2d,{})),_0x3be8cf=asRecord(_0x4a8111[_0x5e9a24(0x1cf)]);return JSON[_0x5e9a24(0x184)+'y']({..._0x4a8111,'enabled':_0x41a8aa,'state':{..._0x3be8cf,'nextRunAtMs':_0x4b4109,'runningAtMs':undefined}});}async function loadOpenClawScheduleComputer(_0x5e68cd){const _0x511ed4=_0x280435,_0x546cd8=resolve(_0x5e68cd[_0x511ed4(0x1bf)+'WorkingD'+'ir'],_0x511ed4(0x15c)),_0x30165e=await readdir(_0x546cd8,{'withFileTypes':!![]}),_0x8e77ba=_0x30165e['filter'](_0x93bab5=>_0x93bab5[_0x511ed4(0x19f)]())['map'](_0x15f72e=>_0x15f72e[_0x511ed4(0x1c7)])['filter'](_0x329ec8=>_0x329ec8['startsWi'+'th'](SCHEDULE_MODULE_PREFIX)&&_0x329ec8[_0x511ed4(0x1d2)](SCHEDULE_MODULE_SUFFIX));for(const _0x50af2e of _0x8e77ba){const _0x21a6a3=pathToFileURL(join(_0x546cd8,_0x50af2e))['href'],_0x395333=await import(_0x21a6a3);if(typeof _0x395333['t']==='function')return _0x395333['t'];}throw new Error('OpenClaw'+_0x511ed4(0x16b)+'e\x20module'+'\x20not\x20fou'+_0x511ed4(0x166)+_0x546cd8);}function tableExists(_0x134892){const _0x5915bd=_0x280435,_0x21f8d2=_0x134892[_0x5915bd(0x1c0)]('SELECT\x20n'+_0x5915bd(0x1ca)+_0x5915bd(0x173)+'master\x20W'+'HERE\x20typ'+_0x5915bd(0x17c)+_0x5915bd(0x16a)+_0x5915bd(0x188)+_0x5915bd(0x179))[_0x5915bd(0x167)](CRON_TABLE_NAME);return Boolean(_0x21f8d2);}function readExpiredRows(_0x599524,_0x2c3b83){const _0x3003d9=_0x280435;return _0x599524[_0x3003d9(0x1c0)]('SELECT\x0a\x20'+_0x3003d9(0x181)+_0x3003d9(0x192)+',\x0a\x20\x20\x20\x20\x20\x20'+_0x3003d9(0x165)+_0x3003d9(0x1b1)+_0x3003d9(0x186)+_0x3003d9(0x15b)+_0x3003d9(0x180)+_0x3003d9(0x1a5)+_0x3003d9(0x16b)+_0x3003d9(0x19a)+_0x3003d9(0x15b)+_0x3003d9(0x16f)+'_expr,\x0a\x20'+_0x3003d9(0x181)+'chedule_'+_0x3003d9(0x1cd)+_0x3003d9(0x1c3)+'y_ms,\x0a\x20\x20'+_0x3003d9(0x1a1)+_0x3003d9(0x175)+_0x3003d9(0x1a5)+_0x3003d9(0x16d)+'\x20\x20\x20\x20\x20nex'+_0x3003d9(0x170)+'_ms,\x0a\x20\x20\x20'+_0x3003d9(0x1a6)+_0x3003d9(0x199)+_0x3003d9(0x176)+'\x20\x20\x20\x20job_'+_0x3003d9(0x1b7)+_0x3003d9(0x18b)+_0x3003d9(0x1c8)+_0x3003d9(0x1bc)+_0x3003d9(0x16e)+_0x3003d9(0x162)+'\x20\x20\x20\x20WHER'+_0x3003d9(0x1aa)+_0x3003d9(0x19c)+_0x3003d9(0x160)+'D\x20next_r'+_0x3003d9(0x1d0)+'\x20IS\x20NOT\x20'+_0x3003d9(0x1c4)+_0x3003d9(0x17b)+'\x20next_ru'+_0x3003d9(0x155)+_0x3003d9(0x1b6)+'\x20\x20\x20\x20\x20AND'+'\x20running'+_0x3003d9(0x154)+_0x3003d9(0x1b5))[_0x3003d9(0x172)](_0x2c3b83);}function updateNextRun(_0x14fb07,_0x144b89,_0x1d97ec,_0x476b8d){const _0x4cc52e=_0x280435;_0x14fb07[_0x4cc52e(0x1c0)](_0x4cc52e(0x1b8)+_0x4cc52e(0x17d)+_0x4cc52e(0x193)+_0x4cc52e(0x15e)+'run_at_m'+_0x4cc52e(0x19e)+_0x4cc52e(0x1b9)+_0x4cc52e(0x157)+_0x4cc52e(0x18d)+_0x4cc52e(0x152)+_0x4cc52e(0x1ce)+_0x4cc52e(0x18e)+_0x4cc52e(0x17f)+_0x4cc52e(0x171)+_0x4cc52e(0x18e)+'?,\x0a\x20\x20\x20\x20\x20'+_0x4cc52e(0x1af)+_0x4cc52e(0x187)+_0x4cc52e(0x17a)+_0x4cc52e(0x185)+_0x4cc52e(0x18f)+'\x20store_k'+_0x4cc52e(0x150)+_0x4cc52e(0x194)+_0x4cc52e(0x1c1))[_0x4cc52e(0x1b2)](_0x1d97ec,patchJobJson(_0x144b89[_0x4cc52e(0x1cb)],{'enabled':!![],'nextRunAtMs':_0x1d97ec}),patchStateJson(_0x144b89['state_js'+'on'],_0x1d97ec),_0x476b8d,_0x144b89[_0x4cc52e(0x17e)+'y'],_0x144b89['job_id']);}function _0x1993(_0x1d885e,_0x128a34){_0x1d885e=_0x1d885e-0x14f;const _0x3a54b0=_0x3a54();let _0x19937f=_0x3a54b0[_0x1d885e];return _0x19937f;}function disableExpiredAtRun(_0x26e984,_0x5677d8,_0x19342d){const _0x3dbb49=_0x280435;_0x26e984[_0x3dbb49(0x1c0)](_0x3dbb49(0x1b8)+_0x3dbb49(0x17d)+_0x3dbb49(0x193)+_0x3dbb49(0x1be)+_0x3dbb49(0x182)+_0x3dbb49(0x15b)+_0x3dbb49(0x163)+'_at_ms\x20='+_0x3dbb49(0x190)+_0x3dbb49(0x1b9)+_0x3dbb49(0x157)+_0x3dbb49(0x18d)+_0x3dbb49(0x152)+_0x3dbb49(0x1ce)+_0x3dbb49(0x18e)+_0x3dbb49(0x17f)+_0x3dbb49(0x171)+'_json\x20=\x20'+_0x3dbb49(0x17f)+_0x3dbb49(0x1af)+_0x3dbb49(0x187)+'ed_at_ms'+_0x3dbb49(0x185)+'\x20\x20\x20WHERE'+_0x3dbb49(0x151)+'ey\x20=\x20?\x20A'+_0x3dbb49(0x194)+_0x3dbb49(0x1c1))[_0x3dbb49(0x1b2)](patchJobJson(_0x5677d8[_0x3dbb49(0x1cb)],{'enabled':![],'nextRunAtMs':undefined}),patchStateJson(_0x5677d8['state_js'+'on'],undefined),_0x19342d,_0x5677d8[_0x3dbb49(0x17e)+'y'],_0x5677d8[_0x3dbb49(0x1ab)]);}export async function skipMissedCronRunsBeforeGatewayStart(_0x50af64,_0xb3ea0b={}){const _0x4eab72=_0x280435;if(process.env.WUJIE_SHELL_SKIP_MISSED_CRON_RUNS==='0')return _0xb3ea0b[_0x4eab72(0x18a)]?.[_0x4eab72(0x161)]?.({'enabled':![]},_0x4eab72(0x174)+_0x4eab72(0x153)+'skip\x20dis'+'abled\x20by'+_0x4eab72(0x158)),{'skipped':0x0,'inspected':0x0,'disabled':!![]};const _0x5c40d8=getTrimmedString(_0xb3ea0b[_0x4eab72(0x197)])||_0x50af64[_0x4eab72(0x198)],_0x285ac7=join(_0x5c40d8,_0x4eab72(0x1cf),CRON_DB_FILE);if(!existsSync(_0x285ac7))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x11f6a6=toFiniteMs(_0xb3ea0b['nowMs'])??Date['now'](),_0x116876=Date[_0x4eab72(0x1b0)]();let _0x3f3f22;try{_0x3f3f22=new DatabaseSync(_0x285ac7);if(!tableExists(_0x3f3f22))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x3c01b5=readExpiredRows(_0x3f3f22,_0x11f6a6);if(_0x3c01b5['length']===0x0)return{'skipped':0x0,'inspected':0x0};const _0x12f229=await loadRuntimeInfo(_0x50af64[_0x4eab72(0x1ad)+_0x4eab72(0x1a7)]),_0x42d563=await loadOpenClawScheduleComputer(_0x12f229);let _0x4efedb=0x0;const _0x56c065=[];_0x3f3f22[_0x4eab72(0x1bd)]('BEGIN\x20IM'+_0x4eab72(0x1a8));try{for(const _0x2b2c2e of _0x3c01b5){const _0x55ab62=createScheduleFromRow(_0x2b2c2e);if(!_0x55ab62)continue;let _0x103fc7;try{_0x103fc7=_0x42d563(_0x55ab62,_0x11f6a6);}catch(_0x4313cf){_0x56c065[_0x4eab72(0x1a3)]({'jobId':_0x2b2c2e[_0x4eab72(0x1ab)],'message':_0x4313cf instanceof Error?_0x4313cf['message']:String(_0x4313cf)});continue;}if(!Number[_0x4eab72(0x1b3)](_0x103fc7)||_0x103fc7<=_0x11f6a6){_0x55ab62[_0x4eab72(0x18c)]==='at'&&(disableExpiredAtRun(_0x3f3f22,_0x2b2c2e,_0x116876),_0x4efedb+=0x1);continue;}updateNextRun(_0x3f3f22,_0x2b2c2e,Math[_0x4eab72(0x1a2)](_0x103fc7),_0x116876),_0x4efedb+=0x1;}_0x3f3f22[_0x4eab72(0x1bd)](_0x4eab72(0x14f));}catch(_0x3cef1b){_0x3f3f22[_0x4eab72(0x1bd)]('ROLLBACK');throw _0x3cef1b;}return(_0x4efedb>0x0||_0x56c065[_0x4eab72(0x1a4)]>0x0)&&_0xb3ea0b[_0x4eab72(0x18a)]?.[_0x4eab72(0x1a0)+'t']?.({'dbPath':_0x285ac7,'inspected':_0x3c01b5[_0x4eab72(0x1a4)],'skipped':_0x4efedb,'failures':_0x56c065},'cron:\x20sk'+'ipped\x20mi'+_0x4eab72(0x195)+_0x4eab72(0x1ba)+_0x4eab72(0x15a)+_0x4eab72(0x177)),{'skipped':_0x4efedb,'inspected':_0x3c01b5[_0x4eab72(0x1a4)],'failures':_0x56c065};}catch(_0x43af4b){return _0xb3ea0b['logger']?.['warn']?.('cron\x20mis'+_0x4eab72(0x153)+_0x4eab72(0x164)+_0x4eab72(0x1b4),{'dbPath':_0x285ac7,'error':_0x43af4b instanceof Error?_0x43af4b[_0x4eab72(0x1cc)]:String(_0x43af4b)}),{'skipped':0x0,'inspected':0x0,'error':_0x43af4b};}finally{_0x3f3f22?.[_0x4eab72(0x1ae)]();}}
1
+ function _0x4162(_0x3788a3,_0x2fe6a7){_0x3788a3=_0x3788a3-0x173;const _0x14ddeb=_0x14dd();let _0x41621a=_0x14ddeb[_0x3788a3];return _0x41621a;}const _0x472a21=_0x4162;function _0x14dd(){const _0x5ca58d=['d\x20=\x201\x0a\x20\x20','946383Uonnag','_json\x20=\x20','t_run_at','\x20\x20job_id','1048134fHTeTz','nowMs','length','exec',',\x0a\x20\x20\x20\x20\x20\x20','e_kind,\x0a','WorkingD','5iOROeH','chor_ms,','ET\x20enabl','UPDATE\x20c','endsWith','2417724WvAdPz','.sqlite','SELECT\x0a\x20','ROLLBACK','filter','close','message','<=\x20?\x0a\x20\x20\x20','_tz','ed\x20=\x200,\x0a','\x20\x20\x20runti','ron_jobs','e\x20module','_expr','OpenClaw','skip\x20fai','e\x20=\x20\x27tab','\x20\x20\x20\x20\x20\x20st','unning_a','run','\x20\x20\x20state','run_at_m','t_ms\x20=\x20N','HERE\x20typ','BEGIN\x20IM','5180336SHCSpc','\x20running','schedule','master\x20W','E\x20enable','prepare','\x20env','n_at_ms\x20','floor','2205896LgOuPS','info','\x20NULL,\x0a\x20','warn','\x20gateway','.js','sed-run\x20','tz,\x0a\x20\x20\x20\x20','MEDIATE','oot','cron:\x20sk','\x20\x20\x20\x20\x20\x20\x20s','json,\x0a\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20','me_updat','job_id','\x20next_ru','stateDir','tore_key','un_at_ms','\x20start','ipped\x20mi','\x20not\x20fou','\x20IS\x20NOT\x20','ms,\x0a\x20\x20\x20\x20','isFile','\x0a\x20\x20\x20\x20\x20\x20F','store_ke','4477240vlyJTD','\x20\x20\x20\x20\x20run','NULL\x0a\x20\x20\x20','parse','name\x20=\x20?','function','push','logger','enabled,','\x20store_k','\x20\x20\x20\x20\x20AND','ROM\x20cron','next_run','?,\x0a\x20\x20\x20\x20\x20','\x20\x20\x20\x20ever','every','ey\x20=\x20?\x20A','ed_at_ms','S\x20NULL','anchor_m','d\x20=\x20?','cron_job','\x20\x20\x20\x20WHER','abled\x20by','\x20\x20\x20\x20\x20\x20\x20r','16KLxNHn','importan','job_json','y_ms,\x0a\x20\x20','get','_kind','\x20at,\x0a\x20\x20\x20','ULL,\x0a\x20\x20\x20','8nhtVpU','\x20\x20\x20\x20\x20\x20\x20\x20','SELECT\x20n','\x20\x20\x20\x20job_','\x20schedul','\x20sqlite_','ning_at_','\x20\x20\x20WHERE','D\x20next_r','projectR','isFinite','state_js','led','ssed\x20run','ate_json','ND\x20job_i','235215ilAmbO','ET\x20next_','cron\x20mis','_at_ms\x20=','10RtTpaD','\x20\x20\x20\x20\x20\x20AN','\x20=\x20?\x0a\x20\x20\x20','chedule_','stringif'];_0x14dd=function(){return _0x5ca58d;};return _0x14dd();}(function(_0x1ac8f9,_0x1d581d){const _0xd8afc4=_0x4162,_0x42526f=_0x1ac8f9();while(!![]){try{const _0x461eeb=-parseInt(_0xd8afc4(0x183))/0x1*(-parseInt(_0xd8afc4(0x187))/0x2)+-parseInt(_0xd8afc4(0x18d))/0x3*(-parseInt(_0xd8afc4(0x1f4))/0x4)+-parseInt(_0xd8afc4(0x198))/0x5*(-parseInt(_0xd8afc4(0x191))/0x6)+-parseInt(_0xd8afc4(0x1b6))/0x7+parseInt(_0xd8afc4(0x173))/0x8*(-parseInt(_0xd8afc4(0x19d))/0x9)+-parseInt(_0xd8afc4(0x1db))/0xa+-parseInt(_0xd8afc4(0x1bf))/0xb;if(_0x461eeb===_0x1d581d)break;else _0x42526f['push'](_0x42526f['shift']());}catch(_0x3883be){_0x42526f['push'](_0x42526f['shift']());}}}(_0x14dd,0xe9510));import{existsSync}from'node:fs';import{readdir}from'node:fs/promises';import{DatabaseSync}from'node:sqlite';import{join,resolve}from'node:path';import{pathToFileURL}from'node:url';import{asRecord,getTrimmedString}from'../common/utils.mjs';import{loadRuntimeInfo}from'./index.mjs';const CRON_DB_FILE='openclaw'+_0x472a21(0x19e),CRON_TABLE_NAME=_0x472a21(0x1f0)+'s',SCHEDULE_MODULE_PREFIX='schedule'+'-',SCHEDULE_MODULE_SUFFIX=_0x472a21(0x1c4);function toFiniteMs(_0x27d799){const _0x2185a6=_0x472a21,_0x159f21=Number(_0x27d799);return Number[_0x2185a6(0x17d)](_0x159f21)?_0x159f21:undefined;}function safeJsonParse(_0x3b68a0,_0x32b709={}){const _0x351205=_0x472a21;if(typeof _0x3b68a0!=='string'||!_0x3b68a0['trim']())return _0x32b709;try{return JSON[_0x351205(0x1de)](_0x3b68a0);}catch{return _0x32b709;}}function createScheduleFromRow(_0x172646){const _0x3b0844=_0x472a21,_0xa0f320=getTrimmedString(_0x172646[_0x3b0844(0x1b8)+_0x3b0844(0x1f9)]);if(_0xa0f320==='cron'){const _0x458b1c=getTrimmedString(_0x172646[_0x3b0844(0x1b8)+_0x3b0844(0x1aa)]);if(!_0x458b1c)return null;const _0x4b76c6=getTrimmedString(_0x172646[_0x3b0844(0x1b8)+_0x3b0844(0x1a5)]);return{'kind':_0xa0f320,'expr':_0x458b1c,..._0x4b76c6?{'tz':_0x4b76c6}:{}};}if(_0xa0f320===_0x3b0844(0x1ea)){const _0x464e0e=toFiniteMs(_0x172646['every_ms']);if(_0x464e0e===undefined)return null;const _0x3ccb35=toFiniteMs(_0x172646[_0x3b0844(0x1ee)+'s']);return{'kind':_0xa0f320,'everyMs':_0x464e0e,..._0x3ccb35===undefined?{}:{'anchorMs':_0x3ccb35}};}if(_0xa0f320==='at'){const _0x285ed4=getTrimmedString(_0x172646['at']);return _0x285ed4?{'kind':_0xa0f320,'at':_0x285ed4}:null;}return null;}function patchStateJson(_0x4714ef,_0x48dbf2){const _0x3b27a0=_0x472a21,_0x2524c8=asRecord(safeJsonParse(_0x4714ef,{}));return JSON[_0x3b27a0(0x18b)+'y']({..._0x2524c8,'nextRunAtMs':_0x48dbf2,'runningAtMs':undefined});}function patchJobJson(_0xc8d04d,{enabled:_0x5ad7e0,nextRunAtMs:_0x106bdc}){const _0x16f6a3=asRecord(safeJsonParse(_0xc8d04d,{})),_0xfb21d5=asRecord(_0x16f6a3['state']);return JSON['stringif'+'y']({..._0x16f6a3,'enabled':_0x5ad7e0,'state':{..._0xfb21d5,'nextRunAtMs':_0x106bdc,'runningAtMs':undefined}});}async function loadOpenClawScheduleComputer(_0x5e3018){const _0x12e444=_0x472a21,_0xefafdc=resolve(_0x5e3018['openclaw'+_0x12e444(0x197)+'ir'],'dist'),_0x3c642e=await readdir(_0xefafdc,{'withFileTypes':!![]}),_0x5a8612=_0x3c642e[_0x12e444(0x1a1)](_0x58fc7b=>_0x58fc7b[_0x12e444(0x1d8)]())['map'](_0x47d51f=>_0x47d51f['name'])[_0x12e444(0x1a1)](_0x418d9f=>_0x418d9f['startsWi'+'th'](SCHEDULE_MODULE_PREFIX)&&_0x418d9f[_0x12e444(0x19c)](SCHEDULE_MODULE_SUFFIX));for(const _0x1f32b1 of _0x5a8612){const _0x5c40fa=pathToFileURL(join(_0xefafdc,_0x1f32b1))['href'],_0x489b3a=await import(_0x5c40fa);if(typeof _0x489b3a['t']===_0x12e444(0x1e0))return _0x489b3a['t'];}throw new Error(_0x12e444(0x1ab)+_0x12e444(0x177)+_0x12e444(0x1a9)+_0x12e444(0x1d5)+'nd\x20in\x20'+_0xefafdc);}function tableExists(_0x54d4e6){const _0x1a9858=_0x472a21,_0x555efe=_0x54d4e6[_0x1a9858(0x1bb)](_0x1a9858(0x175)+'ame\x20FROM'+_0x1a9858(0x178)+_0x1a9858(0x1b9)+_0x1a9858(0x1b4)+_0x1a9858(0x1ad)+'le\x27\x20AND\x20'+_0x1a9858(0x1df)+'\x20LIMIT\x201')[_0x1a9858(0x1f8)](CRON_TABLE_NAME);return Boolean(_0x555efe);}function readExpiredRows(_0x5d0609,_0x1ad6f8){const _0x582b66=_0x472a21;return _0x5d0609[_0x582b66(0x1bb)](_0x582b66(0x19f)+_0x582b66(0x1ca)+_0x582b66(0x1d1)+_0x582b66(0x195)+_0x582b66(0x190)+_0x582b66(0x195)+'\x20\x20name,\x0a'+_0x582b66(0x174)+_0x582b66(0x1e3)+_0x582b66(0x1cc)+'\x20schedul'+_0x582b66(0x196)+_0x582b66(0x174)+'schedule'+'_expr,\x0a\x20'+_0x582b66(0x1ca)+_0x582b66(0x18a)+_0x582b66(0x1c6)+_0x582b66(0x1e9)+_0x582b66(0x1f7)+'\x20\x20\x20\x20\x20\x20an'+_0x582b66(0x199)+_0x582b66(0x1cc)+_0x582b66(0x1fa)+'\x20\x20\x20\x20\x20nex'+_0x582b66(0x18f)+'_ms,\x0a\x20\x20\x20'+_0x582b66(0x1dc)+_0x582b66(0x179)+_0x582b66(0x1d7)+_0x582b66(0x176)+_0x582b66(0x1cb)+_0x582b66(0x1ae)+_0x582b66(0x181)+_0x582b66(0x1d9)+_0x582b66(0x1e6)+'_jobs\x0a\x20\x20'+_0x582b66(0x1f1)+_0x582b66(0x1ba)+_0x582b66(0x18c)+_0x582b66(0x188)+_0x582b66(0x17b)+_0x582b66(0x1d2)+_0x582b66(0x1d6)+_0x582b66(0x1dd)+_0x582b66(0x1e5)+_0x582b66(0x1cf)+_0x582b66(0x1bd)+_0x582b66(0x1a4)+'\x20\x20\x20\x20\x20AND'+_0x582b66(0x1b7)+'_at_ms\x20I'+_0x582b66(0x1ed))['all'](_0x1ad6f8);}function updateNextRun(_0x86b88a,_0x195d8b,_0x3e3e3a,_0xc11669){const _0x126dcd=_0x472a21;_0x86b88a[_0x126dcd(0x1bb)]('UPDATE\x20c'+_0x126dcd(0x1a8)+'\x0a\x20\x20\x20\x20\x20\x20S'+_0x126dcd(0x184)+_0x126dcd(0x1b2)+'s\x20=\x20?,\x0a\x20'+_0x126dcd(0x1f3)+_0x126dcd(0x1af)+_0x126dcd(0x1b3)+'ULL,\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20job'+_0x126dcd(0x18e)+'?,\x0a\x20\x20\x20\x20\x20'+_0x126dcd(0x1b1)+_0x126dcd(0x18e)+_0x126dcd(0x1e8)+_0x126dcd(0x1a7)+_0x126dcd(0x1cd)+'ed_at_ms'+'\x20=\x20?\x0a\x20\x20\x20'+_0x126dcd(0x17a)+_0x126dcd(0x1e4)+_0x126dcd(0x1eb)+_0x126dcd(0x182)+_0x126dcd(0x1ef))[_0x126dcd(0x1b0)](_0x3e3e3a,patchJobJson(_0x195d8b[_0x126dcd(0x1f6)],{'enabled':!![],'nextRunAtMs':_0x3e3e3a}),patchStateJson(_0x195d8b[_0x126dcd(0x17e)+'on'],_0x3e3e3a),_0xc11669,_0x195d8b[_0x126dcd(0x1da)+'y'],_0x195d8b[_0x126dcd(0x1ce)]);}function disableExpiredAtRun(_0x310fab,_0x31cd16,_0x4b592d){const _0xc4eb11=_0x472a21;_0x310fab[_0xc4eb11(0x1bb)](_0xc4eb11(0x19b)+_0xc4eb11(0x1a8)+'\x0a\x20\x20\x20\x20\x20\x20S'+_0xc4eb11(0x19a)+_0xc4eb11(0x1a6)+'\x20\x20\x20\x20\x20\x20\x20\x20'+_0xc4eb11(0x1e7)+_0xc4eb11(0x186)+_0xc4eb11(0x1c1)+_0xc4eb11(0x1f3)+'unning_a'+'t_ms\x20=\x20N'+_0xc4eb11(0x1fb)+'\x20\x20\x20\x20\x20job'+_0xc4eb11(0x18e)+_0xc4eb11(0x1e8)+_0xc4eb11(0x1b1)+_0xc4eb11(0x18e)+_0xc4eb11(0x1e8)+_0xc4eb11(0x1a7)+_0xc4eb11(0x1cd)+_0xc4eb11(0x1ec)+_0xc4eb11(0x189)+'\x20\x20\x20WHERE'+_0xc4eb11(0x1e4)+_0xc4eb11(0x1eb)+_0xc4eb11(0x182)+_0xc4eb11(0x1ef))[_0xc4eb11(0x1b0)](patchJobJson(_0x31cd16['job_json'],{'enabled':![],'nextRunAtMs':undefined}),patchStateJson(_0x31cd16[_0xc4eb11(0x17e)+'on'],undefined),_0x4b592d,_0x31cd16[_0xc4eb11(0x1da)+'y'],_0x31cd16[_0xc4eb11(0x1ce)]);}export async function skipMissedCronRunsBeforeGatewayStart(_0x357d1b,_0x233472={}){const _0x4a0f34=_0x472a21;if(process.env.WUJIE_SHELL_SKIP_MISSED_CRON_RUNS==='0')return _0x233472[_0x4a0f34(0x1e2)]?.[_0x4a0f34(0x1c0)]?.({'enabled':![]},_0x4a0f34(0x185)+_0x4a0f34(0x1c5)+'skip\x20dis'+_0x4a0f34(0x1f2)+_0x4a0f34(0x1bc)),{'skipped':0x0,'inspected':0x0,'disabled':!![]};const _0x4eea01=getTrimmedString(_0x233472[_0x4a0f34(0x1d0)])||_0x357d1b['dataDir'],_0x51d502=join(_0x4eea01,'state',CRON_DB_FILE);if(!existsSync(_0x51d502))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x382a73=toFiniteMs(_0x233472[_0x4a0f34(0x192)])??Date['now'](),_0x22cc50=Date['now']();let _0x59d32a;try{_0x59d32a=new DatabaseSync(_0x51d502);if(!tableExists(_0x59d32a))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x7e6afe=readExpiredRows(_0x59d32a,_0x382a73);if(_0x7e6afe[_0x4a0f34(0x193)]===0x0)return{'skipped':0x0,'inspected':0x0};const _0x4afe0a=await loadRuntimeInfo(_0x357d1b[_0x4a0f34(0x17c)+_0x4a0f34(0x1c8)]),_0x339581=await loadOpenClawScheduleComputer(_0x4afe0a);let _0x354576=0x0;const _0x404077=[];_0x59d32a[_0x4a0f34(0x194)](_0x4a0f34(0x1b5)+_0x4a0f34(0x1c7));try{for(const _0x3342f4 of _0x7e6afe){const _0x2f4338=createScheduleFromRow(_0x3342f4);if(!_0x2f4338)continue;let _0x34054d;try{_0x34054d=_0x339581(_0x2f4338,_0x382a73);}catch(_0x260b29){_0x404077[_0x4a0f34(0x1e1)]({'jobId':_0x3342f4[_0x4a0f34(0x1ce)],'message':_0x260b29 instanceof Error?_0x260b29[_0x4a0f34(0x1a3)]:String(_0x260b29)});continue;}if(!Number[_0x4a0f34(0x17d)](_0x34054d)||_0x34054d<=_0x382a73){_0x2f4338['kind']==='at'&&(disableExpiredAtRun(_0x59d32a,_0x3342f4,_0x22cc50),_0x354576+=0x1);continue;}updateNextRun(_0x59d32a,_0x3342f4,Math[_0x4a0f34(0x1be)](_0x34054d),_0x22cc50),_0x354576+=0x1;}_0x59d32a[_0x4a0f34(0x194)]('COMMIT');}catch(_0x2c9f32){_0x59d32a[_0x4a0f34(0x194)](_0x4a0f34(0x1a0));throw _0x2c9f32;}return(_0x354576>0x0||_0x404077[_0x4a0f34(0x193)]>0x0)&&_0x233472[_0x4a0f34(0x1e2)]?.[_0x4a0f34(0x1f5)+'t']?.({'dbPath':_0x51d502,'inspected':_0x7e6afe[_0x4a0f34(0x193)],'skipped':_0x354576,'failures':_0x404077},_0x4a0f34(0x1c9)+_0x4a0f34(0x1d4)+_0x4a0f34(0x180)+'s\x20before'+_0x4a0f34(0x1c3)+_0x4a0f34(0x1d3)),{'skipped':_0x354576,'inspected':_0x7e6afe[_0x4a0f34(0x193)],'failures':_0x404077};}catch(_0x5f5d41){return _0x233472['logger']?.[_0x4a0f34(0x1c2)]?.(_0x4a0f34(0x185)+'sed-run\x20'+_0x4a0f34(0x1ac)+_0x4a0f34(0x17f),{'dbPath':_0x51d502,'error':_0x5f5d41 instanceof Error?_0x5f5d41[_0x4a0f34(0x1a3)]:String(_0x5f5d41)}),{'skipped':0x0,'inspected':0x0,'error':_0x5f5d41};}finally{_0x59d32a?.[_0x4a0f34(0x1a2)]();}}
@@ -1 +1 @@
1
- const _0x3d918c=_0x1d92;(function(_0x1ac0b9,_0x4fb2e9){const _0x513519=_0x1d92,_0x9c2d43=_0x1ac0b9();while(!![]){try{const _0x508069=-parseInt(_0x513519(0x11b))/0x1+-parseInt(_0x513519(0x2a0))/0x2*(-parseInt(_0x513519(0x26d))/0x3)+-parseInt(_0x513519(0x1d6))/0x4*(-parseInt(_0x513519(0x126))/0x5)+parseInt(_0x513519(0x2b2))/0x6+-parseInt(_0x513519(0x1b3))/0x7+parseInt(_0x513519(0x200))/0x8*(-parseInt(_0x513519(0x299))/0x9)+parseInt(_0x513519(0x1ec))/0xa;if(_0x508069===_0x4fb2e9)break;else _0x9c2d43['push'](_0x9c2d43['shift']());}catch(_0x26a9f0){_0x9c2d43['push'](_0x9c2d43['shift']());}}}(_0x4fd9,0xbd75f));import{existsSync}from'node:fs';function _0x1d92(_0xe049b7,_0x544037){_0xe049b7=_0xe049b7-0x95;const _0x4fd9ec=_0x4fd9();let _0x1d92b8=_0x4fd9ec[_0xe049b7];return _0x1d92b8;}import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rename,rm,stat,symlink,writeFile}from'node:fs/promises';import{basename,delimiter,dirname,join,extname,parse,relative,resolve}from'node:path';import{fileURLToPath,pathToFileURL}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'../common/utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'../common/runtime-logger.mjs';import{hasConfiguredKdocsSkill,installKdocsCliBinary}from'../connectors/kdocs-cli.mjs';import{installRuntimeLarkCliPackage,resolveRuntimeLarkCliCommand}from'../connectors/lark-cli.mjs';import{patchMixedToolContentFromSource}from'./patch-chat-history-mixed-tool-content.mjs';import{patchChannelPluginRuntimeFromSource}from'./patch-channel-plugin-runtime.mjs';import{patchProviderRequestIdHeaderFromSource}from'./patch-provider-request-id-header.mjs';import{patchSessionStoreLoadFromSource,patchSessionStoreWriteFromSource}from'./patch-session-store-sqlite.mjs';import{patchQQBotOutboundFallbackFromSource,patchQQBotOutboundSessionRouteFromSource}from'./patch-qqbot-outbound-session-route.mjs';import{patchWeixinOutboundFallbackFromSource,patchWeixinOutboundSessionRouteFromSource}from'./patch-weixin-outbound-session-route.mjs';import{patchRequestIdTitleRuntimeFromSource}from'./patch-request-id-title-runtime.mjs';const RUNTIME_DIR=_0x3d918c(0x2ee)+_0x3d918c(0xef),MANIFEST_NAME=_0x3d918c(0x27c)+_0x3d918c(0x209)+_0x3d918c(0xbf),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x4be870){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x4be870,RUNTIME_DIR);}export function resolveManifestPath(_0x576ce1){return join(_0x576ce1,MANIFEST_NAME);}async function loadProductRuntime(_0x3354f4,_0x70e727){const _0x3bf8a9=_0x3d918c,_0x317b82=[join(_0x3354f4,_0x3bf8a9(0x181)+_0x3bf8a9(0x25d),_0x3bf8a9(0x18d)+'s'),join(_0x70e727,'shell-ru'+_0x3bf8a9(0x25d),'index.mj'+'s')];for(const _0x379097 of _0x317b82){if(!existsSync(_0x379097))continue;return await import(pathToFileURL(_0x379097)[_0x3bf8a9(0x178)]+_0x3bf8a9(0x19c)+Date['now']());}return{};}export async function prepareRuntime(_0x172163,{syncOnly:syncOnly=![],pruneForPackaging:pruneForPackaging=![]}={}){const _0x4062b0=_0x3d918c,_0x2ddd94=resolveRuntimeRoot(_0x172163[_0x4062b0(0x149)+_0x4062b0(0x302)]),_0x16703e=createRuntimeLogger(getConfigPaths(_0x172163),'runtime'),_0x5f04e2=Date[_0x4062b0(0x242)]();_0x16703e?.[_0x4062b0(0x143)+'t']?.('prepare\x20'+'runtime\x20'+'started',{'syncOnly':syncOnly,'runtimeRoot':_0x2ddd94,'shellConfig':summarizeShellConfig(_0x172163)});try{const _0x24ecbd=await ensureRuntimeBase(_0x172163,_0x2ddd94,{'runtimeLogger':_0x16703e,'syncOnly':syncOnly});_0x16703e?.[_0x4062b0(0x143)+'t']?.('runtime\x20'+'manifest'+_0x4062b0(0x2c6),{'manifestPath':resolveManifestPath(_0x2ddd94),'manifest':summarizeRuntimeManifest(_0x24ecbd)}),validateRuntimeNodeVersion(_0x24ecbd,_0x172163),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x1eb)+_0x4062b0(0x10d)+'sion\x20val'+_0x4062b0(0x2fc),{'nodeVersion':_0x24ecbd[_0x4062b0(0x232)+_0x4062b0(0x156)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x24ecbd,_0x172163),_0x16703e?.[_0x4062b0(0x143)+'t']?.('runtime\x20'+'openclaw'+_0x4062b0(0x19a)+_0x4062b0(0x227)+'ed',{'openclawVersion':_0x24ecbd[_0x4062b0(0x21d)+'Version']});else{if(_0x24ecbd['openclaw'+_0x4062b0(0x323)]!==_0x172163['openclaw'][_0x4062b0(0x21d)+'Version']){const _0x25b85b=await loadRuntimeInfo(_0x172163[_0x4062b0(0x149)+_0x4062b0(0x302)]);_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x21d)+_0x4062b0(0x2f2)+_0x4062b0(0xa0)+'\x20started',{'fromVersion':_0x24ecbd[_0x4062b0(0x21d)+'Version']||_0x4062b0(0xa5),'toVersion':_0x172163['openclaw'][_0x4062b0(0x21d)+_0x4062b0(0x323)]}),await installOpenClawPackage(_0x25b85b,_0x172163[_0x4062b0(0x21d)][_0x4062b0(0x21d)+_0x4062b0(0x323)]),_0x24ecbd[_0x4062b0(0x21d)+_0x4062b0(0x323)]=_0x172163[_0x4062b0(0x21d)]['openclaw'+_0x4062b0(0x323)],_0x16703e?.['importan'+'t']?.(_0x4062b0(0x21d)+_0x4062b0(0x2f2)+_0x4062b0(0xa0)+'\x20complet'+'ed',{'openclawVersion':_0x24ecbd[_0x4062b0(0x21d)+_0x4062b0(0x323)]});}}_0x24ecbd[_0x4062b0(0x318)+'dAt']=new Date()[_0x4062b0(0xb8)+'ing'](),_0x24ecbd[_0x4062b0(0x232)+_0x4062b0(0x156)]=_0x172163[_0x4062b0(0x21d)][_0x4062b0(0x232)+_0x4062b0(0x156)],_0x24ecbd[_0x4062b0(0x1c5)]={'appId':_0x172163[_0x4062b0(0x17b)],'productName':_0x172163['productN'+_0x4062b0(0x257)],'dataDirName':_0x172163[_0x4062b0(0xb7)+_0x4062b0(0x257)]},await patchChatHistoryMixedToolContentBug(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await patchProviderRequestIdHeader(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await patchChannelPluginRuntimeBug(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await patchWeixinOutboundFallbackRuntime(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await patchQQBotOutboundFallbackRuntime(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e});const _0x40b745=await loadProductRuntime(_0x172163['projectR'+'oot'],_0x2ddd94);if(typeof _0x40b745[_0x4062b0(0xd1)+_0x4062b0(0x1b5)+_0x4062b0(0x25d)]===_0x4062b0(0x202)){const _0x5e9528=createRuntimeInfoFromManifest(_0x2ddd94,_0x24ecbd);await _0x40b745[_0x4062b0(0xd1)+'roductRu'+_0x4062b0(0x25d)]({'shellConfig':_0x172163,'runtime':_0x5e9528,'runtimeLogger':_0x16703e,'syncOnly':syncOnly}),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x99)+_0x4062b0(0x1eb)+_0x4062b0(0x1a9)+'nced');}await patchSessionStoreSqliteRuntime(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await patchRequestIdTitleRuntime(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e});!syncOnly&&(await installRuntimeLarkCliPackage(createRuntimeInfoFromManifest(_0x2ddd94,_0x24ecbd),{'runtimeLogger':_0x16703e,'createRuntimeEnv':createRuntimeEnv}),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x11a)+_0x4062b0(0x1ab)+'\x20package'+_0x4062b0(0x141)),await hasConfiguredKdocsSkill(_0x172163)?(await installKdocsCliBinary(_0x172163,createRuntimeInfoFromManifest(_0x2ddd94,_0x24ecbd),{'runtimeLogger':_0x16703e,'syncOnly':syncOnly}),_0x16703e?.['importan'+'t']?.('connecto'+_0x4062b0(0x142)+'e\x20tools\x20'+_0x4062b0(0x15a))):_0x16703e?.[_0x4062b0(0xc9)]('connecto'+_0x4062b0(0x142)+_0x4062b0(0x25e)+'skipped;'+_0x4062b0(0x291)+_0x4062b0(0x1b8)+_0x4062b0(0x316)+'red'));const _0x1254aa=Array['isArray'](_0x24ecbd[_0x4062b0(0x218)])?_0x24ecbd['plugins']['length']:0x0;return await syncManifestPluginScope(_0x172163,_0x2ddd94,_0x24ecbd),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x1eb)+_0x4062b0(0x2ea)+_0x4062b0(0x16f)+_0x4062b0(0xff),{'beforePluginCount':_0x1254aa,'afterPluginCount':Array['isArray'](_0x24ecbd['plugins'])?_0x24ecbd[_0x4062b0(0x218)][_0x4062b0(0xde)]:0x0,'pluginSpecCount':Array['isArray'](_0x24ecbd['pluginSp'+_0x4062b0(0xbb)])?_0x24ecbd[_0x4062b0(0x23e)+_0x4062b0(0xbb)]['length']:0x0}),await syncConfiguredNpmPlugins(_0x172163,_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e,'syncOnly':syncOnly}),_0x16703e?.['importan'+'t']?.(_0x4062b0(0x24e)+_0x4062b0(0x324)+_0x4062b0(0x1de)+_0x4062b0(0x146),{'pluginSpecCount':_0x172163[_0x4062b0(0x21d)][_0x4062b0(0x23e)+_0x4062b0(0xbb)][_0x4062b0(0xde)],'pluginCount':Array['isArray'](_0x24ecbd[_0x4062b0(0x218)])?_0x24ecbd['plugins'][_0x4062b0(0xde)]:0x0}),await patchWeixinOutboundSessionRoute(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await patchQQBotOutboundSessionRoute(_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),await syncProductPlugins(_0x172163,_0x2ddd94,_0x24ecbd,{'runtimeLogger':_0x16703e}),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x99)+_0x4062b0(0x123)+'synced',{'localPluginCount':_0x172163['openclaw'][_0x4062b0(0x214)+_0x4062b0(0x20f)+'ginPaths'][_0x4062b0(0xde)],'pluginCount':Array[_0x4062b0(0x233)](_0x24ecbd[_0x4062b0(0x218)])?_0x24ecbd[_0x4062b0(0x218)][_0x4062b0(0xde)]:0x0}),await syncProductAgents(_0x172163,_0x2ddd94,_0x24ecbd),_0x16703e?.['importan'+'t']?.('product\x20'+_0x4062b0(0x2c4)+'ynced',{'sources':_0x172163['openclaw']['resolved'+_0x4062b0(0x139)+_0x4062b0(0x1db)],'entryCount':_0x24ecbd[_0x4062b0(0x337)]?.[_0x4062b0(0xe2)+'nt'],'installPath':_0x24ecbd[_0x4062b0(0x337)]?.[_0x4062b0(0x100)+_0x4062b0(0x2c9)]}),await syncProductSkills(_0x172163,_0x2ddd94,_0x24ecbd),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x99)+_0x4062b0(0x117)+'ynced',{'sources':_0x172163[_0x4062b0(0x21d)][_0x4062b0(0x214)+_0x4062b0(0x2bf)+'llPaths'],'entryCount':_0x24ecbd['skills']?.[_0x4062b0(0xe2)+'nt'],'installPath':_0x24ecbd['skills']?.[_0x4062b0(0x100)+_0x4062b0(0x2c9)]}),await syncRuntimeWrapper(_0x172163,_0x2ddd94,_0x24ecbd),_0x16703e?.[_0x4062b0(0x143)+'t']?.(_0x4062b0(0x1eb)+'wrapper\x20'+_0x4062b0(0x15a),{'wujieclawBin':_0x24ecbd[_0x4062b0(0x1f5)+'wBin']}),await prunePackagedRuntimeCaches(_0x2ddd94,_0x16703e),pruneForPackaging&&await prunePackagedRuntimePayload(_0x2ddd94,_0x24ecbd,_0x16703e),await writeJson(resolveManifestPath(_0x2ddd94),_0x24ecbd),_0x16703e?.['importan'+'t']?.('runtime\x20'+_0x4062b0(0x209)+_0x4062b0(0x1d2),{'manifestPath':resolveManifestPath(_0x2ddd94),'manifest':summarizeRuntimeManifest(_0x24ecbd),'durationMs':Date[_0x4062b0(0x242)]()-_0x5f04e2}),await _0x16703e?.['flush'](),_0x24ecbd;}catch(_0x366dcd){_0x16703e?.[_0x4062b0(0x2aa)](_0x4062b0(0x189)+'runtime\x20'+_0x4062b0(0xd8),{'syncOnly':syncOnly,'runtimeRoot':_0x2ddd94,'durationMs':Date['now']()-_0x5f04e2,'error':_0x366dcd}),await _0x16703e?.['flush']();throw _0x366dcd;}}async function prunePackagedRuntimeCaches(_0xa00abc,_0x42c60b){const _0x2327c1=_0x3d918c,_0x59b877=[join(_0xa00abc,_0x2327c1(0x333)),join(_0xa00abc,_0x2327c1(0x1df),_0x2327c1(0x16e)+'e'),join(_0xa00abc,_0x2327c1(0x2e1)+'time-bac'+_0x2327c1(0x14a)),join(_0xa00abc,_0x2327c1(0x14c)+_0x2327c1(0x2cd)+'ackup')];for(const _0x2a3f14 of _0x59b877){if(!existsSync(_0x2a3f14))continue;await rm(_0x2a3f14,{'recursive':!![],'force':!![]}),_0x42c60b?.[_0x2327c1(0xc9)]('pruned\x20r'+'untime\x20c'+_0x2327c1(0x1b2)+_0x2327c1(0xe8)+_0x2327c1(0x1cd),{'cachePath':_0x2a3f14});}}async function prunePackagedRuntimePayload(_0x5ea7d1,_0x207093,_0xb5226e){const _0x4ed637=_0x3d918c,_0x4675c0=createRuntimeInfoFromManifest(_0x5ea7d1,_0x207093),_0x2f730b=[join(_0x5ea7d1,process[_0x4ed637(0x1a4)]==='win32'?_0x4ed637(0x225)+_0x4ed637(0x11f)+_0x4ed637(0x11c):_0x4ed637(0x198)+_0x4ed637(0x1ae)+'dules/np'+'m'),join(_0x4675c0[_0x4ed637(0x21d)+_0x4ed637(0x1a6)+'ir'],_0x4ed637(0x2e9)+_0x4ed637(0xb3))],_0xba01=join(_0x4675c0[_0x4ed637(0x21d)+_0x4ed637(0x1a6)+'ir'],_0x4ed637(0x315),'extensio'+'ns');if(existsSync(_0xba01))for(const _0x1a5e12 of await readdir(_0xba01,{'withFileTypes':!![]})){_0x1a5e12['isDirect'+_0x4ed637(0x9a)]()&&_0x2f730b[_0x4ed637(0x2e8)](join(_0xba01,_0x1a5e12[_0x4ed637(0x22d)],_0x4ed637(0x2e9)+_0x4ed637(0xb3)));}const _0x45768e={'files':0x0,'directories':0x0,'bytes':0x0};for(const _0x485e56 of _0x2f730b){await pruneRuntimeDependencyTree(_0x485e56,_0x45768e);}await pruneOpenClawDocs(_0x4675c0['openclaw'+_0x4ed637(0x1a6)+'ir'],_0x45768e),_0xb5226e?.[_0x4ed637(0xc9)](_0x4ed637(0x1bd)+_0x4ed637(0xc3)+_0x4ed637(0xcf)+_0x4ed637(0x12b)+_0x4ed637(0x24d),_0x45768e);}async function pruneOpenClawDocs(_0x81019e,_0x534fb0){const _0x5ce35b=_0x3d918c,_0x42e1ca=join(_0x81019e,_0x5ce35b(0x183));if(!existsSync(_0x42e1ca))return;for(const _0x6193d1 of await readdir(_0x42e1ca,{'withFileTypes':!![]})){if(_0x6193d1[_0x5ce35b(0x22d)]===_0x5ce35b(0x1d9)+'e')continue;await removePrunedPath(join(_0x42e1ca,_0x6193d1['name']),_0x534fb0);}}async function pruneRuntimeDependencyTree(_0x2b984d,_0x476492){const _0x150da1=_0x3d918c;if(!existsSync(_0x2b984d))return;for(const _0x484071 of await readdir(_0x2b984d,{'withFileTypes':!![]})){const _0xdc7a17=join(_0x2b984d,_0x484071['name']);if(_0x484071[_0x150da1(0x268)+_0x150da1(0x9a)]()){if(shouldPruneRuntimeDirectory(_0x2b984d,_0x484071[_0x150da1(0x22d)])){await removePrunedPath(_0xdc7a17,_0x476492);continue;}await pruneRuntimeDependencyTree(_0xdc7a17,_0x476492);continue;}_0x484071[_0x150da1(0x2b7)]()&&shouldPruneRuntimeFile(_0x484071[_0x150da1(0x22d)])&&await removePrunedPath(_0xdc7a17,_0x476492);}}function shouldPruneRuntimeDirectory(_0x3db639,_0x89f8e2){const _0x39d47d=_0x3d918c;if(_0x89f8e2===_0x39d47d(0x2a5))return!![];if(new Set([_0x39d47d(0x17c),_0x39d47d(0x183),'man'])[_0x39d47d(0x2b5)](_0x89f8e2))return existsSync(join(_0x3db639,_0x39d47d(0x1ee)+_0x39d47d(0x155)));return new Set([_0x39d47d(0x325)+'_',_0x39d47d(0x109),_0x39d47d(0x1e2),_0x39d47d(0x17a),_0x39d47d(0x166)])[_0x39d47d(0x2b5)](_0x89f8e2);}function shouldPruneRuntimeFile(_0x2a213d){const _0x7a199d=_0x3d918c;if(_0x2a213d==='package-'+'lock.jso'+'n'||_0x2a213d[_0x7a199d(0xac)](_0x7a199d(0x1bc)))return!![];return new Set([_0x7a199d(0x1fe),_0x7a199d(0x1b6),_0x7a199d(0x18f)+'n'])[_0x7a199d(0x2b5)](extname(_0x2a213d)[_0x7a199d(0x2ae)+'ase']());}async function removePrunedPath(_0x1fccb4,_0x8fd6ec){const _0x172e85=_0x3d918c;if(!existsSync(_0x1fccb4))return;const _0x21be5a=await getPathSize(_0x1fccb4),_0x3fbc39=await stat(_0x1fccb4);await rm(_0x1fccb4,{'recursive':!![],'force':!![]}),_0x8fd6ec[_0x172e85(0x2d6)]+=_0x21be5a;if(_0x3fbc39[_0x172e85(0x268)+_0x172e85(0x9a)]())_0x8fd6ec[_0x172e85(0x245)+_0x172e85(0x199)]+=0x1;else _0x8fd6ec[_0x172e85(0xab)]+=0x1;}async function getPathSize(_0x3636d4){const _0x5da755=_0x3d918c,_0x5a6544=await stat(_0x3636d4);if(!_0x5a6544[_0x5da755(0x268)+_0x5da755(0x9a)]())return _0x5a6544['size'];let _0x1a754a=0x0;for(const _0x167e34 of await readdir(_0x3636d4,{'withFileTypes':!![]})){_0x1a754a+=await getPathSize(join(_0x3636d4,_0x167e34['name']));}return _0x1a754a;}async function syncRuntimeWrapper(_0x206980,_0x281b7f,_0x941c6){const _0x1cb30b=_0x3d918c,_0x4d4bd1=_0x206980[_0x1cb30b(0x21d)]?.[_0x1cb30b(0x30d)+'leName']??_0x1cb30b(0x129)+'json',_0x5bb607=join(_0x281b7f,_0x1cb30b(0x10b),_0x1cb30b(0x1f5)+'w'),_0x5e507d=join(_0x281b7f,_0x1cb30b(0x10b),_0x1cb30b(0x1f5)+_0x1cb30b(0xf6)),_0x23cac3=normalizeRuntimeRelativePath(relative(dirname(_0x5bb607),resolve(_0x281b7f,_0x941c6[_0x1cb30b(0x334)+_0x1cb30b(0x219)]))),_0x935335=normalizeRuntimeRelativePath(relative(dirname(_0x5bb607),resolve(_0x281b7f,_0x941c6[_0x1cb30b(0x21d)+_0x1cb30b(0x2d5)]))),_0x1585fd=_0x1cb30b(0x1ff)+_0x206980[_0x1cb30b(0xb7)+_0x1cb30b(0x257)],_0xbcc12e=_0x1cb30b(0x300)+_0x1cb30b(0x30b)+_0x206980[_0x1cb30b(0xb7)+_0x1cb30b(0x257)];await mkdir(dirname(_0x5bb607),{'recursive':!![]});const _0x5e8d52=fileURLToPath(new URL(_0x1cb30b(0x31e)+'sets/wuj'+_0x1cb30b(0x2d9)+_0x1cb30b(0x293),import.meta.url)),_0x21cd43=join(_0x281b7f,_0x1cb30b(0x10b),'wujie-lo'+_0x1cb30b(0x31d));await cp(_0x5e8d52,_0x21cd43),await writeFile(_0x5bb607,[_0x1cb30b(0x280)+'h',_0x1cb30b(0xf7)+_0x1cb30b(0x102)+_0x1cb30b(0x9e)+_0x1cb30b(0x2a2)+'_HOME:-'+_0x1585fd+'}\x22',_0x1cb30b(0xf7)+_0x1cb30b(0x102)+_0x1cb30b(0x23a)+_0x1cb30b(0x10c)+_0x1cb30b(0x1da)+_0x1cb30b(0x2b4)+'-'+_0x1585fd+'}\x22',_0x1cb30b(0xf7)+_0x1cb30b(0x102)+'CONFIG_F'+_0x1cb30b(0x284)+_0x1cb30b(0x1c3)+'CLAW_CON'+_0x1cb30b(0x217)+_0x1cb30b(0x1b7)+_0x4d4bd1+'}\x22',_0x1cb30b(0xf7)+'PENCLAW_'+_0x1cb30b(0x235)+'ATH=\x22${O'+_0x1cb30b(0x102)+_0x1cb30b(0x235)+_0x1cb30b(0x221)+_0x1585fd+'/'+_0x4d4bd1+'}\x22',_0x1cb30b(0x231)+'IR=$(CDP'+'ATH=\x20cd\x20'+_0x1cb30b(0x224)+'rname\x20--'+'\x20\x22$0\x22)\x22\x20'+_0x1cb30b(0xe7),_0x1cb30b(0x122)+_0x1cb30b(0x1bb)+'\x20-z\x20\x22$WU'+_0x1cb30b(0x1dc)+_0x1cb30b(0xd3)+_0x1cb30b(0x114),'\x20\x20\x22$SCRI'+_0x1cb30b(0x29f)+_0x23cac3+('\x22\x20\x22$SCRI'+'PT_DIR/w'+_0x1cb30b(0xd0)+_0x1cb30b(0x2d0)+_0x1cb30b(0x98)+_0x1cb30b(0x230)+'ue'),'fi',_0x1cb30b(0x29a)+_0x1cb30b(0x310)+'R/'+_0x23cac3+('\x22\x20\x22$SCRI'+_0x1cb30b(0x29f))+_0x935335+_0x1cb30b(0xcd),''][_0x1cb30b(0x13f)]('\x0a'),_0x1cb30b(0x1ce)),await chmod(_0x5bb607,0x1ed),await writeFile(_0x5e507d,[_0x1cb30b(0x1b0)+'f',_0x1cb30b(0x23c)+_0x1cb30b(0x27b)+_0x1cb30b(0x2c2)+'\x20set\x20\x22OP'+_0x1cb30b(0x22f)+_0x1cb30b(0x2e6)+_0xbcc12e+'\x22',_0x1cb30b(0x23c)+_0x1cb30b(0x1da)+'ATE_DIR%'+_0x1cb30b(0x2ed)+_0x1cb30b(0x22e)+_0x1cb30b(0x105)+_0x1cb30b(0x2dd)+_0xbcc12e+'\x22','if\x20\x22%OPE'+_0x1cb30b(0x274)+'NFIG_FIL'+'E_NAME%\x22'+_0x1cb30b(0xf5)+_0x1cb30b(0x159)+_0x1cb30b(0x1a1)+'G_FILE_N'+'AME='+_0x4d4bd1+'\x22','if\x20\x22%OPE'+'NCLAW_CO'+'NFIG_PAT'+'H%\x22==\x22\x22\x20'+_0x1cb30b(0x190)+_0x1cb30b(0x274)+_0x1cb30b(0x212)+'H='+_0xbcc12e+'\x5c'+_0x4d4bd1+'\x22',_0x1cb30b(0x13c)+_0x1cb30b(0x1e7)+_0x1cb30b(0x16d),'\x22%SCRIPT'+_0x1cb30b(0x17e)+toWindowsPath(_0x23cac3)+(_0x1cb30b(0x1cf)+_0x1cb30b(0x2eb))+toWindowsPath(_0x935335)+_0x1cb30b(0x2b8),''][_0x1cb30b(0x13f)]('\x0d\x0a'),'utf8'),_0x941c6['wujiecla'+_0x1cb30b(0x206)]=toRuntimeRelative(_0x281b7f,process[_0x1cb30b(0x1a4)]==='win32'?_0x5e507d:_0x5bb607);}async function patchChatHistoryMixedToolContentBug(_0xf7d1,_0x3d7442,_0x108eac={}){const _0x597ce8=_0x3d918c,_0x3287da=resolve(_0xf7d1,_0x3d7442['openclaw'+_0x597ce8(0x1a6)+'ir']),_0xa3c9b8=join(_0x3287da,'dist');let _0x2f56b4=[];try{_0x2f56b4=await readdir(_0xa3c9b8,{'withFileTypes':!![]});}catch{_0x108eac[_0x597ce8(0x285)+'ogger']?.[_0x597ce8(0x1b4)]?.(_0x597ce8(0x135)+_0x597ce8(0xa9)+_0x597ce8(0x1f0)+'patch\x20sk'+_0x597ce8(0xc6)+'ist\x20not\x20'+'found',{'distDir':_0xa3c9b8,'openclawVersion':_0x3d7442['openclaw'+_0x597ce8(0x323)]});return;}const _0x2c1e36=_0x2f56b4[_0x597ce8(0x254)](_0x2bc797=>_0x2bc797[_0x597ce8(0x2b7)]()&&(_0x2bc797[_0x597ce8(0x22d)][_0x597ce8(0x1c6)+'th'](_0x597ce8(0x2f4)+_0x597ce8(0x12a)+'jection-')||_0x2bc797[_0x597ce8(0x22d)][_0x597ce8(0x1c6)+'th']('session-'+_0x597ce8(0xe3)+_0x597ce8(0x28b)))&&_0x2bc797[_0x597ce8(0x22d)]['endsWith'](_0x597ce8(0x153)))['map'](_0x34fd08=>join(_0xa3c9b8,_0x34fd08[_0x597ce8(0x22d)]));if(_0x2c1e36['length']===0x0){_0x108eac[_0x597ce8(0x285)+'ogger']?.[_0x597ce8(0x1b4)]?.(_0x597ce8(0x135)+_0x597ce8(0xa9)+'ed-tool\x20'+'patch\x20sk'+_0x597ce8(0x169)+_0x597ce8(0x15e)+_0x597ce8(0x104),{'openclawVersion':_0x3d7442[_0x597ce8(0x21d)+_0x597ce8(0x323)]});return;}for(const _0x235d20 of _0x2c1e36){const _0x2b5a41=await readFile(_0x235d20,_0x597ce8(0x1ce)),_0x4f6f9a=patchMixedToolContentFromSource(_0x2b5a41);if(!_0x4f6f9a[_0x597ce8(0x32c)]){if(_0x4f6f9a['reason']==='already-'+_0x597ce8(0x32c)){_0x108eac[_0x597ce8(0x285)+_0x597ce8(0x10a)]?.[_0x597ce8(0xc9)]?.(_0x597ce8(0x135)+_0x597ce8(0xa9)+_0x597ce8(0x1f0)+'patch\x20al'+_0x597ce8(0x16a)+_0x597ce8(0x255),{'openclawVersion':_0x3d7442[_0x597ce8(0x21d)+_0x597ce8(0x323)],'filePath':_0x235d20});return;}continue;}await writeFile(_0x235d20,_0x4f6f9a['source'],_0x597ce8(0x1ce)),_0x108eac[_0x597ce8(0x285)+'ogger']?.['info']?.('chat\x20his'+'tory\x20mix'+_0x597ce8(0x1f0)+'patch\x20ap'+_0x597ce8(0x255),{'openclawVersion':_0x3d7442[_0x597ce8(0x21d)+_0x597ce8(0x323)],'filePath':_0x235d20,'note':_0x597ce8(0x30a)+_0x597ce8(0x111)+_0x597ce8(0x2ba)+'patch\x20fo'+_0x597ce8(0x180)+'aw\x202026.'+_0x597ce8(0x32d)+_0x597ce8(0x2e7)+_0x597ce8(0x168)+_0x597ce8(0x1cb)+_0x597ce8(0x2de)+_0x597ce8(0x137)+_0x597ce8(0x1e0)+_0x597ce8(0x12e)+'re\x20upgra'+_0x597ce8(0x265)});return;}_0x108eac[_0x597ce8(0x285)+'ogger']?.[_0x597ce8(0x1b4)]?.(_0x597ce8(0x135)+_0x597ce8(0xa9)+_0x597ce8(0x1f0)+_0x597ce8(0x326)+'ipped;\x20f'+'unction\x20'+_0x597ce8(0x127)+'d',{'openclawVersion':_0x3d7442[_0x597ce8(0x21d)+_0x597ce8(0x323)]});}async function patchProviderRequestIdHeader(_0x79e1db,_0x40b11f,_0x448c08={}){const _0x304b2b=_0x3d918c,_0x171b9e=resolve(_0x79e1db,_0x40b11f['openclaw'+_0x304b2b(0x1a6)+'ir']),_0x42a2c6=join(_0x171b9e,_0x304b2b(0x315));let _0x1be71d=[];try{_0x1be71d=await readdir(_0x42a2c6,{'withFileTypes':!![]});}catch{_0x448c08['runtimeL'+'ogger']?.[_0x304b2b(0x1b4)]?.(_0x304b2b(0x260)+_0x304b2b(0x27f)+_0x304b2b(0x15c)+_0x304b2b(0x2ad)+'\x20skipped'+_0x304b2b(0x154)+_0x304b2b(0x241),{'distDir':_0x42a2c6,'openclawVersion':_0x40b11f[_0x304b2b(0x21d)+'Version']});return;}const _0x34e4e8=_0x1be71d[_0x304b2b(0x254)](_0x4bd7df=>_0x4bd7df[_0x304b2b(0x2b7)]()&&_0x4bd7df[_0x304b2b(0x22d)][_0x304b2b(0xac)]('.js'))[_0x304b2b(0x1f6)](_0x539324=>join(_0x42a2c6,_0x539324[_0x304b2b(0x22d)]));let _0x5a387c=0x0,_0xee9aa7=0x0;for(const _0x201497 of _0x34e4e8){const _0x463c41=await readFile(_0x201497,_0x304b2b(0x1ce)),_0x4a2e4a=patchProviderRequestIdHeaderFromSource(_0x463c41);if(_0x4a2e4a[_0x304b2b(0x32c)]){await writeFile(_0x201497,_0x4a2e4a[_0x304b2b(0x96)],_0x304b2b(0x1ce)),_0x5a387c+=0x1,_0x448c08[_0x304b2b(0x285)+_0x304b2b(0x10a)]?.['info']?.(_0x304b2b(0x260)+'\x20request'+_0x304b2b(0x15c)+_0x304b2b(0x2ad)+_0x304b2b(0x1d5),{'openclawVersion':_0x40b11f['openclaw'+'Version'],'filePath':_0x201497});continue;}if(_0x4a2e4a[_0x304b2b(0x2f3)]==='already-'+_0x304b2b(0x32c))_0xee9aa7+=0x1;}if(_0x5a387c>0x0){_0x448c08['runtimeL'+_0x304b2b(0x10a)]?.[_0x304b2b(0xc9)]?.('provider'+_0x304b2b(0x27f)+_0x304b2b(0x15c)+_0x304b2b(0x2ad)+_0x304b2b(0xa3),{'openclawVersion':_0x40b11f[_0x304b2b(0x21d)+_0x304b2b(0x323)],'patchedCount':_0x5a387c,'alreadyPatchedCount':_0xee9aa7});return;}if(_0xee9aa7>0x0){_0x448c08[_0x304b2b(0x285)+_0x304b2b(0x10a)]?.['info']?.(_0x304b2b(0x260)+_0x304b2b(0x27f)+_0x304b2b(0x15c)+_0x304b2b(0x2ad)+_0x304b2b(0x9d)+_0x304b2b(0x1d5),{'openclawVersion':_0x40b11f[_0x304b2b(0x21d)+_0x304b2b(0x323)],'alreadyPatchedCount':_0xee9aa7});return;}_0x448c08[_0x304b2b(0x285)+_0x304b2b(0x10a)]?.[_0x304b2b(0x1b4)]?.('provider'+_0x304b2b(0x27f)+_0x304b2b(0x15c)+_0x304b2b(0x2ad)+_0x304b2b(0xbe)+_0x304b2b(0x2a7)+_0x304b2b(0x20e)+_0x304b2b(0x335)+_0x304b2b(0xc7)+'nd',{'openclawVersion':_0x40b11f[_0x304b2b(0x21d)+_0x304b2b(0x323)]});}async function patchChannelPluginRuntimeBug(_0x4917b9,_0x110e6c,_0x480c92={}){const _0x1517e1=_0x3d918c,_0x3dd283=resolve(_0x4917b9,_0x110e6c[_0x1517e1(0x21d)+_0x1517e1(0x1a6)+'ir']),_0xb7cd2e=join(_0x3dd283,'dist');let _0x1e9a9e=[];try{_0x1e9a9e=await readdir(_0xb7cd2e,{'withFileTypes':!![]});}catch{_0x480c92[_0x1517e1(0x285)+_0x1517e1(0x10a)]?.[_0x1517e1(0x1b4)]?.(_0x1517e1(0x175)+'plugin\x20r'+_0x1517e1(0xc3)+'atch\x20ski'+'pped;\x20di'+'st\x20not\x20f'+'ound',{'distDir':_0xb7cd2e,'openclawVersion':_0x110e6c['openclaw'+_0x1517e1(0x323)]});return;}const _0x38e762=_0x1e9a9e[_0x1517e1(0x254)](_0x188c0a=>_0x188c0a[_0x1517e1(0x2b7)]()&&_0x188c0a[_0x1517e1(0x22d)][_0x1517e1(0x1c6)+'th'](_0x1517e1(0x9b))&&_0x188c0a[_0x1517e1(0x22d)][_0x1517e1(0xac)](_0x1517e1(0x153)))[_0x1517e1(0x1f6)](_0x5e1a32=>join(_0xb7cd2e,_0x5e1a32[_0x1517e1(0x22d)])),_0x1cc4ce=await resolveRuntimeChannelImportPath(_0xb7cd2e,_0x1e9a9e);if(_0x38e762[_0x1517e1(0xde)]===0x0){_0x480c92[_0x1517e1(0x285)+'ogger']?.['warn']?.('channel\x20'+_0x1517e1(0x2e2)+_0x1517e1(0xc3)+_0x1517e1(0x244)+'pped;\x20lo'+'ader\x20not'+_0x1517e1(0x18a),{'openclawVersion':_0x110e6c[_0x1517e1(0x21d)+_0x1517e1(0x323)]});return;}if(!_0x1cc4ce){_0x480c92['runtimeL'+_0x1517e1(0x10a)]?.['warn']?.(_0x1517e1(0x175)+_0x1517e1(0x2e2)+_0x1517e1(0xc3)+'atch\x20ski'+_0x1517e1(0x294)+_0x1517e1(0x243)+_0x1517e1(0x1a8)+_0x1517e1(0x278)+_0x1517e1(0x104),{'openclawVersion':_0x110e6c[_0x1517e1(0x21d)+'Version'],'distDir':_0xb7cd2e});return;}for(const _0x4780a9 of _0x38e762){const _0x3f46a3=await readFile(_0x4780a9,_0x1517e1(0x1ce)),_0x48139d=patchChannelPluginRuntimeFromSource(_0x3f46a3,{'runtimeChannelImportPath':_0x1cc4ce});if(!_0x48139d[_0x1517e1(0x32c)]){if(_0x48139d['reason']===_0x1517e1(0x2ac)+_0x1517e1(0x32c)){_0x480c92[_0x1517e1(0x285)+_0x1517e1(0x10a)]?.[_0x1517e1(0xc9)]?.(_0x1517e1(0x175)+_0x1517e1(0x2e2)+_0x1517e1(0xc3)+_0x1517e1(0x262)+_0x1517e1(0x1af)+_0x1517e1(0xe0),{'openclawVersion':_0x110e6c[_0x1517e1(0x21d)+'Version'],'filePath':_0x4780a9});return;}continue;}await writeFile(_0x4780a9,_0x48139d[_0x1517e1(0x96)],_0x1517e1(0x1ce)),_0x480c92['runtimeL'+_0x1517e1(0x10a)]?.[_0x1517e1(0xc9)]?.(_0x1517e1(0x175)+_0x1517e1(0x2e2)+_0x1517e1(0xc3)+_0x1517e1(0x187)+'lied',{'openclawVersion':_0x110e6c['openclaw'+'Version'],'filePath':_0x4780a9,'note':_0x1517e1(0x30a)+_0x1517e1(0x111)+_0x1517e1(0x2ba)+_0x1517e1(0x140)+_0x1517e1(0x180)+_0x1517e1(0x162)+_0x1517e1(0x15f)+_0x1517e1(0xcc)+_0x1517e1(0x136)+_0x1517e1(0x161)+_0x1517e1(0x32f)+_0x1517e1(0x249)+_0x1517e1(0x2c0)+'rs;\x20veri'+_0x1517e1(0x2bd)+_0x1517e1(0x226)+_0x1517e1(0x10e)+_0x1517e1(0x29e)+_0x1517e1(0x115)});return;}_0x480c92[_0x1517e1(0x285)+'ogger']?.[_0x1517e1(0x1b4)]?.(_0x1517e1(0x175)+_0x1517e1(0x2e2)+'untime\x20p'+'atch\x20ski'+_0x1517e1(0x294)+'ntime\x20re'+_0x1517e1(0x2c7)+_0x1517e1(0x241),{'openclawVersion':_0x110e6c[_0x1517e1(0x21d)+_0x1517e1(0x323)]});}async function patchSessionStoreSqliteRuntime(_0x3857c7,_0x2798ad,_0x7bc3f0={}){const _0x250785=_0x3d918c,_0x3a46b5=resolve(_0x3857c7,_0x2798ad[_0x250785(0x21d)+'WorkingD'+'ir']),_0x4e861b=join(_0x3a46b5,_0x250785(0x315)),_0x116cb5=_0x250785(0x30c)+_0x250785(0x2b9)+_0x250785(0xb2)+'ions/run'+_0x250785(0x194)+'dge.mjs',_0x1996bc=join(_0x3857c7,_0x250785(0x181)+_0x250785(0x25d),_0x250785(0x2f0),_0x250785(0x27c)+_0x250785(0xfb)+'js'),_0x563408=(await readdir(_0x4e861b,{'withFileTypes':!![]})[_0x250785(0x298)](()=>[]))[_0x250785(0x254)](_0x59c8d4=>_0x59c8d4[_0x250785(0x2b7)]()&&_0x59c8d4['name']['startsWi'+'th'](_0x250785(0x295)+_0x250785(0x22c))&&_0x59c8d4[_0x250785(0x22d)][_0x250785(0xac)](_0x250785(0x153)))[_0x250785(0x1f6)](_0x552700=>join(_0x4e861b,_0x552700[_0x250785(0x22d)])),_0x2b3ac8=(await readdir(_0x4e861b,{'withFileTypes':!![]})[_0x250785(0x298)](()=>[]))[_0x250785(0x254)](_0x14d2b5=>_0x14d2b5[_0x250785(0x2b7)]()&&_0x14d2b5[_0x250785(0x22d)][_0x250785(0x1c6)+'th'](_0x250785(0x103))&&!_0x14d2b5[_0x250785(0x22d)][_0x250785(0x1c6)+'th']('store-lo'+_0x250785(0x22c))&&_0x14d2b5[_0x250785(0x22d)][_0x250785(0xac)](_0x250785(0x153)))['map'](_0x486786=>join(_0x4e861b,_0x486786[_0x250785(0x22d)]));if(!existsSync(_0x1996bc)){_0x7bc3f0[_0x250785(0x285)+'ogger']?.[_0x250785(0xc9)]?.('session\x20'+'store\x20sq'+'lite\x20pat'+'ch\x20skipp'+_0x250785(0x172)+'ge\x20not\x20a'+'vailable',{'bridgePath':_0x1996bc,'openclawVersion':_0x2798ad[_0x250785(0x21d)+_0x250785(0x323)]});return;}for(const _0x2c3c30 of _0x563408){const _0x47c9bf=await readFile(_0x2c3c30,_0x250785(0x1ce)),_0x3d5aa0=patchSessionStoreLoadFromSource(_0x47c9bf,{'bridgeImportPath':_0x116cb5});if(!_0x3d5aa0['patched']){if(_0x3d5aa0[_0x250785(0x2f3)]==='already-'+_0x250785(0x32c)){_0x7bc3f0[_0x250785(0x285)+_0x250785(0x10a)]?.[_0x250785(0xc9)]?.(_0x250785(0x147)+'store\x20lo'+_0x250785(0x24c)+_0x250785(0x9d)+_0x250785(0x1d5),{'filePath':_0x2c3c30,'openclawVersion':_0x2798ad['openclaw'+'Version']});break;}continue;}await writeFile(_0x2c3c30,_0x3d5aa0[_0x250785(0x96)],_0x250785(0x1ce)),_0x7bc3f0[_0x250785(0x285)+'ogger']?.['info']?.(_0x250785(0x147)+_0x250785(0x321)+'ad\x20patch'+_0x250785(0x1d5),{'filePath':_0x2c3c30,'openclawVersion':_0x2798ad[_0x250785(0x21d)+_0x250785(0x323)]});break;}for(const _0x293c6b of _0x2b3ac8){const _0xbb6878=await readFile(_0x293c6b,_0x250785(0x1ce)),_0x502d42=patchSessionStoreWriteFromSource(_0xbb6878,{'bridgeImportPath':_0x116cb5});if(!_0x502d42[_0x250785(0x32c)]){if(_0x502d42[_0x250785(0x2f3)]===_0x250785(0x2ac)+'patched'){_0x7bc3f0[_0x250785(0x285)+_0x250785(0x10a)]?.[_0x250785(0xc9)]?.(_0x250785(0x147)+_0x250785(0x2d7)+_0x250785(0x1c9)+_0x250785(0x330)+_0x250785(0x272)+'d',{'filePath':_0x293c6b,'openclawVersion':_0x2798ad[_0x250785(0x21d)+_0x250785(0x323)]});break;}continue;}await writeFile(_0x293c6b,_0x502d42[_0x250785(0x96)],_0x250785(0x1ce)),_0x7bc3f0[_0x250785(0x285)+_0x250785(0x10a)]?.[_0x250785(0xc9)]?.(_0x250785(0x147)+_0x250785(0x2d7)+_0x250785(0x1c9)+_0x250785(0x21b)+'d',{'filePath':_0x293c6b,'openclawVersion':_0x2798ad[_0x250785(0x21d)+_0x250785(0x323)]});break;}}async function patchWeixinOutboundSessionRoute(_0x393b6,_0xda1a75,_0x2944d0={}){const _0x3d77d5=_0x3d918c,_0x316dbf=join(_0x393b6,_0x3d77d5(0x21d),_0x3d77d5(0x315),_0x3d77d5(0xe1)+'ns',_0x3d77d5(0x21d)+_0x3d77d5(0x164),_0x3d77d5(0x315),_0x3d77d5(0xb6),_0x3d77d5(0xbd)+'js');if(!existsSync(_0x316dbf)){_0x2944d0[_0x3d77d5(0x285)+_0x3d77d5(0x10a)]?.[_0x3d77d5(0xc9)]?.(_0x3d77d5(0xfa)+_0x3d77d5(0x2a4)+'session\x20'+'route\x20pa'+'tch\x20skip'+'ped;\x20plu'+_0x3d77d5(0x188)+'installe'+'d',{'openclawVersion':_0xda1a75[_0x3d77d5(0x21d)+_0x3d77d5(0x323)],'filePath':_0x316dbf});return;}const _0x46de1b=await readFile(_0x316dbf,'utf8'),_0x3f4c4a=patchWeixinOutboundSessionRouteFromSource(_0x46de1b);if(!_0x3f4c4a[_0x3d77d5(0x32c)]){if(_0x3f4c4a[_0x3d77d5(0x2f3)]===_0x3d77d5(0x2ac)+_0x3d77d5(0x32c)){_0x2944d0['runtimeL'+_0x3d77d5(0x10a)]?.['info']?.(_0x3d77d5(0xfa)+'utbound\x20'+_0x3d77d5(0x147)+_0x3d77d5(0x173)+_0x3d77d5(0x2b6)+_0x3d77d5(0x21e)+_0x3d77d5(0x26f),{'openclawVersion':_0xda1a75[_0x3d77d5(0x21d)+_0x3d77d5(0x323)],'filePath':_0x316dbf});return;}_0x2944d0[_0x3d77d5(0x285)+_0x3d77d5(0x10a)]?.[_0x3d77d5(0x1b4)]?.(_0x3d77d5(0xfa)+_0x3d77d5(0x2a4)+_0x3d77d5(0x147)+_0x3d77d5(0x173)+_0x3d77d5(0x170)+_0x3d77d5(0x25f)+_0x3d77d5(0xce)+_0x3d77d5(0x216)+'ound',{'openclawVersion':_0xda1a75[_0x3d77d5(0x21d)+_0x3d77d5(0x323)],'filePath':_0x316dbf,'reason':_0x3f4c4a[_0x3d77d5(0x2f3)]});return;}await writeFile(_0x316dbf,_0x3f4c4a[_0x3d77d5(0x96)],_0x3d77d5(0x1ce)),_0x2944d0['runtimeL'+_0x3d77d5(0x10a)]?.[_0x3d77d5(0xc9)]?.(_0x3d77d5(0xfa)+_0x3d77d5(0x2a4)+_0x3d77d5(0x147)+_0x3d77d5(0x173)+'tch\x20appl'+'ied',{'openclawVersion':_0xda1a75[_0x3d77d5(0x21d)+_0x3d77d5(0x323)],'filePath':_0x316dbf,'note':_0x3d77d5(0x30a)+_0x3d77d5(0x111)+'ibility\x20'+_0x3d77d5(0x140)+'r\x20@tence'+_0x3d77d5(0x1fa)+_0x3d77d5(0x286)+_0x3d77d5(0x197)+_0x3d77d5(0x28c)+_0x3d77d5(0x2d1)+_0x3d77d5(0x138)+_0x3d77d5(0xd2)+'g\x20indexe'+_0x3d77d5(0x26b)+_0x3d77d5(0xf1)+_0x3d77d5(0x336)+_0x3d77d5(0x137)+_0x3d77d5(0x1e0)+_0x3d77d5(0x12e)+_0x3d77d5(0x107)+'des.'});}async function patchWeixinOutboundFallbackRuntime(_0x2e8c2a,_0x29c9b1,_0x141c1d={}){const _0x2df960=_0x3d918c,_0x39fda4=resolve(_0x2e8c2a,_0x29c9b1[_0x2df960(0x21d)+_0x2df960(0x1a6)+'ir']),_0x1d34da=join(_0x39fda4,_0x2df960(0x315)),_0x45506d=(await readdir(_0x1d34da,{'withFileTypes':!![]})[_0x2df960(0x298)](()=>[]))[_0x2df960(0x254)](_0x53b8d9=>_0x53b8d9['isFile']()&&_0x53b8d9[_0x2df960(0x22d)]['startsWi'+'th'](_0x2df960(0x116)+'-session'+'-')&&_0x53b8d9[_0x2df960(0x22d)][_0x2df960(0xac)](_0x2df960(0x153)))['map'](_0x4a1f82=>join(_0x1d34da,_0x4a1f82[_0x2df960(0x22d)]));if(_0x45506d[_0x2df960(0xde)]===0x0){_0x141c1d[_0x2df960(0x285)+'ogger']?.[_0x2df960(0x1b4)]?.(_0x2df960(0xfa)+_0x2df960(0x2a4)+'fallback'+'\x20patch\x20s'+_0x2df960(0x131)+'outbound'+_0x2df960(0x1ab)+_0x2df960(0xc7)+'nd',{'openclawVersion':_0x29c9b1[_0x2df960(0x21d)+_0x2df960(0x323)],'distDir':_0x1d34da});return;}for(const _0x9e872 of _0x45506d){const _0x236b65=await readFile(_0x9e872,'utf8'),_0x493320=patchWeixinOutboundFallbackFromSource(_0x236b65);if(!_0x493320[_0x2df960(0x32c)]){if(_0x493320['reason']==='already-'+_0x2df960(0x32c)){_0x141c1d[_0x2df960(0x285)+'ogger']?.['info']?.(_0x2df960(0xfa)+_0x2df960(0x2a4)+_0x2df960(0x10f)+_0x2df960(0x215)+_0x2df960(0x133)+_0x2df960(0x2cc),{'openclawVersion':_0x29c9b1[_0x2df960(0x21d)+_0x2df960(0x323)],'filePath':_0x9e872});return;}continue;}await writeFile(_0x9e872,_0x493320[_0x2df960(0x96)],_0x2df960(0x1ce)),_0x141c1d[_0x2df960(0x285)+_0x2df960(0x10a)]?.[_0x2df960(0xc9)]?.(_0x2df960(0xfa)+_0x2df960(0x2a4)+'fallback'+_0x2df960(0x215)+_0x2df960(0x2cc),{'openclawVersion':_0x29c9b1[_0x2df960(0x21d)+'Version'],'filePath':_0x9e872,'note':_0x2df960(0x30a)+_0x2df960(0x111)+_0x2df960(0x2ba)+_0x2df960(0x140)+_0x2df960(0x2a1)+_0x2df960(0x193)+_0x2df960(0x237)+'m.wechat'+_0x2df960(0xc4)+_0x2df960(0x25c)+_0x2df960(0x287)+_0x2df960(0x303)+_0x2df960(0x128)+_0x2df960(0x1dd)+_0x2df960(0xa8)+'\x20is\x20unav'+_0x2df960(0x14e)});return;}_0x141c1d[_0x2df960(0x285)+_0x2df960(0x10a)]?.[_0x2df960(0x1b4)]?.(_0x2df960(0xfa)+_0x2df960(0x2a4)+'fallback'+'\x20patch\x20s'+_0x2df960(0x131)+_0x2df960(0x1e6)+_0x2df960(0x20b)+_0x2df960(0x241),{'openclawVersion':_0x29c9b1[_0x2df960(0x21d)+_0x2df960(0x323)]});}async function patchRequestIdTitleRuntime(_0x48a257,_0x43323f,_0x2bd473={}){const _0x4d222a=_0x3d918c,_0x3add64=resolve(_0x48a257,_0x43323f[_0x4d222a(0x21d)+_0x4d222a(0x1a6)+'ir']),_0x59c40a=join(_0x3add64,_0x4d222a(0x315)),_0x520d58=_0x4d222a(0x30c)+'ell-runt'+_0x4d222a(0x165)+'est-id/r'+'untime-b'+'ridge.mj'+'s',_0x3c81b0=join(_0x48a257,'shell-ru'+_0x4d222a(0x25d),_0x4d222a(0x2d3)+'id',_0x4d222a(0x27c)+_0x4d222a(0xfb)+'js');if(!existsSync(_0x3c81b0)){_0x2bd473[_0x4d222a(0x285)+_0x4d222a(0x10a)]?.[_0x4d222a(0xc9)]?.(_0x4d222a(0x2d3)+_0x4d222a(0x279)+_0x4d222a(0x1ab)+_0x4d222a(0xb0)+_0x4d222a(0x131)+_0x4d222a(0x21a)+'ot\x20avail'+_0x4d222a(0x320),{'bridgePath':_0x3c81b0,'openclawVersion':_0x43323f[_0x4d222a(0x21d)+'Version']});return;}const _0x217210=(await readdir(_0x59c40a,{'withFileTypes':!![]})[_0x4d222a(0x298)](()=>[]))['filter'](_0x23b80c=>_0x23b80c[_0x4d222a(0x2b7)]()&&_0x23b80c[_0x4d222a(0x22d)][_0x4d222a(0x1c6)+'th'](_0x4d222a(0x9b))&&_0x23b80c['name'][_0x4d222a(0xac)](_0x4d222a(0x153)))[_0x4d222a(0x1f6)](_0x3985f7=>join(_0x59c40a,_0x3985f7[_0x4d222a(0x22d)]));for(const _0x2c3640 of _0x217210){const _0x7d5be8=await readFile(_0x2c3640,_0x4d222a(0x1ce)),_0x29cbe6=patchRequestIdTitleRuntimeFromSource(_0x7d5be8,{'bridgeImportPath':_0x520d58});if(!_0x29cbe6[_0x4d222a(0x32c)]){if(_0x29cbe6[_0x4d222a(0x2f3)]==='already-'+'patched'){_0x2bd473[_0x4d222a(0x285)+_0x4d222a(0x10a)]?.[_0x4d222a(0xc9)]?.(_0x4d222a(0x2d3)+_0x4d222a(0x279)+_0x4d222a(0x1ab)+'\x20patch\x20a'+_0x4d222a(0x133)+_0x4d222a(0x2cc),{'filePath':_0x2c3640,'openclawVersion':_0x43323f[_0x4d222a(0x21d)+'Version']});break;}continue;}await writeFile(_0x2c3640,_0x29cbe6['source'],_0x4d222a(0x1ce)),_0x2bd473['runtimeL'+_0x4d222a(0x10a)]?.[_0x4d222a(0xc9)]?.('request-'+_0x4d222a(0x279)+_0x4d222a(0x1ab)+_0x4d222a(0x215)+_0x4d222a(0x2cc),{'filePath':_0x2c3640,'openclawVersion':_0x43323f['openclaw'+_0x4d222a(0x323)]});break;}}async function patchQQBotOutboundFallbackRuntime(_0x14fe2e,_0x2020d4,_0x5ca1b8={}){const _0x123792=_0x3d918c,_0xd13fad=resolve(_0x14fe2e,_0x2020d4[_0x123792(0x21d)+'WorkingD'+'ir']),_0x58256d=join(_0xd13fad,_0x123792(0x315)),_0x1f9db1=(await readdir(_0x58256d,{'withFileTypes':!![]})[_0x123792(0x298)](()=>[]))[_0x123792(0x254)](_0x4dc779=>_0x4dc779[_0x123792(0x2b7)]()&&_0x4dc779[_0x123792(0x22d)]['startsWi'+'th'](_0x123792(0x116)+_0x123792(0x177)+'-')&&_0x4dc779[_0x123792(0x22d)]['endsWith'](_0x123792(0x153)))[_0x123792(0x1f6)](_0x24ba63=>join(_0x58256d,_0x24ba63[_0x123792(0x22d)]));if(_0x1f9db1['length']===0x0){_0x5ca1b8[_0x123792(0x285)+_0x123792(0x10a)]?.['warn']?.('qqbot\x20ou'+_0x123792(0xeb)+_0x123792(0x1c7)+_0x123792(0x326)+_0x123792(0xa6)+_0x123792(0x2a4)+_0x123792(0x1eb)+_0x123792(0x127)+'d',{'openclawVersion':_0x2020d4[_0x123792(0x21d)+_0x123792(0x323)],'distDir':_0x58256d});return;}for(const _0x275374 of _0x1f9db1){const _0x2b642c=await readFile(_0x275374,'utf8'),_0x35adfd=patchQQBotOutboundFallbackFromSource(_0x2b642c);if(!_0x35adfd[_0x123792(0x32c)]){if(_0x35adfd[_0x123792(0x2f3)]===_0x123792(0x2ac)+'patched'){_0x5ca1b8[_0x123792(0x285)+_0x123792(0x10a)]?.[_0x123792(0xc9)]?.(_0x123792(0x246)+_0x123792(0xeb)+'allback\x20'+_0x123792(0x119)+'ready\x20ap'+'plied',{'openclawVersion':_0x2020d4['openclaw'+_0x123792(0x323)],'filePath':_0x275374});return;}continue;}await writeFile(_0x275374,_0x35adfd[_0x123792(0x96)],_0x123792(0x1ce)),_0x5ca1b8['runtimeL'+'ogger']?.[_0x123792(0xc9)]?.(_0x123792(0x246)+_0x123792(0xeb)+_0x123792(0x1c7)+'patch\x20ap'+_0x123792(0x255),{'openclawVersion':_0x2020d4[_0x123792(0x21d)+_0x123792(0x323)],'filePath':_0x275374,'note':_0x123792(0x30a)+_0x123792(0x111)+'ibility\x20'+'patch\x20fo'+_0x123792(0x2fa)+_0x123792(0x1b9)+_0x123792(0x116)+_0x123792(0x250)+_0x123792(0xba)+_0x123792(0x2ce)+_0x123792(0x1f8)+_0x123792(0x1e9)+_0x123792(0x106)+_0x123792(0x308)+_0x123792(0x21c)});return;}_0x5ca1b8[_0x123792(0x285)+_0x123792(0x10a)]?.[_0x123792(0x1b4)]?.('qqbot\x20ou'+'tbound\x20f'+_0x123792(0x1c7)+_0x123792(0x326)+_0x123792(0x267)+'esolver\x20'+_0x123792(0xb1)+_0x123792(0x1a3),{'openclawVersion':_0x2020d4[_0x123792(0x21d)+_0x123792(0x323)]});}async function patchQQBotOutboundSessionRoute(_0x4be5e0,_0x4a4127,_0x31ff6a={}){const _0x3cc489=_0x3d918c,_0x1fd741=join(_0x4be5e0,'openclaw',_0x3cc489(0x315),'extensio'+'ns','qqbot',_0x3cc489(0x315));if(!existsSync(_0x1fd741)){_0x31ff6a['runtimeL'+_0x3cc489(0x10a)]?.[_0x3cc489(0xc9)]?.(_0x3cc489(0x246)+_0x3cc489(0xee)+_0x3cc489(0x150)+'oute\x20pat'+_0x3cc489(0x29b)+_0x3cc489(0x11d)+_0x3cc489(0x160)+'nstalled',{'openclawVersion':_0x4a4127[_0x3cc489(0x21d)+_0x3cc489(0x323)],'distDir':_0x1fd741});return;}const _0x511ad6=(await readdir(_0x1fd741,{'withFileTypes':!![]})[_0x3cc489(0x298)](()=>[]))[_0x3cc489(0x254)](_0x4dde76=>_0x4dde76[_0x3cc489(0x2b7)]()&&_0x4dde76[_0x3cc489(0x22d)]['endsWith'](_0x3cc489(0x153)))[_0x3cc489(0x1f6)](_0x5443ae=>join(_0x1fd741,_0x5443ae[_0x3cc489(0x22d)]));for(const _0x1f6b64 of _0x511ad6){const _0x41dcda=await readFile(_0x1f6b64,'utf8'),_0x78cc30=patchQQBotOutboundSessionRouteFromSource(_0x41dcda);if(!_0x78cc30[_0x3cc489(0x32c)]){if(_0x78cc30[_0x3cc489(0x2f3)]==='already-'+'patched'){_0x31ff6a[_0x3cc489(0x285)+_0x3cc489(0x10a)]?.[_0x3cc489(0xc9)]?.('qqbot\x20ou'+_0x3cc489(0xee)+_0x3cc489(0x150)+_0x3cc489(0x31b)+_0x3cc489(0xa7)+_0x3cc489(0x31f)+'ed',{'openclawVersion':_0x4a4127[_0x3cc489(0x21d)+_0x3cc489(0x323)],'filePath':_0x1f6b64});return;}continue;}await writeFile(_0x1f6b64,_0x78cc30[_0x3cc489(0x96)],_0x3cc489(0x1ce)),_0x31ff6a['runtimeL'+_0x3cc489(0x10a)]?.['info']?.(_0x3cc489(0x246)+_0x3cc489(0xee)+_0x3cc489(0x150)+'oute\x20pat'+_0x3cc489(0x2da)+'ed',{'openclawVersion':_0x4a4127[_0x3cc489(0x21d)+_0x3cc489(0x323)],'filePath':_0x1f6b64,'note':_0x3cc489(0x30a)+_0x3cc489(0x111)+'ibility\x20'+_0x3cc489(0x140)+_0x3cc489(0x2db)+_0x3cc489(0x14d)+'t\x20c2c\x20ou'+'tbound\x20d'+_0x3cc489(0xf8)+_0x3cc489(0x331)+'being\x20in'+_0x3cc489(0xdd)+_0x3cc489(0x277)+_0x3cc489(0x28f)+'rect\x20pee'+_0x3cc489(0x25b)});return;}_0x31ff6a[_0x3cc489(0x285)+_0x3cc489(0x10a)]?.[_0x3cc489(0x1b4)]?.(_0x3cc489(0x246)+'tbound\x20s'+_0x3cc489(0x150)+_0x3cc489(0x31b)+_0x3cc489(0x29b)+_0x3cc489(0x2af)+_0x3cc489(0x18c)+_0x3cc489(0x2c1)+_0x3cc489(0x201),{'openclawVersion':_0x4a4127[_0x3cc489(0x21d)+_0x3cc489(0x323)],'distDir':_0x1fd741});}async function resolveRuntimeChannelImportPath(_0x33c481,_0x46ab94){const _0x1d4d38=_0x3d918c,_0x2f3090=_0x46ab94[_0x1d4d38(0x254)](_0x42faa3=>_0x42faa3[_0x1d4d38(0x2b7)]()&&_0x42faa3[_0x1d4d38(0x22d)][_0x1d4d38(0x1c6)+'th'](_0x1d4d38(0x27c)+_0x1d4d38(0x247))&&_0x42faa3[_0x1d4d38(0x22d)][_0x1d4d38(0xac)](_0x1d4d38(0x153))&&!_0x42faa3[_0x1d4d38(0x22d)]['startsWi'+'th'](_0x1d4d38(0x27c)+_0x1d4d38(0x247)+_0x1d4d38(0x270)))[_0x1d4d38(0x1f6)](_0x3defb2=>_0x3defb2['name'])[_0x1d4d38(0x20a)]();for(const _0x52673c of _0x2f3090){const _0x49794e=await readFile(join(_0x33c481,_0x52673c),_0x1d4d38(0x1ce));if(_0x49794e[_0x1d4d38(0x281)](_0x1d4d38(0x1d8)+_0x1d4d38(0xa2)+_0x1d4d38(0x213)))return'./'+_0x52673c;}return null;}function normalizeRuntimeRelativePath(_0x2841b9){return _0x2841b9['replaceA'+'ll']('\x5c','/');}function toWindowsPath(_0x54b57f){const _0x509e26=_0x3d918c;return _0x54b57f[_0x509e26(0x19f)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x650858,_0x1a2732){const _0x19a33d=_0x3d918c;if(_0x650858[_0x19a33d(0x232)+'ion']===_0x1a2732[_0x19a33d(0x21d)][_0x19a33d(0x232)+_0x19a33d(0x156)])return;throw new Error(_0x19a33d(0x1eb)+_0x19a33d(0x232)+_0x19a33d(0x273)+_0x19a33d(0x1c1)+_0x19a33d(0x1ef)+(_0x650858[_0x19a33d(0x232)+_0x19a33d(0x156)]||'unknown')+(_0x19a33d(0x252)+'config=')+_0x1a2732[_0x19a33d(0x21d)][_0x19a33d(0x232)+_0x19a33d(0x156)]+'.\x20'+(_0x19a33d(0xd9)+_0x19a33d(0xc8)+_0x19a33d(0x191)+_0x19a33d(0x26a)+_0x19a33d(0xb4)+_0x19a33d(0x1ab)+_0x19a33d(0x2bc)+_0x19a33d(0x2e4)+_0x19a33d(0x275)+_0x19a33d(0x316)+_0x19a33d(0x24f)+_0x19a33d(0x19a)+'.'));}function validateRuntimeOpenClawVersion(_0x2ab26f,_0x5b41c2){const _0x5f5d24=_0x3d918c;if(_0x2ab26f[_0x5f5d24(0x21d)+_0x5f5d24(0x323)]===_0x5b41c2['openclaw'][_0x5f5d24(0x21d)+_0x5f5d24(0x323)])return;throw new Error(_0x5f5d24(0x1eb)+'openclaw'+_0x5f5d24(0xcb)+_0x5f5d24(0x171)+_0x5f5d24(0x1ac)+_0x5f5d24(0x13d)+(_0x2ab26f[_0x5f5d24(0x21d)+_0x5f5d24(0x323)]||_0x5f5d24(0xa5))+(_0x5f5d24(0x252)+_0x5f5d24(0x1e3))+_0x5b41c2[_0x5f5d24(0x21d)][_0x5f5d24(0x21d)+_0x5f5d24(0x323)]+'.\x20'+(_0x5f5d24(0xd9)+_0x5f5d24(0xc8)+'\x20prepare'+'\x22\x20so\x20the'+'\x20runtime'+_0x5f5d24(0x1fd)+'tall\x20the'+'\x20configu'+_0x5f5d24(0x222)+_0x5f5d24(0x2ec)+_0x5f5d24(0x2be)));}function parseNpmPackJson(_0x4ae1cb){const _0x53f580=_0x3d918c,_0x5311c4=_0x4ae1cb[_0x53f580(0x2f9)](),_0x532a67=_0x5311c4[_0x53f580(0x163)]('[');if(_0x532a67<0x0)throw new Error(_0x53f580(0xa4)+_0x53f580(0x234)+'\x20return\x20'+_0x53f580(0x1e1)+_0x5311c4[_0x53f580(0x1a5)](0x0,0x1f4));const _0x19a190=JSON[_0x53f580(0x276)](_0x5311c4[_0x53f580(0x1a5)](_0x532a67)),_0x4f2f70=Array[_0x53f580(0x233)](_0x19a190)?_0x19a190[0x0]:_0x19a190;if(!_0x4f2f70||typeof _0x4f2f70!==_0x53f580(0x112))throw new Error(_0x53f580(0xa4)+_0x53f580(0x239)+_0x53f580(0xdf)+_0x53f580(0xf9)+_0x53f580(0x319)+_0x5311c4[_0x53f580(0x1a5)](0x0,0x1f4));return _0x4f2f70;}function normalizePackedTarballFilename(_0xece905){const _0x55c2e1=_0x3d918c;return _0xece905[_0x55c2e1(0x1d7)](/^@/,'')['replaceA'+'ll']('/','-')[_0x55c2e1(0x19f)+'ll']('\x5c','-');}async function runProcess(_0x2cf4f9,_0x460747,_0x7ede80={}){const _0x381122=_0x3d918c,_0x1a0a6a=_0x7ede80[_0x381122(0x240)]||[_0x2cf4f9,..._0x460747]['join']('\x20'),_0x164ff0=_0x7ede80['timeoutM'+'s']??NPM_INSTALL_TIMEOUT_MS,_0x2864d1=spawn(_0x2cf4f9,_0x460747,{'cwd':_0x7ede80[_0x381122(0x25a)],'env':_0x7ede80[_0x381122(0x95)],'stdio':[_0x381122(0x2b0),'pipe','pipe']});return await new Promise((_0xc8c53f,_0x741598)=>{const _0x1b7163=_0x381122;let _0x18edbc='',_0x43c5a4='',_0x59a167=![];const _0x599f23=setTimeout(()=>{const _0x978511=_0x1d92;if(_0x59a167)return;_0x59a167=!![],_0x2864d1['kill'](_0x978511(0x1d0)),_0x741598(new Error(_0x1a0a6a+(_0x978511(0x253)+_0x978511(0x18e)+'\x20')+_0x164ff0+'ms'));},_0x164ff0);_0x2864d1[_0x1b7163(0xfd)]['on']('data',_0x43504d=>{const _0x490f57=_0x1b7163;_0x18edbc+=_0x43504d[_0x490f57(0x174)]();}),_0x2864d1[_0x1b7163(0x2c5)]['on'](_0x1b7163(0x2d8),_0x5a4005=>{const _0x383c01=_0x1b7163;_0x43c5a4+=_0x5a4005[_0x383c01(0x174)]();}),_0x2864d1['on'](_0x1b7163(0x2aa),_0x2462f8=>{if(_0x59a167)return;_0x59a167=!![],clearTimeout(_0x599f23),_0x741598(_0x2462f8);}),_0x2864d1['on'](_0x1b7163(0x309),(_0xd42766,_0x48792f)=>{const _0x5745ff=_0x1b7163;if(_0x59a167)return;_0x59a167=!![],clearTimeout(_0x599f23);if(_0xd42766===0x0){_0xc8c53f({'stdout':_0x18edbc,'stderr':_0x43c5a4});return;}_0x741598(new Error(_0x1a0a6a+(_0x5745ff(0xc2)+_0x5745ff(0x121)+'e=')+(_0xd42766??'null')+_0x5745ff(0x1ba)+(_0x48792f??_0x5745ff(0x15b))+'\x0a'+(''+(_0x43c5a4||_0x18edbc))[_0x5745ff(0x2f9)]()));});});}async function installOpenClawPackage(_0x2bde9e,_0x3c4990){const _0x286cc4=_0x3d918c,_0x2dc38c=join(_0x2bde9e[_0x286cc4(0x207)+_0x286cc4(0x302)],'.cache'),_0x378a4b=join(_0x2bde9e['runtimeR'+_0x286cc4(0x302)],'.opencla'+_0x286cc4(0x258)+'t');await mkdir(_0x2dc38c,{'recursive':!![]}),await removePathWithRetries(_0x378a4b),await mkdir(_0x378a4b,{'recursive':!![]});const _0x50b9f2=await createRuntimeEnv(_0x2bde9e),_0x59e34c='openclaw'+'@'+_0x3c4990;console['log'](_0x286cc4(0xbc)+'hell:run'+'time]\x20in'+_0x286cc4(0x1d3)+'\x20'+_0x59e34c);const _0x4e031f=await runProcess(_0x2bde9e[_0x286cc4(0x334)+_0x286cc4(0x219)],[_0x2bde9e[_0x286cc4(0x1e5)],'pack',_0x59e34c,_0x286cc4(0x22a)],{'cwd':_0x2dc38c,'env':_0x50b9f2,'label':'npm\x20pack'+'\x20'+_0x59e34c}),_0xf058fb=parseNpmPackJson(_0x4e031f[_0x286cc4(0xfd)]);if(_0xf058fb['version']!==_0x3c4990)throw new Error(_0x286cc4(0x296)+_0x286cc4(0x196)+_0x286cc4(0xfe)+_0x3c4990+(_0x286cc4(0x236)+_0x286cc4(0x1f7))+_0xf058fb[_0x286cc4(0xae)]);const _0x2a7cbd=resolve(_0x2dc38c,_0xf058fb[_0x286cc4(0xe9)]);if(!existsSync(_0x2a7cbd))throw new Error('npm\x20pack'+'\x20did\x20not'+_0x286cc4(0x152)+_0x286cc4(0x32e)+'\x20'+_0x2a7cbd);await runProcess(_0x286cc4(0x151),[_0x286cc4(0xea),_0x2a7cbd,'-C',_0x378a4b],{'label':'extract\x20'+_0xf058fb[_0x286cc4(0xe9)]}),await removePathWithRetries(_0x2bde9e[_0x286cc4(0x21d)+_0x286cc4(0x1a6)+'ir']),await rename(join(_0x378a4b,'package'),_0x2bde9e[_0x286cc4(0x21d)+_0x286cc4(0x1a6)+'ir']),await removePathWithRetries(_0x378a4b),await runProcess(_0x2bde9e[_0x286cc4(0x334)+_0x286cc4(0x219)],[_0x2bde9e['npmCli'],_0x286cc4(0x312),_0x286cc4(0x2dc)+'ev','--omit=p'+_0x286cc4(0xc1),_0x286cc4(0x261)+'it',_0x286cc4(0x144)+'d',_0x286cc4(0x108)+_0x286cc4(0x2f5)+'ps'],{'cwd':_0x2bde9e[_0x286cc4(0x21d)+_0x286cc4(0x1a6)+'ir'],'env':_0x50b9f2,'label':'npm\x20inst'+_0x286cc4(0x328)+_0x59e34c+(_0x286cc4(0x1ab)+_0x286cc4(0x2cf)+_0x286cc4(0x264))});if(!existsSync(_0x2bde9e['openclaw'+_0x286cc4(0x2d5)]))throw new Error('OpenClaw'+_0x286cc4(0x12f)+_0x286cc4(0xc7)+_0x286cc4(0x1fc)+'\x20install'+':\x20'+_0x2bde9e['openclaw'+_0x286cc4(0x2d5)]);}async function ensureRuntimeBase(_0x28e03f,_0x5275a6,_0x156cbd={}){const _0x27129a=_0x3d918c;await mkdir(_0x5275a6,{'recursive':!![]});let _0x4a2b63=await readRuntimeManifest(_0x5275a6);const _0x48494a=_0x28e03f['openclaw'][_0x27129a(0x232)+'ion'],_0x276d29=_0x28e03f['openclaw']['openclaw'+_0x27129a(0x323)],_0x5e0628=existsSync(resolveManifestPath(_0x5275a6)),_0x449392=runtimeHasRequiredPaths(_0x5275a6,_0x4a2b63),_0x2ad4b6=_0x4a2b63[_0x27129a(0x232)+_0x27129a(0x156)]===_0x48494a;!_0x5e0628||!_0x449392||!_0x2ad4b6?(_0x156cbd['runtimeL'+_0x27129a(0x10a)]?.[_0x27129a(0x143)+'t']?.(_0x27129a(0x1eb)+_0x27129a(0x185)+_0x27129a(0x1f4)+'ed',{'runtimeRoot':_0x5275a6,'reason':!_0x5e0628?_0x27129a(0x1d1)+_0x27129a(0x209):!_0x449392?_0x27129a(0x1d1)+_0x27129a(0x130)+_0x27129a(0x1ab)+_0x27129a(0xd7):_0x27129a(0x10d)+_0x27129a(0x2e5)+_0x27129a(0x1c0),'syncOnly':_0x156cbd[_0x27129a(0x184)]}),_0x4a2b63=await buildRuntimeBase(_0x28e03f,_0x5275a6,_0x4a2b63),_0x156cbd['runtimeL'+_0x27129a(0x10a)]?.[_0x27129a(0x143)+'t']?.(_0x27129a(0x1eb)+'base\x20bui'+_0x27129a(0x19d)+'eted',{'manifest':summarizeRuntimeManifest(_0x4a2b63)})):_0x156cbd[_0x27129a(0x285)+_0x27129a(0x10a)]?.['importan'+'t']?.(_0x27129a(0x1eb)+_0x27129a(0x327)+_0x27129a(0x26c)+_0x27129a(0x192),{'manifest':summarizeRuntimeManifest(_0x4a2b63)});if(!existsSync(resolve(_0x5275a6,_0x4a2b63[_0x27129a(0x21d)+_0x27129a(0x2d5)]))){const _0x35f228=createRuntimeInfoFromManifest(_0x5275a6,_0x4a2b63,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x35f228,_0x276d29),_0x4a2b63[_0x27129a(0x21d)+'Version']=_0x276d29;}return _0x4a2b63;}function runtimeHasRequiredPaths(_0x17f4c2,_0x1efaa6){const _0x5823cd=_0x3d918c;return[_0x5823cd(0x334)+_0x5823cd(0x219),_0x5823cd(0x1e5),_0x5823cd(0x21d)+_0x5823cd(0x1a6)+'ir','openclaw'+_0x5823cd(0x2d5)][_0x5823cd(0x30f)](_0x53b0d8=>typeof _0x1efaa6[_0x53b0d8]==='string'&&_0x1efaa6[_0x53b0d8]['trim']())&&[_0x5823cd(0x334)+_0x5823cd(0x219),_0x5823cd(0x1e5)][_0x5823cd(0x30f)](_0x2038e7=>existsSync(resolve(_0x17f4c2,_0x1efaa6[_0x2038e7])));}function _0x4fd9(){const _0xf60fa=['json','ion','arm64','node/bin','\x20\x22OPENCL','synced','null','-id\x20head','log','ile\x20not\x20','6.6\x20chan','in\x20not\x20i','me\x20missi','aw\x202026.','indexOf','-weixin','ime/requ','tests','untime\x20r','tory\x20pro','ipped;\x20f','ready\x20ap','cal\x20runt','\x20path\x20mu','%~dp0\x22','npm-cach','cope\x20syn','tch\x20skip','mismatch','ed;\x20brid','route\x20pa','toString','channel\x20','dependen','-session','href','led','test','appId','doc','npm','_DIR%','LiteralP','r\x20OpenCl','shell-ru','in\x20','docs','syncOnly','base\x20bui','nodejs.o','atch\x20app','gin\x20not\x20','prepare\x20','\x20found','x64','nel\x20shap','index.mj','ut\x20after','.markdow','set\x20\x22OPE','\x20prepare','rent','enclaw-w','time-bri','location','ed\x20OpenC','aw-weixi','node/lib','ies','\x20version','find','?t=','ld\x20compl','-NoProfi','replaceA','\x20doctor\x20','AW_CONFI','node.exe','t\x20found','platform','slice','WorkingD','headers','annel\x20en','tools\x20sy','local\x20pl','\x20runtime',':\x20manife','pendenci','/node_mo','eady\x20app','@echo\x20of','er\x20writt','ache\x20bef','6969655omxvOI','warn','roductRu','.md','_NAME:-','kill\x20not','Bot\x20c2c\x20','\x20signal=','1\x20]\x20&&\x20[','.d.ts','pruned\x20r','nPath\x20$e','root','match','atch:\x20ma','lugin\x20','=\x22${OPEN','-xJf','product','startsWi','allback\x20','fix','ite\x20patc','https://','jection\x20','agent','aging','utf8','\x22\x20\x22%SCRI','SIGTERM','missing\x20','\x20written','stalling','e.exe','\x20applied','2604nLctCN','replace','createRu','referenc','NCLAW_ST','ntPaths','JIE_NO_L','n\x20plugin','lugins\x20s','.tools','ream\x20fix','JSON:\x20','examples','config=','und:\x20','npmCli','resolver','IPT_DIR=','leted','out\x20c2c\x20','fix\x20comp','runtime\x20','25663320uHQvSK','skills','package.','nifest=','ed-tool\x20','ent','configPa','\x20and\x20','ld\x20start','wujiecla','map','d\x20to\x20','ons\x20with','s\x20not\x20fo','nt-weixi','split','nd\x20after','\x20can\x20ins','.map','$HOME/','2021272jaEWHK','und','function','spec','in\x20insta','some','wBin','runtimeR','pluginId','manifest','sort','\x20shape\x20n','\x20entry\x20\x22','dencies','er\x20respo','LocalPlu','--omit=p','win32','NFIG_PAT','nnel','resolved','\x20patch\x20a','pe\x20not\x20f','FIG_FILE','plugins','utable','bridge\x20n','h\x20applie','er\x20id.','openclaw','ady\x20appl','ime\x20buil','m-cli.js','ATH:-','red\x20Open','execPath','--\x20\x22$(di','node/nod','eam\x20fix\x20','\x20validat','Spec','time]\x20do','--json','oot\x20was\x20','ad-','name','t\x20\x22OPENC','ENCLAW_H','ll\x20||\x20tr','SCRIPT_D','nodeVers','isArray','\x20did\x20not','CONFIG_P','\x20resolve','eixin\x20@i','endencie','\x20returne','STATE_DI','shift','if\x20\x22%OPE','pid','pluginSp','octor\x20--','label','ot\x20found','now','ntime\x20ch','atch\x20ski','director','qqbot\x20ou','channel-','package','el.inbou','Dependen','age\x20was\x20','ad\x20patch','ckaging','configur','red\x20Node','\x20mirrors','lib',',\x20shell.','\x20timed\x20o','filter','plied','Name','ame','w-extrac','npm\x20plug','cwd','r\x20id.','d\x20mirror','ntime','e\x20tools\x20','ped;\x20cha','provider','--no-aud','atch\x20alr','/npm','ncies','des.','scripts','ipped;\x20r','isDirect','keys','\x22\x20so\x20the','d\x20as\x20gro','eady\x20cur','49227KeqpgL','w.mjs','ied','state-','extract\x20','y\x20applie','ion\x20mism','NCLAW_CO','with\x20the','parse','th\x20c2c\x20i','try\x20not\x20','id\x20title','HIVE\x20-De','NCLAW_HO','runtime-','ugin\x20dep','process.','\x20request','#!/bin/s','includes','arch','allowMis','ILE_NAME','runtimeL','n/opencl','s\x20to\x20dir','time-too','ugin\x20spe','integrit','pt-path-','n\x20outbou','set','npm-cli.','n\x20the\x20di','o\x20resolv','\x20kdocs\x20s','path:\x20','mjs','pped;\x20ru','store-lo','Configur','singOpen','catch','45qakmyM','exec\x20\x22$S','ch\x20skipp','fix\x20star','versions','e\x20upgrad','PT_DIR/','38jojZKg','rcing\x20op','OPENCLAW','or.com','utbound\x20','@types','wnloadin',';\x20provid','.npmmirr','hell:run','error','-Executi','already-','er\x20patch','toLowerC','ed;\x20chan','ignore','all\x20plug','6353160WWwWPx','(empty)','ATE_DIR:','has','tch\x20alre','isFile','\x22\x20%*','ell-runt','ibility\x20','string','\x20can\x20be\x20','fy\x20upstr','sion.','LocalSki','nd\x20helpe','e\x20not\x20fo','ME%\x22==\x22\x22','local','agents\x20s','stderr','\x20loaded','solver\x20n','dataDir','ath','es\x20','add','pplied','nloads-b','ct\x20sessi','\x20depende','o.mjs\x22\x202','nd\x20deliv','_modules','request-','kill','Bin','bytes','store\x20wr','data','ie-logo.','ch\x20appli','r\x20@openc','--omit=d','E_DIR=','bug;\x20ver','Invalid\x20','m/bin/np','aipc-run','plugin\x20r','Bypass','rebuilt\x20','sion\x20mis','OME=','tool\x20his','push','node_mod','plugin\x20s','PT_DIR%','Claw\x20ver','\x22==\x22\x22\x20se','.tmp/run','stinatio','sessions','d:\x20','\x20package','reason','chat-dis','-peer-de','ules/npm','/node','lled','trim','rcing\x20QQ','Expand-A','idated','shasum','ginPaths','vel\x20entr','%USERPRO','OOT\x20-For','oot','ect\x20sess','\x20-g','node-v','fix\x20alre','onPolicy','n\x20the\x20pe','close','Temporar','FILE%\x5c','../../sh','configFi','jie-shel','every','CRIPT_DI','get','install','ies:\x20','ll.exe','dist','\x20configu','tching\x20p','generate','load:\x20','pec:\x20','oute\x20pat','enclaw\x20d','go.mjs','../../as','dy\x20appli','able','store\x20lo','optional','Version','ed\x20npm\x20p','__tests_','patch\x20sk','base\x20alr','all\x20','_SHELL_E','path','d\x20Node\x20r','patched','6\x20mixed\x20','tarball:','ng\x20chann','h\x20alread','mirrors\x20','fix\x20mark','.cache','nodeExec','nse\x20hook','ons;\x20ver','agents','env','source','cies','>/dev/nu','product\x20','ory','loader-','rchive\x20-','\x20already','HOME=\x22${','l\x20prepar','\x20install','\x20id\x20from','ntimeCha','\x20summary','npm\x20pack','unknown','ipped;\x20o','ch\x20alrea','\x20routing','tory\x20mix',':WUJIE_S','files','endsWith','pipe','version','d\x20for\x20lo','\x20patch\x20s','shape\x20no','ime/sess','ules','\x20product','st\x20be\x20a\x20','src','dataDirN','toISOStr','\x22\x20at\x20','\x20to\x20dire','ecs','[wujie-s','channel.','\x20skipped','.json','XTRACT_R','eer','\x20failed\x20','untime\x20p','\x20outboun','lugin\x20de','ipped;\x20d','\x20not\x20fou','ie-shell','info','Duplicat','Version\x20','nel\x20plug','\x22\x20\x22$@\x22','nnel\x20sha','ayload\x20b','ujie-log','prepareP','ors\x20bein','OGO\x22\x20];\x20','all\x20loca','s\x20instal','ing\x20\x22','\x20paths','failed','Run\x20\x22wuj','registry','pack','n/npm-cl','dexed\x20wi','length','d\x20an\x20inv','lied','extensio','entryCou','transcri','npm-glob','\x20in\x20','--fix','&&\x20pwd)','ore\x20pack','filename','-xzf','tbound\x20f','node','devDepen','tbound\x20s','time','npm\x20inst','up\x20sessi','statusCo','time]\x20fe','\x20path\x20wa','==\x22\x22\x20set','w.cmd','export\x20O','elivery\x20','alid\x20pay','weixin\x20o','bridge.m','Extracte','stdout','law\x20','ced','installP','doctor','PENCLAW_','store-','found','LAW_STAT','prefix\x20i','re\x20upgra','--legacy','example','ogger','bin','R=\x22${OPE','node\x20ver','on\x20futur','fallback','lib/node','y\x20compat','object','scoped\x20s','then','es.','outbound','skills\x20s','\x20is\x20miss','patch\x20al','lark-cli','1119406tWTtlq','s/npm','ed;\x20plug','\x5cwjrt-','e_module','ing','with\x20cod','if\x20[\x20-t\x20','plugins\x20','local:','_shared','1670NGPtMy','not\x20foun','ions\x20whe','wujieai.','play-pro','efore\x20pa','time]\x20in','rg/dist/','\x20on\x20futu','\x20bin\x20was','required','kipped;\x20','exec','lready\x20a','resume','chat\x20his','in\x20runti','ify\x20upst','ery\x20mirr','LocalAge','y:\x20','llPaths','set\x20\x22SCR','st=','values','join','patch\x20fo','\x20synced','r\x20runtim','importan','--no-fun','l\x20plugin','ynced','session\x20','agentSco','projectR','kup','.node','aipc-dow','law/qqbo','ailable.','\x20local\x20p','ession\x20r','tar','\x20create\x20','.js',';\x20dist\x20n'];_0x4fd9=function(){return _0xf60fa;};return _0x4fd9();}async function buildRuntimeBase(_0x12b3d5,_0x576a38,_0x46d387={}){const _0x355327=_0x3d918c,_0x56ebe4=join(_0x576a38,_0x355327(0xec));await ensureRuntimeNode(_0x12b3d5,_0x56ebe4);const _0x1fba70=process['platform']===_0x355327(0x211)?_0x355327(0x225)+_0x355327(0x1d4):_0x355327(0x158)+_0x355327(0x2f7),_0x178259=process[_0x355327(0x1a4)]===_0x355327(0x211)?_0x355327(0x225)+_0x355327(0x11f)+'s/npm/bi'+_0x355327(0xdc)+'i.js':_0x355327(0x198)+_0x355327(0x1ae)+'dules/np'+_0x355327(0x2e0)+_0x355327(0x220),_0x24ef13={..._0x46d387,'generatedAt':new Date()[_0x355327(0xb8)+_0x355327(0x120)](),'nodeVersion':_0x12b3d5['openclaw'][_0x355327(0x232)+_0x355327(0x156)],'openclawVersion':_0x46d387['openclaw'+_0x355327(0x323)]||'','platform':process['platform'],'arch':process[_0x355327(0x282)],'nodeExecutable':_0x1fba70,'npmCli':_0x178259,'openclawWorkingDir':_0x355327(0x21d),'openclawBin':_0x355327(0x21d)+'/opencla'+_0x355327(0x26e)};return await writeJson(resolveManifestPath(_0x576a38),_0x24ef13),_0x24ef13;}async function removePathWithRetries(_0x383384){await rm(_0x383384,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}async function ensureRuntimeNode(_0x527f7f,_0xbd59db){const _0x139222=_0x3d918c,_0x2e2b65=_0x527f7f['openclaw']['nodeVers'+_0x139222(0x156)],_0x4b84bf=process[_0x139222(0x1a4)]===_0x139222(0x211)?join(_0xbd59db,_0x139222(0x1a2)):join(_0xbd59db,_0x139222(0x10b),_0x139222(0xec)),_0x2083de=process[_0x139222(0x1a4)]===_0x139222(0x211)?join(_0xbd59db,_0x139222(0x2e9)+_0x139222(0xb3),'npm',_0x139222(0x10b),'npm-cli.'+'js'):join(_0xbd59db,'lib',_0x139222(0x2e9)+'ules',_0x139222(0x17d),'bin',_0x139222(0x28e)+'js');if(existsSync(_0x4b84bf)&&existsSync(_0x2083de)&&await getNodeVersion(_0x4b84bf)===_0x2e2b65)return;await removePathWithRetries(_0xbd59db);if(process[_0x139222(0x29d)]['node']===_0x2e2b65){await linkCurrentNodeRuntime(_0xbd59db);return;}await downloadNodeRuntime(_0x2e2b65,_0xbd59db);}async function getNodeVersion(_0x1f72d2){const _0x225708=_0x3d918c;try{const _0x483c6f=await runProcess(_0x1f72d2,['-p',_0x225708(0x27e)+_0x225708(0x29d)+_0x225708(0x14b)],{'label':_0x1f72d2+_0x225708(0x19a),'timeoutMs':0x7530});return _0x483c6f[_0x225708(0xfd)][_0x225708(0x2f9)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x3b45a2){const _0x135680=_0x3d918c,_0x416aef=process[_0x135680(0x223)],_0x5ce336=resolve(dirname(_0x416aef),'..'),_0x2368d3=process[_0x135680(0x1a4)]===_0x135680(0x211)?resolve(_0x5ce336,_0x135680(0x2e9)+_0x135680(0x2f6)):resolve(_0x5ce336,_0x135680(0x110)+_0x135680(0x2d2)+_0x135680(0x263)),_0x3cb50c=process[_0x135680(0x1a4)]===_0x135680(0x211)?join(_0x3b45a2,_0x135680(0x1a2)):join(_0x3b45a2,'bin',_0x135680(0xec)),_0x939adc=process['platform']===_0x135680(0x211)?join(_0x3b45a2,'node_mod'+_0x135680(0xb3),_0x135680(0x17d)):join(_0x3b45a2,_0x135680(0x251),_0x135680(0x2e9)+'ules',_0x135680(0x17d));await mkdir(dirname(_0x3cb50c),{'recursive':!![]}),await mkdir(dirname(_0x939adc),{'recursive':!![]}),await symlink(_0x416aef,_0x3cb50c),existsSync(_0x2368d3)?await symlink(_0x2368d3,_0x939adc):await symlink(await resolveNpmRoot(),_0x939adc);}async function resolveNpmRoot(){const _0x328616=_0x3d918c,_0x1ea27f=await runProcess(_0x328616(0x17d),['root','-g'],{'label':'npm\x20root'+_0x328616(0x304),'timeoutMs':0x7530}),_0x5d87f4=process[_0x328616(0x1a4)]===_0x328616(0x211)?_0x1ea27f['stdout'][_0x328616(0x2f9)]():join(_0x1ea27f[_0x328616(0xfd)][_0x328616(0x2f9)](),'npm');if(!existsSync(join(_0x5d87f4,_0x328616(0x10b),'npm-cli.'+'js')))throw new Error(_0x328616(0xa4)+_0x328616(0x24b)+'not\x20foun'+_0x328616(0xaf)+_0x328616(0x16b)+_0x328616(0x21f)+_0x328616(0x2f1)+_0x5d87f4);return _0x5d87f4;}async function resolveExtractedNodeRoot(_0x3c95dd,_0xeba5ec){const _0x37a20b=_0x3d918c,_0x5ca177=join(_0x3c95dd,_0xeba5ec);if(existsSync(_0x5ca177))return _0x5ca177;const _0x26ed51=await readdir(_0x3c95dd,{'withFileTypes':!![]}),_0x13b9bb=_0x26ed51[_0x37a20b(0x254)](_0x43f60a=>_0x43f60a['isDirect'+_0x37a20b(0x9a)]());if(_0x13b9bb[_0x37a20b(0xde)]===0x1)return join(_0x3c95dd,_0x13b9bb[0x0][_0x37a20b(0x22d)]);const _0x55c945=process[_0x37a20b(0x1a4)]==='win32'?join(_0x3c95dd,_0x37a20b(0x1a2)):join(_0x3c95dd,_0x37a20b(0x10b),'node');if(existsSync(_0x55c945))return _0x3c95dd;const _0x2f330c=await findNodeRuntimeRoot(_0x3c95dd);if(_0x2f330c)return _0x2f330c;const _0x3bea00=_0x26ed51[_0x37a20b(0x1f6)](_0x464e2f=>_0x464e2f['name'])[_0x37a20b(0x13f)](',\x20');throw new Error(_0x37a20b(0xfc)+_0x37a20b(0x32b)+_0x37a20b(0x167)+_0x37a20b(0x22b)+_0x37a20b(0x127)+'d\x20for\x20'+_0xeba5ec+_0x37a20b(0xe5)+_0x3c95dd+('.\x20Top-le'+_0x37a20b(0x2ff)+_0x37a20b(0x313))+(_0x3bea00||_0x37a20b(0x2b3)));}function resolveNodeExtractRoot(_0x2219a0,_0x1aa215,_0x35b971){const _0x598f7e=_0x3d918c;if(process['platform']!==_0x598f7e(0x211))return join(_0x2219a0,_0x1aa215+('-extract'+'-')+process[_0x598f7e(0x23d)]+'-'+Date[_0x598f7e(0x242)]()+'-'+_0x35b971);const _0x20f85d=/^[A-Za-z]:[\\/]/[_0x598f7e(0x132)](_0x2219a0),_0x36e2dd=parse(_0x2219a0),_0x2853c0=_0x20f85d?_0x20f85d[0x0][_0x598f7e(0x1a5)](0x0,0x2)+'\x5c':_0x36e2dd[_0x598f7e(0x1bf)]&&_0x36e2dd[_0x598f7e(0x1bf)]!=='/'?_0x36e2dd[_0x598f7e(0x1bf)]:_0x2219a0,_0x1c57ac=_0x2853c0[_0x598f7e(0x1d7)](/[\\/]+$/,'');return _0x1c57ac+_0x598f7e(0x11e)+process[_0x598f7e(0x23d)]+'-'+Date['now']()+'-'+_0x35b971;}async function findNodeRuntimeRoot(_0x5c23d0){const _0x2256d2=_0x3d918c,_0x5439cd=[_0x5c23d0],_0x4be828=new Set();while(_0x5439cd[_0x2256d2(0xde)]>0x0){const _0x29b1a8=_0x5439cd[_0x2256d2(0x23b)]();if(!_0x29b1a8||_0x4be828[_0x2256d2(0x2b5)](_0x29b1a8))continue;_0x4be828[_0x2256d2(0x2cb)](_0x29b1a8);const _0x717fa3=process[_0x2256d2(0x1a4)]==='win32'?join(_0x29b1a8,_0x2256d2(0x1a2)):join(_0x29b1a8,_0x2256d2(0x10b),_0x2256d2(0xec)),_0x339ac8=process[_0x2256d2(0x1a4)]===_0x2256d2(0x211)?join(_0x29b1a8,_0x2256d2(0x2e9)+_0x2256d2(0xb3),'npm','bin','npm-cli.'+'js'):join(_0x29b1a8,_0x2256d2(0x251),_0x2256d2(0x2e9)+_0x2256d2(0xb3),'npm','bin',_0x2256d2(0x28e)+'js');if(existsSync(_0x717fa3)&&existsSync(_0x339ac8))return _0x29b1a8;const _0x5accef=await readdir(_0x29b1a8,{'withFileTypes':!![]});for(const _0x4fa8b0 of _0x5accef){_0x4fa8b0[_0x2256d2(0x268)+_0x2256d2(0x9a)]()&&_0x5439cd[_0x2256d2(0x2e8)](join(_0x29b1a8,_0x4fa8b0[_0x2256d2(0x22d)]));}}return'';}async function downloadNodeRuntime(_0x4223ff,_0x1d4d8d){const _0x180d85=_0x3d918c,_0x21e65f=process['platform']===_0x180d85(0x211)?'win':process['platform'],_0x259fce=process['arch']==='x64'?_0x180d85(0x18b):process[_0x180d85(0x282)]===_0x180d85(0x157)?_0x180d85(0x157):process[_0x180d85(0x282)],_0x120052=process['platform']==='win32'?'zip':'tar.xz',_0x556cbb=_0x180d85(0x305)+_0x4223ff+'-'+_0x21e65f+'-'+_0x259fce,_0x5f9f70=_0x556cbb+'.'+_0x120052,_0x4d1c5c=join(dirname(_0x1d4d8d),_0x180d85(0x333)),_0x5974ce=join(_0x4d1c5c,_0x5f9f70),_0x588b17=_0x180d85(0x1ca)+_0x180d85(0x186)+_0x180d85(0x12d)+'v'+_0x4223ff+'/'+_0x5f9f70;await mkdir(_0x4d1c5c,{'recursive':!![]});const _0x2b2e74=resolveNodeExtractRoot(_0x4d1c5c,_0x556cbb,0x1);!existsSync(_0x5974ce)&&(console[_0x180d85(0x15d)](_0x180d85(0xbc)+_0x180d85(0x2a9)+_0x180d85(0x229)+_0x180d85(0x2a6)+'g\x20'+_0x588b17),await downloadFile(_0x588b17,_0x5974ce));await rm(_0x2b2e74,{'recursive':!![],'force':!![]}),await mkdir(_0x2b2e74,{'recursive':!![]});process['platform']===_0x180d85(0x211)?await extractZipArchive(_0x5974ce,_0x2b2e74,_0x5f9f70):await runProcess('tar',[_0x180d85(0x1c4),_0x5974ce,'-C',_0x2b2e74],{'label':'extract\x20'+_0x5f9f70});const _0xb66ad7=await resolveExtractedNodeRoot(_0x2b2e74,_0x556cbb);await mkdir(dirname(_0x1d4d8d),{'recursive':!![]}),await rename(_0xb66ad7,_0x1d4d8d),_0xb66ad7!==_0x2b2e74&&await rm(_0x2b2e74,{'recursive':!![],'force':!![]});}async function extractZipArchive(_0xd709e3,_0x1b21b0,_0x4c9a3f){const _0x43214a=_0x3d918c;await runProcess('powershe'+_0x43214a(0x314),[_0x43214a(0x19e)+'le',_0x43214a(0x2ab)+_0x43214a(0x307),_0x43214a(0x2e3),'-Command',_0x43214a(0x2fb)+_0x43214a(0x9c)+_0x43214a(0x17f)+'ath\x20$env'+_0x43214a(0xaa)+'HELL_ARC'+_0x43214a(0x27a)+_0x43214a(0x2ef)+_0x43214a(0x1be)+'nv:WUJIE'+_0x43214a(0x329)+_0x43214a(0xc0)+_0x43214a(0x301)+'ce'],{'env':{...process.env,'WUJIE_SHELL_ARCHIVE':_0xd709e3,'WUJIE_SHELL_EXTRACT_ROOT':_0x1b21b0},'label':_0x43214a(0x271)+_0x4c9a3f});}async function downloadFile(_0x552155,_0x10574e){await mkdir(dirname(_0x10574e),{'recursive':!![]});const _0x359dc0=await new Promise((_0xefcf19,_0x18845a)=>{get(_0x552155,_0x2beda6=>{const _0x5739e3=_0x1d92;if(_0x2beda6[_0x5739e3(0xf2)+'de']>=0x12c&&_0x2beda6[_0x5739e3(0xf2)+'de']<0x190&&_0x2beda6['headers'][_0x5739e3(0x195)]){_0x2beda6[_0x5739e3(0x134)](),downloadFile(new URL(_0x2beda6[_0x5739e3(0x1a7)][_0x5739e3(0x195)],_0x552155)[_0x5739e3(0x178)],_0x10574e)[_0x5739e3(0x114)](()=>_0xefcf19(null))[_0x5739e3(0x298)](_0x18845a);return;}if(_0x2beda6[_0x5739e3(0xf2)+'de']!==0xc8){_0x2beda6['resume'](),_0x18845a(new Error('download'+'\x20failed\x20'+_0x2beda6['statusCo'+'de']+':\x20'+_0x552155));return;}_0xefcf19(_0x2beda6);})['on']('error',_0x18845a);});_0x359dc0&&await pipeline(_0x359dc0,createWriteStream(_0x10574e));}export async function ensureOpenClawDoctorFixed(_0x4e3242,_0x105d92={}){const _0x3b0cb7=_0x3d918c,_0x332655=await loadRuntimeInfo(_0x4e3242[_0x3b0cb7(0x149)+'oot']),_0x358fc1=getConfigPaths(_0x4e3242),_0x4e6202=join(_0x358fc1['runtimeS'+'tateDir'],_0x3b0cb7(0x21d)+'-doctor.'+'json'),_0xbc6186=await readJson(_0x4e6202,{});if(_0xbc6186['openclaw'+_0x3b0cb7(0x323)]===_0x332655[_0x3b0cb7(0x21d)+'Version'])return _0x105d92[_0x3b0cb7(0x285)+_0x3b0cb7(0x10a)]?.[_0x3b0cb7(0xc9)](_0x3b0cb7(0x21d)+'\x20doctor\x20'+_0x3b0cb7(0x306)+'ady\x20curr'+_0x3b0cb7(0x1f1),{'openclawVersion':_0x332655['openclaw'+_0x3b0cb7(0x323)],'markerPath':_0x4e6202}),{'ran':![],'openclawVersion':_0x332655[_0x3b0cb7(0x21d)+_0x3b0cb7(0x323)],'markerPath':_0x4e6202};return await runOpenClawDoctorFix(_0x4e3242,_0x332655,{'fromVersion':_0xbc6186[_0x3b0cb7(0x21d)+'Version']||_0x3b0cb7(0xa5),'toVersion':_0x332655[_0x3b0cb7(0x21d)+_0x3b0cb7(0x323)],'markerPath':_0x4e6202,'runtimeLogger':_0x105d92[_0x3b0cb7(0x285)+_0x3b0cb7(0x10a)]}),{'ran':!![],'openclawVersion':_0x332655['openclaw'+_0x3b0cb7(0x323)],'markerPath':_0x4e6202};}async function runOpenClawDoctorFix(_0x30536a,_0x186a1d,{fromVersion:_0x8f71ec,toVersion:_0x176d28,markerPath:markerPath='',runtimeLogger:_0x1ff076}={}){const _0x5e690b=_0x3d918c;_0x1ff076?.[_0x5e690b(0x143)+'t']?.(_0x5e690b(0x21d)+_0x5e690b(0x1a0)+_0x5e690b(0x29c)+'ted',{'fromVersion':_0x8f71ec,'toVersion':_0x176d28});const _0x3c7257=await createRuntimeEnv(_0x186a1d,{'OPENCLAW_HOME':_0x30536a['dataDir'],'OPENCLAW_STATE_DIR':_0x30536a[_0x5e690b(0x2c8)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x30536a)[_0x5e690b(0x1f2)+'th']});console['log'](_0x5e690b(0xbc)+_0x5e690b(0x2a9)+'time]\x20ru'+'nning\x20op'+_0x5e690b(0x31c)+_0x5e690b(0x23f)+_0x5e690b(0x1c8));const _0x2fb083=await runProcess(_0x186a1d[_0x5e690b(0x334)+_0x5e690b(0x219)],[_0x186a1d[_0x5e690b(0x21d)+'Bin'],_0x5e690b(0x101),_0x5e690b(0xe6)],{'cwd':_0x186a1d[_0x5e690b(0x21d)+'WorkingD'+'ir'],'env':_0x3c7257,'label':'openclaw'+_0x5e690b(0x1a0)+'--fix','timeoutMs':0x1d4c0});_0x1ff076?.['importan'+'t']?.(_0x5e690b(0x21d)+_0x5e690b(0x1a0)+_0x5e690b(0x1ea)+_0x5e690b(0x1e8),{'fromVersion':_0x8f71ec,'toVersion':_0x176d28,'stdout':_0x2fb083[_0x5e690b(0xfd)][_0x5e690b(0x2f9)]()[_0x5e690b(0x1a5)](-0xfa0),'stderr':_0x2fb083[_0x5e690b(0x2c5)][_0x5e690b(0x2f9)]()[_0x5e690b(0x1a5)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x186a1d['openclaw'+'Version'],'fixedAt':new Date()[_0x5e690b(0xb8)+_0x5e690b(0x120)]()}),_0x1ff076?.[_0x5e690b(0x143)+'t']?.('openclaw'+'\x20doctor\x20'+_0x5e690b(0x332)+_0x5e690b(0x1b1)+'en',{'markerPath':markerPath,'openclawVersion':_0x186a1d[_0x5e690b(0x21d)+_0x5e690b(0x323)]}));}export async function readRuntimeManifest(_0x387b8d){return await readJson(resolveManifestPath(_0x387b8d),{});}export async function loadRuntimeInfo(_0x45f1e7){const _0x5da5e1=resolveRuntimeRoot(_0x45f1e7),_0x20dc2f=await readRuntimeManifest(_0x5da5e1);return createRuntimeInfoFromManifest(_0x5da5e1,_0x20dc2f);}function createRuntimeInfoFromManifest(_0x49c32c,_0x5675ec,_0x77151d={}){const _0x54e515=_0x3d918c;for(const _0x174506 of[_0x54e515(0x334)+_0x54e515(0x219),_0x54e515(0x1e5),_0x54e515(0x21d)+_0x54e515(0x1a6)+'ir',_0x54e515(0x21d)+_0x54e515(0x2d5)]){if(typeof _0x5675ec[_0x174506]!==_0x54e515(0x2bb)||!_0x5675ec[_0x174506]['trim']())throw new Error(_0x54e515(0x1eb)+_0x54e515(0x209)+_0x54e515(0x118)+_0x54e515(0xd6)+_0x174506+_0x54e515(0xb9)+resolveManifestPath(_0x49c32c)+(';\x20run\x20wu'+_0x54e515(0x30e)+_0x54e515(0x9f)+'e'));}const _0x4e8179=resolve(_0x49c32c,_0x5675ec['nodeExec'+_0x54e515(0x219)]),_0x502c75=resolve(_0x49c32c,_0x5675ec[_0x54e515(0x1e5)]),_0x27745b=resolve(_0x49c32c,_0x5675ec[_0x54e515(0x21d)+_0x54e515(0x1a6)+'ir']),_0x11ccef=resolve(_0x49c32c,_0x5675ec[_0x54e515(0x21d)+'Bin']),_0x14eea2=Array['isArray'](_0x5675ec[_0x54e515(0x218)])?_0x5675ec[_0x54e515(0x218)][_0x54e515(0x1f6)](_0x27a9dd=>({..._0x27a9dd,'installPath':resolve(_0x49c32c,_0x27a9dd['installP'+_0x54e515(0x2c9)])})):[],_0x193d90=_0x77151d[_0x54e515(0x283)+_0x54e515(0x297)+'Claw']?[_0x4e8179,_0x502c75]:[_0x4e8179,_0x502c75,_0x27745b,_0x11ccef];for(const _0x4dbdbb of _0x193d90){if(!existsSync(_0x4dbdbb))throw new Error(_0x54e515(0x1eb)+_0x54e515(0x1d1)+_0x54e515(0x292)+_0x4dbdbb);}return{'runtimeRoot':_0x49c32c,'manifest':_0x5675ec,'openclawVersion':_0x5675ec[_0x54e515(0x21d)+_0x54e515(0x323)]||'unknown','nodeExecutable':_0x4e8179,'npmCli':_0x502c75,'openclawWorkingDir':_0x27745b,'openclawBin':_0x11ccef,'plugins':_0x14eea2};}export async function spawnClaw(_0x546c97,_0x50b662=[],_0x145d3f={}){const _0x380c48=_0x3d918c,_0x492745=await loadRuntimeInfo(_0x546c97),_0x484907=await createRuntimeEnv(_0x492745,_0x145d3f['env']??{});return spawn(_0x492745[_0x380c48(0x334)+'utable'],[_0x492745[_0x380c48(0x21d)+_0x380c48(0x2d5)],..._0x50b662],{'cwd':_0x492745['openclaw'+_0x380c48(0x1a6)+'ir'],'stdio':_0x380c48(0xad),..._0x145d3f,'env':_0x484907});}export async function runClawOnce(_0x4b3b2d,_0x11143b=[],_0x275199=0x15f90){const _0x2555e0=await spawnClaw(_0x4b3b2d,_0x11143b);return await new Promise((_0x4b296d,_0x42322d)=>{const _0x51a2af=_0x1d92;let _0x14c4ec='',_0x2cddcf='',_0x3e07e3=![];const _0x5f0b3c=setTimeout(()=>{const _0x3bcd63=_0x1d92;if(_0x3e07e3)return;_0x3e07e3=!![],_0x2555e0[_0x3bcd63(0x2d4)](_0x3bcd63(0x1d0)),_0x42322d(new Error(_0x3bcd63(0x21d)+_0x3bcd63(0x253)+_0x3bcd63(0x18e)+'\x20'+_0x275199+'ms'));},_0x275199);_0x2555e0[_0x51a2af(0xfd)]['on'](_0x51a2af(0x2d8),_0x5545ab=>{_0x14c4ec+=_0x5545ab['toString']();}),_0x2555e0[_0x51a2af(0x2c5)]['on']('data',_0x36bce1=>{const _0x5581e3=_0x51a2af;_0x2cddcf+=_0x36bce1[_0x5581e3(0x174)]();}),_0x2555e0['on'](_0x51a2af(0x2aa),_0x183ece=>{if(_0x3e07e3)return;_0x3e07e3=!![],clearTimeout(_0x5f0b3c),_0x42322d(_0x183ece);}),_0x2555e0['on'](_0x51a2af(0x309),(_0x2b62ca,_0x9c481f)=>{if(_0x3e07e3)return;_0x3e07e3=!![],clearTimeout(_0x5f0b3c),_0x4b296d({'code':_0x2b62ca,'signal':_0x9c481f,'stdout':_0x14c4ec,'stderr':_0x2cddcf});});});}export{resolveRuntimeLarkCliCommand};function resolvePackageNameFromNpmSpec(_0x2aa89a){const _0x10b06c=_0x3d918c,_0xab2072=_0x2aa89a[_0x10b06c(0x2f9)]()[_0x10b06c(0x1d7)](/^npm:/,'');if(!_0xab2072)throw new Error('Invalid\x20'+'empty\x20pl'+_0x10b06c(0x289)+'c');if(_0xab2072[_0x10b06c(0x1c6)+'th']('@')){const _0x43ad4e=_0xab2072[_0x10b06c(0x163)]('/');if(_0x43ad4e===-0x1)throw new Error(_0x10b06c(0x2df)+_0x10b06c(0x113)+'pec:\x20'+_0x2aa89a);const _0x56b5a2=_0xab2072[_0x10b06c(0x163)]('@',_0x43ad4e+0x1);return _0x56b5a2===-0x1?_0xab2072:_0xab2072[_0x10b06c(0x1a5)](0x0,_0x56b5a2);}const _0x3f852f=_0xab2072[_0x10b06c(0x163)]('@');return _0x3f852f===-0x1?_0xab2072:_0xab2072['slice'](0x0,_0x3f852f);}async function createRuntimeEnv(_0x201179,_0x695f3c={}){const _0xd5c0f3=_0x3d918c,_0x52e78=process.env.OPENCLAW_STATE_DIR||'',_0x36d990=process.env.NPM_CONFIG_REGISTRY||_0xd5c0f3(0x1ca)+_0xd5c0f3(0xda)+_0xd5c0f3(0x2a8)+_0xd5c0f3(0x2a3),_0xdd5d20=_0x52e78?join(_0x52e78,'claw-run'+_0xd5c0f3(0x288)+'ls'):join(_0x201179['runtimeR'+_0xd5c0f3(0x302)],'.tools'),_0x21000c=join(_0xdd5d20,_0xd5c0f3(0xe4)+'al'),_0x1f3d48=join(_0xdd5d20,'npm-cach'+'e'),_0x100fee=join(_0x21000c,_0xd5c0f3(0x10b));await mkdir(_0x100fee,{'recursive':!![]}),await mkdir(_0x1f3d48,{'recursive':!![]});const _0x4cabeb=[_0x100fee,dirname(_0x201179['nodeExec'+_0xd5c0f3(0x219)]),process.env.PATH||''];return{...process.env,..._0x695f3c,'PATH':_0x4cabeb[_0xd5c0f3(0x254)](Boolean)[_0xd5c0f3(0x13f)](delimiter),'npm_config_prefix':_0x21000c,'NPM_CONFIG_PREFIX':_0x21000c,'npm_config_cache':_0x1f3d48,'NPM_CONFIG_CACHE':_0x1f3d48,'NPM_CONFIG_REGISTRY':_0x36d990,'npm_execpath':_0x201179[_0xd5c0f3(0x1e5)],'npm_node_execpath':_0x201179[_0xd5c0f3(0x334)+_0xd5c0f3(0x219)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x21000c,'OPENCLAW_RUNTIME_NPM_BIN':_0x100fee};}export async function getRuntimeSpawnContext(_0x1efcf7,_0x2c0e37={}){const _0x5f33f5=_0x3d918c,_0x26eacf=await loadRuntimeInfo(_0x1efcf7),_0x1aef87=await createRuntimeEnv(_0x26eacf,_0x2c0e37);return{'cwd':_0x26eacf[_0x5f33f5(0x21d)+_0x5f33f5(0x1a6)+'ir'],'env':_0x1aef87,'runtime':_0x26eacf};}function resolvePluginDirNameFromSpec(_0x5143e5){const _0xb88768=_0x3d918c,_0x2909a4=resolvePackageNameFromNpmSpec(_0x5143e5),_0x5dde39=_0x2909a4[_0xb88768(0x1fb)]('/')[_0xb88768(0x254)](Boolean),_0x488764=_0x5dde39['at'](-0x1)??'';if(!_0x488764)throw new Error(_0xb88768(0x2df)+_0xb88768(0x2ea)+_0xb88768(0x31a)+_0x5143e5);return _0x488764;}async function resolvePluginIdFromPackageDir(_0x54d8cf,_0x48e92e){const _0x44e612=_0x3d918c,_0x517540=await readJson(join(_0x54d8cf,_0x44e612(0x1ee)+_0x44e612(0x155)),{}),_0x3bd7de=await readPluginManifest(_0x54d8cf),_0x54a0ea=[_0x3bd7de?.['id'],_0x3bd7de?.['pluginId'],_0x3bd7de?.[_0x44e612(0x22d)],_0x517540?.[_0x44e612(0x21d)]?.['id'],_0x517540?.[_0x44e612(0x21d)+'Id'],_0x48e92e],_0x21bed2=_0x54a0ea[_0x44e612(0x19b)](_0x186cf7=>typeof _0x186cf7==='string'&&_0x186cf7['trim']());if(!_0x21bed2)throw new Error('Unable\x20t'+_0x44e612(0x290)+'e\x20plugin'+_0x44e612(0xa1)+'\x20'+_0x54d8cf);return _0x21bed2['trim']();}function pluginSpecMatches(_0x56b3f8,_0x9ff7b2){const _0x1278ea=_0x3d918c,_0x50ce9a=_0x9ff7b2[_0x1278ea(0x2f9)](),_0x225a72=resolvePackageNameFromNpmSpec(_0x50ce9a);return[_0x56b3f8['spec'],_0x56b3f8[_0x1278ea(0x214)+'Spec'],_0x56b3f8['resolved'+_0x1278ea(0x256)]][_0x1278ea(0x205)](_0x19a39f=>_0x19a39f===_0x50ce9a||_0x19a39f===_0x225a72);}async function installPluginFromNpmSpec(_0x289549,_0x162727,_0x51eb65={}){const _0x26f76f=_0x3d918c,_0x1d5201=_0x289549[_0x26f76f(0x2f9)]()[_0x26f76f(0x1d7)](/^npm:/,''),_0x2dead6=resolvePluginDirNameFromSpec(_0x1d5201),_0x5aefd6=join(_0x162727[_0x26f76f(0x21d)+_0x26f76f(0x1a6)+'ir'],_0x26f76f(0x315),_0x26f76f(0xe1)+'ns'),_0x230f8b=join(_0x5aefd6,_0x2dead6),_0x523536=join(_0x162727[_0x26f76f(0x207)+_0x26f76f(0x302)],'.plugin-'+'extract-'+process['pid']+'-'+Date[_0x26f76f(0x242)]()),_0x30c823=await createRuntimeEnv(_0x162727),_0x3311b8=new Date()['toISOStr'+_0x26f76f(0x120)](),_0x34eaf0=join(_0x162727['runtimeR'+_0x26f76f(0x302)],'.cache');await mkdir(_0x34eaf0,{'recursive':!![]}),await rm(_0x523536,{'recursive':!![],'force':!![]}),await rm(_0x230f8b,{'recursive':!![],'force':!![]}),await mkdir(_0x523536,{'recursive':!![]}),await mkdir(_0x5aefd6,{'recursive':!![]}),console['log'](_0x26f76f(0xbc)+_0x26f76f(0x2a9)+_0x26f76f(0xf3)+_0x26f76f(0x317)+_0x26f76f(0x1c2)+_0x1d5201);const _0x52d5ac=await runProcess(_0x162727[_0x26f76f(0x334)+'utable'],[_0x162727['npmCli'],_0x26f76f(0xdb),_0x1d5201,'--json'],{'cwd':_0x34eaf0,'env':_0x30c823,'label':_0x26f76f(0xa4)+'\x20'+_0x1d5201}),_0x49488a=parseNpmPackJson(_0x52d5ac[_0x26f76f(0xfd)]),_0x1564d2=normalizePackedTarballFilename(_0x49488a['filename']),_0x493275=join(_0x34eaf0,_0x1564d2);if(!existsSync(_0x493275))throw new Error('npm\x20pack'+_0x26f76f(0x234)+'\x20create\x20'+'tarball:'+'\x20'+_0x493275);await runProcess(_0x26f76f(0x151),[_0x26f76f(0xea),_0x493275,'-C',_0x523536],{'label':_0x26f76f(0x271)+_0x1564d2}),await rename(join(_0x523536,_0x26f76f(0x248)),_0x230f8b),await rm(_0x523536,{'recursive':!![],'force':!![]});const _0x404a55=join(_0x230f8b,'package.'+_0x26f76f(0x155)),_0x48dff5=await readJson(_0x404a55,{});(_0x48dff5['devDepen'+_0x26f76f(0x20d)]||_0x48dff5['scripts'])&&(delete _0x48dff5['devDepen'+_0x26f76f(0x20d)],delete _0x48dff5['scripts'],await writeJson(_0x404a55,_0x48dff5));await runProcess(_0x162727[_0x26f76f(0x334)+'utable'],[_0x162727[_0x26f76f(0x1e5)],'install',_0x26f76f(0x2dc)+'ev',_0x26f76f(0x210)+_0x26f76f(0xc1),'--no-aud'+'it',_0x26f76f(0x144)+'d','--legacy'+_0x26f76f(0x2f5)+'ps'],{'cwd':_0x230f8b,'env':_0x30c823,'label':_0x26f76f(0xf0)+_0x26f76f(0x2b1)+_0x26f76f(0x182)+_0x1d5201});const _0x54d9ca=new Date()[_0x26f76f(0xb8)+_0x26f76f(0x120)](),_0x59a1bb=await resolvePluginIdFromPackageDir(_0x230f8b,_0x49488a['name']);return _0x51eb65['runtimeL'+_0x26f76f(0x10a)]?.[_0x26f76f(0xc9)](_0x26f76f(0x259)+_0x26f76f(0x204)+_0x26f76f(0x2f8),{'spec':_0x1d5201,'pluginId':_0x59a1bb,'installPath':_0x230f8b}),{'pluginId':_0x59a1bb,'source':'npm','spec':_0x1d5201,'installPath':toRuntimeRelative(_0x162727[_0x26f76f(0x207)+_0x26f76f(0x302)],_0x230f8b),'version':_0x49488a['version'],'resolvedName':_0x49488a[_0x26f76f(0x22d)],'resolvedVersion':_0x49488a['version'],'resolvedSpec':_0x49488a['name']+'@'+_0x49488a['version'],'integrity':typeof _0x49488a[_0x26f76f(0x28a)+'y']===_0x26f76f(0x2bb)?_0x49488a['integrit'+'y']:'','shasum':typeof _0x49488a[_0x26f76f(0x2fd)]===_0x26f76f(0x2bb)?_0x49488a['shasum']:'','resolvedAt':_0x3311b8,'installedAt':_0x54d9ca};}async function syncConfiguredNpmPlugins(_0x4b0968,_0x506f3a,_0x3c5562,_0x20f146={}){const _0x174342=_0x3d918c;if(_0x20f146[_0x174342(0x184)])return;const _0x103263=createRuntimeInfoFromManifest(_0x506f3a,_0x3c5562),_0x49b28c=Array['isArray'](_0x3c5562['plugins'])?_0x3c5562[_0x174342(0x218)]:[],_0x2de83d=[];for(const _0x2499b9 of _0x4b0968[_0x174342(0x21d)][_0x174342(0x23e)+_0x174342(0xbb)]){const _0x4143bd=_0x49b28c[_0x174342(0x19b)](_0x55761e=>_0x55761e?.[_0x174342(0x96)]===_0x174342(0x17d)&&pluginSpecMatches(_0x55761e,_0x2499b9)&&typeof _0x55761e[_0x174342(0x100)+_0x174342(0x2c9)]===_0x174342(0x2bb)&&existsSync(resolve(_0x506f3a,_0x55761e[_0x174342(0x100)+_0x174342(0x2c9)])));if(_0x4143bd){_0x2de83d[_0x174342(0x2e8)](_0x4143bd);continue;}_0x2de83d[_0x174342(0x2e8)](await installPluginFromNpmSpec(_0x2499b9,_0x103263,_0x20f146));}const _0x41c3dc=new Set(_0x4b0968[_0x174342(0x21d)][_0x174342(0x23e)+_0x174342(0xbb)]['map'](resolvePackageNameFromNpmSpec)),_0x1d7085=_0x49b28c[_0x174342(0x254)](_0x1b1110=>_0x1b1110?.['source']!==_0x174342(0x17d)||!_0x41c3dc['has'](resolvePackageNameFromNpmSpec(_0x1b1110[_0x174342(0x214)+_0x174342(0x256)]||_0x1b1110[_0x174342(0x203)]||'')));_0x3c5562[_0x174342(0x218)]=[..._0x1d7085,..._0x2de83d];}function hasRuntimeDependencies(_0x4a1b28){const _0x21a0c4=_0x3d918c,_0x7c2198=_0x4a1b28?.[_0x21a0c4(0x176)+_0x21a0c4(0x97)]&&typeof _0x4a1b28[_0x21a0c4(0x176)+_0x21a0c4(0x97)]===_0x21a0c4(0x112)?Object[_0x21a0c4(0x269)](_0x4a1b28[_0x21a0c4(0x176)+_0x21a0c4(0x97)]):[],_0x228017=_0x4a1b28?.[_0x21a0c4(0x322)+'Dependen'+'cies']&&typeof _0x4a1b28['optional'+_0x21a0c4(0x24a)+_0x21a0c4(0x97)]===_0x21a0c4(0x112)?Object[_0x21a0c4(0x269)](_0x4a1b28[_0x21a0c4(0x322)+_0x21a0c4(0x24a)+'cies']):[];return _0x7c2198[_0x21a0c4(0xde)]>0x0||_0x228017[_0x21a0c4(0xde)]>0x0;}async function installLocalPluginRuntimeDependencies(_0x24c84a,_0x4cbbfe,_0x3bb5c1){const _0x415853=_0x3d918c,_0xb8a561=join(_0x24c84a,'package.'+'json'),_0x564b85=await readJson(_0xb8a561,{});(_0x564b85[_0x415853(0xed)+'dencies']||_0x564b85[_0x415853(0x266)])&&(delete _0x564b85[_0x415853(0xed)+_0x415853(0x20d)],delete _0x564b85[_0x415853(0x266)],await writeJson(_0xb8a561,_0x564b85));if(!hasRuntimeDependencies(_0x564b85))return;const _0xb58ec0=await createRuntimeEnv(_0x4cbbfe);console['log'](_0x415853(0xbc)+_0x415853(0x2a9)+_0x415853(0x12c)+'stalling'+_0x415853(0x14f)+_0x415853(0xc5)+_0x415853(0x1ad)+_0x415853(0x2ca)+_0x24c84a),await runProcess(_0x4cbbfe[_0x415853(0x334)+_0x415853(0x219)],[_0x4cbbfe[_0x415853(0x1e5)],_0x415853(0x312),'--omit=d'+'ev',_0x415853(0x210)+_0x415853(0xc1),_0x415853(0x261)+'it',_0x415853(0x144)+'d',_0x415853(0x108)+_0x415853(0x2f5)+'ps'],{'cwd':_0x24c84a,'env':_0xb58ec0,'label':_0x415853(0xf0)+_0x415853(0xd4)+_0x415853(0x145)+'\x20'+_0x24c84a}),_0x3bb5c1[_0x415853(0x285)+_0x415853(0x10a)]?.[_0x415853(0xc9)](_0x415853(0x1aa)+_0x415853(0x27d)+_0x415853(0x238)+_0x415853(0xd5)+_0x415853(0x179),{'installPath':_0x24c84a});}async function syncSharedPluginModules(_0x29c3e7,_0x595596){const _0x145487=_0x3d918c,_0x3b9738=new Set();for(const _0x1d6cc0 of _0x29c3e7){const _0x394fbe=join(dirname(_0x1d6cc0),_0x145487(0x125));if(existsSync(_0x394fbe))_0x3b9738['add'](_0x394fbe);}for(const _0x7d5bc0 of _0x3b9738){await copyDirFresh(_0x7d5bc0,join(_0x595596,'_shared'));}}async function syncProductPlugins(_0x3e6f03,_0x2d09bc,_0x24add9,_0xfeade9={}){const _0x19e251=_0x3d918c,_0x296505=join(_0x2d09bc,_0x19e251(0x21d),_0x19e251(0x315),'extensio'+'ns'),_0x5dbbfd=createRuntimeInfoFromManifest(_0x2d09bc,_0x24add9),_0x2f1f47=[];await syncSharedPluginModules(_0x3e6f03[_0x19e251(0x21d)][_0x19e251(0x214)+_0x19e251(0x20f)+'ginPaths'],_0x296505);for(const _0x38db54 of _0x3e6f03[_0x19e251(0x21d)]['resolved'+_0x19e251(0x20f)+_0x19e251(0x2fe)]){const _0x228272=await getPackageMetadata(_0x38db54),_0x209915=await readPluginManifest(_0x38db54),_0x1250fa=join(_0x296505,_0x228272[_0x19e251(0x208)]);await copyDirFresh(_0x38db54,_0x1250fa),await installLocalPluginRuntimeDependencies(_0x1250fa,_0x5dbbfd,_0xfeade9),_0x2f1f47['push']({'pluginId':_0x228272[_0x19e251(0x208)],'source':_0x19e251(0x2c3),'spec':_0x19e251(0x124)+_0x38db54,'installPath':toRuntimeRelative(_0x2d09bc,_0x1250fa),'version':_0x228272[_0x19e251(0xae)],'resolvedName':_0x228272['name'],'resolvedVersion':_0x228272[_0x19e251(0xae)],'resolvedSpec':_0x19e251(0x124)+_0x38db54,'integrity':'','shasum':'','resolvedAt':new Date()[_0x19e251(0xb8)+_0x19e251(0x120)](),'installedAt':new Date()[_0x19e251(0xb8)+_0x19e251(0x120)](),'agentScope':_0x209915[_0x19e251(0x148)+'pe'],'skills':_0x209915[_0x19e251(0x1ed)]});}const _0x23a882=new Set(_0x2f1f47[_0x19e251(0x1f6)](_0x4f3ef0=>_0x4f3ef0[_0x19e251(0x208)])),_0x3466fc=Array[_0x19e251(0x233)](_0x24add9[_0x19e251(0x218)])?_0x24add9['plugins'][_0x19e251(0x254)](_0x434975=>!_0x23a882[_0x19e251(0x2b5)](_0x434975['pluginId'])):[];_0x24add9[_0x19e251(0x218)]=[..._0x3466fc,..._0x2f1f47];}async function syncManifestPluginScope(_0x4c5bb3,_0x2b08cb,_0x635692){const _0x4bc81c=_0x3d918c,_0x4f82a8=join(_0x2b08cb,_0x4bc81c(0x21d),_0x4bc81c(0x315),_0x4bc81c(0xe1)+'ns'),_0x2a5870=new Set(_0x4c5bb3[_0x4bc81c(0x21d)]['pluginSp'+_0x4bc81c(0xbb)]??[]),_0x279fa4=new Set([..._0x2a5870][_0x4bc81c(0x1f6)](_0xfcf527=>_0xfcf527[_0x4bc81c(0x1d7)](/^npm:/,''))[_0x4bc81c(0x1f6)](_0x228b38=>{const _0x480530=_0x4bc81c;if(_0x228b38[_0x480530(0x1c6)+'th']('@')){const _0xcb2018=_0x228b38[_0x480530(0x1fb)]('@');return _0xcb2018[_0x480530(0xde)]>=0x3?'@'+_0xcb2018[0x1]:_0x228b38;}return _0x228b38[_0x480530(0x1fb)]('@')[0x0];})[_0x4bc81c(0x254)](Boolean)),_0x3fca7a=new Set();for(const _0x5cbd3f of _0x4c5bb3[_0x4bc81c(0x21d)][_0x4bc81c(0x214)+_0x4bc81c(0x20f)+_0x4bc81c(0x2fe)]){const _0x3e26e5=await getPackageMetadata(_0x5cbd3f);if(_0x3e26e5['pluginId'])_0x3fca7a[_0x4bc81c(0x2cb)](_0x3e26e5[_0x4bc81c(0x208)]);}const _0x3b808c=Array[_0x4bc81c(0x233)](_0x635692['plugins'])?_0x635692[_0x4bc81c(0x218)]:[];_0x635692[_0x4bc81c(0x23e)+_0x4bc81c(0xbb)]=[..._0x4c5bb3[_0x4bc81c(0x21d)][_0x4bc81c(0x23e)+_0x4bc81c(0xbb)],..._0x4c5bb3[_0x4bc81c(0x21d)][_0x4bc81c(0x214)+_0x4bc81c(0x20f)+'ginPaths'][_0x4bc81c(0x1f6)](_0x24fb78=>_0x4bc81c(0x124)+_0x24fb78)],_0x635692[_0x4bc81c(0x218)]=_0x3b808c[_0x4bc81c(0x254)](_0x829dd3=>{const _0x3d3199=_0x4bc81c;if(!_0x829dd3||typeof _0x829dd3!==_0x3d3199(0x112))return![];if(_0x829dd3[_0x3d3199(0x96)]===_0x3d3199(0x2c3))return _0x3fca7a[_0x3d3199(0x2b5)](_0x829dd3['pluginId']);if(_0x829dd3[_0x3d3199(0x96)]==='npm')return _0x2a5870[_0x3d3199(0x2b5)](_0x829dd3[_0x3d3199(0x203)])||_0x2a5870['has'](_0x829dd3['resolved'+_0x3d3199(0x228)])||_0x279fa4[_0x3d3199(0x2b5)](_0x829dd3[_0x3d3199(0x214)+_0x3d3199(0x256)]);return![];});const _0xef6254=new Set(_0x635692['plugins'][_0x4bc81c(0x1f6)](_0x5684c4=>_0x5684c4[_0x4bc81c(0x208)]));for(const _0x42455a of _0x3b808c){if(!_0x42455a[_0x4bc81c(0x208)]||_0xef6254[_0x4bc81c(0x2b5)](_0x42455a[_0x4bc81c(0x208)]))continue;const _0x481d23=typeof _0x42455a['installP'+_0x4bc81c(0x2c9)]==='string'&&_0x42455a[_0x4bc81c(0x100)+'ath']['trim']()?resolve(_0x2b08cb,_0x42455a[_0x4bc81c(0x100)+_0x4bc81c(0x2c9)]):join(_0x4f82a8,_0x42455a[_0x4bc81c(0x208)]),_0x8192ba=relative(_0x4f82a8,_0x481d23);if(_0x8192ba[_0x4bc81c(0x1c6)+'th']('..')||_0x8192ba==='')continue;await rm(_0x481d23,{'recursive':!![],'force':!![]});}}async function collectCapabilityEntries(_0x24e0b1,_0x25de40){const _0x142b7d=_0x3d918c,_0x25bc99=new Map();for(const _0x4e93a7 of _0x24e0b1){let _0x192d4c;try{_0x192d4c=await stat(_0x4e93a7);}catch{throw new Error(_0x25de40+(_0x142b7d(0xf4)+_0x142b7d(0x1f9)+_0x142b7d(0x1e4))+_0x4e93a7);}if(!_0x192d4c['isDirect'+'ory']())throw new Error(_0x25de40+(_0x142b7d(0x16c)+_0x142b7d(0xb5)+_0x142b7d(0x245)+_0x142b7d(0x13a))+_0x4e93a7);const _0x14d2cb={'name':basename(_0x4e93a7),'path':_0x4e93a7},_0x1a725b=_0x25bc99[_0x142b7d(0x311)](_0x14d2cb['name']);if(_0x1a725b)throw new Error(_0x142b7d(0xca)+'e\x20'+_0x25de40+_0x142b7d(0x20c)+_0x14d2cb['name']+'\x22\x20from\x20'+_0x1a725b[_0x142b7d(0x32a)]+_0x142b7d(0x1f3)+_0x14d2cb[_0x142b7d(0x32a)]);_0x25bc99[_0x142b7d(0x28d)](_0x14d2cb[_0x142b7d(0x22d)],_0x14d2cb);}return[..._0x25bc99[_0x142b7d(0x13e)]()];}async function syncProductCapabilityDirs(_0x59fa09,_0x12344d,_0x1506d3){const _0x476565=_0x3d918c,_0x2f36c4=await collectCapabilityEntries(_0x59fa09,_0x1506d3);await rm(_0x12344d,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(_0x12344d,{'recursive':!![]});for(const _0x9307be of _0x2f36c4){await cp(_0x9307be[_0x476565(0x32a)],join(_0x12344d,_0x9307be[_0x476565(0x22d)]),{'recursive':!![]});}return _0x2f36c4[_0x476565(0xde)];}export const __test__={'collectCapabilityEntries':collectCapabilityEntries,'prunePackagedRuntimePayload':prunePackagedRuntimePayload,'syncProductCapabilityDirs':syncProductCapabilityDirs,'resolveNodeExtractRoot':resolveNodeExtractRoot};async function syncProductAgents(_0x5041fe,_0x5cd989,_0xe1a1db){const _0x10723f=_0x3d918c,_0x1573c5=join(_0x5cd989,'openclaw',_0x10723f(0x337)),_0x3bf946=await syncProductCapabilityDirs(_0x5041fe[_0x10723f(0x21d)][_0x10723f(0x214)+_0x10723f(0x139)+_0x10723f(0x1db)],_0x1573c5,_0x10723f(0x1cc));_0xe1a1db['agents']={'source':_0x10723f(0x1c5),'installPath':toRuntimeRelative(_0x5cd989,_0x1573c5),'localPaths':_0x5041fe['openclaw'][_0x10723f(0x214)+_0x10723f(0x139)+_0x10723f(0x1db)],'entryCount':_0x3bf946};}async function syncProductSkills(_0x57e7ed,_0x5d799d,_0x2a106d){const _0x3b57b1=_0x3d918c,_0x5eaf9c=join(_0x5d799d,_0x3b57b1(0x21d),'skills'),_0x105679=await syncProductCapabilityDirs(_0x57e7ed[_0x3b57b1(0x21d)][_0x3b57b1(0x214)+'LocalSki'+_0x3b57b1(0x13b)],_0x5eaf9c,'skill');_0x2a106d[_0x3b57b1(0x1ed)]={'source':_0x3b57b1(0x1c5),'installPath':toRuntimeRelative(_0x5d799d,_0x5eaf9c),'localPaths':_0x57e7ed[_0x3b57b1(0x21d)]['resolved'+_0x3b57b1(0x2bf)+_0x3b57b1(0x13b)],'entryCount':_0x105679};}
1
+ const _0x44ad8a=_0x537f;(function(_0x27541f,_0x196adf){const _0x3d1055=_0x537f,_0x28bffb=_0x27541f();while(!![]){try{const _0x22d712=-parseInt(_0x3d1055(0x39f))/0x1+parseInt(_0x3d1055(0x153))/0x2+-parseInt(_0x3d1055(0x1a7))/0x3*(parseInt(_0x3d1055(0x335))/0x4)+parseInt(_0x3d1055(0x2c1))/0x5*(parseInt(_0x3d1055(0x1a3))/0x6)+-parseInt(_0x3d1055(0x271))/0x7+parseInt(_0x3d1055(0x289))/0x8*(parseInt(_0x3d1055(0x3b3))/0x9)+parseInt(_0x3d1055(0x347))/0xa;if(_0x22d712===_0x196adf)break;else _0x28bffb['push'](_0x28bffb['shift']());}catch(_0x450ad3){_0x28bffb['push'](_0x28bffb['shift']());}}}(_0x251d,0x582f5));import{existsSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rename,rm,stat,symlink,writeFile}from'node:fs/promises';import{basename,delimiter,dirname,join,extname,parse,relative,resolve}from'node:path';import{fileURLToPath,pathToFileURL}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'../common/utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'../common/runtime-logger.mjs';import{hasConfiguredKdocsSkill,installKdocsCliBinary}from'../connectors/kdocs-cli.mjs';import{installRuntimeLarkCliPackage,resolveRuntimeLarkCliCommand}from'../connectors/lark-cli.mjs';function _0x251d(){const _0x205e06=['aipc-dow','win32','pluginId','ch\x20skipp','test','stalling','stderr','plugin\x20s','pendenci','export\x20O','found','object','nodejs.o','OPENCLAW','nstalled','close','pipe','[wujie-s','ed;\x20plug','t\x20c2c\x20ou','Claw','nse\x20hook','location','\x20patch\x20s','play-pro','npm-cach','pid','_modules','has','bug;\x20ver','product\x20','tall\x20the','y\x20applie','json','es.','LocalSki','node/nod','generate','spec','dexed\x20wi','Unable\x20t','tching\x20p','ady\x20curr','time]\x20fe','oute\x20pat','d\x20for\x20lo','time','node_mod','pruned\x20r','ibility\x20','\x22\x20\x22%SCRI',':\x20manife','hell:run','unknown','efore\x20pa','exec','--fix','ch\x20alrea','re\x20upgra','ame','npm\x20plug','ies:\x20','--omit=p','createRu','OME=','\x20id\x20from','ath','red\x20Open','director','openclaw','node/lib','nt-weixi','nning\x20op','isFile','oot\x20was\x20','ot\x20found','chat\x20his','st\x20be\x20a\x20','\x20and\x20','tbound\x20d','route\x20pa','n\x20plugin','then','Dependen','href','des.','IR=$(CDP','ache\x20bef','importan','roductRu','agents\x20s','examples',',\x20shell.','mirrors\x20','tar.xz','channel\x20','configur','ons;\x20ver','started','dge.mjs','base\x20bui','4411512tcKdhe','WorkingD','out\x20c2c\x20','path','ced','HOME=\x22${','replaceA','er\x20patch','local:','runtimeR','ad\x20patch','wujie-lo','bridge\x20n','pack','set','doc','package-','\x22\x20from\x20','catch','pped;\x20di','ipped;\x20o','lite\x20pat','bin','-weixin','16XDvcmj','all\x20loca','ies','.npmmirr','\x20product','red\x20Node','\x20request','.json','tateDir','ore\x20pack','solver\x20n','und:\x20','\x20is\x20miss','isDirect','powershe','E_NAME%\x22','npmCli','loader-','_DIR%','outbound','request-','isArray','--no-aud','ipped;\x20r','OGO\x22\x20];\x20','ge\x20not\x20a','\x20did\x20not',':WUJIE_S','est-id/r','nPath\x20$e','src','e\x20plugin','all\x20','exec\x20\x22$S','ase','SIGTERM','rcing\x20QQ','l\x20plugin','being\x20in','\x20failed\x20','time]\x20in','ready\x20ap','statusCo','s\x20to\x20dir','eixin\x20@i','--omit=d','%USERPRO','runtime','untime\x20r','ipped;\x20f','\x20doctor\x20','atch\x20alr','tory\x20pro','1\x20]\x20&&\x20[','ions/run','-extract','1390160mvnkhC','utf8','__tests_','push','-xJf','atch\x20ski','registry','ntime','node\x20ver','indexOf','\x20-g','scripts','und','zip','cwd','/opencla','ILE_NAME','\x20not\x20fou','ld\x20start','\x20path\x20wa','\x20shape\x20n','--no-fun','join','rent','ie-shell','ream\x20fix','t\x20\x22OPENC','t\x20found','set\x20\x22OPE','ime/requ','fy\x20upstr','Bin','qqbot','tch\x20alre','platform','r\x20runtim','ipped;\x20d','\x20mirrors','G_FILE_N','ion','package','\x22\x20so\x20the','package.','lark-cli','st=','weixin\x20o','runtime\x20','age\x20was\x20','\x20resolve','env','startsWi','ent','with\x20cod','enclaw-w','ckaging','ion\x20mism','versions','Bypass','PT_DIR/','\x20create\x20','o.mjs\x22\x202','rchive\x20-','npm\x20inst','projectR','l\x20prepar','ujie-log','ackup','timeoutM','LocalPlu','s/npm','ing\x20\x22','AW_CONFI','\x20prepare','ogger','ntPaths','find','prefix\x20i','sion\x20val','ed;\x20chan','\x20applied','mismatch','\x20already','configFi','manifest','\x20patch\x20a','ed-tool\x20','n\x20outbou','size','scoped\x20s','ery\x20mirr','ignore','process.','allowMis','try\x20not\x20','tbound\x20f','resolved','wujieai.','tarball:','Version','ell-runt','\x20paths','d\x20an\x20inv','jie-shel','eady\x20app','x64','fix','patch\x20fo','warn','stinatio','sort','.tools','ons\x20with','name','npm','\x22\x20%*','-id\x20head','684JFWqmD','in\x20insta','map','skipped;','with\x20the','--legacy','LAW_STAT','dAt','man','tbound\x20s','octor\x20--','atch\x20app','\x20package','/npm','every','--json','\x20set\x20\x22OP','log','11359080kPopWP','\x22\x20\x22$SCRI','qqbot\x20ou','(empty)','headers',';\x20run\x20wu','kup','llPaths','kill\x20not','toISOStr','-Executi','\x20synced','kill','trim','utbound\x20','source','ession\x20r','fallback','e_module','ATH:-','IPT_DIR=','\x20local\x20p','d\x20Node\x20r','sion.','d\x20as\x20gro','eer','jection-','slice','.md','runtimeS','bridge.m','devDepen','session\x20','er\x20id.','arch','../../sh','STATE_DI','ntime\x20ch','ify\x20upst','utable','doctor','.cache','\x22%SCRIPT','PT_DIR/w','https://','agents','referenc','product','m-cli.js','missing\x20','vailable','patched','parse','go.mjs','dataDir','\x20runtime','extract-','HELL_ARC','NCLAW_CO','installe','ped;\x20cha','plied','PT_DIR%','\x20return\x20','ory','.js','resume','dencies','ile\x20not\x20','idated','aw\x202026.','nced','st\x20not\x20f','split','dataDirN','PENCLAW_','able','\x20skipped','provider','leName','.plugin-','ot\x20avail','\x20timed\x20o','ATH=\x22${O','ecs','m.wechat','on\x20futur','Run\x20\x22wuj','482793SuvegB','ntime\x20re','\x20bin\x20was','#!/bin/s','alid\x20pay','-peer-de','\x20signal=','../../as','CLAW_CON','untime\x20c','entryCou','singOpen','wnloadin','ime\x20buil','ed\x20OpenC','lib/node','FILE%\x5c','plugins\x20','patch\x20ap','unction\x20','469188guyzwJ','\x20started','-xzf','fix\x20star','store-lo','pt-path-','n\x20the\x20pe','r\x20@tence','.\x20Top-le','w.mjs','flush','or.com','replace','lready\x20a','configPa','syncOnly','$HOME/','in\x20not\x20i','extensio','ed;\x20brid','data','rcing\x20op','endsWith','execPath','ied','synced','Spec','appId','r\x20id.','ATE_DIR:','red','\x20\x22OPENCL','failed','law/qqbo','%~dp0\x22','wBin','er\x20respo','version','nnel','store\x20lo','shell-ru','tar','6\x20mixed\x20','ions\x20whe','\x20on\x20futu','\x20returne','\x20kdocs\x20s','SCRIPT_D','ME%\x22==\x22\x22','ader\x20not','local\x20pl','ATH=\x20cd\x20','_HOME:-','y:\x20','not\x20foun','ite\x20patc','\x20is\x20unav','nel\x20plug','reason','stdout','integrit','\x20\x22$0\x22)\x22\x20','287564AkGoDB','match','extract\x20','error','ch\x20appli','Version\x20','optional','transcri','\x5cwjrt-','patch\x20sk','nifest=','Invalid\x20','=\x22${OPEN','resolver','chat-dis','ENCLAW_H','ect\x20sess','ed\x20npm\x20p','null','pped;\x20ru','aipc-run','installP','y\x20compat','skills\x20s','nodeVers','patch\x20al','now','store\x20sq','shift','\x20\x20\x22$SCRI','node/bin','npm-cli.','required','6.6\x20chan','NFIG_PAT','ugin\x20spe','ailable.','set\x20\x22SCR','\x22\x20\x22$@\x22','fix\x20alre','toString','\x20depende','NCLAW_ST','lib','node.exe','ad-','channel.','untime-b','path:\x20','local','fix\x20mark','nd\x20after','h\x20applie','enclaw\x20d','rect\x20pee','ules','store\x20wr','r\x20@openc','prepare\x20','endencie','\x20summary','R=\x22${OPE','\x20complet','ors\x20bein','atch:\x20ma','some','dependen','connecto','ing','function','>/dev/nu','e\x20upgrad','\x20written','CONFIG_F','rs;\x20veri','\x20found','ATE_DIR%','d:\x20','root','claw-run','12upchVs','includes','filename','ist\x20not\x20','8172lXvWTi','nd\x20helpe','gin\x20not\x20','w.cmd','@echo\x20of','untime\x20p','ut\x20after','pped;\x20lo','ng\x20chann','Claw\x20ver','node','leted','nodeExec','install','JIE_NO_L','store-','g\x20indexe','session-','rebuilt\x20','/node_mo','index.mj','allback\x20','\x20install','cies','plugin\x20r','runtimeL',';\x20provid','ath\x20$env','kipped;\x20','Name','length','get','skills','eted','\x20can\x20ins','download','_shared','filter','id\x20title','runtime-','already-','r\x20OpenCl','tory\x20mix','empty\x20pl','.d.ts','dist','arm64','string','JSON:\x20','load:\x20','\x20configu','node-v','Extracte','oot','d\x20for\x20','wujiecla','docs','LiteralP','ynced','sets/wuj','npm-glob','plugins','.tmp/run','h\x20alread','e\x20tools\x20','wrapper\x20','ound','ime/sess','aging','add','lugin\x20de','\x20version','channel-','ginPaths','\x20to\x20dire','OOT\x20-For','nnel\x20sha','tests','Temporar','==\x22\x22\x20set','mjs','tch\x20appl','_SHELL_E','nv:WUJIE','el.inbou','pplied','shasum','dy\x20appli','\x20loaded','info','eady\x20cur','pluginSp','n\x20the\x20di','in\x20','jection\x20','npm\x20pack','nd\x20deliv','Configur','ie-logo.','H%\x22==\x22\x22\x20','if\x20\x22%OPE'];_0x251d=function(){return _0x205e06;};return _0x251d();}import{patchMixedToolContentFromSource}from'./patch-chat-history-mixed-tool-content.mjs';import{patchChannelPluginRuntimeFromSource}from'./patch-channel-plugin-runtime.mjs';import{patchProviderRequestIdHeaderFromSource}from'./patch-provider-request-id-header.mjs';import{patchSessionStoreLoadFromSource,patchSessionStoreWriteFromSource}from'./patch-session-store-sqlite.mjs';import{patchQQBotOutboundFallbackFromSource,patchQQBotOutboundSessionRouteFromSource}from'./patch-qqbot-outbound-session-route.mjs';import{patchWeixinOutboundFallbackFromSource,patchWeixinOutboundSessionRouteFromSource}from'./patch-weixin-outbound-session-route.mjs';import{patchRequestIdTitleRuntimeFromSource}from'./patch-request-id-title-runtime.mjs';const RUNTIME_DIR=_0x44ad8a(0x1e5)+_0x44ad8a(0x23a),MANIFEST_NAME=_0x44ad8a(0x1ce)+_0x44ad8a(0x314)+_0x44ad8a(0x290),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x38e5d3){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x38e5d3,RUNTIME_DIR);}export function resolveManifestPath(_0x5bcc22){return join(_0x5bcc22,MANIFEST_NAME);}async function loadProductRuntime(_0x5b7f81,_0x4ede30){const _0x10669c=_0x44ad8a,_0x5642c2=[join(_0x5b7f81,'shell-ru'+'ntime',_0x10669c(0x1bb)+'s'),join(_0x4ede30,_0x10669c(0x13d)+_0x10669c(0x2c8),'index.mj'+'s')];for(const _0x27ebfe of _0x5642c2){if(!existsSync(_0x27ebfe))continue;return await import(pathToFileURL(_0x27ebfe)[_0x10669c(0x260)]+'?t='+Date['now']());}return{};}export async function prepareRuntime(_0x3e9506,{syncOnly:syncOnly=![],pruneForPackaging:pruneForPackaging=![]}={}){const _0x4a8200=_0x44ad8a,_0x58a3ae=resolveRuntimeRoot(_0x3e9506['projectR'+_0x4a8200(0x1dc)]),_0x26ace8=createRuntimeLogger(getConfigPaths(_0x3e9506),_0x4a8200(0x2b8)),_0x2c38e2=Date[_0x4a8200(0x16d)]();_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x18d)+_0x4a8200(0x2ef)+_0x4a8200(0x26e),{'syncOnly':syncOnly,'runtimeRoot':_0x58a3ae,'shellConfig':summarizeShellConfig(_0x3e9506)});try{const _0x5c2deb=await ensureRuntimeBase(_0x3e9506,_0x58a3ae,{'runtimeLogger':_0x26ace8,'syncOnly':syncOnly});_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x2ef)+_0x4a8200(0x314)+_0x4a8200(0x1ff),{'manifestPath':resolveManifestPath(_0x58a3ae),'manifest':summarizeRuntimeManifest(_0x5c2deb)}),validateRuntimeNodeVersion(_0x5c2deb,_0x3e9506),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x2ef)+_0x4a8200(0x2c9)+_0x4a8200(0x30e)+_0x4a8200(0x38c),{'nodeVersion':_0x5c2deb[_0x4a8200(0x16b)+_0x4a8200(0x2e8)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x5c2deb,_0x3e9506),_0x26ace8?.['importan'+'t']?.('runtime\x20'+_0x4a8200(0x251)+'\x20version'+'\x20validat'+'ed',{'openclawVersion':_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]});else{if(_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]!==_0x3e9506['openclaw'][_0x4a8200(0x251)+_0x4a8200(0x323)]){const _0x5815a8=await loadRuntimeInfo(_0x3e9506['projectR'+_0x4a8200(0x1dc)]);_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x251)+_0x4a8200(0x341)+_0x4a8200(0x1bd)+_0x4a8200(0x3b4),{'fromVersion':_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]||'unknown','toVersion':_0x3e9506[_0x4a8200(0x251)]['openclaw'+_0x4a8200(0x323)]}),await installOpenClawPackage(_0x5815a8,_0x3e9506[_0x4a8200(0x251)][_0x4a8200(0x251)+_0x4a8200(0x323)]),_0x5c2deb[_0x4a8200(0x251)+'Version']=_0x3e9506['openclaw']['openclaw'+_0x4a8200(0x323)],_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x251)+_0x4a8200(0x341)+_0x4a8200(0x1bd)+_0x4a8200(0x191)+'ed',{'openclawVersion':_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]});}}_0x5c2deb[_0x4a8200(0x231)+_0x4a8200(0x33c)]=new Date()[_0x4a8200(0x350)+_0x4a8200(0x197)](),_0x5c2deb[_0x4a8200(0x16b)+_0x4a8200(0x2e8)]=_0x3e9506['openclaw'][_0x4a8200(0x16b)+_0x4a8200(0x2e8)],_0x5c2deb[_0x4a8200(0x376)]={'appId':_0x3e9506[_0x4a8200(0x3ce)],'productName':_0x3e9506['productN'+_0x4a8200(0x247)],'dataDirName':_0x3e9506[_0x4a8200(0x391)+_0x4a8200(0x247)]},await patchChatHistoryMixedToolContentBug(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchProviderRequestIdHeader(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchChannelPluginRuntimeBug(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchWeixinOutboundFallbackRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchQQBotOutboundFallbackRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8});const _0x3a2721=await loadProductRuntime(_0x3e9506[_0x4a8200(0x300)+_0x4a8200(0x1dc)],_0x58a3ae);if(typeof _0x3a2721['prepareP'+_0x4a8200(0x265)+'ntime']===_0x4a8200(0x198)){const _0x23900e=createRuntimeInfoFromManifest(_0x58a3ae,_0x5c2deb);await _0x3a2721['prepareP'+'roductRu'+_0x4a8200(0x2c8)]({'shellConfig':_0x3e9506,'runtime':_0x23900e,'runtimeLogger':_0x26ace8,'syncOnly':syncOnly}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x22a)+'runtime\x20'+'tools\x20sy'+_0x4a8200(0x38e));}await patchSessionStoreSqliteRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchRequestIdTitleRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8});!syncOnly&&(await installRuntimeLarkCliPackage(createRuntimeInfoFromManifest(_0x58a3ae,_0x5c2deb),{'runtimeLogger':_0x26ace8,'createRuntimeEnv':createRuntimeEnv}),_0x26ace8?.['importan'+'t']?.(_0x4a8200(0x2ec)+_0x4a8200(0x37e)+_0x4a8200(0x341)+_0x4a8200(0x352)),await hasConfiguredKdocsSkill(_0x3e9506)?(await installKdocsCliBinary(_0x3e9506,createRuntimeInfoFromManifest(_0x58a3ae,_0x5c2deb),{'runtimeLogger':_0x26ace8,'syncOnly':syncOnly}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x196)+_0x4a8200(0x2e4)+_0x4a8200(0x1e7)+'synced')):_0x26ace8?.[_0x4a8200(0x200)](_0x4a8200(0x196)+_0x4a8200(0x2e4)+_0x4a8200(0x1e7)+_0x4a8200(0x338)+_0x4a8200(0x143)+_0x4a8200(0x34f)+'\x20configu'+_0x4a8200(0x3d1)));const _0xd836ed=Array[_0x4a8200(0x29e)](_0x5c2deb['plugins'])?_0x5c2deb[_0x4a8200(0x1e4)][_0x4a8200(0x1c5)]:0x0;return await syncManifestPluginScope(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x2ef)+'plugin\x20s'+'cope\x20syn'+_0x4a8200(0x275),{'beforePluginCount':_0xd836ed,'afterPluginCount':Array[_0x4a8200(0x29e)](_0x5c2deb['plugins'])?_0x5c2deb[_0x4a8200(0x1e4)]['length']:0x0,'pluginSpecCount':Array[_0x4a8200(0x29e)](_0x5c2deb[_0x4a8200(0x202)+_0x4a8200(0x39b)])?_0x5c2deb[_0x4a8200(0x202)+_0x4a8200(0x39b)][_0x4a8200(0x1c5)]:0x0}),await syncConfiguredNpmPlugins(_0x3e9506,_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8,'syncOnly':syncOnly}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x26c)+_0x4a8200(0x164)+'lugins\x20s'+_0x4a8200(0x1e1),{'pluginSpecCount':_0x3e9506[_0x4a8200(0x251)]['pluginSp'+_0x4a8200(0x39b)][_0x4a8200(0x1c5)],'pluginCount':Array[_0x4a8200(0x29e)](_0x5c2deb[_0x4a8200(0x1e4)])?_0x5c2deb[_0x4a8200(0x1e4)]['length']:0x0}),await patchWeixinOutboundSessionRoute(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchQQBotOutboundSessionRoute(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await syncProductPlugins(_0x3e9506,_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.('product\x20'+_0x4a8200(0x3b0)+_0x4a8200(0x3cc),{'localPluginCount':_0x3e9506[_0x4a8200(0x251)][_0x4a8200(0x320)+_0x4a8200(0x305)+_0x4a8200(0x1f0)]['length'],'pluginCount':Array['isArray'](_0x5c2deb[_0x4a8200(0x1e4)])?_0x5c2deb[_0x4a8200(0x1e4)][_0x4a8200(0x1c5)]:0x0}),await syncProductAgents(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x22a)+_0x4a8200(0x266)+_0x4a8200(0x1e1),{'sources':_0x3e9506[_0x4a8200(0x251)][_0x4a8200(0x320)+'LocalAge'+_0x4a8200(0x30b)],'entryCount':_0x5c2deb[_0x4a8200(0x374)]?.['entryCou'+'nt'],'installPath':_0x5c2deb[_0x4a8200(0x374)]?.['installP'+_0x4a8200(0x24e)]}),await syncProductSkills(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x22a)+_0x4a8200(0x16a)+'ynced',{'sources':_0x3e9506[_0x4a8200(0x251)]['resolved'+_0x4a8200(0x22f)+_0x4a8200(0x34e)],'entryCount':_0x5c2deb[_0x4a8200(0x1c7)]?.[_0x4a8200(0x3a9)+'nt'],'installPath':_0x5c2deb[_0x4a8200(0x1c7)]?.['installP'+_0x4a8200(0x24e)]}),await syncRuntimeWrapper(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.['importan'+'t']?.(_0x4a8200(0x2ef)+_0x4a8200(0x1e8)+_0x4a8200(0x3cc),{'wujieclawBin':_0x5c2deb[_0x4a8200(0x1de)+_0x4a8200(0x3d6)]}),await prunePackagedRuntimeCaches(_0x58a3ae,_0x26ace8),pruneForPackaging&&await prunePackagedRuntimePayload(_0x58a3ae,_0x5c2deb,_0x26ace8),await writeJson(resolveManifestPath(_0x58a3ae),_0x5c2deb),_0x26ace8?.['importan'+'t']?.(_0x4a8200(0x2ef)+'manifest'+_0x4a8200(0x19b),{'manifestPath':resolveManifestPath(_0x58a3ae),'manifest':summarizeRuntimeManifest(_0x5c2deb),'durationMs':Date[_0x4a8200(0x16d)]()-_0x2c38e2}),await _0x26ace8?.[_0x4a8200(0x3bd)](),_0x5c2deb;}catch(_0x16b109){_0x26ace8?.[_0x4a8200(0x156)]('prepare\x20'+_0x4a8200(0x2ef)+_0x4a8200(0x3d3),{'syncOnly':syncOnly,'runtimeRoot':_0x58a3ae,'durationMs':Date[_0x4a8200(0x16d)]()-_0x2c38e2,'error':_0x16b109}),await _0x26ace8?.[_0x4a8200(0x3bd)]();throw _0x16b109;}}async function prunePackagedRuntimeCaches(_0x315397,_0x492563){const _0x484700=_0x44ad8a,_0x2c1cb2=[join(_0x315397,_0x484700(0x370)),join(_0x315397,_0x484700(0x32f),'npm-cach'+'e'),join(_0x315397,_0x484700(0x167)+'time-bac'+_0x484700(0x34d)),join(_0x315397,_0x484700(0x20c)+'nloads-b'+_0x484700(0x303))];for(const _0xb983c8 of _0x2c1cb2){if(!existsSync(_0xb983c8))continue;await rm(_0xb983c8,{'recursive':!![],'force':!![]}),_0x492563?.[_0x484700(0x200)](_0x484700(0x23c)+_0x484700(0x3a8)+_0x484700(0x263)+_0x484700(0x292)+_0x484700(0x1eb),{'cachePath':_0xb983c8});}}async function prunePackagedRuntimePayload(_0x3740be,_0x5282c9,_0x298c17){const _0x2422fc=_0x44ad8a,_0x5af0f4=createRuntimeInfoFromManifest(_0x3740be,_0x5282c9),_0x5643aa=[join(_0x3740be,process[_0x2422fc(0x2e3)]===_0x2422fc(0x20d)?'node/nod'+_0x2422fc(0x359)+_0x2422fc(0x306):_0x2422fc(0x252)+_0x2422fc(0x1ba)+'dules/np'+'m'),join(_0x5af0f4[_0x2422fc(0x251)+_0x2422fc(0x272)+'ir'],_0x2422fc(0x23b)+_0x2422fc(0x18a))],_0x4d5ed5=join(_0x5af0f4[_0x2422fc(0x251)+_0x2422fc(0x272)+'ir'],'dist',_0x2422fc(0x3c5)+'ns');if(existsSync(_0x4d5ed5))for(const _0x4ac492 of await readdir(_0x4d5ed5,{'withFileTypes':!![]})){_0x4ac492[_0x2422fc(0x296)+'ory']()&&_0x5643aa['push'](join(_0x4d5ed5,_0x4ac492[_0x2422fc(0x331)],_0x2422fc(0x23b)+_0x2422fc(0x18a)));}const _0x18f893={'files':0x0,'directories':0x0,'bytes':0x0};for(const _0x49634e of _0x5643aa){await pruneRuntimeDependencyTree(_0x49634e,_0x18f893);}await pruneOpenClawDocs(_0x5af0f4['openclaw'+'WorkingD'+'ir'],_0x18f893),_0x298c17?.[_0x2422fc(0x200)](_0x2422fc(0x23c)+_0x2422fc(0x1ac)+'ayload\x20b'+_0x2422fc(0x242)+_0x2422fc(0x2f7),_0x18f893);}async function pruneOpenClawDocs(_0x4726c0,_0x2c9872){const _0x37ac82=_0x44ad8a,_0x17bbcd=join(_0x4726c0,_0x37ac82(0x1df));if(!existsSync(_0x17bbcd))return;for(const _0x25c2af of await readdir(_0x17bbcd,{'withFileTypes':!![]})){if(_0x25c2af[_0x37ac82(0x331)]===_0x37ac82(0x375)+'e')continue;await removePrunedPath(join(_0x17bbcd,_0x25c2af[_0x37ac82(0x331)]),_0x2c9872);}}async function pruneRuntimeDependencyTree(_0x1dc04d,_0x56c621){const _0x361c2b=_0x44ad8a;if(!existsSync(_0x1dc04d))return;for(const _0x148fa8 of await readdir(_0x1dc04d,{'withFileTypes':!![]})){const _0x575057=join(_0x1dc04d,_0x148fa8[_0x361c2b(0x331)]);if(_0x148fa8[_0x361c2b(0x296)+_0x361c2b(0x387)]()){if(shouldPruneRuntimeDirectory(_0x1dc04d,_0x148fa8['name'])){await removePrunedPath(_0x575057,_0x56c621);continue;}await pruneRuntimeDependencyTree(_0x575057,_0x56c621);continue;}_0x148fa8['isFile']()&&shouldPruneRuntimeFile(_0x148fa8[_0x361c2b(0x331)])&&await removePrunedPath(_0x575057,_0x56c621);}}function shouldPruneRuntimeDirectory(_0x260f7e,_0x3af44d){const _0x2966f1=_0x44ad8a;if(_0x3af44d==='@types')return!![];if(new Set([_0x2966f1(0x280),_0x2966f1(0x1df),_0x2966f1(0x33d)])[_0x2966f1(0x228)](_0x3af44d))return existsSync(join(_0x260f7e,_0x2966f1(0x2eb)+_0x2966f1(0x22d)));return new Set([_0x2966f1(0x2c3)+'_','example',_0x2966f1(0x267),_0x2966f1(0x210),_0x2966f1(0x1f4)])['has'](_0x3af44d);}function shouldPruneRuntimeFile(_0x45eb44){const _0x5f1645=_0x44ad8a;if(_0x45eb44===_0x5f1645(0x281)+'lock.jso'+'n'||_0x45eb44[_0x5f1645(0x3c9)](_0x5f1645(0x1d3)))return!![];return new Set(['.map',_0x5f1645(0x363),'.markdow'+'n'])[_0x5f1645(0x228)](extname(_0x45eb44)['toLowerC'+_0x5f1645(0x2ab)]());}async function removePrunedPath(_0x309fc0,_0x58a51c){const _0x132e9c=_0x44ad8a;if(!existsSync(_0x309fc0))return;const _0x513b56=await getPathSize(_0x309fc0),_0x2a14c9=await stat(_0x309fc0);await rm(_0x309fc0,{'recursive':!![],'force':!![]}),_0x58a51c['bytes']+=_0x513b56;if(_0x2a14c9[_0x132e9c(0x296)+_0x132e9c(0x387)]())_0x58a51c[_0x132e9c(0x250)+_0x132e9c(0x28b)]+=0x1;else _0x58a51c['files']+=0x1;}async function getPathSize(_0x2450e8){const _0x64573d=_0x44ad8a,_0x4d38cb=await stat(_0x2450e8);if(!_0x4d38cb[_0x64573d(0x296)+_0x64573d(0x387)]())return _0x4d38cb[_0x64573d(0x318)];let _0x1e2f98=0x0;for(const _0x3e8ee8 of await readdir(_0x2450e8,{'withFileTypes':!![]})){_0x1e2f98+=await getPathSize(join(_0x2450e8,_0x3e8ee8[_0x64573d(0x331)]));}return _0x1e2f98;}function _0x537f(_0xd3c41f,_0x44cc64){_0xd3c41f=_0xd3c41f-0x139;const _0x251da2=_0x251d();let _0x537fd3=_0x251da2[_0xd3c41f];return _0x537fd3;}async function syncRuntimeWrapper(_0x307d56,_0x1b4870,_0x3c50bd){const _0x336ffa=_0x44ad8a,_0x1e5f84=_0x307d56[_0x336ffa(0x251)]?.[_0x336ffa(0x313)+_0x336ffa(0x396)]??_0x336ffa(0x321)+_0x336ffa(0x22d),_0x1cd4b1=join(_0x1b4870,_0x336ffa(0x287),'wujiecla'+'w'),_0x3fa152=join(_0x1b4870,_0x336ffa(0x287),_0x336ffa(0x1de)+_0x336ffa(0x1aa)),_0x388e11=normalizeRuntimeRelativePath(relative(dirname(_0x1cd4b1),resolve(_0x1b4870,_0x3c50bd[_0x336ffa(0x1b3)+_0x336ffa(0x36e)]))),_0x4915ed=normalizeRuntimeRelativePath(relative(dirname(_0x1cd4b1),resolve(_0x1b4870,_0x3c50bd[_0x336ffa(0x251)+_0x336ffa(0x2e0)]))),_0x1fb753=_0x336ffa(0x3c3)+_0x307d56[_0x336ffa(0x391)+_0x336ffa(0x247)],_0x2fba98=_0x336ffa(0x2b7)+_0x336ffa(0x3af)+_0x307d56[_0x336ffa(0x391)+_0x336ffa(0x247)];await mkdir(dirname(_0x1cd4b1),{'recursive':!![]});const _0x2bc254=fileURLToPath(new URL(_0x336ffa(0x3a6)+_0x336ffa(0x1e2)+_0x336ffa(0x209)+_0x336ffa(0x1f7),import.meta.url)),_0x11ffdf=join(_0x1b4870,_0x336ffa(0x287),_0x336ffa(0x27c)+_0x336ffa(0x37c));await cp(_0x2bc254,_0x11ffdf),await writeFile(_0x1cd4b1,[_0x336ffa(0x3a2)+'h','export\x20O'+'PENCLAW_'+_0x336ffa(0x276)+_0x336ffa(0x219)+_0x336ffa(0x149)+_0x1fb753+'}\x22','export\x20O'+_0x336ffa(0x392)+_0x336ffa(0x36b)+_0x336ffa(0x190)+_0x336ffa(0x17d)+_0x336ffa(0x3d0)+'-'+_0x1fb753+'}\x22',_0x336ffa(0x215)+_0x336ffa(0x392)+_0x336ffa(0x19c)+_0x336ffa(0x2d1)+_0x336ffa(0x15f)+_0x336ffa(0x3a7)+'FIG_FILE'+'_NAME:-'+_0x1e5f84+'}\x22',_0x336ffa(0x215)+_0x336ffa(0x392)+'CONFIG_P'+_0x336ffa(0x39a)+_0x336ffa(0x392)+'CONFIG_P'+_0x336ffa(0x35a)+_0x1fb753+'/'+_0x1e5f84+'}\x22',_0x336ffa(0x144)+_0x336ffa(0x262)+_0x336ffa(0x148)+'--\x20\x22$(di'+'rname\x20--'+_0x336ffa(0x152)+'&&\x20pwd)','if\x20[\x20-t\x20'+_0x336ffa(0x2be)+'\x20-z\x20\x22$WU'+_0x336ffa(0x1b5)+_0x336ffa(0x2a1)+_0x336ffa(0x25e),_0x336ffa(0x170)+'PT_DIR/'+_0x388e11+('\x22\x20\x22$SCRI'+_0x336ffa(0x372)+_0x336ffa(0x302)+_0x336ffa(0x2fd)+_0x336ffa(0x199)+'ll\x20||\x20tr'+'ue'),'fi',_0x336ffa(0x2aa)+'CRIPT_DI'+'R/'+_0x388e11+(_0x336ffa(0x348)+_0x336ffa(0x2fb))+_0x4915ed+_0x336ffa(0x179),''][_0x336ffa(0x2d7)]('\x0a'),'utf8'),await chmod(_0x1cd4b1,0x1ed),await writeFile(_0x3fa152,[_0x336ffa(0x1ab)+'f','if\x20\x22%OPE'+'NCLAW_HO'+_0x336ffa(0x145)+_0x336ffa(0x345)+_0x336ffa(0x162)+_0x336ffa(0x24c)+_0x2fba98+'\x22',_0x336ffa(0x20b)+_0x336ffa(0x17d)+_0x336ffa(0x19f)+'\x22==\x22\x22\x20se'+_0x336ffa(0x2db)+_0x336ffa(0x33b)+'E_DIR='+_0x2fba98+'\x22','if\x20\x22%OPE'+_0x336ffa(0x381)+'NFIG_FIL'+_0x336ffa(0x298)+_0x336ffa(0x1f6)+_0x336ffa(0x3d2)+_0x336ffa(0x308)+_0x336ffa(0x2e7)+'AME='+_0x1e5f84+'\x22','if\x20\x22%OPE'+'NCLAW_CO'+'NFIG_PAT'+_0x336ffa(0x20a)+_0x336ffa(0x2dd)+_0x336ffa(0x381)+_0x336ffa(0x175)+'H='+_0x2fba98+'\x5c'+_0x1e5f84+'\x22',_0x336ffa(0x178)+_0x336ffa(0x35b)+_0x336ffa(0x3d5),_0x336ffa(0x371)+_0x336ffa(0x29b)+toWindowsPath(_0x388e11)+(_0x336ffa(0x23e)+_0x336ffa(0x385))+toWindowsPath(_0x4915ed)+_0x336ffa(0x333),''][_0x336ffa(0x2d7)]('\x0d\x0a'),'utf8'),_0x3c50bd[_0x336ffa(0x1de)+_0x336ffa(0x3d6)]=toRuntimeRelative(_0x1b4870,process[_0x336ffa(0x2e3)]===_0x336ffa(0x20d)?_0x3fa152:_0x1cd4b1);}async function patchChatHistoryMixedToolContentBug(_0x4ea4cb,_0x5644ac,_0x439a16={}){const _0x3f515d=_0x44ad8a,_0x2257fc=resolve(_0x4ea4cb,_0x5644ac['openclaw'+_0x3f515d(0x272)+'ir']),_0x15031d=join(_0x2257fc,_0x3f515d(0x1d4));let _0x142fac=[];try{_0x142fac=await readdir(_0x15031d,{'withFileTypes':!![]});}catch{_0x439a16[_0x3f515d(0x1c0)+_0x3f515d(0x30a)]?.[_0x3f515d(0x32c)]?.('chat\x20his'+'tory\x20mix'+_0x3f515d(0x316)+_0x3f515d(0x15c)+_0x3f515d(0x2e5)+_0x3f515d(0x1a6)+_0x3f515d(0x216),{'distDir':_0x15031d,'openclawVersion':_0x5644ac[_0x3f515d(0x251)+_0x3f515d(0x323)]});return;}const _0x1ca14e=_0x142fac[_0x3f515d(0x1cc)](_0xbb77dd=>_0xbb77dd[_0x3f515d(0x255)]()&&(_0xbb77dd[_0x3f515d(0x331)]['startsWi'+'th'](_0x3f515d(0x161)+_0x3f515d(0x224)+_0x3f515d(0x361))||_0xbb77dd[_0x3f515d(0x331)][_0x3f515d(0x2f3)+'th'](_0x3f515d(0x1b8)+_0x3f515d(0x15a)+_0x3f515d(0x3b8)))&&_0xbb77dd[_0x3f515d(0x331)][_0x3f515d(0x3c9)](_0x3f515d(0x388)))[_0x3f515d(0x337)](_0x5dcda8=>join(_0x15031d,_0x5dcda8[_0x3f515d(0x331)]));if(_0x1ca14e[_0x3f515d(0x1c5)]===0x0){_0x439a16[_0x3f515d(0x1c0)+'ogger']?.[_0x3f515d(0x32c)]?.(_0x3f515d(0x258)+_0x3f515d(0x1d1)+_0x3f515d(0x316)+_0x3f515d(0x15c)+_0x3f515d(0x2ba)+_0x3f515d(0x38b)+'found',{'openclawVersion':_0x5644ac[_0x3f515d(0x251)+_0x3f515d(0x323)]});return;}for(const _0x4bd685 of _0x1ca14e){const _0xd68a34=await readFile(_0x4bd685,_0x3f515d(0x2c2)),_0x406408=patchMixedToolContentFromSource(_0xd68a34);if(!_0x406408[_0x3f515d(0x37a)]){if(_0x406408[_0x3f515d(0x14f)]===_0x3f515d(0x1cf)+_0x3f515d(0x37a)){_0x439a16[_0x3f515d(0x1c0)+_0x3f515d(0x30a)]?.[_0x3f515d(0x200)]?.('chat\x20his'+_0x3f515d(0x1d1)+'ed-tool\x20'+_0x3f515d(0x16c)+_0x3f515d(0x2b2)+'plied',{'openclawVersion':_0x5644ac['openclaw'+'Version'],'filePath':_0x4bd685});return;}continue;}await writeFile(_0x4bd685,_0x406408[_0x3f515d(0x356)],'utf8'),_0x439a16[_0x3f515d(0x1c0)+'ogger']?.['info']?.('chat\x20his'+_0x3f515d(0x1d1)+_0x3f515d(0x316)+_0x3f515d(0x3b1)+_0x3f515d(0x384),{'openclawVersion':_0x5644ac[_0x3f515d(0x251)+_0x3f515d(0x323)],'filePath':_0x4bd685,'note':_0x3f515d(0x1f5)+'y\x20compat'+_0x3f515d(0x23d)+_0x3f515d(0x32b)+'r\x20OpenCl'+_0x3f515d(0x38d)+_0x3f515d(0x13f)+'tool\x20his'+_0x3f515d(0x2bd)+_0x3f515d(0x205)+_0x3f515d(0x229)+'ify\x20upst'+'ream\x20fix'+_0x3f515d(0x141)+_0x3f515d(0x246)+_0x3f515d(0x261)});return;}_0x439a16['runtimeL'+'ogger']?.['warn']?.('chat\x20his'+_0x3f515d(0x1d1)+_0x3f515d(0x316)+_0x3f515d(0x15c)+_0x3f515d(0x2ba)+_0x3f515d(0x3b2)+_0x3f515d(0x14b)+'d',{'openclawVersion':_0x5644ac['openclaw'+_0x3f515d(0x323)]});}async function patchProviderRequestIdHeader(_0x585100,_0x99851,_0x5122c4={}){const _0x254210=_0x44ad8a,_0x4e1224=resolve(_0x585100,_0x99851['openclaw'+_0x254210(0x272)+'ir']),_0x4098e2=join(_0x4e1224,'dist');let _0xd6cf79=[];try{_0xd6cf79=await readdir(_0x4098e2,{'withFileTypes':!![]});}catch{_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x32c)]?.(_0x254210(0x395)+_0x254210(0x28f)+_0x254210(0x334)+_0x254210(0x278)+_0x254210(0x394)+';\x20dist\x20n'+_0x254210(0x257),{'distDir':_0x4098e2,'openclawVersion':_0x99851['openclaw'+_0x254210(0x323)]});return;}const _0x3b97ef=_0xd6cf79[_0x254210(0x1cc)](_0x41283b=>_0x41283b[_0x254210(0x255)]()&&_0x41283b[_0x254210(0x331)]['endsWith'](_0x254210(0x388)))[_0x254210(0x337)](_0x43044c=>join(_0x4098e2,_0x43044c['name']));let _0x2df2a0=0x0,_0x3351a0=0x0;for(const _0x1f9f27 of _0x3b97ef){const _0x58ed74=await readFile(_0x1f9f27,_0x254210(0x2c2)),_0x1b57c0=patchProviderRequestIdHeaderFromSource(_0x58ed74);if(_0x1b57c0[_0x254210(0x37a)]){await writeFile(_0x1f9f27,_0x1b57c0[_0x254210(0x356)],_0x254210(0x2c2)),_0x2df2a0+=0x1,_0x5122c4[_0x254210(0x1c0)+'ogger']?.[_0x254210(0x200)]?.(_0x254210(0x395)+_0x254210(0x28f)+'-id\x20head'+_0x254210(0x278)+_0x254210(0x310),{'openclawVersion':_0x99851['openclaw'+_0x254210(0x323)],'filePath':_0x1f9f27});continue;}if(_0x1b57c0[_0x254210(0x14f)]==='already-'+_0x254210(0x37a))_0x3351a0+=0x1;}if(_0x2df2a0>0x0){_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x200)]?.(_0x254210(0x395)+_0x254210(0x28f)+_0x254210(0x334)+_0x254210(0x278)+_0x254210(0x18f),{'openclawVersion':_0x99851[_0x254210(0x251)+_0x254210(0x323)],'patchedCount':_0x2df2a0,'alreadyPatchedCount':_0x3351a0});return;}if(_0x3351a0>0x0){_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x200)]?.(_0x254210(0x395)+_0x254210(0x28f)+'-id\x20head'+'er\x20patch'+_0x254210(0x312)+_0x254210(0x310),{'openclawVersion':_0x99851[_0x254210(0x251)+'Version'],'alreadyPatchedCount':_0x3351a0});return;}_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x32c)]?.(_0x254210(0x395)+_0x254210(0x28f)+'-id\x20head'+_0x254210(0x278)+_0x254210(0x394)+_0x254210(0x1c1)+_0x254210(0x139)+_0x254210(0x221)+_0x254210(0x2d2)+'nd',{'openclawVersion':_0x99851[_0x254210(0x251)+_0x254210(0x323)]});}async function patchChannelPluginRuntimeBug(_0x326dcf,_0x2233c1,_0x10c0af={}){const _0x50ddfc=_0x44ad8a,_0xaf3e5e=resolve(_0x326dcf,_0x2233c1[_0x50ddfc(0x251)+'WorkingD'+'ir']),_0x371061=join(_0xaf3e5e,'dist');let _0x397a94=[];try{_0x397a94=await readdir(_0x371061,{'withFileTypes':!![]});}catch{_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.[_0x50ddfc(0x32c)]?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+'untime\x20p'+_0x50ddfc(0x2c6)+_0x50ddfc(0x284)+_0x50ddfc(0x38f)+_0x50ddfc(0x1e9),{'distDir':_0x371061,'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)]});return;}const _0x1b15ba=_0x397a94['filter'](_0x26c559=>_0x26c559[_0x50ddfc(0x255)]()&&_0x26c559[_0x50ddfc(0x331)]['startsWi'+'th'](_0x50ddfc(0x29a))&&_0x26c559['name'][_0x50ddfc(0x3c9)](_0x50ddfc(0x388)))[_0x50ddfc(0x337)](_0x4f1fc9=>join(_0x371061,_0x4f1fc9[_0x50ddfc(0x331)])),_0x4dddcc=await resolveRuntimeChannelImportPath(_0x371061,_0x397a94);if(_0x1b15ba[_0x50ddfc(0x1c5)]===0x0){_0x10c0af['runtimeL'+_0x50ddfc(0x30a)]?.[_0x50ddfc(0x32c)]?.('channel\x20'+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x2c6)+_0x50ddfc(0x1ae)+_0x50ddfc(0x146)+_0x50ddfc(0x19e),{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)]});return;}if(!_0x4dddcc){_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.['warn']?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x2c6)+_0x50ddfc(0x166)+_0x50ddfc(0x36c)+'annel\x20en'+_0x50ddfc(0x31e)+_0x50ddfc(0x216),{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)],'distDir':_0x371061});return;}for(const _0x14b530 of _0x1b15ba){const _0x1faadf=await readFile(_0x14b530,_0x50ddfc(0x2c2)),_0x531a97=patchChannelPluginRuntimeFromSource(_0x1faadf,{'runtimeChannelImportPath':_0x4dddcc});if(!_0x531a97[_0x50ddfc(0x37a)]){if(_0x531a97[_0x50ddfc(0x14f)]===_0x50ddfc(0x1cf)+'patched'){_0x10c0af['runtimeL'+'ogger']?.[_0x50ddfc(0x200)]?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x2bc)+_0x50ddfc(0x328)+'lied',{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)],'filePath':_0x14b530});return;}continue;}await writeFile(_0x14b530,_0x531a97['source'],_0x50ddfc(0x2c2)),_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.['info']?.('channel\x20'+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x340)+'lied',{'openclawVersion':_0x2233c1['openclaw'+_0x50ddfc(0x323)],'filePath':_0x14b530,'note':_0x50ddfc(0x1f5)+_0x50ddfc(0x169)+_0x50ddfc(0x23d)+_0x50ddfc(0x32b)+_0x50ddfc(0x1d0)+_0x50ddfc(0x38d)+_0x50ddfc(0x174)+_0x50ddfc(0x14e)+'in\x20runti'+'me\x20missi'+_0x50ddfc(0x1af)+_0x50ddfc(0x1fb)+_0x50ddfc(0x1a8)+_0x50ddfc(0x19d)+_0x50ddfc(0x2df)+'eam\x20fix\x20'+_0x50ddfc(0x39d)+_0x50ddfc(0x19a)+_0x50ddfc(0x22e)});return;}_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.[_0x50ddfc(0x32c)]?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+'atch\x20ski'+_0x50ddfc(0x166)+_0x50ddfc(0x3a0)+_0x50ddfc(0x293)+_0x50ddfc(0x257),{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+'Version']});}async function patchSessionStoreSqliteRuntime(_0x569ea6,_0x26dbfd,_0x3a62c8={}){const _0x5c270a=_0x44ad8a,_0x180609=resolve(_0x569ea6,_0x26dbfd[_0x5c270a(0x251)+_0x5c270a(0x272)+'ir']),_0x124b09=join(_0x180609,_0x5c270a(0x1d4)),_0x158b33=_0x5c270a(0x36a)+_0x5c270a(0x324)+_0x5c270a(0x1ea)+_0x5c270a(0x2bf)+'time-bri'+_0x5c270a(0x26f),_0x159d13=join(_0x569ea6,_0x5c270a(0x13d)+_0x5c270a(0x2c8),'sessions','runtime-'+_0x5c270a(0x365)+'js'),_0x1f4b7e=(await readdir(_0x124b09,{'withFileTypes':!![]})[_0x5c270a(0x283)](()=>[]))['filter'](_0x2da284=>_0x2da284['isFile']()&&_0x2da284['name']['startsWi'+'th'](_0x5c270a(0x3b7)+_0x5c270a(0x180))&&_0x2da284['name']['endsWith'](_0x5c270a(0x388)))[_0x5c270a(0x337)](_0x58b6f6=>join(_0x124b09,_0x58b6f6[_0x5c270a(0x331)])),_0x3a1d14=(await readdir(_0x124b09,{'withFileTypes':!![]})[_0x5c270a(0x283)](()=>[]))[_0x5c270a(0x1cc)](_0xb590e8=>_0xb590e8[_0x5c270a(0x255)]()&&_0xb590e8[_0x5c270a(0x331)][_0x5c270a(0x2f3)+'th'](_0x5c270a(0x1b6))&&!_0xb590e8['name']['startsWi'+'th'](_0x5c270a(0x3b7)+'ad-')&&_0xb590e8[_0x5c270a(0x331)][_0x5c270a(0x3c9)](_0x5c270a(0x388)))['map'](_0x458a34=>join(_0x124b09,_0x458a34['name']));if(!existsSync(_0x159d13)){_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.(_0x5c270a(0x367)+_0x5c270a(0x16e)+_0x5c270a(0x286)+_0x5c270a(0x20f)+_0x5c270a(0x3c6)+_0x5c270a(0x2a2)+_0x5c270a(0x379),{'bridgePath':_0x159d13,'openclawVersion':_0x26dbfd[_0x5c270a(0x251)+'Version']});return;}for(const _0x5ad691 of _0x1f4b7e){const _0x308e46=await readFile(_0x5ad691,'utf8'),_0x297f8f=patchSessionStoreLoadFromSource(_0x308e46,{'bridgeImportPath':_0x158b33});if(!_0x297f8f['patched']){if(_0x297f8f[_0x5c270a(0x14f)]===_0x5c270a(0x1cf)+'patched'){_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.('session\x20'+'store\x20lo'+'ad\x20patch'+_0x5c270a(0x312)+_0x5c270a(0x310),{'filePath':_0x5ad691,'openclawVersion':_0x26dbfd['openclaw'+_0x5c270a(0x323)]});break;}continue;}await writeFile(_0x5ad691,_0x297f8f[_0x5c270a(0x356)],_0x5c270a(0x2c2)),_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.(_0x5c270a(0x367)+_0x5c270a(0x13c)+_0x5c270a(0x27b)+'\x20applied',{'filePath':_0x5ad691,'openclawVersion':_0x26dbfd[_0x5c270a(0x251)+_0x5c270a(0x323)]});break;}for(const _0x31a3eb of _0x3a1d14){const _0x999adc=await readFile(_0x31a3eb,_0x5c270a(0x2c2)),_0x1adc6c=patchSessionStoreWriteFromSource(_0x999adc,{'bridgeImportPath':_0x158b33});if(!_0x1adc6c['patched']){if(_0x1adc6c[_0x5c270a(0x14f)]===_0x5c270a(0x1cf)+_0x5c270a(0x37a)){_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.('session\x20'+'store\x20wr'+_0x5c270a(0x14c)+_0x5c270a(0x1e6)+_0x5c270a(0x22c)+'d',{'filePath':_0x31a3eb,'openclawVersion':_0x26dbfd['openclaw'+'Version']});break;}continue;}await writeFile(_0x31a3eb,_0x1adc6c['source'],'utf8'),_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.['info']?.(_0x5c270a(0x367)+_0x5c270a(0x18b)+'ite\x20patc'+_0x5c270a(0x187)+'d',{'filePath':_0x31a3eb,'openclawVersion':_0x26dbfd[_0x5c270a(0x251)+_0x5c270a(0x323)]});break;}}async function patchWeixinOutboundSessionRoute(_0xb046a2,_0x4931d5,_0x3da068={}){const _0x2b91b3=_0x44ad8a,_0x5488e9=join(_0xb046a2,_0x2b91b3(0x251),_0x2b91b3(0x1d4),_0x2b91b3(0x3c5)+'ns','openclaw'+_0x2b91b3(0x288),_0x2b91b3(0x1d4),_0x2b91b3(0x2a7),_0x2b91b3(0x181)+'js');if(!existsSync(_0x5488e9)){_0x3da068[_0x2b91b3(0x1c0)+'ogger']?.[_0x2b91b3(0x200)]?.(_0x2b91b3(0x2ee)+_0x2b91b3(0x355)+'session\x20'+'route\x20pa'+'tch\x20skip'+'ped;\x20plu'+_0x2b91b3(0x1a9)+_0x2b91b3(0x382)+'d',{'openclawVersion':_0x4931d5[_0x2b91b3(0x251)+_0x2b91b3(0x323)],'filePath':_0x5488e9});return;}const _0x293da6=await readFile(_0x5488e9,'utf8'),_0x148e58=patchWeixinOutboundSessionRouteFromSource(_0x293da6);if(!_0x148e58[_0x2b91b3(0x37a)]){if(_0x148e58[_0x2b91b3(0x14f)]===_0x2b91b3(0x1cf)+'patched'){_0x3da068[_0x2b91b3(0x1c0)+_0x2b91b3(0x30a)]?.[_0x2b91b3(0x200)]?.(_0x2b91b3(0x2ee)+_0x2b91b3(0x355)+_0x2b91b3(0x367)+'route\x20pa'+_0x2b91b3(0x2e2)+'ady\x20appl'+_0x2b91b3(0x3cb),{'openclawVersion':_0x4931d5[_0x2b91b3(0x251)+_0x2b91b3(0x323)],'filePath':_0x5488e9});return;}_0x3da068[_0x2b91b3(0x1c0)+_0x2b91b3(0x30a)]?.[_0x2b91b3(0x32c)]?.(_0x2b91b3(0x2ee)+'utbound\x20'+'session\x20'+_0x2b91b3(0x25c)+'tch\x20skip'+_0x2b91b3(0x383)+_0x2b91b3(0x1f3)+'pe\x20not\x20f'+_0x2b91b3(0x1e9),{'openclawVersion':_0x4931d5['openclaw'+_0x2b91b3(0x323)],'filePath':_0x5488e9,'reason':_0x148e58[_0x2b91b3(0x14f)]});return;}await writeFile(_0x5488e9,_0x148e58[_0x2b91b3(0x356)],'utf8'),_0x3da068['runtimeL'+_0x2b91b3(0x30a)]?.[_0x2b91b3(0x200)]?.(_0x2b91b3(0x2ee)+_0x2b91b3(0x355)+_0x2b91b3(0x367)+'route\x20pa'+_0x2b91b3(0x1f8)+'ied',{'openclawVersion':_0x4931d5[_0x2b91b3(0x251)+_0x2b91b3(0x323)],'filePath':_0x5488e9,'note':_0x2b91b3(0x1f5)+_0x2b91b3(0x169)+_0x2b91b3(0x23d)+_0x2b91b3(0x32b)+_0x2b91b3(0x3ba)+_0x2b91b3(0x253)+'n/opencl'+'aw-weixi'+_0x2b91b3(0x317)+_0x2b91b3(0x207)+_0x2b91b3(0x31a)+_0x2b91b3(0x192)+_0x2b91b3(0x1b7)+_0x2b91b3(0x35f)+'up\x20sessi'+_0x2b91b3(0x26d)+_0x2b91b3(0x36d)+_0x2b91b3(0x2da)+_0x2b91b3(0x141)+_0x2b91b3(0x246)+_0x2b91b3(0x261)});}async function patchWeixinOutboundFallbackRuntime(_0x3ba174,_0x47d96d,_0x4c19a9={}){const _0x3de756=_0x44ad8a,_0x2c483e=resolve(_0x3ba174,_0x47d96d['openclaw'+_0x3de756(0x272)+'ir']),_0x482b5a=join(_0x2c483e,'dist'),_0x4ca04a=(await readdir(_0x482b5a,{'withFileTypes':!![]})[_0x3de756(0x283)](()=>[]))[_0x3de756(0x1cc)](_0x273535=>_0x273535[_0x3de756(0x255)]()&&_0x273535[_0x3de756(0x331)][_0x3de756(0x2f3)+'th'](_0x3de756(0x29c)+'-session'+'-')&&_0x273535[_0x3de756(0x331)]['endsWith'](_0x3de756(0x388)))[_0x3de756(0x337)](_0x3bb0c5=>join(_0x482b5a,_0x3bb0c5[_0x3de756(0x331)]));if(_0x4ca04a[_0x3de756(0x1c5)]===0x0){_0x4c19a9['runtimeL'+_0x3de756(0x30a)]?.[_0x3de756(0x32c)]?.(_0x3de756(0x2ee)+_0x3de756(0x355)+_0x3de756(0x358)+_0x3de756(0x223)+_0x3de756(0x1c3)+_0x3de756(0x29c)+_0x3de756(0x37e)+_0x3de756(0x2d2)+'nd',{'openclawVersion':_0x47d96d[_0x3de756(0x251)+_0x3de756(0x323)],'distDir':_0x482b5a});return;}for(const _0xacc544 of _0x4ca04a){const _0x3d2c9f=await readFile(_0xacc544,'utf8'),_0x4b63d7=patchWeixinOutboundFallbackFromSource(_0x3d2c9f);if(!_0x4b63d7[_0x3de756(0x37a)]){if(_0x4b63d7[_0x3de756(0x14f)]===_0x3de756(0x1cf)+_0x3de756(0x37a)){_0x4c19a9[_0x3de756(0x1c0)+_0x3de756(0x30a)]?.[_0x3de756(0x200)]?.(_0x3de756(0x2ee)+'utbound\x20'+_0x3de756(0x358)+'\x20patch\x20a'+_0x3de756(0x3c0)+'pplied',{'openclawVersion':_0x47d96d[_0x3de756(0x251)+_0x3de756(0x323)],'filePath':_0xacc544});return;}continue;}await writeFile(_0xacc544,_0x4b63d7['source'],_0x3de756(0x2c2)),_0x4c19a9[_0x3de756(0x1c0)+_0x3de756(0x30a)]?.['info']?.(_0x3de756(0x2ee)+_0x3de756(0x355)+'fallback'+_0x3de756(0x315)+_0x3de756(0x1fc),{'openclawVersion':_0x47d96d[_0x3de756(0x251)+_0x3de756(0x323)],'filePath':_0xacc544,'note':_0x3de756(0x1f5)+_0x3de756(0x169)+'ibility\x20'+_0x3de756(0x32b)+_0x3de756(0x3c8)+_0x3de756(0x2f6)+_0x3de756(0x2b5)+_0x3de756(0x39c)+'\x20outboun'+'d\x20mirror'+_0x3de756(0x2b4)+_0x3de756(0x163)+_0x3de756(0x140)+_0x3de756(0x25d)+'\x20routing'+_0x3de756(0x14d)+_0x3de756(0x177)});return;}_0x4c19a9['runtimeL'+_0x3de756(0x30a)]?.[_0x3de756(0x32c)]?.('weixin\x20o'+_0x3de756(0x355)+_0x3de756(0x358)+_0x3de756(0x223)+_0x3de756(0x1c3)+_0x3de756(0x160)+_0x3de756(0x2d5)+_0x3de756(0x257),{'openclawVersion':_0x47d96d['openclaw'+_0x3de756(0x323)]});}async function patchRequestIdTitleRuntime(_0x8dae7d,_0x4c5dd8,_0x1a0843={}){const _0x14f9d1=_0x44ad8a,_0x561253=resolve(_0x8dae7d,_0x4c5dd8[_0x14f9d1(0x251)+_0x14f9d1(0x272)+'ir']),_0x2c3f39=join(_0x561253,_0x14f9d1(0x1d4)),_0x176a42=_0x14f9d1(0x36a)+_0x14f9d1(0x324)+_0x14f9d1(0x2de)+_0x14f9d1(0x2a5)+_0x14f9d1(0x182)+'ridge.mj'+'s',_0x397481=join(_0x8dae7d,_0x14f9d1(0x13d)+_0x14f9d1(0x2c8),_0x14f9d1(0x29d)+'id','runtime-'+'bridge.m'+'js');if(!existsSync(_0x397481)){_0x1a0843['runtimeL'+'ogger']?.['info']?.('request-'+_0x14f9d1(0x1cd)+'\x20runtime'+_0x14f9d1(0x223)+'kipped;\x20'+_0x14f9d1(0x27d)+_0x14f9d1(0x398)+_0x14f9d1(0x393),{'bridgePath':_0x397481,'openclawVersion':_0x4c5dd8['openclaw'+_0x14f9d1(0x323)]});return;}const _0x12323e=(await readdir(_0x2c3f39,{'withFileTypes':!![]})[_0x14f9d1(0x283)](()=>[]))['filter'](_0xe3b54c=>_0xe3b54c[_0x14f9d1(0x255)]()&&_0xe3b54c[_0x14f9d1(0x331)][_0x14f9d1(0x2f3)+'th'](_0x14f9d1(0x29a))&&_0xe3b54c[_0x14f9d1(0x331)][_0x14f9d1(0x3c9)](_0x14f9d1(0x388)))[_0x14f9d1(0x337)](_0x4b6622=>join(_0x2c3f39,_0x4b6622['name']));for(const _0xd90e86 of _0x12323e){const _0x2f7c20=await readFile(_0xd90e86,'utf8'),_0x1f1be2=patchRequestIdTitleRuntimeFromSource(_0x2f7c20,{'bridgeImportPath':_0x176a42});if(!_0x1f1be2[_0x14f9d1(0x37a)]){if(_0x1f1be2['reason']===_0x14f9d1(0x1cf)+_0x14f9d1(0x37a)){_0x1a0843[_0x14f9d1(0x1c0)+_0x14f9d1(0x30a)]?.[_0x14f9d1(0x200)]?.(_0x14f9d1(0x29d)+_0x14f9d1(0x1cd)+_0x14f9d1(0x37e)+_0x14f9d1(0x315)+'lready\x20a'+_0x14f9d1(0x1fc),{'filePath':_0xd90e86,'openclawVersion':_0x4c5dd8[_0x14f9d1(0x251)+_0x14f9d1(0x323)]});break;}continue;}await writeFile(_0xd90e86,_0x1f1be2[_0x14f9d1(0x356)],_0x14f9d1(0x2c2)),_0x1a0843['runtimeL'+_0x14f9d1(0x30a)]?.['info']?.(_0x14f9d1(0x29d)+_0x14f9d1(0x1cd)+'\x20runtime'+_0x14f9d1(0x315)+'pplied',{'filePath':_0xd90e86,'openclawVersion':_0x4c5dd8[_0x14f9d1(0x251)+_0x14f9d1(0x323)]});break;}}async function patchQQBotOutboundFallbackRuntime(_0x1c23b7,_0xb476c,_0x1e47d4={}){const _0x1937de=_0x44ad8a,_0x30ad27=resolve(_0x1c23b7,_0xb476c[_0x1937de(0x251)+'WorkingD'+'ir']),_0x55b178=join(_0x30ad27,'dist'),_0x3784ef=(await readdir(_0x55b178,{'withFileTypes':!![]})[_0x1937de(0x283)](()=>[]))[_0x1937de(0x1cc)](_0x3877ce=>_0x3877ce[_0x1937de(0x255)]()&&_0x3877ce[_0x1937de(0x331)][_0x1937de(0x2f3)+'th'](_0x1937de(0x29c)+'-session'+'-')&&_0x3877ce[_0x1937de(0x331)][_0x1937de(0x3c9)](_0x1937de(0x388)))[_0x1937de(0x337)](_0x403761=>join(_0x55b178,_0x403761['name']));if(_0x3784ef[_0x1937de(0x1c5)]===0x0){_0x1e47d4[_0x1937de(0x1c0)+'ogger']?.['warn']?.(_0x1937de(0x349)+'tbound\x20f'+_0x1937de(0x1bc)+_0x1937de(0x15c)+_0x1937de(0x285)+_0x1937de(0x355)+'runtime\x20'+_0x1937de(0x14b)+'d',{'openclawVersion':_0xb476c[_0x1937de(0x251)+_0x1937de(0x323)],'distDir':_0x55b178});return;}for(const _0x4943a6 of _0x3784ef){const _0x255a8c=await readFile(_0x4943a6,'utf8'),_0x5e1752=patchQQBotOutboundFallbackFromSource(_0x255a8c);if(!_0x5e1752[_0x1937de(0x37a)]){if(_0x5e1752[_0x1937de(0x14f)]==='already-'+'patched'){_0x1e47d4['runtimeL'+_0x1937de(0x30a)]?.['info']?.('qqbot\x20ou'+_0x1937de(0x31f)+_0x1937de(0x1bc)+_0x1937de(0x16c)+_0x1937de(0x2b2)+_0x1937de(0x384),{'openclawVersion':_0xb476c[_0x1937de(0x251)+_0x1937de(0x323)],'filePath':_0x4943a6});return;}continue;}await writeFile(_0x4943a6,_0x5e1752[_0x1937de(0x356)],_0x1937de(0x2c2)),_0x1e47d4['runtimeL'+_0x1937de(0x30a)]?.[_0x1937de(0x200)]?.(_0x1937de(0x349)+_0x1937de(0x31f)+_0x1937de(0x1bc)+_0x1937de(0x3b1)+_0x1937de(0x384),{'openclawVersion':_0xb476c[_0x1937de(0x251)+'Version'],'filePath':_0x4943a6,'note':_0x1937de(0x1f5)+_0x1937de(0x169)+_0x1937de(0x23d)+_0x1937de(0x32b)+_0x1937de(0x2ad)+'Bot\x20c2c\x20'+_0x1937de(0x29c)+_0x1937de(0x2e6)+_0x1937de(0x1f1)+'ct\x20sessi'+_0x1937de(0x330)+_0x1937de(0x273)+_0x1937de(0x30d)+_0x1937de(0x3b9)+_0x1937de(0x368)});return;}_0x1e47d4['runtimeL'+'ogger']?.['warn']?.(_0x1937de(0x349)+_0x1937de(0x31f)+_0x1937de(0x1bc)+_0x1937de(0x15c)+_0x1937de(0x2a0)+'esolver\x20'+'shape\x20no'+_0x1937de(0x2dc),{'openclawVersion':_0xb476c[_0x1937de(0x251)+'Version']});}async function patchQQBotOutboundSessionRoute(_0x1cd53e,_0x4d3166,_0x5da2c8={}){const _0x223679=_0x44ad8a,_0x385af6=join(_0x1cd53e,'openclaw',_0x223679(0x1d4),_0x223679(0x3c5)+'ns',_0x223679(0x2e1),'dist');if(!existsSync(_0x385af6)){_0x5da2c8[_0x223679(0x1c0)+_0x223679(0x30a)]?.[_0x223679(0x200)]?.(_0x223679(0x349)+'tbound\x20s'+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x20f)+_0x223679(0x21e)+_0x223679(0x3c4)+_0x223679(0x21a),{'openclawVersion':_0x4d3166[_0x223679(0x251)+'Version'],'distDir':_0x385af6});return;}const _0x500e21=(await readdir(_0x385af6,{'withFileTypes':!![]})[_0x223679(0x283)](()=>[]))[_0x223679(0x1cc)](_0x586c07=>_0x586c07[_0x223679(0x255)]()&&_0x586c07[_0x223679(0x331)][_0x223679(0x3c9)](_0x223679(0x388)))[_0x223679(0x337)](_0x3f6eeb=>join(_0x385af6,_0x3f6eeb[_0x223679(0x331)]));for(const _0x1b580c of _0x500e21){const _0x319f5e=await readFile(_0x1b580c,'utf8'),_0x529f3f=patchQQBotOutboundSessionRouteFromSource(_0x319f5e);if(!_0x529f3f['patched']){if(_0x529f3f[_0x223679(0x14f)]===_0x223679(0x1cf)+_0x223679(0x37a)){_0x5da2c8[_0x223679(0x1c0)+'ogger']?.['info']?.(_0x223679(0x349)+_0x223679(0x33e)+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x245)+_0x223679(0x1fe)+'ed',{'openclawVersion':_0x4d3166[_0x223679(0x251)+_0x223679(0x323)],'filePath':_0x1b580c});return;}continue;}await writeFile(_0x1b580c,_0x529f3f['source'],_0x223679(0x2c2)),_0x5da2c8[_0x223679(0x1c0)+_0x223679(0x30a)]?.['info']?.(_0x223679(0x349)+_0x223679(0x33e)+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x157)+'ed',{'openclawVersion':_0x4d3166[_0x223679(0x251)+'Version'],'filePath':_0x1b580c,'note':_0x223679(0x1f5)+_0x223679(0x169)+'ibility\x20'+'patch\x20fo'+_0x223679(0x18c)+_0x223679(0x3d4)+_0x223679(0x21f)+_0x223679(0x25b)+'elivery\x20'+_0x223679(0x269)+_0x223679(0x2af)+_0x223679(0x233)+'th\x20c2c\x20i'+_0x223679(0x203)+_0x223679(0x189)+_0x223679(0x3cf)});return;}_0x5da2c8['runtimeL'+_0x223679(0x30a)]?.[_0x223679(0x32c)]?.(_0x223679(0x349)+_0x223679(0x33e)+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x20f)+_0x223679(0x30f)+'nel\x20shap'+'e\x20not\x20fo'+_0x223679(0x2cd),{'openclawVersion':_0x4d3166[_0x223679(0x251)+'Version'],'distDir':_0x385af6});}async function resolveRuntimeChannelImportPath(_0x27dc52,_0x3ebc68){const _0x5cdf8e=_0x44ad8a,_0x44f6a8=_0x3ebc68[_0x5cdf8e(0x1cc)](_0x2e441e=>_0x2e441e[_0x5cdf8e(0x255)]()&&_0x2e441e[_0x5cdf8e(0x331)][_0x5cdf8e(0x2f3)+'th'](_0x5cdf8e(0x1ce)+_0x5cdf8e(0x1ef))&&_0x2e441e[_0x5cdf8e(0x331)][_0x5cdf8e(0x3c9)](_0x5cdf8e(0x388))&&!_0x2e441e[_0x5cdf8e(0x331)][_0x5cdf8e(0x2f3)+'th']('runtime-'+_0x5cdf8e(0x1ef)+'state-'))[_0x5cdf8e(0x337)](_0xdab370=>_0xdab370[_0x5cdf8e(0x331)])[_0x5cdf8e(0x32e)]();for(const _0xe97b1b of _0x44f6a8){const _0x2faa16=await readFile(join(_0x27dc52,_0xe97b1b),_0x5cdf8e(0x2c2));if(_0x2faa16[_0x5cdf8e(0x1a4)](_0x5cdf8e(0x24b)+'ntimeCha'+_0x5cdf8e(0x13b)))return'./'+_0xe97b1b;}return null;}function normalizeRuntimeRelativePath(_0x3e249d){const _0x27086d=_0x44ad8a;return _0x3e249d[_0x27086d(0x277)+'ll']('\x5c','/');}function toWindowsPath(_0x6ecea1){const _0x146661=_0x44ad8a;return _0x6ecea1[_0x146661(0x277)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x2f1257,_0xa5b5a3){const _0x303988=_0x44ad8a;if(_0x2f1257[_0x303988(0x16b)+_0x303988(0x2e8)]===_0xa5b5a3['openclaw'][_0x303988(0x16b)+_0x303988(0x2e8)])return;throw new Error(_0x303988(0x2ef)+'nodeVers'+_0x303988(0x2f8)+_0x303988(0x193)+_0x303988(0x15d)+(_0x2f1257[_0x303988(0x16b)+_0x303988(0x2e8)]||_0x303988(0x241))+(',\x20shell.'+'config=')+_0xa5b5a3[_0x303988(0x251)][_0x303988(0x16b)+_0x303988(0x2e8)]+'.\x20'+('Run\x20\x22wuj'+_0x303988(0x2d9)+'\x20prepare'+'\x22\x20so\x20the'+_0x303988(0x28d)+'\x20runtime'+'\x20can\x20be\x20'+_0x303988(0x1b9)+_0x303988(0x339)+_0x303988(0x1d9)+_0x303988(0x28e)+_0x303988(0x1ee)+'.'));}function validateRuntimeOpenClawVersion(_0x2d3341,_0x7f48c7){const _0x3d2ffd=_0x44ad8a;if(_0x2d3341['openclaw'+_0x3d2ffd(0x323)]===_0x7f48c7[_0x3d2ffd(0x251)][_0x3d2ffd(0x251)+_0x3d2ffd(0x323)])return;throw new Error(_0x3d2ffd(0x2ef)+_0x3d2ffd(0x251)+_0x3d2ffd(0x158)+_0x3d2ffd(0x311)+_0x3d2ffd(0x23f)+_0x3d2ffd(0x2ed)+(_0x2d3341[_0x3d2ffd(0x251)+_0x3d2ffd(0x323)]||'unknown')+(_0x3d2ffd(0x268)+'config=')+_0x7f48c7[_0x3d2ffd(0x251)][_0x3d2ffd(0x251)+_0x3d2ffd(0x323)]+'.\x20'+(_0x3d2ffd(0x39e)+_0x3d2ffd(0x2d9)+_0x3d2ffd(0x309)+_0x3d2ffd(0x2ea)+_0x3d2ffd(0x37e)+_0x3d2ffd(0x1c9)+_0x3d2ffd(0x22b)+_0x3d2ffd(0x1d9)+_0x3d2ffd(0x24f)+_0x3d2ffd(0x1b0)+_0x3d2ffd(0x35e)));}function parseNpmPackJson(_0x3cb85c){const _0x21c035=_0x44ad8a,_0x1ec16f=_0x3cb85c['trim'](),_0x30b8e1=_0x1ec16f[_0x21c035(0x2ca)]('[');if(_0x30b8e1<0x0)throw new Error('npm\x20pack'+_0x21c035(0x2a3)+_0x21c035(0x386)+_0x21c035(0x1d7)+_0x1ec16f[_0x21c035(0x362)](0x0,0x1f4));const _0x1c6eb4=JSON[_0x21c035(0x37b)](_0x1ec16f['slice'](_0x30b8e1)),_0x56faa4=Array[_0x21c035(0x29e)](_0x1c6eb4)?_0x1c6eb4[0x0]:_0x1c6eb4;if(!_0x56faa4||typeof _0x56faa4!==_0x21c035(0x217))throw new Error(_0x21c035(0x206)+_0x21c035(0x142)+_0x21c035(0x326)+_0x21c035(0x3a3)+_0x21c035(0x1d8)+_0x1ec16f[_0x21c035(0x362)](0x0,0x1f4));return _0x56faa4;}function normalizePackedTarballFilename(_0x47ead6){const _0x3fb1d2=_0x44ad8a;return _0x47ead6['replace'](/^@/,'')[_0x3fb1d2(0x277)+'ll']('/','-')[_0x3fb1d2(0x277)+'ll']('\x5c','-');}async function runProcess(_0x4661bd,_0x7d7349,_0x5d1d1={}){const _0x2b9b7e=_0x44ad8a,_0x3d5491=_0x5d1d1['label']||[_0x4661bd,..._0x7d7349]['join']('\x20'),_0x5b7c1a=_0x5d1d1[_0x2b9b7e(0x304)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x3643fb=spawn(_0x4661bd,_0x7d7349,{'cwd':_0x5d1d1[_0x2b9b7e(0x2cf)],'env':_0x5d1d1[_0x2b9b7e(0x2f2)],'stdio':[_0x2b9b7e(0x31b),_0x2b9b7e(0x21c),'pipe']});return await new Promise((_0x28d5bb,_0x77d983)=>{const _0x13f413=_0x2b9b7e;let _0x25c9df='',_0x150db2='',_0x4d3955=![];const _0x32e804=setTimeout(()=>{const _0x159d86=_0x537f;if(_0x4d3955)return;_0x4d3955=!![],_0x3643fb['kill'](_0x159d86(0x2ac)),_0x77d983(new Error(_0x3d5491+(_0x159d86(0x399)+_0x159d86(0x1ad)+'\x20')+_0x5b7c1a+'ms'));},_0x5b7c1a);_0x3643fb[_0x13f413(0x150)]['on'](_0x13f413(0x3c7),_0x1655ee=>{const _0x2e07c1=_0x13f413;_0x25c9df+=_0x1655ee[_0x2e07c1(0x17b)]();}),_0x3643fb[_0x13f413(0x212)]['on'](_0x13f413(0x3c7),_0x2763b8=>{_0x150db2+=_0x2763b8['toString']();}),_0x3643fb['on'](_0x13f413(0x156),_0x1720b7=>{if(_0x4d3955)return;_0x4d3955=!![],clearTimeout(_0x32e804),_0x77d983(_0x1720b7);}),_0x3643fb['on'](_0x13f413(0x21b),(_0x3e7853,_0x1f4142)=>{const _0x438502=_0x13f413;if(_0x4d3955)return;_0x4d3955=!![],clearTimeout(_0x32e804);if(_0x3e7853===0x0){_0x28d5bb({'stdout':_0x25c9df,'stderr':_0x150db2});return;}_0x77d983(new Error(_0x3d5491+(_0x438502(0x2b0)+_0x438502(0x2f5)+'e=')+(_0x3e7853??_0x438502(0x165))+_0x438502(0x3a5)+(_0x1f4142??_0x438502(0x165))+'\x0a'+(''+(_0x150db2||_0x25c9df))[_0x438502(0x354)]()));});});}async function installOpenClawPackage(_0x4aa55e,_0x56db4e){const _0x278abf=_0x44ad8a,_0x3deb87=join(_0x4aa55e['runtimeR'+_0x278abf(0x1dc)],'.cache'),_0xfef83c=join(_0x4aa55e[_0x278abf(0x27a)+_0x278abf(0x1dc)],'.opencla'+'w-extrac'+'t');await mkdir(_0x3deb87,{'recursive':!![]}),await removePathWithRetries(_0xfef83c),await mkdir(_0xfef83c,{'recursive':!![]});const _0x4dccd4=await createRuntimeEnv(_0x4aa55e),_0xd6b789=_0x278abf(0x251)+'@'+_0x56db4e;console[_0x278abf(0x346)](_0x278abf(0x21d)+'hell:run'+'time]\x20in'+_0x278abf(0x211)+'\x20'+_0xd6b789);const _0x15c16c=await runProcess(_0x4aa55e[_0x278abf(0x1b3)+_0x278abf(0x36e)],[_0x4aa55e[_0x278abf(0x299)],_0x278abf(0x27e),_0xd6b789,_0x278abf(0x344)],{'cwd':_0x3deb87,'env':_0x4dccd4,'label':_0x278abf(0x206)+'\x20'+_0xd6b789}),_0x223af9=parseNpmPackJson(_0x15c16c['stdout']);if(_0x223af9[_0x278abf(0x13a)]!==_0x56db4e)throw new Error(_0x278abf(0x208)+_0x278abf(0x3ad)+'law\x20'+_0x56db4e+(_0x278abf(0x2f1)+'d\x20to\x20')+_0x223af9[_0x278abf(0x13a)]);const _0x4fcf18=resolve(_0x3deb87,_0x223af9[_0x278abf(0x1a5)]);if(!existsSync(_0x4fcf18))throw new Error('npm\x20pack'+_0x278abf(0x2a3)+'\x20create\x20'+_0x278abf(0x322)+'\x20'+_0x4fcf18);await runProcess(_0x278abf(0x13e),[_0x278abf(0x3b5),_0x4fcf18,'-C',_0xfef83c],{'label':_0x278abf(0x155)+_0x223af9['filename']}),await removePathWithRetries(_0x4aa55e[_0x278abf(0x251)+_0x278abf(0x272)+'ir']),await rename(join(_0xfef83c,_0x278abf(0x2e9)),_0x4aa55e[_0x278abf(0x251)+_0x278abf(0x272)+'ir']),await removePathWithRetries(_0xfef83c),await runProcess(_0x4aa55e[_0x278abf(0x1b3)+_0x278abf(0x36e)],[_0x4aa55e[_0x278abf(0x299)],_0x278abf(0x1b4),_0x278abf(0x2b6)+'ev',_0x278abf(0x24a)+'eer',_0x278abf(0x29f)+'it',_0x278abf(0x2d6)+'d',_0x278abf(0x33a)+_0x278abf(0x3a4)+'ps'],{'cwd':_0x4aa55e['openclaw'+_0x278abf(0x272)+'ir'],'env':_0x4dccd4,'label':_0x278abf(0x2ff)+_0x278abf(0x2a9)+_0xd6b789+('\x20runtime'+_0x278abf(0x17c)+'ncies')});if(!existsSync(_0x4aa55e[_0x278abf(0x251)+_0x278abf(0x2e0)]))throw new Error('OpenClaw'+_0x278abf(0x3a1)+_0x278abf(0x2d2)+_0x278abf(0x186)+_0x278abf(0x1bd)+':\x20'+_0x4aa55e[_0x278abf(0x251)+'Bin']);}async function ensureRuntimeBase(_0x2a80e5,_0x2358a6,_0x11d379={}){const _0x3c51b9=_0x44ad8a;await mkdir(_0x2358a6,{'recursive':!![]});let _0x2787d2=await readRuntimeManifest(_0x2358a6);const _0x54be39=_0x2a80e5[_0x3c51b9(0x251)][_0x3c51b9(0x16b)+_0x3c51b9(0x2e8)],_0x26492b=_0x2a80e5[_0x3c51b9(0x251)]['openclaw'+_0x3c51b9(0x323)],_0x29606d=existsSync(resolveManifestPath(_0x2358a6)),_0x123745=runtimeHasRequiredPaths(_0x2358a6,_0x2787d2),_0x2a61b5=_0x2787d2['nodeVers'+_0x3c51b9(0x2e8)]===_0x54be39;!_0x29606d||!_0x123745||!_0x2a61b5?(_0x11d379[_0x3c51b9(0x1c0)+'ogger']?.[_0x3c51b9(0x264)+'t']?.(_0x3c51b9(0x2ef)+_0x3c51b9(0x270)+_0x3c51b9(0x2d3)+'ed',{'runtimeRoot':_0x2358a6,'reason':!_0x29606d?_0x3c51b9(0x378)+_0x3c51b9(0x314):!_0x123745?'missing\x20'+_0x3c51b9(0x173)+'\x20runtime'+_0x3c51b9(0x325):'node\x20ver'+'sion\x20mis'+_0x3c51b9(0x154),'syncOnly':_0x11d379[_0x3c51b9(0x3c2)]}),_0x2787d2=await buildRuntimeBase(_0x2a80e5,_0x2358a6,_0x2787d2),_0x11d379[_0x3c51b9(0x1c0)+_0x3c51b9(0x30a)]?.[_0x3c51b9(0x264)+'t']?.(_0x3c51b9(0x2ef)+_0x3c51b9(0x270)+'ld\x20compl'+_0x3c51b9(0x1c8),{'manifest':summarizeRuntimeManifest(_0x2787d2)})):_0x11d379[_0x3c51b9(0x1c0)+'ogger']?.[_0x3c51b9(0x264)+'t']?.(_0x3c51b9(0x2ef)+'base\x20alr'+_0x3c51b9(0x201)+_0x3c51b9(0x2d8),{'manifest':summarizeRuntimeManifest(_0x2787d2)});if(!existsSync(resolve(_0x2358a6,_0x2787d2['openclaw'+_0x3c51b9(0x2e0)]))){const _0x10517e=createRuntimeInfoFromManifest(_0x2358a6,_0x2787d2,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x10517e,_0x26492b),_0x2787d2['openclaw'+_0x3c51b9(0x323)]=_0x26492b;}return _0x2787d2;}function runtimeHasRequiredPaths(_0x211275,_0x18fdea){const _0x2081fb=_0x44ad8a;return['nodeExec'+_0x2081fb(0x36e),'npmCli',_0x2081fb(0x251)+'WorkingD'+'ir','openclaw'+_0x2081fb(0x2e0)]['every'](_0x3c0b1e=>typeof _0x18fdea[_0x3c0b1e]===_0x2081fb(0x1d6)&&_0x18fdea[_0x3c0b1e][_0x2081fb(0x354)]())&&[_0x2081fb(0x1b3)+'utable',_0x2081fb(0x299)][_0x2081fb(0x343)](_0x49ddd7=>existsSync(resolve(_0x211275,_0x18fdea[_0x49ddd7])));}async function buildRuntimeBase(_0x5d0445,_0xe97d57,_0x9b3119={}){const _0x4c2072=_0x44ad8a,_0x1eda68=join(_0xe97d57,'node');await ensureRuntimeNode(_0x5d0445,_0x1eda68);const _0x45a4a3=process[_0x4c2072(0x2e3)]===_0x4c2072(0x20d)?_0x4c2072(0x230)+'e.exe':_0x4c2072(0x171)+'/node',_0x1b11ea=process['platform']===_0x4c2072(0x20d)?_0x4c2072(0x230)+_0x4c2072(0x359)+'s/npm/bi'+'n/npm-cl'+'i.js':_0x4c2072(0x252)+'/node_mo'+'dules/np'+'m/bin/np'+_0x4c2072(0x377),_0x18d57d={..._0x9b3119,'generatedAt':new Date()[_0x4c2072(0x350)+_0x4c2072(0x197)](),'nodeVersion':_0x5d0445['openclaw'][_0x4c2072(0x16b)+_0x4c2072(0x2e8)],'openclawVersion':_0x9b3119[_0x4c2072(0x251)+'Version']||'','platform':process[_0x4c2072(0x2e3)],'arch':process['arch'],'nodeExecutable':_0x45a4a3,'npmCli':_0x1b11ea,'openclawWorkingDir':'openclaw','openclawBin':_0x4c2072(0x251)+_0x4c2072(0x2d0)+_0x4c2072(0x3bc)};return await writeJson(resolveManifestPath(_0xe97d57),_0x18d57d),_0x18d57d;}async function removePathWithRetries(_0x358cdc){await rm(_0x358cdc,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}async function ensureRuntimeNode(_0x460efa,_0x20730a){const _0x20f729=_0x44ad8a,_0x3515ea=_0x460efa[_0x20f729(0x251)][_0x20f729(0x16b)+_0x20f729(0x2e8)],_0x5b870b=process['platform']===_0x20f729(0x20d)?join(_0x20730a,_0x20f729(0x17f)):join(_0x20730a,_0x20f729(0x287),'node'),_0x27faa7=process[_0x20f729(0x2e3)]==='win32'?join(_0x20730a,_0x20f729(0x23b)+'ules',_0x20f729(0x332),'bin',_0x20f729(0x172)+'js'):join(_0x20730a,'lib','node_mod'+_0x20f729(0x18a),_0x20f729(0x332),_0x20f729(0x287),_0x20f729(0x172)+'js');if(existsSync(_0x5b870b)&&existsSync(_0x27faa7)&&await getNodeVersion(_0x5b870b)===_0x3515ea)return;await removePathWithRetries(_0x20730a);if(process[_0x20f729(0x2f9)][_0x20f729(0x1b1)]===_0x3515ea){await linkCurrentNodeRuntime(_0x20730a);return;}await downloadNodeRuntime(_0x3515ea,_0x20730a);}async function getNodeVersion(_0x3db7c3){const _0x604093=_0x44ad8a;try{const _0x15066e=await runProcess(_0x3db7c3,['-p',_0x604093(0x31c)+_0x604093(0x2f9)+'.node'],{'label':_0x3db7c3+_0x604093(0x1ee),'timeoutMs':0x7530});return _0x15066e[_0x604093(0x150)][_0x604093(0x354)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x3e9fe3){const _0x121522=_0x44ad8a,_0x5464a7=process[_0x121522(0x3ca)],_0xc79852=resolve(dirname(_0x5464a7),'..'),_0x3d5e59=process['platform']===_0x121522(0x20d)?resolve(_0xc79852,_0x121522(0x23b)+'ules/npm'):resolve(_0xc79852,_0x121522(0x3ae)+_0x121522(0x227)+_0x121522(0x342)),_0x53ff4a=process[_0x121522(0x2e3)]===_0x121522(0x20d)?join(_0x3e9fe3,'node.exe'):join(_0x3e9fe3,_0x121522(0x287),_0x121522(0x1b1)),_0x2e6095=process['platform']===_0x121522(0x20d)?join(_0x3e9fe3,_0x121522(0x23b)+'ules',_0x121522(0x332)):join(_0x3e9fe3,_0x121522(0x17e),'node_mod'+_0x121522(0x18a),_0x121522(0x332));await mkdir(dirname(_0x53ff4a),{'recursive':!![]}),await mkdir(dirname(_0x2e6095),{'recursive':!![]}),await symlink(_0x5464a7,_0x53ff4a),existsSync(_0x3d5e59)?await symlink(_0x3d5e59,_0x2e6095):await symlink(await resolveNpmRoot(),_0x2e6095);}async function resolveNpmRoot(){const _0x5bc2b4=_0x44ad8a,_0x3856be=await runProcess(_0x5bc2b4(0x332),[_0x5bc2b4(0x1a1),'-g'],{'label':'npm\x20root'+_0x5bc2b4(0x2cb),'timeoutMs':0x7530}),_0x2a69d0=process[_0x5bc2b4(0x2e3)]===_0x5bc2b4(0x20d)?_0x3856be[_0x5bc2b4(0x150)][_0x5bc2b4(0x354)]():join(_0x3856be[_0x5bc2b4(0x150)]['trim'](),_0x5bc2b4(0x332));if(!existsSync(join(_0x2a69d0,_0x5bc2b4(0x287),_0x5bc2b4(0x172)+'js')))throw new Error(_0x5bc2b4(0x206)+_0x5bc2b4(0x2f0)+_0x5bc2b4(0x14b)+_0x5bc2b4(0x239)+'cal\x20runt'+_0x5bc2b4(0x3ac)+_0x5bc2b4(0x1a0)+_0x2a69d0);return _0x2a69d0;}async function resolveExtractedNodeRoot(_0x37ef15,_0x203796){const _0x10caa6=_0x44ad8a,_0x3d799d=join(_0x37ef15,_0x203796);if(existsSync(_0x3d799d))return _0x3d799d;const _0x1839af=await readdir(_0x37ef15,{'withFileTypes':!![]}),_0x6860d5=_0x1839af[_0x10caa6(0x1cc)](_0xde768c=>_0xde768c[_0x10caa6(0x296)+'ory']());if(_0x6860d5[_0x10caa6(0x1c5)]===0x1)return join(_0x37ef15,_0x6860d5[0x0][_0x10caa6(0x331)]);const _0x454eca=process[_0x10caa6(0x2e3)]==='win32'?join(_0x37ef15,'node.exe'):join(_0x37ef15,_0x10caa6(0x287),_0x10caa6(0x1b1));if(existsSync(_0x454eca))return _0x37ef15;const _0x44fcde=await findNodeRuntimeRoot(_0x37ef15);if(_0x44fcde)return _0x44fcde;const _0x42323a=_0x1839af['map'](_0x4243fc=>_0x4243fc['name'])[_0x10caa6(0x2d7)](',\x20');throw new Error(_0x10caa6(0x1db)+_0x10caa6(0x35d)+_0x10caa6(0x2b9)+_0x10caa6(0x256)+'not\x20foun'+_0x10caa6(0x1dd)+_0x203796+'\x20in\x20'+_0x37ef15+(_0x10caa6(0x3bb)+'vel\x20entr'+_0x10caa6(0x249))+(_0x42323a||_0x10caa6(0x34a)));}function resolveNodeExtractRoot(_0x290051,_0x76bf69,_0x1b6848){const _0x2d7749=_0x44ad8a;if(process[_0x2d7749(0x2e3)]!==_0x2d7749(0x20d))return join(_0x290051,_0x76bf69+(_0x2d7749(0x2c0)+'-')+process[_0x2d7749(0x226)]+'-'+Date['now']()+'-'+_0x1b6848);const _0x26687a=/^[A-Za-z]:[\\/]/[_0x2d7749(0x243)](_0x290051),_0x25213b=parse(_0x290051),_0x569afa=_0x26687a?_0x26687a[0x0][_0x2d7749(0x362)](0x0,0x2)+'\x5c':_0x25213b[_0x2d7749(0x1a1)]&&_0x25213b[_0x2d7749(0x1a1)]!=='/'?_0x25213b[_0x2d7749(0x1a1)]:_0x290051,_0x4eba44=_0x569afa[_0x2d7749(0x3bf)](/[\\/]+$/,'');return _0x4eba44+_0x2d7749(0x15b)+process[_0x2d7749(0x226)]+'-'+Date[_0x2d7749(0x16d)]()+'-'+_0x1b6848;}async function findNodeRuntimeRoot(_0x5d454d){const _0x4d716a=_0x44ad8a,_0x23be61=[_0x5d454d],_0x2971fe=new Set();while(_0x23be61[_0x4d716a(0x1c5)]>0x0){const _0x2e2f3c=_0x23be61[_0x4d716a(0x16f)]();if(!_0x2e2f3c||_0x2971fe[_0x4d716a(0x228)](_0x2e2f3c))continue;_0x2971fe[_0x4d716a(0x1ec)](_0x2e2f3c);const _0x455ccc=process[_0x4d716a(0x2e3)]===_0x4d716a(0x20d)?join(_0x2e2f3c,_0x4d716a(0x17f)):join(_0x2e2f3c,_0x4d716a(0x287),_0x4d716a(0x1b1)),_0x473a68=process[_0x4d716a(0x2e3)]===_0x4d716a(0x20d)?join(_0x2e2f3c,'node_mod'+_0x4d716a(0x18a),'npm',_0x4d716a(0x287),_0x4d716a(0x172)+'js'):join(_0x2e2f3c,'lib',_0x4d716a(0x23b)+_0x4d716a(0x18a),_0x4d716a(0x332),_0x4d716a(0x287),'npm-cli.'+'js');if(existsSync(_0x455ccc)&&existsSync(_0x473a68))return _0x2e2f3c;const _0x1496fa=await readdir(_0x2e2f3c,{'withFileTypes':!![]});for(const _0x65dfcd of _0x1496fa){_0x65dfcd[_0x4d716a(0x296)+_0x4d716a(0x387)]()&&_0x23be61['push'](join(_0x2e2f3c,_0x65dfcd[_0x4d716a(0x331)]));}}return'';}async function downloadNodeRuntime(_0x3be215,_0x31cc8b){const _0x196937=_0x44ad8a,_0x129438=process[_0x196937(0x2e3)]===_0x196937(0x20d)?'win':process['platform'],_0x31fa34=process[_0x196937(0x369)]==='x64'?_0x196937(0x329):process[_0x196937(0x369)]===_0x196937(0x1d5)?_0x196937(0x1d5):process[_0x196937(0x369)],_0x58061e=process['platform']==='win32'?_0x196937(0x2ce):_0x196937(0x26a),_0x3939f8=_0x196937(0x1da)+_0x3be215+'-'+_0x129438+'-'+_0x31fa34,_0x545848=_0x3939f8+'.'+_0x58061e,_0x5328f6=join(dirname(_0x31cc8b),_0x196937(0x370)),_0x3f6c48=join(_0x5328f6,_0x545848),_0x3a1895=_0x196937(0x373)+_0x196937(0x218)+'rg/dist/'+'v'+_0x3be215+'/'+_0x545848;await mkdir(_0x5328f6,{'recursive':!![]});const _0x35db21=resolveNodeExtractRoot(_0x5328f6,_0x3939f8,0x1);!existsSync(_0x3f6c48)&&(console[_0x196937(0x346)](_0x196937(0x21d)+_0x196937(0x240)+'time]\x20do'+_0x196937(0x3ab)+'g\x20'+_0x3a1895),await downloadFile(_0x3a1895,_0x3f6c48));await rm(_0x35db21,{'recursive':!![],'force':!![]}),await mkdir(_0x35db21,{'recursive':!![]});process[_0x196937(0x2e3)]===_0x196937(0x20d)?await extractZipArchive(_0x3f6c48,_0x35db21,_0x545848):await runProcess(_0x196937(0x13e),[_0x196937(0x2c5),_0x3f6c48,'-C',_0x35db21],{'label':_0x196937(0x155)+_0x545848});const _0x39dc4a=await resolveExtractedNodeRoot(_0x35db21,_0x3939f8);await mkdir(dirname(_0x31cc8b),{'recursive':!![]}),await rename(_0x39dc4a,_0x31cc8b),_0x39dc4a!==_0x35db21&&await rm(_0x35db21,{'recursive':!![],'force':!![]});}async function extractZipArchive(_0x1bb2c1,_0x2e572b,_0x3ec7b7){const _0x247f65=_0x44ad8a;await runProcess(_0x247f65(0x297)+'ll.exe',['-NoProfi'+'le',_0x247f65(0x351)+'onPolicy',_0x247f65(0x2fa),'-Command','Expand-A'+_0x247f65(0x2fe)+_0x247f65(0x1e0)+_0x247f65(0x1c2)+_0x247f65(0x2a4)+_0x247f65(0x380)+'HIVE\x20-De'+_0x247f65(0x32d)+_0x247f65(0x2a6)+_0x247f65(0x1fa)+_0x247f65(0x1f9)+'XTRACT_R'+_0x247f65(0x1f2)+'ce'],{'env':{...process.env,'WUJIE_SHELL_ARCHIVE':_0x1bb2c1,'WUJIE_SHELL_EXTRACT_ROOT':_0x2e572b},'label':_0x247f65(0x155)+_0x3ec7b7});}async function downloadFile(_0x41926a,_0x4e45d0){await mkdir(dirname(_0x4e45d0),{'recursive':!![]});const _0x3dd7e7=await new Promise((_0x25b871,_0x443afe)=>{const _0x2f22c1=_0x537f;get(_0x41926a,_0x9df35f=>{const _0x2a9baa=_0x537f;if(_0x9df35f['statusCo'+'de']>=0x12c&&_0x9df35f[_0x2a9baa(0x2b3)+'de']<0x190&&_0x9df35f[_0x2a9baa(0x34b)][_0x2a9baa(0x222)]){_0x9df35f[_0x2a9baa(0x389)](),downloadFile(new URL(_0x9df35f['headers'][_0x2a9baa(0x222)],_0x41926a)['href'],_0x4e45d0)['then'](()=>_0x25b871(null))['catch'](_0x443afe);return;}if(_0x9df35f[_0x2a9baa(0x2b3)+'de']!==0xc8){_0x9df35f[_0x2a9baa(0x389)](),_0x443afe(new Error(_0x2a9baa(0x1ca)+'\x20failed\x20'+_0x9df35f[_0x2a9baa(0x2b3)+'de']+':\x20'+_0x41926a));return;}_0x25b871(_0x9df35f);})['on'](_0x2f22c1(0x156),_0x443afe);});_0x3dd7e7&&await pipeline(_0x3dd7e7,createWriteStream(_0x4e45d0));}export async function ensureOpenClawDoctorFixed(_0x227b01,_0x97d8ca={}){const _0x2fcae0=_0x44ad8a,_0x4da38f=await loadRuntimeInfo(_0x227b01[_0x2fcae0(0x300)+_0x2fcae0(0x1dc)]),_0x1edb5e=getConfigPaths(_0x227b01),_0x123582=join(_0x1edb5e[_0x2fcae0(0x364)+_0x2fcae0(0x291)],'openclaw'+'-doctor.'+_0x2fcae0(0x22d)),_0x9300c0=await readJson(_0x123582,{});if(_0x9300c0[_0x2fcae0(0x251)+_0x2fcae0(0x323)]===_0x4da38f['openclaw'+_0x2fcae0(0x323)])return _0x97d8ca['runtimeL'+_0x2fcae0(0x30a)]?.[_0x2fcae0(0x200)](_0x2fcae0(0x251)+_0x2fcae0(0x2bb)+_0x2fcae0(0x17a)+_0x2fcae0(0x236)+_0x2fcae0(0x2f4),{'openclawVersion':_0x4da38f['openclaw'+'Version'],'markerPath':_0x123582}),{'ran':![],'openclawVersion':_0x4da38f['openclaw'+'Version'],'markerPath':_0x123582};return await runOpenClawDoctorFix(_0x227b01,_0x4da38f,{'fromVersion':_0x9300c0['openclaw'+_0x2fcae0(0x323)]||_0x2fcae0(0x241),'toVersion':_0x4da38f[_0x2fcae0(0x251)+'Version'],'markerPath':_0x123582,'runtimeLogger':_0x97d8ca['runtimeL'+_0x2fcae0(0x30a)]}),{'ran':!![],'openclawVersion':_0x4da38f[_0x2fcae0(0x251)+_0x2fcae0(0x323)],'markerPath':_0x123582};}async function runOpenClawDoctorFix(_0x165bd1,_0x593aca,{fromVersion:_0x269ad6,toVersion:_0x567136,markerPath:markerPath='',runtimeLogger:_0x3f5a33}={}){const _0xcd4ff2=_0x44ad8a;_0x3f5a33?.[_0xcd4ff2(0x264)+'t']?.('openclaw'+_0xcd4ff2(0x2bb)+_0xcd4ff2(0x3b6)+'ted',{'fromVersion':_0x269ad6,'toVersion':_0x567136});const _0x553bd0=await createRuntimeEnv(_0x593aca,{'OPENCLAW_HOME':_0x165bd1[_0xcd4ff2(0x37d)],'OPENCLAW_STATE_DIR':_0x165bd1[_0xcd4ff2(0x37d)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x165bd1)[_0xcd4ff2(0x3c1)+'th']});console[_0xcd4ff2(0x346)](_0xcd4ff2(0x21d)+_0xcd4ff2(0x240)+'time]\x20ru'+_0xcd4ff2(0x254)+_0xcd4ff2(0x188)+_0xcd4ff2(0x33f)+_0xcd4ff2(0x32a));const _0x3083ec=await runProcess(_0x593aca[_0xcd4ff2(0x1b3)+'utable'],[_0x593aca[_0xcd4ff2(0x251)+_0xcd4ff2(0x2e0)],_0xcd4ff2(0x36f),'--fix'],{'cwd':_0x593aca[_0xcd4ff2(0x251)+_0xcd4ff2(0x272)+'ir'],'env':_0x553bd0,'label':'openclaw'+'\x20doctor\x20'+_0xcd4ff2(0x244),'timeoutMs':0x1d4c0});_0x3f5a33?.[_0xcd4ff2(0x264)+'t']?.(_0xcd4ff2(0x251)+_0xcd4ff2(0x2bb)+'fix\x20comp'+_0xcd4ff2(0x1b2),{'fromVersion':_0x269ad6,'toVersion':_0x567136,'stdout':_0x3083ec[_0xcd4ff2(0x150)][_0xcd4ff2(0x354)]()[_0xcd4ff2(0x362)](-0xfa0),'stderr':_0x3083ec[_0xcd4ff2(0x212)][_0xcd4ff2(0x354)]()[_0xcd4ff2(0x362)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x593aca['openclaw'+'Version'],'fixedAt':new Date()[_0xcd4ff2(0x350)+_0xcd4ff2(0x197)]()}),_0x3f5a33?.['importan'+'t']?.(_0xcd4ff2(0x251)+_0xcd4ff2(0x2bb)+_0xcd4ff2(0x185)+'er\x20writt'+'en',{'markerPath':markerPath,'openclawVersion':_0x593aca[_0xcd4ff2(0x251)+_0xcd4ff2(0x323)]}));}export async function readRuntimeManifest(_0x5daebe){return await readJson(resolveManifestPath(_0x5daebe),{});}export async function loadRuntimeInfo(_0xfb00d5){const _0x2e04a1=resolveRuntimeRoot(_0xfb00d5),_0x165fb9=await readRuntimeManifest(_0x2e04a1);return createRuntimeInfoFromManifest(_0x2e04a1,_0x165fb9);}function createRuntimeInfoFromManifest(_0x52ffad,_0x15dbaf,_0x15d5c6={}){const _0x5b001f=_0x44ad8a;for(const _0x1acc35 of[_0x5b001f(0x1b3)+_0x5b001f(0x36e),'npmCli',_0x5b001f(0x251)+'WorkingD'+'ir',_0x5b001f(0x251)+'Bin']){if(typeof _0x15dbaf[_0x1acc35]!=='string'||!_0x15dbaf[_0x1acc35]['trim']())throw new Error(_0x5b001f(0x2ef)+'manifest'+_0x5b001f(0x295)+_0x5b001f(0x307)+_0x1acc35+'\x22\x20at\x20'+resolveManifestPath(_0x52ffad)+(_0x5b001f(0x34c)+_0x5b001f(0x327)+_0x5b001f(0x301)+'e'));}const _0x993962=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x1b3)+_0x5b001f(0x36e)]),_0x3c5bb8=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x299)]),_0x19a994=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x251)+_0x5b001f(0x272)+'ir']),_0x17912c=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x251)+_0x5b001f(0x2e0)]),_0x16b31c=Array['isArray'](_0x15dbaf[_0x5b001f(0x1e4)])?_0x15dbaf[_0x5b001f(0x1e4)]['map'](_0x37f7b9=>({..._0x37f7b9,'installPath':resolve(_0x52ffad,_0x37f7b9[_0x5b001f(0x168)+_0x5b001f(0x24e)])})):[],_0x18ea34=_0x15d5c6[_0x5b001f(0x31d)+_0x5b001f(0x3aa)+_0x5b001f(0x220)]?[_0x993962,_0x3c5bb8]:[_0x993962,_0x3c5bb8,_0x19a994,_0x17912c];for(const _0x58c0c7 of _0x18ea34){if(!existsSync(_0x58c0c7))throw new Error(_0x5b001f(0x2ef)+_0x5b001f(0x378)+_0x5b001f(0x183)+_0x58c0c7);}return{'runtimeRoot':_0x52ffad,'manifest':_0x15dbaf,'openclawVersion':_0x15dbaf[_0x5b001f(0x251)+_0x5b001f(0x323)]||_0x5b001f(0x241),'nodeExecutable':_0x993962,'npmCli':_0x3c5bb8,'openclawWorkingDir':_0x19a994,'openclawBin':_0x17912c,'plugins':_0x16b31c};}export async function spawnClaw(_0x894432,_0x179309=[],_0x31973a={}){const _0x5bb84b=_0x44ad8a,_0x7fd55b=await loadRuntimeInfo(_0x894432),_0xf35ecd=await createRuntimeEnv(_0x7fd55b,_0x31973a[_0x5bb84b(0x2f2)]??{});return spawn(_0x7fd55b[_0x5bb84b(0x1b3)+'utable'],[_0x7fd55b[_0x5bb84b(0x251)+_0x5bb84b(0x2e0)],..._0x179309],{'cwd':_0x7fd55b[_0x5bb84b(0x251)+_0x5bb84b(0x272)+'ir'],'stdio':_0x5bb84b(0x21c),..._0x31973a,'env':_0xf35ecd});}export async function runClawOnce(_0x1a35f7,_0x52322e=[],_0x920572=0x15f90){const _0x1486ea=await spawnClaw(_0x1a35f7,_0x52322e);return await new Promise((_0x3ffdc4,_0x28d519)=>{const _0x2f7e65=_0x537f;let _0x5bf63c='',_0x3d6152='',_0x3d1072=![];const _0x54e81f=setTimeout(()=>{const _0x20f6de=_0x537f;if(_0x3d1072)return;_0x3d1072=!![],_0x1486ea[_0x20f6de(0x353)]('SIGTERM'),_0x28d519(new Error(_0x20f6de(0x251)+_0x20f6de(0x399)+_0x20f6de(0x1ad)+'\x20'+_0x920572+'ms'));},_0x920572);_0x1486ea[_0x2f7e65(0x150)]['on'](_0x2f7e65(0x3c7),_0x4528aa=>{_0x5bf63c+=_0x4528aa['toString']();}),_0x1486ea[_0x2f7e65(0x212)]['on']('data',_0x2e1e4b=>{_0x3d6152+=_0x2e1e4b['toString']();}),_0x1486ea['on'](_0x2f7e65(0x156),_0xd11784=>{if(_0x3d1072)return;_0x3d1072=!![],clearTimeout(_0x54e81f),_0x28d519(_0xd11784);}),_0x1486ea['on'](_0x2f7e65(0x21b),(_0x47de40,_0x12e604)=>{if(_0x3d1072)return;_0x3d1072=!![],clearTimeout(_0x54e81f),_0x3ffdc4({'code':_0x47de40,'signal':_0x12e604,'stdout':_0x5bf63c,'stderr':_0x3d6152});});});}export{resolveRuntimeLarkCliCommand};function resolvePackageNameFromNpmSpec(_0x57e463){const _0x290d9d=_0x44ad8a,_0x454a68=_0x57e463[_0x290d9d(0x354)]()[_0x290d9d(0x3bf)](/^npm:/,'');if(!_0x454a68)throw new Error(_0x290d9d(0x15e)+_0x290d9d(0x1d2)+_0x290d9d(0x176)+'c');if(_0x454a68[_0x290d9d(0x2f3)+'th']('@')){const _0x170285=_0x454a68[_0x290d9d(0x2ca)]('/');if(_0x170285===-0x1)throw new Error(_0x290d9d(0x15e)+_0x290d9d(0x319)+'pec:\x20'+_0x57e463);const _0x52a17c=_0x454a68[_0x290d9d(0x2ca)]('@',_0x170285+0x1);return _0x52a17c===-0x1?_0x454a68:_0x454a68['slice'](0x0,_0x52a17c);}const _0x4e3577=_0x454a68[_0x290d9d(0x2ca)]('@');return _0x4e3577===-0x1?_0x454a68:_0x454a68['slice'](0x0,_0x4e3577);}async function createRuntimeEnv(_0x3ca212,_0x4bcc4b={}){const _0x5d6cca=_0x44ad8a,_0x2b59a6=process.env.OPENCLAW_STATE_DIR||'',_0x5241f8=process.env.NPM_CONFIG_REGISTRY||_0x5d6cca(0x373)+_0x5d6cca(0x2c7)+_0x5d6cca(0x28c)+_0x5d6cca(0x3be),_0x2ed5c3=_0x2b59a6?join(_0x2b59a6,_0x5d6cca(0x1a2)+'time-too'+'ls'):join(_0x3ca212[_0x5d6cca(0x27a)+'oot'],_0x5d6cca(0x32f)),_0x1728ea=join(_0x2ed5c3,_0x5d6cca(0x1e3)+'al'),_0x1b4a4f=join(_0x2ed5c3,_0x5d6cca(0x225)+'e'),_0x225622=join(_0x1728ea,_0x5d6cca(0x287));await mkdir(_0x225622,{'recursive':!![]}),await mkdir(_0x1b4a4f,{'recursive':!![]});const _0x52521a=[_0x225622,dirname(_0x3ca212['nodeExec'+'utable']),process.env.PATH||''];return{...process.env,..._0x4bcc4b,'PATH':_0x52521a['filter'](Boolean)[_0x5d6cca(0x2d7)](delimiter),'npm_config_prefix':_0x1728ea,'NPM_CONFIG_PREFIX':_0x1728ea,'npm_config_cache':_0x1b4a4f,'NPM_CONFIG_CACHE':_0x1b4a4f,'NPM_CONFIG_REGISTRY':_0x5241f8,'npm_execpath':_0x3ca212[_0x5d6cca(0x299)],'npm_node_execpath':_0x3ca212['nodeExec'+'utable'],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x1728ea,'OPENCLAW_RUNTIME_NPM_BIN':_0x225622};}export async function getRuntimeSpawnContext(_0x24c774,_0x901879={}){const _0x6abb0=_0x44ad8a,_0x13909b=await loadRuntimeInfo(_0x24c774),_0x299a72=await createRuntimeEnv(_0x13909b,_0x901879);return{'cwd':_0x13909b[_0x6abb0(0x251)+_0x6abb0(0x272)+'ir'],'env':_0x299a72,'runtime':_0x13909b};}function resolvePluginDirNameFromSpec(_0x430222){const _0x13d95f=_0x44ad8a,_0x4fa044=resolvePackageNameFromNpmSpec(_0x430222),_0x85e9bd=_0x4fa044['split']('/')[_0x13d95f(0x1cc)](Boolean),_0x231e83=_0x85e9bd['at'](-0x1)??'';if(!_0x231e83)throw new Error(_0x13d95f(0x15e)+_0x13d95f(0x213)+'pec:\x20'+_0x430222);return _0x231e83;}async function resolvePluginIdFromPackageDir(_0x31666a,_0x54016e){const _0x3add08=_0x44ad8a,_0x18839a=await readJson(join(_0x31666a,_0x3add08(0x2eb)+_0x3add08(0x22d)),{}),_0x32800b=await readPluginManifest(_0x31666a),_0x5abaaa=[_0x32800b?.['id'],_0x32800b?.[_0x3add08(0x20e)],_0x32800b?.[_0x3add08(0x331)],_0x18839a?.[_0x3add08(0x251)]?.['id'],_0x18839a?.[_0x3add08(0x251)+'Id'],_0x54016e],_0x7b472a=_0x5abaaa[_0x3add08(0x30c)](_0x5a9fde=>typeof _0x5a9fde===_0x3add08(0x1d6)&&_0x5a9fde[_0x3add08(0x354)]());if(!_0x7b472a)throw new Error(_0x3add08(0x234)+'o\x20resolv'+_0x3add08(0x2a8)+_0x3add08(0x24d)+'\x20'+_0x31666a);return _0x7b472a[_0x3add08(0x354)]();}function pluginSpecMatches(_0x4caf15,_0x3cc9b7){const _0xa78d43=_0x44ad8a,_0x3676d3=_0x3cc9b7[_0xa78d43(0x354)](),_0x5a7f08=resolvePackageNameFromNpmSpec(_0x3676d3);return[_0x4caf15['spec'],_0x4caf15[_0xa78d43(0x320)+_0xa78d43(0x3cd)],_0x4caf15[_0xa78d43(0x320)+_0xa78d43(0x1c4)]][_0xa78d43(0x194)](_0xc0abcd=>_0xc0abcd===_0x3676d3||_0xc0abcd===_0x5a7f08);}async function installPluginFromNpmSpec(_0x2de135,_0x494e02,_0x1a791f={}){const _0x426062=_0x44ad8a,_0x177d3=_0x2de135[_0x426062(0x354)]()[_0x426062(0x3bf)](/^npm:/,''),_0x41e260=resolvePluginDirNameFromSpec(_0x177d3),_0xcb238=join(_0x494e02[_0x426062(0x251)+_0x426062(0x272)+'ir'],_0x426062(0x1d4),_0x426062(0x3c5)+'ns'),_0x31ec8c=join(_0xcb238,_0x41e260),_0x2119f6=join(_0x494e02['runtimeR'+_0x426062(0x1dc)],_0x426062(0x397)+_0x426062(0x37f)+process[_0x426062(0x226)]+'-'+Date[_0x426062(0x16d)]()),_0x5b945a=await createRuntimeEnv(_0x494e02),_0x39cf9b=new Date()[_0x426062(0x350)+_0x426062(0x197)](),_0x16bd56=join(_0x494e02[_0x426062(0x27a)+'oot'],_0x426062(0x370));await mkdir(_0x16bd56,{'recursive':!![]}),await rm(_0x2119f6,{'recursive':!![],'force':!![]}),await rm(_0x31ec8c,{'recursive':!![],'force':!![]}),await mkdir(_0x2119f6,{'recursive':!![]}),await mkdir(_0xcb238,{'recursive':!![]}),console[_0x426062(0x346)](_0x426062(0x21d)+_0x426062(0x240)+_0x426062(0x237)+_0x426062(0x235)+'lugin\x20'+_0x177d3);const _0x46ff08=await runProcess(_0x494e02[_0x426062(0x1b3)+'utable'],[_0x494e02[_0x426062(0x299)],'pack',_0x177d3,_0x426062(0x344)],{'cwd':_0x16bd56,'env':_0x5b945a,'label':'npm\x20pack'+'\x20'+_0x177d3}),_0x375a0c=parseNpmPackJson(_0x46ff08['stdout']),_0x57bd56=normalizePackedTarballFilename(_0x375a0c[_0x426062(0x1a5)]),_0x2273e7=join(_0x16bd56,_0x57bd56);if(!existsSync(_0x2273e7))throw new Error(_0x426062(0x206)+_0x426062(0x2a3)+_0x426062(0x2fc)+_0x426062(0x322)+'\x20'+_0x2273e7);await runProcess('tar',[_0x426062(0x3b5),_0x2273e7,'-C',_0x2119f6],{'label':_0x426062(0x155)+_0x57bd56}),await rename(join(_0x2119f6,'package'),_0x31ec8c),await rm(_0x2119f6,{'recursive':!![],'force':!![]});const _0x1d26b8=join(_0x31ec8c,'package.'+'json'),_0x14967f=await readJson(_0x1d26b8,{});(_0x14967f[_0x426062(0x366)+_0x426062(0x38a)]||_0x14967f[_0x426062(0x2cc)])&&(delete _0x14967f['devDepen'+_0x426062(0x38a)],delete _0x14967f[_0x426062(0x2cc)],await writeJson(_0x1d26b8,_0x14967f));await runProcess(_0x494e02[_0x426062(0x1b3)+'utable'],[_0x494e02[_0x426062(0x299)],_0x426062(0x1b4),_0x426062(0x2b6)+'ev',_0x426062(0x24a)+'eer',_0x426062(0x29f)+'it','--no-fun'+'d',_0x426062(0x33a)+_0x426062(0x3a4)+'ps'],{'cwd':_0x31ec8c,'env':_0x5b945a,'label':_0x426062(0x2ff)+'all\x20plug'+_0x426062(0x204)+_0x177d3});const _0x18b5c6=new Date()[_0x426062(0x350)+_0x426062(0x197)](),_0x1ba028=await resolvePluginIdFromPackageDir(_0x31ec8c,_0x375a0c[_0x426062(0x331)]);return _0x1a791f[_0x426062(0x1c0)+_0x426062(0x30a)]?.['info'](_0x426062(0x248)+_0x426062(0x336)+'lled',{'spec':_0x177d3,'pluginId':_0x1ba028,'installPath':_0x31ec8c}),{'pluginId':_0x1ba028,'source':_0x426062(0x332),'spec':_0x177d3,'installPath':toRuntimeRelative(_0x494e02['runtimeR'+_0x426062(0x1dc)],_0x31ec8c),'version':_0x375a0c[_0x426062(0x13a)],'resolvedName':_0x375a0c[_0x426062(0x331)],'resolvedVersion':_0x375a0c[_0x426062(0x13a)],'resolvedSpec':_0x375a0c[_0x426062(0x331)]+'@'+_0x375a0c['version'],'integrity':typeof _0x375a0c['integrit'+'y']===_0x426062(0x1d6)?_0x375a0c[_0x426062(0x151)+'y']:'','shasum':typeof _0x375a0c[_0x426062(0x1fd)]===_0x426062(0x1d6)?_0x375a0c['shasum']:'','resolvedAt':_0x39cf9b,'installedAt':_0x18b5c6};}async function syncConfiguredNpmPlugins(_0x5628ac,_0x154712,_0x34bd14,_0x22e818={}){const _0x18485d=_0x44ad8a;if(_0x22e818[_0x18485d(0x3c2)])return;const _0x56832f=createRuntimeInfoFromManifest(_0x154712,_0x34bd14),_0x1b17e8=Array[_0x18485d(0x29e)](_0x34bd14[_0x18485d(0x1e4)])?_0x34bd14[_0x18485d(0x1e4)]:[],_0x383e24=[];for(const _0x6b19b8 of _0x5628ac[_0x18485d(0x251)]['pluginSp'+_0x18485d(0x39b)]){const _0x33ebcb=_0x1b17e8[_0x18485d(0x30c)](_0x91b61c=>_0x91b61c?.['source']===_0x18485d(0x332)&&pluginSpecMatches(_0x91b61c,_0x6b19b8)&&typeof _0x91b61c[_0x18485d(0x168)+_0x18485d(0x24e)]===_0x18485d(0x1d6)&&existsSync(resolve(_0x154712,_0x91b61c[_0x18485d(0x168)+_0x18485d(0x24e)])));if(_0x33ebcb){_0x383e24[_0x18485d(0x2c4)](_0x33ebcb);continue;}_0x383e24[_0x18485d(0x2c4)](await installPluginFromNpmSpec(_0x6b19b8,_0x56832f,_0x22e818));}const _0xeed7ab=new Set(_0x5628ac[_0x18485d(0x251)][_0x18485d(0x202)+'ecs'][_0x18485d(0x337)](resolvePackageNameFromNpmSpec)),_0x2e666b=_0x1b17e8[_0x18485d(0x1cc)](_0x3a2de9=>_0x3a2de9?.[_0x18485d(0x356)]!==_0x18485d(0x332)||!_0xeed7ab[_0x18485d(0x228)](resolvePackageNameFromNpmSpec(_0x3a2de9['resolved'+'Name']||_0x3a2de9[_0x18485d(0x232)]||'')));_0x34bd14[_0x18485d(0x1e4)]=[..._0x2e666b,..._0x383e24];}function hasRuntimeDependencies(_0x23f6fe){const _0x5f46d9=_0x44ad8a,_0x542cd9=_0x23f6fe?.[_0x5f46d9(0x195)+_0x5f46d9(0x1be)]&&typeof _0x23f6fe[_0x5f46d9(0x195)+_0x5f46d9(0x1be)]===_0x5f46d9(0x217)?Object['keys'](_0x23f6fe[_0x5f46d9(0x195)+_0x5f46d9(0x1be)]):[],_0x3dee92=_0x23f6fe?.[_0x5f46d9(0x159)+_0x5f46d9(0x25f)+_0x5f46d9(0x1be)]&&typeof _0x23f6fe['optional'+_0x5f46d9(0x25f)+_0x5f46d9(0x1be)]===_0x5f46d9(0x217)?Object['keys'](_0x23f6fe['optional'+_0x5f46d9(0x25f)+'cies']):[];return _0x542cd9[_0x5f46d9(0x1c5)]>0x0||_0x3dee92['length']>0x0;}async function installLocalPluginRuntimeDependencies(_0x4fe2b4,_0x132daa,_0x3ef698){const _0x2cedd5=_0x44ad8a,_0x1fcc42=join(_0x4fe2b4,_0x2cedd5(0x2eb)+_0x2cedd5(0x22d)),_0x374e0e=await readJson(_0x1fcc42,{});(_0x374e0e[_0x2cedd5(0x366)+_0x2cedd5(0x38a)]||_0x374e0e['scripts'])&&(delete _0x374e0e[_0x2cedd5(0x366)+_0x2cedd5(0x38a)],delete _0x374e0e['scripts'],await writeJson(_0x1fcc42,_0x374e0e));if(!hasRuntimeDependencies(_0x374e0e))return;const _0x554fd6=await createRuntimeEnv(_0x132daa);console['log']('[wujie-s'+'hell:run'+_0x2cedd5(0x2b1)+_0x2cedd5(0x211)+_0x2cedd5(0x35c)+_0x2cedd5(0x1ed)+_0x2cedd5(0x214)+'es\x20'+_0x4fe2b4),await runProcess(_0x132daa['nodeExec'+_0x2cedd5(0x36e)],[_0x132daa[_0x2cedd5(0x299)],_0x2cedd5(0x1b4),'--omit=d'+'ev',_0x2cedd5(0x24a)+_0x2cedd5(0x360),_0x2cedd5(0x29f)+'it',_0x2cedd5(0x2d6)+'d',_0x2cedd5(0x33a)+'-peer-de'+'ps'],{'cwd':_0x4fe2b4,'env':_0x554fd6,'label':_0x2cedd5(0x2ff)+_0x2cedd5(0x28a)+_0x2cedd5(0x2ae)+'\x20'+_0x4fe2b4}),_0x3ef698[_0x2cedd5(0x1c0)+'ogger']?.[_0x2cedd5(0x200)](_0x2cedd5(0x147)+'ugin\x20dep'+_0x2cedd5(0x18e)+'s\x20instal'+'led',{'installPath':_0x4fe2b4});}async function syncSharedPluginModules(_0x23bc9e,_0xe9f166){const _0xaa23d4=_0x44ad8a,_0x321722=new Set();for(const _0x1c0c61 of _0x23bc9e){const _0x29e89e=join(dirname(_0x1c0c61),_0xaa23d4(0x1cb));if(existsSync(_0x29e89e))_0x321722[_0xaa23d4(0x1ec)](_0x29e89e);}for(const _0x36f3cb of _0x321722){await copyDirFresh(_0x36f3cb,join(_0xe9f166,_0xaa23d4(0x1cb)));}}async function syncProductPlugins(_0x107664,_0x504f80,_0x372081,_0x452ab2={}){const _0x5e63a0=_0x44ad8a,_0x179be4=join(_0x504f80,'openclaw',_0x5e63a0(0x1d4),_0x5e63a0(0x3c5)+'ns'),_0x2a7316=createRuntimeInfoFromManifest(_0x504f80,_0x372081),_0x83122d=[];await syncSharedPluginModules(_0x107664[_0x5e63a0(0x251)]['resolved'+_0x5e63a0(0x305)+_0x5e63a0(0x1f0)],_0x179be4);for(const _0x3209ba of _0x107664[_0x5e63a0(0x251)]['resolved'+_0x5e63a0(0x305)+_0x5e63a0(0x1f0)]){const _0xfcb7cf=await getPackageMetadata(_0x3209ba),_0x30f241=await readPluginManifest(_0x3209ba),_0x511cb7=join(_0x179be4,_0xfcb7cf['pluginId']);await copyDirFresh(_0x3209ba,_0x511cb7),await installLocalPluginRuntimeDependencies(_0x511cb7,_0x2a7316,_0x452ab2),_0x83122d['push']({'pluginId':_0xfcb7cf[_0x5e63a0(0x20e)],'source':_0x5e63a0(0x184),'spec':'local:'+_0x3209ba,'installPath':toRuntimeRelative(_0x504f80,_0x511cb7),'version':_0xfcb7cf[_0x5e63a0(0x13a)],'resolvedName':_0xfcb7cf[_0x5e63a0(0x331)],'resolvedVersion':_0xfcb7cf[_0x5e63a0(0x13a)],'resolvedSpec':_0x5e63a0(0x279)+_0x3209ba,'integrity':'','shasum':'','resolvedAt':new Date()[_0x5e63a0(0x350)+_0x5e63a0(0x197)](),'installedAt':new Date()[_0x5e63a0(0x350)+_0x5e63a0(0x197)](),'agentScope':_0x30f241['agentSco'+'pe'],'skills':_0x30f241[_0x5e63a0(0x1c7)]});}const _0x4e8500=new Set(_0x83122d[_0x5e63a0(0x337)](_0x33803b=>_0x33803b[_0x5e63a0(0x20e)])),_0x2c696a=Array[_0x5e63a0(0x29e)](_0x372081[_0x5e63a0(0x1e4)])?_0x372081[_0x5e63a0(0x1e4)][_0x5e63a0(0x1cc)](_0x34be26=>!_0x4e8500[_0x5e63a0(0x228)](_0x34be26[_0x5e63a0(0x20e)])):[];_0x372081[_0x5e63a0(0x1e4)]=[..._0x2c696a,..._0x83122d];}async function syncManifestPluginScope(_0x37e61f,_0xff5f40,_0x4ab9fb){const _0x44857e=_0x44ad8a,_0x15b334=join(_0xff5f40,'openclaw',_0x44857e(0x1d4),_0x44857e(0x3c5)+'ns'),_0x55cfe1=new Set(_0x37e61f[_0x44857e(0x251)][_0x44857e(0x202)+_0x44857e(0x39b)]??[]),_0x51f401=new Set([..._0x55cfe1][_0x44857e(0x337)](_0x3ef7bb=>_0x3ef7bb['replace'](/^npm:/,''))[_0x44857e(0x337)](_0x17af94=>{const _0x21d6cf=_0x44857e;if(_0x17af94[_0x21d6cf(0x2f3)+'th']('@')){const _0x10becb=_0x17af94[_0x21d6cf(0x390)]('@');return _0x10becb['length']>=0x3?'@'+_0x10becb[0x1]:_0x17af94;}return _0x17af94[_0x21d6cf(0x390)]('@')[0x0];})['filter'](Boolean)),_0x4346e4=new Set();for(const _0x253d85 of _0x37e61f[_0x44857e(0x251)]['resolved'+_0x44857e(0x305)+'ginPaths']){const _0x91ba9e=await getPackageMetadata(_0x253d85);if(_0x91ba9e['pluginId'])_0x4346e4['add'](_0x91ba9e[_0x44857e(0x20e)]);}const _0x452b1d=Array[_0x44857e(0x29e)](_0x4ab9fb['plugins'])?_0x4ab9fb[_0x44857e(0x1e4)]:[];_0x4ab9fb[_0x44857e(0x202)+_0x44857e(0x39b)]=[..._0x37e61f[_0x44857e(0x251)][_0x44857e(0x202)+_0x44857e(0x39b)],..._0x37e61f[_0x44857e(0x251)][_0x44857e(0x320)+'LocalPlu'+_0x44857e(0x1f0)][_0x44857e(0x337)](_0x4ec43c=>_0x44857e(0x279)+_0x4ec43c)],_0x4ab9fb[_0x44857e(0x1e4)]=_0x452b1d[_0x44857e(0x1cc)](_0xf3b19d=>{const _0x3f02b2=_0x44857e;if(!_0xf3b19d||typeof _0xf3b19d!==_0x3f02b2(0x217))return![];if(_0xf3b19d[_0x3f02b2(0x356)]===_0x3f02b2(0x184))return _0x4346e4[_0x3f02b2(0x228)](_0xf3b19d[_0x3f02b2(0x20e)]);if(_0xf3b19d[_0x3f02b2(0x356)]===_0x3f02b2(0x332))return _0x55cfe1[_0x3f02b2(0x228)](_0xf3b19d[_0x3f02b2(0x232)])||_0x55cfe1[_0x3f02b2(0x228)](_0xf3b19d[_0x3f02b2(0x320)+_0x3f02b2(0x3cd)])||_0x51f401[_0x3f02b2(0x228)](_0xf3b19d['resolved'+_0x3f02b2(0x1c4)]);return![];});const _0x1469af=new Set(_0x4ab9fb[_0x44857e(0x1e4)][_0x44857e(0x337)](_0x2907f3=>_0x2907f3[_0x44857e(0x20e)]));for(const _0x4f1d58 of _0x452b1d){if(!_0x4f1d58[_0x44857e(0x20e)]||_0x1469af[_0x44857e(0x228)](_0x4f1d58[_0x44857e(0x20e)]))continue;const _0x7670b2=typeof _0x4f1d58[_0x44857e(0x168)+_0x44857e(0x24e)]==='string'&&_0x4f1d58[_0x44857e(0x168)+_0x44857e(0x24e)][_0x44857e(0x354)]()?resolve(_0xff5f40,_0x4f1d58['installP'+_0x44857e(0x24e)]):join(_0x15b334,_0x4f1d58[_0x44857e(0x20e)]),_0x486e5b=relative(_0x15b334,_0x7670b2);if(_0x486e5b['startsWi'+'th']('..')||_0x486e5b==='')continue;await rm(_0x7670b2,{'recursive':!![],'force':!![]});}}async function collectCapabilityEntries(_0x4e7148,_0x353f8a){const _0x46a6d8=_0x44ad8a,_0x5af8cd=new Map();for(const _0x4c0493 of _0x4e7148){let _0xa93cdc;try{_0xa93cdc=await stat(_0x4c0493);}catch{throw new Error(_0x353f8a+(_0x46a6d8(0x2d4)+'s\x20not\x20fo'+_0x46a6d8(0x294))+_0x4c0493);}if(!_0xa93cdc[_0x46a6d8(0x296)+'ory']())throw new Error(_0x353f8a+('\x20path\x20mu'+_0x46a6d8(0x259)+_0x46a6d8(0x250)+_0x46a6d8(0x14a))+_0x4c0493);const _0x59a013={'name':basename(_0x4c0493),'path':_0x4c0493},_0x1564e0=_0x5af8cd[_0x46a6d8(0x1c6)](_0x59a013[_0x46a6d8(0x331)]);if(_0x1564e0)throw new Error('Duplicat'+'e\x20'+_0x353f8a+'\x20entry\x20\x22'+_0x59a013[_0x46a6d8(0x331)]+_0x46a6d8(0x282)+_0x1564e0[_0x46a6d8(0x274)]+_0x46a6d8(0x25a)+_0x59a013[_0x46a6d8(0x274)]);_0x5af8cd[_0x46a6d8(0x27f)](_0x59a013['name'],_0x59a013);}return[..._0x5af8cd['values']()];}async function syncProductCapabilityDirs(_0x1224e5,_0xc0ed2e,_0xa00791){const _0x46cc61=_0x44ad8a,_0x43bef8=await collectCapabilityEntries(_0x1224e5,_0xa00791);await rm(_0xc0ed2e,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(_0xc0ed2e,{'recursive':!![]});for(const _0x2d7b78 of _0x43bef8){await cp(_0x2d7b78[_0x46cc61(0x274)],join(_0xc0ed2e,_0x2d7b78[_0x46cc61(0x331)]),{'recursive':!![]});}return _0x43bef8['length'];}export const __test__={'collectCapabilityEntries':collectCapabilityEntries,'prunePackagedRuntimePayload':prunePackagedRuntimePayload,'syncProductCapabilityDirs':syncProductCapabilityDirs,'resolveNodeExtractRoot':resolveNodeExtractRoot};async function syncProductAgents(_0x4d0ae2,_0x3a6c51,_0x1db71d){const _0x30db9a=_0x44ad8a,_0x181f98=join(_0x3a6c51,_0x30db9a(0x251),_0x30db9a(0x374)),_0x5ceeae=await syncProductCapabilityDirs(_0x4d0ae2[_0x30db9a(0x251)][_0x30db9a(0x320)+'LocalAge'+'ntPaths'],_0x181f98,'agent');_0x1db71d[_0x30db9a(0x374)]={'source':_0x30db9a(0x376),'installPath':toRuntimeRelative(_0x3a6c51,_0x181f98),'localPaths':_0x4d0ae2[_0x30db9a(0x251)][_0x30db9a(0x320)+'LocalAge'+'ntPaths'],'entryCount':_0x5ceeae};}async function syncProductSkills(_0x41690c,_0x5a53f4,_0x39d8b2){const _0x162692=_0x44ad8a,_0x5e4e64=join(_0x5a53f4,'openclaw',_0x162692(0x1c7)),_0x47336b=await syncProductCapabilityDirs(_0x41690c[_0x162692(0x251)][_0x162692(0x320)+_0x162692(0x22f)+_0x162692(0x34e)],_0x5e4e64,'skill');_0x39d8b2['skills']={'source':_0x162692(0x376),'installPath':toRuntimeRelative(_0x5a53f4,_0x5e4e64),'localPaths':_0x41690c[_0x162692(0x251)][_0x162692(0x320)+_0x162692(0x22f)+_0x162692(0x34e)],'entryCount':_0x47336b};}