@morphllm/morphmcp
Advanced tools
+1
-1
| #!/usr/bin/env node | ||
| const a0_0x50aede=a0_0xa12a;(function(_0x52d251,_0x4c29c0){const _0x3f4185=a0_0xa12a,_0x1f85f8=_0x52d251();while(!![]){try{const _0x43bcdb=-parseInt(_0x3f4185(0x23a))/0x1+-parseInt(_0x3f4185(0x157))/0x2*(parseInt(_0x3f4185(0x186))/0x3)+parseInt(_0x3f4185(0x249))/0x4*(parseInt(_0x3f4185(0x22c))/0x5)+-parseInt(_0x3f4185(0x143))/0x6*(-parseInt(_0x3f4185(0x20c))/0x7)+-parseInt(_0x3f4185(0x153))/0x8*(parseInt(_0x3f4185(0x264))/0x9)+parseInt(_0x3f4185(0x1ec))/0xa*(parseInt(_0x3f4185(0x152))/0xb)+-parseInt(_0x3f4185(0x180))/0xc;if(_0x43bcdb===_0x4c29c0)break;else _0x1f85f8['push'](_0x1f85f8['shift']());}catch(_0x4ca6f9){_0x1f85f8['push'](_0x1f85f8['shift']());}}}(a0_0x3bac,0xb2a3e));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x5237c2 from'fs/promises';import a0_0x20fcf1 from'path';import a0_0x20d132 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x38920b from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x34efbb){const _0x48c177=a0_0xa12a,_0x5189e9=_0x34efbb['split'](a0_0x20fcf1['sep'])[_0x48c177(0x204)](Boolean);if(_0x5189e9[_0x48c177(0x1eb)]<0x2)return null;for(let _0x15b6b6=Math['floor'](_0x5189e9[_0x48c177(0x1eb)]/0x2);_0x15b6b6>=0x1;_0x15b6b6--){for(let _0x3974d5=0x0;_0x3974d5<=_0x5189e9['length']-0x2*_0x15b6b6;_0x3974d5++){const _0x3d2d2e=_0x5189e9['slice'](_0x3974d5,_0x3974d5+_0x15b6b6),_0xf9cf29=_0x5189e9[_0x48c177(0x1cc)](_0x3974d5+_0x15b6b6,_0x3974d5+0x2*_0x15b6b6);if(_0x3d2d2e[_0x48c177(0x1b2)]((_0x181fde,_0x4e328e)=>_0x181fde===_0xf9cf29[_0x4e328e])){const _0x2b208b=[..._0x5189e9[_0x48c177(0x1cc)](0x0,_0x3974d5),..._0x5189e9[_0x48c177(0x1cc)](_0x3974d5+_0x15b6b6)];return a0_0x20fcf1[_0x48c177(0x185)]+_0x2b208b['join'](a0_0x20fcf1[_0x48c177(0x185)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1daa23=a0_0xa12a;try{const _0x55b2a2=require('../package.json');return _0x55b2a2[_0x1daa23(0x167)]??_0x1daa23(0x1f8);}catch(_0x93a857){return logMcpStderr(_0x1daa23(0x224),_0x93a857),_0x1daa23(0x1f8);}}function printHelp(){const _0x20f751=a0_0xa12a;console[_0x20f751(0x1db)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x20f751(0x1db)](_0x20f751(0x1cd)),console[_0x20f751(0x1db)]('\x0aOptions:'),console[_0x20f751(0x1db)](_0x20f751(0x236)),console[_0x20f751(0x1db)](_0x20f751(0x1a3)),console[_0x20f751(0x1db)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x20f751(0x1db)](_0x20f751(0x1de)),console[_0x20f751(0x1db)](_0x20f751(0x191)),console[_0x20f751(0x1db)](_0x20f751(0x1fe));}const cliArgs=process[a0_0x50aede(0x1af)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x50aede(0x222),'-v','-V']),HELP_FLAGS=new Set([a0_0x50aede(0x154),'-h']);cliArgs[a0_0x50aede(0x259)](_0x5a01c3=>VERSION_FLAGS[a0_0x50aede(0x1b6)](_0x5a01c3))&&(console[a0_0x50aede(0x1db)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x17990d=>HELP_FLAGS[a0_0x50aede(0x1b6)](_0x17990d))&&(printHelp(),process[a0_0x50aede(0x21e)](0x0));function getCliArg(_0x3f8676){const _0x54eea5=a0_0x50aede;for(let _0x3691b2=0x0;_0x3691b2<cliArgs[_0x54eea5(0x1eb)];_0x3691b2++){const _0x1e5ff4=cliArgs[_0x3691b2];if(_0x1e5ff4[_0x54eea5(0x193)]('--'+_0x3f8676+'='))return _0x1e5ff4[_0x54eea5(0x1cc)](('--'+_0x3f8676+'=')['length']);if(_0x1e5ff4==='--'+_0x3f8676&&_0x3691b2+0x1<cliArgs[_0x54eea5(0x1eb)])return cliArgs[_0x3691b2+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x50aede(0x1b6)](arg))continue;if(arg[a0_0x50aede(0x193)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x50aede(0x1e1)](arg);}const WORKSPACE_ROOT=process[a0_0x50aede(0x19b)][a0_0x50aede(0x22b)]||process['env'][a0_0x50aede(0x140)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x50aede(0x19b)][a0_0x50aede(0x16f)]!=='false',MORPH_API_KEY=getCliArg(a0_0x50aede(0x15d))??process[a0_0x50aede(0x19b)][a0_0x50aede(0x1cf)],MORPH_API_URL=process[a0_0x50aede(0x19b)][a0_0x50aede(0x1ed)],MORPH_LARGE_APPLY=process[a0_0x50aede(0x19b)]['MORPH_LARGE_APPLY']!==a0_0x50aede(0x156),MORPH_WARP_GREP_TIMEOUT=process['env']['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x50aede(0x19b)][a0_0x50aede(0x218)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x50aede(0x19b)]['DISABLED_TOOLS']?new Set(process[a0_0x50aede(0x19b)][a0_0x50aede(0x21c)]['split'](',')['map'](_0x218205=>_0x218205[a0_0x50aede(0x1c9)]())[a0_0x50aede(0x204)](_0x5b024b=>_0x5b024b[a0_0x50aede(0x1eb)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x50aede(0x1f5)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x50aede(0x1b6)](tool)&&console[a0_0x50aede(0x184)](a0_0x50aede(0x221)+tool+a0_0x50aede(0x247)+[...KNOWN_TOOL_NAMES][a0_0x50aede(0x1e8)](',\x20'));}console[a0_0x50aede(0x184)](a0_0x50aede(0x161)+[...DISABLED_TOOLS][a0_0x50aede(0x1e8)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x50aede(0x193)](a0_0x50aede(0x244))&&!MORPH_API_KEY['startsWith']('morph-')&&logMcpStderr(a0_0x50aede(0x252));async function reportMorphError(_0x33f7c0){const _0x3b53e2=a0_0x50aede;try{await a0_0x38920b['post'](_0x3b53e2(0x183),{..._0x33f7c0,'timestamp':new Date()[_0x3b53e2(0x19f)](),'source':_0x33f7c0[_0x3b53e2(0x20e)]||_0x3b53e2(0x23e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x33f7c0[_0x3b53e2(0x23c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3b53e2(0x1a4),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function a0_0x3bac(){const _0x21badf=['substring','filter','.vscode','metadata','\x20-\x20','indexOf','oninitialized','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','5491647dRWCyn','description','source','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a',',\x20modified\x20','[github_codebase_search]\x20Failed\x20in\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20error(s)','composer.json','tool','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x20chars)','MORPH_WARP_GREP_TIMEOUT','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','completed','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','DISABLED_TOOLS','github_codebase_search','exit','realpath','FileNotFound','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','--version','warp_grep_complete','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','unknown\x20error','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','file_read_failed','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','-\x20Grepped\x20\x27','Created\x20File','WORKSPACE_ROOT','35pdTERQ','files','search_type','lines','stringify','[github_codebase_search]\x20Done\x20in\x20','RipgrepNotAvailable','WarpGrep\x20sub-tool\x20errors:\x20','status','messages','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','payload','WarpGrepError','tool_call_error','1155924IxGaUX','stack','context','string','mcp-filesystem','BinaryFile','access','resolve','repo_path','constructor','sk-','Parent\x20directory\x20does\x20not\x20exist:\x20','read','\x22.\x20Known\x20tools:\x20','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','809696nnmShd','edit_file','go.mod','\x20valid\x20directories','grep','tool_calls','Fallback:\x20Using\x20workspace\x20root\x20','list_directory','❌\x20Morph\x20Edit\x20Failed:\x20','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','compaction_failed','Warning:\x20Workspace\x20fallback\x20failed:\x20','EDIT_FILE','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','filePath','morph-','some','Tool\x20','-\x20Listed\x20directory\x20`','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','boolean','isArray','0.2.0','listRoots','207BZgVgZ','changes','message','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','PWD','path_validation_start','ReadError','6ODYFlq','target_file',',\x20removed\x20','FileReadError','\x22>\x0aError\x20reading\x20file:\x20','node_modules','\x22>\x0a','morph-v3-fast','Error\x20running\x20fast\x20context\x20search:\x20','code_edit','morph-warp-grep-v2.1','name','number','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','toLowerCase','33vBydfH','54152BlGxAZ','--help','Invalid\x20arguments:\x20','false','93914BSKWzh','glob','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Morph\x20Edit\x20','Unknown\x20error','instructions','api-key','command','response','tool_call_complete','Disabled\x20tools:\x20','branch','map','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','version','morph-v3-large','inputSchema','RipgrepError','all','match','isDirectory','errors','ENABLE_WORKSPACE_MODE','params','setRequestHandler','CODEBASE_SEARCH','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','etimedout','tool_call_received','timed\x20out','text','ms:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','glob\x20\x27','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','now','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','min','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','7683408CiMpSU','role','roots','https://morphllm.com/api/error-report','error','sep','33RQRCjl','instruction','Max\x20results\x20to\x20return','morph-mcp','grep_search','Error\x20accessing\x20directory\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','catch','api_request_start','split','searchGitHub','\x20\x20morph-mcp','provider_created','startsWith','arguments','data','default','SymlinkError','-\x20Read\x20file\x20`','search_string','pattern','env','linesRemoved','.git','basename','toISOString','code','\x0a...\x20(truncated,\x20total:\x20','function','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','application/json','-\x20Preserve\x20exact\x20indentation\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x27\x20in\x20`','finish','setNotificationHandler','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x20as\x20allowed\x20directory','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','ms.\x20Success:\x20','file_path','argv','[could\x20not\x20read\x20file:\x20','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','every','homedir','Preview\x20changes\x20without\x20applying\x20them.','Example\x20format:\x0a','has','tool_call_id','MCP','content','assistant','completionId','user','Workspace\x20mode\x20enabled:\x20Using\x20','timings','completed_with_file_errors','list_directory\x20','object','terminationReason','debug','dryRun','safeParse','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','GitHub\x20search\x20failed:\x20','dirname','trim','readFile','file','slice','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','path','MORPH_API_KEY','\x0a</file>','includes','UnknownError','file_read_complete','Unknown\x20tool:\x20','success','API\x20error\x20(auth/rate-limit)','linesModified','warn','Error:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','log','requiresApiKey','path_validation_resolved','\x0aExamples:','Tool\x20\x22','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','push','utf-8','Warning:\x20','ENOENT','runWarpGrep_call','Here\x20is\x20the\x20content\x20of\x20files:\x0a','.\x20Path:\x20','join','codebase_search','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','length','3328810UGgjBH','MORPH_API_URL','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Parameters:\x0a','.\x20Changes:\x20','linesAdded','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','github_url','new_string','size','optional','Repository\x20identifier','unknown','edit','describe','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','tsconfig.json','TimeoutError','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Morph\x20FastApply\x20failed\x20without\x20error\x20message','timeout','<file\x20path=\x22'];a0_0x3bac=function(){return _0x21badf;};return a0_0x3bac();}function extractStatusCode(_0x30de50,_0x42dc7d){const _0x68eb49=a0_0x50aede;if(_0x30de50&&typeof _0x30de50==='object'&&'status'in _0x30de50)return _0x30de50[_0x68eb49(0x234)];if(_0x30de50&&typeof _0x30de50===_0x68eb49(0x1c1)&&'response'in _0x30de50)return _0x30de50[_0x68eb49(0x15f)]?.[_0x68eb49(0x234)];const _0x71f65c=_0x42dc7d[_0x68eb49(0x16c)](/\b(401|429)\b/);return _0x71f65c?parseInt(_0x71f65c[0x1],0xa):null;}function a0_0xa12a(_0x52770a,_0x2e912f){_0x52770a=_0x52770a-0x13d;const _0x3bac17=a0_0x3bac();let _0xa12acf=_0x3bac17[_0x52770a];return _0xa12acf;}function handleMorphAPIError(_0x6093a2){const _0xfc9775=a0_0x50aede,_0x259be3=_0x6093a2 instanceof Error?_0x6093a2[_0xfc9775(0x13e)]:String(_0x6093a2),_0x2f3977=extractStatusCode(_0x6093a2,_0x259be3);switch(_0x2f3977){case 0x191:return{'content':[{'type':_0xfc9775(0x177),'text':_0xfc9775(0x17f)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0xfc9775(0x177),'text':_0xfc9775(0x228)}],'isError':!![]};default:return null;}}args[a0_0x50aede(0x1eb)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x50aede(0x1c6)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x50aede(0x17d)),logMcpStderr(a0_0x50aede(0x212)),logMcpStderr(a0_0x50aede(0x256)),logMcpStderr(a0_0x50aede(0x21b)));function normalizePath(_0x5d41b7){return a0_0x20fcf1['normalize'](_0x5d41b7);}function expandHome(_0x1fe926){const _0x5986e3=a0_0x50aede;if(_0x1fe926['startsWith']('~/')||_0x1fe926==='~')return a0_0x20fcf1[_0x5986e3(0x1e8)](a0_0x20d132[_0x5986e3(0x1b3)](),_0x1fe926[_0x5986e3(0x1cc)](0x1));return _0x1fe926;}let allowedDirectories=await Promise[a0_0x50aede(0x16b)](args[a0_0x50aede(0x163)](async _0x21aba1=>{const _0x349caa=a0_0x50aede,_0x3591d0=expandHome(_0x21aba1),_0x492365=a0_0x20fcf1[_0x349caa(0x241)](_0x3591d0);try{const _0xe118bf=await a0_0x5237c2[_0x349caa(0x21f)](_0x492365);return normalizePath(_0xe118bf);}catch(_0x54b4c0){return normalizePath(_0x492365);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x50aede(0x1eb)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x50aede(0x1e1)](workspaceDir),logMcpStderr(a0_0x50aede(0x1bd)+workspaceDir+a0_0x50aede(0x1ab)));}catch(a0_0x1c040f){logMcpStderr(a0_0x50aede(0x1fb)+a0_0x1c040f);}async function detectWorkspaceRoot(_0x343c35){const _0x575a89=a0_0x50aede;let _0x4121c3=a0_0x20fcf1[_0x575a89(0x241)](_0x343c35);const _0x276597=[_0x575a89(0x19d),_0x575a89(0x205),'package.json','Cargo.toml','pyproject.toml',_0x575a89(0x24b),'.cursor',_0x575a89(0x1fc),_0x575a89(0x214)];while(_0x4121c3!==a0_0x20fcf1[_0x575a89(0x1c8)](_0x4121c3)){for(const _0x1a343b of _0x276597){const _0x26a88f=a0_0x20fcf1[_0x575a89(0x1e8)](_0x4121c3,_0x1a343b);try{return await a0_0x5237c2[_0x575a89(0x240)](_0x26a88f),normalizePath(_0x4121c3);}catch{}}_0x4121c3=a0_0x20fcf1[_0x575a89(0x1c8)](_0x4121c3);}return normalizePath(_0x343c35);}await Promise[a0_0x50aede(0x16b)](args[a0_0x50aede(0x163)](async _0x5bc67f=>{const _0x57c185=a0_0x50aede;try{const _0x5edf2b=await a0_0x5237c2['stat'](expandHome(_0x5bc67f));!_0x5edf2b[_0x57c185(0x16d)]()&&(logMcpStderr(_0x57c185(0x1d9)+_0x5bc67f+'\x20is\x20not\x20a\x20directory'),process[_0x57c185(0x21e)](0x1));}catch(_0x20b24c){logMcpStderr(_0x57c185(0x18b)+_0x5bc67f+':',_0x20b24c),process['exit'](0x1);}}));async function validatePath(_0x295ed4){const _0x38d557=a0_0x50aede,_0x32132d=expandHome(_0x295ed4),_0x5a4097=a0_0x20fcf1[_0x38d557(0x241)](_0x32132d);logger['debug'](_0x38d557(0x1b8),_0x38d557(0x141),{'raw_path':_0x295ed4,'absolute':_0x5a4097});try{const _0x115f5e=await a0_0x5237c2[_0x38d557(0x21f)](_0x5a4097);return logger['debug'](_0x38d557(0x1b8),_0x38d557(0x1dd),{'resolved':_0x115f5e,'symlink':_0x115f5e!==_0x5a4097}),_0x115f5e;}catch(_0xbcf01a){if(_0xbcf01a['code']===_0x38d557(0x1e4)){const _0x2973c8=a0_0x20fcf1[_0x38d557(0x1c8)](_0x5a4097);try{const _0x903617=await a0_0x5237c2[_0x38d557(0x21f)](_0x2973c8),_0xb960cf=a0_0x20fcf1[_0x38d557(0x1e8)](_0x903617,a0_0x20fcf1[_0x38d557(0x19e)](_0x5a4097));return logger[_0x38d557(0x1c3)](_0x38d557(0x1b8),_0x38d557(0x1dd),{'resolved':_0xb960cf,'new_file':!![]}),_0xb960cf;}catch{logger[_0x38d557(0x184)](_0x38d557(0x1b8),'path_validation_failed',{'raw_path':_0x295ed4,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x2973c8});throw new Error(_0x38d557(0x245)+_0x2973c8);}}logger[_0x38d557(0x184)](_0x38d557(0x1b8),'path_validation_failed',{'raw_path':_0x295ed4,'error':_0xbcf01a[_0x38d557(0x13e)]});throw _0xbcf01a;}}const MorphEditFileArgsSchema=z[a0_0x50aede(0x1c1)]({'path':z[a0_0x50aede(0x23d)](),'code_edit':z['string']()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1ee)),'instruction':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1f2)),'dryRun':z[a0_0x50aede(0x260)]()[a0_0x50aede(0x196)](![])[a0_0x50aede(0x1fa)](a0_0x50aede(0x1b4))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x50aede(0x25d),WarpGrepArgsSchema=z[a0_0x50aede(0x1c1)]({'search_string':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x50aede(0x23d)]()['describe']('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z['enum']([a0_0x50aede(0x196),a0_0x50aede(0x148)])[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x50aede(0x1c1)]({'search_string':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1fa)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x50aede(0x23d)]()['optional']()['describe'](a0_0x50aede(0x25f)),'owner_repo':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)](a0_0x50aede(0x1da)),'branch':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()['describe'](a0_0x50aede(0x1a6))}),CodebaseSearchArgsSchema=z[a0_0x50aede(0x1c1)]({'query':z[a0_0x50aede(0x23d)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()['describe'](a0_0x50aede(0x1f7)),'branch':z['string']()[a0_0x50aede(0x1f6)]()['describe'](a0_0x50aede(0x173)),'commitHash':z[a0_0x50aede(0x23d)]()[a0_0x50aede(0x1f6)]()[a0_0x50aede(0x1fa)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x50aede(0x23d)]())['default']([])[a0_0x50aede(0x1fa)](a0_0x50aede(0x159)),'limit':z[a0_0x50aede(0x14f)]()['optional']()[a0_0x50aede(0x196)](0xa)[a0_0x50aede(0x1fa)](a0_0x50aede(0x188))}),server=new Server({'name':a0_0x50aede(0x189),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x50aede(0x171)](ListToolsRequestSchema,async()=>{const _0x28f2d9=a0_0x50aede,_0x9cfce2=[{'name':TOOL_NAMES[_0x28f2d9(0x255)],'description':_0x28f2d9(0x20f)+_0x28f2d9(0x1ef)+_0x28f2d9(0x13f)+_0x28f2d9(0x1b1)+_0x28f2d9(0x248)+_0x28f2d9(0x20a)+_0x28f2d9(0x1b5)+'//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a'+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x28f2d9(0x1a5)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x28f2d9(0x165),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x28f2d9(0x172)],'description':_0x28f2d9(0x219)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x28f2d9(0x1e0)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3e393d=_0x9cfce2[_0x28f2d9(0x204)](_0x3118d4=>{const _0xd93567=_0x28f2d9;if(DISABLED_TOOLS[_0xd93567(0x1b6)](_0x3118d4['name']))return console[_0xd93567(0x184)](_0xd93567(0x25a)+_0x3118d4[_0xd93567(0x14e)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0xd93567(0x1dc)in _0x3118d4&&_0x3118d4['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0xd93567(0x1e3)+_0x3118d4[_0xd93567(0x14e)]+_0xd93567(0x1aa)),![];return!![];});return{'tools':_0x3e393d['map'](_0x1054ef=>({'name':_0x1054ef[_0x28f2d9(0x14e)],'description':_0x1054ef[_0x28f2d9(0x20d)],'inputSchema':_0x1054ef[_0x28f2d9(0x169)]}))};}),server[a0_0x50aede(0x171)](CallToolRequestSchema,async _0x12a6be=>{const _0x367870=a0_0x50aede,{name:_0x39e5ba,arguments:_0x2c41b8}=_0x12a6be[_0x367870(0x170)],_0x32b9cc=Date[_0x367870(0x17c)]();logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x175),{'tool':_0x39e5ba,'args':_0x39e5ba==='edit_file'?{'path':_0x2c41b8?.[_0x367870(0x1ce)],'instruction':_0x2c41b8?.[_0x367870(0x187)]||_0x2c41b8?.[_0x367870(0x15c)],'dryRun':_0x2c41b8?.[_0x367870(0x1c4)]}:_0x2c41b8});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x166)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x367870(0x244))&&!MORPH_API_KEY[_0x367870(0x193)](_0x367870(0x258)))return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x226)}],'isError':!![]};if(DISABLED_TOOLS[_0x367870(0x1b6)](_0x39e5ba))return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1df)+_0x39e5ba+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x39e5ba){case TOOL_NAMES[_0x367870(0x255)]:{let _0x2d7e95=_0x2c41b8;if(_0x2d7e95&&typeof _0x2d7e95===_0x367870(0x1c1)){if(!('path'in _0x2d7e95)){const _0x1d14f4=_0x2d7e95[_0x367870(0x144)]??_0x2d7e95[_0x367870(0x257)]??_0x2d7e95['target_filepath']??_0x2d7e95[_0x367870(0x1ae)]??_0x2d7e95[_0x367870(0x1cb)];if(_0x1d14f4)_0x2d7e95={..._0x2d7e95,'path':_0x1d14f4};}_0x367870(0x15c)in _0x2d7e95&&!(_0x367870(0x187)in _0x2d7e95)&&(_0x2d7e95={..._0x2d7e95,'instruction':_0x2d7e95[_0x367870(0x15c)]});if(!(_0x367870(0x14c)in _0x2d7e95)){const _0x19b26e=_0x2d7e95[_0x367870(0x1a0)]??_0x2d7e95[_0x367870(0x1f4)]??_0x2d7e95['content']??_0x2d7e95[_0x367870(0x1f9)];if(_0x19b26e)_0x2d7e95={..._0x2d7e95,'code_edit':_0x19b26e};}}const _0x52f74c=MorphEditFileArgsSchema[_0x367870(0x1c5)](_0x2d7e95);if(!_0x52f74c[_0x367870(0x1d5)])throw new Error(_0x367870(0x150)+_0x52f74c[_0x367870(0x184)]);const _0x5ebd9a=await validatePath(_0x52f74c[_0x367870(0x195)]['path']);let _0x485029=null,_0x33603c=!![],_0x4e56bc=null;try{_0x485029=await a0_0x5237c2[_0x367870(0x1ca)](_0x5ebd9a,_0x367870(0x1e2)),logger['debug'](_0x367870(0x1b8),_0x367870(0x1d3),{'path':_0x5ebd9a,'size_bytes':_0x485029[_0x367870(0x1eb)]});}catch(_0x4ebf4f){const _0x6b9b42=_0x4ebf4f[_0x367870(0x1a0)];_0x6b9b42===_0x367870(0x1e4)?(_0x33603c=![],_0x485029='',logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x1d3),{'path':_0x5ebd9a,'exists':![]})):(_0x4e56bc='Failed\x20to\x20read\x20file:\x20'+(_0x6b9b42||_0x367870(0x1f8))+_0x367870(0x207)+(_0x4ebf4f instanceof Error?_0x4ebf4f['message']:String(_0x4ebf4f)),logger['error'](_0x367870(0x1b8),_0x367870(0x227),{'path':_0x5ebd9a,'error':_0x4e56bc}),logMcpStderr(_0x367870(0x1e3)+_0x4e56bc));}let _0x7413e;try{const _0x2e36fe=MORPH_API_KEY;if(!_0x2e36fe)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x11cbab=a0_0x20fcf1['dirname'](_0x5ebd9a),_0x285d8f=a0_0x20fcf1[_0x367870(0x19e)](_0x5ebd9a);logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x18e),{'model':_0x367870(0x14a),'path':_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)],'instruction_len':_0x52f74c[_0x367870(0x195)][_0x367870(0x187)]['length'],'code_edit_len':_0x52f74c['data'][_0x367870(0x14c)][_0x367870(0x1eb)],'original_code_len':_0x485029?.[_0x367870(0x1eb)]??0x0,'dry_run':_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)]});const _0x2d480b=Date['now'](),_0x580e5d=await executeEditFile({'target_filepath':_0x285d8f,'code_edit':_0x52f74c[_0x367870(0x195)][_0x367870(0x14c)],'instruction':_0x52f74c[_0x367870(0x195)][_0x367870(0x187)]},{'morphApiKey':_0x2e36fe,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x11cbab,'autoWrite':!_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)],'generateUdiff':![],'debug':![]}),_0x89f152=Date['now']()-_0x2d480b;_0x7413e=_0x580e5d[_0x367870(0x1bb)];if(!_0x580e5d[_0x367870(0x1d5)])throw new Error(_0x580e5d[_0x367870(0x184)]||_0x367870(0x200));const _0x5bb124=_0x580e5d[_0x367870(0x13d)],_0x4fab8d='added\x20'+_0x5bb124[_0x367870(0x1f1)]+_0x367870(0x145)+_0x5bb124[_0x367870(0x19c)]+_0x367870(0x210)+_0x5bb124['linesModified'];logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x160),{'tool':_0x367870(0x24a),'success':!![],'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc,'edit_latency_ms':_0x89f152,'changes':{'added':_0x5bb124[_0x367870(0x1f1)],'removed':_0x5bb124[_0x367870(0x19c)],'modified':_0x5bb124[_0x367870(0x1d7)]},'completion_id':_0x7413e});if(_0x52f74c[_0x367870(0x195)]['dryRun'])return{'content':[{'type':_0x367870(0x177),'text':'Morph\x20Edit\x20Preview'+(_0x33603c?'':'\x20(new\x20file)')+':\x20'+_0x52f74c['data'][_0x367870(0x187)]+_0x367870(0x1f0)+_0x4fab8d+_0x367870(0x1e7)+_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)]+'.'}]};return{'content':[{'type':'text','text':_0x367870(0x15a)+(_0x33603c?'Applied':_0x367870(0x22a))+':\x20'+_0x52f74c['data'][_0x367870(0x187)]+_0x367870(0x1f0)+_0x4fab8d+'.\x20Path:\x20'+_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)]+'.'}]};}catch(_0x1233d7){const _0x10e89b=handleMorphAPIError(_0x1233d7);if(_0x10e89b)return logger[_0x367870(0x184)](_0x367870(0x1b8),_0x367870(0x239),{'tool':_0x367870(0x24a),'error':_0x367870(0x1d6),'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc}),_0x10e89b;const _0x49423f=_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x13e)]:String(_0x1233d7);return logger['error'](_0x367870(0x1b8),'tool_call_error',{'tool':_0x367870(0x24a),'error':_0x49423f,'path':_0x52f74c['data']['path'],'validated_path':_0x5ebd9a,'latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc,'stack':_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x23b)]:undefined}),reportMorphError({'error_message':_0x49423f,'error_type':_0x1233d7 instanceof Error?_0x1233d7['constructor'][_0x367870(0x14e)]:_0x367870(0x1d2),'context':{'tool':_0x367870(0x24a),'completion_id':_0x7413e,'file_path':_0x52f74c['data'][_0x367870(0x1ce)],'validated_path':_0x5ebd9a,'instruction':_0x52f74c['data']['instruction'],'model':MORPH_LARGE_APPLY?_0x367870(0x168):_0x367870(0x14a),'dry_run':_0x52f74c['data']['dryRun'],'file_exists':_0x33603c,'file_read_error':_0x4e56bc,'file_readable':_0x485029!==null,'request_content':{'path':_0x52f74c[_0x367870(0x195)][_0x367870(0x1ce)],'code_edit':_0x52f74c[_0x367870(0x195)][_0x367870(0x14c)],'instruction':_0x52f74c['data']['instruction'],'original_code':_0x485029!==null?_0x485029[_0x367870(0x1eb)]>0xc350?_0x485029[_0x367870(0x203)](0x0,0xc350)+_0x367870(0x1a1)+_0x485029[_0x367870(0x1eb)]+_0x367870(0x217):_0x485029:_0x367870(0x1b0)+(_0x4e56bc||_0x367870(0x225))+']','original_code_length':_0x485029?.[_0x367870(0x1eb)]??0x0,'model':MORPH_LARGE_APPLY?_0x367870(0x168):'morph-v3-fast','dry_run':_0x52f74c[_0x367870(0x195)][_0x367870(0x1c4)]}},'stack_trace':_0x1233d7 instanceof Error?_0x1233d7[_0x367870(0x23b)]:undefined,'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{}),{'content':[{'type':'text','text':_0x367870(0x251)+_0x49423f}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x3d8421=WarpGrepArgsSchema['safeParse'](_0x2c41b8);if(!_0x3d8421[_0x367870(0x1d5)])return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x155)+_0x3d8421['error']}],'isError':!![]};const _0x4a5946=_0x45dc90=>{const _0x1450f8=_0x367870,_0x4e71d3=[];for(const _0x5e9e8f of _0x45dc90||[]){if(_0x5e9e8f[_0x1450f8(0x181)]===_0x1450f8(0x1ba)&&Array[_0x1450f8(0x261)](_0x5e9e8f[_0x1450f8(0x24e)]))for(const _0x5a2c19 of _0x5e9e8f['tool_calls']){try{const _0x5ef070=_0x5a2c19[_0x1450f8(0x1a2)]?.[_0x1450f8(0x14e)],_0x47a80f=JSON['parse'](_0x5a2c19['function']?.[_0x1450f8(0x194)]||'{}');if(_0x5ef070==='grep_search')_0x4e71d3[_0x1450f8(0x1e1)]('grep\x20\x27'+_0x47a80f[_0x1450f8(0x19a)]+'\x27\x20'+(_0x47a80f['path']||'.'));else{if(_0x5ef070==='read')_0x4e71d3[_0x1450f8(0x1e1)]('read\x20'+_0x47a80f[_0x1450f8(0x1ce)]);else{if(_0x5ef070===_0x1450f8(0x250))_0x4e71d3['push'](_0x1450f8(0x1c0)+(_0x47a80f[_0x1450f8(0x15e)]||'.'));else{if(_0x5ef070===_0x1450f8(0x158))_0x4e71d3[_0x1450f8(0x1e1)](_0x1450f8(0x17a)+_0x47a80f[_0x1450f8(0x19a)]+'\x27\x20'+(_0x47a80f[_0x1450f8(0x1ce)]||'.'));else _0x5ef070==='finish'&&_0x4e71d3[_0x1450f8(0x1e1)](_0x1450f8(0x1a8));}}}}catch{}}}return _0x4e71d3;},_0x4e686f=_0x36560f=>{const _0x2657d7=_0x367870,_0xe32c46=[];if(!_0x36560f||!Array[_0x2657d7(0x261)](_0x36560f))return _0xe32c46;const _0x4e27fd=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2657d7(0x220),'tool':_0x2657d7(0x246)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x2657d7(0x246)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2657d7(0x142),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x2657d7(0x246)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2657d7(0x16a),'tool':_0x2657d7(0x24d)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2657d7(0x232),'tool':_0x2657d7(0x24d)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2657d7(0x23f),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':'read'},{'pattern':/not a text file/,'error_type':_0x2657d7(0x23f),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x2657d7(0x197),'tool':_0x2657d7(0x246)},{'pattern':/Error reading file:/,'error_type':_0x2657d7(0x142),'tool':'read'},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x28bb96=0x0;for(const _0x23d707 of _0x36560f){_0x23d707[_0x2657d7(0x181)]==='assistant'&&Array['isArray'](_0x23d707[_0x2657d7(0x24e)])&&_0x28bb96++;const _0x19f99b=_0x23d707['content'];if((_0x23d707['role']===_0x2657d7(0x215)||_0x23d707[_0x2657d7(0x181)]===_0x2657d7(0x1bc))&&_0x19f99b&&typeof _0x19f99b===_0x2657d7(0x23d))for(const {pattern:_0x199604,error_type:_0x4c00b4,tool:_0xc39334}of _0x4e27fd){const _0x40edf5=_0x19f99b[_0x2657d7(0x16c)](new RegExp(_0x199604[_0x2657d7(0x20e)],'g'));if(_0x40edf5)for(const _0x5c6c8b of _0x40edf5){const _0x74ddc7=_0x19f99b[_0x2657d7(0x208)](_0x5c6c8b),_0x193646=_0x19f99b[_0x2657d7(0x203)](_0x74ddc7,Math[_0x2657d7(0x17e)](_0x74ddc7+0xc8,_0x19f99b[_0x2657d7(0x1eb)]));_0xe32c46[_0x2657d7(0x1e1)]({'tool':_0xc39334,'error_type':_0x4c00b4,'error_message':_0x193646[_0x2657d7(0x18f)]('\x0a')[0x0],'turn':_0x28bb96});}}}return _0xe32c46;};try{const _0x1342d8=a0_0x20fcf1[_0x367870(0x241)](_0x3d8421['data'][_0x367870(0x242)]),_0x4e1133=_0x3d8421[_0x367870(0x195)][_0x367870(0x22e)],_0x1eed7d=_0x4e1133===_0x367870(0x148)?{'allowNames':[_0x367870(0x148)]}:undefined,_0x1a7a14=new LocalRipgrepProvider(_0x1342d8,undefined,_0x1eed7d);logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x192),{'type':'LocalRipgrepProvider','repo_root':_0x1342d8,'search_type':_0x4e1133||_0x367870(0x196)}),logger['debug'](_0x367870(0x1b8),'warp_grep_start',{'query':_0x3d8421['data'][_0x367870(0x199)],'repo_root':_0x1342d8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x808e76=Date[_0x367870(0x17c)](),_0x4bae9b=await runWarpGrep({'searchTerm':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repoRoot':_0x1342d8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1a7a14,'search_type':_0x4e1133}),_0x2580d0=Date[_0x367870(0x17c)]()-_0x808e76,_0x2afa31=_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)]?.[_0x367870(0x1eb)]??0x0;logger[_0x367870(0x1c3)](_0x367870(0x1b8),_0x367870(0x223),{'termination':_0x4bae9b[_0x367870(0x1c2)],'turns':_0x4bae9b[_0x367870(0x1be)]?.['turns']??0x0,'files_found':_0x2afa31,'latency_ms':_0x2580d0});const _0x1807b1=_0x4e686f(_0x4bae9b[_0x367870(0x235)]);_0x1807b1[_0x367870(0x1eb)]>0x0&&reportMorphError({'error_message':_0x367870(0x233)+_0x1807b1['length']+_0x367870(0x213),'error_type':'SubToolError','level':_0x367870(0x1d8),'tool':_0x367870(0x1e9),'context':{'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'termination_reason':_0x4bae9b[_0x367870(0x1c2)],'sub_tool_errors':_0x1807b1,'timings':_0x4bae9b[_0x367870(0x1be)],'tool_calls':_0x4a5946(_0x4bae9b[_0x367870(0x235)]),'messages':_0x4bae9b[_0x367870(0x235)]?.[_0x367870(0x163)](_0x1ff604=>({'role':_0x1ff604[_0x367870(0x181)],'content':_0x1ff604['content'],..._0x1ff604[_0x367870(0x24e)]?{'tool_calls':_0x1ff604['tool_calls']['length']}:{},..._0x1ff604[_0x367870(0x1b7)]?{'tool_call_id':_0x1ff604[_0x367870(0x1b7)]}:{}}))},'source':_0x367870(0x23e)})['catch'](()=>{});let _0x228bf2='';if(_0x4bae9b['terminationReason']===_0x367870(0x21a)&&_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)]){const _0x284cac=_0x4bae9b[_0x367870(0x1a8)][_0x367870(0x206)]['files'];if(_0x284cac[_0x367870(0x1eb)]===0x0)return _0x228bf2=_0x4bae9b[_0x367870(0x1a8)][_0x367870(0x237)]||_0x367870(0x1ea),{'content':[{'type':_0x367870(0x177),'text':_0x228bf2}]};const _0x119d62=[],_0x5e740c=[_0x367870(0x179)];for(const _0x580d1c of _0x4bae9b['messages']){if(_0x580d1c[_0x367870(0x181)]===_0x367870(0x1ba)&&Array[_0x367870(0x261)](_0x580d1c[_0x367870(0x24e)]))for(const _0x33564d of _0x580d1c[_0x367870(0x24e)]){try{const _0x2fed0c=_0x33564d[_0x367870(0x1a2)]?.[_0x367870(0x14e)],_0x1ff2ac=JSON['parse'](_0x33564d[_0x367870(0x1a2)]?.[_0x367870(0x194)]||'{}');if(_0x2fed0c===_0x367870(0x18a))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x229)+_0x1ff2ac[_0x367870(0x19a)]+_0x367870(0x1a7)+(_0x1ff2ac[_0x367870(0x1ce)]||'.')+'`');else{if(_0x2fed0c===_0x367870(0x246))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x198)+_0x1ff2ac['path']+'`');else{if(_0x2fed0c===_0x367870(0x250))_0x5e740c[_0x367870(0x1e1)](_0x367870(0x25b)+(_0x1ff2ac[_0x367870(0x15e)]||'.')+'`');else _0x2fed0c===_0x367870(0x158)&&_0x5e740c['push']('-\x20Glob\x20search\x20`'+_0x1ff2ac[_0x367870(0x19a)]+'`\x20in\x20`'+(_0x1ff2ac['path']||'.')+'`');}}}catch{}}}_0x119d62[_0x367870(0x1e1)](_0x5e740c[_0x367870(0x1e8)]('\x0a'));const _0x1b0c55=['','Relevant\x20context\x20found:'];for(const _0x557667 of _0x284cac){if(_0x557667[_0x367870(0x22f)]==='*')_0x1b0c55[_0x367870(0x1e1)]('-\x20'+_0x557667[_0x367870(0x1ce)]+':*');else{if(Array[_0x367870(0x261)](_0x557667[_0x367870(0x22f)])){const _0x501c22=_0x557667[_0x367870(0x22f)][_0x367870(0x163)](([_0xcb238b,_0x296cac])=>{if(_0xcb238b===_0x296cac)return''+_0xcb238b;return _0xcb238b+'-'+_0x296cac;});_0x1b0c55['push']('-\x20'+_0x557667[_0x367870(0x1ce)]+':'+_0x501c22['join'](','));}else _0x1b0c55['push']('-\x20'+_0x557667[_0x367870(0x1ce)]+':*');}}_0x1b0c55[_0x367870(0x1e1)](''),_0x119d62[_0x367870(0x1e1)](_0x1b0c55[_0x367870(0x1e8)]('\x0a')),_0x119d62[_0x367870(0x1e1)](_0x367870(0x1e6));const _0x28721f=[],_0x1f4112=[];for(const _0x7047ed of _0x284cac){let _0x1d18d4=a0_0x20fcf1[_0x367870(0x241)](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],_0x7047ed[_0x367870(0x1ce)]),_0x3285d3=null,_0x44bf1b=null;try{_0x3285d3=await a0_0x5237c2[_0x367870(0x1ca)](_0x1d18d4,{'encoding':_0x367870(0x1e2)});}catch(_0x7526e2){const _0x5820b9=fixPathRepetition(_0x1d18d4);if(_0x5820b9)try{_0x3285d3=await a0_0x5237c2[_0x367870(0x1ca)](_0x5820b9,{'encoding':_0x367870(0x1e2)}),_0x1d18d4=_0x5820b9;}catch{_0x44bf1b=_0x7526e2 instanceof Error?_0x7526e2:new Error(String(_0x7526e2));}else _0x44bf1b=_0x7526e2 instanceof Error?_0x7526e2:new Error(String(_0x7526e2));}if(_0x3285d3!==null){const _0x17a628=_0x3285d3[_0x367870(0x18f)](/\r?\n/),_0x118efd=[];if(_0x7047ed[_0x367870(0x22f)]==='*'||!Array[_0x367870(0x261)](_0x7047ed['lines']))for(let _0x3169b3=0x1;_0x3169b3<=_0x17a628[_0x367870(0x1eb)];_0x3169b3++){const _0x6e34ca=_0x17a628[_0x3169b3-0x1];_0x118efd[_0x367870(0x1e1)](_0x3169b3+'|\x20'+_0x6e34ca);}else for(const [_0x84d787,_0x183a87]of _0x7047ed[_0x367870(0x22f)]){_0x118efd[_0x367870(0x1eb)]>0x0&&_0x118efd[_0x367870(0x1e1)]('');for(let _0x4110e5=_0x84d787;_0x4110e5<=_0x183a87&&_0x4110e5<=_0x17a628['length'];_0x4110e5++){const _0xd85615=_0x17a628[_0x4110e5-0x1];_0x118efd[_0x367870(0x1e1)](_0x4110e5+'|\x20'+_0xd85615);}}_0x1f4112[_0x367870(0x1e1)]({'path':_0x7047ed[_0x367870(0x1ce)],'content':_0x118efd['join']('\x0a')});}else _0x28721f['push'](_0x367870(0x202)+_0x7047ed[_0x367870(0x1ce)]+_0x367870(0x147)+(_0x44bf1b?.[_0x367870(0x13e)]||_0x367870(0x15b))+'\x0a</file>');}try{const _0x5ed92c=await compactFileContexts(_0x1f4112,_0x3d8421['data'][_0x367870(0x199)],MORPH_API_KEY,MORPH_API_URL);for(const _0x2fdc12 of _0x5ed92c){_0x28721f[_0x367870(0x1e1)](_0x367870(0x202)+_0x2fdc12[_0x367870(0x1ce)]+'\x22>\x0a'+_0x2fdc12['content']+_0x367870(0x1d0));}}catch(_0x42c63c){logger[_0x367870(0x1d8)](_0x367870(0x1b8),_0x367870(0x253),{'error':_0x42c63c instanceof Error?_0x42c63c[_0x367870(0x13e)]:String(_0x42c63c),'files_count':_0x1f4112[_0x367870(0x1eb)]});for(const _0x3825be of _0x1f4112){_0x28721f[_0x367870(0x1e1)](_0x367870(0x202)+_0x3825be[_0x367870(0x1ce)]+_0x367870(0x149)+_0x3825be['content']+_0x367870(0x1d0));}}_0x119d62['push'](_0x28721f['join']('\x0a\x0a')),_0x228bf2=_0x119d62[_0x367870(0x1e8)]('\x0a');const _0x219e8e=_0x4bae9b[_0x367870(0x16e)]?.[_0x367870(0x204)](_0x389401=>_0x389401[_0x367870(0x13e)]?.[_0x367870(0x193)]('File\x20read\x20error:'))||[];if(_0x219e8e['length']>0x0){const _0xa2a7bb=_0x219e8e['map'](_0x4a4a44=>_0x4a4a44[_0x367870(0x13e)])[_0x367870(0x1e8)](';\x20');reportMorphError({'error_message':_0xa2a7bb,'error_type':_0x367870(0x146),'context':{'tool':_0x367870(0x1e9),'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'termination_reason':_0x367870(0x1bf),'error_count':_0x219e8e[_0x367870(0x1eb)],'is_timeout':![],'timings':_0x4bae9b[_0x367870(0x1be)],'files_attempted':_0x284cac[_0x367870(0x163)](_0x5d02f7=>({'path':_0x5d02f7['path'],'lines':_0x5d02f7[_0x367870(0x22f)]})),'tool_calls':_0x4a5946(_0x4bae9b[_0x367870(0x235)]),'messages':_0x4bae9b[_0x367870(0x235)]?.[_0x367870(0x163)](_0xe3c89c=>({'role':_0xe3c89c['role'],'content':_0xe3c89c[_0x367870(0x1b9)],..._0xe3c89c[_0x367870(0x24e)]?{'tool_calls':_0xe3c89c[_0x367870(0x24e)]['length']}:{},..._0xe3c89c[_0x367870(0x1b7)]?{'tool_call_id':_0xe3c89c[_0x367870(0x1b7)]}:{}})),'request_content':{'query':_0x3d8421['data']['search_string'],'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'repoRoot':a0_0x20fcf1['resolve'](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{});}}else{if(_0x4bae9b[_0x367870(0x1c2)]==='terminated'&&_0x4bae9b['errors']['length']>0x0){const _0x36cfec=_0x4bae9b[_0x367870(0x16e)][_0x367870(0x163)](_0x4b3ff2=>_0x4b3ff2[_0x367870(0x13e)])['join'](';\x20');_0x228bf2='Error:\x20'+_0x36cfec;const _0x328c97=_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x201))||_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x176))||_0x36cfec[_0x367870(0x151)]()[_0x367870(0x1d1)]('etimedout'),_0x3d3f8c=_0x4bae9b[_0x367870(0x1a8)]?.[_0x367870(0x206)]?.[_0x367870(0x22d)],_0x2c9284=_0x4bae9b['errors'][0x0];reportMorphError({'error_message':_0x36cfec,'error_type':_0x328c97?_0x367870(0x1fd):_0x2c9284?.[_0x367870(0x243)]?.[_0x367870(0x14e)]||_0x367870(0x238),'context':{'tool':'codebase_search','repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':'morph-warp-grep-v2.1','termination_reason':_0x4bae9b[_0x367870(0x1c2)],'error_count':_0x4bae9b[_0x367870(0x16e)][_0x367870(0x1eb)],'is_timeout':_0x328c97,'timings':_0x4bae9b['timings'],'files_attempted':_0x3d3f8c?.['map'](_0x37c99e=>({'path':_0x37c99e['path'],'lines':_0x37c99e[_0x367870(0x22f)]})),'tool_calls':_0x4a5946(_0x4bae9b['messages']),'messages':_0x4bae9b['messages']?.[_0x367870(0x163)](_0x2ec35a=>({'role':_0x2ec35a[_0x367870(0x181)],'content':_0x2ec35a[_0x367870(0x1b9)],..._0x2ec35a[_0x367870(0x24e)]?{'tool_calls':_0x2ec35a[_0x367870(0x24e)]['length']}:{},..._0x2ec35a[_0x367870(0x1b7)]?{'tool_call_id':_0x2ec35a['tool_call_id']}:{}})),'request_content':{'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repo_path':_0x3d8421[_0x367870(0x195)]['repo_path'],'repoRoot':a0_0x20fcf1['resolve'](_0x3d8421[_0x367870(0x195)][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'stack_trace':_0x2c9284?.['stack']||undefined,'source':_0x367870(0x23e)})[_0x367870(0x18d)](()=>{});}else _0x228bf2=_0x367870(0x1ac);}return{'content':[{'type':_0x367870(0x177),'text':_0x228bf2}]};}catch(_0x5659ae){const _0x49c3c5=handleMorphAPIError(_0x5659ae);if(_0x49c3c5)return logger[_0x367870(0x184)](_0x367870(0x1b8),_0x367870(0x239),{'tool':_0x367870(0x1e9),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x367870(0x17c)]()-_0x32b9cc}),_0x49c3c5;const _0x2869b5=_0x5659ae instanceof Error?_0x5659ae[_0x367870(0x13e)]:String(_0x5659ae);logger[_0x367870(0x184)](_0x367870(0x1b8),'tool_call_error',{'tool':_0x367870(0x1e9),'error':_0x2869b5,'repo_path':_0x3d8421['data'][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'latency_ms':Date['now']()-_0x32b9cc});const _0xcad7e9=_0x2869b5['toLowerCase']()[_0x367870(0x1d1)](_0x367870(0x201))||_0x2869b5[_0x367870(0x151)]()[_0x367870(0x1d1)](_0x367870(0x176))||_0x2869b5['toLowerCase']()[_0x367870(0x1d1)](_0x367870(0x174))||_0x5659ae instanceof Error&&_0x5659ae['name']==='TimeoutError';return reportMorphError({'error_message':_0x2869b5,'error_type':_0xcad7e9?_0x367870(0x1fd):_0x5659ae instanceof Error?_0x5659ae['constructor']['name']:_0x367870(0x1d2),'context':{'tool':_0x367870(0x1e9),'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'model':_0x367870(0x14d),'is_timeout':_0xcad7e9,'exception_phase':_0x367870(0x1e5),'request_content':{'query':_0x3d8421[_0x367870(0x195)][_0x367870(0x199)],'repo_path':_0x3d8421[_0x367870(0x195)][_0x367870(0x242)],'repoRoot':a0_0x20fcf1[_0x367870(0x241)](_0x3d8421['data'][_0x367870(0x242)]),'model':_0x367870(0x14d)}},'stack_trace':_0x5659ae instanceof Error?_0x5659ae['stack']:undefined,'source':'mcp-filesystem'})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x14b)+_0x2869b5}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x452801=WarpGrepGitHubArgsSchema['safeParse'](_0x2c41b8);if(!_0x452801[_0x367870(0x1d5)])return{'content':[{'type':'text','text':_0x367870(0x155)+_0x452801[_0x367870(0x184)]}],'isError':!![]};const _0x31f84=_0x452801[_0x367870(0x195)][_0x367870(0x1f3)]||_0x452801['data']['owner_repo'];if(!_0x31f84)return{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x20b)}],'isError':!![]};const _0x292cfd=MORPH_API_KEY;if(!_0x292cfd)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x4e8dc6=Date[_0x367870(0x17c)]();logger[_0x367870(0x1c3)](_0x367870(0x1b8),'github_search_start',{'identifier':_0x31f84,'query':_0x452801['data'][_0x367870(0x199)],'branch':_0x452801['data'][_0x367870(0x162)]});try{const _0x390dd0=new WarpGrepClient({'morphApiKey':_0x292cfd,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x50e668=await _0x390dd0[_0x367870(0x190)]({'searchTerm':_0x452801['data'][_0x367870(0x199)],'github':_0x31f84,'branch':_0x452801[_0x367870(0x195)][_0x367870(0x162)]}),_0x5d0833=Date[_0x367870(0x17c)]()-_0x4e8dc6;logMcpStderr(_0x367870(0x231)+_0x5d0833+_0x367870(0x1ad)+_0x50e668[_0x367870(0x1d5)]);const _0xdcd3=formatResult(_0x50e668);return{'content':[{'type':_0x367870(0x177),'text':_0xdcd3}]};}catch(_0x4eafbd){const _0x266454=handleMorphAPIError(_0x4eafbd);if(_0x266454)return _0x266454;const _0x7b2f22=Date[_0x367870(0x17c)]()-_0x4e8dc6,_0x12c733=_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x13e)]:String(_0x4eafbd);return logMcpStderr(_0x367870(0x211)+_0x7b2f22+_0x367870(0x178),_0x12c733),reportMorphError({'error_message':_0x12c733,'error_type':_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x243)]['name']:'UnknownError','context':{'tool':_0x367870(0x21d),'github_url':_0x31f84,'search_string':_0x452801['data']['search_string'],'branch':_0x452801[_0x367870(0x195)][_0x367870(0x162)]},'stack_trace':_0x4eafbd instanceof Error?_0x4eafbd[_0x367870(0x23b)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x7b2f22})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1c7)+_0x12c733}],'isError':![]};}}default:throw new Error(_0x367870(0x1d4)+_0x39e5ba);}}catch(_0x18c788){const _0x3ab192=_0x18c788 instanceof Error?_0x18c788[_0x367870(0x13e)]:String(_0x18c788);return reportMorphError({'error_message':_0x3ab192,'error_type':_0x18c788 instanceof Error?_0x18c788[_0x367870(0x243)]['name']:_0x367870(0x1d2),'context':{'tool':_0x39e5ba,'arguments':_0x2c41b8?JSON[_0x367870(0x230)](_0x2c41b8)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x367870(0x262)},'stack_trace':_0x18c788 instanceof Error?_0x18c788[_0x367870(0x23b)]:undefined,'source':_0x367870(0x23e)})[_0x367870(0x18d)](()=>{}),{'content':[{'type':_0x367870(0x177),'text':_0x367870(0x1d9)+_0x3ab192}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3f6df9){const _0x1f8900=a0_0x50aede,_0x15d9d5=await getValidRootDirectories(_0x3f6df9);if(_0x15d9d5[_0x1f8900(0x1eb)]>0x0)allowedDirectories=[..._0x15d9d5],logMcpStderr(_0x1f8900(0x18c)+_0x15d9d5[_0x1f8900(0x1eb)]+_0x1f8900(0x24c));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x36107b=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x36107b&&(allowedDirectories=[_0x36107b],logMcpStderr(_0x1f8900(0x24f)+_0x36107b));}catch(_0x3f904a){logMcpStderr(_0x1f8900(0x254)+_0x3f904a);}}}server[a0_0x50aede(0x1a9)](RootsListChangedNotificationSchema,async()=>{const _0x2d5c5a=a0_0x50aede;try{const _0x57d765=await server[_0x2d5c5a(0x263)]();_0x57d765&&'roots'in _0x57d765&&await updateAllowedDirectoriesFromRoots(_0x57d765[_0x2d5c5a(0x182)]);}catch(_0x476442){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x476442 instanceof Error?_0x476442[_0x2d5c5a(0x13e)]:String(_0x476442));}}),server[a0_0x50aede(0x209)]=async()=>{const _0x26d65e=a0_0x50aede,_0x594014=server['getClientCapabilities']();if(_0x594014?.['roots'])try{const _0x5b73e2=await server['listRoots']();_0x5b73e2&&_0x26d65e(0x182)in _0x5b73e2?await updateAllowedDirectoriesFromRoots(_0x5b73e2[_0x26d65e(0x182)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x10eac3){logMcpStderr(_0x26d65e(0x17b),_0x10eac3 instanceof Error?_0x10eac3[_0x26d65e(0x13e)]:String(_0x10eac3));}else{if(allowedDirectories[_0x26d65e(0x1eb)]>0x0)logMcpStderr(_0x26d65e(0x25c),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x26d65e(0x1ff));else throw new Error(_0x26d65e(0x164));}}};async function runServer(){const _0x51224e=a0_0x50aede,_0x57b860=new StdioServerTransport();await server['connect'](_0x57b860),logMcpStderr(_0x51224e(0x25e)),allowedDirectories['length']===0x0&&logMcpStderr(_0x51224e(0x216));}runServer()[a0_0x50aede(0x18d)](_0x29f384=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x29f384),process['exit'](0x1);}); | ||
| const a0_0x231f6c=a0_0x2218;(function(_0x101d3d,_0x14fc74){const _0x4947c8=a0_0x2218,_0x36b4bd=_0x101d3d();while(!![]){try{const _0x12a916=parseInt(_0x4947c8(0x1e2))/0x1+parseInt(_0x4947c8(0x293))/0x2*(parseInt(_0x4947c8(0x29b))/0x3)+-parseInt(_0x4947c8(0x1ac))/0x4+parseInt(_0x4947c8(0x1b9))/0x5+parseInt(_0x4947c8(0x1a2))/0x6*(-parseInt(_0x4947c8(0x262))/0x7)+parseInt(_0x4947c8(0x219))/0x8*(parseInt(_0x4947c8(0x2b2))/0x9)+-parseInt(_0x4947c8(0x27b))/0xa;if(_0x12a916===_0x14fc74)break;else _0x36b4bd['push'](_0x36b4bd['shift']());}catch(_0x1c4159){_0x36b4bd['push'](_0x36b4bd['shift']());}}}(a0_0x57ec,0x6520d));import{Server}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x3ed385 from'fs/promises';import a0_0x146359 from'path';import a0_0x1d7b4c from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';function a0_0x2218(_0x508a99,_0x50fef7){_0x508a99=_0x508a99-0x194;const _0x57ec87=a0_0x57ec();let _0x22189a=_0x57ec87[_0x508a99];return _0x22189a;}function a0_0x57ec(){const _0x2de968=['\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','listRoots','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','split','dryRun','terminated','\x22>\x0aError\x20reading\x20file:\x20','code','normalize','assistant','github_url','lines','trim','toLowerCase','setRequestHandler','warp_grep_start','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','warp_grep_complete','user','optional','context','sep','mcp-filesystem','slice','cwd','indexOf','Tool\x20\x22','role','argv','[github_codebase_search]\x20Done\x20in\x20','Created\x20File','some','floor','code_edit','errors','MORPH_LARGE_APPLY','metadata','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','grep_search','setNotificationHandler','WORKSPACE_ROOT','❌\x20Morph\x20Edit\x20Failed:\x20','min','map','SubToolError','filter','completionId','\x20error(s)','target_filepath','.\x20Path:\x20','error','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','version','provider_created','Workspace\x20mode\x20enabled:\x20Using\x20','size','github_codebase_search','morph-','1001GRtAAG','enum','morph-warp-grep-v2.1','name','Applied','grep\x20\x27','env','MORPH_WARP_GREP_TIMEOUT','pattern','Unknown\x20error','.git','--api-key','tsconfig.json','boolean','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','linesAdded','roots','includes','repo_path','file_read_complete','\x20disabled\x20via\x20DISABLED_TOOLS','@morphllm/morphmcp\x20','Morph\x20Edit\x20Preview','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','unknown','202270eREpru','`\x20in\x20`','exit','timeout','grep','homedir','getClientCapabilities','Cargo.toml','new_string','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a',',\x20modified\x20','text','-\x20Listed\x20directory\x20`','MCP','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Fallback:\x20Using\x20workspace\x20root\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','stringify','Warning:\x20','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','../package.json','tool_call_received','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','package.json','16918mJiwor','turns','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','path_validation_failed','access','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','54tuttOm','false','ENOENT','file','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Rules:\x0a','linesModified','\x20-\x20','search_string','read','glob\x20\x27','tool_call_error','<file\x20path=\x22','CODEBASE_SEARCH','completed_with_file_errors','function','DISABLED_TOOLS','timed\x20out','\x20as\x20allowed\x20directory','basename','morph-v3-large','-\x20Grepped\x20\x27','.\x20Changes:\x20','2462931KAaXFJ','catch','default','RipgrepNotAvailable','source','\x20(new\x20file)','instruction','0.2.0','data','Morph\x20FastApply\x20failed\x20without\x20error\x20message','API\x20error\x20(auth/rate-limit)','now','GitHub\x20search\x20failed:\x20','TimeoutError','substring','Unknown\x20tool:\x20','object','morph-mcp','content','readFile','list_directory','owner_repo','instructions','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','-\x20Preserve\x20exact\x20indentation\x0a','params','pyproject.toml','glob','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','etimedout','describe','Error:\x20','description','15432ZMUNfn','MORPH_API_KEY','path_validation_resolved','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','match','node_modules','\x20\x20morph-mcp','WarpGrepError','path','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','2989108xvzCUG','completed','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','parse','EDIT_FILE','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','.cursor','message','warn','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','-\x20Glob\x20search\x20`','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','4037350ryKZuF','success','linesRemoved','\x20chars)','join','tool_calls','files','Repository\x20identifier','all','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','BinaryFile','tool_call_id','status','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x22.\x20Known\x20tools:\x20','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x0aOptions:','push','dirname','edit','string','application/json','File\x20read\x20error:','Max\x20results\x20to\x20return','Morph\x20Edit\x20','Bearer\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','timings','runWarpGrep_call','oninitialized','post','Disabled\x20tools:\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Error\x20accessing\x20directory\x20','arguments','ENABLE_WORKSPACE_MODE','debug','Fatal\x20error\x20running\x20server:','constructor','42471oNhDbA','target_file','codebase_search','Specific\x20commit\x20hash\x20to\x20search','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','MORPH_API_URL','resolve','\x0aExamples:','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','branch','searchGitHub','edit_file','\x20valid\x20directories','search_type','terminationReason','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','startsWith','has',',\x20removed\x20','Preview\x20changes\x20without\x20applying\x20them.','compaction_failed','go.mod','LocalRipgrepProvider','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','github_search_start','utf-8','messages','command','\x22>\x0a','safeParse','--api-key=','Relevant\x20context\x20found:','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','log','Parent\x20directory\x20does\x20not\x20exist:\x20','Tool\x20','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.','file_path','composer.json','realpath','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','-\x20Read\x20file\x20`','stack','PWD','Invalid\x20arguments:\x20','isArray','sk-','UnknownError','every','finish','list_directory\x20','length','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','16LNujRe','unknown\x20error','filePath','GITHUB_CODEBASE_SEARCH','morph-v3-fast','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','[could\x20not\x20read\x20file:\x20','\x0a</file>','changes','FileReadError','Warning:\x20Workspace\x20fallback\x20failed:\x20','requiresApiKey','ms:'];a0_0x57ec=function(){return _0x2de968;};return a0_0x57ec();}import a0_0x2590e9 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x40c9d3){const _0x8f9f7e=a0_0x2218,_0x324a98=_0x40c9d3[_0x8f9f7e(0x22b)](a0_0x146359[_0x8f9f7e(0x23d)])[_0x8f9f7e(0x255)](Boolean);if(_0x324a98['length']<0x2)return null;for(let _0x156ce8=Math[_0x8f9f7e(0x248)](_0x324a98['length']/0x2);_0x156ce8>=0x1;_0x156ce8--){for(let _0x50a1e0=0x0;_0x50a1e0<=_0x324a98['length']-0x2*_0x156ce8;_0x50a1e0++){const _0x5894c4=_0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0,_0x50a1e0+_0x156ce8),_0x18b795=_0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0+_0x156ce8,_0x50a1e0+0x2*_0x156ce8);if(_0x5894c4[_0x8f9f7e(0x214)]((_0x513950,_0x2bcf53)=>_0x513950===_0x18b795[_0x2bcf53])){const _0x4ad43f=[..._0x324a98['slice'](0x0,_0x50a1e0),..._0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0+_0x156ce8)];return a0_0x146359[_0x8f9f7e(0x23d)]+_0x4ad43f['join'](a0_0x146359[_0x8f9f7e(0x23d)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x6d2e5b=a0_0x2218;try{const _0x56d369=require(_0x6d2e5b(0x28f));return _0x56d369[_0x6d2e5b(0x25c)]??'unknown';}catch(_0x2865d2){return logMcpStderr(_0x6d2e5b(0x1c2),_0x2865d2),_0x6d2e5b(0x27a);}}function printHelp(){const _0x5b9b33=a0_0x2218;console['log'](_0x5b9b33(0x277)+getPackageVersion()),console[_0x5b9b33(0x203)](_0x5b9b33(0x21e)),console['log'](_0x5b9b33(0x1cb)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1f1)),console[_0x5b9b33(0x203)](_0x5b9b33(0x228)),console[_0x5b9b33(0x203)](_0x5b9b33(0x21f)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1e9)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1a8)),console['log'](_0x5b9b33(0x1c9));}const cliArgs=process[a0_0x231f6c(0x244)][a0_0x231f6c(0x23f)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x231f6c(0x247)](_0x1a307f=>VERSION_FLAGS[a0_0x231f6c(0x1f3)](_0x1a307f))&&(console[a0_0x231f6c(0x203)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x19915b=>HELP_FLAGS['has'](_0x19915b))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x421452){const _0x23fb11=a0_0x231f6c;for(let _0x3706c6=0x0;_0x3706c6<cliArgs[_0x23fb11(0x217)];_0x3706c6++){const _0x2f478d=cliArgs[_0x3706c6];if(_0x2f478d[_0x23fb11(0x1f2)]('--'+_0x421452+'='))return _0x2f478d['slice'](('--'+_0x421452+'=')[_0x23fb11(0x217)]);if(_0x2f478d==='--'+_0x421452&&_0x3706c6+0x1<cliArgs[_0x23fb11(0x217)])return cliArgs[_0x3706c6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x231f6c(0x1f3)](arg)||HELP_FLAGS[a0_0x231f6c(0x1f3)](arg))continue;if(arg[a0_0x231f6c(0x1f2)](a0_0x231f6c(0x200)))continue;if(arg===a0_0x231f6c(0x26d)){i++;continue;}args[a0_0x231f6c(0x1cc)](arg);}const WORKSPACE_ROOT=process[a0_0x231f6c(0x268)][a0_0x231f6c(0x250)]||process['env'][a0_0x231f6c(0x20f)]||process[a0_0x231f6c(0x240)](),ENABLE_WORKSPACE_MODE=process[a0_0x231f6c(0x268)][a0_0x231f6c(0x1de)]!==a0_0x231f6c(0x29c),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x231f6c(0x268)][a0_0x231f6c(0x1a3)],MORPH_API_URL=process['env'][a0_0x231f6c(0x1e7)],MORPH_LARGE_APPLY=process['env'][a0_0x231f6c(0x24b)]!==a0_0x231f6c(0x29c),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x231f6c(0x269)]?parseInt(process[a0_0x231f6c(0x268)][a0_0x231f6c(0x269)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x231f6c(0x268)]['DISABLED_TOOLS']?new Set(process[a0_0x231f6c(0x268)][a0_0x231f6c(0x2ab)][a0_0x231f6c(0x22b)](',')[a0_0x231f6c(0x253)](_0x288027=>_0x288027[a0_0x231f6c(0x234)]())['filter'](_0x58a5d2=>_0x58a5d2[a0_0x231f6c(0x217)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x231f6c(0x25f)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x231f6c(0x1f3)](tool)&&console[a0_0x231f6c(0x25a)](a0_0x231f6c(0x198)+tool+a0_0x231f6c(0x1c8)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console['error'](a0_0x231f6c(0x1da)+[...DISABLED_TOOLS][a0_0x231f6c(0x1bd)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY['startsWith'](a0_0x231f6c(0x261))&&logMcpStderr(a0_0x231f6c(0x1b1));async function reportMorphError(_0xe94246){const _0x4c2e75=a0_0x231f6c;try{await a0_0x2590e9[_0x4c2e75(0x1d9)]('https://morphllm.com/api/error-report',{..._0xe94246,'timestamp':new Date()['toISOString'](),'source':_0xe94246['source']||_0x4c2e75(0x23e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0xe94246[_0x4c2e75(0x23c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x4c2e75(0x1d0),'Authorization':_0x4c2e75(0x1d4)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x49cea8,_0x38b268){const _0xd589c=a0_0x231f6c;if(_0x49cea8&&typeof _0x49cea8===_0xd589c(0x2c2)&&_0xd589c(0x1c5)in _0x49cea8)return _0x49cea8['status'];if(_0x49cea8&&typeof _0x49cea8===_0xd589c(0x2c2)&&'response'in _0x49cea8)return _0x49cea8['response']?.[_0xd589c(0x1c5)];const _0x35be96=_0x38b268[_0xd589c(0x1a6)](/\b(401|429)\b/);return _0x35be96?parseInt(_0x35be96[0x1],0xa):null;}function handleMorphAPIError(_0xcd63a8){const _0x38f9cf=a0_0x231f6c,_0x190a72=_0xcd63a8 instanceof Error?_0xcd63a8[_0x38f9cf(0x1b3)]:String(_0xcd63a8),_0x2ba529=extractStatusCode(_0xcd63a8,_0x190a72);switch(_0x2ba529){case 0x191:return{'content':[{'type':_0x38f9cf(0x286),'text':_0x38f9cf(0x220)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x38f9cf(0x286),'text':_0x38f9cf(0x202)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x231f6c(0x20c)),logMcpStderr(a0_0x231f6c(0x1c7)),logMcpStderr(a0_0x231f6c(0x238)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x231f6c(0x1ab)),logMcpStderr(a0_0x231f6c(0x207)));function normalizePath(_0x5c28b1){const _0x39d877=a0_0x231f6c;return a0_0x146359[_0x39d877(0x230)](_0x5c28b1);}function expandHome(_0x3977ee){const _0x1bc4ed=a0_0x231f6c;if(_0x3977ee[_0x1bc4ed(0x1f2)]('~/')||_0x3977ee==='~')return a0_0x146359['join'](a0_0x1d7b4c[_0x1bc4ed(0x280)](),_0x3977ee[_0x1bc4ed(0x23f)](0x1));return _0x3977ee;}let allowedDirectories=await Promise[a0_0x231f6c(0x1c1)](args['map'](async _0x11b605=>{const _0x18c26f=a0_0x231f6c,_0x418256=expandHome(_0x11b605),_0x224b5b=a0_0x146359[_0x18c26f(0x1e8)](_0x418256);try{const _0x27bc6c=await a0_0x3ed385[_0x18c26f(0x20b)](_0x224b5b);return normalizePath(_0x27bc6c);}catch(_0x48495f){return normalizePath(_0x224b5b);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x231f6c(0x217)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x231f6c(0x1cc)](workspaceDir),logMcpStderr(a0_0x231f6c(0x25e)+workspaceDir+a0_0x231f6c(0x2ad)));}catch(a0_0x10bc0e){logMcpStderr(a0_0x231f6c(0x19d)+a0_0x10bc0e);}async function detectWorkspaceRoot(_0x44068c){const _0x4aed0=a0_0x231f6c;let _0x51fed3=a0_0x146359[_0x4aed0(0x1e8)](_0x44068c);const _0x502396=[_0x4aed0(0x26c),'.vscode',_0x4aed0(0x292),_0x4aed0(0x282),_0x4aed0(0x19b),_0x4aed0(0x1f7),_0x4aed0(0x1b2),_0x4aed0(0x26e),_0x4aed0(0x20a)];while(_0x51fed3!==a0_0x146359[_0x4aed0(0x1cd)](_0x51fed3)){for(const _0x3780d1 of _0x502396){const _0x1ec5b1=a0_0x146359['join'](_0x51fed3,_0x3780d1);try{return await a0_0x3ed385[_0x4aed0(0x299)](_0x1ec5b1),normalizePath(_0x51fed3);}catch{}}_0x51fed3=a0_0x146359[_0x4aed0(0x1cd)](_0x51fed3);}return normalizePath(_0x44068c);}await Promise[a0_0x231f6c(0x1c1)](args['map'](async _0xa03992=>{const _0x50d8f7=a0_0x231f6c;try{const _0xf89f8a=await a0_0x3ed385['stat'](expandHome(_0xa03992));!_0xf89f8a['isDirectory']()&&(logMcpStderr(_0x50d8f7(0x1a0)+_0xa03992+'\x20is\x20not\x20a\x20directory'),process[_0x50d8f7(0x27d)](0x1));}catch(_0x40959f){logMcpStderr(_0x50d8f7(0x1dc)+_0xa03992+':',_0x40959f),process['exit'](0x1);}}));async function validatePath(_0x4cbf84){const _0x27c2ed=a0_0x231f6c,_0x56c840=expandHome(_0x4cbf84),_0x510c56=a0_0x146359[_0x27c2ed(0x1e8)](_0x56c840);logger[_0x27c2ed(0x1df)]('MCP','path_validation_start',{'raw_path':_0x4cbf84,'absolute':_0x510c56});try{const _0x14591d=await a0_0x3ed385['realpath'](_0x510c56);return logger[_0x27c2ed(0x1df)]('MCP',_0x27c2ed(0x1a4),{'resolved':_0x14591d,'symlink':_0x14591d!==_0x510c56}),_0x14591d;}catch(_0x3587a4){if(_0x3587a4[_0x27c2ed(0x22f)]===_0x27c2ed(0x29d)){const _0x1718a2=a0_0x146359['dirname'](_0x510c56);try{const _0x4c39c8=await a0_0x3ed385[_0x27c2ed(0x20b)](_0x1718a2),_0x108cff=a0_0x146359[_0x27c2ed(0x1bd)](_0x4c39c8,a0_0x146359[_0x27c2ed(0x2ae)](_0x510c56));return logger[_0x27c2ed(0x1df)](_0x27c2ed(0x288),'path_validation_resolved',{'resolved':_0x108cff,'new_file':!![]}),_0x108cff;}catch{logger[_0x27c2ed(0x25a)]('MCP',_0x27c2ed(0x298),{'raw_path':_0x4cbf84,'error':_0x27c2ed(0x204)+_0x1718a2});throw new Error(_0x27c2ed(0x204)+_0x1718a2);}}logger[_0x27c2ed(0x25a)](_0x27c2ed(0x288),_0x27c2ed(0x298),{'raw_path':_0x4cbf84,'error':_0x3587a4['message']});throw _0x3587a4;}}const MorphEditFileArgsSchema=z[a0_0x231f6c(0x2c2)]({'path':z[a0_0x231f6c(0x1cf)](),'code_edit':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x270)),'instruction':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1b8)),'dryRun':z[a0_0x231f6c(0x26f)]()['default'](![])[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1f5))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z[a0_0x231f6c(0x2c2)]({'search_string':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x231f6c(0x263)]([a0_0x231f6c(0x2b4),'node_modules'])[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1c6))}),WarpGrepGitHubArgsSchema=z[a0_0x231f6c(0x2c2)]({'search_string':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()['describe'](a0_0x231f6c(0x25b)),'owner_repo':z['string']()[a0_0x231f6c(0x23b)]()['describe'](a0_0x231f6c(0x1ae)),'branch':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x23b)]()['describe'](a0_0x231f6c(0x1db))}),CodebaseSearchArgsSchema=z[a0_0x231f6c(0x2c2)]({'query':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1c0)),'branch':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x297)),'commitHash':z['string']()[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1e5)),'targetDirectories':z['array'](z[a0_0x231f6c(0x1cf)]())[a0_0x231f6c(0x2b4)]([])['describe']('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x231f6c(0x23b)]()['default'](0xa)[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1d2))}),server=new Server({'name':a0_0x231f6c(0x2c3),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x231f6c(0x236)](ListToolsRequestSchema,async()=>{const _0x362509=a0_0x231f6c,_0x36731e=[{'name':TOOL_NAMES[_0x362509(0x1b0)],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a'+'Parameters:\x0a'+_0x362509(0x206)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+_0x362509(0x1f9)+'Example\x20format:\x0a'+_0x362509(0x284)+_0x362509(0x2a0)+_0x362509(0x1b5)+_0x362509(0x199)+_0x362509(0x295)+_0x362509(0x279),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x362509(0x2a8)],'description':_0x362509(0x28e)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x362509(0x22a)+_0x362509(0x1b6)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x11ddf5=_0x36731e[_0x362509(0x255)](_0x2e0805=>{const _0x1df734=_0x362509;if(DISABLED_TOOLS[_0x1df734(0x1f3)](_0x2e0805[_0x1df734(0x265)]))return console[_0x1df734(0x25a)](_0x1df734(0x205)+_0x2e0805[_0x1df734(0x265)]+_0x1df734(0x276)),![];if(_0x1df734(0x226)in _0x2e0805&&_0x2e0805[_0x1df734(0x226)]&&!MORPH_API_KEY)return logMcpStderr(_0x1df734(0x28d)+_0x2e0805[_0x1df734(0x265)]+_0x1df734(0x29f)),![];return!![];});return{'tools':_0x11ddf5[_0x362509(0x253)](_0xac4d80=>({'name':_0xac4d80[_0x362509(0x265)],'description':_0xac4d80[_0x362509(0x1a1)],'inputSchema':_0xac4d80['inputSchema']}))};}),server[a0_0x231f6c(0x236)](CallToolRequestSchema,async _0x986cf2=>{const _0x5e3def=a0_0x231f6c,{name:_0x150814,arguments:_0x17d255}=_0x986cf2[_0x5e3def(0x19a)],_0x4722eb=Date[_0x5e3def(0x2bd)]();logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x290),{'tool':_0x150814,'args':_0x150814===_0x5e3def(0x1ed)?{'path':_0x17d255?.['path'],'instruction':_0x17d255?.[_0x5e3def(0x2b8)]||_0x17d255?.[_0x5e3def(0x197)],'dryRun':_0x17d255?.[_0x5e3def(0x22c)]}:_0x17d255});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':_0x5e3def(0x24d)}],'isError':!![]};if(!MORPH_API_KEY[_0x5e3def(0x1f2)](_0x5e3def(0x212))&&!MORPH_API_KEY[_0x5e3def(0x1f2)](_0x5e3def(0x261)))return{'content':[{'type':_0x5e3def(0x286),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x5e3def(0x1f3)](_0x150814))return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x242)+_0x150814+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x150814){case TOOL_NAMES[_0x5e3def(0x1b0)]:{let _0x56b691=_0x17d255;if(_0x56b691&&typeof _0x56b691===_0x5e3def(0x2c2)){if(!(_0x5e3def(0x1aa)in _0x56b691)){const _0x347eba=_0x56b691[_0x5e3def(0x1e3)]??_0x56b691[_0x5e3def(0x21b)]??_0x56b691[_0x5e3def(0x258)]??_0x56b691[_0x5e3def(0x209)]??_0x56b691[_0x5e3def(0x29e)];if(_0x347eba)_0x56b691={..._0x56b691,'path':_0x347eba};}'instructions'in _0x56b691&&!(_0x5e3def(0x2b8)in _0x56b691)&&(_0x56b691={..._0x56b691,'instruction':_0x56b691['instructions']});if(!(_0x5e3def(0x249)in _0x56b691)){const _0x267cb5=_0x56b691['code']??_0x56b691[_0x5e3def(0x283)]??_0x56b691['content']??_0x56b691[_0x5e3def(0x1ce)];if(_0x267cb5)_0x56b691={..._0x56b691,'code_edit':_0x267cb5};}}const _0x2a0b34=MorphEditFileArgsSchema[_0x5e3def(0x1ff)](_0x56b691);if(!_0x2a0b34[_0x5e3def(0x1ba)])throw new Error(_0x5e3def(0x1ca)+_0x2a0b34[_0x5e3def(0x25a)]);const _0x56c068=await validatePath(_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)]);let _0xec2481=null,_0x5a687a=!![],_0x519e46=null;try{_0xec2481=await a0_0x3ed385[_0x5e3def(0x194)](_0x56c068,_0x5e3def(0x1fb)),logger[_0x5e3def(0x1df)]('MCP','file_read_complete',{'path':_0x56c068,'size_bytes':_0xec2481['length']});}catch(_0x2a39e4){const _0x42d2d5=_0x2a39e4[_0x5e3def(0x22f)];_0x42d2d5==='ENOENT'?(_0x5a687a=![],_0xec2481='',logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x275),{'path':_0x56c068,'exists':![]})):(_0x519e46='Failed\x20to\x20read\x20file:\x20'+(_0x42d2d5||_0x5e3def(0x27a))+_0x5e3def(0x2a2)+(_0x2a39e4 instanceof Error?_0x2a39e4[_0x5e3def(0x1b3)]:String(_0x2a39e4)),logger[_0x5e3def(0x25a)](_0x5e3def(0x288),'file_read_failed',{'path':_0x56c068,'error':_0x519e46}),logMcpStderr(_0x5e3def(0x28d)+_0x519e46));}let _0x50de33;try{const _0x74b61f=MORPH_API_KEY;if(!_0x74b61f)throw new Error(_0x5e3def(0x29a));const _0x30f222=a0_0x146359[_0x5e3def(0x1cd)](_0x56c068),_0x530ff9=a0_0x146359['basename'](_0x56c068);logger[_0x5e3def(0x1df)]('MCP','api_request_start',{'model':_0x5e3def(0x21d),'path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'instruction_len':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)][_0x5e3def(0x217)],'code_edit_len':_0x2a0b34[_0x5e3def(0x2ba)]['code_edit']['length'],'original_code_len':_0xec2481?.[_0x5e3def(0x217)]??0x0,'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)]});const _0x3cdd2b=Date[_0x5e3def(0x2bd)](),_0x577326=await executeEditFile({'target_filepath':_0x530ff9,'code_edit':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x249)],'instruction':_0x2a0b34['data'][_0x5e3def(0x2b8)]},{'morphApiKey':_0x74b61f,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x30f222,'autoWrite':!_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)],'generateUdiff':![],'debug':![]}),_0x5da451=Date[_0x5e3def(0x2bd)]()-_0x3cdd2b;_0x50de33=_0x577326[_0x5e3def(0x256)];if(!_0x577326[_0x5e3def(0x1ba)])throw new Error(_0x577326[_0x5e3def(0x25a)]||_0x5e3def(0x2bb));const _0x3ebb72=_0x577326[_0x5e3def(0x223)],_0x5ebbf0='added\x20'+_0x3ebb72[_0x5e3def(0x271)]+_0x5e3def(0x1f4)+_0x3ebb72[_0x5e3def(0x1bb)]+_0x5e3def(0x285)+_0x3ebb72[_0x5e3def(0x2a1)];logger[_0x5e3def(0x1df)](_0x5e3def(0x288),'tool_call_complete',{'tool':_0x5e3def(0x1ed),'success':!![],'latency_ms':Date['now']()-_0x4722eb,'edit_latency_ms':_0x5da451,'changes':{'added':_0x3ebb72[_0x5e3def(0x271)],'removed':_0x3ebb72[_0x5e3def(0x1bb)],'modified':_0x3ebb72['linesModified']},'completion_id':_0x50de33});if(_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)])return{'content':[{'type':'text','text':_0x5e3def(0x278)+(_0x5a687a?'':_0x5e3def(0x2b7))+':\x20'+_0x2a0b34['data'][_0x5e3def(0x2b8)]+_0x5e3def(0x2b1)+_0x5ebbf0+_0x5e3def(0x259)+_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)]+'.'}]};return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x1d3)+(_0x5a687a?_0x5e3def(0x266):_0x5e3def(0x246))+':\x20'+_0x2a0b34['data'][_0x5e3def(0x2b8)]+'.\x20Changes:\x20'+_0x5ebbf0+'.\x20Path:\x20'+_0x2a0b34['data']['path']+'.'}]};}catch(_0x2d6fdc){const _0x525417=handleMorphAPIError(_0x2d6fdc);if(_0x525417)return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':'edit_file','error':_0x5e3def(0x2bc),'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb}),_0x525417;const _0x2c0638=_0x2d6fdc instanceof Error?_0x2d6fdc['message']:String(_0x2d6fdc);return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1ed),'error':_0x2c0638,'path':_0x2a0b34[_0x5e3def(0x2ba)]['path'],'validated_path':_0x56c068,'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb,'stack':_0x2d6fdc instanceof Error?_0x2d6fdc['stack']:undefined}),reportMorphError({'error_message':_0x2c0638,'error_type':_0x2d6fdc instanceof Error?_0x2d6fdc[_0x5e3def(0x1e1)]['name']:'UnknownError','context':{'tool':'edit_file','completion_id':_0x50de33,'file_path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'validated_path':_0x56c068,'instruction':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)],'model':MORPH_LARGE_APPLY?_0x5e3def(0x2af):_0x5e3def(0x21d),'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)],'file_exists':_0x5a687a,'file_read_error':_0x519e46,'file_readable':_0xec2481!==null,'request_content':{'path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'code_edit':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x249)],'instruction':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)],'original_code':_0xec2481!==null?_0xec2481['length']>0xc350?_0xec2481['substring'](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0xec2481[_0x5e3def(0x217)]+_0x5e3def(0x1bc):_0xec2481:_0x5e3def(0x221)+(_0x519e46||_0x5e3def(0x21a))+']','original_code_length':_0xec2481?.[_0x5e3def(0x217)]??0x0,'model':MORPH_LARGE_APPLY?_0x5e3def(0x2af):_0x5e3def(0x21d),'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)]}},'stack_trace':_0x2d6fdc instanceof Error?_0x2d6fdc['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':'text','text':_0x5e3def(0x251)+_0x2c0638}],'isError':!![]};}}case TOOL_NAMES[_0x5e3def(0x2a8)]:{const _0x3e1cba=WarpGrepArgsSchema['safeParse'](_0x17d255);if(!_0x3e1cba[_0x5e3def(0x1ba)])return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x210)+_0x3e1cba[_0x5e3def(0x25a)]}],'isError':!![]};const _0x354e70=_0x4e9df8=>{const _0x5e9832=_0x5e3def,_0x4ff32e=[];for(const _0x40e0d5 of _0x4e9df8||[]){if(_0x40e0d5['role']===_0x5e9832(0x231)&&Array[_0x5e9832(0x211)](_0x40e0d5[_0x5e9832(0x1be)]))for(const _0x555f59 of _0x40e0d5['tool_calls']){try{const _0x1ec239=_0x555f59[_0x5e9832(0x2aa)]?.[_0x5e9832(0x265)],_0x151d03=JSON[_0x5e9832(0x1af)](_0x555f59[_0x5e9832(0x2aa)]?.[_0x5e9832(0x1dd)]||'{}');if(_0x1ec239===_0x5e9832(0x24e))_0x4ff32e[_0x5e9832(0x1cc)](_0x5e9832(0x267)+_0x151d03[_0x5e9832(0x26a)]+'\x27\x20'+(_0x151d03['path']||'.'));else{if(_0x1ec239==='read')_0x4ff32e[_0x5e9832(0x1cc)]('read\x20'+_0x151d03['path']);else{if(_0x1ec239===_0x5e9832(0x195))_0x4ff32e[_0x5e9832(0x1cc)](_0x5e9832(0x216)+(_0x151d03[_0x5e9832(0x1fd)]||'.'));else{if(_0x1ec239==='glob')_0x4ff32e['push'](_0x5e9832(0x2a5)+_0x151d03[_0x5e9832(0x26a)]+'\x27\x20'+(_0x151d03[_0x5e9832(0x1aa)]||'.'));else _0x1ec239==='finish'&&_0x4ff32e['push']('finish');}}}}catch{}}}return _0x4ff32e;},_0x1be310=_0x3cdbc5=>{const _0x52bcd0=_0x5e3def,_0x3752de=[];if(!_0x3cdbc5||!Array[_0x52bcd0(0x211)](_0x3cdbc5))return _0x3752de;const _0x54b28d=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x52bcd0(0x2a4)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x52bcd0(0x2a4)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x52bcd0(0x1c3),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x52bcd0(0x27f)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x52bcd0(0x2b5),'tool':_0x52bcd0(0x27f)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x52bcd0(0x1c3),'tool':_0x52bcd0(0x2a4)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x52bcd0(0x2a4)},{'pattern':/not a text file/,'error_type':_0x52bcd0(0x1c3),'tool':_0x52bcd0(0x2a4)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x52bcd0(0x2a4)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x52bcd0(0x2a4)},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x323080=0x0;for(const _0x1f88ea of _0x3cdbc5){_0x1f88ea[_0x52bcd0(0x243)]===_0x52bcd0(0x231)&&Array[_0x52bcd0(0x211)](_0x1f88ea[_0x52bcd0(0x1be)])&&_0x323080++;const _0x3d9d28=_0x1f88ea['content'];if((_0x1f88ea[_0x52bcd0(0x243)]==='tool'||_0x1f88ea['role']===_0x52bcd0(0x23a))&&_0x3d9d28&&typeof _0x3d9d28==='string')for(const {pattern:_0x765f10,error_type:_0x2a71e4,tool:_0x2f8d24}of _0x54b28d){const _0x548d32=_0x3d9d28[_0x52bcd0(0x1a6)](new RegExp(_0x765f10[_0x52bcd0(0x2b6)],'g'));if(_0x548d32)for(const _0x1e4ef6 of _0x548d32){const _0x38fd11=_0x3d9d28[_0x52bcd0(0x241)](_0x1e4ef6),_0x3b5757=_0x3d9d28['substring'](_0x38fd11,Math[_0x52bcd0(0x252)](_0x38fd11+0xc8,_0x3d9d28[_0x52bcd0(0x217)]));_0x3752de['push']({'tool':_0x2f8d24,'error_type':_0x2a71e4,'error_message':_0x3b5757[_0x52bcd0(0x22b)]('\x0a')[0x0],'turn':_0x323080});}}}return _0x3752de;};try{const _0x12f3f8=a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)]['repo_path']),_0x1d85bc=_0x3e1cba['data'][_0x5e3def(0x1ef)],_0x3d99af=_0x1d85bc===_0x5e3def(0x1a7)?{'allowNames':[_0x5e3def(0x1a7)]}:undefined,_0xf86700=new LocalRipgrepProvider(_0x12f3f8,undefined,_0x3d99af);logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x25d),{'type':_0x5e3def(0x1f8),'repo_root':_0x12f3f8,'search_type':_0x1d85bc||_0x5e3def(0x2b4)}),logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x237),{'query':_0x3e1cba[_0x5e3def(0x2ba)]['search_string'],'repo_root':_0x12f3f8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x3c7643=Date['now'](),_0x596820=await runWarpGrep({'searchTerm':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repoRoot':_0x12f3f8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xf86700,'search_type':_0x1d85bc}),_0x3aae5a=Date[_0x5e3def(0x2bd)]()-_0x3c7643,_0x213dcf=_0x596820[_0x5e3def(0x215)]?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)]?.[_0x5e3def(0x217)]??0x0;logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x239),{'termination':_0x596820[_0x5e3def(0x1f0)],'turns':_0x596820[_0x5e3def(0x1d6)]?.[_0x5e3def(0x294)]??0x0,'files_found':_0x213dcf,'latency_ms':_0x3aae5a});const _0x5a0a0f=_0x1be310(_0x596820[_0x5e3def(0x1fc)]);_0x5a0a0f[_0x5e3def(0x217)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x5a0a0f[_0x5e3def(0x217)]+_0x5e3def(0x257),'error_type':_0x5e3def(0x254),'level':_0x5e3def(0x1b4),'tool':'codebase_search','context':{'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'model':_0x5e3def(0x264),'termination_reason':_0x596820[_0x5e3def(0x1f0)],'sub_tool_errors':_0x5a0a0f,'timings':_0x596820[_0x5e3def(0x1d6)],'tool_calls':_0x354e70(_0x596820[_0x5e3def(0x1fc)]),'messages':_0x596820[_0x5e3def(0x1fc)]?.[_0x5e3def(0x253)](_0x2b698f=>({'role':_0x2b698f[_0x5e3def(0x243)],'content':_0x2b698f[_0x5e3def(0x2c4)],..._0x2b698f[_0x5e3def(0x1be)]?{'tool_calls':_0x2b698f[_0x5e3def(0x1be)][_0x5e3def(0x217)]}:{},..._0x2b698f[_0x5e3def(0x1c4)]?{'tool_call_id':_0x2b698f[_0x5e3def(0x1c4)]}:{}}))},'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{});let _0x291421='';if(_0x596820[_0x5e3def(0x1f0)]===_0x5e3def(0x1ad)&&_0x596820[_0x5e3def(0x215)]?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)]){const _0x5d70b5=_0x596820[_0x5e3def(0x215)]['metadata'][_0x5e3def(0x1bf)];if(_0x5d70b5['length']===0x0)return _0x291421=_0x596820[_0x5e3def(0x215)]['payload']||_0x5e3def(0x1a5),{'content':[{'type':_0x5e3def(0x286),'text':_0x291421}]};const _0x97cb89=[],_0x4545d3=[_0x5e3def(0x28b)];for(const _0x5197ca of _0x596820[_0x5e3def(0x1fc)]){if(_0x5197ca[_0x5e3def(0x243)]===_0x5e3def(0x231)&&Array[_0x5e3def(0x211)](_0x5197ca['tool_calls']))for(const _0x2e7713 of _0x5197ca[_0x5e3def(0x1be)]){try{const _0x38c924=_0x2e7713[_0x5e3def(0x2aa)]?.['name'],_0x5b8332=JSON[_0x5e3def(0x1af)](_0x2e7713[_0x5e3def(0x2aa)]?.[_0x5e3def(0x1dd)]||'{}');if(_0x38c924==='grep_search')_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x2b0)+_0x5b8332[_0x5e3def(0x26a)]+'\x27\x20in\x20`'+(_0x5b8332[_0x5e3def(0x1aa)]||'.')+'`');else{if(_0x38c924==='read')_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x20d)+_0x5b8332[_0x5e3def(0x1aa)]+'`');else{if(_0x38c924===_0x5e3def(0x195))_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x287)+(_0x5b8332[_0x5e3def(0x1fd)]||'.')+'`');else _0x38c924===_0x5e3def(0x19c)&&_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x1b7)+_0x5b8332['pattern']+_0x5e3def(0x27c)+(_0x5b8332[_0x5e3def(0x1aa)]||'.')+'`');}}}catch{}}}_0x97cb89[_0x5e3def(0x1cc)](_0x4545d3[_0x5e3def(0x1bd)]('\x0a'));const _0x57e931=['',_0x5e3def(0x201)];for(const _0x44c374 of _0x5d70b5){if(_0x44c374[_0x5e3def(0x233)]==='*')_0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374['path']+':*');else{if(Array[_0x5e3def(0x211)](_0x44c374[_0x5e3def(0x233)])){const _0x70b752=_0x44c374[_0x5e3def(0x233)][_0x5e3def(0x253)](([_0x38d49f,_0x364940])=>{if(_0x38d49f===_0x364940)return''+_0x38d49f;return _0x38d49f+'-'+_0x364940;});_0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374[_0x5e3def(0x1aa)]+':'+_0x70b752[_0x5e3def(0x1bd)](','));}else _0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374[_0x5e3def(0x1aa)]+':*');}}_0x57e931[_0x5e3def(0x1cc)](''),_0x97cb89[_0x5e3def(0x1cc)](_0x57e931[_0x5e3def(0x1bd)]('\x0a')),_0x97cb89[_0x5e3def(0x1cc)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x6b2e2d=[],_0x574496=[];for(const _0x322db2 of _0x5d70b5){let _0x4fbeed=a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)]['repo_path'],_0x322db2['path']),_0x543c7c=null,_0x211b93=null;try{_0x543c7c=await a0_0x3ed385[_0x5e3def(0x194)](_0x4fbeed,{'encoding':'utf-8'});}catch(_0x43837d){const _0xd5ac3b=fixPathRepetition(_0x4fbeed);if(_0xd5ac3b)try{_0x543c7c=await a0_0x3ed385[_0x5e3def(0x194)](_0xd5ac3b,{'encoding':'utf-8'}),_0x4fbeed=_0xd5ac3b;}catch{_0x211b93=_0x43837d instanceof Error?_0x43837d:new Error(String(_0x43837d));}else _0x211b93=_0x43837d instanceof Error?_0x43837d:new Error(String(_0x43837d));}if(_0x543c7c!==null){const _0x2b6da9=_0x543c7c[_0x5e3def(0x22b)](/\r?\n/),_0x51ae93=[];if(_0x322db2[_0x5e3def(0x233)]==='*'||!Array['isArray'](_0x322db2[_0x5e3def(0x233)]))for(let _0x43651b=0x1;_0x43651b<=_0x2b6da9['length'];_0x43651b++){const _0x29b4ac=_0x2b6da9[_0x43651b-0x1];_0x51ae93[_0x5e3def(0x1cc)](_0x43651b+'|\x20'+_0x29b4ac);}else for(const [_0x4d5e4a,_0x4bcde4]of _0x322db2['lines']){_0x51ae93[_0x5e3def(0x217)]>0x0&&_0x51ae93['push']('');for(let _0x2b00a1=_0x4d5e4a;_0x2b00a1<=_0x4bcde4&&_0x2b00a1<=_0x2b6da9[_0x5e3def(0x217)];_0x2b00a1++){const _0x314a40=_0x2b6da9[_0x2b00a1-0x1];_0x51ae93['push'](_0x2b00a1+'|\x20'+_0x314a40);}}_0x574496[_0x5e3def(0x1cc)]({'path':_0x322db2[_0x5e3def(0x1aa)],'content':_0x51ae93[_0x5e3def(0x1bd)]('\x0a')});}else _0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x322db2[_0x5e3def(0x1aa)]+_0x5e3def(0x22e)+(_0x211b93?.['message']||_0x5e3def(0x26b))+_0x5e3def(0x222));}try{const _0x41a2a2=await compactFileContexts(_0x574496,_0x3e1cba['data'][_0x5e3def(0x2a3)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3760d3 of _0x41a2a2){_0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x3760d3['path']+'\x22>\x0a'+_0x3760d3[_0x5e3def(0x2c4)]+_0x5e3def(0x222));}}catch(_0x259409){logger[_0x5e3def(0x1b4)](_0x5e3def(0x288),_0x5e3def(0x1f6),{'error':_0x259409 instanceof Error?_0x259409['message']:String(_0x259409),'files_count':_0x574496['length']});for(const _0x2ab428 of _0x574496){_0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x2ab428['path']+_0x5e3def(0x1fe)+_0x2ab428[_0x5e3def(0x2c4)]+_0x5e3def(0x222));}}_0x97cb89[_0x5e3def(0x1cc)](_0x6b2e2d[_0x5e3def(0x1bd)]('\x0a\x0a')),_0x291421=_0x97cb89['join']('\x0a');const _0x427881=_0x596820[_0x5e3def(0x24a)]?.[_0x5e3def(0x255)](_0x1cb76c=>_0x1cb76c[_0x5e3def(0x1b3)]?.[_0x5e3def(0x1f2)](_0x5e3def(0x1d1)))||[];if(_0x427881[_0x5e3def(0x217)]>0x0){const _0x2028cc=_0x427881['map'](_0xb3f112=>_0xb3f112[_0x5e3def(0x1b3)])['join'](';\x20');reportMorphError({'error_message':_0x2028cc,'error_type':_0x5e3def(0x224),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba['data'][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'model':'morph-warp-grep-v2.1','termination_reason':_0x5e3def(0x2a9),'error_count':_0x427881[_0x5e3def(0x217)],'is_timeout':![],'timings':_0x596820[_0x5e3def(0x1d6)],'files_attempted':_0x5d70b5['map'](_0x2f7642=>({'path':_0x2f7642[_0x5e3def(0x1aa)],'lines':_0x2f7642[_0x5e3def(0x233)]})),'tool_calls':_0x354e70(_0x596820[_0x5e3def(0x1fc)]),'messages':_0x596820['messages']?.[_0x5e3def(0x253)](_0x23be47=>({'role':_0x23be47[_0x5e3def(0x243)],'content':_0x23be47[_0x5e3def(0x2c4)],..._0x23be47[_0x5e3def(0x1be)]?{'tool_calls':_0x23be47['tool_calls'][_0x5e3def(0x217)]}:{},..._0x23be47[_0x5e3def(0x1c4)]?{'tool_call_id':_0x23be47['tool_call_id']}:{}})),'request_content':{'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':_0x5e3def(0x264)}},'source':_0x5e3def(0x23e)})['catch'](()=>{});}}else{if(_0x596820['terminationReason']===_0x5e3def(0x22d)&&_0x596820[_0x5e3def(0x24a)][_0x5e3def(0x217)]>0x0){const _0x4e16f3=_0x596820['errors'][_0x5e3def(0x253)](_0x58cf8d=>_0x58cf8d[_0x5e3def(0x1b3)])[_0x5e3def(0x1bd)](';\x20');_0x291421=_0x5e3def(0x1a0)+_0x4e16f3;const _0x430324=_0x4e16f3['toLowerCase']()[_0x5e3def(0x273)](_0x5e3def(0x27e))||_0x4e16f3[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x2ac))||_0x4e16f3[_0x5e3def(0x235)]()[_0x5e3def(0x273)]('etimedout'),_0x2ff7be=_0x596820['finish']?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)],_0x41ce65=_0x596820['errors'][0x0];reportMorphError({'error_message':_0x4e16f3,'error_type':_0x430324?'TimeoutError':_0x41ce65?.[_0x5e3def(0x1e1)]?.[_0x5e3def(0x265)]||_0x5e3def(0x1a9),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x596820[_0x5e3def(0x1f0)],'error_count':_0x596820['errors']['length'],'is_timeout':_0x430324,'timings':_0x596820['timings'],'files_attempted':_0x2ff7be?.[_0x5e3def(0x253)](_0x4b8077=>({'path':_0x4b8077[_0x5e3def(0x1aa)],'lines':_0x4b8077[_0x5e3def(0x233)]})),'tool_calls':_0x354e70(_0x596820['messages']),'messages':_0x596820[_0x5e3def(0x1fc)]?.[_0x5e3def(0x253)](_0x5577bc=>({'role':_0x5577bc[_0x5e3def(0x243)],'content':_0x5577bc['content'],..._0x5577bc['tool_calls']?{'tool_calls':_0x5577bc['tool_calls']['length']}:{},..._0x5577bc[_0x5e3def(0x1c4)]?{'tool_call_id':_0x5577bc[_0x5e3def(0x1c4)]}:{}})),'request_content':{'query':_0x3e1cba['data'][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':_0x5e3def(0x264)}},'stack_trace':_0x41ce65?.['stack']||undefined,'source':_0x5e3def(0x23e)})['catch'](()=>{});}else _0x291421=_0x5e3def(0x218);}return{'content':[{'type':'text','text':_0x291421}]};}catch(_0x5e710e){const _0x59e9c4=handleMorphAPIError(_0x5e710e);if(_0x59e9c4)return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1e4),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb}),_0x59e9c4;const _0x4afad4=_0x5e710e instanceof Error?_0x5e710e[_0x5e3def(0x1b3)]:String(_0x5e710e);logger[_0x5e3def(0x25a)]('MCP',_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1e4),'error':_0x4afad4,'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb});const _0x50bfe7=_0x4afad4['toLowerCase']()[_0x5e3def(0x273)]('timeout')||_0x4afad4[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x2ac))||_0x4afad4[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x19e))||_0x5e710e instanceof Error&&_0x5e710e[_0x5e3def(0x265)]===_0x5e3def(0x2bf);return reportMorphError({'error_message':_0x4afad4,'error_type':_0x50bfe7?_0x5e3def(0x2bf):_0x5e710e instanceof Error?_0x5e710e[_0x5e3def(0x1e1)][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba['data'][_0x5e3def(0x274)],'query':_0x3e1cba['data']['search_string'],'model':_0x5e3def(0x264),'is_timeout':_0x50bfe7,'exception_phase':_0x5e3def(0x1d7),'request_content':{'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x5e710e instanceof Error?_0x5e710e['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':_0x5e3def(0x286),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x4afad4}],'isError':![]};}}case TOOL_NAMES[_0x5e3def(0x21c)]:{const _0x364373=WarpGrepGitHubArgsSchema[_0x5e3def(0x1ff)](_0x17d255);if(!_0x364373[_0x5e3def(0x1ba)])return{'content':[{'type':_0x5e3def(0x286),'text':'Invalid\x20arguments:\x20'+_0x364373[_0x5e3def(0x25a)]}],'isError':!![]};const _0x29a3e7=_0x364373['data'][_0x5e3def(0x232)]||_0x364373['data'][_0x5e3def(0x196)];if(!_0x29a3e7)return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x289)}],'isError':!![]};const _0x414d5a=MORPH_API_KEY;if(!_0x414d5a)throw new Error(_0x5e3def(0x29a));const _0x44d2e7=Date[_0x5e3def(0x2bd)]();logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x1fa),{'identifier':_0x29a3e7,'query':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'branch':_0x364373['data'][_0x5e3def(0x1eb)]});try{const _0x531bcf=new WarpGrepClient({'morphApiKey':_0x414d5a,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x20b161=await _0x531bcf[_0x5e3def(0x1ec)]({'searchTerm':_0x364373[_0x5e3def(0x2ba)]['search_string'],'github':_0x29a3e7,'branch':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x1eb)]}),_0x3cacdc=Date[_0x5e3def(0x2bd)]()-_0x44d2e7;logMcpStderr(_0x5e3def(0x245)+_0x3cacdc+'ms.\x20Success:\x20'+_0x20b161[_0x5e3def(0x1ba)]);const _0x578200=formatResult(_0x20b161);return{'content':[{'type':'text','text':_0x578200}]};}catch(_0x5193d6){const _0x283217=handleMorphAPIError(_0x5193d6);if(_0x283217)return _0x283217;const _0x1c92c4=Date[_0x5e3def(0x2bd)]()-_0x44d2e7,_0x41c5bc=_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x1b3)]:String(_0x5193d6);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x1c92c4+_0x5e3def(0x227),_0x41c5bc),reportMorphError({'error_message':_0x41c5bc,'error_type':_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x1e1)][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x5e3def(0x260),'github_url':_0x29a3e7,'search_string':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'branch':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x1eb)]},'stack_trace':_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x20e)]:undefined,'source':_0x5e3def(0x23e),'tool':_0x5e3def(0x260),'latency_ms':_0x1c92c4})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x2be)+_0x41c5bc}],'isError':![]};}}default:throw new Error(_0x5e3def(0x2c1)+_0x150814);}}catch(_0x38fb77){const _0x5975c8=_0x38fb77 instanceof Error?_0x38fb77[_0x5e3def(0x1b3)]:String(_0x38fb77);return reportMorphError({'error_message':_0x5975c8,'error_type':_0x38fb77 instanceof Error?_0x38fb77['constructor'][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x150814,'arguments':_0x17d255?JSON[_0x5e3def(0x28c)](_0x17d255)[_0x5e3def(0x2c0)](0x0,0x1f4):undefined,'mcp_server_version':_0x5e3def(0x2b9)},'stack_trace':_0x38fb77 instanceof Error?_0x38fb77['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':'text','text':_0x5e3def(0x1a0)+_0x5975c8}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x569828){const _0x34ea3b=a0_0x231f6c,_0x4c4568=await getValidRootDirectories(_0x569828);if(_0x4c4568[_0x34ea3b(0x217)]>0x0)allowedDirectories=[..._0x4c4568],logMcpStderr(_0x34ea3b(0x1d5)+_0x4c4568[_0x34ea3b(0x217)]+_0x34ea3b(0x1ee));else{logMcpStderr(_0x34ea3b(0x291));if(ENABLE_WORKSPACE_MODE)try{const _0x62e1f4=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x62e1f4&&(allowedDirectories=[_0x62e1f4],logMcpStderr(_0x34ea3b(0x28a)+_0x62e1f4));}catch(_0x5cabd2){logMcpStderr(_0x34ea3b(0x225)+_0x5cabd2);}}}server[a0_0x231f6c(0x24f)](RootsListChangedNotificationSchema,async()=>{const _0x1da150=a0_0x231f6c;try{const _0x1e72a8=await server[_0x1da150(0x229)]();_0x1e72a8&&'roots'in _0x1e72a8&&await updateAllowedDirectoriesFromRoots(_0x1e72a8['roots']);}catch(_0x10ae8e){logMcpStderr(_0x1da150(0x296),_0x10ae8e instanceof Error?_0x10ae8e[_0x1da150(0x1b3)]:String(_0x10ae8e));}}),server[a0_0x231f6c(0x1d8)]=async()=>{const _0x3fa1c2=a0_0x231f6c,_0x4e661a=server[_0x3fa1c2(0x281)]();if(_0x4e661a?.[_0x3fa1c2(0x272)])try{const _0x540d01=await server[_0x3fa1c2(0x229)]();_0x540d01&&_0x3fa1c2(0x272)in _0x540d01?await updateAllowedDirectoriesFromRoots(_0x540d01[_0x3fa1c2(0x272)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x1d088d){logMcpStderr(_0x3fa1c2(0x1ea),_0x1d088d instanceof Error?_0x1d088d[_0x3fa1c2(0x1b3)]:String(_0x1d088d));}else{if(allowedDirectories[_0x3fa1c2(0x217)]>0x0)logMcpStderr(_0x3fa1c2(0x1e6),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x3fa1c2(0x208));}}};async function runServer(){const _0x5aa2c4=a0_0x231f6c,_0x52bdab=new StdioServerTransport();await server['connect'](_0x52bdab),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x5aa2c4(0x217)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x220812=>{const _0x5414e6=a0_0x231f6c;logMcpStderr(_0x5414e6(0x1e0),_0x220812),process[_0x5414e6(0x27d)](0x1);}); |
@@ -1,1 +0,1 @@ | ||
| function a1_0x578c(){var _0x47f255=['Windows','MCP','macOS','error','Linux','darwin','10041241UyEkYN','length','[os=','Unknown','win32','981354wefEaC','info','909775oyibnZ','platform','3047535FTLbth','6964280TGRsef','24SYqeRf','1871917nzjBbE','map','5834634vHFpKw','3bREJbV'];a1_0x578c=function(){return _0x47f255;};return a1_0x578c();}var a1_0x1e6af9=a1_0x1f8c;(function(_0x4b7cb3,_0x2717d5){var _0x250058=a1_0x1f8c,_0x51c4e6=_0x4b7cb3();while(!![]){try{var _0x55e964=parseInt(_0x250058(0x1ce))/0x1+-parseInt(_0x250058(0x1dd))/0x2+parseInt(_0x250058(0x1d1))/0x3*(-parseInt(_0x250058(0x1cc))/0x4)+-parseInt(_0x250058(0x1c9))/0x5+-parseInt(_0x250058(0x1d0))/0x6+parseInt(_0x250058(0x1d8))/0x7+parseInt(_0x250058(0x1cd))/0x8*(parseInt(_0x250058(0x1cb))/0x9);if(_0x55e964===_0x2717d5)break;else _0x51c4e6['push'](_0x51c4e6['shift']());}catch(_0xffbff3){_0x51c4e6['push'](_0x51c4e6['shift']());}}}(a1_0x578c,0xe4894));function a1_0x1f8c(_0x372c44,_0x5e9e07){_0x372c44=_0x372c44-0x1c9;var _0x578cc8=a1_0x578c();var _0x1f8c94=_0x578cc8[_0x372c44];return _0x1f8c94;}import a1_0x3b0571 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x5a87a5=a1_0x3b0571[a1_0x1e6af9(0x1ca)]()){var _0x16766b=a1_0x1e6af9;switch(_0x5a87a5){case _0x16766b(0x1d7):return _0x16766b(0x1d4);case _0x16766b(0x1dc):return _0x16766b(0x1d2);case'linux':return _0x16766b(0x1d6);default:return _0x16766b(0x1db);}}export function formatMcpLogMessage(_0x30d31d,_0x4f494c=a1_0x3b0571[a1_0x1e6af9(0x1ca)]()){var _0x12d10a=a1_0x1e6af9;return _0x12d10a(0x1da)+getOperatingSystemType(_0x4f494c)+']\x20'+_0x30d31d;}export function logMcpStderr(_0x1ac1e4,..._0x67e285){var _0x47befa=a1_0x1e6af9;console[_0x47befa(0x1d5)](formatMcpLogMessage(_0x1ac1e4),..._0x67e285),logger[_0x47befa(0x1de)](_0x47befa(0x1d3),_0x1ac1e4,_0x67e285[_0x47befa(0x1d9)]?{'args':_0x67e285[_0x47befa(0x1cf)](_0x34fc2c=>String(_0x34fc2c))}:undefined);} | ||
| var a1_0x14162f=a1_0x9ec8;(function(_0x53e503,_0x103f9c){var _0x59187e=a1_0x9ec8,_0x1311ae=_0x53e503();while(!![]){try{var _0x38cccd=parseInt(_0x59187e(0x79))/0x1+parseInt(_0x59187e(0x74))/0x2+parseInt(_0x59187e(0x87))/0x3*(parseInt(_0x59187e(0x88))/0x4)+-parseInt(_0x59187e(0x85))/0x5+-parseInt(_0x59187e(0x7a))/0x6*(parseInt(_0x59187e(0x7b))/0x7)+-parseInt(_0x59187e(0x7c))/0x8*(-parseInt(_0x59187e(0x7e))/0x9)+-parseInt(_0x59187e(0x7d))/0xa*(parseInt(_0x59187e(0x77))/0xb);if(_0x38cccd===_0x103f9c)break;else _0x1311ae['push'](_0x1311ae['shift']());}catch(_0x384238){_0x1311ae['push'](_0x1311ae['shift']());}}}(a1_0x46dc,0x883dc));import a1_0x3ccd86 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0xcb0c92=a1_0x3ccd86[a1_0x14162f(0x86)]()){var _0x24dd3f=a1_0x14162f;switch(_0xcb0c92){case _0x24dd3f(0x7f):return _0x24dd3f(0x80);case'win32':return _0x24dd3f(0x78);case'linux':return _0x24dd3f(0x75);default:return _0x24dd3f(0x76);}}function a1_0x9ec8(_0x877ac5,_0x4980e6){_0x877ac5=_0x877ac5-0x73;var _0x46dc9b=a1_0x46dc();var _0x9ec87a=_0x46dc9b[_0x877ac5];return _0x9ec87a;}export function formatMcpLogMessage(_0x3794f2,_0x245a0d=a1_0x3ccd86['platform']()){var _0x50c657=a1_0x14162f;return _0x50c657(0x83)+getOperatingSystemType(_0x245a0d)+']\x20'+_0x3794f2;}function a1_0x46dc(){var _0x1c3cee=['538777cWZNNj','2441958rILkhM','7dpaIOE','345480kWtgFZ','6910jxiezx','153Adjsht','darwin','macOS','length','info','[os=','MCP','11330sVNvJS','platform','3YfoyIP','3465184RTTSXY','error','834770yDCqKV','Linux','Unknown','25300AYejpk','Windows'];a1_0x46dc=function(){return _0x1c3cee;};return a1_0x46dc();}export function logMcpStderr(_0x95e4fd,..._0x5b9036){var _0xa0ec25=a1_0x14162f;console[_0xa0ec25(0x73)](formatMcpLogMessage(_0x95e4fd),..._0x5b9036),logger[_0xa0ec25(0x82)](_0xa0ec25(0x84),_0x95e4fd,_0x5b9036[_0xa0ec25(0x81)]?{'args':_0x5b9036['map'](_0x30bb23=>String(_0x30bb23))}:undefined);} |
+1
-1
@@ -1,1 +0,1 @@ | ||
| function a2_0x1056(_0x4bf09d,_0x19c689){_0x4bf09d=_0x4bf09d-0x1b6;const _0x584d6a=a2_0x584d();let _0x10560d=_0x584d6a[_0x4bf09d];return _0x10560d;}const a2_0x301809=a2_0x1056;(function(_0x56e816,_0x509184){const _0x5435e7=a2_0x1056,_0x5aafdb=_0x56e816();while(!![]){try{const _0x5f0a79=-parseInt(_0x5435e7(0x1c9))/0x1+parseInt(_0x5435e7(0x1c5))/0x2+-parseInt(_0x5435e7(0x1b8))/0x3+parseInt(_0x5435e7(0x1b6))/0x4+parseInt(_0x5435e7(0x1bd))/0x5*(parseInt(_0x5435e7(0x1b9))/0x6)+parseInt(_0x5435e7(0x1c3))/0x7*(-parseInt(_0x5435e7(0x1bf))/0x8)+parseInt(_0x5435e7(0x1c7))/0x9;if(_0x5f0a79===_0x509184)break;else _0x5aafdb['push'](_0x5aafdb['shift']());}catch(_0x12ee37){_0x5aafdb['push'](_0x5aafdb['shift']());}}}(a2_0x584d,0x78178));import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x301809(0x1c2)];constructor(){const _0x1e8dec=a2_0x301809;this[_0x1e8dec(0x1bc)]=process[_0x1e8dec(0x1c0)]['MORPH_DEBUG']==='1'||!!process[_0x1e8dec(0x1c0)][_0x1e8dec(0x1cd)];const _0x213431=process[_0x1e8dec(0x1c0)]['MORPH_LOG_FILE'];this[_0x1e8dec(0x1c2)]=_0x213431?createWriteStream(_0x213431,{'flags':'a'}):null;}[a2_0x301809(0x1ca)](_0x5459d1,_0x2dad74,_0x474f95){const _0x3ab30d=a2_0x301809;this[_0x3ab30d(0x1ba)](_0x3ab30d(0x1ca),_0x5459d1,_0x2dad74,_0x474f95);}[a2_0x301809(0x1cb)](_0x4b25f1,_0x3cccbf,_0x20e914){const _0x2277ba=a2_0x301809;this[_0x2277ba(0x1ba)]('info',_0x4b25f1,_0x3cccbf,_0x20e914);}[a2_0x301809(0x1c1)](_0x548a59,_0x309a89,_0x483bbf){const _0x2223fd=a2_0x301809;this[_0x2223fd(0x1ba)]('warn',_0x548a59,_0x309a89,_0x483bbf);}[a2_0x301809(0x1bb)](_0x43962d,_0x312de8,_0xb256f9){const _0xe394c2=a2_0x301809;this[_0xe394c2(0x1ba)]('error',_0x43962d,_0x312de8,_0xb256f9);}[a2_0x301809(0x1c6)](){const _0xee4b69=a2_0x301809;this[_0xee4b69(0x1bc)]=!![];}get[a2_0x301809(0x1be)](){const _0x448eaf=a2_0x301809;return this[_0x448eaf(0x1bc)];}['_log'](_0x49fd78,_0x4d7990,_0x1b704a,_0x4c5344){const _0x167110=a2_0x301809;if(_0x49fd78!==_0x167110(0x1bb)&&!this['enabled'])return;const _0x2fbbda=new Date()[_0x167110(0x1c4)](),_0x3c0f13='['+_0x2fbbda+_0x167110(0x1cc)+_0x49fd78['toUpperCase']()+_0x167110(0x1cc)+_0x4d7990+']';console['error'](_0x4c5344?_0x3c0f13+'\x20'+_0x1b704a+'\x20'+JSON[_0x167110(0x1c8)](_0x4c5344):_0x3c0f13+'\x20'+_0x1b704a),this['fileStream']?.[_0x167110(0x1b7)](JSON[_0x167110(0x1c8)]({'ts':_0x2fbbda,'level':_0x49fd78,'component':_0x4d7990,'msg':_0x1b704a,..._0x4c5344&&{'data':_0x4c5344}})+'\x0a');}}function a2_0x584d(){const _0x496d9e=['warn','fileStream','28aZYmCB','toISOString','1608716uIImdj','enable','3461895tOYCoN','stringify','854074nCSzQN','debug','info',']\x20[','MORPH_LOG_FILE','3334648hwSBBS','write','876066SBioHe','6njfvhh','_log','error','enabled','1626605EMeNXZ','isEnabled','1420008hdJhHw','env'];a2_0x584d=function(){return _0x496d9e;};return a2_0x584d();}export const logger=new MorphLogger(); | ||
| function a2_0x14ef(){const _0x2a2494=['1WTSDqT','63NSPhEB','toUpperCase','error','6928OhQDaN','4298UTmsuW','isEnabled','1941366xfuHgU',']\x20[','enable','stringify','env','24047716cmyffe','834550ZTHxTp','enabled','debug','fileStream','3118095TbIoge','warn','12brxwqT','_log','1154434bjDeGr','MORPH_LOG_FILE','MORPH_DEBUG','write','508884HjSCGe','info'];a2_0x14ef=function(){return _0x2a2494;};return a2_0x14ef();}const a2_0x412cae=a2_0x54fd;(function(_0x5678b3,_0x3540d8){const _0x517885=a2_0x54fd,_0x9d9109=_0x5678b3();while(!![]){try{const _0x3dbc8b=parseInt(_0x517885(0xb8))/0x1*(parseInt(_0x517885(0xb2))/0x2)+parseInt(_0x517885(0xb0))/0x3*(parseInt(_0x517885(0xb6))/0x4)+parseInt(_0x517885(0xae))/0x5+-parseInt(_0x517885(0xbf))/0x6+-parseInt(_0x517885(0xbd))/0x7*(-parseInt(_0x517885(0xbc))/0x8)+-parseInt(_0x517885(0xb9))/0x9*(-parseInt(_0x517885(0xaa))/0xa)+-parseInt(_0x517885(0xc4))/0xb;if(_0x3dbc8b===_0x3540d8)break;else _0x9d9109['push'](_0x9d9109['shift']());}catch(_0x28e704){_0x9d9109['push'](_0x9d9109['shift']());}}}(a2_0x14ef,0x4d208));import{createWriteStream}from'fs';function a2_0x54fd(_0x37b61f,_0x34a80b){_0x37b61f=_0x37b61f-0xaa;const _0x14ef34=a2_0x14ef();let _0x54fdfc=_0x14ef34[_0x37b61f];return _0x54fdfc;}class MorphLogger{[a2_0x412cae(0xab)];['fileStream'];constructor(){const _0xda4fa3=a2_0x412cae;this[_0xda4fa3(0xab)]=process[_0xda4fa3(0xc3)][_0xda4fa3(0xb4)]==='1'||!!process[_0xda4fa3(0xc3)][_0xda4fa3(0xb3)];const _0x2f3e05=process[_0xda4fa3(0xc3)][_0xda4fa3(0xb3)];this[_0xda4fa3(0xad)]=_0x2f3e05?createWriteStream(_0x2f3e05,{'flags':'a'}):null;}['debug'](_0x3b90d6,_0x3eae38,_0xb44cb8){const _0x578af7=a2_0x412cae;this[_0x578af7(0xb1)](_0x578af7(0xac),_0x3b90d6,_0x3eae38,_0xb44cb8);}[a2_0x412cae(0xb7)](_0x2cae50,_0x11b4aa,_0x3045ef){const _0x2504d=a2_0x412cae;this['_log'](_0x2504d(0xb7),_0x2cae50,_0x11b4aa,_0x3045ef);}[a2_0x412cae(0xaf)](_0x55407d,_0x20fcef,_0x45bd8e){const _0xf712c5=a2_0x412cae;this['_log'](_0xf712c5(0xaf),_0x55407d,_0x20fcef,_0x45bd8e);}[a2_0x412cae(0xbb)](_0x211ebd,_0xb6564f,_0x152ced){const _0x480e72=a2_0x412cae;this[_0x480e72(0xb1)](_0x480e72(0xbb),_0x211ebd,_0xb6564f,_0x152ced);}[a2_0x412cae(0xc1)](){const _0x1fa57c=a2_0x412cae;this[_0x1fa57c(0xab)]=!![];}get[a2_0x412cae(0xbe)](){return this['enabled'];}[a2_0x412cae(0xb1)](_0x5f0756,_0x4c3fe9,_0x5e742a,_0x472ac9){const _0x2ac966=a2_0x412cae;if(_0x5f0756!=='error'&&!this[_0x2ac966(0xab)])return;const _0x4484ef=new Date()['toISOString'](),_0x21bb51='['+_0x4484ef+_0x2ac966(0xc0)+_0x5f0756[_0x2ac966(0xba)]()+_0x2ac966(0xc0)+_0x4c3fe9+']';console[_0x2ac966(0xbb)](_0x472ac9?_0x21bb51+'\x20'+_0x5e742a+'\x20'+JSON[_0x2ac966(0xc2)](_0x472ac9):_0x21bb51+'\x20'+_0x5e742a),this[_0x2ac966(0xad)]?.[_0x2ac966(0xb5)](JSON[_0x2ac966(0xc2)]({'ts':_0x4484ef,'level':_0x5f0756,'component':_0x4c3fe9,'msg':_0x5e742a,..._0x472ac9&&{'data':_0x472ac9}})+'\x0a');}}export const logger=new MorphLogger(); |
@@ -1,1 +0,1 @@ | ||
| (function(_0x49c7a2,_0x373e80){const _0x334fba=a3_0x2f95,_0x367dc5=_0x49c7a2();while(!![]){try{const _0x4181ca=parseInt(_0x334fba(0x95))/0x1*(parseInt(_0x334fba(0x94))/0x2)+-parseInt(_0x334fba(0xa4))/0x3*(parseInt(_0x334fba(0x98))/0x4)+parseInt(_0x334fba(0xa1))/0x5+-parseInt(_0x334fba(0x9d))/0x6*(-parseInt(_0x334fba(0x9c))/0x7)+parseInt(_0x334fba(0xa5))/0x8+-parseInt(_0x334fba(0x92))/0x9*(-parseInt(_0x334fba(0x9e))/0xa)+-parseInt(_0x334fba(0xa3))/0xb;if(_0x4181ca===_0x373e80)break;else _0x367dc5['push'](_0x367dc5['shift']());}catch(_0x3730e9){_0x367dc5['push'](_0x367dc5['shift']());}}}(a3_0x4140,0x99a30));import a3_0x30bcad from'path';import a3_0x310f09 from'os';function a3_0x4140(){const _0x37d8d3=['trim','34228ZOtvFW','charAt','substring','normalize','77yjyZBp','633522sGhyuR','327310tjQLqe','replace','join','287035EFtuss','toUpperCase','18017681BzsIpZ','168dyyLwP','2069040QTwIol','slice','match','/mnt/','234CpvVJY','test','2YkcSOh','417959YDETUQ','startsWith'];a3_0x4140=function(){return _0x37d8d3;};return a3_0x4140();}export function convertToWindowsPath(_0x34f729){const _0x317181=a3_0x2f95;if(_0x34f729['startsWith'](_0x317181(0x91))){const _0x2d8834=_0x34f729[_0x317181(0x99)](0x5)[_0x317181(0xa2)](),_0x1682b1=_0x34f729[_0x317181(0x8f)](0x6)[_0x317181(0x9f)](/\//g,'\x5c');return _0x2d8834+':'+_0x1682b1;}if(_0x34f729[_0x317181(0x90)](/^\/[a-zA-Z]\//)){const _0x536469=_0x34f729[_0x317181(0x99)](0x1)['toUpperCase'](),_0x36d374=_0x34f729['slice'](0x2)[_0x317181(0x9f)](/\//g,'\x5c');return _0x536469+':'+_0x36d374;}if(_0x34f729[_0x317181(0x90)](/^[a-zA-Z]:/))return _0x34f729[_0x317181(0x9f)](/\//g,'\x5c');return _0x34f729;}export function normalizePath(_0x29f9d3){const _0x2585b8=a3_0x2f95;_0x29f9d3=_0x29f9d3[_0x2585b8(0x97)]()[_0x2585b8(0x9f)](/^["']|["']$/g,'');const _0x53d920=_0x29f9d3['startsWith']('/')&&!_0x29f9d3[_0x2585b8(0x90)](/^\/mnt\/[a-z]\//i)&&!_0x29f9d3[_0x2585b8(0x90)](/^\/[a-zA-Z]\//);if(_0x53d920)return _0x29f9d3['replace'](/\/+/g,'/')[_0x2585b8(0x9f)](/\/+$/,'');_0x29f9d3=convertToWindowsPath(_0x29f9d3);if(_0x29f9d3[_0x2585b8(0x96)]('\x5c\x5c')){let _0x363f77=_0x29f9d3;_0x363f77=_0x363f77['replace'](/^\\{2,}/,'\x5c\x5c');const _0x174657=_0x363f77[_0x2585b8(0x9a)](0x2)[_0x2585b8(0x9f)](/\\\\/g,'\x5c');_0x29f9d3='\x5c\x5c'+_0x174657;}else _0x29f9d3=_0x29f9d3[_0x2585b8(0x9f)](/\\\\/g,'\x5c');let _0x3cc2dc=a3_0x30bcad[_0x2585b8(0x9b)](_0x29f9d3);_0x29f9d3[_0x2585b8(0x96)]('\x5c\x5c')&&!_0x3cc2dc[_0x2585b8(0x96)]('\x5c\x5c')&&(_0x3cc2dc='\x5c'+_0x3cc2dc);if(_0x3cc2dc[_0x2585b8(0x90)](/^[a-zA-Z]:/)){let _0x1e08df=_0x3cc2dc[_0x2585b8(0x9f)](/\//g,'\x5c');return/^[a-z]:/[_0x2585b8(0x93)](_0x1e08df)&&(_0x1e08df=_0x1e08df[_0x2585b8(0x99)](0x0)[_0x2585b8(0xa2)]()+_0x1e08df[_0x2585b8(0x8f)](0x1)),_0x1e08df;}return _0x3cc2dc[_0x2585b8(0x9f)](/\//g,'\x5c');}function a3_0x2f95(_0x267eda,_0x593058){_0x267eda=_0x267eda-0x8f;const _0x414053=a3_0x4140();let _0x2f9571=_0x414053[_0x267eda];return _0x2f9571;}export function expandHome(_0x14cc54){const _0x35aedc=a3_0x2f95;if(_0x14cc54[_0x35aedc(0x96)]('~/')||_0x14cc54==='~')return a3_0x30bcad[_0x35aedc(0xa0)](a3_0x310f09['homedir'](),_0x14cc54['slice'](0x1));return _0x14cc54;} | ||
| (function(_0x15a3fd,_0x1aa299){const _0x296ac5=a3_0x3639,_0x197a93=_0x15a3fd();while(!![]){try{const _0x258abe=-parseInt(_0x296ac5(0x6f))/0x1+parseInt(_0x296ac5(0x73))/0x2*(-parseInt(_0x296ac5(0x6b))/0x3)+-parseInt(_0x296ac5(0x6c))/0x4*(-parseInt(_0x296ac5(0x78))/0x5)+parseInt(_0x296ac5(0x66))/0x6*(-parseInt(_0x296ac5(0x65))/0x7)+-parseInt(_0x296ac5(0x75))/0x8+parseInt(_0x296ac5(0x69))/0x9*(parseInt(_0x296ac5(0x70))/0xa)+parseInt(_0x296ac5(0x72))/0xb;if(_0x258abe===_0x1aa299)break;else _0x197a93['push'](_0x197a93['shift']());}catch(_0x387153){_0x197a93['push'](_0x197a93['shift']());}}}(a3_0x45fe,0x5dbb2));function a3_0x3639(_0x29c628,_0x1517dc){_0x29c628=_0x29c628-0x64;const _0x45fed9=a3_0x45fe();let _0x363925=_0x45fed9[_0x29c628];return _0x363925;}import a3_0x51aee4 from'path';import a3_0x469a8c from'os';export function convertToWindowsPath(_0x28e1e6){const _0x359f2b=a3_0x3639;if(_0x28e1e6['startsWith'](_0x359f2b(0x64))){const _0x3d06e=_0x28e1e6[_0x359f2b(0x74)](0x5)[_0x359f2b(0x67)](),_0x18f1cc=_0x28e1e6[_0x359f2b(0x71)](0x6)[_0x359f2b(0x68)](/\//g,'\x5c');return _0x3d06e+':'+_0x18f1cc;}if(_0x28e1e6[_0x359f2b(0x77)](/^\/[a-zA-Z]\//)){const _0x93cb02=_0x28e1e6[_0x359f2b(0x74)](0x1)['toUpperCase'](),_0x4354c5=_0x28e1e6[_0x359f2b(0x71)](0x2)['replace'](/\//g,'\x5c');return _0x93cb02+':'+_0x4354c5;}if(_0x28e1e6[_0x359f2b(0x77)](/^[a-zA-Z]:/))return _0x28e1e6[_0x359f2b(0x68)](/\//g,'\x5c');return _0x28e1e6;}export function normalizePath(_0x24f235){const _0x4b1c37=a3_0x3639;_0x24f235=_0x24f235[_0x4b1c37(0x76)]()[_0x4b1c37(0x68)](/^["']|["']$/g,'');const _0x51aa4c=_0x24f235['startsWith']('/')&&!_0x24f235[_0x4b1c37(0x77)](/^\/mnt\/[a-z]\//i)&&!_0x24f235[_0x4b1c37(0x77)](/^\/[a-zA-Z]\//);if(_0x51aa4c)return _0x24f235['replace'](/\/+/g,'/')[_0x4b1c37(0x68)](/\/+$/,'');_0x24f235=convertToWindowsPath(_0x24f235);if(_0x24f235[_0x4b1c37(0x6d)]('\x5c\x5c')){let _0x135fee=_0x24f235;_0x135fee=_0x135fee[_0x4b1c37(0x68)](/^\\{2,}/,'\x5c\x5c');const _0xd4c412=_0x135fee[_0x4b1c37(0x79)](0x2)[_0x4b1c37(0x68)](/\\\\/g,'\x5c');_0x24f235='\x5c\x5c'+_0xd4c412;}else _0x24f235=_0x24f235[_0x4b1c37(0x68)](/\\\\/g,'\x5c');let _0x11272f=a3_0x51aee4['normalize'](_0x24f235);_0x24f235[_0x4b1c37(0x6d)]('\x5c\x5c')&&!_0x11272f[_0x4b1c37(0x6d)]('\x5c\x5c')&&(_0x11272f='\x5c'+_0x11272f);if(_0x11272f[_0x4b1c37(0x77)](/^[a-zA-Z]:/)){let _0x922950=_0x11272f['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x4b1c37(0x6e)](_0x922950)&&(_0x922950=_0x922950[_0x4b1c37(0x74)](0x0)['toUpperCase']()+_0x922950[_0x4b1c37(0x71)](0x1)),_0x922950;}return _0x11272f['replace'](/\//g,'\x5c');}export function expandHome(_0x5dca1d){const _0x279e61=a3_0x3639;if(_0x5dca1d[_0x279e61(0x6d)]('~/')||_0x5dca1d==='~')return a3_0x51aee4[_0x279e61(0x6a)](a3_0x469a8c['homedir'](),_0x5dca1d[_0x279e61(0x71)](0x1));return _0x5dca1d;}function a3_0x45fe(){const _0x166f4f=['charAt','734464KELybu','trim','match','5nmnBWq','substring','/mnt/','336MfbiwS','65424GJliwU','toUpperCase','replace','9qsRMjN','join','844161AURwki','616876agxReA','startsWith','test','317294ILiIau','2739650KNfDiw','slice','12865809wIUnWO','2OhFVZw'];a3_0x45fe=function(){return _0x166f4f;};return a3_0x45fe();} |
@@ -1,1 +0,1 @@ | ||
| function a4_0x5bb1(_0x3f1cec,_0x5ae989){_0x3f1cec=_0x3f1cec-0x172;const _0x1a6ef9=a4_0x1a6e();let _0x5bb19b=_0x1a6ef9[_0x3f1cec];return _0x5bb19b;}function a4_0x1a6e(){const _0xdd1e01=['3859332wMDHTQ','resolve','length','isArray','10356750krbdqb','normalize','5PIEoxl','2671240NbxXJf','1SHTlaT','12mypODb','8HzNmtz','isAbsolute','1848690IfWkHe','sep','12101663mKaLLE','529786YqxCqY','Path\x20must\x20be\x20absolute\x20after\x20normalization','string','includes','6yMSlFn','startsWith','14179407tdGneo'];a4_0x1a6e=function(){return _0xdd1e01;};return a4_0x1a6e();}(function(_0x3ef8e7,_0x25778c){const _0x4b26e7=a4_0x5bb1,_0x426306=_0x3ef8e7();while(!![]){try{const _0x3422f6=-parseInt(_0x4b26e7(0x175))/0x1*(parseInt(_0x4b26e7(0x17c))/0x2)+-parseInt(_0x4b26e7(0x180))/0x3*(-parseInt(_0x4b26e7(0x174))/0x4)+parseInt(_0x4b26e7(0x173))/0x5*(parseInt(_0x4b26e7(0x183))/0x6)+-parseInt(_0x4b26e7(0x17b))/0x7*(-parseInt(_0x4b26e7(0x177))/0x8)+-parseInt(_0x4b26e7(0x179))/0x9+-parseInt(_0x4b26e7(0x187))/0xa+parseInt(_0x4b26e7(0x182))/0xb*(-parseInt(_0x4b26e7(0x176))/0xc);if(_0x3422f6===_0x25778c)break;else _0x426306['push'](_0x426306['shift']());}catch(_0x2bd9bf){_0x426306['push'](_0x426306['shift']());}}}(a4_0x1a6e,0xdecfc));import a4_0x53edf1 from'path';export function isPathWithinAllowedDirectories(_0x230f73,_0x219218){const _0x190a46=a4_0x5bb1;if(typeof _0x230f73!==_0x190a46(0x17e)||!Array[_0x190a46(0x186)](_0x219218))return![];if(!_0x230f73||_0x219218[_0x190a46(0x185)]===0x0)return![];if(_0x230f73[_0x190a46(0x17f)]('\x00'))return![];let _0x46b1ac;try{_0x46b1ac=a4_0x53edf1[_0x190a46(0x184)](a4_0x53edf1[_0x190a46(0x172)](_0x230f73));}catch{return![];}if(!a4_0x53edf1[_0x190a46(0x178)](_0x46b1ac))throw new Error(_0x190a46(0x17d));return _0x219218['some'](_0x1d02ab=>{const _0x125ddd=_0x190a46;if(typeof _0x1d02ab!==_0x125ddd(0x17e)||!_0x1d02ab)return![];if(_0x1d02ab[_0x125ddd(0x17f)]('\x00'))return![];let _0xf6324e;try{_0xf6324e=a4_0x53edf1[_0x125ddd(0x184)](a4_0x53edf1['normalize'](_0x1d02ab));}catch{return![];}if(!a4_0x53edf1[_0x125ddd(0x178)](_0xf6324e))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x46b1ac===_0xf6324e)return!![];if(_0xf6324e===a4_0x53edf1[_0x125ddd(0x17a)])return _0x46b1ac[_0x125ddd(0x181)](a4_0x53edf1[_0x125ddd(0x17a)]);return _0x46b1ac['startsWith'](_0xf6324e+a4_0x53edf1[_0x125ddd(0x17a)]);});} | ||
| (function(_0xc56a2c,_0x5c1286){const _0x3e0e7b=a4_0x3ace,_0x278a9f=_0xc56a2c();while(!![]){try{const _0x19a658=parseInt(_0x3e0e7b(0x127))/0x1+-parseInt(_0x3e0e7b(0x121))/0x2+-parseInt(_0x3e0e7b(0x12a))/0x3+-parseInt(_0x3e0e7b(0x124))/0x4+-parseInt(_0x3e0e7b(0x128))/0x5+-parseInt(_0x3e0e7b(0x12f))/0x6+parseInt(_0x3e0e7b(0x12c))/0x7*(parseInt(_0x3e0e7b(0x125))/0x8);if(_0x19a658===_0x5c1286)break;else _0x278a9f['push'](_0x278a9f['shift']());}catch(_0x4c3a05){_0x278a9f['push'](_0x278a9f['shift']());}}}(a4_0x33b2,0xd83c6));function a4_0x3ace(_0x24d1d1,_0x4621e3){_0x24d1d1=_0x24d1d1-0x11e;const _0x33b201=a4_0x33b2();let _0x3ace13=_0x33b201[_0x24d1d1];return _0x3ace13;}import a4_0x4a1cd4 from'path';function a4_0x33b2(){const _0x487d5c=['startsWith','includes','594452CSPuHz','40adDFeE','isArray','1262292jMDBEn','3119855ivWbWZ','Path\x20must\x20be\x20absolute\x20after\x20normalization','2529699XydWlh','resolve','3616991urihlN','some','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1889034eluZJZ','isAbsolute','sep','length','normalize','string','2058998XcIjTy'];a4_0x33b2=function(){return _0x487d5c;};return a4_0x33b2();}export function isPathWithinAllowedDirectories(_0x4ad033,_0x2b604a){const _0xaa7a=a4_0x3ace;if(typeof _0x4ad033!==_0xaa7a(0x120)||!Array[_0xaa7a(0x126)](_0x2b604a))return![];if(!_0x4ad033||_0x2b604a[_0xaa7a(0x11e)]===0x0)return![];if(_0x4ad033[_0xaa7a(0x123)]('\x00'))return![];let _0x1ecb5e;try{_0x1ecb5e=a4_0x4a1cd4[_0xaa7a(0x12b)](a4_0x4a1cd4[_0xaa7a(0x11f)](_0x4ad033));}catch{return![];}if(!a4_0x4a1cd4[_0xaa7a(0x130)](_0x1ecb5e))throw new Error(_0xaa7a(0x129));return _0x2b604a[_0xaa7a(0x12d)](_0x21179b=>{const _0x57f04e=_0xaa7a;if(typeof _0x21179b!==_0x57f04e(0x120)||!_0x21179b)return![];if(_0x21179b[_0x57f04e(0x123)]('\x00'))return![];let _0x3968f2;try{_0x3968f2=a4_0x4a1cd4[_0x57f04e(0x12b)](a4_0x4a1cd4['normalize'](_0x21179b));}catch{return![];}if(!a4_0x4a1cd4[_0x57f04e(0x130)](_0x3968f2))throw new Error(_0x57f04e(0x12e));if(_0x1ecb5e===_0x3968f2)return!![];if(_0x3968f2===a4_0x4a1cd4['sep'])return _0x1ecb5e[_0x57f04e(0x122)](a4_0x4a1cd4[_0x57f04e(0x131)]);return _0x1ecb5e[_0x57f04e(0x122)](_0x3968f2+a4_0x4a1cd4[_0x57f04e(0x131)]);});} |
@@ -1,1 +0,1 @@ | ||
| (function(_0x22b1d5,_0x10406b){const _0x56993e=a5_0xe19c,_0xca8bf2=_0x22b1d5();while(!![]){try{const _0x2b92fd=-parseInt(_0x56993e(0x1a1))/0x1*(-parseInt(_0x56993e(0x193))/0x2)+-parseInt(_0x56993e(0x197))/0x3*(parseInt(_0x56993e(0x18f))/0x4)+parseInt(_0x56993e(0x19d))/0x5*(parseInt(_0x56993e(0x19c))/0x6)+parseInt(_0x56993e(0x1a5))/0x7*(parseInt(_0x56993e(0x19f))/0x8)+parseInt(_0x56993e(0x19e))/0x9+parseInt(_0x56993e(0x1a8))/0xa*(-parseInt(_0x56993e(0x190))/0xb)+-parseInt(_0x56993e(0x19b))/0xc;if(_0x2b92fd===_0x10406b)break;else _0xca8bf2['push'](_0xca8bf2['shift']());}catch(_0x3a38d5){_0xca8bf2['push'](_0xca8bf2['shift']());}}}(a5_0x457a,0xcbafd));import{promises as a5_0x62b470}from'fs';import a5_0x357a98 from'path';import a5_0x19a7da from'os';import{normalizePath}from'./path-utils.js';function a5_0x457a(){const _0x3495a6=['429BLBqEP','slice','homedir','2JcHDiK','invalid\x20path\x20or\x20inaccessible','push','\x20due\x20to\x20error:\x20','8805oTDohc','join','stat','uri','27605940gxvVrQ','6foCDon','4827245fDSJbs','14940981JdeJPG','402104CRFoaU','message','1337129wwzgWG','non-directory\x20root','file://','resolve','203dhWNgz','realpath','isDirectory','377570XyfDfU','Skipping\x20invalid\x20directory:\x20','1108IxxEzM'];a5_0x457a=function(){return _0x3495a6;};return a5_0x457a();}import{logMcpStderr}from'./log-utils.js';function a5_0xe19c(_0x22983f,_0x41c1d0){_0x22983f=_0x22983f-0x18f;const _0x457a67=a5_0x457a();let _0xe19cfb=_0x457a67[_0x22983f];return _0xe19cfb;}async function parseRootUri(_0x499842){const _0x5ab305=a5_0xe19c;try{const _0x2d732e=_0x499842['startsWith'](_0x5ab305(0x1a3))?_0x499842[_0x5ab305(0x191)](0x7):_0x499842,_0x1b2f60=_0x2d732e['startsWith']('~/')||_0x2d732e==='~'?a5_0x357a98[_0x5ab305(0x198)](a5_0x19a7da[_0x5ab305(0x192)](),_0x2d732e['slice'](0x1)):_0x2d732e,_0x287222=a5_0x357a98[_0x5ab305(0x1a4)](_0x1b2f60),_0x3c1056=await a5_0x62b470[_0x5ab305(0x1a6)](_0x287222);return normalizePath(_0x3c1056);}catch{return null;}}function formatDirectoryError(_0x71924,_0x4450a9,_0xaa30f2){const _0x4ef01e=a5_0xe19c;if(_0xaa30f2)return'Skipping\x20'+_0xaa30f2+':\x20'+_0x71924;const _0x273ad9=_0x4450a9 instanceof Error?_0x4450a9[_0x4ef01e(0x1a0)]:String(_0x4450a9);return _0x4ef01e(0x1a9)+_0x71924+_0x4ef01e(0x196)+_0x273ad9;}export async function getValidRootDirectories(_0x590122){const _0x37337d=a5_0xe19c,_0x49bb02=[];for(const _0x578a56 of _0x590122){const _0x382701=await parseRootUri(_0x578a56[_0x37337d(0x19a)]);if(!_0x382701){logMcpStderr(formatDirectoryError(_0x578a56[_0x37337d(0x19a)],undefined,_0x37337d(0x194)));continue;}try{const _0x2bb7fb=await a5_0x62b470[_0x37337d(0x199)](_0x382701);_0x2bb7fb[_0x37337d(0x1a7)]()?_0x49bb02[_0x37337d(0x195)](_0x382701):logMcpStderr(formatDirectoryError(_0x382701,undefined,_0x37337d(0x1a2)));}catch(_0x4f0296){logMcpStderr(formatDirectoryError(_0x382701,_0x4f0296));}}return _0x49bb02;} | ||
| (function(_0x4783da,_0x1c4ed2){const _0x22c928=a5_0x5dbf,_0x7a3cd6=_0x4783da();while(!![]){try{const _0x380c09=parseInt(_0x22c928(0x98))/0x1*(parseInt(_0x22c928(0x9b))/0x2)+parseInt(_0x22c928(0x91))/0x3*(-parseInt(_0x22c928(0x8c))/0x4)+parseInt(_0x22c928(0xa0))/0x5*(-parseInt(_0x22c928(0x93))/0x6)+parseInt(_0x22c928(0x9c))/0x7*(parseInt(_0x22c928(0x9a))/0x8)+parseInt(_0x22c928(0x9f))/0x9+parseInt(_0x22c928(0x94))/0xa*(-parseInt(_0x22c928(0x96))/0xb)+-parseInt(_0x22c928(0xa1))/0xc;if(_0x380c09===_0x1c4ed2)break;else _0x7a3cd6['push'](_0x7a3cd6['shift']());}catch(_0x3c984d){_0x7a3cd6['push'](_0x7a3cd6['shift']());}}}(a5_0x2f6f,0xe04ec));import{promises as a5_0x2cf053}from'fs';function a5_0x5dbf(_0x37464c,_0x3fe048){_0x37464c=_0x37464c-0x8a;const _0x2f6f4c=a5_0x2f6f();let _0x5dbf39=_0x2f6f4c[_0x37464c];return _0x5dbf39;}import a5_0x38ed9d from'path';function a5_0x2f6f(){const _0x4a6357=['2064PvVVuj','2gHkgEH','43393JDjivf','resolve','isDirectory','13859154MvZvzX','20bTUcGO','14778348NWapwF','realpath','Skipping\x20invalid\x20directory:\x20','invalid\x20path\x20or\x20inaccessible','stat','3520lzGMzk','slice','push','uri','join','1041QiAeim','message','1694724JLspox','310CtCsHu','startsWith','78298fbHIwH','Skipping\x20','666879YcdZqi','file://'];a5_0x2f6f=function(){return _0x4a6357;};return a5_0x2f6f();}import a5_0x262723 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x6ef63d){const _0x3c86b4=a5_0x5dbf;try{const _0x1b6a0a=_0x6ef63d[_0x3c86b4(0x95)](_0x3c86b4(0x99))?_0x6ef63d['slice'](0x7):_0x6ef63d,_0x4c48d4=_0x1b6a0a[_0x3c86b4(0x95)]('~/')||_0x1b6a0a==='~'?a5_0x38ed9d[_0x3c86b4(0x90)](a5_0x262723['homedir'](),_0x1b6a0a[_0x3c86b4(0x8d)](0x1)):_0x1b6a0a,_0xda8079=a5_0x38ed9d[_0x3c86b4(0x9d)](_0x4c48d4),_0x595796=await a5_0x2cf053[_0x3c86b4(0xa2)](_0xda8079);return normalizePath(_0x595796);}catch{return null;}}function formatDirectoryError(_0x113101,_0x522bb0,_0x3e93cc){const _0x44d2a3=a5_0x5dbf;if(_0x3e93cc)return _0x44d2a3(0x97)+_0x3e93cc+':\x20'+_0x113101;const _0x919858=_0x522bb0 instanceof Error?_0x522bb0[_0x44d2a3(0x92)]:String(_0x522bb0);return _0x44d2a3(0xa3)+_0x113101+'\x20due\x20to\x20error:\x20'+_0x919858;}export async function getValidRootDirectories(_0x400539){const _0x1545d=a5_0x5dbf,_0x4e0063=[];for(const _0x4345c7 of _0x400539){const _0x50d16c=await parseRootUri(_0x4345c7['uri']);if(!_0x50d16c){logMcpStderr(formatDirectoryError(_0x4345c7[_0x1545d(0x8f)],undefined,_0x1545d(0x8a)));continue;}try{const _0x4e5ca6=await a5_0x2cf053[_0x1545d(0x8b)](_0x50d16c);_0x4e5ca6[_0x1545d(0x9e)]()?_0x4e0063[_0x1545d(0x8e)](_0x50d16c):logMcpStderr(formatDirectoryError(_0x50d16c,undefined,'non-directory\x20root'));}catch(_0x1ac2bd){logMcpStderr(formatDirectoryError(_0x50d16c,_0x1ac2bd));}}return _0x4e0063;} |
@@ -1,1 +0,1 @@ | ||
| const a6_0x1c0466=a6_0x2a27;(function(_0x267915,_0x30affc){const _0x52d55c=a6_0x2a27,_0x5011b6=_0x267915();while(!![]){try{const _0x894ddd=parseInt(_0x52d55c(0x175))/0x1+-parseInt(_0x52d55c(0x173))/0x2*(parseInt(_0x52d55c(0x177))/0x3)+-parseInt(_0x52d55c(0x178))/0x4*(parseInt(_0x52d55c(0x176))/0x5)+-parseInt(_0x52d55c(0x179))/0x6*(-parseInt(_0x52d55c(0x17e))/0x7)+-parseInt(_0x52d55c(0x17f))/0x8*(-parseInt(_0x52d55c(0x174))/0x9)+parseInt(_0x52d55c(0x172))/0xa+-parseInt(_0x52d55c(0x17b))/0xb;if(_0x894ddd===_0x30affc)break;else _0x5011b6['push'](_0x5011b6['shift']());}catch(_0x12936c){_0x5011b6['push'](_0x5011b6['shift']());}}}(a6_0xd26a,0x3461f));export const TOOL_NAMES={'EDIT_FILE':a6_0x1c0466(0x17a),'CODEBASE_SEARCH':a6_0x1c0466(0x180),'GITHUB_CODEBASE_SEARCH':a6_0x1c0466(0x17d)};export const ALL_TOOL_NAMES=Object[a6_0x1c0466(0x17c)](TOOL_NAMES);function a6_0x2a27(_0x5c8679,_0x88d40b){_0x5c8679=_0x5c8679-0x172;const _0xd26a22=a6_0xd26a();let _0x2a2712=_0xd26a22[_0x5c8679];return _0x2a2712;}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0xd26a(){const _0x466164=['196691ZIBmSM','values','github_codebase_search','35042koeXnT','16CcBdVa','codebase_search','1187580nUvBDT','453758eLDHey','1620558wOybYO','87030vhoqVU','86015yEIehb','3tyWRnh','76PCMUxI','264ofrXjg','edit_file'];a6_0xd26a=function(){return _0x466164;};return a6_0xd26a();} | ||
| const a6_0x2b9c34=a6_0x1718;(function(_0x281d16,_0x55aba0){const _0x517849=a6_0x1718,_0x3d0172=_0x281d16();while(!![]){try{const _0x4a9447=parseInt(_0x517849(0x19b))/0x1*(parseInt(_0x517849(0x199))/0x2)+-parseInt(_0x517849(0x1a1))/0x3+-parseInt(_0x517849(0x19e))/0x4*(-parseInt(_0x517849(0x1a3))/0x5)+-parseInt(_0x517849(0x198))/0x6*(-parseInt(_0x517849(0x1a4))/0x7)+parseInt(_0x517849(0x19f))/0x8+parseInt(_0x517849(0x1a2))/0x9+-parseInt(_0x517849(0x197))/0xa*(parseInt(_0x517849(0x1a0))/0xb);if(_0x4a9447===_0x55aba0)break;else _0x3d0172['push'](_0x3d0172['shift']());}catch(_0x41ab8f){_0x3d0172['push'](_0x3d0172['shift']());}}}(a6_0x113e,0x47a8d));export const TOOL_NAMES={'EDIT_FILE':a6_0x2b9c34(0x19c),'CODEBASE_SEARCH':a6_0x2b9c34(0x19a),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};function a6_0x113e(){const _0x79f768=['1727VcqRdX','1249560PZVtRO','3591549NLvzsJ','30575iHImTK','7vJexTg','75880XpVcDv','1031736VteCje','694994QyxNpr','codebase_search','1UmVAsy','edit_file','values','268XWmEZS','4585072lBbuFS'];a6_0x113e=function(){return _0x79f768;};return a6_0x113e();}export const ALL_TOOL_NAMES=Object[a6_0x2b9c34(0x19d)](TOOL_NAMES);function a6_0x1718(_0x11134f,_0x4d674f){_0x11134f=_0x11134f-0x197;const _0x113e09=a6_0x113e();let _0x171867=_0x113e09[_0x11134f];return _0x171867;}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES); |
+2
-2
| { | ||
| "name": "@morphllm/morphmcp", | ||
| "version": "0.8.180", | ||
| "version": "0.8.181", | ||
| "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.", | ||
@@ -38,3 +38,3 @@ "license": "MIT", | ||
| "@modelcontextprotocol/sdk": "^1.12.3", | ||
| "@morphllm/morphsdk": "0.2.170", | ||
| "@morphllm/morphsdk": "0.2.171", | ||
| "@vscode/ripgrep": "^1.15.14", | ||
@@ -41,0 +41,0 @@ "axios": "^1.6.0", |
Obfuscated code
Supply chain riskObfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.
Found 7 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Obfuscated code
Supply chain riskObfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.
Found 7 instances in 1 package
77068
-0.35%2
100%+ Added
- Removed
Updated