@wujie-shell/core 1.0.3 → 1.0.5

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 (61) 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-attachment-base64.mjs +1 -0
  43. package/dist/src/runtime/patch-chat-history-mixed-tool-content.mjs +1 -1
  44. package/dist/src/runtime/patch-provider-request-id-header.mjs +1 -1
  45. package/dist/src/runtime/patch-qqbot-outbound-session-route.mjs +1 -1
  46. package/dist/src/runtime/patch-request-id-title-runtime.mjs +1 -1
  47. package/dist/src/runtime/patch-session-store-sqlite.mjs +1 -1
  48. package/dist/src/runtime/patch-weixin-outbound-session-route.mjs +1 -1
  49. package/dist/src/runtime/plugin-sync.mjs +1 -1
  50. package/dist/src/sessions/agent-sessions-map-store.mjs +1 -1
  51. package/dist/src/sessions/runtime-bridge.mjs +1 -1
  52. package/dist/src/sessions/session-data-service.mjs +1 -1
  53. package/dist/src/sessions/session-runtime-state-service.mjs +1 -1
  54. package/dist/src/sessions/session-runtime-state.mjs +1 -1
  55. package/dist/src/sessions/session-sqlite-store.mjs +1 -1
  56. package/dist/src/skills/import.mjs +1 -1
  57. package/dist/src/skills/market.mjs +1 -1
  58. package/dist/src/terminal/manager.mjs +1 -1
  59. package/dist/src/updates/controller.mjs +1 -1
  60. package/dist/src/updates/loader.mjs +1 -1
  61. 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
+ const _0x4a3b27=_0x3caa;(function(_0x4d830e,_0x53019f){const _0xc8bd29=_0x3caa,_0x4ffec0=_0x4d830e();while(!![]){try{const _0x46f541=parseInt(_0xc8bd29(0x23b))/0x1*(parseInt(_0xc8bd29(0x253))/0x2)+parseInt(_0xc8bd29(0x256))/0x3+-parseInt(_0xc8bd29(0x245))/0x4+-parseInt(_0xc8bd29(0x20e))/0x5*(parseInt(_0xc8bd29(0x1f2))/0x6)+parseInt(_0xc8bd29(0x240))/0x7+-parseInt(_0xc8bd29(0x252))/0x8*(-parseInt(_0xc8bd29(0x222))/0x9)+-parseInt(_0xc8bd29(0x1f9))/0xa;if(_0x46f541===_0x53019f)break;else _0x4ffec0['push'](_0x4ffec0['shift']());}catch(_0x3740ca){_0x4ffec0['push'](_0x4ffec0['shift']());}}}(_0x4235,0x67690));function _0x4235(){const _0x572613=['state_js','on\x20=\x20?,\x0a','tore_key','\x0a\x20\x20\x20\x20\x20\x20S','ore_key\x20','t_run_at','chor_ms,','at_ms\x20IS','\x20\x20\x20\x20cons','nd\x20in\x20','\x20\x20\x20\x20\x20\x20\x20r','anchor_m',',\x200)\x20+\x201','store_ke','t_ms\x20=\x20N','cron_job','n,\x0a\x20\x20\x20\x20\x20','led','ssed\x20run','.js','\x20\x20\x20\x20\x20nex','21498bhgDVu','e\x20module','SELECT\x20n','skipped','MEDIATE','isFile','runtime_','7006880ONwVpZ','\x20\x20AND\x20ne','isFinite','\x20\x20\x20\x20\x20\x20\x20s','name\x20=\x20?','\x20\x20name,\x0a','_json\x0a\x20\x20','master\x20W','ning_at_','href','\x20WHERE\x20e','skipped,','_ms,\x0a\x20\x20\x20','t_ms\x20<=\x20','chedule_','importan','d\x20=\x20COAL','cron','ron_jobs','_ms\x20=\x20?,','dataDir','295cElaoY','_tz','ecutive_','info','length','name','job_id\x20=','UPDATE\x20c','ET\x20enabl','unning_a','ext_run_','enabled,','secutive','prepare','\x20\x20\x20state','ULL','max','\x20gateway','COMMIT','\x0a\x20\x20\x20\x20\x20\x20\x20','1503EcNpFm','\x20at,\x0a\x20\x20\x20','le\x27\x20AND\x20','consecut','abled\x20by','nabled\x20=','xt_run_a','schedule',',\x0a\x20\x20\x20\x20\x20\x20','cron:\x20sk','ipped\x20mi','\x20not\x20fou','\x20before\x20','e_skippe','\x20\x20\x20\x20\x20las','_kind','ET\x20next_','skip\x20fai','cron\x20mis','startsWi','\x20\x20\x20\x20\x20\x20co','openclaw','\x20cron_jo','.sqlite','run','225349IkrsoW','floor','\x20\x20\x20\x20\x20\x20\x20\x20','push','?\x0a\x20\x20\x20\x20\x20\x20','2644614mkcREj','next_run','filter','\x201\x0a\x20\x20\x20\x20\x20','job_json','2904740peXBnw','\x20NOT\x20NUL','\x20NULL,\x0a\x20','now','nowMs','s\x20before','gateway\x20','ame\x20FROM','ESCE(con','\x20last_ru','_at_ms\x20=','at_ms\x20=\x20','L\x0a\x20\x20\x20\x20\x20\x20','27624OKkCcY','6rnteYY','map','every_ms','1294014vGqwKo','BEGIN\x20IM','updated_','OpenClaw','logger','ULL,\x0a\x20\x20\x20','\x20\x20AND\x20ru','trim','\x20\x20job_js','\x20=\x20?,\x0a\x20\x20','y_ms,\x0a\x20\x20','_ms\x20IS\x20N','every','job_id','\x20\x20\x20\x20ever','sed-run\x20','\x20LIMIT\x201','dist','_skipped','bs\x0a\x20\x20\x20\x20\x20','ROLLBACK','\x20env','stateDir','warn','ms,\x0a\x20\x20\x20\x20','function','SELECT\x0a\x20','state','iveSkipp','e\x20=\x20\x27tab','message','stringif','n_status','nsecutiv'];_0x4235=function(){return _0x572613;};return _0x4235();}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=_0x4a3b27(0x237)+_0x4a3b27(0x239),CRON_TABLE_NAME=_0x4a3b27(0x1ec)+'s',SCHEDULE_MODULE_PREFIX=_0x4a3b27(0x229)+'-',SCHEDULE_MODULE_SUFFIX=_0x4a3b27(0x1f0);function toFiniteMs(_0x132b0b){const _0x5cf3bb=Number(_0x132b0b);return Number['isFinite'](_0x5cf3bb)?_0x5cf3bb:undefined;}function safeJsonParse(_0x8386c,_0x1273ac={}){const _0x3c8707=_0x4a3b27;if(typeof _0x8386c!=='string'||!_0x8386c[_0x3c8707(0x25d)]())return _0x1273ac;try{return JSON['parse'](_0x8386c);}catch{return _0x1273ac;}}function createScheduleFromRow(_0x507734){const _0x532da1=_0x4a3b27,_0x32cfc=getTrimmedString(_0x507734['schedule'+_0x532da1(0x231)]);if(_0x32cfc===_0x532da1(0x20a)){const _0x58b6a2=getTrimmedString(_0x507734['schedule'+'_expr']);if(!_0x58b6a2)return null;const _0x25d539=getTrimmedString(_0x507734['schedule'+_0x532da1(0x20f)]);return{'kind':_0x32cfc,'expr':_0x58b6a2,..._0x25d539?{'tz':_0x25d539}:{}};}if(_0x32cfc===_0x532da1(0x262)){const _0x505412=toFiniteMs(_0x507734[_0x532da1(0x255)]);if(_0x505412===undefined)return null;const _0x46c5fa=toFiniteMs(_0x507734[_0x532da1(0x283)+'s']);return{'kind':_0x32cfc,'everyMs':_0x505412,..._0x46c5fa===undefined?{}:{'anchorMs':_0x46c5fa}};}if(_0x32cfc==='at'){const _0x407f30=getTrimmedString(_0x507734['at']);return _0x407f30?{'kind':_0x32cfc,'at':_0x407f30}:null;}return null;}const MISSED_RUN_SKIPPED_STATUS=_0x4a3b27(0x1f5),MISSED_RUN_SKIPPED_ERROR=_0x4a3b27(0x22b)+_0x4a3b27(0x22c)+_0x4a3b27(0x1ef)+_0x4a3b27(0x22e)+_0x4a3b27(0x24b)+'start';function nextConsecutiveSkipped(_0x3da6a7,_0x31dad4){const _0x5d289e=_0x4a3b27,_0x392b62=Number(_0x3da6a7[_0x5d289e(0x225)+'ive_skip'+'ped']);if(Number['isFinite'](_0x392b62))return Math[_0x5d289e(0x21e)](0x0,Math[_0x5d289e(0x23c)](_0x392b62))+0x1;const _0x3201d0=Number(_0x31dad4['consecut'+_0x5d289e(0x272)+'ed']);return Number['isFinite'](_0x3201d0)?Math['max'](0x0,Math[_0x5d289e(0x23c)](_0x3201d0))+0x1:0x1;}function patchStateJson(_0x4610c5,_0x414bed,_0x5dae06){const _0x30acfd=_0x4a3b27,_0x218273=asRecord(safeJsonParse(_0x4610c5[_0x30acfd(0x278)+'on'],{})),_0x353def=nextConsecutiveSkipped(_0x4610c5,_0x218273);return JSON[_0x30acfd(0x275)+'y']({..._0x218273,'nextRunAtMs':_0x414bed,'runningAtMs':undefined,'lastRunAtMs':_0x5dae06,'lastRunStatus':MISSED_RUN_SKIPPED_STATUS,'lastStatus':MISSED_RUN_SKIPPED_STATUS,'lastError':MISSED_RUN_SKIPPED_ERROR,'consecutiveSkipped':_0x353def});}function patchJobJson(_0x5be5f8,{enabled:_0x3fb699,nextRunAtMs:_0x1a0be8,skippedAtMs:_0x336fde}){const _0x1a85dd=_0x4a3b27,_0x32a808=asRecord(safeJsonParse(_0x5be5f8[_0x1a85dd(0x244)],{})),_0x1d9a5b=asRecord(_0x32a808[_0x1a85dd(0x271)]),_0x11b58b=nextConsecutiveSkipped(_0x5be5f8,_0x1d9a5b);return JSON[_0x1a85dd(0x275)+'y']({..._0x32a808,'enabled':_0x3fb699,'state':{..._0x1d9a5b,'nextRunAtMs':_0x1a0be8,'runningAtMs':undefined,'lastRunAtMs':_0x336fde,'lastRunStatus':MISSED_RUN_SKIPPED_STATUS,'lastStatus':MISSED_RUN_SKIPPED_STATUS,'lastError':MISSED_RUN_SKIPPED_ERROR,'consecutiveSkipped':_0x11b58b}});}async function loadOpenClawScheduleComputer(_0x57943b){const _0x185002=_0x4a3b27,_0x107f76=resolve(_0x57943b[_0x185002(0x237)+'WorkingD'+'ir'],_0x185002(0x267)),_0x945c7d=await readdir(_0x107f76,{'withFileTypes':!![]}),_0x65d503=_0x945c7d[_0x185002(0x242)](_0x33f3e9=>_0x33f3e9[_0x185002(0x1f7)]())[_0x185002(0x254)](_0x586e61=>_0x586e61[_0x185002(0x213)])[_0x185002(0x242)](_0x35203e=>_0x35203e[_0x185002(0x235)+'th'](SCHEDULE_MODULE_PREFIX)&&_0x35203e['endsWith'](SCHEDULE_MODULE_SUFFIX));for(const _0x1e4b42 of _0x65d503){const _0x392643=pathToFileURL(join(_0x107f76,_0x1e4b42))[_0x185002(0x202)],_0x5dd51c=await import(_0x392643);if(typeof _0x5dd51c['t']===_0x185002(0x26f))return _0x5dd51c['t'];}throw new Error(_0x185002(0x259)+'\x20schedul'+_0x185002(0x1f3)+_0x185002(0x22d)+_0x185002(0x281)+_0x107f76);}function _0x3caa(_0x58b9cc,_0x4f1185){_0x58b9cc=_0x58b9cc-0x1ea;const _0x423565=_0x4235();let _0x3caafb=_0x423565[_0x58b9cc];return _0x3caafb;}function tableExists(_0x26baee){const _0x41cdef=_0x4a3b27,_0x200599=_0x26baee[_0x41cdef(0x21b)](_0x41cdef(0x1f4)+_0x41cdef(0x24c)+'\x20sqlite_'+_0x41cdef(0x200)+'HERE\x20typ'+_0x41cdef(0x273)+_0x41cdef(0x224)+_0x41cdef(0x1fd)+_0x41cdef(0x266))['get'](CRON_TABLE_NAME);return Boolean(_0x200599);}function readExpiredRows(_0xa3f18e,_0x50fa1f){const _0xc5604f=_0x4a3b27;return _0xa3f18e[_0xc5604f(0x21b)](_0xc5604f(0x270)+_0xc5604f(0x1fc)+_0xc5604f(0x27a)+_0xc5604f(0x22a)+'\x20\x20job_id'+_0xc5604f(0x22a)+_0xc5604f(0x1fe)+_0xc5604f(0x23d)+_0xc5604f(0x219)+_0xc5604f(0x221)+'\x20schedul'+'e_kind,\x0a'+_0xc5604f(0x23d)+'schedule'+'_expr,\x0a\x20'+'\x20\x20\x20\x20\x20\x20\x20s'+_0xc5604f(0x207)+'tz,\x0a\x20\x20\x20\x20'+_0xc5604f(0x264)+_0xc5604f(0x260)+'\x20\x20\x20\x20\x20\x20an'+_0xc5604f(0x27e)+_0xc5604f(0x221)+_0xc5604f(0x223)+_0xc5604f(0x1f1)+_0xc5604f(0x27d)+_0xc5604f(0x205)+'\x20\x20\x20\x20\x20run'+_0xc5604f(0x201)+_0xc5604f(0x26e)+_0xc5604f(0x280)+_0xc5604f(0x210)+_0xc5604f(0x204)+'\x0a\x20\x20\x20\x20\x20\x20\x20'+'\x20job_jso'+_0xc5604f(0x1ed)+_0xc5604f(0x21c)+_0xc5604f(0x1ff)+'\x20\x20\x20\x20FROM'+_0xc5604f(0x238)+_0xc5604f(0x269)+_0xc5604f(0x203)+_0xc5604f(0x227)+_0xc5604f(0x243)+'\x20\x20\x20AND\x20n'+_0xc5604f(0x218)+_0xc5604f(0x27f)+_0xc5604f(0x246)+_0xc5604f(0x251)+_0xc5604f(0x1fa)+_0xc5604f(0x228)+_0xc5604f(0x206)+_0xc5604f(0x23f)+_0xc5604f(0x25c)+'nning_at'+_0xc5604f(0x261)+_0xc5604f(0x21d))['all'](_0x50fa1f);}function updateNextRun(_0xb0618e,_0xd65011,_0x55845b,_0x44ac0d,_0x26ce89){const _0x384490=_0x4a3b27;_0xb0618e['prepare'](_0x384490(0x215)+_0x384490(0x20b)+'\x0a\x20\x20\x20\x20\x20\x20S'+_0x384490(0x232)+'run_at_m'+'s\x20=\x20?,\x0a\x20'+_0x384490(0x282)+'unning_a'+'t_ms\x20=\x20N'+'ULL,\x0a\x20\x20\x20'+_0x384490(0x230)+_0x384490(0x27d)+_0x384490(0x20c)+'\x0a\x20\x20\x20\x20\x20\x20\x20'+_0x384490(0x24e)+_0x384490(0x276)+_0x384490(0x25f)+'\x20\x20\x20\x20\x20\x20la'+'st_error'+_0x384490(0x25f)+_0x384490(0x236)+_0x384490(0x277)+_0x384490(0x22f)+'d\x20=\x20COAL'+'ESCE(con'+_0x384490(0x21a)+_0x384490(0x268)+_0x384490(0x284)+_0x384490(0x22a)+_0x384490(0x25e)+_0x384490(0x279)+_0x384490(0x23d)+_0x384490(0x278)+_0x384490(0x279)+_0x384490(0x23d)+_0x384490(0x1f8)+_0x384490(0x258)+_0x384490(0x250)+_0x384490(0x23f)+'WHERE\x20st'+'ore_key\x20'+'=\x20?\x20AND\x20'+_0x384490(0x214)+'\x20?')[_0x384490(0x23a)](_0x55845b,_0x26ce89,MISSED_RUN_SKIPPED_STATUS,MISSED_RUN_SKIPPED_ERROR,patchJobJson(_0xd65011,{'enabled':!![],'nextRunAtMs':_0x55845b,'skippedAtMs':_0x26ce89}),patchStateJson(_0xd65011,_0x55845b,_0x26ce89),_0x44ac0d,_0xd65011[_0x384490(0x1ea)+'y'],_0xd65011[_0x384490(0x263)]);}function disableExpiredAtRun(_0x3b3590,_0x50bc4b,_0x453e1a,_0x3b2abd){const _0xd775b5=_0x4a3b27;_0x3b3590[_0xd775b5(0x21b)]('UPDATE\x20c'+'ron_jobs'+_0xd775b5(0x27b)+_0xd775b5(0x216)+'ed\x20=\x200,\x0a'+_0xd775b5(0x23d)+_0xd775b5(0x241)+_0xd775b5(0x24f)+_0xd775b5(0x247)+_0xd775b5(0x282)+_0xd775b5(0x217)+_0xd775b5(0x1eb)+_0xd775b5(0x25b)+_0xd775b5(0x230)+_0xd775b5(0x27d)+_0xd775b5(0x20c)+'\x0a\x20\x20\x20\x20\x20\x20\x20'+_0xd775b5(0x24e)+_0xd775b5(0x276)+_0xd775b5(0x25f)+'\x20\x20\x20\x20\x20\x20la'+'st_error'+_0xd775b5(0x25f)+'\x20\x20\x20\x20\x20\x20co'+_0xd775b5(0x277)+_0xd775b5(0x22f)+_0xd775b5(0x209)+_0xd775b5(0x24d)+_0xd775b5(0x21a)+_0xd775b5(0x268)+_0xd775b5(0x284)+',\x0a\x20\x20\x20\x20\x20\x20'+_0xd775b5(0x25e)+'on\x20=\x20?,\x0a'+_0xd775b5(0x23d)+_0xd775b5(0x278)+'on\x20=\x20?,\x0a'+_0xd775b5(0x23d)+_0xd775b5(0x1f8)+'updated_'+_0xd775b5(0x250)+'?\x0a\x20\x20\x20\x20\x20\x20'+'WHERE\x20st'+_0xd775b5(0x27c)+'=\x20?\x20AND\x20'+_0xd775b5(0x214)+'\x20?')[_0xd775b5(0x23a)](_0x3b2abd,MISSED_RUN_SKIPPED_STATUS,MISSED_RUN_SKIPPED_ERROR,patchJobJson(_0x50bc4b,{'enabled':![],'nextRunAtMs':undefined,'skippedAtMs':_0x3b2abd}),patchStateJson(_0x50bc4b,undefined,_0x3b2abd),_0x453e1a,_0x50bc4b[_0xd775b5(0x1ea)+'y'],_0x50bc4b[_0xd775b5(0x263)]);}export async function skipMissedCronRunsBeforeGatewayStart(_0x3bb4fc,_0x9fe6ac={}){const _0x50e637=_0x4a3b27;if(process.env.WUJIE_SHELL_SKIP_MISSED_CRON_RUNS==='0')return _0x9fe6ac[_0x50e637(0x25a)]?.[_0x50e637(0x211)]?.({'enabled':![]},_0x50e637(0x234)+_0x50e637(0x265)+'skip\x20dis'+_0x50e637(0x226)+_0x50e637(0x26b)),{'skipped':0x0,'inspected':0x0,'disabled':!![]};const _0x502e3a=getTrimmedString(_0x9fe6ac[_0x50e637(0x26c)])||_0x3bb4fc[_0x50e637(0x20d)],_0x5207b5=join(_0x502e3a,_0x50e637(0x271),CRON_DB_FILE);if(!existsSync(_0x5207b5))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0xecfb5b=toFiniteMs(_0x9fe6ac[_0x50e637(0x249)])??Date[_0x50e637(0x248)](),_0x354c8f=Date[_0x50e637(0x248)]();let _0x39e07f;try{_0x39e07f=new DatabaseSync(_0x5207b5);if(!tableExists(_0x39e07f))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x1432a2=readExpiredRows(_0x39e07f,_0xecfb5b);if(_0x1432a2[_0x50e637(0x212)]===0x0)return{'skipped':0x0,'inspected':0x0};const _0x3ba758=await loadRuntimeInfo(_0x3bb4fc['projectR'+'oot']),_0x4415b4=await loadOpenClawScheduleComputer(_0x3ba758);let _0x2ed5cd=0x0;const _0x592181=[];_0x39e07f['exec'](_0x50e637(0x257)+_0x50e637(0x1f6));try{for(const _0x3a13de of _0x1432a2){const _0xa91e6a=createScheduleFromRow(_0x3a13de);if(!_0xa91e6a)continue;if(_0xa91e6a['kind']==='at'){disableExpiredAtRun(_0x39e07f,_0x3a13de,_0x354c8f,_0xecfb5b),_0x2ed5cd+=0x1;continue;}let _0x182474;try{_0x182474=_0x4415b4(_0xa91e6a,_0xecfb5b);}catch(_0x36e92c){_0x592181[_0x50e637(0x23e)]({'jobId':_0x3a13de[_0x50e637(0x263)],'message':_0x36e92c instanceof Error?_0x36e92c[_0x50e637(0x274)]:String(_0x36e92c)});continue;}if(!Number[_0x50e637(0x1fb)](_0x182474)||_0x182474<=_0xecfb5b)continue;updateNextRun(_0x39e07f,_0x3a13de,Math[_0x50e637(0x23c)](_0x182474),_0x354c8f,_0xecfb5b),_0x2ed5cd+=0x1;}_0x39e07f['exec'](_0x50e637(0x220));}catch(_0x589254){_0x39e07f['exec'](_0x50e637(0x26a));throw _0x589254;}return(_0x2ed5cd>0x0||_0x592181[_0x50e637(0x212)]>0x0)&&_0x9fe6ac[_0x50e637(0x25a)]?.[_0x50e637(0x208)+'t']?.({'dbPath':_0x5207b5,'inspected':_0x1432a2[_0x50e637(0x212)],'skipped':_0x2ed5cd,'failures':_0x592181},_0x50e637(0x22b)+_0x50e637(0x22c)+_0x50e637(0x1ef)+_0x50e637(0x24a)+_0x50e637(0x21f)+'\x20start'),{'skipped':_0x2ed5cd,'inspected':_0x1432a2[_0x50e637(0x212)],'failures':_0x592181};}catch(_0x3ff5a6){return _0x9fe6ac[_0x50e637(0x25a)]?.[_0x50e637(0x26d)]?.(_0x50e637(0x234)+_0x50e637(0x265)+_0x50e637(0x233)+_0x50e637(0x1ee),{'dbPath':_0x5207b5,'error':_0x3ff5a6 instanceof Error?_0x3ff5a6['message']:String(_0x3ff5a6)}),{'skipped':0x0,'inspected':0x0,'error':_0x3ff5a6};}finally{_0x39e07f?.['close']();}}
@@ -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 _0x4cb8b3=_0x5af4;(function(_0x2bfd7c,_0x12c27b){const _0x488749=_0x5af4,_0x3ee2e7=_0x2bfd7c();while(!![]){try{const _0x4fb003=-parseInt(_0x488749(0x17d))/0x1*(parseInt(_0x488749(0x3df))/0x2)+parseInt(_0x488749(0x176))/0x3*(-parseInt(_0x488749(0x162))/0x4)+parseInt(_0x488749(0x2b2))/0x5+-parseInt(_0x488749(0x1c6))/0x6*(-parseInt(_0x488749(0x387))/0x7)+parseInt(_0x488749(0x1f3))/0x8+-parseInt(_0x488749(0x1f7))/0x9*(parseInt(_0x488749(0x178))/0xa)+parseInt(_0x488749(0x3f6))/0xb;if(_0x4fb003===_0x12c27b)break;else _0x3ee2e7['push'](_0x3ee2e7['shift']());}catch(_0x100270){_0x3ee2e7['push'](_0x3ee2e7['shift']());}}}(_0x8027,0x8c265));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';function _0x5af4(_0x2fa1aa,_0x56bb24){_0x2fa1aa=_0x2fa1aa-0x15a;const _0x8027f1=_0x8027();let _0x5af406=_0x8027f1[_0x2fa1aa];return _0x5af406;}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{patchChatAttachmentBase64FromSource}from'./patch-chat-attachment-base64.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=_0x4cb8b3(0x3b0)+'time',MANIFEST_NAME=_0x4cb8b3(0x3ee)+_0x4cb8b3(0x28d)+_0x4cb8b3(0x3a8),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x2403ce){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x2403ce,RUNTIME_DIR);}export function resolveManifestPath(_0x9fac78){return join(_0x9fac78,MANIFEST_NAME);}async function loadProductRuntime(_0x28ee56,_0x43e21a){const _0x21b08e=_0x4cb8b3,_0x2d8f37=[join(_0x28ee56,'shell-ru'+_0x21b08e(0x1dc),_0x21b08e(0x261)+'s'),join(_0x43e21a,'shell-ru'+_0x21b08e(0x1dc),_0x21b08e(0x261)+'s')];for(const _0x213a80 of _0x2d8f37){if(!existsSync(_0x213a80))continue;return await import(pathToFileURL(_0x213a80)[_0x21b08e(0x32b)]+_0x21b08e(0x298)+Date[_0x21b08e(0x366)]());}return{};}export async function prepareRuntime(_0x14639c,{syncOnly:syncOnly=![],pruneForPackaging:pruneForPackaging=![]}={}){const _0x11afd5=_0x4cb8b3,_0x1331bc=resolveRuntimeRoot(_0x14639c[_0x11afd5(0x25e)+_0x11afd5(0x32a)]),_0x5e987b=createRuntimeLogger(getConfigPaths(_0x14639c),_0x11afd5(0x36f)),_0x2cf544=Date[_0x11afd5(0x366)]();_0x5e987b?.['importan'+'t']?.('prepare\x20'+_0x11afd5(0x3e2)+_0x11afd5(0x16f),{'syncOnly':syncOnly,'runtimeRoot':_0x1331bc,'shellConfig':summarizeShellConfig(_0x14639c)});try{const _0x37ab0d=await ensureRuntimeBase(_0x14639c,_0x1331bc,{'runtimeLogger':_0x5e987b,'syncOnly':syncOnly});_0x5e987b?.['importan'+'t']?.(_0x11afd5(0x3e2)+_0x11afd5(0x28d)+_0x11afd5(0x23a),{'manifestPath':resolveManifestPath(_0x1331bc),'manifest':summarizeRuntimeManifest(_0x37ab0d)}),validateRuntimeNodeVersion(_0x37ab0d,_0x14639c),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.(_0x11afd5(0x3e2)+_0x11afd5(0x1d4)+_0x11afd5(0x1bf)+_0x11afd5(0x3f8),{'nodeVersion':_0x37ab0d[_0x11afd5(0x1d1)+'ion']});if(syncOnly)validateRuntimeOpenClawVersion(_0x37ab0d,_0x14639c),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.(_0x11afd5(0x3e2)+'openclaw'+'\x20version'+_0x11afd5(0x2c8)+'ed',{'openclawVersion':_0x37ab0d[_0x11afd5(0x33d)+'Version']});else{if(_0x37ab0d[_0x11afd5(0x33d)+_0x11afd5(0x2ee)]!==_0x14639c['openclaw'][_0x11afd5(0x33d)+_0x11afd5(0x2ee)]){const _0x467763=await loadRuntimeInfo(_0x14639c['projectR'+_0x11afd5(0x32a)]);_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.('openclaw'+_0x11afd5(0x33c)+'\x20install'+'\x20started',{'fromVersion':_0x37ab0d[_0x11afd5(0x33d)+_0x11afd5(0x2ee)]||'unknown','toVersion':_0x14639c['openclaw']['openclaw'+_0x11afd5(0x2ee)]}),await installOpenClawPackage(_0x467763,_0x14639c['openclaw'][_0x11afd5(0x33d)+_0x11afd5(0x2ee)]),_0x37ab0d[_0x11afd5(0x33d)+_0x11afd5(0x2ee)]=_0x14639c['openclaw']['openclaw'+_0x11afd5(0x2ee)],_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.(_0x11afd5(0x33d)+_0x11afd5(0x33c)+_0x11afd5(0x250)+_0x11afd5(0x22e)+'ed',{'openclawVersion':_0x37ab0d[_0x11afd5(0x33d)+_0x11afd5(0x2ee)]});}}_0x37ab0d[_0x11afd5(0x37c)+'dAt']=new Date()['toISOStr'+_0x11afd5(0x196)](),_0x37ab0d['nodeVers'+_0x11afd5(0x35f)]=_0x14639c['openclaw'][_0x11afd5(0x1d1)+_0x11afd5(0x35f)],_0x37ab0d['product']={'appId':_0x14639c[_0x11afd5(0x1ae)],'productName':_0x14639c[_0x11afd5(0x222)+_0x11afd5(0x38f)],'dataDirName':_0x14639c[_0x11afd5(0x34a)+_0x11afd5(0x38f)]},await patchChatHistoryMixedToolContentBug(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchChatAttachmentBase64Runtime(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchProviderRequestIdHeader(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchChannelPluginRuntimeBug(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchWeixinOutboundFallbackRuntime(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchQQBotOutboundFallbackRuntime(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b});const _0x405711=await loadProductRuntime(_0x14639c[_0x11afd5(0x25e)+_0x11afd5(0x32a)],_0x1331bc);if(typeof _0x405711[_0x11afd5(0x1b9)+_0x11afd5(0x1c9)+_0x11afd5(0x1dc)]===_0x11afd5(0x2b8)){const _0x56b405=createRuntimeInfoFromManifest(_0x1331bc,_0x37ab0d);await _0x405711[_0x11afd5(0x1b9)+'roductRu'+_0x11afd5(0x1dc)]({'shellConfig':_0x14639c,'runtime':_0x56b405,'runtimeLogger':_0x5e987b,'syncOnly':syncOnly}),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.(_0x11afd5(0x2d2)+_0x11afd5(0x3e2)+_0x11afd5(0x1de)+_0x11afd5(0x1e8));}await patchSessionStoreSqliteRuntime(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchRequestIdTitleRuntime(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b});!syncOnly&&(await installRuntimeLarkCliPackage(createRuntimeInfoFromManifest(_0x1331bc,_0x37ab0d),{'runtimeLogger':_0x5e987b,'createRuntimeEnv':createRuntimeEnv}),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.('lark-cli'+_0x11afd5(0x260)+_0x11afd5(0x33c)+'\x20synced'),await hasConfiguredKdocsSkill(_0x14639c)?(await installKdocsCliBinary(_0x14639c,createRuntimeInfoFromManifest(_0x1331bc,_0x37ab0d),{'runtimeLogger':_0x5e987b,'syncOnly':syncOnly}),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.('connecto'+_0x11afd5(0x36d)+_0x11afd5(0x1b1)+_0x11afd5(0x286))):_0x5e987b?.[_0x11afd5(0x189)]('connecto'+_0x11afd5(0x36d)+_0x11afd5(0x1b1)+_0x11afd5(0x1cf)+_0x11afd5(0x2f0)+'kill\x20not'+_0x11afd5(0x254)+_0x11afd5(0x397)));const _0x1403fe=Array[_0x11afd5(0x1a6)](_0x37ab0d[_0x11afd5(0x2c9)])?_0x37ab0d[_0x11afd5(0x2c9)][_0x11afd5(0x23b)]:0x0;return await syncManifestPluginScope(_0x14639c,_0x1331bc,_0x37ab0d),_0x5e987b?.['importan'+'t']?.(_0x11afd5(0x3e2)+'plugin\x20s'+_0x11afd5(0x177)+_0x11afd5(0x287),{'beforePluginCount':_0x1403fe,'afterPluginCount':Array[_0x11afd5(0x1a6)](_0x37ab0d['plugins'])?_0x37ab0d[_0x11afd5(0x2c9)][_0x11afd5(0x23b)]:0x0,'pluginSpecCount':Array[_0x11afd5(0x1a6)](_0x37ab0d[_0x11afd5(0x294)+'ecs'])?_0x37ab0d['pluginSp'+_0x11afd5(0x37e)]['length']:0x0}),await syncConfiguredNpmPlugins(_0x14639c,_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b,'syncOnly':syncOnly}),_0x5e987b?.['importan'+'t']?.(_0x11afd5(0x27f)+_0x11afd5(0x351)+_0x11afd5(0x3fa)+_0x11afd5(0x2da),{'pluginSpecCount':_0x14639c[_0x11afd5(0x33d)]['pluginSp'+_0x11afd5(0x37e)][_0x11afd5(0x23b)],'pluginCount':Array[_0x11afd5(0x1a6)](_0x37ab0d[_0x11afd5(0x2c9)])?_0x37ab0d[_0x11afd5(0x2c9)][_0x11afd5(0x23b)]:0x0}),await patchWeixinOutboundSessionRoute(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await patchQQBotOutboundSessionRoute(_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),await syncProductPlugins(_0x14639c,_0x1331bc,_0x37ab0d,{'runtimeLogger':_0x5e987b}),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.('product\x20'+_0x11afd5(0x195)+_0x11afd5(0x286),{'localPluginCount':_0x14639c[_0x11afd5(0x33d)][_0x11afd5(0x264)+'LocalPlu'+'ginPaths'][_0x11afd5(0x23b)],'pluginCount':Array['isArray'](_0x37ab0d['plugins'])?_0x37ab0d[_0x11afd5(0x2c9)][_0x11afd5(0x23b)]:0x0}),await syncProductAgents(_0x14639c,_0x1331bc,_0x37ab0d),_0x5e987b?.['importan'+'t']?.('product\x20'+_0x11afd5(0x215)+_0x11afd5(0x2da),{'sources':_0x14639c[_0x11afd5(0x33d)][_0x11afd5(0x264)+_0x11afd5(0x39d)+_0x11afd5(0x15c)],'entryCount':_0x37ab0d[_0x11afd5(0x3a4)]?.[_0x11afd5(0x3ca)+'nt'],'installPath':_0x37ab0d[_0x11afd5(0x3a4)]?.[_0x11afd5(0x1c1)+_0x11afd5(0x362)]}),await syncProductSkills(_0x14639c,_0x1331bc,_0x37ab0d),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.('product\x20'+_0x11afd5(0x25a)+_0x11afd5(0x2da),{'sources':_0x14639c[_0x11afd5(0x33d)]['resolved'+'LocalSki'+_0x11afd5(0x221)],'entryCount':_0x37ab0d['skills']?.[_0x11afd5(0x3ca)+'nt'],'installPath':_0x37ab0d[_0x11afd5(0x389)]?.[_0x11afd5(0x1c1)+_0x11afd5(0x362)]}),await syncRuntimeWrapper(_0x14639c,_0x1331bc,_0x37ab0d),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.(_0x11afd5(0x3e2)+_0x11afd5(0x3de)+_0x11afd5(0x286),{'wujieclawBin':_0x37ab0d[_0x11afd5(0x393)+_0x11afd5(0x3b6)]}),await prunePackagedRuntimeCaches(_0x1331bc,_0x5e987b),pruneForPackaging&&await prunePackagedRuntimePayload(_0x1331bc,_0x37ab0d,_0x5e987b),await writeJson(resolveManifestPath(_0x1331bc),_0x37ab0d),_0x5e987b?.[_0x11afd5(0x1b3)+'t']?.(_0x11afd5(0x3e2)+_0x11afd5(0x28d)+_0x11afd5(0x386),{'manifestPath':resolveManifestPath(_0x1331bc),'manifest':summarizeRuntimeManifest(_0x37ab0d),'durationMs':Date[_0x11afd5(0x366)]()-_0x2cf544}),await _0x5e987b?.[_0x11afd5(0x327)](),_0x37ab0d;}catch(_0x15268d){_0x5e987b?.[_0x11afd5(0x371)](_0x11afd5(0x2c1)+_0x11afd5(0x3e2)+_0x11afd5(0x2f7),{'syncOnly':syncOnly,'runtimeRoot':_0x1331bc,'durationMs':Date['now']()-_0x2cf544,'error':_0x15268d}),await _0x5e987b?.[_0x11afd5(0x327)]();throw _0x15268d;}}async function prunePackagedRuntimeCaches(_0xc4e44a,_0x29df80){const _0x48ea32=_0x4cb8b3,_0x3838dd=[join(_0xc4e44a,'.cache'),join(_0xc4e44a,_0x48ea32(0x19f),_0x48ea32(0x37f)+'e'),join(_0xc4e44a,_0x48ea32(0x38b)+'time-bac'+_0x48ea32(0x1bc)),join(_0xc4e44a,_0x48ea32(0x3db)+'nloads-b'+_0x48ea32(0x347))];for(const _0x1936f4 of _0x3838dd){if(!existsSync(_0x1936f4))continue;await rm(_0x1936f4,{'recursive':!![],'force':!![]}),_0x29df80?.['info']('pruned\x20r'+'untime\x20c'+'ache\x20bef'+_0x48ea32(0x3ba)+'aging',{'cachePath':_0x1936f4});}}async function prunePackagedRuntimePayload(_0x3d97e0,_0x29eb2e,_0x18e138){const _0x3f05db=_0x4cb8b3,_0x4095fe=createRuntimeInfoFromManifest(_0x3d97e0,_0x29eb2e),_0x4c466f=[join(_0x3d97e0,process['platform']===_0x3f05db(0x242)?'node/nod'+_0x3f05db(0x198)+_0x3f05db(0x200):_0x3f05db(0x408)+_0x3f05db(0x1ed)+'dules/np'+'m'),join(_0x4095fe[_0x3f05db(0x33d)+_0x3f05db(0x1ad)+'ir'],_0x3f05db(0x2b3)+'ules')],_0x2142c5=join(_0x4095fe['openclaw'+_0x3f05db(0x1ad)+'ir'],'dist',_0x3f05db(0x1fc)+'ns');if(existsSync(_0x2142c5))for(const _0x547a78 of await readdir(_0x2142c5,{'withFileTypes':!![]})){_0x547a78[_0x3f05db(0x2dd)+'ory']()&&_0x4c466f[_0x3f05db(0x211)](join(_0x2142c5,_0x547a78[_0x3f05db(0x388)],_0x3f05db(0x2b3)+_0x3f05db(0x2ae)));}const _0x4b9556={'files':0x0,'directories':0x0,'bytes':0x0};for(const _0x575064 of _0x4c466f){await pruneRuntimeDependencyTree(_0x575064,_0x4b9556);}await pruneOpenClawDocs(_0x4095fe[_0x3f05db(0x33d)+_0x3f05db(0x1ad)+'ir'],_0x4b9556),_0x18e138?.['info'](_0x3f05db(0x32f)+'untime\x20p'+_0x3f05db(0x39b)+'efore\x20pa'+'ckaging',_0x4b9556);}async function pruneOpenClawDocs(_0x7b879,_0x2e758b){const _0x33427b=_0x4cb8b3,_0x5a853f=join(_0x7b879,_0x33427b(0x192));if(!existsSync(_0x5a853f))return;for(const _0x5ddfbf of await readdir(_0x5a853f,{'withFileTypes':!![]})){if(_0x5ddfbf['name']===_0x33427b(0x333)+'e')continue;await removePrunedPath(join(_0x5a853f,_0x5ddfbf[_0x33427b(0x388)]),_0x2e758b);}}async function pruneRuntimeDependencyTree(_0x5cd447,_0x1b1dde){const _0x149015=_0x4cb8b3;if(!existsSync(_0x5cd447))return;for(const _0xe246a8 of await readdir(_0x5cd447,{'withFileTypes':!![]})){const _0x2aca78=join(_0x5cd447,_0xe246a8[_0x149015(0x388)]);if(_0xe246a8[_0x149015(0x2dd)+_0x149015(0x273)]()){if(shouldPruneRuntimeDirectory(_0x5cd447,_0xe246a8[_0x149015(0x388)])){await removePrunedPath(_0x2aca78,_0x1b1dde);continue;}await pruneRuntimeDependencyTree(_0x2aca78,_0x1b1dde);continue;}_0xe246a8['isFile']()&&shouldPruneRuntimeFile(_0xe246a8[_0x149015(0x388)])&&await removePrunedPath(_0x2aca78,_0x1b1dde);}}function shouldPruneRuntimeDirectory(_0x20052c,_0x4c713a){const _0x4a658a=_0x4cb8b3;if(_0x4c713a==='@types')return!![];if(new Set([_0x4a658a(0x216),_0x4a658a(0x192),_0x4a658a(0x315)])['has'](_0x4c713a))return existsSync(join(_0x20052c,'package.'+'json'));return new Set(['__tests_'+'_',_0x4a658a(0x306),_0x4a658a(0x15a),_0x4a658a(0x39c),_0x4a658a(0x2f6)])['has'](_0x4c713a);}function shouldPruneRuntimeFile(_0x319855){const _0x3122df=_0x4cb8b3;if(_0x319855===_0x3122df(0x187)+_0x3122df(0x19c)+'n'||_0x319855['endsWith'](_0x3122df(0x3fc)))return!![];return new Set([_0x3122df(0x3b1),_0x3122df(0x230),'.markdow'+'n'])['has'](extname(_0x319855)[_0x3122df(0x350)+'ase']());}async function removePrunedPath(_0x3bb0aa,_0x468ec7){const _0x66a3e3=_0x4cb8b3;if(!existsSync(_0x3bb0aa))return;const _0xc75baa=await getPathSize(_0x3bb0aa),_0x1262ae=await stat(_0x3bb0aa);await rm(_0x3bb0aa,{'recursive':!![],'force':!![]}),_0x468ec7[_0x66a3e3(0x3fb)]+=_0xc75baa;if(_0x1262ae[_0x66a3e3(0x2dd)+_0x66a3e3(0x273)]())_0x468ec7[_0x66a3e3(0x21a)+_0x66a3e3(0x238)]+=0x1;else _0x468ec7['files']+=0x1;}async function getPathSize(_0x32b681){const _0x2c78a2=_0x4cb8b3,_0x6cd6b9=await stat(_0x32b681);if(!_0x6cd6b9[_0x2c78a2(0x2dd)+'ory']())return _0x6cd6b9[_0x2c78a2(0x265)];let _0x56c0f9=0x0;for(const _0x58cb3d of await readdir(_0x32b681,{'withFileTypes':!![]})){_0x56c0f9+=await getPathSize(join(_0x32b681,_0x58cb3d[_0x2c78a2(0x388)]));}return _0x56c0f9;}async function syncRuntimeWrapper(_0x1d64af,_0x4fab08,_0x170232){const _0x5910f5=_0x4cb8b3,_0xd05443=_0x1d64af[_0x5910f5(0x33d)]?.['configFi'+_0x5910f5(0x3e3)]??_0x5910f5(0x3d6)+_0x5910f5(0x1a8),_0x5de707=join(_0x4fab08,'bin',_0x5910f5(0x393)+'w'),_0x20157f=join(_0x4fab08,'bin',_0x5910f5(0x393)+_0x5910f5(0x31f)),_0x445c5d=normalizeRuntimeRelativePath(relative(dirname(_0x5de707),resolve(_0x4fab08,_0x170232[_0x5910f5(0x2cd)+_0x5910f5(0x1d7)]))),_0x48019c=normalizeRuntimeRelativePath(relative(dirname(_0x5de707),resolve(_0x4fab08,_0x170232['openclaw'+_0x5910f5(0x15e)]))),_0xdd3f28='$HOME/'+_0x1d64af[_0x5910f5(0x34a)+_0x5910f5(0x38f)],_0x1e0c4e=_0x5910f5(0x36b)+_0x5910f5(0x343)+_0x1d64af[_0x5910f5(0x34a)+'ame'];await mkdir(dirname(_0x5de707),{'recursive':!![]});const _0x3c1dcb=fileURLToPath(new URL(_0x5910f5(0x28a)+_0x5910f5(0x171)+'ie-logo.'+'mjs',import.meta.url)),_0x20f1f5=join(_0x4fab08,'bin',_0x5910f5(0x29f)+_0x5910f5(0x1e4));await cp(_0x3c1dcb,_0x20f1f5),await writeFile(_0x5de707,[_0x5910f5(0x359)+'h',_0x5910f5(0x31c)+_0x5910f5(0x364)+_0x5910f5(0x3f9)+'OPENCLAW'+_0x5910f5(0x164)+_0xdd3f28+'}\x22',_0x5910f5(0x31c)+'PENCLAW_'+_0x5910f5(0x22a)+'R=\x22${OPE'+_0x5910f5(0x1ca)+_0x5910f5(0x2df)+'-'+_0xdd3f28+'}\x22',_0x5910f5(0x31c)+_0x5910f5(0x364)+'CONFIG_F'+'ILE_NAME'+_0x5910f5(0x233)+_0x5910f5(0x1f9)+_0x5910f5(0x2d1)+_0x5910f5(0x235)+_0xd05443+'}\x22',_0x5910f5(0x31c)+_0x5910f5(0x364)+_0x5910f5(0x31a)+_0x5910f5(0x29a)+_0x5910f5(0x364)+_0x5910f5(0x31a)+_0x5910f5(0x2ec)+_0xdd3f28+'/'+_0xd05443+'}\x22',_0x5910f5(0x208)+'IR=$(CDP'+_0x5910f5(0x372)+_0x5910f5(0x2a7)+_0x5910f5(0x3dd)+'\x20\x22$0\x22)\x22\x20'+_0x5910f5(0x326),_0x5910f5(0x169)+'1\x20]\x20&&\x20['+_0x5910f5(0x354)+_0x5910f5(0x26c)+_0x5910f5(0x338)+_0x5910f5(0x194),'\x20\x20\x22$SCRI'+_0x5910f5(0x296)+_0x445c5d+(_0x5910f5(0x2e9)+_0x5910f5(0x1a5)+_0x5910f5(0x165)+'o.mjs\x22\x202'+_0x5910f5(0x3b7)+'ll\x20||\x20tr'+'ue'),'fi',_0x5910f5(0x276)+'CRIPT_DI'+'R/'+_0x445c5d+(_0x5910f5(0x2e9)+'PT_DIR/')+_0x48019c+_0x5910f5(0x20b),''][_0x5910f5(0x186)]('\x0a'),_0x5910f5(0x3a2)),await chmod(_0x5de707,0x1ed),await writeFile(_0x20157f,[_0x5910f5(0x209)+'f','if\x20\x22%OPE'+_0x5910f5(0x394)+_0x5910f5(0x374)+_0x5910f5(0x185)+_0x5910f5(0x305)+'OME='+_0x1e0c4e+'\x22',_0x5910f5(0x28e)+_0x5910f5(0x1ca)+_0x5910f5(0x300)+_0x5910f5(0x299)+'t\x20\x22OPENC'+'LAW_STAT'+_0x5910f5(0x1a4)+_0x1e0c4e+'\x22',_0x5910f5(0x28e)+_0x5910f5(0x3c2)+_0x5910f5(0x367)+_0x5910f5(0x2d3)+_0x5910f5(0x16c)+_0x5910f5(0x1c5)+'AW_CONFI'+'G_FILE_N'+_0x5910f5(0x179)+_0xd05443+'\x22',_0x5910f5(0x28e)+_0x5910f5(0x3c2)+'NFIG_PAT'+'H%\x22==\x22\x22\x20'+_0x5910f5(0x399)+_0x5910f5(0x3c2)+_0x5910f5(0x307)+'H='+_0x1e0c4e+'\x5c'+_0xd05443+'\x22',_0x5910f5(0x1f2)+_0x5910f5(0x34e)+_0x5910f5(0x2b6),_0x5910f5(0x284)+_0x5910f5(0x312)+toWindowsPath(_0x445c5d)+(_0x5910f5(0x33a)+_0x5910f5(0x278))+toWindowsPath(_0x48019c)+_0x5910f5(0x30b),'']['join']('\x0d\x0a'),_0x5910f5(0x3a2)),_0x170232[_0x5910f5(0x393)+_0x5910f5(0x3b6)]=toRuntimeRelative(_0x4fab08,process[_0x5910f5(0x313)]===_0x5910f5(0x242)?_0x20157f:_0x5de707);}async function patchChatHistoryMixedToolContentBug(_0x1b1c5e,_0x1d5d8a,_0x95a60a={}){const _0x395afb=_0x4cb8b3,_0xde3f8=resolve(_0x1b1c5e,_0x1d5d8a[_0x395afb(0x33d)+_0x395afb(0x1ad)+'ir']),_0x208633=join(_0xde3f8,_0x395afb(0x384));let _0x3c6645=[];try{_0x3c6645=await readdir(_0x208633,{'withFileTypes':!![]});}catch{_0x95a60a['runtimeL'+'ogger']?.[_0x395afb(0x3e1)]?.(_0x395afb(0x3ed)+_0x395afb(0x3b2)+'ed-tool\x20'+_0x395afb(0x2d9)+_0x395afb(0x1ff)+'ist\x20not\x20'+_0x395afb(0x3d3),{'distDir':_0x208633,'openclawVersion':_0x1d5d8a['openclaw'+'Version']});return;}const _0xe6265=_0x3c6645[_0x395afb(0x249)](_0x26df20=>_0x26df20[_0x395afb(0x218)]()&&(_0x26df20[_0x395afb(0x388)][_0x395afb(0x2e0)+'th'](_0x395afb(0x356)+_0x395afb(0x1d5)+'jection-')||_0x26df20['name'][_0x395afb(0x2e0)+'th'](_0x395afb(0x392)+_0x395afb(0x23e)+'pt-path-'))&&_0x26df20['name'][_0x395afb(0x334)](_0x395afb(0x297)))[_0x395afb(0x3d4)](_0x5c330f=>join(_0x208633,_0x5c330f[_0x395afb(0x388)]));if(_0xe6265[_0x395afb(0x23b)]===0x0){_0x95a60a[_0x395afb(0x2de)+'ogger']?.[_0x395afb(0x3e1)]?.(_0x395afb(0x3ed)+_0x395afb(0x3b2)+_0x395afb(0x25c)+_0x395afb(0x2d9)+_0x395afb(0x35d)+_0x395afb(0x2f1)+_0x395afb(0x3d3),{'openclawVersion':_0x1d5d8a[_0x395afb(0x33d)+'Version']});return;}for(const _0x117508 of _0xe6265){const _0x51e929=await readFile(_0x117508,_0x395afb(0x3a2)),_0x4cd95b=patchMixedToolContentFromSource(_0x51e929);if(!_0x4cd95b['patched']){if(_0x4cd95b[_0x395afb(0x3cf)]===_0x395afb(0x34d)+'patched'){_0x95a60a[_0x395afb(0x2de)+_0x395afb(0x304)]?.[_0x395afb(0x189)]?.(_0x395afb(0x3ed)+_0x395afb(0x3b2)+_0x395afb(0x25c)+_0x395afb(0x1b7)+_0x395afb(0x403)+_0x395afb(0x369),{'openclawVersion':_0x1d5d8a[_0x395afb(0x33d)+_0x395afb(0x2ee)],'filePath':_0x117508});return;}continue;}await writeFile(_0x117508,_0x4cd95b['source'],_0x395afb(0x3a2)),_0x95a60a[_0x395afb(0x2de)+_0x395afb(0x304)]?.['info']?.(_0x395afb(0x3ed)+'tory\x20mix'+_0x395afb(0x25c)+_0x395afb(0x3e8)+_0x395afb(0x369),{'openclawVersion':_0x1d5d8a['openclaw'+_0x395afb(0x2ee)],'filePath':_0x117508,'note':_0x395afb(0x271)+_0x395afb(0x220)+'ibility\x20'+_0x395afb(0x1da)+_0x395afb(0x303)+_0x395afb(0x336)+'6\x20mixed\x20'+_0x395afb(0x1c4)+_0x395afb(0x30e)+_0x395afb(0x161)+_0x395afb(0x16b)+_0x395afb(0x292)+_0x395afb(0x282)+_0x395afb(0x253)+'re\x20upgra'+'des.'});return;}_0x95a60a[_0x395afb(0x2de)+_0x395afb(0x304)]?.['warn']?.(_0x395afb(0x3ed)+_0x395afb(0x3b2)+_0x395afb(0x25c)+_0x395afb(0x2d9)+_0x395afb(0x35d)+_0x395afb(0x18b)+_0x395afb(0x1cb)+'d',{'openclawVersion':_0x1d5d8a['openclaw'+_0x395afb(0x2ee)]});}async function patchChatAttachmentBase64Runtime(_0x2285e6,_0x52e07f,_0x58672={}){const _0x3e5953=_0x4cb8b3,_0x2c8107=resolve(_0x2285e6,_0x52e07f[_0x3e5953(0x33d)+_0x3e5953(0x1ad)+'ir']),_0x18b600=join(_0x2c8107,_0x3e5953(0x384));let _0x5655d8=[];try{_0x5655d8=await readdir(_0x18b600,{'withFileTypes':!![]});}catch{_0x58672[_0x3e5953(0x2de)+_0x3e5953(0x304)]?.['warn']?.(_0x3e5953(0x283)+_0x3e5953(0x2f9)+_0x3e5953(0x3b3)+'atch\x20ski'+'pped;\x20di'+'st\x20not\x20f'+_0x3e5953(0x29c),{'distDir':_0x18b600,'openclawVersion':_0x52e07f[_0x3e5953(0x33d)+_0x3e5953(0x2ee)]});return;}const _0xa50cf8=_0x5655d8[_0x3e5953(0x249)](_0x46f92a=>_0x46f92a['isFile']()&&_0x46f92a[_0x3e5953(0x388)]['startsWi'+'th'](_0x3e5953(0x35b)+_0x3e5953(0x170)+_0x3e5953(0x197))&&_0x46f92a[_0x3e5953(0x388)]['endsWith'](_0x3e5953(0x297)))[_0x3e5953(0x3d4)](_0x4e03b2=>join(_0x18b600,_0x4e03b2[_0x3e5953(0x388)]));if(_0xa50cf8[_0x3e5953(0x23b)]===0x0){_0x58672[_0x3e5953(0x2de)+_0x3e5953(0x304)]?.[_0x3e5953(0x3e1)]?.(_0x3e5953(0x283)+_0x3e5953(0x2f9)+'base64\x20p'+_0x3e5953(0x2c3)+_0x3e5953(0x377)+'le\x20not\x20f'+'ound',{'openclawVersion':_0x52e07f[_0x3e5953(0x33d)+_0x3e5953(0x2ee)]});return;}for(const _0x56dcef of _0xa50cf8){const _0x2d91ed=await readFile(_0x56dcef,_0x3e5953(0x3a2)),_0x1a5c50=patchChatAttachmentBase64FromSource(_0x2d91ed);if(!_0x1a5c50[_0x3e5953(0x3b8)]){if(_0x1a5c50[_0x3e5953(0x3cf)]===_0x3e5953(0x34d)+_0x3e5953(0x3b8)){_0x58672[_0x3e5953(0x2de)+_0x3e5953(0x304)]?.[_0x3e5953(0x189)]?.(_0x3e5953(0x283)+_0x3e5953(0x2f9)+_0x3e5953(0x3b3)+_0x3e5953(0x3d7)+_0x3e5953(0x365)+_0x3e5953(0x1fe),{'openclawVersion':_0x52e07f[_0x3e5953(0x33d)+_0x3e5953(0x2ee)],'filePath':_0x56dcef});return;}continue;}await writeFile(_0x56dcef,_0x1a5c50['source'],_0x3e5953(0x3a2)),_0x58672[_0x3e5953(0x2de)+'ogger']?.[_0x3e5953(0x189)]?.(_0x3e5953(0x283)+_0x3e5953(0x2f9)+'base64\x20p'+_0x3e5953(0x259)+'lied',{'openclawVersion':_0x52e07f[_0x3e5953(0x33d)+_0x3e5953(0x2ee)],'filePath':_0x56dcef,'note':_0x3e5953(0x271)+'y\x20compat'+_0x3e5953(0x2c5)+_0x3e5953(0x1da)+_0x3e5953(0x303)+_0x3e5953(0x336)+_0x3e5953(0x1df)+'end\x20atta'+_0x3e5953(0x322)+_0x3e5953(0x1c0)+_0x3e5953(0x293)+_0x3e5953(0x2aa)+_0x3e5953(0x1e5)+_0x3e5953(0x27a)+_0x3e5953(0x316)+_0x3e5953(0x331)+_0x3e5953(0x1c7)});return;}_0x58672['runtimeL'+_0x3e5953(0x304)]?.[_0x3e5953(0x3e1)]?.('chat\x20att'+_0x3e5953(0x2f9)+_0x3e5953(0x3b3)+_0x3e5953(0x2c3)+'pped;\x20fu'+'nction\x20n'+_0x3e5953(0x2af),{'openclawVersion':_0x52e07f[_0x3e5953(0x33d)+_0x3e5953(0x2ee)]});}async function patchProviderRequestIdHeader(_0x43a3b0,_0x2a867a,_0xe197b9={}){const _0x30c3f4=_0x4cb8b3,_0x33c9c9=resolve(_0x43a3b0,_0x2a867a['openclaw'+_0x30c3f4(0x1ad)+'ir']),_0x598fcb=join(_0x33c9c9,_0x30c3f4(0x384));let _0x46c3fc=[];try{_0x46c3fc=await readdir(_0x598fcb,{'withFileTypes':!![]});}catch{_0xe197b9[_0x30c3f4(0x2de)+_0x30c3f4(0x304)]?.[_0x30c3f4(0x3e1)]?.(_0x30c3f4(0x3d5)+_0x30c3f4(0x1d6)+_0x30c3f4(0x1a9)+'er\x20patch'+_0x30c3f4(0x25b)+_0x30c3f4(0x19e)+_0x30c3f4(0x2af),{'distDir':_0x598fcb,'openclawVersion':_0x2a867a['openclaw'+_0x30c3f4(0x2ee)]});return;}const _0x33c576=_0x46c3fc[_0x30c3f4(0x249)](_0x574538=>_0x574538[_0x30c3f4(0x218)]()&&_0x574538[_0x30c3f4(0x388)][_0x30c3f4(0x334)]('.js'))[_0x30c3f4(0x3d4)](_0x59ad9c=>join(_0x598fcb,_0x59ad9c['name']));let _0x51e18e=0x0,_0x1c5dac=0x0;for(const _0x4298ab of _0x33c576){const _0x458c7d=await readFile(_0x4298ab,_0x30c3f4(0x3a2)),_0x3d5eda=patchProviderRequestIdHeaderFromSource(_0x458c7d);if(_0x3d5eda[_0x30c3f4(0x3b8)]){await writeFile(_0x4298ab,_0x3d5eda['source'],_0x30c3f4(0x3a2)),_0x51e18e+=0x1,_0xe197b9[_0x30c3f4(0x2de)+'ogger']?.['info']?.(_0x30c3f4(0x3d5)+_0x30c3f4(0x1d6)+_0x30c3f4(0x1a9)+_0x30c3f4(0x1e9)+'\x20applied',{'openclawVersion':_0x2a867a[_0x30c3f4(0x33d)+_0x30c3f4(0x2ee)],'filePath':_0x4298ab});continue;}if(_0x3d5eda[_0x30c3f4(0x3cf)]===_0x30c3f4(0x34d)+'patched')_0x1c5dac+=0x1;}if(_0x51e18e>0x0){_0xe197b9[_0x30c3f4(0x2de)+_0x30c3f4(0x304)]?.[_0x30c3f4(0x189)]?.(_0x30c3f4(0x3d5)+_0x30c3f4(0x1d6)+_0x30c3f4(0x1a9)+_0x30c3f4(0x1e9)+_0x30c3f4(0x37b),{'openclawVersion':_0x2a867a[_0x30c3f4(0x33d)+_0x30c3f4(0x2ee)],'patchedCount':_0x51e18e,'alreadyPatchedCount':_0x1c5dac});return;}if(_0x1c5dac>0x0){_0xe197b9[_0x30c3f4(0x2de)+_0x30c3f4(0x304)]?.[_0x30c3f4(0x189)]?.(_0x30c3f4(0x3d5)+_0x30c3f4(0x1d6)+_0x30c3f4(0x1a9)+_0x30c3f4(0x1e9)+_0x30c3f4(0x2dc)+_0x30c3f4(0x2a9),{'openclawVersion':_0x2a867a[_0x30c3f4(0x33d)+_0x30c3f4(0x2ee)],'alreadyPatchedCount':_0x1c5dac});return;}_0xe197b9[_0x30c3f4(0x2de)+_0x30c3f4(0x304)]?.[_0x30c3f4(0x3e1)]?.(_0x30c3f4(0x3d5)+_0x30c3f4(0x1d6)+'-id\x20head'+_0x30c3f4(0x1e9)+'\x20skipped'+';\x20provid'+_0x30c3f4(0x31b)+_0x30c3f4(0x240)+'\x20not\x20fou'+'nd',{'openclawVersion':_0x2a867a[_0x30c3f4(0x33d)+_0x30c3f4(0x2ee)]});}async function patchChannelPluginRuntimeBug(_0x1def14,_0x5e6ff3,_0x1725b1={}){const _0x34f80f=_0x4cb8b3,_0x5e6091=resolve(_0x1def14,_0x5e6ff3[_0x34f80f(0x33d)+_0x34f80f(0x1ad)+'ir']),_0x345e0c=join(_0x5e6091,'dist');let _0xa8649=[];try{_0xa8649=await readdir(_0x345e0c,{'withFileTypes':!![]});}catch{_0x1725b1[_0x34f80f(0x2de)+_0x34f80f(0x304)]?.[_0x34f80f(0x3e1)]?.(_0x34f80f(0x2a1)+_0x34f80f(0x2e5)+_0x34f80f(0x3d1)+_0x34f80f(0x2c3)+_0x34f80f(0x180)+_0x34f80f(0x213)+'ound',{'distDir':_0x345e0c,'openclawVersion':_0x5e6ff3[_0x34f80f(0x33d)+'Version']});return;}const _0x50f3f2=_0xa8649[_0x34f80f(0x249)](_0x3e8c0f=>_0x3e8c0f['isFile']()&&_0x3e8c0f[_0x34f80f(0x388)]['startsWi'+'th'](_0x34f80f(0x1fb))&&_0x3e8c0f[_0x34f80f(0x388)][_0x34f80f(0x334)]('.js'))[_0x34f80f(0x3d4)](_0x379b42=>join(_0x345e0c,_0x379b42[_0x34f80f(0x388)])),_0x476119=await resolveRuntimeChannelImportPath(_0x345e0c,_0xa8649);if(_0x50f3f2[_0x34f80f(0x23b)]===0x0){_0x1725b1['runtimeL'+_0x34f80f(0x304)]?.[_0x34f80f(0x3e1)]?.(_0x34f80f(0x2a1)+'plugin\x20r'+_0x34f80f(0x3d1)+_0x34f80f(0x2c3)+_0x34f80f(0x2cb)+_0x34f80f(0x31d)+_0x34f80f(0x39e),{'openclawVersion':_0x5e6ff3[_0x34f80f(0x33d)+_0x34f80f(0x2ee)]});return;}if(!_0x476119){_0x1725b1['runtimeL'+'ogger']?.[_0x34f80f(0x3e1)]?.(_0x34f80f(0x2a1)+_0x34f80f(0x2e5)+_0x34f80f(0x3d1)+'atch\x20ski'+_0x34f80f(0x318)+_0x34f80f(0x344)+'annel\x20en'+_0x34f80f(0x2a5)+_0x34f80f(0x3d3),{'openclawVersion':_0x5e6ff3['openclaw'+'Version'],'distDir':_0x345e0c});return;}for(const _0xeb5e03 of _0x50f3f2){const _0xe3e834=await readFile(_0xeb5e03,_0x34f80f(0x3a2)),_0x4f29f9=patchChannelPluginRuntimeFromSource(_0xe3e834,{'runtimeChannelImportPath':_0x476119});if(!_0x4f29f9[_0x34f80f(0x3b8)]){if(_0x4f29f9[_0x34f80f(0x3cf)]==='already-'+_0x34f80f(0x3b8)){_0x1725b1[_0x34f80f(0x2de)+_0x34f80f(0x304)]?.[_0x34f80f(0x189)]?.('channel\x20'+_0x34f80f(0x2e5)+'untime\x20p'+_0x34f80f(0x3d7)+_0x34f80f(0x365)+_0x34f80f(0x1fe),{'openclawVersion':_0x5e6ff3[_0x34f80f(0x33d)+_0x34f80f(0x2ee)],'filePath':_0xeb5e03});return;}continue;}await writeFile(_0xeb5e03,_0x4f29f9['source'],_0x34f80f(0x3a2)),_0x1725b1[_0x34f80f(0x2de)+_0x34f80f(0x304)]?.['info']?.(_0x34f80f(0x2a1)+_0x34f80f(0x2e5)+'untime\x20p'+'atch\x20app'+_0x34f80f(0x1fe),{'openclawVersion':_0x5e6ff3['openclaw'+_0x34f80f(0x2ee)],'filePath':_0xeb5e03,'note':_0x34f80f(0x271)+_0x34f80f(0x220)+_0x34f80f(0x2c5)+_0x34f80f(0x1da)+_0x34f80f(0x303)+_0x34f80f(0x336)+'6.6\x20chan'+'nel\x20plug'+_0x34f80f(0x2a8)+_0x34f80f(0x2ca)+_0x34f80f(0x191)+'el.inbou'+_0x34f80f(0x3c5)+_0x34f80f(0x329)+_0x34f80f(0x2d4)+_0x34f80f(0x21b)+_0x34f80f(0x36c)+_0x34f80f(0x3e7)+_0x34f80f(0x3a3)});return;}_0x1725b1[_0x34f80f(0x2de)+_0x34f80f(0x304)]?.['warn']?.(_0x34f80f(0x2a1)+_0x34f80f(0x2e5)+_0x34f80f(0x3d1)+_0x34f80f(0x2c3)+'pped;\x20ru'+_0x34f80f(0x2a0)+_0x34f80f(0x1f1)+_0x34f80f(0x2af),{'openclawVersion':_0x5e6ff3[_0x34f80f(0x33d)+_0x34f80f(0x2ee)]});}async function patchSessionStoreSqliteRuntime(_0x3e7108,_0x1f854b,_0x5d85ac={}){const _0x1b75df=_0x4cb8b3,_0x232196=resolve(_0x3e7108,_0x1f854b[_0x1b75df(0x33d)+_0x1b75df(0x1ad)+'ir']),_0x158163=join(_0x232196,_0x1b75df(0x384)),_0xdbbaff=_0x1b75df(0x36a)+_0x1b75df(0x348)+_0x1b75df(0x379)+_0x1b75df(0x252)+_0x1b75df(0x337)+'dge.mjs',_0x5e3c86=join(_0x3e7108,_0x1b75df(0x32e)+_0x1b75df(0x1dc),_0x1b75df(0x1f0),_0x1b75df(0x3ee)+_0x1b75df(0x30c)+'js'),_0x1143f2=(await readdir(_0x158163,{'withFileTypes':!![]})[_0x1b75df(0x258)](()=>[]))['filter'](_0x3a6771=>_0x3a6771[_0x1b75df(0x218)]()&&_0x3a6771[_0x1b75df(0x388)][_0x1b75df(0x2e0)+'th'](_0x1b75df(0x20a)+'ad-')&&_0x3a6771[_0x1b75df(0x388)]['endsWith'](_0x1b75df(0x297)))[_0x1b75df(0x3d4)](_0x554c18=>join(_0x158163,_0x554c18[_0x1b75df(0x388)])),_0x56ecb4=(await readdir(_0x158163,{'withFileTypes':!![]})[_0x1b75df(0x258)](()=>[]))[_0x1b75df(0x249)](_0x2ac9f1=>_0x2ac9f1[_0x1b75df(0x218)]()&&_0x2ac9f1['name'][_0x1b75df(0x2e0)+'th'](_0x1b75df(0x2ce))&&!_0x2ac9f1[_0x1b75df(0x388)][_0x1b75df(0x2e0)+'th']('store-lo'+'ad-')&&_0x2ac9f1['name'][_0x1b75df(0x334)](_0x1b75df(0x297)))[_0x1b75df(0x3d4)](_0x5009d0=>join(_0x158163,_0x5009d0[_0x1b75df(0x388)]));if(!existsSync(_0x5e3c86)){_0x5d85ac['runtimeL'+'ogger']?.['info']?.(_0x1b75df(0x2ad)+_0x1b75df(0x214)+_0x1b75df(0x172)+_0x1b75df(0x1bd)+_0x1b75df(0x3d0)+'ge\x20not\x20a'+_0x1b75df(0x26e),{'bridgePath':_0x5e3c86,'openclawVersion':_0x1f854b[_0x1b75df(0x33d)+_0x1b75df(0x2ee)]});return;}for(const _0xca253e of _0x1143f2){const _0x59082c=await readFile(_0xca253e,'utf8'),_0x1c41a0=patchSessionStoreLoadFromSource(_0x59082c,{'bridgeImportPath':_0xdbbaff});if(!_0x1c41a0[_0x1b75df(0x3b8)]){if(_0x1c41a0[_0x1b75df(0x3cf)]==='already-'+'patched'){_0x5d85ac['runtimeL'+_0x1b75df(0x304)]?.[_0x1b75df(0x189)]?.(_0x1b75df(0x2ad)+_0x1b75df(0x1a7)+_0x1b75df(0x3c7)+_0x1b75df(0x2dc)+'\x20applied',{'filePath':_0xca253e,'openclawVersion':_0x1f854b['openclaw'+_0x1b75df(0x2ee)]});break;}continue;}await writeFile(_0xca253e,_0x1c41a0[_0x1b75df(0x267)],_0x1b75df(0x3a2)),_0x5d85ac[_0x1b75df(0x2de)+_0x1b75df(0x304)]?.[_0x1b75df(0x189)]?.('session\x20'+_0x1b75df(0x1a7)+'ad\x20patch'+'\x20applied',{'filePath':_0xca253e,'openclawVersion':_0x1f854b[_0x1b75df(0x33d)+_0x1b75df(0x2ee)]});break;}for(const _0x2e39f9 of _0x56ecb4){const _0x4a9959=await readFile(_0x2e39f9,_0x1b75df(0x3a2)),_0x4b1c3f=patchSessionStoreWriteFromSource(_0x4a9959,{'bridgeImportPath':_0xdbbaff});if(!_0x4b1c3f[_0x1b75df(0x3b8)]){if(_0x4b1c3f[_0x1b75df(0x3cf)]===_0x1b75df(0x34d)+'patched'){_0x5d85ac[_0x1b75df(0x2de)+'ogger']?.[_0x1b75df(0x189)]?.('session\x20'+_0x1b75df(0x2bc)+_0x1b75df(0x231)+_0x1b75df(0x24d)+_0x1b75df(0x25d)+'d',{'filePath':_0x2e39f9,'openclawVersion':_0x1f854b[_0x1b75df(0x33d)+_0x1b75df(0x2ee)]});break;}continue;}await writeFile(_0x2e39f9,_0x4b1c3f[_0x1b75df(0x267)],'utf8'),_0x5d85ac[_0x1b75df(0x2de)+_0x1b75df(0x304)]?.[_0x1b75df(0x189)]?.(_0x1b75df(0x2ad)+'store\x20wr'+_0x1b75df(0x231)+_0x1b75df(0x289)+'d',{'filePath':_0x2e39f9,'openclawVersion':_0x1f854b[_0x1b75df(0x33d)+_0x1b75df(0x2ee)]});break;}}async function patchWeixinOutboundSessionRoute(_0x357ace,_0x4367e9,_0x221ed2={}){const _0x50d08f=_0x4cb8b3,_0x93aad7=join(_0x357ace,_0x50d08f(0x33d),'dist','extensio'+'ns',_0x50d08f(0x33d)+'-weixin',_0x50d08f(0x384),_0x50d08f(0x212),_0x50d08f(0x3ce)+'js');if(!existsSync(_0x93aad7)){_0x221ed2['runtimeL'+_0x50d08f(0x304)]?.[_0x50d08f(0x189)]?.('weixin\x20o'+_0x50d08f(0x34f)+'session\x20'+'route\x20pa'+'tch\x20skip'+'ped;\x20plu'+_0x50d08f(0x3f0)+_0x50d08f(0x3ae)+'d',{'openclawVersion':_0x4367e9[_0x50d08f(0x33d)+_0x50d08f(0x2ee)],'filePath':_0x93aad7});return;}const _0x3fc45b=await readFile(_0x93aad7,'utf8'),_0x20a943=patchWeixinOutboundSessionRouteFromSource(_0x3fc45b);if(!_0x20a943[_0x50d08f(0x3b8)]){if(_0x20a943[_0x50d08f(0x3cf)]===_0x50d08f(0x34d)+'patched'){_0x221ed2[_0x50d08f(0x2de)+_0x50d08f(0x304)]?.['info']?.(_0x50d08f(0x3f5)+_0x50d08f(0x34f)+_0x50d08f(0x2ad)+_0x50d08f(0x22d)+_0x50d08f(0x2db)+_0x50d08f(0x2ff)+_0x50d08f(0x268),{'openclawVersion':_0x4367e9[_0x50d08f(0x33d)+'Version'],'filePath':_0x93aad7});return;}_0x221ed2['runtimeL'+_0x50d08f(0x304)]?.[_0x50d08f(0x3e1)]?.(_0x50d08f(0x3f5)+_0x50d08f(0x34f)+_0x50d08f(0x2ad)+'route\x20pa'+_0x50d08f(0x280)+_0x50d08f(0x20d)+_0x50d08f(0x204)+_0x50d08f(0x3a9)+'ound',{'openclawVersion':_0x4367e9['openclaw'+_0x50d08f(0x2ee)],'filePath':_0x93aad7,'reason':_0x20a943['reason']});return;}await writeFile(_0x93aad7,_0x20a943[_0x50d08f(0x267)],_0x50d08f(0x3a2)),_0x221ed2['runtimeL'+_0x50d08f(0x304)]?.['info']?.(_0x50d08f(0x3f5)+'utbound\x20'+_0x50d08f(0x2ad)+_0x50d08f(0x22d)+_0x50d08f(0x360)+_0x50d08f(0x268),{'openclawVersion':_0x4367e9['openclaw'+_0x50d08f(0x2ee)],'filePath':_0x93aad7,'note':_0x50d08f(0x271)+'y\x20compat'+'ibility\x20'+'patch\x20fo'+'r\x20@tence'+_0x50d08f(0x1aa)+_0x50d08f(0x193)+_0x50d08f(0x38e)+_0x50d08f(0x288)+_0x50d08f(0x30f)+_0x50d08f(0x29d)+_0x50d08f(0x291)+'g\x20indexe'+_0x50d08f(0x2b0)+_0x50d08f(0x314)+_0x50d08f(0x2a6)+'ify\x20upst'+_0x50d08f(0x282)+_0x50d08f(0x253)+_0x50d08f(0x237)+_0x50d08f(0x27d)});}async function patchWeixinOutboundFallbackRuntime(_0x434e16,_0x7621c2,_0x2f33c8={}){const _0x163b63=_0x4cb8b3,_0x3dcb5c=resolve(_0x434e16,_0x7621c2['openclaw'+'WorkingD'+'ir']),_0x60abc3=join(_0x3dcb5c,_0x163b63(0x384)),_0xd086d8=(await readdir(_0x60abc3,{'withFileTypes':!![]})[_0x163b63(0x258)](()=>[]))['filter'](_0x23c2bb=>_0x23c2bb['isFile']()&&_0x23c2bb['name'][_0x163b63(0x2e0)+'th']('outbound'+_0x163b63(0x383)+'-')&&_0x23c2bb[_0x163b63(0x388)]['endsWith'](_0x163b63(0x297)))[_0x163b63(0x3d4)](_0x5622c3=>join(_0x60abc3,_0x5622c3[_0x163b63(0x388)]));if(_0xd086d8[_0x163b63(0x23b)]===0x0){_0x2f33c8['runtimeL'+'ogger']?.[_0x163b63(0x3e1)]?.(_0x163b63(0x3f5)+_0x163b63(0x34f)+'fallback'+_0x163b63(0x27e)+_0x163b63(0x20e)+_0x163b63(0x24f)+_0x163b63(0x260)+_0x163b63(0x21c)+'nd',{'openclawVersion':_0x7621c2[_0x163b63(0x33d)+'Version'],'distDir':_0x60abc3});return;}for(const _0x22bc85 of _0xd086d8){const _0x57f008=await readFile(_0x22bc85,_0x163b63(0x3a2)),_0x321093=patchWeixinOutboundFallbackFromSource(_0x57f008);if(!_0x321093[_0x163b63(0x3b8)]){if(_0x321093[_0x163b63(0x3cf)]===_0x163b63(0x34d)+_0x163b63(0x3b8)){_0x2f33c8[_0x163b63(0x2de)+_0x163b63(0x304)]?.['info']?.(_0x163b63(0x3f5)+_0x163b63(0x34f)+'fallback'+'\x20patch\x20a'+_0x163b63(0x1e2)+_0x163b63(0x309),{'openclawVersion':_0x7621c2['openclaw'+'Version'],'filePath':_0x22bc85});return;}continue;}await writeFile(_0x22bc85,_0x321093[_0x163b63(0x267)],_0x163b63(0x3a2)),_0x2f33c8[_0x163b63(0x2de)+'ogger']?.['info']?.(_0x163b63(0x3f5)+'utbound\x20'+_0x163b63(0x2eb)+_0x163b63(0x373)+'pplied',{'openclawVersion':_0x7621c2[_0x163b63(0x33d)+_0x163b63(0x2ee)],'filePath':_0x22bc85,'note':_0x163b63(0x271)+'y\x20compat'+_0x163b63(0x2c5)+'patch\x20fo'+_0x163b63(0x236)+_0x163b63(0x3f4)+_0x163b63(0x160)+_0x163b63(0x1e7)+_0x163b63(0x3c4)+'d\x20mirror'+_0x163b63(0x199)+_0x163b63(0x3ff)+'ions\x20whe'+_0x163b63(0x3b5)+_0x163b63(0x1ea)+_0x163b63(0x290)+_0x163b63(0x2fc)});return;}_0x2f33c8[_0x163b63(0x2de)+_0x163b63(0x304)]?.['warn']?.('weixin\x20o'+_0x163b63(0x34f)+_0x163b63(0x2eb)+'\x20patch\x20s'+_0x163b63(0x20e)+_0x163b63(0x321)+_0x163b63(0x404)+_0x163b63(0x2af),{'openclawVersion':_0x7621c2[_0x163b63(0x33d)+'Version']});}async function patchRequestIdTitleRuntime(_0x28aef2,_0x72217e,_0x5d6c7f={}){const _0x436056=_0x4cb8b3,_0x216cff=resolve(_0x28aef2,_0x72217e[_0x436056(0x33d)+'WorkingD'+'ir']),_0x3e47a0=join(_0x216cff,_0x436056(0x384)),_0xa745c4=_0x436056(0x36a)+_0x436056(0x348)+_0x436056(0x1af)+_0x436056(0x281)+_0x436056(0x30a)+_0x436056(0x390)+'s',_0x152870=join(_0x28aef2,'shell-ru'+_0x436056(0x1dc),_0x436056(0x3f3)+'id','runtime-'+_0x436056(0x30c)+'js');if(!existsSync(_0x152870)){_0x5d6c7f[_0x436056(0x2de)+_0x436056(0x304)]?.[_0x436056(0x189)]?.('request-'+_0x436056(0x1c8)+'\x20runtime'+'\x20patch\x20s'+_0x436056(0x20e)+_0x436056(0x1ab)+_0x436056(0x39f)+'able',{'bridgePath':_0x152870,'openclawVersion':_0x72217e['openclaw'+'Version']});return;}const _0x858ee4=(await readdir(_0x3e47a0,{'withFileTypes':!![]})[_0x436056(0x258)](()=>[]))[_0x436056(0x249)](_0x5a835f=>_0x5a835f[_0x436056(0x218)]()&&_0x5a835f[_0x436056(0x388)][_0x436056(0x2e0)+'th']('loader-')&&_0x5a835f['name'][_0x436056(0x334)](_0x436056(0x297)))[_0x436056(0x3d4)](_0x479678=>join(_0x3e47a0,_0x479678[_0x436056(0x388)]));for(const _0x55c78e of _0x858ee4){const _0x380b47=await readFile(_0x55c78e,_0x436056(0x3a2)),_0x233bf5=patchRequestIdTitleRuntimeFromSource(_0x380b47,{'bridgeImportPath':_0xa745c4});if(!_0x233bf5[_0x436056(0x3b8)]){if(_0x233bf5[_0x436056(0x3cf)]===_0x436056(0x34d)+_0x436056(0x3b8)){_0x5d6c7f[_0x436056(0x2de)+_0x436056(0x304)]?.[_0x436056(0x189)]?.(_0x436056(0x3f3)+'id\x20title'+_0x436056(0x260)+_0x436056(0x373)+_0x436056(0x1e2)+_0x436056(0x309),{'filePath':_0x55c78e,'openclawVersion':_0x72217e[_0x436056(0x33d)+'Version']});break;}continue;}await writeFile(_0x55c78e,_0x233bf5['source'],'utf8'),_0x5d6c7f['runtimeL'+'ogger']?.['info']?.(_0x436056(0x3f3)+_0x436056(0x1c8)+_0x436056(0x260)+_0x436056(0x373)+_0x436056(0x309),{'filePath':_0x55c78e,'openclawVersion':_0x72217e[_0x436056(0x33d)+_0x436056(0x2ee)]});break;}}async function patchQQBotOutboundFallbackRuntime(_0x2fa67c,_0x5a14e6,_0x4cd616={}){const _0xd74049=_0x4cb8b3,_0xfbd43c=resolve(_0x2fa67c,_0x5a14e6[_0xd74049(0x33d)+_0xd74049(0x1ad)+'ir']),_0x4b9e6a=join(_0xfbd43c,_0xd74049(0x384)),_0x36223d=(await readdir(_0x4b9e6a,{'withFileTypes':!![]})[_0xd74049(0x258)](()=>[]))[_0xd74049(0x249)](_0x739cac=>_0x739cac['isFile']()&&_0x739cac[_0xd74049(0x388)]['startsWi'+'th']('outbound'+'-session'+'-')&&_0x739cac[_0xd74049(0x388)][_0xd74049(0x334)]('.js'))['map'](_0x5ac56e=>join(_0x4b9e6a,_0x5ac56e[_0xd74049(0x388)]));if(_0x36223d[_0xd74049(0x23b)]===0x0){_0x4cd616[_0xd74049(0x2de)+_0xd74049(0x304)]?.['warn']?.(_0xd74049(0x3fd)+'tbound\x20f'+_0xd74049(0x2cf)+'patch\x20sk'+_0xd74049(0x3da)+_0xd74049(0x34f)+_0xd74049(0x3e2)+_0xd74049(0x1cb)+'d',{'openclawVersion':_0x5a14e6[_0xd74049(0x33d)+_0xd74049(0x2ee)],'distDir':_0x4b9e6a});return;}for(const _0x800b8 of _0x36223d){const _0x34ff33=await readFile(_0x800b8,_0xd74049(0x3a2)),_0x4a2686=patchQQBotOutboundFallbackFromSource(_0x34ff33);if(!_0x4a2686[_0xd74049(0x3b8)]){if(_0x4a2686[_0xd74049(0x3cf)]===_0xd74049(0x34d)+_0xd74049(0x3b8)){_0x4cd616['runtimeL'+_0xd74049(0x304)]?.[_0xd74049(0x189)]?.('qqbot\x20ou'+'tbound\x20f'+'allback\x20'+_0xd74049(0x1b7)+_0xd74049(0x403)+_0xd74049(0x369),{'openclawVersion':_0x5a14e6[_0xd74049(0x33d)+_0xd74049(0x2ee)],'filePath':_0x800b8});return;}continue;}await writeFile(_0x800b8,_0x4a2686[_0xd74049(0x267)],_0xd74049(0x3a2)),_0x4cd616[_0xd74049(0x2de)+_0xd74049(0x304)]?.['info']?.(_0xd74049(0x3fd)+_0xd74049(0x1f8)+_0xd74049(0x2cf)+_0xd74049(0x3e8)+_0xd74049(0x369),{'openclawVersion':_0x5a14e6[_0xd74049(0x33d)+'Version'],'filePath':_0x800b8,'note':_0xd74049(0x271)+_0xd74049(0x220)+_0xd74049(0x2c5)+'patch\x20fo'+'rcing\x20QQ'+_0xd74049(0x243)+'outbound'+_0xd74049(0x409)+_0xd74049(0x3e4)+_0xd74049(0x188)+_0xd74049(0x376)+_0xd74049(0x15f)+_0xd74049(0x269)+'n\x20the\x20pe'+_0xd74049(0x182)});return;}_0x4cd616[_0xd74049(0x2de)+_0xd74049(0x304)]?.[_0xd74049(0x3e1)]?.('qqbot\x20ou'+_0xd74049(0x1f8)+_0xd74049(0x2cf)+'patch\x20sk'+_0xd74049(0x3e6)+_0xd74049(0x358)+_0xd74049(0x1b4)+_0xd74049(0x2a3),{'openclawVersion':_0x5a14e6[_0xd74049(0x33d)+_0xd74049(0x2ee)]});}async function patchQQBotOutboundSessionRoute(_0x9b42c2,_0x46271c,_0x5b9a76={}){const _0x34fb35=_0x4cb8b3,_0x30003b=join(_0x9b42c2,'openclaw',_0x34fb35(0x384),'extensio'+'ns',_0x34fb35(0x18d),_0x34fb35(0x384));if(!existsSync(_0x30003b)){_0x5b9a76[_0x34fb35(0x2de)+_0x34fb35(0x304)]?.[_0x34fb35(0x189)]?.(_0x34fb35(0x3fd)+_0x34fb35(0x23f)+_0x34fb35(0x3c1)+'oute\x20pat'+'ch\x20skipp'+'ed;\x20plug'+_0x34fb35(0x3a6)+_0x34fb35(0x332),{'openclawVersion':_0x46271c[_0x34fb35(0x33d)+_0x34fb35(0x2ee)],'distDir':_0x30003b});return;}const _0x2f8009=(await readdir(_0x30003b,{'withFileTypes':!![]})[_0x34fb35(0x258)](()=>[]))[_0x34fb35(0x249)](_0x5a5067=>_0x5a5067[_0x34fb35(0x218)]()&&_0x5a5067['name'][_0x34fb35(0x334)](_0x34fb35(0x297)))[_0x34fb35(0x3d4)](_0x2c8f31=>join(_0x30003b,_0x2c8f31['name']));for(const _0x285bff of _0x2f8009){const _0x211429=await readFile(_0x285bff,_0x34fb35(0x3a2)),_0x2f4c50=patchQQBotOutboundSessionRouteFromSource(_0x211429);if(!_0x2f4c50['patched']){if(_0x2f4c50[_0x34fb35(0x3cf)]===_0x34fb35(0x34d)+_0x34fb35(0x3b8)){_0x5b9a76[_0x34fb35(0x2de)+'ogger']?.[_0x34fb35(0x189)]?.('qqbot\x20ou'+'tbound\x20s'+_0x34fb35(0x3c1)+_0x34fb35(0x381)+_0x34fb35(0x3bf)+'dy\x20appli'+'ed',{'openclawVersion':_0x46271c[_0x34fb35(0x33d)+'Version'],'filePath':_0x285bff});return;}continue;}await writeFile(_0x285bff,_0x2f4c50[_0x34fb35(0x267)],_0x34fb35(0x3a2)),_0x5b9a76['runtimeL'+_0x34fb35(0x304)]?.['info']?.(_0x34fb35(0x3fd)+_0x34fb35(0x23f)+_0x34fb35(0x3c1)+_0x34fb35(0x381)+'ch\x20appli'+'ed',{'openclawVersion':_0x46271c[_0x34fb35(0x33d)+_0x34fb35(0x2ee)],'filePath':_0x285bff,'note':_0x34fb35(0x271)+'y\x20compat'+_0x34fb35(0x2c5)+'patch\x20fo'+_0x34fb35(0x339)+_0x34fb35(0x263)+_0x34fb35(0x3cc)+_0x34fb35(0x239)+'elivery\x20'+_0x34fb35(0x311)+_0x34fb35(0x2fd)+_0x34fb35(0x219)+'th\x20c2c\x20i'+_0x34fb35(0x227)+_0x34fb35(0x173)+'r\x20id.'});return;}_0x5b9a76[_0x34fb35(0x2de)+_0x34fb35(0x304)]?.[_0x34fb35(0x3e1)]?.(_0x34fb35(0x3fd)+_0x34fb35(0x23f)+_0x34fb35(0x3c1)+_0x34fb35(0x381)+_0x34fb35(0x1bd)+_0x34fb35(0x26a)+_0x34fb35(0x33f)+'e\x20not\x20fo'+_0x34fb35(0x2b7),{'openclawVersion':_0x46271c['openclaw'+_0x34fb35(0x2ee)],'distDir':_0x30003b});}async function resolveRuntimeChannelImportPath(_0x58a980,_0x45ec67){const _0x3b2524=_0x4cb8b3,_0x4348e9=_0x45ec67['filter'](_0x48e256=>_0x48e256[_0x3b2524(0x218)]()&&_0x48e256[_0x3b2524(0x388)][_0x3b2524(0x2e0)+'th']('runtime-'+_0x3b2524(0x2be))&&_0x48e256[_0x3b2524(0x388)][_0x3b2524(0x334)](_0x3b2524(0x297))&&!_0x48e256[_0x3b2524(0x388)][_0x3b2524(0x2e0)+'th'](_0x3b2524(0x3ee)+_0x3b2524(0x2be)+_0x3b2524(0x23c)))[_0x3b2524(0x3d4)](_0x548ed7=>_0x548ed7['name'])[_0x3b2524(0x2c6)]();for(const _0x4386d0 of _0x4348e9){const _0x4ae119=await readFile(join(_0x58a980,_0x4386d0),_0x3b2524(0x3a2));if(_0x4ae119[_0x3b2524(0x2e7)](_0x3b2524(0x295)+_0x3b2524(0x3c0)+_0x3b2524(0x2d7)))return'./'+_0x4386d0;}return null;}function normalizeRuntimeRelativePath(_0x44886a){const _0x2287b8=_0x4cb8b3;return _0x44886a[_0x2287b8(0x3aa)+'ll']('\x5c','/');}function toWindowsPath(_0x4c8c4a){const _0x339d70=_0x4cb8b3;return _0x4c8c4a[_0x339d70(0x3aa)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x57f547,_0xb1a946){const _0x2f5d35=_0x4cb8b3;if(_0x57f547[_0x2f5d35(0x1d1)+_0x2f5d35(0x35f)]===_0xb1a946[_0x2f5d35(0x33d)][_0x2f5d35(0x1d1)+_0x2f5d35(0x35f)])return;throw new Error(_0x2f5d35(0x3e2)+_0x2f5d35(0x1d1)+_0x2f5d35(0x3d8)+_0x2f5d35(0x246)+_0x2f5d35(0x232)+(_0x57f547['nodeVers'+'ion']||'unknown')+(_0x2f5d35(0x2b4)+_0x2f5d35(0x24e))+_0xb1a946[_0x2f5d35(0x33d)]['nodeVers'+_0x2f5d35(0x35f)]+'.\x20'+(_0x2f5d35(0x167)+_0x2f5d35(0x229)+_0x2f5d35(0x2d0)+_0x2f5d35(0x2e6)+_0x2f5d35(0x1b5)+_0x2f5d35(0x260)+_0x2f5d35(0x205)+_0x2f5d35(0x1a2)+_0x2f5d35(0x2d6)+'\x20configu'+_0x2f5d35(0x28c)+'\x20version'+'.'));}function validateRuntimeOpenClawVersion(_0x4b24dc,_0x39929c){const _0x25050a=_0x4cb8b3;if(_0x4b24dc[_0x25050a(0x33d)+_0x25050a(0x2ee)]===_0x39929c[_0x25050a(0x33d)]['openclaw'+_0x25050a(0x2ee)])return;throw new Error(_0x25050a(0x3e2)+_0x25050a(0x33d)+_0x25050a(0x395)+'mismatch'+_0x25050a(0x21f)+_0x25050a(0x3e0)+(_0x4b24dc[_0x25050a(0x33d)+_0x25050a(0x2ee)]||_0x25050a(0x1fa))+(_0x25050a(0x2b4)+_0x25050a(0x24e))+_0x39929c[_0x25050a(0x33d)][_0x25050a(0x33d)+_0x25050a(0x2ee)]+'.\x20'+(_0x25050a(0x167)+_0x25050a(0x229)+'\x20prepare'+'\x22\x20so\x20the'+_0x25050a(0x260)+_0x25050a(0x1b8)+_0x25050a(0x3a7)+_0x25050a(0x254)+_0x25050a(0x223)+'Claw\x20ver'+_0x25050a(0x16a)));}function parseNpmPackJson(_0x33c923){const _0x512266=_0x4cb8b3,_0x233ba1=_0x33c923['trim'](),_0x42739b=_0x233ba1['indexOf']('[');if(_0x42739b<0x0)throw new Error(_0x512266(0x406)+_0x512266(0x24a)+_0x512266(0x38d)+_0x512266(0x28b)+_0x233ba1['slice'](0x0,0x1f4));const _0x2b3d86=JSON[_0x512266(0x202)](_0x233ba1[_0x512266(0x1ac)](_0x42739b)),_0x1a00ee=Array['isArray'](_0x2b3d86)?_0x2b3d86[0x0]:_0x2b3d86;if(!_0x1a00ee||typeof _0x1a00ee!==_0x512266(0x38c))throw new Error(_0x512266(0x406)+_0x512266(0x1d8)+_0x512266(0x3fe)+_0x512266(0x1d2)+_0x512266(0x245)+_0x233ba1[_0x512266(0x1ac)](0x0,0x1f4));return _0x1a00ee;}function normalizePackedTarballFilename(_0x4a8561){const _0x5a82e6=_0x4cb8b3;return _0x4a8561[_0x5a82e6(0x37d)](/^@/,'')[_0x5a82e6(0x3aa)+'ll']('/','-')[_0x5a82e6(0x3aa)+'ll']('\x5c','-');}async function runProcess(_0x280112,_0x2bec00,_0x191424={}){const _0x5dffe6=_0x4cb8b3,_0xea5a63=_0x191424[_0x5dffe6(0x30d)]||[_0x280112,..._0x2bec00]['join']('\x20'),_0x398c42=_0x191424[_0x5dffe6(0x3ea)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x22b0db=spawn(_0x280112,_0x2bec00,{'cwd':_0x191424[_0x5dffe6(0x175)],'env':_0x191424[_0x5dffe6(0x323)],'stdio':['ignore',_0x5dffe6(0x2bf),_0x5dffe6(0x2bf)]});return await new Promise((_0x3c7865,_0x3f5103)=>{const _0x42dbfb=_0x5dffe6;let _0x4070dc='',_0x3bbd01='',_0x43e4c8=![];const _0x2bc30a=setTimeout(()=>{const _0xe25e78=_0x5af4;if(_0x43e4c8)return;_0x43e4c8=!![],_0x22b0db[_0xe25e78(0x15b)](_0xe25e78(0x241)),_0x3f5103(new Error(_0xea5a63+('\x20timed\x20o'+_0xe25e78(0x217)+'\x20')+_0x398c42+'ms'));},_0x398c42);_0x22b0db[_0x42dbfb(0x33e)]['on']('data',_0x3d9d21=>{const _0x3a9e73=_0x42dbfb;_0x4070dc+=_0x3d9d21[_0x3a9e73(0x29e)]();}),_0x22b0db[_0x42dbfb(0x29b)]['on'](_0x42dbfb(0x2ba),_0xa0d916=>{const _0x4c0a81=_0x42dbfb;_0x3bbd01+=_0xa0d916[_0x4c0a81(0x29e)]();}),_0x22b0db['on'](_0x42dbfb(0x371),_0x38754a=>{if(_0x43e4c8)return;_0x43e4c8=!![],clearTimeout(_0x2bc30a),_0x3f5103(_0x38754a);}),_0x22b0db['on'](_0x42dbfb(0x21e),(_0x1ef9e6,_0x364671)=>{const _0x45083b=_0x42dbfb;if(_0x43e4c8)return;_0x43e4c8=!![],clearTimeout(_0x2bc30a);if(_0x1ef9e6===0x0){_0x3c7865({'stdout':_0x4070dc,'stderr':_0x3bbd01});return;}_0x3f5103(new Error(_0xea5a63+(_0x45083b(0x1b6)+_0x45083b(0x355)+'e=')+(_0x1ef9e6??_0x45083b(0x378))+_0x45083b(0x2f4)+(_0x364671??_0x45083b(0x378))+'\x0a'+(''+(_0x3bbd01||_0x4070dc))['trim']()));});});}async function installOpenClawPackage(_0x3f09f9,_0x1c1090){const _0x4b8d11=_0x4cb8b3,_0x52b660=join(_0x3f09f9[_0x4b8d11(0x1c2)+'oot'],_0x4b8d11(0x2d5)),_0x24744b=join(_0x3f09f9[_0x4b8d11(0x1c2)+_0x4b8d11(0x32a)],_0x4b8d11(0x1f4)+_0x4b8d11(0x317)+'t');await mkdir(_0x52b660,{'recursive':!![]}),await removePathWithRetries(_0x24744b),await mkdir(_0x24744b,{'recursive':!![]});const _0x134f50=await createRuntimeEnv(_0x3f09f9),_0x474120=_0x4b8d11(0x33d)+'@'+_0x1c1090;console[_0x4b8d11(0x335)](_0x4b8d11(0x206)+'hell:run'+_0x4b8d11(0x302)+_0x4b8d11(0x3a0)+'\x20'+_0x474120);const _0x4b2baa=await runProcess(_0x3f09f9['nodeExec'+'utable'],[_0x3f09f9[_0x4b8d11(0x2f2)],_0x4b8d11(0x310),_0x474120,_0x4b8d11(0x274)],{'cwd':_0x52b660,'env':_0x134f50,'label':_0x4b8d11(0x406)+'\x20'+_0x474120}),_0x286e39=parseNpmPackJson(_0x4b2baa[_0x4b8d11(0x33e)]);if(_0x286e39[_0x4b8d11(0x3f2)]!==_0x1c1090)throw new Error(_0x4b8d11(0x19d)+_0x4b8d11(0x251)+'law\x20'+_0x1c1090+(_0x4b8d11(0x3c8)+'d\x20to\x20')+_0x286e39[_0x4b8d11(0x3f2)]);const _0xf96be3=resolve(_0x52b660,_0x286e39[_0x4b8d11(0x3ef)]);if(!existsSync(_0xf96be3))throw new Error(_0x4b8d11(0x406)+_0x4b8d11(0x24a)+_0x4b8d11(0x405)+_0x4b8d11(0x2c2)+'\x20'+_0xf96be3);await runProcess(_0x4b8d11(0x2b9),[_0x4b8d11(0x22f),_0xf96be3,'-C',_0x24744b],{'label':_0x4b8d11(0x2ea)+_0x286e39[_0x4b8d11(0x3ef)]}),await removePathWithRetries(_0x3f09f9['openclaw'+_0x4b8d11(0x1ad)+'ir']),await rename(join(_0x24744b,'package'),_0x3f09f9[_0x4b8d11(0x33d)+_0x4b8d11(0x1ad)+'ir']),await removePathWithRetries(_0x24744b),await runProcess(_0x3f09f9[_0x4b8d11(0x2cd)+_0x4b8d11(0x1d7)],[_0x3f09f9['npmCli'],_0x4b8d11(0x285),_0x4b8d11(0x398)+'ev',_0x4b8d11(0x324)+'eer',_0x4b8d11(0x22b)+'it','--no-fun'+'d',_0x4b8d11(0x1b2)+'-peer-de'+'ps'],{'cwd':_0x3f09f9[_0x4b8d11(0x33d)+'WorkingD'+'ir'],'env':_0x134f50,'label':'npm\x20inst'+_0x4b8d11(0x361)+_0x474120+('\x20runtime'+_0x4b8d11(0x401)+_0x4b8d11(0x2f3))});if(!existsSync(_0x3f09f9['openclaw'+_0x4b8d11(0x15e)]))throw new Error(_0x4b8d11(0x256)+'\x20bin\x20was'+_0x4b8d11(0x21c)+_0x4b8d11(0x3ac)+_0x4b8d11(0x250)+':\x20'+_0x3f09f9[_0x4b8d11(0x33d)+_0x4b8d11(0x15e)]);}async function ensureRuntimeBase(_0x3e2564,_0x3c9fcf,_0x46c4da={}){const _0x51c3ac=_0x4cb8b3;await mkdir(_0x3c9fcf,{'recursive':!![]});let _0x32102f=await readRuntimeManifest(_0x3c9fcf);const _0x424965=_0x3e2564[_0x51c3ac(0x33d)]['nodeVers'+_0x51c3ac(0x35f)],_0x12264f=_0x3e2564[_0x51c3ac(0x33d)][_0x51c3ac(0x33d)+_0x51c3ac(0x2ee)],_0x1cf5d8=existsSync(resolveManifestPath(_0x3c9fcf)),_0xbb94ed=runtimeHasRequiredPaths(_0x3c9fcf,_0x32102f),_0x54d57b=_0x32102f[_0x51c3ac(0x1d1)+_0x51c3ac(0x35f)]===_0x424965;!_0x1cf5d8||!_0xbb94ed||!_0x54d57b?(_0x46c4da[_0x51c3ac(0x2de)+'ogger']?.[_0x51c3ac(0x1b3)+'t']?.(_0x51c3ac(0x3e2)+_0x51c3ac(0x2b1)+_0x51c3ac(0x2cc)+'ed',{'runtimeRoot':_0x3c9fcf,'reason':!_0x1cf5d8?'missing\x20'+_0x51c3ac(0x28d):!_0xbb94ed?_0x51c3ac(0x275)+_0x51c3ac(0x3cb)+_0x51c3ac(0x260)+_0x51c3ac(0x400):'node\x20ver'+'sion\x20mis'+_0x51c3ac(0x308),'syncOnly':_0x46c4da[_0x51c3ac(0x1db)]}),_0x32102f=await buildRuntimeBase(_0x3e2564,_0x3c9fcf,_0x32102f),_0x46c4da[_0x51c3ac(0x2de)+_0x51c3ac(0x304)]?.[_0x51c3ac(0x1b3)+'t']?.(_0x51c3ac(0x3e2)+_0x51c3ac(0x2b1)+_0x51c3ac(0x2e4)+_0x51c3ac(0x262),{'manifest':summarizeRuntimeManifest(_0x32102f)})):_0x46c4da[_0x51c3ac(0x2de)+_0x51c3ac(0x304)]?.[_0x51c3ac(0x1b3)+'t']?.('runtime\x20'+'base\x20alr'+_0x51c3ac(0x3a5)+_0x51c3ac(0x15d),{'manifest':summarizeRuntimeManifest(_0x32102f)});if(!existsSync(resolve(_0x3c9fcf,_0x32102f[_0x51c3ac(0x33d)+'Bin']))){const _0x297665=createRuntimeInfoFromManifest(_0x3c9fcf,_0x32102f,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x297665,_0x12264f),_0x32102f[_0x51c3ac(0x33d)+'Version']=_0x12264f;}return _0x32102f;}function runtimeHasRequiredPaths(_0x1fbd29,_0x17c40c){const _0x53f2c0=_0x4cb8b3;return['nodeExec'+'utable',_0x53f2c0(0x2f2),_0x53f2c0(0x33d)+_0x53f2c0(0x1ad)+'ir',_0x53f2c0(0x33d)+'Bin'][_0x53f2c0(0x1ec)](_0x1185ac=>typeof _0x17c40c[_0x1185ac]===_0x53f2c0(0x226)&&_0x17c40c[_0x1185ac][_0x53f2c0(0x396)]())&&[_0x53f2c0(0x2cd)+_0x53f2c0(0x1d7),_0x53f2c0(0x2f2)][_0x53f2c0(0x1ec)](_0x59a7e=>existsSync(resolve(_0x1fbd29,_0x17c40c[_0x59a7e])));}async function buildRuntimeBase(_0x5c511b,_0x3aeaa9,_0x2f8d99={}){const _0x540ad3=_0x4cb8b3,_0x16f232=join(_0x3aeaa9,_0x540ad3(0x39a));await ensureRuntimeNode(_0x5c511b,_0x16f232);const _0x328f03=process[_0x540ad3(0x313)]===_0x540ad3(0x242)?_0x540ad3(0x210)+'e.exe':_0x540ad3(0x1e0)+'/node',_0xfa2c6d=process[_0x540ad3(0x313)]==='win32'?_0x540ad3(0x210)+_0x540ad3(0x198)+_0x540ad3(0x1fd)+_0x540ad3(0x1be)+'i.js':_0x540ad3(0x408)+_0x540ad3(0x1ed)+_0x540ad3(0x20f)+_0x540ad3(0x19a)+'m-cli.js',_0xc96b27={..._0x2f8d99,'generatedAt':new Date()[_0x540ad3(0x174)+_0x540ad3(0x196)](),'nodeVersion':_0x5c511b[_0x540ad3(0x33d)][_0x540ad3(0x1d1)+'ion'],'openclawVersion':_0x2f8d99[_0x540ad3(0x33d)+'Version']||'','platform':process['platform'],'arch':process['arch'],'nodeExecutable':_0x328f03,'npmCli':_0xfa2c6d,'openclawWorkingDir':'openclaw','openclawBin':_0x540ad3(0x33d)+'/opencla'+'w.mjs'};return await writeJson(resolveManifestPath(_0x3aeaa9),_0xc96b27),_0xc96b27;}async function removePathWithRetries(_0x320300){await rm(_0x320300,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}async function ensureRuntimeNode(_0x228222,_0x3f3c73){const _0x588437=_0x4cb8b3,_0x1b4067=_0x228222[_0x588437(0x33d)][_0x588437(0x1d1)+_0x588437(0x35f)],_0x402d37=process[_0x588437(0x313)]===_0x588437(0x242)?join(_0x3f3c73,_0x588437(0x1ee)):join(_0x3f3c73,_0x588437(0x407),'node'),_0x5f0437=process['platform']==='win32'?join(_0x3f3c73,_0x588437(0x2b3)+'ules',_0x588437(0x1e3),_0x588437(0x407),_0x588437(0x1e6)+'js'):join(_0x3f3c73,_0x588437(0x2bb),_0x588437(0x2b3)+_0x588437(0x2ae),'npm',_0x588437(0x407),_0x588437(0x1e6)+'js');if(existsSync(_0x402d37)&&existsSync(_0x5f0437)&&await getNodeVersion(_0x402d37)===_0x1b4067)return;await removePathWithRetries(_0x3f3c73);if(process[_0x588437(0x34b)][_0x588437(0x39a)]===_0x1b4067){await linkCurrentNodeRuntime(_0x3f3c73);return;}await downloadNodeRuntime(_0x1b4067,_0x3f3c73);}async function getNodeVersion(_0x25bd84){const _0x39123e=_0x4cb8b3;try{const _0x3b6f4e=await runProcess(_0x25bd84,['-p',_0x39123e(0x375)+_0x39123e(0x34b)+_0x39123e(0x3f1)],{'label':_0x25bd84+'\x20version','timeoutMs':0x7530});return _0x3b6f4e[_0x39123e(0x33e)][_0x39123e(0x396)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x1828d4){const _0x32d18f=_0x4cb8b3,_0x5185cc=process[_0x32d18f(0x1dd)],_0x1741b8=resolve(dirname(_0x5185cc),'..'),_0x3edc63=process[_0x32d18f(0x313)]===_0x32d18f(0x242)?resolve(_0x1741b8,_0x32d18f(0x2b3)+_0x32d18f(0x1d0)):resolve(_0x1741b8,_0x32d18f(0x3b9)+_0x32d18f(0x3c9)+_0x32d18f(0x279)),_0x3202e1=process[_0x32d18f(0x313)]===_0x32d18f(0x242)?join(_0x1828d4,_0x32d18f(0x1ee)):join(_0x1828d4,_0x32d18f(0x407),_0x32d18f(0x39a)),_0x402749=process[_0x32d18f(0x313)]==='win32'?join(_0x1828d4,_0x32d18f(0x2b3)+'ules','npm'):join(_0x1828d4,_0x32d18f(0x2bb),_0x32d18f(0x2b3)+_0x32d18f(0x2ae),_0x32d18f(0x1e3));await mkdir(dirname(_0x3202e1),{'recursive':!![]}),await mkdir(dirname(_0x402749),{'recursive':!![]}),await symlink(_0x5185cc,_0x3202e1),existsSync(_0x3edc63)?await symlink(_0x3edc63,_0x402749):await symlink(await resolveNpmRoot(),_0x402749);}async function resolveNpmRoot(){const _0x487bfc=_0x4cb8b3,_0x58438d=await runProcess('npm',['root','-g'],{'label':_0x487bfc(0x3eb)+_0x487bfc(0x301),'timeoutMs':0x7530}),_0x23624c=process[_0x487bfc(0x313)]===_0x487bfc(0x242)?_0x58438d[_0x487bfc(0x33e)]['trim']():join(_0x58438d[_0x487bfc(0x33e)][_0x487bfc(0x396)](),_0x487bfc(0x1e3));if(!existsSync(join(_0x23624c,_0x487bfc(0x407),'npm-cli.'+'js')))throw new Error(_0x487bfc(0x406)+_0x487bfc(0x201)+_0x487bfc(0x1cb)+'d\x20for\x20lo'+'cal\x20runt'+_0x487bfc(0x2fe)+_0x487bfc(0x3af)+_0x23624c);return _0x23624c;}async function resolveExtractedNodeRoot(_0x47631b,_0x5bee68){const _0x4b7a6d=_0x4cb8b3,_0x38813a=join(_0x47631b,_0x5bee68);if(existsSync(_0x38813a))return _0x38813a;const _0x104038=await readdir(_0x47631b,{'withFileTypes':!![]}),_0x3a7b07=_0x104038[_0x4b7a6d(0x249)](_0x3828cc=>_0x3828cc[_0x4b7a6d(0x2dd)+'ory']());if(_0x3a7b07[_0x4b7a6d(0x23b)]===0x1)return join(_0x47631b,_0x3a7b07[0x0][_0x4b7a6d(0x388)]);const _0x50d84d=process[_0x4b7a6d(0x313)]===_0x4b7a6d(0x242)?join(_0x47631b,_0x4b7a6d(0x1ee)):join(_0x47631b,_0x4b7a6d(0x407),'node');if(existsSync(_0x50d84d))return _0x47631b;const _0xb14b3c=await findNodeRuntimeRoot(_0x47631b);if(_0xb14b3c)return _0xb14b3c;const _0x58dbec=_0x104038[_0x4b7a6d(0x3d4)](_0x2244d6=>_0x2244d6[_0x4b7a6d(0x388)])['join'](',\x20');throw new Error(_0x4b7a6d(0x1f5)+'d\x20Node\x20r'+_0x4b7a6d(0x341)+_0x4b7a6d(0x257)+'not\x20foun'+_0x4b7a6d(0x3ec)+_0x5bee68+_0x4b7a6d(0x166)+_0x47631b+('.\x20Top-le'+'vel\x20entr'+'ies:\x20')+(_0x58dbec||_0x4b7a6d(0x203)));}function resolveNodeExtractRoot(_0xb607a8,_0x530deb,_0x1b68c7){const _0x200f23=_0x4cb8b3;if(process[_0x200f23(0x313)]!=='win32')return join(_0xb607a8,_0x530deb+(_0x200f23(0x35c)+'-')+process[_0x200f23(0x27c)]+'-'+Date[_0x200f23(0x366)]()+'-'+_0x1b68c7);const _0x52a875=/^[A-Za-z]:[\\/]/[_0x200f23(0x24c)](_0xb607a8),_0x3056ed=parse(_0xb607a8),_0x2523b8=_0x52a875?_0x52a875[0x0][_0x200f23(0x1ac)](0x0,0x2)+'\x5c':_0x3056ed[_0x200f23(0x247)]&&_0x3056ed[_0x200f23(0x247)]!=='/'?_0x3056ed[_0x200f23(0x247)]:_0xb607a8,_0x1baa3c=_0x2523b8['replace'](/[\\/]+$/,'');return _0x1baa3c+'\x5cwjrt-'+process[_0x200f23(0x27c)]+'-'+Date[_0x200f23(0x366)]()+'-'+_0x1b68c7;}async function findNodeRuntimeRoot(_0x398911){const _0x169c87=_0x4cb8b3,_0x24995d=[_0x398911],_0x4659cd=new Set();while(_0x24995d[_0x169c87(0x23b)]>0x0){const _0x1baabf=_0x24995d[_0x169c87(0x1f6)]();if(!_0x1baabf||_0x4659cd[_0x169c87(0x3e5)](_0x1baabf))continue;_0x4659cd[_0x169c87(0x3ad)](_0x1baabf);const _0x5490b0=process[_0x169c87(0x313)]===_0x169c87(0x242)?join(_0x1baabf,_0x169c87(0x1ee)):join(_0x1baabf,_0x169c87(0x407),'node'),_0x40607=process['platform']==='win32'?join(_0x1baabf,_0x169c87(0x2b3)+_0x169c87(0x2ae),'npm',_0x169c87(0x407),_0x169c87(0x1e6)+'js'):join(_0x1baabf,_0x169c87(0x2bb),_0x169c87(0x2b3)+_0x169c87(0x2ae),_0x169c87(0x1e3),_0x169c87(0x407),_0x169c87(0x1e6)+'js');if(existsSync(_0x5490b0)&&existsSync(_0x40607))return _0x1baabf;const _0x3861c9=await readdir(_0x1baabf,{'withFileTypes':!![]});for(const _0x4a6f5d of _0x3861c9){_0x4a6f5d[_0x169c87(0x2dd)+_0x169c87(0x273)]()&&_0x24995d['push'](join(_0x1baabf,_0x4a6f5d[_0x169c87(0x388)]));}}return'';}async function downloadNodeRuntime(_0x138e4d,_0x28891b){const _0x17cb61=_0x4cb8b3,_0x7eeb5=process[_0x17cb61(0x313)]===_0x17cb61(0x242)?_0x17cb61(0x21d):process['platform'],_0x45f384=process['arch']==='x64'?_0x17cb61(0x33b):process[_0x17cb61(0x1ef)]===_0x17cb61(0x35a)?_0x17cb61(0x35a):process[_0x17cb61(0x1ef)],_0x245cb1=process[_0x17cb61(0x313)]==='win32'?_0x17cb61(0x1ba):_0x17cb61(0x325),_0x3fe249='node-v'+_0x138e4d+'-'+_0x7eeb5+'-'+_0x45f384,_0x59c692=_0x3fe249+'.'+_0x245cb1,_0x3bdc58=join(dirname(_0x28891b),_0x17cb61(0x2d5)),_0x46348e=join(_0x3bdc58,_0x59c692),_0x1b91e0=_0x17cb61(0x16d)+_0x17cb61(0x37a)+'rg/dist/'+'v'+_0x138e4d+'/'+_0x59c692;await mkdir(_0x3bdc58,{'recursive':!![]});const _0x42cbc2=resolveNodeExtractRoot(_0x3bdc58,_0x3fe249,0x1);!existsSync(_0x46348e)&&(console['log']('[wujie-s'+_0x17cb61(0x340)+_0x17cb61(0x26f)+_0x17cb61(0x1d3)+'g\x20'+_0x1b91e0),await downloadFile(_0x1b91e0,_0x46348e));await rm(_0x42cbc2,{'recursive':!![],'force':!![]}),await mkdir(_0x42cbc2,{'recursive':!![]});process[_0x17cb61(0x313)]===_0x17cb61(0x242)?await extractZipArchive(_0x46348e,_0x42cbc2,_0x59c692):await runProcess(_0x17cb61(0x2b9),[_0x17cb61(0x2e2),_0x46348e,'-C',_0x42cbc2],{'label':_0x17cb61(0x2ea)+_0x59c692});const _0x4bd8de=await resolveExtractedNodeRoot(_0x42cbc2,_0x3fe249);await mkdir(dirname(_0x28891b),{'recursive':!![]}),await rename(_0x4bd8de,_0x28891b),_0x4bd8de!==_0x42cbc2&&await rm(_0x42cbc2,{'recursive':!![],'force':!![]});}async function extractZipArchive(_0x4f35b9,_0x556d2e,_0x23fe55){const _0xb5f1e=_0x4cb8b3;await runProcess('powershe'+_0xb5f1e(0x183),[_0xb5f1e(0x248)+'le',_0xb5f1e(0x32c)+_0xb5f1e(0x3ab),_0xb5f1e(0x190),'-Command','Expand-A'+_0xb5f1e(0x17e)+_0xb5f1e(0x2c4)+_0xb5f1e(0x2f8)+_0xb5f1e(0x1c3)+_0xb5f1e(0x1e1)+_0xb5f1e(0x1cd)+'stinatio'+_0xb5f1e(0x352)+_0xb5f1e(0x3be)+_0xb5f1e(0x272)+_0xb5f1e(0x18a)+'OOT\x20-For'+'ce'],{'env':{...process.env,'WUJIE_SHELL_ARCHIVE':_0x4f35b9,'WUJIE_SHELL_EXTRACT_ROOT':_0x556d2e},'label':_0xb5f1e(0x2ea)+_0x23fe55});}function _0x8027(){const _0x36fce9=['synced','ced','n\x20outbou','h\x20applie','../../as','JSON:\x20','red\x20Node','manifest','if\x20\x22%OPE',';\x20run\x20wu','\x20is\x20unav','ors\x20bein','ify\x20upst','ack\x20over','pluginSp','createRu','PT_DIR/','.js','?t=','\x22==\x22\x22\x20se','ATH=\x22${O','stderr','ound','ery\x20mirr','toString','wujie-lo','ntime\x20re','channel\x20','time-too','t\x20found','l\x20prepar','try\x20not\x20','ons;\x20ver','--\x20\x22$(di','in\x20runti','\x20applied','flow;\x20ve','allowMis','agentSco','session\x20','ules','ot\x20found','d\x20as\x20gro','base\x20bui','864720BCCBpH','node_mod',',\x20shell.','fix\x20comp','%~dp0\x22','und','function','tar','data','lib','store\x20wr','Invalid\x20','channel-','pipe','LocalSki','prepare\x20','tarball:','atch\x20ski','LiteralP','ibility\x20','sort','plugin\x20s','\x20validat','plugins','me\x20missi','pped;\x20lo','ld\x20start','nodeExec','store-','allback\x20','\x20prepare','FIG_FILE','product\x20','E_NAME%\x22','fy\x20upstr','.cache','with\x20the','nnel','configPa','patch\x20sk','ynced','tch\x20alre','\x20already','isDirect','runtimeL','ATE_DIR:','startsWi','\x20and\x20','-xJf','claw-run','ld\x20compl','plugin\x20r','\x22\x20so\x20the','includes','y:\x20','\x22\x20\x22$SCRI','extract\x20','fallback','ATH:-','values','Version','devDepen','\x20kdocs\x20s','ile\x20not\x20','npmCli','ncies','\x20signal=','led','tests','failed','ath\x20$env','achment\x20','e\x20plugin','\x20doctor\x20','ailable.','being\x20in','ime\x20buil','ady\x20appl','ATE_DIR%','\x20-g','time]\x20in','r\x20OpenCl','ogger','ENCLAW_H','example','NFIG_PAT','match','pplied','untime-b','\x22\x20%*','bridge.m','label','tory\x20pro','nd\x20deliv','pack','mirrors\x20','_DIR%','platform','up\x20sessi','man','x\x20on\x20fut','w-extrac','pped;\x20ru','-peer-de','CONFIG_P','er\x20respo','export\x20O','ader\x20not','npm\x20plug','w.cmd','Name','resolver','chment\x20b','env','--omit=p','tar.xz','&&\x20pwd)','flush','npm\x20inst','rs;\x20veri','oot','href','-Executi','empty\x20pl','shell-ru','pruned\x20r','statusCo','ure\x20upgr','nstalled','referenc','endsWith','log','aw\x202026.','time-bri','OGO\x22\x20];\x20','r\x20@openc','\x22\x20\x22%SCRI','x64','\x20package','openclaw','stdout','nel\x20shap','hell:run','untime\x20r','download','FILE%\x5c','ntime\x20ch','local:','all\x20loca','ackup','ell-runt','leted','dataDirN','versions','fix\x20mark','already-','IPT_DIR=','utbound\x20','toLowerC','ed\x20npm\x20p','nPath\x20$e','time]\x20fe','\x20-z\x20\x22$WU','with\x20cod','chat-dis','\x20id\x20from','esolver\x20','#!/bin/s','arm64','attachme','-extract','ipped;\x20f','ent','ion','tch\x20appl','all\x20','ath','dencies','PENCLAW_','eady\x20app','now','NFIG_FIL','npm-glob','plied','../../sh','%USERPRO','on\x20futur','r\x20runtim','cies','runtime','lled','error','ATH=\x20cd\x20','\x20patch\x20a','ME%\x22==\x22\x22','process.','ons\x20with','pped;\x20fi','null','ime/sess','nodejs.o','\x20summary','generate','replace','ecs','npm-cach','Dependen','oute\x20pat','find','-session','dist','ugin\x20dep','\x20written','385mnnrLl','name','skills','enclaw\x20d','aipc-run','object','\x20return\x20','aw-weixi','ame','ridge.mj','Spec','session-','wujiecla','NCLAW_HO','Version\x20','trim','red','--omit=d','set\x20\x22OPE','node','ayload\x20b','test','LocalAge','\x20found','ot\x20avail','stalling','_shared','utf8','es.','agents','eady\x20cur','in\x20not\x20i','tall\x20the','.json','pe\x20not\x20f','replaceA','onPolicy','nd\x20after','add','installe','d:\x20','.tmp/run','.map','tory\x20mix','base64\x20p','indexOf','n\x20plugin','wBin','>/dev/nu','patched','lib/node','ore\x20pack','ginPaths','Unable\x20t','local\x20pl','nv:WUJIE','ch\x20alrea','ntimeCha','ession\x20r','NCLAW_CO','Claw','\x20outboun','nd\x20helpe','headers','ad\x20patch','\x20resolve','_modules','entryCou','required','t\x20c2c\x20ou','eer','channel.','reason','ed;\x20brid','untime\x20p','shasum','found','map','provider','wujieai.','atch\x20alr','ion\x20mism','all\x20plug','ipped;\x20o','aipc-dow','keys','rname\x20--','wrapper\x20','2hYIWbD','st=','warn','runtime\x20','leName','\x20to\x20dire','has','ipped;\x20r','e\x20upgrad','patch\x20ap','pluginId','timeoutM','npm\x20root','d\x20for\x20','chat\x20his','runtime-','filename','gin\x20not\x20','.node','version','request-','enclaw-w','weixin\x20o','7727390OHlvpb','ugin\x20spe','idated','HOME=\x22${','lugins\x20s','bytes','.d.ts','qqbot\x20ou','d\x20an\x20inv','ect\x20sess','\x20paths','\x20depende','path','ready\x20ap','\x20shape\x20n','\x20create\x20','npm\x20pack','bin','node/lib','\x20mirrors','examples','kill','ntPaths','rent','Bin','out\x20c2c\x20','eixin\x20@i','jection\x20','40732DwkTqT','local','_HOME:-','ujie-log','\x20in\x20','Run\x20\x22wuj','singOpen','if\x20[\x20-t\x20','sion.','bug;\x20ver','==\x22\x22\x20set','https://','fix\x20alre','started','nt-norma','sets/wuj','lite\x20pat','rect\x20pee','toISOStr','cwd','291ONbnvy','cope\x20syn','710cRjeyi','AME=','resume','--fix','skill','116611nAeRMV','rchive\x20-','st\x20be\x20a\x20','pped;\x20di','endencie','er\x20id.','ll.exe','tching\x20p','\x20set\x20\x22OP','join','package-','ct\x20sessi','info','XTRACT_R','unction\x20','product','qqbot','split','\x20local\x20p','Bypass','ng\x20chann','docs','n/opencl','then','plugins\x20','ing','lize-','e_module','s\x20to\x20dir','m/bin/np','\x22\x20from\x20','lock.jso','Configur',';\x20dist\x20n','.tools','agent','und:\x20','rebuilt\x20','location','E_DIR=','PT_DIR/w','isArray','store\x20lo','json','-id\x20head','nt-weixi','bridge\x20n','slice','WorkingD','appId','ime/requ','jie-shel','e\x20tools\x20','--legacy','importan','shape\x20no','\x20product','\x20failed\x20','patch\x20al','\x20can\x20ins','prepareP','zip','octor\x20--','kup','ch\x20skipp','n/npm-cl','sion\x20val','ase64\x20st','installP','runtimeR',':WUJIE_S','tool\x20his','\x20\x22OPENCL','85398EPnehu','ades.','id\x20title','roductRu','NCLAW_ST','not\x20foun','tateDir','HIVE\x20-De','.npmmirr','skipped;','ules/npm','nodeVers','alid\x20pay','wnloadin','node\x20ver','play-pro','\x20request','utable','\x20returne','Duplicat','patch\x20fo','syncOnly','ntime','execPath','tools\x20sy','6\x20chat.s','node/bin','HELL_ARC','lready\x20a','npm','go.mjs','rify\x20ups','npm-cli.','m.wechat','nced','er\x20patch','\x20routing','dataDir','every','/node_mo','node.exe','arch','sessions','solver\x20n','set\x20\x22SCR','3960680wikkin','.opencla','Extracte','shift','60201bzCFUL','tbound\x20f','CLAW_CON','unknown','loader-','extensio','s/npm/bi','lied','ipped;\x20d','s/npm','age\x20was\x20','parse','(empty)','nnel\x20sha','\x20can\x20be\x20','[wujie-s','in\x20insta','SCRIPT_D','@echo\x20of','store-lo','\x22\x20\x22$@\x22','o\x20resolv','ped;\x20cha','kipped;\x20','dules/np','node/nod','push','src','st\x20not\x20f','store\x20sq','agents\x20s','doc','ut\x20after','isFile','dexed\x20wi','director','eam\x20fix\x20','\x20not\x20fou','win','close',':\x20manife','y\x20compat','llPaths','productN','red\x20Open','ted','package.','string','n\x20the\x20di','-doctor.','ie-shell','STATE_DI','--no-aud','pec:\x20','route\x20pa','\x20complet','-xzf','.md','ite\x20patc','nifest=','=\x22${OPEN','or.com','_NAME:-','rcing\x20op','re\x20upgra','ies','tbound\x20d','\x20loaded','length','state-','LocalPlu','transcri','tbound\x20s','nse\x20hook','SIGTERM','win32','Bot\x20c2c\x20','dependen','load:\x20','atch:\x20ma','root','-NoProfi','filter','\x20did\x20not','ing\x20\x22','exec','h\x20alread','config=','outbound','\x20install','ed\x20OpenC','ions/run','\x20on\x20futu','\x20configu','runtimeS','OpenClaw','oot\x20was\x20','catch','atch\x20app','skills\x20s','\x20skipped','ed-tool\x20','y\x20applie','projectR','fix\x20star','\x20runtime','index.mj','eted','law/qqbo','resolved','size','optional','source','ied','prefix\x20i','ed;\x20chan','scripts','JIE_NO_L','.plugin-','vailable','time]\x20do','s\x20not\x20fo','Temporar','_SHELL_E','ory','--json','missing\x20','exec\x20\x22$S','\x20timed\x20o','PT_DIR%','/npm','tream\x20fi','pendenci','pid','des.','\x20patch\x20s','configur','tch\x20skip','est-id/r','ream\x20fix','chat\x20att','\x22%SCRIPT','install'];_0x8027=function(){return _0x36fce9;};return _0x8027();}async function downloadFile(_0x5dbe34,_0x5a66d9){await mkdir(dirname(_0x5a66d9),{'recursive':!![]});const _0x3701ba=await new Promise((_0x3f16bb,_0x3779f6)=>{const _0x55fc54=_0x5af4;get(_0x5dbe34,_0x11c550=>{const _0x6ca26=_0x5af4;if(_0x11c550['statusCo'+'de']>=0x12c&&_0x11c550['statusCo'+'de']<0x190&&_0x11c550['headers'][_0x6ca26(0x1a3)]){_0x11c550[_0x6ca26(0x17a)](),downloadFile(new URL(_0x11c550[_0x6ca26(0x3c6)]['location'],_0x5dbe34)[_0x6ca26(0x32b)],_0x5a66d9)['then'](()=>_0x3f16bb(null))[_0x6ca26(0x258)](_0x3779f6);return;}if(_0x11c550[_0x6ca26(0x330)+'de']!==0xc8){_0x11c550[_0x6ca26(0x17a)](),_0x3779f6(new Error(_0x6ca26(0x342)+'\x20failed\x20'+_0x11c550[_0x6ca26(0x330)+'de']+':\x20'+_0x5dbe34));return;}_0x3f16bb(_0x11c550);})['on'](_0x55fc54(0x371),_0x3779f6);});_0x3701ba&&await pipeline(_0x3701ba,createWriteStream(_0x5a66d9));}export async function ensureOpenClawDoctorFixed(_0x9dff7a,_0x49f642={}){const _0x4eddfb=_0x4cb8b3,_0x50bd4d=await loadRuntimeInfo(_0x9dff7a['projectR'+_0x4eddfb(0x32a)]),_0x3fa20d=getConfigPaths(_0x9dff7a),_0x5a6160=join(_0x3fa20d[_0x4eddfb(0x255)+_0x4eddfb(0x1cc)],_0x4eddfb(0x33d)+_0x4eddfb(0x228)+'json'),_0x3bd0d1=await readJson(_0x5a6160,{});if(_0x3bd0d1['openclaw'+_0x4eddfb(0x2ee)]===_0x50bd4d[_0x4eddfb(0x33d)+'Version'])return _0x49f642['runtimeL'+_0x4eddfb(0x304)]?.[_0x4eddfb(0x189)]('openclaw'+_0x4eddfb(0x2fb)+_0x4eddfb(0x16e)+'ady\x20curr'+_0x4eddfb(0x35e),{'openclawVersion':_0x50bd4d[_0x4eddfb(0x33d)+_0x4eddfb(0x2ee)],'markerPath':_0x5a6160}),{'ran':![],'openclawVersion':_0x50bd4d[_0x4eddfb(0x33d)+_0x4eddfb(0x2ee)],'markerPath':_0x5a6160};return await runOpenClawDoctorFix(_0x9dff7a,_0x50bd4d,{'fromVersion':_0x3bd0d1[_0x4eddfb(0x33d)+_0x4eddfb(0x2ee)]||_0x4eddfb(0x1fa),'toVersion':_0x50bd4d[_0x4eddfb(0x33d)+_0x4eddfb(0x2ee)],'markerPath':_0x5a6160,'runtimeLogger':_0x49f642['runtimeL'+_0x4eddfb(0x304)]}),{'ran':!![],'openclawVersion':_0x50bd4d[_0x4eddfb(0x33d)+_0x4eddfb(0x2ee)],'markerPath':_0x5a6160};}async function runOpenClawDoctorFix(_0x494b10,_0x553eb6,{fromVersion:_0x1d6308,toVersion:_0x373d05,markerPath:markerPath='',runtimeLogger:_0x517062}={}){const _0x5aaff1=_0x4cb8b3;_0x517062?.[_0x5aaff1(0x1b3)+'t']?.('openclaw'+'\x20doctor\x20'+_0x5aaff1(0x25f)+_0x5aaff1(0x224),{'fromVersion':_0x1d6308,'toVersion':_0x373d05});const _0x4ef135=await createRuntimeEnv(_0x553eb6,{'OPENCLAW_HOME':_0x494b10[_0x5aaff1(0x1eb)],'OPENCLAW_STATE_DIR':_0x494b10[_0x5aaff1(0x1eb)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x494b10)[_0x5aaff1(0x2d8)+'th']});console[_0x5aaff1(0x335)](_0x5aaff1(0x206)+'hell:run'+'time]\x20ru'+'nning\x20op'+_0x5aaff1(0x38a)+_0x5aaff1(0x1bb)+'fix');const _0x31907e=await runProcess(_0x553eb6[_0x5aaff1(0x2cd)+_0x5aaff1(0x1d7)],[_0x553eb6['openclaw'+_0x5aaff1(0x15e)],'doctor','--fix'],{'cwd':_0x553eb6[_0x5aaff1(0x33d)+_0x5aaff1(0x1ad)+'ir'],'env':_0x4ef135,'label':_0x5aaff1(0x33d)+_0x5aaff1(0x2fb)+_0x5aaff1(0x17b),'timeoutMs':0x1d4c0});_0x517062?.[_0x5aaff1(0x1b3)+'t']?.(_0x5aaff1(0x33d)+'\x20doctor\x20'+_0x5aaff1(0x2b5)+_0x5aaff1(0x349),{'fromVersion':_0x1d6308,'toVersion':_0x373d05,'stdout':_0x31907e[_0x5aaff1(0x33e)][_0x5aaff1(0x396)]()[_0x5aaff1(0x1ac)](-0xfa0),'stderr':_0x31907e['stderr'][_0x5aaff1(0x396)]()[_0x5aaff1(0x1ac)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x553eb6[_0x5aaff1(0x33d)+_0x5aaff1(0x2ee)],'fixedAt':new Date()[_0x5aaff1(0x174)+'ing']()}),_0x517062?.[_0x5aaff1(0x1b3)+'t']?.('openclaw'+_0x5aaff1(0x2fb)+_0x5aaff1(0x34c)+'er\x20writt'+'en',{'markerPath':markerPath,'openclawVersion':_0x553eb6['openclaw'+_0x5aaff1(0x2ee)]}));}export async function readRuntimeManifest(_0x157de4){return await readJson(resolveManifestPath(_0x157de4),{});}export async function loadRuntimeInfo(_0x7c8391){const _0x4ca235=resolveRuntimeRoot(_0x7c8391),_0x237007=await readRuntimeManifest(_0x4ca235);return createRuntimeInfoFromManifest(_0x4ca235,_0x237007);}function createRuntimeInfoFromManifest(_0x314d11,_0x3ad895,_0x2c8ed1={}){const _0x175ffc=_0x4cb8b3;for(const _0x558a85 of[_0x175ffc(0x2cd)+_0x175ffc(0x1d7),_0x175ffc(0x2f2),_0x175ffc(0x33d)+'WorkingD'+'ir',_0x175ffc(0x33d)+_0x175ffc(0x15e)]){if(typeof _0x3ad895[_0x558a85]!==_0x175ffc(0x226)||!_0x3ad895[_0x558a85][_0x175ffc(0x396)]())throw new Error('runtime\x20'+'manifest'+'\x20is\x20miss'+_0x175ffc(0x24b)+_0x558a85+'\x22\x20at\x20'+resolveManifestPath(_0x314d11)+(_0x175ffc(0x28f)+_0x175ffc(0x1b0)+_0x175ffc(0x2a4)+'e'));}const _0x3100b2=resolve(_0x314d11,_0x3ad895[_0x175ffc(0x2cd)+'utable']),_0x171e81=resolve(_0x314d11,_0x3ad895[_0x175ffc(0x2f2)]),_0xf53cdf=resolve(_0x314d11,_0x3ad895[_0x175ffc(0x33d)+_0x175ffc(0x1ad)+'ir']),_0x31593e=resolve(_0x314d11,_0x3ad895[_0x175ffc(0x33d)+_0x175ffc(0x15e)]),_0x3117e8=Array[_0x175ffc(0x1a6)](_0x3ad895[_0x175ffc(0x2c9)])?_0x3ad895['plugins'][_0x175ffc(0x3d4)](_0x21b23f=>({..._0x21b23f,'installPath':resolve(_0x314d11,_0x21b23f[_0x175ffc(0x1c1)+_0x175ffc(0x362)])})):[],_0x5d1018=_0x2c8ed1[_0x175ffc(0x2ab)+_0x175ffc(0x168)+_0x175ffc(0x3c3)]?[_0x3100b2,_0x171e81]:[_0x3100b2,_0x171e81,_0xf53cdf,_0x31593e];for(const _0x930f76 of _0x5d1018){if(!existsSync(_0x930f76))throw new Error(_0x175ffc(0x3e2)+_0x175ffc(0x275)+'path:\x20'+_0x930f76);}return{'runtimeRoot':_0x314d11,'manifest':_0x3ad895,'openclawVersion':_0x3ad895[_0x175ffc(0x33d)+_0x175ffc(0x2ee)]||_0x175ffc(0x1fa),'nodeExecutable':_0x3100b2,'npmCli':_0x171e81,'openclawWorkingDir':_0xf53cdf,'openclawBin':_0x31593e,'plugins':_0x3117e8};}export async function spawnClaw(_0x48edb4,_0x447579=[],_0x278c66={}){const _0x1194b1=_0x4cb8b3,_0x4bfd19=await loadRuntimeInfo(_0x48edb4),_0x4702d4=await createRuntimeEnv(_0x4bfd19,_0x278c66[_0x1194b1(0x323)]??{});return spawn(_0x4bfd19[_0x1194b1(0x2cd)+_0x1194b1(0x1d7)],[_0x4bfd19[_0x1194b1(0x33d)+'Bin'],..._0x447579],{'cwd':_0x4bfd19[_0x1194b1(0x33d)+'WorkingD'+'ir'],'stdio':'pipe',..._0x278c66,'env':_0x4702d4});}export async function runClawOnce(_0x1addb4,_0x1a85a3=[],_0x1e3b91=0x15f90){const _0x1bcd74=await spawnClaw(_0x1addb4,_0x1a85a3);return await new Promise((_0x4a4075,_0x1596b2)=>{const _0x4867dc=_0x5af4;let _0xdbe743='',_0x57411b='',_0xf3a92c=![];const _0x513d3f=setTimeout(()=>{const _0x34fb5c=_0x5af4;if(_0xf3a92c)return;_0xf3a92c=!![],_0x1bcd74[_0x34fb5c(0x15b)](_0x34fb5c(0x241)),_0x1596b2(new Error(_0x34fb5c(0x33d)+_0x34fb5c(0x277)+_0x34fb5c(0x217)+'\x20'+_0x1e3b91+'ms'));},_0x1e3b91);_0x1bcd74[_0x4867dc(0x33e)]['on'](_0x4867dc(0x2ba),_0x10a152=>{const _0x50c97f=_0x4867dc;_0xdbe743+=_0x10a152[_0x50c97f(0x29e)]();}),_0x1bcd74[_0x4867dc(0x29b)]['on'](_0x4867dc(0x2ba),_0x12ab14=>{_0x57411b+=_0x12ab14['toString']();}),_0x1bcd74['on'](_0x4867dc(0x371),_0x1915a5=>{if(_0xf3a92c)return;_0xf3a92c=!![],clearTimeout(_0x513d3f),_0x1596b2(_0x1915a5);}),_0x1bcd74['on'](_0x4867dc(0x21e),(_0x1935a9,_0x38774a)=>{if(_0xf3a92c)return;_0xf3a92c=!![],clearTimeout(_0x513d3f),_0x4a4075({'code':_0x1935a9,'signal':_0x38774a,'stdout':_0xdbe743,'stderr':_0x57411b});});});}export{resolveRuntimeLarkCliCommand};function resolvePackageNameFromNpmSpec(_0x194709){const _0x1a8384=_0x4cb8b3,_0x285543=_0x194709[_0x1a8384(0x396)]()[_0x1a8384(0x37d)](/^npm:/,'');if(!_0x285543)throw new Error('Invalid\x20'+_0x1a8384(0x32d)+_0x1a8384(0x3f7)+'c');if(_0x285543[_0x1a8384(0x2e0)+'th']('@')){const _0x21b48a=_0x285543['indexOf']('/');if(_0x21b48a===-0x1)throw new Error(_0x1a8384(0x2bd)+'scoped\x20s'+_0x1a8384(0x22c)+_0x194709);const _0x3c9794=_0x285543[_0x1a8384(0x3b4)]('@',_0x21b48a+0x1);return _0x3c9794===-0x1?_0x285543:_0x285543[_0x1a8384(0x1ac)](0x0,_0x3c9794);}const _0x50b7f5=_0x285543[_0x1a8384(0x3b4)]('@');return _0x50b7f5===-0x1?_0x285543:_0x285543[_0x1a8384(0x1ac)](0x0,_0x50b7f5);}async function createRuntimeEnv(_0x10bf8d,_0x79b044={}){const _0x538715=_0x4cb8b3,_0x317ee8=process.env.OPENCLAW_STATE_DIR||'',_0x411791=process.env.NPM_CONFIG_REGISTRY||_0x538715(0x16d)+'registry'+_0x538715(0x1ce)+_0x538715(0x234),_0x3dbe43=_0x317ee8?join(_0x317ee8,_0x538715(0x2e3)+_0x538715(0x2a2)+'ls'):join(_0x10bf8d[_0x538715(0x1c2)+'oot'],_0x538715(0x19f)),_0x49aed0=join(_0x3dbe43,_0x538715(0x368)+'al'),_0xaa0b11=join(_0x3dbe43,_0x538715(0x37f)+'e'),_0x14f245=join(_0x49aed0,_0x538715(0x407));await mkdir(_0x14f245,{'recursive':!![]}),await mkdir(_0xaa0b11,{'recursive':!![]});const _0x257a85=[_0x14f245,dirname(_0x10bf8d[_0x538715(0x2cd)+_0x538715(0x1d7)]),process.env.PATH||''];return{...process.env,..._0x79b044,'PATH':_0x257a85[_0x538715(0x249)](Boolean)[_0x538715(0x186)](delimiter),'npm_config_prefix':_0x49aed0,'NPM_CONFIG_PREFIX':_0x49aed0,'npm_config_cache':_0xaa0b11,'NPM_CONFIG_CACHE':_0xaa0b11,'NPM_CONFIG_REGISTRY':_0x411791,'npm_execpath':_0x10bf8d['npmCli'],'npm_node_execpath':_0x10bf8d[_0x538715(0x2cd)+_0x538715(0x1d7)],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x49aed0,'OPENCLAW_RUNTIME_NPM_BIN':_0x14f245};}export async function getRuntimeSpawnContext(_0x5ce8f2,_0x1a5495={}){const _0x268f9f=_0x4cb8b3,_0x516645=await loadRuntimeInfo(_0x5ce8f2),_0x24462b=await createRuntimeEnv(_0x516645,_0x1a5495);return{'cwd':_0x516645[_0x268f9f(0x33d)+_0x268f9f(0x1ad)+'ir'],'env':_0x24462b,'runtime':_0x516645};}function resolvePluginDirNameFromSpec(_0x17ab10){const _0x36e4c4=_0x4cb8b3,_0x3888dd=resolvePackageNameFromNpmSpec(_0x17ab10),_0x36c030=_0x3888dd['split']('/')[_0x36e4c4(0x249)](Boolean),_0x7036cb=_0x36c030['at'](-0x1)??'';if(!_0x7036cb)throw new Error(_0x36e4c4(0x2bd)+_0x36e4c4(0x2c7)+_0x36e4c4(0x22c)+_0x17ab10);return _0x7036cb;}async function resolvePluginIdFromPackageDir(_0x411586,_0x50ff6e){const _0x23d93f=_0x4cb8b3,_0x2b34d8=await readJson(join(_0x411586,_0x23d93f(0x225)+_0x23d93f(0x1a8)),{}),_0x59a939=await readPluginManifest(_0x411586),_0x55fda2=[_0x59a939?.['id'],_0x59a939?.[_0x23d93f(0x3e9)],_0x59a939?.[_0x23d93f(0x388)],_0x2b34d8?.[_0x23d93f(0x33d)]?.['id'],_0x2b34d8?.[_0x23d93f(0x33d)+'Id'],_0x50ff6e],_0x155531=_0x55fda2[_0x23d93f(0x382)](_0x925522=>typeof _0x925522==='string'&&_0x925522[_0x23d93f(0x396)]());if(!_0x155531)throw new Error(_0x23d93f(0x3bc)+_0x23d93f(0x20c)+_0x23d93f(0x2fa)+_0x23d93f(0x357)+'\x20'+_0x411586);return _0x155531[_0x23d93f(0x396)]();}function pluginSpecMatches(_0x2bf9e9,_0x186d50){const _0x258aae=_0x4cb8b3,_0x5cf0cb=_0x186d50[_0x258aae(0x396)](),_0xe40be4=resolvePackageNameFromNpmSpec(_0x5cf0cb);return[_0x2bf9e9['spec'],_0x2bf9e9[_0x258aae(0x264)+_0x258aae(0x391)],_0x2bf9e9[_0x258aae(0x264)+_0x258aae(0x320)]]['some'](_0x22a93b=>_0x22a93b===_0x5cf0cb||_0x22a93b===_0xe40be4);}async function installPluginFromNpmSpec(_0x1340d2,_0x1859cf,_0x2bb3e7={}){const _0x149425=_0x4cb8b3,_0x17ac19=_0x1340d2['trim']()['replace'](/^npm:/,''),_0x3ddab9=resolvePluginDirNameFromSpec(_0x17ac19),_0xbd374e=join(_0x1859cf[_0x149425(0x33d)+_0x149425(0x1ad)+'ir'],_0x149425(0x384),_0x149425(0x1fc)+'ns'),_0x2317aa=join(_0xbd374e,_0x3ddab9),_0x483f74=join(_0x1859cf['runtimeR'+_0x149425(0x32a)],_0x149425(0x26d)+'extract-'+process[_0x149425(0x27c)]+'-'+Date[_0x149425(0x366)]()),_0x3cb7b6=await createRuntimeEnv(_0x1859cf),_0xc6cd54=new Date()[_0x149425(0x174)+_0x149425(0x196)](),_0x30c83c=join(_0x1859cf[_0x149425(0x1c2)+_0x149425(0x32a)],_0x149425(0x2d5));await mkdir(_0x30c83c,{'recursive':!![]}),await rm(_0x483f74,{'recursive':!![],'force':!![]}),await rm(_0x2317aa,{'recursive':!![],'force':!![]}),await mkdir(_0x483f74,{'recursive':!![]}),await mkdir(_0xbd374e,{'recursive':!![]}),console['log']('[wujie-s'+'hell:run'+_0x149425(0x353)+_0x149425(0x184)+'lugin\x20'+_0x17ac19);const _0x438d43=await runProcess(_0x1859cf['nodeExec'+'utable'],[_0x1859cf[_0x149425(0x2f2)],_0x149425(0x310),_0x17ac19,_0x149425(0x274)],{'cwd':_0x30c83c,'env':_0x3cb7b6,'label':_0x149425(0x406)+'\x20'+_0x17ac19}),_0x21657b=parseNpmPackJson(_0x438d43[_0x149425(0x33e)]),_0x9c674c=normalizePackedTarballFilename(_0x21657b[_0x149425(0x3ef)]),_0x2e0143=join(_0x30c83c,_0x9c674c);if(!existsSync(_0x2e0143))throw new Error(_0x149425(0x406)+_0x149425(0x24a)+_0x149425(0x405)+_0x149425(0x2c2)+'\x20'+_0x2e0143);await runProcess(_0x149425(0x2b9),['-xzf',_0x2e0143,'-C',_0x483f74],{'label':'extract\x20'+_0x9c674c}),await rename(join(_0x483f74,'package'),_0x2317aa),await rm(_0x483f74,{'recursive':!![],'force':!![]});const _0x2c41ec=join(_0x2317aa,'package.'+_0x149425(0x1a8)),_0x31250c=await readJson(_0x2c41ec,{});(_0x31250c['devDepen'+_0x149425(0x363)]||_0x31250c['scripts'])&&(delete _0x31250c[_0x149425(0x2ef)+_0x149425(0x363)],delete _0x31250c[_0x149425(0x26b)],await writeJson(_0x2c41ec,_0x31250c));await runProcess(_0x1859cf[_0x149425(0x2cd)+'utable'],[_0x1859cf[_0x149425(0x2f2)],'install',_0x149425(0x398)+'ev','--omit=p'+_0x149425(0x3cd),'--no-aud'+'it','--no-fun'+'d',_0x149425(0x1b2)+_0x149425(0x319)+'ps'],{'cwd':_0x2317aa,'env':_0x3cb7b6,'label':_0x149425(0x328)+_0x149425(0x3d9)+'in\x20'+_0x17ac19});const _0x584b98=new Date()['toISOStr'+_0x149425(0x196)](),_0x35ea74=await resolvePluginIdFromPackageDir(_0x2317aa,_0x21657b[_0x149425(0x388)]);return _0x2bb3e7[_0x149425(0x2de)+'ogger']?.[_0x149425(0x189)](_0x149425(0x31e)+_0x149425(0x207)+_0x149425(0x370),{'spec':_0x17ac19,'pluginId':_0x35ea74,'installPath':_0x2317aa}),{'pluginId':_0x35ea74,'source':_0x149425(0x1e3),'spec':_0x17ac19,'installPath':toRuntimeRelative(_0x1859cf[_0x149425(0x1c2)+_0x149425(0x32a)],_0x2317aa),'version':_0x21657b[_0x149425(0x3f2)],'resolvedName':_0x21657b['name'],'resolvedVersion':_0x21657b[_0x149425(0x3f2)],'resolvedSpec':_0x21657b[_0x149425(0x388)]+'@'+_0x21657b[_0x149425(0x3f2)],'integrity':typeof _0x21657b['integrit'+'y']===_0x149425(0x226)?_0x21657b['integrit'+'y']:'','shasum':typeof _0x21657b[_0x149425(0x3d2)]==='string'?_0x21657b[_0x149425(0x3d2)]:'','resolvedAt':_0xc6cd54,'installedAt':_0x584b98};}async function syncConfiguredNpmPlugins(_0x52ffe6,_0xb82933,_0x221d3c,_0x454360={}){const _0x5098ad=_0x4cb8b3;if(_0x454360[_0x5098ad(0x1db)])return;const _0x5e2272=createRuntimeInfoFromManifest(_0xb82933,_0x221d3c),_0x39a655=Array[_0x5098ad(0x1a6)](_0x221d3c[_0x5098ad(0x2c9)])?_0x221d3c[_0x5098ad(0x2c9)]:[],_0x3618e8=[];for(const _0x1eee0c of _0x52ffe6['openclaw'][_0x5098ad(0x294)+_0x5098ad(0x37e)]){const _0x56f84a=_0x39a655[_0x5098ad(0x382)](_0x2d27c1=>_0x2d27c1?.[_0x5098ad(0x267)]===_0x5098ad(0x1e3)&&pluginSpecMatches(_0x2d27c1,_0x1eee0c)&&typeof _0x2d27c1[_0x5098ad(0x1c1)+_0x5098ad(0x362)]===_0x5098ad(0x226)&&existsSync(resolve(_0xb82933,_0x2d27c1['installP'+_0x5098ad(0x362)])));if(_0x56f84a){_0x3618e8[_0x5098ad(0x211)](_0x56f84a);continue;}_0x3618e8[_0x5098ad(0x211)](await installPluginFromNpmSpec(_0x1eee0c,_0x5e2272,_0x454360));}const _0x8408d9=new Set(_0x52ffe6[_0x5098ad(0x33d)][_0x5098ad(0x294)+_0x5098ad(0x37e)]['map'](resolvePackageNameFromNpmSpec)),_0x3b7103=_0x39a655[_0x5098ad(0x249)](_0xee7b72=>_0xee7b72?.['source']!==_0x5098ad(0x1e3)||!_0x8408d9[_0x5098ad(0x3e5)](resolvePackageNameFromNpmSpec(_0xee7b72['resolved'+_0x5098ad(0x320)]||_0xee7b72['spec']||'')));_0x221d3c[_0x5098ad(0x2c9)]=[..._0x3b7103,..._0x3618e8];}function hasRuntimeDependencies(_0x511137){const _0x4bf358=_0x4cb8b3,_0x27ffca=_0x511137?.[_0x4bf358(0x244)+'cies']&&typeof _0x511137[_0x4bf358(0x244)+_0x4bf358(0x36e)]===_0x4bf358(0x38c)?Object['keys'](_0x511137[_0x4bf358(0x244)+_0x4bf358(0x36e)]):[],_0x183293=_0x511137?.[_0x4bf358(0x266)+_0x4bf358(0x380)+_0x4bf358(0x36e)]&&typeof _0x511137[_0x4bf358(0x266)+_0x4bf358(0x380)+_0x4bf358(0x36e)]===_0x4bf358(0x38c)?Object[_0x4bf358(0x3dc)](_0x511137['optional'+_0x4bf358(0x380)+_0x4bf358(0x36e)]):[];return _0x27ffca[_0x4bf358(0x23b)]>0x0||_0x183293[_0x4bf358(0x23b)]>0x0;}async function installLocalPluginRuntimeDependencies(_0x5eb99c,_0x81396c,_0x4e3c29){const _0x982704=_0x4cb8b3,_0x56af84=join(_0x5eb99c,'package.'+_0x982704(0x1a8)),_0x587339=await readJson(_0x56af84,{});(_0x587339[_0x982704(0x2ef)+'dencies']||_0x587339[_0x982704(0x26b)])&&(delete _0x587339[_0x982704(0x2ef)+_0x982704(0x363)],delete _0x587339[_0x982704(0x26b)],await writeJson(_0x56af84,_0x587339));if(!hasRuntimeDependencies(_0x587339))return;const _0x1fa555=await createRuntimeEnv(_0x81396c);console['log']('[wujie-s'+'hell:run'+_0x982704(0x302)+'stalling'+_0x982704(0x18f)+'lugin\x20de'+_0x982704(0x27b)+'es\x20'+_0x5eb99c),await runProcess(_0x81396c['nodeExec'+'utable'],[_0x81396c[_0x982704(0x2f2)],'install',_0x982704(0x398)+'ev',_0x982704(0x324)+_0x982704(0x3cd),'--no-aud'+'it','--no-fun'+'d',_0x982704(0x1b2)+_0x982704(0x319)+'ps'],{'cwd':_0x5eb99c,'env':_0x1fa555,'label':_0x982704(0x328)+_0x982704(0x346)+'l\x20plugin'+'\x20'+_0x5eb99c}),_0x4e3c29[_0x982704(0x2de)+_0x982704(0x304)]?.['info'](_0x982704(0x3bd)+_0x982704(0x385)+_0x982704(0x181)+'s\x20instal'+_0x982704(0x2f5),{'installPath':_0x5eb99c});}async function syncSharedPluginModules(_0x49c4df,_0xc8bd02){const _0x550a20=_0x4cb8b3,_0x5a4617=new Set();for(const _0x54fdef of _0x49c4df){const _0x1e7134=join(dirname(_0x54fdef),_0x550a20(0x3a1));if(existsSync(_0x1e7134))_0x5a4617[_0x550a20(0x3ad)](_0x1e7134);}for(const _0x326a8e of _0x5a4617){await copyDirFresh(_0x326a8e,join(_0xc8bd02,_0x550a20(0x3a1)));}}async function syncProductPlugins(_0x5336f2,_0x5119e4,_0x164c3e,_0x3511ba={}){const _0x1205af=_0x4cb8b3,_0x54119b=join(_0x5119e4,_0x1205af(0x33d),_0x1205af(0x384),_0x1205af(0x1fc)+'ns'),_0x56adca=createRuntimeInfoFromManifest(_0x5119e4,_0x164c3e),_0x54f741=[];await syncSharedPluginModules(_0x5336f2[_0x1205af(0x33d)][_0x1205af(0x264)+_0x1205af(0x23d)+_0x1205af(0x3bb)],_0x54119b);for(const _0x597fbe of _0x5336f2[_0x1205af(0x33d)][_0x1205af(0x264)+_0x1205af(0x23d)+_0x1205af(0x3bb)]){const _0x42952a=await getPackageMetadata(_0x597fbe),_0x5e9664=await readPluginManifest(_0x597fbe),_0x200434=join(_0x54119b,_0x42952a[_0x1205af(0x3e9)]);await copyDirFresh(_0x597fbe,_0x200434),await installLocalPluginRuntimeDependencies(_0x200434,_0x56adca,_0x3511ba),_0x54f741['push']({'pluginId':_0x42952a['pluginId'],'source':'local','spec':_0x1205af(0x345)+_0x597fbe,'installPath':toRuntimeRelative(_0x5119e4,_0x200434),'version':_0x42952a['version'],'resolvedName':_0x42952a[_0x1205af(0x388)],'resolvedVersion':_0x42952a['version'],'resolvedSpec':_0x1205af(0x345)+_0x597fbe,'integrity':'','shasum':'','resolvedAt':new Date()[_0x1205af(0x174)+'ing'](),'installedAt':new Date()[_0x1205af(0x174)+_0x1205af(0x196)](),'agentScope':_0x5e9664[_0x1205af(0x2ac)+'pe'],'skills':_0x5e9664['skills']});}const _0x87448e=new Set(_0x54f741['map'](_0x2065b2=>_0x2065b2[_0x1205af(0x3e9)])),_0x1d3e80=Array['isArray'](_0x164c3e[_0x1205af(0x2c9)])?_0x164c3e[_0x1205af(0x2c9)][_0x1205af(0x249)](_0x2b38ce=>!_0x87448e['has'](_0x2b38ce[_0x1205af(0x3e9)])):[];_0x164c3e['plugins']=[..._0x1d3e80,..._0x54f741];}async function syncManifestPluginScope(_0x17f71d,_0xd56829,_0x2bfd1b){const _0x318a8e=_0x4cb8b3,_0x1ba42c=join(_0xd56829,'openclaw',_0x318a8e(0x384),'extensio'+'ns'),_0x3fc3d1=new Set(_0x17f71d[_0x318a8e(0x33d)]['pluginSp'+_0x318a8e(0x37e)]??[]),_0x4e1045=new Set([..._0x3fc3d1][_0x318a8e(0x3d4)](_0x491298=>_0x491298['replace'](/^npm:/,''))['map'](_0x44a652=>{const _0x4ffa3d=_0x318a8e;if(_0x44a652['startsWi'+'th']('@')){const _0x5c721a=_0x44a652[_0x4ffa3d(0x18e)]('@');return _0x5c721a[_0x4ffa3d(0x23b)]>=0x3?'@'+_0x5c721a[0x1]:_0x44a652;}return _0x44a652[_0x4ffa3d(0x18e)]('@')[0x0];})[_0x318a8e(0x249)](Boolean)),_0x598ed4=new Set();for(const _0x44618f of _0x17f71d[_0x318a8e(0x33d)]['resolved'+_0x318a8e(0x23d)+_0x318a8e(0x3bb)]){const _0x4a0f7e=await getPackageMetadata(_0x44618f);if(_0x4a0f7e[_0x318a8e(0x3e9)])_0x598ed4['add'](_0x4a0f7e[_0x318a8e(0x3e9)]);}const _0x4dd3f4=Array[_0x318a8e(0x1a6)](_0x2bfd1b[_0x318a8e(0x2c9)])?_0x2bfd1b[_0x318a8e(0x2c9)]:[];_0x2bfd1b[_0x318a8e(0x294)+'ecs']=[..._0x17f71d[_0x318a8e(0x33d)][_0x318a8e(0x294)+_0x318a8e(0x37e)],..._0x17f71d[_0x318a8e(0x33d)][_0x318a8e(0x264)+_0x318a8e(0x23d)+_0x318a8e(0x3bb)][_0x318a8e(0x3d4)](_0x4a5073=>_0x318a8e(0x345)+_0x4a5073)],_0x2bfd1b[_0x318a8e(0x2c9)]=_0x4dd3f4['filter'](_0x45cb04=>{const _0x1e2d69=_0x318a8e;if(!_0x45cb04||typeof _0x45cb04!==_0x1e2d69(0x38c))return![];if(_0x45cb04[_0x1e2d69(0x267)]===_0x1e2d69(0x163))return _0x598ed4['has'](_0x45cb04[_0x1e2d69(0x3e9)]);if(_0x45cb04[_0x1e2d69(0x267)]==='npm')return _0x3fc3d1[_0x1e2d69(0x3e5)](_0x45cb04['spec'])||_0x3fc3d1[_0x1e2d69(0x3e5)](_0x45cb04[_0x1e2d69(0x264)+_0x1e2d69(0x391)])||_0x4e1045['has'](_0x45cb04[_0x1e2d69(0x264)+_0x1e2d69(0x320)]);return![];});const _0x2e790a=new Set(_0x2bfd1b['plugins'][_0x318a8e(0x3d4)](_0x26c2cc=>_0x26c2cc[_0x318a8e(0x3e9)]));for(const _0x51ab1e of _0x4dd3f4){if(!_0x51ab1e[_0x318a8e(0x3e9)]||_0x2e790a['has'](_0x51ab1e['pluginId']))continue;const _0x6cfdb4=typeof _0x51ab1e[_0x318a8e(0x1c1)+_0x318a8e(0x362)]==='string'&&_0x51ab1e[_0x318a8e(0x1c1)+'ath'][_0x318a8e(0x396)]()?resolve(_0xd56829,_0x51ab1e[_0x318a8e(0x1c1)+_0x318a8e(0x362)]):join(_0x1ba42c,_0x51ab1e[_0x318a8e(0x3e9)]),_0x3cec21=relative(_0x1ba42c,_0x6cfdb4);if(_0x3cec21[_0x318a8e(0x2e0)+'th']('..')||_0x3cec21==='')continue;await rm(_0x6cfdb4,{'recursive':!![],'force':!![]});}}async function collectCapabilityEntries(_0x16ea8d,_0x4a085b){const _0x364f57=_0x4cb8b3,_0x16099f=new Map();for(const _0x39b30e of _0x16ea8d){let _0x2faead;try{_0x2faead=await stat(_0x39b30e);}catch{throw new Error(_0x4a085b+('\x20path\x20wa'+_0x364f57(0x270)+_0x364f57(0x1a1))+_0x39b30e);}if(!_0x2faead[_0x364f57(0x2dd)+_0x364f57(0x273)]())throw new Error(_0x4a085b+('\x20path\x20mu'+_0x364f57(0x17f)+_0x364f57(0x21a)+_0x364f57(0x2e8))+_0x39b30e);const _0x13f5db={'name':basename(_0x39b30e),'path':_0x39b30e},_0x38a6ed=_0x16099f['get'](_0x13f5db[_0x364f57(0x388)]);if(_0x38a6ed)throw new Error(_0x364f57(0x1d9)+'e\x20'+_0x4a085b+'\x20entry\x20\x22'+_0x13f5db[_0x364f57(0x388)]+_0x364f57(0x19b)+_0x38a6ed['path']+_0x364f57(0x2e1)+_0x13f5db['path']);_0x16099f['set'](_0x13f5db[_0x364f57(0x388)],_0x13f5db);}return[..._0x16099f[_0x364f57(0x2ed)]()];}async function syncProductCapabilityDirs(_0x3fb958,_0x409cea,_0x1eeb53){const _0x508c81=_0x4cb8b3,_0x29bc68=await collectCapabilityEntries(_0x3fb958,_0x1eeb53);await rm(_0x409cea,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(_0x409cea,{'recursive':!![]});for(const _0x4366d2 of _0x29bc68){await cp(_0x4366d2[_0x508c81(0x402)],join(_0x409cea,_0x4366d2[_0x508c81(0x388)]),{'recursive':!![]});}return _0x29bc68[_0x508c81(0x23b)];}export const __test__={'collectCapabilityEntries':collectCapabilityEntries,'prunePackagedRuntimePayload':prunePackagedRuntimePayload,'syncProductCapabilityDirs':syncProductCapabilityDirs,'resolveNodeExtractRoot':resolveNodeExtractRoot};async function syncProductAgents(_0x249256,_0x106dbd,_0x3a0dd1){const _0x33d7bd=_0x4cb8b3,_0x6b95d2=join(_0x106dbd,_0x33d7bd(0x33d),_0x33d7bd(0x3a4)),_0x3c4a07=await syncProductCapabilityDirs(_0x249256[_0x33d7bd(0x33d)][_0x33d7bd(0x264)+'LocalAge'+'ntPaths'],_0x6b95d2,_0x33d7bd(0x1a0));_0x3a0dd1[_0x33d7bd(0x3a4)]={'source':_0x33d7bd(0x18c),'installPath':toRuntimeRelative(_0x106dbd,_0x6b95d2),'localPaths':_0x249256[_0x33d7bd(0x33d)]['resolved'+'LocalAge'+_0x33d7bd(0x15c)],'entryCount':_0x3c4a07};}async function syncProductSkills(_0x12a3a9,_0x146ea0,_0x3be411){const _0x19445c=_0x4cb8b3,_0xa732d7=join(_0x146ea0,_0x19445c(0x33d),_0x19445c(0x389)),_0x3d133f=await syncProductCapabilityDirs(_0x12a3a9[_0x19445c(0x33d)]['resolved'+_0x19445c(0x2c0)+_0x19445c(0x221)],_0xa732d7,_0x19445c(0x17c));_0x3be411[_0x19445c(0x389)]={'source':_0x19445c(0x18c),'installPath':toRuntimeRelative(_0x146ea0,_0xa732d7),'localPaths':_0x12a3a9['openclaw'][_0x19445c(0x264)+_0x19445c(0x2c0)+_0x19445c(0x221)],'entryCount':_0x3d133f};}