woozlit 2.1.0 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/login.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/server.js +1 -1
- package/dist/browser/tools.js +1 -1
- package/dist/chat/agent.js +1 -1
- package/dist/config/mcp.js +1 -1
- package/dist/config/settings.js +1 -1
- package/dist/discord/client.js +1 -1
- package/dist/discord/config.js +1 -1
- package/dist/discord/index.js +1 -1
- package/dist/discord/setup.js +1 -1
- package/dist/email/config.js +1 -1
- package/dist/email/index.js +1 -1
- package/dist/email/service.js +1 -1
- package/dist/email/setup.js +1 -1
- package/dist/github/api.js +1 -1
- package/dist/github/auth.js +1 -1
- package/dist/github/auto-setup.js +1 -1
- package/dist/github/index.js +1 -1
- package/dist/github/manual-setup.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-servers/computer-use.js +1 -1
- package/dist/services/bot-manager.js +1 -1
- package/dist/services/voice-agent.js +1 -1
- package/dist/telegram/bot.js +1 -1
- package/dist/telegram/config.js +1 -1
- package/dist/telegram/index.js +1 -1
- package/dist/telegram/reminders.js +1 -1
- package/dist/telegram/setup.js +1 -1
- package/dist/tools/command.js +1 -1
- package/dist/tools/file.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp.js +1 -1
- package/dist/tools/rollback.js +1 -1
- package/dist/tools/rules.js +1 -1
- package/dist/twilio/config.js +1 -1
- package/dist/twilio/index.js +1 -1
- package/dist/twilio/server.js +1 -1
- package/dist/twilio/setup.js +1 -1
- package/dist/ui/output.js +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/themes.js +1 -1
- package/dist/utils/api.js +1 -1
- package/dist/utils/chat-history.d.ts +15 -0
- package/dist/utils/chat-history.js +1 -0
- package/dist/utils/history.js +1 -1
- package/dist/utils/mcp-installer.js +1 -1
- package/dist/utils/platform.js +1 -1
- package/dist/utils/storage.js +1 -1
- package/dist/utils/update-check.js +1 -1
- package/dist/verify_repro.js +1 -1
- package/package.json +1 -1
package/dist/telegram/bot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a24_0x4abd99=a24_0x4152;(function(_0x97fdf8,_0xaf43f1){const _0x1a282f=a24_0x4152,_0x4e2556=_0x97fdf8();while(!![]){try{const _0x5cf3a8=parseInt(_0x1a282f(0xe6))/0x1+parseInt(_0x1a282f(0xf7))/0x2+-parseInt(_0x1a282f(0xd4))/0x3+parseInt(_0x1a282f(0x13a))/0x4+parseInt(_0x1a282f(0x13d))/0x5+parseInt(_0x1a282f(0x111))/0x6*(parseInt(_0x1a282f(0xe5))/0x7)+parseInt(_0x1a282f(0x12f))/0x8*(-parseInt(_0x1a282f(0x101))/0x9);if(_0x5cf3a8===_0xaf43f1)break;else _0x4e2556['push'](_0x4e2556['shift']());}catch(_0x1ff1ff){_0x4e2556['push'](_0x4e2556['shift']());}}}(a24_0x3559,0x712f7));import{Bot,InputFile}from'grammy';import{promises as a24_0x3a23b9}from'fs';import{tmpdir}from'os';import{join}from'path';import*as a24_0x4e728a from'./config.js';import{checkReminders,scheduleReminder}from'./reminders.js';import{sendChatMessage}from'../utils/api.js';import{getSelectedModel}from'../utils/storage.js';function a24_0x4152(_0x28125d,_0x14fa11){_0x28125d=_0x28125d-0x8b;const _0x35591f=a24_0x3559();let _0x41528c=_0x35591f[_0x28125d];return _0x41528c;}import{createFile,readFile,listDirectory,editFile,runCommand,searchFile,readTerminalOutput,sendTerminalInput,terminateProcess}from'../tools/index.js';import{processVoiceMessage}from'../services/voice-agent.js';import*as a24_0x1ef8a6 from'../ui/output.js';import{createRequire}from'module';import{Jimp}from'jimp';const require=createRequire(import.meta.url);let bot=null,isRunning=![];function a24_0x3559(){const _0x2cc2d7=['...','.woozlit','PARSED\x20TOOL:\x20','delete','value','edit_file','Executing\x20','/status','Running:\x20','Browser\x20Screenshot','-\x20Request:\x20\x22','pids','content','read_terminal','parse','\x0aProcesses:\x20','send_input','create_file','getFile','Voice\x20processing\x20error:\x20','screenshot_','reply','catch','create-next-app','Desktop','getBotToken','url','USERPROFILE','getScreenSize','stop','toFixed','[Voice\x20Message]:\x20','Creating\x20file:\x20','~2s','Voice\x20error:\x20','name','has','Done\x20in\x20','.ogg','Invalid\x20bot\x20token.','Bot\x20start\x20failed:\x20','pid','mkdir','robotjs\x20not\x20available\x20to\x20capture\x20photo','[Telegram]\x20Tool\x20error:\x20','Woozlit\x20Remote\x0a\x0aConnected:\x20','You\x20are\x20Woozlit\x20AI.\x20Complete\x20tasks\x20autonomously.\x0a\x0aCRITICAL\x20RULES:\x0a1.\x20**EXECUTE\x20IMMEDIATELY**:\x20When\x20user\x20requests\x20an\x20action,\x20execute\x20the\x20tool\x20FIRST,\x20explain\x20NEVER.\x0a2.\x20**NO\x20EMOJIS**:\x20Never\x20use\x20emojis\x20in\x20any\x20response.\x0a3.\x20**NO\x20CONVERSATIONAL\x20ERRORS**:\x20If\x20a\x20browser\x20command\x20cannot\x20be\x20executed,\x20just\x20execute\x20it\x20anyway.\x20Never\x20explain\x20limitations.\x0a4.\x20**CONCISE**:\x20Maximum\x201-2\x20sentences\x20for\x20final\x20responses.\x20No\x20filler.\x0a5.\x20**TOOL\x20FORMAT**:\x20Use\x20THREE\x20backticks\x20(```)\x20NOT\x20asterisks\x20(***)\x20for\x20tool\x20blocks.\x0a\x0aTOOLS:\x0a-\x20run_command:\x20{command,\x20wait\x20(ms,\x20default\x2030000),\x20background\x20(bool)}\x0a-\x20read_terminal:\x20{}\x20-\x20check\x20running\x20process\x20output\x0a-\x20send_input:\x20{input}\x20-\x20answer\x20prompts\x0a-\x20terminate:\x20{}\x20-\x20kill\x20stuck\x20process\x0a-\x20create_file:\x20{path,\x20content}\x0a-\x20read_file:\x20{path}\x0a-\x20list_directory:\x20{path}\x0a-\x20edit_file:\x20{path,\x20search,\x20replace}\x0a-\x20screenshot:\x20{}\x20-\x20capture\x20desktop\x0a-\x20schedule_reminder:\x20{delayMinutes:\x20number,\x20message:\x20string}\x0a-\x20github_read_file:\x20{owner,\x20repo,\x20path,\x20branch}\x0a-\x20github_create_branch:\x20{owner,\x20repo,\x20branchName,\x20fromBranch}\x0a-\x20github_create_pr:\x20{owner,\x20repo,\x20title,\x20head,\x20base,\x20body}\x0a-\x20browser_open:\x20{url}\x0a-\x20browser_click:\x20{selector}\x0a-\x20browser_fill:\x20{selector,\x20value}\x0a-\x20browser_screenshot:\x20{}\x0a-\x20browser_snapshot:\x20{}\x0a\x0aBROWSER\x20COMMANDS\x20-\x20EXECUTE\x20IMMEDIATELY:\x0aWhen\x20user\x20says\x20\x22open\x20[site]\x22,\x20\x22go\x20to\x20[url]\x22,\x20\x22navigate\x20to\x20[url]\x22:\x0a```tool\x0a{\x22name\x22:\x22browser_open\x22,\x22args\x22:{\x22url\x22:\x22https://example.com\x22}}\x0a```\x0a\x0aDO\x20NOT\x20respond\x20with:\x0a-\x20\x22I\x20understand\x20you\x27d\x20like\x20me\x20to...\x22\x0a-\x20\x22I\x20need\x20the\x20extension\x20to\x20be\x20connected...\x22\x0a-\x20\x22Apologies\x20for\x20the\x20inconvenience\x22\x0a-\x20Any\x20explanation\x20about\x20what\x20you\x27re\x20about\x20to\x20do\x0a\x0aJUST\x20EXECUTE\x20THE\x20TOOL.\x0a\x0aEXAMPLE:\x0aUser:\x20\x22open\x20discord\x22\x0aYou:\x0a```tool\x0a{\x22name\x22:\x22browser_open\x22,\x22args\x22:{\x22url\x22:\x22https://discord.com\x22}}\x0a```','then','system','fromBranch','actionSummary','run_command','1776978eNHANI','Telegram\x20bot\x20started!','path','success','from','head','request','voice_','Tool\x20error:\x20','cwd','build','writeFile','assistant','~30s','add','Taking\x20screenshot...','Tool\x20result\x20for\x20','1942591JxrrML','700101GwkPcm','error','input','branchName','isAllowedChatId','search','Dir:\x20','search_file','owner','history.json','message:text','bitmap','Cleared','slice','sendPhoto','voice','trim','1065700OwZwTL','match','info','push','args','replyWithPhoto','Telegram\x20bot\x20already\x20running.','pnpm\x20init','dim','stringify','2196vBMzmB','file_path','terminate','.\x20Try\x20again\x20or\x20skip.','401','~2-3\x20min','env','Stopped\x20(max\x20steps)','replace','\x0a\x0aTask\x20Summary:\x0a','read_file','delayMinutes','typing','message_id','~1-2\x20min','sendChatAction','6UMVGhm','image','browser_screenshot','../github/api.js','@hurdlegroup/robotjs','split','user','list_directory','join','clear','api','warn','message','message:voice','title','file_id','now','screen','chat','deleteWebhook','image/jpeg','repo','HOME','browser_open','.jpeg','width','base64','../browser/index.js','addAllowedChatId','/screenshot','53880FZeKod','screenshot','Screenshot\x20failed:\x20','selector','Failed:\x20','get','npm\x20install','git\x20clone','https://api.telegram.org/file/bot','Unknown\x20tool:\x20','editMessageText','3070880VRcEGa','[Telegram]\x20Iteration\x20','command','2105445moHNyJ','set','replyWithChatAction','text','\x20(Voice):\x20','message\x20is\x20not\x20modified','arrayBuffer','data','Verified','length','toolSuccess','sendMessage','map','upload_photo','branch','~1\x20min','\x0aModel:\x20','readFile','first_name','[Telegram]\x20','npm\x20init','body','includes','unlink'];a24_0x3559=function(){return _0x2cc2d7;};return a24_0x3559();}const verifiedSessions=new Set(),statusMessages=new Map(),chatHistories=new Map(),WOOZLIT_DIR=join(process['env'][a24_0x4abd99(0xbb)]||process[a24_0x4abd99(0x107)][a24_0x4abd99(0x127)]||'.',a24_0x4abd99(0xa1)),HISTORY_FILE=join(WOOZLIT_DIR,a24_0x4abd99(0xef));async function ensureWoozlitDir(){const _0x33029b=a24_0x4abd99;try{await a24_0x3a23b9[_0x33029b(0xca)](WOOZLIT_DIR,{'recursive':!![]});}catch{}}async function getTaskHistory(){const _0x1fdadb=a24_0x4abd99;try{const _0xd2164=await a24_0x3a23b9[_0x1fdadb(0x99)](HISTORY_FILE,'utf-8');return JSON[_0x1fdadb(0xae)](_0xd2164);}catch{return[];}}async function saveTaskHistory(_0xaf4a83,_0x2773e2){const _0x7f6f6d=a24_0x4abd99;await ensureWoozlitDir();const _0x2118ce=await getTaskHistory();_0x2118ce[_0x7f6f6d(0xfa)]({'timestamp':Date[_0x7f6f6d(0x121)](),'request':_0xaf4a83,'actionSummary':_0x2773e2});if(_0x2118ce[_0x7f6f6d(0x91)]>0x14)_0x2118ce['shift']();await a24_0x3a23b9[_0x7f6f6d(0xdf)](HISTORY_FILE,JSON[_0x7f6f6d(0x100)](_0x2118ce,null,0x2));}function formatHistoryForPrompt(_0x20781b){const _0x19f115=a24_0x4abd99;if(_0x20781b['length']===0x0)return'';return'\x0a\x0aRECENT\x20TASK\x20HISTORY\x20(Use\x20this\x20context):\x0a'+_0x20781b[_0x19f115(0xf3)](-0x5)[_0x19f115(0x94)](_0x1bbc3a=>_0x19f115(0xaa)+_0x1bbc3a[_0x19f115(0xda)]+'\x22\x0a\x20\x20Actions:\x20'+_0x1bbc3a[_0x19f115(0xd2)][_0x19f115(0x119)](',\x20'))[_0x19f115(0x119)]('\x0a');}function getSystemPrompt(_0x758957){const _0x4c55ff=a24_0x4abd99;return _0x4c55ff(0xce)+_0x758957;}async function getOrCreateHistory(_0x323b28){const _0x1969cb=a24_0x4abd99;if(!chatHistories[_0x1969cb(0xc4)](_0x323b28)){const _0x586b1f='';chatHistories[_0x1969cb(0x13e)](_0x323b28,[{'role':_0x1969cb(0xd0),'content':getSystemPrompt(_0x586b1f)}]);}return chatHistories[_0x1969cb(0x134)](_0x323b28);}async function updateStatus(_0x132e25,_0x5b737d){const _0x16c517=a24_0x4abd99;if(!bot)return;const _0x57a58b=statusMessages['get'](_0x132e25);if(_0x57a58b)try{await bot[_0x16c517(0x11b)][_0x16c517(0x139)](_0x132e25,_0x57a58b,_0x5b737d);return;}catch(_0x4a0ee5){if(_0x4a0ee5[_0x16c517(0x11d)]&&_0x4a0ee5[_0x16c517(0x11d)][_0x16c517(0x9e)](_0x16c517(0x8d)))return;statusMessages['delete'](_0x132e25);}try{const _0x60da5e=await bot[_0x16c517(0x11b)][_0x16c517(0x93)](_0x132e25,_0x5b737d);statusMessages['set'](_0x132e25,_0x60da5e[_0x16c517(0x10e)]);}catch(_0x874230){}}async function takeScreenshot(){const _0x294c8d=a24_0x4abd99,_0x2523d4=_0x294c8d(0xb4)+Date[_0x294c8d(0x121)]()+_0x294c8d(0x129),_0x1fafda=join(tmpdir(),_0x2523d4);let _0x57fc2f;try{_0x57fc2f=require(_0x294c8d(0x115));const _0x55d063=_0x57fc2f[_0x294c8d(0xbc)](),_0x2a4679=_0x57fc2f[_0x294c8d(0x122)]['capture'](0x0,0x0,_0x55d063[_0x294c8d(0x12a)],_0x55d063['height']),_0x23ea61=new Jimp({'width':_0x2a4679[_0x294c8d(0x12a)],'height':_0x2a4679['height']});for(let _0x339c37=0x0;_0x339c37<_0x2a4679[_0x294c8d(0x112)][_0x294c8d(0x91)];_0x339c37+=0x4){_0x23ea61[_0x294c8d(0xf1)][_0x294c8d(0x8f)][_0x339c37]=_0x2a4679[_0x294c8d(0x112)][_0x339c37+0x2],_0x23ea61[_0x294c8d(0xf1)][_0x294c8d(0x8f)][_0x339c37+0x1]=_0x2a4679[_0x294c8d(0x112)][_0x339c37+0x1],_0x23ea61[_0x294c8d(0xf1)][_0x294c8d(0x8f)][_0x339c37+0x2]=_0x2a4679['image'][_0x339c37],_0x23ea61[_0x294c8d(0xf1)][_0x294c8d(0x8f)][_0x339c37+0x3]=_0x2a4679[_0x294c8d(0x112)][_0x339c37+0x3];}_0x23ea61[_0x294c8d(0xf1)][_0x294c8d(0x12a)]>0x500&&_0x23ea61['resize']({'w':0x500});const _0x48cd82=await _0x23ea61['getBuffer'](_0x294c8d(0x125));await a24_0x3a23b9[_0x294c8d(0xdf)](_0x1fafda,_0x48cd82);}catch(_0x52bd9d){throw new Error(_0x294c8d(0xcb));}return _0x1fafda;}async function executeToolCall(_0x5d8b13,_0xd8c8c4,_0x41375a){const _0x4ed362=a24_0x4abd99;switch(_0x5d8b13){case'screenshot':try{statusMessages[_0x4ed362(0xa3)](_0x41375a);const _0x2d13af=await takeScreenshot();return await bot?.[_0x4ed362(0x11b)]['sendPhoto'](_0x41375a,new InputFile(_0x2d13af),{'caption':_0x4ed362(0xb8)}),await a24_0x3a23b9[_0x4ed362(0x9f)](_0x2d13af)[_0x4ed362(0xb6)](()=>{}),{'success':!![],'sent':!![]};}catch(_0x4ed328){return{'error':_0x4ed362(0x131)+_0x4ed328};}case _0x4ed362(0xad):return readTerminalOutput(_0xd8c8c4[_0x4ed362(0xc9)]);case _0x4ed362(0xb0):return sendTerminalInput(_0xd8c8c4[_0x4ed362(0xe8)],_0xd8c8c4[_0x4ed362(0xc9)]);case _0x4ed362(0x103):return terminateProcess(_0xd8c8c4[_0x4ed362(0xc9)]);case _0x4ed362(0xb1):return createFile(_0xd8c8c4[_0x4ed362(0xd6)],_0xd8c8c4[_0x4ed362(0xac)]);case _0x4ed362(0x10b):return readFile(_0xd8c8c4['path']);case _0x4ed362(0x118):return listDirectory(_0xd8c8c4[_0x4ed362(0xd6)]||'.');case _0x4ed362(0xa5):return editFile(_0xd8c8c4[_0x4ed362(0xd6)],_0xd8c8c4[_0x4ed362(0xeb)],_0xd8c8c4['replace']);case _0x4ed362(0xed):return searchFile(_0xd8c8c4[_0x4ed362(0xd6)],_0xd8c8c4['pattern']);case _0x4ed362(0xd3):const {command:_0x3757bd,background:_0x272c6c,wait:_0x3d42ac}=_0xd8c8c4,_0x1c351d=await runCommand(_0x3757bd,undefined,_0x272c6c||![],_0x3d42ac||0x7530);return _0x1c351d;case'schedule_reminder':return scheduleReminder(_0x41375a,_0xd8c8c4[_0x4ed362(0x10c)],_0xd8c8c4['message']);case'github_read_file':{const {readFile:_0x3d58f6}=await import(_0x4ed362(0x114));return _0x3d58f6(_0xd8c8c4[_0x4ed362(0xee)],_0xd8c8c4[_0x4ed362(0x126)],_0xd8c8c4['path'],_0xd8c8c4[_0x4ed362(0x96)]);}case'github_create_branch':{const {createBranch:_0x37002e}=await import('../github/api.js');return _0x37002e(_0xd8c8c4[_0x4ed362(0xee)],_0xd8c8c4[_0x4ed362(0x126)],_0xd8c8c4[_0x4ed362(0xe9)],_0xd8c8c4[_0x4ed362(0xd1)]);}case'github_create_pr':{const {createPullRequest:_0x38f42a}=await import(_0x4ed362(0x114));return _0x38f42a(_0xd8c8c4['owner'],_0xd8c8c4[_0x4ed362(0x126)],_0xd8c8c4[_0x4ed362(0x11f)],_0xd8c8c4[_0x4ed362(0xd9)],_0xd8c8c4['base'],_0xd8c8c4[_0x4ed362(0x9d)]);}case _0x4ed362(0x128):{const {browserOpen:_0x2590c6,startBrowserServer:_0x405c87,isBrowserServerRunning:_0x1f0baa}=await import(_0x4ed362(0x12c));return!_0x1f0baa()&&await _0x405c87(),_0x2590c6(_0xd8c8c4[_0x4ed362(0xba)]);}case'browser_click':{const {browserClick:_0x5db650}=await import(_0x4ed362(0x12c));return _0x5db650(_0xd8c8c4[_0x4ed362(0x132)]);}case'browser_fill':{const {browserFill:_0x3ddcb4}=await import('../browser/index.js');return _0x3ddcb4(_0xd8c8c4[_0x4ed362(0x132)],_0xd8c8c4[_0x4ed362(0xa4)]);}case'browser_snapshot':{const {browserSnapshot:_0x2e8250}=await import(_0x4ed362(0x12c));return _0x2e8250();}case _0x4ed362(0x113):{const {browserScreenshot:_0x2e593b}=await import(_0x4ed362(0x12c)),_0x4507ef=await _0x2e593b();if(_0x4507ef[_0x4ed362(0xd7)]&&_0x4507ef[_0x4ed362(0x8f)]){const _0x4f8601=_0x4507ef[_0x4ed362(0x8f)][_0x4ed362(0x109)](/^data:image\/\w+;base64,/,''),_0x233297=Buffer[_0x4ed362(0xd8)](_0x4f8601,_0x4ed362(0x12b));return statusMessages[_0x4ed362(0xa3)](_0x41375a),await bot?.['api'][_0x4ed362(0xf4)](_0x41375a,new InputFile(_0x233297),{'caption':_0x4ed362(0xa9)}),{'success':!![],'sent':!![]};}return _0x4507ef;}case'browser_close':{const {browserClose:_0x885a50}=await import(_0x4ed362(0x12c));return _0x885a50();}default:return{'error':_0x4ed362(0x138)+_0x5d8b13};}}function estimateTime(_0x176624,_0x538025){const _0x4f3288=a24_0x4abd99;if(_0x176624===_0x4f3288(0x130))return _0x4f3288(0xc1);if(_0x176624===_0x4f3288(0xad)||_0x176624==='send_input'||_0x176624===_0x4f3288(0x103))return'~1s';if(_0x176624===_0x4f3288(0xd3)){const _0x2b9be1=(_0x538025[_0x4f3288(0x13c)]||'')['toLowerCase']();if(_0x2b9be1['includes'](_0x4f3288(0xb7))||_0x2b9be1[_0x4f3288(0x9e)]('create-vite'))return _0x4f3288(0x106);if(_0x2b9be1[_0x4f3288(0x9e)](_0x4f3288(0x135))||_0x2b9be1[_0x4f3288(0x9e)]('pnpm\x20install'))return'~1-2\x20min';if(_0x2b9be1[_0x4f3288(0x9e)](_0x4f3288(0x9c))||_0x2b9be1[_0x4f3288(0x9e)](_0x4f3288(0xfe)))return _0x4f3288(0xe1);if(_0x2b9be1[_0x4f3288(0x9e)](_0x4f3288(0x136)))return _0x4f3288(0x97);if(_0x2b9be1[_0x4f3288(0x9e)](_0x4f3288(0xde)))return _0x4f3288(0x10f);}return _0x4f3288(0xc1);}function getActionDescription(_0x4d1807,_0x203afd){const _0x3f996b=a24_0x4abd99;if(_0x4d1807===_0x3f996b(0xd3)){let _0x252a31=_0x203afd[_0x3f996b(0x13c)]||_0x3f996b(0x13c);if(_0x252a31[_0x3f996b(0x91)]>0x1e)_0x252a31=_0x252a31['substring'](0x0,0x1b)+_0x3f996b(0xa0);return _0x3f996b(0xa8)+_0x252a31;}if(_0x4d1807===_0x3f996b(0xb1))return _0x3f996b(0xc0)+_0x203afd[_0x3f996b(0xd6)];if(_0x4d1807==='edit_file')return'Editing\x20file:\x20'+_0x203afd[_0x3f996b(0xd6)];if(_0x4d1807===_0x3f996b(0x130))return _0x3f996b(0xe3);return _0x3f996b(0xa6)+_0x4d1807+_0x3f996b(0xa0);}async function processTelegramAgentLoop(_0x148426,_0x573f01,_0x39581c,_0x220e5c){const _0x1a467e=a24_0x4abd99;let _0x35842b=0x0;const _0x6bb1da=0x14;let _0x124eeb=![];const _0x5bcd59=[];while(_0x35842b<_0x6bb1da){_0x35842b++;bot&&bot[_0x1a467e(0x11b)][_0x1a467e(0x110)](_0x148426,_0x1a467e(0x10d))[_0x1a467e(0xb6)](()=>{});a24_0x1ef8a6[_0x1a467e(0xff)](_0x1a467e(0x13b)+_0x35842b+'...');let _0x3ca70e='';try{const _0x53eda2=await sendChatMessage(_0x39581c,_0x573f01,_0x308097=>{_0x3ca70e+=_0x308097;});_0x3ca70e=_0x53eda2['content'];}catch(_0x856cca){await bot?.['api'][_0x1a467e(0x93)](_0x148426,_0x1a467e(0x133)+(_0x856cca[_0x1a467e(0x11d)]?.['substring'](0x0,0x1e)||'Error'));return;}_0x573f01[_0x1a467e(0xfa)]({'role':_0x1a467e(0xe0),'content':_0x3ca70e});let _0x1a7e1b=_0x3ca70e[_0x1a467e(0xf8)](/```tool\s*([\s\S]*?)```/);!_0x1a7e1b&&(_0x1a7e1b=_0x3ca70e[_0x1a467e(0xf8)](/\*\*\*tool\s*([\s\S]*?)\*\*\*/));!_0x1a7e1b&&(_0x1a7e1b=_0x3ca70e[_0x1a467e(0xf8)](/\`\`\`json\s*({[\s\S]*?"name"[\s\S]*?})\s*\`\`\`/));if(!_0x1a7e1b){let _0xa54d4a=_0x3ca70e[_0x1a467e(0x109)](/\<reasoning\>[\s\S]*?\<\/reasoning\>/g,'')[_0x1a467e(0x109)](/\<text\>|\<\/text\>/g,'')['replace'](/```tool[\s\S]*?```/g,'')['replace'](/\*\*\*tool[\s\S]*?\*\*\*/g,'')[_0x1a467e(0x109)](/```json\s*{\s*"tool"[\s\S]*?```/g,'')[_0x1a467e(0x109)](/```json\s*{\s*"command"[\s\S]*?```/g,'')[_0x1a467e(0x109)](/\*\*(.+?)\*\*/g,'$1')[_0x1a467e(0x109)](/\*(.+?)\*/g,'$1')[_0x1a467e(0x109)](/__(.+?)__/g,'$1')[_0x1a467e(0x109)](/_(.+?)_/g,'$1')[_0x1a467e(0x109)](/#{1,6}\s*/g,'')[_0x1a467e(0x109)](/^[-*+]\s+/gm,'')['replace'](/^\d+\.\s+/gm,'')[_0x1a467e(0x109)](/`([^`]+)`/g,'$1')[_0x1a467e(0x109)](/\[([^\]]+)\]\([^)]+\)/g,'$1')[_0x1a467e(0xf6)]();const _0x2daa1e=_0xa54d4a[_0x1a467e(0x116)]('\x0a')['filter'](_0x4f19db=>_0x4f19db[_0x1a467e(0xf6)]()&&_0x4f19db[_0x1a467e(0xf6)]()[_0x1a467e(0x91)]>0x1);if(_0xa54d4a[_0x1a467e(0xf6)]()){if(_0x5bcd59[_0x1a467e(0x91)]>0x0){await saveTaskHistory(_0x220e5c,_0x5bcd59);const _0x2cd71e=_0x1a467e(0x10a)+_0x5bcd59[_0x1a467e(0x94)](_0x1b0eb0=>'-\x20'+_0x1b0eb0)[_0x1a467e(0x119)]('\x0a');await bot?.['api']['sendMessage'](_0x148426,_0xa54d4a+_0x2cd71e)[_0x1a467e(0xb6)](()=>{});}else await bot?.[_0x1a467e(0x11b)][_0x1a467e(0x93)](_0x148426,_0xa54d4a)[_0x1a467e(0xb6)](()=>{});}break;}try{const _0x5d634d=_0x1a7e1b[0x1][_0x1a467e(0xf6)]();a24_0x1ef8a6[_0x1a467e(0xff)]('TOOL\x20JSON:\x20'+_0x5d634d);const _0xfd51a=JSON[_0x1a467e(0xae)](_0x5d634d);a24_0x1ef8a6[_0x1a467e(0xff)](_0x1a467e(0xa2)+JSON[_0x1a467e(0x100)](_0xfd51a));const _0x54b03d=estimateTime(_0xfd51a[_0x1a467e(0xc3)],_0xfd51a['args']),_0x128426=getActionDescription(_0xfd51a[_0x1a467e(0xc3)],_0xfd51a[_0x1a467e(0xfb)]);_0x5bcd59['push'](_0x128426[_0x1a467e(0x109)](/\(\~.*\)/,'')[_0x1a467e(0xf6)]()),await updateStatus(_0x148426,_0x128426+'\x20('+_0x54b03d+')'),_0x124eeb=!![],a24_0x1ef8a6[_0x1a467e(0xf9)]('[Telegram]\x20Starting\x20tool\x20'+_0xfd51a[_0x1a467e(0xc3)]);const _0x58d413=performance[_0x1a467e(0x121)](),_0x1f1406=await executeToolCall(_0xfd51a[_0x1a467e(0xc3)],_0xfd51a[_0x1a467e(0xfb)],_0x148426),_0x371bd3=((performance[_0x1a467e(0x121)]()-_0x58d413)/0x3e8)[_0x1a467e(0xbe)](0x1);a24_0x1ef8a6[_0x1a467e(0x92)](_0xfd51a[_0x1a467e(0xc3)],Object['values'](_0xfd51a[_0x1a467e(0xfb)])[0x0]||'',_0x1a467e(0xc5)+_0x371bd3+'s'),_0x573f01[_0x1a467e(0xfa)]({'role':'user','content':_0x1a467e(0xe4)+_0xfd51a[_0x1a467e(0xc3)]+':\x0a'+JSON[_0x1a467e(0x100)](_0x1f1406,null,0x2)}),await new Promise(_0x3ebc5f=>setTimeout(_0x3ebc5f,0xc8));}catch(_0x22c0e6){a24_0x1ef8a6[_0x1a467e(0xe7)](_0x1a467e(0xcc)+_0x22c0e6),_0x573f01[_0x1a467e(0xfa)]({'role':_0x1a467e(0x117),'content':_0x1a467e(0xdc)+_0x22c0e6+_0x1a467e(0x104)});}}_0x35842b>=_0x6bb1da&&await bot?.[_0x1a467e(0x11b)][_0x1a467e(0x93)](_0x148426,_0x1a467e(0x108));}async function handleMessage(_0x198073){const _0x33ac6a=a24_0x4abd99,_0x22cd8e=_0x198073[_0x33ac6a(0x11d)]?.['text']?.[_0x33ac6a(0xf6)](),_0x4d0898=_0x198073[_0x33ac6a(0xd8)]?.['id'];if(!_0x22cd8e||!_0x4d0898||!_0x198073[_0x33ac6a(0x123)]?.['id'])return;const _0x2ed452=_0x198073[_0x33ac6a(0x123)]['id'],_0x541a40=_0x4d0898;if(!a24_0x4e728a[_0x33ac6a(0xea)](_0x541a40)){const _0x3bbdf3=a24_0x4e728a['getSecurityPin']();if(_0x3bbdf3&&!verifiedSessions[_0x33ac6a(0xc4)](_0x541a40)){if(_0x22cd8e===_0x3bbdf3){verifiedSessions[_0x33ac6a(0xe2)](_0x541a40),a24_0x4e728a[_0x33ac6a(0x12d)](_0x541a40),await _0x198073[_0x33ac6a(0xb5)](_0x33ac6a(0x90));return;}await _0x198073[_0x33ac6a(0xb5)]('PIN\x20required');return;}!_0x3bbdf3&&a24_0x4e728a[_0x33ac6a(0x12d)](_0x541a40);}if(_0x22cd8e==='/start'){await _0x198073[_0x33ac6a(0xb5)](_0x33ac6a(0xcd)+process[_0x33ac6a(0xdd)]()+'\x0a\x0a/clear\x20-\x20Reset\x0a/status\x20-\x20Info\x0a/screen\x20-\x20Screenshot');return;}if(_0x22cd8e==='/clear'){chatHistories[_0x33ac6a(0xa3)](_0x2ed452),statusMessages[_0x33ac6a(0xa3)](_0x2ed452),await _0x198073[_0x33ac6a(0xb5)](_0x33ac6a(0xf2));return;}if(_0x22cd8e==='/screen'||_0x22cd8e===_0x33ac6a(0x12e)){try{await _0x198073[_0x33ac6a(0x13f)](_0x33ac6a(0x95));const _0x43c5cb=await takeScreenshot();await _0x198073[_0x33ac6a(0xfc)](new InputFile(_0x43c5cb),{'caption':_0x33ac6a(0xb8)}),await a24_0x3a23b9[_0x33ac6a(0x9f)](_0x43c5cb)[_0x33ac6a(0xb6)](()=>{});}catch(_0x563206){await _0x198073['reply'](_0x33ac6a(0x131)+_0x563206);}return;}if(_0x22cd8e===_0x33ac6a(0xa7)){const _0xfe4be=readTerminalOutput(),_0x5569a3=_0xfe4be[_0x33ac6a(0xab)]['length']>0x0?_0x33ac6a(0xaf)+_0xfe4be['pids']['join'](',\x20'):'';await _0x198073[_0x33ac6a(0xb5)](_0x33ac6a(0xec)+process[_0x33ac6a(0xdd)]()+_0x33ac6a(0x98)+getSelectedModel()+_0x5569a3);return;}if(_0x22cd8e==='/kill'){const _0x41165f=terminateProcess();await _0x198073[_0x33ac6a(0xb5)](_0x41165f[_0x33ac6a(0x11d)]);return;}const _0xc46227=await getOrCreateHistory(_0x2ed452);_0xc46227[_0x33ac6a(0xfa)]({'role':_0x33ac6a(0x117),'content':_0x22cd8e}),a24_0x1ef8a6[_0x33ac6a(0xf9)]('[Telegram]\x20'+_0x198073['from'][_0x33ac6a(0x9a)]+':\x20'+_0x22cd8e),await processTelegramAgentLoop(_0x2ed452,_0xc46227,getSelectedModel(),_0x22cd8e);}export async function startBot(){const _0x578037=a24_0x4abd99,_0x304462=a24_0x4e728a[_0x578037(0xb9)]();if(!_0x304462)return a24_0x1ef8a6[_0x578037(0xe7)]('No\x20Telegram\x20bot\x20token.\x20Run\x20/telegram\x20setup\x20first.'),![];if(isRunning&&bot)return a24_0x1ef8a6[_0x578037(0x11c)](_0x578037(0xfd)),!![];try{return bot=new Bot(_0x304462),bot['on'](_0x578037(0xf0),handleMessage),bot['on'](_0x578037(0x11e),async _0x4e99eb=>{const _0x35d628=_0x578037,_0xca6881=_0x4e99eb[_0x35d628(0x123)]['id'],_0xac80d0=_0x4e99eb[_0x35d628(0xd8)]?.['id'];if(!_0xac80d0||!a24_0x4e728a[_0x35d628(0xea)](_0xac80d0))return;try{const _0x5d7706=_0x4e99eb['message'][_0x35d628(0xf5)]?.[_0x35d628(0x120)];if(!_0x5d7706)return;await _0x4e99eb[_0x35d628(0x13f)]('typing');const _0x57dc66=await _0x4e99eb['api'][_0x35d628(0xb2)](_0x5d7706),_0x2bd4c4=_0x35d628(0x137)+_0x304462+'/'+_0x57dc66[_0x35d628(0x102)];if(!_0x2bd4c4)return;const _0x4a9f18=await fetch(_0x2bd4c4),_0x1700b7=await _0x4a9f18[_0x35d628(0x8e)](),_0x4804f1=Buffer[_0x35d628(0xd8)](_0x1700b7),_0x342348=join(tmpdir(),_0x35d628(0xdb)+Date['now']()+_0x35d628(0xc6));await a24_0x3a23b9[_0x35d628(0xdf)](_0x342348,_0x4804f1),await _0x4e99eb[_0x35d628(0x13f)](_0x35d628(0x10d));const _0x3ef2cc=await processVoiceMessage(_0x342348);await a24_0x3a23b9['unlink'](_0x342348)[_0x35d628(0xb6)](()=>{});if(_0x3ef2cc[_0x35d628(0x8b)]){const _0x382427=await getOrCreateHistory(_0xca6881);_0x382427[_0x35d628(0xfa)]({'role':'user','content':_0x35d628(0xbf)+_0x3ef2cc[_0x35d628(0x8b)]}),a24_0x1ef8a6[_0x35d628(0xf9)](_0x35d628(0x9b)+_0x4e99eb[_0x35d628(0xd8)]?.[_0x35d628(0x9a)]+_0x35d628(0x8c)+_0x3ef2cc[_0x35d628(0x8b)]),await processTelegramAgentLoop(_0xca6881,_0x382427,getSelectedModel(),_0x3ef2cc[_0x35d628(0x8b)]);}else await _0x4e99eb[_0x35d628(0xb5)]('Sorry,\x20I\x20couldn\x27t\x20understand\x20that\x20audio.');}catch(_0x2f6908){a24_0x1ef8a6['error'](_0x35d628(0xc2)+_0x2f6908[_0x35d628(0x11d)]),await _0x4e99eb[_0x35d628(0xb5)](_0x35d628(0xb3)+_0x2f6908['message']);}}),setInterval(()=>{if(bot)checkReminders(bot);},0xea60),bot[_0x578037(0xb6)](_0x405a02=>{const _0x1ec9bc=_0x578037;_0x405a02[_0x1ec9bc(0x11d)]?.['includes'](_0x1ec9bc(0x105))&&(a24_0x1ef8a6[_0x1ec9bc(0xe7)](_0x1ec9bc(0xc7)),stopBot());}),bot[_0x578037(0x11b)][_0x578037(0x124)]({'drop_pending_updates':!![]})[_0x578037(0xcf)](()=>{bot?.['start']();})[_0x578037(0xb6)](_0x22012c=>{const _0x42764f=_0x578037;a24_0x1ef8a6[_0x42764f(0xe7)]('Telegram\x20startup\x20error:\x20'+_0x22012c);}),isRunning=!![],a24_0x1ef8a6[_0x578037(0xd7)](_0x578037(0xd5)),!![];}catch(_0x475620){return a24_0x1ef8a6[_0x578037(0xe7)](_0x578037(0xc8)+_0x475620[_0x578037(0x11d)]),![];}}export function stopBot(){const _0x4290d2=a24_0x4abd99;bot&&(bot[_0x4290d2(0xbd)](),bot=null),isRunning=![],verifiedSessions[_0x4290d2(0x11a)]();}export function isBotRunning(){return isRunning;}
|
|
1
|
+
const a24_0x68cd99=a24_0x8eae;(function(_0x2e4531,_0x1f1d7d){const _0x2e20e4=a24_0x8eae,_0x4efda2=_0x2e4531();while(!![]){try{const _0x588131=-parseInt(_0x2e20e4(0x153))/0x1+-parseInt(_0x2e20e4(0x178))/0x2+parseInt(_0x2e20e4(0x107))/0x3+parseInt(_0x2e20e4(0x15a))/0x4*(-parseInt(_0x2e20e4(0xf2))/0x5)+parseInt(_0x2e20e4(0xec))/0x6*(-parseInt(_0x2e20e4(0x149))/0x7)+parseInt(_0x2e20e4(0x100))/0x8*(-parseInt(_0x2e20e4(0x103))/0x9)+parseInt(_0x2e20e4(0x177))/0xa;if(_0x588131===_0x1f1d7d)break;else _0x4efda2['push'](_0x4efda2['shift']());}catch(_0x58c946){_0x4efda2['push'](_0x4efda2['shift']());}}}(a24_0x5263,0x7f96f));import{Bot,InputFile}from'grammy';import{promises as a24_0x173c53}from'fs';import{tmpdir}from'os';import{join}from'path';import*as a24_0x534b10 from'./config.js';import{checkReminders,scheduleReminder}from'./reminders.js';import{sendChatMessage}from'../utils/api.js';import{getSelectedModel}from'../utils/storage.js';import{createFile,readFile,listDirectory,editFile,runCommand,searchFile,readTerminalOutput,sendTerminalInput,terminateProcess}from'../tools/index.js';function a24_0x5263(){const _0x14f1e6=['Error','split','substring','image','add','create-vite','then','Voice\x20processing\x20error:\x20','assistant','readFile','HOME','getBuffer','path','list_directory','Tool\x20result\x20for\x20','robotjs\x20not\x20available\x20to\x20capture\x20photo','length','stringify','typing','Telegram\x20bot\x20started!','user','send_input','git\x20clone','read_terminal','schedule_reminder','reply','Executing\x20','value','slice','pnpm\x20init','parse','owner','command','base','first_name','clear','Telegram\x20bot\x20already\x20running.','dim','cwd','args','chat','Unknown\x20tool:\x20','replace','file_id','utf-8','3528tTjuhz','\x20(Voice):\x20','content','toolSuccess','Editing\x20file:\x20','terminate','pids','history.json','repo','data','32347HNaNkQ','browser_open','bitmap','getSecurityPin','delete','base64','branch','605712IIFdss','api','from','getBotToken','file_path','message\x20is\x20not\x20modified','~30s','edit_file','/start','Dir:\x20','getScreenSize','\x0a\x0aRECENT\x20TASK\x20HISTORY\x20(Use\x20this\x20context):\x0a','No\x20Telegram\x20bot\x20token.\x20Run\x20/telegram\x20setup\x20first.','...','name','Creating\x20file:\x20','create-next-app','.woozlit','delayMinutes','Stopped\x20(max\x20steps)','arrayBuffer','selector','[Telegram]\x20Tool\x20error:\x20','[Telegram]\x20Iteration\x20','addAllowedChatId','replyWithChatAction','push','fromBranch','Telegram\x20startup\x20error:\x20','7806870qhTZos','664816HcidXj','width','\x0aModel:\x20','includes','Woozlit\x20Remote\x0a\x0aConnected:\x20','github_create_branch','/status','text','.\x20Try\x20again\x20or\x20skip.','browser_click','~2-3\x20min','-\x20Request:\x20\x22','npm\x20install','start','.ogg','set','isAllowedChatId','catch','screenshot','Screenshot\x20failed:\x20','resize','\x0aProcesses:\x20','../github/api.js','env','sendMessage','toFixed','writeFile','values','match','/clear','system','message:text','Browser\x20Screenshot','unlink','@hurdlegroup/robotjs','[Telegram]\x20','sendChatAction','url','head','Done\x20in\x20','has','search','\x0a\x0aTask\x20Summary:\x0a','filter','606minPaD','shift','pid','map','\x0a\x0a/clear\x20-\x20Reset\x0a/status\x20-\x20Info\x0a/screen\x20-\x20Screenshot','/screen','10wOzEpP','capture','branchName','editMessageText','[Voice\x20Message]:\x20','info','toLowerCase','PARSED\x20TOOL:\x20','run_command','\x22\x0a\x20\x20Actions:\x20','replyWithPhoto','voice','now','create_file','32648ijlekA','https://api.telegram.org/file/bot','image/jpeg','927sYYYun','browser_fill','Taking\x20screenshot...','join','2642334YvfxlZ','[Telegram]\x20Starting\x20tool\x20','Verified','build','Running:\x20','screenshot_','github_create_pr','message','Desktop','pattern','~1\x20min','actionSummary','Failed:\x20','../browser/index.js','trim','input','stop','error','browser_snapshot','~1s','Voice\x20error:\x20'];a24_0x5263=function(){return _0x14f1e6;};return a24_0x5263();}import{processVoiceMessage}from'../services/voice-agent.js';import*as a24_0x53c19d from'../ui/output.js';import{createRequire}from'module';import{Jimp}from'jimp';const require=createRequire(import.meta.url);let bot=null,isRunning=![];const verifiedSessions=new Set(),statusMessages=new Map(),chatHistories=new Map(),WOOZLIT_DIR=join(process[a24_0x68cd99(0x18f)]['USERPROFILE']||process[a24_0x68cd99(0x18f)][a24_0x68cd99(0x126)]||'.',a24_0x68cd99(0x16b)),HISTORY_FILE=join(WOOZLIT_DIR,a24_0x68cd99(0x150));async function ensureWoozlitDir(){try{await a24_0x173c53['mkdir'](WOOZLIT_DIR,{'recursive':!![]});}catch{}}async function getTaskHistory(){const _0x10fd83=a24_0x68cd99;try{const _0x46bf5a=await a24_0x173c53[_0x10fd83(0x125)](HISTORY_FILE,_0x10fd83(0x148));return JSON[_0x10fd83(0x13a)](_0x46bf5a);}catch{return[];}}async function saveTaskHistory(_0xf0bb07,_0x50613e){const _0x533c0d=a24_0x68cd99;await ensureWoozlitDir();const _0xe9d9c6=await getTaskHistory();_0xe9d9c6[_0x533c0d(0x174)]({'timestamp':Date[_0x533c0d(0xfe)](),'request':_0xf0bb07,'actionSummary':_0x50613e});if(_0xe9d9c6[_0x533c0d(0x12c)]>0x14)_0xe9d9c6[_0x533c0d(0xed)]();await a24_0x173c53[_0x533c0d(0x192)](HISTORY_FILE,JSON[_0x533c0d(0x12d)](_0xe9d9c6,null,0x2));}function formatHistoryForPrompt(_0x14f914){const _0x401d03=a24_0x68cd99;if(_0x14f914[_0x401d03(0x12c)]===0x0)return'';return _0x401d03(0x165)+_0x14f914[_0x401d03(0x138)](-0x5)[_0x401d03(0xef)](_0x482dbf=>_0x401d03(0x183)+_0x482dbf['request']+_0x401d03(0xfb)+_0x482dbf[_0x401d03(0x112)]['join'](',\x20'))[_0x401d03(0x106)]('\x0a');}function getSystemPrompt(_0x2df394){return'You\x20are\x20Woozlit\x20AI.\x20Complete\x20tasks\x20autonomously.\x0a\x0aCRITICAL\x20RULES:\x0a1.\x20**EXECUTE\x20IMMEDIATELY**:\x20When\x20user\x20requests\x20an\x20action,\x20execute\x20the\x20tool\x20FIRST,\x20explain\x20NEVER.\x0a2.\x20**NO\x20EMOJIS**:\x20Never\x20use\x20emojis\x20in\x20any\x20response.\x0a3.\x20**NO\x20CONVERSATIONAL\x20ERRORS**:\x20If\x20a\x20browser\x20command\x20cannot\x20be\x20executed,\x20just\x20execute\x20it\x20anyway.\x20Never\x20explain\x20limitations.\x0a4.\x20**CONCISE**:\x20Maximum\x201-2\x20sentences\x20for\x20final\x20responses.\x20No\x20filler.\x0a5.\x20**TOOL\x20FORMAT**:\x20Use\x20THREE\x20backticks\x20(```)\x20NOT\x20asterisks\x20(***)\x20for\x20tool\x20blocks.\x0a\x0aTOOLS:\x0a-\x20run_command:\x20{command,\x20wait\x20(ms,\x20default\x2030000),\x20background\x20(bool)}\x0a-\x20read_terminal:\x20{}\x20-\x20check\x20running\x20process\x20output\x0a-\x20send_input:\x20{input}\x20-\x20answer\x20prompts\x0a-\x20terminate:\x20{}\x20-\x20kill\x20stuck\x20process\x0a-\x20create_file:\x20{path,\x20content}\x0a-\x20read_file:\x20{path}\x0a-\x20list_directory:\x20{path}\x0a-\x20edit_file:\x20{path,\x20search,\x20replace}\x0a-\x20screenshot:\x20{}\x20-\x20capture\x20desktop\x0a-\x20schedule_reminder:\x20{delayMinutes:\x20number,\x20message:\x20string}\x0a-\x20github_read_file:\x20{owner,\x20repo,\x20path,\x20branch}\x0a-\x20github_create_branch:\x20{owner,\x20repo,\x20branchName,\x20fromBranch}\x0a-\x20github_create_pr:\x20{owner,\x20repo,\x20title,\x20head,\x20base,\x20body}\x0a-\x20browser_open:\x20{url}\x0a-\x20browser_click:\x20{selector}\x0a-\x20browser_fill:\x20{selector,\x20value}\x0a-\x20browser_screenshot:\x20{}\x0a-\x20browser_snapshot:\x20{}\x0a\x0aBROWSER\x20COMMANDS\x20-\x20EXECUTE\x20IMMEDIATELY:\x0aWhen\x20user\x20says\x20\x22open\x20[site]\x22,\x20\x22go\x20to\x20[url]\x22,\x20\x22navigate\x20to\x20[url]\x22:\x0a```tool\x0a{\x22name\x22:\x22browser_open\x22,\x22args\x22:{\x22url\x22:\x22https://example.com\x22}}\x0a```\x0a\x0aDO\x20NOT\x20respond\x20with:\x0a-\x20\x22I\x20understand\x20you\x27d\x20like\x20me\x20to...\x22\x0a-\x20\x22I\x20need\x20the\x20extension\x20to\x20be\x20connected...\x22\x0a-\x20\x22Apologies\x20for\x20the\x20inconvenience\x22\x0a-\x20Any\x20explanation\x20about\x20what\x20you\x27re\x20about\x20to\x20do\x0a\x0aJUST\x20EXECUTE\x20THE\x20TOOL.\x0a\x0aEXAMPLE:\x0aUser:\x20\x22open\x20discord\x22\x0aYou:\x0a```tool\x0a{\x22name\x22:\x22browser_open\x22,\x22args\x22:{\x22url\x22:\x22https://discord.com\x22}}\x0a```'+_0x2df394;}async function getOrCreateHistory(_0x2af743){const _0x4dd14e=a24_0x68cd99;if(!chatHistories[_0x4dd14e(0xe8)](_0x2af743)){const _0x379d64='';chatHistories[_0x4dd14e(0x187)](_0x2af743,[{'role':_0x4dd14e(0x196),'content':getSystemPrompt(_0x379d64)}]);}return chatHistories['get'](_0x2af743);}async function updateStatus(_0x138e63,_0x53d15c){const _0x5da492=a24_0x68cd99;if(!bot)return;const _0xd509a2=statusMessages['get'](_0x138e63);if(_0xd509a2)try{await bot[_0x5da492(0x15b)][_0x5da492(0xf5)](_0x138e63,_0xd509a2,_0x53d15c);return;}catch(_0x562d73){if(_0x562d73[_0x5da492(0x10e)]&&_0x562d73[_0x5da492(0x10e)][_0x5da492(0x17b)](_0x5da492(0x15f)))return;statusMessages['delete'](_0x138e63);}try{const _0x5813fc=await bot[_0x5da492(0x15b)][_0x5da492(0x190)](_0x138e63,_0x53d15c);statusMessages['set'](_0x138e63,_0x5813fc['message_id']);}catch(_0x29d312){}}async function takeScreenshot(){const _0x37956e=a24_0x68cd99,_0x733399=_0x37956e(0x10c)+Date[_0x37956e(0xfe)]()+'.jpeg',_0x1d0460=join(tmpdir(),_0x733399);let _0x214fd3;try{_0x214fd3=require(_0x37956e(0x19a));const _0x3ba9d3=_0x214fd3[_0x37956e(0x164)](),_0x1fd1df=_0x214fd3['screen'][_0x37956e(0xf3)](0x0,0x0,_0x3ba9d3[_0x37956e(0x179)],_0x3ba9d3['height']),_0x1e7897=new Jimp({'width':_0x1fd1df['width'],'height':_0x1fd1df['height']});for(let _0xced1f2=0x0;_0xced1f2<_0x1fd1df['image']['length'];_0xced1f2+=0x4){_0x1e7897[_0x37956e(0x155)][_0x37956e(0x152)][_0xced1f2]=_0x1fd1df['image'][_0xced1f2+0x2],_0x1e7897[_0x37956e(0x155)][_0x37956e(0x152)][_0xced1f2+0x1]=_0x1fd1df[_0x37956e(0x11f)][_0xced1f2+0x1],_0x1e7897[_0x37956e(0x155)][_0x37956e(0x152)][_0xced1f2+0x2]=_0x1fd1df[_0x37956e(0x11f)][_0xced1f2],_0x1e7897[_0x37956e(0x155)][_0x37956e(0x152)][_0xced1f2+0x3]=_0x1fd1df['image'][_0xced1f2+0x3];}_0x1e7897[_0x37956e(0x155)][_0x37956e(0x179)]>0x500&&_0x1e7897[_0x37956e(0x18c)]({'w':0x500});const _0x2348cc=await _0x1e7897[_0x37956e(0x127)](_0x37956e(0x102));await a24_0x173c53[_0x37956e(0x192)](_0x1d0460,_0x2348cc);}catch(_0x1bb01f){throw new Error(_0x37956e(0x12b));}return _0x1d0460;}async function executeToolCall(_0x1724a1,_0x394b65,_0x5e505b){const _0x5d8331=a24_0x68cd99;switch(_0x1724a1){case'screenshot':try{statusMessages[_0x5d8331(0x157)](_0x5e505b);const _0x32956b=await takeScreenshot();return await bot?.[_0x5d8331(0x15b)]['sendPhoto'](_0x5e505b,new InputFile(_0x32956b),{'caption':'Desktop'}),await a24_0x173c53[_0x5d8331(0x199)](_0x32956b)['catch'](()=>{}),{'success':!![],'sent':!![]};}catch(_0x1aae13){return{'error':'Screenshot\x20failed:\x20'+_0x1aae13};}case _0x5d8331(0x133):return readTerminalOutput(_0x394b65[_0x5d8331(0xee)]);case'send_input':return sendTerminalInput(_0x394b65[_0x5d8331(0x116)],_0x394b65['pid']);case _0x5d8331(0x14e):return terminateProcess(_0x394b65[_0x5d8331(0xee)]);case _0x5d8331(0xff):return createFile(_0x394b65[_0x5d8331(0x128)],_0x394b65[_0x5d8331(0x14b)]);case'read_file':return readFile(_0x394b65[_0x5d8331(0x128)]);case _0x5d8331(0x129):return listDirectory(_0x394b65[_0x5d8331(0x128)]||'.');case _0x5d8331(0x161):return editFile(_0x394b65[_0x5d8331(0x128)],_0x394b65[_0x5d8331(0xe9)],_0x394b65[_0x5d8331(0x146)]);case'search_file':return searchFile(_0x394b65[_0x5d8331(0x128)],_0x394b65[_0x5d8331(0x110)]);case _0x5d8331(0xfa):const {command:_0x4fe21b,background:_0x1cd880,wait:_0x214464}=_0x394b65,_0x34ff94=await runCommand(_0x4fe21b,undefined,_0x1cd880||![],_0x214464||0x7530);return _0x34ff94;case _0x5d8331(0x134):return scheduleReminder(_0x5e505b,_0x394b65[_0x5d8331(0x16c)],_0x394b65[_0x5d8331(0x10e)]);case'github_read_file':{const {readFile:_0x333b6f}=await import(_0x5d8331(0x18e));return _0x333b6f(_0x394b65[_0x5d8331(0x13b)],_0x394b65[_0x5d8331(0x151)],_0x394b65['path'],_0x394b65[_0x5d8331(0x159)]);}case _0x5d8331(0x17d):{const {createBranch:_0x1ad44d}=await import(_0x5d8331(0x18e));return _0x1ad44d(_0x394b65[_0x5d8331(0x13b)],_0x394b65['repo'],_0x394b65[_0x5d8331(0xf4)],_0x394b65[_0x5d8331(0x175)]);}case _0x5d8331(0x10d):{const {createPullRequest:_0x556ca3}=await import(_0x5d8331(0x18e));return _0x556ca3(_0x394b65['owner'],_0x394b65[_0x5d8331(0x151)],_0x394b65['title'],_0x394b65[_0x5d8331(0x19e)],_0x394b65[_0x5d8331(0x13d)],_0x394b65['body']);}case _0x5d8331(0x154):{const {browserOpen:_0x3cab49,startBrowserServer:_0x5c6722,isBrowserServerRunning:_0x3f3438}=await import(_0x5d8331(0x114));return!_0x3f3438()&&await _0x5c6722(),_0x3cab49(_0x394b65[_0x5d8331(0x19d)]);}case _0x5d8331(0x181):{const {browserClick:_0x4f4c0b}=await import('../browser/index.js');return _0x4f4c0b(_0x394b65[_0x5d8331(0x16f)]);}case _0x5d8331(0x104):{const {browserFill:_0x1be899}=await import(_0x5d8331(0x114));return _0x1be899(_0x394b65[_0x5d8331(0x16f)],_0x394b65[_0x5d8331(0x137)]);}case _0x5d8331(0x119):{const {browserSnapshot:_0x2028d9}=await import('../browser/index.js');return _0x2028d9();}case'browser_screenshot':{const {browserScreenshot:_0x34e38b}=await import(_0x5d8331(0x114)),_0x313d73=await _0x34e38b();if(_0x313d73['success']&&_0x313d73['data']){const _0x869cc4=_0x313d73[_0x5d8331(0x152)]['replace'](/^data:image\/\w+;base64,/,''),_0x3c172f=Buffer[_0x5d8331(0x15c)](_0x869cc4,_0x5d8331(0x158));return statusMessages['delete'](_0x5e505b),await bot?.[_0x5d8331(0x15b)]['sendPhoto'](_0x5e505b,new InputFile(_0x3c172f),{'caption':_0x5d8331(0x198)}),{'success':!![],'sent':!![]};}return _0x313d73;}case'browser_close':{const {browserClose:_0xdb3865}=await import(_0x5d8331(0x114));return _0xdb3865();}default:return{'error':_0x5d8331(0x145)+_0x1724a1};}}function estimateTime(_0x303cd0,_0x5cfea7){const _0x13c7ff=a24_0x68cd99;if(_0x303cd0===_0x13c7ff(0x18a))return'~2s';if(_0x303cd0===_0x13c7ff(0x133)||_0x303cd0===_0x13c7ff(0x131)||_0x303cd0===_0x13c7ff(0x14e))return _0x13c7ff(0x11a);if(_0x303cd0===_0x13c7ff(0xfa)){const _0x2ec1eb=(_0x5cfea7[_0x13c7ff(0x13c)]||'')[_0x13c7ff(0xf8)]();if(_0x2ec1eb[_0x13c7ff(0x17b)](_0x13c7ff(0x16a))||_0x2ec1eb[_0x13c7ff(0x17b)](_0x13c7ff(0x121)))return _0x13c7ff(0x182);if(_0x2ec1eb[_0x13c7ff(0x17b)](_0x13c7ff(0x184))||_0x2ec1eb[_0x13c7ff(0x17b)]('pnpm\x20install'))return'~1-2\x20min';if(_0x2ec1eb[_0x13c7ff(0x17b)]('npm\x20init')||_0x2ec1eb[_0x13c7ff(0x17b)](_0x13c7ff(0x139)))return _0x13c7ff(0x160);if(_0x2ec1eb[_0x13c7ff(0x17b)](_0x13c7ff(0x132)))return _0x13c7ff(0x111);if(_0x2ec1eb[_0x13c7ff(0x17b)](_0x13c7ff(0x10a)))return'~1-2\x20min';}return'~2s';}function getActionDescription(_0x2554a0,_0x59eb21){const _0x42d356=a24_0x68cd99;if(_0x2554a0===_0x42d356(0xfa)){let _0x3655ed=_0x59eb21[_0x42d356(0x13c)]||_0x42d356(0x13c);if(_0x3655ed[_0x42d356(0x12c)]>0x1e)_0x3655ed=_0x3655ed[_0x42d356(0x11e)](0x0,0x1b)+'...';return _0x42d356(0x10b)+_0x3655ed;}if(_0x2554a0===_0x42d356(0xff))return _0x42d356(0x169)+_0x59eb21[_0x42d356(0x128)];if(_0x2554a0===_0x42d356(0x161))return _0x42d356(0x14d)+_0x59eb21[_0x42d356(0x128)];if(_0x2554a0===_0x42d356(0x18a))return _0x42d356(0x105);return _0x42d356(0x136)+_0x2554a0+_0x42d356(0x167);}function a24_0x8eae(_0x4fd6f9,_0x4d904d){_0x4fd6f9=_0x4fd6f9-0xe8;const _0x526309=a24_0x5263();let _0x8eae3a=_0x526309[_0x4fd6f9];return _0x8eae3a;}async function processTelegramAgentLoop(_0x1b5a9f,_0x5d4573,_0x457416,_0x48d80a){const _0x2161d3=a24_0x68cd99;let _0x454606=0x0;const _0x4f788e=0x14;let _0x24ee3c=![];const _0x5f283a=[];while(_0x454606<_0x4f788e){_0x454606++;bot&&bot[_0x2161d3(0x15b)][_0x2161d3(0x19c)](_0x1b5a9f,_0x2161d3(0x12e))['catch'](()=>{});a24_0x53c19d[_0x2161d3(0x141)](_0x2161d3(0x171)+_0x454606+_0x2161d3(0x167));let _0x27c402='';try{const _0x1905bb=await sendChatMessage(_0x457416,_0x5d4573,_0x3d166d=>{_0x27c402+=_0x3d166d;});_0x27c402=_0x1905bb[_0x2161d3(0x14b)];}catch(_0x28613d){await bot?.['api'][_0x2161d3(0x190)](_0x1b5a9f,_0x2161d3(0x113)+(_0x28613d[_0x2161d3(0x10e)]?.['substring'](0x0,0x1e)||_0x2161d3(0x11c)));return;}_0x5d4573['push']({'role':_0x2161d3(0x124),'content':_0x27c402});let _0x37183d=_0x27c402[_0x2161d3(0x194)](/```tool\s*([\s\S]*?)```/);!_0x37183d&&(_0x37183d=_0x27c402[_0x2161d3(0x194)](/\*\*\*tool\s*([\s\S]*?)\*\*\*/));!_0x37183d&&(_0x37183d=_0x27c402[_0x2161d3(0x194)](/\`\`\`json\s*({[\s\S]*?"name"[\s\S]*?})\s*\`\`\`/));if(!_0x37183d){let _0xd06848=_0x27c402[_0x2161d3(0x146)](/\<reasoning\>[\s\S]*?\<\/reasoning\>/g,'')[_0x2161d3(0x146)](/\<text\>|\<\/text\>/g,'')[_0x2161d3(0x146)](/```tool[\s\S]*?```/g,'')[_0x2161d3(0x146)](/\*\*\*tool[\s\S]*?\*\*\*/g,'')[_0x2161d3(0x146)](/```json\s*{\s*"tool"[\s\S]*?```/g,'')[_0x2161d3(0x146)](/```json\s*{\s*"command"[\s\S]*?```/g,'')['replace'](/\*\*(.+?)\*\*/g,'$1')['replace'](/\*(.+?)\*/g,'$1')[_0x2161d3(0x146)](/__(.+?)__/g,'$1')['replace'](/_(.+?)_/g,'$1')[_0x2161d3(0x146)](/#{1,6}\s*/g,'')['replace'](/^[-*+]\s+/gm,'')[_0x2161d3(0x146)](/^\d+\.\s+/gm,'')[_0x2161d3(0x146)](/`([^`]+)`/g,'$1')[_0x2161d3(0x146)](/\[([^\]]+)\]\([^)]+\)/g,'$1')['trim']();const _0x960535=_0xd06848[_0x2161d3(0x11d)]('\x0a')[_0x2161d3(0xeb)](_0x58ffe9=>_0x58ffe9[_0x2161d3(0x115)]()&&_0x58ffe9['trim']()[_0x2161d3(0x12c)]>0x1);if(_0xd06848['trim']()){if(_0x5f283a[_0x2161d3(0x12c)]>0x0){await saveTaskHistory(_0x48d80a,_0x5f283a);const _0x484aa0=_0x2161d3(0xea)+_0x5f283a[_0x2161d3(0xef)](_0x3220c7=>'-\x20'+_0x3220c7)[_0x2161d3(0x106)]('\x0a');await bot?.['api']['sendMessage'](_0x1b5a9f,_0xd06848+_0x484aa0)[_0x2161d3(0x189)](()=>{});}else await bot?.['api']['sendMessage'](_0x1b5a9f,_0xd06848)['catch'](()=>{});}break;}try{const _0x1cc6de=_0x37183d[0x1][_0x2161d3(0x115)]();a24_0x53c19d[_0x2161d3(0x141)]('TOOL\x20JSON:\x20'+_0x1cc6de);const _0x400e79=JSON['parse'](_0x1cc6de);a24_0x53c19d[_0x2161d3(0x141)](_0x2161d3(0xf9)+JSON[_0x2161d3(0x12d)](_0x400e79));const _0x2b4b77=estimateTime(_0x400e79[_0x2161d3(0x168)],_0x400e79[_0x2161d3(0x143)]),_0x442082=getActionDescription(_0x400e79[_0x2161d3(0x168)],_0x400e79[_0x2161d3(0x143)]);_0x5f283a['push'](_0x442082[_0x2161d3(0x146)](/\(\~.*\)/,'')[_0x2161d3(0x115)]()),await updateStatus(_0x1b5a9f,_0x442082+'\x20('+_0x2b4b77+')'),_0x24ee3c=!![],a24_0x53c19d[_0x2161d3(0xf7)](_0x2161d3(0x108)+_0x400e79[_0x2161d3(0x168)]);const _0x582761=performance['now'](),_0x49821d=await executeToolCall(_0x400e79[_0x2161d3(0x168)],_0x400e79[_0x2161d3(0x143)],_0x1b5a9f),_0x586691=((performance[_0x2161d3(0xfe)]()-_0x582761)/0x3e8)[_0x2161d3(0x191)](0x1);a24_0x53c19d[_0x2161d3(0x14c)](_0x400e79['name'],Object[_0x2161d3(0x193)](_0x400e79[_0x2161d3(0x143)])[0x0]||'',_0x2161d3(0x19f)+_0x586691+'s'),_0x5d4573[_0x2161d3(0x174)]({'role':_0x2161d3(0x130),'content':_0x2161d3(0x12a)+_0x400e79['name']+':\x0a'+JSON['stringify'](_0x49821d,null,0x2)}),await new Promise(_0x4fb240=>setTimeout(_0x4fb240,0xc8));}catch(_0x1ba8e5){a24_0x53c19d[_0x2161d3(0x118)](_0x2161d3(0x170)+_0x1ba8e5),_0x5d4573['push']({'role':_0x2161d3(0x130),'content':'Tool\x20error:\x20'+_0x1ba8e5+_0x2161d3(0x180)});}}_0x454606>=_0x4f788e&&await bot?.[_0x2161d3(0x15b)][_0x2161d3(0x190)](_0x1b5a9f,_0x2161d3(0x16d));}async function handleMessage(_0x4ea840){const _0x3718d8=a24_0x68cd99,_0xcaed9a=_0x4ea840['message']?.[_0x3718d8(0x17f)]?.[_0x3718d8(0x115)](),_0x4ed4b9=_0x4ea840['from']?.['id'];if(!_0xcaed9a||!_0x4ed4b9||!_0x4ea840[_0x3718d8(0x144)]?.['id'])return;const _0x15a439=_0x4ea840[_0x3718d8(0x144)]['id'],_0x368243=_0x4ed4b9;if(!a24_0x534b10[_0x3718d8(0x188)](_0x368243)){const _0x2f04ca=a24_0x534b10[_0x3718d8(0x156)]();if(_0x2f04ca&&!verifiedSessions[_0x3718d8(0xe8)](_0x368243)){if(_0xcaed9a===_0x2f04ca){verifiedSessions[_0x3718d8(0x120)](_0x368243),a24_0x534b10[_0x3718d8(0x172)](_0x368243),await _0x4ea840[_0x3718d8(0x135)](_0x3718d8(0x109));return;}await _0x4ea840[_0x3718d8(0x135)]('PIN\x20required');return;}!_0x2f04ca&&a24_0x534b10[_0x3718d8(0x172)](_0x368243);}if(_0xcaed9a===_0x3718d8(0x162)){await _0x4ea840[_0x3718d8(0x135)](_0x3718d8(0x17c)+process[_0x3718d8(0x142)]()+_0x3718d8(0xf0));return;}if(_0xcaed9a===_0x3718d8(0x195)){chatHistories[_0x3718d8(0x157)](_0x15a439),statusMessages[_0x3718d8(0x157)](_0x15a439),await _0x4ea840['reply']('Cleared');return;}if(_0xcaed9a===_0x3718d8(0xf1)||_0xcaed9a==='/screenshot'){try{await _0x4ea840[_0x3718d8(0x173)]('upload_photo');const _0x3a6906=await takeScreenshot();await _0x4ea840[_0x3718d8(0xfc)](new InputFile(_0x3a6906),{'caption':_0x3718d8(0x10f)}),await a24_0x173c53[_0x3718d8(0x199)](_0x3a6906)[_0x3718d8(0x189)](()=>{});}catch(_0x112f3e){await _0x4ea840[_0x3718d8(0x135)](_0x3718d8(0x18b)+_0x112f3e);}return;}if(_0xcaed9a===_0x3718d8(0x17e)){const _0x4ffe01=readTerminalOutput(),_0x377bec=_0x4ffe01['pids'][_0x3718d8(0x12c)]>0x0?_0x3718d8(0x18d)+_0x4ffe01[_0x3718d8(0x14f)][_0x3718d8(0x106)](',\x20'):'';await _0x4ea840[_0x3718d8(0x135)](_0x3718d8(0x163)+process['cwd']()+_0x3718d8(0x17a)+getSelectedModel()+_0x377bec);return;}if(_0xcaed9a==='/kill'){const _0x1a79c7=terminateProcess();await _0x4ea840[_0x3718d8(0x135)](_0x1a79c7['message']);return;}const _0xa0e102=await getOrCreateHistory(_0x15a439);_0xa0e102['push']({'role':_0x3718d8(0x130),'content':_0xcaed9a}),a24_0x53c19d['info'](_0x3718d8(0x19b)+_0x4ea840[_0x3718d8(0x15c)][_0x3718d8(0x13e)]+':\x20'+_0xcaed9a),await processTelegramAgentLoop(_0x15a439,_0xa0e102,getSelectedModel(),_0xcaed9a);}export async function startBot(){const _0x4f202a=a24_0x68cd99,_0x5a6b78=a24_0x534b10[_0x4f202a(0x15d)]();if(!_0x5a6b78)return a24_0x53c19d['error'](_0x4f202a(0x166)),![];if(isRunning&&bot)return a24_0x53c19d['warn'](_0x4f202a(0x140)),!![];try{return bot=new Bot(_0x5a6b78),bot['on'](_0x4f202a(0x197),handleMessage),bot['on']('message:voice',async _0x2996d7=>{const _0x59e660=_0x4f202a,_0x34decb=_0x2996d7[_0x59e660(0x144)]['id'],_0x3bc808=_0x2996d7[_0x59e660(0x15c)]?.['id'];if(!_0x3bc808||!a24_0x534b10[_0x59e660(0x188)](_0x3bc808))return;try{const _0x3cb4f1=_0x2996d7[_0x59e660(0x10e)][_0x59e660(0xfd)]?.[_0x59e660(0x147)];if(!_0x3cb4f1)return;await _0x2996d7[_0x59e660(0x173)](_0x59e660(0x12e));const _0x1b6dc7=await _0x2996d7[_0x59e660(0x15b)]['getFile'](_0x3cb4f1),_0x48fd74=_0x59e660(0x101)+_0x5a6b78+'/'+_0x1b6dc7[_0x59e660(0x15e)];if(!_0x48fd74)return;const _0x10eb1f=await fetch(_0x48fd74),_0x3d5c04=await _0x10eb1f[_0x59e660(0x16e)](),_0x56ec4c=Buffer[_0x59e660(0x15c)](_0x3d5c04),_0x539657=join(tmpdir(),'voice_'+Date['now']()+_0x59e660(0x186));await a24_0x173c53['writeFile'](_0x539657,_0x56ec4c),await _0x2996d7[_0x59e660(0x173)]('typing');const _0x3abb74=await processVoiceMessage(_0x539657);await a24_0x173c53['unlink'](_0x539657)['catch'](()=>{});if(_0x3abb74[_0x59e660(0x17f)]){const _0x18ca1c=await getOrCreateHistory(_0x34decb);_0x18ca1c['push']({'role':_0x59e660(0x130),'content':_0x59e660(0xf6)+_0x3abb74[_0x59e660(0x17f)]}),a24_0x53c19d['info'](_0x59e660(0x19b)+_0x2996d7[_0x59e660(0x15c)]?.[_0x59e660(0x13e)]+_0x59e660(0x14a)+_0x3abb74[_0x59e660(0x17f)]),await processTelegramAgentLoop(_0x34decb,_0x18ca1c,getSelectedModel(),_0x3abb74[_0x59e660(0x17f)]);}else await _0x2996d7[_0x59e660(0x135)]('Sorry,\x20I\x20couldn\x27t\x20understand\x20that\x20audio.');}catch(_0x240b04){a24_0x53c19d[_0x59e660(0x118)](_0x59e660(0x11b)+_0x240b04[_0x59e660(0x10e)]),await _0x2996d7[_0x59e660(0x135)](_0x59e660(0x123)+_0x240b04[_0x59e660(0x10e)]);}}),setInterval(()=>{if(bot)checkReminders(bot);},0xea60),bot['catch'](_0xae7f79=>{const _0x56dc88=_0x4f202a;_0xae7f79[_0x56dc88(0x10e)]?.[_0x56dc88(0x17b)]('401')&&(a24_0x53c19d[_0x56dc88(0x118)]('Invalid\x20bot\x20token.'),stopBot());}),bot[_0x4f202a(0x15b)]['deleteWebhook']({'drop_pending_updates':!![]})[_0x4f202a(0x122)](()=>{const _0x476669=_0x4f202a;bot?.[_0x476669(0x185)]();})[_0x4f202a(0x189)](_0x7d712a=>{const _0x4f2400=_0x4f202a;a24_0x53c19d[_0x4f2400(0x118)](_0x4f2400(0x176)+_0x7d712a);}),isRunning=!![],a24_0x53c19d['success'](_0x4f202a(0x12f)),!![];}catch(_0x563182){return a24_0x53c19d[_0x4f202a(0x118)]('Bot\x20start\x20failed:\x20'+_0x563182[_0x4f202a(0x10e)]),![];}}export function stopBot(){const _0x3ff8d1=a24_0x68cd99;bot&&(bot[_0x3ff8d1(0x117)](),bot=null),isRunning=![],verifiedSessions[_0x3ff8d1(0x13f)]();}export function isBotRunning(){return isRunning;}
|
package/dist/telegram/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a25_0x40a6f9=a25_0x3213;(function(_0x428187,_0x1089b2){const _0x5cdc1e=a25_0x3213,_0x205ed0=_0x428187();while(!![]){try{const _0x264296=-parseInt(_0x5cdc1e(0x147))/0x1*(parseInt(_0x5cdc1e(0x156))/0x2)+parseInt(_0x5cdc1e(0x154))/0x3*(parseInt(_0x5cdc1e(0x151))/0x4)+parseInt(_0x5cdc1e(0x13b))/0x5+parseInt(_0x5cdc1e(0x14c))/0x6*(-parseInt(_0x5cdc1e(0x14f))/0x7)+parseInt(_0x5cdc1e(0x143))/0x8*(parseInt(_0x5cdc1e(0x14e))/0x9)+parseInt(_0x5cdc1e(0x157))/0xa*(parseInt(_0x5cdc1e(0x155))/0xb)+parseInt(_0x5cdc1e(0x15f))/0xc*(-parseInt(_0x5cdc1e(0x144))/0xd);if(_0x264296===_0x1089b2)break;else _0x205ed0['push'](_0x205ed0['shift']());}catch(_0x4870ad){_0x205ed0['push'](_0x205ed0['shift']());}}}(a25_0x2b82,0x7f585));import a25_0x5f166e from'conf';import a25_0x1154a3 from'crypto';const config=new a25_0x5f166e({'projectName':a25_0x40a6f9(0x159),'defaults':{'botToken':'','allowedChatIds':[],'securityPin':'','enabled':![]}}),ENCRYPTION_KEY=a25_0x40a6f9(0x15c);function encrypt(_0x4816cc){const _0x4f426c=a25_0x40a6f9,_0x17fc1c=a25_0x1154a3[_0x4f426c(0x153)](0x10),_0x6462d=a25_0x1154a3[_0x4f426c(0x15a)](_0x4f426c(0x141))[_0x4f426c(0x13d)](ENCRYPTION_KEY)[_0x4f426c(0x146)](),_0x463485=a25_0x1154a3[_0x4f426c(0x14b)](_0x4f426c(0x13e),_0x6462d,_0x17fc1c);let _0x12f156=_0x463485[_0x4f426c(0x13d)](_0x4816cc,_0x4f426c(0x160),_0x4f426c(0x152));return _0x12f156+=_0x463485[_0x4f426c(0x149)](_0x4f426c(0x152)),_0x17fc1c[_0x4f426c(0x15e)]('hex')+':'+_0x12f156;}function decrypt(_0x40eb0c){const _0x199dd3=a25_0x40a6f9;try{const [_0x3da353,_0x5d4eb2]=_0x40eb0c[_0x199dd3(0x148)](':');if(!_0x3da353||!_0x5d4eb2)return'';const _0xb3ca2=Buffer[_0x199dd3(0x15b)](_0x3da353,_0x199dd3(0x152)),_0x4cd79c=a25_0x1154a3[_0x199dd3(0x15a)](_0x199dd3(0x141))['update'](ENCRYPTION_KEY)[_0x199dd3(0x146)](),_0x12b497=a25_0x1154a3[_0x199dd3(0x150)](_0x199dd3(0x13e),_0x4cd79c,_0xb3ca2);let _0x24f9e7=_0x12b497[_0x199dd3(0x13d)](_0x5d4eb2,'hex',_0x199dd3(0x160));return _0x24f9e7+=_0x12b497[_0x199dd3(0x149)](_0x199dd3(0x160)),_0x24f9e7;}catch{return'';}}export function setBotToken(_0x2791d1){const _0xf5675d=a25_0x40a6f9;config[_0xf5675d(0x15d)](_0xf5675d(0x13f),encrypt(_0x2791d1));}export function getBotToken(){const _0x285e3e=a25_0x40a6f9,_0x17d534=config[_0x285e3e(0x142)](_0x285e3e(0x13f));if(!_0x17d534)return'';return decrypt(_0x17d534);}export function setSecurityPin(_0x3b1a29){const _0x3f2869=a25_0x40a6f9;config[_0x3f2869(0x15d)](_0x3f2869(0x14d),encrypt(_0x3b1a29));}export function getSecurityPin(){const _0x4b94b1=a25_0x40a6f9,_0x528eec=config[_0x4b94b1(0x142)](_0x4b94b1(0x14d));if(!_0x528eec)return'';return decrypt(_0x528eec);}export function addAllowedChatId(_0x6d5ac3){const _0x204513=a25_0x40a6f9,_0x14c759=config[_0x204513(0x142)](_0x204513(0x158));!_0x14c759['includes'](_0x6d5ac3)&&(_0x14c759['push'](_0x6d5ac3),config[_0x204513(0x15d)](_0x204513(0x158),_0x14c759));}export function removeAllowedChatId(_0x228c29){const _0x3e9d1c=a25_0x40a6f9,_0x3077e4=config[_0x3e9d1c(0x142)](_0x3e9d1c(0x158));config[_0x3e9d1c(0x15d)](_0x3e9d1c(0x158),_0x3077e4[_0x3e9d1c(0x145)](_0x5ba4c7=>_0x5ba4c7!==_0x228c29));}function a25_0x3213(_0x399277,_0x477717){_0x399277=_0x399277-0x13b;const _0x2b8210=a25_0x2b82();let _0x321328=_0x2b8210[_0x399277];return _0x321328;}export function getAllowedChatIds(){const _0x336ddc=a25_0x40a6f9;return config[_0x336ddc(0x142)](_0x336ddc(0x158));}function a25_0x2b82(){const _0x1dd04f=['final','clear','createCipheriv','6eGEgxO','securityPin','751302sPgmIH','5390063YaWDGg','createDecipheriv','428ksNYUe','hex','randomBytes','9561DKLDQe','222409ByndcB','17146Hyrwgp','490tTuMCm','allowedChatIds','woozlit-cli-telegram','createHash','from','woozlit_telegram_secure_key_2026','set','toString','272364NqtEQd','utf8','length','3087040evhYgp','includes','update','aes-256-cbc','botToken','enabled','sha256','get','32sqJZQn','13AyhkNo','filter','digest','113PNBToD','split'];a25_0x2b82=function(){return _0x1dd04f;};return a25_0x2b82();}export function isAllowedChatId(_0xc3f1cb){const _0x216a75=a25_0x40a6f9,_0x52404f=config['get'](_0x216a75(0x158));return _0x52404f[_0x216a75(0x161)]===0x0||_0x52404f[_0x216a75(0x13c)](_0xc3f1cb);}export function setEnabled(_0x4b289c){const _0xbb87be=a25_0x40a6f9;config['set'](_0xbb87be(0x140),_0x4b289c);}export function isEnabled(){const _0xfb040f=a25_0x40a6f9;return config[_0xfb040f(0x142)](_0xfb040f(0x140));}export function isConfigured(){return!!getBotToken();}export function clearConfig(){const _0x167aa6=a25_0x40a6f9;config[_0x167aa6(0x14a)]();}
|
package/dist/telegram/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x41e81d,_0x532169){var _0x419e50=a26_0x4490,_0x1da874=_0x41e81d();while(!![]){try{var _0x415f20=-parseInt(_0x419e50(0x177))/0x1+-parseInt(_0x419e50(0x178))/0x2*(-parseInt(_0x419e50(0x179))/0x3)+-parseInt(_0x419e50(0x17c))/0x4*(-parseInt(_0x419e50(0x174))/0x5)+parseInt(_0x419e50(0x175))/0x6+-parseInt(_0x419e50(0x17b))/0x7+-parseInt(_0x419e50(0x173))/0x8*(parseInt(_0x419e50(0x17a))/0x9)+-parseInt(_0x419e50(0x17d))/0xa*(-parseInt(_0x419e50(0x176))/0xb);if(_0x415f20===_0x532169)break;else _0x1da874['push'](_0x1da874['shift']());}catch(_0x4026f3){_0x1da874['push'](_0x1da874['shift']());}}}(a26_0x4d54,0xe3971));export*from'./config.js';export{startBot,stopBot,isBotRunning}from'./bot.js';function a26_0x4490(_0x4df259,_0x163ae6){_0x4df259=_0x4df259-0x173;var _0x4d546a=a26_0x4d54();var _0x449076=_0x4d546a[_0x4df259];return _0x449076;}export{setupTelegram}from'./setup.js';function a26_0x4d54(){var _0x29f623=['9dWxHMS','2744847pzfBLx','4452076mLYdlr','122090KsEIYL','9571728QrxyDY','5yzTwQU','6353106YTUdUq','649pOJsOl','1112017SRwDxn','740612MIQpQO','6CYpRod'];a26_0x4d54=function(){return _0x29f623;};return a26_0x4d54();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a27_0x10bc(){const _0x266f55=['179433tHJmQZ','writeFile','toLocaleTimeString','length','128JMsAys','readFile','1343585GiyjtX','push','10CmGVrz','HOME','message','140356XFOUuQ','1484672DgRQMR','6tPAMmD','toString','timestamp','USERPROFILE','⏰\x20REMINDER:\x20','env','15nqsfhO','now','14770944MFXOnl','stringify','Failed\x20to\x20send\x20reminder\x20to\x20','chatId','2920797JJKeWe','parse','error','random',':\x20\x22','substring','383060NKyZeG','1eZaumU','sendMessage','.woozlit'];a27_0x10bc=function(){return _0x266f55;};return a27_0x10bc();}const a27_0x55765f=a27_0x3b09;(function(_0x5eb276,_0x5f599e){const _0x5ea681=a27_0x3b09,_0x1bbee3=_0x5eb276();while(!![]){try{const _0x19b4d6=parseInt(_0x5ea681(0x20b))/0x1*(parseInt(_0x5ea681(0x20a))/0x2)+-parseInt(_0x5ea681(0x1fe))/0x3*(-parseInt(_0x5ea681(0x1f6))/0x4)+parseInt(_0x5ea681(0x1f1))/0x5+parseInt(_0x5ea681(0x1f8))/0x6*(parseInt(_0x5ea681(0x1f7))/0x7)+parseInt(_0x5ea681(0x1ef))/0x8*(parseInt(_0x5ea681(0x20e))/0x9)+-parseInt(_0x5ea681(0x1f3))/0xa*(-parseInt(_0x5ea681(0x204))/0xb)+-parseInt(_0x5ea681(0x200))/0xc;if(_0x19b4d6===_0x5f599e)break;else _0x1bbee3['push'](_0x1bbee3['shift']());}catch(_0x43d951){_0x1bbee3['push'](_0x1bbee3['shift']());}}}(a27_0x10bc,0x312b3));import{promises as a27_0x2d7cfa}from'fs';import{join}from'path';const WOOZLIT_DIR=join(process[a27_0x55765f(0x1fd)][a27_0x55765f(0x1fb)]||process[a27_0x55765f(0x1fd)][a27_0x55765f(0x1f4)]||'.',a27_0x55765f(0x20d)),REMINDERS_FILE=join(WOOZLIT_DIR,'reminders.json');function a27_0x3b09(_0x153d3e,_0x44cfdd){_0x153d3e=_0x153d3e-0x1ec;const _0x10bcf4=a27_0x10bc();let _0x3b0950=_0x10bcf4[_0x153d3e];return _0x3b0950;}let reminders=[];export async function loadReminders(){const _0x84e920=a27_0x55765f;try{const _0x4f1031=await a27_0x2d7cfa[_0x84e920(0x1f0)](REMINDERS_FILE,'utf-8');reminders=JSON[_0x84e920(0x205)](_0x4f1031);}catch{reminders=[];}}export async function saveReminders(){const _0x5e39ef=a27_0x55765f;try{await a27_0x2d7cfa['mkdir'](WOOZLIT_DIR,{'recursive':!![]}),await a27_0x2d7cfa[_0x5e39ef(0x1ec)](REMINDERS_FILE,JSON[_0x5e39ef(0x201)](reminders,null,0x2));}catch{}}export async function scheduleReminder(_0x1a843e,_0x93793f,_0x1ae689){const _0x3620a4=a27_0x55765f,_0x37c131=Date[_0x3620a4(0x1ff)]()+_0x93793f*0x3c*0x3e8,_0x47477e={'id':Math[_0x3620a4(0x207)]()[_0x3620a4(0x1f9)](0x24)[_0x3620a4(0x209)](0x7),'chatId':_0x1a843e,'timestamp':_0x37c131,'message':_0x1ae689};if(reminders['length']===0x0)await loadReminders();reminders[_0x3620a4(0x1f2)](_0x47477e),await saveReminders();const _0x353cb4=new Date(_0x37c131)[_0x3620a4(0x1ed)]();return'Reminder\x20set\x20for\x20'+_0x353cb4+_0x3620a4(0x208)+_0x1ae689+'\x22';}export async function checkReminders(_0x7e7fc5){const _0x102f3a=a27_0x55765f;if(reminders['length']===0x0)await loadReminders();const _0x2a7999=Date['now'](),_0x3c2259=reminders['filter'](_0x4d5f9b=>_0x4d5f9b[_0x102f3a(0x1fa)]>_0x2a7999),_0x404fa2=reminders['filter'](_0x4e0b2e=>_0x4e0b2e[_0x102f3a(0x1fa)]<=_0x2a7999);if(_0x404fa2[_0x102f3a(0x1ee)]>0x0){for(const _0x4d7a17 of _0x404fa2){try{await _0x7e7fc5['api'][_0x102f3a(0x20c)](_0x4d7a17[_0x102f3a(0x203)],_0x102f3a(0x1fc)+_0x4d7a17[_0x102f3a(0x1f5)]);}catch(_0x4f2785){console[_0x102f3a(0x206)](_0x102f3a(0x202)+_0x4d7a17[_0x102f3a(0x203)],_0x4f2785);}}reminders=_0x3c2259,await saveReminders();}}
|
package/dist/telegram/setup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x296ce9,_0x45ff85){const _0x39b254=a28_0x1929,_0x307faf=_0x296ce9();while(!![]){try{const _0x50c585=-parseInt(_0x39b254(0x9d))/0x1+-parseInt(_0x39b254(0x95))/0x2*(parseInt(_0x39b254(0x8e))/0x3)+-parseInt(_0x39b254(0x94))/0x4+parseInt(_0x39b254(0x9b))/0x5*(-parseInt(_0x39b254(0x93))/0x6)+-parseInt(_0x39b254(0x99))/0x7+parseInt(_0x39b254(0xa2))/0x8*(parseInt(_0x39b254(0xa1))/0x9)+-parseInt(_0x39b254(0xa4))/0xa*(-parseInt(_0x39b254(0x8d))/0xb);if(_0x50c585===_0x45ff85)break;else _0x307faf['push'](_0x307faf['shift']());}catch(_0x5c052b){_0x307faf['push'](_0x307faf['shift']());}}}(a28_0x2215,0xc9a4f));import{input}from'@inquirer/prompts';function a28_0x2215(){const _0x194b1b=['506546xDSVyh','Telegram\x20configuration\x20saved!','addAllowedChatId','You\x20also\x20need\x20to\x20allow\x20your\x20Telegram\x20User\x20ID.','4949770HvGYla','Invalid\x20token\x20format','1602995WIaZNt','info','612746sluyNB','Bot\x20Token:','Get\x20your\x20token\x20from\x20@BotFather\x20on\x20Telegram.','Setup\x20Telegram\x20Bot','63JOWWWs','504232Fmbmko','includes','42260dhsFpM','setBotToken','13541EDqtEk','6UPFFYr','Your\x20Telegram\x20Chat\x20ID\x20(numeric).\x20Leave\x20empty\x20if\x20unknown:','success','warn','You\x20can\x20add\x20your\x20Chat\x20ID\x20later\x20using\x20/telegram\x20allow\x20<id>\x20inside\x20the\x20CLI.','30NdcoBH','5552308Vavfhv'];a28_0x2215=function(){return _0x194b1b;};return a28_0x2215();}function a28_0x1929(_0x530554,_0x56464a){_0x530554=_0x530554-0x8d;const _0x221579=a28_0x2215();let _0x192926=_0x221579[_0x530554];return _0x192926;}import*as a28_0x505a88 from'./config.js';import*as a28_0x591487 from'../ui/output.js';export async function setupTelegram(){const _0x41232e=a28_0x1929;a28_0x591487[_0x41232e(0x9c)](_0x41232e(0xa0)),a28_0x591487['dim'](_0x41232e(0x9f));const _0x5b94f2=await input({'message':_0x41232e(0x9e),'validate':_0xba1899=>_0xba1899[_0x41232e(0xa3)](':')?!![]:_0x41232e(0x9a)});a28_0x505a88[_0x41232e(0xa5)](_0x5b94f2),a28_0x591487[_0x41232e(0x91)](_0x41232e(0x98));const _0x321634=await input({'message':_0x41232e(0x8f)});_0x321634?a28_0x505a88[_0x41232e(0x97)](parseInt(_0x321634)):a28_0x591487[_0x41232e(0x9c)](_0x41232e(0x92)),a28_0x591487[_0x41232e(0x90)](_0x41232e(0x96)),a28_0x591487[_0x41232e(0x9c)]('Restart\x20the\x20CLI\x20to\x20start\x20the\x20bot.');}
|
package/dist/tools/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3dfb31,_0x2f5dca){const _0x4f135a=a29_0x1f0e,_0x26da90=_0x3dfb31();while(!![]){try{const _0x82491f=parseInt(_0x4f135a(0x165))/0x1+-parseInt(_0x4f135a(0x16b))/0x2+parseInt(_0x4f135a(0x156))/0x3+-parseInt(_0x4f135a(0x160))/0x4+-parseInt(_0x4f135a(0x159))/0x5+parseInt(_0x4f135a(0x14f))/0x6*(-parseInt(_0x4f135a(0x16e))/0x7)+parseInt(_0x4f135a(0x151))/0x8;if(_0x82491f===_0x2f5dca)break;else _0x26da90['push'](_0x26da90['shift']());}catch(_0x3bb32d){_0x26da90['push'](_0x26da90['shift']());}}}(a29_0x51ed,0x7a570));import{spawn}from'child_process';function a29_0x1f0e(_0x5d4637,_0x58b328){_0x5d4637=_0x5d4637-0x14c;const _0x51edca=a29_0x51ed();let _0x1f0ee9=_0x51edca[_0x5d4637];return _0x1f0ee9;}const activeProcesses=new Map();export async function runCommand(_0x38ba6d,_0x2e920e,_0x1982d2=![],_0x54687d=0x7530){return new Promise(_0x3a9d20=>{const _0x22cb57=a29_0x1f0e,_0x2e6dd1=process[_0x22cb57(0x167)]===_0x22cb57(0x152),_0x28afab=_0x2e6dd1?_0x22cb57(0x161):'/bin/sh',_0x2e1770=_0x2e6dd1?'/c':'-c',_0x2250f8=spawn(_0x28afab,[_0x2e1770,_0x38ba6d],{'cwd':process['cwd'](),'env':process['env'],'detached':_0x1982d2,'stdio':_0x22cb57(0x157)}),_0x3b8000=_0x2250f8[_0x22cb57(0x166)]||0x0;let _0x172d98='',_0x5aa133='',_0x476211=![];_0x3b8000&&activeProcesses[_0x22cb57(0x16c)](_0x3b8000,{'child':_0x2250f8,'output':''});const _0x3af4bb=setTimeout(()=>{const _0x88fbf1=_0x22cb57;if(!_0x476211){_0x476211=!![];if(_0x1982d2&&_0x2250f8[_0x88fbf1(0x15a)])_0x2250f8[_0x88fbf1(0x15a)]();_0x3a9d20({'success':!![],'stdout':_0x172d98+(_0x88fbf1(0x15e)+_0x3b8000+']'),'stderr':_0x5aa133,'exitCode':0x0,'pid':_0x3b8000});}},_0x54687d);_0x2250f8[_0x22cb57(0x163)]?.['on'](_0x22cb57(0x155),_0x34013a=>{const _0x52635d=_0x22cb57,_0x220476=_0x34013a[_0x52635d(0x15d)]();_0x172d98+=_0x220476;if(_0x3b8000&&activeProcesses[_0x52635d(0x14d)](_0x3b8000)){const _0x112d1f=activeProcesses['get'](_0x3b8000);_0x112d1f['output']+=_0x220476;}if(!_0x476211&&_0x2e920e)_0x2e920e(_0x220476);}),_0x2250f8[_0x22cb57(0x150)]?.['on'](_0x22cb57(0x155),_0x8154e=>{const _0x3e069d=_0x22cb57,_0x3b9a70=_0x8154e[_0x3e069d(0x15d)]();_0x5aa133+=_0x3b9a70;if(_0x3b8000&&activeProcesses[_0x3e069d(0x14d)](_0x3b8000)){const _0x46d9f5=activeProcesses[_0x3e069d(0x15c)](_0x3b8000);_0x46d9f5[_0x3e069d(0x154)]+=_0x3b9a70;}if(!_0x476211&&_0x2e920e)_0x2e920e(_0x3b9a70);}),_0x2250f8['on'](_0x22cb57(0x16d),_0xf64a08=>{const _0x4f6cd9=_0x22cb57;clearTimeout(_0x3af4bb);if(_0x3b8000)activeProcesses[_0x4f6cd9(0x14e)](_0x3b8000);!_0x476211&&(_0x476211=!![],_0x3a9d20({'success':_0xf64a08===0x0,'stdout':_0x172d98,'stderr':_0x5aa133,'exitCode':_0xf64a08||0x0,'pid':_0x3b8000}));}),_0x2250f8['on'](_0x22cb57(0x15b),_0x23ff01=>{clearTimeout(_0x3af4bb);if(_0x3b8000)activeProcesses['delete'](_0x3b8000);!_0x476211&&(_0x476211=!![],_0x3a9d20({'success':![],'stdout':_0x172d98,'stderr':_0x23ff01['message'],'exitCode':0x1,'pid':_0x3b8000}));});});}export function readTerminalOutput(_0x1abf40){const _0x34877d=a29_0x1f0e,_0xb2c2b7=Array[_0x34877d(0x14c)](activeProcesses['keys']());if(_0x1abf40&&activeProcesses[_0x34877d(0x14d)](_0x1abf40)){const _0x2bcb35=activeProcesses['get'](_0x1abf40);return{'output':_0x2bcb35[_0x34877d(0x154)][_0x34877d(0x168)](-0x7d0),'running':!![],'pids':_0xb2c2b7};}let _0x305570='';for(const [_0x58cf38,_0x58b306]of activeProcesses){_0x305570+='[PID\x20'+_0x58cf38+']\x0a'+_0x58b306[_0x34877d(0x154)][_0x34877d(0x168)](-0x3e8)+'\x0a';}return{'output':_0x305570||_0x34877d(0x162),'running':_0xb2c2b7['length']>0x0,'pids':_0xb2c2b7};}function a29_0x51ed(){const _0x121346=['set','close','259pGXAqR','stdin','from','has','delete','112524fhQruD','stderr','14866504MkOJJG','win32','Terminated\x20PID\x20','output','data','718527XvxgBF','pipe','child','1461740cEOoCY','unref','error','get','toString','\x0a[Process\x20running\x20in\x20background,\x20PID:\x20','kill','2354072hyturr','cmd.exe','No\x20active\x20processes','stdout','write','691480ylszeN','pid','platform','slice','Sent\x20to\x20PID\x20','keys','1426868sKBSyy'];a29_0x51ed=function(){return _0x121346;};return a29_0x51ed();}export function sendTerminalInput(_0x3ad7a8,_0x529588){const _0x153a79=a29_0x1f0e;if(_0x529588&&activeProcesses[_0x153a79(0x14d)](_0x529588)){const _0x2ea724=activeProcesses[_0x153a79(0x15c)](_0x529588);return _0x2ea724[_0x153a79(0x158)][_0x153a79(0x16f)]?.[_0x153a79(0x164)](_0x3ad7a8+'\x0a'),{'success':!![],'message':_0x153a79(0x169)+_0x529588};}for(const [_0xc5c5a7,_0x3a7422]of activeProcesses){return _0x3a7422[_0x153a79(0x158)][_0x153a79(0x16f)]?.[_0x153a79(0x164)](_0x3ad7a8+'\x0a'),{'success':!![],'message':_0x153a79(0x169)+_0xc5c5a7};}return{'success':![],'message':_0x153a79(0x162)};}export function terminateProcess(_0x449496){const _0x1b763e=a29_0x1f0e;if(_0x449496&&activeProcesses['has'](_0x449496)){const _0x1b6282=activeProcesses[_0x1b763e(0x15c)](_0x449496);return _0x1b6282[_0x1b763e(0x158)]['kill'](),activeProcesses['delete'](_0x449496),{'success':!![],'message':_0x1b763e(0x153)+_0x449496};}if(activeProcesses['size']>0x0)for(const [_0x55cee2,_0x106a3f]of activeProcesses){return _0x106a3f[_0x1b763e(0x158)][_0x1b763e(0x15f)](),activeProcesses['delete'](_0x55cee2),{'success':!![],'message':_0x1b763e(0x153)+_0x55cee2};}return{'success':![],'message':'No\x20active\x20processes'};}export function getActiveProcesses(){const _0x2de657=a29_0x1f0e;return Array[_0x2de657(0x14c)](activeProcesses[_0x2de657(0x16a)]());}
|
package/dist/tools/file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x57f962,_0x2be18b){const _0x205e1d=a30_0xf355,_0x5ecbbe=_0x57f962();while(!![]){try{const _0x3e698b=parseInt(_0x205e1d(0x1ee))/0x1+-parseInt(_0x205e1d(0x1ca))/0x2*(-parseInt(_0x205e1d(0x1dc))/0x3)+-parseInt(_0x205e1d(0x1e3))/0x4*(-parseInt(_0x205e1d(0x1ec))/0x5)+parseInt(_0x205e1d(0x1f0))/0x6*(parseInt(_0x205e1d(0x1fa))/0x7)+parseInt(_0x205e1d(0x1be))/0x8*(-parseInt(_0x205e1d(0x1c5))/0x9)+parseInt(_0x205e1d(0x1e5))/0xa+-parseInt(_0x205e1d(0x1df))/0xb*(parseInt(_0x205e1d(0x1e4))/0xc);if(_0x3e698b===_0x2be18b)break;else _0x5ecbbe['push'](_0x5ecbbe['shift']());}catch(_0x5bd3f6){_0x5ecbbe['push'](_0x5ecbbe['shift']());}}}(a30_0xb4a8,0x3069d));import{readFileSync,writeFileSync,existsSync,readdirSync,statSync,mkdirSync}from'fs';import{dirname,resolve,relative}from'path';import{trackFileCreate,trackFileModify}from'./rollback.js';function a30_0xb4a8(){const _0x3aead0=['Edited\x20','.jsx','file','Read\x20','15FQEDOt','.png','Failed\x20to\x20create\x20','3908267CvOGLU','.bin','Failed\x20to\x20edit\x20','Created\x20','24rKquKQ','12ElDFDu','2386470xTEvwP','directory','.jpg','.md','Directory\x20not\x20found:\x20','length','map','119455ZFvxis','Failed\x20to\x20find\x20files:\x20','101421hOZDXU','forEach','24966kdZVSv','Failed\x20to\x20read\x20','.rs','utf-8','split','slice','.css','.html','test','push','21HaOBWZ','Search\x20string\x20not\x20found\x20in\x20',').\x20Use\x20\x27computer_screenshot\x27\x20or\x20specific\x20tools\x20to\x20handle\x20this\x20file\x20type.\x20Direct\x20reading\x20is\x20not\x20supported.]','node_modules','pop','.jpeg','48IELjBf','.\x20Note:\x20The\x20search\x20string\x20must\x20be\x20an\x20EXACT\x20match\x20including\x20all\x20whitespace\x20and\x20indentation.\x20If\x20you\x20are\x20struggling\x20to\x20edit,\x20please\x20use\x20create_file\x20to\x20overwrite\x20the\x20entire\x20file.','Listed\x20','File\x20not\x20found:\x20','toLowerCase','startsWith','includes','143856gNynIl','.gif','Failed\x20to\x20list\x20','\x20matches\x20for\x20\x22','.go','61442tGlUII','cwd','trim','.exe','isDirectory','.ts','Failed\x20to\x20search\x20','filter','size','substring','[Binary\x20file\x20detected\x20(.','.py','\x20files\x20matching\x20\x22','Found\x20'];a30_0xb4a8=function(){return _0x3aead0;};return a30_0xb4a8();}function a30_0xf355(_0x38ec24,_0x1841aa){_0x38ec24=_0x38ec24-0x1bd;const _0xb4a87c=a30_0xb4a8();let _0xf3557f=_0xb4a87c[_0x38ec24];return _0xf3557f;}export function createFile(_0x34df21,_0x10a3b4){const _0x587cc8=a30_0xf355;try{const _0x1eebc8=resolve(process[_0x587cc8(0x1cb)](),_0x34df21),_0x3bfabe=dirname(_0x1eebc8);return!existsSync(_0x3bfabe)&&mkdirSync(_0x3bfabe,{'recursive':!![]}),writeFileSync(_0x1eebc8,_0x10a3b4,'utf-8'),trackFileCreate(_0x1eebc8),{'success':!![],'message':_0x587cc8(0x1e2)+_0x34df21};}catch(_0x41b9f7){return{'success':![],'message':_0x587cc8(0x1de)+_0x34df21+':\x20'+_0x41b9f7};}}export function readFile(_0x23454f){const _0x301306=a30_0xf355;try{const _0x1a537c=resolve(process['cwd'](),_0x23454f);if(!existsSync(_0x1a537c))return{'success':![],'message':_0x301306(0x1c1)+_0x23454f};const _0x148f64=[_0x301306(0x1dd),_0x301306(0x1e7),_0x301306(0x1bd),_0x301306(0x1c6),_0x301306(0x1cd),'.dll',_0x301306(0x1e0)],_0x288aff=_0x1a537c[_0x301306(0x1f4)]('.')[_0x301306(0x1fe)]()?.[_0x301306(0x1c2)]();if(_0x288aff&&_0x148f64[_0x301306(0x1c4)]('.'+_0x288aff))return{'success':![],'message':_0x301306(0x1d4)+_0x288aff+_0x301306(0x1fc)};const _0x11be39=readFileSync(_0x1a537c,_0x301306(0x1f3));return{'success':!![],'content':_0x11be39,'message':_0x301306(0x1db)+_0x23454f};}catch(_0x1f2212){return{'success':![],'message':_0x301306(0x1f1)+_0x23454f+':\x20'+_0x1f2212};}}export function listDirectory(_0x447fdd='.'){const _0x1ef7cb=a30_0xf355;try{const _0xd62c74=resolve(process[_0x1ef7cb(0x1cb)](),_0x447fdd);if(!existsSync(_0xd62c74))return{'success':![],'message':_0x1ef7cb(0x1e9)+_0x447fdd};const _0x11de41=readdirSync(_0xd62c74),_0x4d4863=_0x11de41[_0x1ef7cb(0x1eb)](_0x58f9ca=>{const _0x40afab=_0x1ef7cb,_0x42c4bb=resolve(_0xd62c74,_0x58f9ca),_0xd381f=statSync(_0x42c4bb);return{'name':_0x58f9ca,'type':_0xd381f[_0x40afab(0x1ce)]()?_0x40afab(0x1e6):_0x40afab(0x1da),'size':_0xd381f['isFile']()?_0xd381f[_0x40afab(0x1d2)]:undefined};});return{'success':!![],'entries':_0x4d4863,'message':_0x1ef7cb(0x1c0)+_0x4d4863['length']+'\x20items\x20in\x20'+_0x447fdd};}catch(_0x4b70c7){return{'success':![],'message':_0x1ef7cb(0x1c7)+_0x447fdd+':\x20'+_0x4b70c7};}}export function editFile(_0x50a153,_0x1762f3,_0x5e5a28){const _0x4f59af=a30_0xf355;try{const _0x32a10d=resolve(process[_0x4f59af(0x1cb)](),_0x50a153);if(!existsSync(_0x32a10d))return{'success':![],'message':_0x4f59af(0x1c1)+_0x50a153};const _0x252cfe=readFileSync(_0x32a10d,_0x4f59af(0x1f3));if(!_0x252cfe[_0x4f59af(0x1c4)](_0x1762f3))return{'success':![],'message':_0x4f59af(0x1fb)+_0x50a153+_0x4f59af(0x1bf)};trackFileModify(_0x32a10d,_0x252cfe);const _0x503495=_0x252cfe['replace'](_0x1762f3,_0x5e5a28);return writeFileSync(_0x32a10d,_0x503495,_0x4f59af(0x1f3)),{'success':!![],'message':_0x4f59af(0x1d8)+_0x50a153};}catch(_0x34689e){return{'success':![],'message':_0x4f59af(0x1e1)+_0x50a153+':\x20'+_0x34689e};}}export function searchFile(_0xef89ec,_0x148339){const _0x51e505=a30_0xf355;try{const _0x12e5b0=resolve(process[_0x51e505(0x1cb)](),_0xef89ec);if(!existsSync(_0x12e5b0))return{'success':![],'message':_0x51e505(0x1c1)+_0xef89ec};const _0x5ecc26=readFileSync(_0x12e5b0,_0x51e505(0x1f3)),_0x469d0b=new RegExp(_0x148339,'g'),_0x379ab8=_0x5ecc26['match'](_0x469d0b)||[],_0x599bb1=_0x5ecc26[_0x51e505(0x1f4)]('\x0a'),_0x25a764=_0x599bb1[_0x51e505(0x1d1)]((_0x26eb9c,_0x50c524)=>new RegExp(_0x148339)[_0x51e505(0x1f8)](_0x26eb9c));return{'success':!![],'matches':_0x25a764,'message':_0x51e505(0x1d7)+_0x25a764[_0x51e505(0x1ea)]+'\x20output\x20matches\x20in\x20'+_0xef89ec};}catch(_0x2ccd38){return{'success':![],'message':_0x51e505(0x1d0)+_0xef89ec+':\x20'+_0x2ccd38};}}export function findFiles(_0x33115b,_0x2d05c7){const _0x8a4b13=a30_0xf355;try{const _0x57c3c1=resolve(process[_0x8a4b13(0x1cb)](),_0x33115b);if(!existsSync(_0x57c3c1))return{'success':![],'message':_0x8a4b13(0x1e9)+_0x33115b};const _0x53e970=[],_0x511f2e=new RegExp(_0x2d05c7,'i');function _0x5c89f5(_0x1f8310){const _0x1431aa=_0x8a4b13,_0xee9609=readdirSync(_0x1f8310);for(const _0x1763da of _0xee9609){if(_0x1763da[_0x1431aa(0x1c3)]('.')||_0x1763da==='node_modules')continue;const _0x1bd52f=resolve(_0x1f8310,_0x1763da),_0x3a220b=statSync(_0x1bd52f);if(_0x3a220b[_0x1431aa(0x1ce)]())_0x5c89f5(_0x1bd52f);else _0x511f2e['test'](_0x1763da)&&_0x53e970[_0x1431aa(0x1f9)](relative(_0x57c3c1,_0x1bd52f));}}return _0x5c89f5(_0x57c3c1),{'success':!![],'files':_0x53e970['slice'](0x0,0x32),'message':'Found\x20'+_0x53e970[_0x8a4b13(0x1ea)]+_0x8a4b13(0x1d6)+_0x2d05c7+'\x22'};}catch(_0x334679){return{'success':![],'message':_0x8a4b13(0x1ed)+_0x334679};}}export function searchDirectory(_0x104134,_0x465da5){const _0x2bdb76=a30_0xf355;try{const _0x5eeba5=resolve(process[_0x2bdb76(0x1cb)](),_0x104134);if(!existsSync(_0x5eeba5))return{'success':![],'message':_0x2bdb76(0x1e9)+_0x104134};const _0x54bcca=[],_0x2dd886=new RegExp(_0x465da5,'i'),_0x29e61b=[_0x2bdb76(0x1cf),'.js','.tsx',_0x2bdb76(0x1d9),'.json',_0x2bdb76(0x1e8),'.txt',_0x2bdb76(0x1f6),_0x2bdb76(0x1f7),_0x2bdb76(0x1d5),_0x2bdb76(0x1c9),_0x2bdb76(0x1f2)];function _0x58597c(_0x491d0f){const _0x2aec83=_0x2bdb76,_0x3dd944=readdirSync(_0x491d0f);for(const _0x2609ab of _0x3dd944){if(_0x2609ab[_0x2aec83(0x1c3)]('.')||_0x2609ab===_0x2aec83(0x1fd))continue;const _0x422295=resolve(_0x491d0f,_0x2609ab),_0x554789=statSync(_0x422295);if(_0x554789[_0x2aec83(0x1ce)]())_0x58597c(_0x422295);else{const _0x12d500='.'+_0x2609ab[_0x2aec83(0x1f4)]('.')[_0x2aec83(0x1fe)]()?.[_0x2aec83(0x1c2)]();if(_0x29e61b['includes'](_0x12d500))try{const _0x1ea4eb=readFileSync(_0x422295,_0x2aec83(0x1f3)),_0x5b18a6=_0x1ea4eb['split']('\x0a');_0x5b18a6[_0x2aec83(0x1ef)]((_0x13cf06,_0x43e744)=>{const _0x1840db=_0x2aec83;_0x2dd886['test'](_0x13cf06)&&_0x54bcca[_0x1840db(0x1f9)]({'file':relative(_0x5eeba5,_0x422295),'line':_0x43e744+0x1,'content':_0x13cf06[_0x1840db(0x1cc)]()[_0x1840db(0x1d3)](0x0,0x64)});});}catch{}}}}return _0x58597c(_0x5eeba5),{'success':!![],'results':_0x54bcca[_0x2bdb76(0x1f5)](0x0,0x1e),'message':'Found\x20'+_0x54bcca[_0x2bdb76(0x1ea)]+_0x2bdb76(0x1c8)+_0x465da5+'\x22'};}catch(_0x2e2698){return{'success':![],'message':'Failed\x20to\x20search\x20directory:\x20'+_0x2e2698};}}
|
package/dist/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5114e4,_0x4de563){var _0x3dedd0=a31_0x1471,_0x2a2907=_0x5114e4();while(!![]){try{var _0x566eb1=-parseInt(_0x3dedd0(0x114))/0x1+parseInt(_0x3dedd0(0x111))/0x2+-parseInt(_0x3dedd0(0x10e))/0x3*(parseInt(_0x3dedd0(0x10f))/0x4)+-parseInt(_0x3dedd0(0x10b))/0x5*(parseInt(_0x3dedd0(0x10c))/0x6)+-parseInt(_0x3dedd0(0x113))/0x7*(-parseInt(_0x3dedd0(0x112))/0x8)+-parseInt(_0x3dedd0(0x110))/0x9+parseInt(_0x3dedd0(0x10d))/0xa;if(_0x566eb1===_0x4de563)break;else _0x2a2907['push'](_0x2a2907['shift']());}catch(_0x759a27){_0x2a2907['push'](_0x2a2907['shift']());}}}(a31_0x2976,0xbf7e2));export{createFile,readFile,listDirectory,editFile,searchFile,findFiles,searchDirectory}from'./file.js';export{runCommand,readTerminalOutput,sendTerminalInput,terminateProcess,getActiveProcesses}from'./command.js';export{listRules,addRule,clearRules,formatRulesForSystem}from'./rules.js';function a31_0x2976(){var _0x41a1a9=['858830DNIhMG','55vGeihu','541992BhdwZI','14970020ylqshe','514863ZbDNRx','12XThapB','2187603rNHveN','2654510yyFEtX','4564072ejREZO','7FBVsJA'];a31_0x2976=function(){return _0x41a1a9;};return a31_0x2976();}function a31_0x1471(_0x20ef9b,_0x1f1db7){_0x20ef9b=_0x20ef9b-0x10b;var _0x297629=a31_0x2976();var _0x147103=_0x297629[_0x20ef9b];return _0x147103;}export{connectToMcpServers,getMcpTools,executeMcpTool,closeMcpClients}from'./mcp.js';export{trackFileCreate,trackFileModify,rollbackLast,rollbackAll,getChanges,clearChanges}from'./rollback.js';export*from'../browser/index.js';
|
package/dist/tools/mcp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xb8f026,_0xbe3c4e){const _0x24e486=a32_0x52e6,_0x17af89=_0xb8f026();while(!![]){try{const _0x421687=-parseInt(_0x24e486(0x113))/0x1+-parseInt(_0x24e486(0x132))/0x2*(-parseInt(_0x24e486(0x126))/0x3)+parseInt(_0x24e486(0x138))/0x4*(parseInt(_0x24e486(0x127))/0x5)+-parseInt(_0x24e486(0x134))/0x6*(-parseInt(_0x24e486(0x112))/0x7)+-parseInt(_0x24e486(0x11c))/0x8*(-parseInt(_0x24e486(0x125))/0x9)+-parseInt(_0x24e486(0x10f))/0xa*(-parseInt(_0x24e486(0x133))/0xb)+-parseInt(_0x24e486(0x120))/0xc;if(_0x421687===_0xbe3c4e)break;else _0x17af89['push'](_0x17af89['shift']());}catch(_0x50e826){_0x17af89['push'](_0x17af89['shift']());}}}(a32_0x5ae7,0xf0b82));import{Client}from'@modelcontextprotocol/sdk/client/index.js';import{StdioClientTransport}from'@modelcontextprotocol/sdk/client/stdio.js';import{StreamableHTTPClientTransport}from'@modelcontextprotocol/sdk/client/streamableHttp.js';import{getMcpServers}from'../config/mcp.js';import*as a32_0x524eb5 from'../ui/output.js';const clients=new Map();async function connectStdioServer(_0x2830ce,_0x502fc6){const _0x2a8ef4=a32_0x52e6;try{const _0x11f3a2={...process[_0x2a8ef4(0x111)],..._0x502fc6[_0x2a8ef4(0x111)]};Object[_0x2a8ef4(0x12f)](_0x11f3a2)[_0x2a8ef4(0x137)](_0x149d47=>_0x11f3a2[_0x149d47]===undefined&&delete _0x11f3a2[_0x149d47]);const _0x1b042d=new StdioClientTransport({'command':_0x502fc6[_0x2a8ef4(0x124)],'args':_0x502fc6[_0x2a8ef4(0x123)],'env':_0x11f3a2,'stderr':_0x2a8ef4(0x139)}),_0xae3b2f=new Client({'name':_0x2a8ef4(0x136),'version':'1.0.0'},{'capabilities':{}});return await _0xae3b2f[_0x2a8ef4(0x114)](_0x1b042d),_0xae3b2f;}catch{return null;}}async function connectHttpServer(_0x563b4a,_0x355bd3){const _0x57fb61=a32_0x52e6;try{const _0x3839a9=new StreamableHTTPClientTransport(new URL(_0x355bd3)),_0x53c51d=new Client({'name':_0x57fb61(0x136),'version':_0x57fb61(0x11e)},{'capabilities':{}});return await _0x53c51d[_0x57fb61(0x114)](_0x3839a9),_0x53c51d;}catch{return null;}}export async function connectToMcpServers(){const _0x5cd66a=a32_0x52e6,_0x3805c3=getMcpServers(),_0x44d551=Object['keys'](_0x3805c3);if(_0x44d551[_0x5cd66a(0x11f)]===0x0)return;const _0x146230=_0x37b6cd=>new Promise((_0x474a2d,_0x2da3f0)=>setTimeout(()=>_0x2da3f0(new Error('timeout')),_0x37b6cd)),_0x3a3f9d=async(_0x472b6b,_0x1a6dda)=>{const _0x4eb9c0=_0x5cd66a;try{let _0x5cd4e4=null;const _0x592eb7=_0x1a6dda['type']===_0x4eb9c0(0x128)?connectHttpServer(_0x472b6b,_0x1a6dda['url']):connectStdioServer(_0x472b6b,_0x1a6dda);_0x5cd4e4=await Promise[_0x4eb9c0(0x119)]([_0x592eb7,_0x146230(0xbb8)]);if(_0x5cd4e4)clients[_0x4eb9c0(0x131)](_0x472b6b,_0x5cd4e4);}catch{}};await Promise[_0x5cd66a(0x11b)](_0x44d551[_0x5cd66a(0x11d)](_0x8a6ce3=>!clients[_0x5cd66a(0x12e)](_0x8a6ce3))['map'](_0x163ee6=>_0x3a3f9d(_0x163ee6,_0x3805c3[_0x163ee6])));}export async function getMcpTools(){const _0x3496f7=a32_0x52e6,_0x46b642=[];for(const [_0x179cad,_0x304579]of clients[_0x3496f7(0x121)]()){try{const _0x2af271=await _0x304579[_0x3496f7(0x110)](),_0x42210d=_0x2af271[_0x3496f7(0x135)][_0x3496f7(0x11a)](_0x269ed8=>({'name':_0x269ed8[_0x3496f7(0x130)],'description':_0x269ed8['description'],'inputSchema':_0x269ed8[_0x3496f7(0x116)],'serverName':_0x179cad}));_0x46b642[_0x3496f7(0x10e)](..._0x42210d);}catch(_0x4f90d8){a32_0x524eb5[_0x3496f7(0x118)](_0x3496f7(0x12b)+_0x179cad+_0x3496f7(0x13a)+_0x4f90d8);}}return _0x46b642;}function a32_0x52e6(_0xb33542,_0x5102d9){_0xb33542=_0xb33542-0x10e;const _0x5ae7bb=a32_0x5ae7();let _0x52e6bd=_0x5ae7bb[_0xb33542];return _0x52e6bd;}function a32_0x5ae7(){const _0x1973db=['632VGmipK','filter','1.0.0','length','42346080oEcwJU','entries','MCP\x20tool\x20execution\x20failed:\x20','args','command','176679YKhVVh','219ncgeaS','2930RzCvnx','streamable-http','MCP\x20server\x20\x27','callTool','Failed\x20to\x20list\x20tools\x20for\x20\x27','get','\x27\x20not\x20connected','has','keys','name','set','13334HaAjZb','11SKsggP','6814512MIktUU','tools','woozlit-cli','forEach','12876QgOLUF','pipe','\x27:\x20','push','1683770DHSYEs','listTools','env','7WemJqm','713177fcznsc','connect','clear','inputSchema','values','error','race','map','all'];a32_0x5ae7=function(){return _0x1973db;};return a32_0x5ae7();}export async function executeMcpTool(_0x2bc0b9,_0x3e7dba,_0x1427b9){const _0x311998=a32_0x52e6,_0x299be4=clients[_0x311998(0x12c)](_0x2bc0b9);if(!_0x299be4)throw new Error(_0x311998(0x129)+_0x2bc0b9+_0x311998(0x12d));try{const _0x4e14e7=await _0x299be4[_0x311998(0x12a)]({'name':_0x3e7dba,'arguments':_0x1427b9});return _0x4e14e7;}catch(_0x18886b){throw new Error(_0x311998(0x122)+_0x18886b);}}export function closeMcpClients(){const _0x55fcbf=a32_0x52e6;for(const _0x298df5 of clients[_0x55fcbf(0x117)]()){try{_0x298df5['close']();}catch(_0x1bef42){}}clients[_0x55fcbf(0x115)]();}
|
package/dist/tools/rollback.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a33_0x2f33(){const _0x22c881=['50257BIspzG','delete','6200XExDwl','existsSync','6BLpNQt','703564JxDuvu','writeFileSync','path','18XitdOg','message','21838278pTFvwo','length','modify','3858760fnDoge','resolve','Deleted:\x20','1990520rfNCFc','Restored:\x20','previousContent','Rollback\x20failed:\x20','push','now','No\x20changes\x20to\x20rollback','38PpYmdq','create','4662721SYZaCl','423GoFGFX','unlinkSync','type','pop'];a33_0x2f33=function(){return _0x22c881;};return a33_0x2f33();}(function(_0x47703c,_0x24cb5d){const _0x87147b=a33_0x5618,_0x548a66=_0x47703c();while(!![]){try{const _0x5407fc=parseInt(_0x87147b(0x99))/0x1*(-parseInt(_0x87147b(0x92))/0x2)+-parseInt(_0x87147b(0x7f))/0x3*(parseInt(_0x87147b(0x80))/0x4)+-parseInt(_0x87147b(0x8b))/0x5*(parseInt(_0x87147b(0x83))/0x6)+parseInt(_0x87147b(0x94))/0x7+parseInt(_0x87147b(0x88))/0x8+parseInt(_0x87147b(0x95))/0x9*(-parseInt(_0x87147b(0x9b))/0xa)+parseInt(_0x87147b(0x85))/0xb;if(_0x5407fc===_0x24cb5d)break;else _0x548a66['push'](_0x548a66['shift']());}catch(_0xbf9b9c){_0x548a66['push'](_0x548a66['shift']());}}}(a33_0x2f33,0x935ed));import*as a33_0xecb6e from'fs';import*as a33_0x5ebb87 from'path';const changes=[];export function trackFileCreate(_0x48d4ec){const _0x32d810=a33_0x5618;changes[_0x32d810(0x8f)]({'path':a33_0x5ebb87[_0x32d810(0x89)](_0x48d4ec),'type':_0x32d810(0x93),'previousContent':null,'timestamp':Date[_0x32d810(0x90)]()});}export function trackFileModify(_0x23f7f8,_0x8ca0ee){const _0x433375=a33_0x5618;changes[_0x433375(0x8f)]({'path':a33_0x5ebb87[_0x433375(0x89)](_0x23f7f8),'type':_0x433375(0x87),'previousContent':_0x8ca0ee,'timestamp':Date['now']()});}export function trackFileDelete(_0x3b8c6a,_0x44da2b){const _0x5b9b73=a33_0x5618;changes[_0x5b9b73(0x8f)]({'path':a33_0x5ebb87[_0x5b9b73(0x89)](_0x3b8c6a),'type':_0x5b9b73(0x9a),'previousContent':_0x44da2b,'timestamp':Date[_0x5b9b73(0x90)]()});}export function getChanges(){return[...changes];}export function rollbackLast(){const _0x54af0a=a33_0x5618;if(changes[_0x54af0a(0x86)]===0x0)return{'success':![],'message':_0x54af0a(0x91)};const _0xbd452c=changes[_0x54af0a(0x98)]();try{switch(_0xbd452c[_0x54af0a(0x97)]){case'create':a33_0xecb6e[_0x54af0a(0x7e)](_0xbd452c['path'])&&a33_0xecb6e[_0x54af0a(0x96)](_0xbd452c[_0x54af0a(0x82)]);return{'success':!![],'message':_0x54af0a(0x8a)+_0xbd452c[_0x54af0a(0x82)]};case _0x54af0a(0x87):_0xbd452c['previousContent']!==null&&a33_0xecb6e['writeFileSync'](_0xbd452c[_0x54af0a(0x82)],_0xbd452c['previousContent']);return{'success':!![],'message':_0x54af0a(0x8c)+_0xbd452c[_0x54af0a(0x82)]};case _0x54af0a(0x9a):_0xbd452c['previousContent']!==null&&a33_0xecb6e[_0x54af0a(0x81)](_0xbd452c[_0x54af0a(0x82)],_0xbd452c[_0x54af0a(0x8d)]);return{'success':!![],'message':'Restored:\x20'+_0xbd452c['path']};default:return{'success':![],'message':'Unknown\x20change\x20type'};}}catch(_0x5aa958){return{'success':![],'message':_0x54af0a(0x8e)+_0x5aa958};}}export function rollbackAll(){const _0x3f5636=a33_0x5618,_0x1e7230=[];let _0x4a4b80=0x0;while(changes[_0x3f5636(0x86)]>0x0){const _0x7ce93e=rollbackLast();_0x7ce93e['success']&&(_0x4a4b80++,_0x1e7230[_0x3f5636(0x8f)](_0x7ce93e[_0x3f5636(0x84)]));}return{'success':_0x4a4b80>0x0,'count':_0x4a4b80,'messages':_0x1e7230};}function a33_0x5618(_0x538d87,_0x3b1aa4){_0x538d87=_0x538d87-0x7e;const _0x2f33c8=a33_0x2f33();let _0x5618c5=_0x2f33c8[_0x538d87];return _0x5618c5;}export function clearChanges(){changes['length']=0x0;}
|
package/dist/tools/rules.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a34_0x1ecc(){const _0xdd58dc=['842265rESJlP','1575704yHKxMI','3515928KWaYLz','447255HjBfoI','length','1659888TTCzOO','49MGAvMX','6LLXmnJ','map','157414CjCrdF','6405080yzODlX','16lbWVsr','\x0a\x0aUser-defined\x20rules:\x0a'];a34_0x1ecc=function(){return _0xdd58dc;};return a34_0x1ecc();}(function(_0x5c4819,_0x22823b){const _0x23f0d9=a34_0x5412,_0x5d00b9=_0x5c4819();while(!![]){try{const _0x31aa79=-parseInt(_0x23f0d9(0x176))/0x1*(-parseInt(_0x23f0d9(0x178))/0x2)+parseInt(_0x23f0d9(0x172))/0x3+parseInt(_0x23f0d9(0x16f))/0x4+parseInt(_0x23f0d9(0x16d))/0x5*(parseInt(_0x23f0d9(0x174))/0x6)+parseInt(_0x23f0d9(0x173))/0x7*(-parseInt(_0x23f0d9(0x16e))/0x8)+parseInt(_0x23f0d9(0x170))/0x9+-parseInt(_0x23f0d9(0x177))/0xa;if(_0x31aa79===_0x22823b)break;else _0x5d00b9['push'](_0x5d00b9['shift']());}catch(_0x1c2e3a){_0x5d00b9['push'](_0x5d00b9['shift']());}}}(a34_0x1ecc,0xd9679));function a34_0x5412(_0x278c82,_0x24e5f5){_0x278c82=_0x278c82-0x16d;const _0x1ecc10=a34_0x1ecc();let _0x54122f=_0x1ecc10[_0x278c82];return _0x54122f;}import{getRules,addRule as a34_0x2e9b1d,clearRules as a34_0x1185c9}from'../utils/storage.js';export function listRules(){return getRules();}export function addRule(_0x24e624){a34_0x2e9b1d(_0x24e624);}export function clearRules(){a34_0x1185c9();}export function formatRulesForSystem(){const _0x1e0692=a34_0x5412,_0x20c083=getRules();if(_0x20c083[_0x1e0692(0x171)]===0x0)return'';return _0x1e0692(0x179)+_0x20c083[_0x1e0692(0x175)]((_0x259a59,_0x20a05d)=>_0x20a05d+0x1+'.\x20'+_0x259a59)['join']('\x0a');}
|