@wujie-shell/core 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/wujie-shell.mjs +1 -1
- package/dist/src/agents/bundled-agent-skills.mjs +1 -1
- package/dist/src/agents/bundled-agents.mjs +1 -1
- package/dist/src/chat/media-archive.mjs +1 -1
- package/dist/src/chat/queue.mjs +1 -1
- package/dist/src/common/diagnostics.mjs +1 -1
- package/dist/src/common/logging.mjs +1 -1
- package/dist/src/common/runtime-logger.mjs +1 -1
- package/dist/src/common/user-events.mjs +1 -1
- package/dist/src/common/utils.mjs +1 -1
- package/dist/src/config/controller.mjs +1 -1
- package/dist/src/connectors/config-utils.mjs +1 -1
- package/dist/src/connectors/constants.mjs +1 -1
- package/dist/src/connectors/controller.mjs +1 -1
- package/dist/src/connectors/kdocs-cli.mjs +1 -1
- package/dist/src/electron/main.mjs +1 -1
- package/dist/src/electron/preload.mjs +1 -1
- package/dist/src/files/generated-files-store.mjs +1 -1
- package/dist/src/files/handlers.mjs +1 -1
- package/dist/src/gateway/chat-delta.mjs +1 -1
- package/dist/src/gateway/controller.mjs +1 -1
- package/dist/src/gateway/ws-client.mjs +1 -1
- package/dist/src/index.mjs +1 -1
- package/dist/src/log-reporting/handlers.mjs +1 -1
- package/dist/src/log-reporting/report-logs.mjs +1 -1
- package/dist/src/models/handlers.mjs +1 -1
- package/dist/src/preferences/store.mjs +1 -1
- package/dist/src/runtime/index.mjs +1 -1
- package/dist/src/runtime/patch-channel-plugin-runtime.mjs +1 -1
- package/dist/src/runtime/patch-chat-history-mixed-tool-content.mjs +1 -1
- package/dist/src/runtime/patch-session-store-sqlite.mjs +1 -1
- package/dist/src/runtime/plugin-sync.mjs +1 -1
- package/dist/src/sessions/agent-sessions-map-store.mjs +1 -1
- package/dist/src/sessions/runtime-bridge.mjs +1 -1
- package/dist/src/sessions/session-sqlite-store.mjs +1 -1
- package/dist/src/skills/import.mjs +1 -1
- package/dist/src/skills/market.mjs +1 -1
- package/dist/src/terminal/manager.mjs +1 -1
- package/dist/src/updates/controller.mjs +1 -1
- package/dist/src/updates/loader.mjs +1 -1
- package/package.json +3 -3
package/dist/bin/wujie-shell.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const _0x1ecc9=_0x19c8;(function(_0x4d7611,_0x520ae8){const _0x29a1aa=_0x19c8,_0xe4d98f=_0x4d7611();while(!![]){try{const _0x39e7c6=-parseInt(_0x29a1aa(0x18e))/0x1+-parseInt(_0x29a1aa(0x1a6))/0x2*(parseInt(_0x29a1aa(0x196))/0x3)+parseInt(_0x29a1aa(0x198))/0x4+-parseInt(_0x29a1aa(0x1a9))/0x5*(parseInt(_0x29a1aa(0x18f))/0x6)+parseInt(_0x29a1aa(0x181))/0x7+parseInt(_0x29a1aa(0x19f))/0x8+-parseInt(_0x29a1aa(0x17e))/0x9*(-parseInt(_0x29a1aa(0x190))/0xa);if(_0x39e7c6===_0x520ae8)break;else _0xe4d98f['push'](_0xe4d98f['shift']());}catch(_0x5910e9){_0xe4d98f['push'](_0xe4d98f['shift']());}}}(_0x1f73,0xd0e40));import{existsSync}from'node:fs';function _0x19c8(_0x55c52f,_0x573702){_0x55c52f=_0x55c52f-0x17e;const _0x1f73cf=_0x1f73();let _0x19c856=_0x1f73cf[_0x55c52f];return _0x19c856;}import{resolve}from'node:path';import{loadShellConfig}from'@wujie-shell/config';const runtimeEntry=existsSync(new URL(_0x1ecc9(0x1ab)+_0x1ecc9(0x182)+_0x1ecc9(0x186)+_0x1ecc9(0x192),import.meta.url))?_0x1ecc9(0x1ab)+_0x1ecc9(0x182)+'ime/inde'+'x.mjs':_0x1ecc9(0x19d)+_0x1ecc9(0x1a3)+_0x1ecc9(0x18a),{prepareRuntime}=await import(runtimeEntry);function parseArgs(_0x4ab977){const _0x3ecd35=_0x1ecc9,_0x16dfe2=[..._0x4ab977],_0x3d490a=_0x16dfe2['shift']()||_0x3ecd35(0x19c),_0x46acb4={'project':process[_0x3ecd35(0x185)]()};for(let _0x3fcbbf=0x0;_0x3fcbbf<_0x16dfe2[_0x3ecd35(0x1a7)];_0x3fcbbf+=0x1){const _0x1df2a4=_0x16dfe2[_0x3fcbbf];(_0x1df2a4===_0x3ecd35(0x19e)+'t'||_0x1df2a4==='-p')&&(_0x46acb4[_0x3ecd35(0x1a5)]=_0x16dfe2[_0x3fcbbf+0x1],_0x3fcbbf+=0x1);}return{'command':_0x3d490a,'options':_0x46acb4};}function usage(){const _0x2bf1e3=_0x1ecc9;console[_0x2bf1e3(0x18d)](_0x2bf1e3(0x191)+_0x2bf1e3(0x19b)+_0x2bf1e3(0x187)+_0x2bf1e3(0x1ad)+_0x2bf1e3(0x18c)+_0x2bf1e3(0x184)+'ect\x20<ui-'+_0x2bf1e3(0x194)+_0x2bf1e3(0x18b)+'-shell\x20s'+'ync\x20--pr'+_0x2bf1e3(0x183)+_0x2bf1e3(0x1a0)+'t>\x0a');}async function main(){const _0x568c96=_0x1ecc9,{command:_0x477a3e,options:_0x4bf984}=parseArgs(process[_0x568c96(0x1ac)][_0x568c96(0x1a8)](0x2));if(_0x477a3e==='help'||_0x477a3e==='--help'||_0x477a3e==='-h'){usage();return;}if(_0x477a3e!=='prepare'&&_0x477a3e!==_0x568c96(0x1a2))throw new Error(_0x568c96(0x199)+_0x568c96(0x1aa)+'\x20'+_0x477a3e);const _0x2f2047=resolve(_0x4bf984[_0x568c96(0x1a5)]),_0x204cbc=await loadShellConfig(_0x2f2047),_0x2ad7f6=await prepareRuntime(_0x204cbc,{'syncOnly':_0x477a3e===_0x568c96(0x1a2)});console[_0x568c96(0x18d)](JSON[_0x568c96(0x197)+'y']({'ok':!![],'command':_0x477a3e,'projectRoot':_0x2f2047,'runtimeRoot':_0x2f2047+(_0x568c96(0x1a1)+_0x568c96(0x188)),'openclawVersion':_0x2ad7f6[_0x568c96(0x195)+_0x568c96(0x17f)],'pluginCount':Array[_0x568c96(0x193)](_0x2ad7f6[_0x568c96(0x1a4)])?_0x2ad7f6['plugins'][_0x568c96(0x1a7)]:0x0},null,0x2));}function _0x1f73(){const _0x55ca45=['4829559gjDTds','stringif','4269656cMDwaL','unknown\x20','catch','ell\x0a\x0aUsa','help','../src/r','--projec','11822176BOuIzv','i-projec','/.tmp/ru','sync','untime/i','plugins','project','2bEIzZf','length','slice','180qaJBhk','command:','../dist/','argv','jie-shel','1111059KhzOoH','Version','stack','1913884OZCOVo','src/runt','oject\x20<u','e\x20--proj','cwd','ime/inde','ge:\x0a\x20\x20wu','ntime','error','ndex.mjs','\x0a\x20\x20wujie','l\x20prepar','log','511728HkgrjP','241044aifqmo','130HGXKsc','wujie-sh','x.mjs','isArray','project>','openclaw'];_0x1f73=function(){return _0x55ca45;};return _0x1f73();}main()[_0x1ecc9(0x19a)](_0x4cfc66=>{const _0x1fc5c7=_0x1ecc9;console[_0x1fc5c7(0x189)](_0x4cfc66 instanceof Error?_0x4cfc66[_0x1fc5c7(0x180)]||_0x4cfc66['message']:String(_0x4cfc66)),process['exit'](0x1);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xbefbcb,_0x15594a){const _0x4e96d0=_0x3ce1,_0x15b485=_0xbefbcb();while(!![]){try{const _0x59ef53=-parseInt(_0x4e96d0(0x1df))/0x1+parseInt(_0x4e96d0(0x1ef))/0x2+-parseInt(_0x4e96d0(0x1d9))/0x3+parseInt(_0x4e96d0(0x1ed))/0x4*(parseInt(_0x4e96d0(0x1d8))/0x5)+-parseInt(_0x4e96d0(0x1e6))/0x6*(-parseInt(_0x4e96d0(0x1f2))/0x7)+parseInt(_0x4e96d0(0x1d6))/0x8+parseInt(_0x4e96d0(0x1ce))/0x9;if(_0x59ef53===_0x15594a)break;else _0x15b485['push'](_0x15b485['shift']());}catch(_0x1d8747){_0x15b485['push'](_0x15b485['shift']());}}}(_0x3be5,0xe8fdb));import{existsSync}from'node:fs';import{readFile,readdir}from'node:fs/promises';import{join}from'node:path';import{asRecord,asStringArray,dedupeStrings,getTrimmedString}from'../common/utils.mjs';function _0x3be5(){const _0x58dc06=['^\x5cs+','agentAll','hell:ski','ption','BySkillK','keys','utf8','skills','entries','cnName','5283972IdOODK','find','match','name','metadata','length','ory','agents','2060176czYRYD','cnDescri','10eATPzL','2541075vUqxYr','list','extraDir','load','openclaw','parse','1640041HkEidK','isDirect','push','isArray','ead\x20skil','SKILL.md','[wujie-s','186OvuzEg','startsWi','stringif','ls\x20dir\x20a','catch','owlist','map','1933436adOiXP',':\x5cs*(.+)','2395756nywsPy','trim','object','97587itRCSC'];_0x3be5=function(){return _0x58dc06;};return _0x3be5();}function extractFrontmatter(_0x2c05c6){const _0x4626d7=_0x3ce1,_0x317713=String(_0x2c05c6||'')[_0x4626d7(0x1d0)](/^---\s*\r?\n([\s\S]*?)\r?\n---/);return _0x317713?.[0x1]||'';}function stripYamlQuote(_0x14a6e6){return getTrimmedString(_0x14a6e6)['replace'](/^["']|["']$/g,'');}function resolveFrontmatterValue(_0x120403,_0x33e6ef){const _0x111ed9=_0x3ce1,_0x31e359=_0x120403['match'](new RegExp('^\x5cs*'+_0x33e6ef+(_0x111ed9(0x1ee)+'$'),'m'))?.[0x1];return stripYamlQuote(_0x31e359);}function resolveIndentedYamlValue(_0x1e9b73,_0x2159cd){const _0x5c3f8c=_0x3ce1,_0x4953b8=String(_0x1e9b73||'')['match'](new RegExp(_0x5c3f8c(0x1f3)+_0x2159cd+(_0x5c3f8c(0x1ee)+'$'),'m'))?.[0x1];return stripYamlQuote(_0x4953b8);}function resolveMetadataJsonBlock(_0x21b9f0){const _0x2439b8=_0x3ce1,_0x1f7722=_0x21b9f0[_0x2439b8(0x1d0)](/^metadata:\s*[|>]\s*\r?\n((?:[ \t]+.*(?:\r?\n|$))*)/m);if(!_0x1f7722?.[0x1])return{};try{return asRecord(JSON[_0x2439b8(0x1de)](_0x1f7722[0x1]));}catch{return{};}}function readOpenClawDisplayMetadataFromFrontmatter(_0x2be2cd){const _0x525e0e=_0x3ce1,_0x181ed1=resolveMetadataJsonBlock(_0x2be2cd),_0x3c8ee4=asRecord(_0x181ed1[_0x525e0e(0x1dd)]),_0x7a30e8=getTrimmedString(_0x3c8ee4[_0x525e0e(0x1cd)])||resolveFrontmatterValue(_0x2be2cd,_0x525e0e(0x1cd))||resolveIndentedYamlValue(_0x2be2cd,_0x525e0e(0x1cd)),_0x20246b=getTrimmedString(_0x3c8ee4['cnDescri'+_0x525e0e(0x1f6)])||resolveFrontmatterValue(_0x2be2cd,_0x525e0e(0x1d7)+_0x525e0e(0x1f6))||resolveIndentedYamlValue(_0x2be2cd,'cnDescri'+_0x525e0e(0x1f6));return{..._0x7a30e8?{'cnName':_0x7a30e8}:{},..._0x20246b?{'cnDescription':_0x20246b}:{}};}async function readSkillDisplayMetadata(_0x1ea41b){const _0x49ecd4=_0x3ce1,_0x1de55c=await readFile(join(_0x1ea41b,_0x49ecd4(0x1e4)),'utf8')[_0x49ecd4(0x1ea)](()=>'');if(!_0x1de55c['trim']())return{};const _0x34e5d5=extractFrontmatter(_0x1de55c);if(!_0x34e5d5)return{};return readOpenClawDisplayMetadataFromFrontmatter(_0x34e5d5);}async function listValidSkillKeys(_0x321c5f,_0xf161ae){const _0x5420ca=_0x3ce1;if(!existsSync(_0x321c5f))return{'skillKeys':[],'metadataBySkillKey':{}};let _0x1a0292=[];try{_0x1a0292=await readdir(_0x321c5f,{'withFileTypes':!![],'encoding':_0x5420ca(0x1ca)});}catch(_0x53f04e){return console['warn'](_0x5420ca(0x1e5)+_0x5420ca(0x1f5)+'lls]\x20fai'+'led\x20to\x20r'+_0x5420ca(0x1e3)+_0x5420ca(0x1e9)+'gent='+_0xf161ae,_0x53f04e),{'skillKeys':[],'metadataBySkillKey':{}};}const _0x759800=[],_0x524317={};for(const _0x5d8e1a of _0x1a0292){if(!_0x5d8e1a[_0x5420ca(0x1e0)+_0x5420ca(0x1d4)]())continue;const _0x931417=_0x5d8e1a[_0x5420ca(0x1d1)][_0x5420ca(0x1f0)]();if(!_0x931417||_0x931417[_0x5420ca(0x1e7)+'th']('_'))continue;const _0x10535d=join(_0x321c5f,_0x931417);if(!existsSync(join(_0x10535d,_0x5420ca(0x1e4))))continue;_0x759800[_0x5420ca(0x1e1)](_0x931417);const _0x408502=await readSkillDisplayMetadata(_0x10535d);if(Object[_0x5420ca(0x1c9)](_0x408502)[_0x5420ca(0x1d3)]>0x0)_0x524317[_0x931417]=_0x408502;}return{'skillKeys':_0x759800,'metadataBySkillKey':_0x524317};}export async function discoverBundledAgentSkills(_0x22b2a4,_0x1674c1){const _0x5019bb=_0x3ce1,_0x124948=[],_0x1d4a08={},_0xe4a2c2={},_0xb799ee={};for(const _0x4e2bf5 of _0x22b2a4){const _0x224658=_0x1674c1(_0x4e2bf5),_0x46b2d1=await listValidSkillKeys(_0x224658,_0x4e2bf5),{skillKeys:_0xfe0ac7}=_0x46b2d1;_0xe4a2c2[_0x4e2bf5]=_0xfe0ac7,Object['assign'](_0xb799ee,_0x46b2d1[_0x5019bb(0x1d2)+_0x5019bb(0x1f7)+'ey']),_0xfe0ac7[_0x5019bb(0x1d3)]>0x0&&(_0x124948[_0x5019bb(0x1e1)](_0x224658),_0x1d4a08[_0x4e2bf5]=_0x224658);}return{'extraDirs':_0x124948,'extraDirByAgent':_0x1d4a08,'agentAllowlist':_0xe4a2c2,'metadataBySkillKey':_0xb799ee};}export async function syncBundledAgentSkillsToConfig({agentIds:_0x5f2952,resolveSkillsDir:_0x9508d5,readConfig:_0x1c9a28,writeConfig:_0x717d84,markConfigWriteHandledInternally:_0x3014a4}){const _0x1e023a=_0x3ce1,_0xcd9ad2=await discoverBundledAgentSkills(_0x5f2952,_0x9508d5);if(_0x5f2952['length']===0x0)return{'discovery':_0xcd9ad2,'changed':![]};const _0x1b059d=await _0x1c9a28();let _0x2d8da6=![];const _0x6a634e=asRecord(_0x1b059d['skills']),_0x1176fe=asRecord(_0x6a634e[_0x1e023a(0x1dc)]),_0x284482=asStringArray(_0x1176fe[_0x1e023a(0x1db)+'s']),_0x5a526d=dedupeStrings([..._0x284482,..._0xcd9ad2['extraDir'+'s']]);JSON[_0x1e023a(0x1e8)+'y'](_0x284482)!==JSON[_0x1e023a(0x1e8)+'y'](_0x5a526d)&&(_0x1176fe[_0x1e023a(0x1db)+'s']=_0x5a526d,_0x6a634e[_0x1e023a(0x1dc)]=_0x1176fe,_0x1b059d[_0x1e023a(0x1cb)]=_0x6a634e,_0x2d8da6=!![]);const _0x1560a1=asRecord(_0x1b059d[_0x1e023a(0x1d5)]),_0x2f1a1a=Array[_0x1e023a(0x1e2)](_0x1560a1[_0x1e023a(0x1da)])?_0x1560a1[_0x1e023a(0x1da)]:[];if(_0x2f1a1a[_0x1e023a(0x1d3)]>0x0){const _0x2fc2f2=_0x2f1a1a[_0x1e023a(0x1ec)](_0x2447b4=>_0x2447b4&&typeof _0x2447b4===_0x1e023a(0x1f1)?{..._0x2447b4}:_0x2447b4);let _0x43c7ad=![];for(const [_0x49120b,_0x112f52]of Object[_0x1e023a(0x1cc)](_0xcd9ad2[_0x1e023a(0x1f4)+_0x1e023a(0x1eb)])){if(_0x49120b==='main')continue;const _0x2305bc=_0x2fc2f2[_0x1e023a(0x1cf)](_0x553df6=>asRecord(_0x553df6)['id']===_0x49120b);if(!_0x2305bc)continue;const _0x22714d=Array[_0x1e023a(0x1e2)](_0x2305bc['skills'])?_0x2305bc[_0x1e023a(0x1cb)]:null;(!_0x22714d||JSON[_0x1e023a(0x1e8)+'y'](_0x22714d)!==JSON['stringif'+'y'](_0x112f52))&&(_0x2305bc['skills']=_0x112f52,_0x43c7ad=!![]);}_0x43c7ad&&(_0x1560a1['list']=_0x2fc2f2,_0x1b059d[_0x1e023a(0x1d5)]=_0x1560a1,_0x2d8da6=!![]);}return _0x2d8da6&&(_0x3014a4?.(),await _0x717d84(_0x1b059d)),{'discovery':_0xcd9ad2,'changed':_0x2d8da6};}function applyBundledSkillMetadata(_0x44949a,_0x1c38ec){const _0x241248=_0x3ce1,_0x380d9a=asRecord(asRecord(_0x1c38ec)['metadata'+_0x241248(0x1f7)+'ey']);if(Object[_0x241248(0x1c9)](_0x380d9a)['length']===0x0)return _0x44949a;return _0x44949a['map'](_0x36a983=>{const _0xb70353=_0x241248,_0x2159d4=asRecord(_0x36a983),_0x1bd230=getTrimmedString(_0x2159d4['skillKey'])||getTrimmedString(_0x2159d4[_0xb70353(0x1d1)]),_0x93af22=asRecord(_0x380d9a[_0x1bd230]);if(Object[_0xb70353(0x1c9)](_0x93af22)[_0xb70353(0x1d3)]===0x0)return _0x36a983;return{..._0x2159d4,...getTrimmedString(_0x2159d4[_0xb70353(0x1cd)])?{}:{'cnName':getTrimmedString(_0x93af22[_0xb70353(0x1cd)])||null},...getTrimmedString(_0x2159d4[_0xb70353(0x1d7)+_0xb70353(0x1f6)])?{}:{'cnDescription':getTrimmedString(_0x93af22[_0xb70353(0x1d7)+'ption'])||null}};});}function _0x3ce1(_0x48fddd,_0x4dca82){_0x48fddd=_0x48fddd-0x1c9;const _0x3be51a=_0x3be5();let _0x3ce128=_0x3be51a[_0x48fddd];return _0x3ce128;}export function filterSkillsForAgent(_0x4f4301,_0x561486,_0x76cdee='',_0x361886=null){const _0x3648c9=_0x3ce1,_0x2c56c0=Array[_0x3648c9(0x1e2)](asRecord(_0x4f4301)['skills'])?asRecord(_0x4f4301)[_0x3648c9(0x1cb)]:[],_0x145985=getTrimmedString(_0x76cdee)||'main',_0x221237=Array[_0x3648c9(0x1e2)](asRecord(asRecord(_0x561486)[_0x3648c9(0x1d5)])[_0x3648c9(0x1da)])?asRecord(asRecord(_0x561486)[_0x3648c9(0x1d5)])[_0x3648c9(0x1da)]:[],_0x5123b3=_0x221237[_0x3648c9(0x1ec)](asRecord)[_0x3648c9(0x1cf)](_0x4aca32=>getTrimmedString(_0x4aca32['id'])===_0x145985),_0x7a4da3=_0x5123b3&&Array[_0x3648c9(0x1e2)](_0x5123b3['skills'])?new Set(asStringArray(_0x5123b3[_0x3648c9(0x1cb)])):null,_0x3311d6=applyBundledSkillMetadata(_0x2c56c0,_0x361886);if(!_0x7a4da3)return{...asRecord(_0x4f4301),'skills':_0x3311d6};return{...asRecord(_0x4f4301),'skills':_0x3311d6['filter'](_0x4ec36f=>_0x7a4da3['has'](getTrimmedString(asRecord(_0x4ec36f)[_0x3648c9(0x1d1)])))};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x381f54,_0x3b95c2){const _0x4f7e3e=_0x14f3,_0x1cf2d0=_0x381f54();while(!![]){try{const _0x4e85cd=parseInt(_0x4f7e3e(0x98))/0x1+parseInt(_0x4f7e3e(0xb1))/0x2+parseInt(_0x4f7e3e(0x89))/0x3+parseInt(_0x4f7e3e(0xa6))/0x4*(parseInt(_0x4f7e3e(0x9a))/0x5)+parseInt(_0x4f7e3e(0x8e))/0x6*(-parseInt(_0x4f7e3e(0xac))/0x7)+-parseInt(_0x4f7e3e(0x88))/0x8+-parseInt(_0x4f7e3e(0x8b))/0x9;if(_0x4e85cd===_0x3b95c2)break;else _0x1cf2d0['push'](_0x1cf2d0['shift']());}catch(_0x5208de){_0x1cf2d0['push'](_0x1cf2d0['shift']());}}}(_0x372a,0x1bb91));import{existsSync}from'node:fs';function _0x372a(){const _0x2aa0ea=['mcpServe','workspac','forceSyn','116mYaYWm','led\x20to\x20s','afe\x20mana','capabili','toolsDen','pped\x20uns','163828MVnVNX','error','trim','[wujie-s','ync\x20bund','152888bXalxJ','icon','absPath','filter','warn','cOnDev','map','managedP','avatar','ePaths','agentId','some','321760KMUrUt','518406eHZOzZ','includes','2600604GgiXLq','version','name','6ARHUPM','function','isArray','readme.j','length','cnName','son','t\x20\x22','emoji','model','180057WiNJhL','tyDomain','6350YtDGaL','deletabl','main','startsWi','hell:age','ins','agents','toolDoma','led\x20agen'];_0x372a=function(){return _0x2aa0ea;};return _0x372a();}import{cp,mkdir,readFile,readdir,rm}from'node:fs/promises';import{dirname,join,resolve,sep}from'node:path';import{asRecord,asStringArray,getTrimmedString,readJson}from'../common/utils.mjs';function toOptionalString(_0x50a761){const _0x5a8db8=getTrimmedString(_0x50a761);return _0x5a8db8||undefined;}export async function loadBundledAgents(_0x5230a6){const _0x54ff51=_0x14f3;let _0x12576f=[];try{_0x12576f=await readdir(_0x5230a6,{'withFileTypes':!![],'encoding':'utf8'});}catch{return[];}const _0x2f4467=await Promise['all'](_0x12576f[_0x54ff51(0xb4)](_0x599390=>_0x599390['isDirect'+'ory']())[_0x54ff51(0xb7)](async _0x35abf8=>{const _0x545173=_0x54ff51,_0x3b13d4=_0x35abf8[_0x545173(0x8d)][_0x545173(0xae)]();if(!_0x3b13d4)return null;const _0xfc1db8=await readJson(join(_0x5230a6,_0x3b13d4,_0x545173(0x91)+'son'),{}),_0x3de68b=asRecord(_0xfc1db8),_0x4e4d3c=toOptionalString(_0x3de68b[_0x545173(0x8d)])??_0x3b13d4;if(!_0x4e4d3c)return null;return{'name':_0x4e4d3c,'cnName':toOptionalString(_0x3de68b[_0x545173(0x93)]),'avatar':toOptionalString(_0x3de68b[_0x545173(0xb9)]),'icon':toOptionalString(_0x3de68b[_0x545173(0xb2)]),'emoji':toOptionalString(_0x3de68b[_0x545173(0x96)]),'model':toOptionalString(_0x3de68b[_0x545173(0x97)]),'version':toOptionalString(_0x3de68b[_0x545173(0x8c)]),'capabilityDomains':asStringArray(_0x3de68b[_0x545173(0xa9)+_0x545173(0x99)+'s']??_0x3de68b[_0x545173(0xa1)+_0x545173(0x9f)]),'managedPaths':asStringArray(_0x3de68b[_0x545173(0xb8)+'aths']??_0x3de68b[_0x545173(0x9b)+_0x545173(0xba)]),'toolsDeny':asStringArray(_0x3de68b[_0x545173(0xaa)+'y']),'mcpServers':asRecord(_0x3de68b[_0x545173(0xa3)+'rs']),'forceSyncOnDev':typeof _0x3de68b[_0x545173(0xa5)+_0x545173(0xb6)]==='boolean'?_0x3de68b['forceSyn'+_0x545173(0xb6)]:undefined};}));return _0x2f4467[_0x54ff51(0xb4)](Boolean);}export function shouldForceFullSync(_0xbfe5,_0x3050ba){return _0xbfe5===!![]&&!_0x3050ba;}async function readJsonVersion(_0x52d586){const _0x413cc3=_0x14f3;try{const _0x1b86ec=JSON['parse'](await readFile(_0x52d586,'utf8'));return getTrimmedString(asRecord(_0x1b86ec)[_0x413cc3(0x8c)])||null;}catch{return null;}}function assertSafeManagedPath(_0x7fb1e7,_0x5bfa72){const _0x34cd59=_0x14f3,_0x494e5f=getTrimmedString(_0x5bfa72);if(!_0x494e5f||_0x494e5f[_0x34cd59(0x9d)+'th']('/')||_0x494e5f[_0x34cd59(0x8a)]('..'))return null;const _0xb3ed41=resolve(_0x7fb1e7),_0xd541f9=resolve(join(_0x7fb1e7,_0x494e5f));if(_0xd541f9!==_0xb3ed41&&!_0xd541f9[_0x34cd59(0x9d)+'th'](_0xb3ed41+sep))return null;return{'relPath':_0x494e5f,'absPath':_0xd541f9};}function _0x14f3(_0x34ed4d,_0x318588){_0x34ed4d=_0x34ed4d-0x88;const _0x372a13=_0x372a();let _0x14f327=_0x372a13[_0x34ed4d];return _0x14f327;}async function copyManagedPaths(_0xe90b8d,_0x57f402,_0x5de429){const _0x5e9371=_0x14f3;if(_0x5de429[_0x5e9371(0x92)]===0x0){await cp(_0xe90b8d,_0x57f402,{'recursive':!![]});return;}for(const _0x567c11 of _0x5de429){const _0x75b11b=assertSafeManagedPath(_0x57f402,_0x567c11);if(!_0x75b11b){console[_0x5e9371(0xb5)](_0x5e9371(0xaf)+_0x5e9371(0x9e)+'nts]\x20ski'+_0x5e9371(0xab)+_0x5e9371(0xa8)+'gedPath:'+'\x20'+_0x567c11);continue;}const _0xac9f4c=join(_0xe90b8d,_0x75b11b['relPath']);if(!existsSync(_0xac9f4c)){await rm(_0x75b11b[_0x5e9371(0xb3)],{'recursive':!![],'force':!![]});continue;}await rm(_0x75b11b[_0x5e9371(0xb3)],{'recursive':!![],'force':!![]}),await mkdir(dirname(_0x75b11b['absPath']),{'recursive':!![]}),await cp(_0xac9f4c,_0x75b11b['absPath'],{'recursive':!![]});}}export async function ensureBundledAgents({runtimeBundledAgentsDir:_0x2369df,stateDir:_0x37baa5,isPackaged:isPackaged=![],listAgents:_0x634a17,createAgent:_0x45c081,updateAgent:_0x32ad6c,syncSkills:_0x9a089b,syncConfig:_0x2040da,shouldContinue:_0x209058}){const _0x19eeff=_0x14f3;let _0x4a5b3d=![];const _0x46ffe5=typeof _0x209058===_0x19eeff(0x8f)?_0x209058:()=>!![],_0x5cca2d=await _0x634a17();if(!_0x46ffe5())return{'didUpdate':_0x4a5b3d,'bundledAgents':[]};const _0x486103=Array[_0x19eeff(0x90)](_0x5cca2d['agents'])?_0x5cca2d[_0x19eeff(0xa0)]:[],_0x25a207=_0x486103['find'](_0xefe06b=>_0xefe06b?.['id']===_0x19eeff(0x9c)),_0x5cd916=getTrimmedString(_0x25a207?.[_0x19eeff(0xa4)+'e'])||join(_0x37baa5,_0x19eeff(0xa4)+'e'),_0x5196b9=await loadBundledAgents(_0x2369df);for(const _0x3fec9b of _0x5196b9){if(!_0x46ffe5())break;const {name:_0x357805,cnName:_0x2f6e2b,avatar:_0x526fb6,emoji:_0x1ff670,version:_0x490f4d,managedPaths:_0x11f571}=_0x3fec9b,_0x4c6f7a=_0x357805===_0x19eeff(0x9c),_0x52ab4b=_0x4c6f7a?_0x5cd916:join(dirname(_0x5cd916),_0x19eeff(0xa4)+'e-'+_0x357805),_0x427efe=join(_0x2369df,_0x357805);if(!existsSync(_0x427efe))continue;try{const _0x5d65b1=_0x4c6f7a||_0x486103[_0x19eeff(0xbc)](_0x25b18e=>_0x25b18e?.['id']===_0x357805);if(_0x5d65b1){const _0x394126=await readJsonVersion(join(_0x52ab4b,_0x19eeff(0x91)+_0x19eeff(0x94))),_0x1ae135=shouldForceFullSync(_0x3fec9b['forceSyn'+_0x19eeff(0xb6)],isPackaged);if(_0x490f4d&&_0x394126&&_0x490f4d===_0x394126&&!_0x1ae135)continue;_0x1ae135?(await rm(_0x52ab4b,{'recursive':!![],'force':!![]}),await mkdir(_0x52ab4b,{'recursive':!![]}),await cp(_0x427efe,_0x52ab4b,{'recursive':!![]})):(await mkdir(_0x52ab4b,{'recursive':!![]}),await copyManagedPaths(_0x427efe,_0x52ab4b,_0x11f571));}else await rm(_0x52ab4b,{'recursive':!![],'force':!![]}),await mkdir(_0x52ab4b,{'recursive':!![]}),await cp(_0x427efe,_0x52ab4b,{'recursive':!![]});_0x4a5b3d=!![];if(_0x4c6f7a)continue;if(_0x5d65b1){const _0xe5703c={'agentId':_0x357805,'workspace':_0x52ab4b};if(_0x2f6e2b)_0xe5703c[_0x19eeff(0x8d)]=_0x2f6e2b;if(_0x526fb6)_0xe5703c['avatar']=_0x526fb6;if(_0x1ff670)_0xe5703c[_0x19eeff(0x96)]=_0x1ff670;if(!_0x46ffe5())break;await _0x32ad6c(_0xe5703c);}else{const _0x23029a={'name':_0x357805,'workspace':_0x52ab4b};if(_0x526fb6)_0x23029a['avatar']=_0x526fb6;if(_0x1ff670)_0x23029a['emoji']=_0x1ff670;if(!_0x46ffe5())break;const _0x10d85e=asRecord(await _0x45c081(_0x23029a));if(_0x2f6e2b){if(!_0x46ffe5())break;await _0x32ad6c({'agentId':getTrimmedString(_0x10d85e[_0x19eeff(0xbb)])||_0x357805,'name':_0x2f6e2b});}}}catch(_0x35dba7){console[_0x19eeff(0xad)](_0x19eeff(0xaf)+_0x19eeff(0x9e)+'nts]\x20fai'+_0x19eeff(0xa7)+_0x19eeff(0xb0)+_0x19eeff(0xa2)+_0x19eeff(0x95)+_0x357805+'\x22',_0x35dba7);}}return _0x46ffe5()&&await _0x9a089b?.({'agentIds':_0x5196b9['map'](_0x46a7a4=>_0x46a7a4[_0x19eeff(0x8d)]),'mainWorkspace':_0x5cd916}),_0x46ffe5()&&await _0x2040da?.({'bundledAgents':_0x5196b9}),{'didUpdate':_0x4a5b3d,'bundledAgents':_0x5196b9};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2d195e,_0x2fe228){const _0x5ad1ac=_0xbd63,_0x1fdeb4=_0x2d195e();while(!![]){try{const _0x1cd536=-parseInt(_0x5ad1ac(0xc1))/0x1*(parseInt(_0x5ad1ac(0xd5))/0x2)+parseInt(_0x5ad1ac(0xcb))/0x3+-parseInt(_0x5ad1ac(0xc3))/0x4+parseInt(_0x5ad1ac(0xb6))/0x5+parseInt(_0x5ad1ac(0xd2))/0x6*(parseInt(_0x5ad1ac(0xd4))/0x7)+-parseInt(_0x5ad1ac(0xd7))/0x8+parseInt(_0x5ad1ac(0xc2))/0x9*(parseInt(_0x5ad1ac(0xd0))/0xa);if(_0x1cd536===_0x2fe228)break;else _0x1fdeb4['push'](_0x1fdeb4['shift']());}catch(_0x579221){_0x1fdeb4['push'](_0x1fdeb4['shift']());}}}(_0x3765,0x405c7));import{createHash}from'node:crypto';import{copyFile,lstat,mkdir,readFile}from'node:fs/promises';function _0xbd63(_0x321504,_0x3b358f){_0x321504=_0x321504-0xb5;const _0x376526=_0x3765();let _0xbd6320=_0x376526[_0x321504];return _0xbd6320;}import{join,parse,resolve,sep}from'node:path';function sanitizeSessionKey(_0x43f6b1){const _0x5c665b=_0xbd63,_0x43d151=String(_0x43f6b1??'')[_0x5c665b(0xb9)]()[_0x5c665b(0xbc)](/[^A-Za-z0-9._-]+/g,'_')[_0x5c665b(0xbc)](/^_+|_+$/g,'')[_0x5c665b(0xbb)](0x0,0x78);return _0x43d151||_0x5c665b(0xce);}function isPathInsideDir(_0x220f6e,_0x318400){const _0x2ad2a9=_0xbd63,_0x32fd2b=resolve(_0x220f6e),_0x3c4376=resolve(_0x318400);return _0x32fd2b===_0x3c4376||_0x32fd2b[_0x2ad2a9(0xc9)+'th'](_0x3c4376+sep);}async function hashFile(_0x4a2b40){const _0x223b96=_0xbd63;return createHash(_0x223b96(0xd1))[_0x223b96(0xbf)](await readFile(_0x4a2b40))[_0x223b96(0xb8)](_0x223b96(0xcd));}export function getArchivedChatMediaDir(_0x247815,_0x2ead1e){const _0x47d3d4=_0xbd63;return join(_0x247815,_0x47d3d4(0xd3),_0x47d3d4(0xc6)+_0x47d3d4(0xbd),sanitizeSessionKey(_0x2ead1e));}function _0x3765(){const _0x21cbb7=['message','hex','session','size','1300RrmLdF','sha256','150JCffzD','media','26145bprBzB','2036ivkhec','t\x20find\x20a','722936enDCtY','\x20source:','achment\x20','non-file','\x20free\x20sl','icLink','1682645nsafYn','isFile','digest','trim','archive\x20','slice','replace','achments','could\x20no','update','isSymbol','310GZuYAU','28881wujBzO','2018200TeJPBM','or\x20','ot\x20for:\x20','chat-att','failed\x20f','chat\x20att','startsWi','skipped\x20','981138bgdVpv'];_0x3765=function(){return _0x21cbb7;};return _0x3765();}export async function archiveChatAttachmentForHistory({mediaPath:_0x2d7b04,stateDir:_0x5ab94d,sessionKey:_0x264299,onWarn:_0xa7971f}){const _0x1efa9b=_0xbd63,_0x5ae4b4=getArchivedChatMediaDir(_0x5ab94d,_0x264299),{base:_0x35a093,name:_0xd4650d,ext:_0x235498}=parse(_0x2d7b04);if(!_0x35a093||_0x35a093==='.'||_0x35a093==='..')return _0x2d7b04;let _0x10f762;try{_0x10f762=await lstat(_0x2d7b04);}catch{return _0xa7971f?.(_0x1efa9b(0xc8)+_0x1efa9b(0xd9)+'source\x20m'+'issing:\x20'+_0x2d7b04),_0x2d7b04;}if(!_0x10f762[_0x1efa9b(0xb7)]()||_0x10f762[_0x1efa9b(0xc0)+_0x1efa9b(0xb5)]())return _0xa7971f?.('chat\x20att'+'achment\x20'+_0x1efa9b(0xca)+_0x1efa9b(0xda)+_0x1efa9b(0xd8)+'\x20'+_0x2d7b04),_0x2d7b04;for(let _0x2d9b14=0x0;_0x2d9b14<=0x3e7;_0x2d9b14+=0x1){const _0x3530c7=_0x2d9b14===0x0?_0x35a093:_0xd4650d+'_'+_0x2d9b14+_0x235498,_0x16bf60=join(_0x5ae4b4,_0x3530c7);if(!isPathInsideDir(_0x16bf60,_0x5ae4b4))break;let _0x4049f3;try{_0x4049f3=await lstat(_0x16bf60);}catch{try{return await mkdir(_0x5ae4b4,{'recursive':!![]}),await copyFile(_0x2d7b04,_0x16bf60),_0x16bf60;}catch(_0x19c24d){return _0xa7971f?.(_0x1efa9b(0xc8)+'achment\x20'+'archive\x20'+_0x1efa9b(0xc7)+_0x1efa9b(0xc4)+_0x2d7b04+':\x20'+(_0x19c24d instanceof Error?_0x19c24d[_0x1efa9b(0xcc)]:String(_0x19c24d))),_0x2d7b04;}}if(!_0x4049f3[_0x1efa9b(0xb7)]()||_0x4049f3[_0x1efa9b(0xc0)+'icLink']())continue;if(_0x4049f3[_0x1efa9b(0xcf)]===_0x10f762[_0x1efa9b(0xcf)]&&await hashFile(_0x16bf60)===await hashFile(_0x2d7b04))return _0x16bf60;}return _0xa7971f?.(_0x1efa9b(0xc8)+_0x1efa9b(0xd9)+_0x1efa9b(0xba)+_0x1efa9b(0xbe)+_0x1efa9b(0xd6)+_0x1efa9b(0xdb)+_0x1efa9b(0xc5)+_0x2d7b04),_0x2d7b04;}
|
package/dist/src/chat/queue.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x5a3c(_0x2912c3,_0x6adc31){_0x2912c3=_0x2912c3-0xf4;const _0x4a685b=_0x4a68();let _0x5a3c44=_0x4a685b[_0x2912c3];return _0x5a3c44;}function _0x4a68(){const _0x779fe7=['sessionK','clear','1233337xVzonO','10210kDbdkJ','8913bpXAoX','256024yIDyNI','25pJpbBn','243uHSRNs','83xlTXdc','24600AwEvgP','8188900lvTxgP','get','1557292JVQKQH','30STHRix'];_0x4a68=function(){return _0x779fe7;};return _0x4a68();}(function(_0x46b3b7,_0xcfa5c5){const _0x5c44e5=_0x5a3c,_0x1a3359=_0x46b3b7();while(!![]){try{const _0x101f4b=parseInt(_0x5c44e5(0xf6))/0x1*(-parseInt(_0x5c44e5(0xff))/0x2)+parseInt(_0x5c44e5(0x100))/0x3+-parseInt(_0x5c44e5(0xf7))/0x4*(parseInt(_0x5c44e5(0xf4))/0x5)+-parseInt(_0x5c44e5(0xfb))/0x6*(parseInt(_0x5c44e5(0xfe))/0x7)+-parseInt(_0x5c44e5(0x101))/0x8*(-parseInt(_0x5c44e5(0xf5))/0x9)+parseInt(_0x5c44e5(0xf8))/0xa+parseInt(_0x5c44e5(0xfa))/0xb;if(_0x101f4b===_0xcfa5c5)break;else _0x1a3359['push'](_0x1a3359['shift']());}catch(_0x1f662a){_0x1a3359['push'](_0x1a3359['shift']());}}}(_0x4a68,0x7823e));export function createGatewayChatQueue(){const _0x130890=new Map();return{'enqueue'(_0x4b465b){const _0x4c14c7=_0x5a3c,_0x35c286=_0x130890['get'](_0x4b465b['sessionK'+'ey'])??null;return _0x130890['set'](_0x4b465b[_0x4c14c7(0xfc)+'ey'],_0x4b465b),_0x35c286;},'remove'(_0x1e8e65){const _0x1a00f9=_0x5a3c;_0x130890[_0x1a00f9(0xf9)](_0x1e8e65[_0x1a00f9(0xfc)+'ey'])===_0x1e8e65&&_0x130890['delete'](_0x1e8e65['sessionK'+'ey']);},'clear'(){const _0x3d0bea=_0x5a3c;_0x130890[_0x3d0bea(0xfd)]();}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x3646e0=_0x355c;(function(_0x283a0a,_0xbc6a8){const _0x14aa81=_0x355c,_0x19d19c=_0x283a0a();while(!![]){try{const _0x36f9b1=-parseInt(_0x14aa81(0xb3))/0x1*(-parseInt(_0x14aa81(0xe6))/0x2)+-parseInt(_0x14aa81(0xd3))/0x3+parseInt(_0x14aa81(0xc6))/0x4+parseInt(_0x14aa81(0xfa))/0x5+-parseInt(_0x14aa81(0xe8))/0x6+-parseInt(_0x14aa81(0xf2))/0x7+-parseInt(_0x14aa81(0xbc))/0x8*(parseInt(_0x14aa81(0xb5))/0x9);if(_0x36f9b1===_0xbc6a8)break;else _0x19d19c['push'](_0x19d19c['shift']());}catch(_0x2bb4c0){_0x19d19c['push'](_0x19d19c['shift']());}}}(_0x1644,0xd8a92));import{createHash}from'node:crypto';import{existsSync}from'node:fs';import{appendFile,mkdir,readFile,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';import{redactLogValue}from'@wujie-shell/logger';import{summarizeError,summarizePayload,toHomePath,truncateText}from'./logging.mjs';function _0x1644(){const _0x44fec3=['diagnost','ts.jsonl','some','936487vYNOAR','log','4448043PLjNuW','ipc','padStart','warn','warning','error','abs','8aqHSUj','ics/even','getMonth','join','sonl','related.','string','gateway.','json','debug','4086316GgUZPY','level','meta','nId','runtime','runtime.','incident','ipc.log','sha256','map','getSecon','slice','message','1227597TQbNWi','info','.log','push','split','object','ear','category','business','getFullY','utf8','files.lo','files','duration','isFinite','timeline','length','main.log','sessionI','2HDQhEt','stringif','4681908RYvWHO','replace','filter','gateway','.jsonl','agentId','includes','globalFi','now','file','7029729BYtEhV','type','trim','runId','dents','digest','elds','getDate','8086835ePFzpr','teamId','renderer','getHours','.json','event','manifest'];_0x1644=function(){return _0x44fec3;};return _0x1644();}const MAX_RELATED_LINES=0xf0,MAX_RELATED_LINE_LENGTH=0xfa0,MAX_TIMELINE_EVENTS=0x50,INCIDENT_BUCKET_MS=0xea60;function pad(_0x30a118,_0x5cfdcd=0x2){const _0x32fd1a=_0x355c;return String(_0x30a118)[_0x32fd1a(0xb7)](_0x5cfdcd,'0');}function formatIncidentTime(_0x2fc333){const _0x1533c7=_0x355c,_0x39e5ab=new Date(Number[_0x1533c7(0xe1)](_0x2fc333)?_0x2fc333:Date[_0x1533c7(0xf0)]());return''+_0x39e5ab[_0x1533c7(0xdc)+_0x1533c7(0xd9)]()+pad(_0x39e5ab[_0x1533c7(0xbe)]()+0x1)+pad(_0x39e5ab[_0x1533c7(0xf9)]())+'-'+(''+pad(_0x39e5ab[_0x1533c7(0xac)]())+pad(_0x39e5ab['getMinut'+'es']())+pad(_0x39e5ab[_0x1533c7(0xd0)+'ds']()));}function normalizeSlug(_0x2305e2,_0x1e4638=_0x3646e0(0xae)){const _0xa5b5f=_0x3646e0;return String(_0x2305e2||_0x1e4638)[_0xa5b5f(0xf4)]()['toLowerC'+'ase']()[_0xa5b5f(0xe9)](/[^a-z0-9._-]+/g,'-')[_0xa5b5f(0xe9)](/^-+|-+$/g,'')['slice'](0x0,0x50)||_0x1e4638;}function hashValue(_0x19c0a9){const _0x1d065b=_0x3646e0;return createHash(_0x1d065b(0xce))['update'](JSON['stringif'+'y'](_0x19c0a9??''))[_0x1d065b(0xf7)]('hex')[_0x1d065b(0xd1)](0x0,0xc);}function safeJsonStringify(_0x55a31e){return JSON['stringif'+'y'](redactLogValue(_0x55a31e));}function normalizeLevel(_0xcf0f4e){const _0x58dd4b=_0x3646e0,_0x298a65=String(_0xcf0f4e||_0x58dd4b(0xd4))['toLowerC'+'ase']();if(_0x298a65===_0x58dd4b(0xb9))return _0x58dd4b(0xb8);if([_0x58dd4b(0xc5),_0x58dd4b(0xd4),_0x58dd4b(0xb8),_0x58dd4b(0xba)][_0x58dd4b(0xee)](_0x298a65))return _0x298a65;return _0x58dd4b(0xd4);}function normalizeDiagnosticEvent(_0x560e1a={}){const _0x2b516c=_0x3646e0,_0x391609=_0x560e1a&&typeof _0x560e1a==='object'?_0x560e1a:{},_0xd58122=Number['isFinite'](_0x391609['ts'])?_0x391609['ts']:Date[_0x2b516c(0xf0)](),_0x263e3c=normalizeSlug(_0x391609[_0x2b516c(0xda)]||_0x2b516c(0xca),'runtime'),_0x1ced92=normalizeSlug(_0x391609['event']||_0x391609[_0x2b516c(0xf3)]||_0x2b516c(0xae),_0x2b516c(0xae)),_0x47c2dd=String(_0x391609['message']||_0x1ced92),_0x3afd60=_0x391609[_0x2b516c(0xc8)]&&typeof _0x391609[_0x2b516c(0xc8)]===_0x2b516c(0xd8)?_0x391609[_0x2b516c(0xc8)]:undefined;return{'ts':_0xd58122,'level':normalizeLevel(_0x391609[_0x2b516c(0xc7)]),'category':_0x263e3c,'event':_0x1ced92,'message':_0x47c2dd,'sessionId':typeof _0x391609['sessionI'+'d']==='string'?_0x391609[_0x2b516c(0xe5)+'d']:undefined,'runId':typeof _0x391609[_0x2b516c(0xf5)]===_0x2b516c(0xc2)?_0x391609['runId']:undefined,'parentRunId':typeof _0x391609['parentRu'+_0x2b516c(0xc9)]===_0x2b516c(0xc2)?_0x391609['parentRu'+_0x2b516c(0xc9)]:undefined,'agentId':typeof _0x391609[_0x2b516c(0xed)]===_0x2b516c(0xc2)?_0x391609[_0x2b516c(0xed)]:undefined,'teamId':typeof _0x391609[_0x2b516c(0xfb)]===_0x2b516c(0xc2)?_0x391609[_0x2b516c(0xfb)]:undefined,'durationMs':Number[_0x2b516c(0xe1)](_0x391609[_0x2b516c(0xe0)+'Ms'])?_0x391609[_0x2b516c(0xe0)+'Ms']:undefined,'meta':_0x3afd60?summarizePayload(_0x3afd60,{'maxDepth':0x5,'textPreviewLength':0x1f4}):undefined,'globalFields':_0x391609[_0x2b516c(0xef)+_0x2b516c(0xf8)]&&typeof _0x391609[_0x2b516c(0xef)+_0x2b516c(0xf8)]===_0x2b516c(0xd8)?summarizePayload(_0x391609['globalFi'+_0x2b516c(0xf8)],{'maxDepth':0x3,'textPreviewLength':0xc8}):undefined};}export function createIncidentId(_0x33caf9){const _0x4fb28f=_0x3646e0,_0xc7e5ab=_0x33caf9['runId']||_0x33caf9[_0x4fb28f(0xe5)+'d']||_0x33caf9[_0x4fb28f(0xda)]+':'+_0x33caf9[_0x4fb28f(0xae)]+':'+Math['floor'](_0x33caf9['ts']/INCIDENT_BUCKET_MS)+':'+hashValue({'message':_0x33caf9['message'],'meta':_0x33caf9[_0x4fb28f(0xc8)]}),_0x4b747c=normalizeSlug(_0xc7e5ab,hashValue(_0xc7e5ab))['slice'](0x0,0x60);return formatIncidentTime(_0x33caf9['ts'])+'-'+_0x33caf9[_0x4fb28f(0xda)]+'-'+_0x33caf9[_0x4fb28f(0xae)]+'-'+_0x4b747c;}async function ensureManifest(_0x5a26be,_0x4eb241={}){const _0x2d0ccc=_0x3646e0,_0x286a89=join(_0x5a26be,_0x2d0ccc(0xaf)+_0x2d0ccc(0xad));if(existsSync(_0x286a89))return;await mkdir(dirname(_0x286a89),{'recursive':!![]}),await writeFile(_0x286a89,JSON[_0x2d0ccc(0xe7)+'y']({'schemaVersion':0x1,'index':_0x2d0ccc(0xb0)+_0x2d0ccc(0xbd)+_0x2d0ccc(0xb1),'incidentsDir':'diagnost'+'ics/inci'+_0x2d0ccc(0xf6),'generatedAt':Date['now'](),'app':_0x4eb241},null,0x2)+'\x0a',_0x2d0ccc(0xdd));}function getLogFilesForContext(_0x43c436){const _0x38cb73=_0x3646e0;return[join(_0x43c436,'main',_0x38cb73(0xe4)),join(_0x43c436,_0x38cb73(0xab),'renderer'+_0x38cb73(0xd5)),join(_0x43c436,_0x38cb73(0xb6),_0x38cb73(0xcd)),join(_0x43c436,_0x38cb73(0xeb),_0x38cb73(0xc3)+_0x38cb73(0xb4)),join(_0x43c436,'runtime',_0x38cb73(0xcb)+_0x38cb73(0xb4)),join(_0x43c436,_0x38cb73(0xdb),_0x38cb73(0xdb)+'.log'),join(_0x43c436,_0x38cb73(0xdf),_0x38cb73(0xde)+'g')];}async function readRelatedLogLines(_0x5e865a,_0x3903fd){const _0x56d221=_0x3646e0,_0x92393d=[_0x3903fd['runId'],_0x3903fd[_0x56d221(0xe5)+'d'],_0x3903fd['agentId'],_0x3903fd[_0x56d221(0xae)],_0x3903fd['message']][_0x56d221(0xea)](_0x5ce287=>typeof _0x5ce287===_0x56d221(0xc2)&&_0x5ce287[_0x56d221(0xf4)]())[_0x56d221(0xcf)](_0x2c2523=>_0x2c2523[_0x56d221(0xf4)]()),_0x1c016b=[];for(const _0x38d50b of getLogFilesForContext(_0x5e865a)){if(!existsSync(_0x38d50b))continue;try{const _0x5be1ae=(await readFile(_0x38d50b,_0x56d221(0xdd)))[_0x56d221(0xd7)](/\r?\n/)[_0x56d221(0xea)](Boolean),_0x1b5b20=_0x92393d[_0x56d221(0xe3)]?_0x5be1ae[_0x56d221(0xea)](_0x5b4dc3=>_0x92393d[_0x56d221(0xb2)](_0x4c0ace=>_0x5b4dc3[_0x56d221(0xee)](_0x4c0ace))):[],_0x76498c=_0x1b5b20[_0x56d221(0xe3)]?_0x1b5b20[_0x56d221(0xd1)](-MAX_RELATED_LINES):_0x5be1ae['slice'](-Math['min'](MAX_RELATED_LINES,0x50));for(const _0x4eff97 of _0x76498c){_0x1c016b[_0x56d221(0xd6)]({'file':relative(_0x5e865a,_0x38d50b),'line':truncateText(_0x4eff97,MAX_RELATED_LINE_LENGTH)});}}catch{}}return _0x1c016b[_0x56d221(0xd1)](-MAX_RELATED_LINES);}async function appendJsonLine(_0xdb4260,_0x22ace6){const _0x5779d1=_0x3646e0;await mkdir(dirname(_0xdb4260),{'recursive':!![]}),await appendFile(_0xdb4260,safeJsonStringify(_0x22ace6)+'\x0a',_0x5779d1(0xdd));}export function createDiagnosticsWriter({logsDir:_0x3eb072,appContext:appContext={}}={}){const _0x58d1a0=_0x3646e0,_0x4997fb=_0x3eb072?join(_0x3eb072,_0x58d1a0(0xb0)+'ics'):'',_0x1748d3=[];async function _0xd66ab2(_0x5026ed,_0x14d3b1={}){const _0x39d4cd=_0x58d1a0;if(!_0x4997fb)return null;const _0x294979=normalizeDiagnosticEvent(_0x5026ed),_0x53ee52=_0x14d3b1['captureI'+'ncident']===!![]||_0x294979[_0x39d4cd(0xc7)]===_0x39d4cd(0xba),_0x35411e=_0x53ee52?_0x14d3b1[_0x39d4cd(0xcc)+'Id']||createIncidentId(_0x294979):undefined,_0xcb19={..._0x294979,'incidentId':_0x35411e};await ensureManifest(_0x4997fb,appContext),await appendJsonLine(join(_0x4997fb,'events.j'+_0x39d4cd(0xc0)),_0xcb19),_0x1748d3[_0x39d4cd(0xd6)](_0xcb19);if(_0x1748d3[_0x39d4cd(0xe3)]>MAX_TIMELINE_EVENTS)_0x1748d3['shift']();if(_0x35411e)await _0x1c979e(_0xcb19,{'incidentId':_0x35411e});return _0xcb19;}async function _0x1c979e(_0x57fe07,{incidentId:incidentId=_0x57fe07[_0x58d1a0(0xcc)+'Id']}={}){const _0x228ff2=_0x58d1a0;if(!_0x4997fb||!incidentId)return null;const _0x24ca2e=join(_0x4997fb,_0x228ff2(0xcc)+'s',normalizeSlug(incidentId,hashValue(incidentId)));await mkdir(_0x24ca2e,{'recursive':!![]});const _0x3fd139=await readRelatedLogLines(_0x3eb072,_0x57fe07),_0x1f9d91={'schemaVersion':0x1,'incidentId':incidentId,'capturedAt':Date[_0x228ff2(0xf0)](),'app':appContext,'event':{'category':_0x57fe07[_0x228ff2(0xda)],'event':_0x57fe07[_0x228ff2(0xae)],'level':_0x57fe07[_0x228ff2(0xc7)],'message':_0x57fe07[_0x228ff2(0xd2)],'ts':_0x57fe07['ts'],'sessionId':_0x57fe07[_0x228ff2(0xe5)+'d'],'runId':_0x57fe07[_0x228ff2(0xf5)],'agentId':_0x57fe07['agentId']},'relatedLogFiles':[...new Set(_0x3fd139[_0x228ff2(0xcf)](_0x1db3b4=>_0x1db3b4[_0x228ff2(0xf1)]))],'logsDir':toHomePath(_0x3eb072)};return await writeFile(join(_0x24ca2e,'event.js'+'on'),safeJsonStringify(_0x57fe07)+'\x0a',_0x228ff2(0xdd)),await writeFile(join(_0x24ca2e,'context.'+_0x228ff2(0xc4)),JSON[_0x228ff2(0xe7)+'y'](_0x1f9d91,null,0x2)+'\x0a',_0x228ff2(0xdd)),await writeFile(join(_0x24ca2e,_0x228ff2(0xe2)+_0x228ff2(0xec)),_0x1748d3['filter'](_0x524a2f=>{const _0x37e7f6=_0x228ff2;if(_0x524a2f[_0x37e7f6(0xcc)+'Id']===incidentId)return!![];if(_0x57fe07[_0x37e7f6(0xf5)]&&_0x524a2f[_0x37e7f6(0xf5)]===_0x57fe07[_0x37e7f6(0xf5)])return!![];if(_0x57fe07[_0x37e7f6(0xe5)+'d']&&_0x524a2f[_0x37e7f6(0xe5)+'d']===_0x57fe07[_0x37e7f6(0xe5)+'d'])return!![];return Math[_0x37e7f6(0xbb)](_0x524a2f['ts']-_0x57fe07['ts'])<=INCIDENT_BUCKET_MS;})[_0x228ff2(0xcf)](_0x48d756=>safeJsonStringify(_0x48d756))[_0x228ff2(0xbf)]('\x0a')+'\x0a',_0x228ff2(0xdd)),await writeFile(join(_0x24ca2e,_0x228ff2(0xc1)+'log'),_0x3fd139[_0x228ff2(0xcf)](_0x2a22a0=>'['+_0x2a22a0['file']+']\x20'+_0x2a22a0['line'])[_0x228ff2(0xbf)]('\x0a')+(_0x3fd139[_0x228ff2(0xe3)]?'\x0a':''),_0x228ff2(0xdd)),{'incidentId':incidentId,'path':_0x24ca2e};}return{'writeEvent':_0xd66ab2,'captureIncident':(_0x534d6b,_0x1f388b={})=>_0xd66ab2(_0x534d6b,{..._0x1f388b,'captureIncident':!![]})};}function _0x355c(_0xf48dcc,_0xdf8824){_0xf48dcc=_0xf48dcc-0xab;const _0x1644d0=_0x1644();let _0x355ce9=_0x1644d0[_0xf48dcc];return _0x355ce9;}export function diagnosticEventFromError(_0x4fa804,_0x2180fc={}){const _0x3a25c6=_0x3646e0;return{'level':_0x3a25c6(0xba),'category':_0x2180fc['category']||_0x3a25c6(0xca),'event':_0x2180fc[_0x3a25c6(0xae)]||_0x3a25c6(0xba),'message':_0x2180fc[_0x3a25c6(0xd2)]||(_0x4fa804 instanceof Error?_0x4fa804[_0x3a25c6(0xd2)]:String(_0x4fa804||'error')),'sessionId':_0x2180fc[_0x3a25c6(0xe5)+'d'],'runId':_0x2180fc[_0x3a25c6(0xf5)],'agentId':_0x2180fc[_0x3a25c6(0xed)],'durationMs':_0x2180fc[_0x3a25c6(0xe0)+'Ms'],'meta':{..._0x2180fc[_0x3a25c6(0xc8)]&&typeof _0x2180fc[_0x3a25c6(0xc8)]===_0x3a25c6(0xd8)?_0x2180fc[_0x3a25c6(0xc8)]:{},'error':summarizeError(_0x4fa804)}};}
|
|
1
|
+
const _0x48c2da=_0x41e0;(function(_0x359542,_0x173e3a){const _0x41bf0c=_0x41e0,_0x295359=_0x359542();while(!![]){try{const _0x5a9d1c=parseInt(_0x41bf0c(0x186))/0x1*(parseInt(_0x41bf0c(0x1ab))/0x2)+parseInt(_0x41bf0c(0x1c1))/0x3*(-parseInt(_0x41bf0c(0x19c))/0x4)+-parseInt(_0x41bf0c(0x1bc))/0x5+-parseInt(_0x41bf0c(0x1bb))/0x6*(parseInt(_0x41bf0c(0x183))/0x7)+parseInt(_0x41bf0c(0x19d))/0x8+parseInt(_0x41bf0c(0x1cb))/0x9+parseInt(_0x41bf0c(0x1be))/0xa;if(_0x5a9d1c===_0x173e3a)break;else _0x295359['push'](_0x295359['shift']());}catch(_0x51be23){_0x295359['push'](_0x295359['shift']());}}}(_0x27db,0xc38d1));import{createHash}from'node:crypto';import{existsSync}from'node:fs';function _0x41e0(_0x2410b2,_0x43d4ed){_0x2410b2=_0x2410b2-0x17d;const _0x27dbad=_0x27db();let _0x41e05f=_0x27dbad[_0x2410b2];return _0x41e05f;}import{appendFile,mkdir,readFile,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';function _0x27db(){const _0x5554ac=['5518376IZlSBk','ipc.log','hex','getSecon','trim','incident','map','update','floor','.json','level','utf8','slice','ipc','12KvJIKu','ear','duration','string','line','toLowerC','filter','globalFi','runtime','replace','shift','gateway','sha256','sessionI','getDate','ts.jsonl','7761924IPIQvY','5120855wttQrY','events.j','17073050ghwtYy','info','files.lo','27318XZzaSW','some','min','category','ase','length','stringif','join','runId','warn','7934688hjTREc','object','parentRu','.jsonl','timeline','file','includes','event','nId','json','manifest','push','ncident','getFullY','warning','ics/inci','type','7JOffKU','elds','diagnost','58334QRyUWZ','main.log','files','error','message','meta','teamId','sonl','.log','log','business','event.js','getHours','agentId','now','abs','padStart','getMonth','captureI','ics','debug','renderer','224UIJxWH'];_0x27db=function(){return _0x5554ac;};return _0x27db();}import{redactLogValue}from'@wujie-shell/logger';import{summarizeError,summarizePayload,toHomePath,truncateText}from'./logging.mjs';const MAX_RELATED_LINES=0xf0,MAX_RELATED_LINE_LENGTH=0xfa0,MAX_TIMELINE_EVENTS=0x50,INCIDENT_BUCKET_MS=0xea60;function pad(_0x5780b6,_0x43d4d7=0x2){const _0x14a7ff=_0x41e0;return String(_0x5780b6)[_0x14a7ff(0x196)](_0x43d4d7,'0');}function formatIncidentTime(_0x3749a7){const _0x36f2b3=_0x41e0,_0x2835ba=new Date(Number['isFinite'](_0x3749a7)?_0x3749a7:Date[_0x36f2b3(0x194)]());return''+_0x2835ba[_0x36f2b3(0x17f)+_0x36f2b3(0x1ac)]()+pad(_0x2835ba[_0x36f2b3(0x197)]()+0x1)+pad(_0x2835ba[_0x36f2b3(0x1b9)]())+'-'+(''+pad(_0x2835ba[_0x36f2b3(0x192)]())+pad(_0x2835ba['getMinut'+'es']())+pad(_0x2835ba[_0x36f2b3(0x1a0)+'ds']()));}function normalizeSlug(_0x21aa83,_0x2e1006=_0x48c2da(0x1d2)){const _0x2e1a6b=_0x48c2da;return String(_0x21aa83||_0x2e1006)[_0x2e1a6b(0x1a1)]()['toLowerC'+_0x2e1a6b(0x1c5)]()['replace'](/[^a-z0-9._-]+/g,'-')[_0x2e1a6b(0x1b4)](/^-+|-+$/g,'')['slice'](0x0,0x50)||_0x2e1006;}function hashValue(_0x472bf4){const _0x2ca69e=_0x48c2da;return createHash(_0x2ca69e(0x1b7))[_0x2ca69e(0x1a4)](JSON[_0x2ca69e(0x1c7)+'y'](_0x472bf4??''))['digest'](_0x2ca69e(0x19f))[_0x2ca69e(0x1a9)](0x0,0xc);}function safeJsonStringify(_0x24c49d){return JSON['stringif'+'y'](redactLogValue(_0x24c49d));}function normalizeLevel(_0x359c81){const _0x2ad74c=_0x48c2da,_0x40e947=String(_0x359c81||_0x2ad74c(0x1bf))[_0x2ad74c(0x1b0)+_0x2ad74c(0x1c5)]();if(_0x40e947===_0x2ad74c(0x180))return _0x2ad74c(0x1ca);if([_0x2ad74c(0x19a),_0x2ad74c(0x1bf),_0x2ad74c(0x1ca),_0x2ad74c(0x189)]['includes'](_0x40e947))return _0x40e947;return'info';}function normalizeDiagnosticEvent(_0xfed3a5={}){const _0x3c9a77=_0x48c2da,_0x422268=_0xfed3a5&&typeof _0xfed3a5===_0x3c9a77(0x1cc)?_0xfed3a5:{},_0x529a98=Number['isFinite'](_0x422268['ts'])?_0x422268['ts']:Date[_0x3c9a77(0x194)](),_0x52310c=normalizeSlug(_0x422268[_0x3c9a77(0x1c4)]||_0x3c9a77(0x1b3),'runtime'),_0x436eb0=normalizeSlug(_0x422268['event']||_0x422268[_0x3c9a77(0x182)]||_0x3c9a77(0x1d2),_0x3c9a77(0x1d2)),_0x356404=String(_0x422268[_0x3c9a77(0x18a)]||_0x436eb0),_0x3dd0f7=_0x422268[_0x3c9a77(0x18b)]&&typeof _0x422268[_0x3c9a77(0x18b)]===_0x3c9a77(0x1cc)?_0x422268[_0x3c9a77(0x18b)]:undefined;return{'ts':_0x529a98,'level':normalizeLevel(_0x422268[_0x3c9a77(0x1a7)]),'category':_0x52310c,'event':_0x436eb0,'message':_0x356404,'sessionId':typeof _0x422268['sessionI'+'d']===_0x3c9a77(0x1ae)?_0x422268['sessionI'+'d']:undefined,'runId':typeof _0x422268[_0x3c9a77(0x1c9)]===_0x3c9a77(0x1ae)?_0x422268['runId']:undefined,'parentRunId':typeof _0x422268['parentRu'+_0x3c9a77(0x1d3)]===_0x3c9a77(0x1ae)?_0x422268[_0x3c9a77(0x1cd)+_0x3c9a77(0x1d3)]:undefined,'agentId':typeof _0x422268[_0x3c9a77(0x193)]==='string'?_0x422268['agentId']:undefined,'teamId':typeof _0x422268[_0x3c9a77(0x18c)]===_0x3c9a77(0x1ae)?_0x422268[_0x3c9a77(0x18c)]:undefined,'durationMs':Number['isFinite'](_0x422268[_0x3c9a77(0x1ad)+'Ms'])?_0x422268[_0x3c9a77(0x1ad)+'Ms']:undefined,'meta':_0x3dd0f7?summarizePayload(_0x3dd0f7,{'maxDepth':0x5,'textPreviewLength':0x1f4}):undefined,'globalFields':_0x422268[_0x3c9a77(0x1b2)+_0x3c9a77(0x184)]&&typeof _0x422268[_0x3c9a77(0x1b2)+_0x3c9a77(0x184)]===_0x3c9a77(0x1cc)?summarizePayload(_0x422268['globalFi'+_0x3c9a77(0x184)],{'maxDepth':0x3,'textPreviewLength':0xc8}):undefined};}export function createIncidentId(_0x481a5c){const _0x40ab76=_0x48c2da,_0x17275c=_0x481a5c[_0x40ab76(0x1c9)]||_0x481a5c['sessionI'+'d']||_0x481a5c[_0x40ab76(0x1c4)]+':'+_0x481a5c[_0x40ab76(0x1d2)]+':'+Math[_0x40ab76(0x1a5)](_0x481a5c['ts']/INCIDENT_BUCKET_MS)+':'+hashValue({'message':_0x481a5c[_0x40ab76(0x18a)],'meta':_0x481a5c[_0x40ab76(0x18b)]}),_0x1a261b=normalizeSlug(_0x17275c,hashValue(_0x17275c))[_0x40ab76(0x1a9)](0x0,0x60);return formatIncidentTime(_0x481a5c['ts'])+'-'+_0x481a5c[_0x40ab76(0x1c4)]+'-'+_0x481a5c[_0x40ab76(0x1d2)]+'-'+_0x1a261b;}async function ensureManifest(_0x4cd08d,_0x51296c={}){const _0x54b568=_0x48c2da,_0x3452e0=join(_0x4cd08d,_0x54b568(0x1d5)+_0x54b568(0x1a6));if(existsSync(_0x3452e0))return;await mkdir(dirname(_0x3452e0),{'recursive':!![]}),await writeFile(_0x3452e0,JSON[_0x54b568(0x1c7)+'y']({'schemaVersion':0x1,'index':_0x54b568(0x185)+'ics/even'+_0x54b568(0x1ba),'incidentsDir':_0x54b568(0x185)+_0x54b568(0x181)+'dents','generatedAt':Date['now'](),'app':_0x51296c},null,0x2)+'\x0a',_0x54b568(0x1a8));}function getLogFilesForContext(_0x5da4c9){const _0x1c0057=_0x48c2da;return[join(_0x5da4c9,'main',_0x1c0057(0x187)),join(_0x5da4c9,_0x1c0057(0x19b),_0x1c0057(0x19b)+_0x1c0057(0x18e)),join(_0x5da4c9,_0x1c0057(0x1aa),_0x1c0057(0x19e)),join(_0x5da4c9,_0x1c0057(0x1b6),'gateway.'+_0x1c0057(0x18f)),join(_0x5da4c9,'runtime','runtime.'+_0x1c0057(0x18f)),join(_0x5da4c9,_0x1c0057(0x190),'business'+'.log'),join(_0x5da4c9,_0x1c0057(0x188),_0x1c0057(0x1c0)+'g')];}async function readRelatedLogLines(_0x2aa225,_0xd6c08b){const _0x2109fc=_0x48c2da,_0x276c11=[_0xd6c08b[_0x2109fc(0x1c9)],_0xd6c08b[_0x2109fc(0x1b8)+'d'],_0xd6c08b[_0x2109fc(0x193)],_0xd6c08b[_0x2109fc(0x1d2)],_0xd6c08b['message']][_0x2109fc(0x1b1)](_0x27a4d2=>typeof _0x27a4d2==='string'&&_0x27a4d2[_0x2109fc(0x1a1)]())[_0x2109fc(0x1a3)](_0x95778e=>_0x95778e[_0x2109fc(0x1a1)]()),_0x4c1507=[];for(const _0x2ad60a of getLogFilesForContext(_0x2aa225)){if(!existsSync(_0x2ad60a))continue;try{const _0x436a5e=(await readFile(_0x2ad60a,_0x2109fc(0x1a8)))['split'](/\r?\n/)['filter'](Boolean),_0x379370=_0x276c11['length']?_0x436a5e['filter'](_0x4a3e68=>_0x276c11[_0x2109fc(0x1c2)](_0x5ccba3=>_0x4a3e68[_0x2109fc(0x1d1)](_0x5ccba3))):[],_0x311ace=_0x379370[_0x2109fc(0x1c6)]?_0x379370[_0x2109fc(0x1a9)](-MAX_RELATED_LINES):_0x436a5e['slice'](-Math[_0x2109fc(0x1c3)](MAX_RELATED_LINES,0x50));for(const _0x34bfdf of _0x311ace){_0x4c1507[_0x2109fc(0x17d)]({'file':relative(_0x2aa225,_0x2ad60a),'line':truncateText(_0x34bfdf,MAX_RELATED_LINE_LENGTH)});}}catch{}}return _0x4c1507[_0x2109fc(0x1a9)](-MAX_RELATED_LINES);}async function appendJsonLine(_0x1f7635,_0x250486){const _0x2885b2=_0x48c2da;await mkdir(dirname(_0x1f7635),{'recursive':!![]}),await appendFile(_0x1f7635,safeJsonStringify(_0x250486)+'\x0a',_0x2885b2(0x1a8));}export function createDiagnosticsWriter({logsDir:_0x2de89e,appContext:appContext={}}={}){const _0x28d707=_0x48c2da,_0x339c09=_0x2de89e?join(_0x2de89e,'diagnost'+_0x28d707(0x199)):'',_0x354182=[];async function _0x3a68ce(_0x323c30,_0x1968e9={}){const _0x2ad3be=_0x28d707;if(!_0x339c09)return null;const _0x285220=normalizeDiagnosticEvent(_0x323c30),_0x1b561d=_0x1968e9[_0x2ad3be(0x198)+_0x2ad3be(0x17e)]===!![]||_0x285220[_0x2ad3be(0x1a7)]==='error',_0x18b793=_0x1b561d?_0x1968e9[_0x2ad3be(0x1a2)+'Id']||createIncidentId(_0x285220):undefined,_0x384b47={..._0x285220,'incidentId':_0x18b793};await ensureManifest(_0x339c09,appContext),await appendJsonLine(join(_0x339c09,_0x2ad3be(0x1bd)+_0x2ad3be(0x18d)),_0x384b47),_0x354182[_0x2ad3be(0x17d)](_0x384b47);if(_0x354182[_0x2ad3be(0x1c6)]>MAX_TIMELINE_EVENTS)_0x354182[_0x2ad3be(0x1b5)]();if(_0x18b793)await _0x33deb2(_0x384b47,{'incidentId':_0x18b793});return _0x384b47;}async function _0x33deb2(_0x2eb205,{incidentId:incidentId=_0x2eb205[_0x28d707(0x1a2)+'Id']}={}){const _0x2f506e=_0x28d707;if(!_0x339c09||!incidentId)return null;const _0x12839e=join(_0x339c09,'incident'+'s',normalizeSlug(incidentId,hashValue(incidentId)));await mkdir(_0x12839e,{'recursive':!![]});const _0x2f35c8=await readRelatedLogLines(_0x2de89e,_0x2eb205),_0x13a8bb={'schemaVersion':0x1,'incidentId':incidentId,'capturedAt':Date['now'](),'app':appContext,'event':{'category':_0x2eb205[_0x2f506e(0x1c4)],'event':_0x2eb205['event'],'level':_0x2eb205['level'],'message':_0x2eb205[_0x2f506e(0x18a)],'ts':_0x2eb205['ts'],'sessionId':_0x2eb205[_0x2f506e(0x1b8)+'d'],'runId':_0x2eb205[_0x2f506e(0x1c9)],'agentId':_0x2eb205[_0x2f506e(0x193)]},'relatedLogFiles':[...new Set(_0x2f35c8[_0x2f506e(0x1a3)](_0x429f12=>_0x429f12[_0x2f506e(0x1d0)]))],'logsDir':toHomePath(_0x2de89e)};return await writeFile(join(_0x12839e,_0x2f506e(0x191)+'on'),safeJsonStringify(_0x2eb205)+'\x0a',_0x2f506e(0x1a8)),await writeFile(join(_0x12839e,'context.'+_0x2f506e(0x1d4)),JSON[_0x2f506e(0x1c7)+'y'](_0x13a8bb,null,0x2)+'\x0a',_0x2f506e(0x1a8)),await writeFile(join(_0x12839e,_0x2f506e(0x1cf)+_0x2f506e(0x1ce)),_0x354182['filter'](_0x3ca4c3=>{const _0x3e5423=_0x2f506e;if(_0x3ca4c3['incident'+'Id']===incidentId)return!![];if(_0x2eb205[_0x3e5423(0x1c9)]&&_0x3ca4c3['runId']===_0x2eb205[_0x3e5423(0x1c9)])return!![];if(_0x2eb205[_0x3e5423(0x1b8)+'d']&&_0x3ca4c3['sessionI'+'d']===_0x2eb205[_0x3e5423(0x1b8)+'d'])return!![];return Math[_0x3e5423(0x195)](_0x3ca4c3['ts']-_0x2eb205['ts'])<=INCIDENT_BUCKET_MS;})[_0x2f506e(0x1a3)](_0x5019e0=>safeJsonStringify(_0x5019e0))[_0x2f506e(0x1c8)]('\x0a')+'\x0a',_0x2f506e(0x1a8)),await writeFile(join(_0x12839e,'related.'+_0x2f506e(0x18f)),_0x2f35c8[_0x2f506e(0x1a3)](_0x1cd775=>'['+_0x1cd775['file']+']\x20'+_0x1cd775[_0x2f506e(0x1af)])['join']('\x0a')+(_0x2f35c8['length']?'\x0a':''),_0x2f506e(0x1a8)),{'incidentId':incidentId,'path':_0x12839e};}return{'writeEvent':_0x3a68ce,'captureIncident':(_0x27556e,_0x25395b={})=>_0x3a68ce(_0x27556e,{..._0x25395b,'captureIncident':!![]})};}export function diagnosticEventFromError(_0x2d03d0,_0xcb382d={}){const _0x59c28d=_0x48c2da;return{'level':_0x59c28d(0x189),'category':_0xcb382d['category']||_0x59c28d(0x1b3),'event':_0xcb382d[_0x59c28d(0x1d2)]||'error','message':_0xcb382d[_0x59c28d(0x18a)]||(_0x2d03d0 instanceof Error?_0x2d03d0['message']:String(_0x2d03d0||_0x59c28d(0x189))),'sessionId':_0xcb382d[_0x59c28d(0x1b8)+'d'],'runId':_0xcb382d[_0x59c28d(0x1c9)],'agentId':_0xcb382d['agentId'],'durationMs':_0xcb382d['duration'+'Ms'],'meta':{..._0xcb382d[_0x59c28d(0x18b)]&&typeof _0xcb382d[_0x59c28d(0x18b)]===_0x59c28d(0x1cc)?_0xcb382d[_0x59c28d(0x18b)]:{},'error':summarizeError(_0x2d03d0)}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x210af5=_0x4c81;(function(_0x2b90d8,_0x167984){const _0x569a61=_0x4c81,_0x11729a=_0x2b90d8();while(!![]){try{const _0x1a54d5=parseInt(_0x569a61(0xec))/0x1+parseInt(_0x569a61(0x103))/0x2*(-parseInt(_0x569a61(0xfa))/0x3)+-parseInt(_0x569a61(0x10c))/0x4*(parseInt(_0x569a61(0xe4))/0x5)+-parseInt(_0x569a61(0x129))/0x6*(parseInt(_0x569a61(0x111))/0x7)+parseInt(_0x569a61(0x125))/0x8*(parseInt(_0x569a61(0x12a))/0x9)+parseInt(_0x569a61(0xd4))/0xa*(-parseInt(_0x569a61(0xd6))/0xb)+parseInt(_0x569a61(0xf2))/0xc;if(_0x1a54d5===_0x167984)break;else _0x11729a['push'](_0x11729a['shift']());}catch(_0x5a5a3d){_0x11729a['push'](_0x11729a['shift']());}}}(_0x4ff3,0x87092));import{createHash}from'node:crypto';import{spawn}from'node:child_process';import{existsSync}from'node:fs';import{copyFile,mkdir,readdir,rm}from'node:fs/promises';import{homedir,tmpdir}from'node:os';function _0x4c81(_0x523227,_0x324f26){_0x523227=_0x523227-0xd4;const _0x4ff3a1=_0x4ff3();let _0x4c81d8=_0x4ff3a1[_0x523227];return _0x4c81d8;}import{basename,dirname,isAbsolute,join,relative,resolve}from'node:path';import{createFileLogger,redactLogValue}from'@wujie-shell/logger';const LOG_MAX_BYTES=0x2*0x400*0x400,LOG_KEEP_COUNT=0x5,loggers=new Map(),CONTENT_PREVIEW_LENGTH=0xf0,LOG_FILE_RE=/^(?<base>.+?)(?:\.(?<index>\d+))?\.log$/,LEGACY_LOG_FILE_RE=/^.+\.log\.(?<index>\d+)$/;export function createShellLogger(_0x162806,_0x41a190,_0x1fc9a4=_0x41a190){const _0x2a212c=_0x4c81,_0x4014c3=_0x162806?.[_0x2a212c(0x11e)];if(!_0x4014c3||!_0x41a190)return null;const _0x2a5d13=join(_0x4014c3,_0x41a190,_0x41a190+_0x2a212c(0xda)),_0x4fba42=_0x2a5d13+':'+_0x1fc9a4;return!loggers[_0x2a212c(0x137)](_0x4fba42)&&loggers[_0x2a212c(0xdc)](_0x4fba42,createFileLogger({'filePath':_0x2a5d13,'context':_0x1fc9a4,'maxBytes':LOG_MAX_BYTES,'keepCount':LOG_KEEP_COUNT})),loggers[_0x2a212c(0xd8)](_0x4fba42);}export function toHomePath(_0x166fa3){const _0x215271=_0x4c81,_0x3ab844=typeof _0x166fa3===_0x215271(0x11b)?_0x166fa3:'';if(!_0x3ab844)return'';const _0x144354=homedir(),_0x1f9c69=isAbsolute(_0x3ab844)?_0x3ab844:resolve(_0x3ab844),_0x104152=relative(_0x144354,_0x1f9c69);if(!_0x104152||!_0x104152[_0x215271(0x133)+'th']('..')&&!isAbsolute(_0x104152))return _0x104152?'~/'+_0x104152:'~';return _0x1f9c69;}function _0x4ff3(){const _0x4f5a80=['$Progres','index','replaceA','with\x20cod','exec','316WLnRck','pipe','some','trim','split','238NDmqJd','\x20failed\x20','replace','ectory\x20n','-Encoded','ell-logs','slice','-NoProfi','toString','message','string','update','from','logsDir','includes','nce=\x27Sil','error','isArray','ory','now','8UmivJW','\x20-Path\x20','es\x20found','toISOStr','25374hgeocD','8298450LbufrT','/staging','env','add','groups','stack','/node_mo','ll.exe','Compress','startsWi','...','/.cache/','ics','has','iewLengt','-Archive','stringif','\x20-Force','test','10nvkGFf','Command','5523419TNJTrJ','name','get','ot\x20found','.log','sPrefere','set','dev','ignore','ationPat','\x20-Destin','map','tinue\x27;','filter','30140OjVhuO','Thumbs.d','wujie-sh','entlyCon','length','digest','platform','endsWith','429089laeHAl','zip','Object','.jsonl','hex','powershe','6023892dkaBXK','stderr','join','\x20log\x20fil','.json','close','cwd','dules/','57wpdtGK','object','pid','.DS_Stor','Array','isDirect','no\x20valid','.zip','entries','18726JIkLdS','[Circula','catch','ing'];_0x4ff3=function(){return _0x4f5a80;};return _0x4ff3();}export function hashText(_0x226e42){const _0x385b50=_0x4c81;return createHash('sha256')[_0x385b50(0x11c)](String(_0x226e42))[_0x385b50(0xe9)](_0x385b50(0xf0))['slice'](0x0,0x10);}export function truncateText(_0x5c23ca,_0x4243ec=CONTENT_PREVIEW_LENGTH){const _0x4fbc31=_0x4c81,_0x7e3ecf=String(_0x5c23ca??'')[_0x4fbc31(0x113)](/\s+/g,'\x20')[_0x4fbc31(0x10f)]();if(_0x7e3ecf[_0x4fbc31(0xe8)]<=_0x4243ec)return _0x7e3ecf;return _0x7e3ecf[_0x4fbc31(0x117)](0x0,_0x4243ec)+_0x4fbc31(0x134);}export function summarizeText(_0x4a9508,_0x4a84f0=CONTENT_PREVIEW_LENGTH){const _0x5f2ea8=_0x4c81,_0x3c457e=String(_0x4a9508??'');return{'length':_0x3c457e[_0x5f2ea8(0xe8)],'hash':hashText(_0x3c457e),'preview':truncateText(_0x3c457e,_0x4a84f0),'truncated':_0x3c457e[_0x5f2ea8(0xe8)]>_0x4a84f0};}export function summarizeError(_0x203a7a){const _0x30d070=_0x4c81;if(_0x203a7a instanceof Error)return{'name':_0x203a7a[_0x30d070(0xd7)],'message':_0x203a7a[_0x30d070(0x11a)],'stack':_0x203a7a[_0x30d070(0x12f)]};return{'message':String(_0x203a7a)};}function summarizePathValue(_0x458d20){const _0x35933a=_0x4c81;if(typeof _0x458d20!=='string')return _0x458d20;if(_0x458d20['includes']('/')||_0x458d20[_0x35933a(0x11f)]('\x5c'))return toHomePath(_0x458d20);return _0x458d20;}export function summarizePayload(_0x53c884,_0x5e4571={}){const _0x2a784a=_0x5e4571['maxDepth']??0x4,_0x16b4b9=new WeakSet();function _0x5ee2b1(_0x5ae57e,_0x1d14b5,_0x16b6b3=''){const _0xf64e43=_0x4c81;if(_0x5ae57e==null)return _0x5ae57e;if(typeof _0x5ae57e===_0xf64e43(0x11b)){if(/message|content|prompt|text|body/i[_0xf64e43(0x13c)](_0x16b6b3))return summarizeText(_0x5ae57e,_0x5e4571['textPrev'+_0xf64e43(0x138)+'h']);return summarizePathValue(_0x5ae57e);}if(typeof _0x5ae57e!==_0xf64e43(0xfb))return _0x5ae57e;if(_0x5ae57e instanceof Error)return summarizeError(_0x5ae57e);if(_0x16b4b9[_0xf64e43(0x137)](_0x5ae57e))return _0xf64e43(0x104)+'r]';if(_0x1d14b5>=_0x2a784a)return'['+(Array['isArray'](_0x5ae57e)?_0xf64e43(0xfe):_0xf64e43(0xee))+']';_0x16b4b9[_0xf64e43(0x12d)](_0x5ae57e);if(Array['isArray'](_0x5ae57e))return{'type':'array','length':_0x5ae57e[_0xf64e43(0xe8)],'items':_0x5ae57e[_0xf64e43(0x117)](0x0,0x5)['map'](_0x29020e=>_0x5ee2b1(_0x29020e,_0x1d14b5+0x1,_0x16b6b3)),'truncated':_0x5ae57e['length']>0x5};const _0x91ed20={};for(const [_0x1ad622,_0x555e32]of Object[_0xf64e43(0x102)](_0x5ae57e)){_0x91ed20[_0x1ad622]=_0x5ee2b1(_0x555e32,_0x1d14b5+0x1,_0x1ad622);}return redactLogValue(_0x91ed20);}return _0x5ee2b1(_0x53c884,0x0);}export function summarizeFilePaths(_0x13b62c=[]){const _0x263ab2=_0x4c81;return(Array[_0x263ab2(0x122)](_0x13b62c)?_0x13b62c:[])['map'](_0x59679c=>String(_0x59679c||'')[_0x263ab2(0x10f)]())[_0x263ab2(0xe3)](Boolean)[_0x263ab2(0xe1)](_0x201e13=>({'path':toHomePath(_0x201e13),'name':basename(_0x201e13)}));}function run(_0x5ca8eb,_0x4d0bc1,_0x6528cf={}){return new Promise((_0x2a04f0,_0x33a065)=>{const _0x3e24fa=_0x4c81,_0x545bb9=spawn(_0x5ca8eb,_0x4d0bc1,{'cwd':_0x6528cf[_0x3e24fa(0xf8)],'env':{...process.env,..._0x6528cf[_0x3e24fa(0x12c)]??{}},'stdio':[_0x3e24fa(0xde),_0x3e24fa(0x10d),'pipe']});let _0x56c01b='';_0x545bb9[_0x3e24fa(0xf3)]?.['on']('data',_0x544b6b=>{_0x56c01b+=_0x544b6b['toString']();}),_0x545bb9['on'](_0x3e24fa(0x121),_0x33a065),_0x545bb9['on'](_0x3e24fa(0xf7),_0x35a20d=>{const _0x35a42e=_0x3e24fa;if(_0x35a20d===0x0){_0x2a04f0();return;}_0x33a065(new Error(_0x5ca8eb+(_0x35a42e(0x112)+_0x35a42e(0x10a)+'e=')+_0x35a20d+':\x20'+_0x56c01b));});});}function isMetadataJunk(_0xb04877){const _0x5f2593=_0x4c81;return _0xb04877===_0x5f2593(0xfd)+'e'||_0xb04877===_0x5f2593(0xe5)+'b';}function shouldIncludeRotatingLog(_0x13b425){const _0x1b312e=_0x4c81;if(LEGACY_LOG_FILE_RE[_0x1b312e(0x13c)](_0x13b425))return![];const _0xa78f68=LOG_FILE_RE[_0x1b312e(0x10b)](_0x13b425);if(!_0xa78f68)return![];if(_0xa78f68[_0x1b312e(0x12e)][_0x1b312e(0x108)])return![];return!/^\d+$/[_0x1b312e(0x13c)](_0xa78f68[_0x1b312e(0x12e)]['base']);}export function shouldIncludeLogArchiveEntry(_0x402af8){const _0x3fd160=_0x4c81,_0x2371cd=String(_0x402af8||'')[_0x3fd160(0x109)+'ll']('\x5c','/');if(!_0x2371cd||_0x2371cd[_0x3fd160(0x110)]('/')[_0x3fd160(0x10e)](isMetadataJunk))return![];if(_0x2371cd[_0x3fd160(0x11f)](_0x3fd160(0x130)+_0x3fd160(0xf9))||_0x2371cd[_0x3fd160(0x11f)](_0x3fd160(0x135)))return![];if(_0x2371cd[_0x3fd160(0x11f)](_0x3fd160(0x12b)+'/')||_0x2371cd['includes']('/tmp/'))return![];const _0x5711ff=_0x2371cd[_0x3fd160(0x110)]('/'),_0xe08135=_0x5711ff['at'](-0x1)||'';if(!_0xe08135)return![];if(_0x5711ff[0x0]==='diagnost'+_0x3fd160(0x136)){if(_0xe08135[_0x3fd160(0xeb)](_0x3fd160(0xf6))||_0xe08135[_0x3fd160(0xeb)](_0x3fd160(0xef))||_0xe08135[_0x3fd160(0xeb)](_0x3fd160(0xda)))return!![];return![];}return shouldIncludeRotatingLog(_0xe08135);}async function copyAllowedLogs(_0x5d2931,_0x392a27,_0x361c0b=_0x5d2931){const _0x15311a=_0x4c81;let _0xd92fd3=0x0;const _0x1b2a67=await readdir(_0x361c0b,{'withFileTypes':!![]})[_0x15311a(0x105)](()=>[]);for(const _0x2b3d27 of _0x1b2a67){if(isMetadataJunk(_0x2b3d27['name']))continue;const _0x2f3bb1=join(_0x361c0b,_0x2b3d27[_0x15311a(0xd7)]),_0x1a607f=relative(_0x5d2931,_0x2f3bb1);if(_0x2b3d27[_0x15311a(0xff)+_0x15311a(0x123)]()){_0xd92fd3+=await copyAllowedLogs(_0x5d2931,_0x392a27,_0x2f3bb1);continue;}if(!_0x2b3d27['isFile']()||!shouldIncludeLogArchiveEntry(_0x1a607f))continue;const _0x2a9dcb=join(_0x392a27,_0x1a607f);try{await mkdir(dirname(_0x2a9dcb),{'recursive':!![]}),await copyFile(_0x2f3bb1,_0x2a9dcb),_0xd92fd3+=0x1;}catch{}}return _0xd92fd3;}export async function exportLogsArchive({logsDir:_0x491bca,targetDir:_0x1bbb4e,appVersion:appVersion=_0x210af5(0xdd)}){const _0x2805ed=_0x210af5;if(!_0x491bca||!existsSync(_0x491bca))throw new Error('logs\x20dir'+_0x2805ed(0x114)+_0x2805ed(0xd9)+':\x20'+(_0x491bca||''));const _0x171ec0=String(appVersion||_0x2805ed(0xdd))['replace'](/[^A-Za-z0-9._-]/g,'_'),_0x4a48fe=new Date()[_0x2805ed(0x128)+_0x2805ed(0x106)]()[_0x2805ed(0x113)](/[-:]/g,'')['replace'](/\..+$/,''),_0x268ba9=_0x1bbb4e||tmpdir();await mkdir(_0x268ba9,{'recursive':!![]});const _0x368dbe=join(_0x268ba9,_0x2805ed(0xe6)+_0x2805ed(0x116)+'-'+_0x4a48fe+'-'+_0x171ec0+_0x2805ed(0x101)),_0x40a35c=join(tmpdir(),'wujie-sh'+_0x2805ed(0x116)+'-'+process[_0x2805ed(0xfc)]+'-'+Date[_0x2805ed(0x124)]());await rm(_0x40a35c,{'recursive':!![],'force':!![]}),await mkdir(_0x40a35c,{'recursive':!![]});try{const _0x40c7b=await copyAllowedLogs(_0x491bca,_0x40a35c);if(_0x40c7b===0x0)throw new Error(_0x2805ed(0x100)+_0x2805ed(0xf5)+_0x2805ed(0x127)+':\x20'+_0x491bca);if(process[_0x2805ed(0xea)]==='win32'){const _0x317947=[_0x2805ed(0x107)+_0x2805ed(0xdb)+_0x2805ed(0x120)+_0x2805ed(0xe7)+_0x2805ed(0xe2),_0x2805ed(0x132)+_0x2805ed(0x139)+_0x2805ed(0x126)+JSON[_0x2805ed(0x13a)+'y'](join(_0x40a35c,'*'))+(_0x2805ed(0xe0)+_0x2805ed(0xdf)+'h\x20')+JSON[_0x2805ed(0x13a)+'y'](_0x368dbe)+_0x2805ed(0x13b)][_0x2805ed(0xf4)]('\x20'),_0x409f26=Buffer[_0x2805ed(0x11d)](_0x317947,'utf16le')[_0x2805ed(0x119)]('base64');await run(_0x2805ed(0xf1)+_0x2805ed(0x131),[_0x2805ed(0x118)+'le',_0x2805ed(0x115)+_0x2805ed(0xd5),_0x409f26]);}else await run(_0x2805ed(0xed),['-r',_0x368dbe,'.'],{'cwd':_0x40a35c});}finally{await rm(_0x40a35c,{'recursive':!![],'force':!![]})[_0x2805ed(0x105)](()=>{});}return{'ok':!![],'path':_0x368dbe};}
|
|
1
|
+
const _0x1cb9b0=_0x4726;(function(_0x6622ab,_0x415ac3){const _0x22330a=_0x4726,_0x83c3b9=_0x6622ab();while(!![]){try{const _0x143515=-parseInt(_0x22330a(0x173))/0x1+parseInt(_0x22330a(0x160))/0x2*(-parseInt(_0x22330a(0x14a))/0x3)+-parseInt(_0x22330a(0x18d))/0x4+-parseInt(_0x22330a(0x183))/0x5*(parseInt(_0x22330a(0x154))/0x6)+parseInt(_0x22330a(0x153))/0x7+parseInt(_0x22330a(0x198))/0x8*(parseInt(_0x22330a(0x168))/0x9)+parseInt(_0x22330a(0x166))/0xa;if(_0x143515===_0x415ac3)break;else _0x83c3b9['push'](_0x83c3b9['shift']());}catch(_0x20fda6){_0x83c3b9['push'](_0x83c3b9['shift']());}}}(_0x1f00,0x3247d));import{createHash}from'node:crypto';import{spawn}from'node:child_process';import{existsSync}from'node:fs';import{copyFile,mkdir,readdir,rm}from'node:fs/promises';import{homedir,tmpdir}from'node:os';import{basename,dirname,isAbsolute,join,relative,resolve}from'node:path';function _0x4726(_0x2a5a19,_0x56b4dd){_0x2a5a19=_0x2a5a19-0x13e;const _0x1f003f=_0x1f00();let _0x4726ed=_0x1f003f[_0x2a5a19];return _0x4726ed;}import{createFileLogger,redactLogValue}from'@wujie-shell/logger';const LOG_MAX_BYTES=0x2*0x400*0x400,LOG_KEEP_COUNT=0x5,loggers=new Map(),CONTENT_PREVIEW_LENGTH=0xf0,LOG_FILE_RE=/^(?<base>.+?)(?:\.(?<index>\d+))?\.log$/,LEGACY_LOG_FILE_RE=/^.+\.log\.(?<index>\d+)$/;export function createShellLogger(_0x168f32,_0x49ac25,_0x265093=_0x49ac25){const _0x252989=_0x4726,_0x51b68f=_0x168f32?.['logsDir'];if(!_0x51b68f||!_0x49ac25)return null;const _0x3c5953=join(_0x51b68f,_0x49ac25,_0x49ac25+_0x252989(0x191)),_0x511587=_0x3c5953+':'+_0x265093;return!loggers[_0x252989(0x159)](_0x511587)&&loggers[_0x252989(0x156)](_0x511587,createFileLogger({'filePath':_0x3c5953,'context':_0x265093,'maxBytes':LOG_MAX_BYTES,'keepCount':LOG_KEEP_COUNT})),loggers['get'](_0x511587);}export function toHomePath(_0x625158){const _0x310bf5=_0x4726,_0x360e50=typeof _0x625158===_0x310bf5(0x195)?_0x625158:'';if(!_0x360e50)return'';const _0x3b3d14=homedir(),_0x4f91bf=isAbsolute(_0x360e50)?_0x360e50:resolve(_0x360e50),_0x445ffb=relative(_0x3b3d14,_0x4f91bf);if(!_0x445ffb||!_0x445ffb[_0x310bf5(0x13f)+'th']('..')&&!isAbsolute(_0x445ffb))return _0x445ffb?'~/'+_0x445ffb:'~';return _0x4f91bf;}export function hashText(_0x3330a9){const _0x55628c=_0x4726;return createHash('sha256')[_0x55628c(0x17e)](String(_0x3330a9))[_0x55628c(0x15b)]('hex')[_0x55628c(0x17f)](0x0,0x10);}export function truncateText(_0x11c98d,_0x4a6482=CONTENT_PREVIEW_LENGTH){const _0x3a6e0c=_0x4726,_0x3dcc79=String(_0x11c98d??'')[_0x3a6e0c(0x142)](/\s+/g,'\x20')[_0x3a6e0c(0x146)]();if(_0x3dcc79[_0x3a6e0c(0x149)]<=_0x4a6482)return _0x3dcc79;return _0x3dcc79['slice'](0x0,_0x4a6482)+'...';}export function summarizeText(_0x20ad59,_0x54de9e=CONTENT_PREVIEW_LENGTH){const _0x519ae4=_0x4726,_0x3655b7=String(_0x20ad59??'');return{'length':_0x3655b7[_0x519ae4(0x149)],'hash':hashText(_0x3655b7),'preview':truncateText(_0x3655b7,_0x54de9e),'truncated':_0x3655b7['length']>_0x54de9e};}export function summarizeError(_0x30e2f7){const _0x2aab9d=_0x4726;if(_0x30e2f7 instanceof Error)return{'name':_0x30e2f7['name'],'message':_0x30e2f7[_0x2aab9d(0x17a)],'stack':_0x30e2f7['stack']};return{'message':String(_0x30e2f7)};}function summarizePathValue(_0x589c1d){const _0x4b451a=_0x4726;if(typeof _0x589c1d!==_0x4b451a(0x195))return _0x589c1d;if(_0x589c1d[_0x4b451a(0x17c)]('/')||_0x589c1d[_0x4b451a(0x17c)]('\x5c'))return toHomePath(_0x589c1d);return _0x589c1d;}export function summarizePayload(_0x48294e,_0x5e864a={}){const _0x234f3d=_0x4726,_0x53d3ce=_0x5e864a[_0x234f3d(0x163)]??0x4,_0x25290f=new WeakSet();function _0x12f94c(_0x44b812,_0x5f4d10,_0x241848=''){const _0x231481=_0x234f3d;if(_0x44b812==null)return _0x44b812;if(typeof _0x44b812==='string'){if(/message|content|prompt|text|body/i['test'](_0x241848))return summarizeText(_0x44b812,_0x5e864a[_0x231481(0x14b)+_0x231481(0x179)+'h']);return summarizePathValue(_0x44b812);}if(typeof _0x44b812!=='object')return _0x44b812;if(_0x44b812 instanceof Error)return summarizeError(_0x44b812);if(_0x25290f[_0x231481(0x159)](_0x44b812))return _0x231481(0x140)+'r]';if(_0x5f4d10>=_0x53d3ce)return'['+(Array[_0x231481(0x161)](_0x44b812)?_0x231481(0x178):_0x231481(0x193))+']';_0x25290f[_0x231481(0x15a)](_0x44b812);if(Array['isArray'](_0x44b812))return{'type':'array','length':_0x44b812[_0x231481(0x149)],'items':_0x44b812[_0x231481(0x17f)](0x0,0x5)[_0x231481(0x16f)](_0x1ae505=>_0x12f94c(_0x1ae505,_0x5f4d10+0x1,_0x241848)),'truncated':_0x44b812[_0x231481(0x149)]>0x5};const _0x5bb2bb={};for(const [_0x509eaa,_0xf874da]of Object[_0x231481(0x181)](_0x44b812)){_0x5bb2bb[_0x509eaa]=_0x12f94c(_0xf874da,_0x5f4d10+0x1,_0x509eaa);}return redactLogValue(_0x5bb2bb);}return _0x12f94c(_0x48294e,0x0);}function _0x1f00(){const _0x112147=['\x20-Path\x20','980344hQjQRN','logs\x20dir','entlyCon','\x20failed\x20','.log','with\x20cod','Object','\x20log\x20fil','string','-Archive','stringif','3218192QGYgfo','base64','cwd','pid','Command','startsWi','[Circula','split','replace','$Progres','dev','\x20-Force','trim','ationPat','from','length','649785uXTyyr','textPrev','base','toISOStr','ell-logs','powershe','data','ll.exe','.jsonl','2218979kTKjDi','848886WoxSZw','es\x20found','set','utf16le','.zip','has','add','digest','stderr','ory','ing','groups','2bAdpYr','isArray','now','maxDepth','ot\x20found','/tmp/','1226600TkHcQz','Compress','9nGnvCD','filter','catch','win32','toString','sPrefere','error','map','platform','ics','/staging','32820qJtZsM','exec','wujie-sh','some','ectory\x20n','Array','iewLengt','message','-Encoded','includes','pipe','update','slice','Thumbs.d','entries','endsWith','5kbLiMo','dules/','nce=\x27Sil','tinue\x27;','join','.DS_Stor','.json','test','name'];_0x1f00=function(){return _0x112147;};return _0x1f00();}export function summarizeFilePaths(_0x3e2a91=[]){const _0x2018ec=_0x4726;return(Array[_0x2018ec(0x161)](_0x3e2a91)?_0x3e2a91:[])['map'](_0x160fc5=>String(_0x160fc5||'')[_0x2018ec(0x146)]())[_0x2018ec(0x169)](Boolean)['map'](_0x4f311c=>({'path':toHomePath(_0x4f311c),'name':basename(_0x4f311c)}));}function run(_0x47ce18,_0x49bacb,_0x563ceb={}){return new Promise((_0x2a3c10,_0x3058ee)=>{const _0x2d7f07=_0x4726,_0x2c9839=spawn(_0x47ce18,_0x49bacb,{'cwd':_0x563ceb[_0x2d7f07(0x19a)],'env':{...process.env,..._0x563ceb['env']??{}},'stdio':['ignore',_0x2d7f07(0x17d),'pipe']});let _0x1aa22e='';_0x2c9839[_0x2d7f07(0x15c)]?.['on'](_0x2d7f07(0x150),_0x5cfdaf=>{_0x1aa22e+=_0x5cfdaf['toString']();}),_0x2c9839['on'](_0x2d7f07(0x16e),_0x3058ee),_0x2c9839['on']('close',_0x805d60=>{const _0x24dca5=_0x2d7f07;if(_0x805d60===0x0){_0x2a3c10();return;}_0x3058ee(new Error(_0x47ce18+(_0x24dca5(0x190)+_0x24dca5(0x192)+'e=')+_0x805d60+':\x20'+_0x1aa22e));});});}function isMetadataJunk(_0x31248b){const _0x49c35e=_0x4726;return _0x31248b===_0x49c35e(0x188)+'e'||_0x31248b===_0x49c35e(0x180)+'b';}function shouldIncludeRotatingLog(_0x2659a0){const _0x1d8398=_0x4726;if(LEGACY_LOG_FILE_RE[_0x1d8398(0x18a)](_0x2659a0))return![];const _0x565c92=LOG_FILE_RE[_0x1d8398(0x174)](_0x2659a0);if(!_0x565c92)return![];if(_0x565c92[_0x1d8398(0x15f)]['index'])return![];return!/^\d+$/[_0x1d8398(0x18a)](_0x565c92[_0x1d8398(0x15f)][_0x1d8398(0x14c)]);}export function shouldIncludeLogArchiveEntry(_0x480b46){const _0x367e41=_0x4726,_0x42a65c=String(_0x480b46||'')['replaceA'+'ll']('\x5c','/');if(!_0x42a65c||_0x42a65c[_0x367e41(0x141)]('/')[_0x367e41(0x176)](isMetadataJunk))return![];if(_0x42a65c[_0x367e41(0x17c)]('/node_mo'+_0x367e41(0x184))||_0x42a65c[_0x367e41(0x17c)]('/.cache/'))return![];if(_0x42a65c[_0x367e41(0x17c)](_0x367e41(0x172)+'/')||_0x42a65c[_0x367e41(0x17c)](_0x367e41(0x165)))return![];const _0x512536=_0x42a65c[_0x367e41(0x141)]('/'),_0x3440ab=_0x512536['at'](-0x1)||'';if(!_0x3440ab)return![];if(_0x512536[0x0]==='diagnost'+_0x367e41(0x171)){if(_0x3440ab['endsWith'](_0x367e41(0x189))||_0x3440ab[_0x367e41(0x182)](_0x367e41(0x152))||_0x3440ab[_0x367e41(0x182)](_0x367e41(0x191)))return!![];return![];}return shouldIncludeRotatingLog(_0x3440ab);}async function copyAllowedLogs(_0x3b8c30,_0x104f38,_0x42bbfb=_0x3b8c30){const _0x26ba09=_0x4726;let _0x3e71f6=0x0;const _0x10403d=await readdir(_0x42bbfb,{'withFileTypes':!![]})[_0x26ba09(0x16a)](()=>[]);for(const _0x5c3390 of _0x10403d){if(isMetadataJunk(_0x5c3390[_0x26ba09(0x18b)]))continue;const _0x56a073=join(_0x42bbfb,_0x5c3390[_0x26ba09(0x18b)]),_0xad0d00=relative(_0x3b8c30,_0x56a073);if(_0x5c3390['isDirect'+_0x26ba09(0x15d)]()){_0x3e71f6+=await copyAllowedLogs(_0x3b8c30,_0x104f38,_0x56a073);continue;}if(!_0x5c3390['isFile']()||!shouldIncludeLogArchiveEntry(_0xad0d00))continue;const _0x57761c=join(_0x104f38,_0xad0d00);try{await mkdir(dirname(_0x57761c),{'recursive':!![]}),await copyFile(_0x56a073,_0x57761c),_0x3e71f6+=0x1;}catch{}}return _0x3e71f6;}export async function exportLogsArchive({logsDir:_0x4970cf,targetDir:_0x25d409,appVersion:appVersion=_0x1cb9b0(0x144)}){const _0x1438f4=_0x1cb9b0;if(!_0x4970cf||!existsSync(_0x4970cf))throw new Error(_0x1438f4(0x18e)+_0x1438f4(0x177)+_0x1438f4(0x164)+':\x20'+(_0x4970cf||''));const _0xcabfb9=String(appVersion||'dev')['replace'](/[^A-Za-z0-9._-]/g,'_'),_0x5b0758=new Date()[_0x1438f4(0x14d)+_0x1438f4(0x15e)]()[_0x1438f4(0x142)](/[-:]/g,'')[_0x1438f4(0x142)](/\..+$/,''),_0x2ab3e5=_0x25d409||tmpdir();await mkdir(_0x2ab3e5,{'recursive':!![]});const _0xf591e3=join(_0x2ab3e5,_0x1438f4(0x175)+_0x1438f4(0x14e)+'-'+_0x5b0758+'-'+_0xcabfb9+_0x1438f4(0x158)),_0x5e23a6=join(tmpdir(),_0x1438f4(0x175)+_0x1438f4(0x14e)+'-'+process[_0x1438f4(0x19b)]+'-'+Date[_0x1438f4(0x162)]());await rm(_0x5e23a6,{'recursive':!![],'force':!![]}),await mkdir(_0x5e23a6,{'recursive':!![]});try{const _0x3ddeeb=await copyAllowedLogs(_0x4970cf,_0x5e23a6);if(_0x3ddeeb===0x0)throw new Error('no\x20valid'+_0x1438f4(0x194)+_0x1438f4(0x155)+':\x20'+_0x4970cf);if(process[_0x1438f4(0x170)]===_0x1438f4(0x16b)){const _0x3ec3eb=[_0x1438f4(0x143)+_0x1438f4(0x16d)+_0x1438f4(0x185)+_0x1438f4(0x18f)+_0x1438f4(0x186),_0x1438f4(0x167)+_0x1438f4(0x196)+_0x1438f4(0x18c)+JSON[_0x1438f4(0x197)+'y'](join(_0x5e23a6,'*'))+('\x20-Destin'+_0x1438f4(0x147)+'h\x20')+JSON[_0x1438f4(0x197)+'y'](_0xf591e3)+_0x1438f4(0x145)][_0x1438f4(0x187)]('\x20'),_0x5dfb1b=Buffer[_0x1438f4(0x148)](_0x3ec3eb,_0x1438f4(0x157))[_0x1438f4(0x16c)](_0x1438f4(0x199));await run(_0x1438f4(0x14f)+_0x1438f4(0x151),['-NoProfi'+'le',_0x1438f4(0x17b)+_0x1438f4(0x13e),_0x5dfb1b]);}else await run('zip',['-r',_0xf591e3,'.'],{'cwd':_0x5e23a6});}finally{await rm(_0x5e23a6,{'recursive':!![],'force':!![]})[_0x1438f4(0x16a)](()=>{});}return{'ok':!![],'path':_0xf591e3};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const _0x4338b7=_0x5de9;(function(_0x10e5ed,_0x2799a9){const _0x684577=_0x5de9,_0x3a21ce=_0x10e5ed();while(!![]){try{const _0x27fde5=parseInt(_0x684577(0x117))/0x1+parseInt(_0x684577(0xfc))/0x2*(-parseInt(_0x684577(0x10c))/0x3)+parseInt(_0x684577(0x108))/0x4+-parseInt(_0x684577(0x107))/0x5*(parseInt(_0x684577(0x105))/0x6)+-parseInt(_0x684577(0x111))/0x7*(parseInt(_0x684577(0x102))/0x8)+-parseInt(_0x684577(0xf8))/0x9+-parseInt(_0x684577(0x118))/0xa*(-parseInt(_0x684577(0x112))/0xb);if(_0x27fde5===_0x2799a9)break;else _0x3a21ce['push'](_0x3a21ce['shift']());}catch(_0x36700f){_0x3a21ce['push'](_0x3a21ce['shift']());}}}(_0x39ea,0x7f33a));import{join}from'node:path';import{createFileLogger}from'@wujie-shell/logger';function _0x39ea(){const _0x1e81d9=['has','oot','475367tBtAPp','50DVonoa','installP','Version','resolved','LocalPlu','length','LocalAge','product','productN','runtime','appId','dAt','3291723fzGVgQ','LocalSki','get','ame','1010LfBcdb','runtime.','llPaths','plugins','log','logsDir','16vHnTEn','ion','openclaw','12ObcoUP','pluginSp','1930575xbdmDw','409844CVRQNE','wBin','nodeVers','ntPaths','2121hnpPLY','ecs','wujiecla','generate','ath','1052653PhwDJQ','3825712HAXtxX','logsDirN','isArray'];_0x39ea=function(){return _0x1e81d9;};return _0x39ea();}const RUNTIME_LOG_MAX_BYTES=0x2*0x400*0x400,RUNTIME_LOG_KEEP_COUNT=0x5,runtimeLoggers=new Map();export function createRuntimeLogger(_0x5a5d9a,_0x59b0a9=_0x4338b7(0xf5)){const _0x40bd5e=_0x4338b7,_0x5e269e=_0x5a5d9a?.[_0x40bd5e(0x101)];if(!_0x5e269e)return null;const _0x114370=join(_0x5e269e,'runtime',_0x40bd5e(0xfd)+_0x40bd5e(0x100)),_0xa83882=_0x114370+':'+_0x59b0a9;return!runtimeLoggers[_0x40bd5e(0x115)](_0xa83882)&&runtimeLoggers['set'](_0xa83882,createFileLogger({'filePath':_0x114370,'context':_0x59b0a9,'maxBytes':RUNTIME_LOG_MAX_BYTES,'keepCount':RUNTIME_LOG_KEEP_COUNT})),runtimeLoggers[_0x40bd5e(0xfa)](_0xa83882);}export function summarizeShellConfig(_0x29e020){const _0x14f708=_0x4338b7;return{'appId':_0x29e020[_0x14f708(0xf6)],'productName':_0x29e020[_0x14f708(0xf4)+_0x14f708(0xfb)],'projectRoot':_0x29e020['projectR'+_0x14f708(0x116)],'dataDir':_0x29e020['dataDir'],'dataDirName':_0x29e020['dataDirN'+_0x14f708(0xfb)],'logsDirName':_0x29e020['logger']?.[_0x14f708(0x113)+'ame'],'logsDir':_0x29e020['logger']?.[_0x14f708(0x101)],'openclawVersion':_0x29e020[_0x14f708(0x104)]?.[_0x14f708(0x104)+_0x14f708(0x11a)],'nodeVersion':_0x29e020[_0x14f708(0x104)]?.['nodeVers'+_0x14f708(0x103)],'pluginSpecCount':_0x29e020['openclaw']?.[_0x14f708(0x106)+_0x14f708(0x10d)]?.[_0x14f708(0xf1)]??0x0,'localPluginCount':_0x29e020[_0x14f708(0x104)]?.[_0x14f708(0x11b)+_0x14f708(0x11c)+'ginPaths']?.[_0x14f708(0xf1)]??0x0,'localAgentCount':_0x29e020[_0x14f708(0x104)]?.['resolved'+_0x14f708(0xf2)+_0x14f708(0x10b)]?.[_0x14f708(0xf1)]??0x0,'localSkillCount':_0x29e020[_0x14f708(0x104)]?.[_0x14f708(0x11b)+_0x14f708(0xf9)+_0x14f708(0xfe)]?.[_0x14f708(0xf1)]??0x0,'localAgentPaths':_0x29e020[_0x14f708(0x104)]?.[_0x14f708(0x11b)+_0x14f708(0xf2)+'ntPaths'],'localSkillPaths':_0x29e020['openclaw']?.['resolved'+_0x14f708(0xf9)+_0x14f708(0xfe)],'workflowsDir':_0x29e020[_0x14f708(0x104)]?.['workflow'+'sDir']};}function _0x5de9(_0x1a1849,_0x17c2eb){_0x1a1849=_0x1a1849-0xf1;const _0x39ea84=_0x39ea();let _0x5de93c=_0x39ea84[_0x1a1849];return _0x5de93c;}export function summarizeRuntimeManifest(_0x28545d){const _0x36334=_0x4338b7;return{'generatedAt':_0x28545d?.[_0x36334(0x10f)+_0x36334(0xf7)],'openclawVersion':_0x28545d?.[_0x36334(0x104)+_0x36334(0x11a)],'nodeVersion':_0x28545d?.[_0x36334(0x10a)+_0x36334(0x103)],'pluginCount':Array[_0x36334(0x114)](_0x28545d?.[_0x36334(0xff)])?_0x28545d[_0x36334(0xff)][_0x36334(0xf1)]:0x0,'pluginSpecCount':Array[_0x36334(0x114)](_0x28545d?.['pluginSp'+_0x36334(0x10d)])?_0x28545d[_0x36334(0x106)+_0x36334(0x10d)]['length']:0x0,'agentsInstallPath':_0x28545d?.['agents']?.[_0x36334(0x119)+_0x36334(0x110)],'skillsInstallPath':_0x28545d?.['skills']?.[_0x36334(0x119)+_0x36334(0x110)],'wujieclawBin':_0x28545d?.[_0x36334(0x10e)+_0x36334(0x109)],'product':_0x28545d?.[_0x36334(0xf3)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x2891d9=_0x39be;(function(_0x47da0b,_0xdd3d70){const _0x58165f=_0x39be,_0x5c6293=_0x47da0b();while(!![]){try{const _0x2a9d80=parseInt(_0x58165f(0x13c))/0x1*(parseInt(_0x58165f(0x102))/0x2)+-parseInt(_0x58165f(0x148))/0x3+-parseInt(_0x58165f(0x121))/0x4+parseInt(_0x58165f(0x13a))/0x5*(parseInt(_0x58165f(0xf0))/0x6)+-parseInt(_0x58165f(0x11d))/0x7+parseInt(_0x58165f(0x13e))/0x8*(parseInt(_0x58165f(0x131))/0x9)+-parseInt(_0x58165f(0xb6))/0xa*(-parseInt(_0x58165f(0xaa))/0xb);if(_0x2a9d80===_0xdd3d70)break;else _0x5c6293['push'](_0x5c6293['shift']());}catch(_0x561a3d){_0x5c6293['push'](_0x5c6293['shift']());}}}(_0x4a4d,0x68e55));import{basename,extname,join}from'node:path';import{createHash}from'node:crypto';import{createFileLogger,redactLogValue}from'@wujie-shell/logger';import{summarizeError,summarizePayload,summarizeText}from'./logging.mjs';function _0x39be(_0x415a0e,_0x178f27){_0x415a0e=_0x415a0e-0x9d;const _0x4a4d37=_0x4a4d();let _0x39be2f=_0x4a4d37[_0x415a0e];return _0x39be2f;}const USER_EVENT_LOG_MAX_BYTES=0xa*0x400*0x400,USER_EVENT_LOG_KEEP_COUNT=0x1,USER_EVENT_PREVIEW_LENGTH=0xc8,DIAGNOSTIC_EVENT_PREVIEW_LENGTH=0x1f4,loggers=new Map(),CHANNEL_POLICIES={'chat:stream':{'priority':'P0','category':_0x2891d9(0xdb),'event':_0x2891d9(0xf5)+'eam','phase':'request','always':!![]},'chat:abort':{'priority':'P0','category':_0x2891d9(0xdb),'event':_0x2891d9(0xf3)+'rt','phase':_0x2891d9(0xea),'always':!![]},'chat:history':{'priority':'P0','category':_0x2891d9(0xdb),'event':_0x2891d9(0x9d)+'tory','phase':_0x2891d9(0xcd),'errorOnly':!![]},'sessions:create':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0xfd)+_0x2891d9(0xc1),'phase':'request','always':!![]},'sessions:delete':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0xfd)+_0x2891d9(0x9f),'phase':_0x2891d9(0xea),'always':!![]},'sessions:rename':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0xfd)+'rename','phase':'request','always':!![]},'sessions:pin':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0xfd)+_0x2891d9(0x14b)+'te','phase':_0x2891d9(0xea),'always':!![]},'sessions:unpin':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0xfd)+'pin_upda'+'te','phase':_0x2891d9(0xea),'always':!![]},'sessions:reorder-pinned':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0xfd)+_0x2891d9(0x14b)+'te','phase':_0x2891d9(0xea),'always':!![]},'sessions:list':{'priority':'P0','category':_0x2891d9(0xd2),'event':_0x2891d9(0x12a)+_0x2891d9(0x109),'phase':_0x2891d9(0xcd),'errorOnly':!![]},'logs:report':{'priority':'P0','category':_0x2891d9(0x14e),'event':_0x2891d9(0x13b)+_0x2891d9(0x142),'phase':_0x2891d9(0xea),'always':!![]},'logs:export':{'priority':'P0','category':_0x2891d9(0x14e),'event':'logs_exp'+'ort','phase':_0x2891d9(0xea),'always':!![]},'app:file:choose':{'priority':'P0','category':_0x2891d9(0x110),'event':'file_cho'+_0x2891d9(0x13d),'phase':_0x2891d9(0xea),'always':!![]},'files:read':{'priority':'P0','category':_0x2891d9(0x110),'event':_0x2891d9(0x10c)+'d','phase':'request','always':!![]},'files:select-file':{'priority':'P0','category':_0x2891d9(0x110),'event':_0x2891d9(0xd0)+'ect','phase':_0x2891d9(0xea),'always':!![]},'models:complete':{'priority':'P0','category':'model','event':_0x2891d9(0x107)+_0x2891d9(0xbf),'phase':_0x2891d9(0xea),'always':!![]},'agents:create':{'priority':'P1','category':_0x2891d9(0xb5),'event':_0x2891d9(0xfe)+_0x2891d9(0xc9),'phase':_0x2891d9(0xea),'always':!![]},'agents:update':{'priority':'P1','category':_0x2891d9(0xb5),'event':_0x2891d9(0x112)+'date','phase':_0x2891d9(0xea),'always':!![]},'agents:delete':{'priority':'P1','category':'agent','event':_0x2891d9(0xd9)+_0x2891d9(0xd3),'phase':_0x2891d9(0xea),'always':!![]},'agents:list':{'priority':'P1','category':_0x2891d9(0xb5),'event':'agents_l'+_0x2891d9(0xb9),'phase':_0x2891d9(0xcd),'errorOnly':!![]},'skills:install':{'priority':'P1','category':_0x2891d9(0xb2),'event':_0x2891d9(0xc6)+'stall','phase':_0x2891d9(0xea),'always':!![]},'skills:import-zip':{'priority':'P1','category':_0x2891d9(0xb2),'event':_0x2891d9(0x9e)+'port_zip','phase':_0x2891d9(0xea),'always':!![]},'skills:update':{'priority':'P1','category':'skill','event':_0x2891d9(0xb1)+_0x2891d9(0x106),'phase':_0x2891d9(0xea),'always':!![]},'skills:delete':{'priority':'P1','category':_0x2891d9(0xb2),'event':_0x2891d9(0x149)+'lete','phase':'request','always':!![]},'skills:status':{'priority':'P1','category':'skill','event':'skills_s'+_0x2891d9(0x150),'phase':_0x2891d9(0xcd),'errorOnly':!![]},'plugins:update-config':{'priority':'P1','category':_0x2891d9(0x122),'event':_0x2891d9(0x130)+_0x2891d9(0x11e)+'date','phase':'request','always':!![]},'plugins:enable':{'priority':'P1','category':_0x2891d9(0x122),'event':_0x2891d9(0xec)+_0x2891d9(0xff),'phase':_0x2891d9(0xea),'always':!![]},'plugins:disable':{'priority':'P1','category':_0x2891d9(0x122),'event':_0x2891d9(0x134)+_0x2891d9(0x141),'phase':_0x2891d9(0xea),'always':!![]},'config:connector:save':{'priority':'P1','category':_0x2891d9(0x140)+'r','event':_0x2891d9(0x140)+_0x2891d9(0xbc),'phase':_0x2891d9(0xea),'always':!![]},'config:connector-session:start':{'priority':'P1','category':_0x2891d9(0x140)+'r','event':_0x2891d9(0x140)+_0x2891d9(0xdf)+_0x2891d9(0xa9),'phase':'request','always':!![]},'config:connector-session:cancel':{'priority':'P1','category':_0x2891d9(0x140)+'r','event':'connecto'+_0x2891d9(0xdf)+_0x2891d9(0x116),'phase':_0x2891d9(0xea),'always':!![]},'config:connector-session:complete':{'priority':'P1','category':'connecto'+'r','event':'connecto'+_0x2891d9(0xdf)+'n_comple'+'te','phase':'request','always':!![]},'cron:create':{'priority':'P1','category':_0x2891d9(0x10e),'event':_0x2891d9(0x151)+_0x2891d9(0xee),'phase':_0x2891d9(0xea),'always':!![]},'cron:update':{'priority':'P1','category':_0x2891d9(0x10e),'event':_0x2891d9(0xa2)+'ate','phase':_0x2891d9(0xea),'always':!![]},'cron:remove':{'priority':'P1','category':'cron','event':_0x2891d9(0xf8)+_0x2891d9(0x14d),'phase':'request','always':!![]},'cron:run-once':{'priority':'P1','category':_0x2891d9(0x10e),'event':'cron_run'+_0x2891d9(0xf6),'phase':_0x2891d9(0xea),'always':!![]},'app:generated-files:upsert':{'priority':'P1','category':_0x2891d9(0xf9)+_0x2891d9(0xb8),'event':'generate'+'d_file_u'+_0x2891d9(0xba),'phase':_0x2891d9(0xea),'always':!![]},'app:generated-files:hide':{'priority':'P1','category':'generate'+_0x2891d9(0xb8),'event':_0x2891d9(0xf9)+'d_file_h'+_0x2891d9(0xe6),'phase':'request','always':!![]},'app:generated-files:hide-by-session':{'priority':'P1','category':_0x2891d9(0xf9)+_0x2891d9(0xb8),'event':_0x2891d9(0xf9)+_0x2891d9(0xe0)+_0x2891d9(0xcc)+_0x2891d9(0xc7),'phase':_0x2891d9(0xea),'always':!![]},'app:generated-files:delete':{'priority':'P1','category':_0x2891d9(0xf9)+'d_files','event':_0x2891d9(0xf9)+_0x2891d9(0xa8)+'elete','phase':_0x2891d9(0xea),'always':!![]},'app:generated-files:reveal':{'priority':'P1','category':_0x2891d9(0xf9)+_0x2891d9(0xb8),'event':'generate'+_0x2891d9(0xe9)+'eveal','phase':_0x2891d9(0xea),'always':!![]},'artifacts:upsert':{'priority':'P1','category':_0x2891d9(0xf9)+_0x2891d9(0xb8),'event':'artifact'+_0x2891d9(0x133),'phase':'request','always':!![]},'artifacts:hide':{'priority':'P1','category':_0x2891d9(0xf9)+_0x2891d9(0xb8),'event':'artifact'+_0x2891d9(0x147),'phase':_0x2891d9(0xea),'always':!![]},'artifacts:delete':{'priority':'P1','category':_0x2891d9(0xf9)+_0x2891d9(0xb8),'event':_0x2891d9(0xe7)+_0x2891d9(0xb3),'phase':_0x2891d9(0xea),'always':!![]},'artifacts:reveal':{'priority':'P1','category':_0x2891d9(0xf9)+'d_files','event':_0x2891d9(0xe7)+'_reveal','phase':_0x2891d9(0xea),'always':!![]},'window:minimize':{'priority':'P2','category':_0x2891d9(0xc4),'event':'window_m'+'inimize','phase':_0x2891d9(0xea),'always':![]},'window:toggle-maximize':{'priority':'P2','category':_0x2891d9(0xc4),'event':'window_t'+_0x2891d9(0xe8)+_0x2891d9(0xcb),'phase':_0x2891d9(0xea),'always':![]},'window:close':{'priority':'P2','category':_0x2891d9(0xc4),'event':'window_c'+'lose','phase':_0x2891d9(0xea),'always':!![]},'app:tray:set-close':{'priority':'P2','category':_0x2891d9(0xc2),'event':_0x2891d9(0x103)+_0x2891d9(0xd6)+_0x2891d9(0xd7)+'e','phase':_0x2891d9(0xea),'always':!![]},'app:clipboard:write':{'priority':'P2','category':_0x2891d9(0xd4)+'d','event':'clipboar'+'d_write','phase':_0x2891d9(0xea),'errorOnly':!![]},'app:open-url':{'priority':'P2','category':_0x2891d9(0x11f),'event':_0x2891d9(0xdd)+_0x2891d9(0xf1)+'l','phase':_0x2891d9(0xea),'always':!![]},'app:file:download-local':{'priority':'P2','category':_0x2891d9(0x110),'event':'file_dow'+'nload_lo'+_0x2891d9(0x13f),'phase':_0x2891d9(0xea),'errorOnly':!![]},'app:file:choose-folder':{'priority':'P2','category':'file','event':_0x2891d9(0x132)+_0x2891d9(0xa4),'phase':_0x2891d9(0xea),'errorOnly':!![]},'app:system:open-folder':{'priority':'P2','category':_0x2891d9(0x110),'event':_0x2891d9(0xae)+_0x2891d9(0x10b),'phase':_0x2891d9(0xea),'errorOnly':!![]},'app:startup:set':{'priority':'P2','category':_0x2891d9(0xc2),'event':_0x2891d9(0x108)+_0x2891d9(0x105)+_0x2891d9(0x12b),'phase':_0x2891d9(0xea),'always':!![]},'models:set-settings':{'priority':'P2','category':_0x2891d9(0xc2),'event':_0x2891d9(0xd8)+'ttings_u'+'pdate','phase':_0x2891d9(0xea),'always':!![]},'models:set-self-operated':{'priority':'P2','category':_0x2891d9(0xc2),'event':_0x2891d9(0x136)+_0x2891d9(0xe1)+'dels_upd'+_0x2891d9(0xee),'phase':_0x2891d9(0xea),'always':!![]},'workspace:open-directory':{'priority':'P2','category':_0x2891d9(0x12f)+'e','event':_0x2891d9(0x12f)+_0x2891d9(0x113)+_0x2891d9(0x10f),'phase':_0x2891d9(0xea),'always':!![]},'workspace:write-shared-context':{'priority':'P2','category':'workspac'+'e','event':_0x2891d9(0x12f)+'e_shared'+_0x2891d9(0x124)+_0x2891d9(0x12d),'phase':_0x2891d9(0xea),'always':!![]},'openclaw:gateway-restart':{'priority':'P1','category':_0x2891d9(0x10d),'event':_0x2891d9(0xdc)+_0x2891d9(0x146),'phase':'request','always':!![]},'openclaw:open-cli-window':{'priority':'P2','category':_0x2891d9(0x10d),'event':'open_cli'+'_window','phase':_0x2891d9(0xea),'always':!![]},'terminal:create':{'priority':'P2','category':'terminal','event':_0x2891d9(0x137)+'_create','phase':_0x2891d9(0xea),'always':!![]},'terminal:close':{'priority':'P2','category':_0x2891d9(0x137),'event':_0x2891d9(0x137)+_0x2891d9(0xa7),'phase':_0x2891d9(0xea),'always':!![]},'terminal:input':{'priority':'P2','category':_0x2891d9(0x137),'event':_0x2891d9(0x137)+_0x2891d9(0x125),'phase':'request','errorOnly':!![]},'terminal:resize':{'priority':'P2','category':_0x2891d9(0x137),'event':_0x2891d9(0x137)+_0x2891d9(0x138),'phase':_0x2891d9(0xea),'errorOnly':!![]}},CONNECTOR_SAVE_CHANNEL_RE=/^config:connector:save-/;function hashValue(_0x2f0091){const _0x2b646b=_0x2891d9;return createHash(_0x2b646b(0xa6))['update'](String(_0x2f0091??''))[_0x2b646b(0x14f)]('hex')[_0x2b646b(0xad)](0x0,0xa);}function compactText(_0x4d9c54,_0x171e67=USER_EVENT_PREVIEW_LENGTH){const _0x36bfb4=_0x2891d9;return String(_0x4d9c54??'')[_0x36bfb4(0xe5)](/\s+/g,'\x20')[_0x36bfb4(0xaf)]()[_0x36bfb4(0xad)](0x0,_0x171e67);}function redactFileName(_0x1b5eb6){const _0x3b9844=_0x2891d9,_0x4bfab6=basename(String(_0x1b5eb6||'')[_0x3b9844(0xaf)]());if(!_0x4bfab6)return'';const _0x576435=extname(_0x4bfab6),_0x5793b4=_0x576435?_0x4bfab6[_0x3b9844(0xad)](0x0,-_0x576435[_0x3b9844(0xa1)]):_0x4bfab6,_0x28a6b0=compactText(_0x5793b4,0x10);return(_0x28a6b0||_0x3b9844(0x110))+'_'+hashValue(_0x4bfab6)+_0x576435;}function summarizeAttachment(_0x273c9a){const _0xca5e47=_0x2891d9;if(!_0x273c9a||typeof _0x273c9a!==_0xca5e47(0x115)){const _0x4a2758=String(_0x273c9a||'');return{'type':_0xca5e47(0x110),'fileName':redactFileName(_0x4a2758)};}const _0xc4e1a=_0x273c9a,_0x10cd04=_0xc4e1a[_0xca5e47(0x10a)]||_0xc4e1a[_0xca5e47(0x128)]||_0xc4e1a[_0xca5e47(0x119)]||_0xc4e1a['path']||_0xc4e1a[_0xca5e47(0x11a)]||'';return{'type':_0xc4e1a['type']||_0xc4e1a[_0xca5e47(0xeb)]||_0xca5e47(0x110),'mimeType':_0xc4e1a[_0xca5e47(0x145)]||_0xc4e1a[_0xca5e47(0x127)]||undefined,'fileName':redactFileName(_0x10cd04),'size':Number['isFinite'](_0xc4e1a['size'])?_0xc4e1a[_0xca5e47(0xab)]:undefined};}export function summarizeUserEventAttachments(_0x4e7020={}){const _0x93089=_0x2891d9,_0x2f30db=_0x4e7020&&typeof _0x4e7020==='object'?_0x4e7020:{},_0x8ceac3=[_0x2f30db['filePath'+'s'],_0x2f30db[_0x93089(0xe2)],_0x2f30db[_0x93089(0xfa)+_0x93089(0xcf)],_0x2f30db[_0x93089(0x14a)]][_0x93089(0x135)](Array[_0x93089(0xa3)]),_0x2596e7=_0x8ceac3['flat']()['map'](summarizeAttachment)[_0x93089(0x135)](Boolean);return{'count':_0x2596e7[_0x93089(0xa1)],'types':[...new Set(_0x2596e7[_0x93089(0x117)](_0x60b2e1=>_0x60b2e1[_0x93089(0x145)]||_0x60b2e1['type'])[_0x93089(0x135)](Boolean))],'files':_0x2596e7[_0x93089(0xad)](0x0,0xa),'truncated':_0x2596e7['length']>0xa};}function inferSessionKey(_0x4cd9fb={}){const _0x4e398f=_0x2891d9;if(!_0x4cd9fb||typeof _0x4cd9fb!=='object')return undefined;return _0x4cd9fb[_0x4e398f(0xbd)+'ey']||_0x4cd9fb[_0x4e398f(0x111)]||_0x4cd9fb[_0x4e398f(0xda)+'d']||_0x4cd9fb[_0x4e398f(0xd2)]?.[_0x4e398f(0x111)]||_0x4cd9fb[_0x4e398f(0xa0)]?.['sessionK'+'ey']||undefined;}function inferRunId(_0x22955d={},_0x1e6a54={}){const _0x49d30e=_0x2891d9;if(_0x22955d&&typeof _0x22955d===_0x49d30e(0x115)){const _0x1f9d32=_0x22955d[_0x49d30e(0xfc)]||_0x22955d['requestI'+'d']||_0x22955d[_0x49d30e(0xc8)+_0x49d30e(0xb0)];if(_0x1f9d32)return _0x1f9d32;}if(_0x1e6a54&&typeof _0x1e6a54==='object')return _0x1e6a54[_0x49d30e(0xfc)]||_0x1e6a54['requestI'+'d']||undefined;return undefined;}function inferAgentId(_0x3c0e71={},_0x423169={}){const _0x4e3a39=_0x2891d9;if(_0x3c0e71&&typeof _0x3c0e71==='object'){const _0x5dc95d=_0x3c0e71[_0x4e3a39(0x104)]||_0x3c0e71[_0x4e3a39(0xb5)]||_0x3c0e71[_0x4e3a39(0xc0)];if(_0x5dc95d)return _0x5dc95d;}if(_0x423169&&typeof _0x423169===_0x4e3a39(0x115))return _0x423169[_0x4e3a39(0x104)]||_0x423169['agent']?.['id'];return undefined;}function inferInputSummary(_0x200489={}){const _0x2678b5=_0x2891d9;if(!_0x200489||typeof _0x200489!==_0x2678b5(0x115))return undefined;const _0x1f2982=_0x200489[_0x2678b5(0x114)]||_0x200489[_0x2678b5(0xef)]||_0x200489['input']||_0x200489[_0x2678b5(0xb7)]||_0x200489['text'];if(typeof _0x1f2982!==_0x2678b5(0xc3)||!_0x1f2982[_0x2678b5(0xaf)]())return undefined;return summarizeText(_0x1f2982,USER_EVENT_PREVIEW_LENGTH);}function inferOutputSummary(_0x5cf200={}){const _0x5ecf50=_0x2891d9;if(!_0x5cf200||typeof _0x5cf200!==_0x5ecf50(0x115))return undefined;const _0x4b3c50=_0x5cf200[_0x5ecf50(0x114)]||_0x5cf200[_0x5ecf50(0xce)]||_0x5cf200[_0x5ecf50(0xb7)]||_0x5cf200['output']||_0x5cf200[_0x5ecf50(0x118)];if(typeof _0x4b3c50!=='string'||!_0x4b3c50[_0x5ecf50(0xaf)]())return undefined;return summarizeText(_0x4b3c50,USER_EVENT_PREVIEW_LENGTH);}function inferVisibleError(_0x245715,_0x5e6388){const _0x2b3f6e=_0x2891d9;if(_0x245715)return _0x245715 instanceof Error?_0x245715[_0x2b3f6e(0x114)]:String(_0x245715);if(_0x5e6388&&typeof _0x5e6388==='object')return _0x5e6388[_0x2b3f6e(0x126)+_0x2b3f6e(0xa5)]||_0x5e6388[_0x2b3f6e(0x114)]||_0x5e6388[_0x2b3f6e(0xed)]?.[_0x2b3f6e(0x114)]||undefined;return undefined;}function _0x4a4d(){const _0x155229=['request','kind','plugin_e','error','ate','prompt','18WRhRao','ernal_ur','ncident','chat_abo','has','chat_str','_once','info','cron_rem','generate','attachme','errorOnl','runId','session_','agent_cr','nable','mmary','priority','2cPIGKl','tray_clo','agentId','setting_','date','model_co','startup_','_list','fileName','pen','file_rea','gateway','cron','irectory','file','key','agent_up','e_open_d','message','object','n_cancel','map','answer','name','uri','level','phase','5387774nBsyBl','onfig_up','open_url','category','1857528uTjCye','plugin','user-eve','_context','_input','errorMes','mime','filename','now','sessions','update','event','_write','status','workspac','plugin_c','6276222EKuipq','folder_c','_upsert','plugin_d','filter','self_ope','terminal','_resize','inputSum','584275zFzSLK','logs_rep','149414IJmmop','ose','8iXwWUB','cal','connecto','isable','ort','stringif','writeEve','mimeType','restart','_hide','2283624aMZniJ','skill_de','paths','pin_upda','user','ove','logs','digest','tatus','cron_cre','chat_his','skill_im','delete','meta','length','cron_upd','isArray','hoose','sage','sha256','_close','d_file_d','n_start','33OEUTvv','size','outputSu','slice','folder_o','trim','ncyKey','skill_up','skill','_delete','mary','agent','4091960CkylVd','content','d_files','ist','psert','test','r_save','sessionK','succeede','mplete','agent_id','create','settings','string','window','captureI','skill_in','ession','idempote','eate','visibleE','ximize','ide_by_s','query','text','nts','file_sel','rror','session','lete','clipboar','duration','se_setti','ng_updat','model_se','agent_de','sessionI','chat','gateway_','open_ext','observed','r_sessio','d_file_h','rated_mo','files','failed','always','replace','ide','artifact','oggle_ma','d_file_r'];_0x4a4d=function(){return _0x155229;};return _0x4a4d();}function normalizePolicy(_0x15fd90){const _0x59dc91=_0x2891d9;if(CHANNEL_POLICIES[_0x15fd90])return CHANNEL_POLICIES[_0x15fd90];if(CONNECTOR_SAVE_CHANNEL_RE[_0x59dc91(0xbb)](_0x15fd90))return{'priority':'P1','category':_0x59dc91(0x140)+'r','event':_0x59dc91(0x140)+_0x59dc91(0xbc),'phase':_0x59dc91(0xea),'always':!![]};return null;}export function getUserOperationPolicy(_0x2e46f4){return normalizePolicy(String(_0x2e46f4||''));}function summarizeSafeIpcPayload(_0x3aa0d9={}){const _0x2fd73b=_0x2891d9,_0x277893=summarizePayload(_0x3aa0d9,{'maxDepth':0x3,'textPreviewLength':0xa0});if(!_0x277893||typeof _0x277893!==_0x2fd73b(0x115)||Array['isArray'](_0x277893))return _0x277893;const _0x14c596={..._0x277893};for(const _0x135d15 of['filePath'+'s',_0x2fd73b(0xe2),_0x2fd73b(0xfa)+_0x2fd73b(0xcf),_0x2fd73b(0x14a)]){if(_0x135d15 in _0x14c596)_0x14c596[_0x135d15]=summarizeUserEventAttachments(_0x3aa0d9);}return _0x14c596;}export function createUserEventWriter({logsDir:_0x7f5083,diagnosticsWriter:_0x325252}={}){const _0x231702=_0x2891d9;if(!_0x7f5083)return null;const _0x68b846=join(_0x7f5083,'client',_0x231702(0x123)+'nt.log');!loggers[_0x231702(0xf4)](_0x68b846)&&loggers['set'](_0x68b846,createFileLogger({'filePath':_0x68b846,'context':_0x231702(0x123)+'nt','maxBytes':USER_EVENT_LOG_MAX_BYTES,'keepCount':USER_EVENT_LOG_KEEP_COUNT}));const _0x3f2a15=loggers['get'](_0x68b846);async function _0x302df6(_0x55bd50={}){const _0x1b7235=_0x231702,_0xf8b15e=Number['isFinite'](_0x55bd50['ts'])?_0x55bd50['ts']:Date[_0x1b7235(0x129)](),_0x1b3c55=_0x55bd50[_0x1b7235(0x11b)]||(_0x55bd50[_0x1b7235(0x12e)]===_0x1b7235(0xe3)?'error':'info'),_0x1c9b87=_0x55bd50[_0x1b7235(0x12e)]||_0x1b7235(0xde),_0x534cdf=_0x55bd50[_0x1b7235(0x12c)]||'user_eve'+'nt',_0x3671b0=_0x55bd50['category']||_0x1b7235(0x14c),_0x474c6f=_0x55bd50[_0x1b7235(0xbd)+'ey']||_0x55bd50[_0x1b7235(0xda)+'d'],_0x3080f3=_0x55bd50[_0x1b7235(0xfc)],_0x436f01=_0x55bd50[_0x1b7235(0x104)],_0x3e9865=_0x55bd50[_0x1b7235(0xca)+_0x1b7235(0xd1)],_0x4000aa=redactLogValue({'ts':_0xf8b15e,'priority':_0x55bd50[_0x1b7235(0x101)],'category':_0x3671b0,'event':_0x534cdf,'status':_0x1c9b87,'sessionKey':_0x474c6f,'runId':_0x3080f3,'agentId':_0x436f01,'message':compactText(_0x55bd50['message']||_0x534cdf,USER_EVENT_PREVIEW_LENGTH),'inputSummary':_0x55bd50[_0x1b7235(0x139)+_0x1b7235(0xb4)],'outputSummary':_0x55bd50['outputSu'+_0x1b7235(0x100)],'attachments':_0x55bd50[_0x1b7235(0xfa)+_0x1b7235(0xcf)],'visibleError':_0x3e9865,'durationMs':_0x55bd50[_0x1b7235(0xd5)+'Ms'],'meta':_0x55bd50[_0x1b7235(0xa0)]});await _0x3f2a15?.['info'](JSON[_0x1b7235(0x143)+'y'](_0x4000aa)),await _0x325252?.[_0x1b7235(0x144)+'nt']({'ts':_0xf8b15e,'level':_0x1b3c55,'category':_0x3671b0,'event':_0x534cdf,'message':_0x55bd50[_0x1b7235(0x114)]||_0x534cdf,'sessionId':_0x474c6f,'runId':_0x3080f3,'agentId':_0x436f01,'durationMs':_0x55bd50['duration'+'Ms'],'meta':summarizePayload({'priority':_0x55bd50[_0x1b7235(0x101)],'status':_0x1c9b87,'visibleError':_0x3e9865,'inputSummary':_0x55bd50['inputSum'+'mary'],'outputSummary':_0x55bd50[_0x1b7235(0xac)+_0x1b7235(0x100)],'attachments':_0x55bd50[_0x1b7235(0xfa)+'nts'],..._0x55bd50[_0x1b7235(0xa0)]},{'maxDepth':0x5,'textPreviewLength':DIAGNOSTIC_EVENT_PREVIEW_LENGTH})},{'captureIncident':_0x55bd50[_0x1b7235(0xc5)+_0x1b7235(0xf2)]===![]?![]:_0x55bd50[_0x1b7235(0xc5)+_0x1b7235(0xf2)]===!![]||_0x1b3c55===_0x1b7235(0xed)});}return{'filePath':_0x68b846,'write':_0x302df6,'fromIpc':async({channel:_0x283a9f,payload:_0x8bc28a,result:_0x10176f,error:_0x58a21e,durationMs:_0x3b41c6,status:_0x160258})=>{const _0x4f6466=_0x231702,_0x31acd1=getUserOperationPolicy(_0x283a9f);if(!_0x31acd1)return;const _0x525bb2=_0x160258===_0x4f6466(0xe3)||Boolean(_0x58a21e);if(_0x31acd1[_0x4f6466(0xfb)+'y']&&!_0x525bb2)return;if(!_0x31acd1[_0x4f6466(0xe4)]&&!_0x525bb2)return;const _0x107c78=_0x160258||(_0x525bb2?_0x4f6466(0xe3):_0x4f6466(0xbe)+'d');await _0x302df6({'priority':_0x31acd1[_0x4f6466(0x101)],'category':_0x31acd1[_0x4f6466(0x120)],'event':_0x31acd1[_0x4f6466(0x12c)]+'.'+_0x107c78,'status':_0x107c78,'level':_0x525bb2?_0x4f6466(0xed):_0x4f6466(0xf7),'message':_0x283a9f+'\x20'+_0x107c78,'sessionKey':inferSessionKey(_0x8bc28a),'runId':inferRunId(_0x8bc28a,_0x10176f),'agentId':inferAgentId(_0x8bc28a,_0x10176f),'inputSummary':inferInputSummary(_0x8bc28a),'outputSummary':inferOutputSummary(_0x10176f),'attachments':summarizeUserEventAttachments(_0x8bc28a),'visibleError':inferVisibleError(_0x58a21e,_0x10176f),'durationMs':_0x3b41c6,'captureIncident':![],'meta':{'channel':_0x283a9f,'phase':_0x31acd1[_0x4f6466(0x11c)],'payload':summarizeSafeIpcPayload(_0x8bc28a),..._0x525bb2?{'error':summarizeError(_0x58a21e)}:{}}});}};}
|
|
1
|
+
const _0xa7c3d3=_0x16dd;(function(_0x3772bb,_0xb8194b){const _0xba0900=_0x16dd,_0x429555=_0x3772bb();while(!![]){try{const _0x469570=-parseInt(_0xba0900(0xc1))/0x1*(parseInt(_0xba0900(0x150))/0x2)+-parseInt(_0xba0900(0x151))/0x3+-parseInt(_0xba0900(0x126))/0x4+-parseInt(_0xba0900(0x142))/0x5*(parseInt(_0xba0900(0x121))/0x6)+parseInt(_0xba0900(0xbe))/0x7*(-parseInt(_0xba0900(0x111))/0x8)+-parseInt(_0xba0900(0xdb))/0x9+-parseInt(_0xba0900(0x12f))/0xa*(-parseInt(_0xba0900(0x108))/0xb);if(_0x469570===_0xb8194b)break;else _0x429555['push'](_0x429555['shift']());}catch(_0x37acbe){_0x429555['push'](_0x429555['shift']());}}}(_0xcd07,0xa8f0a));import{basename,extname,join}from'node:path';import{createHash}from'node:crypto';import{createFileLogger,redactLogValue}from'@wujie-shell/logger';import{summarizeError,summarizePayload,summarizeText}from'./logging.mjs';const USER_EVENT_LOG_MAX_BYTES=0xa*0x400*0x400,USER_EVENT_LOG_KEEP_COUNT=0x1,USER_EVENT_PREVIEW_LENGTH=0xc8,DIAGNOSTIC_EVENT_PREVIEW_LENGTH=0x1f4,loggers=new Map(),CHANNEL_POLICIES={'chat:stream':{'priority':'P0','category':_0xa7c3d3(0xb5),'event':_0xa7c3d3(0xde)+_0xa7c3d3(0xfd),'phase':'request','always':!![]},'chat:abort':{'priority':'P0','category':_0xa7c3d3(0xb5),'event':_0xa7c3d3(0xe7)+'rt','phase':'request','always':!![]},'chat:history':{'priority':'P0','category':_0xa7c3d3(0xb5),'event':_0xa7c3d3(0xc2)+_0xa7c3d3(0xc5),'phase':_0xa7c3d3(0x130),'errorOnly':!![]},'sessions:create':{'priority':'P0','category':_0xa7c3d3(0x10b),'event':_0xa7c3d3(0xcd)+_0xa7c3d3(0xd9),'phase':_0xa7c3d3(0x128),'always':!![]},'sessions:delete':{'priority':'P0','category':_0xa7c3d3(0x10b),'event':_0xa7c3d3(0xcd)+_0xa7c3d3(0xfe),'phase':_0xa7c3d3(0x128),'always':!![]},'sessions:rename':{'priority':'P0','category':_0xa7c3d3(0x10b),'event':_0xa7c3d3(0xcd)+_0xa7c3d3(0x139),'phase':_0xa7c3d3(0x128),'always':!![]},'sessions:pin':{'priority':'P0','category':_0xa7c3d3(0x10b),'event':'session_'+'pin_upda'+'te','phase':_0xa7c3d3(0x128),'always':!![]},'sessions:unpin':{'priority':'P0','category':_0xa7c3d3(0x10b),'event':'session_'+'pin_upda'+'te','phase':_0xa7c3d3(0x128),'always':!![]},'sessions:reorder-pinned':{'priority':'P0','category':'session','event':_0xa7c3d3(0xcd)+_0xa7c3d3(0x159)+'te','phase':_0xa7c3d3(0x128),'always':!![]},'sessions:list':{'priority':'P0','category':'session','event':_0xa7c3d3(0xea)+_0xa7c3d3(0xb8),'phase':_0xa7c3d3(0x130),'errorOnly':!![]},'logs:report':{'priority':'P0','category':_0xa7c3d3(0x14e),'event':_0xa7c3d3(0xa2)+_0xa7c3d3(0x161),'phase':_0xa7c3d3(0x128),'always':!![]},'logs:export':{'priority':'P0','category':_0xa7c3d3(0x14e),'event':'logs_exp'+_0xa7c3d3(0x161),'phase':_0xa7c3d3(0x128),'always':!![]},'app:file:choose':{'priority':'P0','category':'file','event':_0xa7c3d3(0x120)+_0xa7c3d3(0x167),'phase':'request','always':!![]},'files:read':{'priority':'P0','category':_0xa7c3d3(0x12b),'event':_0xa7c3d3(0xec)+'d','phase':_0xa7c3d3(0x128),'always':!![]},'files:select-file':{'priority':'P0','category':_0xa7c3d3(0x12b),'event':_0xa7c3d3(0x15a)+_0xa7c3d3(0x11d),'phase':'request','always':!![]},'models:complete':{'priority':'P0','category':_0xa7c3d3(0xd0),'event':_0xa7c3d3(0xd7)+_0xa7c3d3(0xa5),'phase':_0xa7c3d3(0x128),'always':!![]},'agents:create':{'priority':'P1','category':_0xa7c3d3(0xb6),'event':_0xa7c3d3(0x162)+_0xa7c3d3(0x11b),'phase':_0xa7c3d3(0x128),'always':!![]},'agents:update':{'priority':'P1','category':_0xa7c3d3(0xb6),'event':'agent_up'+_0xa7c3d3(0x12c),'phase':_0xa7c3d3(0x128),'always':!![]},'agents:delete':{'priority':'P1','category':_0xa7c3d3(0xb6),'event':_0xa7c3d3(0xf5)+_0xa7c3d3(0xd5),'phase':_0xa7c3d3(0x128),'always':!![]},'agents:list':{'priority':'P1','category':_0xa7c3d3(0xb6),'event':'agents_l'+'ist','phase':_0xa7c3d3(0x130),'errorOnly':!![]},'skills:install':{'priority':'P1','category':_0xa7c3d3(0x134),'event':_0xa7c3d3(0xd8)+_0xa7c3d3(0xc4),'phase':_0xa7c3d3(0x128),'always':!![]},'skills:import-zip':{'priority':'P1','category':_0xa7c3d3(0x134),'event':_0xa7c3d3(0xbd)+_0xa7c3d3(0x152),'phase':_0xa7c3d3(0x128),'always':!![]},'skills:update':{'priority':'P1','category':_0xa7c3d3(0x134),'event':'skill_up'+_0xa7c3d3(0x12c),'phase':_0xa7c3d3(0x128),'always':!![]},'skills:delete':{'priority':'P1','category':_0xa7c3d3(0x134),'event':'skill_de'+_0xa7c3d3(0xd5),'phase':_0xa7c3d3(0x128),'always':!![]},'skills:status':{'priority':'P1','category':_0xa7c3d3(0x134),'event':_0xa7c3d3(0xd2)+_0xa7c3d3(0x110),'phase':_0xa7c3d3(0x130),'errorOnly':!![]},'plugins:update-config':{'priority':'P1','category':_0xa7c3d3(0x155),'event':_0xa7c3d3(0xc7)+_0xa7c3d3(0xb4)+'date','phase':_0xa7c3d3(0x128),'always':!![]},'plugins:enable':{'priority':'P1','category':_0xa7c3d3(0x155),'event':_0xa7c3d3(0xe0)+'nable','phase':'request','always':!![]},'plugins:disable':{'priority':'P1','category':'plugin','event':_0xa7c3d3(0xb7)+_0xa7c3d3(0xa3),'phase':_0xa7c3d3(0x128),'always':!![]},'config:connector:save':{'priority':'P1','category':_0xa7c3d3(0xda)+'r','event':_0xa7c3d3(0xda)+'r_save','phase':_0xa7c3d3(0x128),'always':!![]},'config:connector-session:start':{'priority':'P1','category':_0xa7c3d3(0xda)+'r','event':_0xa7c3d3(0xda)+_0xa7c3d3(0x165)+_0xa7c3d3(0xf0),'phase':_0xa7c3d3(0x128),'always':!![]},'config:connector-session:cancel':{'priority':'P1','category':_0xa7c3d3(0xda)+'r','event':'connecto'+'r_sessio'+_0xa7c3d3(0xe6),'phase':_0xa7c3d3(0x128),'always':!![]},'config:connector-session:complete':{'priority':'P1','category':_0xa7c3d3(0xda)+'r','event':_0xa7c3d3(0xda)+'r_sessio'+_0xa7c3d3(0xf9)+'te','phase':'request','always':!![]},'cron:create':{'priority':'P1','category':_0xa7c3d3(0xd4),'event':_0xa7c3d3(0x137)+_0xa7c3d3(0x10f),'phase':_0xa7c3d3(0x128),'always':!![]},'cron:update':{'priority':'P1','category':_0xa7c3d3(0xd4),'event':_0xa7c3d3(0x133)+_0xa7c3d3(0x10f),'phase':'request','always':!![]},'cron:remove':{'priority':'P1','category':_0xa7c3d3(0xd4),'event':_0xa7c3d3(0xab)+'ove','phase':_0xa7c3d3(0x128),'always':!![]},'cron:run-once':{'priority':'P1','category':'cron','event':'cron_run'+_0xa7c3d3(0x14b),'phase':_0xa7c3d3(0x128),'always':!![]},'app:generated-files:upsert':{'priority':'P1','category':_0xa7c3d3(0xac)+_0xa7c3d3(0x112),'event':_0xa7c3d3(0xac)+_0xa7c3d3(0xaf)+'psert','phase':_0xa7c3d3(0x128),'always':!![]},'app:generated-files:hide':{'priority':'P1','category':_0xa7c3d3(0xac)+_0xa7c3d3(0x112),'event':'generate'+_0xa7c3d3(0xe9)+_0xa7c3d3(0x146),'phase':_0xa7c3d3(0x128),'always':!![]},'app:generated-files:hide-by-session':{'priority':'P1','category':_0xa7c3d3(0xac)+_0xa7c3d3(0x112),'event':'generate'+_0xa7c3d3(0xe9)+_0xa7c3d3(0x115)+_0xa7c3d3(0x12e),'phase':_0xa7c3d3(0x128),'always':!![]},'app:generated-files:delete':{'priority':'P1','category':_0xa7c3d3(0xac)+_0xa7c3d3(0x112),'event':_0xa7c3d3(0xac)+_0xa7c3d3(0x132)+'elete','phase':'request','always':!![]},'app:generated-files:reveal':{'priority':'P1','category':'generate'+_0xa7c3d3(0x112),'event':_0xa7c3d3(0xac)+_0xa7c3d3(0x149)+_0xa7c3d3(0x11a),'phase':'request','always':!![]},'artifacts:upsert':{'priority':'P1','category':'generate'+'d_files','event':'artifact'+_0xa7c3d3(0x163),'phase':_0xa7c3d3(0x128),'always':!![]},'artifacts:hide':{'priority':'P1','category':'generate'+'d_files','event':_0xa7c3d3(0x131)+_0xa7c3d3(0xd6),'phase':'request','always':!![]},'artifacts:delete':{'priority':'P1','category':'generate'+_0xa7c3d3(0x112),'event':'artifact'+_0xa7c3d3(0x15e),'phase':'request','always':!![]},'artifacts:reveal':{'priority':'P1','category':_0xa7c3d3(0xac)+_0xa7c3d3(0x112),'event':_0xa7c3d3(0x131)+_0xa7c3d3(0xc9),'phase':_0xa7c3d3(0x128),'always':!![]},'window:minimize':{'priority':'P2','category':_0xa7c3d3(0x117),'event':_0xa7c3d3(0xdd)+_0xa7c3d3(0x157),'phase':'request','always':![]},'window:toggle-maximize':{'priority':'P2','category':_0xa7c3d3(0x117),'event':'window_t'+_0xa7c3d3(0x114)+_0xa7c3d3(0xb2),'phase':_0xa7c3d3(0x128),'always':![]},'window:close':{'priority':'P2','category':_0xa7c3d3(0x117),'event':_0xa7c3d3(0xf2)+_0xa7c3d3(0xe1),'phase':_0xa7c3d3(0x128),'always':!![]},'app:tray:set-close':{'priority':'P2','category':_0xa7c3d3(0xcf),'event':_0xa7c3d3(0x140)+_0xa7c3d3(0xfb)+_0xa7c3d3(0xe8)+'e','phase':_0xa7c3d3(0x128),'always':!![]},'app:clipboard:write':{'priority':'P2','category':_0xa7c3d3(0x106)+'d','event':_0xa7c3d3(0x106)+'d_write','phase':_0xa7c3d3(0x128),'errorOnly':!![]},'app:open-url':{'priority':'P2','category':'open_url','event':_0xa7c3d3(0xff)+'ernal_ur'+'l','phase':_0xa7c3d3(0x128),'always':!![]},'app:file:download-local':{'priority':'P2','category':_0xa7c3d3(0x12b),'event':'file_dow'+_0xa7c3d3(0x11f)+_0xa7c3d3(0xf8),'phase':_0xa7c3d3(0x128),'errorOnly':!![]},'app:file:choose-folder':{'priority':'P2','category':_0xa7c3d3(0x12b),'event':'folder_c'+_0xa7c3d3(0x118),'phase':_0xa7c3d3(0x128),'errorOnly':!![]},'app:system:open-folder':{'priority':'P2','category':_0xa7c3d3(0x12b),'event':_0xa7c3d3(0xa4)+_0xa7c3d3(0xed),'phase':_0xa7c3d3(0x128),'errorOnly':!![]},'app:startup:set':{'priority':'P2','category':_0xa7c3d3(0xcf),'event':_0xa7c3d3(0xfa)+_0xa7c3d3(0x105)+'update','phase':'request','always':!![]},'models:set-settings':{'priority':'P2','category':_0xa7c3d3(0xcf),'event':_0xa7c3d3(0xb0)+_0xa7c3d3(0xae)+_0xa7c3d3(0xb9),'phase':_0xa7c3d3(0x128),'always':!![]},'models:set-self-operated':{'priority':'P2','category':'settings','event':_0xa7c3d3(0x116)+_0xa7c3d3(0x13a)+_0xa7c3d3(0xad)+_0xa7c3d3(0x10f),'phase':'request','always':!![]},'workspace:open-directory':{'priority':'P2','category':_0xa7c3d3(0x13f)+'e','event':_0xa7c3d3(0x13f)+_0xa7c3d3(0x13c)+_0xa7c3d3(0xa6),'phase':_0xa7c3d3(0x128),'always':!![]},'workspace:write-shared-context':{'priority':'P2','category':_0xa7c3d3(0x13f)+'e','event':_0xa7c3d3(0x13f)+_0xa7c3d3(0x154)+_0xa7c3d3(0x13e)+_0xa7c3d3(0x13b),'phase':'request','always':!![]},'openclaw:gateway-restart':{'priority':'P1','category':'gateway','event':'gateway_'+_0xa7c3d3(0x129),'phase':'request','always':!![]},'openclaw:open-cli-window':{'priority':'P2','category':_0xa7c3d3(0x10c),'event':_0xa7c3d3(0xca)+_0xa7c3d3(0x158),'phase':_0xa7c3d3(0x128),'always':!![]},'terminal:create':{'priority':'P2','category':_0xa7c3d3(0xdf),'event':_0xa7c3d3(0xdf)+_0xa7c3d3(0xc8),'phase':_0xa7c3d3(0x128),'always':!![]},'terminal:close':{'priority':'P2','category':'terminal','event':_0xa7c3d3(0xdf)+_0xa7c3d3(0xa9),'phase':_0xa7c3d3(0x128),'always':!![]},'terminal:input':{'priority':'P2','category':_0xa7c3d3(0xdf),'event':_0xa7c3d3(0xdf)+_0xa7c3d3(0x125),'phase':_0xa7c3d3(0x128),'errorOnly':!![]},'terminal:resize':{'priority':'P2','category':_0xa7c3d3(0xdf),'event':'terminal'+_0xa7c3d3(0x11c),'phase':_0xa7c3d3(0x128),'errorOnly':!![]}},CONNECTOR_SAVE_CHANNEL_RE=/^config:connector:save-/;function hashValue(_0x56f952){const _0x19cf33=_0xa7c3d3;return createHash(_0x19cf33(0x153))[_0x19cf33(0xee)](String(_0x56f952??''))[_0x19cf33(0x147)]('hex')[_0x19cf33(0xcc)](0x0,0xa);}function compactText(_0x254151,_0x1232e3=USER_EVENT_PREVIEW_LENGTH){const _0x5a9109=_0xa7c3d3;return String(_0x254151??'')[_0x5a9109(0x127)](/\s+/g,'\x20')['trim']()[_0x5a9109(0xcc)](0x0,_0x1232e3);}function redactFileName(_0x50fa65){const _0x33161c=_0xa7c3d3,_0x542114=basename(String(_0x50fa65||'')[_0x33161c(0x15d)]());if(!_0x542114)return'';const _0x1fb14a=extname(_0x542114),_0x404d0b=_0x1fb14a?_0x542114[_0x33161c(0xcc)](0x0,-_0x1fb14a[_0x33161c(0xf1)]):_0x542114,_0x49abb9=compactText(_0x404d0b,0x10);return(_0x49abb9||_0x33161c(0x12b))+'_'+hashValue(_0x542114)+_0x1fb14a;}function summarizeAttachment(_0x3a74d2){const _0xff6a7e=_0xa7c3d3;if(!_0x3a74d2||typeof _0x3a74d2!==_0xff6a7e(0x145)){const _0x3de01d=String(_0x3a74d2||'');return{'type':'file','fileName':redactFileName(_0x3de01d)};}const _0x5bbeac=_0x3a74d2,_0x41bb3c=_0x5bbeac['fileName']||_0x5bbeac[_0xff6a7e(0xbf)]||_0x5bbeac[_0xff6a7e(0x15b)]||_0x5bbeac[_0xff6a7e(0xf4)]||_0x5bbeac[_0xff6a7e(0xbb)]||'';return{'type':_0x5bbeac[_0xff6a7e(0x15f)]||_0x5bbeac[_0xff6a7e(0x135)]||_0xff6a7e(0x12b),'mimeType':_0x5bbeac[_0xff6a7e(0xe2)]||_0x5bbeac[_0xff6a7e(0x136)]||undefined,'fileName':redactFileName(_0x41bb3c),'size':Number[_0xff6a7e(0x143)](_0x5bbeac[_0xff6a7e(0xc3)])?_0x5bbeac[_0xff6a7e(0xc3)]:undefined};}export function summarizeUserEventAttachments(_0x5434a1={}){const _0x89fac=_0xa7c3d3,_0x39df05=_0x5434a1&&typeof _0x5434a1===_0x89fac(0x145)?_0x5434a1:{},_0x155ba7=[_0x39df05[_0x89fac(0x14a)+'s'],_0x39df05[_0x89fac(0xa8)],_0x39df05[_0x89fac(0x13d)+_0x89fac(0xcb)],_0x39df05['paths']][_0x89fac(0x113)](Array[_0x89fac(0xfc)]),_0x2bd55d=_0x155ba7[_0x89fac(0x14c)]()[_0x89fac(0xe3)](summarizeAttachment)[_0x89fac(0x113)](Boolean);return{'count':_0x2bd55d['length'],'types':[...new Set(_0x2bd55d[_0x89fac(0xe3)](_0x48031c=>_0x48031c[_0x89fac(0xe2)]||_0x48031c[_0x89fac(0x15f)])[_0x89fac(0x113)](Boolean))],'files':_0x2bd55d[_0x89fac(0xcc)](0x0,0xa),'truncated':_0x2bd55d['length']>0xa};}function inferSessionKey(_0x5a9fba={}){const _0x3620c4=_0xa7c3d3;if(!_0x5a9fba||typeof _0x5a9fba!==_0x3620c4(0x145))return undefined;return _0x5a9fba[_0x3620c4(0xc0)+'ey']||_0x5a9fba[_0x3620c4(0x10d)]||_0x5a9fba[_0x3620c4(0x138)+'d']||_0x5a9fba[_0x3620c4(0x10b)]?.[_0x3620c4(0x10d)]||_0x5a9fba['meta']?.[_0x3620c4(0xc0)+'ey']||undefined;}function inferRunId(_0x5c931e={},_0x5f91bb={}){const _0x295882=_0xa7c3d3;if(_0x5c931e&&typeof _0x5c931e===_0x295882(0x145)){const _0x5a1f72=_0x5c931e[_0x295882(0x102)]||_0x5c931e[_0x295882(0x148)+'d']||_0x5c931e[_0x295882(0x104)+_0x295882(0xe5)];if(_0x5a1f72)return _0x5a1f72;}if(_0x5f91bb&&typeof _0x5f91bb==='object')return _0x5f91bb[_0x295882(0x102)]||_0x5f91bb[_0x295882(0x148)+'d']||undefined;return undefined;}function _0x16dd(_0x2aeffa,_0x78af02){_0x2aeffa=_0x2aeffa-0xa2;const _0xcd07ca=_0xcd07();let _0x16dd38=_0xcd07ca[_0x2aeffa];return _0x16dd38;}function _0xcd07(){const _0x18b011=['type','inputSum','ort','agent_cr','_upsert','mary','r_sessio','content','ose','logs_rep','isable','folder_o','mplete','irectory','output','files','_close','input','cron_rem','generate','dels_upd','ttings_u','d_file_u','model_se','answer','ximize','visibleE','onfig_up','chat','agent','plugin_d','_list','pdate','rror','uri','observed','skill_im','63tLZmcf','filename','sessionK','5481bUPlpJ','chat_his','size','stall','tory','user_eve','plugin_c','_create','_reveal','open_cli','nts','slice','session_','test','settings','model','mmary','skills_s','ncident','cron','lete','_hide','model_co','skill_in','create','connecto','6661314NGSNqr','category','window_m','chat_str','terminal','plugin_e','lose','mimeType','map','set','ncyKey','n_cancel','chat_abo','ng_updat','d_file_h','sessions','nt.log','file_rea','pen','update','client','n_start','length','window_c','event','path','agent_de','agentId','failed','cal','n_comple','startup_','se_setti','isArray','eam','delete','open_ext','string','info','runId','stringif','idempote','setting_','clipboar','user-eve','131032VRBdpP','r_save','user','session','gateway','key','phase','ate','tatus','418120TefhpY','d_files','filter','oggle_ma','ide_by_s','self_ope','window','hoose','error','eveal','eate','_resize','ect','status','nload_lo','file_cho','5153994abamRv','outputSu','message','captureI','_input','3529984JaRXLv','replace','request','restart','priority','file','date','always','ession','4090XJAdfK','query','artifact','d_file_d','cron_upd','skill','kind','mime','cron_cre','sessionI','rename','rated_mo','_write','e_open_d','attachme','_context','workspac','tray_clo','get','5PWBHIB','isFinite','sage','object','ide','digest','requestI','d_file_r','filePath','_once','flat','level','logs','succeede','112lKFdEX','2763204xcJKuw','port_zip','sha256','e_shared','plugin','meta','inimize','_window','pin_upda','file_sel','name','duration','trim','_delete'];_0xcd07=function(){return _0x18b011;};return _0xcd07();}function inferAgentId(_0x263aee={},_0x436cbc={}){const _0x9626a9=_0xa7c3d3;if(_0x263aee&&typeof _0x263aee===_0x9626a9(0x145)){const _0x221d7f=_0x263aee['agentId']||_0x263aee[_0x9626a9(0xb6)]||_0x263aee['agent_id'];if(_0x221d7f)return _0x221d7f;}if(_0x436cbc&&typeof _0x436cbc==='object')return _0x436cbc[_0x9626a9(0xf6)]||_0x436cbc[_0x9626a9(0xb6)]?.['id'];return undefined;}function inferInputSummary(_0x528554={}){const _0x3efe4e=_0xa7c3d3;if(!_0x528554||typeof _0x528554!==_0x3efe4e(0x145))return undefined;const _0x347783=_0x528554[_0x3efe4e(0x123)]||_0x528554['prompt']||_0x528554[_0x3efe4e(0xaa)]||_0x528554[_0x3efe4e(0x166)]||_0x528554['text'];if(typeof _0x347783!=='string'||!_0x347783[_0x3efe4e(0x15d)]())return undefined;return summarizeText(_0x347783,USER_EVENT_PREVIEW_LENGTH);}function inferOutputSummary(_0x5d1ddc={}){const _0x5c6fdb=_0xa7c3d3;if(!_0x5d1ddc||typeof _0x5d1ddc!=='object')return undefined;const _0x4bb271=_0x5d1ddc[_0x5c6fdb(0x123)]||_0x5d1ddc['text']||_0x5d1ddc[_0x5c6fdb(0x166)]||_0x5d1ddc[_0x5c6fdb(0xa7)]||_0x5d1ddc[_0x5c6fdb(0xb1)];if(typeof _0x4bb271!==_0x5c6fdb(0x100)||!_0x4bb271['trim']())return undefined;return summarizeText(_0x4bb271,USER_EVENT_PREVIEW_LENGTH);}function inferVisibleError(_0x2432ba,_0x337eab){const _0x391bbf=_0xa7c3d3;if(_0x2432ba)return _0x2432ba instanceof Error?_0x2432ba[_0x391bbf(0x123)]:String(_0x2432ba);if(_0x337eab&&typeof _0x337eab===_0x391bbf(0x145))return _0x337eab['errorMes'+_0x391bbf(0x144)]||_0x337eab[_0x391bbf(0x123)]||_0x337eab[_0x391bbf(0x119)]?.[_0x391bbf(0x123)]||undefined;return undefined;}function normalizePolicy(_0x1c91e2){const _0x5974c4=_0xa7c3d3;if(CHANNEL_POLICIES[_0x1c91e2])return CHANNEL_POLICIES[_0x1c91e2];if(CONNECTOR_SAVE_CHANNEL_RE[_0x5974c4(0xce)](_0x1c91e2))return{'priority':'P1','category':_0x5974c4(0xda)+'r','event':'connecto'+_0x5974c4(0x109),'phase':_0x5974c4(0x128),'always':!![]};return null;}export function getUserOperationPolicy(_0x13776f){return normalizePolicy(String(_0x13776f||''));}function summarizeSafeIpcPayload(_0x2ceb85={}){const _0x11eea4=_0xa7c3d3,_0x47b08f=summarizePayload(_0x2ceb85,{'maxDepth':0x3,'textPreviewLength':0xa0});if(!_0x47b08f||typeof _0x47b08f!=='object'||Array[_0x11eea4(0xfc)](_0x47b08f))return _0x47b08f;const _0x19b8ec={..._0x47b08f};for(const _0x23e7af of['filePath'+'s',_0x11eea4(0xa8),_0x11eea4(0x13d)+_0x11eea4(0xcb),'paths']){if(_0x23e7af in _0x19b8ec)_0x19b8ec[_0x23e7af]=summarizeUserEventAttachments(_0x2ceb85);}return _0x19b8ec;}export function createUserEventWriter({logsDir:_0x10dfcb,diagnosticsWriter:_0x1c5851}={}){const _0x346ea5=_0xa7c3d3;if(!_0x10dfcb)return null;const _0x181747=join(_0x10dfcb,_0x346ea5(0xef),'user-eve'+_0x346ea5(0xeb));!loggers['has'](_0x181747)&&loggers[_0x346ea5(0xe4)](_0x181747,createFileLogger({'filePath':_0x181747,'context':_0x346ea5(0x107)+'nt','maxBytes':USER_EVENT_LOG_MAX_BYTES,'keepCount':USER_EVENT_LOG_KEEP_COUNT}));const _0x98d00b=loggers[_0x346ea5(0x141)](_0x181747);async function _0x2b19e3(_0x5f0142={}){const _0x3cddc3=_0x346ea5,_0xf88a7d=Number[_0x3cddc3(0x143)](_0x5f0142['ts'])?_0x5f0142['ts']:Date['now'](),_0x53d2f0=_0x5f0142[_0x3cddc3(0x14d)]||(_0x5f0142[_0x3cddc3(0x11e)]===_0x3cddc3(0xf7)?'error':_0x3cddc3(0x101)),_0x13462e=_0x5f0142[_0x3cddc3(0x11e)]||_0x3cddc3(0xbc),_0x319b21=_0x5f0142[_0x3cddc3(0xf3)]||_0x3cddc3(0xc6)+'nt',_0x656873=_0x5f0142[_0x3cddc3(0xdc)]||_0x3cddc3(0x10a),_0x3bd1e=_0x5f0142[_0x3cddc3(0xc0)+'ey']||_0x5f0142[_0x3cddc3(0x138)+'d'],_0x345493=_0x5f0142[_0x3cddc3(0x102)],_0x5cfbab=_0x5f0142[_0x3cddc3(0xf6)],_0x4bc06c=_0x5f0142[_0x3cddc3(0xb3)+_0x3cddc3(0xba)],_0x3accfe=redactLogValue({'ts':_0xf88a7d,'priority':_0x5f0142[_0x3cddc3(0x12a)],'category':_0x656873,'event':_0x319b21,'status':_0x13462e,'sessionKey':_0x3bd1e,'runId':_0x345493,'agentId':_0x5cfbab,'message':compactText(_0x5f0142[_0x3cddc3(0x123)]||_0x319b21,USER_EVENT_PREVIEW_LENGTH),'inputSummary':_0x5f0142[_0x3cddc3(0x160)+'mary'],'outputSummary':_0x5f0142[_0x3cddc3(0x122)+_0x3cddc3(0xd1)],'attachments':_0x5f0142[_0x3cddc3(0x13d)+_0x3cddc3(0xcb)],'visibleError':_0x4bc06c,'durationMs':_0x5f0142[_0x3cddc3(0x15c)+'Ms'],'meta':_0x5f0142[_0x3cddc3(0x156)]});await _0x98d00b?.['info'](JSON[_0x3cddc3(0x103)+'y'](_0x3accfe)),await _0x1c5851?.['writeEve'+'nt']({'ts':_0xf88a7d,'level':_0x53d2f0,'category':_0x656873,'event':_0x319b21,'message':_0x5f0142[_0x3cddc3(0x123)]||_0x319b21,'sessionId':_0x3bd1e,'runId':_0x345493,'agentId':_0x5cfbab,'durationMs':_0x5f0142[_0x3cddc3(0x15c)+'Ms'],'meta':summarizePayload({'priority':_0x5f0142[_0x3cddc3(0x12a)],'status':_0x13462e,'visibleError':_0x4bc06c,'inputSummary':_0x5f0142[_0x3cddc3(0x160)+_0x3cddc3(0x164)],'outputSummary':_0x5f0142[_0x3cddc3(0x122)+_0x3cddc3(0xd1)],'attachments':_0x5f0142['attachme'+_0x3cddc3(0xcb)],..._0x5f0142[_0x3cddc3(0x156)]},{'maxDepth':0x5,'textPreviewLength':DIAGNOSTIC_EVENT_PREVIEW_LENGTH})},{'captureIncident':_0x5f0142[_0x3cddc3(0x124)+_0x3cddc3(0xd3)]===![]?![]:_0x5f0142[_0x3cddc3(0x124)+_0x3cddc3(0xd3)]===!![]||_0x53d2f0===_0x3cddc3(0x119)});}return{'filePath':_0x181747,'write':_0x2b19e3,'fromIpc':async({channel:_0x5ae505,payload:_0x227fa2,result:_0x2126ec,error:_0x1ce963,durationMs:_0x396bca,status:_0x5ea51d})=>{const _0x297953=_0x346ea5,_0x5ed184=getUserOperationPolicy(_0x5ae505);if(!_0x5ed184)return;const _0x552d8e=_0x5ea51d===_0x297953(0xf7)||Boolean(_0x1ce963);if(_0x5ed184['errorOnl'+'y']&&!_0x552d8e)return;if(!_0x5ed184[_0x297953(0x12d)]&&!_0x552d8e)return;const _0x54c9a1=_0x5ea51d||(_0x552d8e?_0x297953(0xf7):_0x297953(0x14f)+'d');await _0x2b19e3({'priority':_0x5ed184['priority'],'category':_0x5ed184[_0x297953(0xdc)],'event':_0x5ed184['event']+'.'+_0x54c9a1,'status':_0x54c9a1,'level':_0x552d8e?_0x297953(0x119):_0x297953(0x101),'message':_0x5ae505+'\x20'+_0x54c9a1,'sessionKey':inferSessionKey(_0x227fa2),'runId':inferRunId(_0x227fa2,_0x2126ec),'agentId':inferAgentId(_0x227fa2,_0x2126ec),'inputSummary':inferInputSummary(_0x227fa2),'outputSummary':inferOutputSummary(_0x2126ec),'attachments':summarizeUserEventAttachments(_0x227fa2),'visibleError':inferVisibleError(_0x1ce963,_0x2126ec),'durationMs':_0x396bca,'captureIncident':![],'meta':{'channel':_0x5ae505,'phase':_0x5ed184[_0x297953(0x10e)],'payload':summarizeSafeIpcPayload(_0x227fa2),..._0x552d8e?{'error':summarizeError(_0x1ce963)}:{}}});}};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x242b(){const _0x4f25b6=['6pGKjjl','.plugin.','169982OZTIcs','48DCxOtm','1034240jpPmEK','isFile','map','0.0.0','parse','string','8IJEjjm','1056876EVMXtm','filter','3938765WSAVTL','539613lCfHNs','name','1456920uxJeaE','json','package.','openclaw','object','stringif','version','isArray','7144809lKyDFx','trim','utf8'];_0x242b=function(){return _0x4f25b6;};return _0x242b();}(function(_0x999ed7,_0x16dfff){const _0x43e576=_0x4876,_0x319914=_0x999ed7();while(!![]){try{const _0x206470=parseInt(_0x43e576(0xa7))/0x1*(-parseInt(_0x43e576(0xaf))/0x2)+-parseInt(_0x43e576(0xb0))/0x3+-parseInt(_0x43e576(0x9a))/0x4+-parseInt(_0x43e576(0x97))/0x5*(-parseInt(_0x43e576(0xa5))/0x6)+parseInt(_0x43e576(0xa2))/0x7+parseInt(_0x43e576(0xa8))/0x8*(parseInt(_0x43e576(0x98))/0x9)+-parseInt(_0x43e576(0xa9))/0xa;if(_0x206470===_0x16dfff)break;else _0x319914['push'](_0x319914['shift']());}catch(_0x2453e0){_0x319914['push'](_0x319914['shift']());}}}(_0x242b,0xa3294));function _0x4876(_0x1328ee,_0x19c8e2){_0x1328ee=_0x1328ee-0x97;const _0x242bba=_0x242b();let _0x487640=_0x242bba[_0x1328ee];return _0x487640;}import{existsSync}from'node:fs';import{cp,mkdir,readFile,readdir,rm,stat,writeFile}from'node:fs/promises';import{basename,dirname,join,relative}from'node:path';export function asRecord(_0x21937a){const _0x2e7ea4=_0x4876;return _0x21937a&&typeof _0x21937a===_0x2e7ea4(0x9e)&&!Array[_0x2e7ea4(0xa1)](_0x21937a)?_0x21937a:{};}export function asStringArray(_0x5335e5){const _0x23fc80=_0x4876;return Array[_0x23fc80(0xa1)](_0x5335e5)?_0x5335e5[_0x23fc80(0xb1)](_0x551bcc=>typeof _0x551bcc===_0x23fc80(0xae)&&_0x551bcc[_0x23fc80(0xa3)]())[_0x23fc80(0xab)](_0x5f15ab=>_0x5f15ab[_0x23fc80(0xa3)]()):[];}export function dedupeStrings(_0x3bba55){const _0x5de7c5=_0x4876;return[...new Set(_0x3bba55[_0x5de7c5(0xb1)](Boolean))];}export function getTrimmedString(_0x36b2e4){const _0x5de8d1=_0x4876;return typeof _0x36b2e4===_0x5de8d1(0xae)?_0x36b2e4[_0x5de8d1(0xa3)]():'';}export async function readJson(_0xacccd,_0xa4fa09={}){const _0x4566ca=_0x4876;try{return JSON[_0x4566ca(0xad)](await readFile(_0xacccd,'utf8'));}catch{return _0xa4fa09;}}export async function writeJson(_0x272949,_0x39500e){const _0x598e66=_0x4876;await mkdir(dirname(_0x272949),{'recursive':!![]}),await writeFile(_0x272949,JSON[_0x598e66(0x9f)+'y'](_0x39500e,null,0x2)+'\x0a',_0x598e66(0xa4));}export async function copyDirFresh(_0x2ca8d1,_0x4e44d1){await rm(_0x4e44d1,{'recursive':!![],'force':!![],'maxRetries':0x5,'retryDelay':0x96}),await mkdir(dirname(_0x4e44d1),{'recursive':!![]}),await cp(_0x2ca8d1,_0x4e44d1,{'recursive':!![]});}export async function ensureDir(_0x5abd1d){await mkdir(_0x5abd1d,{'recursive':!![]});}export function pathExists(_0x440ec2){return existsSync(_0x440ec2);}export async function listDirs(_0x125e4c){const _0xf4ad2e=_0x4876;try{const _0x5ca771=await readdir(_0x125e4c,{'withFileTypes':!![],'encoding':_0xf4ad2e(0xa4)});return _0x5ca771[_0xf4ad2e(0xb1)](_0xf5628b=>_0xf5628b['isDirect'+'ory']())['map'](_0x19d172=>_0x19d172[_0xf4ad2e(0x99)]);}catch{return[];}}export async function getPackageMetadata(_0x3065c6){const _0x211f8b=_0x4876,_0x4184d1=await readJson(join(_0x3065c6,_0x211f8b(0x9c)+_0x211f8b(0x9b)),{}),_0x46184a=asRecord(_0x4184d1[_0x211f8b(0x9d)]);return{'name':getTrimmedString(_0x4184d1['name'])||basename(_0x3065c6),'version':getTrimmedString(_0x4184d1[_0x211f8b(0xa0)])||_0x211f8b(0xac),'pluginId':getTrimmedString(_0x46184a['id'])||getTrimmedString(_0x4184d1[_0x211f8b(0x9d)+'Id'])||basename(_0x3065c6)};}export async function readPluginManifest(_0x40b59c){const _0x2ddfab=_0x4876,_0x1cebe9=join(_0x40b59c,_0x2ddfab(0x9d)+_0x2ddfab(0xa6)+_0x2ddfab(0x9b)),_0x78ea53=await readJson(_0x1cebe9,{});return asRecord(_0x78ea53);}export async function hasFile(_0x17c7ce){const _0x52e47d=_0x4876;try{const _0x308279=await stat(_0x17c7ce);return _0x308279[_0x52e47d(0xaa)]();}catch{return![];}}export function toRuntimeRelative(_0x23bd05,_0x19fadf){return relative(_0x23bd05,_0x19fadf)['replaceA'+'ll']('\x5c','/');}
|