cc-ding 0.0.2 → 0.0.3

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.
@@ -1 +1 @@
1
- 'use strict';const a5_0x4570cc=a5_0x248e;(function(_0x11d57d,_0x230a44){const _0xfe1e1e=a5_0x248e,_0x23325b=_0x11d57d();while(!![]){try{const _0x7fc432=parseInt(_0xfe1e1e(0x237))/0x1+parseInt(_0xfe1e1e(0x266))/0x2+parseInt(_0xfe1e1e(0x265))/0x3+parseInt(_0xfe1e1e(0x231))/0x4+-parseInt(_0xfe1e1e(0x283))/0x5+-parseInt(_0xfe1e1e(0x210))/0x6+-parseInt(_0xfe1e1e(0x289))/0x7;if(_0x7fc432===_0x230a44)break;else _0x23325b['push'](_0x23325b['shift']());}catch(_0x18f3b0){_0x23325b['push'](_0x23325b['shift']());}}}(a5_0x4b87,0x66821));var __importDefault=this&&this[a5_0x4570cc(0x20d)]||function(_0x2fc57d){const _0x33dbdc=a5_0x4570cc;return _0x2fc57d&&_0x2fc57d[_0x33dbdc(0x269)]?_0x2fc57d:{'default':_0x2fc57d};};Object[a5_0x4570cc(0x207)](exports,a5_0x4570cc(0x269),{'value':!![]}),exports[a5_0x4570cc(0x232)]=void 0x0,exports[a5_0x4570cc(0x200)]=isValidCronExpression,exports['formatCronJobList']=formatCronJobList,exports[a5_0x4570cc(0x28d)]=formatCronJobInfo;function a5_0x248e(_0x143afd,_0x2e1413){_0x143afd=_0x143afd-0x1ea;const _0x4b87b9=a5_0x4b87();let _0x248eb9=_0x4b87b9[_0x143afd];return _0x248eb9;}const fs_1=__importDefault(require('fs')),readline_1=__importDefault(require(a5_0x4570cc(0x1f2))),child_process_1=require(a5_0x4570cc(0x223)),utils_ok_1=require('utils-ok'),messaging_1=require(a5_0x4570cc(0x267)),claude_process_1=require(a5_0x4570cc(0x26a)),task_1=require(a5_0x4570cc(0x259)),session_1=require('./session');function getCronFile(_0x2958b8){const _0x474d1f=a5_0x4570cc;return(0x0,session_1['getClientDir'])(_0x2958b8)+_0x474d1f(0x228);}function loadCronJobs(_0x1ecdc1){const _0x3b3c5a=a5_0x4570cc,_0xedb616=getCronFile(_0x1ecdc1);try{const _0x3e187b=JSON[_0x3b3c5a(0x26f)](fs_1['default'][_0x3b3c5a(0x20b)](_0xedb616,_0x3b3c5a(0x235)));return Array[_0x3b3c5a(0x27f)](_0x3e187b)?_0x3e187b:_0x3e187b[_0x3b3c5a(0x263)]||[];}catch{return[];}}function saveCronJobs(_0x2d589d,_0x283b4a){const _0x25e851=a5_0x4570cc,_0x1047f3=getCronFile(_0x2d589d);fs_1['default'][_0x25e851(0x264)](_0x1047f3,JSON[_0x25e851(0x246)](_0x283b4a,null,0x2),'utf-8');}function matchesCronField(_0x42c3b5,_0x94dee8,_0x1f5768,_0x14eb68){const _0x43911d=a5_0x4570cc;if(_0x42c3b5==='*')return!![];if(_0x42c3b5[_0x43911d(0x1f7)](','))return _0x42c3b5['split'](',')[_0x43911d(0x1fb)](_0x3595bc=>matchesCronField(_0x3595bc['trim'](),_0x94dee8,_0x1f5768,_0x14eb68));if(_0x42c3b5[_0x43911d(0x1f7)]('/')){const _0x231b87=_0x42c3b5[_0x43911d(0x24d)]('/'),_0x3a1c28=_0x42c3b5[_0x43911d(0x284)](0x0,_0x231b87),_0x272e4e=parseInt(_0x42c3b5[_0x43911d(0x284)](_0x231b87+0x1),0xa);if(isNaN(_0x272e4e)||_0x272e4e<=0x0)return![];let _0x4b117d=_0x1f5768,_0x8e82a0=_0x14eb68;if(_0x3a1c28!=='*'){if(_0x3a1c28[_0x43911d(0x1f7)]('-')){const _0x4d5e8a=_0x3a1c28['split']('-')['map'](Number);_0x4b117d=_0x4d5e8a[0x0],_0x8e82a0=_0x4d5e8a[0x1];}else _0x4b117d=parseInt(_0x3a1c28,0xa),_0x8e82a0=_0x14eb68;}if(_0x94dee8<_0x4b117d||_0x94dee8>_0x8e82a0)return![];return(_0x94dee8-_0x4b117d)%_0x272e4e===0x0;}if(_0x42c3b5[_0x43911d(0x1f7)]('-')){const _0x323ab1=_0x42c3b5[_0x43911d(0x250)]('-')[_0x43911d(0x216)](Number);return _0x94dee8>=_0x323ab1[0x0]&&_0x94dee8<=_0x323ab1[0x1];}const _0x1d50bc=parseInt(_0x42c3b5,0xa);return!isNaN(_0x1d50bc)&&_0x94dee8===_0x1d50bc;}function matchesCron(_0x39950b,_0x3f3a17){const _0x25389e=a5_0x4570cc,_0x17d117=_0x39950b[_0x25389e(0x288)]()[_0x25389e(0x250)](/\s+/);if(_0x17d117[_0x25389e(0x22f)]!==0x5)return![];const _0x4c7a07=_0x3f3a17['getMinutes'](),_0x896635=_0x3f3a17[_0x25389e(0x27c)](),_0x32eb4e=_0x3f3a17[_0x25389e(0x1ef)](),_0x22360f=_0x3f3a17[_0x25389e(0x1fc)]()+0x1,_0x38554f=_0x3f3a17[_0x25389e(0x1eb)]();if(!matchesCronField(_0x17d117[0x0],_0x4c7a07,0x0,0x3b))return![];if(!matchesCronField(_0x17d117[0x1],_0x896635,0x0,0x17))return![];if(!matchesCronField(_0x17d117[0x3],_0x22360f,0x1,0xc))return![];const _0x2eaa69=matchesCronField(_0x17d117[0x2],_0x32eb4e,0x1,0x1f),_0x3aabf9=matchesCronField(_0x17d117[0x4],_0x38554f,0x0,0x7)||_0x38554f===0x0&&matchesCronField(_0x17d117[0x4],0x7,0x0,0x7),_0x1b8964=_0x17d117[0x2]==='*',_0x3c7b04=_0x17d117[0x4]==='*';if(_0x1b8964&&_0x3c7b04)return!![];if(_0x1b8964)return _0x3aabf9;if(_0x3c7b04)return _0x2eaa69;return _0x2eaa69||_0x3aabf9;}function isValidCronExpression(_0x30592f){const _0x1b4339=a5_0x4570cc,_0x3fd029=_0x30592f[_0x1b4339(0x288)]()[_0x1b4339(0x250)](/\s+/);if(_0x3fd029[_0x1b4339(0x22f)]!==0x5)return![];const _0x245423=/^(\*|\d+|\d+-\d+|\*\/\d+|\d+\/\d+|\d+-\d+\/\d+|\d+(,\d+)+)$/;return _0x3fd029[_0x1b4339(0x239)](_0x56d95d=>_0x245423['test'](_0x56d95d));}const ANALYSIS_PROMPT=a5_0x4570cc(0x229);async function analyzeCronWithClaude(_0x502e7d,_0x4a86cd,_0x4016d8){const _0x46eb6a=a5_0x4570cc,_0x429d5e=_0x502e7d[_0x46eb6a(0x28c)](_0x4a86cd),_0x1b071d='claude',_0x595759=ANALYSIS_PROMPT[_0x46eb6a(0x217)]('{INPUT}',_0x4016d8),_0x21f151=['--permission-mode',_0x46eb6a(0x256),'--print',_0x46eb6a(0x1f9),_0x46eb6a(0x258),_0x46eb6a(0x254)],_0x3384f4=(0x0,claude_process_1[_0x46eb6a(0x257)])(_0x502e7d,_0x429d5e);return _0x3384f4&&_0x21f151[_0x46eb6a(0x243)](_0x46eb6a(0x22c),_0x3384f4),console[_0x46eb6a(0x20c)]('['+(0x0,session_1['timestamp'])()+_0x46eb6a(0x201)+_0x1b071d+'\x20'+_0x21f151[_0x46eb6a(0x1f8)]('\x20')),new Promise((_0xd7201e,_0x12d3a2)=>{const _0x55b145=_0x46eb6a,_0x6de307=(0x0,child_process_1[_0x55b145(0x205)])(_0x1b071d,_0x21f151,{'cwd':_0x429d5e,'stdio':[_0x55b145(0x1ed),_0x55b145(0x1ed),_0x55b145(0x1ed)]});_0x6de307[_0x55b145(0x22b)]?.['write'](_0x595759+'\x0a'),_0x6de307['stdin']?.[_0x55b145(0x21c)]();let _0x4ef153='',_0x1b6a32='';const _0xb084dd=readline_1[_0x55b145(0x245)][_0x55b145(0x27e)]({'input':_0x6de307[_0x55b145(0x211)]});_0xb084dd['on'](_0x55b145(0x208),_0x39edbb=>{const _0x5d470f=_0x55b145,_0x5f5a97=(0x0,claude_process_1[_0x5d470f(0x27d)])(_0x39edbb);_0x5f5a97?.[_0x5d470f(0x28a)]===_0x5d470f(0x27a)&&_0x5f5a97[_0x5d470f(0x230)]&&(_0x4ef153=_0x5f5a97['content']);}),_0x6de307[_0x55b145(0x260)]?.['on'](_0x55b145(0x22d),_0x2c3dd7=>{const _0x40521c=_0x55b145;_0x1b6a32+=_0x2c3dd7[_0x40521c(0x253)]();});const _0x5479b6=setTimeout(()=>{const _0x596584=_0x55b145;_0x6de307[_0x596584(0x276)](),_0x12d3a2(new Error(_0x596584(0x25c)));},0xea60);_0x6de307['on'](_0x55b145(0x271),_0x375f11=>{const _0x3f12aa=_0x55b145;clearTimeout(_0x5479b6);if(_0x375f11===0x0&&_0x4ef153)try{const _0x569685=_0x4ef153[_0x3f12aa(0x287)](/\{[\s\S]*\}/);if(_0x569685){const _0x13b853=JSON[_0x3f12aa(0x26f)](_0x569685[0x0]);if(_0x13b853[_0x3f12aa(0x23f)]&&_0x13b853[_0x3f12aa(0x220)]){_0xd7201e(_0x13b853);return;}}_0x12d3a2(new Error('Claude\x20返回格式不正确'));}catch{_0x12d3a2(new Error(_0x3f12aa(0x27b)));}else{const _0x4dca8e=_0x1b6a32['trim']()?'\x20('+_0x1b6a32[_0x3f12aa(0x288)]()[_0x3f12aa(0x284)](0x0,0xc8)+')':'';console[_0x3f12aa(0x24f)]('['+(0x0,session_1[_0x3f12aa(0x281)])()+_0x3f12aa(0x23a)+_0x375f11+')'+_0x4dca8e);const _0x55aedc=_0x1b6a32;if(/\b429\b/[_0x3f12aa(0x280)](_0x55aedc))_0x12d3a2(new Error(_0x3f12aa(0x23b)));else{if(/\b422\b/[_0x3f12aa(0x280)](_0x55aedc)||/TPM|额度超限/i[_0x3f12aa(0x280)](_0x55aedc))_0x12d3a2(new Error(_0x3f12aa(0x270)));else{if(/\b401\b/[_0x3f12aa(0x280)](_0x55aedc)||/auth|认证|permission/i['test'](_0x55aedc))_0x12d3a2(new Error(_0x3f12aa(0x209)));else _0x375f11===0x1&&!_0x4ef153&&!_0x1b6a32[_0x3f12aa(0x288)]()?_0x12d3a2(new Error(_0x3f12aa(0x1f1))):_0x12d3a2(new Error(_0x3f12aa(0x24a)+_0x375f11+')'+_0x4dca8e));}}}}),_0x6de307['on']('error',_0x1128a5=>{const _0x21ce95=_0x55b145;clearTimeout(_0x5479b6),_0x12d3a2(new Error(_0x21ce95(0x26b)+_0x1128a5[_0x21ce95(0x21a)]));});});}function a5_0x4b87(){const _0x434784=['bypassPermissions','resolveClaudeSettingsPath','stream-json','./task','tick','-\x20Cron:\x20`','分析超时(60s)','stopScheduler','dateUtil','executeJob','stderr','-\x20**创建时间:**\x20',']\x20Cron引擎已启动,\x20共\x20','jobs','writeFileSync','1666542ZiooUp','1629538XSfKwT','./messaging','size','__esModule','./claude-process','启动\x20Claude\x20进程失败:\x20','saveActiveSession','filter','delete','parse','Claude\x20TPM\x20限流(422),请稍后重试','close','runningJobIds','sendDingMessage','-\x20**上次执行:**\x20','start','kill','cron_','findIndex','\x20个任务\x20(','result','JSON\x20解析失败','getHours','parseClaudeStreamLine','createInterface','isArray','test','timestamp','activeSessions','3885580OMkaSX','substring','taskCfg','timer','match','trim','7170590jyGWcu','type','getConversationConfig','getConversationDir','formatCronJobInfo','[cron]','getDay','startScheduler','pipe','\x20无通知能力(无dingToken且无defaultDingToken),\x20跳过执行','getDate','/session.json','Claude\x20进程异常退出,无输出。请检查\x20claude\x20命令是否可用','readline','warn','mkdirSync','persist','listJobs','includes','join','--output-format','/session.log','some','getMonth','lastCheckedTime','find','addJob','isValidCronExpression',']\x20Cron分析:\x20','MAX_CONCURRENT_JOBS','lastRunAt','toggleJob','spawn','dingToken','defineProperty','line','Claude\x20认证失败(401),请检查\x20API\x20Key\x20配置','now','readFileSync','log','__importDefault','✅\x20启用','catch','959958dHpLPD','stdout','getSessionDir','format','YYYY-MM-DD-HH-mm-ss',']\x20Cron并发上限(','map','replace','cronExpression',']\x20Cron触发:\x20','message','Claude\x20返回的cron表达式无效:\x20','end','enabled','-\x20上次执行:\x20','📭\x20暂无定时任务','prompt','skill','senderStaffId','child_process','splice',']\x20删除定时任务:\x20','senderNick','destroy','/cron.json','分析以下定时任务描述,提取cron表达式和任务内容。\x0a\x0a用户输入:\x20{INPUT}\x0a\x0a请严格返回以下JSON格式(不要返回其他任何内容):\x0a{\x22cron\x22:\x225位cron表达式(分\x20时\x20日\x20月\x20周)\x22,\x22prompt\x22:\x22要执行的任务提示词\x22,\x22desc\x22:\x22简短的中文描述\x22}\x0a\x0a常见cron格式:\x0a-\x20每天早上9点:\x20\x220\x209\x20*\x20*\x20*\x22\x0a-\x20每周一早上9点:\x20\x220\x209\x20*\x20*\x201\x22\x0a-\x20工作日早上9点:\x20\x220\x209\x20*\x20*\x201-5\x22\x0a-\x20每小时:\x20\x220\x20*\x20*\x20*\x20*\x22\x0a-\x20每30分钟:\x20\x22*/30\x20*\x20*\x20*\x20*\x22\x0a-\x20每天中午12点:\x20\x220\x2012\x20*\x20*\x20*\x22\x0a-\x20每月1号早上9点:\x20\x220\x209\x201\x20*\x20*\x22\x0a-\x20每周五下午3点:\x20\x220\x2015\x20*\x20*\x205\x22','已恢复','stdin','--settings','data','已暂停','length','content','1192828aaAbOV','CronEngine','-\x20**任务:**\x20','conversationId','utf-8','appendFileSync','712862IaBbbW','-\x20**状态:**\x20','every',']\x20Cron分析进程退出(','Claude\x20配额已耗尽(429),请稍后重试或明天再试','set','-\x20**创建者:**\x20','has','cron','enqueueAsTask','getJob','checkJobsAt','push','\x20降级到任务队列失败:','default','stringify',']\x20Cron任务\x20','saveTask','description','分析失败\x20(退出码:\x20','agent','analyzeAndCreate','indexOf','-\x20描述:\x20','error','split',']\x20[SYSTEM]:\x20定时任务触发:\x20','###\x20⏰\x20定时任务列表\x0a','toString','--verbose','\x20启用)'];a5_0x4b87=function(){return _0x434784;};return a5_0x4b87();}function formatCronJobList(_0x1a4929){const _0x323754=a5_0x4570cc;if(_0x1a4929[_0x323754(0x22f)]===0x0)return _0x323754(0x21f);const _0x433cc6=[_0x323754(0x252)];for(const _0x2c327d of _0x1a4929){const _0x2253ef=_0x2c327d[_0x323754(0x21d)]?'✅':'⏸️',_0x3d3087=_0x2c327d[_0x323754(0x203)]||'-';_0x433cc6[_0x323754(0x243)]('**'+_0x2253ef+'\x20'+_0x2c327d['id']+'**'),_0x433cc6[_0x323754(0x243)](_0x323754(0x25b)+_0x2c327d[_0x323754(0x218)]+'`'),_0x433cc6[_0x323754(0x243)](_0x323754(0x24e)+_0x2c327d[_0x323754(0x249)]),_0x433cc6[_0x323754(0x243)]('-\x20任务:\x20'+_0x2c327d[_0x323754(0x220)]),_0x433cc6[_0x323754(0x243)]('-\x20创建者:\x20'+_0x2c327d[_0x323754(0x226)]),_0x433cc6['push'](_0x323754(0x21e)+_0x3d3087),_0x433cc6['push']('');}return _0x433cc6[_0x323754(0x243)]('💡\x20`/cron\x20pause\x20<id>`\x20暂停\x20|\x20`/cron\x20resume\x20<id>`\x20恢复\x20|\x20`/cron\x20delete\x20<id>`\x20删除'),_0x433cc6[_0x323754(0x1f8)]('\x0a');}function formatCronJobInfo(_0x1c4853){const _0x576146=a5_0x4570cc,_0x29dc75=_0x1c4853[_0x576146(0x21d)]?_0x576146(0x20e):'⏸️\x20暂停';return['###\x20⏰\x20定时任务\x20'+_0x1c4853['id'],'',_0x576146(0x238)+_0x29dc75,'-\x20**Cron:**\x20`'+_0x1c4853[_0x576146(0x218)]+'`','-\x20**描述:**\x20'+_0x1c4853['description'],_0x576146(0x233)+_0x1c4853[_0x576146(0x220)],_0x576146(0x23d)+_0x1c4853['senderNick'],_0x576146(0x261)+_0x1c4853['createdAt'],_0x576146(0x274)+(_0x1c4853[_0x576146(0x203)]||'-')][_0x576146(0x1f8)]('\x0a');}class CronEngine{constructor(_0x284a1f){const _0xcb6c46=a5_0x4570cc;this[_0xcb6c46(0x263)]=[],this[_0xcb6c46(0x286)]=null,this[_0xcb6c46(0x1fd)]=-0x1,this['runningJobIds']=new Set(),this['MAX_CONCURRENT_JOBS']=0x3,this['dc']=_0x284a1f,this[_0xcb6c46(0x263)]=loadCronJobs(_0x284a1f);}[a5_0x4570cc(0x275)](){const _0x1ae4d2=a5_0x4570cc;this[_0x1ae4d2(0x1ec)]();const _0x2a0564=this['jobs'][_0x1ae4d2(0x26d)](_0x420142=>_0x420142['enabled'])[_0x1ae4d2(0x22f)];console[_0x1ae4d2(0x20c)]('['+(0x0,session_1['timestamp'])()+_0x1ae4d2(0x262)+this[_0x1ae4d2(0x263)][_0x1ae4d2(0x22f)]+_0x1ae4d2(0x279)+_0x2a0564+_0x1ae4d2(0x255));}[a5_0x4570cc(0x227)](){const _0x86b39f=a5_0x4570cc;this[_0x86b39f(0x25d)]();}[a5_0x4570cc(0x1ff)](_0x2a976d){const _0x4e9248=a5_0x4570cc,_0x37c64d={'id':_0x4e9248(0x277)+Date[_0x4e9248(0x20a)](),'conversationId':_0x2a976d[_0x4e9248(0x234)],'cronExpression':_0x2a976d['cronExpression'],'description':_0x2a976d[_0x4e9248(0x249)],'prompt':_0x2a976d['prompt'],'enabled':!![],'createdAt':(0x0,session_1[_0x4e9248(0x281)])(),'senderStaffId':_0x2a976d[_0x4e9248(0x222)],'senderNick':_0x2a976d['senderNick']};return this[_0x4e9248(0x263)][_0x4e9248(0x243)](_0x37c64d),this['persist'](),console[_0x4e9248(0x20c)]('['+(0x0,session_1[_0x4e9248(0x281)])()+']\x20新增定时任务:\x20'+_0x37c64d['id']+'\x20['+_0x37c64d[_0x4e9248(0x218)]+']\x20'+_0x37c64d[_0x4e9248(0x249)]),_0x37c64d;}['removeJob'](_0x441aa7){const _0x5ef400=a5_0x4570cc,_0x4ee9ab=this[_0x5ef400(0x263)][_0x5ef400(0x278)](_0x4c93e9=>_0x4c93e9['id']===_0x441aa7);if(_0x4ee9ab===-0x1)return![];const _0x5e5a50=this[_0x5ef400(0x263)][_0x5ef400(0x224)](_0x4ee9ab,0x1)[0x0];return this[_0x5ef400(0x1f5)](),console['log']('['+(0x0,session_1['timestamp'])()+_0x5ef400(0x225)+_0x5e5a50['id']),!![];}[a5_0x4570cc(0x204)](_0x340ca3,_0x3a885e){const _0x7933a9=a5_0x4570cc,_0xd8defb=this[_0x7933a9(0x263)][_0x7933a9(0x1fe)](_0x4dc61d=>_0x4dc61d['id']===_0x340ca3);if(!_0xd8defb)return![];return _0xd8defb[_0x7933a9(0x21d)]=_0x3a885e,this[_0x7933a9(0x1f5)](),console['log']('['+(0x0,session_1[_0x7933a9(0x281)])()+']\x20定时任务\x20'+_0xd8defb['id']+'\x20'+(_0x3a885e?_0x7933a9(0x22a):_0x7933a9(0x22e))),!![];}[a5_0x4570cc(0x1f6)](_0x4b2218){const _0x176ab9=a5_0x4570cc;if(_0x4b2218)return this[_0x176ab9(0x263)][_0x176ab9(0x26d)](_0xeb43ca=>_0xeb43ca['conversationId']===_0x4b2218);return[...this['jobs']];}[a5_0x4570cc(0x241)](_0x5a1501){const _0x1b81bc=a5_0x4570cc;return this[_0x1b81bc(0x263)]['find'](_0xbd72f8=>_0xbd72f8['id']===_0x5a1501);}async[a5_0x4570cc(0x24c)](_0x4b1245,_0x3f3de8,_0x5206ec,_0xbd2d03){const _0x559ab4=a5_0x4570cc;try{const _0x370680=await analyzeCronWithClaude(this['dc'],_0x4b1245,_0x3f3de8);if(!isValidCronExpression(_0x370680[_0x559ab4(0x23f)]))return{'error':_0x559ab4(0x21b)+_0x370680['cron']};const _0x115221=this['addJob']({'conversationId':_0x4b1245,'cronExpression':_0x370680[_0x559ab4(0x23f)],'description':_0x370680['desc']||_0x3f3de8['substring'](0x0,0x32),'prompt':_0x370680['prompt'],'senderStaffId':_0x5206ec,'senderNick':_0xbd2d03});return{'job':_0x115221};}catch(_0xf67111){return{'error':_0xf67111 instanceof Error?_0xf67111[_0x559ab4(0x21a)]:String(_0xf67111)};}}['persist'](){const _0x14fc88=a5_0x4570cc;saveCronJobs(this['dc'],this[_0x14fc88(0x263)]);}[a5_0x4570cc(0x1ec)](){const _0x54eea4=Date['now'](),_0x38e8a6=0xea60-_0x54eea4%0xea60;setTimeout(()=>{const _0x285601=a5_0x248e;this[_0x285601(0x25a)](),this[_0x285601(0x286)]=setInterval(()=>this[_0x285601(0x25a)](),0xea60);},_0x38e8a6);}['stopScheduler'](){const _0xc89aec=a5_0x4570cc;this[_0xc89aec(0x286)]&&(clearInterval(this[_0xc89aec(0x286)]),this[_0xc89aec(0x286)]=null);}['tick'](){const _0x9c14a1=a5_0x4570cc,_0x45eb0b=Date['now'](),_0x2898c5=this['lastCheckedTime']<0x0?_0x45eb0b-_0x45eb0b%0xea60:this[_0x9c14a1(0x1fd)]+0xea60-this[_0x9c14a1(0x1fd)]%0xea60,_0x348a38=_0x45eb0b-_0x45eb0b%0xea60;for(let _0x209470=_0x2898c5;_0x209470<=_0x348a38;_0x209470+=0xea60){const _0x2d66c1=new Date(_0x209470);if(!this[_0x9c14a1(0x242)](_0x2d66c1))break;}this['lastCheckedTime']=_0x45eb0b;}[a5_0x4570cc(0x242)](_0x4a59ac){const _0x179c5b=a5_0x4570cc;if(this[_0x179c5b(0x272)][_0x179c5b(0x268)]>=this[_0x179c5b(0x202)])return console[_0x179c5b(0x1f3)]('['+(0x0,session_1[_0x179c5b(0x281)])()+_0x179c5b(0x215)+this['MAX_CONCURRENT_JOBS']+'),\x20跳过\x20'+_0x4a59ac['toISOString']()+'\x20的检查'),![];for(const _0x3b595c of this['jobs']){if(!_0x3b595c['enabled'])continue;if(this[_0x179c5b(0x272)][_0x179c5b(0x23e)](_0x3b595c['id']))continue;if(this[_0x179c5b(0x272)][_0x179c5b(0x268)]>=this[_0x179c5b(0x202)])break;if(!matchesCron(_0x3b595c['cronExpression'],_0x4a59ac))continue;console['log']('['+(0x0,session_1['timestamp'])()+_0x179c5b(0x219)+_0x3b595c['id']+'\x20['+_0x3b595c[_0x179c5b(0x218)]+']\x20'+_0x3b595c[_0x179c5b(0x249)]),this[_0x179c5b(0x25f)](_0x3b595c)[_0x179c5b(0x20f)](_0x2e6ece=>{const _0xbbd4cc=_0x179c5b;console['error']('['+(0x0,session_1[_0xbbd4cc(0x281)])()+']\x20Cron执行失败:\x20'+_0x3b595c['id'],_0x2e6ece);});}return!![];}async['executeJob'](_0xa7d08f){const _0x19492e=a5_0x4570cc;this[_0x19492e(0x272)]['add'](_0xa7d08f['id']);try{const _0x314c9f=this['dc'][_0x19492e(0x28b)](_0xa7d08f[_0x19492e(0x234)]);if(!_0x314c9f){console['warn']('['+(0x0,session_1[_0x19492e(0x281)])()+']\x20Cron任务\x20'+_0xa7d08f['id']+'\x20的会话配置不存在,\x20跳过执行');return;}const _0xadc9ae=!!(_0x314c9f[_0x19492e(0x206)]||this['dc']['config']['defaultDingToken']);if(!_0xadc9ae){console[_0x19492e(0x1f3)]('['+(0x0,session_1[_0x19492e(0x281)])()+_0x19492e(0x247)+_0xa7d08f['id']+_0x19492e(0x1ee));return;}const _0x4ff10d=(0x0,session_1['findActiveSession'])(this['dc'],_0xa7d08f[_0x19492e(0x234)]);if(_0x4ff10d){console[_0x19492e(0x20c)]('['+(0x0,session_1['timestamp'])()+_0x19492e(0x247)+_0xa7d08f['id']+'\x20的会话有活跃session,\x20降级到任务队列'),await this[_0x19492e(0x240)](_0xa7d08f);return;}const _0x3faf84=Date[_0x19492e(0x20a)](),_0x1f232c={'conversationId':_0xa7d08f['conversationId'],'sessionWebhook':'','startTime':_0x3faf84,'startTimeStr':utils_ok_1[_0x19492e(0x25e)]['mm'](_0x3faf84)[_0x19492e(0x213)](_0x19492e(0x214)),'startStaffId':_0xa7d08f[_0x19492e(0x222)],'startNickName':_0x19492e(0x1ea)+_0xa7d08f[_0x19492e(0x226)]},_0x2d8232=(0x0,session_1[_0x19492e(0x212)])(this['dc'],_0x1f232c);fs_1['default'][_0x19492e(0x1f4)](_0x2d8232,{'recursive':!![]}),fs_1[_0x19492e(0x245)][_0x19492e(0x264)](_0x2d8232+_0x19492e(0x1f0),JSON[_0x19492e(0x246)](_0x1f232c,null,0x2),_0x19492e(0x235)),this['dc'][_0x19492e(0x282)][_0x19492e(0x23c)](_0xa7d08f['conversationId'],{'session':_0x1f232c,'lastSenderStaffId':_0xa7d08f[_0x19492e(0x222)],'isProcessing':!![],'conversationConfig':_0x314c9f}),(0x0,session_1[_0x19492e(0x26c)])(this['dc'],_0xa7d08f['conversationId']),console[_0x19492e(0x20c)]('['+(0x0,session_1[_0x19492e(0x281)])()+_0x19492e(0x247)+_0xa7d08f['id']+'\x20开始执行:\x20'+_0xa7d08f['description']),fs_1[_0x19492e(0x245)][_0x19492e(0x236)](_0x2d8232+_0x19492e(0x1fa),'['+(0x0,session_1['timestamp'])()+_0x19492e(0x251)+_0xa7d08f['description']+'\x0a',_0x19492e(0x235));try{await(0x0,claude_process_1['executeClaudeQuery'])(this['dc'],_0x1f232c,_0xa7d08f[_0x19492e(0x220)],{'skill':_0x314c9f[_0x19492e(0x285)]?.[_0x19492e(0x221)],'agent':_0x314c9f[_0x19492e(0x24b)],'senderNick':_0xa7d08f[_0x19492e(0x226)],'senderStaffId':_0xa7d08f[_0x19492e(0x222)]});}catch(_0x5abf6e){console[_0x19492e(0x24f)]('['+(0x0,session_1['timestamp'])()+']\x20Cron执行Claude查询失败:\x20'+_0xa7d08f['id'],_0x5abf6e),await(0x0,messaging_1[_0x19492e(0x273)])(this['dc'],{'conversationId':_0xa7d08f[_0x19492e(0x234)],'sessionWebhook':'','atUserId':_0xa7d08f[_0x19492e(0x222)],'content':'❌\x20定时任务执行失败:\x20'+(_0x5abf6e instanceof Error?_0x5abf6e[_0x19492e(0x21a)]:String(_0x5abf6e))});}finally{this['dc'][_0x19492e(0x282)][_0x19492e(0x26e)](_0xa7d08f[_0x19492e(0x234)]),(0x0,session_1[_0x19492e(0x26c)])(this['dc'],_0xa7d08f['conversationId']);}_0xa7d08f[_0x19492e(0x203)]=(0x0,session_1[_0x19492e(0x281)])(),this[_0x19492e(0x1f5)]();}finally{this[_0x19492e(0x272)][_0x19492e(0x26e)](_0xa7d08f['id']);}}async['enqueueAsTask'](_0x2b56bd){const _0x5e7033=a5_0x4570cc;try{await(0x0,task_1[_0x5e7033(0x248)])(this['dc'],{'conversationId':_0x2b56bd['conversationId'],'prompt':_0x2b56bd['prompt'],'senderStaffId':_0x2b56bd[_0x5e7033(0x222)],'senderNickName':_0x5e7033(0x1ea)+_0x2b56bd[_0x5e7033(0x226)],'sessionWebhook':'','type':_0x5e7033(0x23f)}),console['log']('['+(0x0,session_1[_0x5e7033(0x281)])()+_0x5e7033(0x247)+_0x2b56bd['id']+'\x20已降级到任务队列:\x20'+_0x2b56bd[_0x5e7033(0x249)]);}catch(_0x4d85d1){console[_0x5e7033(0x24f)]('['+(0x0,session_1['timestamp'])()+_0x5e7033(0x247)+_0x2b56bd['id']+_0x5e7033(0x244),_0x4d85d1);}_0x2b56bd['lastRunAt']=(0x0,session_1['timestamp'])(),this[_0x5e7033(0x1f5)]();}}exports['CronEngine']=CronEngine;
1
+ 'use strict';const a5_0x1544ce=a5_0x337a;(function(_0x3e25c2,_0x3bbc65){const _0x115a3d=a5_0x337a,_0x57465b=_0x3e25c2();while(!![]){try{const _0x49a1ff=parseInt(_0x115a3d(0xd3))/0x1+-parseInt(_0x115a3d(0x109))/0x2*(parseInt(_0x115a3d(0xac))/0x3)+parseInt(_0x115a3d(0x147))/0x4*(parseInt(_0x115a3d(0x11e))/0x5)+parseInt(_0x115a3d(0x132))/0x6*(-parseInt(_0x115a3d(0x146))/0x7)+parseInt(_0x115a3d(0x12a))/0x8*(parseInt(_0x115a3d(0x10b))/0x9)+-parseInt(_0x115a3d(0xf8))/0xa*(-parseInt(_0x115a3d(0xe5))/0xb)+-parseInt(_0x115a3d(0x138))/0xc*(parseInt(_0x115a3d(0xd1))/0xd);if(_0x49a1ff===_0x3bbc65)break;else _0x57465b['push'](_0x57465b['shift']());}catch(_0x5539b9){_0x57465b['push'](_0x57465b['shift']());}}}(a5_0x45a5,0xa7a51));var __importDefault=this&&this[a5_0x1544ce(0xef)]||function(_0x4d1421){const _0x36a663=a5_0x1544ce;return _0x4d1421&&_0x4d1421[_0x36a663(0x11f)]?_0x4d1421:{'default':_0x4d1421};};Object[a5_0x1544ce(0x122)](exports,a5_0x1544ce(0x11f),{'value':!![]}),exports['CronEngine']=void 0x0,exports[a5_0x1544ce(0x12d)]=isValidCronExpression,exports[a5_0x1544ce(0x12b)]=formatCronJobList,exports[a5_0x1544ce(0xcf)]=formatCronJobInfo;const fs_1=__importDefault(require('fs')),readline_1=__importDefault(require(a5_0x1544ce(0xb5))),child_process_1=require('child_process'),utils_ok_1=require(a5_0x1544ce(0xce)),messaging_1=require('./messaging'),claude_process_1=require(a5_0x1544ce(0xaa)),task_1=require(a5_0x1544ce(0xfd)),session_1=require(a5_0x1544ce(0x13f));function getCronFile(_0x55797f){const _0x21f4bb=a5_0x1544ce;return(0x0,session_1[_0x21f4bb(0x13b)])(_0x55797f)+'/cron.json';}function a5_0x45a5(){const _0x2a22c0=['./task','end','已暂停','log','desc','lastRunAt','trim','❌\x20定时任务执行失败:\x20','start','agent','分析超时(60s)','Claude\x20TPM\x20限流(422),请稍后重试','22IAeKXf','destroy','4879503RRWKpQ','MAX_CONCURRENT_JOBS','taskCfg','lastCheckedTime','-\x20任务:\x20','filter','\x20开始执行:\x20','prompt','dateUtil','default','claude','cron',']\x20Cron任务\x20','getJob','test','-\x20描述:\x20','jobs','Claude\x20返回格式不正确','message','5bKTbAb','__esModule','senderStaffId','executeClaudeQuery','defineProperty','--settings','result','isArray','addJob','###\x20⏰\x20定时任务列表\x0a','indexOf','toString','16LWSJEW','formatCronJobList','\x20个任务\x20(','isValidCronExpression','startScheduler','Claude\x20认证失败(401),请检查\x20API\x20Key\x20配置','substring','-\x20**描述:**\x20','288276fLnSPE','checkJobsAt','getDay','pipe','executeJob','runningJobIds','72aIlViN','-\x20**创建时间:**\x20','enabled','getClientDir','find','YYYY-MM-DD-HH-mm-ss','getHours','./session','enqueueAsTask',']\x20Cron引擎已启动,\x20共\x20','kill','splice','toggleJob','persist','161fQUEhe','1231564xvyDbW','readFileSync','mkdirSync','resolveClaudeSettingsPath','activeSessions','Claude\x20进程异常退出,无输出。请检查\x20claude\x20命令是否可用','data','./claude-process','📭\x20暂无定时任务','315402ECqyUO','-\x20创建者:\x20','toISOString','-\x20**创建者:**\x20','stdin','stderr','write','warn','已恢复','readline','getConversationDir','\x20降级到任务队列失败:','saveActiveSession','\x20的会话有活跃session,\x20降级到任务队列','line','-\x20Cron:\x20`','-\x20**任务:**\x20','stringify','[cron]','parse','\x20启用)','--verbose','--permission-mode','tick','includes','spawn','length','timer','Claude\x20返回的cron表达式无效:\x20','getDate','-\x20上次执行:\x20','\x20无通知能力(无dingToken且无defaultDingToken),\x20跳过执行','error','--output-format','utils-ok','formatCronJobInfo',']\x20Cron并发上限(','1755507pomLWa','分析失败\x20(退出码:\x20','1369911vbCGeT','description','push','findActiveSession','sendDingMessage','--print','join','now','senderNick','writeFileSync',']\x20[SYSTEM]:\x20定时任务触发:\x20','cronExpression',']\x20Cron执行Claude查询失败:\x20',']\x20删除定时任务:\x20','###\x20⏰\x20定时任务\x20','appendFileSync','split','delete','77zJbIgJ','has','\x20的会话配置不存在,\x20跳过执行','timestamp','💡\x20`/cron\x20pause\x20<id>`\x20暂停\x20|\x20`/cron\x20resume\x20<id>`\x20恢复\x20|\x20`/cron\x20delete\x20<id>`\x20删除','size','CronEngine','map','some',']\x20Cron触发:\x20','__importDefault','analyzeAndCreate','content','skill','stream-json','conversationId',']\x20Cron分析:\x20','parseClaudeStreamLine',']\x20新增定时任务:\x20','1423290dHxAno','utf-8','{INPUT}','bypassPermissions',']\x20定时任务\x20'];a5_0x45a5=function(){return _0x2a22c0;};return a5_0x45a5();}function loadCronJobs(_0x4a245b){const _0x27b44b=a5_0x1544ce,_0xb0f9e=getCronFile(_0x4a245b);try{const _0x452fbc=JSON['parse'](fs_1['default'][_0x27b44b(0x148)](_0xb0f9e,'utf-8'));return Array[_0x27b44b(0x125)](_0x452fbc)?_0x452fbc:_0x452fbc[_0x27b44b(0x11b)]||[];}catch{return[];}}function saveCronJobs(_0x205072,_0x4b3c3b){const _0x460ec3=a5_0x1544ce,_0x4a622b=getCronFile(_0x205072);fs_1[_0x460ec3(0x114)][_0x460ec3(0xdc)](_0x4a622b,JSON[_0x460ec3(0xbd)](_0x4b3c3b,null,0x2),'utf-8');}function a5_0x337a(_0x3fa5f0,_0x59b9ea){_0x3fa5f0=_0x3fa5f0-0xa7;const _0x45a51f=a5_0x45a5();let _0x337ac1=_0x45a51f[_0x3fa5f0];return _0x337ac1;}function matchesCronField(_0x471f6a,_0x3bd5fe,_0x1cc001,_0x53739e){const _0x32dc2e=a5_0x1544ce;if(_0x471f6a==='*')return!![];if(_0x471f6a[_0x32dc2e(0xc4)](','))return _0x471f6a[_0x32dc2e(0xe3)](',')[_0x32dc2e(0xed)](_0x4809f4=>matchesCronField(_0x4809f4[_0x32dc2e(0x103)](),_0x3bd5fe,_0x1cc001,_0x53739e));if(_0x471f6a[_0x32dc2e(0xc4)]('/')){const _0x10cf05=_0x471f6a[_0x32dc2e(0x128)]('/'),_0x275b2d=_0x471f6a[_0x32dc2e(0x130)](0x0,_0x10cf05),_0x56b7bb=parseInt(_0x471f6a[_0x32dc2e(0x130)](_0x10cf05+0x1),0xa);if(isNaN(_0x56b7bb)||_0x56b7bb<=0x0)return![];let _0x4f2799=_0x1cc001,_0x201629=_0x53739e;if(_0x275b2d!=='*'){if(_0x275b2d[_0x32dc2e(0xc4)]('-')){const _0x5616cb=_0x275b2d[_0x32dc2e(0xe3)]('-')[_0x32dc2e(0xec)](Number);_0x4f2799=_0x5616cb[0x0],_0x201629=_0x5616cb[0x1];}else _0x4f2799=parseInt(_0x275b2d,0xa),_0x201629=_0x53739e;}if(_0x3bd5fe<_0x4f2799||_0x3bd5fe>_0x201629)return![];return(_0x3bd5fe-_0x4f2799)%_0x56b7bb===0x0;}if(_0x471f6a[_0x32dc2e(0xc4)]('-')){const _0x462c19=_0x471f6a['split']('-')[_0x32dc2e(0xec)](Number);return _0x3bd5fe>=_0x462c19[0x0]&&_0x3bd5fe<=_0x462c19[0x1];}const _0x37828d=parseInt(_0x471f6a,0xa);return!isNaN(_0x37828d)&&_0x3bd5fe===_0x37828d;}function matchesCron(_0xd3026d,_0x233758){const _0x2f03a4=a5_0x1544ce,_0x5b4c63=_0xd3026d[_0x2f03a4(0x103)]()[_0x2f03a4(0xe3)](/\s+/);if(_0x5b4c63[_0x2f03a4(0xc6)]!==0x5)return![];const _0x55c3d0=_0x233758['getMinutes'](),_0x2321a7=_0x233758[_0x2f03a4(0x13e)](),_0x7e43c3=_0x233758[_0x2f03a4(0xc9)](),_0x5b86f3=_0x233758['getMonth']()+0x1,_0x91fd2=_0x233758[_0x2f03a4(0x134)]();if(!matchesCronField(_0x5b4c63[0x0],_0x55c3d0,0x0,0x3b))return![];if(!matchesCronField(_0x5b4c63[0x1],_0x2321a7,0x0,0x17))return![];if(!matchesCronField(_0x5b4c63[0x3],_0x5b86f3,0x1,0xc))return![];const _0x415b96=matchesCronField(_0x5b4c63[0x2],_0x7e43c3,0x1,0x1f),_0x1c8a6d=matchesCronField(_0x5b4c63[0x4],_0x91fd2,0x0,0x7)||_0x91fd2===0x0&&matchesCronField(_0x5b4c63[0x4],0x7,0x0,0x7),_0x59610c=_0x5b4c63[0x2]==='*',_0x376512=_0x5b4c63[0x4]==='*';if(_0x59610c&&_0x376512)return!![];if(_0x59610c)return _0x1c8a6d;if(_0x376512)return _0x415b96;return _0x415b96||_0x1c8a6d;}function isValidCronExpression(_0xcd16ea){const _0x3efbb6=a5_0x1544ce,_0x361985=_0xcd16ea[_0x3efbb6(0x103)]()[_0x3efbb6(0xe3)](/\s+/);if(_0x361985[_0x3efbb6(0xc6)]!==0x5)return![];const _0x5c3cf4=/^(\*|\d+|\d+-\d+|\*\/\d+|\d+\/\d+|\d+-\d+\/\d+|\d+(,\d+)+)$/;return _0x361985['every'](_0x296f6a=>_0x5c3cf4['test'](_0x296f6a));}const ANALYSIS_PROMPT='分析以下定时任务描述,提取cron表达式和任务内容。\x0a\x0a用户输入:\x20{INPUT}\x0a\x0a请严格返回以下JSON格式(不要返回其他任何内容):\x0a{\x22cron\x22:\x225位cron表达式(分\x20时\x20日\x20月\x20周)\x22,\x22prompt\x22:\x22要执行的任务提示词\x22,\x22desc\x22:\x22简短的中文描述\x22}\x0a\x0a常见cron格式:\x0a-\x20每天早上9点:\x20\x220\x209\x20*\x20*\x20*\x22\x0a-\x20每周一早上9点:\x20\x220\x209\x20*\x20*\x201\x22\x0a-\x20工作日早上9点:\x20\x220\x209\x20*\x20*\x201-5\x22\x0a-\x20每小时:\x20\x220\x20*\x20*\x20*\x20*\x22\x0a-\x20每30分钟:\x20\x22*/30\x20*\x20*\x20*\x20*\x22\x0a-\x20每天中午12点:\x20\x220\x2012\x20*\x20*\x20*\x22\x0a-\x20每月1号早上9点:\x20\x220\x209\x201\x20*\x20*\x22\x0a-\x20每周五下午3点:\x20\x220\x2015\x20*\x20*\x205\x22';async function analyzeCronWithClaude(_0x53d590,_0x2ac96e,_0x2ec836){const _0x1ef25f=a5_0x1544ce,_0x5daecb=_0x53d590[_0x1ef25f(0xb6)](_0x2ac96e),_0x29f901=_0x1ef25f(0x115),_0x4c2440=ANALYSIS_PROMPT['replace'](_0x1ef25f(0xfa),_0x2ec836),_0x3ba00a=[_0x1ef25f(0xc2),_0x1ef25f(0xfb),_0x1ef25f(0xd8),_0x1ef25f(0xcd),_0x1ef25f(0xf3),_0x1ef25f(0xc1)],_0x3fda6f=(0x0,claude_process_1[_0x1ef25f(0x14a)])(_0x53d590,_0x5daecb);return _0x3fda6f&&_0x3ba00a['push'](_0x1ef25f(0x123),_0x3fda6f),console[_0x1ef25f(0x100)]('['+(0x0,session_1['timestamp'])()+_0x1ef25f(0xf5)+_0x29f901+'\x20'+_0x3ba00a[_0x1ef25f(0xd9)]('\x20')),new Promise((_0x1b90ec,_0x2a7371)=>{const _0x4afa07=_0x1ef25f,_0x5720df=(0x0,child_process_1[_0x4afa07(0xc5)])(_0x29f901,_0x3ba00a,{'cwd':_0x5daecb,'stdio':[_0x4afa07(0x135),'pipe',_0x4afa07(0x135)]});_0x5720df['stdin']?.[_0x4afa07(0xb2)](_0x4c2440+'\x0a'),_0x5720df[_0x4afa07(0xb0)]?.[_0x4afa07(0xfe)]();let _0x54f15e='',_0x4b06d6='';const _0x370030=readline_1['default']['createInterface']({'input':_0x5720df['stdout']});_0x370030['on'](_0x4afa07(0xba),_0x594300=>{const _0x3876f6=_0x4afa07,_0x4014ef=(0x0,claude_process_1[_0x3876f6(0xf6)])(_0x594300);_0x4014ef?.['type']===_0x3876f6(0x124)&&_0x4014ef[_0x3876f6(0xf1)]&&(_0x54f15e=_0x4014ef[_0x3876f6(0xf1)]);}),_0x5720df[_0x4afa07(0xb1)]?.['on'](_0x4afa07(0xa9),_0x5a108b=>{const _0x3dbc42=_0x4afa07;_0x4b06d6+=_0x5a108b[_0x3dbc42(0x129)]();});const _0x4c4beb=setTimeout(()=>{const _0x17d17e=_0x4afa07;_0x5720df[_0x17d17e(0x142)](),_0x2a7371(new Error(_0x17d17e(0x107)));},0xea60);_0x5720df['on']('close',_0x592a69=>{const _0x5821f0=_0x4afa07;clearTimeout(_0x4c4beb);if(_0x592a69===0x0&&_0x54f15e)try{const _0x5546d0=_0x54f15e['match'](/\{[\s\S]*\}/);if(_0x5546d0){const _0x4317be=JSON[_0x5821f0(0xbf)](_0x5546d0[0x0]);if(_0x4317be['cron']&&_0x4317be[_0x5821f0(0x112)]){_0x1b90ec(_0x4317be);return;}}_0x2a7371(new Error(_0x5821f0(0x11c)));}catch{_0x2a7371(new Error('JSON\x20解析失败'));}else{const _0x2f3d5e=_0x4b06d6[_0x5821f0(0x103)]()?'\x20('+_0x4b06d6[_0x5821f0(0x103)]()[_0x5821f0(0x130)](0x0,0xc8)+')':'';console[_0x5821f0(0xcc)]('['+(0x0,session_1[_0x5821f0(0xe8)])()+']\x20Cron分析进程退出('+_0x592a69+')'+_0x2f3d5e);const _0x31acb7=_0x4b06d6;if(/\b429\b/[_0x5821f0(0x119)](_0x31acb7))_0x2a7371(new Error('Claude\x20配额已耗尽(429),请稍后重试或明天再试'));else{if(/\b422\b/[_0x5821f0(0x119)](_0x31acb7)||/TPM|额度超限/i[_0x5821f0(0x119)](_0x31acb7))_0x2a7371(new Error(_0x5821f0(0x108)));else{if(/\b401\b/[_0x5821f0(0x119)](_0x31acb7)||/auth|认证|permission/i[_0x5821f0(0x119)](_0x31acb7))_0x2a7371(new Error(_0x5821f0(0x12f)));else _0x592a69===0x1&&!_0x54f15e&&!_0x4b06d6[_0x5821f0(0x103)]()?_0x2a7371(new Error(_0x5821f0(0xa8))):_0x2a7371(new Error(_0x5821f0(0xd2)+_0x592a69+')'+_0x2f3d5e));}}}}),_0x5720df['on'](_0x4afa07(0xcc),_0xed220a=>{const _0x44edb4=_0x4afa07;clearTimeout(_0x4c4beb),_0x2a7371(new Error('启动\x20Claude\x20进程失败:\x20'+_0xed220a[_0x44edb4(0x11d)]));});});}function formatCronJobList(_0x1f8bb7){const _0x402825=a5_0x1544ce;if(_0x1f8bb7[_0x402825(0xc6)]===0x0)return _0x402825(0xab);const _0x201d6d=[_0x402825(0x127)];for(const _0x2387c3 of _0x1f8bb7){const _0x108168=_0x2387c3[_0x402825(0x13a)]?'✅':'⏸️',_0x192706=_0x2387c3[_0x402825(0x102)]||'-';_0x201d6d[_0x402825(0xd5)]('**'+_0x108168+'\x20'+_0x2387c3['id']+'**'),_0x201d6d[_0x402825(0xd5)](_0x402825(0xbb)+_0x2387c3[_0x402825(0xde)]+'`'),_0x201d6d[_0x402825(0xd5)](_0x402825(0x11a)+_0x2387c3[_0x402825(0xd4)]),_0x201d6d[_0x402825(0xd5)](_0x402825(0x10f)+_0x2387c3[_0x402825(0x112)]),_0x201d6d[_0x402825(0xd5)](_0x402825(0xad)+_0x2387c3[_0x402825(0xdb)]),_0x201d6d[_0x402825(0xd5)](_0x402825(0xca)+_0x192706),_0x201d6d['push']('');}return _0x201d6d[_0x402825(0xd5)](_0x402825(0xe9)),_0x201d6d[_0x402825(0xd9)]('\x0a');}function formatCronJobInfo(_0x32e560){const _0x59ed85=a5_0x1544ce,_0x589dfb=_0x32e560[_0x59ed85(0x13a)]?'✅\x20启用':'⏸️\x20暂停';return[_0x59ed85(0xe1)+_0x32e560['id'],'','-\x20**状态:**\x20'+_0x589dfb,'-\x20**Cron:**\x20`'+_0x32e560[_0x59ed85(0xde)]+'`',_0x59ed85(0x131)+_0x32e560['description'],_0x59ed85(0xbc)+_0x32e560[_0x59ed85(0x112)],_0x59ed85(0xaf)+_0x32e560[_0x59ed85(0xdb)],_0x59ed85(0x139)+_0x32e560['createdAt'],'-\x20**上次执行:**\x20'+(_0x32e560[_0x59ed85(0x102)]||'-')][_0x59ed85(0xd9)]('\x0a');}class CronEngine{constructor(_0x8510a9){const _0x208f34=a5_0x1544ce;this[_0x208f34(0x11b)]=[],this[_0x208f34(0xc7)]=null,this[_0x208f34(0x10e)]=-0x1,this['runningJobIds']=new Set(),this['MAX_CONCURRENT_JOBS']=0x3,this['dc']=_0x8510a9,this[_0x208f34(0x11b)]=loadCronJobs(_0x8510a9);}[a5_0x1544ce(0x105)](){const _0x4ec1d3=a5_0x1544ce;this['startScheduler']();const _0x453943=this['jobs']['filter'](_0x2e7262=>_0x2e7262[_0x4ec1d3(0x13a)])[_0x4ec1d3(0xc6)];console[_0x4ec1d3(0x100)]('['+(0x0,session_1['timestamp'])()+_0x4ec1d3(0x141)+this[_0x4ec1d3(0x11b)]['length']+_0x4ec1d3(0x12c)+_0x453943+_0x4ec1d3(0xc0));}[a5_0x1544ce(0x10a)](){this['stopScheduler']();}[a5_0x1544ce(0x126)](_0xc60c22){const _0x473386=a5_0x1544ce,_0x512c7b={'id':'cron_'+Date[_0x473386(0xda)](),'conversationId':_0xc60c22[_0x473386(0xf4)],'cronExpression':_0xc60c22[_0x473386(0xde)],'description':_0xc60c22[_0x473386(0xd4)],'prompt':_0xc60c22[_0x473386(0x112)],'enabled':!![],'createdAt':(0x0,session_1['timestamp'])(),'senderStaffId':_0xc60c22['senderStaffId'],'senderNick':_0xc60c22[_0x473386(0xdb)]};return this[_0x473386(0x11b)][_0x473386(0xd5)](_0x512c7b),this[_0x473386(0x145)](),console[_0x473386(0x100)]('['+(0x0,session_1[_0x473386(0xe8)])()+_0x473386(0xf7)+_0x512c7b['id']+'\x20['+_0x512c7b[_0x473386(0xde)]+']\x20'+_0x512c7b['description']),_0x512c7b;}['removeJob'](_0x59a04a){const _0x1942d6=a5_0x1544ce,_0x52208c=this[_0x1942d6(0x11b)]['findIndex'](_0xf34ca5=>_0xf34ca5['id']===_0x59a04a);if(_0x52208c===-0x1)return![];const _0xc7135e=this['jobs'][_0x1942d6(0x143)](_0x52208c,0x1)[0x0];return this[_0x1942d6(0x145)](),console['log']('['+(0x0,session_1[_0x1942d6(0xe8)])()+_0x1942d6(0xe0)+_0xc7135e['id']),!![];}[a5_0x1544ce(0x144)](_0x227833,_0x30c680){const _0x3e18da=a5_0x1544ce,_0x3b8ff0=this[_0x3e18da(0x11b)]['find'](_0x249f48=>_0x249f48['id']===_0x227833);if(!_0x3b8ff0)return![];return _0x3b8ff0['enabled']=_0x30c680,this[_0x3e18da(0x145)](),console[_0x3e18da(0x100)]('['+(0x0,session_1[_0x3e18da(0xe8)])()+_0x3e18da(0xfc)+_0x3b8ff0['id']+'\x20'+(_0x30c680?_0x3e18da(0xb4):_0x3e18da(0xff))),!![];}['listJobs'](_0x38956f){const _0x363cff=a5_0x1544ce;if(_0x38956f)return this[_0x363cff(0x11b)][_0x363cff(0x110)](_0x4be18b=>_0x4be18b[_0x363cff(0xf4)]===_0x38956f);return[...this[_0x363cff(0x11b)]];}[a5_0x1544ce(0x118)](_0x376dea){const _0x316f03=a5_0x1544ce;return this['jobs'][_0x316f03(0x13c)](_0x481a2e=>_0x481a2e['id']===_0x376dea);}async[a5_0x1544ce(0xf0)](_0x42226c,_0x59a46a,_0x2ec307,_0x57f046){const _0x14b180=a5_0x1544ce;try{const _0x48aafb=await analyzeCronWithClaude(this['dc'],_0x42226c,_0x59a46a);if(!isValidCronExpression(_0x48aafb['cron']))return{'error':_0x14b180(0xc8)+_0x48aafb['cron']};const _0x57957c=this[_0x14b180(0x126)]({'conversationId':_0x42226c,'cronExpression':_0x48aafb[_0x14b180(0x116)],'description':_0x48aafb[_0x14b180(0x101)]||_0x59a46a[_0x14b180(0x130)](0x0,0x32),'prompt':_0x48aafb[_0x14b180(0x112)],'senderStaffId':_0x2ec307,'senderNick':_0x57f046});return{'job':_0x57957c};}catch(_0x2e6a22){return{'error':_0x2e6a22 instanceof Error?_0x2e6a22[_0x14b180(0x11d)]:String(_0x2e6a22)};}}[a5_0x1544ce(0x145)](){const _0x1b0a96=a5_0x1544ce;saveCronJobs(this['dc'],this[_0x1b0a96(0x11b)]);}[a5_0x1544ce(0x12e)](){const _0xcbb98=a5_0x1544ce,_0xbba2d4=Date[_0xcbb98(0xda)](),_0x31befd=0xea60-_0xbba2d4%0xea60;setTimeout(()=>{const _0x45d106=_0xcbb98;this['tick'](),this[_0x45d106(0xc7)]=setInterval(()=>this[_0x45d106(0xc3)](),0xea60);},_0x31befd);}['stopScheduler'](){const _0x560378=a5_0x1544ce;this[_0x560378(0xc7)]&&(clearInterval(this[_0x560378(0xc7)]),this[_0x560378(0xc7)]=null);}['tick'](){const _0x438a25=a5_0x1544ce,_0x226664=Date[_0x438a25(0xda)](),_0x58564d=this[_0x438a25(0x10e)]<0x0?_0x226664-_0x226664%0xea60:this[_0x438a25(0x10e)]+0xea60-this[_0x438a25(0x10e)]%0xea60,_0x276609=_0x226664-_0x226664%0xea60;for(let _0x24562d=_0x58564d;_0x24562d<=_0x276609;_0x24562d+=0xea60){const _0x207444=new Date(_0x24562d);if(!this[_0x438a25(0x133)](_0x207444))break;}this[_0x438a25(0x10e)]=_0x226664;}[a5_0x1544ce(0x133)](_0x33b4c7){const _0x8e4033=a5_0x1544ce;if(this['runningJobIds']['size']>=this['MAX_CONCURRENT_JOBS'])return console[_0x8e4033(0xb3)]('['+(0x0,session_1[_0x8e4033(0xe8)])()+_0x8e4033(0xd0)+this[_0x8e4033(0x10c)]+'),\x20跳过\x20'+_0x33b4c7[_0x8e4033(0xae)]()+'\x20的检查'),![];for(const _0x12c51d of this[_0x8e4033(0x11b)]){if(!_0x12c51d[_0x8e4033(0x13a)])continue;if(this[_0x8e4033(0x137)][_0x8e4033(0xe6)](_0x12c51d['id']))continue;if(this[_0x8e4033(0x137)][_0x8e4033(0xea)]>=this[_0x8e4033(0x10c)])break;if(!matchesCron(_0x12c51d[_0x8e4033(0xde)],_0x33b4c7))continue;console[_0x8e4033(0x100)]('['+(0x0,session_1['timestamp'])()+_0x8e4033(0xee)+_0x12c51d['id']+'\x20['+_0x12c51d[_0x8e4033(0xde)]+']\x20'+_0x12c51d[_0x8e4033(0xd4)]),this[_0x8e4033(0x136)](_0x12c51d)['catch'](_0x4fe5e9=>{const _0x5889fb=_0x8e4033;console[_0x5889fb(0xcc)]('['+(0x0,session_1['timestamp'])()+']\x20Cron执行失败:\x20'+_0x12c51d['id'],_0x4fe5e9);});}return!![];}async[a5_0x1544ce(0x136)](_0x15c054){const _0x955ccc=a5_0x1544ce;this[_0x955ccc(0x137)]['add'](_0x15c054['id']);try{const _0x54a031=this['dc']['getConversationConfig'](_0x15c054['conversationId']);if(!_0x54a031){console[_0x955ccc(0xb3)]('['+(0x0,session_1[_0x955ccc(0xe8)])()+_0x955ccc(0x117)+_0x15c054['id']+_0x955ccc(0xe7));return;}const _0x1c3184=!!(_0x54a031['dingToken']||this['dc']['config']['defaultDingToken']);if(!_0x1c3184){console[_0x955ccc(0xb3)]('['+(0x0,session_1[_0x955ccc(0xe8)])()+_0x955ccc(0x117)+_0x15c054['id']+_0x955ccc(0xcb));return;}const _0x50ea14=(0x0,session_1[_0x955ccc(0xd6)])(this['dc'],_0x15c054[_0x955ccc(0xf4)]);if(_0x50ea14){console['log']('['+(0x0,session_1[_0x955ccc(0xe8)])()+_0x955ccc(0x117)+_0x15c054['id']+_0x955ccc(0xb9)),await this[_0x955ccc(0x140)](_0x15c054);return;}const _0x4b6b1b=Date['now'](),_0x33aa28={'conversationId':_0x15c054[_0x955ccc(0xf4)],'sessionWebhook':'','startTime':_0x4b6b1b,'startTimeStr':utils_ok_1[_0x955ccc(0x113)]['mm'](_0x4b6b1b)['format'](_0x955ccc(0x13d)),'startStaffId':_0x15c054[_0x955ccc(0x120)],'startNickName':'[cron]'+_0x15c054[_0x955ccc(0xdb)]},_0x15941e=(0x0,session_1['getSessionDir'])(this['dc'],_0x33aa28);fs_1[_0x955ccc(0x114)][_0x955ccc(0x149)](_0x15941e,{'recursive':!![]}),fs_1[_0x955ccc(0x114)][_0x955ccc(0xdc)](_0x15941e+'/session.json',JSON[_0x955ccc(0xbd)](_0x33aa28,null,0x2),_0x955ccc(0xf9)),this['dc'][_0x955ccc(0xa7)]['set'](_0x15c054[_0x955ccc(0xf4)],{'session':_0x33aa28,'lastSenderStaffId':_0x15c054[_0x955ccc(0x120)],'isProcessing':!![],'messageQueue':[],'conversationConfig':_0x54a031}),(0x0,session_1[_0x955ccc(0xb8)])(this['dc'],_0x15c054[_0x955ccc(0xf4)]),console['log']('['+(0x0,session_1[_0x955ccc(0xe8)])()+']\x20Cron任务\x20'+_0x15c054['id']+_0x955ccc(0x111)+_0x15c054['description']),fs_1['default'][_0x955ccc(0xe2)](_0x15941e+'/session.log','['+(0x0,session_1[_0x955ccc(0xe8)])()+_0x955ccc(0xdd)+_0x15c054[_0x955ccc(0xd4)]+'\x0a',_0x955ccc(0xf9));try{await(0x0,claude_process_1[_0x955ccc(0x121)])(this['dc'],_0x33aa28,_0x15c054[_0x955ccc(0x112)],{'skill':_0x54a031[_0x955ccc(0x10d)]?.[_0x955ccc(0xf2)],'agent':_0x54a031[_0x955ccc(0x106)],'senderNick':_0x15c054['senderNick'],'senderStaffId':_0x15c054[_0x955ccc(0x120)]});}catch(_0x3b6e2f){console[_0x955ccc(0xcc)]('['+(0x0,session_1[_0x955ccc(0xe8)])()+_0x955ccc(0xdf)+_0x15c054['id'],_0x3b6e2f),await(0x0,messaging_1[_0x955ccc(0xd7)])(this['dc'],{'conversationId':_0x15c054[_0x955ccc(0xf4)],'sessionWebhook':'','atUserId':_0x15c054['senderStaffId'],'content':_0x955ccc(0x104)+(_0x3b6e2f instanceof Error?_0x3b6e2f[_0x955ccc(0x11d)]:String(_0x3b6e2f))});}finally{this['dc']['activeSessions'][_0x955ccc(0xe4)](_0x15c054['conversationId']),(0x0,session_1['saveActiveSession'])(this['dc'],_0x15c054[_0x955ccc(0xf4)]);}_0x15c054[_0x955ccc(0x102)]=(0x0,session_1[_0x955ccc(0xe8)])(),this['persist']();}finally{this[_0x955ccc(0x137)]['delete'](_0x15c054['id']);}}async['enqueueAsTask'](_0x23636d){const _0x2821e7=a5_0x1544ce;try{await(0x0,task_1['saveTask'])(this['dc'],{'conversationId':_0x23636d['conversationId'],'prompt':_0x23636d['prompt'],'senderStaffId':_0x23636d[_0x2821e7(0x120)],'senderNickName':_0x2821e7(0xbe)+_0x23636d[_0x2821e7(0xdb)],'sessionWebhook':'','type':_0x2821e7(0x116)}),console[_0x2821e7(0x100)]('['+(0x0,session_1['timestamp'])()+_0x2821e7(0x117)+_0x23636d['id']+'\x20已降级到任务队列:\x20'+_0x23636d['description']);}catch(_0x4d0fa7){console[_0x2821e7(0xcc)]('['+(0x0,session_1[_0x2821e7(0xe8)])()+']\x20Cron任务\x20'+_0x23636d['id']+_0x2821e7(0xb7),_0x4d0fa7);}_0x23636d[_0x2821e7(0x102)]=(0x0,session_1['timestamp'])(),this[_0x2821e7(0x145)]();}}exports[a5_0x1544ce(0xeb)]=CronEngine;
@@ -1 +1 @@
1
- 'use strict';const a6_0x5cfb92=a6_0x3109;(function(_0x3e5ecc,_0x12c06f){const _0x58c4be=a6_0x3109,_0x43e59a=_0x3e5ecc();while(!![]){try{const _0x34b000=parseInt(_0x58c4be(0x16b))/0x1+-parseInt(_0x58c4be(0x114))/0x2+parseInt(_0x58c4be(0x153))/0x3+-parseInt(_0x58c4be(0x119))/0x4+parseInt(_0x58c4be(0xf7))/0x5+parseInt(_0x58c4be(0x138))/0x6+parseInt(_0x58c4be(0x14f))/0x7;if(_0x34b000===_0x12c06f)break;else _0x43e59a['push'](_0x43e59a['shift']());}catch(_0xb6bd3d){_0x43e59a['push'](_0x43e59a['shift']());}}}(a6_0x37b4,0x9a120));var __importDefault=this&&this['__importDefault']||function(_0xad8d58){const _0x4009be=a6_0x3109;return _0xad8d58&&_0xad8d58[_0x4009be(0x16e)]?_0xad8d58:{'default':_0xad8d58};};Object['defineProperty'](exports,a6_0x5cfb92(0x16e),{'value':!![]}),exports[a6_0x5cfb92(0x10f)]=printDoctorResults,exports[a6_0x5cfb92(0x139)]=runDoctor;const session_1=require(a6_0x5cfb92(0xff)),api_key_manager_1=require(a6_0x5cfb92(0xfa)),fs_1=__importDefault(require('fs')),path_1=__importDefault(require(a6_0x5cfb92(0xf6))),child_process_1=require(a6_0x5cfb92(0xf5));function a6_0x37b4(){const _0x1691f3=['boolean','.cc-ding','default','cron.json\x20格式异常,无法解析为任务数组','951468vEfDFO','runDoctor',']\x20缺少\x20cronExpression','existsSync','PID\x20锁文件读取异常:\x20','config.json\x20不存在','baseUrl','\x20通过,\x20','linkConversationId','\x20缺少\x20apiKey','==========\x20cc-ding\x20doctor\x20==========','conversations\x20共\x20','\x20应为数组','settings-tpl.json\x20有效,env\x20包含:\x20','conversations\x20为空数组,可通过\x20/reg\x20命令动态注册','push','\x20conversationId\x20重复:\x20','log','jobs','test','filter','config.json\x20解析失败:\x20','.doctor-check','758821HsEszn','enabled','FATAL','join','2537082YsedkC','(空)','isValid','keys','conversations[','level','apiKeyCfg\x20未配置,无法使用\x20API\x20Key\x20池化轮换','apiKeyCfg.claudeSettings\x20不是数组','WARN','pipe','\x22\x20未在\x20config.json\x20conversations\x20中找到','PASS','\x20个定时任务\x20(','env','some','slice','exit','length','cron.json\x20共\x20','which\x20claude','version','parse','add','\x20缺少\x20baseUrl','781245PxWFos','客户端目录可写','cron.json','__esModule','settings-tpl.json','settings-tpl.json\x20不存在,创建\x20settings-ding.json\x20时将使用空模板','====================================\x0a','claude\x20命令不可用,请确认\x20Claude\x20Code\x20CLI\x20已安装','execSync','trim','\x20缺少\x20model','conversations','child_process','path','2007265oEQXgG','has','settings-tpl.json\x20根元素不是对象','./api-key-manager','model','Node\x20版本过低:','\x20已退出(过期锁文件)','dingToken','./session','config.json\x20解析成功','claudeSettings','\x20\x20❌\x20存在致命问题,请修复后重新运行','\x20apiKey\x20重复:\x20','cron.json\x20不存在\x20(无定时任务)','unlinkSync','apiKeyCfg','getHomeDir','split','claude\x20命令可用','\x20缺少\x20conversationId','utf-8','apiKeyCfg.claudeSettings[',']\x20缺少\x20prompt','\x20\x20✅\x20所有检查通过','printDoctorResults','string',',要求\x20Node\x20>=\x2024','message','\x20dingToken\x20仍为占位符','1311992CgQisG','apiKeyCfg.claudeSettings\x20为空,无备用\x20Key',']\x20缺少\x20conversationId','客户端目录不存在:\x20','无运行中的进程','4033220DLAzQc','owner:\x20','.pid.lock','cron.json[','apiKey','settings-tpl.json\x20解析失败:\x20','\x20isValid\x20类型异常:\x20','\x20个群配置','\x20启用)','resetTime','object','------------------------------------','缺少必填字段:\x20','config.json','defaultDingToken','锁文件存在但进程\x20','\x20仍为占位符:\x20','settingLabel','conversationId',']\x20缺少\x20id','\x20linkConversationId\x20\x22','whiteUserList','客户端目录存在:\x20','readFileSync','isArray','owner','prompt'];a6_0x37b4=function(){return _0x1691f3;};return a6_0x37b4();}function a6_0x3109(_0xaa4e80,_0x1b7796){_0xaa4e80=_0xaa4e80-0xf0;const _0x37b446=a6_0x37b4();let _0x3109c5=_0x37b446[_0xaa4e80];return _0x3109c5;}function printDoctorResults(_0x3271d6){const _0x3744af=a6_0x5cfb92;console[_0x3744af(0x149)](''),console[_0x3744af(0x149)](_0x3744af(0x142));const _0x45f194=_0x3271d6[_0x3744af(0x161)](_0x53cd74=>_0x53cd74[_0x3744af(0x158)]===_0x3744af(0x151));for(const _0x3c9889 of _0x3271d6){const _0x42d540=_0x3c9889[_0x3744af(0x158)]===_0x3744af(0x15e)?'✓':_0x3c9889[_0x3744af(0x158)]==='FATAL'?'✗':'⚠',_0x27e812=_0x3c9889['level']===_0x3744af(0x15e)?'':'['+_0x3c9889[_0x3744af(0x158)]+']\x20';console[_0x3744af(0x149)]('\x20\x20'+_0x42d540+'\x20'+_0x27e812+_0x3c9889['message']);}const _0x4e4adb=_0x3271d6['filter'](_0x73adf=>_0x73adf[_0x3744af(0x158)]===_0x3744af(0x15e))['length'],_0x46d0ab=_0x3271d6['filter'](_0x245b7d=>_0x245b7d['level']===_0x3744af(0x15b))[_0x3744af(0x164)],_0x4490b1=_0x3271d6[_0x3744af(0x14c)](_0x2e4208=>_0x2e4208[_0x3744af(0x158)]===_0x3744af(0x151))[_0x3744af(0x164)];console['log'](_0x3744af(0x124)),console[_0x3744af(0x149)]('\x20\x20合计:\x20'+_0x4e4adb+_0x3744af(0x13f)+_0x46d0ab+'\x20警告,\x20'+_0x4490b1+'\x20致命');_0x45f194?console[_0x3744af(0x149)](_0x3744af(0x102)):console['log'](_0x3744af(0x10e));console[_0x3744af(0x149)](_0x3744af(0x171));if(_0x45f194)process[_0x3744af(0x163)](0x1);}function runDoctor(_0x5317c6){const _0x42654b=a6_0x5cfb92,_0x22c9ad=[],_0x5ce4e3=process[_0x42654b(0x167)][_0x42654b(0x162)](0x1),_0x5a0179=parseInt(_0x5ce4e3[_0x42654b(0x108)]('.')[0x0],0xa);_0x5a0179<0x18?_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x42654b(0xfc)+_0x5ce4e3+_0x42654b(0x111))):_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),'Node\x20版本:'+_0x5ce4e3));if(!fs_1[_0x42654b(0x136)][_0x42654b(0x13b)](_0x5317c6))return _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x42654b(0x117)+_0x5317c6)),_0x22c9ad;_0x22c9ad['push'](check(_0x42654b(0x15e),_0x42654b(0x12f)+_0x5317c6));const _0x4c26c9=path_1[_0x42654b(0x136)]['join'](_0x5317c6,_0x42654b(0x11b));if(fs_1[_0x42654b(0x136)][_0x42654b(0x13b)](_0x4c26c9))try{const _0x336d3f=parseInt(fs_1['default'][_0x42654b(0x130)](_0x4c26c9,_0x42654b(0x10b))[_0x42654b(0xf2)](),0xa);if(!isNaN(_0x336d3f))try{process['kill'](_0x336d3f,0x0),_0x22c9ad[_0x42654b(0x147)](check('PASS','进程运行中\x20(PID:\x20'+_0x336d3f+')'));}catch{_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x128)+_0x336d3f+_0x42654b(0xfd)));}}catch{_0x22c9ad['push'](check('WARN',_0x42654b(0x13c)+_0x4c26c9));}else _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x42654b(0x118)));const _0x1a3612=path_1[_0x42654b(0x136)][_0x42654b(0x152)](_0x5317c6,_0x42654b(0x126));if(!fs_1[_0x42654b(0x136)][_0x42654b(0x13b)](_0x1a3612))return _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x42654b(0x13d))),_0x22c9ad;let _0x42e0f7;try{_0x42e0f7=JSON[_0x42654b(0x168)](fs_1[_0x42654b(0x136)][_0x42654b(0x130)](_0x1a3612,_0x42654b(0x10b)));}catch(_0x9030d2){return _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x42654b(0x14d)+(_0x9030d2 instanceof Error?_0x9030d2['message']:_0x9030d2))),_0x22c9ad;}_0x22c9ad['push'](check('PASS',_0x42654b(0x100)));const _0x10445d=[{'key':'clientSecret','label':'clientSecret'},{'key':_0x42654b(0x127),'label':_0x42654b(0x127)},{'key':_0x42654b(0x12e),'label':_0x42654b(0x12e),'isArr':!![]},{'key':_0x42654b(0x132),'label':_0x42654b(0x132)}];for(const {key:_0x1bae45,label:_0x1f86bd,isArr:_0x21fcc7}of _0x10445d){const _0x4b3d69=_0x42e0f7[_0x1bae45];if(_0x4b3d69===undefined||_0x4b3d69===null||_0x4b3d69==='')_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x42654b(0x125)+_0x1f86bd));else{if(_0x21fcc7&&!Array[_0x42654b(0x131)](_0x4b3d69))_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x1f86bd+_0x42654b(0x144)));else{if(_0x1bae45!==_0x42654b(0xf4)&&_0x21fcc7&&_0x4b3d69[_0x42654b(0x164)]===0x0)_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x1f86bd+'\x20为空数组'));else!_0x21fcc7&&typeof _0x4b3d69===_0x42654b(0x110)&&_0x4b3d69['startsWith']('<')?_0x22c9ad['push'](check('FATAL',_0x1f86bd+_0x42654b(0x129)+_0x4b3d69)):_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x1f86bd+'\x20✓'));}}}_0x42e0f7['owner']?_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x42654b(0x11a)+_0x42e0f7[_0x42654b(0x132)])):_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),'owner\x20未配置,管理命令(/clean,\x20/open,\x20/reset-apikeycfg,\x20/reg,\x20/auth)不可用'));const _0x5563fb=['clientSecret',_0x42654b(0x127)];for(const _0x33ca0c of _0x5563fb){const _0x3b8e07=_0x42e0f7[_0x33ca0c];typeof _0x3b8e07==='string'&&/^<.*>$/[_0x42654b(0x14b)](_0x3b8e07[_0x42654b(0xf2)]())&&_0x22c9ad['push'](check(_0x42654b(0x151),_0x33ca0c+_0x42654b(0x129)+_0x3b8e07));}const _0x3ed8b6=new Set();if(!Array[_0x42654b(0x131)](_0x42e0f7[_0x42654b(0xf4)]))_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),'conversations\x20应为数组'));else{if(_0x42e0f7[_0x42654b(0xf4)]['length']===0x0)_0x22c9ad['push'](check(_0x42654b(0x15e),_0x42654b(0x146)));else{for(let _0x5a1a1b=0x0;_0x5a1a1b<_0x42e0f7[_0x42654b(0xf4)][_0x42654b(0x164)];_0x5a1a1b++){const _0x2826dd=_0x42e0f7[_0x42654b(0xf4)][_0x5a1a1b],_0x1105f2=_0x42654b(0x157)+_0x5a1a1b+']';if(!_0x2826dd[_0x42654b(0x12b)])_0x22c9ad[_0x42654b(0x147)](check('FATAL',_0x1105f2+_0x42654b(0x10a)));else{if(typeof _0x2826dd[_0x42654b(0x12b)]===_0x42654b(0x110)&&/^<.*>$/[_0x42654b(0x14b)](_0x2826dd[_0x42654b(0x12b)][_0x42654b(0xf2)]()))_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x1105f2+'\x20conversationId\x20仍为占位符:\x20'+_0x2826dd[_0x42654b(0x12b)]));else _0x3ed8b6[_0x42654b(0xf8)](_0x2826dd[_0x42654b(0x12b)])?_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x1105f2+_0x42654b(0x148)+_0x2826dd['conversationId'])):_0x3ed8b6[_0x42654b(0x169)](_0x2826dd[_0x42654b(0x12b)]);}_0x2826dd[_0x42654b(0x140)]&&!_0x42e0f7[_0x42654b(0xf4)][_0x42654b(0x161)](_0x350015=>_0x350015[_0x42654b(0x12b)]===_0x2826dd[_0x42654b(0x140)])&&_0x22c9ad[_0x42654b(0x147)](check('WARN',_0x1105f2+_0x42654b(0x12d)+_0x2826dd[_0x42654b(0x140)]+'\x22\x20未在\x20conversations\x20中找到')),_0x2826dd['dingToken']&&typeof _0x2826dd[_0x42654b(0xfe)]===_0x42654b(0x110)&&/^<.*>$/[_0x42654b(0x14b)](_0x2826dd[_0x42654b(0xfe)][_0x42654b(0xf2)]())&&_0x22c9ad['push'](check(_0x42654b(0x15b),_0x1105f2+_0x42654b(0x113)));}_0x22c9ad[_0x42654b(0x147)](check('PASS',_0x42654b(0x143)+_0x42e0f7[_0x42654b(0xf4)][_0x42654b(0x164)]+_0x42654b(0x120)));}}if(_0x42e0f7['apiKeyCfg']){const _0x2c1530=_0x42e0f7[_0x42654b(0x106)];_0x2c1530[_0x42654b(0x122)]&&_0x22c9ad['push'](check(_0x42654b(0x15e),'apiKeyCfg.resetTime:\x20'+_0x2c1530[_0x42654b(0x122)]));if(!Array['isArray'](_0x2c1530[_0x42654b(0x101)]))_0x22c9ad[_0x42654b(0x147)](check('WARN',_0x42654b(0x15a)));else{if(_0x2c1530[_0x42654b(0x101)]['length']===0x0)_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x115)));else{const _0x2bedea=new Set();for(let _0x38e3b6=0x0;_0x38e3b6<_0x2c1530['claudeSettings'][_0x42654b(0x164)];_0x38e3b6++){const _0x4221eb=_0x2c1530[_0x42654b(0x101)][_0x38e3b6],_0x28cd77=_0x42654b(0x10c)+_0x38e3b6+']';if(!_0x4221eb[_0x42654b(0x11d)])_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x28cd77+_0x42654b(0x141)));else _0x2bedea['has'](_0x4221eb[_0x42654b(0x11d)])?_0x22c9ad['push'](check(_0x42654b(0x15b),_0x28cd77+_0x42654b(0x103)+(0x0,api_key_manager_1[_0x42654b(0x12a)])(_0x4221eb))):_0x2bedea['add'](_0x4221eb[_0x42654b(0x11d)]);if(!_0x4221eb[_0x42654b(0x13e)])_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x28cd77+_0x42654b(0x16a)));if(!_0x4221eb[_0x42654b(0xfb)])_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x28cd77+_0x42654b(0xf3)));if(typeof _0x4221eb[_0x42654b(0x155)]!==_0x42654b(0x134))_0x22c9ad['push'](check(_0x42654b(0x15b),_0x28cd77+_0x42654b(0x11f)+typeof _0x4221eb['isValid']));}const _0x11d5f2=_0x2c1530['claudeSettings'][_0x42654b(0x14c)](_0x159a53=>_0x159a53[_0x42654b(0x155)])[_0x42654b(0x164)];_0x22c9ad[_0x42654b(0x147)](check('PASS','apiKeyCfg.claudeSettings\x20共\x20'+_0x2c1530[_0x42654b(0x101)][_0x42654b(0x164)]+'\x20项,有效\x20'+_0x11d5f2));}}}else _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x159)));const _0x2e368d=path_1[_0x42654b(0x136)]['join'](_0x5317c6,_0x42654b(0x16d));if(fs_1[_0x42654b(0x136)]['existsSync'](_0x2e368d))try{const _0x5ce107=JSON[_0x42654b(0x168)](fs_1['default'][_0x42654b(0x130)](_0x2e368d,_0x42654b(0x10b))),_0x5f1161=Array[_0x42654b(0x131)](_0x5ce107)?_0x5ce107:_0x5ce107[_0x42654b(0x14a)];if(Array[_0x42654b(0x131)](_0x5f1161)){const _0x169ae6=_0x5f1161['filter'](_0x59b886=>_0x59b886[_0x42654b(0x150)]!==![])['length'];_0x22c9ad['push'](check(_0x42654b(0x15e),_0x42654b(0x165)+_0x5f1161[_0x42654b(0x164)]+_0x42654b(0x15f)+_0x169ae6+_0x42654b(0x121)));for(let _0x236db2=0x0;_0x236db2<_0x5f1161['length'];_0x236db2++){const _0x453afb=_0x5f1161[_0x236db2];if(!_0x453afb['id'])_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x11c)+_0x236db2+_0x42654b(0x12c)));if(!_0x453afb['cronExpression'])_0x22c9ad['push'](check('WARN','cron.json['+_0x236db2+_0x42654b(0x13a)));if(!_0x453afb[_0x42654b(0x133)])_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x11c)+_0x236db2+_0x42654b(0x10d)));if(!_0x453afb['conversationId'])_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),'cron.json['+_0x236db2+_0x42654b(0x116)));else!_0x3ed8b6[_0x42654b(0xf8)](_0x453afb[_0x42654b(0x12b)])&&_0x22c9ad['push'](check(_0x42654b(0x15b),_0x42654b(0x11c)+_0x236db2+']\x20conversationId\x20\x22'+_0x453afb['conversationId']+_0x42654b(0x15d)));}}else _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x137)));}catch(_0x23941f){_0x22c9ad['push'](check(_0x42654b(0x15b),'cron.json\x20解析失败:\x20'+(_0x23941f instanceof Error?_0x23941f[_0x42654b(0x112)]:_0x23941f)));}else _0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x42654b(0x104)));const _0x4cb73b=path_1['default'][_0x42654b(0x152)]((0x0,session_1[_0x42654b(0x107)])(),_0x42654b(0x135),_0x42654b(0x16f));if(fs_1['default'][_0x42654b(0x13b)](_0x4cb73b))try{const _0x380d2d=JSON[_0x42654b(0x168)](fs_1['default'][_0x42654b(0x130)](_0x4cb73b,_0x42654b(0x10b)));if(typeof _0x380d2d!==_0x42654b(0x123)||_0x380d2d===null)_0x22c9ad[_0x42654b(0x147)](check('WARN',_0x42654b(0xf9)));else{if(!_0x380d2d[_0x42654b(0x160)]||typeof _0x380d2d[_0x42654b(0x160)]!==_0x42654b(0x123))_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),'settings-tpl.json\x20缺少\x20env\x20字段'));else{const _0x20639b=Object[_0x42654b(0x156)](_0x380d2d[_0x42654b(0x160)]);_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x42654b(0x145)+(_0x20639b['join'](',\x20')||_0x42654b(0x154))));}}}catch(_0x40694d){_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15b),_0x42654b(0x11e)+(_0x40694d instanceof Error?_0x40694d[_0x42654b(0x112)]:_0x40694d)));}else _0x22c9ad['push'](check(_0x42654b(0x15b),_0x42654b(0x170)));try{(0x0,child_process_1[_0x42654b(0xf1)])(_0x42654b(0x166),{'stdio':_0x42654b(0x15c)}),_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x42654b(0x109)));}catch{_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),_0x42654b(0xf0)));}try{const _0x228cbf=path_1[_0x42654b(0x136)]['join'](_0x5317c6,_0x42654b(0x14e));fs_1[_0x42654b(0x136)]['writeFileSync'](_0x228cbf,'ok',_0x42654b(0x10b)),fs_1[_0x42654b(0x136)][_0x42654b(0x105)](_0x228cbf),_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x15e),_0x42654b(0x16c)));}catch(_0x56ca35){_0x22c9ad[_0x42654b(0x147)](check(_0x42654b(0x151),'客户端目录不可写:\x20'+(_0x56ca35 instanceof Error?_0x56ca35[_0x42654b(0x112)]:_0x56ca35)));}return _0x22c9ad;}function check(_0x592152,_0x530553){return{'level':_0x592152,'message':_0x530553};}
1
+ 'use strict';function a6_0x2da8(_0xe00728,_0x1f1533){_0xe00728=_0xe00728-0xde;const _0x4cdfdf=a6_0x4cdf();let _0x2da8f0=_0x4cdfdf[_0xe00728];return _0x2da8f0;}const a6_0x5c0e0b=a6_0x2da8;(function(_0x51605e,_0x3d4932){const _0x3f7901=a6_0x2da8,_0x36f494=_0x51605e();while(!![]){try{const _0x5a869a=-parseInt(_0x3f7901(0x10b))/0x1*(-parseInt(_0x3f7901(0xf0))/0x2)+parseInt(_0x3f7901(0x103))/0x3+-parseInt(_0x3f7901(0x151))/0x4+parseInt(_0x3f7901(0x11e))/0x5*(-parseInt(_0x3f7901(0x120))/0x6)+parseInt(_0x3f7901(0x12b))/0x7+parseInt(_0x3f7901(0x102))/0x8*(-parseInt(_0x3f7901(0x161))/0x9)+-parseInt(_0x3f7901(0x144))/0xa;if(_0x5a869a===_0x3d4932)break;else _0x36f494['push'](_0x36f494['shift']());}catch(_0x4c2d9b){_0x36f494['push'](_0x36f494['shift']());}}}(a6_0x4cdf,0x53602));var __importDefault=this&&this[a6_0x5c0e0b(0x127)]||function(_0x54c389){const _0x381bfd=a6_0x5c0e0b;return _0x54c389&&_0x54c389[_0x381bfd(0x111)]?_0x54c389:{'default':_0x54c389};};Object[a6_0x5c0e0b(0xee)](exports,a6_0x5c0e0b(0x111),{'value':!![]}),exports[a6_0x5c0e0b(0x138)]=printDoctorResults,exports[a6_0x5c0e0b(0xef)]=runDoctor;const session_1=require(a6_0x5c0e0b(0x145)),api_key_manager_1=require(a6_0x5c0e0b(0xf1)),fs_1=__importDefault(require('fs')),path_1=__importDefault(require('path')),child_process_1=require(a6_0x5c0e0b(0x130));function a6_0x4cdf(){const _0xa68620=['runDoctor','1720EdQQoi','./api-key-manager','\x20应为数组','\x20通过,\x20','getHomeDir','cron.json\x20不存在\x20(无定时任务)','cron.json\x20格式异常,无法解析为任务数组','trim','env','\x20缺少\x20conversationId','PASS','some','Node\x20版本:','==========\x20cc-ding\x20doctor\x20==========','\x20dingToken\x20仍为占位符','isValid','slice','settings-tpl.json\x20有效,env\x20包含:\x20','8ajHGle','1249128lLlKty','客户端目录不存在:\x20','.doctor-check','model','owner','utf-8',']\x20缺少\x20conversationId','.pid.lock','705JQejan',']\x20conversationId\x20\x22','conversations\x20为空数组,可通过\x20/reg\x20命令动态注册','\x20conversationId\x20重复:\x20','\x20apiKey\x20重复:\x20','readFileSync','__esModule','object','apiKeyCfg.claudeSettings\x20共\x20','writeFileSync','add','\x22\x20未在\x20conversations\x20中找到','join','push','apiKeyCfg','conversationId','jobs','conversations\x20应为数组','dingToken','150lCcEoP','缺少必填字段:\x20','27870PhcZCs','split','客户端目录可写','log','锁文件存在但进程\x20','FATAL','string','__importDefault','filter','\x20conversationId\x20仍为占位符:\x20','\x20仍为占位符:\x20','1985851ntFHov','config.json\x20解析成功','baseUrl','length','\x20启用)','child_process','settings-tpl.json\x20根元素不是对象',']\x20缺少\x20prompt','conversations','客户端目录存在:\x20','cronExpression','claudeSettings','boolean','printDoctorResults','resetTime',']\x20缺少\x20id','无运行中的进程','whiteUserList','\x20为空数组','enabled','config.json','test','客户端目录不可写:\x20','default','conversations\x20共\x20','1738430jcNoAh','./session','------------------------------------','claude\x20命令可用','WARN','.cc-ding','exit','PID\x20锁文件读取异常:\x20','claude\x20命令不可用,请确认\x20Claude\x20Code\x20CLI\x20已安装','existsSync','\x20缺少\x20apiKey','settings-tpl.json','conversations[','2495492SgnhdX','\x20已退出(过期锁文件)','isArray','进程运行中\x20(PID:\x20','\x20致命','pipe','has','level','execSync','\x20缺少\x20model','clientSecret','settingLabel','apiKey','cron.json[','linkConversationId','which\x20claude','250173KPkpvk','owner\x20未配置,管理命令(/clean,\x20/open,\x20/reset-apikeycfg,\x20/reg,\x20/auth)不可用','\x20个群配置',',要求\x20Node\x20>=\x2024','cron.json','apiKeyCfg\x20未配置,无法使用\x20API\x20Key\x20池化轮换','message','settings-tpl.json\x20解析失败:\x20','cron.json\x20解析失败:\x20','\x20\x20✅\x20所有检查通过','\x20缺少\x20baseUrl','settings-tpl.json\x20缺少\x20env\x20字段','startsWith','(空)','defaultDingToken','version','keys','Node\x20版本过低:','defineProperty'];a6_0x4cdf=function(){return _0xa68620;};return a6_0x4cdf();}function printDoctorResults(_0x4321eb){const _0x3c1283=a6_0x5c0e0b;console[_0x3c1283(0x123)](''),console['log'](_0x3c1283(0xfd));const _0x3517a4=_0x4321eb[_0x3c1283(0xfb)](_0x20183c=>_0x20183c['level']===_0x3c1283(0x125));for(const _0x1f7131 of _0x4321eb){const _0x5ba1bb=_0x1f7131[_0x3c1283(0x158)]===_0x3c1283(0xfa)?'✓':_0x1f7131['level']===_0x3c1283(0x125)?'✗':'⚠',_0x465432=_0x1f7131[_0x3c1283(0x158)]==='PASS'?'':'['+_0x1f7131[_0x3c1283(0x158)]+']\x20';console[_0x3c1283(0x123)]('\x20\x20'+_0x5ba1bb+'\x20'+_0x465432+_0x1f7131[_0x3c1283(0xe2)]);}const _0x210eeb=_0x4321eb[_0x3c1283(0x128)](_0x320af5=>_0x320af5[_0x3c1283(0x158)]==='PASS')[_0x3c1283(0x12e)],_0x441356=_0x4321eb[_0x3c1283(0x128)](_0x36d8f0=>_0x36d8f0[_0x3c1283(0x158)]==='WARN')[_0x3c1283(0x12e)],_0x41e78a=_0x4321eb[_0x3c1283(0x128)](_0x4b1b92=>_0x4b1b92['level']==='FATAL')['length'];console[_0x3c1283(0x123)](_0x3c1283(0x146)),console[_0x3c1283(0x123)]('\x20\x20合计:\x20'+_0x210eeb+_0x3c1283(0xf3)+_0x441356+'\x20警告,\x20'+_0x41e78a+_0x3c1283(0x155));_0x3517a4?console[_0x3c1283(0x123)]('\x20\x20❌\x20存在致命问题,请修复后重新运行'):console[_0x3c1283(0x123)](_0x3c1283(0xe5));console[_0x3c1283(0x123)]('====================================\x0a');if(_0x3517a4)process[_0x3c1283(0x14a)](0x1);}function runDoctor(_0x5ef620){const _0x20fba2=a6_0x5c0e0b,_0x846b9a=[],_0x72bbd8=process[_0x20fba2(0xeb)][_0x20fba2(0x100)](0x1),_0x2276a0=parseInt(_0x72bbd8[_0x20fba2(0x121)]('.')[0x0],0xa);_0x2276a0<0x18?_0x846b9a['push'](check(_0x20fba2(0x125),_0x20fba2(0xed)+_0x72bbd8+_0x20fba2(0xdf))):_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x20fba2(0xfc)+_0x72bbd8));if(!fs_1[_0x20fba2(0x142)][_0x20fba2(0x14d)](_0x5ef620))return _0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x20fba2(0x104)+_0x5ef620)),_0x846b9a;_0x846b9a['push'](check(_0x20fba2(0xfa),_0x20fba2(0x134)+_0x5ef620));const _0x1eb563=path_1[_0x20fba2(0x142)][_0x20fba2(0x117)](_0x5ef620,_0x20fba2(0x10a));if(fs_1[_0x20fba2(0x142)][_0x20fba2(0x14d)](_0x1eb563))try{const _0x3b6658=parseInt(fs_1[_0x20fba2(0x142)][_0x20fba2(0x110)](_0x1eb563,_0x20fba2(0x108))['trim'](),0xa);if(!isNaN(_0x3b6658))try{process['kill'](_0x3b6658,0x0),_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x20fba2(0x154)+_0x3b6658+')'));}catch{_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0x124)+_0x3b6658+_0x20fba2(0x152)));}}catch{_0x846b9a[_0x20fba2(0x118)](check('WARN',_0x20fba2(0x14b)+_0x1eb563));}else _0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x20fba2(0x13b)));const _0x24ad68=path_1['default']['join'](_0x5ef620,_0x20fba2(0x13f));if(!fs_1[_0x20fba2(0x142)][_0x20fba2(0x14d)](_0x24ad68))return _0x846b9a[_0x20fba2(0x118)](check('FATAL','config.json\x20不存在')),_0x846b9a;let _0x22875e;try{_0x22875e=JSON['parse'](fs_1['default'][_0x20fba2(0x110)](_0x24ad68,'utf-8'));}catch(_0x4015a9){return _0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),'config.json\x20解析失败:\x20'+(_0x4015a9 instanceof Error?_0x4015a9['message']:_0x4015a9))),_0x846b9a;}_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x20fba2(0x12c)));const _0x37075=[{'key':_0x20fba2(0x15b),'label':_0x20fba2(0x15b)},{'key':'defaultDingToken','label':_0x20fba2(0xea)},{'key':_0x20fba2(0x13c),'label':_0x20fba2(0x13c),'isArr':!![]},{'key':'owner','label':'owner'}];for(const {key:_0x33cc9e,label:_0x1a3807,isArr:_0x3d1134}of _0x37075){const _0x105459=_0x22875e[_0x33cc9e];if(_0x105459===undefined||_0x105459===null||_0x105459==='')_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x20fba2(0x11f)+_0x1a3807));else{if(_0x3d1134&&!Array[_0x20fba2(0x153)](_0x105459))_0x846b9a['push'](check(_0x20fba2(0x125),_0x1a3807+_0x20fba2(0xf2)));else{if(_0x33cc9e!==_0x20fba2(0x133)&&_0x3d1134&&_0x105459[_0x20fba2(0x12e)]===0x0)_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x1a3807+_0x20fba2(0x13d)));else!_0x3d1134&&typeof _0x105459===_0x20fba2(0x126)&&_0x105459[_0x20fba2(0xe8)]('<')?_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x1a3807+_0x20fba2(0x12a)+_0x105459)):_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x1a3807+'\x20✓'));}}}_0x22875e[_0x20fba2(0x107)]?_0x846b9a['push'](check(_0x20fba2(0xfa),'owner:\x20'+_0x22875e[_0x20fba2(0x107)])):_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x20fba2(0x162)));const _0x4000a1=[_0x20fba2(0x15b),'defaultDingToken'];for(const _0x27a3a0 of _0x4000a1){const _0x512923=_0x22875e[_0x27a3a0];typeof _0x512923===_0x20fba2(0x126)&&/^<.*>$/[_0x20fba2(0x140)](_0x512923[_0x20fba2(0xf7)]())&&_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x27a3a0+_0x20fba2(0x12a)+_0x512923));}const _0x1b9cd8=new Set();if(!Array['isArray'](_0x22875e[_0x20fba2(0x133)]))_0x846b9a['push'](check(_0x20fba2(0x125),_0x20fba2(0x11c)));else{if(_0x22875e[_0x20fba2(0x133)]['length']===0x0)_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x20fba2(0x10d)));else{for(let _0x332ff9=0x0;_0x332ff9<_0x22875e[_0x20fba2(0x133)]['length'];_0x332ff9++){const _0x30f1e8=_0x22875e['conversations'][_0x332ff9],_0x26166b=_0x20fba2(0x150)+_0x332ff9+']';if(!_0x30f1e8[_0x20fba2(0x11a)])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x26166b+_0x20fba2(0xf9)));else{if(typeof _0x30f1e8[_0x20fba2(0x11a)]==='string'&&/^<.*>$/[_0x20fba2(0x140)](_0x30f1e8['conversationId'][_0x20fba2(0xf7)]()))_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x26166b+_0x20fba2(0x129)+_0x30f1e8[_0x20fba2(0x11a)]));else _0x1b9cd8['has'](_0x30f1e8[_0x20fba2(0x11a)])?_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x26166b+_0x20fba2(0x10e)+_0x30f1e8[_0x20fba2(0x11a)])):_0x1b9cd8[_0x20fba2(0x115)](_0x30f1e8['conversationId']);}_0x30f1e8[_0x20fba2(0x15f)]&&!_0x22875e[_0x20fba2(0x133)][_0x20fba2(0xfb)](_0x430162=>_0x430162[_0x20fba2(0x11a)]===_0x30f1e8[_0x20fba2(0x15f)])&&_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x26166b+'\x20linkConversationId\x20\x22'+_0x30f1e8[_0x20fba2(0x15f)]+_0x20fba2(0x116))),_0x30f1e8[_0x20fba2(0x11d)]&&typeof _0x30f1e8[_0x20fba2(0x11d)]===_0x20fba2(0x126)&&/^<.*>$/[_0x20fba2(0x140)](_0x30f1e8[_0x20fba2(0x11d)]['trim']())&&_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x26166b+_0x20fba2(0xfe)));}_0x846b9a[_0x20fba2(0x118)](check('PASS',_0x20fba2(0x143)+_0x22875e[_0x20fba2(0x133)]['length']+_0x20fba2(0xde)));}}if(_0x22875e[_0x20fba2(0x119)]){const _0x128176=_0x22875e[_0x20fba2(0x119)];_0x128176[_0x20fba2(0x139)]&&_0x846b9a[_0x20fba2(0x118)](check('PASS','apiKeyCfg.resetTime:\x20'+_0x128176[_0x20fba2(0x139)]));if(!Array[_0x20fba2(0x153)](_0x128176[_0x20fba2(0x136)]))_0x846b9a['push'](check('WARN','apiKeyCfg.claudeSettings\x20不是数组'));else{if(_0x128176[_0x20fba2(0x136)][_0x20fba2(0x12e)]===0x0)_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),'apiKeyCfg.claudeSettings\x20为空,无备用\x20Key'));else{const _0x30e8ac=new Set();for(let _0x34195f=0x0;_0x34195f<_0x128176[_0x20fba2(0x136)]['length'];_0x34195f++){const _0x154d11=_0x128176[_0x20fba2(0x136)][_0x34195f],_0x53f535='apiKeyCfg.claudeSettings['+_0x34195f+']';if(!_0x154d11[_0x20fba2(0x15d)])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x53f535+_0x20fba2(0x14e)));else _0x30e8ac['has'](_0x154d11[_0x20fba2(0x15d)])?_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x53f535+_0x20fba2(0x10f)+(0x0,api_key_manager_1[_0x20fba2(0x15c)])(_0x154d11))):_0x30e8ac[_0x20fba2(0x115)](_0x154d11[_0x20fba2(0x15d)]);if(!_0x154d11[_0x20fba2(0x12d)])_0x846b9a[_0x20fba2(0x118)](check('WARN',_0x53f535+_0x20fba2(0xe6)));if(!_0x154d11[_0x20fba2(0x106)])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x53f535+_0x20fba2(0x15a)));if(typeof _0x154d11[_0x20fba2(0xff)]!==_0x20fba2(0x137))_0x846b9a[_0x20fba2(0x118)](check('WARN',_0x53f535+'\x20isValid\x20类型异常:\x20'+typeof _0x154d11['isValid']));}const _0x66d4b0=_0x128176[_0x20fba2(0x136)][_0x20fba2(0x128)](_0x4508a0=>_0x4508a0[_0x20fba2(0xff)])[_0x20fba2(0x12e)];_0x846b9a['push'](check(_0x20fba2(0xfa),_0x20fba2(0x113)+_0x128176[_0x20fba2(0x136)][_0x20fba2(0x12e)]+'\x20项,有效\x20'+_0x66d4b0));}}}else _0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0xe1)));const _0x1f076e=path_1[_0x20fba2(0x142)][_0x20fba2(0x117)](_0x5ef620,_0x20fba2(0xe0));if(fs_1['default'][_0x20fba2(0x14d)](_0x1f076e))try{const _0x12455d=JSON['parse'](fs_1['default'][_0x20fba2(0x110)](_0x1f076e,_0x20fba2(0x108))),_0x160bad=Array[_0x20fba2(0x153)](_0x12455d)?_0x12455d:_0x12455d[_0x20fba2(0x11b)];if(Array[_0x20fba2(0x153)](_0x160bad)){const _0x330eb6=_0x160bad[_0x20fba2(0x128)](_0xcb7362=>_0xcb7362[_0x20fba2(0x13e)]!==![])[_0x20fba2(0x12e)];_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),'cron.json\x20共\x20'+_0x160bad[_0x20fba2(0x12e)]+'\x20个定时任务\x20('+_0x330eb6+_0x20fba2(0x12f)));for(let _0x168ebe=0x0;_0x168ebe<_0x160bad['length'];_0x168ebe++){const _0x201ee6=_0x160bad[_0x168ebe];if(!_0x201ee6['id'])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0x15e)+_0x168ebe+_0x20fba2(0x13a)));if(!_0x201ee6[_0x20fba2(0x135)])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0x15e)+_0x168ebe+']\x20缺少\x20cronExpression'));if(!_0x201ee6['prompt'])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0x15e)+_0x168ebe+_0x20fba2(0x132)));if(!_0x201ee6[_0x20fba2(0x11a)])_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0x15e)+_0x168ebe+_0x20fba2(0x109)));else!_0x1b9cd8[_0x20fba2(0x157)](_0x201ee6[_0x20fba2(0x11a)])&&_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),'cron.json['+_0x168ebe+_0x20fba2(0x10c)+_0x201ee6[_0x20fba2(0x11a)]+'\x22\x20未在\x20config.json\x20conversations\x20中找到'));}}else _0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0xf6)));}catch(_0x5924e5){_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0xe4)+(_0x5924e5 instanceof Error?_0x5924e5[_0x20fba2(0xe2)]:_0x5924e5)));}else _0x846b9a['push'](check(_0x20fba2(0xfa),_0x20fba2(0xf5)));const _0x2d3de6=path_1[_0x20fba2(0x142)][_0x20fba2(0x117)]((0x0,session_1[_0x20fba2(0xf4)])(),_0x20fba2(0x149),_0x20fba2(0x14f));if(fs_1[_0x20fba2(0x142)][_0x20fba2(0x14d)](_0x2d3de6))try{const _0x298b65=JSON['parse'](fs_1[_0x20fba2(0x142)]['readFileSync'](_0x2d3de6,_0x20fba2(0x108)));if(typeof _0x298b65!=='object'||_0x298b65===null)_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0x131)));else{if(!_0x298b65['env']||typeof _0x298b65[_0x20fba2(0xf8)]!==_0x20fba2(0x112))_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0xe7)));else{const _0x3ac84a=Object[_0x20fba2(0xec)](_0x298b65['env']);_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0xfa),_0x20fba2(0x101)+(_0x3ac84a[_0x20fba2(0x117)](',\x20')||_0x20fba2(0xe9))));}}}catch(_0x49150b){_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x148),_0x20fba2(0xe3)+(_0x49150b instanceof Error?_0x49150b['message']:_0x49150b)));}else _0x846b9a['push'](check(_0x20fba2(0x148),'settings-tpl.json\x20不存在,创建\x20settings-ding.json\x20时将使用空模板'));try{(0x0,child_process_1[_0x20fba2(0x159)])(_0x20fba2(0x160),{'stdio':_0x20fba2(0x156)}),_0x846b9a[_0x20fba2(0x118)](check('PASS',_0x20fba2(0x147)));}catch{_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x20fba2(0x14c)));}try{const _0x1a583b=path_1[_0x20fba2(0x142)]['join'](_0x5ef620,_0x20fba2(0x105));fs_1['default'][_0x20fba2(0x114)](_0x1a583b,'ok','utf-8'),fs_1['default']['unlinkSync'](_0x1a583b),_0x846b9a[_0x20fba2(0x118)](check('PASS',_0x20fba2(0x122)));}catch(_0xaf027c){_0x846b9a[_0x20fba2(0x118)](check(_0x20fba2(0x125),_0x20fba2(0x141)+(_0xaf027c instanceof Error?_0xaf027c[_0x20fba2(0xe2)]:_0xaf027c)));}return _0x846b9a;}function check(_0x9431b,_0x45fbec){return{'level':_0x9431b,'message':_0x45fbec};}
@@ -1 +1 @@
1
- 'use strict';const a7_0x4ac058=a7_0x1fee;(function(_0x5acc13,_0xe4d7e3){const _0x26b44e=a7_0x1fee,_0x2e37e4=_0x5acc13();while(!![]){try{const _0x5c3cf4=parseInt(_0x26b44e(0xae))/0x1*(parseInt(_0x26b44e(0xa2))/0x2)+-parseInt(_0x26b44e(0xc9))/0x3*(parseInt(_0x26b44e(0x8b))/0x4)+-parseInt(_0x26b44e(0x92))/0x5*(-parseInt(_0x26b44e(0xb2))/0x6)+-parseInt(_0x26b44e(0x95))/0x7+parseInt(_0x26b44e(0x7c))/0x8+-parseInt(_0x26b44e(0x91))/0x9*(parseInt(_0x26b44e(0xc0))/0xa)+parseInt(_0x26b44e(0x8d))/0xb*(parseInt(_0x26b44e(0x98))/0xc);if(_0x5c3cf4===_0xe4d7e3)break;else _0x2e37e4['push'](_0x2e37e4['shift']());}catch(_0x428db6){_0x2e37e4['push'](_0x2e37e4['shift']());}}}(a7_0x100a,0xd2356));var __importDefault=this&&this[a7_0x4ac058(0x7b)]||function(_0x44ec8e){return _0x44ec8e&&_0x44ec8e['__esModule']?_0x44ec8e:{'default':_0x44ec8e};};Object[a7_0x4ac058(0x9f)](exports,a7_0x4ac058(0x6c),{'value':!![]}),exports[a7_0x4ac058(0xaa)]=runOcr,exports['processPictureMessage']=processPictureMessage,exports[a7_0x4ac058(0xbe)]=processRichTextMessage;const child_process_1=require(a7_0x4ac058(0x90)),fs_1=__importDefault(require('fs')),path_1=__importDefault(require('path')),urllib_1=__importDefault(require(a7_0x4ac058(0x75))),session_1=require(a7_0x4ac058(0x89)),common_1=require(a7_0x4ac058(0xc4)),MAX_IMAGE_SIZE=0xa*0x400*0x400,DING_API_BASE=a7_0x4ac058(0x9b),OCR_PREAMBLE=a7_0x4ac058(0xa8),OCR_BIN_DIR=(0x0,common_1[a7_0x4ac058(0xba)])()[a7_0x4ac058(0xbd)](),cachedOcrBinPath=((()=>{const _0x210fdf=a7_0x4ac058;if(process[_0x210fdf(0x68)]==='win32')return null;const _0x2bf002=process[_0x210fdf(0xc1)];if(_0x2bf002==='arm64')return path_1['default'][_0x210fdf(0x7d)](OCR_BIN_DIR,'ocr-arm64');if(_0x2bf002===_0x210fdf(0xa6))return path_1[_0x210fdf(0xb9)][_0x210fdf(0x7d)](OCR_BIN_DIR,'ocr-x64');return null;})());let ocrBinExists=null;async function runOcr(_0x5232b4){const _0x2a3ccd=a7_0x4ac058;if(!cachedOcrBinPath)return console[_0x2a3ccd(0x81)]('['+(0x0,session_1[_0x2a3ccd(0x8e)])()+_0x2a3ccd(0xc2)+process[_0x2a3ccd(0x68)]+'/'+process[_0x2a3ccd(0xc1)]+_0x2a3ccd(0xa5)),null;ocrBinExists===null&&(ocrBinExists=fs_1[_0x2a3ccd(0xb9)][_0x2a3ccd(0x96)](cachedOcrBinPath),!ocrBinExists&&console[_0x2a3ccd(0x8f)]('['+(0x0,session_1['timestamp'])()+']\x20OCR\x20二进制不存在:\x20'+cachedOcrBinPath));if(!ocrBinExists)return null;return new Promise(_0xfd9722=>{const _0x34f3af=_0x2a3ccd;(0x0,child_process_1[_0x34f3af(0x9a)])(cachedOcrBinPath,[_0x5232b4],{'timeout':0x7530,'maxBuffer':0x5*0x400*0x400},(_0x41ddae,_0x19332f,_0x40b560)=>{const _0x56411d=_0x34f3af;if(_0x41ddae){console[_0x56411d(0x8f)]('['+(0x0,session_1[_0x56411d(0x8e)])()+_0x56411d(0x8a)+_0x41ddae[_0x56411d(0x72)]);if(_0x40b560)console['warn']('['+(0x0,session_1[_0x56411d(0x8e)])()+_0x56411d(0x83)+_0x40b560[_0x56411d(0x87)](0x0,0xc8));_0xfd9722(null);return;}try{const _0xb688f0=JSON[_0x56411d(0xa4)](_0x19332f);if(!Array[_0x56411d(0x6e)](_0xb688f0)||_0xb688f0[_0x56411d(0xa3)]===0x0){console['log']('['+(0x0,session_1[_0x56411d(0x8e)])()+_0x56411d(0x86)),_0xfd9722(null);return;}const _0x40585e=_0xb688f0[_0x56411d(0x97)](_0x25684c=>_0x25684c['word'])['filter'](Boolean)[_0x56411d(0x7d)]('\x20');console['log']('['+(0x0,session_1[_0x56411d(0x8e)])()+_0x56411d(0xab)+_0x40585e['substring'](0x0,0xc8)+(_0x40585e[_0x56411d(0xa3)]>0xc8?_0x56411d(0x88):'')),_0xfd9722(_0x40585e||null);}catch{console[_0x56411d(0x8f)]('['+(0x0,session_1['timestamp'])()+_0x56411d(0x79)+_0x19332f[_0x56411d(0x87)](0x0,0xc8)),_0xfd9722(null);}});});}const MAGIC_NUMBERS=[{'bytes':[0x89,0x50,0x4e,0x47],'mediaType':'image/png','ext':a7_0x4ac058(0xc8)},{'bytes':[0xff,0xd8,0xff],'mediaType':a7_0x4ac058(0xb1),'ext':a7_0x4ac058(0x69)},{'bytes':[0x47,0x49,0x46],'mediaType':'image/gif','ext':a7_0x4ac058(0xcb)},{'bytes':[0x52,0x49,0x46,0x46],'mediaType':'image/webp','ext':a7_0x4ac058(0x84)}];function detectImageMediaType(_0xa0da9d){const _0xece8e0=a7_0x4ac058;for(const {bytes:_0xa01989,mediaType:_0x3f08a8,ext:_0x48a7a8}of MAGIC_NUMBERS){if(_0xa0da9d[_0xece8e0(0xa3)]>=_0xa01989[_0xece8e0(0xa3)]&&_0xa01989['every']((_0x2e33c6,_0x37f1bc)=>_0xa0da9d[_0x37f1bc]===_0x2e33c6))return{'mediaType':_0x3f08a8,'ext':_0x48a7a8};}return{'mediaType':_0xece8e0(0xb1),'ext':_0xece8e0(0x69)};}async function getImageDownloadUrl(_0x98eda4,_0x43ba76,_0x115e14){const _0x2735f4=a7_0x4ac058;try{const _0x265025=await _0x98eda4[_0x2735f4(0xb5)]['getAccessToken'](),_0xbebd22=DING_API_BASE+_0x2735f4(0xa1),_0x52ddba=await urllib_1[_0x2735f4(0xb9)][_0x2735f4(0xc3)](_0xbebd22,{'method':_0x2735f4(0x6b),'headers':{'x-acs-dingtalk-access-token':_0x265025,'Content-Type':_0x2735f4(0xb7)},'data':{'downloadCode':_0x43ba76,'robotCode':_0x115e14},'dataType':_0x2735f4(0x76),'timeout':0x2710});if(_0x52ddba[_0x2735f4(0x7a)]!==0xc8||!_0x52ddba[_0x2735f4(0x71)])return _0x98eda4['debugLog'](_0x2735f4(0x82)+_0x52ddba[_0x2735f4(0x7a)]+_0x2735f4(0x74)+JSON['stringify'](_0x52ddba[_0x2735f4(0x71)])),null;const _0x5acee9=_0x52ddba['data'],_0x3ef815=_0x5acee9?.[_0x2735f4(0x73)];if(!_0x3ef815)return _0x98eda4[_0x2735f4(0x77)]('getImageDownloadUrl\x20响应无\x20downloadUrl:\x20'+JSON['stringify'](_0x5acee9)),null;return _0x3ef815;}catch(_0x44000b){return console[_0x2735f4(0x8f)]('['+(0x0,session_1['timestamp'])()+_0x2735f4(0x6f),_0x44000b),null;}}function a7_0x1fee(_0x12a3f2,_0x1ff07f){_0x12a3f2=_0x12a3f2-0x68;const _0x100a94=a7_0x100a();let _0x1feee1=_0x100a94[_0x12a3f2];return _0x1feee1;}async function downloadImageBuffer(_0x33c760){const _0x146d83=a7_0x4ac058;try{const _0x2aac3f=await urllib_1[_0x146d83(0xb9)][_0x146d83(0xc3)](_0x33c760,{'method':_0x146d83(0xb3),'dataType':_0x146d83(0xbc),'timeout':0x7530});if(_0x2aac3f[_0x146d83(0x7a)]!==0xc8)return console['warn']('['+(0x0,session_1[_0x146d83(0x8e)])()+_0x146d83(0xbf)+_0x2aac3f[_0x146d83(0x7a)]),null;const _0x26c8f5=_0x2aac3f[_0x146d83(0x71)];if(!_0x26c8f5||_0x26c8f5[_0x146d83(0xa3)]===0x0)return console['warn']('['+(0x0,session_1[_0x146d83(0x8e)])()+']\x20downloadImageBuffer\x20下载结果为空'),null;if(_0x26c8f5[_0x146d83(0xa3)]>MAX_IMAGE_SIZE)return console[_0x146d83(0x8f)]('['+(0x0,session_1[_0x146d83(0x8e)])()+_0x146d83(0x6a)+_0x26c8f5[_0x146d83(0xa3)]+'\x20超过限制\x20'+MAX_IMAGE_SIZE),null;return _0x26c8f5;}catch(_0x1c26d4){return console[_0x146d83(0x8f)]('['+(0x0,session_1[_0x146d83(0x8e)])()+_0x146d83(0xa7),_0x1c26d4),null;}}function a7_0x100a(){const _0x4d1711=['trim','filter','[��片下载失败]','log','getImageDownloadUrl\x20API\x20返回非200:\x20status=',']\x20OCR\x20stderr:\x20','webp','mkdirSync',']\x20OCR\x20无识别结果','substring','...','./session',']\x20OCR\x20执行失败:\x20','4mHfxEw','\x20OCR]','59477NlHISu','timestamp','warn','child_process','8631sCMCGn','135rwLRZc','push','userId','3533488cWcyVQ','existsSync','map','1884ZfOvRK','filePath','execFile','https://api.dingtalk.com','pictureDownloadCode','\x0a---\x0a',']\x20图片保存失败:\x20','defineProperty','now','/v1.0/robot/messageFiles/download','10YmvtSN','length','parse',')不支持本地OCR,使用模型识别','x64',']\x20downloadImageBuffer\x20下载失败:','以下图片\x20OCR\x20识别结果来自对用户消息中图片的预处理(非用户原始输入),如识别不准确可直接查看原图路径','\x20bytes)','runOcr',']\x20OCR\x20识别结果:\x20','picture','[图片\x20OCR]','115683zYsLwS','get','downloadCode','image/jpeg','12498kpdQBu','GET','[图片]','dingStreamClient','text','application/json','set','default','projUtil','all','buffer','getResourcePath','processRichTextMessage',']\x20downloadImageBuffer\x20下载失败:\x20status=','10460EvhclU','arch',']\x20当前平台(','request','../common','writeFileSync','[图片\x20',']\x20OCR\x20失败,仅传原图路径:\x20','png','132474CXLUyn','test','gif','platform','jpg',']\x20图片大小\x20','POST','__esModule','type','isArray',']\x20getImageDownloadUrl\x20请求失败:','[富文本消息内容为空]','data','message','downloadUrl',',\x20data=','urllib','json','debugLog','\x0a---',']\x20OCR\x20输出解析失败:\x20','status','__importDefault','7436120XLtgPg','join'];a7_0x100a=function(){return _0x4d1711;};return a7_0x100a();}async function downloadAndProcessImage(_0x26c8b7,_0x4a64b4,_0x3c0d9d,_0x26435f){const _0x494439=a7_0x4ac058,_0x364b57=await getImageDownloadUrl(_0x26c8b7,_0x4a64b4,_0x3c0d9d);if(!_0x364b57)return null;const _0x5c47a2=await downloadImageBuffer(_0x364b57);if(!_0x5c47a2)return null;const {mediaType:_0x2c9916,ext:_0x4206e0}=detectImageMediaType(_0x5c47a2),_0x5556ed=path_1[_0x494439(0xb9)][_0x494439(0x7d)](_0x26435f,'.images'),_0x323382=_0x4a64b4['slice'](-0x8),_0x4adbb3=Date[_0x494439(0xa0)]()+'-'+_0x323382+'.'+_0x4206e0,_0x299bb4=path_1[_0x494439(0xb9)][_0x494439(0x7d)](_0x5556ed,_0x4adbb3);try{fs_1[_0x494439(0xb9)][_0x494439(0x85)](_0x5556ed,{'recursive':!![]}),fs_1['default'][_0x494439(0xc5)](_0x299bb4,_0x5c47a2);}catch(_0x14259d){return console[_0x494439(0x8f)]('['+(0x0,session_1[_0x494439(0x8e)])()+_0x494439(0x9e)+_0x299bb4,_0x14259d),null;}return console['log']('['+(0x0,session_1[_0x494439(0x8e)])()+']\x20图片已保存:\x20'+_0x299bb4+'\x20('+_0x2c9916+',\x20'+_0x5c47a2[_0x494439(0xa3)]+_0x494439(0xa9)),{'mediaType':_0x2c9916,'filePath':_0x299bb4,'sizeBytes':_0x5c47a2[_0x494439(0xa3)]};}async function buildImagePrompt(_0x28890a,_0x5f0b7f,_0x559cac){const _0xb77a58=a7_0x4ac058,_0x5a350a=_0x559cac!=null?_0xb77a58(0xc6)+_0x559cac+']':_0xb77a58(0xb4);if(_0x5f0b7f){const _0x4799e4=await runOcr(_0x28890a['filePath']);if(_0x4799e4){const _0x125e78=_0x559cac!=null?_0xb77a58(0xc6)+_0x559cac+_0xb77a58(0x8c):_0xb77a58(0xad);return _0x5a350a+'\x20'+_0x28890a['filePath']+'\x0a'+_0x125e78+_0xb77a58(0x9d)+_0x4799e4+_0xb77a58(0x78);}console[_0xb77a58(0x8f)]('['+(0x0,session_1[_0xb77a58(0x8e)])()+_0xb77a58(0xc7)+_0x28890a[_0xb77a58(0x99)]);}return _0x5a350a+'\x20'+_0x28890a['filePath'];}async function processPictureMessage(_0x13ecfc,_0x40aa90,_0x468996,_0x19f5b7,_0xe76461=!![],_0x453ee5){const _0x2a66bb=a7_0x4ac058,_0x4640a9=await downloadAndProcessImage(_0x13ecfc,_0x40aa90,_0x468996,_0x19f5b7);if(!_0x4640a9)return null;const _0x3d2e4f=await buildImagePrompt(_0x4640a9,_0xe76461),_0x464aa9=[];_0xe76461&&_0x464aa9[_0x2a66bb(0x93)](OCR_PREAMBLE);if(_0x453ee5)_0x464aa9[_0x2a66bb(0x93)](_0x453ee5);return _0x464aa9[_0x2a66bb(0x93)](_0x3d2e4f),_0x464aa9[_0x2a66bb(0x7d)]('\x0a');}async function processRichTextMessage(_0x266ed0,_0x152044,_0x2ae0f3,_0x450861,_0x43ed30=!![]){const _0x3cc93c=a7_0x4ac058,_0x291351=_0x152044[_0x3cc93c(0x7f)](_0x16e2ac=>_0x16e2ac[_0x3cc93c(0x6d)]==='picture'&&(_0x16e2ac[_0x3cc93c(0xb0)]||_0x16e2ac[_0x3cc93c(0x9c)]))['length'],_0x188c4b=_0x152044[_0x3cc93c(0x97)](async(_0x22ef10,_0x1c9e4a)=>{const _0x537f40=_0x3cc93c;if(_0x22ef10[_0x537f40(0x6d)]==='picture'){const _0x26308b=_0x22ef10['downloadCode']||_0x22ef10[_0x537f40(0x9c)];if(_0x26308b){const _0x2e6c9d=await downloadAndProcessImage(_0x266ed0,_0x26308b,_0x2ae0f3,_0x450861);return{'index':_0x1c9e4a,'result':_0x2e6c9d};}}return{'index':_0x1c9e4a,'result':null};}),_0x58d2c8=await Promise['all'](_0x188c4b),_0x36cc52=new Map();for(const {index:_0x5b54d6,result:_0x4b5527}of _0x58d2c8){_0x36cc52['set'](_0x5b54d6,_0x4b5527);}const _0x5baf55=new Map();if(_0x43ed30&&_0x291351>0x0){const _0x22cddf=[];for(const [_0x303735,_0x14505d]of _0x36cc52){_0x14505d&&_0x22cddf['push'](runOcr(_0x14505d[_0x3cc93c(0x99)])['then'](_0x52cb5b=>({'index':_0x303735,'ocrText':_0x52cb5b})));}const _0x5144af=await Promise[_0x3cc93c(0xbb)](_0x22cddf);for(const {index:_0x850f50,ocrText:_0x2869fc}of _0x5144af){_0x5baf55[_0x3cc93c(0xb8)](_0x850f50,_0x2869fc);}}const _0x416ac5=[];let _0x39dbf5=0x0;for(let _0x2af77d=0x0;_0x2af77d<_0x152044['length'];_0x2af77d++){const _0xafa470=_0x152044[_0x2af77d];if(_0xafa470[_0x3cc93c(0x6d)]===_0x3cc93c(0xb6)&&_0xafa470[_0x3cc93c(0xb6)]){if(/^@\S+$/[_0x3cc93c(0xca)](_0xafa470['text'][_0x3cc93c(0x7e)]()))continue;_0x416ac5[_0x3cc93c(0x93)](_0xafa470[_0x3cc93c(0xb6)]);}else{if(_0xafa470[_0x3cc93c(0x6d)]==='mention'&&_0xafa470['userId'])_0x416ac5[_0x3cc93c(0x93)]('@'+_0xafa470[_0x3cc93c(0x94)]);else{if(_0xafa470[_0x3cc93c(0x6d)]===_0x3cc93c(0xac)){const _0xe0a88c=_0x36cc52[_0x3cc93c(0xaf)](_0x2af77d);if(_0xe0a88c){_0x39dbf5++;const _0x2e5d88=_0x291351>0x1?_0x39dbf5:undefined,_0x380260=_0x43ed30?_0x5baf55[_0x3cc93c(0xaf)](_0x2af77d):null,_0x332dfa=_0x2e5d88!=null?_0x3cc93c(0xc6)+_0x2e5d88+']':_0x3cc93c(0xb4);if(_0x380260){const _0x375945=_0x2e5d88!=null?'[图片\x20'+_0x2e5d88+_0x3cc93c(0x8c):'[图片\x20OCR]';_0x416ac5[_0x3cc93c(0x93)](_0x332dfa+'\x20'+_0xe0a88c[_0x3cc93c(0x99)]+'\x0a'+_0x375945+_0x3cc93c(0x9d)+_0x380260+_0x3cc93c(0x78));}else _0x416ac5['push'](_0x332dfa+'\x20'+_0xe0a88c[_0x3cc93c(0x99)]);}else{const _0x21a0a5=_0xafa470[_0x3cc93c(0xb0)]||_0xafa470['pictureDownloadCode'];_0x21a0a5&&_0x416ac5['push'](_0x3cc93c(0x80));}}}}}const _0x2bf38b=_0x416ac5[_0x3cc93c(0x7d)]('\x0a')||_0x3cc93c(0x70);if(_0x43ed30&&_0x39dbf5>0x0)return OCR_PREAMBLE+'\x0a'+_0x2bf38b;return _0x2bf38b;}
1
+ 'use strict';const a7_0x16fd1b=a7_0x309d;(function(_0x57642e,_0x17a2a9){const _0x4475b2=a7_0x309d,_0x37dfbc=_0x57642e();while(!![]){try{const _0x52ab91=parseInt(_0x4475b2(0x1dc))/0x1*(parseInt(_0x4475b2(0x1a9))/0x2)+parseInt(_0x4475b2(0x1e8))/0x3+parseInt(_0x4475b2(0x1cc))/0x4*(-parseInt(_0x4475b2(0x1e9))/0x5)+-parseInt(_0x4475b2(0x204))/0x6*(-parseInt(_0x4475b2(0x1fc))/0x7)+-parseInt(_0x4475b2(0x1fd))/0x8*(-parseInt(_0x4475b2(0x1cf))/0x9)+parseInt(_0x4475b2(0x1f3))/0xa+parseInt(_0x4475b2(0x20a))/0xb*(-parseInt(_0x4475b2(0x1ae))/0xc);if(_0x52ab91===_0x17a2a9)break;else _0x37dfbc['push'](_0x37dfbc['shift']());}catch(_0x305a6a){_0x37dfbc['push'](_0x37dfbc['shift']());}}}(a7_0x1b77,0x1e22d));var __importDefault=this&&this[a7_0x16fd1b(0x201)]||function(_0x517f7a){const _0x277eb7=a7_0x16fd1b;return _0x517f7a&&_0x517f7a[_0x277eb7(0x1f0)]?_0x517f7a:{'default':_0x517f7a};};Object[a7_0x16fd1b(0x1ed)](exports,a7_0x16fd1b(0x1f0),{'value':!![]}),exports[a7_0x16fd1b(0x1d1)]=runOcr,exports[a7_0x16fd1b(0x1bd)]=processPictureMessage,exports[a7_0x16fd1b(0x20c)]=processRichTextMessage;const child_process_1=require(a7_0x16fd1b(0x1bf)),fs_1=__importDefault(require('fs')),path_1=__importDefault(require('path')),urllib_1=__importDefault(require(a7_0x16fd1b(0x1b7))),session_1=require(a7_0x16fd1b(0x1f9)),common_1=require('../common'),MAX_IMAGE_SIZE=0xa*0x400*0x400,DING_API_BASE=a7_0x16fd1b(0x209),OCR_PREAMBLE=a7_0x16fd1b(0x1b3),OCR_BIN_DIR=(0x0,common_1[a7_0x16fd1b(0x1ca)])()[a7_0x16fd1b(0x1b1)](),cachedOcrBinPath=((()=>{const _0x3a7e9e=a7_0x16fd1b;if(process[_0x3a7e9e(0x1c1)]==='win32')return null;const _0x30264=process[_0x3a7e9e(0x1ff)];if(_0x30264==='arm64')return path_1[_0x3a7e9e(0x1c4)][_0x3a7e9e(0x1c5)](OCR_BIN_DIR,'ocr-arm64');if(_0x30264===_0x3a7e9e(0x1fb))return path_1[_0x3a7e9e(0x1c4)][_0x3a7e9e(0x1c5)](OCR_BIN_DIR,_0x3a7e9e(0x1a8));return null;})());function a7_0x1b77(){const _0x4d6e97=['pictureDownloadCode','request','1318734EJYDJh',',\x20data=','runOcr',']\x20图片大小\x20','\x0a---','trim',']\x20OCR\x20无识别结果','[图片\x20','POST','image/png','mkdirSync',']\x20downloadImageBuffer\x20下载失败:','jpg','8037Rddedv','\x20bytes)','set','log',']\x20图片保存失败:\x20','json','downloadCode','type','push','length','...','substring','363978kEthlg','517955vDVZer','[富文本消息内容为空]','data','then','defineProperty','[图片]','gif','__esModule',']\x20图片已保存:\x20','existsSync','583740lCyEXa',']\x20OCR\x20二进制不存在:\x20',']\x20当前平台(','status','\x20OCR]','timestamp','./session','filter','x64','66171dpGcUk','8GWgKuN','map','arch','filePath','__importDefault','application/json','webp','150BfTnNZ','downloadUrl','/v1.0/robot/messageFiles/download','stringify','buffer','https://api.dingtalk.com','1701755mdzEgI','userId','processRichTextMessage','slice',']\x20getImageDownloadUrl\x20请求失败:','ocr-x64','32fuxnEI','text','getImageDownloadUrl\x20响应无\x20downloadUrl:\x20','getImageDownloadUrl\x20API\x20返回非200:\x20status=',']\x20OCR\x20stderr:\x20','36jwKqmm',')不支持本地OCR,使用模型识别','image/jpeg','getResourcePath','debugLog','以下图片\x20OCR\x20识别结果来自对用户消息中图片的预处理(非用户原始输入),如识别不准确可直接查看原图路径',']\x20downloadImageBuffer\x20下载失败:\x20status=','all',']\x20OCR\x20输出解析失败:\x20','urllib','parse','dingStreamClient','\x0a---\x0a','test','[��片下载失败]','processPictureMessage','isArray','child_process','get','platform','picture','GET','default','join','image/gif','warn','[图片\x20OCR]','getAccessToken','projUtil','execFile','4PPMUrv'];a7_0x1b77=function(){return _0x4d6e97;};return a7_0x1b77();}let ocrBinExists=null;async function runOcr(_0x299355){const _0x591fc8=a7_0x16fd1b;if(!cachedOcrBinPath)return console[_0x591fc8(0x1df)]('['+(0x0,session_1['timestamp'])()+_0x591fc8(0x1f5)+process[_0x591fc8(0x1c1)]+'/'+process[_0x591fc8(0x1ff)]+_0x591fc8(0x1af)),null;ocrBinExists===null&&(ocrBinExists=fs_1[_0x591fc8(0x1c4)][_0x591fc8(0x1f2)](cachedOcrBinPath),!ocrBinExists&&console[_0x591fc8(0x1c7)]('['+(0x0,session_1[_0x591fc8(0x1f8)])()+_0x591fc8(0x1f4)+cachedOcrBinPath));if(!ocrBinExists)return null;return new Promise(_0x517617=>{const _0x293d3a=_0x591fc8;(0x0,child_process_1[_0x293d3a(0x1cb)])(cachedOcrBinPath,[_0x299355],{'timeout':0x7530,'maxBuffer':0x5*0x400*0x400},(_0x2218a5,_0x2f9ab0,_0x9287ad)=>{const _0x29e9fe=_0x293d3a;if(_0x2218a5){console[_0x29e9fe(0x1c7)]('['+(0x0,session_1[_0x29e9fe(0x1f8)])()+']\x20OCR\x20执行失败:\x20'+_0x2218a5['message']);if(_0x9287ad)console[_0x29e9fe(0x1c7)]('['+(0x0,session_1[_0x29e9fe(0x1f8)])()+_0x29e9fe(0x1ad)+_0x9287ad[_0x29e9fe(0x1e7)](0x0,0xc8));_0x517617(null);return;}try{const _0x5466d1=JSON[_0x29e9fe(0x1b8)](_0x2f9ab0);if(!Array[_0x29e9fe(0x1be)](_0x5466d1)||_0x5466d1[_0x29e9fe(0x1e5)]===0x0){console['log']('['+(0x0,session_1['timestamp'])()+_0x29e9fe(0x1d5)),_0x517617(null);return;}const _0x3f2e02=_0x5466d1[_0x29e9fe(0x1fe)](_0x29e027=>_0x29e027['word'])['filter'](Boolean)['join']('\x20');console[_0x29e9fe(0x1df)]('['+(0x0,session_1[_0x29e9fe(0x1f8)])()+']\x20OCR\x20识别结果:\x20'+_0x3f2e02[_0x29e9fe(0x1e7)](0x0,0xc8)+(_0x3f2e02[_0x29e9fe(0x1e5)]>0xc8?_0x29e9fe(0x1e6):'')),_0x517617(_0x3f2e02||null);}catch{console[_0x29e9fe(0x1c7)]('['+(0x0,session_1[_0x29e9fe(0x1f8)])()+_0x29e9fe(0x1b6)+_0x2f9ab0[_0x29e9fe(0x1e7)](0x0,0xc8)),_0x517617(null);}});});}const MAGIC_NUMBERS=[{'bytes':[0x89,0x50,0x4e,0x47],'mediaType':a7_0x16fd1b(0x1d8),'ext':'png'},{'bytes':[0xff,0xd8,0xff],'mediaType':a7_0x16fd1b(0x1b0),'ext':a7_0x16fd1b(0x1db)},{'bytes':[0x47,0x49,0x46],'mediaType':a7_0x16fd1b(0x1c6),'ext':a7_0x16fd1b(0x1ef)},{'bytes':[0x52,0x49,0x46,0x46],'mediaType':'image/webp','ext':a7_0x16fd1b(0x203)}];function detectImageMediaType(_0x5caf61){const _0x5a2c2b=a7_0x16fd1b;for(const {bytes:_0x1d3150,mediaType:_0x2d38fb,ext:_0x24dc2e}of MAGIC_NUMBERS){if(_0x5caf61[_0x5a2c2b(0x1e5)]>=_0x1d3150['length']&&_0x1d3150['every']((_0xea961b,_0x36526c)=>_0x5caf61[_0x36526c]===_0xea961b))return{'mediaType':_0x2d38fb,'ext':_0x24dc2e};}return{'mediaType':'image/jpeg','ext':'jpg'};}async function getImageDownloadUrl(_0x52fb2c,_0x374b80,_0x3cfd5d){const _0x351735=a7_0x16fd1b;try{const _0x3449ae=await _0x52fb2c[_0x351735(0x1b9)][_0x351735(0x1c9)](),_0x4835d2=DING_API_BASE+_0x351735(0x206),_0x5421cd=await urllib_1[_0x351735(0x1c4)][_0x351735(0x1ce)](_0x4835d2,{'method':_0x351735(0x1d7),'headers':{'x-acs-dingtalk-access-token':_0x3449ae,'Content-Type':_0x351735(0x202)},'data':{'downloadCode':_0x374b80,'robotCode':_0x3cfd5d},'dataType':_0x351735(0x1e1),'timeout':0x2710});if(_0x5421cd[_0x351735(0x1f6)]!==0xc8||!_0x5421cd['data'])return _0x52fb2c[_0x351735(0x1b2)](_0x351735(0x1ac)+_0x5421cd[_0x351735(0x1f6)]+_0x351735(0x1d0)+JSON[_0x351735(0x207)](_0x5421cd[_0x351735(0x1eb)])),null;const _0x262d21=_0x5421cd[_0x351735(0x1eb)],_0x3b81dd=_0x262d21?.[_0x351735(0x205)];if(!_0x3b81dd)return _0x52fb2c[_0x351735(0x1b2)](_0x351735(0x1ab)+JSON[_0x351735(0x207)](_0x262d21)),null;return _0x3b81dd;}catch(_0x1dd3f5){return console['warn']('['+(0x0,session_1[_0x351735(0x1f8)])()+_0x351735(0x20e),_0x1dd3f5),null;}}async function downloadImageBuffer(_0x537472){const _0x254763=a7_0x16fd1b;try{const _0x308f72=await urllib_1[_0x254763(0x1c4)][_0x254763(0x1ce)](_0x537472,{'method':_0x254763(0x1c3),'dataType':_0x254763(0x208),'timeout':0x7530});if(_0x308f72[_0x254763(0x1f6)]!==0xc8)return console['warn']('['+(0x0,session_1[_0x254763(0x1f8)])()+_0x254763(0x1b4)+_0x308f72[_0x254763(0x1f6)]),null;const _0x5b8264=_0x308f72[_0x254763(0x1eb)];if(!_0x5b8264||_0x5b8264[_0x254763(0x1e5)]===0x0)return console[_0x254763(0x1c7)]('['+(0x0,session_1['timestamp'])()+']\x20downloadImageBuffer\x20下载结果为空'),null;if(_0x5b8264['length']>MAX_IMAGE_SIZE)return console[_0x254763(0x1c7)]('['+(0x0,session_1[_0x254763(0x1f8)])()+_0x254763(0x1d2)+_0x5b8264[_0x254763(0x1e5)]+'\x20超过限制\x20'+MAX_IMAGE_SIZE),null;return _0x5b8264;}catch(_0x5bcb35){return console[_0x254763(0x1c7)]('['+(0x0,session_1[_0x254763(0x1f8)])()+_0x254763(0x1da),_0x5bcb35),null;}}function a7_0x309d(_0x2c246d,_0x28bc83){_0x2c246d=_0x2c246d-0x1a8;const _0x1b7731=a7_0x1b77();let _0x309df3=_0x1b7731[_0x2c246d];return _0x309df3;}async function downloadAndProcessImage(_0x1f3517,_0x4fc628,_0x4ca42,_0x111860){const _0x29733c=a7_0x16fd1b,_0x3a8315=await getImageDownloadUrl(_0x1f3517,_0x4fc628,_0x4ca42);if(!_0x3a8315)return null;const _0x2b0952=await downloadImageBuffer(_0x3a8315);if(!_0x2b0952)return null;const {mediaType:_0x36d65a,ext:_0x10fc72}=detectImageMediaType(_0x2b0952),_0x4574ae=path_1[_0x29733c(0x1c4)]['join'](_0x111860,'.images'),_0x22095a=_0x4fc628[_0x29733c(0x20d)](-0x8),_0x8ef492=Date['now']()+'-'+_0x22095a+'.'+_0x10fc72,_0x2144bc=path_1[_0x29733c(0x1c4)][_0x29733c(0x1c5)](_0x4574ae,_0x8ef492);try{fs_1[_0x29733c(0x1c4)][_0x29733c(0x1d9)](_0x4574ae,{'recursive':!![]}),fs_1[_0x29733c(0x1c4)]['writeFileSync'](_0x2144bc,_0x2b0952);}catch(_0x5d6f6f){return console[_0x29733c(0x1c7)]('['+(0x0,session_1[_0x29733c(0x1f8)])()+_0x29733c(0x1e0)+_0x2144bc,_0x5d6f6f),null;}return console[_0x29733c(0x1df)]('['+(0x0,session_1[_0x29733c(0x1f8)])()+_0x29733c(0x1f1)+_0x2144bc+'\x20('+_0x36d65a+',\x20'+_0x2b0952['length']+_0x29733c(0x1dd)),{'mediaType':_0x36d65a,'filePath':_0x2144bc,'sizeBytes':_0x2b0952[_0x29733c(0x1e5)]};}async function buildImagePrompt(_0xc0a484,_0x5b0bc9,_0x6663fc){const _0x2b440a=a7_0x16fd1b,_0x41c604=_0x6663fc!=null?_0x2b440a(0x1d6)+_0x6663fc+']':'[图片]';if(_0x5b0bc9){const _0x5dcd93=await runOcr(_0xc0a484[_0x2b440a(0x200)]);if(_0x5dcd93){const _0xf0b7e9=_0x6663fc!=null?_0x2b440a(0x1d6)+_0x6663fc+_0x2b440a(0x1f7):_0x2b440a(0x1c8);return _0x41c604+'\x20'+_0xc0a484[_0x2b440a(0x200)]+'\x0a'+_0xf0b7e9+_0x2b440a(0x1ba)+_0x5dcd93+_0x2b440a(0x1d3);}console['warn']('['+(0x0,session_1[_0x2b440a(0x1f8)])()+']\x20OCR\x20失败,仅传原图路径:\x20'+_0xc0a484[_0x2b440a(0x200)]);}return _0x41c604+'\x20'+_0xc0a484['filePath'];}async function processPictureMessage(_0x1d6a50,_0x4168d0,_0x4b224d,_0xc719d9,_0x52bcd4=!![],_0x4f84d5){const _0x48f47d=a7_0x16fd1b,_0x3a4bb2=await downloadAndProcessImage(_0x1d6a50,_0x4168d0,_0x4b224d,_0xc719d9);if(!_0x3a4bb2)return null;const _0x1facd0=await buildImagePrompt(_0x3a4bb2,_0x52bcd4),_0x112ca2=[];_0x52bcd4&&_0x112ca2['push'](OCR_PREAMBLE);if(_0x4f84d5)_0x112ca2[_0x48f47d(0x1e4)](_0x4f84d5);return _0x112ca2[_0x48f47d(0x1e4)](_0x1facd0),_0x112ca2[_0x48f47d(0x1c5)]('\x0a');}async function processRichTextMessage(_0x16080b,_0x384efb,_0x43783b,_0x16f513,_0x836c09=!![]){const _0x5eb72e=a7_0x16fd1b,_0x1d4b94=_0x384efb[_0x5eb72e(0x1fa)](_0xea25f0=>_0xea25f0[_0x5eb72e(0x1e3)]===_0x5eb72e(0x1c2)&&(_0xea25f0[_0x5eb72e(0x1e2)]||_0xea25f0[_0x5eb72e(0x1cd)]))[_0x5eb72e(0x1e5)],_0x4287f1=_0x384efb[_0x5eb72e(0x1fe)](async(_0x1ba1e0,_0x547384)=>{const _0x2455a9=_0x5eb72e;if(_0x1ba1e0[_0x2455a9(0x1e3)]===_0x2455a9(0x1c2)){const _0x460242=_0x1ba1e0[_0x2455a9(0x1e2)]||_0x1ba1e0[_0x2455a9(0x1cd)];if(_0x460242){const _0x5d3f52=await downloadAndProcessImage(_0x16080b,_0x460242,_0x43783b,_0x16f513);return{'index':_0x547384,'result':_0x5d3f52};}}return{'index':_0x547384,'result':null};}),_0x5e95fa=await Promise[_0x5eb72e(0x1b5)](_0x4287f1),_0x2dfbe8=new Map();for(const {index:_0x7c4f30,result:_0x167bde}of _0x5e95fa){_0x2dfbe8[_0x5eb72e(0x1de)](_0x7c4f30,_0x167bde);}const _0x5b5fda=new Map();if(_0x836c09&&_0x1d4b94>0x0){const _0x2d3eea=[];for(const [_0x194b86,_0x3147ff]of _0x2dfbe8){_0x3147ff&&_0x2d3eea['push'](runOcr(_0x3147ff['filePath'])[_0x5eb72e(0x1ec)](_0x1d82b0=>({'index':_0x194b86,'ocrText':_0x1d82b0})));}const _0x4a29d8=await Promise['all'](_0x2d3eea);for(const {index:_0x35b995,ocrText:_0x46c754}of _0x4a29d8){_0x5b5fda[_0x5eb72e(0x1de)](_0x35b995,_0x46c754);}}const _0x524411=[];let _0x271af8=0x0;for(let _0x397133=0x0;_0x397133<_0x384efb['length'];_0x397133++){const _0x326ba0=_0x384efb[_0x397133];if(_0x326ba0[_0x5eb72e(0x1e3)]===_0x5eb72e(0x1aa)&&_0x326ba0[_0x5eb72e(0x1aa)]){if(/^@\S+$/[_0x5eb72e(0x1bb)](_0x326ba0['text'][_0x5eb72e(0x1d4)]()))continue;_0x524411[_0x5eb72e(0x1e4)](_0x326ba0['text']);}else{if(_0x326ba0['type']==='mention'&&_0x326ba0[_0x5eb72e(0x20b)])_0x524411[_0x5eb72e(0x1e4)]('@'+_0x326ba0['userId']);else{if(_0x326ba0['type']===_0x5eb72e(0x1c2)){const _0x532b92=_0x2dfbe8[_0x5eb72e(0x1c0)](_0x397133);if(_0x532b92){_0x271af8++;const _0x1b5d19=_0x1d4b94>0x1?_0x271af8:undefined,_0x2f1417=_0x836c09?_0x5b5fda[_0x5eb72e(0x1c0)](_0x397133):null,_0x45ea61=_0x1b5d19!=null?_0x5eb72e(0x1d6)+_0x1b5d19+']':_0x5eb72e(0x1ee);if(_0x2f1417){const _0x4db198=_0x1b5d19!=null?_0x5eb72e(0x1d6)+_0x1b5d19+_0x5eb72e(0x1f7):'[图片\x20OCR]';_0x524411[_0x5eb72e(0x1e4)](_0x45ea61+'\x20'+_0x532b92[_0x5eb72e(0x200)]+'\x0a'+_0x4db198+_0x5eb72e(0x1ba)+_0x2f1417+_0x5eb72e(0x1d3));}else _0x524411['push'](_0x45ea61+'\x20'+_0x532b92[_0x5eb72e(0x200)]);}else{const _0x56be5e=_0x326ba0[_0x5eb72e(0x1e2)]||_0x326ba0['pictureDownloadCode'];_0x56be5e&&_0x524411[_0x5eb72e(0x1e4)](_0x5eb72e(0x1bc));}}}}}const _0x21393a=_0x524411[_0x5eb72e(0x1c5)]('\x0a')||_0x5eb72e(0x1ea);if(_0x836c09&&_0x271af8>0x0)return OCR_PREAMBLE+'\x0a'+_0x21393a;return _0x21393a;}
@@ -1 +1 @@
1
- 'use strict';const a8_0x2e3edb=a8_0x1089;function a8_0x1e65(){const _0xdf9442=['kill','timestamp','pid','path','4033305zeUrmz','2161554xzUQlb','__esModule','4587400loeTlh','existsSync','1109022FhxeJG','error','1125034hamfcS','\x20\x20如需强制启动,请先停止已有进程或删除锁文件:\x20','default','writeFileSync','unlinkSync','2vnIEDV','join','35nbNWuI','SIGINT','\x22\x20已有运行中的进程\x20(PID:\x20','trim','./session','exit',']\x20检测到过期锁文件\x20(PID:\x20','utf-8','50WcaCxE','1706756ZwQHEO','__importDefault','readFileSync','4829925xbWAaC'];a8_0x1e65=function(){return _0xdf9442;};return a8_0x1e65();}(function(_0x5343e7,_0x129e66){const _0x447b36=a8_0x1089,_0x260000=_0x5343e7();while(!![]){try{const _0xe8d21f=parseInt(_0x447b36(0x128))/0x1*(parseInt(_0x447b36(0x123))/0x2)+-parseInt(_0x447b36(0x13c))/0x3+parseInt(_0x447b36(0x133))/0x4+-parseInt(_0x447b36(0x136))/0x5+parseInt(_0x447b36(0x140))/0x6*(-parseInt(_0x447b36(0x12a))/0x7)+-parseInt(_0x447b36(0x13e))/0x8+parseInt(_0x447b36(0x13b))/0x9*(parseInt(_0x447b36(0x132))/0xa);if(_0xe8d21f===_0x129e66)break;else _0x260000['push'](_0x260000['shift']());}catch(_0x3aed13){_0x260000['push'](_0x260000['shift']());}}}(a8_0x1e65,0x9484f));function a8_0x1089(_0x1f9b06,_0x50683f){_0x1f9b06=_0x1f9b06-0x122;const _0x1e6583=a8_0x1e65();let _0x108962=_0x1e6583[_0x1f9b06];return _0x108962;}var __importDefault=this&&this[a8_0x2e3edb(0x134)]||function(_0x36be07){const _0x388bcc=a8_0x2e3edb;return _0x36be07&&_0x36be07[_0x388bcc(0x13d)]?_0x36be07:{'default':_0x36be07};};Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['acquirePidLock']=acquirePidLock;const session_1=require(a8_0x2e3edb(0x12e)),fs_1=__importDefault(require('fs')),path_1=__importDefault(require(a8_0x2e3edb(0x13a)));function acquirePidLock(_0x624507,_0x51e7da){const _0x1cffaa=a8_0x2e3edb,_0x39203f=path_1[_0x1cffaa(0x125)][_0x1cffaa(0x129)](_0x624507,'.pid.lock');if(fs_1[_0x1cffaa(0x125)][_0x1cffaa(0x13f)](_0x39203f))try{const _0x1c1ad1=parseInt(fs_1[_0x1cffaa(0x125)][_0x1cffaa(0x135)](_0x39203f,'utf-8')[_0x1cffaa(0x12d)](),0xa);if(!isNaN(_0x1c1ad1))try{process[_0x1cffaa(0x137)](_0x1c1ad1,0x0),console[_0x1cffaa(0x122)]('[FATAL]\x20clientId\x20\x22'+_0x51e7da+_0x1cffaa(0x12c)+_0x1c1ad1+')'),console[_0x1cffaa(0x122)](_0x1cffaa(0x124)+_0x39203f),process[_0x1cffaa(0x12f)](0x1);}catch{console['log']('['+(0x0,session_1[_0x1cffaa(0x138)])()+_0x1cffaa(0x130)+_0x1c1ad1+'\x20已退出),自动清理');}}catch{}fs_1['default'][_0x1cffaa(0x126)](_0x39203f,String(process[_0x1cffaa(0x139)]),_0x1cffaa(0x131));const _0x3bda29=()=>{const _0x56822c=_0x1cffaa;try{fs_1[_0x56822c(0x125)][_0x56822c(0x127)](_0x39203f);}catch{}};process['on'](_0x1cffaa(0x12f),_0x3bda29),process['on'](_0x1cffaa(0x12b),()=>{const _0xbaaeeb=_0x1cffaa;_0x3bda29(),process[_0xbaaeeb(0x12f)](0x82);}),process['on']('SIGTERM',()=>{const _0x4a336f=_0x1cffaa;_0x3bda29(),process[_0x4a336f(0x12f)](0x8f);});}
1
+ 'use strict';const a8_0x333189=a8_0x4a85;function a8_0x4029(){const _0x33fe8b=['\x20已退出),自动清理','path','1179804EXxseS','defineProperty','29226070xEkFQR','20OKZpdq','\x22\x20已有运行中的进程\x20(PID:\x20','acquirePidLock','join',']\x20检测到过期锁文件\x20(PID:\x20','__importDefault','SIGINT','6097617ZjyPum','exit','readFileSync','1930422TORmkp','252kafvip','37120boVKTJ','1UeWtdE','__esModule','[FATAL]\x20clientId\x20\x22','4069188pPKamF','5567132oTxkxX','writeFileSync','.pid.lock','default','\x20\x20如需强制启动,请先停止已有进程或删除锁文件:\x20','log','./session'];a8_0x4029=function(){return _0x33fe8b;};return a8_0x4029();}(function(_0xdc9b48,_0x2ba6c4){const _0x5f1667=a8_0x4a85,_0x45b6a3=_0xdc9b48();while(!![]){try{const _0x3b83a3=parseInt(_0x5f1667(0x16b))/0x1*(parseInt(_0x5f1667(0x168))/0x2)+parseInt(_0x5f1667(0x16e))/0x3+parseInt(_0x5f1667(0x16f))/0x4+parseInt(_0x5f1667(0x15e))/0x5*(parseInt(_0x5f1667(0x15b))/0x6)+parseInt(_0x5f1667(0x169))/0x7*(-parseInt(_0x5f1667(0x16a))/0x8)+-parseInt(_0x5f1667(0x165))/0x9+-parseInt(_0x5f1667(0x15d))/0xa;if(_0x3b83a3===_0x2ba6c4)break;else _0x45b6a3['push'](_0x45b6a3['shift']());}catch(_0x52a177){_0x45b6a3['push'](_0x45b6a3['shift']());}}}(a8_0x4029,0xb2e5e));function a8_0x4a85(_0x1f777f,_0x117f81){_0x1f777f=_0x1f777f-0x158;const _0x40296e=a8_0x4029();let _0x4a851e=_0x40296e[_0x1f777f];return _0x4a851e;}var __importDefault=this&&this[a8_0x333189(0x163)]||function(_0x3ebd04){const _0x3a74cc=a8_0x333189;return _0x3ebd04&&_0x3ebd04[_0x3a74cc(0x16c)]?_0x3ebd04:{'default':_0x3ebd04};};Object[a8_0x333189(0x15c)](exports,a8_0x333189(0x16c),{'value':!![]}),exports[a8_0x333189(0x160)]=acquirePidLock;const session_1=require(a8_0x333189(0x158)),fs_1=__importDefault(require('fs')),path_1=__importDefault(require(a8_0x333189(0x15a)));function acquirePidLock(_0x16df7c,_0x371c5d){const _0x4ac01d=a8_0x333189,_0x5558dd=path_1['default'][_0x4ac01d(0x161)](_0x16df7c,_0x4ac01d(0x171));if(fs_1[_0x4ac01d(0x172)]['existsSync'](_0x5558dd))try{const _0x55e6a4=parseInt(fs_1[_0x4ac01d(0x172)][_0x4ac01d(0x167)](_0x5558dd,'utf-8')['trim'](),0xa);if(!isNaN(_0x55e6a4))try{process['kill'](_0x55e6a4,0x0),console['error'](_0x4ac01d(0x16d)+_0x371c5d+_0x4ac01d(0x15f)+_0x55e6a4+')'),console['error'](_0x4ac01d(0x173)+_0x5558dd),process[_0x4ac01d(0x166)](0x1);}catch{console[_0x4ac01d(0x174)]('['+(0x0,session_1['timestamp'])()+_0x4ac01d(0x162)+_0x55e6a4+_0x4ac01d(0x159));}}catch{}fs_1[_0x4ac01d(0x172)][_0x4ac01d(0x170)](_0x5558dd,String(process['pid']),'utf-8');const _0x3777c1=()=>{try{fs_1['default']['unlinkSync'](_0x5558dd);}catch{}};process['on']('exit',_0x3777c1),process['on'](_0x4ac01d(0x164),()=>{_0x3777c1(),process['exit'](0x82);}),process['on']('SIGTERM',()=>{_0x3777c1(),process['exit'](0x8f);});}
@@ -1 +1 @@
1
- 'use strict';const a9_0x4c5be1=a9_0x3da8;(function(_0x1ebc50,_0x1ceca5){const _0x27b037=a9_0x3da8,_0x3b8744=_0x1ebc50();while(!![]){try{const _0x4b5fc2=-parseInt(_0x27b037(0xa0))/0x1*(-parseInt(_0x27b037(0xae))/0x2)+parseInt(_0x27b037(0xda))/0x3*(-parseInt(_0x27b037(0xad))/0x4)+parseInt(_0x27b037(0xc2))/0x5+-parseInt(_0x27b037(0xa8))/0x6+parseInt(_0x27b037(0xd1))/0x7+parseInt(_0x27b037(0x9c))/0x8+-parseInt(_0x27b037(0xd5))/0x9;if(_0x4b5fc2===_0x1ceca5)break;else _0x3b8744['push'](_0x3b8744['shift']());}catch(_0x36bb3b){_0x3b8744['push'](_0x3b8744['shift']());}}}(a9_0x42be,0xbd761));var __importDefault=this&&this[a9_0x4c5be1(0xd8)]||function(_0x7c58d7){return _0x7c58d7&&_0x7c58d7['__esModule']?_0x7c58d7:{'default':_0x7c58d7};};Object[a9_0x4c5be1(0xa5)](exports,a9_0x4c5be1(0xdc),{'value':!![]}),exports[a9_0x4c5be1(0xc1)]=fetchQuotedMessage,exports[a9_0x4c5be1(0x9f)]=queryDingUser,exports[a9_0x4c5be1(0xdd)]=queryUserIdByMobile,exports[a9_0x4c5be1(0xcb)]=filterToolUseContent,exports['splitMessage']=splitMessage,exports[a9_0x4c5be1(0xc4)]=sendDingMessage,exports[a9_0x4c5be1(0x9e)]=sendClaudeResponseToDing;const utils_ok_1=require('utils-ok'),urllib_1=__importDefault(require(a9_0x4c5be1(0xd2))),DING_API_BASE=a9_0x4c5be1(0xc5),DING_OAPI_BASE=a9_0x4c5be1(0xd6);async function fetchQuotedMessage(_0x4b0fed,_0x5bb3b8){const _0x10773e=a9_0x4c5be1;try{const _0x2e49b7=await _0x4b0fed['dingStreamClient'][_0x10773e(0x88)](),_0x46cca4=DING_API_BASE+'/v1.0/im/api/messages/'+encodeURIComponent(_0x5bb3b8),_0x5794b6=await urllib_1[_0x10773e(0x97)][_0x10773e(0xb4)](_0x46cca4,{'method':_0x10773e(0xaf),'headers':{'x-acs-dingtalk-access-token':_0x2e49b7},'dataType':_0x10773e(0xbc),'timeout':0x1388});if(_0x5794b6['status']!==0xc8||!_0x5794b6[_0x10773e(0xc0)])return _0x4b0fed[_0x10773e(0xa2)]('fetchQuotedMessage\x20API\x20返回非200:\x20status='+_0x5794b6['status']+_0x10773e(0xc9)+JSON[_0x10773e(0xb0)](_0x5794b6[_0x10773e(0xc0)])),null;const _0xc318f9=_0x5794b6[_0x10773e(0xc0)];if(_0xc318f9[_0x10773e(0x93)]&&typeof _0xc318f9[_0x10773e(0x93)]===_0x10773e(0xb7)){const _0x2b145b=_0xc318f9[_0x10773e(0x93)][_0x10773e(0xc6)];if(typeof _0x2b145b===_0x10773e(0x8c)&&_0x2b145b)return _0x2b145b['trim']();}if(typeof _0xc318f9[_0x10773e(0xc6)]===_0x10773e(0x8c)&&_0xc318f9['content'])try{const _0x608c82=JSON[_0x10773e(0x85)](_0xc318f9[_0x10773e(0xc6)]);if(typeof _0x608c82==='string')return _0x608c82[_0x10773e(0xcc)]();if(_0x608c82['text'])return String(_0x608c82[_0x10773e(0x93)])[_0x10773e(0xcc)]();if(_0x608c82[_0x10773e(0xc6)])return String(_0x608c82[_0x10773e(0xc6)])[_0x10773e(0xcc)]();}catch{return _0xc318f9[_0x10773e(0xc6)][_0x10773e(0xcc)]();}if(_0xc318f9['body']&&typeof _0xc318f9[_0x10773e(0xab)]===_0x10773e(0xb7)){const _0x555f4b=_0xc318f9[_0x10773e(0xab)];if(typeof _0x555f4b[_0x10773e(0xc6)]==='string'&&_0x555f4b[_0x10773e(0xc6)])return _0x555f4b[_0x10773e(0xc6)][_0x10773e(0xcc)]();}return _0x4b0fed[_0x10773e(0xa2)]('fetchQuotedMessage\x20无法从响应中提取文本:\x20keys='+Object['keys'](_0xc318f9)[_0x10773e(0xbd)](',')),null;}catch(_0x14c0e0){return console[_0x10773e(0x96)]('fetchQuotedMessage\x20请求失败:',_0x14c0e0),null;}}async function queryDingUser(_0x23ea65,_0x52e0e2){const _0x359b6f=a9_0x4c5be1;try{const _0x2cf68b=await _0x23ea65[_0x359b6f(0xde)][_0x359b6f(0x88)](),_0x2bba27=DING_OAPI_BASE+_0x359b6f(0xd3)+_0x2cf68b,_0xb51ed=await urllib_1[_0x359b6f(0x97)][_0x359b6f(0xb4)](_0x2bba27,{'method':'POST','data':{'userid':_0x52e0e2},'contentType':_0x359b6f(0xbc),'dataType':_0x359b6f(0xbc),'timeout':0x1388});if(_0xb51ed[_0x359b6f(0x86)]!==0xc8||!_0xb51ed['data'])return _0x23ea65[_0x359b6f(0xa2)]('queryDingUser\x20API\x20返回非200:\x20status='+_0xb51ed[_0x359b6f(0x86)]+',\x20data='+JSON[_0x359b6f(0xb0)](_0xb51ed[_0x359b6f(0xc0)])),null;const _0x5eb599=_0xb51ed[_0x359b6f(0xc0)];if(_0x5eb599[_0x359b6f(0xb2)]!==0x0)return console[_0x359b6f(0x96)](_0x359b6f(0xac)+_0x5eb599[_0x359b6f(0xb2)]+_0x359b6f(0x8e)+_0x5eb599[_0x359b6f(0xbe)]),null;return _0x5eb599[_0x359b6f(0xa1)]||null;}catch(_0x534bb0){return console[_0x359b6f(0x96)](_0x359b6f(0xaa),_0x534bb0),null;}}async function queryUserIdByMobile(_0x435a37,_0x19018d){const _0x5b0750=a9_0x4c5be1;try{const _0x414221=await _0x435a37['dingStreamClient'][_0x5b0750(0x88)](),_0x5f2212=DING_OAPI_BASE+_0x5b0750(0x89)+_0x414221,_0x40d877=await urllib_1[_0x5b0750(0x97)][_0x5b0750(0xb4)](_0x5f2212,{'method':_0x5b0750(0xbf),'data':{'mobile':_0x19018d},'contentType':_0x5b0750(0xbc),'dataType':'json','timeout':0x1388});if(_0x40d877[_0x5b0750(0x86)]!==0xc8||!_0x40d877[_0x5b0750(0xc0)])return _0x435a37['debugLog'](_0x5b0750(0xbb)+_0x40d877[_0x5b0750(0x86)]+_0x5b0750(0xc9)+JSON[_0x5b0750(0xb0)](_0x40d877['data'])),null;const _0x445a73=_0x40d877['data'];if(_0x445a73[_0x5b0750(0xb2)]!==0x0)return console[_0x5b0750(0x96)]('queryUserIdByMobile\x20接口返回错误:\x20errcode='+_0x445a73[_0x5b0750(0xb2)]+_0x5b0750(0x8e)+_0x445a73[_0x5b0750(0xbe)]),null;const _0x152681=_0x445a73[_0x5b0750(0xa1)];return _0x152681?.['userid']||null;}catch(_0x1cfb3d){return console[_0x5b0750(0x96)](_0x5b0750(0xdb),_0x1cfb3d),null;}}function a9_0x3da8(_0x1dbdf3,_0x27fd48){_0x1dbdf3=_0x1dbdf3-0x84;const _0x42be0a=a9_0x42be();let _0x3da81f=_0x42be0a[_0x1dbdf3];return _0x3da81f;}function a9_0x42be(){const _0x4ec0fc=['LSP','EnterWorktree',',\x20data=','CronDelete','filterToolUseContent','trim','TaskGet','markdown','config','Agent','9158345MgInNU','urllib','/topapi/v2/user/get?access_token=','https://oapi.dingtalk.com/robot/send?access_token=','15346134AOYTyx','https://oapi.dingtalk.com','baseUtil','__importDefault','通过\x20defaultDingToken\x20发送钉钉消息失败:','6kGBgKg','queryUserIdByMobile\x20请求失败:','__esModule','queryUserIdByMobile','dingStreamClient','defaultDingToken','parse','status','TaskCreate','getAccessToken','/topapi/v2/user/getbymobile?access_token=','WebSearch','conversations','string','NotebookEdit',',\x20errmsg=','通过\x20sessionWebhook\x20发送钉钉消息失败:','replace','CronCreate',')[^>]*>[\x5cs\x5cS]*?<\x5c/\x5c1>','text','substring','ExitPlanMode','warn','default','Read','lastIndexOf','error','ExitWorktree','7263472VeUBQs','push','sendClaudeResponseToDing','queryDingUser','357874sXIeUq','result','debugLog','Write','Edit','defineProperty',')[^>]*\x5c/>','Skill','2027106wtwVsi','过滤后内容为空,跳过发送','queryDingUser\x20请求失败:','body','queryDingUser\x20接口返回错误:\x20errcode=','1119308xiKwXD','2ewYpSx','GET','stringify','Bash','errcode','**[','request','sleep','WebFetch','object','TaskUpdate','TaskOutput','未能获取机器人信息发送途径','queryUserIdByMobile\x20API\x20返回非200:\x20status=','json','join','errmsg','POST','data','fetchQuotedMessage','4022605FLOEyG','length','sendDingMessage','https://api.dingtalk.com','content'];a9_0x42be=function(){return _0x4ec0fc;};return a9_0x42be();}const TOOL_TAGS=[a9_0x4c5be1(0xa3),a9_0x4c5be1(0x98),a9_0x4c5be1(0xa4),a9_0x4c5be1(0xb1),'Grep','Glob',a9_0x4c5be1(0xd0),a9_0x4c5be1(0xa7),a9_0x4c5be1(0xb6),a9_0x4c5be1(0x8a),a9_0x4c5be1(0xb9),'AskUserQuestion','EnterPlanMode',a9_0x4c5be1(0x95),a9_0x4c5be1(0x87),a9_0x4c5be1(0xcd),a9_0x4c5be1(0xb8),'TaskList',a9_0x4c5be1(0xc8),a9_0x4c5be1(0x9b),a9_0x4c5be1(0x91),a9_0x4c5be1(0xca),'CronList',a9_0x4c5be1(0xc7),a9_0x4c5be1(0x8d)]['join']('|'),TOOL_USE_SELF_CLOSE_RE=new RegExp('<('+TOOL_TAGS+a9_0x4c5be1(0xa6),'g'),TOOL_USE_OPEN_CLOSE_RE=new RegExp('<('+TOOL_TAGS+a9_0x4c5be1(0x92),'g'),MULTI_NEWLINE_RE=/\n{3,}/g;function filterToolUseContent(_0x330828){const _0x1d337c=a9_0x4c5be1;let _0xc7cd46=_0x330828[_0x1d337c(0x90)](TOOL_USE_SELF_CLOSE_RE,'');return _0xc7cd46=_0xc7cd46[_0x1d337c(0x90)](TOOL_USE_OPEN_CLOSE_RE,''),_0xc7cd46=_0xc7cd46[_0x1d337c(0x90)](MULTI_NEWLINE_RE,'\x0a\x0a'),_0xc7cd46[_0x1d337c(0xcc)]();}function splitMessage(_0x1107b0,_0x5a3a7b){const _0x492d4a=a9_0x4c5be1,_0x41fa65=[];while(_0x1107b0[_0x492d4a(0xc3)]>_0x5a3a7b){let _0x495c05=_0x1107b0['lastIndexOf']('\x0a',_0x5a3a7b);(_0x495c05===-0x1||_0x495c05<_0x5a3a7b*0.5)&&(_0x495c05=_0x1107b0['lastIndexOf']('。',_0x5a3a7b)),(_0x495c05===-0x1||_0x495c05<_0x5a3a7b*0.5)&&(_0x495c05=_0x1107b0[_0x492d4a(0x99)]('\x20',_0x5a3a7b)),_0x495c05===-0x1||_0x495c05<_0x5a3a7b*0.5?_0x495c05=_0x5a3a7b:_0x495c05+=0x1,_0x41fa65['push'](_0x1107b0[_0x492d4a(0x94)](0x0,_0x495c05)[_0x492d4a(0xcc)]()),_0x1107b0=_0x1107b0[_0x492d4a(0x94)](_0x495c05)[_0x492d4a(0xcc)]();}return _0x1107b0[_0x492d4a(0xc3)]>0x0&&_0x41fa65[_0x492d4a(0x9d)](_0x1107b0),_0x41fa65;}async function sendDingMessage(_0xc75f64,_0x16dc90){const _0x27164e=a9_0x4c5be1,{conversationId:_0x5b72e6,sessionWebhook:_0x1073b1,atUserId:_0x41667b,content:_0x1c2a2a,msgType:msgType='text'}=_0x16dc90,_0x579fbf=_0x41667b?[_0x41667b]:[],_0x523bb4=_0xc75f64['config'][_0x27164e(0x8b)]['find'](_0x45ad82=>_0x45ad82['conversationId']===_0x5b72e6),_0x1cf043=_0x523bb4?.['dingToken'],_0x57dcb3=msgType===_0x27164e(0xce)?{'msgtype':'markdown','markdown':{'title':_0x1c2a2a,'text':_0x1c2a2a},'at':{'atUserIds':_0x579fbf,'isAtAll':![]}}:{'msgtype':'text','text':{'content':_0x1c2a2a},'at':{'atUserIds':_0x579fbf,'isAtAll':![]}};if(_0x1cf043){const _0x276c3b=await _0xc75f64['dingStreamClient'][_0x27164e(0x88)](),_0x4ccde1=_0x27164e(0xd4)+_0x1cf043;try{await urllib_1[_0x27164e(0x97)]['request'](_0x4ccde1,{'method':'POST','data':_0x57dcb3,'contentType':_0x27164e(0xbc),'headers':{'x-acs-dingtalk-access-token':_0x276c3b},'dataType':_0x27164e(0xbc)});}catch(_0x502ad9){console['error']('通过\x20dingToken\x20发送钉钉消息失败:',_0x502ad9);}}else{if(_0x1073b1){const _0x28d4c3=await _0xc75f64[_0x27164e(0xde)][_0x27164e(0x88)]();try{await urllib_1['default'][_0x27164e(0xb4)](_0x1073b1,{'method':_0x27164e(0xbf),'data':_0x57dcb3,'contentType':_0x27164e(0xbc),'headers':{'x-acs-dingtalk-access-token':_0x28d4c3},'dataType':_0x27164e(0xbc)});}catch(_0xad9600){console[_0x27164e(0x9a)](_0x27164e(0x8f),_0xad9600);}}else{if(_0xc75f64[_0x27164e(0xcf)][_0x27164e(0x84)]){const _0x365fb5=await _0xc75f64['dingStreamClient'][_0x27164e(0x88)](),_0x5d597e='https://oapi.dingtalk.com/robot/send?access_token='+_0xc75f64[_0x27164e(0xcf)][_0x27164e(0x84)];try{await urllib_1['default'][_0x27164e(0xb4)](_0x5d597e,{'method':_0x27164e(0xbf),'data':_0x57dcb3,'contentType':_0x27164e(0xbc),'headers':{'x-acs-dingtalk-access-token':_0x365fb5},'dataType':'json'});}catch(_0x901c3f){console['error'](_0x27164e(0xd9),_0x901c3f);}}else console['error'](_0x27164e(0xba));}}}async function sendClaudeResponseToDing(_0x32f729,_0x1e41c3,_0x3fa6af,_0x21ee10,_0x6240ff){const _0x2ccbbe=a9_0x4c5be1,_0x40c3b8=0x4650,_0x40216c=filterToolUseContent(_0x6240ff);if(!_0x40216c){_0x32f729[_0x2ccbbe(0xa2)](_0x2ccbbe(0xa9));return;}if(_0x40216c[_0x2ccbbe(0xc3)]<=_0x40c3b8)await sendDingMessage(_0x32f729,{'conversationId':_0x1e41c3,'sessionWebhook':_0x3fa6af,'atUserId':_0x21ee10,'content':_0x40216c,'msgType':_0x2ccbbe(0xce)});else{const _0x493a74=splitMessage(_0x40216c,_0x40c3b8);for(let _0x3d6ce9=0x0;_0x3d6ce9<_0x493a74['length'];_0x3d6ce9++){const _0x2221e3=_0x493a74[_0x2ccbbe(0xc3)]>0x1?_0x2ccbbe(0xb3)+(_0x3d6ce9+0x1)+'/'+_0x493a74['length']+']**\x0a':'';await sendDingMessage(_0x32f729,{'conversationId':_0x1e41c3,'sessionWebhook':_0x3fa6af,'atUserId':_0x3d6ce9===_0x493a74[_0x2ccbbe(0xc3)]-0x1?_0x21ee10:'','content':_0x2221e3+_0x493a74[_0x3d6ce9],'msgType':_0x2ccbbe(0xce)}),_0x3d6ce9<_0x493a74[_0x2ccbbe(0xc3)]-0x1&&await utils_ok_1[_0x2ccbbe(0xd7)][_0x2ccbbe(0xb5)](0x1f4);}}}
1
+ 'use strict';const a9_0xe4b6ab=a9_0x13bc;(function(_0x47512f,_0x5e5784){const _0x2b9892=a9_0x13bc,_0x444941=_0x47512f();while(!![]){try{const _0x39a776=-parseInt(_0x2b9892(0x112))/0x1*(parseInt(_0x2b9892(0xeb))/0x2)+parseInt(_0x2b9892(0x11b))/0x3*(parseInt(_0x2b9892(0x10a))/0x4)+-parseInt(_0x2b9892(0xd5))/0x5*(-parseInt(_0x2b9892(0x100))/0x6)+parseInt(_0x2b9892(0xcc))/0x7+-parseInt(_0x2b9892(0x119))/0x8*(-parseInt(_0x2b9892(0xcf))/0x9)+-parseInt(_0x2b9892(0xfc))/0xa+parseInt(_0x2b9892(0xf4))/0xb*(-parseInt(_0x2b9892(0x10c))/0xc);if(_0x39a776===_0x5e5784)break;else _0x444941['push'](_0x444941['shift']());}catch(_0x22b1c9){_0x444941['push'](_0x444941['shift']());}}}(a9_0x3f49,0xa46e7));var __importDefault=this&&this[a9_0xe4b6ab(0xfe)]||function(_0x560b4d){const _0x37c994=a9_0xe4b6ab;return _0x560b4d&&_0x560b4d[_0x37c994(0xce)]?_0x560b4d:{'default':_0x560b4d};};Object[a9_0xe4b6ab(0x106)](exports,a9_0xe4b6ab(0xce),{'value':!![]}),exports['fetchQuotedMessage']=fetchQuotedMessage,exports[a9_0xe4b6ab(0xdf)]=queryDingUser,exports['queryUserIdByMobile']=queryUserIdByMobile,exports[a9_0xe4b6ab(0xf1)]=filterToolUseContent,exports['splitMessage']=splitMessage,exports[a9_0xe4b6ab(0xc9)]=sendDingMessage,exports['sendClaudeResponseToDing']=sendClaudeResponseToDing;function a9_0x3f49(){const _0x5409ad=['NotebookEdit','GET','default','WebSearch','status','content','errcode','getAccessToken','join','/v1.0/im/api/messages/','TaskList',']**\x0a','sendDingMessage','push','/topapi/v2/user/get?access_token=','7880796fNmXSh','body','__esModule','6723396MMNGFK','data','TaskCreate','TaskOutput','**[','config','20665WTHFlT',')[^>]*>[\x5cs\x5cS]*?<\x5c/\x5c1>',')[^>]*\x5c/>','defaultDingToken','EnterPlanMode','markdown','未能获取机器人信息发送途径','json',',\x20data=','https://oapi.dingtalk.com/robot/send?access_token=','queryDingUser','TaskGet','debugLog','lastIndexOf','EnterWorktree',',\x20errmsg=','sleep','queryUserIdByMobile\x20API\x20返回非200:\x20status=','substring','atSender','conversationId','stringify','779998MsZqoN','queryDingUser\x20接口返回错误:\x20errcode=','Agent','find','LSP','object','filterToolUseContent','parse','conversations','5126xtFTAx','queryDingUser\x20API\x20返回非200:\x20status=','CronDelete','replace','keys','ExitWorktree','queryDingUser\x20请求失败:','trim','4553690RdzEVj','AskUserQuestion','__importDefault','POST','552lzuwIE','error','https://oapi.dingtalk.com','Bash','Grep','Edit','defineProperty','result','fetchQuotedMessage\x20无法从响应中提取文本:\x20keys=','length','4GCbcNs','TaskUpdate','10116FqeVNV','通过\x20dingToken\x20发送钉钉消息失败:','CronCreate','errmsg','dingStreamClient','WebFetch','2nkByzB','text','request','warn','string','Read','userid','8JEBlcI','https://api.dingtalk.com','145824ygvONr'];a9_0x3f49=function(){return _0x5409ad;};return a9_0x3f49();}function a9_0x13bc(_0x599d3d,_0x208c72){_0x599d3d=_0x599d3d-0xbf;const _0x3f498c=a9_0x3f49();let _0x13bc91=_0x3f498c[_0x599d3d];return _0x13bc91;}const utils_ok_1=require('utils-ok'),urllib_1=__importDefault(require('urllib')),DING_API_BASE=a9_0xe4b6ab(0x11a),DING_OAPI_BASE=a9_0xe4b6ab(0x102);async function fetchQuotedMessage(_0x41b2c8,_0x13b262){const _0x12cbf0=a9_0xe4b6ab;try{const _0x8b9778=await _0x41b2c8[_0x12cbf0(0x110)]['getAccessToken'](),_0x528591=DING_API_BASE+_0x12cbf0(0xc6)+encodeURIComponent(_0x13b262),_0x2582c0=await urllib_1[_0x12cbf0(0xbf)]['request'](_0x528591,{'method':_0x12cbf0(0x11d),'headers':{'x-acs-dingtalk-access-token':_0x8b9778},'dataType':_0x12cbf0(0xdc),'timeout':0x1388});if(_0x2582c0[_0x12cbf0(0xc1)]!==0xc8||!_0x2582c0[_0x12cbf0(0xd0)])return _0x41b2c8[_0x12cbf0(0xe1)]('fetchQuotedMessage\x20API\x20返回非200:\x20status='+_0x2582c0[_0x12cbf0(0xc1)]+_0x12cbf0(0xdd)+JSON[_0x12cbf0(0xea)](_0x2582c0['data'])),null;const _0x4988b5=_0x2582c0[_0x12cbf0(0xd0)];if(_0x4988b5[_0x12cbf0(0x113)]&&typeof _0x4988b5[_0x12cbf0(0x113)]===_0x12cbf0(0xf0)){const _0x6e5146=_0x4988b5[_0x12cbf0(0x113)][_0x12cbf0(0xc2)];if(typeof _0x6e5146===_0x12cbf0(0x116)&&_0x6e5146)return _0x6e5146['trim']();}if(typeof _0x4988b5[_0x12cbf0(0xc2)]===_0x12cbf0(0x116)&&_0x4988b5[_0x12cbf0(0xc2)])try{const _0x436ca6=JSON[_0x12cbf0(0xf2)](_0x4988b5[_0x12cbf0(0xc2)]);if(typeof _0x436ca6===_0x12cbf0(0x116))return _0x436ca6['trim']();if(_0x436ca6[_0x12cbf0(0x113)])return String(_0x436ca6[_0x12cbf0(0x113)])[_0x12cbf0(0xfb)]();if(_0x436ca6[_0x12cbf0(0xc2)])return String(_0x436ca6[_0x12cbf0(0xc2)])['trim']();}catch{return _0x4988b5[_0x12cbf0(0xc2)][_0x12cbf0(0xfb)]();}if(_0x4988b5[_0x12cbf0(0xcd)]&&typeof _0x4988b5[_0x12cbf0(0xcd)]===_0x12cbf0(0xf0)){const _0x3676b6=_0x4988b5['body'];if(typeof _0x3676b6[_0x12cbf0(0xc2)]===_0x12cbf0(0x116)&&_0x3676b6[_0x12cbf0(0xc2)])return _0x3676b6[_0x12cbf0(0xc2)][_0x12cbf0(0xfb)]();}return _0x41b2c8[_0x12cbf0(0xe1)](_0x12cbf0(0x108)+Object[_0x12cbf0(0xf8)](_0x4988b5)[_0x12cbf0(0xc5)](',')),null;}catch(_0x1b63d0){return console[_0x12cbf0(0x115)]('fetchQuotedMessage\x20请求失败:',_0x1b63d0),null;}}async function queryDingUser(_0xaa4544,_0x1e960d){const _0xaffb6d=a9_0xe4b6ab;try{const _0x42480f=await _0xaa4544[_0xaffb6d(0x110)][_0xaffb6d(0xc4)](),_0x599238=DING_OAPI_BASE+_0xaffb6d(0xcb)+_0x42480f,_0x44adf3=await urllib_1[_0xaffb6d(0xbf)]['request'](_0x599238,{'method':_0xaffb6d(0xff),'data':{'userid':_0x1e960d},'contentType':_0xaffb6d(0xdc),'dataType':_0xaffb6d(0xdc),'timeout':0x1388});if(_0x44adf3[_0xaffb6d(0xc1)]!==0xc8||!_0x44adf3[_0xaffb6d(0xd0)])return _0xaa4544['debugLog'](_0xaffb6d(0xf5)+_0x44adf3[_0xaffb6d(0xc1)]+',\x20data='+JSON['stringify'](_0x44adf3[_0xaffb6d(0xd0)])),null;const _0x254c97=_0x44adf3[_0xaffb6d(0xd0)];if(_0x254c97[_0xaffb6d(0xc3)]!==0x0)return console[_0xaffb6d(0x115)](_0xaffb6d(0xec)+_0x254c97[_0xaffb6d(0xc3)]+_0xaffb6d(0xe4)+_0x254c97[_0xaffb6d(0x10f)]),null;return _0x254c97['result']||null;}catch(_0x356258){return console[_0xaffb6d(0x115)](_0xaffb6d(0xfa),_0x356258),null;}}async function queryUserIdByMobile(_0x483d60,_0x43325c){const _0x594347=a9_0xe4b6ab;try{const _0x5bb719=await _0x483d60[_0x594347(0x110)][_0x594347(0xc4)](),_0x6f2653=DING_OAPI_BASE+'/topapi/v2/user/getbymobile?access_token='+_0x5bb719,_0x25f5f0=await urllib_1[_0x594347(0xbf)][_0x594347(0x114)](_0x6f2653,{'method':_0x594347(0xff),'data':{'mobile':_0x43325c},'contentType':_0x594347(0xdc),'dataType':'json','timeout':0x1388});if(_0x25f5f0[_0x594347(0xc1)]!==0xc8||!_0x25f5f0['data'])return _0x483d60[_0x594347(0xe1)](_0x594347(0xe6)+_0x25f5f0['status']+_0x594347(0xdd)+JSON[_0x594347(0xea)](_0x25f5f0[_0x594347(0xd0)])),null;const _0x4eb3f7=_0x25f5f0[_0x594347(0xd0)];if(_0x4eb3f7[_0x594347(0xc3)]!==0x0)return console['warn']('queryUserIdByMobile\x20接口返回错误:\x20errcode='+_0x4eb3f7[_0x594347(0xc3)]+_0x594347(0xe4)+_0x4eb3f7[_0x594347(0x10f)]),null;const _0xbf42de=_0x4eb3f7[_0x594347(0x107)];return _0xbf42de?.[_0x594347(0x118)]||null;}catch(_0x131151){return console[_0x594347(0x115)]('queryUserIdByMobile\x20请求失败:',_0x131151),null;}}const TOOL_TAGS=['Write',a9_0xe4b6ab(0x117),a9_0xe4b6ab(0x105),a9_0xe4b6ab(0x103),a9_0xe4b6ab(0x104),'Glob',a9_0xe4b6ab(0xed),'Skill',a9_0xe4b6ab(0x111),a9_0xe4b6ab(0xc0),a9_0xe4b6ab(0xd2),a9_0xe4b6ab(0xfd),a9_0xe4b6ab(0xd9),'ExitPlanMode',a9_0xe4b6ab(0xd1),a9_0xe4b6ab(0xe0),a9_0xe4b6ab(0x10b),a9_0xe4b6ab(0xc7),a9_0xe4b6ab(0xe3),a9_0xe4b6ab(0xf9),a9_0xe4b6ab(0x10e),a9_0xe4b6ab(0xf6),'CronList',a9_0xe4b6ab(0xef),a9_0xe4b6ab(0x11c)][a9_0xe4b6ab(0xc5)]('|'),TOOL_USE_SELF_CLOSE_RE=new RegExp('<('+TOOL_TAGS+a9_0xe4b6ab(0xd7),'g'),TOOL_USE_OPEN_CLOSE_RE=new RegExp('<('+TOOL_TAGS+a9_0xe4b6ab(0xd6),'g'),MULTI_NEWLINE_RE=/\n{3,}/g;function filterToolUseContent(_0x1220b6){const _0xc8645a=a9_0xe4b6ab;let _0x464b3d=_0x1220b6[_0xc8645a(0xf7)](TOOL_USE_SELF_CLOSE_RE,'');return _0x464b3d=_0x464b3d[_0xc8645a(0xf7)](TOOL_USE_OPEN_CLOSE_RE,''),_0x464b3d=_0x464b3d[_0xc8645a(0xf7)](MULTI_NEWLINE_RE,'\x0a\x0a'),_0x464b3d[_0xc8645a(0xfb)]();}function splitMessage(_0x4988f6,_0x1bf0cb){const _0xcbf21d=a9_0xe4b6ab,_0x2b94c6=[];while(_0x4988f6[_0xcbf21d(0x109)]>_0x1bf0cb){let _0x1664e5=_0x4988f6['lastIndexOf']('\x0a',_0x1bf0cb);(_0x1664e5===-0x1||_0x1664e5<_0x1bf0cb*0.5)&&(_0x1664e5=_0x4988f6['lastIndexOf']('。',_0x1bf0cb)),(_0x1664e5===-0x1||_0x1664e5<_0x1bf0cb*0.5)&&(_0x1664e5=_0x4988f6[_0xcbf21d(0xe2)]('\x20',_0x1bf0cb)),_0x1664e5===-0x1||_0x1664e5<_0x1bf0cb*0.5?_0x1664e5=_0x1bf0cb:_0x1664e5+=0x1,_0x2b94c6[_0xcbf21d(0xca)](_0x4988f6[_0xcbf21d(0xe7)](0x0,_0x1664e5)[_0xcbf21d(0xfb)]()),_0x4988f6=_0x4988f6[_0xcbf21d(0xe7)](_0x1664e5)['trim']();}return _0x4988f6[_0xcbf21d(0x109)]>0x0&&_0x2b94c6['push'](_0x4988f6),_0x2b94c6;}async function sendDingMessage(_0x3504a3,_0x1171d0){const _0x45c880=a9_0xe4b6ab,{conversationId:_0x14db64,sessionWebhook:_0x450c5e,atUserId:_0x11dda8,content:_0x34fada,msgType:msgType=_0x45c880(0x113)}=_0x1171d0,_0x4e2862=_0x3504a3[_0x45c880(0xd4)][_0x45c880(0xf3)][_0x45c880(0xee)](_0x1ba13a=>_0x1ba13a[_0x45c880(0xe9)]===_0x14db64);let _0x3eb13d=_0x11dda8;_0x4e2862?.[_0x45c880(0xe8)]===![]&&(_0x3eb13d=undefined);const _0x57d792=_0x3eb13d?[_0x3eb13d]:[],_0x58e97d=_0x4e2862?.['dingToken'];let _0x25f4b6=_0x34fada;_0x3eb13d&&msgType===_0x45c880(0xda)&&(_0x25f4b6=_0x34fada+'\x0a@'+_0x3eb13d);const _0x85adcb=msgType===_0x45c880(0xda)?{'msgtype':_0x45c880(0xda),'markdown':{'title':_0x25f4b6,'text':_0x25f4b6},'at':{'atUserIds':_0x57d792,'isAtAll':![]}}:{'msgtype':_0x45c880(0x113),'text':{'content':_0x34fada},'at':{'atUserIds':_0x57d792,'isAtAll':![]}};if(_0x58e97d){const _0x344a69=await _0x3504a3['dingStreamClient'][_0x45c880(0xc4)](),_0x5188a9=_0x45c880(0xde)+_0x58e97d;try{await urllib_1[_0x45c880(0xbf)][_0x45c880(0x114)](_0x5188a9,{'method':_0x45c880(0xff),'data':_0x85adcb,'contentType':_0x45c880(0xdc),'headers':{'x-acs-dingtalk-access-token':_0x344a69},'dataType':_0x45c880(0xdc)});}catch(_0x2f595c){console['error'](_0x45c880(0x10d),_0x2f595c);}}else{if(_0x450c5e){const _0x4da4e7=await _0x3504a3['dingStreamClient']['getAccessToken']();try{await urllib_1[_0x45c880(0xbf)][_0x45c880(0x114)](_0x450c5e,{'method':'POST','data':_0x85adcb,'contentType':_0x45c880(0xdc),'headers':{'x-acs-dingtalk-access-token':_0x4da4e7},'dataType':_0x45c880(0xdc)});}catch(_0x49c7f7){console['error']('通过\x20sessionWebhook\x20发送钉钉消息失败:',_0x49c7f7);}}else{if(_0x3504a3[_0x45c880(0xd4)][_0x45c880(0xd8)]){const _0x5a521e=await _0x3504a3[_0x45c880(0x110)][_0x45c880(0xc4)](),_0x385678=_0x45c880(0xde)+_0x3504a3[_0x45c880(0xd4)][_0x45c880(0xd8)];try{await urllib_1['default'][_0x45c880(0x114)](_0x385678,{'method':_0x45c880(0xff),'data':_0x85adcb,'contentType':'json','headers':{'x-acs-dingtalk-access-token':_0x5a521e},'dataType':_0x45c880(0xdc)});}catch(_0x2a2a37){console['error']('通过\x20defaultDingToken\x20发送钉钉消息失败:',_0x2a2a37);}}else console[_0x45c880(0x101)](_0x45c880(0xdb));}}}async function sendClaudeResponseToDing(_0x2d34a4,_0x3f8362,_0x408b0c,_0x38900f,_0x54140e){const _0xfd8176=a9_0xe4b6ab,_0x42c0df=0x4650,_0x19d710=filterToolUseContent(_0x54140e);if(!_0x19d710){_0x2d34a4[_0xfd8176(0xe1)]('过滤后内容为空,跳过发送');return;}if(_0x19d710[_0xfd8176(0x109)]<=_0x42c0df)await sendDingMessage(_0x2d34a4,{'conversationId':_0x3f8362,'sessionWebhook':_0x408b0c,'atUserId':_0x38900f,'content':_0x19d710,'msgType':_0xfd8176(0xda)});else{const _0x5aadd1=splitMessage(_0x19d710,_0x42c0df);for(let _0x35bbe0=0x0;_0x35bbe0<_0x5aadd1[_0xfd8176(0x109)];_0x35bbe0++){const _0x2e9984=_0x5aadd1[_0xfd8176(0x109)]>0x1?_0xfd8176(0xd3)+(_0x35bbe0+0x1)+'/'+_0x5aadd1[_0xfd8176(0x109)]+_0xfd8176(0xc8):'';await sendDingMessage(_0x2d34a4,{'conversationId':_0x3f8362,'sessionWebhook':_0x408b0c,'atUserId':_0x35bbe0===_0x5aadd1[_0xfd8176(0x109)]-0x1?_0x38900f:'','content':_0x2e9984+_0x5aadd1[_0x35bbe0],'msgType':_0xfd8176(0xda)}),_0x35bbe0<_0x5aadd1[_0xfd8176(0x109)]-0x1&&await utils_ok_1['baseUtil'][_0xfd8176(0xe5)](0x1f4);}}}
@@ -1 +1 @@
1
- 'use strict';const a10_0xff0678=a10_0x5cc6;(function(_0x2c9ce8,_0x2d9d04){const _0x1f556c=a10_0x5cc6,_0x730b1=_0x2c9ce8();while(!![]){try{const _0x18dc0a=parseInt(_0x1f556c(0x1a9))/0x1+parseInt(_0x1f556c(0x19b))/0x2*(parseInt(_0x1f556c(0x1ad))/0x3)+-parseInt(_0x1f556c(0x1a5))/0x4*(-parseInt(_0x1f556c(0x19e))/0x5)+parseInt(_0x1f556c(0x1ab))/0x6*(parseInt(_0x1f556c(0x1a7))/0x7)+parseInt(_0x1f556c(0x1a2))/0x8+-parseInt(_0x1f556c(0x199))/0x9+-parseInt(_0x1f556c(0x1a0))/0xa*(parseInt(_0x1f556c(0x194))/0xb);if(_0x18dc0a===_0x2d9d04)break;else _0x730b1['push'](_0x730b1['shift']());}catch(_0x5cd56a){_0x730b1['push'](_0x730b1['shift']());}}}(a10_0x4813,0x2b6d3));function a10_0x4813(){const _0x26c85f=['\x20──\x0a','string','msgId','1129977pWsKwz','\x20(来自:\x20','34KnJdui','senderNick','text','4210Mdiodk','formatPromptWithQuote','7727620slnpGG','quoteSenderNick','2609544RIlrzN','content','──\x20引用消息','716WtEMIH','extractQuoteInfo','21odKGZv','repliedMsg','100480MvYusf','__esModule','486102dGRveB','trim','45132FeUzzL','quoteText','11zcZlFp','defineProperty'];a10_0x4813=function(){return _0x26c85f;};return a10_0x4813();}Object[a10_0xff0678(0x195)](exports,a10_0xff0678(0x1aa),{'value':!![]}),exports[a10_0xff0678(0x1a6)]=extractQuoteInfo,exports[a10_0xff0678(0x19f)]=formatPromptWithQuote;function extractQuoteInfo(_0xcd85be){const _0x15d8bf=a10_0xff0678,_0x3f42d7=_0xcd85be[_0x15d8bf(0x19d)];if(!_0x3f42d7?.[_0x15d8bf(0x1a8)])return null;const _0x1dbfd8=_0x3f42d7[_0x15d8bf(0x1a8)];let _0x262826='';const _0x398bfa=_0x1dbfd8[_0x15d8bf(0x198)],_0x253b06=_0x1dbfd8[_0x15d8bf(0x19c)];if(_0x1dbfd8['content']){if(typeof _0x1dbfd8[_0x15d8bf(0x1a3)]['text']===_0x15d8bf(0x197))_0x262826=_0x1dbfd8[_0x15d8bf(0x1a3)][_0x15d8bf(0x19d)][_0x15d8bf(0x1ac)]();else typeof _0x1dbfd8['content']===_0x15d8bf(0x197)&&(_0x262826=_0x1dbfd8[_0x15d8bf(0x1a3)][_0x15d8bf(0x1ac)]());}if(!_0x262826&&!_0x398bfa)return null;return{'quoteText':_0x262826,'quoteMessageId':_0x398bfa,'quoteSenderNick':_0x253b06};}function a10_0x5cc6(_0x253da9,_0x5af2d4){_0x253da9=_0x253da9-0x194;const _0x481330=a10_0x4813();let _0x5cc676=_0x481330[_0x253da9];return _0x5cc676;}function formatPromptWithQuote(_0x38c439,_0x5a8493){const _0x18ee87=a10_0xff0678;if(!_0x5a8493[_0x18ee87(0x1ae)])return _0x38c439;const _0x34504a=_0x5a8493[_0x18ee87(0x1a1)]?_0x18ee87(0x19a)+_0x5a8493[_0x18ee87(0x1a1)]+')':'';return _0x18ee87(0x1a4)+_0x34504a+_0x18ee87(0x196)+_0x5a8493[_0x18ee87(0x1ae)]+'\x0a──\x20引用结束\x20──\x0a\x0a'+_0x38c439;}
1
+ 'use strict';const a10_0x7c5a8c=a10_0x169a;(function(_0x333cd5,_0x207301){const _0x105396=a10_0x169a,_0x216318=_0x333cd5();while(!![]){try{const _0x3bad61=-parseInt(_0x105396(0xf4))/0x1*(-parseInt(_0x105396(0x107))/0x2)+parseInt(_0x105396(0xf0))/0x3+-parseInt(_0x105396(0x100))/0x4+parseInt(_0x105396(0x103))/0x5+-parseInt(_0x105396(0xf3))/0x6+-parseInt(_0x105396(0xf7))/0x7*(-parseInt(_0x105396(0xfb))/0x8)+-parseInt(_0x105396(0xfd))/0x9*(parseInt(_0x105396(0xfe))/0xa);if(_0x3bad61===_0x207301)break;else _0x216318['push'](_0x216318['shift']());}catch(_0x5c361a){_0x216318['push'](_0x216318['shift']());}}}(a10_0x1a09,0xd973d));function a10_0x1a09(){const _0x5c741c=['repliedMsg','2822942wWTHLR','quoteText','trim','1638684IPmeuT','extractQuoteInfo','string','7690542PJXWdF','1JYDYLK','text','msgId','14UCdqKK','\x20──\x0a','content','\x0a──\x20引用结束\x20──\x0a\x0a','6838328UxyOdx','\x20(来自:\x20','63FEupiQ','2762920sibssW','quoteSenderNick','1262676VPgoUS','__esModule','──\x20引用消息','3774370HZIBtM','formatPromptWithQuote','defineProperty'];a10_0x1a09=function(){return _0x5c741c;};return a10_0x1a09();}Object[a10_0x7c5a8c(0x105)](exports,a10_0x7c5a8c(0x101),{'value':!![]}),exports[a10_0x7c5a8c(0xf1)]=extractQuoteInfo,exports[a10_0x7c5a8c(0x104)]=formatPromptWithQuote;function a10_0x169a(_0x1ae14b,_0x281c73){_0x1ae14b=_0x1ae14b-0xef;const _0x1a09a2=a10_0x1a09();let _0x169a01=_0x1a09a2[_0x1ae14b];return _0x169a01;}function extractQuoteInfo(_0x4335a5){const _0x6decc0=a10_0x7c5a8c,_0x754889=_0x4335a5[_0x6decc0(0xf5)];if(!_0x754889?.[_0x6decc0(0x106)])return null;const _0x358183=_0x754889[_0x6decc0(0x106)];let _0x4e4ccd='';const _0x45d2af=_0x358183[_0x6decc0(0xf6)],_0x120dc0=_0x358183['senderNick'];if(_0x358183['content']){if(typeof _0x358183[_0x6decc0(0xf9)][_0x6decc0(0xf5)]===_0x6decc0(0xf2))_0x4e4ccd=_0x358183[_0x6decc0(0xf9)][_0x6decc0(0xf5)][_0x6decc0(0xef)]();else typeof _0x358183[_0x6decc0(0xf9)]==='string'&&(_0x4e4ccd=_0x358183['content'][_0x6decc0(0xef)]());}if(!_0x4e4ccd&&!_0x45d2af)return null;return{'quoteText':_0x4e4ccd,'quoteMessageId':_0x45d2af,'quoteSenderNick':_0x120dc0};}function formatPromptWithQuote(_0x4af3b3,_0x400116){const _0x57bee2=a10_0x7c5a8c;if(!_0x400116[_0x57bee2(0x108)])return _0x4af3b3;const _0x10806b=_0x400116[_0x57bee2(0xff)]?_0x57bee2(0xfc)+_0x400116[_0x57bee2(0xff)]+')':'';return _0x57bee2(0x102)+_0x10806b+_0x57bee2(0xf8)+_0x400116[_0x57bee2(0x108)]+_0x57bee2(0xfa)+_0x4af3b3;}