@wujie-shell/core 1.0.4 → 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
- function _0x4162(_0x3788a3,_0x2fe6a7){_0x3788a3=_0x3788a3-0x173;const _0x14ddeb=_0x14dd();let _0x41621a=_0x14ddeb[_0x3788a3];return _0x41621a;}const _0x472a21=_0x4162;function _0x14dd(){const _0x5ca58d=['d\x20=\x201\x0a\x20\x20','946383Uonnag','_json\x20=\x20','t_run_at','\x20\x20job_id','1048134fHTeTz','nowMs','length','exec',',\x0a\x20\x20\x20\x20\x20\x20','e_kind,\x0a','WorkingD','5iOROeH','chor_ms,','ET\x20enabl','UPDATE\x20c','endsWith','2417724WvAdPz','.sqlite','SELECT\x0a\x20','ROLLBACK','filter','close','message','<=\x20?\x0a\x20\x20\x20','_tz','ed\x20=\x200,\x0a','\x20\x20\x20runti','ron_jobs','e\x20module','_expr','OpenClaw','skip\x20fai','e\x20=\x20\x27tab','\x20\x20\x20\x20\x20\x20st','unning_a','run','\x20\x20\x20state','run_at_m','t_ms\x20=\x20N','HERE\x20typ','BEGIN\x20IM','5180336SHCSpc','\x20running','schedule','master\x20W','E\x20enable','prepare','\x20env','n_at_ms\x20','floor','2205896LgOuPS','info','\x20NULL,\x0a\x20','warn','\x20gateway','.js','sed-run\x20','tz,\x0a\x20\x20\x20\x20','MEDIATE','oot','cron:\x20sk','\x20\x20\x20\x20\x20\x20\x20s','json,\x0a\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20','me_updat','job_id','\x20next_ru','stateDir','tore_key','un_at_ms','\x20start','ipped\x20mi','\x20not\x20fou','\x20IS\x20NOT\x20','ms,\x0a\x20\x20\x20\x20','isFile','\x0a\x20\x20\x20\x20\x20\x20F','store_ke','4477240vlyJTD','\x20\x20\x20\x20\x20run','NULL\x0a\x20\x20\x20','parse','name\x20=\x20?','function','push','logger','enabled,','\x20store_k','\x20\x20\x20\x20\x20AND','ROM\x20cron','next_run','?,\x0a\x20\x20\x20\x20\x20','\x20\x20\x20\x20ever','every','ey\x20=\x20?\x20A','ed_at_ms','S\x20NULL','anchor_m','d\x20=\x20?','cron_job','\x20\x20\x20\x20WHER','abled\x20by','\x20\x20\x20\x20\x20\x20\x20r','16KLxNHn','importan','job_json','y_ms,\x0a\x20\x20','get','_kind','\x20at,\x0a\x20\x20\x20','ULL,\x0a\x20\x20\x20','8nhtVpU','\x20\x20\x20\x20\x20\x20\x20\x20','SELECT\x20n','\x20\x20\x20\x20job_','\x20schedul','\x20sqlite_','ning_at_','\x20\x20\x20WHERE','D\x20next_r','projectR','isFinite','state_js','led','ssed\x20run','ate_json','ND\x20job_i','235215ilAmbO','ET\x20next_','cron\x20mis','_at_ms\x20=','10RtTpaD','\x20\x20\x20\x20\x20\x20AN','\x20=\x20?\x0a\x20\x20\x20','chedule_','stringif'];_0x14dd=function(){return _0x5ca58d;};return _0x14dd();}(function(_0x1ac8f9,_0x1d581d){const _0xd8afc4=_0x4162,_0x42526f=_0x1ac8f9();while(!![]){try{const _0x461eeb=-parseInt(_0xd8afc4(0x183))/0x1*(-parseInt(_0xd8afc4(0x187))/0x2)+-parseInt(_0xd8afc4(0x18d))/0x3*(-parseInt(_0xd8afc4(0x1f4))/0x4)+-parseInt(_0xd8afc4(0x198))/0x5*(-parseInt(_0xd8afc4(0x191))/0x6)+-parseInt(_0xd8afc4(0x1b6))/0x7+parseInt(_0xd8afc4(0x173))/0x8*(-parseInt(_0xd8afc4(0x19d))/0x9)+-parseInt(_0xd8afc4(0x1db))/0xa+-parseInt(_0xd8afc4(0x1bf))/0xb;if(_0x461eeb===_0x1d581d)break;else _0x42526f['push'](_0x42526f['shift']());}catch(_0x3883be){_0x42526f['push'](_0x42526f['shift']());}}}(_0x14dd,0xe9510));import{existsSync}from'node:fs';import{readdir}from'node:fs/promises';import{DatabaseSync}from'node:sqlite';import{join,resolve}from'node:path';import{pathToFileURL}from'node:url';import{asRecord,getTrimmedString}from'../common/utils.mjs';import{loadRuntimeInfo}from'./index.mjs';const CRON_DB_FILE='openclaw'+_0x472a21(0x19e),CRON_TABLE_NAME=_0x472a21(0x1f0)+'s',SCHEDULE_MODULE_PREFIX='schedule'+'-',SCHEDULE_MODULE_SUFFIX=_0x472a21(0x1c4);function toFiniteMs(_0x27d799){const _0x2185a6=_0x472a21,_0x159f21=Number(_0x27d799);return Number[_0x2185a6(0x17d)](_0x159f21)?_0x159f21:undefined;}function safeJsonParse(_0x3b68a0,_0x32b709={}){const _0x351205=_0x472a21;if(typeof _0x3b68a0!=='string'||!_0x3b68a0['trim']())return _0x32b709;try{return JSON[_0x351205(0x1de)](_0x3b68a0);}catch{return _0x32b709;}}function createScheduleFromRow(_0x172646){const _0x3b0844=_0x472a21,_0xa0f320=getTrimmedString(_0x172646[_0x3b0844(0x1b8)+_0x3b0844(0x1f9)]);if(_0xa0f320==='cron'){const _0x458b1c=getTrimmedString(_0x172646[_0x3b0844(0x1b8)+_0x3b0844(0x1aa)]);if(!_0x458b1c)return null;const _0x4b76c6=getTrimmedString(_0x172646[_0x3b0844(0x1b8)+_0x3b0844(0x1a5)]);return{'kind':_0xa0f320,'expr':_0x458b1c,..._0x4b76c6?{'tz':_0x4b76c6}:{}};}if(_0xa0f320===_0x3b0844(0x1ea)){const _0x464e0e=toFiniteMs(_0x172646['every_ms']);if(_0x464e0e===undefined)return null;const _0x3ccb35=toFiniteMs(_0x172646[_0x3b0844(0x1ee)+'s']);return{'kind':_0xa0f320,'everyMs':_0x464e0e,..._0x3ccb35===undefined?{}:{'anchorMs':_0x3ccb35}};}if(_0xa0f320==='at'){const _0x285ed4=getTrimmedString(_0x172646['at']);return _0x285ed4?{'kind':_0xa0f320,'at':_0x285ed4}:null;}return null;}function patchStateJson(_0x4714ef,_0x48dbf2){const _0x3b27a0=_0x472a21,_0x2524c8=asRecord(safeJsonParse(_0x4714ef,{}));return JSON[_0x3b27a0(0x18b)+'y']({..._0x2524c8,'nextRunAtMs':_0x48dbf2,'runningAtMs':undefined});}function patchJobJson(_0xc8d04d,{enabled:_0x5ad7e0,nextRunAtMs:_0x106bdc}){const _0x16f6a3=asRecord(safeJsonParse(_0xc8d04d,{})),_0xfb21d5=asRecord(_0x16f6a3['state']);return JSON['stringif'+'y']({..._0x16f6a3,'enabled':_0x5ad7e0,'state':{..._0xfb21d5,'nextRunAtMs':_0x106bdc,'runningAtMs':undefined}});}async function loadOpenClawScheduleComputer(_0x5e3018){const _0x12e444=_0x472a21,_0xefafdc=resolve(_0x5e3018['openclaw'+_0x12e444(0x197)+'ir'],'dist'),_0x3c642e=await readdir(_0xefafdc,{'withFileTypes':!![]}),_0x5a8612=_0x3c642e[_0x12e444(0x1a1)](_0x58fc7b=>_0x58fc7b[_0x12e444(0x1d8)]())['map'](_0x47d51f=>_0x47d51f['name'])[_0x12e444(0x1a1)](_0x418d9f=>_0x418d9f['startsWi'+'th'](SCHEDULE_MODULE_PREFIX)&&_0x418d9f[_0x12e444(0x19c)](SCHEDULE_MODULE_SUFFIX));for(const _0x1f32b1 of _0x5a8612){const _0x5c40fa=pathToFileURL(join(_0xefafdc,_0x1f32b1))['href'],_0x489b3a=await import(_0x5c40fa);if(typeof _0x489b3a['t']===_0x12e444(0x1e0))return _0x489b3a['t'];}throw new Error(_0x12e444(0x1ab)+_0x12e444(0x177)+_0x12e444(0x1a9)+_0x12e444(0x1d5)+'nd\x20in\x20'+_0xefafdc);}function tableExists(_0x54d4e6){const _0x1a9858=_0x472a21,_0x555efe=_0x54d4e6[_0x1a9858(0x1bb)](_0x1a9858(0x175)+'ame\x20FROM'+_0x1a9858(0x178)+_0x1a9858(0x1b9)+_0x1a9858(0x1b4)+_0x1a9858(0x1ad)+'le\x27\x20AND\x20'+_0x1a9858(0x1df)+'\x20LIMIT\x201')[_0x1a9858(0x1f8)](CRON_TABLE_NAME);return Boolean(_0x555efe);}function readExpiredRows(_0x5d0609,_0x1ad6f8){const _0x582b66=_0x472a21;return _0x5d0609[_0x582b66(0x1bb)](_0x582b66(0x19f)+_0x582b66(0x1ca)+_0x582b66(0x1d1)+_0x582b66(0x195)+_0x582b66(0x190)+_0x582b66(0x195)+'\x20\x20name,\x0a'+_0x582b66(0x174)+_0x582b66(0x1e3)+_0x582b66(0x1cc)+'\x20schedul'+_0x582b66(0x196)+_0x582b66(0x174)+'schedule'+'_expr,\x0a\x20'+_0x582b66(0x1ca)+_0x582b66(0x18a)+_0x582b66(0x1c6)+_0x582b66(0x1e9)+_0x582b66(0x1f7)+'\x20\x20\x20\x20\x20\x20an'+_0x582b66(0x199)+_0x582b66(0x1cc)+_0x582b66(0x1fa)+'\x20\x20\x20\x20\x20nex'+_0x582b66(0x18f)+'_ms,\x0a\x20\x20\x20'+_0x582b66(0x1dc)+_0x582b66(0x179)+_0x582b66(0x1d7)+_0x582b66(0x176)+_0x582b66(0x1cb)+_0x582b66(0x1ae)+_0x582b66(0x181)+_0x582b66(0x1d9)+_0x582b66(0x1e6)+'_jobs\x0a\x20\x20'+_0x582b66(0x1f1)+_0x582b66(0x1ba)+_0x582b66(0x18c)+_0x582b66(0x188)+_0x582b66(0x17b)+_0x582b66(0x1d2)+_0x582b66(0x1d6)+_0x582b66(0x1dd)+_0x582b66(0x1e5)+_0x582b66(0x1cf)+_0x582b66(0x1bd)+_0x582b66(0x1a4)+'\x20\x20\x20\x20\x20AND'+_0x582b66(0x1b7)+'_at_ms\x20I'+_0x582b66(0x1ed))['all'](_0x1ad6f8);}function updateNextRun(_0x86b88a,_0x195d8b,_0x3e3e3a,_0xc11669){const _0x126dcd=_0x472a21;_0x86b88a[_0x126dcd(0x1bb)]('UPDATE\x20c'+_0x126dcd(0x1a8)+'\x0a\x20\x20\x20\x20\x20\x20S'+_0x126dcd(0x184)+_0x126dcd(0x1b2)+'s\x20=\x20?,\x0a\x20'+_0x126dcd(0x1f3)+_0x126dcd(0x1af)+_0x126dcd(0x1b3)+'ULL,\x0a\x20\x20\x20'+'\x20\x20\x20\x20\x20job'+_0x126dcd(0x18e)+'?,\x0a\x20\x20\x20\x20\x20'+_0x126dcd(0x1b1)+_0x126dcd(0x18e)+_0x126dcd(0x1e8)+_0x126dcd(0x1a7)+_0x126dcd(0x1cd)+'ed_at_ms'+'\x20=\x20?\x0a\x20\x20\x20'+_0x126dcd(0x17a)+_0x126dcd(0x1e4)+_0x126dcd(0x1eb)+_0x126dcd(0x182)+_0x126dcd(0x1ef))[_0x126dcd(0x1b0)](_0x3e3e3a,patchJobJson(_0x195d8b[_0x126dcd(0x1f6)],{'enabled':!![],'nextRunAtMs':_0x3e3e3a}),patchStateJson(_0x195d8b[_0x126dcd(0x17e)+'on'],_0x3e3e3a),_0xc11669,_0x195d8b[_0x126dcd(0x1da)+'y'],_0x195d8b[_0x126dcd(0x1ce)]);}function disableExpiredAtRun(_0x310fab,_0x31cd16,_0x4b592d){const _0xc4eb11=_0x472a21;_0x310fab[_0xc4eb11(0x1bb)](_0xc4eb11(0x19b)+_0xc4eb11(0x1a8)+'\x0a\x20\x20\x20\x20\x20\x20S'+_0xc4eb11(0x19a)+_0xc4eb11(0x1a6)+'\x20\x20\x20\x20\x20\x20\x20\x20'+_0xc4eb11(0x1e7)+_0xc4eb11(0x186)+_0xc4eb11(0x1c1)+_0xc4eb11(0x1f3)+'unning_a'+'t_ms\x20=\x20N'+_0xc4eb11(0x1fb)+'\x20\x20\x20\x20\x20job'+_0xc4eb11(0x18e)+_0xc4eb11(0x1e8)+_0xc4eb11(0x1b1)+_0xc4eb11(0x18e)+_0xc4eb11(0x1e8)+_0xc4eb11(0x1a7)+_0xc4eb11(0x1cd)+_0xc4eb11(0x1ec)+_0xc4eb11(0x189)+'\x20\x20\x20WHERE'+_0xc4eb11(0x1e4)+_0xc4eb11(0x1eb)+_0xc4eb11(0x182)+_0xc4eb11(0x1ef))[_0xc4eb11(0x1b0)](patchJobJson(_0x31cd16['job_json'],{'enabled':![],'nextRunAtMs':undefined}),patchStateJson(_0x31cd16[_0xc4eb11(0x17e)+'on'],undefined),_0x4b592d,_0x31cd16[_0xc4eb11(0x1da)+'y'],_0x31cd16[_0xc4eb11(0x1ce)]);}export async function skipMissedCronRunsBeforeGatewayStart(_0x357d1b,_0x233472={}){const _0x4a0f34=_0x472a21;if(process.env.WUJIE_SHELL_SKIP_MISSED_CRON_RUNS==='0')return _0x233472[_0x4a0f34(0x1e2)]?.[_0x4a0f34(0x1c0)]?.({'enabled':![]},_0x4a0f34(0x185)+_0x4a0f34(0x1c5)+'skip\x20dis'+_0x4a0f34(0x1f2)+_0x4a0f34(0x1bc)),{'skipped':0x0,'inspected':0x0,'disabled':!![]};const _0x4eea01=getTrimmedString(_0x233472[_0x4a0f34(0x1d0)])||_0x357d1b['dataDir'],_0x51d502=join(_0x4eea01,'state',CRON_DB_FILE);if(!existsSync(_0x51d502))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x382a73=toFiniteMs(_0x233472[_0x4a0f34(0x192)])??Date['now'](),_0x22cc50=Date['now']();let _0x59d32a;try{_0x59d32a=new DatabaseSync(_0x51d502);if(!tableExists(_0x59d32a))return{'skipped':0x0,'inspected':0x0,'missing':!![]};const _0x7e6afe=readExpiredRows(_0x59d32a,_0x382a73);if(_0x7e6afe[_0x4a0f34(0x193)]===0x0)return{'skipped':0x0,'inspected':0x0};const _0x4afe0a=await loadRuntimeInfo(_0x357d1b[_0x4a0f34(0x17c)+_0x4a0f34(0x1c8)]),_0x339581=await loadOpenClawScheduleComputer(_0x4afe0a);let _0x354576=0x0;const _0x404077=[];_0x59d32a[_0x4a0f34(0x194)](_0x4a0f34(0x1b5)+_0x4a0f34(0x1c7));try{for(const _0x3342f4 of _0x7e6afe){const _0x2f4338=createScheduleFromRow(_0x3342f4);if(!_0x2f4338)continue;let _0x34054d;try{_0x34054d=_0x339581(_0x2f4338,_0x382a73);}catch(_0x260b29){_0x404077[_0x4a0f34(0x1e1)]({'jobId':_0x3342f4[_0x4a0f34(0x1ce)],'message':_0x260b29 instanceof Error?_0x260b29[_0x4a0f34(0x1a3)]:String(_0x260b29)});continue;}if(!Number[_0x4a0f34(0x17d)](_0x34054d)||_0x34054d<=_0x382a73){_0x2f4338['kind']==='at'&&(disableExpiredAtRun(_0x59d32a,_0x3342f4,_0x22cc50),_0x354576+=0x1);continue;}updateNextRun(_0x59d32a,_0x3342f4,Math[_0x4a0f34(0x1be)](_0x34054d),_0x22cc50),_0x354576+=0x1;}_0x59d32a[_0x4a0f34(0x194)]('COMMIT');}catch(_0x2c9f32){_0x59d32a[_0x4a0f34(0x194)](_0x4a0f34(0x1a0));throw _0x2c9f32;}return(_0x354576>0x0||_0x404077[_0x4a0f34(0x193)]>0x0)&&_0x233472[_0x4a0f34(0x1e2)]?.[_0x4a0f34(0x1f5)+'t']?.({'dbPath':_0x51d502,'inspected':_0x7e6afe[_0x4a0f34(0x193)],'skipped':_0x354576,'failures':_0x404077},_0x4a0f34(0x1c9)+_0x4a0f34(0x1d4)+_0x4a0f34(0x180)+'s\x20before'+_0x4a0f34(0x1c3)+_0x4a0f34(0x1d3)),{'skipped':_0x354576,'inspected':_0x7e6afe[_0x4a0f34(0x193)],'failures':_0x404077};}catch(_0x5f5d41){return _0x233472['logger']?.[_0x4a0f34(0x1c2)]?.(_0x4a0f34(0x185)+'sed-run\x20'+_0x4a0f34(0x1ac)+_0x4a0f34(0x17f),{'dbPath':_0x51d502,'error':_0x5f5d41 instanceof Error?_0x5f5d41[_0x4a0f34(0x1a3)]:String(_0x5f5d41)}),{'skipped':0x0,'inspected':0x0,'error':_0x5f5d41};}finally{_0x59d32a?.[_0x4a0f34(0x1a2)]();}}
1
+ 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 _0x44ad8a=_0x537f;(function(_0x27541f,_0x196adf){const _0x3d1055=_0x537f,_0x28bffb=_0x27541f();while(!![]){try{const _0x22d712=-parseInt(_0x3d1055(0x39f))/0x1+parseInt(_0x3d1055(0x153))/0x2+-parseInt(_0x3d1055(0x1a7))/0x3*(parseInt(_0x3d1055(0x335))/0x4)+parseInt(_0x3d1055(0x2c1))/0x5*(parseInt(_0x3d1055(0x1a3))/0x6)+-parseInt(_0x3d1055(0x271))/0x7+parseInt(_0x3d1055(0x289))/0x8*(parseInt(_0x3d1055(0x3b3))/0x9)+parseInt(_0x3d1055(0x347))/0xa;if(_0x22d712===_0x196adf)break;else _0x28bffb['push'](_0x28bffb['shift']());}catch(_0x450ad3){_0x28bffb['push'](_0x28bffb['shift']());}}}(_0x251d,0x582f5));import{existsSync}from'node:fs';import{createWriteStream}from'node:fs';import{chmod,cp,mkdir,readFile,readdir,rename,rm,stat,symlink,writeFile}from'node:fs/promises';import{basename,delimiter,dirname,join,extname,parse,relative,resolve}from'node:path';import{fileURLToPath,pathToFileURL}from'node:url';import{spawn}from'node:child_process';import{get}from'node:https';import{pipeline}from'node:stream/promises';import{getConfigPaths}from'@wujie-shell/config';import{copyDirFresh,getPackageMetadata,readJson,readPluginManifest,toRuntimeRelative,writeJson}from'../common/utils.mjs';import{createRuntimeLogger,summarizeRuntimeManifest,summarizeShellConfig}from'../common/runtime-logger.mjs';import{hasConfiguredKdocsSkill,installKdocsCliBinary}from'../connectors/kdocs-cli.mjs';import{installRuntimeLarkCliPackage,resolveRuntimeLarkCliCommand}from'../connectors/lark-cli.mjs';function _0x251d(){const _0x205e06=['aipc-dow','win32','pluginId','ch\x20skipp','test','stalling','stderr','plugin\x20s','pendenci','export\x20O','found','object','nodejs.o','OPENCLAW','nstalled','close','pipe','[wujie-s','ed;\x20plug','t\x20c2c\x20ou','Claw','nse\x20hook','location','\x20patch\x20s','play-pro','npm-cach','pid','_modules','has','bug;\x20ver','product\x20','tall\x20the','y\x20applie','json','es.','LocalSki','node/nod','generate','spec','dexed\x20wi','Unable\x20t','tching\x20p','ady\x20curr','time]\x20fe','oute\x20pat','d\x20for\x20lo','time','node_mod','pruned\x20r','ibility\x20','\x22\x20\x22%SCRI',':\x20manife','hell:run','unknown','efore\x20pa','exec','--fix','ch\x20alrea','re\x20upgra','ame','npm\x20plug','ies:\x20','--omit=p','createRu','OME=','\x20id\x20from','ath','red\x20Open','director','openclaw','node/lib','nt-weixi','nning\x20op','isFile','oot\x20was\x20','ot\x20found','chat\x20his','st\x20be\x20a\x20','\x20and\x20','tbound\x20d','route\x20pa','n\x20plugin','then','Dependen','href','des.','IR=$(CDP','ache\x20bef','importan','roductRu','agents\x20s','examples',',\x20shell.','mirrors\x20','tar.xz','channel\x20','configur','ons;\x20ver','started','dge.mjs','base\x20bui','4411512tcKdhe','WorkingD','out\x20c2c\x20','path','ced','HOME=\x22${','replaceA','er\x20patch','local:','runtimeR','ad\x20patch','wujie-lo','bridge\x20n','pack','set','doc','package-','\x22\x20from\x20','catch','pped;\x20di','ipped;\x20o','lite\x20pat','bin','-weixin','16XDvcmj','all\x20loca','ies','.npmmirr','\x20product','red\x20Node','\x20request','.json','tateDir','ore\x20pack','solver\x20n','und:\x20','\x20is\x20miss','isDirect','powershe','E_NAME%\x22','npmCli','loader-','_DIR%','outbound','request-','isArray','--no-aud','ipped;\x20r','OGO\x22\x20];\x20','ge\x20not\x20a','\x20did\x20not',':WUJIE_S','est-id/r','nPath\x20$e','src','e\x20plugin','all\x20','exec\x20\x22$S','ase','SIGTERM','rcing\x20QQ','l\x20plugin','being\x20in','\x20failed\x20','time]\x20in','ready\x20ap','statusCo','s\x20to\x20dir','eixin\x20@i','--omit=d','%USERPRO','runtime','untime\x20r','ipped;\x20f','\x20doctor\x20','atch\x20alr','tory\x20pro','1\x20]\x20&&\x20[','ions/run','-extract','1390160mvnkhC','utf8','__tests_','push','-xJf','atch\x20ski','registry','ntime','node\x20ver','indexOf','\x20-g','scripts','und','zip','cwd','/opencla','ILE_NAME','\x20not\x20fou','ld\x20start','\x20path\x20wa','\x20shape\x20n','--no-fun','join','rent','ie-shell','ream\x20fix','t\x20\x22OPENC','t\x20found','set\x20\x22OPE','ime/requ','fy\x20upstr','Bin','qqbot','tch\x20alre','platform','r\x20runtim','ipped;\x20d','\x20mirrors','G_FILE_N','ion','package','\x22\x20so\x20the','package.','lark-cli','st=','weixin\x20o','runtime\x20','age\x20was\x20','\x20resolve','env','startsWi','ent','with\x20cod','enclaw-w','ckaging','ion\x20mism','versions','Bypass','PT_DIR/','\x20create\x20','o.mjs\x22\x202','rchive\x20-','npm\x20inst','projectR','l\x20prepar','ujie-log','ackup','timeoutM','LocalPlu','s/npm','ing\x20\x22','AW_CONFI','\x20prepare','ogger','ntPaths','find','prefix\x20i','sion\x20val','ed;\x20chan','\x20applied','mismatch','\x20already','configFi','manifest','\x20patch\x20a','ed-tool\x20','n\x20outbou','size','scoped\x20s','ery\x20mirr','ignore','process.','allowMis','try\x20not\x20','tbound\x20f','resolved','wujieai.','tarball:','Version','ell-runt','\x20paths','d\x20an\x20inv','jie-shel','eady\x20app','x64','fix','patch\x20fo','warn','stinatio','sort','.tools','ons\x20with','name','npm','\x22\x20%*','-id\x20head','684JFWqmD','in\x20insta','map','skipped;','with\x20the','--legacy','LAW_STAT','dAt','man','tbound\x20s','octor\x20--','atch\x20app','\x20package','/npm','every','--json','\x20set\x20\x22OP','log','11359080kPopWP','\x22\x20\x22$SCRI','qqbot\x20ou','(empty)','headers',';\x20run\x20wu','kup','llPaths','kill\x20not','toISOStr','-Executi','\x20synced','kill','trim','utbound\x20','source','ession\x20r','fallback','e_module','ATH:-','IPT_DIR=','\x20local\x20p','d\x20Node\x20r','sion.','d\x20as\x20gro','eer','jection-','slice','.md','runtimeS','bridge.m','devDepen','session\x20','er\x20id.','arch','../../sh','STATE_DI','ntime\x20ch','ify\x20upst','utable','doctor','.cache','\x22%SCRIPT','PT_DIR/w','https://','agents','referenc','product','m-cli.js','missing\x20','vailable','patched','parse','go.mjs','dataDir','\x20runtime','extract-','HELL_ARC','NCLAW_CO','installe','ped;\x20cha','plied','PT_DIR%','\x20return\x20','ory','.js','resume','dencies','ile\x20not\x20','idated','aw\x202026.','nced','st\x20not\x20f','split','dataDirN','PENCLAW_','able','\x20skipped','provider','leName','.plugin-','ot\x20avail','\x20timed\x20o','ATH=\x22${O','ecs','m.wechat','on\x20futur','Run\x20\x22wuj','482793SuvegB','ntime\x20re','\x20bin\x20was','#!/bin/s','alid\x20pay','-peer-de','\x20signal=','../../as','CLAW_CON','untime\x20c','entryCou','singOpen','wnloadin','ime\x20buil','ed\x20OpenC','lib/node','FILE%\x5c','plugins\x20','patch\x20ap','unction\x20','469188guyzwJ','\x20started','-xzf','fix\x20star','store-lo','pt-path-','n\x20the\x20pe','r\x20@tence','.\x20Top-le','w.mjs','flush','or.com','replace','lready\x20a','configPa','syncOnly','$HOME/','in\x20not\x20i','extensio','ed;\x20brid','data','rcing\x20op','endsWith','execPath','ied','synced','Spec','appId','r\x20id.','ATE_DIR:','red','\x20\x22OPENCL','failed','law/qqbo','%~dp0\x22','wBin','er\x20respo','version','nnel','store\x20lo','shell-ru','tar','6\x20mixed\x20','ions\x20whe','\x20on\x20futu','\x20returne','\x20kdocs\x20s','SCRIPT_D','ME%\x22==\x22\x22','ader\x20not','local\x20pl','ATH=\x20cd\x20','_HOME:-','y:\x20','not\x20foun','ite\x20patc','\x20is\x20unav','nel\x20plug','reason','stdout','integrit','\x20\x22$0\x22)\x22\x20','287564AkGoDB','match','extract\x20','error','ch\x20appli','Version\x20','optional','transcri','\x5cwjrt-','patch\x20sk','nifest=','Invalid\x20','=\x22${OPEN','resolver','chat-dis','ENCLAW_H','ect\x20sess','ed\x20npm\x20p','null','pped;\x20ru','aipc-run','installP','y\x20compat','skills\x20s','nodeVers','patch\x20al','now','store\x20sq','shift','\x20\x20\x22$SCRI','node/bin','npm-cli.','required','6.6\x20chan','NFIG_PAT','ugin\x20spe','ailable.','set\x20\x22SCR','\x22\x20\x22$@\x22','fix\x20alre','toString','\x20depende','NCLAW_ST','lib','node.exe','ad-','channel.','untime-b','path:\x20','local','fix\x20mark','nd\x20after','h\x20applie','enclaw\x20d','rect\x20pee','ules','store\x20wr','r\x20@openc','prepare\x20','endencie','\x20summary','R=\x22${OPE','\x20complet','ors\x20bein','atch:\x20ma','some','dependen','connecto','ing','function','>/dev/nu','e\x20upgrad','\x20written','CONFIG_F','rs;\x20veri','\x20found','ATE_DIR%','d:\x20','root','claw-run','12upchVs','includes','filename','ist\x20not\x20','8172lXvWTi','nd\x20helpe','gin\x20not\x20','w.cmd','@echo\x20of','untime\x20p','ut\x20after','pped;\x20lo','ng\x20chann','Claw\x20ver','node','leted','nodeExec','install','JIE_NO_L','store-','g\x20indexe','session-','rebuilt\x20','/node_mo','index.mj','allback\x20','\x20install','cies','plugin\x20r','runtimeL',';\x20provid','ath\x20$env','kipped;\x20','Name','length','get','skills','eted','\x20can\x20ins','download','_shared','filter','id\x20title','runtime-','already-','r\x20OpenCl','tory\x20mix','empty\x20pl','.d.ts','dist','arm64','string','JSON:\x20','load:\x20','\x20configu','node-v','Extracte','oot','d\x20for\x20','wujiecla','docs','LiteralP','ynced','sets/wuj','npm-glob','plugins','.tmp/run','h\x20alread','e\x20tools\x20','wrapper\x20','ound','ime/sess','aging','add','lugin\x20de','\x20version','channel-','ginPaths','\x20to\x20dire','OOT\x20-For','nnel\x20sha','tests','Temporar','==\x22\x22\x20set','mjs','tch\x20appl','_SHELL_E','nv:WUJIE','el.inbou','pplied','shasum','dy\x20appli','\x20loaded','info','eady\x20cur','pluginSp','n\x20the\x20di','in\x20','jection\x20','npm\x20pack','nd\x20deliv','Configur','ie-logo.','H%\x22==\x22\x22\x20','if\x20\x22%OPE'];_0x251d=function(){return _0x205e06;};return _0x251d();}import{patchMixedToolContentFromSource}from'./patch-chat-history-mixed-tool-content.mjs';import{patchChannelPluginRuntimeFromSource}from'./patch-channel-plugin-runtime.mjs';import{patchProviderRequestIdHeaderFromSource}from'./patch-provider-request-id-header.mjs';import{patchSessionStoreLoadFromSource,patchSessionStoreWriteFromSource}from'./patch-session-store-sqlite.mjs';import{patchQQBotOutboundFallbackFromSource,patchQQBotOutboundSessionRouteFromSource}from'./patch-qqbot-outbound-session-route.mjs';import{patchWeixinOutboundFallbackFromSource,patchWeixinOutboundSessionRouteFromSource}from'./patch-weixin-outbound-session-route.mjs';import{patchRequestIdTitleRuntimeFromSource}from'./patch-request-id-title-runtime.mjs';const RUNTIME_DIR=_0x44ad8a(0x1e5)+_0x44ad8a(0x23a),MANIFEST_NAME=_0x44ad8a(0x1ce)+_0x44ad8a(0x314)+_0x44ad8a(0x290),NPM_INSTALL_TIMEOUT_MS=0xf*0x3c*0x3e8;export function resolveRuntimeRoot(_0x38e5d3){if(process.env.WUJIE_SHELL_RUNTIME_ROOT)return resolve(process.env.WUJIE_SHELL_RUNTIME_ROOT);return resolve(_0x38e5d3,RUNTIME_DIR);}export function resolveManifestPath(_0x5bcc22){return join(_0x5bcc22,MANIFEST_NAME);}async function loadProductRuntime(_0x5b7f81,_0x4ede30){const _0x10669c=_0x44ad8a,_0x5642c2=[join(_0x5b7f81,'shell-ru'+'ntime',_0x10669c(0x1bb)+'s'),join(_0x4ede30,_0x10669c(0x13d)+_0x10669c(0x2c8),'index.mj'+'s')];for(const _0x27ebfe of _0x5642c2){if(!existsSync(_0x27ebfe))continue;return await import(pathToFileURL(_0x27ebfe)[_0x10669c(0x260)]+'?t='+Date['now']());}return{};}export async function prepareRuntime(_0x3e9506,{syncOnly:syncOnly=![],pruneForPackaging:pruneForPackaging=![]}={}){const _0x4a8200=_0x44ad8a,_0x58a3ae=resolveRuntimeRoot(_0x3e9506['projectR'+_0x4a8200(0x1dc)]),_0x26ace8=createRuntimeLogger(getConfigPaths(_0x3e9506),_0x4a8200(0x2b8)),_0x2c38e2=Date[_0x4a8200(0x16d)]();_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x18d)+_0x4a8200(0x2ef)+_0x4a8200(0x26e),{'syncOnly':syncOnly,'runtimeRoot':_0x58a3ae,'shellConfig':summarizeShellConfig(_0x3e9506)});try{const _0x5c2deb=await ensureRuntimeBase(_0x3e9506,_0x58a3ae,{'runtimeLogger':_0x26ace8,'syncOnly':syncOnly});_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x2ef)+_0x4a8200(0x314)+_0x4a8200(0x1ff),{'manifestPath':resolveManifestPath(_0x58a3ae),'manifest':summarizeRuntimeManifest(_0x5c2deb)}),validateRuntimeNodeVersion(_0x5c2deb,_0x3e9506),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x2ef)+_0x4a8200(0x2c9)+_0x4a8200(0x30e)+_0x4a8200(0x38c),{'nodeVersion':_0x5c2deb[_0x4a8200(0x16b)+_0x4a8200(0x2e8)]});if(syncOnly)validateRuntimeOpenClawVersion(_0x5c2deb,_0x3e9506),_0x26ace8?.['importan'+'t']?.('runtime\x20'+_0x4a8200(0x251)+'\x20version'+'\x20validat'+'ed',{'openclawVersion':_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]});else{if(_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]!==_0x3e9506['openclaw'][_0x4a8200(0x251)+_0x4a8200(0x323)]){const _0x5815a8=await loadRuntimeInfo(_0x3e9506['projectR'+_0x4a8200(0x1dc)]);_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x251)+_0x4a8200(0x341)+_0x4a8200(0x1bd)+_0x4a8200(0x3b4),{'fromVersion':_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]||'unknown','toVersion':_0x3e9506[_0x4a8200(0x251)]['openclaw'+_0x4a8200(0x323)]}),await installOpenClawPackage(_0x5815a8,_0x3e9506[_0x4a8200(0x251)][_0x4a8200(0x251)+_0x4a8200(0x323)]),_0x5c2deb[_0x4a8200(0x251)+'Version']=_0x3e9506['openclaw']['openclaw'+_0x4a8200(0x323)],_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x251)+_0x4a8200(0x341)+_0x4a8200(0x1bd)+_0x4a8200(0x191)+'ed',{'openclawVersion':_0x5c2deb[_0x4a8200(0x251)+_0x4a8200(0x323)]});}}_0x5c2deb[_0x4a8200(0x231)+_0x4a8200(0x33c)]=new Date()[_0x4a8200(0x350)+_0x4a8200(0x197)](),_0x5c2deb[_0x4a8200(0x16b)+_0x4a8200(0x2e8)]=_0x3e9506['openclaw'][_0x4a8200(0x16b)+_0x4a8200(0x2e8)],_0x5c2deb[_0x4a8200(0x376)]={'appId':_0x3e9506[_0x4a8200(0x3ce)],'productName':_0x3e9506['productN'+_0x4a8200(0x247)],'dataDirName':_0x3e9506[_0x4a8200(0x391)+_0x4a8200(0x247)]},await patchChatHistoryMixedToolContentBug(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchProviderRequestIdHeader(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchChannelPluginRuntimeBug(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchWeixinOutboundFallbackRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchQQBotOutboundFallbackRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8});const _0x3a2721=await loadProductRuntime(_0x3e9506[_0x4a8200(0x300)+_0x4a8200(0x1dc)],_0x58a3ae);if(typeof _0x3a2721['prepareP'+_0x4a8200(0x265)+'ntime']===_0x4a8200(0x198)){const _0x23900e=createRuntimeInfoFromManifest(_0x58a3ae,_0x5c2deb);await _0x3a2721['prepareP'+'roductRu'+_0x4a8200(0x2c8)]({'shellConfig':_0x3e9506,'runtime':_0x23900e,'runtimeLogger':_0x26ace8,'syncOnly':syncOnly}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x22a)+'runtime\x20'+'tools\x20sy'+_0x4a8200(0x38e));}await patchSessionStoreSqliteRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchRequestIdTitleRuntime(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8});!syncOnly&&(await installRuntimeLarkCliPackage(createRuntimeInfoFromManifest(_0x58a3ae,_0x5c2deb),{'runtimeLogger':_0x26ace8,'createRuntimeEnv':createRuntimeEnv}),_0x26ace8?.['importan'+'t']?.(_0x4a8200(0x2ec)+_0x4a8200(0x37e)+_0x4a8200(0x341)+_0x4a8200(0x352)),await hasConfiguredKdocsSkill(_0x3e9506)?(await installKdocsCliBinary(_0x3e9506,createRuntimeInfoFromManifest(_0x58a3ae,_0x5c2deb),{'runtimeLogger':_0x26ace8,'syncOnly':syncOnly}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x196)+_0x4a8200(0x2e4)+_0x4a8200(0x1e7)+'synced')):_0x26ace8?.[_0x4a8200(0x200)](_0x4a8200(0x196)+_0x4a8200(0x2e4)+_0x4a8200(0x1e7)+_0x4a8200(0x338)+_0x4a8200(0x143)+_0x4a8200(0x34f)+'\x20configu'+_0x4a8200(0x3d1)));const _0xd836ed=Array[_0x4a8200(0x29e)](_0x5c2deb['plugins'])?_0x5c2deb[_0x4a8200(0x1e4)][_0x4a8200(0x1c5)]:0x0;return await syncManifestPluginScope(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x2ef)+'plugin\x20s'+'cope\x20syn'+_0x4a8200(0x275),{'beforePluginCount':_0xd836ed,'afterPluginCount':Array[_0x4a8200(0x29e)](_0x5c2deb['plugins'])?_0x5c2deb[_0x4a8200(0x1e4)]['length']:0x0,'pluginSpecCount':Array[_0x4a8200(0x29e)](_0x5c2deb[_0x4a8200(0x202)+_0x4a8200(0x39b)])?_0x5c2deb[_0x4a8200(0x202)+_0x4a8200(0x39b)][_0x4a8200(0x1c5)]:0x0}),await syncConfiguredNpmPlugins(_0x3e9506,_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8,'syncOnly':syncOnly}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x26c)+_0x4a8200(0x164)+'lugins\x20s'+_0x4a8200(0x1e1),{'pluginSpecCount':_0x3e9506[_0x4a8200(0x251)]['pluginSp'+_0x4a8200(0x39b)][_0x4a8200(0x1c5)],'pluginCount':Array[_0x4a8200(0x29e)](_0x5c2deb[_0x4a8200(0x1e4)])?_0x5c2deb[_0x4a8200(0x1e4)]['length']:0x0}),await patchWeixinOutboundSessionRoute(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await patchQQBotOutboundSessionRoute(_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),await syncProductPlugins(_0x3e9506,_0x58a3ae,_0x5c2deb,{'runtimeLogger':_0x26ace8}),_0x26ace8?.[_0x4a8200(0x264)+'t']?.('product\x20'+_0x4a8200(0x3b0)+_0x4a8200(0x3cc),{'localPluginCount':_0x3e9506[_0x4a8200(0x251)][_0x4a8200(0x320)+_0x4a8200(0x305)+_0x4a8200(0x1f0)]['length'],'pluginCount':Array['isArray'](_0x5c2deb[_0x4a8200(0x1e4)])?_0x5c2deb[_0x4a8200(0x1e4)][_0x4a8200(0x1c5)]:0x0}),await syncProductAgents(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x22a)+_0x4a8200(0x266)+_0x4a8200(0x1e1),{'sources':_0x3e9506[_0x4a8200(0x251)][_0x4a8200(0x320)+'LocalAge'+_0x4a8200(0x30b)],'entryCount':_0x5c2deb[_0x4a8200(0x374)]?.['entryCou'+'nt'],'installPath':_0x5c2deb[_0x4a8200(0x374)]?.['installP'+_0x4a8200(0x24e)]}),await syncProductSkills(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.[_0x4a8200(0x264)+'t']?.(_0x4a8200(0x22a)+_0x4a8200(0x16a)+'ynced',{'sources':_0x3e9506[_0x4a8200(0x251)]['resolved'+_0x4a8200(0x22f)+_0x4a8200(0x34e)],'entryCount':_0x5c2deb[_0x4a8200(0x1c7)]?.[_0x4a8200(0x3a9)+'nt'],'installPath':_0x5c2deb[_0x4a8200(0x1c7)]?.['installP'+_0x4a8200(0x24e)]}),await syncRuntimeWrapper(_0x3e9506,_0x58a3ae,_0x5c2deb),_0x26ace8?.['importan'+'t']?.(_0x4a8200(0x2ef)+_0x4a8200(0x1e8)+_0x4a8200(0x3cc),{'wujieclawBin':_0x5c2deb[_0x4a8200(0x1de)+_0x4a8200(0x3d6)]}),await prunePackagedRuntimeCaches(_0x58a3ae,_0x26ace8),pruneForPackaging&&await prunePackagedRuntimePayload(_0x58a3ae,_0x5c2deb,_0x26ace8),await writeJson(resolveManifestPath(_0x58a3ae),_0x5c2deb),_0x26ace8?.['importan'+'t']?.(_0x4a8200(0x2ef)+'manifest'+_0x4a8200(0x19b),{'manifestPath':resolveManifestPath(_0x58a3ae),'manifest':summarizeRuntimeManifest(_0x5c2deb),'durationMs':Date[_0x4a8200(0x16d)]()-_0x2c38e2}),await _0x26ace8?.[_0x4a8200(0x3bd)](),_0x5c2deb;}catch(_0x16b109){_0x26ace8?.[_0x4a8200(0x156)]('prepare\x20'+_0x4a8200(0x2ef)+_0x4a8200(0x3d3),{'syncOnly':syncOnly,'runtimeRoot':_0x58a3ae,'durationMs':Date[_0x4a8200(0x16d)]()-_0x2c38e2,'error':_0x16b109}),await _0x26ace8?.[_0x4a8200(0x3bd)]();throw _0x16b109;}}async function prunePackagedRuntimeCaches(_0x315397,_0x492563){const _0x484700=_0x44ad8a,_0x2c1cb2=[join(_0x315397,_0x484700(0x370)),join(_0x315397,_0x484700(0x32f),'npm-cach'+'e'),join(_0x315397,_0x484700(0x167)+'time-bac'+_0x484700(0x34d)),join(_0x315397,_0x484700(0x20c)+'nloads-b'+_0x484700(0x303))];for(const _0xb983c8 of _0x2c1cb2){if(!existsSync(_0xb983c8))continue;await rm(_0xb983c8,{'recursive':!![],'force':!![]}),_0x492563?.[_0x484700(0x200)](_0x484700(0x23c)+_0x484700(0x3a8)+_0x484700(0x263)+_0x484700(0x292)+_0x484700(0x1eb),{'cachePath':_0xb983c8});}}async function prunePackagedRuntimePayload(_0x3740be,_0x5282c9,_0x298c17){const _0x2422fc=_0x44ad8a,_0x5af0f4=createRuntimeInfoFromManifest(_0x3740be,_0x5282c9),_0x5643aa=[join(_0x3740be,process[_0x2422fc(0x2e3)]===_0x2422fc(0x20d)?'node/nod'+_0x2422fc(0x359)+_0x2422fc(0x306):_0x2422fc(0x252)+_0x2422fc(0x1ba)+'dules/np'+'m'),join(_0x5af0f4[_0x2422fc(0x251)+_0x2422fc(0x272)+'ir'],_0x2422fc(0x23b)+_0x2422fc(0x18a))],_0x4d5ed5=join(_0x5af0f4[_0x2422fc(0x251)+_0x2422fc(0x272)+'ir'],'dist',_0x2422fc(0x3c5)+'ns');if(existsSync(_0x4d5ed5))for(const _0x4ac492 of await readdir(_0x4d5ed5,{'withFileTypes':!![]})){_0x4ac492[_0x2422fc(0x296)+'ory']()&&_0x5643aa['push'](join(_0x4d5ed5,_0x4ac492[_0x2422fc(0x331)],_0x2422fc(0x23b)+_0x2422fc(0x18a)));}const _0x18f893={'files':0x0,'directories':0x0,'bytes':0x0};for(const _0x49634e of _0x5643aa){await pruneRuntimeDependencyTree(_0x49634e,_0x18f893);}await pruneOpenClawDocs(_0x5af0f4['openclaw'+'WorkingD'+'ir'],_0x18f893),_0x298c17?.[_0x2422fc(0x200)](_0x2422fc(0x23c)+_0x2422fc(0x1ac)+'ayload\x20b'+_0x2422fc(0x242)+_0x2422fc(0x2f7),_0x18f893);}async function pruneOpenClawDocs(_0x4726c0,_0x2c9872){const _0x37ac82=_0x44ad8a,_0x17bbcd=join(_0x4726c0,_0x37ac82(0x1df));if(!existsSync(_0x17bbcd))return;for(const _0x25c2af of await readdir(_0x17bbcd,{'withFileTypes':!![]})){if(_0x25c2af[_0x37ac82(0x331)]===_0x37ac82(0x375)+'e')continue;await removePrunedPath(join(_0x17bbcd,_0x25c2af[_0x37ac82(0x331)]),_0x2c9872);}}async function pruneRuntimeDependencyTree(_0x1dc04d,_0x56c621){const _0x361c2b=_0x44ad8a;if(!existsSync(_0x1dc04d))return;for(const _0x148fa8 of await readdir(_0x1dc04d,{'withFileTypes':!![]})){const _0x575057=join(_0x1dc04d,_0x148fa8[_0x361c2b(0x331)]);if(_0x148fa8[_0x361c2b(0x296)+_0x361c2b(0x387)]()){if(shouldPruneRuntimeDirectory(_0x1dc04d,_0x148fa8['name'])){await removePrunedPath(_0x575057,_0x56c621);continue;}await pruneRuntimeDependencyTree(_0x575057,_0x56c621);continue;}_0x148fa8['isFile']()&&shouldPruneRuntimeFile(_0x148fa8[_0x361c2b(0x331)])&&await removePrunedPath(_0x575057,_0x56c621);}}function shouldPruneRuntimeDirectory(_0x260f7e,_0x3af44d){const _0x2966f1=_0x44ad8a;if(_0x3af44d==='@types')return!![];if(new Set([_0x2966f1(0x280),_0x2966f1(0x1df),_0x2966f1(0x33d)])[_0x2966f1(0x228)](_0x3af44d))return existsSync(join(_0x260f7e,_0x2966f1(0x2eb)+_0x2966f1(0x22d)));return new Set([_0x2966f1(0x2c3)+'_','example',_0x2966f1(0x267),_0x2966f1(0x210),_0x2966f1(0x1f4)])['has'](_0x3af44d);}function shouldPruneRuntimeFile(_0x45eb44){const _0x5f1645=_0x44ad8a;if(_0x45eb44===_0x5f1645(0x281)+'lock.jso'+'n'||_0x45eb44[_0x5f1645(0x3c9)](_0x5f1645(0x1d3)))return!![];return new Set(['.map',_0x5f1645(0x363),'.markdow'+'n'])[_0x5f1645(0x228)](extname(_0x45eb44)['toLowerC'+_0x5f1645(0x2ab)]());}async function removePrunedPath(_0x309fc0,_0x58a51c){const _0x132e9c=_0x44ad8a;if(!existsSync(_0x309fc0))return;const _0x513b56=await getPathSize(_0x309fc0),_0x2a14c9=await stat(_0x309fc0);await rm(_0x309fc0,{'recursive':!![],'force':!![]}),_0x58a51c['bytes']+=_0x513b56;if(_0x2a14c9[_0x132e9c(0x296)+_0x132e9c(0x387)]())_0x58a51c[_0x132e9c(0x250)+_0x132e9c(0x28b)]+=0x1;else _0x58a51c['files']+=0x1;}async function getPathSize(_0x2450e8){const _0x64573d=_0x44ad8a,_0x4d38cb=await stat(_0x2450e8);if(!_0x4d38cb[_0x64573d(0x296)+_0x64573d(0x387)]())return _0x4d38cb[_0x64573d(0x318)];let _0x1e2f98=0x0;for(const _0x3e8ee8 of await readdir(_0x2450e8,{'withFileTypes':!![]})){_0x1e2f98+=await getPathSize(join(_0x2450e8,_0x3e8ee8[_0x64573d(0x331)]));}return _0x1e2f98;}function _0x537f(_0xd3c41f,_0x44cc64){_0xd3c41f=_0xd3c41f-0x139;const _0x251da2=_0x251d();let _0x537fd3=_0x251da2[_0xd3c41f];return _0x537fd3;}async function syncRuntimeWrapper(_0x307d56,_0x1b4870,_0x3c50bd){const _0x336ffa=_0x44ad8a,_0x1e5f84=_0x307d56[_0x336ffa(0x251)]?.[_0x336ffa(0x313)+_0x336ffa(0x396)]??_0x336ffa(0x321)+_0x336ffa(0x22d),_0x1cd4b1=join(_0x1b4870,_0x336ffa(0x287),'wujiecla'+'w'),_0x3fa152=join(_0x1b4870,_0x336ffa(0x287),_0x336ffa(0x1de)+_0x336ffa(0x1aa)),_0x388e11=normalizeRuntimeRelativePath(relative(dirname(_0x1cd4b1),resolve(_0x1b4870,_0x3c50bd[_0x336ffa(0x1b3)+_0x336ffa(0x36e)]))),_0x4915ed=normalizeRuntimeRelativePath(relative(dirname(_0x1cd4b1),resolve(_0x1b4870,_0x3c50bd[_0x336ffa(0x251)+_0x336ffa(0x2e0)]))),_0x1fb753=_0x336ffa(0x3c3)+_0x307d56[_0x336ffa(0x391)+_0x336ffa(0x247)],_0x2fba98=_0x336ffa(0x2b7)+_0x336ffa(0x3af)+_0x307d56[_0x336ffa(0x391)+_0x336ffa(0x247)];await mkdir(dirname(_0x1cd4b1),{'recursive':!![]});const _0x2bc254=fileURLToPath(new URL(_0x336ffa(0x3a6)+_0x336ffa(0x1e2)+_0x336ffa(0x209)+_0x336ffa(0x1f7),import.meta.url)),_0x11ffdf=join(_0x1b4870,_0x336ffa(0x287),_0x336ffa(0x27c)+_0x336ffa(0x37c));await cp(_0x2bc254,_0x11ffdf),await writeFile(_0x1cd4b1,[_0x336ffa(0x3a2)+'h','export\x20O'+'PENCLAW_'+_0x336ffa(0x276)+_0x336ffa(0x219)+_0x336ffa(0x149)+_0x1fb753+'}\x22','export\x20O'+_0x336ffa(0x392)+_0x336ffa(0x36b)+_0x336ffa(0x190)+_0x336ffa(0x17d)+_0x336ffa(0x3d0)+'-'+_0x1fb753+'}\x22',_0x336ffa(0x215)+_0x336ffa(0x392)+_0x336ffa(0x19c)+_0x336ffa(0x2d1)+_0x336ffa(0x15f)+_0x336ffa(0x3a7)+'FIG_FILE'+'_NAME:-'+_0x1e5f84+'}\x22',_0x336ffa(0x215)+_0x336ffa(0x392)+'CONFIG_P'+_0x336ffa(0x39a)+_0x336ffa(0x392)+'CONFIG_P'+_0x336ffa(0x35a)+_0x1fb753+'/'+_0x1e5f84+'}\x22',_0x336ffa(0x144)+_0x336ffa(0x262)+_0x336ffa(0x148)+'--\x20\x22$(di'+'rname\x20--'+_0x336ffa(0x152)+'&&\x20pwd)','if\x20[\x20-t\x20'+_0x336ffa(0x2be)+'\x20-z\x20\x22$WU'+_0x336ffa(0x1b5)+_0x336ffa(0x2a1)+_0x336ffa(0x25e),_0x336ffa(0x170)+'PT_DIR/'+_0x388e11+('\x22\x20\x22$SCRI'+_0x336ffa(0x372)+_0x336ffa(0x302)+_0x336ffa(0x2fd)+_0x336ffa(0x199)+'ll\x20||\x20tr'+'ue'),'fi',_0x336ffa(0x2aa)+'CRIPT_DI'+'R/'+_0x388e11+(_0x336ffa(0x348)+_0x336ffa(0x2fb))+_0x4915ed+_0x336ffa(0x179),''][_0x336ffa(0x2d7)]('\x0a'),'utf8'),await chmod(_0x1cd4b1,0x1ed),await writeFile(_0x3fa152,[_0x336ffa(0x1ab)+'f','if\x20\x22%OPE'+'NCLAW_HO'+_0x336ffa(0x145)+_0x336ffa(0x345)+_0x336ffa(0x162)+_0x336ffa(0x24c)+_0x2fba98+'\x22',_0x336ffa(0x20b)+_0x336ffa(0x17d)+_0x336ffa(0x19f)+'\x22==\x22\x22\x20se'+_0x336ffa(0x2db)+_0x336ffa(0x33b)+'E_DIR='+_0x2fba98+'\x22','if\x20\x22%OPE'+_0x336ffa(0x381)+'NFIG_FIL'+_0x336ffa(0x298)+_0x336ffa(0x1f6)+_0x336ffa(0x3d2)+_0x336ffa(0x308)+_0x336ffa(0x2e7)+'AME='+_0x1e5f84+'\x22','if\x20\x22%OPE'+'NCLAW_CO'+'NFIG_PAT'+_0x336ffa(0x20a)+_0x336ffa(0x2dd)+_0x336ffa(0x381)+_0x336ffa(0x175)+'H='+_0x2fba98+'\x5c'+_0x1e5f84+'\x22',_0x336ffa(0x178)+_0x336ffa(0x35b)+_0x336ffa(0x3d5),_0x336ffa(0x371)+_0x336ffa(0x29b)+toWindowsPath(_0x388e11)+(_0x336ffa(0x23e)+_0x336ffa(0x385))+toWindowsPath(_0x4915ed)+_0x336ffa(0x333),''][_0x336ffa(0x2d7)]('\x0d\x0a'),'utf8'),_0x3c50bd[_0x336ffa(0x1de)+_0x336ffa(0x3d6)]=toRuntimeRelative(_0x1b4870,process[_0x336ffa(0x2e3)]===_0x336ffa(0x20d)?_0x3fa152:_0x1cd4b1);}async function patchChatHistoryMixedToolContentBug(_0x4ea4cb,_0x5644ac,_0x439a16={}){const _0x3f515d=_0x44ad8a,_0x2257fc=resolve(_0x4ea4cb,_0x5644ac['openclaw'+_0x3f515d(0x272)+'ir']),_0x15031d=join(_0x2257fc,_0x3f515d(0x1d4));let _0x142fac=[];try{_0x142fac=await readdir(_0x15031d,{'withFileTypes':!![]});}catch{_0x439a16[_0x3f515d(0x1c0)+_0x3f515d(0x30a)]?.[_0x3f515d(0x32c)]?.('chat\x20his'+'tory\x20mix'+_0x3f515d(0x316)+_0x3f515d(0x15c)+_0x3f515d(0x2e5)+_0x3f515d(0x1a6)+_0x3f515d(0x216),{'distDir':_0x15031d,'openclawVersion':_0x5644ac[_0x3f515d(0x251)+_0x3f515d(0x323)]});return;}const _0x1ca14e=_0x142fac[_0x3f515d(0x1cc)](_0xbb77dd=>_0xbb77dd[_0x3f515d(0x255)]()&&(_0xbb77dd[_0x3f515d(0x331)]['startsWi'+'th'](_0x3f515d(0x161)+_0x3f515d(0x224)+_0x3f515d(0x361))||_0xbb77dd[_0x3f515d(0x331)][_0x3f515d(0x2f3)+'th'](_0x3f515d(0x1b8)+_0x3f515d(0x15a)+_0x3f515d(0x3b8)))&&_0xbb77dd[_0x3f515d(0x331)][_0x3f515d(0x3c9)](_0x3f515d(0x388)))[_0x3f515d(0x337)](_0x5dcda8=>join(_0x15031d,_0x5dcda8[_0x3f515d(0x331)]));if(_0x1ca14e[_0x3f515d(0x1c5)]===0x0){_0x439a16[_0x3f515d(0x1c0)+'ogger']?.[_0x3f515d(0x32c)]?.(_0x3f515d(0x258)+_0x3f515d(0x1d1)+_0x3f515d(0x316)+_0x3f515d(0x15c)+_0x3f515d(0x2ba)+_0x3f515d(0x38b)+'found',{'openclawVersion':_0x5644ac[_0x3f515d(0x251)+_0x3f515d(0x323)]});return;}for(const _0x4bd685 of _0x1ca14e){const _0xd68a34=await readFile(_0x4bd685,_0x3f515d(0x2c2)),_0x406408=patchMixedToolContentFromSource(_0xd68a34);if(!_0x406408[_0x3f515d(0x37a)]){if(_0x406408[_0x3f515d(0x14f)]===_0x3f515d(0x1cf)+_0x3f515d(0x37a)){_0x439a16[_0x3f515d(0x1c0)+_0x3f515d(0x30a)]?.[_0x3f515d(0x200)]?.('chat\x20his'+_0x3f515d(0x1d1)+'ed-tool\x20'+_0x3f515d(0x16c)+_0x3f515d(0x2b2)+'plied',{'openclawVersion':_0x5644ac['openclaw'+'Version'],'filePath':_0x4bd685});return;}continue;}await writeFile(_0x4bd685,_0x406408[_0x3f515d(0x356)],'utf8'),_0x439a16[_0x3f515d(0x1c0)+'ogger']?.['info']?.('chat\x20his'+_0x3f515d(0x1d1)+_0x3f515d(0x316)+_0x3f515d(0x3b1)+_0x3f515d(0x384),{'openclawVersion':_0x5644ac[_0x3f515d(0x251)+_0x3f515d(0x323)],'filePath':_0x4bd685,'note':_0x3f515d(0x1f5)+'y\x20compat'+_0x3f515d(0x23d)+_0x3f515d(0x32b)+'r\x20OpenCl'+_0x3f515d(0x38d)+_0x3f515d(0x13f)+'tool\x20his'+_0x3f515d(0x2bd)+_0x3f515d(0x205)+_0x3f515d(0x229)+'ify\x20upst'+'ream\x20fix'+_0x3f515d(0x141)+_0x3f515d(0x246)+_0x3f515d(0x261)});return;}_0x439a16['runtimeL'+'ogger']?.['warn']?.('chat\x20his'+_0x3f515d(0x1d1)+_0x3f515d(0x316)+_0x3f515d(0x15c)+_0x3f515d(0x2ba)+_0x3f515d(0x3b2)+_0x3f515d(0x14b)+'d',{'openclawVersion':_0x5644ac['openclaw'+_0x3f515d(0x323)]});}async function patchProviderRequestIdHeader(_0x585100,_0x99851,_0x5122c4={}){const _0x254210=_0x44ad8a,_0x4e1224=resolve(_0x585100,_0x99851['openclaw'+_0x254210(0x272)+'ir']),_0x4098e2=join(_0x4e1224,'dist');let _0xd6cf79=[];try{_0xd6cf79=await readdir(_0x4098e2,{'withFileTypes':!![]});}catch{_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x32c)]?.(_0x254210(0x395)+_0x254210(0x28f)+_0x254210(0x334)+_0x254210(0x278)+_0x254210(0x394)+';\x20dist\x20n'+_0x254210(0x257),{'distDir':_0x4098e2,'openclawVersion':_0x99851['openclaw'+_0x254210(0x323)]});return;}const _0x3b97ef=_0xd6cf79[_0x254210(0x1cc)](_0x41283b=>_0x41283b[_0x254210(0x255)]()&&_0x41283b[_0x254210(0x331)]['endsWith'](_0x254210(0x388)))[_0x254210(0x337)](_0x43044c=>join(_0x4098e2,_0x43044c['name']));let _0x2df2a0=0x0,_0x3351a0=0x0;for(const _0x1f9f27 of _0x3b97ef){const _0x58ed74=await readFile(_0x1f9f27,_0x254210(0x2c2)),_0x1b57c0=patchProviderRequestIdHeaderFromSource(_0x58ed74);if(_0x1b57c0[_0x254210(0x37a)]){await writeFile(_0x1f9f27,_0x1b57c0[_0x254210(0x356)],_0x254210(0x2c2)),_0x2df2a0+=0x1,_0x5122c4[_0x254210(0x1c0)+'ogger']?.[_0x254210(0x200)]?.(_0x254210(0x395)+_0x254210(0x28f)+'-id\x20head'+_0x254210(0x278)+_0x254210(0x310),{'openclawVersion':_0x99851['openclaw'+_0x254210(0x323)],'filePath':_0x1f9f27});continue;}if(_0x1b57c0[_0x254210(0x14f)]==='already-'+_0x254210(0x37a))_0x3351a0+=0x1;}if(_0x2df2a0>0x0){_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x200)]?.(_0x254210(0x395)+_0x254210(0x28f)+_0x254210(0x334)+_0x254210(0x278)+_0x254210(0x18f),{'openclawVersion':_0x99851[_0x254210(0x251)+_0x254210(0x323)],'patchedCount':_0x2df2a0,'alreadyPatchedCount':_0x3351a0});return;}if(_0x3351a0>0x0){_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x200)]?.(_0x254210(0x395)+_0x254210(0x28f)+'-id\x20head'+'er\x20patch'+_0x254210(0x312)+_0x254210(0x310),{'openclawVersion':_0x99851[_0x254210(0x251)+'Version'],'alreadyPatchedCount':_0x3351a0});return;}_0x5122c4[_0x254210(0x1c0)+_0x254210(0x30a)]?.[_0x254210(0x32c)]?.(_0x254210(0x395)+_0x254210(0x28f)+'-id\x20head'+_0x254210(0x278)+_0x254210(0x394)+_0x254210(0x1c1)+_0x254210(0x139)+_0x254210(0x221)+_0x254210(0x2d2)+'nd',{'openclawVersion':_0x99851[_0x254210(0x251)+_0x254210(0x323)]});}async function patchChannelPluginRuntimeBug(_0x326dcf,_0x2233c1,_0x10c0af={}){const _0x50ddfc=_0x44ad8a,_0xaf3e5e=resolve(_0x326dcf,_0x2233c1[_0x50ddfc(0x251)+'WorkingD'+'ir']),_0x371061=join(_0xaf3e5e,'dist');let _0x397a94=[];try{_0x397a94=await readdir(_0x371061,{'withFileTypes':!![]});}catch{_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.[_0x50ddfc(0x32c)]?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+'untime\x20p'+_0x50ddfc(0x2c6)+_0x50ddfc(0x284)+_0x50ddfc(0x38f)+_0x50ddfc(0x1e9),{'distDir':_0x371061,'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)]});return;}const _0x1b15ba=_0x397a94['filter'](_0x26c559=>_0x26c559[_0x50ddfc(0x255)]()&&_0x26c559[_0x50ddfc(0x331)]['startsWi'+'th'](_0x50ddfc(0x29a))&&_0x26c559['name'][_0x50ddfc(0x3c9)](_0x50ddfc(0x388)))[_0x50ddfc(0x337)](_0x4f1fc9=>join(_0x371061,_0x4f1fc9[_0x50ddfc(0x331)])),_0x4dddcc=await resolveRuntimeChannelImportPath(_0x371061,_0x397a94);if(_0x1b15ba[_0x50ddfc(0x1c5)]===0x0){_0x10c0af['runtimeL'+_0x50ddfc(0x30a)]?.[_0x50ddfc(0x32c)]?.('channel\x20'+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x2c6)+_0x50ddfc(0x1ae)+_0x50ddfc(0x146)+_0x50ddfc(0x19e),{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)]});return;}if(!_0x4dddcc){_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.['warn']?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x2c6)+_0x50ddfc(0x166)+_0x50ddfc(0x36c)+'annel\x20en'+_0x50ddfc(0x31e)+_0x50ddfc(0x216),{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)],'distDir':_0x371061});return;}for(const _0x14b530 of _0x1b15ba){const _0x1faadf=await readFile(_0x14b530,_0x50ddfc(0x2c2)),_0x531a97=patchChannelPluginRuntimeFromSource(_0x1faadf,{'runtimeChannelImportPath':_0x4dddcc});if(!_0x531a97[_0x50ddfc(0x37a)]){if(_0x531a97[_0x50ddfc(0x14f)]===_0x50ddfc(0x1cf)+'patched'){_0x10c0af['runtimeL'+'ogger']?.[_0x50ddfc(0x200)]?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x2bc)+_0x50ddfc(0x328)+'lied',{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+_0x50ddfc(0x323)],'filePath':_0x14b530});return;}continue;}await writeFile(_0x14b530,_0x531a97['source'],_0x50ddfc(0x2c2)),_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.['info']?.('channel\x20'+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+_0x50ddfc(0x340)+'lied',{'openclawVersion':_0x2233c1['openclaw'+_0x50ddfc(0x323)],'filePath':_0x14b530,'note':_0x50ddfc(0x1f5)+_0x50ddfc(0x169)+_0x50ddfc(0x23d)+_0x50ddfc(0x32b)+_0x50ddfc(0x1d0)+_0x50ddfc(0x38d)+_0x50ddfc(0x174)+_0x50ddfc(0x14e)+'in\x20runti'+'me\x20missi'+_0x50ddfc(0x1af)+_0x50ddfc(0x1fb)+_0x50ddfc(0x1a8)+_0x50ddfc(0x19d)+_0x50ddfc(0x2df)+'eam\x20fix\x20'+_0x50ddfc(0x39d)+_0x50ddfc(0x19a)+_0x50ddfc(0x22e)});return;}_0x10c0af[_0x50ddfc(0x1c0)+_0x50ddfc(0x30a)]?.[_0x50ddfc(0x32c)]?.(_0x50ddfc(0x26b)+_0x50ddfc(0x1bf)+_0x50ddfc(0x1ac)+'atch\x20ski'+_0x50ddfc(0x166)+_0x50ddfc(0x3a0)+_0x50ddfc(0x293)+_0x50ddfc(0x257),{'openclawVersion':_0x2233c1[_0x50ddfc(0x251)+'Version']});}async function patchSessionStoreSqliteRuntime(_0x569ea6,_0x26dbfd,_0x3a62c8={}){const _0x5c270a=_0x44ad8a,_0x180609=resolve(_0x569ea6,_0x26dbfd[_0x5c270a(0x251)+_0x5c270a(0x272)+'ir']),_0x124b09=join(_0x180609,_0x5c270a(0x1d4)),_0x158b33=_0x5c270a(0x36a)+_0x5c270a(0x324)+_0x5c270a(0x1ea)+_0x5c270a(0x2bf)+'time-bri'+_0x5c270a(0x26f),_0x159d13=join(_0x569ea6,_0x5c270a(0x13d)+_0x5c270a(0x2c8),'sessions','runtime-'+_0x5c270a(0x365)+'js'),_0x1f4b7e=(await readdir(_0x124b09,{'withFileTypes':!![]})[_0x5c270a(0x283)](()=>[]))['filter'](_0x2da284=>_0x2da284['isFile']()&&_0x2da284['name']['startsWi'+'th'](_0x5c270a(0x3b7)+_0x5c270a(0x180))&&_0x2da284['name']['endsWith'](_0x5c270a(0x388)))[_0x5c270a(0x337)](_0x58b6f6=>join(_0x124b09,_0x58b6f6[_0x5c270a(0x331)])),_0x3a1d14=(await readdir(_0x124b09,{'withFileTypes':!![]})[_0x5c270a(0x283)](()=>[]))[_0x5c270a(0x1cc)](_0xb590e8=>_0xb590e8[_0x5c270a(0x255)]()&&_0xb590e8[_0x5c270a(0x331)][_0x5c270a(0x2f3)+'th'](_0x5c270a(0x1b6))&&!_0xb590e8['name']['startsWi'+'th'](_0x5c270a(0x3b7)+'ad-')&&_0xb590e8[_0x5c270a(0x331)][_0x5c270a(0x3c9)](_0x5c270a(0x388)))['map'](_0x458a34=>join(_0x124b09,_0x458a34['name']));if(!existsSync(_0x159d13)){_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.(_0x5c270a(0x367)+_0x5c270a(0x16e)+_0x5c270a(0x286)+_0x5c270a(0x20f)+_0x5c270a(0x3c6)+_0x5c270a(0x2a2)+_0x5c270a(0x379),{'bridgePath':_0x159d13,'openclawVersion':_0x26dbfd[_0x5c270a(0x251)+'Version']});return;}for(const _0x5ad691 of _0x1f4b7e){const _0x308e46=await readFile(_0x5ad691,'utf8'),_0x297f8f=patchSessionStoreLoadFromSource(_0x308e46,{'bridgeImportPath':_0x158b33});if(!_0x297f8f['patched']){if(_0x297f8f[_0x5c270a(0x14f)]===_0x5c270a(0x1cf)+'patched'){_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.('session\x20'+'store\x20lo'+'ad\x20patch'+_0x5c270a(0x312)+_0x5c270a(0x310),{'filePath':_0x5ad691,'openclawVersion':_0x26dbfd['openclaw'+_0x5c270a(0x323)]});break;}continue;}await writeFile(_0x5ad691,_0x297f8f[_0x5c270a(0x356)],_0x5c270a(0x2c2)),_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.(_0x5c270a(0x367)+_0x5c270a(0x13c)+_0x5c270a(0x27b)+'\x20applied',{'filePath':_0x5ad691,'openclawVersion':_0x26dbfd[_0x5c270a(0x251)+_0x5c270a(0x323)]});break;}for(const _0x31a3eb of _0x3a1d14){const _0x999adc=await readFile(_0x31a3eb,_0x5c270a(0x2c2)),_0x1adc6c=patchSessionStoreWriteFromSource(_0x999adc,{'bridgeImportPath':_0x158b33});if(!_0x1adc6c['patched']){if(_0x1adc6c[_0x5c270a(0x14f)]===_0x5c270a(0x1cf)+_0x5c270a(0x37a)){_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.[_0x5c270a(0x200)]?.('session\x20'+'store\x20wr'+_0x5c270a(0x14c)+_0x5c270a(0x1e6)+_0x5c270a(0x22c)+'d',{'filePath':_0x31a3eb,'openclawVersion':_0x26dbfd['openclaw'+'Version']});break;}continue;}await writeFile(_0x31a3eb,_0x1adc6c['source'],'utf8'),_0x3a62c8[_0x5c270a(0x1c0)+_0x5c270a(0x30a)]?.['info']?.(_0x5c270a(0x367)+_0x5c270a(0x18b)+'ite\x20patc'+_0x5c270a(0x187)+'d',{'filePath':_0x31a3eb,'openclawVersion':_0x26dbfd[_0x5c270a(0x251)+_0x5c270a(0x323)]});break;}}async function patchWeixinOutboundSessionRoute(_0xb046a2,_0x4931d5,_0x3da068={}){const _0x2b91b3=_0x44ad8a,_0x5488e9=join(_0xb046a2,_0x2b91b3(0x251),_0x2b91b3(0x1d4),_0x2b91b3(0x3c5)+'ns','openclaw'+_0x2b91b3(0x288),_0x2b91b3(0x1d4),_0x2b91b3(0x2a7),_0x2b91b3(0x181)+'js');if(!existsSync(_0x5488e9)){_0x3da068[_0x2b91b3(0x1c0)+'ogger']?.[_0x2b91b3(0x200)]?.(_0x2b91b3(0x2ee)+_0x2b91b3(0x355)+'session\x20'+'route\x20pa'+'tch\x20skip'+'ped;\x20plu'+_0x2b91b3(0x1a9)+_0x2b91b3(0x382)+'d',{'openclawVersion':_0x4931d5[_0x2b91b3(0x251)+_0x2b91b3(0x323)],'filePath':_0x5488e9});return;}const _0x293da6=await readFile(_0x5488e9,'utf8'),_0x148e58=patchWeixinOutboundSessionRouteFromSource(_0x293da6);if(!_0x148e58[_0x2b91b3(0x37a)]){if(_0x148e58[_0x2b91b3(0x14f)]===_0x2b91b3(0x1cf)+'patched'){_0x3da068[_0x2b91b3(0x1c0)+_0x2b91b3(0x30a)]?.[_0x2b91b3(0x200)]?.(_0x2b91b3(0x2ee)+_0x2b91b3(0x355)+_0x2b91b3(0x367)+'route\x20pa'+_0x2b91b3(0x2e2)+'ady\x20appl'+_0x2b91b3(0x3cb),{'openclawVersion':_0x4931d5[_0x2b91b3(0x251)+_0x2b91b3(0x323)],'filePath':_0x5488e9});return;}_0x3da068[_0x2b91b3(0x1c0)+_0x2b91b3(0x30a)]?.[_0x2b91b3(0x32c)]?.(_0x2b91b3(0x2ee)+'utbound\x20'+'session\x20'+_0x2b91b3(0x25c)+'tch\x20skip'+_0x2b91b3(0x383)+_0x2b91b3(0x1f3)+'pe\x20not\x20f'+_0x2b91b3(0x1e9),{'openclawVersion':_0x4931d5['openclaw'+_0x2b91b3(0x323)],'filePath':_0x5488e9,'reason':_0x148e58[_0x2b91b3(0x14f)]});return;}await writeFile(_0x5488e9,_0x148e58[_0x2b91b3(0x356)],'utf8'),_0x3da068['runtimeL'+_0x2b91b3(0x30a)]?.[_0x2b91b3(0x200)]?.(_0x2b91b3(0x2ee)+_0x2b91b3(0x355)+_0x2b91b3(0x367)+'route\x20pa'+_0x2b91b3(0x1f8)+'ied',{'openclawVersion':_0x4931d5[_0x2b91b3(0x251)+_0x2b91b3(0x323)],'filePath':_0x5488e9,'note':_0x2b91b3(0x1f5)+_0x2b91b3(0x169)+_0x2b91b3(0x23d)+_0x2b91b3(0x32b)+_0x2b91b3(0x3ba)+_0x2b91b3(0x253)+'n/opencl'+'aw-weixi'+_0x2b91b3(0x317)+_0x2b91b3(0x207)+_0x2b91b3(0x31a)+_0x2b91b3(0x192)+_0x2b91b3(0x1b7)+_0x2b91b3(0x35f)+'up\x20sessi'+_0x2b91b3(0x26d)+_0x2b91b3(0x36d)+_0x2b91b3(0x2da)+_0x2b91b3(0x141)+_0x2b91b3(0x246)+_0x2b91b3(0x261)});}async function patchWeixinOutboundFallbackRuntime(_0x3ba174,_0x47d96d,_0x4c19a9={}){const _0x3de756=_0x44ad8a,_0x2c483e=resolve(_0x3ba174,_0x47d96d['openclaw'+_0x3de756(0x272)+'ir']),_0x482b5a=join(_0x2c483e,'dist'),_0x4ca04a=(await readdir(_0x482b5a,{'withFileTypes':!![]})[_0x3de756(0x283)](()=>[]))[_0x3de756(0x1cc)](_0x273535=>_0x273535[_0x3de756(0x255)]()&&_0x273535[_0x3de756(0x331)][_0x3de756(0x2f3)+'th'](_0x3de756(0x29c)+'-session'+'-')&&_0x273535[_0x3de756(0x331)]['endsWith'](_0x3de756(0x388)))[_0x3de756(0x337)](_0x3bb0c5=>join(_0x482b5a,_0x3bb0c5[_0x3de756(0x331)]));if(_0x4ca04a[_0x3de756(0x1c5)]===0x0){_0x4c19a9['runtimeL'+_0x3de756(0x30a)]?.[_0x3de756(0x32c)]?.(_0x3de756(0x2ee)+_0x3de756(0x355)+_0x3de756(0x358)+_0x3de756(0x223)+_0x3de756(0x1c3)+_0x3de756(0x29c)+_0x3de756(0x37e)+_0x3de756(0x2d2)+'nd',{'openclawVersion':_0x47d96d[_0x3de756(0x251)+_0x3de756(0x323)],'distDir':_0x482b5a});return;}for(const _0xacc544 of _0x4ca04a){const _0x3d2c9f=await readFile(_0xacc544,'utf8'),_0x4b63d7=patchWeixinOutboundFallbackFromSource(_0x3d2c9f);if(!_0x4b63d7[_0x3de756(0x37a)]){if(_0x4b63d7[_0x3de756(0x14f)]===_0x3de756(0x1cf)+_0x3de756(0x37a)){_0x4c19a9[_0x3de756(0x1c0)+_0x3de756(0x30a)]?.[_0x3de756(0x200)]?.(_0x3de756(0x2ee)+'utbound\x20'+_0x3de756(0x358)+'\x20patch\x20a'+_0x3de756(0x3c0)+'pplied',{'openclawVersion':_0x47d96d[_0x3de756(0x251)+_0x3de756(0x323)],'filePath':_0xacc544});return;}continue;}await writeFile(_0xacc544,_0x4b63d7['source'],_0x3de756(0x2c2)),_0x4c19a9[_0x3de756(0x1c0)+_0x3de756(0x30a)]?.['info']?.(_0x3de756(0x2ee)+_0x3de756(0x355)+'fallback'+_0x3de756(0x315)+_0x3de756(0x1fc),{'openclawVersion':_0x47d96d[_0x3de756(0x251)+_0x3de756(0x323)],'filePath':_0xacc544,'note':_0x3de756(0x1f5)+_0x3de756(0x169)+'ibility\x20'+_0x3de756(0x32b)+_0x3de756(0x3c8)+_0x3de756(0x2f6)+_0x3de756(0x2b5)+_0x3de756(0x39c)+'\x20outboun'+'d\x20mirror'+_0x3de756(0x2b4)+_0x3de756(0x163)+_0x3de756(0x140)+_0x3de756(0x25d)+'\x20routing'+_0x3de756(0x14d)+_0x3de756(0x177)});return;}_0x4c19a9['runtimeL'+_0x3de756(0x30a)]?.[_0x3de756(0x32c)]?.('weixin\x20o'+_0x3de756(0x355)+_0x3de756(0x358)+_0x3de756(0x223)+_0x3de756(0x1c3)+_0x3de756(0x160)+_0x3de756(0x2d5)+_0x3de756(0x257),{'openclawVersion':_0x47d96d['openclaw'+_0x3de756(0x323)]});}async function patchRequestIdTitleRuntime(_0x8dae7d,_0x4c5dd8,_0x1a0843={}){const _0x14f9d1=_0x44ad8a,_0x561253=resolve(_0x8dae7d,_0x4c5dd8[_0x14f9d1(0x251)+_0x14f9d1(0x272)+'ir']),_0x2c3f39=join(_0x561253,_0x14f9d1(0x1d4)),_0x176a42=_0x14f9d1(0x36a)+_0x14f9d1(0x324)+_0x14f9d1(0x2de)+_0x14f9d1(0x2a5)+_0x14f9d1(0x182)+'ridge.mj'+'s',_0x397481=join(_0x8dae7d,_0x14f9d1(0x13d)+_0x14f9d1(0x2c8),_0x14f9d1(0x29d)+'id','runtime-'+'bridge.m'+'js');if(!existsSync(_0x397481)){_0x1a0843['runtimeL'+'ogger']?.['info']?.('request-'+_0x14f9d1(0x1cd)+'\x20runtime'+_0x14f9d1(0x223)+'kipped;\x20'+_0x14f9d1(0x27d)+_0x14f9d1(0x398)+_0x14f9d1(0x393),{'bridgePath':_0x397481,'openclawVersion':_0x4c5dd8['openclaw'+_0x14f9d1(0x323)]});return;}const _0x12323e=(await readdir(_0x2c3f39,{'withFileTypes':!![]})[_0x14f9d1(0x283)](()=>[]))['filter'](_0xe3b54c=>_0xe3b54c[_0x14f9d1(0x255)]()&&_0xe3b54c[_0x14f9d1(0x331)][_0x14f9d1(0x2f3)+'th'](_0x14f9d1(0x29a))&&_0xe3b54c[_0x14f9d1(0x331)][_0x14f9d1(0x3c9)](_0x14f9d1(0x388)))[_0x14f9d1(0x337)](_0x4b6622=>join(_0x2c3f39,_0x4b6622['name']));for(const _0xd90e86 of _0x12323e){const _0x2f7c20=await readFile(_0xd90e86,'utf8'),_0x1f1be2=patchRequestIdTitleRuntimeFromSource(_0x2f7c20,{'bridgeImportPath':_0x176a42});if(!_0x1f1be2[_0x14f9d1(0x37a)]){if(_0x1f1be2['reason']===_0x14f9d1(0x1cf)+_0x14f9d1(0x37a)){_0x1a0843[_0x14f9d1(0x1c0)+_0x14f9d1(0x30a)]?.[_0x14f9d1(0x200)]?.(_0x14f9d1(0x29d)+_0x14f9d1(0x1cd)+_0x14f9d1(0x37e)+_0x14f9d1(0x315)+'lready\x20a'+_0x14f9d1(0x1fc),{'filePath':_0xd90e86,'openclawVersion':_0x4c5dd8[_0x14f9d1(0x251)+_0x14f9d1(0x323)]});break;}continue;}await writeFile(_0xd90e86,_0x1f1be2[_0x14f9d1(0x356)],_0x14f9d1(0x2c2)),_0x1a0843['runtimeL'+_0x14f9d1(0x30a)]?.['info']?.(_0x14f9d1(0x29d)+_0x14f9d1(0x1cd)+'\x20runtime'+_0x14f9d1(0x315)+'pplied',{'filePath':_0xd90e86,'openclawVersion':_0x4c5dd8[_0x14f9d1(0x251)+_0x14f9d1(0x323)]});break;}}async function patchQQBotOutboundFallbackRuntime(_0x1c23b7,_0xb476c,_0x1e47d4={}){const _0x1937de=_0x44ad8a,_0x30ad27=resolve(_0x1c23b7,_0xb476c[_0x1937de(0x251)+'WorkingD'+'ir']),_0x55b178=join(_0x30ad27,'dist'),_0x3784ef=(await readdir(_0x55b178,{'withFileTypes':!![]})[_0x1937de(0x283)](()=>[]))[_0x1937de(0x1cc)](_0x3877ce=>_0x3877ce[_0x1937de(0x255)]()&&_0x3877ce[_0x1937de(0x331)][_0x1937de(0x2f3)+'th'](_0x1937de(0x29c)+'-session'+'-')&&_0x3877ce[_0x1937de(0x331)][_0x1937de(0x3c9)](_0x1937de(0x388)))[_0x1937de(0x337)](_0x403761=>join(_0x55b178,_0x403761['name']));if(_0x3784ef[_0x1937de(0x1c5)]===0x0){_0x1e47d4[_0x1937de(0x1c0)+'ogger']?.['warn']?.(_0x1937de(0x349)+'tbound\x20f'+_0x1937de(0x1bc)+_0x1937de(0x15c)+_0x1937de(0x285)+_0x1937de(0x355)+'runtime\x20'+_0x1937de(0x14b)+'d',{'openclawVersion':_0xb476c[_0x1937de(0x251)+_0x1937de(0x323)],'distDir':_0x55b178});return;}for(const _0x4943a6 of _0x3784ef){const _0x255a8c=await readFile(_0x4943a6,'utf8'),_0x5e1752=patchQQBotOutboundFallbackFromSource(_0x255a8c);if(!_0x5e1752[_0x1937de(0x37a)]){if(_0x5e1752[_0x1937de(0x14f)]==='already-'+'patched'){_0x1e47d4['runtimeL'+_0x1937de(0x30a)]?.['info']?.('qqbot\x20ou'+_0x1937de(0x31f)+_0x1937de(0x1bc)+_0x1937de(0x16c)+_0x1937de(0x2b2)+_0x1937de(0x384),{'openclawVersion':_0xb476c[_0x1937de(0x251)+_0x1937de(0x323)],'filePath':_0x4943a6});return;}continue;}await writeFile(_0x4943a6,_0x5e1752[_0x1937de(0x356)],_0x1937de(0x2c2)),_0x1e47d4['runtimeL'+_0x1937de(0x30a)]?.[_0x1937de(0x200)]?.(_0x1937de(0x349)+_0x1937de(0x31f)+_0x1937de(0x1bc)+_0x1937de(0x3b1)+_0x1937de(0x384),{'openclawVersion':_0xb476c[_0x1937de(0x251)+'Version'],'filePath':_0x4943a6,'note':_0x1937de(0x1f5)+_0x1937de(0x169)+_0x1937de(0x23d)+_0x1937de(0x32b)+_0x1937de(0x2ad)+'Bot\x20c2c\x20'+_0x1937de(0x29c)+_0x1937de(0x2e6)+_0x1937de(0x1f1)+'ct\x20sessi'+_0x1937de(0x330)+_0x1937de(0x273)+_0x1937de(0x30d)+_0x1937de(0x3b9)+_0x1937de(0x368)});return;}_0x1e47d4['runtimeL'+'ogger']?.['warn']?.(_0x1937de(0x349)+_0x1937de(0x31f)+_0x1937de(0x1bc)+_0x1937de(0x15c)+_0x1937de(0x2a0)+'esolver\x20'+'shape\x20no'+_0x1937de(0x2dc),{'openclawVersion':_0xb476c[_0x1937de(0x251)+'Version']});}async function patchQQBotOutboundSessionRoute(_0x1cd53e,_0x4d3166,_0x5da2c8={}){const _0x223679=_0x44ad8a,_0x385af6=join(_0x1cd53e,'openclaw',_0x223679(0x1d4),_0x223679(0x3c5)+'ns',_0x223679(0x2e1),'dist');if(!existsSync(_0x385af6)){_0x5da2c8[_0x223679(0x1c0)+_0x223679(0x30a)]?.[_0x223679(0x200)]?.(_0x223679(0x349)+'tbound\x20s'+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x20f)+_0x223679(0x21e)+_0x223679(0x3c4)+_0x223679(0x21a),{'openclawVersion':_0x4d3166[_0x223679(0x251)+'Version'],'distDir':_0x385af6});return;}const _0x500e21=(await readdir(_0x385af6,{'withFileTypes':!![]})[_0x223679(0x283)](()=>[]))[_0x223679(0x1cc)](_0x586c07=>_0x586c07[_0x223679(0x255)]()&&_0x586c07[_0x223679(0x331)][_0x223679(0x3c9)](_0x223679(0x388)))[_0x223679(0x337)](_0x3f6eeb=>join(_0x385af6,_0x3f6eeb[_0x223679(0x331)]));for(const _0x1b580c of _0x500e21){const _0x319f5e=await readFile(_0x1b580c,'utf8'),_0x529f3f=patchQQBotOutboundSessionRouteFromSource(_0x319f5e);if(!_0x529f3f['patched']){if(_0x529f3f[_0x223679(0x14f)]===_0x223679(0x1cf)+_0x223679(0x37a)){_0x5da2c8[_0x223679(0x1c0)+'ogger']?.['info']?.(_0x223679(0x349)+_0x223679(0x33e)+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x245)+_0x223679(0x1fe)+'ed',{'openclawVersion':_0x4d3166[_0x223679(0x251)+_0x223679(0x323)],'filePath':_0x1b580c});return;}continue;}await writeFile(_0x1b580c,_0x529f3f['source'],_0x223679(0x2c2)),_0x5da2c8[_0x223679(0x1c0)+_0x223679(0x30a)]?.['info']?.(_0x223679(0x349)+_0x223679(0x33e)+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x157)+'ed',{'openclawVersion':_0x4d3166[_0x223679(0x251)+'Version'],'filePath':_0x1b580c,'note':_0x223679(0x1f5)+_0x223679(0x169)+'ibility\x20'+'patch\x20fo'+_0x223679(0x18c)+_0x223679(0x3d4)+_0x223679(0x21f)+_0x223679(0x25b)+'elivery\x20'+_0x223679(0x269)+_0x223679(0x2af)+_0x223679(0x233)+'th\x20c2c\x20i'+_0x223679(0x203)+_0x223679(0x189)+_0x223679(0x3cf)});return;}_0x5da2c8['runtimeL'+_0x223679(0x30a)]?.[_0x223679(0x32c)]?.(_0x223679(0x349)+_0x223679(0x33e)+_0x223679(0x357)+_0x223679(0x238)+_0x223679(0x20f)+_0x223679(0x30f)+'nel\x20shap'+'e\x20not\x20fo'+_0x223679(0x2cd),{'openclawVersion':_0x4d3166[_0x223679(0x251)+'Version'],'distDir':_0x385af6});}async function resolveRuntimeChannelImportPath(_0x27dc52,_0x3ebc68){const _0x5cdf8e=_0x44ad8a,_0x44f6a8=_0x3ebc68[_0x5cdf8e(0x1cc)](_0x2e441e=>_0x2e441e[_0x5cdf8e(0x255)]()&&_0x2e441e[_0x5cdf8e(0x331)][_0x5cdf8e(0x2f3)+'th'](_0x5cdf8e(0x1ce)+_0x5cdf8e(0x1ef))&&_0x2e441e[_0x5cdf8e(0x331)][_0x5cdf8e(0x3c9)](_0x5cdf8e(0x388))&&!_0x2e441e[_0x5cdf8e(0x331)][_0x5cdf8e(0x2f3)+'th']('runtime-'+_0x5cdf8e(0x1ef)+'state-'))[_0x5cdf8e(0x337)](_0xdab370=>_0xdab370[_0x5cdf8e(0x331)])[_0x5cdf8e(0x32e)]();for(const _0xe97b1b of _0x44f6a8){const _0x2faa16=await readFile(join(_0x27dc52,_0xe97b1b),_0x5cdf8e(0x2c2));if(_0x2faa16[_0x5cdf8e(0x1a4)](_0x5cdf8e(0x24b)+'ntimeCha'+_0x5cdf8e(0x13b)))return'./'+_0xe97b1b;}return null;}function normalizeRuntimeRelativePath(_0x3e249d){const _0x27086d=_0x44ad8a;return _0x3e249d[_0x27086d(0x277)+'ll']('\x5c','/');}function toWindowsPath(_0x6ecea1){const _0x146661=_0x44ad8a;return _0x6ecea1[_0x146661(0x277)+'ll']('/','\x5c');}function validateRuntimeNodeVersion(_0x2f1257,_0xa5b5a3){const _0x303988=_0x44ad8a;if(_0x2f1257[_0x303988(0x16b)+_0x303988(0x2e8)]===_0xa5b5a3['openclaw'][_0x303988(0x16b)+_0x303988(0x2e8)])return;throw new Error(_0x303988(0x2ef)+'nodeVers'+_0x303988(0x2f8)+_0x303988(0x193)+_0x303988(0x15d)+(_0x2f1257[_0x303988(0x16b)+_0x303988(0x2e8)]||_0x303988(0x241))+(',\x20shell.'+'config=')+_0xa5b5a3[_0x303988(0x251)][_0x303988(0x16b)+_0x303988(0x2e8)]+'.\x20'+('Run\x20\x22wuj'+_0x303988(0x2d9)+'\x20prepare'+'\x22\x20so\x20the'+_0x303988(0x28d)+'\x20runtime'+'\x20can\x20be\x20'+_0x303988(0x1b9)+_0x303988(0x339)+_0x303988(0x1d9)+_0x303988(0x28e)+_0x303988(0x1ee)+'.'));}function validateRuntimeOpenClawVersion(_0x2d3341,_0x7f48c7){const _0x3d2ffd=_0x44ad8a;if(_0x2d3341['openclaw'+_0x3d2ffd(0x323)]===_0x7f48c7[_0x3d2ffd(0x251)][_0x3d2ffd(0x251)+_0x3d2ffd(0x323)])return;throw new Error(_0x3d2ffd(0x2ef)+_0x3d2ffd(0x251)+_0x3d2ffd(0x158)+_0x3d2ffd(0x311)+_0x3d2ffd(0x23f)+_0x3d2ffd(0x2ed)+(_0x2d3341[_0x3d2ffd(0x251)+_0x3d2ffd(0x323)]||'unknown')+(_0x3d2ffd(0x268)+'config=')+_0x7f48c7[_0x3d2ffd(0x251)][_0x3d2ffd(0x251)+_0x3d2ffd(0x323)]+'.\x20'+(_0x3d2ffd(0x39e)+_0x3d2ffd(0x2d9)+_0x3d2ffd(0x309)+_0x3d2ffd(0x2ea)+_0x3d2ffd(0x37e)+_0x3d2ffd(0x1c9)+_0x3d2ffd(0x22b)+_0x3d2ffd(0x1d9)+_0x3d2ffd(0x24f)+_0x3d2ffd(0x1b0)+_0x3d2ffd(0x35e)));}function parseNpmPackJson(_0x3cb85c){const _0x21c035=_0x44ad8a,_0x1ec16f=_0x3cb85c['trim'](),_0x30b8e1=_0x1ec16f[_0x21c035(0x2ca)]('[');if(_0x30b8e1<0x0)throw new Error('npm\x20pack'+_0x21c035(0x2a3)+_0x21c035(0x386)+_0x21c035(0x1d7)+_0x1ec16f[_0x21c035(0x362)](0x0,0x1f4));const _0x1c6eb4=JSON[_0x21c035(0x37b)](_0x1ec16f['slice'](_0x30b8e1)),_0x56faa4=Array[_0x21c035(0x29e)](_0x1c6eb4)?_0x1c6eb4[0x0]:_0x1c6eb4;if(!_0x56faa4||typeof _0x56faa4!==_0x21c035(0x217))throw new Error(_0x21c035(0x206)+_0x21c035(0x142)+_0x21c035(0x326)+_0x21c035(0x3a3)+_0x21c035(0x1d8)+_0x1ec16f[_0x21c035(0x362)](0x0,0x1f4));return _0x56faa4;}function normalizePackedTarballFilename(_0x47ead6){const _0x3fb1d2=_0x44ad8a;return _0x47ead6['replace'](/^@/,'')[_0x3fb1d2(0x277)+'ll']('/','-')[_0x3fb1d2(0x277)+'ll']('\x5c','-');}async function runProcess(_0x4661bd,_0x7d7349,_0x5d1d1={}){const _0x2b9b7e=_0x44ad8a,_0x3d5491=_0x5d1d1['label']||[_0x4661bd,..._0x7d7349]['join']('\x20'),_0x5b7c1a=_0x5d1d1[_0x2b9b7e(0x304)+'s']??NPM_INSTALL_TIMEOUT_MS,_0x3643fb=spawn(_0x4661bd,_0x7d7349,{'cwd':_0x5d1d1[_0x2b9b7e(0x2cf)],'env':_0x5d1d1[_0x2b9b7e(0x2f2)],'stdio':[_0x2b9b7e(0x31b),_0x2b9b7e(0x21c),'pipe']});return await new Promise((_0x28d5bb,_0x77d983)=>{const _0x13f413=_0x2b9b7e;let _0x25c9df='',_0x150db2='',_0x4d3955=![];const _0x32e804=setTimeout(()=>{const _0x159d86=_0x537f;if(_0x4d3955)return;_0x4d3955=!![],_0x3643fb['kill'](_0x159d86(0x2ac)),_0x77d983(new Error(_0x3d5491+(_0x159d86(0x399)+_0x159d86(0x1ad)+'\x20')+_0x5b7c1a+'ms'));},_0x5b7c1a);_0x3643fb[_0x13f413(0x150)]['on'](_0x13f413(0x3c7),_0x1655ee=>{const _0x2e07c1=_0x13f413;_0x25c9df+=_0x1655ee[_0x2e07c1(0x17b)]();}),_0x3643fb[_0x13f413(0x212)]['on'](_0x13f413(0x3c7),_0x2763b8=>{_0x150db2+=_0x2763b8['toString']();}),_0x3643fb['on'](_0x13f413(0x156),_0x1720b7=>{if(_0x4d3955)return;_0x4d3955=!![],clearTimeout(_0x32e804),_0x77d983(_0x1720b7);}),_0x3643fb['on'](_0x13f413(0x21b),(_0x3e7853,_0x1f4142)=>{const _0x438502=_0x13f413;if(_0x4d3955)return;_0x4d3955=!![],clearTimeout(_0x32e804);if(_0x3e7853===0x0){_0x28d5bb({'stdout':_0x25c9df,'stderr':_0x150db2});return;}_0x77d983(new Error(_0x3d5491+(_0x438502(0x2b0)+_0x438502(0x2f5)+'e=')+(_0x3e7853??_0x438502(0x165))+_0x438502(0x3a5)+(_0x1f4142??_0x438502(0x165))+'\x0a'+(''+(_0x150db2||_0x25c9df))[_0x438502(0x354)]()));});});}async function installOpenClawPackage(_0x4aa55e,_0x56db4e){const _0x278abf=_0x44ad8a,_0x3deb87=join(_0x4aa55e['runtimeR'+_0x278abf(0x1dc)],'.cache'),_0xfef83c=join(_0x4aa55e[_0x278abf(0x27a)+_0x278abf(0x1dc)],'.opencla'+'w-extrac'+'t');await mkdir(_0x3deb87,{'recursive':!![]}),await removePathWithRetries(_0xfef83c),await mkdir(_0xfef83c,{'recursive':!![]});const _0x4dccd4=await createRuntimeEnv(_0x4aa55e),_0xd6b789=_0x278abf(0x251)+'@'+_0x56db4e;console[_0x278abf(0x346)](_0x278abf(0x21d)+'hell:run'+'time]\x20in'+_0x278abf(0x211)+'\x20'+_0xd6b789);const _0x15c16c=await runProcess(_0x4aa55e[_0x278abf(0x1b3)+_0x278abf(0x36e)],[_0x4aa55e[_0x278abf(0x299)],_0x278abf(0x27e),_0xd6b789,_0x278abf(0x344)],{'cwd':_0x3deb87,'env':_0x4dccd4,'label':_0x278abf(0x206)+'\x20'+_0xd6b789}),_0x223af9=parseNpmPackJson(_0x15c16c['stdout']);if(_0x223af9[_0x278abf(0x13a)]!==_0x56db4e)throw new Error(_0x278abf(0x208)+_0x278abf(0x3ad)+'law\x20'+_0x56db4e+(_0x278abf(0x2f1)+'d\x20to\x20')+_0x223af9[_0x278abf(0x13a)]);const _0x4fcf18=resolve(_0x3deb87,_0x223af9[_0x278abf(0x1a5)]);if(!existsSync(_0x4fcf18))throw new Error('npm\x20pack'+_0x278abf(0x2a3)+'\x20create\x20'+_0x278abf(0x322)+'\x20'+_0x4fcf18);await runProcess(_0x278abf(0x13e),[_0x278abf(0x3b5),_0x4fcf18,'-C',_0xfef83c],{'label':_0x278abf(0x155)+_0x223af9['filename']}),await removePathWithRetries(_0x4aa55e[_0x278abf(0x251)+_0x278abf(0x272)+'ir']),await rename(join(_0xfef83c,_0x278abf(0x2e9)),_0x4aa55e[_0x278abf(0x251)+_0x278abf(0x272)+'ir']),await removePathWithRetries(_0xfef83c),await runProcess(_0x4aa55e[_0x278abf(0x1b3)+_0x278abf(0x36e)],[_0x4aa55e[_0x278abf(0x299)],_0x278abf(0x1b4),_0x278abf(0x2b6)+'ev',_0x278abf(0x24a)+'eer',_0x278abf(0x29f)+'it',_0x278abf(0x2d6)+'d',_0x278abf(0x33a)+_0x278abf(0x3a4)+'ps'],{'cwd':_0x4aa55e['openclaw'+_0x278abf(0x272)+'ir'],'env':_0x4dccd4,'label':_0x278abf(0x2ff)+_0x278abf(0x2a9)+_0xd6b789+('\x20runtime'+_0x278abf(0x17c)+'ncies')});if(!existsSync(_0x4aa55e[_0x278abf(0x251)+_0x278abf(0x2e0)]))throw new Error('OpenClaw'+_0x278abf(0x3a1)+_0x278abf(0x2d2)+_0x278abf(0x186)+_0x278abf(0x1bd)+':\x20'+_0x4aa55e[_0x278abf(0x251)+'Bin']);}async function ensureRuntimeBase(_0x2a80e5,_0x2358a6,_0x11d379={}){const _0x3c51b9=_0x44ad8a;await mkdir(_0x2358a6,{'recursive':!![]});let _0x2787d2=await readRuntimeManifest(_0x2358a6);const _0x54be39=_0x2a80e5[_0x3c51b9(0x251)][_0x3c51b9(0x16b)+_0x3c51b9(0x2e8)],_0x26492b=_0x2a80e5[_0x3c51b9(0x251)]['openclaw'+_0x3c51b9(0x323)],_0x29606d=existsSync(resolveManifestPath(_0x2358a6)),_0x123745=runtimeHasRequiredPaths(_0x2358a6,_0x2787d2),_0x2a61b5=_0x2787d2['nodeVers'+_0x3c51b9(0x2e8)]===_0x54be39;!_0x29606d||!_0x123745||!_0x2a61b5?(_0x11d379[_0x3c51b9(0x1c0)+'ogger']?.[_0x3c51b9(0x264)+'t']?.(_0x3c51b9(0x2ef)+_0x3c51b9(0x270)+_0x3c51b9(0x2d3)+'ed',{'runtimeRoot':_0x2358a6,'reason':!_0x29606d?_0x3c51b9(0x378)+_0x3c51b9(0x314):!_0x123745?'missing\x20'+_0x3c51b9(0x173)+'\x20runtime'+_0x3c51b9(0x325):'node\x20ver'+'sion\x20mis'+_0x3c51b9(0x154),'syncOnly':_0x11d379[_0x3c51b9(0x3c2)]}),_0x2787d2=await buildRuntimeBase(_0x2a80e5,_0x2358a6,_0x2787d2),_0x11d379[_0x3c51b9(0x1c0)+_0x3c51b9(0x30a)]?.[_0x3c51b9(0x264)+'t']?.(_0x3c51b9(0x2ef)+_0x3c51b9(0x270)+'ld\x20compl'+_0x3c51b9(0x1c8),{'manifest':summarizeRuntimeManifest(_0x2787d2)})):_0x11d379[_0x3c51b9(0x1c0)+'ogger']?.[_0x3c51b9(0x264)+'t']?.(_0x3c51b9(0x2ef)+'base\x20alr'+_0x3c51b9(0x201)+_0x3c51b9(0x2d8),{'manifest':summarizeRuntimeManifest(_0x2787d2)});if(!existsSync(resolve(_0x2358a6,_0x2787d2['openclaw'+_0x3c51b9(0x2e0)]))){const _0x10517e=createRuntimeInfoFromManifest(_0x2358a6,_0x2787d2,{'allowMissingOpenClaw':!![]});await installOpenClawPackage(_0x10517e,_0x26492b),_0x2787d2['openclaw'+_0x3c51b9(0x323)]=_0x26492b;}return _0x2787d2;}function runtimeHasRequiredPaths(_0x211275,_0x18fdea){const _0x2081fb=_0x44ad8a;return['nodeExec'+_0x2081fb(0x36e),'npmCli',_0x2081fb(0x251)+'WorkingD'+'ir','openclaw'+_0x2081fb(0x2e0)]['every'](_0x3c0b1e=>typeof _0x18fdea[_0x3c0b1e]===_0x2081fb(0x1d6)&&_0x18fdea[_0x3c0b1e][_0x2081fb(0x354)]())&&[_0x2081fb(0x1b3)+'utable',_0x2081fb(0x299)][_0x2081fb(0x343)](_0x49ddd7=>existsSync(resolve(_0x211275,_0x18fdea[_0x49ddd7])));}async function buildRuntimeBase(_0x5d0445,_0xe97d57,_0x9b3119={}){const _0x4c2072=_0x44ad8a,_0x1eda68=join(_0xe97d57,'node');await ensureRuntimeNode(_0x5d0445,_0x1eda68);const _0x45a4a3=process[_0x4c2072(0x2e3)]===_0x4c2072(0x20d)?_0x4c2072(0x230)+'e.exe':_0x4c2072(0x171)+'/node',_0x1b11ea=process['platform']===_0x4c2072(0x20d)?_0x4c2072(0x230)+_0x4c2072(0x359)+'s/npm/bi'+'n/npm-cl'+'i.js':_0x4c2072(0x252)+'/node_mo'+'dules/np'+'m/bin/np'+_0x4c2072(0x377),_0x18d57d={..._0x9b3119,'generatedAt':new Date()[_0x4c2072(0x350)+_0x4c2072(0x197)](),'nodeVersion':_0x5d0445['openclaw'][_0x4c2072(0x16b)+_0x4c2072(0x2e8)],'openclawVersion':_0x9b3119[_0x4c2072(0x251)+'Version']||'','platform':process[_0x4c2072(0x2e3)],'arch':process['arch'],'nodeExecutable':_0x45a4a3,'npmCli':_0x1b11ea,'openclawWorkingDir':'openclaw','openclawBin':_0x4c2072(0x251)+_0x4c2072(0x2d0)+_0x4c2072(0x3bc)};return await writeJson(resolveManifestPath(_0xe97d57),_0x18d57d),_0x18d57d;}async function removePathWithRetries(_0x358cdc){await rm(_0x358cdc,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96});}async function ensureRuntimeNode(_0x460efa,_0x20730a){const _0x20f729=_0x44ad8a,_0x3515ea=_0x460efa[_0x20f729(0x251)][_0x20f729(0x16b)+_0x20f729(0x2e8)],_0x5b870b=process['platform']===_0x20f729(0x20d)?join(_0x20730a,_0x20f729(0x17f)):join(_0x20730a,_0x20f729(0x287),'node'),_0x27faa7=process[_0x20f729(0x2e3)]==='win32'?join(_0x20730a,_0x20f729(0x23b)+'ules',_0x20f729(0x332),'bin',_0x20f729(0x172)+'js'):join(_0x20730a,'lib','node_mod'+_0x20f729(0x18a),_0x20f729(0x332),_0x20f729(0x287),_0x20f729(0x172)+'js');if(existsSync(_0x5b870b)&&existsSync(_0x27faa7)&&await getNodeVersion(_0x5b870b)===_0x3515ea)return;await removePathWithRetries(_0x20730a);if(process[_0x20f729(0x2f9)][_0x20f729(0x1b1)]===_0x3515ea){await linkCurrentNodeRuntime(_0x20730a);return;}await downloadNodeRuntime(_0x3515ea,_0x20730a);}async function getNodeVersion(_0x3db7c3){const _0x604093=_0x44ad8a;try{const _0x15066e=await runProcess(_0x3db7c3,['-p',_0x604093(0x31c)+_0x604093(0x2f9)+'.node'],{'label':_0x3db7c3+_0x604093(0x1ee),'timeoutMs':0x7530});return _0x15066e[_0x604093(0x150)][_0x604093(0x354)]();}catch{return'';}}async function linkCurrentNodeRuntime(_0x3e9fe3){const _0x121522=_0x44ad8a,_0x5464a7=process[_0x121522(0x3ca)],_0xc79852=resolve(dirname(_0x5464a7),'..'),_0x3d5e59=process['platform']===_0x121522(0x20d)?resolve(_0xc79852,_0x121522(0x23b)+'ules/npm'):resolve(_0xc79852,_0x121522(0x3ae)+_0x121522(0x227)+_0x121522(0x342)),_0x53ff4a=process[_0x121522(0x2e3)]===_0x121522(0x20d)?join(_0x3e9fe3,'node.exe'):join(_0x3e9fe3,_0x121522(0x287),_0x121522(0x1b1)),_0x2e6095=process['platform']===_0x121522(0x20d)?join(_0x3e9fe3,_0x121522(0x23b)+'ules',_0x121522(0x332)):join(_0x3e9fe3,_0x121522(0x17e),'node_mod'+_0x121522(0x18a),_0x121522(0x332));await mkdir(dirname(_0x53ff4a),{'recursive':!![]}),await mkdir(dirname(_0x2e6095),{'recursive':!![]}),await symlink(_0x5464a7,_0x53ff4a),existsSync(_0x3d5e59)?await symlink(_0x3d5e59,_0x2e6095):await symlink(await resolveNpmRoot(),_0x2e6095);}async function resolveNpmRoot(){const _0x5bc2b4=_0x44ad8a,_0x3856be=await runProcess(_0x5bc2b4(0x332),[_0x5bc2b4(0x1a1),'-g'],{'label':'npm\x20root'+_0x5bc2b4(0x2cb),'timeoutMs':0x7530}),_0x2a69d0=process[_0x5bc2b4(0x2e3)]===_0x5bc2b4(0x20d)?_0x3856be[_0x5bc2b4(0x150)][_0x5bc2b4(0x354)]():join(_0x3856be[_0x5bc2b4(0x150)]['trim'](),_0x5bc2b4(0x332));if(!existsSync(join(_0x2a69d0,_0x5bc2b4(0x287),_0x5bc2b4(0x172)+'js')))throw new Error(_0x5bc2b4(0x206)+_0x5bc2b4(0x2f0)+_0x5bc2b4(0x14b)+_0x5bc2b4(0x239)+'cal\x20runt'+_0x5bc2b4(0x3ac)+_0x5bc2b4(0x1a0)+_0x2a69d0);return _0x2a69d0;}async function resolveExtractedNodeRoot(_0x37ef15,_0x203796){const _0x10caa6=_0x44ad8a,_0x3d799d=join(_0x37ef15,_0x203796);if(existsSync(_0x3d799d))return _0x3d799d;const _0x1839af=await readdir(_0x37ef15,{'withFileTypes':!![]}),_0x6860d5=_0x1839af[_0x10caa6(0x1cc)](_0xde768c=>_0xde768c[_0x10caa6(0x296)+'ory']());if(_0x6860d5[_0x10caa6(0x1c5)]===0x1)return join(_0x37ef15,_0x6860d5[0x0][_0x10caa6(0x331)]);const _0x454eca=process[_0x10caa6(0x2e3)]==='win32'?join(_0x37ef15,'node.exe'):join(_0x37ef15,_0x10caa6(0x287),_0x10caa6(0x1b1));if(existsSync(_0x454eca))return _0x37ef15;const _0x44fcde=await findNodeRuntimeRoot(_0x37ef15);if(_0x44fcde)return _0x44fcde;const _0x42323a=_0x1839af['map'](_0x4243fc=>_0x4243fc['name'])[_0x10caa6(0x2d7)](',\x20');throw new Error(_0x10caa6(0x1db)+_0x10caa6(0x35d)+_0x10caa6(0x2b9)+_0x10caa6(0x256)+'not\x20foun'+_0x10caa6(0x1dd)+_0x203796+'\x20in\x20'+_0x37ef15+(_0x10caa6(0x3bb)+'vel\x20entr'+_0x10caa6(0x249))+(_0x42323a||_0x10caa6(0x34a)));}function resolveNodeExtractRoot(_0x290051,_0x76bf69,_0x1b6848){const _0x2d7749=_0x44ad8a;if(process[_0x2d7749(0x2e3)]!==_0x2d7749(0x20d))return join(_0x290051,_0x76bf69+(_0x2d7749(0x2c0)+'-')+process[_0x2d7749(0x226)]+'-'+Date['now']()+'-'+_0x1b6848);const _0x26687a=/^[A-Za-z]:[\\/]/[_0x2d7749(0x243)](_0x290051),_0x25213b=parse(_0x290051),_0x569afa=_0x26687a?_0x26687a[0x0][_0x2d7749(0x362)](0x0,0x2)+'\x5c':_0x25213b[_0x2d7749(0x1a1)]&&_0x25213b[_0x2d7749(0x1a1)]!=='/'?_0x25213b[_0x2d7749(0x1a1)]:_0x290051,_0x4eba44=_0x569afa[_0x2d7749(0x3bf)](/[\\/]+$/,'');return _0x4eba44+_0x2d7749(0x15b)+process[_0x2d7749(0x226)]+'-'+Date[_0x2d7749(0x16d)]()+'-'+_0x1b6848;}async function findNodeRuntimeRoot(_0x5d454d){const _0x4d716a=_0x44ad8a,_0x23be61=[_0x5d454d],_0x2971fe=new Set();while(_0x23be61[_0x4d716a(0x1c5)]>0x0){const _0x2e2f3c=_0x23be61[_0x4d716a(0x16f)]();if(!_0x2e2f3c||_0x2971fe[_0x4d716a(0x228)](_0x2e2f3c))continue;_0x2971fe[_0x4d716a(0x1ec)](_0x2e2f3c);const _0x455ccc=process[_0x4d716a(0x2e3)]===_0x4d716a(0x20d)?join(_0x2e2f3c,_0x4d716a(0x17f)):join(_0x2e2f3c,_0x4d716a(0x287),_0x4d716a(0x1b1)),_0x473a68=process[_0x4d716a(0x2e3)]===_0x4d716a(0x20d)?join(_0x2e2f3c,'node_mod'+_0x4d716a(0x18a),'npm',_0x4d716a(0x287),_0x4d716a(0x172)+'js'):join(_0x2e2f3c,'lib',_0x4d716a(0x23b)+_0x4d716a(0x18a),_0x4d716a(0x332),_0x4d716a(0x287),'npm-cli.'+'js');if(existsSync(_0x455ccc)&&existsSync(_0x473a68))return _0x2e2f3c;const _0x1496fa=await readdir(_0x2e2f3c,{'withFileTypes':!![]});for(const _0x65dfcd of _0x1496fa){_0x65dfcd[_0x4d716a(0x296)+_0x4d716a(0x387)]()&&_0x23be61['push'](join(_0x2e2f3c,_0x65dfcd[_0x4d716a(0x331)]));}}return'';}async function downloadNodeRuntime(_0x3be215,_0x31cc8b){const _0x196937=_0x44ad8a,_0x129438=process[_0x196937(0x2e3)]===_0x196937(0x20d)?'win':process['platform'],_0x31fa34=process[_0x196937(0x369)]==='x64'?_0x196937(0x329):process[_0x196937(0x369)]===_0x196937(0x1d5)?_0x196937(0x1d5):process[_0x196937(0x369)],_0x58061e=process['platform']==='win32'?_0x196937(0x2ce):_0x196937(0x26a),_0x3939f8=_0x196937(0x1da)+_0x3be215+'-'+_0x129438+'-'+_0x31fa34,_0x545848=_0x3939f8+'.'+_0x58061e,_0x5328f6=join(dirname(_0x31cc8b),_0x196937(0x370)),_0x3f6c48=join(_0x5328f6,_0x545848),_0x3a1895=_0x196937(0x373)+_0x196937(0x218)+'rg/dist/'+'v'+_0x3be215+'/'+_0x545848;await mkdir(_0x5328f6,{'recursive':!![]});const _0x35db21=resolveNodeExtractRoot(_0x5328f6,_0x3939f8,0x1);!existsSync(_0x3f6c48)&&(console[_0x196937(0x346)](_0x196937(0x21d)+_0x196937(0x240)+'time]\x20do'+_0x196937(0x3ab)+'g\x20'+_0x3a1895),await downloadFile(_0x3a1895,_0x3f6c48));await rm(_0x35db21,{'recursive':!![],'force':!![]}),await mkdir(_0x35db21,{'recursive':!![]});process[_0x196937(0x2e3)]===_0x196937(0x20d)?await extractZipArchive(_0x3f6c48,_0x35db21,_0x545848):await runProcess(_0x196937(0x13e),[_0x196937(0x2c5),_0x3f6c48,'-C',_0x35db21],{'label':_0x196937(0x155)+_0x545848});const _0x39dc4a=await resolveExtractedNodeRoot(_0x35db21,_0x3939f8);await mkdir(dirname(_0x31cc8b),{'recursive':!![]}),await rename(_0x39dc4a,_0x31cc8b),_0x39dc4a!==_0x35db21&&await rm(_0x35db21,{'recursive':!![],'force':!![]});}async function extractZipArchive(_0x1bb2c1,_0x2e572b,_0x3ec7b7){const _0x247f65=_0x44ad8a;await runProcess(_0x247f65(0x297)+'ll.exe',['-NoProfi'+'le',_0x247f65(0x351)+'onPolicy',_0x247f65(0x2fa),'-Command','Expand-A'+_0x247f65(0x2fe)+_0x247f65(0x1e0)+_0x247f65(0x1c2)+_0x247f65(0x2a4)+_0x247f65(0x380)+'HIVE\x20-De'+_0x247f65(0x32d)+_0x247f65(0x2a6)+_0x247f65(0x1fa)+_0x247f65(0x1f9)+'XTRACT_R'+_0x247f65(0x1f2)+'ce'],{'env':{...process.env,'WUJIE_SHELL_ARCHIVE':_0x1bb2c1,'WUJIE_SHELL_EXTRACT_ROOT':_0x2e572b},'label':_0x247f65(0x155)+_0x3ec7b7});}async function downloadFile(_0x41926a,_0x4e45d0){await mkdir(dirname(_0x4e45d0),{'recursive':!![]});const _0x3dd7e7=await new Promise((_0x25b871,_0x443afe)=>{const _0x2f22c1=_0x537f;get(_0x41926a,_0x9df35f=>{const _0x2a9baa=_0x537f;if(_0x9df35f['statusCo'+'de']>=0x12c&&_0x9df35f[_0x2a9baa(0x2b3)+'de']<0x190&&_0x9df35f[_0x2a9baa(0x34b)][_0x2a9baa(0x222)]){_0x9df35f[_0x2a9baa(0x389)](),downloadFile(new URL(_0x9df35f['headers'][_0x2a9baa(0x222)],_0x41926a)['href'],_0x4e45d0)['then'](()=>_0x25b871(null))['catch'](_0x443afe);return;}if(_0x9df35f[_0x2a9baa(0x2b3)+'de']!==0xc8){_0x9df35f[_0x2a9baa(0x389)](),_0x443afe(new Error(_0x2a9baa(0x1ca)+'\x20failed\x20'+_0x9df35f[_0x2a9baa(0x2b3)+'de']+':\x20'+_0x41926a));return;}_0x25b871(_0x9df35f);})['on'](_0x2f22c1(0x156),_0x443afe);});_0x3dd7e7&&await pipeline(_0x3dd7e7,createWriteStream(_0x4e45d0));}export async function ensureOpenClawDoctorFixed(_0x227b01,_0x97d8ca={}){const _0x2fcae0=_0x44ad8a,_0x4da38f=await loadRuntimeInfo(_0x227b01[_0x2fcae0(0x300)+_0x2fcae0(0x1dc)]),_0x1edb5e=getConfigPaths(_0x227b01),_0x123582=join(_0x1edb5e[_0x2fcae0(0x364)+_0x2fcae0(0x291)],'openclaw'+'-doctor.'+_0x2fcae0(0x22d)),_0x9300c0=await readJson(_0x123582,{});if(_0x9300c0[_0x2fcae0(0x251)+_0x2fcae0(0x323)]===_0x4da38f['openclaw'+_0x2fcae0(0x323)])return _0x97d8ca['runtimeL'+_0x2fcae0(0x30a)]?.[_0x2fcae0(0x200)](_0x2fcae0(0x251)+_0x2fcae0(0x2bb)+_0x2fcae0(0x17a)+_0x2fcae0(0x236)+_0x2fcae0(0x2f4),{'openclawVersion':_0x4da38f['openclaw'+'Version'],'markerPath':_0x123582}),{'ran':![],'openclawVersion':_0x4da38f['openclaw'+'Version'],'markerPath':_0x123582};return await runOpenClawDoctorFix(_0x227b01,_0x4da38f,{'fromVersion':_0x9300c0['openclaw'+_0x2fcae0(0x323)]||_0x2fcae0(0x241),'toVersion':_0x4da38f[_0x2fcae0(0x251)+'Version'],'markerPath':_0x123582,'runtimeLogger':_0x97d8ca['runtimeL'+_0x2fcae0(0x30a)]}),{'ran':!![],'openclawVersion':_0x4da38f[_0x2fcae0(0x251)+_0x2fcae0(0x323)],'markerPath':_0x123582};}async function runOpenClawDoctorFix(_0x165bd1,_0x593aca,{fromVersion:_0x269ad6,toVersion:_0x567136,markerPath:markerPath='',runtimeLogger:_0x3f5a33}={}){const _0xcd4ff2=_0x44ad8a;_0x3f5a33?.[_0xcd4ff2(0x264)+'t']?.('openclaw'+_0xcd4ff2(0x2bb)+_0xcd4ff2(0x3b6)+'ted',{'fromVersion':_0x269ad6,'toVersion':_0x567136});const _0x553bd0=await createRuntimeEnv(_0x593aca,{'OPENCLAW_HOME':_0x165bd1[_0xcd4ff2(0x37d)],'OPENCLAW_STATE_DIR':_0x165bd1[_0xcd4ff2(0x37d)],'OPENCLAW_CONFIG_PATH':getConfigPaths(_0x165bd1)[_0xcd4ff2(0x3c1)+'th']});console[_0xcd4ff2(0x346)](_0xcd4ff2(0x21d)+_0xcd4ff2(0x240)+'time]\x20ru'+_0xcd4ff2(0x254)+_0xcd4ff2(0x188)+_0xcd4ff2(0x33f)+_0xcd4ff2(0x32a));const _0x3083ec=await runProcess(_0x593aca[_0xcd4ff2(0x1b3)+'utable'],[_0x593aca[_0xcd4ff2(0x251)+_0xcd4ff2(0x2e0)],_0xcd4ff2(0x36f),'--fix'],{'cwd':_0x593aca[_0xcd4ff2(0x251)+_0xcd4ff2(0x272)+'ir'],'env':_0x553bd0,'label':'openclaw'+'\x20doctor\x20'+_0xcd4ff2(0x244),'timeoutMs':0x1d4c0});_0x3f5a33?.[_0xcd4ff2(0x264)+'t']?.(_0xcd4ff2(0x251)+_0xcd4ff2(0x2bb)+'fix\x20comp'+_0xcd4ff2(0x1b2),{'fromVersion':_0x269ad6,'toVersion':_0x567136,'stdout':_0x3083ec[_0xcd4ff2(0x150)][_0xcd4ff2(0x354)]()[_0xcd4ff2(0x362)](-0xfa0),'stderr':_0x3083ec[_0xcd4ff2(0x212)][_0xcd4ff2(0x354)]()[_0xcd4ff2(0x362)](-0xfa0)}),markerPath&&(await writeJson(markerPath,{'openclawVersion':_0x593aca['openclaw'+'Version'],'fixedAt':new Date()[_0xcd4ff2(0x350)+_0xcd4ff2(0x197)]()}),_0x3f5a33?.['importan'+'t']?.(_0xcd4ff2(0x251)+_0xcd4ff2(0x2bb)+_0xcd4ff2(0x185)+'er\x20writt'+'en',{'markerPath':markerPath,'openclawVersion':_0x593aca[_0xcd4ff2(0x251)+_0xcd4ff2(0x323)]}));}export async function readRuntimeManifest(_0x5daebe){return await readJson(resolveManifestPath(_0x5daebe),{});}export async function loadRuntimeInfo(_0xfb00d5){const _0x2e04a1=resolveRuntimeRoot(_0xfb00d5),_0x165fb9=await readRuntimeManifest(_0x2e04a1);return createRuntimeInfoFromManifest(_0x2e04a1,_0x165fb9);}function createRuntimeInfoFromManifest(_0x52ffad,_0x15dbaf,_0x15d5c6={}){const _0x5b001f=_0x44ad8a;for(const _0x1acc35 of[_0x5b001f(0x1b3)+_0x5b001f(0x36e),'npmCli',_0x5b001f(0x251)+'WorkingD'+'ir',_0x5b001f(0x251)+'Bin']){if(typeof _0x15dbaf[_0x1acc35]!=='string'||!_0x15dbaf[_0x1acc35]['trim']())throw new Error(_0x5b001f(0x2ef)+'manifest'+_0x5b001f(0x295)+_0x5b001f(0x307)+_0x1acc35+'\x22\x20at\x20'+resolveManifestPath(_0x52ffad)+(_0x5b001f(0x34c)+_0x5b001f(0x327)+_0x5b001f(0x301)+'e'));}const _0x993962=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x1b3)+_0x5b001f(0x36e)]),_0x3c5bb8=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x299)]),_0x19a994=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x251)+_0x5b001f(0x272)+'ir']),_0x17912c=resolve(_0x52ffad,_0x15dbaf[_0x5b001f(0x251)+_0x5b001f(0x2e0)]),_0x16b31c=Array['isArray'](_0x15dbaf[_0x5b001f(0x1e4)])?_0x15dbaf[_0x5b001f(0x1e4)]['map'](_0x37f7b9=>({..._0x37f7b9,'installPath':resolve(_0x52ffad,_0x37f7b9[_0x5b001f(0x168)+_0x5b001f(0x24e)])})):[],_0x18ea34=_0x15d5c6[_0x5b001f(0x31d)+_0x5b001f(0x3aa)+_0x5b001f(0x220)]?[_0x993962,_0x3c5bb8]:[_0x993962,_0x3c5bb8,_0x19a994,_0x17912c];for(const _0x58c0c7 of _0x18ea34){if(!existsSync(_0x58c0c7))throw new Error(_0x5b001f(0x2ef)+_0x5b001f(0x378)+_0x5b001f(0x183)+_0x58c0c7);}return{'runtimeRoot':_0x52ffad,'manifest':_0x15dbaf,'openclawVersion':_0x15dbaf[_0x5b001f(0x251)+_0x5b001f(0x323)]||_0x5b001f(0x241),'nodeExecutable':_0x993962,'npmCli':_0x3c5bb8,'openclawWorkingDir':_0x19a994,'openclawBin':_0x17912c,'plugins':_0x16b31c};}export async function spawnClaw(_0x894432,_0x179309=[],_0x31973a={}){const _0x5bb84b=_0x44ad8a,_0x7fd55b=await loadRuntimeInfo(_0x894432),_0xf35ecd=await createRuntimeEnv(_0x7fd55b,_0x31973a[_0x5bb84b(0x2f2)]??{});return spawn(_0x7fd55b[_0x5bb84b(0x1b3)+'utable'],[_0x7fd55b[_0x5bb84b(0x251)+_0x5bb84b(0x2e0)],..._0x179309],{'cwd':_0x7fd55b[_0x5bb84b(0x251)+_0x5bb84b(0x272)+'ir'],'stdio':_0x5bb84b(0x21c),..._0x31973a,'env':_0xf35ecd});}export async function runClawOnce(_0x1a35f7,_0x52322e=[],_0x920572=0x15f90){const _0x1486ea=await spawnClaw(_0x1a35f7,_0x52322e);return await new Promise((_0x3ffdc4,_0x28d519)=>{const _0x2f7e65=_0x537f;let _0x5bf63c='',_0x3d6152='',_0x3d1072=![];const _0x54e81f=setTimeout(()=>{const _0x20f6de=_0x537f;if(_0x3d1072)return;_0x3d1072=!![],_0x1486ea[_0x20f6de(0x353)]('SIGTERM'),_0x28d519(new Error(_0x20f6de(0x251)+_0x20f6de(0x399)+_0x20f6de(0x1ad)+'\x20'+_0x920572+'ms'));},_0x920572);_0x1486ea[_0x2f7e65(0x150)]['on'](_0x2f7e65(0x3c7),_0x4528aa=>{_0x5bf63c+=_0x4528aa['toString']();}),_0x1486ea[_0x2f7e65(0x212)]['on']('data',_0x2e1e4b=>{_0x3d6152+=_0x2e1e4b['toString']();}),_0x1486ea['on'](_0x2f7e65(0x156),_0xd11784=>{if(_0x3d1072)return;_0x3d1072=!![],clearTimeout(_0x54e81f),_0x28d519(_0xd11784);}),_0x1486ea['on'](_0x2f7e65(0x21b),(_0x47de40,_0x12e604)=>{if(_0x3d1072)return;_0x3d1072=!![],clearTimeout(_0x54e81f),_0x3ffdc4({'code':_0x47de40,'signal':_0x12e604,'stdout':_0x5bf63c,'stderr':_0x3d6152});});});}export{resolveRuntimeLarkCliCommand};function resolvePackageNameFromNpmSpec(_0x57e463){const _0x290d9d=_0x44ad8a,_0x454a68=_0x57e463[_0x290d9d(0x354)]()[_0x290d9d(0x3bf)](/^npm:/,'');if(!_0x454a68)throw new Error(_0x290d9d(0x15e)+_0x290d9d(0x1d2)+_0x290d9d(0x176)+'c');if(_0x454a68[_0x290d9d(0x2f3)+'th']('@')){const _0x170285=_0x454a68[_0x290d9d(0x2ca)]('/');if(_0x170285===-0x1)throw new Error(_0x290d9d(0x15e)+_0x290d9d(0x319)+'pec:\x20'+_0x57e463);const _0x52a17c=_0x454a68[_0x290d9d(0x2ca)]('@',_0x170285+0x1);return _0x52a17c===-0x1?_0x454a68:_0x454a68['slice'](0x0,_0x52a17c);}const _0x4e3577=_0x454a68[_0x290d9d(0x2ca)]('@');return _0x4e3577===-0x1?_0x454a68:_0x454a68['slice'](0x0,_0x4e3577);}async function createRuntimeEnv(_0x3ca212,_0x4bcc4b={}){const _0x5d6cca=_0x44ad8a,_0x2b59a6=process.env.OPENCLAW_STATE_DIR||'',_0x5241f8=process.env.NPM_CONFIG_REGISTRY||_0x5d6cca(0x373)+_0x5d6cca(0x2c7)+_0x5d6cca(0x28c)+_0x5d6cca(0x3be),_0x2ed5c3=_0x2b59a6?join(_0x2b59a6,_0x5d6cca(0x1a2)+'time-too'+'ls'):join(_0x3ca212[_0x5d6cca(0x27a)+'oot'],_0x5d6cca(0x32f)),_0x1728ea=join(_0x2ed5c3,_0x5d6cca(0x1e3)+'al'),_0x1b4a4f=join(_0x2ed5c3,_0x5d6cca(0x225)+'e'),_0x225622=join(_0x1728ea,_0x5d6cca(0x287));await mkdir(_0x225622,{'recursive':!![]}),await mkdir(_0x1b4a4f,{'recursive':!![]});const _0x52521a=[_0x225622,dirname(_0x3ca212['nodeExec'+'utable']),process.env.PATH||''];return{...process.env,..._0x4bcc4b,'PATH':_0x52521a['filter'](Boolean)[_0x5d6cca(0x2d7)](delimiter),'npm_config_prefix':_0x1728ea,'NPM_CONFIG_PREFIX':_0x1728ea,'npm_config_cache':_0x1b4a4f,'NPM_CONFIG_CACHE':_0x1b4a4f,'NPM_CONFIG_REGISTRY':_0x5241f8,'npm_execpath':_0x3ca212[_0x5d6cca(0x299)],'npm_node_execpath':_0x3ca212['nodeExec'+'utable'],'OPENCLAW_RUNTIME_NPM_PREFIX':_0x1728ea,'OPENCLAW_RUNTIME_NPM_BIN':_0x225622};}export async function getRuntimeSpawnContext(_0x24c774,_0x901879={}){const _0x6abb0=_0x44ad8a,_0x13909b=await loadRuntimeInfo(_0x24c774),_0x299a72=await createRuntimeEnv(_0x13909b,_0x901879);return{'cwd':_0x13909b[_0x6abb0(0x251)+_0x6abb0(0x272)+'ir'],'env':_0x299a72,'runtime':_0x13909b};}function resolvePluginDirNameFromSpec(_0x430222){const _0x13d95f=_0x44ad8a,_0x4fa044=resolvePackageNameFromNpmSpec(_0x430222),_0x85e9bd=_0x4fa044['split']('/')[_0x13d95f(0x1cc)](Boolean),_0x231e83=_0x85e9bd['at'](-0x1)??'';if(!_0x231e83)throw new Error(_0x13d95f(0x15e)+_0x13d95f(0x213)+'pec:\x20'+_0x430222);return _0x231e83;}async function resolvePluginIdFromPackageDir(_0x31666a,_0x54016e){const _0x3add08=_0x44ad8a,_0x18839a=await readJson(join(_0x31666a,_0x3add08(0x2eb)+_0x3add08(0x22d)),{}),_0x32800b=await readPluginManifest(_0x31666a),_0x5abaaa=[_0x32800b?.['id'],_0x32800b?.[_0x3add08(0x20e)],_0x32800b?.[_0x3add08(0x331)],_0x18839a?.[_0x3add08(0x251)]?.['id'],_0x18839a?.[_0x3add08(0x251)+'Id'],_0x54016e],_0x7b472a=_0x5abaaa[_0x3add08(0x30c)](_0x5a9fde=>typeof _0x5a9fde===_0x3add08(0x1d6)&&_0x5a9fde[_0x3add08(0x354)]());if(!_0x7b472a)throw new Error(_0x3add08(0x234)+'o\x20resolv'+_0x3add08(0x2a8)+_0x3add08(0x24d)+'\x20'+_0x31666a);return _0x7b472a[_0x3add08(0x354)]();}function pluginSpecMatches(_0x4caf15,_0x3cc9b7){const _0xa78d43=_0x44ad8a,_0x3676d3=_0x3cc9b7[_0xa78d43(0x354)](),_0x5a7f08=resolvePackageNameFromNpmSpec(_0x3676d3);return[_0x4caf15['spec'],_0x4caf15[_0xa78d43(0x320)+_0xa78d43(0x3cd)],_0x4caf15[_0xa78d43(0x320)+_0xa78d43(0x1c4)]][_0xa78d43(0x194)](_0xc0abcd=>_0xc0abcd===_0x3676d3||_0xc0abcd===_0x5a7f08);}async function installPluginFromNpmSpec(_0x2de135,_0x494e02,_0x1a791f={}){const _0x426062=_0x44ad8a,_0x177d3=_0x2de135[_0x426062(0x354)]()[_0x426062(0x3bf)](/^npm:/,''),_0x41e260=resolvePluginDirNameFromSpec(_0x177d3),_0xcb238=join(_0x494e02[_0x426062(0x251)+_0x426062(0x272)+'ir'],_0x426062(0x1d4),_0x426062(0x3c5)+'ns'),_0x31ec8c=join(_0xcb238,_0x41e260),_0x2119f6=join(_0x494e02['runtimeR'+_0x426062(0x1dc)],_0x426062(0x397)+_0x426062(0x37f)+process[_0x426062(0x226)]+'-'+Date[_0x426062(0x16d)]()),_0x5b945a=await createRuntimeEnv(_0x494e02),_0x39cf9b=new Date()[_0x426062(0x350)+_0x426062(0x197)](),_0x16bd56=join(_0x494e02[_0x426062(0x27a)+'oot'],_0x426062(0x370));await mkdir(_0x16bd56,{'recursive':!![]}),await rm(_0x2119f6,{'recursive':!![],'force':!![]}),await rm(_0x31ec8c,{'recursive':!![],'force':!![]}),await mkdir(_0x2119f6,{'recursive':!![]}),await mkdir(_0xcb238,{'recursive':!![]}),console[_0x426062(0x346)](_0x426062(0x21d)+_0x426062(0x240)+_0x426062(0x237)+_0x426062(0x235)+'lugin\x20'+_0x177d3);const _0x46ff08=await runProcess(_0x494e02[_0x426062(0x1b3)+'utable'],[_0x494e02[_0x426062(0x299)],'pack',_0x177d3,_0x426062(0x344)],{'cwd':_0x16bd56,'env':_0x5b945a,'label':'npm\x20pack'+'\x20'+_0x177d3}),_0x375a0c=parseNpmPackJson(_0x46ff08['stdout']),_0x57bd56=normalizePackedTarballFilename(_0x375a0c[_0x426062(0x1a5)]),_0x2273e7=join(_0x16bd56,_0x57bd56);if(!existsSync(_0x2273e7))throw new Error(_0x426062(0x206)+_0x426062(0x2a3)+_0x426062(0x2fc)+_0x426062(0x322)+'\x20'+_0x2273e7);await runProcess('tar',[_0x426062(0x3b5),_0x2273e7,'-C',_0x2119f6],{'label':_0x426062(0x155)+_0x57bd56}),await rename(join(_0x2119f6,'package'),_0x31ec8c),await rm(_0x2119f6,{'recursive':!![],'force':!![]});const _0x1d26b8=join(_0x31ec8c,'package.'+'json'),_0x14967f=await readJson(_0x1d26b8,{});(_0x14967f[_0x426062(0x366)+_0x426062(0x38a)]||_0x14967f[_0x426062(0x2cc)])&&(delete _0x14967f['devDepen'+_0x426062(0x38a)],delete _0x14967f[_0x426062(0x2cc)],await writeJson(_0x1d26b8,_0x14967f));await runProcess(_0x494e02[_0x426062(0x1b3)+'utable'],[_0x494e02[_0x426062(0x299)],_0x426062(0x1b4),_0x426062(0x2b6)+'ev',_0x426062(0x24a)+'eer',_0x426062(0x29f)+'it','--no-fun'+'d',_0x426062(0x33a)+_0x426062(0x3a4)+'ps'],{'cwd':_0x31ec8c,'env':_0x5b945a,'label':_0x426062(0x2ff)+'all\x20plug'+_0x426062(0x204)+_0x177d3});const _0x18b5c6=new Date()[_0x426062(0x350)+_0x426062(0x197)](),_0x1ba028=await resolvePluginIdFromPackageDir(_0x31ec8c,_0x375a0c[_0x426062(0x331)]);return _0x1a791f[_0x426062(0x1c0)+_0x426062(0x30a)]?.['info'](_0x426062(0x248)+_0x426062(0x336)+'lled',{'spec':_0x177d3,'pluginId':_0x1ba028,'installPath':_0x31ec8c}),{'pluginId':_0x1ba028,'source':_0x426062(0x332),'spec':_0x177d3,'installPath':toRuntimeRelative(_0x494e02['runtimeR'+_0x426062(0x1dc)],_0x31ec8c),'version':_0x375a0c[_0x426062(0x13a)],'resolvedName':_0x375a0c[_0x426062(0x331)],'resolvedVersion':_0x375a0c[_0x426062(0x13a)],'resolvedSpec':_0x375a0c[_0x426062(0x331)]+'@'+_0x375a0c['version'],'integrity':typeof _0x375a0c['integrit'+'y']===_0x426062(0x1d6)?_0x375a0c[_0x426062(0x151)+'y']:'','shasum':typeof _0x375a0c[_0x426062(0x1fd)]===_0x426062(0x1d6)?_0x375a0c['shasum']:'','resolvedAt':_0x39cf9b,'installedAt':_0x18b5c6};}async function syncConfiguredNpmPlugins(_0x5628ac,_0x154712,_0x34bd14,_0x22e818={}){const _0x18485d=_0x44ad8a;if(_0x22e818[_0x18485d(0x3c2)])return;const _0x56832f=createRuntimeInfoFromManifest(_0x154712,_0x34bd14),_0x1b17e8=Array[_0x18485d(0x29e)](_0x34bd14[_0x18485d(0x1e4)])?_0x34bd14[_0x18485d(0x1e4)]:[],_0x383e24=[];for(const _0x6b19b8 of _0x5628ac[_0x18485d(0x251)]['pluginSp'+_0x18485d(0x39b)]){const _0x33ebcb=_0x1b17e8[_0x18485d(0x30c)](_0x91b61c=>_0x91b61c?.['source']===_0x18485d(0x332)&&pluginSpecMatches(_0x91b61c,_0x6b19b8)&&typeof _0x91b61c[_0x18485d(0x168)+_0x18485d(0x24e)]===_0x18485d(0x1d6)&&existsSync(resolve(_0x154712,_0x91b61c[_0x18485d(0x168)+_0x18485d(0x24e)])));if(_0x33ebcb){_0x383e24[_0x18485d(0x2c4)](_0x33ebcb);continue;}_0x383e24[_0x18485d(0x2c4)](await installPluginFromNpmSpec(_0x6b19b8,_0x56832f,_0x22e818));}const _0xeed7ab=new Set(_0x5628ac[_0x18485d(0x251)][_0x18485d(0x202)+'ecs'][_0x18485d(0x337)](resolvePackageNameFromNpmSpec)),_0x2e666b=_0x1b17e8[_0x18485d(0x1cc)](_0x3a2de9=>_0x3a2de9?.[_0x18485d(0x356)]!==_0x18485d(0x332)||!_0xeed7ab[_0x18485d(0x228)](resolvePackageNameFromNpmSpec(_0x3a2de9['resolved'+'Name']||_0x3a2de9[_0x18485d(0x232)]||'')));_0x34bd14[_0x18485d(0x1e4)]=[..._0x2e666b,..._0x383e24];}function hasRuntimeDependencies(_0x23f6fe){const _0x5f46d9=_0x44ad8a,_0x542cd9=_0x23f6fe?.[_0x5f46d9(0x195)+_0x5f46d9(0x1be)]&&typeof _0x23f6fe[_0x5f46d9(0x195)+_0x5f46d9(0x1be)]===_0x5f46d9(0x217)?Object['keys'](_0x23f6fe[_0x5f46d9(0x195)+_0x5f46d9(0x1be)]):[],_0x3dee92=_0x23f6fe?.[_0x5f46d9(0x159)+_0x5f46d9(0x25f)+_0x5f46d9(0x1be)]&&typeof _0x23f6fe['optional'+_0x5f46d9(0x25f)+_0x5f46d9(0x1be)]===_0x5f46d9(0x217)?Object['keys'](_0x23f6fe['optional'+_0x5f46d9(0x25f)+'cies']):[];return _0x542cd9[_0x5f46d9(0x1c5)]>0x0||_0x3dee92['length']>0x0;}async function installLocalPluginRuntimeDependencies(_0x4fe2b4,_0x132daa,_0x3ef698){const _0x2cedd5=_0x44ad8a,_0x1fcc42=join(_0x4fe2b4,_0x2cedd5(0x2eb)+_0x2cedd5(0x22d)),_0x374e0e=await readJson(_0x1fcc42,{});(_0x374e0e[_0x2cedd5(0x366)+_0x2cedd5(0x38a)]||_0x374e0e['scripts'])&&(delete _0x374e0e[_0x2cedd5(0x366)+_0x2cedd5(0x38a)],delete _0x374e0e['scripts'],await writeJson(_0x1fcc42,_0x374e0e));if(!hasRuntimeDependencies(_0x374e0e))return;const _0x554fd6=await createRuntimeEnv(_0x132daa);console['log']('[wujie-s'+'hell:run'+_0x2cedd5(0x2b1)+_0x2cedd5(0x211)+_0x2cedd5(0x35c)+_0x2cedd5(0x1ed)+_0x2cedd5(0x214)+'es\x20'+_0x4fe2b4),await runProcess(_0x132daa['nodeExec'+_0x2cedd5(0x36e)],[_0x132daa[_0x2cedd5(0x299)],_0x2cedd5(0x1b4),'--omit=d'+'ev',_0x2cedd5(0x24a)+_0x2cedd5(0x360),_0x2cedd5(0x29f)+'it',_0x2cedd5(0x2d6)+'d',_0x2cedd5(0x33a)+'-peer-de'+'ps'],{'cwd':_0x4fe2b4,'env':_0x554fd6,'label':_0x2cedd5(0x2ff)+_0x2cedd5(0x28a)+_0x2cedd5(0x2ae)+'\x20'+_0x4fe2b4}),_0x3ef698[_0x2cedd5(0x1c0)+'ogger']?.[_0x2cedd5(0x200)](_0x2cedd5(0x147)+'ugin\x20dep'+_0x2cedd5(0x18e)+'s\x20instal'+'led',{'installPath':_0x4fe2b4});}async function syncSharedPluginModules(_0x23bc9e,_0xe9f166){const _0xaa23d4=_0x44ad8a,_0x321722=new Set();for(const _0x1c0c61 of _0x23bc9e){const _0x29e89e=join(dirname(_0x1c0c61),_0xaa23d4(0x1cb));if(existsSync(_0x29e89e))_0x321722[_0xaa23d4(0x1ec)](_0x29e89e);}for(const _0x36f3cb of _0x321722){await copyDirFresh(_0x36f3cb,join(_0xe9f166,_0xaa23d4(0x1cb)));}}async function syncProductPlugins(_0x107664,_0x504f80,_0x372081,_0x452ab2={}){const _0x5e63a0=_0x44ad8a,_0x179be4=join(_0x504f80,'openclaw',_0x5e63a0(0x1d4),_0x5e63a0(0x3c5)+'ns'),_0x2a7316=createRuntimeInfoFromManifest(_0x504f80,_0x372081),_0x83122d=[];await syncSharedPluginModules(_0x107664[_0x5e63a0(0x251)]['resolved'+_0x5e63a0(0x305)+_0x5e63a0(0x1f0)],_0x179be4);for(const _0x3209ba of _0x107664[_0x5e63a0(0x251)]['resolved'+_0x5e63a0(0x305)+_0x5e63a0(0x1f0)]){const _0xfcb7cf=await getPackageMetadata(_0x3209ba),_0x30f241=await readPluginManifest(_0x3209ba),_0x511cb7=join(_0x179be4,_0xfcb7cf['pluginId']);await copyDirFresh(_0x3209ba,_0x511cb7),await installLocalPluginRuntimeDependencies(_0x511cb7,_0x2a7316,_0x452ab2),_0x83122d['push']({'pluginId':_0xfcb7cf[_0x5e63a0(0x20e)],'source':_0x5e63a0(0x184),'spec':'local:'+_0x3209ba,'installPath':toRuntimeRelative(_0x504f80,_0x511cb7),'version':_0xfcb7cf[_0x5e63a0(0x13a)],'resolvedName':_0xfcb7cf[_0x5e63a0(0x331)],'resolvedVersion':_0xfcb7cf[_0x5e63a0(0x13a)],'resolvedSpec':_0x5e63a0(0x279)+_0x3209ba,'integrity':'','shasum':'','resolvedAt':new Date()[_0x5e63a0(0x350)+_0x5e63a0(0x197)](),'installedAt':new Date()[_0x5e63a0(0x350)+_0x5e63a0(0x197)](),'agentScope':_0x30f241['agentSco'+'pe'],'skills':_0x30f241[_0x5e63a0(0x1c7)]});}const _0x4e8500=new Set(_0x83122d[_0x5e63a0(0x337)](_0x33803b=>_0x33803b[_0x5e63a0(0x20e)])),_0x2c696a=Array[_0x5e63a0(0x29e)](_0x372081[_0x5e63a0(0x1e4)])?_0x372081[_0x5e63a0(0x1e4)][_0x5e63a0(0x1cc)](_0x34be26=>!_0x4e8500[_0x5e63a0(0x228)](_0x34be26[_0x5e63a0(0x20e)])):[];_0x372081[_0x5e63a0(0x1e4)]=[..._0x2c696a,..._0x83122d];}async function syncManifestPluginScope(_0x37e61f,_0xff5f40,_0x4ab9fb){const _0x44857e=_0x44ad8a,_0x15b334=join(_0xff5f40,'openclaw',_0x44857e(0x1d4),_0x44857e(0x3c5)+'ns'),_0x55cfe1=new Set(_0x37e61f[_0x44857e(0x251)][_0x44857e(0x202)+_0x44857e(0x39b)]??[]),_0x51f401=new Set([..._0x55cfe1][_0x44857e(0x337)](_0x3ef7bb=>_0x3ef7bb['replace'](/^npm:/,''))[_0x44857e(0x337)](_0x17af94=>{const _0x21d6cf=_0x44857e;if(_0x17af94[_0x21d6cf(0x2f3)+'th']('@')){const _0x10becb=_0x17af94[_0x21d6cf(0x390)]('@');return _0x10becb['length']>=0x3?'@'+_0x10becb[0x1]:_0x17af94;}return _0x17af94[_0x21d6cf(0x390)]('@')[0x0];})['filter'](Boolean)),_0x4346e4=new Set();for(const _0x253d85 of _0x37e61f[_0x44857e(0x251)]['resolved'+_0x44857e(0x305)+'ginPaths']){const _0x91ba9e=await getPackageMetadata(_0x253d85);if(_0x91ba9e['pluginId'])_0x4346e4['add'](_0x91ba9e[_0x44857e(0x20e)]);}const _0x452b1d=Array[_0x44857e(0x29e)](_0x4ab9fb['plugins'])?_0x4ab9fb[_0x44857e(0x1e4)]:[];_0x4ab9fb[_0x44857e(0x202)+_0x44857e(0x39b)]=[..._0x37e61f[_0x44857e(0x251)][_0x44857e(0x202)+_0x44857e(0x39b)],..._0x37e61f[_0x44857e(0x251)][_0x44857e(0x320)+'LocalPlu'+_0x44857e(0x1f0)][_0x44857e(0x337)](_0x4ec43c=>_0x44857e(0x279)+_0x4ec43c)],_0x4ab9fb[_0x44857e(0x1e4)]=_0x452b1d[_0x44857e(0x1cc)](_0xf3b19d=>{const _0x3f02b2=_0x44857e;if(!_0xf3b19d||typeof _0xf3b19d!==_0x3f02b2(0x217))return![];if(_0xf3b19d[_0x3f02b2(0x356)]===_0x3f02b2(0x184))return _0x4346e4[_0x3f02b2(0x228)](_0xf3b19d[_0x3f02b2(0x20e)]);if(_0xf3b19d[_0x3f02b2(0x356)]===_0x3f02b2(0x332))return _0x55cfe1[_0x3f02b2(0x228)](_0xf3b19d[_0x3f02b2(0x232)])||_0x55cfe1[_0x3f02b2(0x228)](_0xf3b19d[_0x3f02b2(0x320)+_0x3f02b2(0x3cd)])||_0x51f401[_0x3f02b2(0x228)](_0xf3b19d['resolved'+_0x3f02b2(0x1c4)]);return![];});const _0x1469af=new Set(_0x4ab9fb[_0x44857e(0x1e4)][_0x44857e(0x337)](_0x2907f3=>_0x2907f3[_0x44857e(0x20e)]));for(const _0x4f1d58 of _0x452b1d){if(!_0x4f1d58[_0x44857e(0x20e)]||_0x1469af[_0x44857e(0x228)](_0x4f1d58[_0x44857e(0x20e)]))continue;const _0x7670b2=typeof _0x4f1d58[_0x44857e(0x168)+_0x44857e(0x24e)]==='string'&&_0x4f1d58[_0x44857e(0x168)+_0x44857e(0x24e)][_0x44857e(0x354)]()?resolve(_0xff5f40,_0x4f1d58['installP'+_0x44857e(0x24e)]):join(_0x15b334,_0x4f1d58[_0x44857e(0x20e)]),_0x486e5b=relative(_0x15b334,_0x7670b2);if(_0x486e5b['startsWi'+'th']('..')||_0x486e5b==='')continue;await rm(_0x7670b2,{'recursive':!![],'force':!![]});}}async function collectCapabilityEntries(_0x4e7148,_0x353f8a){const _0x46a6d8=_0x44ad8a,_0x5af8cd=new Map();for(const _0x4c0493 of _0x4e7148){let _0xa93cdc;try{_0xa93cdc=await stat(_0x4c0493);}catch{throw new Error(_0x353f8a+(_0x46a6d8(0x2d4)+'s\x20not\x20fo'+_0x46a6d8(0x294))+_0x4c0493);}if(!_0xa93cdc[_0x46a6d8(0x296)+'ory']())throw new Error(_0x353f8a+('\x20path\x20mu'+_0x46a6d8(0x259)+_0x46a6d8(0x250)+_0x46a6d8(0x14a))+_0x4c0493);const _0x59a013={'name':basename(_0x4c0493),'path':_0x4c0493},_0x1564e0=_0x5af8cd[_0x46a6d8(0x1c6)](_0x59a013[_0x46a6d8(0x331)]);if(_0x1564e0)throw new Error('Duplicat'+'e\x20'+_0x353f8a+'\x20entry\x20\x22'+_0x59a013[_0x46a6d8(0x331)]+_0x46a6d8(0x282)+_0x1564e0[_0x46a6d8(0x274)]+_0x46a6d8(0x25a)+_0x59a013[_0x46a6d8(0x274)]);_0x5af8cd[_0x46a6d8(0x27f)](_0x59a013['name'],_0x59a013);}return[..._0x5af8cd['values']()];}async function syncProductCapabilityDirs(_0x1224e5,_0xc0ed2e,_0xa00791){const _0x46cc61=_0x44ad8a,_0x43bef8=await collectCapabilityEntries(_0x1224e5,_0xa00791);await rm(_0xc0ed2e,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(_0xc0ed2e,{'recursive':!![]});for(const _0x2d7b78 of _0x43bef8){await cp(_0x2d7b78[_0x46cc61(0x274)],join(_0xc0ed2e,_0x2d7b78[_0x46cc61(0x331)]),{'recursive':!![]});}return _0x43bef8['length'];}export const __test__={'collectCapabilityEntries':collectCapabilityEntries,'prunePackagedRuntimePayload':prunePackagedRuntimePayload,'syncProductCapabilityDirs':syncProductCapabilityDirs,'resolveNodeExtractRoot':resolveNodeExtractRoot};async function syncProductAgents(_0x4d0ae2,_0x3a6c51,_0x1db71d){const _0x30db9a=_0x44ad8a,_0x181f98=join(_0x3a6c51,_0x30db9a(0x251),_0x30db9a(0x374)),_0x5ceeae=await syncProductCapabilityDirs(_0x4d0ae2[_0x30db9a(0x251)][_0x30db9a(0x320)+'LocalAge'+'ntPaths'],_0x181f98,'agent');_0x1db71d[_0x30db9a(0x374)]={'source':_0x30db9a(0x376),'installPath':toRuntimeRelative(_0x3a6c51,_0x181f98),'localPaths':_0x4d0ae2[_0x30db9a(0x251)][_0x30db9a(0x320)+'LocalAge'+'ntPaths'],'entryCount':_0x5ceeae};}async function syncProductSkills(_0x41690c,_0x5a53f4,_0x39d8b2){const _0x162692=_0x44ad8a,_0x5e4e64=join(_0x5a53f4,'openclaw',_0x162692(0x1c7)),_0x47336b=await syncProductCapabilityDirs(_0x41690c[_0x162692(0x251)][_0x162692(0x320)+_0x162692(0x22f)+_0x162692(0x34e)],_0x5e4e64,'skill');_0x39d8b2['skills']={'source':_0x162692(0x376),'installPath':toRuntimeRelative(_0x5a53f4,_0x5e4e64),'localPaths':_0x41690c[_0x162692(0x251)][_0x162692(0x320)+_0x162692(0x22f)+_0x162692(0x34e)],'entryCount':_0x47336b};}
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};}