@morphllm/morphmcp 0.8.188 → 0.8.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x227abc=a0_0x2127;(function(_0x3ca447,_0x1d39b8){const _0x531fbe=a0_0x2127,_0x1da6be=_0x3ca447();while(!![]){try{const _0x31ca05=-parseInt(_0x531fbe(0x315))/0x1+parseInt(_0x531fbe(0x309))/0x2+-parseInt(_0x531fbe(0x206))/0x3*(-parseInt(_0x531fbe(0x222))/0x4)+-parseInt(_0x531fbe(0x308))/0x5*(-parseInt(_0x531fbe(0x21b))/0x6)+-parseInt(_0x531fbe(0x2e0))/0x7*(-parseInt(_0x531fbe(0x2da))/0x8)+parseInt(_0x531fbe(0x2b7))/0x9*(parseInt(_0x531fbe(0x216))/0xa)+-parseInt(_0x531fbe(0x26a))/0xb;if(_0x31ca05===_0x1d39b8)break;else _0x1da6be['push'](_0x1da6be['shift']());}catch(_0x1f0f63){_0x1da6be['push'](_0x1da6be['shift']());}}}(a0_0x5757,0x7a28d));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_0x4e40e0 from'fs/promises';import a0_0x123294 from'path';import a0_0x51281c 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_0x4e35e1 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x13d3d2){const _0x5311c6=a0_0x2127,_0x53a581=_0x13d3d2['split'](a0_0x123294[_0x5311c6(0x295)])[_0x5311c6(0x242)](Boolean);if(_0x53a581['length']<0x2)return null;for(let _0x494e71=Math[_0x5311c6(0x31c)](_0x53a581[_0x5311c6(0x2de)]/0x2);_0x494e71>=0x1;_0x494e71--){for(let _0xa72741=0x0;_0xa72741<=_0x53a581[_0x5311c6(0x2de)]-0x2*_0x494e71;_0xa72741++){const _0x1b73d7=_0x53a581[_0x5311c6(0x21d)](_0xa72741,_0xa72741+_0x494e71),_0x53da20=_0x53a581[_0x5311c6(0x21d)](_0xa72741+_0x494e71,_0xa72741+0x2*_0x494e71);if(_0x1b73d7[_0x5311c6(0x284)]((_0x362770,_0x228ee5)=>_0x362770===_0x53da20[_0x228ee5])){const _0x182fd5=[..._0x53a581[_0x5311c6(0x21d)](0x0,_0xa72741),..._0x53a581[_0x5311c6(0x21d)](_0xa72741+_0x494e71)];return a0_0x123294['sep']+_0x182fd5['join'](a0_0x123294[_0x5311c6(0x295)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1ce701=a0_0x2127;try{const _0x49651e=require(_0x1ce701(0x1f3));return _0x49651e[_0x1ce701(0x2cb)]??_0x1ce701(0x249);}catch(_0x466d13){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x466d13),'unknown';}}function printHelp(){const _0x5bea69=a0_0x2127;console[_0x5bea69(0x1f5)](_0x5bea69(0x235)+getPackageVersion()),console[_0x5bea69(0x1f5)](_0x5bea69(0x299)),console[_0x5bea69(0x1f5)](_0x5bea69(0x2e3)),console[_0x5bea69(0x1f5)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x5bea69(0x1f5)](_0x5bea69(0x30f)),console[_0x5bea69(0x1f5)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console['log'](_0x5bea69(0x1f9)),console['log'](_0x5bea69(0x300)),console[_0x5bea69(0x1f5)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x227abc(0x2fd)][a0_0x227abc(0x21d)](0x2),VERSION_FLAGS=new Set([a0_0x227abc(0x2c5),'-v','-V']),HELP_FLAGS=new Set([a0_0x227abc(0x223),'-h']);cliArgs['some'](_0x40e1ee=>VERSION_FLAGS['has'](_0x40e1ee))&&(console[a0_0x227abc(0x1f5)](a0_0x227abc(0x235)+getPackageVersion()),process[a0_0x227abc(0x22e)](0x0));cliArgs['some'](_0x3ede24=>HELP_FLAGS[a0_0x227abc(0x317)](_0x3ede24))&&(printHelp(),process[a0_0x227abc(0x22e)](0x0));function getCliArg(_0x4b62d0){const _0x4a1bbb=a0_0x227abc;for(let _0x44a85b=0x0;_0x44a85b<cliArgs[_0x4a1bbb(0x2de)];_0x44a85b++){const _0x1d61aa=cliArgs[_0x44a85b];if(_0x1d61aa[_0x4a1bbb(0x23c)]('--'+_0x4b62d0+'='))return _0x1d61aa[_0x4a1bbb(0x21d)](('--'+_0x4b62d0+'=')[_0x4a1bbb(0x2de)]);if(_0x1d61aa==='--'+_0x4b62d0&&_0x44a85b+0x1<cliArgs[_0x4a1bbb(0x2de)])return cliArgs[_0x44a85b+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x227abc(0x2de)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x227abc(0x317)](arg)||HELP_FLAGS[a0_0x227abc(0x317)](arg))continue;if(arg[a0_0x227abc(0x23c)](a0_0x227abc(0x220)))continue;if(arg===a0_0x227abc(0x226)){i++;continue;}args[a0_0x227abc(0x282)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x227abc(0x229)]||process['env'][a0_0x227abc(0x2c1)]||process[a0_0x227abc(0x23a)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x227abc(0x2f2)]!==a0_0x227abc(0x274),MORPH_API_KEY=getCliArg(a0_0x227abc(0x28b))??process[a0_0x227abc(0x25e)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x227abc(0x25e)][a0_0x227abc(0x2be)],MORPH_LARGE_APPLY=process[a0_0x227abc(0x25e)]['MORPH_LARGE_APPLY']!=='false',MORPH_WARP_GREP_TIMEOUT=process['env']['MORPH_WARP_GREP_TIMEOUT']?parseInt(process['env'][a0_0x227abc(0x2f1)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x227abc(0x25e)][a0_0x227abc(0x263)]?new Set(process[a0_0x227abc(0x25e)][a0_0x227abc(0x263)][a0_0x227abc(0x22f)](',')['map'](_0x178d7d=>_0x178d7d['trim']())[a0_0x227abc(0x242)](_0x276ac6=>_0x276ac6['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x227abc(0x245)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x227abc(0x317)](tool)&&console[a0_0x227abc(0x318)](a0_0x227abc(0x2f3)+tool+a0_0x227abc(0x233)+[...KNOWN_TOOL_NAMES][a0_0x227abc(0x27e)](',\x20'));}console[a0_0x227abc(0x318)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x227abc(0x211))&&!MORPH_API_KEY[a0_0x227abc(0x23c)](a0_0x227abc(0x25a))&&logMcpStderr(a0_0x227abc(0x28a));function a0_0x2127(_0x23585b,_0x3a2208){_0x23585b=_0x23585b-0x1f3;const _0x5757e9=a0_0x5757();let _0x2127cc=_0x5757e9[_0x23585b];return _0x2127cc;}async function reportMorphError(_0x2708b2){const _0x593dd6=a0_0x227abc;try{await a0_0x4e35e1[_0x593dd6(0x2ec)](_0x593dd6(0x221),{..._0x2708b2,'timestamp':new Date()[_0x593dd6(0x28f)](),'source':_0x2708b2['source']||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x2708b2[_0x593dd6(0x20c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x593dd6(0x2e7),'Authorization':_0x593dd6(0x294)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x8d2e91,_0x133642){const _0x4efe7e=a0_0x227abc;if(_0x8d2e91&&typeof _0x8d2e91===_0x4efe7e(0x277)&&'status'in _0x8d2e91)return _0x8d2e91['status'];if(_0x8d2e91&&typeof _0x8d2e91===_0x4efe7e(0x277)&&_0x4efe7e(0x1f7)in _0x8d2e91)return _0x8d2e91[_0x4efe7e(0x1f7)]?.[_0x4efe7e(0x289)];const _0x3d3623=_0x133642[_0x4efe7e(0x1fc)](/\b(401|429)\b/);return _0x3d3623?parseInt(_0x3d3623[0x1],0xa):null;}function handleMorphAPIError(_0x336b52){const _0x2cb757=a0_0x227abc,_0x32e944=_0x336b52 instanceof Error?_0x336b52['message']:String(_0x336b52),_0x24f01a=extractStatusCode(_0x336b52,_0x32e944);switch(_0x24f01a){case 0x191:return{'content':[{'type':_0x2cb757(0x290),'text':_0x2cb757(0x1f8)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x2cb757(0x290),'text':_0x2cb757(0x251)}],'isError':!![]};default:return null;}}args[a0_0x227abc(0x2de)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x227abc(0x30e)),logMcpStderr(a0_0x227abc(0x279)),logMcpStderr(a0_0x227abc(0x26d)),logMcpStderr(a0_0x227abc(0x240)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x227abc(0x2fa)));function normalizePath(_0x17bb85){return a0_0x123294['normalize'](_0x17bb85);}function expandHome(_0x22c3db){const _0x59dc75=a0_0x227abc;if(_0x22c3db[_0x59dc75(0x23c)]('~/')||_0x22c3db==='~')return a0_0x123294['join'](a0_0x51281c[_0x59dc75(0x2b2)](),_0x22c3db['slice'](0x1));return _0x22c3db;}let allowedDirectories=await Promise[a0_0x227abc(0x2ff)](args[a0_0x227abc(0x2c4)](async _0x2b5ebe=>{const _0x4f5f70=a0_0x227abc,_0x1f4597=expandHome(_0x2b5ebe),_0xa7b249=a0_0x123294[_0x4f5f70(0x268)](_0x1f4597);try{const _0x3cf9e6=await a0_0x4e40e0[_0x4f5f70(0x2ca)](_0xa7b249);return normalizePath(_0x3cf9e6);}catch(_0x242cd1){return normalizePath(_0xa7b249);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x227abc(0x2de)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x227abc(0x285)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x2e962b){logMcpStderr(a0_0x227abc(0x246)+a0_0x2e962b);}async function detectWorkspaceRoot(_0x52d65b){const _0x445c2e=a0_0x227abc;let _0x59d6fe=a0_0x123294[_0x445c2e(0x268)](_0x52d65b);const _0x5c8430=[_0x445c2e(0x314),_0x445c2e(0x256),'package.json',_0x445c2e(0x2ad),_0x445c2e(0x24e),'go.mod',_0x445c2e(0x310),_0x445c2e(0x283),_0x445c2e(0x306)];while(_0x59d6fe!==a0_0x123294['dirname'](_0x59d6fe)){for(const _0x313ba3 of _0x5c8430){const _0x4a6f34=a0_0x123294[_0x445c2e(0x27e)](_0x59d6fe,_0x313ba3);try{return await a0_0x4e40e0[_0x445c2e(0x292)](_0x4a6f34),normalizePath(_0x59d6fe);}catch{}}_0x59d6fe=a0_0x123294['dirname'](_0x59d6fe);}return normalizePath(_0x52d65b);}await Promise[a0_0x227abc(0x2ff)](args['map'](async _0x1c205b=>{const _0x1af700=a0_0x227abc;try{const _0x3acb0f=await a0_0x4e40e0['stat'](expandHome(_0x1c205b));!_0x3acb0f['isDirectory']()&&(logMcpStderr(_0x1af700(0x2b9)+_0x1c205b+'\x20is\x20not\x20a\x20directory'),process[_0x1af700(0x22e)](0x1));}catch(_0x2e077c){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x1c205b+':',_0x2e077c),process['exit'](0x1);}}));function a0_0x5757(){const _0x5439a4=['-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','arguments','stringify','ms:','read\x20','[github_codebase_search]\x20Done\x20in\x20','messages','describe','WarpGrepError','8SfuInY','\x20valid\x20directories','getClientCapabilities','repo_path','length','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','4860205roqTil','Morph\x20Edit\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x0aOptions:','listRoots','api_request_start','min','application/json','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','basename','linesAdded','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','post','command','searchGitHub','safeParse','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','MORPH_WARP_GREP_TIMEOUT','ENABLE_WORKSPACE_MODE','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','\x22>\x0a','Fallback:\x20Using\x20workspace\x20root\x20','read','node_modules','Here\x20is\x20the\x20content\x20of\x20files:\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','-\x20Preserve\x20exact\x20indentation\x0a','array','argv','grep_search','all','\x20\x20morph-mcp','LocalRipgrepProvider','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','filePath','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','codebase_search','composer.json','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','130FNJRbN','1241760rEjZaq','utf-8','MCP','path_validation_start','metadata','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','.cursor','message','edit_file','File\x20read\x20error:','.git','110303mkexwL','file','has','error','setRequestHandler','FileNotFound','Fatal\x20error\x20running\x20server:','floor','ReadError','../package.json','GITHUB_CODEBASE_SEARCH','log',',\x20removed\x20','response','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.','\x0aExamples:','glob\x20\x27','Preview\x20changes\x20without\x20applying\x20them.','match','isArray','runWarpGrep_call','path_validation_resolved','instruction','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','Specific\x20commit\x20hash\x20to\x20search','lines','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','instructions','210ereqaM','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','tool_call_id','search_type','terminated','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','context','search_string','Morph\x20Edit\x20Preview','ENOENT','timeout','sk-','**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','Max\x20results\x20to\x20return','tool_call_received','list_directory\x20','6295130eIMSRB','❌\x20Morph\x20Edit\x20Failed:\x20','RipgrepError','source','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','45510yyYdvs','code_edit','slice','.\x20Changes:\x20','enum','--api-key=','https://morphllm.com/api/error-report','31676fsMzWS','--help','compaction_failed','linesModified','--api-key','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','string','WORKSPACE_ROOT','linesRemoved','constructor','Error\x20running\x20fast\x20context\x20search:\x20','oninitialized','exit','split','optional','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','[github_codebase_search]\x20Failed\x20in\x20','\x22.\x20Known\x20tools:\x20','Created\x20File','@morphllm/morphmcp\x20','includes','github_url','API\x20error\x20(auth/rate-limit)','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','cwd','assistant','startsWith','tool_calls','\x20disabled\x20via\x20DISABLED_TOOLS','BinaryFile','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','code','filter','grep','Repository\x20identifier','size','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','path','unknown','params','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','etimedout','pyproject.toml','morph-warp-grep-v2.1','warp_grep_complete','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','success','ToolException','EDIT_FILE','content','.vscode','provider_created','-\x20Glob\x20search\x20`','files','morph-','completed_with_file_errors','terminationReason','.\x20Path:\x20','env','CODEBASE_SEARCH','github_codebase_search','RipgrepNotAvailable','catch','DISABLED_TOOLS','[could\x20not\x20read\x20file:\x20','indexOf','list_directory','stack','resolve','Morph\x20FastApply\x20failed\x20without\x20error\x20message','22941380jTjoCE','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Parent\x20directory\x20does\x20not\x20exist:\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','new_string','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','warn','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','Warning:\x20','UnknownError','false','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.','name','object','target_filepath','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x20error(s)','tool_call_complete','added\x20','timings','join','parse','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.','dirname','push','tsconfig.json','every','Workspace\x20mode\x20enabled:\x20Using\x20','Parameters:\x0a','\x27\x20in\x20`','0.2.0','status','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','api-key','Unknown\x20tool:\x20','<file\x20path=\x22','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.','toISOString','text','number','access','branch','Bearer\x20','sep','tool_call_error','requiresApiKey','\x20(new\x20file)','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Failed\x20to\x20read\x20file:\x20','morph-mcp','Tool\x20','TimeoutError','roots','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Tool\x20\x22','debug','dryRun','readFile','path_validation_failed','unknown\x20error','glob','file_read_failed','target_file','\x0a</file>','toLowerCase','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Example\x20format:\x0a','Cargo.toml','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','`\x20in\x20`','SymlinkError','substring','homedir','now','function','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','setNotificationHandler','9EhFrsT','data','Error:\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','default','warp_grep_start','errors','MORPH_API_URL','role','morph-v3-large','PWD','boolean','completionId','map','--version','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','mcp-filesystem','-\x20Listed\x20directory\x20`','file_read_complete','realpath','version','grep\x20\x27','finish','pattern','morph-v3-fast','ms.\x20Success:\x20'];a0_0x5757=function(){return _0x5439a4;};return a0_0x5757();}async function validatePath(_0x3165a1){const _0x59c0d7=a0_0x227abc,_0x42081b=expandHome(_0x3165a1),_0x3e6d05=a0_0x123294['resolve'](_0x42081b);logger[_0x59c0d7(0x2a1)]('MCP',_0x59c0d7(0x30c),{'raw_path':_0x3165a1,'absolute':_0x3e6d05});try{const _0x55a5cc=await a0_0x4e40e0['realpath'](_0x3e6d05);return logger[_0x59c0d7(0x2a1)](_0x59c0d7(0x30b),_0x59c0d7(0x1ff),{'resolved':_0x55a5cc,'symlink':_0x55a5cc!==_0x3e6d05}),_0x55a5cc;}catch(_0x1d2796){if(_0x1d2796[_0x59c0d7(0x241)]===_0x59c0d7(0x20f)){const _0x4be0fc=a0_0x123294[_0x59c0d7(0x281)](_0x3e6d05);try{const _0x329e85=await a0_0x4e40e0['realpath'](_0x4be0fc),_0x76938c=a0_0x123294[_0x59c0d7(0x27e)](_0x329e85,a0_0x123294[_0x59c0d7(0x2e9)](_0x3e6d05));return logger['debug'](_0x59c0d7(0x30b),_0x59c0d7(0x1ff),{'resolved':_0x76938c,'new_file':!![]}),_0x76938c;}catch{logger[_0x59c0d7(0x318)](_0x59c0d7(0x30b),_0x59c0d7(0x2a4),{'raw_path':_0x3165a1,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x4be0fc});throw new Error(_0x59c0d7(0x26c)+_0x4be0fc);}}logger[_0x59c0d7(0x318)]('MCP',_0x59c0d7(0x2a4),{'raw_path':_0x3165a1,'error':_0x1d2796[_0x59c0d7(0x311)]});throw _0x1d2796;}}const MorphEditFileArgsSchema=z[a0_0x227abc(0x277)]({'path':z[a0_0x227abc(0x228)](),'code_edit':z[a0_0x227abc(0x228)]()['describe'](a0_0x227abc(0x26b)),'instruction':z['string']()[a0_0x227abc(0x2d8)](a0_0x227abc(0x247)),'dryRun':z[a0_0x227abc(0x2c2)]()[a0_0x227abc(0x2bb)](![])['describe'](a0_0x227abc(0x1fb))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x227abc(0x28e),WarpGrepArgsSchema=z[a0_0x227abc(0x277)]({'search_string':z['string']()[a0_0x227abc(0x2d8)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x227abc(0x228)]()[a0_0x227abc(0x2d8)](a0_0x227abc(0x271)),'search_type':z[a0_0x227abc(0x21f)](['default',a0_0x227abc(0x2f8)])['optional']()['describe'](a0_0x227abc(0x26f))}),WarpGrepGitHubArgsSchema=z[a0_0x227abc(0x277)]({'search_string':z['string']()[a0_0x227abc(0x2d8)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x227abc(0x230)]()[a0_0x227abc(0x2d8)](a0_0x227abc(0x280)),'owner_repo':z[a0_0x227abc(0x228)]()[a0_0x227abc(0x230)]()['describe'](a0_0x227abc(0x2ab)),'branch':z[a0_0x227abc(0x228)]()[a0_0x227abc(0x230)]()[a0_0x227abc(0x2d8)](a0_0x227abc(0x207))}),CodebaseSearchArgsSchema=z[a0_0x227abc(0x277)]({'query':z[a0_0x227abc(0x228)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x227abc(0x2d8)](a0_0x227abc(0x244)),'branch':z[a0_0x227abc(0x228)]()[a0_0x227abc(0x230)]()[a0_0x227abc(0x2d8)](a0_0x227abc(0x2f0)),'commitHash':z[a0_0x227abc(0x228)]()[a0_0x227abc(0x230)]()[a0_0x227abc(0x2d8)](a0_0x227abc(0x202)),'targetDirectories':z[a0_0x227abc(0x2fc)](z[a0_0x227abc(0x228)]())[a0_0x227abc(0x2bb)]([])[a0_0x227abc(0x2d8)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x227abc(0x291)]()['optional']()['default'](0xa)['describe'](a0_0x227abc(0x213))}),server=new Server({'name':a0_0x227abc(0x29b),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x48ac60=a0_0x227abc,_0x3adb4b=[{'name':TOOL_NAMES[_0x48ac60(0x254)],'description':_0x48ac60(0x212)+_0x48ac60(0x286)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x48ac60(0x307)+_0x48ac60(0x239)+'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'+_0x48ac60(0x2ac)+_0x48ac60(0x302)+'Rules:\x0a'+_0x48ac60(0x2ae)+_0x48ac60(0x2fb)+_0x48ac60(0x201)+_0x48ac60(0x2d1),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x48ac60(0x25f)],'description':_0x48ac60(0x21a)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x48ac60(0x2eb)+_0x48ac60(0x231)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x33a065=_0x3adb4b[_0x48ac60(0x242)](_0x60b70=>{const _0x564424=_0x48ac60;if(DISABLED_TOOLS[_0x564424(0x317)](_0x60b70[_0x564424(0x276)]))return console[_0x564424(0x318)](_0x564424(0x29c)+_0x60b70[_0x564424(0x276)]+_0x564424(0x23e)),![];if('requiresApiKey'in _0x60b70&&_0x60b70[_0x564424(0x297)]&&!MORPH_API_KEY)return logMcpStderr(_0x564424(0x272)+_0x60b70[_0x564424(0x276)]+_0x564424(0x2df)),![];return!![];});return{'tools':_0x33a065[_0x48ac60(0x2c4)](_0x4d93a4=>({'name':_0x4d93a4[_0x48ac60(0x276)],'description':_0x4d93a4['description'],'inputSchema':_0x4d93a4['inputSchema']}))};}),server[a0_0x227abc(0x319)](CallToolRequestSchema,async _0x525907=>{const _0x24010d=a0_0x227abc,{name:_0x3d0a42,arguments:_0x35e2fe}=_0x525907[_0x24010d(0x24a)],_0x56f1d9=Date[_0x24010d(0x2b3)]();logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x214),{'tool':_0x3d0a42,'args':_0x3d0a42==='edit_file'?{'path':_0x35e2fe?.[_0x24010d(0x248)],'instruction':_0x35e2fe?.[_0x24010d(0x200)]||_0x35e2fe?.[_0x24010d(0x205)],'dryRun':_0x35e2fe?.[_0x24010d(0x2a2)]}:_0x35e2fe});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x24010d(0x290),'text':_0x24010d(0x20b)}],'isError':!![]};if(!MORPH_API_KEY[_0x24010d(0x23c)](_0x24010d(0x211))&&!MORPH_API_KEY['startsWith']('morph-'))return{'content':[{'type':'text','text':_0x24010d(0x275)}],'isError':!![]};if(DISABLED_TOOLS[_0x24010d(0x317)](_0x3d0a42))return{'content':[{'type':_0x24010d(0x290),'text':_0x24010d(0x2a0)+_0x3d0a42+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x3d0a42){case TOOL_NAMES[_0x24010d(0x254)]:{let _0x1848de=_0x35e2fe;if(_0x1848de&&typeof _0x1848de===_0x24010d(0x277)){if(!(_0x24010d(0x248)in _0x1848de)){const _0x2e854f=_0x1848de[_0x24010d(0x2a8)]??_0x1848de[_0x24010d(0x303)]??_0x1848de[_0x24010d(0x278)]??_0x1848de['file_path']??_0x1848de[_0x24010d(0x316)];if(_0x2e854f)_0x1848de={..._0x1848de,'path':_0x2e854f};}_0x24010d(0x205)in _0x1848de&&!(_0x24010d(0x200)in _0x1848de)&&(_0x1848de={..._0x1848de,'instruction':_0x1848de['instructions']});if(!('code_edit'in _0x1848de)){const _0x2658a2=_0x1848de[_0x24010d(0x241)]??_0x1848de[_0x24010d(0x26e)]??_0x1848de[_0x24010d(0x255)]??_0x1848de['edit'];if(_0x2658a2)_0x1848de={..._0x1848de,'code_edit':_0x2658a2};}}const _0x244de8=MorphEditFileArgsSchema[_0x24010d(0x2ef)](_0x1848de);if(!_0x244de8[_0x24010d(0x252)])throw new Error(_0x24010d(0x204)+_0x244de8[_0x24010d(0x318)]);const _0x150a28=await validatePath(_0x244de8['data']['path']);let _0x3e3315=null,_0x469663=!![],_0x1d124a=null;try{_0x3e3315=await a0_0x4e40e0['readFile'](_0x150a28,'utf-8'),logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x2c9),{'path':_0x150a28,'size_bytes':_0x3e3315['length']});}catch(_0x5200c9){const _0x3a068c=_0x5200c9[_0x24010d(0x241)];_0x3a068c===_0x24010d(0x20f)?(_0x469663=![],_0x3e3315='',logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x2c9),{'path':_0x150a28,'exists':![]})):(_0x1d124a=_0x24010d(0x29a)+(_0x3a068c||_0x24010d(0x249))+'\x20-\x20'+(_0x5200c9 instanceof Error?_0x5200c9['message']:String(_0x5200c9)),logger[_0x24010d(0x318)](_0x24010d(0x30b),_0x24010d(0x2a7),{'path':_0x150a28,'error':_0x1d124a}),logMcpStderr(_0x24010d(0x272)+_0x1d124a));}let _0x5476ef;try{const _0x8e0376=MORPH_API_KEY;if(!_0x8e0376)throw new Error(_0x24010d(0x227));const _0x26c28b=a0_0x123294['dirname'](_0x150a28),_0x5981c0=a0_0x123294[_0x24010d(0x2e9)](_0x150a28);logger['debug'](_0x24010d(0x30b),_0x24010d(0x2e5),{'model':_0x24010d(0x2cf),'path':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x248)],'instruction_len':_0x244de8['data'][_0x24010d(0x200)]['length'],'code_edit_len':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x21c)][_0x24010d(0x2de)],'original_code_len':_0x3e3315?.[_0x24010d(0x2de)]??0x0,'dry_run':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x2a2)]});const _0x481e96=Date['now'](),_0x5b34e1=await executeEditFile({'target_filepath':_0x5981c0,'code_edit':_0x244de8[_0x24010d(0x2b8)]['code_edit'],'instruction':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x200)]},{'morphApiKey':_0x8e0376,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x26c28b,'autoWrite':!_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x2a2)],'generateUdiff':![],'debug':![]}),_0x1fc1bb=Date[_0x24010d(0x2b3)]()-_0x481e96;_0x5476ef=_0x5b34e1[_0x24010d(0x2c3)];if(!_0x5b34e1['success'])throw new Error(_0x5b34e1['error']||_0x24010d(0x269));const _0x374f3=_0x5b34e1['changes'],_0x176170=_0x24010d(0x27c)+_0x374f3[_0x24010d(0x2ea)]+_0x24010d(0x1f6)+_0x374f3[_0x24010d(0x22a)]+',\x20modified\x20'+_0x374f3[_0x24010d(0x225)];logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x27b),{'tool':'edit_file','success':!![],'latency_ms':Date['now']()-_0x56f1d9,'edit_latency_ms':_0x1fc1bb,'changes':{'added':_0x374f3[_0x24010d(0x2ea)],'removed':_0x374f3['linesRemoved'],'modified':_0x374f3[_0x24010d(0x225)]},'completion_id':_0x5476ef});if(_0x244de8[_0x24010d(0x2b8)]['dryRun'])return{'content':[{'type':'text','text':_0x24010d(0x20e)+(_0x469663?'':_0x24010d(0x298))+':\x20'+_0x244de8['data']['instruction']+'.\x20Changes:\x20'+_0x176170+_0x24010d(0x25d)+_0x244de8['data'][_0x24010d(0x248)]+'.'}]};return{'content':[{'type':_0x24010d(0x290),'text':_0x24010d(0x2e1)+(_0x469663?'Applied':_0x24010d(0x234))+':\x20'+_0x244de8['data']['instruction']+_0x24010d(0x21e)+_0x176170+'.\x20Path:\x20'+_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x248)]+'.'}]};}catch(_0x8f2193){const _0x59f41a=handleMorphAPIError(_0x8f2193);if(_0x59f41a)return logger['error']('MCP',_0x24010d(0x296),{'tool':'edit_file','error':_0x24010d(0x238),'latency_ms':Date[_0x24010d(0x2b3)]()-_0x56f1d9}),_0x59f41a;const _0x3b5702=_0x8f2193 instanceof Error?_0x8f2193[_0x24010d(0x311)]:String(_0x8f2193);return logger[_0x24010d(0x318)](_0x24010d(0x30b),_0x24010d(0x296),{'tool':_0x24010d(0x312),'error':_0x3b5702,'path':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x248)],'validated_path':_0x150a28,'latency_ms':Date[_0x24010d(0x2b3)]()-_0x56f1d9,'stack':_0x8f2193 instanceof Error?_0x8f2193[_0x24010d(0x267)]:undefined}),reportMorphError({'error_message':_0x3b5702,'error_type':_0x8f2193 instanceof Error?_0x8f2193['constructor']['name']:'UnknownError','context':{'tool':'edit_file','completion_id':_0x5476ef,'file_path':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x248)],'validated_path':_0x150a28,'instruction':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x200)],'model':MORPH_LARGE_APPLY?_0x24010d(0x2c0):_0x24010d(0x2cf),'dry_run':_0x244de8[_0x24010d(0x2b8)]['dryRun'],'file_exists':_0x469663,'file_read_error':_0x1d124a,'file_readable':_0x3e3315!==null,'request_content':{'path':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x248)],'code_edit':_0x244de8['data'][_0x24010d(0x21c)],'instruction':_0x244de8[_0x24010d(0x2b8)][_0x24010d(0x200)],'original_code':_0x3e3315!==null?_0x3e3315[_0x24010d(0x2de)]>0xc350?_0x3e3315[_0x24010d(0x2b1)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x3e3315[_0x24010d(0x2de)]+'\x20chars)':_0x3e3315:_0x24010d(0x264)+(_0x1d124a||_0x24010d(0x2a5))+']','original_code_length':_0x3e3315?.[_0x24010d(0x2de)]??0x0,'model':MORPH_LARGE_APPLY?_0x24010d(0x2c0):_0x24010d(0x2cf),'dry_run':_0x244de8['data']['dryRun']}},'stack_trace':_0x8f2193 instanceof Error?_0x8f2193[_0x24010d(0x267)]:undefined,'source':_0x24010d(0x2c7)})[_0x24010d(0x262)](()=>{}),{'content':[{'type':'text','text':_0x24010d(0x217)+_0x3b5702}],'isError':!![]};}}case TOOL_NAMES[_0x24010d(0x25f)]:{const _0x3078f4=WarpGrepArgsSchema[_0x24010d(0x2ef)](_0x35e2fe);if(!_0x3078f4[_0x24010d(0x252)])return{'content':[{'type':_0x24010d(0x290),'text':'Invalid\x20arguments:\x20'+_0x3078f4[_0x24010d(0x318)]}],'isError':!![]};const _0x55d002=_0x511c74=>{const _0x44a017=_0x24010d,_0x21b3c3=[];for(const _0x2005c0 of _0x511c74||[]){if(_0x2005c0[_0x44a017(0x2bf)]===_0x44a017(0x23b)&&Array[_0x44a017(0x1fd)](_0x2005c0[_0x44a017(0x23d)]))for(const _0x1ca0db of _0x2005c0[_0x44a017(0x23d)]){try{const _0x172d03=_0x1ca0db['function']?.[_0x44a017(0x276)],_0x50ef64=JSON[_0x44a017(0x27f)](_0x1ca0db['function']?.[_0x44a017(0x2d2)]||'{}');if(_0x172d03===_0x44a017(0x2fe))_0x21b3c3[_0x44a017(0x282)](_0x44a017(0x2cc)+_0x50ef64[_0x44a017(0x2ce)]+'\x27\x20'+(_0x50ef64['path']||'.'));else{if(_0x172d03===_0x44a017(0x2f7))_0x21b3c3[_0x44a017(0x282)](_0x44a017(0x2d5)+_0x50ef64[_0x44a017(0x248)]);else{if(_0x172d03===_0x44a017(0x266))_0x21b3c3[_0x44a017(0x282)](_0x44a017(0x215)+(_0x50ef64[_0x44a017(0x2ed)]||'.'));else{if(_0x172d03===_0x44a017(0x2a6))_0x21b3c3[_0x44a017(0x282)](_0x44a017(0x1fa)+_0x50ef64[_0x44a017(0x2ce)]+'\x27\x20'+(_0x50ef64['path']||'.'));else _0x172d03==='finish'&&_0x21b3c3['push'](_0x44a017(0x2cd));}}}}catch{}}}return _0x21b3c3;},_0x1744f0=_0x23a021=>{const _0x407189=_0x24010d,_0x1703a7=[];if(!_0x23a021||!Array[_0x407189(0x1fd)](_0x23a021))return _0x1703a7;const _0x5ab0d8=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x407189(0x31a),'tool':_0x407189(0x2f7)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x407189(0x2f7)},{'pattern':/\[READ ERROR\]/,'error_type':_0x407189(0x31d),'tool':_0x407189(0x2f7)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x407189(0x23f),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x407189(0x218),'tool':_0x407189(0x243)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x407189(0x261),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x407189(0x23f),'tool':_0x407189(0x2f7)},{'pattern':/\[SYMLINK\]/,'error_type':_0x407189(0x2b0),'tool':_0x407189(0x2f7)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':'read'},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x407189(0x2f7)},{'pattern':/Error reading file:/,'error_type':_0x407189(0x31d),'tool':_0x407189(0x2f7)},{'pattern':/status="error"/,'error_type':_0x407189(0x253),'tool':_0x407189(0x249)}];let _0x1481ed=0x0;for(const _0x5e1ea3 of _0x23a021){_0x5e1ea3['role']===_0x407189(0x23b)&&Array[_0x407189(0x1fd)](_0x5e1ea3[_0x407189(0x23d)])&&_0x1481ed++;const _0x3e4970=_0x5e1ea3[_0x407189(0x255)];if((_0x5e1ea3['role']==='tool'||_0x5e1ea3[_0x407189(0x2bf)]==='user')&&_0x3e4970&&typeof _0x3e4970===_0x407189(0x228))for(const {pattern:_0x2861be,error_type:_0x24ad6d,tool:_0xa51491}of _0x5ab0d8){const _0xebdbde=_0x3e4970[_0x407189(0x1fc)](new RegExp(_0x2861be[_0x407189(0x219)],'g'));if(_0xebdbde)for(const _0x4927b6 of _0xebdbde){const _0x37c3b1=_0x3e4970[_0x407189(0x265)](_0x4927b6),_0xdf641c=_0x3e4970['substring'](_0x37c3b1,Math[_0x407189(0x2e6)](_0x37c3b1+0xc8,_0x3e4970[_0x407189(0x2de)]));_0x1703a7[_0x407189(0x282)]({'tool':_0xa51491,'error_type':_0x24ad6d,'error_message':_0xdf641c[_0x407189(0x22f)]('\x0a')[0x0],'turn':_0x1481ed});}}}return _0x1703a7;};try{const _0x21c93e=a0_0x123294[_0x24010d(0x268)](_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x2dd)]),_0x701b20=_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x209)],_0x105d0f=_0x701b20===_0x24010d(0x2f8)?{'allowNames':[_0x24010d(0x2f8)]}:undefined,_0x25f353=new LocalRipgrepProvider(_0x21c93e,undefined,_0x105d0f);logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x257),{'type':_0x24010d(0x301),'repo_root':_0x21c93e,'search_type':_0x701b20||_0x24010d(0x2bb)}),logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x2bc),{'query':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x20d)],'repo_root':_0x21c93e,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x493240=Date['now'](),_0x4e434f=await runWarpGrep({'searchTerm':_0x3078f4['data']['search_string'],'repoRoot':_0x21c93e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x25f353,'search_type':_0x701b20}),_0x3e0b64=Date[_0x24010d(0x2b3)]()-_0x493240,_0x48e035=_0x4e434f[_0x24010d(0x2cd)]?.[_0x24010d(0x30d)]?.[_0x24010d(0x259)]?.[_0x24010d(0x2de)]??0x0;logger[_0x24010d(0x2a1)](_0x24010d(0x30b),_0x24010d(0x250),{'termination':_0x4e434f['terminationReason'],'turns':_0x4e434f[_0x24010d(0x27d)]?.['turns']??0x0,'files_found':_0x48e035,'latency_ms':_0x3e0b64});const _0x2741fe=_0x1744f0(_0x4e434f[_0x24010d(0x2d7)]);_0x2741fe[_0x24010d(0x2de)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2741fe[_0x24010d(0x2de)]+_0x24010d(0x27a),'error_type':'SubToolError','level':'warn','tool':_0x24010d(0x305),'context':{'repo_path':_0x3078f4['data'][_0x24010d(0x2dd)],'query':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x20d)],'model':_0x24010d(0x24f),'termination_reason':_0x4e434f[_0x24010d(0x25c)],'sub_tool_errors':_0x2741fe,'timings':_0x4e434f['timings'],'tool_calls':_0x55d002(_0x4e434f[_0x24010d(0x2d7)]),'messages':_0x4e434f['messages']?.[_0x24010d(0x2c4)](_0x2a12ba=>({'role':_0x2a12ba[_0x24010d(0x2bf)],'content':_0x2a12ba['content'],..._0x2a12ba[_0x24010d(0x23d)]?{'tool_calls':_0x2a12ba[_0x24010d(0x23d)][_0x24010d(0x2de)]}:{},..._0x2a12ba[_0x24010d(0x208)]?{'tool_call_id':_0x2a12ba['tool_call_id']}:{}}))},'source':_0x24010d(0x2c7)})[_0x24010d(0x262)](()=>{});let _0x59f995='';if(_0x4e434f[_0x24010d(0x25c)]==='completed'&&_0x4e434f[_0x24010d(0x2cd)]?.['metadata']?.['files']){const _0x388271=_0x4e434f[_0x24010d(0x2cd)][_0x24010d(0x30d)]['files'];if(_0x388271[_0x24010d(0x2de)]===0x0)return _0x59f995=_0x4e434f[_0x24010d(0x2cd)]['payload']||_0x24010d(0x2e8),{'content':[{'type':_0x24010d(0x290),'text':_0x59f995}]};const _0x1888ab=[],_0xd25be7=[_0x24010d(0x24c)];for(const _0x16f788 of _0x4e434f[_0x24010d(0x2d7)]){if(_0x16f788['role']===_0x24010d(0x23b)&&Array[_0x24010d(0x1fd)](_0x16f788[_0x24010d(0x23d)]))for(const _0x4c11ea of _0x16f788[_0x24010d(0x23d)]){try{const _0x4ff881=_0x4c11ea['function']?.[_0x24010d(0x276)],_0x1a4d0f=JSON[_0x24010d(0x27f)](_0x4c11ea[_0x24010d(0x2b4)]?.[_0x24010d(0x2d2)]||'{}');if(_0x4ff881===_0x24010d(0x2fe))_0xd25be7[_0x24010d(0x282)]('-\x20Grepped\x20\x27'+_0x1a4d0f['pattern']+_0x24010d(0x287)+(_0x1a4d0f[_0x24010d(0x248)]||'.')+'`');else{if(_0x4ff881===_0x24010d(0x2f7))_0xd25be7[_0x24010d(0x282)]('-\x20Read\x20file\x20`'+_0x1a4d0f['path']+'`');else{if(_0x4ff881===_0x24010d(0x266))_0xd25be7[_0x24010d(0x282)](_0x24010d(0x2c8)+(_0x1a4d0f[_0x24010d(0x2ed)]||'.')+'`');else _0x4ff881==='glob'&&_0xd25be7[_0x24010d(0x282)](_0x24010d(0x258)+_0x1a4d0f[_0x24010d(0x2ce)]+_0x24010d(0x2af)+(_0x1a4d0f['path']||'.')+'`');}}}catch{}}}_0x1888ab[_0x24010d(0x282)](_0xd25be7['join']('\x0a'));const _0x4b1e6d=['','Relevant\x20context\x20found:'];for(const _0x50209d of _0x388271){if(_0x50209d['lines']==='*')_0x4b1e6d['push']('-\x20'+_0x50209d[_0x24010d(0x248)]+':*');else{if(Array['isArray'](_0x50209d[_0x24010d(0x203)])){const _0x2a6f75=_0x50209d[_0x24010d(0x203)]['map'](([_0x29db15,_0x29cd71])=>{if(_0x29db15===_0x29cd71)return''+_0x29db15;return _0x29db15+'-'+_0x29cd71;});_0x4b1e6d[_0x24010d(0x282)]('-\x20'+_0x50209d[_0x24010d(0x248)]+':'+_0x2a6f75[_0x24010d(0x27e)](','));}else _0x4b1e6d['push']('-\x20'+_0x50209d['path']+':*');}}_0x4b1e6d[_0x24010d(0x282)](''),_0x1888ab[_0x24010d(0x282)](_0x4b1e6d['join']('\x0a')),_0x1888ab[_0x24010d(0x282)](_0x24010d(0x2f9));const _0x51227a=[],_0x18dc09=[];for(const _0x2883b5 of _0x388271){let _0x2e9587=a0_0x123294[_0x24010d(0x268)](_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x2dd)],_0x2883b5[_0x24010d(0x248)]),_0xccddb9=null,_0x107d0a=null;try{_0xccddb9=await a0_0x4e40e0[_0x24010d(0x2a3)](_0x2e9587,{'encoding':'utf-8'});}catch(_0x2d90fc){const _0x2441f6=fixPathRepetition(_0x2e9587);if(_0x2441f6)try{_0xccddb9=await a0_0x4e40e0[_0x24010d(0x2a3)](_0x2441f6,{'encoding':_0x24010d(0x30a)}),_0x2e9587=_0x2441f6;}catch{_0x107d0a=_0x2d90fc instanceof Error?_0x2d90fc:new Error(String(_0x2d90fc));}else _0x107d0a=_0x2d90fc instanceof Error?_0x2d90fc:new Error(String(_0x2d90fc));}if(_0xccddb9!==null){const _0x125467=_0xccddb9[_0x24010d(0x22f)](/\r?\n/),_0x206525=[];if(_0x2883b5[_0x24010d(0x203)]==='*'||!Array['isArray'](_0x2883b5[_0x24010d(0x203)]))for(let _0xc18542=0x1;_0xc18542<=_0x125467[_0x24010d(0x2de)];_0xc18542++){const _0x4a74df=_0x125467[_0xc18542-0x1];_0x206525['push'](_0xc18542+'|\x20'+_0x4a74df);}else for(const [_0x5cca63,_0x1bc4d7]of _0x2883b5[_0x24010d(0x203)]){_0x206525[_0x24010d(0x2de)]>0x0&&_0x206525[_0x24010d(0x282)]('');for(let _0x39d71c=_0x5cca63;_0x39d71c<=_0x1bc4d7&&_0x39d71c<=_0x125467['length'];_0x39d71c++){const _0x3c9a01=_0x125467[_0x39d71c-0x1];_0x206525[_0x24010d(0x282)](_0x39d71c+'|\x20'+_0x3c9a01);}}_0x18dc09[_0x24010d(0x282)]({'path':_0x2883b5['path'],'content':_0x206525[_0x24010d(0x27e)]('\x0a')});}else _0x51227a[_0x24010d(0x282)](_0x24010d(0x28d)+_0x2883b5['path']+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x107d0a?.[_0x24010d(0x311)]||'Unknown\x20error')+_0x24010d(0x2a9));}try{const _0x3277cc=await compactFileContexts(_0x18dc09,_0x3078f4['data'][_0x24010d(0x20d)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3c63e9 of _0x3277cc){_0x51227a[_0x24010d(0x282)]('<file\x20path=\x22'+_0x3c63e9['path']+_0x24010d(0x2f5)+_0x3c63e9['content']+_0x24010d(0x2a9));}}catch(_0x1f8d2d){logger[_0x24010d(0x270)](_0x24010d(0x30b),_0x24010d(0x224),{'error':_0x1f8d2d instanceof Error?_0x1f8d2d[_0x24010d(0x311)]:String(_0x1f8d2d),'files_count':_0x18dc09[_0x24010d(0x2de)]});for(const _0x3f1ff7 of _0x18dc09){_0x51227a[_0x24010d(0x282)](_0x24010d(0x28d)+_0x3f1ff7[_0x24010d(0x248)]+_0x24010d(0x2f5)+_0x3f1ff7[_0x24010d(0x255)]+_0x24010d(0x2a9));}}_0x1888ab['push'](_0x51227a[_0x24010d(0x27e)]('\x0a\x0a')),_0x59f995=_0x1888ab[_0x24010d(0x27e)]('\x0a');const _0x41fa2e=_0x4e434f[_0x24010d(0x2bd)]?.[_0x24010d(0x242)](_0x1d486d=>_0x1d486d['message']?.[_0x24010d(0x23c)](_0x24010d(0x313)))||[];if(_0x41fa2e[_0x24010d(0x2de)]>0x0){const _0x34e326=_0x41fa2e[_0x24010d(0x2c4)](_0x352dfa=>_0x352dfa['message'])[_0x24010d(0x27e)](';\x20');reportMorphError({'error_message':_0x34e326,'error_type':'FileReadError','context':{'tool':'codebase_search','repo_path':_0x3078f4[_0x24010d(0x2b8)]['repo_path'],'query':_0x3078f4['data']['search_string'],'model':_0x24010d(0x24f),'termination_reason':_0x24010d(0x25b),'error_count':_0x41fa2e[_0x24010d(0x2de)],'is_timeout':![],'timings':_0x4e434f['timings'],'files_attempted':_0x388271[_0x24010d(0x2c4)](_0x319a93=>({'path':_0x319a93['path'],'lines':_0x319a93['lines']})),'tool_calls':_0x55d002(_0x4e434f[_0x24010d(0x2d7)]),'messages':_0x4e434f['messages']?.[_0x24010d(0x2c4)](_0x4c5e6c=>({'role':_0x4c5e6c[_0x24010d(0x2bf)],'content':_0x4c5e6c[_0x24010d(0x255)],..._0x4c5e6c['tool_calls']?{'tool_calls':_0x4c5e6c[_0x24010d(0x23d)][_0x24010d(0x2de)]}:{},..._0x4c5e6c[_0x24010d(0x208)]?{'tool_call_id':_0x4c5e6c[_0x24010d(0x208)]}:{}})),'request_content':{'query':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x20d)],'repo_path':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x2dd)],'repoRoot':a0_0x123294[_0x24010d(0x268)](_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x2dd)]),'model':_0x24010d(0x24f)}},'source':_0x24010d(0x2c7)})[_0x24010d(0x262)](()=>{});}}else{if(_0x4e434f[_0x24010d(0x25c)]===_0x24010d(0x20a)&&_0x4e434f[_0x24010d(0x2bd)][_0x24010d(0x2de)]>0x0){const _0x479c44=_0x4e434f[_0x24010d(0x2bd)][_0x24010d(0x2c4)](_0x2cfb4c=>_0x2cfb4c['message'])['join'](';\x20');_0x59f995=_0x24010d(0x2b9)+_0x479c44;const _0x942340=_0x479c44[_0x24010d(0x2aa)]()[_0x24010d(0x236)]('timeout')||_0x479c44['toLowerCase']()[_0x24010d(0x236)]('timed\x20out')||_0x479c44[_0x24010d(0x2aa)]()['includes'](_0x24010d(0x24d)),_0x23307e=_0x4e434f[_0x24010d(0x2cd)]?.[_0x24010d(0x30d)]?.[_0x24010d(0x259)],_0x557b82=_0x4e434f[_0x24010d(0x2bd)][0x0];reportMorphError({'error_message':_0x479c44,'error_type':_0x942340?_0x24010d(0x29d):_0x557b82?.[_0x24010d(0x22b)]?.[_0x24010d(0x276)]||_0x24010d(0x2d9),'context':{'tool':_0x24010d(0x305),'repo_path':_0x3078f4['data'][_0x24010d(0x2dd)],'query':_0x3078f4[_0x24010d(0x2b8)]['search_string'],'model':_0x24010d(0x24f),'termination_reason':_0x4e434f['terminationReason'],'error_count':_0x4e434f[_0x24010d(0x2bd)][_0x24010d(0x2de)],'is_timeout':_0x942340,'timings':_0x4e434f['timings'],'files_attempted':_0x23307e?.[_0x24010d(0x2c4)](_0xf091cb=>({'path':_0xf091cb[_0x24010d(0x248)],'lines':_0xf091cb[_0x24010d(0x203)]})),'tool_calls':_0x55d002(_0x4e434f['messages']),'messages':_0x4e434f[_0x24010d(0x2d7)]?.[_0x24010d(0x2c4)](_0xfddd46=>({'role':_0xfddd46[_0x24010d(0x2bf)],'content':_0xfddd46[_0x24010d(0x255)],..._0xfddd46[_0x24010d(0x23d)]?{'tool_calls':_0xfddd46['tool_calls'][_0x24010d(0x2de)]}:{},..._0xfddd46['tool_call_id']?{'tool_call_id':_0xfddd46[_0x24010d(0x208)]}:{}})),'request_content':{'query':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x20d)],'repo_path':_0x3078f4[_0x24010d(0x2b8)]['repo_path'],'repoRoot':a0_0x123294[_0x24010d(0x268)](_0x3078f4['data']['repo_path']),'model':_0x24010d(0x24f)}},'stack_trace':_0x557b82?.['stack']||undefined,'source':_0x24010d(0x2c7)})[_0x24010d(0x262)](()=>{});}else _0x59f995=_0x24010d(0x2b5);}return{'content':[{'type':_0x24010d(0x290),'text':_0x59f995}]};}catch(_0x5975e3){const _0xc20980=handleMorphAPIError(_0x5975e3);if(_0xc20980)return logger[_0x24010d(0x318)](_0x24010d(0x30b),_0x24010d(0x296),{'tool':_0x24010d(0x305),'error':_0x24010d(0x238),'latency_ms':Date[_0x24010d(0x2b3)]()-_0x56f1d9}),_0xc20980;const _0x2577fa=_0x5975e3 instanceof Error?_0x5975e3[_0x24010d(0x311)]:String(_0x5975e3);logger['error'](_0x24010d(0x30b),_0x24010d(0x296),{'tool':_0x24010d(0x305),'error':_0x2577fa,'repo_path':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x2dd)],'query':_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x20d)],'latency_ms':Date[_0x24010d(0x2b3)]()-_0x56f1d9});const _0x372204=_0x2577fa['toLowerCase']()[_0x24010d(0x236)](_0x24010d(0x210))||_0x2577fa[_0x24010d(0x2aa)]()[_0x24010d(0x236)]('timed\x20out')||_0x2577fa['toLowerCase']()['includes'](_0x24010d(0x24d))||_0x5975e3 instanceof Error&&_0x5975e3[_0x24010d(0x276)]===_0x24010d(0x29d);return reportMorphError({'error_message':_0x2577fa,'error_type':_0x372204?'TimeoutError':_0x5975e3 instanceof Error?_0x5975e3[_0x24010d(0x22b)][_0x24010d(0x276)]:_0x24010d(0x273),'context':{'tool':_0x24010d(0x305),'repo_path':_0x3078f4['data'][_0x24010d(0x2dd)],'query':_0x3078f4[_0x24010d(0x2b8)]['search_string'],'model':_0x24010d(0x24f),'is_timeout':_0x372204,'exception_phase':_0x24010d(0x1fe),'request_content':{'query':_0x3078f4['data'][_0x24010d(0x20d)],'repo_path':_0x3078f4[_0x24010d(0x2b8)]['repo_path'],'repoRoot':a0_0x123294[_0x24010d(0x268)](_0x3078f4[_0x24010d(0x2b8)][_0x24010d(0x2dd)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x5975e3 instanceof Error?_0x5975e3['stack']:undefined,'source':_0x24010d(0x2c7)})['catch'](()=>{}),{'content':[{'type':_0x24010d(0x290),'text':_0x24010d(0x22c)+_0x2577fa}],'isError':![]};}}case TOOL_NAMES[_0x24010d(0x1f4)]:{const _0x370873=WarpGrepGitHubArgsSchema[_0x24010d(0x2ef)](_0x35e2fe);if(!_0x370873[_0x24010d(0x252)])return{'content':[{'type':_0x24010d(0x290),'text':'Invalid\x20arguments:\x20'+_0x370873[_0x24010d(0x318)]}],'isError':!![]};const _0x39c838=_0x370873[_0x24010d(0x2b8)][_0x24010d(0x237)]||_0x370873[_0x24010d(0x2b8)]['owner_repo'];if(!_0x39c838)return{'content':[{'type':_0x24010d(0x290),'text':_0x24010d(0x24b)}],'isError':!![]};const _0x52dbd2=MORPH_API_KEY;if(!_0x52dbd2)throw new Error(_0x24010d(0x227));const _0x400df7=Date[_0x24010d(0x2b3)]();logger['debug'](_0x24010d(0x30b),'github_search_start',{'identifier':_0x39c838,'query':_0x370873[_0x24010d(0x2b8)][_0x24010d(0x20d)],'branch':_0x370873[_0x24010d(0x2b8)][_0x24010d(0x293)]});try{const _0x56f27e=new WarpGrepClient({'morphApiKey':_0x52dbd2,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x113cee=await _0x56f27e[_0x24010d(0x2ee)]({'searchTerm':_0x370873[_0x24010d(0x2b8)]['search_string'],'github':_0x39c838,'branch':_0x370873['data'][_0x24010d(0x293)]}),_0x1b730a=Date['now']()-_0x400df7;logMcpStderr(_0x24010d(0x2d6)+_0x1b730a+_0x24010d(0x2d0)+_0x113cee['success']);const _0x391c70=formatResult(_0x113cee);return{'content':[{'type':_0x24010d(0x290),'text':_0x391c70}]};}catch(_0x491ec9){const _0x3e4e0f=handleMorphAPIError(_0x491ec9);if(_0x3e4e0f)return _0x3e4e0f;const _0x482555=Date[_0x24010d(0x2b3)]()-_0x400df7,_0x2c615e=_0x491ec9 instanceof Error?_0x491ec9[_0x24010d(0x311)]:String(_0x491ec9);return logMcpStderr(_0x24010d(0x232)+_0x482555+_0x24010d(0x2d4),_0x2c615e),reportMorphError({'error_message':_0x2c615e,'error_type':_0x491ec9 instanceof Error?_0x491ec9[_0x24010d(0x22b)]['name']:_0x24010d(0x273),'context':{'tool':_0x24010d(0x260),'github_url':_0x39c838,'search_string':_0x370873[_0x24010d(0x2b8)][_0x24010d(0x20d)],'branch':_0x370873[_0x24010d(0x2b8)][_0x24010d(0x293)]},'stack_trace':_0x491ec9 instanceof Error?_0x491ec9[_0x24010d(0x267)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x482555})[_0x24010d(0x262)](()=>{}),{'content':[{'type':_0x24010d(0x290),'text':'GitHub\x20search\x20failed:\x20'+_0x2c615e}],'isError':![]};}}default:throw new Error(_0x24010d(0x28c)+_0x3d0a42);}}catch(_0x3679db){const _0x4149b8=_0x3679db instanceof Error?_0x3679db[_0x24010d(0x311)]:String(_0x3679db);return reportMorphError({'error_message':_0x4149b8,'error_type':_0x3679db instanceof Error?_0x3679db[_0x24010d(0x22b)][_0x24010d(0x276)]:_0x24010d(0x273),'context':{'tool':_0x3d0a42,'arguments':_0x35e2fe?JSON[_0x24010d(0x2d3)](_0x35e2fe)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x24010d(0x288)},'stack_trace':_0x3679db instanceof Error?_0x3679db['stack']:undefined,'source':_0x24010d(0x2c7)})[_0x24010d(0x262)](()=>{}),{'content':[{'type':'text','text':_0x24010d(0x2b9)+_0x4149b8}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x60784b){const _0x312af5=a0_0x227abc,_0x2702c7=await getValidRootDirectories(_0x60784b);if(_0x2702c7[_0x312af5(0x2de)]>0x0)allowedDirectories=[..._0x2702c7],logMcpStderr(_0x312af5(0x2e2)+_0x2702c7['length']+_0x312af5(0x2db));else{logMcpStderr(_0x312af5(0x2f4));if(ENABLE_WORKSPACE_MODE)try{const _0x200fa0=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x200fa0&&(allowedDirectories=[_0x200fa0],logMcpStderr(_0x312af5(0x2f6)+_0x200fa0));}catch(_0x336fc1){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x336fc1);}}}server[a0_0x227abc(0x2b6)](RootsListChangedNotificationSchema,async()=>{const _0x55d1a0=a0_0x227abc;try{const _0x57b94d=await server[_0x55d1a0(0x2e4)]();_0x57b94d&&_0x55d1a0(0x29e)in _0x57b94d&&await updateAllowedDirectoriesFromRoots(_0x57b94d['roots']);}catch(_0x13530d){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x13530d instanceof Error?_0x13530d[_0x55d1a0(0x311)]:String(_0x13530d));}}),server[a0_0x227abc(0x22d)]=async()=>{const _0x3211a3=a0_0x227abc,_0x266d4e=server[_0x3211a3(0x2dc)]();if(_0x266d4e?.['roots'])try{const _0x17c385=await server['listRoots']();_0x17c385&&_0x3211a3(0x29e)in _0x17c385?await updateAllowedDirectoriesFromRoots(_0x17c385[_0x3211a3(0x29e)]):logMcpStderr(_0x3211a3(0x2ba));}catch(_0x162cc4){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x162cc4 instanceof Error?_0x162cc4[_0x3211a3(0x311)]:String(_0x162cc4));}else{if(allowedDirectories[_0x3211a3(0x2de)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x3211a3(0x29f));else throw new Error('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.');}}};async function runServer(){const _0x4e511e=a0_0x227abc,_0x335149=new StdioServerTransport();await server['connect'](_0x335149),logMcpStderr(_0x4e511e(0x2c6)),allowedDirectories[_0x4e511e(0x2de)]===0x0&&logMcpStderr(_0x4e511e(0x304));}runServer()[a0_0x227abc(0x262)](_0x39aaa0=>{const _0x2d44e3=a0_0x227abc;logMcpStderr(_0x2d44e3(0x31b),_0x39aaa0),process[_0x2d44e3(0x22e)](0x1);});
2
+ const a0_0xc88ac9=a0_0xaecf;(function(_0x20e87c,_0x423f17){const _0x50dc6b=a0_0xaecf,_0x443a8a=_0x20e87c();while(!![]){try{const _0x53b668=-parseInt(_0x50dc6b(0x172))/0x1+-parseInt(_0x50dc6b(0x1a4))/0x2*(parseInt(_0x50dc6b(0x1c2))/0x3)+parseInt(_0x50dc6b(0x18c))/0x4*(parseInt(_0x50dc6b(0x24b))/0x5)+parseInt(_0x50dc6b(0x19c))/0x6*(parseInt(_0x50dc6b(0x1ed))/0x7)+parseInt(_0x50dc6b(0x22b))/0x8+-parseInt(_0x50dc6b(0x1c5))/0x9*(-parseInt(_0x50dc6b(0x179))/0xa)+-parseInt(_0x50dc6b(0x158))/0xb;if(_0x53b668===_0x423f17)break;else _0x443a8a['push'](_0x443a8a['shift']());}catch(_0x2049cd){_0x443a8a['push'](_0x443a8a['shift']());}}}(a0_0x579d,0x9364b));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_0x38ee0b from'fs/promises';import a0_0x2fcbcf from'path';import a0_0x5b5c6e 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';function a0_0x579d(){const _0x251cad=['timeout','ToolException','MORPH_WARP_GREP_TIMEOUT','success','<file\x20path=\x22','mcp-filesystem','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','arguments','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','--help','package.json','api-key','read','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','constructor','toLowerCase','grep\x20\x27','safeParse','sep','Error\x20running\x20fast\x20context\x20search:\x20','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','36177wrosFP','MORPH_API_KEY','github_codebase_search','26154Mpmwmj','normalize','github_search_start','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','morph-mcp','target_filepath','list_directory','branch','.\x20Path:\x20','catch','search_type','basename','file','tool_call_received','data','api_request_start','-\x20Preserve\x20exact\x20indentation\x0a','glob','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Fallback:\x20Using\x20workspace\x20root\x20','ENOENT','application/json','realpath','error','user','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','TimeoutError','\x0aExamples:','MORPH_LARGE_APPLY','morph-','0.2.0','indexOf','errors','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','utf-8','Failed\x20to\x20request\x20roots\x20from\x20client:','BinaryFile','filter','response','dryRun','7875PRCRaL','boolean','❌\x20Morph\x20Edit\x20Failed:\x20','Unknown\x20tool:\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','SymlinkError','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','compaction_failed','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','@morphllm/morphmcp\x20','lines','oninitialized','isArray','grep_search','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','unknown','tsconfig.json','split','-\x20Glob\x20search\x20`','.git','\x22.\x20Known\x20tools:\x20','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','array','UnknownError','sk-','dirname','morph-warp-grep-v2.1','PathError','log','access','\x0a</file>','Workspace\x20mode\x20enabled:\x20Using\x20','size','.\x20Changes:\x20','edit','Relevant\x20context\x20found:','min','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','readFile','API\x20error\x20(auth/rate-limit)','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','https://morphllm.com/api/error-report','provider_created','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','requiresApiKey','file_read_complete','FileNotFound','new_string','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Morph\x20Edit\x20Preview','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.','stack','\x20disabled\x20via\x20DISABLED_TOOLS','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','params','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','assistant','tool_call_error','filePath','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','7072560qhXVaU','changes','\x22>\x0aError\x20reading\x20file:\x20','setNotificationHandler','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','\x0aOptions:','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','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Warning:\x20','Applied','terminated','map','path_validation_resolved','File\x20read\x20error:','finish','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','[github_codebase_search]\x20Failed\x20in\x20','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.','Specific\x20commit\x20hash\x20to\x20search','tool_calls','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x27\x20in\x20`','instruction','path_validation_failed','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','optional','text','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','version','messages','read\x20','--api-key=','2748905eXEGch','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.','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.','completionId','SubToolError','\x20chars)','../package.json','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','-\x20Grepped\x20\x27','Example\x20format:\x0a','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','completed_with_file_errors','object','RipgrepError','Morph\x20FastApply\x20failed\x20without\x20error\x20message','ReadError','\x0a...\x20(truncated,\x20total:\x20','Created\x20File','number','CODEBASE_SEARCH','Cargo.toml','env','morph-v3-large','warn','string','unknown\x20error','function','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Disabled\x20tools:\x20','composer.json','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','timings','`\x20in\x20`','RipgrepNotAvailable','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Invalid\x20arguments:\x20','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','searchGitHub','terminationReason','\x20valid\x20directories','linesModified','--api-key','repo_path','message','files','post','has','Parent\x20directory\x20does\x20not\x20exist:\x20','describe','setRequestHandler','inputSchema','join','Warning:\x20Workspace\x20fallback\x20failed:\x20','Error:\x20','GitHub\x20search\x20failed:\x20','default','LocalRipgrepProvider','MCP','\x22>\x0a','13624512HLShfl','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.','morph-v3-fast','payload','MORPH_API_URL','metadata','grep','DISABLED_TOOLS','toISOString','role','context','Tool\x20','false','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','startsWith','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','ENABLE_WORKSPACE_MODE','homedir','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','pattern','WarpGrep\x20sub-tool\x20errors:\x20','Bearer\x20','exit','length','now','substring','827195WqTZao','enum','\x20(new\x20file)','parse','isDirectory','linesAdded','status','1010DzBgxF','match','codebase_search','resolve','name','Repository\x20identifier','slice','timed\x20out',',\x20removed\x20','[could\x20not\x20read\x20file:\x20','-\x20Listed\x20directory\x20`','node_modules','tool_call_id','**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','-\x20Read\x20file\x20`','.vscode','code_edit','description','owner_repo','8sXqUdj','push','file_path','Here\x20is\x20the\x20content\x20of\x20files:\x0a','roots','tool','--version','linesRemoved','etimedout','search_string','Fatal\x20error\x20running\x20server:','debug','Failed\x20to\x20read\x20file:\x20','Unknown\x20error','FileReadError','cwd','3186skYbuN','content','[github_codebase_search]\x20Done\x20in\x20','github_url','instructions','argv','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','includes','34NKbFiF','command','completed','edit_file','Error\x20accessing\x20directory\x20','connect','\x20\x20morph-mcp','path'];a0_0x579d=function(){return _0x251cad;};return a0_0x579d();}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x260df5 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x3798e6){const _0xde5763=a0_0xaecf,_0x3fad36=_0x3798e6[_0xde5763(0x1ff)](a0_0x2fcbcf[_0xde5763(0x1bf)])[_0xde5763(0x1ea)](Boolean);if(_0x3fad36[_0xde5763(0x16f)]<0x2)return null;for(let _0x1f1b1a=Math['floor'](_0x3fad36['length']/0x2);_0x1f1b1a>=0x1;_0x1f1b1a--){for(let _0xb2c63=0x0;_0xb2c63<=_0x3fad36['length']-0x2*_0x1f1b1a;_0xb2c63++){const _0x349157=_0x3fad36[_0xde5763(0x17f)](_0xb2c63,_0xb2c63+_0x1f1b1a),_0x26bc90=_0x3fad36['slice'](_0xb2c63+_0x1f1b1a,_0xb2c63+0x2*_0x1f1b1a);if(_0x349157['every']((_0x2decdd,_0x2c1f07)=>_0x2decdd===_0x26bc90[_0x2c1f07])){const _0x5af69e=[..._0x3fad36[_0xde5763(0x17f)](0x0,_0xb2c63),..._0x3fad36[_0xde5763(0x17f)](_0xb2c63+_0x1f1b1a)];return a0_0x2fcbcf[_0xde5763(0x1bf)]+_0x5af69e['join'](a0_0x2fcbcf[_0xde5763(0x1bf)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x2a30a7=a0_0xaecf;try{const _0x2c4aba=require(_0x2a30a7(0x251));return _0x2c4aba[_0x2a30a7(0x247)]??_0x2a30a7(0x1fd);}catch(_0x12d452){return logMcpStderr(_0x2a30a7(0x22f),_0x12d452),_0x2a30a7(0x1fd);}}function printHelp(){const _0x4feef5=a0_0xaecf;console[_0x4feef5(0x20a)](_0x4feef5(0x1f6)+getPackageVersion()),console['log'](_0x4feef5(0x1fc)),console[_0x4feef5(0x20a)](_0x4feef5(0x230)),console[_0x4feef5(0x20a)](_0x4feef5(0x225)),console[_0x4feef5(0x20a)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x4feef5(0x20a)](_0x4feef5(0x26d)),console[_0x4feef5(0x20a)](_0x4feef5(0x1e0)),console[_0x4feef5(0x20a)](_0x4feef5(0x1aa)),console[_0x4feef5(0x20a)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0xc88ac9(0x1a1)][a0_0xc88ac9(0x17f)](0x2),VERSION_FLAGS=new Set([a0_0xc88ac9(0x192),'-v','-V']),HELP_FLAGS=new Set([a0_0xc88ac9(0x1b5),'-h']);cliArgs['some'](_0x3fe0c4=>VERSION_FLAGS['has'](_0x3fe0c4))&&(console[a0_0xc88ac9(0x20a)](a0_0xc88ac9(0x1f6)+getPackageVersion()),process[a0_0xc88ac9(0x16e)](0x0));cliArgs['some'](_0x5364e4=>HELP_FLAGS[a0_0xc88ac9(0x27a)](_0x5364e4))&&(printHelp(),process[a0_0xc88ac9(0x16e)](0x0));function getCliArg(_0x3161f7){const _0x24ae3a=a0_0xc88ac9;for(let _0x45f702=0x0;_0x45f702<cliArgs[_0x24ae3a(0x16f)];_0x45f702++){const _0x3d5b79=cliArgs[_0x45f702];if(_0x3d5b79['startsWith']('--'+_0x3161f7+'='))return _0x3d5b79['slice'](('--'+_0x3161f7+'=')[_0x24ae3a(0x16f)]);if(_0x3d5b79==='--'+_0x3161f7&&_0x45f702+0x1<cliArgs['length'])return cliArgs[_0x45f702+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0xc88ac9(0x16f)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0xc88ac9(0x27a)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0xc88ac9(0x166)](a0_0xc88ac9(0x24a)))continue;if(arg===a0_0xc88ac9(0x275)){i++;continue;}args[a0_0xc88ac9(0x18d)](arg);}const WORKSPACE_ROOT=process[a0_0xc88ac9(0x260)]['WORKSPACE_ROOT']||process[a0_0xc88ac9(0x260)]['PWD']||process[a0_0xc88ac9(0x19b)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0xc88ac9(0x168)]!==a0_0xc88ac9(0x164),MORPH_API_KEY=getCliArg(a0_0xc88ac9(0x1b7))??process[a0_0xc88ac9(0x260)][a0_0xc88ac9(0x1c3)],MORPH_API_URL=process[a0_0xc88ac9(0x260)][a0_0xc88ac9(0x15c)],MORPH_LARGE_APPLY=process['env'][a0_0xc88ac9(0x1e1)]!==a0_0xc88ac9(0x164),MORPH_WARP_GREP_TIMEOUT=process['env']['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0xc88ac9(0x260)][a0_0xc88ac9(0x1ae)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0xc88ac9(0x260)][a0_0xc88ac9(0x15f)]?new Set(process[a0_0xc88ac9(0x260)][a0_0xc88ac9(0x15f)][a0_0xc88ac9(0x1ff)](',')[a0_0xc88ac9(0x236)](_0x459f8a=>_0x459f8a['trim']())[a0_0xc88ac9(0x1ea)](_0xa79574=>_0xa79574[a0_0xc88ac9(0x16f)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0xc88ac9(0x20e)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0xc88ac9(0x1dc)](a0_0xc88ac9(0x1d7)+tool+a0_0xc88ac9(0x202)+[...KNOWN_TOOL_NAMES][a0_0xc88ac9(0x27f)](',\x20'));}console[a0_0xc88ac9(0x1dc)](a0_0xc88ac9(0x267)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0xc88ac9(0x166)]('sk-')&&!MORPH_API_KEY[a0_0xc88ac9(0x166)](a0_0xc88ac9(0x1e2))&&logMcpStderr(a0_0xc88ac9(0x216));async function reportMorphError(_0x45035b){const _0x1e188b=a0_0xc88ac9;try{await a0_0x260df5[_0x1e188b(0x279)](_0x1e188b(0x217),{..._0x45035b,'timestamp':new Date()[_0x1e188b(0x160)](),'source':_0x45035b['source']||_0x1e188b(0x1b1),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x45035b[_0x1e188b(0x162)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x1e188b(0x1da),'Authorization':_0x1e188b(0x16d)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x33ccf9,_0x5ba7f8){const _0x54f55e=a0_0xc88ac9;if(_0x33ccf9&&typeof _0x33ccf9===_0x54f55e(0x257)&&_0x54f55e(0x178)in _0x33ccf9)return _0x33ccf9[_0x54f55e(0x178)];if(_0x33ccf9&&typeof _0x33ccf9===_0x54f55e(0x257)&&_0x54f55e(0x1eb)in _0x33ccf9)return _0x33ccf9[_0x54f55e(0x1eb)]?.['status'];const _0x40d2e8=_0x5ba7f8[_0x54f55e(0x17a)](/\b(401|429)\b/);return _0x40d2e8?parseInt(_0x40d2e8[0x1],0xa):null;}function handleMorphAPIError(_0x19652a){const _0xa81595=a0_0xc88ac9,_0x36f93f=_0x19652a instanceof Error?_0x19652a[_0xa81595(0x277)]:String(_0x19652a),_0x1ed314=extractStatusCode(_0x19652a,_0x36f93f);switch(_0x1ed314){case 0x191:return{'content':[{'type':'text','text':_0xa81595(0x220)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0xa81595(0x245),'text':_0xa81595(0x26f)}],'isError':!![]};default:return null;}}args[a0_0xc88ac9(0x16f)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0xc88ac9(0x255)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0xc88ac9(0x1f1)),logMcpStderr(a0_0xc88ac9(0x22a)),logMcpStderr(a0_0xc88ac9(0x213)),logMcpStderr(a0_0xc88ac9(0x232)));function normalizePath(_0x421017){const _0xbae44d=a0_0xc88ac9;return a0_0x2fcbcf[_0xbae44d(0x1c6)](_0x421017);}function expandHome(_0x4ec92b){const _0x166493=a0_0xc88ac9;if(_0x4ec92b[_0x166493(0x166)]('~/')||_0x4ec92b==='~')return a0_0x2fcbcf['join'](a0_0x5b5c6e[_0x166493(0x169)](),_0x4ec92b[_0x166493(0x17f)](0x1));return _0x4ec92b;}let allowedDirectories=await Promise['all'](args['map'](async _0x2a113e=>{const _0x3280da=a0_0xc88ac9,_0x4d0fbf=expandHome(_0x2a113e),_0x3025e8=a0_0x2fcbcf[_0x3280da(0x17c)](_0x4d0fbf);try{const _0x2c35e1=await a0_0x38ee0b[_0x3280da(0x1db)](_0x3025e8);return normalizePath(_0x2c35e1);}catch(_0x44d67f){return normalizePath(_0x3025e8);}}));function a0_0xaecf(_0x2b4e99,_0x79d43f){_0x2b4e99=_0x2b4e99-0x155;const _0x579d48=a0_0x579d();let _0xaecf6c=_0x579d48[_0x2b4e99];return _0xaecf6c;}if(ENABLE_WORKSPACE_MODE&&args[a0_0xc88ac9(0x16f)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0xc88ac9(0x18d)](workspaceDir),logMcpStderr(a0_0xc88ac9(0x20d)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x5e09b3){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x5e09b3);}async function detectWorkspaceRoot(_0x255a9c){const _0x19e2e6=a0_0xc88ac9;let _0x3765d3=a0_0x2fcbcf['resolve'](_0x255a9c);const _0x281680=[_0x19e2e6(0x201),_0x19e2e6(0x188),_0x19e2e6(0x1b6),_0x19e2e6(0x25f),'pyproject.toml','go.mod','.cursor',_0x19e2e6(0x1fe),_0x19e2e6(0x268)];while(_0x3765d3!==a0_0x2fcbcf['dirname'](_0x3765d3)){for(const _0x5c5a49 of _0x281680){const _0x7a7ebb=a0_0x2fcbcf[_0x19e2e6(0x27f)](_0x3765d3,_0x5c5a49);try{return await a0_0x38ee0b[_0x19e2e6(0x20b)](_0x7a7ebb),normalizePath(_0x3765d3);}catch{}}_0x3765d3=a0_0x2fcbcf[_0x19e2e6(0x207)](_0x3765d3);}return normalizePath(_0x255a9c);}await Promise['all'](args[a0_0xc88ac9(0x236)](async _0x1d589c=>{const _0x47ebb8=a0_0xc88ac9;try{const _0x32ade2=await a0_0x38ee0b['stat'](expandHome(_0x1d589c));!_0x32ade2[_0x47ebb8(0x176)]()&&(logMcpStderr(_0x47ebb8(0x281)+_0x1d589c+'\x20is\x20not\x20a\x20directory'),process[_0x47ebb8(0x16e)](0x1));}catch(_0x51ea45){logMcpStderr(_0x47ebb8(0x1a8)+_0x1d589c+':',_0x51ea45),process[_0x47ebb8(0x16e)](0x1);}}));async function validatePath(_0x442334){const _0x3d69bc=a0_0xc88ac9,_0x2936b1=expandHome(_0x442334),_0x3bbeb0=a0_0x2fcbcf['resolve'](_0x2936b1);logger[_0x3d69bc(0x197)](_0x3d69bc(0x156),'path_validation_start',{'raw_path':_0x442334,'absolute':_0x3bbeb0});try{const _0x155421=await a0_0x38ee0b['realpath'](_0x3bbeb0);return logger['debug'](_0x3d69bc(0x156),_0x3d69bc(0x237),{'resolved':_0x155421,'symlink':_0x155421!==_0x3bbeb0}),_0x155421;}catch(_0x4963a2){if(_0x4963a2['code']===_0x3d69bc(0x1d9)){const _0x1ee7e1=a0_0x2fcbcf[_0x3d69bc(0x207)](_0x3bbeb0);try{const _0x58c7b2=await a0_0x38ee0b[_0x3d69bc(0x1db)](_0x1ee7e1),_0x10abe4=a0_0x2fcbcf[_0x3d69bc(0x27f)](_0x58c7b2,a0_0x2fcbcf[_0x3d69bc(0x1d0)](_0x3bbeb0));return logger[_0x3d69bc(0x197)](_0x3d69bc(0x156),_0x3d69bc(0x237),{'resolved':_0x10abe4,'new_file':!![]}),_0x10abe4;}catch{logger[_0x3d69bc(0x1dc)]('MCP',_0x3d69bc(0x242),{'raw_path':_0x442334,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x1ee7e1});throw new Error(_0x3d69bc(0x27b)+_0x1ee7e1);}}logger['error'](_0x3d69bc(0x156),'path_validation_failed',{'raw_path':_0x442334,'error':_0x4963a2['message']});throw _0x4963a2;}}const MorphEditFileArgsSchema=z[a0_0xc88ac9(0x257)]({'path':z[a0_0xc88ac9(0x263)](),'code_edit':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x246)),'instruction':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x223)),'dryRun':z[a0_0xc88ac9(0x1ee)]()['default'](![])[a0_0xc88ac9(0x27c)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0xc88ac9(0x24c),WarpGrepArgsSchema=z[a0_0xc88ac9(0x257)]({'search_string':z['string']()[a0_0xc88ac9(0x27c)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x1b4)),'search_type':z[a0_0xc88ac9(0x173)](['default',a0_0xc88ac9(0x184)])[a0_0xc88ac9(0x244)]()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x252))}),WarpGrepGitHubArgsSchema=z[a0_0xc88ac9(0x257)]({'search_string':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x27c)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x244)]()['describe'](a0_0xc88ac9(0x159)),'owner_repo':z['string']()[a0_0xc88ac9(0x244)]()['describe'](a0_0xc88ac9(0x1c8)),'branch':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x244)]()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x226))}),CodebaseSearchArgsSchema=z[a0_0xc88ac9(0x257)]({'query':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x27c)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x17e)),'branch':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x244)]()[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x1b9)),'commitHash':z[a0_0xc88ac9(0x263)]()[a0_0xc88ac9(0x244)]()['describe'](a0_0xc88ac9(0x23d)),'targetDirectories':z[a0_0xc88ac9(0x204)](z[a0_0xc88ac9(0x263)]())[a0_0xc88ac9(0x283)]([])[a0_0xc88ac9(0x27c)](a0_0xc88ac9(0x1f3)),'limit':z[a0_0xc88ac9(0x25d)]()[a0_0xc88ac9(0x244)]()[a0_0xc88ac9(0x283)](0xa)['describe']('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0xc88ac9(0x1c9),'version':a0_0xc88ac9(0x1e3)},{'capabilities':{'tools':{}}});server[a0_0xc88ac9(0x27d)](ListToolsRequestSchema,async()=>{const _0x15bc47=a0_0xc88ac9,_0x4e5e65=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x15bc47(0x186)+'Parameters:\x0a'+_0x15bc47(0x1b2)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+_0x15bc47(0x167)+_0x15bc47(0x231)+_0x15bc47(0x254)+_0x15bc47(0x203)+'Rules:\x0a'+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+_0x15bc47(0x1d5)+_0x15bc47(0x1de)+_0x15bc47(0x266),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x15bc47(0x25e)],'description':_0x15bc47(0x269)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x15bc47(0x1f5)+_0x15bc47(0x219)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x73a303=_0x4e5e65[_0x15bc47(0x1ea)](_0x232aa1=>{const _0x40ba9c=_0x15bc47;if(DISABLED_TOOLS[_0x40ba9c(0x27a)](_0x232aa1[_0x40ba9c(0x17d)]))return console['error'](_0x40ba9c(0x163)+_0x232aa1[_0x40ba9c(0x17d)]+_0x40ba9c(0x222)),![];if(_0x40ba9c(0x21a)in _0x232aa1&&_0x232aa1[_0x40ba9c(0x21a)]&&!MORPH_API_KEY)return logMcpStderr(_0x40ba9c(0x233)+_0x232aa1[_0x40ba9c(0x17d)]+_0x40ba9c(0x1e6)),![];return!![];});return{'tools':_0x73a303[_0x15bc47(0x236)](_0x169b30=>({'name':_0x169b30[_0x15bc47(0x17d)],'description':_0x169b30[_0x15bc47(0x18a)],'inputSchema':_0x169b30[_0x15bc47(0x27e)]}))};}),server[a0_0xc88ac9(0x27d)](CallToolRequestSchema,async _0x44c039=>{const _0x32a950=a0_0xc88ac9,{name:_0x5ec9b5,arguments:_0x245588}=_0x44c039[_0x32a950(0x224)],_0x44c3bf=Date['now']();logger['debug']('MCP',_0x32a950(0x1d2),{'tool':_0x5ec9b5,'args':_0x5ec9b5===_0x32a950(0x1a7)?{'path':_0x245588?.[_0x32a950(0x1ab)],'instruction':_0x245588?.[_0x32a950(0x241)]||_0x245588?.['instructions'],'dryRun':_0x245588?.[_0x32a950(0x1ec)]}:_0x245588});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x1c1)}],'isError':!![]};if(!MORPH_API_KEY[_0x32a950(0x166)](_0x32a950(0x206))&&!MORPH_API_KEY[_0x32a950(0x166)](_0x32a950(0x1e2)))return{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x24d)}],'isError':!![]};if(DISABLED_TOOLS[_0x32a950(0x27a)](_0x5ec9b5))return{'content':[{'type':'text','text':'Tool\x20\x22'+_0x5ec9b5+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x5ec9b5){case TOOL_NAMES['EDIT_FILE']:{let _0x282c5f=_0x245588;if(_0x282c5f&&typeof _0x282c5f==='object'){if(!(_0x32a950(0x1ab)in _0x282c5f)){const _0x21acb2=_0x282c5f['target_file']??_0x282c5f[_0x32a950(0x229)]??_0x282c5f[_0x32a950(0x1ca)]??_0x282c5f[_0x32a950(0x18e)]??_0x282c5f[_0x32a950(0x1d1)];if(_0x21acb2)_0x282c5f={..._0x282c5f,'path':_0x21acb2};}_0x32a950(0x1a0)in _0x282c5f&&!(_0x32a950(0x241)in _0x282c5f)&&(_0x282c5f={..._0x282c5f,'instruction':_0x282c5f[_0x32a950(0x1a0)]});if(!(_0x32a950(0x189)in _0x282c5f)){const _0x4584a1=_0x282c5f['code']??_0x282c5f[_0x32a950(0x21d)]??_0x282c5f[_0x32a950(0x19d)]??_0x282c5f[_0x32a950(0x210)];if(_0x4584a1)_0x282c5f={..._0x282c5f,'code_edit':_0x4584a1};}}const _0x744aec=MorphEditFileArgsSchema[_0x32a950(0x1be)](_0x282c5f);if(!_0x744aec[_0x32a950(0x1af)])throw new Error(_0x32a950(0x270)+_0x744aec[_0x32a950(0x1dc)]);const _0x539ff0=await validatePath(_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ab)]);let _0x93ccb=null,_0x12d48f=!![],_0x11caf5=null;try{_0x93ccb=await a0_0x38ee0b[_0x32a950(0x214)](_0x539ff0,'utf-8'),logger[_0x32a950(0x197)](_0x32a950(0x156),'file_read_complete',{'path':_0x539ff0,'size_bytes':_0x93ccb['length']});}catch(_0x8f131a){const _0x255eca=_0x8f131a['code'];_0x255eca==='ENOENT'?(_0x12d48f=![],_0x93ccb='',logger[_0x32a950(0x197)](_0x32a950(0x156),_0x32a950(0x21b),{'path':_0x539ff0,'exists':![]})):(_0x11caf5=_0x32a950(0x198)+(_0x255eca||_0x32a950(0x1fd))+'\x20-\x20'+(_0x8f131a instanceof Error?_0x8f131a[_0x32a950(0x277)]:String(_0x8f131a)),logger[_0x32a950(0x1dc)](_0x32a950(0x156),'file_read_failed',{'path':_0x539ff0,'error':_0x11caf5}),logMcpStderr(_0x32a950(0x233)+_0x11caf5));}let _0x372bd3;try{const _0x349e64=MORPH_API_KEY;if(!_0x349e64)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x2bd79f=a0_0x2fcbcf[_0x32a950(0x207)](_0x539ff0),_0x20a54a=a0_0x2fcbcf[_0x32a950(0x1d0)](_0x539ff0);logger[_0x32a950(0x197)](_0x32a950(0x156),_0x32a950(0x1d4),{'model':_0x32a950(0x15a),'path':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ab)],'instruction_len':_0x744aec[_0x32a950(0x1d3)]['instruction'][_0x32a950(0x16f)],'code_edit_len':_0x744aec['data'][_0x32a950(0x189)][_0x32a950(0x16f)],'original_code_len':_0x93ccb?.[_0x32a950(0x16f)]??0x0,'dry_run':_0x744aec['data'][_0x32a950(0x1ec)]});const _0x2c98a0=Date[_0x32a950(0x170)](),_0x4b321f=await executeEditFile({'target_filepath':_0x20a54a,'code_edit':_0x744aec[_0x32a950(0x1d3)]['code_edit'],'instruction':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x241)]},{'morphApiKey':_0x349e64,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x2bd79f,'autoWrite':!_0x744aec[_0x32a950(0x1d3)]['dryRun'],'generateUdiff':![],'debug':![]}),_0xc05998=Date[_0x32a950(0x170)]()-_0x2c98a0;_0x372bd3=_0x4b321f[_0x32a950(0x24e)];if(!_0x4b321f[_0x32a950(0x1af)])throw new Error(_0x4b321f[_0x32a950(0x1dc)]||_0x32a950(0x259));const _0x414fdc=_0x4b321f[_0x32a950(0x22c)],_0x3f8289='added\x20'+_0x414fdc[_0x32a950(0x177)]+_0x32a950(0x181)+_0x414fdc[_0x32a950(0x193)]+',\x20modified\x20'+_0x414fdc[_0x32a950(0x274)];logger[_0x32a950(0x197)](_0x32a950(0x156),'tool_call_complete',{'tool':'edit_file','success':!![],'latency_ms':Date[_0x32a950(0x170)]()-_0x44c3bf,'edit_latency_ms':_0xc05998,'changes':{'added':_0x414fdc[_0x32a950(0x177)],'removed':_0x414fdc[_0x32a950(0x193)],'modified':_0x414fdc[_0x32a950(0x274)]},'completion_id':_0x372bd3});if(_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ec)])return{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x21f)+(_0x12d48f?'':_0x32a950(0x174))+':\x20'+_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x241)]+_0x32a950(0x20f)+_0x3f8289+_0x32a950(0x1cd)+_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ab)]+'.'}]};return{'content':[{'type':'text','text':'Morph\x20Edit\x20'+(_0x12d48f?_0x32a950(0x234):_0x32a950(0x25c))+':\x20'+_0x744aec['data'][_0x32a950(0x241)]+_0x32a950(0x20f)+_0x3f8289+_0x32a950(0x1cd)+_0x744aec['data'][_0x32a950(0x1ab)]+'.'}]};}catch(_0x1e4346){const _0x27257a=handleMorphAPIError(_0x1e4346);if(_0x27257a)return logger['error']('MCP',_0x32a950(0x228),{'tool':'edit_file','error':_0x32a950(0x215),'latency_ms':Date['now']()-_0x44c3bf}),_0x27257a;const _0x51afa9=_0x1e4346 instanceof Error?_0x1e4346[_0x32a950(0x277)]:String(_0x1e4346);return logger[_0x32a950(0x1dc)]('MCP',_0x32a950(0x228),{'tool':_0x32a950(0x1a7),'error':_0x51afa9,'path':_0x744aec[_0x32a950(0x1d3)]['path'],'validated_path':_0x539ff0,'latency_ms':Date[_0x32a950(0x170)]()-_0x44c3bf,'stack':_0x1e4346 instanceof Error?_0x1e4346['stack']:undefined}),reportMorphError({'error_message':_0x51afa9,'error_type':_0x1e4346 instanceof Error?_0x1e4346['constructor']['name']:_0x32a950(0x205),'context':{'tool':_0x32a950(0x1a7),'completion_id':_0x372bd3,'file_path':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ab)],'validated_path':_0x539ff0,'instruction':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x241)],'model':MORPH_LARGE_APPLY?_0x32a950(0x261):'morph-v3-fast','dry_run':_0x744aec['data'][_0x32a950(0x1ec)],'file_exists':_0x12d48f,'file_read_error':_0x11caf5,'file_readable':_0x93ccb!==null,'request_content':{'path':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ab)],'code_edit':_0x744aec[_0x32a950(0x1d3)]['code_edit'],'instruction':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x241)],'original_code':_0x93ccb!==null?_0x93ccb[_0x32a950(0x16f)]>0xc350?_0x93ccb[_0x32a950(0x171)](0x0,0xc350)+_0x32a950(0x25b)+_0x93ccb[_0x32a950(0x16f)]+_0x32a950(0x250):_0x93ccb:_0x32a950(0x182)+(_0x11caf5||_0x32a950(0x264))+']','original_code_length':_0x93ccb?.[_0x32a950(0x16f)]??0x0,'model':MORPH_LARGE_APPLY?_0x32a950(0x261):_0x32a950(0x15a),'dry_run':_0x744aec[_0x32a950(0x1d3)][_0x32a950(0x1ec)]}},'stack_trace':_0x1e4346 instanceof Error?_0x1e4346['stack']:undefined,'source':_0x32a950(0x1b1)})[_0x32a950(0x1ce)](()=>{}),{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x1ef)+_0x51afa9}],'isError':!![]};}}case TOOL_NAMES[_0x32a950(0x25e)]:{const _0x4cd2f7=WarpGrepArgsSchema[_0x32a950(0x1be)](_0x245588);if(!_0x4cd2f7[_0x32a950(0x1af)])return{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x26e)+_0x4cd2f7[_0x32a950(0x1dc)]}],'isError':!![]};const _0x470a1e=_0x564630=>{const _0x3bb1ff=_0x32a950,_0xee8d51=[];for(const _0x40e6b9 of _0x564630||[]){if(_0x40e6b9[_0x3bb1ff(0x161)]===_0x3bb1ff(0x227)&&Array[_0x3bb1ff(0x1f9)](_0x40e6b9[_0x3bb1ff(0x23e)]))for(const _0x8e8b17 of _0x40e6b9[_0x3bb1ff(0x23e)]){try{const _0x52744b=_0x8e8b17[_0x3bb1ff(0x265)]?.['name'],_0x462612=JSON[_0x3bb1ff(0x175)](_0x8e8b17[_0x3bb1ff(0x265)]?.[_0x3bb1ff(0x1b3)]||'{}');if(_0x52744b===_0x3bb1ff(0x1fa))_0xee8d51['push'](_0x3bb1ff(0x1bd)+_0x462612[_0x3bb1ff(0x16b)]+'\x27\x20'+(_0x462612[_0x3bb1ff(0x1ab)]||'.'));else{if(_0x52744b===_0x3bb1ff(0x1b8))_0xee8d51[_0x3bb1ff(0x18d)](_0x3bb1ff(0x249)+_0x462612[_0x3bb1ff(0x1ab)]);else{if(_0x52744b==='list_directory')_0xee8d51['push']('list_directory\x20'+(_0x462612[_0x3bb1ff(0x1a5)]||'.'));else{if(_0x52744b===_0x3bb1ff(0x1d6))_0xee8d51[_0x3bb1ff(0x18d)]('glob\x20\x27'+_0x462612[_0x3bb1ff(0x16b)]+'\x27\x20'+(_0x462612['path']||'.'));else _0x52744b===_0x3bb1ff(0x239)&&_0xee8d51['push']('finish');}}}}catch{}}}return _0xee8d51;},_0x357219=_0x4cbb2b=>{const _0x16de5c=_0x32a950,_0x2d23c1=[];if(!_0x4cbb2b||!Array[_0x16de5c(0x1f9)](_0x4cbb2b))return _0x2d23c1;const _0x2daef5=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x16de5c(0x21c),'tool':_0x16de5c(0x1b8)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x16de5c(0x209),'tool':_0x16de5c(0x1b8)},{'pattern':/\[READ ERROR\]/,'error_type':_0x16de5c(0x25a),'tool':_0x16de5c(0x1b8)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x16de5c(0x1e9),'tool':_0x16de5c(0x1b8)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x16de5c(0x258),'tool':_0x16de5c(0x15e)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x16de5c(0x26c),'tool':_0x16de5c(0x15e)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x16de5c(0x1e9),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x16de5c(0x1f2),'tool':_0x16de5c(0x1b8)},{'pattern':/not a text file/,'error_type':_0x16de5c(0x1e9),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x16de5c(0x1f2),'tool':'read'},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x16de5c(0x1b8)},{'pattern':/status="error"/,'error_type':_0x16de5c(0x1ad),'tool':'unknown'}];let _0x12c7a3=0x0;for(const _0x17fe1b of _0x4cbb2b){_0x17fe1b['role']===_0x16de5c(0x227)&&Array[_0x16de5c(0x1f9)](_0x17fe1b[_0x16de5c(0x23e)])&&_0x12c7a3++;const _0x2ce0e7=_0x17fe1b[_0x16de5c(0x19d)];if((_0x17fe1b[_0x16de5c(0x161)]===_0x16de5c(0x191)||_0x17fe1b['role']===_0x16de5c(0x1dd))&&_0x2ce0e7&&typeof _0x2ce0e7===_0x16de5c(0x263))for(const {pattern:_0x4bdb92,error_type:_0x5c417f,tool:_0x1efc41}of _0x2daef5){const _0x5968e9=_0x2ce0e7[_0x16de5c(0x17a)](new RegExp(_0x4bdb92['source'],'g'));if(_0x5968e9)for(const _0x124020 of _0x5968e9){const _0x580188=_0x2ce0e7[_0x16de5c(0x1e4)](_0x124020),_0x61d187=_0x2ce0e7[_0x16de5c(0x171)](_0x580188,Math[_0x16de5c(0x212)](_0x580188+0xc8,_0x2ce0e7[_0x16de5c(0x16f)]));_0x2d23c1[_0x16de5c(0x18d)]({'tool':_0x1efc41,'error_type':_0x5c417f,'error_message':_0x61d187[_0x16de5c(0x1ff)]('\x0a')[0x0],'turn':_0x12c7a3});}}}return _0x2d23c1;};try{const _0x59761f=a0_0x2fcbcf['resolve'](_0x4cd2f7['data'][_0x32a950(0x276)]),_0x5c6041=_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x1cf)],_0x5182ff=_0x5c6041===_0x32a950(0x184)?{'allowNames':['node_modules']}:undefined,_0x2f79bc=new LocalRipgrepProvider(_0x59761f,undefined,_0x5182ff);logger[_0x32a950(0x197)](_0x32a950(0x156),_0x32a950(0x218),{'type':_0x32a950(0x155),'repo_root':_0x59761f,'search_type':_0x5c6041||_0x32a950(0x283)}),logger[_0x32a950(0x197)]('MCP','warp_grep_start',{'query':_0x4cd2f7[_0x32a950(0x1d3)]['search_string'],'repo_root':_0x59761f,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x41ef83=Date[_0x32a950(0x170)](),_0x250d74=await runWarpGrep({'searchTerm':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x195)],'repoRoot':_0x59761f,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x2f79bc,'search_type':_0x5c6041}),_0x4027fd=Date[_0x32a950(0x170)]()-_0x41ef83,_0x3f79f6=_0x250d74[_0x32a950(0x239)]?.[_0x32a950(0x15d)]?.[_0x32a950(0x278)]?.['length']??0x0;logger[_0x32a950(0x197)](_0x32a950(0x156),'warp_grep_complete',{'termination':_0x250d74[_0x32a950(0x272)],'turns':_0x250d74[_0x32a950(0x26a)]?.['turns']??0x0,'files_found':_0x3f79f6,'latency_ms':_0x4027fd});const _0xad8399=_0x357219(_0x250d74[_0x32a950(0x248)]);_0xad8399[_0x32a950(0x16f)]>0x0&&reportMorphError({'error_message':_0x32a950(0x16c)+_0xad8399['length']+'\x20error(s)','error_type':_0x32a950(0x24f),'level':_0x32a950(0x262),'tool':'codebase_search','context':{'repo_path':_0x4cd2f7['data'][_0x32a950(0x276)],'query':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x195)],'model':_0x32a950(0x208),'termination_reason':_0x250d74[_0x32a950(0x272)],'sub_tool_errors':_0xad8399,'timings':_0x250d74['timings'],'tool_calls':_0x470a1e(_0x250d74['messages']),'messages':_0x250d74['messages']?.[_0x32a950(0x236)](_0x5dc8b8=>({'role':_0x5dc8b8['role'],'content':_0x5dc8b8['content'],..._0x5dc8b8[_0x32a950(0x23e)]?{'tool_calls':_0x5dc8b8[_0x32a950(0x23e)][_0x32a950(0x16f)]}:{},..._0x5dc8b8['tool_call_id']?{'tool_call_id':_0x5dc8b8[_0x32a950(0x185)]}:{}}))},'source':'mcp-filesystem'})[_0x32a950(0x1ce)](()=>{});let _0xcc351d='';if(_0x250d74[_0x32a950(0x272)]===_0x32a950(0x1a6)&&_0x250d74[_0x32a950(0x239)]?.[_0x32a950(0x15d)]?.[_0x32a950(0x278)]){const _0xbc4e8d=_0x250d74['finish'][_0x32a950(0x15d)][_0x32a950(0x278)];if(_0xbc4e8d['length']===0x0)return _0xcc351d=_0x250d74[_0x32a950(0x239)][_0x32a950(0x15b)]||_0x32a950(0x165),{'content':[{'type':_0x32a950(0x245),'text':_0xcc351d}]};const _0xbca72d=[],_0x486a34=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x4a3721 of _0x250d74[_0x32a950(0x248)]){if(_0x4a3721[_0x32a950(0x161)]==='assistant'&&Array['isArray'](_0x4a3721[_0x32a950(0x23e)]))for(const _0x2f733b of _0x4a3721[_0x32a950(0x23e)]){try{const _0x260279=_0x2f733b[_0x32a950(0x265)]?.[_0x32a950(0x17d)],_0x493380=JSON[_0x32a950(0x175)](_0x2f733b[_0x32a950(0x265)]?.[_0x32a950(0x1b3)]||'{}');if(_0x260279===_0x32a950(0x1fa))_0x486a34[_0x32a950(0x18d)](_0x32a950(0x253)+_0x493380[_0x32a950(0x16b)]+_0x32a950(0x240)+(_0x493380[_0x32a950(0x1ab)]||'.')+'`');else{if(_0x260279===_0x32a950(0x1b8))_0x486a34[_0x32a950(0x18d)](_0x32a950(0x187)+_0x493380['path']+'`');else{if(_0x260279===_0x32a950(0x1cb))_0x486a34[_0x32a950(0x18d)](_0x32a950(0x183)+(_0x493380['command']||'.')+'`');else _0x260279==='glob'&&_0x486a34[_0x32a950(0x18d)](_0x32a950(0x200)+_0x493380['pattern']+_0x32a950(0x26b)+(_0x493380[_0x32a950(0x1ab)]||'.')+'`');}}}catch{}}}_0xbca72d['push'](_0x486a34[_0x32a950(0x27f)]('\x0a'));const _0x4f8e7f=['',_0x32a950(0x211)];for(const _0x370147 of _0xbc4e8d){if(_0x370147[_0x32a950(0x1f7)]==='*')_0x4f8e7f[_0x32a950(0x18d)]('-\x20'+_0x370147[_0x32a950(0x1ab)]+':*');else{if(Array['isArray'](_0x370147[_0x32a950(0x1f7)])){const _0x375efe=_0x370147['lines'][_0x32a950(0x236)](([_0x16b57a,_0x37a7ee])=>{if(_0x16b57a===_0x37a7ee)return''+_0x16b57a;return _0x16b57a+'-'+_0x37a7ee;});_0x4f8e7f[_0x32a950(0x18d)]('-\x20'+_0x370147[_0x32a950(0x1ab)]+':'+_0x375efe[_0x32a950(0x27f)](','));}else _0x4f8e7f['push']('-\x20'+_0x370147[_0x32a950(0x1ab)]+':*');}}_0x4f8e7f[_0x32a950(0x18d)](''),_0xbca72d['push'](_0x4f8e7f[_0x32a950(0x27f)]('\x0a')),_0xbca72d[_0x32a950(0x18d)](_0x32a950(0x18f));const _0x54c0fa=[],_0x55c9b3=[];for(const _0x5507cb of _0xbc4e8d){let _0x5dd10d=a0_0x2fcbcf[_0x32a950(0x17c)](_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],_0x5507cb['path']),_0x19d0d8=null,_0x338417=null;try{_0x19d0d8=await a0_0x38ee0b[_0x32a950(0x214)](_0x5dd10d,{'encoding':_0x32a950(0x1e7)});}catch(_0x5e0bbc){const _0x136c76=fixPathRepetition(_0x5dd10d);if(_0x136c76)try{_0x19d0d8=await a0_0x38ee0b['readFile'](_0x136c76,{'encoding':_0x32a950(0x1e7)}),_0x5dd10d=_0x136c76;}catch{_0x338417=_0x5e0bbc instanceof Error?_0x5e0bbc:new Error(String(_0x5e0bbc));}else _0x338417=_0x5e0bbc instanceof Error?_0x5e0bbc:new Error(String(_0x5e0bbc));}if(_0x19d0d8!==null){const _0x4a1fff=_0x19d0d8[_0x32a950(0x1ff)](/\r?\n/),_0x550107=[];if(_0x5507cb['lines']==='*'||!Array[_0x32a950(0x1f9)](_0x5507cb['lines']))for(let _0x3126cf=0x1;_0x3126cf<=_0x4a1fff[_0x32a950(0x16f)];_0x3126cf++){const _0x2a4359=_0x4a1fff[_0x3126cf-0x1];_0x550107['push'](_0x3126cf+'|\x20'+_0x2a4359);}else for(const [_0x37230c,_0x850772]of _0x5507cb[_0x32a950(0x1f7)]){_0x550107[_0x32a950(0x16f)]>0x0&&_0x550107[_0x32a950(0x18d)]('');for(let _0x517de0=_0x37230c;_0x517de0<=_0x850772&&_0x517de0<=_0x4a1fff[_0x32a950(0x16f)];_0x517de0++){const _0x5740df=_0x4a1fff[_0x517de0-0x1];_0x550107[_0x32a950(0x18d)](_0x517de0+'|\x20'+_0x5740df);}}_0x55c9b3['push']({'path':_0x5507cb[_0x32a950(0x1ab)],'content':_0x550107[_0x32a950(0x27f)]('\x0a')});}else _0x54c0fa[_0x32a950(0x18d)](_0x32a950(0x1b0)+_0x5507cb[_0x32a950(0x1ab)]+_0x32a950(0x22d)+(_0x338417?.[_0x32a950(0x277)]||_0x32a950(0x199))+_0x32a950(0x20c));}try{const _0x2c4d1d=await compactFileContexts(_0x55c9b3,_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x195)],MORPH_API_KEY,MORPH_API_URL);for(const _0x358bf7 of _0x2c4d1d){_0x54c0fa[_0x32a950(0x18d)](_0x32a950(0x1b0)+_0x358bf7[_0x32a950(0x1ab)]+_0x32a950(0x157)+_0x358bf7[_0x32a950(0x19d)]+_0x32a950(0x20c));}}catch(_0x3d1fc6){logger[_0x32a950(0x262)](_0x32a950(0x156),_0x32a950(0x1f4),{'error':_0x3d1fc6 instanceof Error?_0x3d1fc6[_0x32a950(0x277)]:String(_0x3d1fc6),'files_count':_0x55c9b3[_0x32a950(0x16f)]});for(const _0x256848 of _0x55c9b3){_0x54c0fa[_0x32a950(0x18d)](_0x32a950(0x1b0)+_0x256848['path']+_0x32a950(0x157)+_0x256848[_0x32a950(0x19d)]+'\x0a</file>');}}_0xbca72d['push'](_0x54c0fa['join']('\x0a\x0a')),_0xcc351d=_0xbca72d[_0x32a950(0x27f)]('\x0a');const _0x4bd632=_0x250d74['errors']?.['filter'](_0x3ce1d8=>_0x3ce1d8[_0x32a950(0x277)]?.[_0x32a950(0x166)](_0x32a950(0x238)))||[];if(_0x4bd632[_0x32a950(0x16f)]>0x0){const _0x418e5d=_0x4bd632[_0x32a950(0x236)](_0xf421c0=>_0xf421c0['message'])['join'](';\x20');reportMorphError({'error_message':_0x418e5d,'error_type':_0x32a950(0x19a),'context':{'tool':'codebase_search','repo_path':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],'query':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x195)],'model':_0x32a950(0x208),'termination_reason':_0x32a950(0x256),'error_count':_0x4bd632[_0x32a950(0x16f)],'is_timeout':![],'timings':_0x250d74[_0x32a950(0x26a)],'files_attempted':_0xbc4e8d['map'](_0x2f62bf=>({'path':_0x2f62bf[_0x32a950(0x1ab)],'lines':_0x2f62bf[_0x32a950(0x1f7)]})),'tool_calls':_0x470a1e(_0x250d74[_0x32a950(0x248)]),'messages':_0x250d74[_0x32a950(0x248)]?.[_0x32a950(0x236)](_0x28084c=>({'role':_0x28084c['role'],'content':_0x28084c[_0x32a950(0x19d)],..._0x28084c[_0x32a950(0x23e)]?{'tool_calls':_0x28084c['tool_calls'][_0x32a950(0x16f)]}:{},..._0x28084c[_0x32a950(0x185)]?{'tool_call_id':_0x28084c[_0x32a950(0x185)]}:{}})),'request_content':{'query':_0x4cd2f7['data'][_0x32a950(0x195)],'repo_path':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],'repoRoot':a0_0x2fcbcf[_0x32a950(0x17c)](_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)]),'model':_0x32a950(0x208)}},'source':_0x32a950(0x1b1)})[_0x32a950(0x1ce)](()=>{});}}else{if(_0x250d74[_0x32a950(0x272)]===_0x32a950(0x235)&&_0x250d74[_0x32a950(0x1e5)][_0x32a950(0x16f)]>0x0){const _0x2c5fe1=_0x250d74[_0x32a950(0x1e5)][_0x32a950(0x236)](_0x9d0ee7=>_0x9d0ee7[_0x32a950(0x277)])[_0x32a950(0x27f)](';\x20');_0xcc351d=_0x32a950(0x281)+_0x2c5fe1;const _0x1e1af5=_0x2c5fe1['toLowerCase']()[_0x32a950(0x1a3)](_0x32a950(0x1ac))||_0x2c5fe1['toLowerCase']()[_0x32a950(0x1a3)]('timed\x20out')||_0x2c5fe1['toLowerCase']()['includes'](_0x32a950(0x194)),_0x5d1391=_0x250d74[_0x32a950(0x239)]?.['metadata']?.['files'],_0x5a792d=_0x250d74[_0x32a950(0x1e5)][0x0];reportMorphError({'error_message':_0x2c5fe1,'error_type':_0x1e1af5?_0x32a950(0x1df):_0x5a792d?.[_0x32a950(0x1bb)]?.[_0x32a950(0x17d)]||'WarpGrepError','context':{'tool':_0x32a950(0x17b),'repo_path':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],'query':_0x4cd2f7[_0x32a950(0x1d3)]['search_string'],'model':_0x32a950(0x208),'termination_reason':_0x250d74['terminationReason'],'error_count':_0x250d74[_0x32a950(0x1e5)]['length'],'is_timeout':_0x1e1af5,'timings':_0x250d74['timings'],'files_attempted':_0x5d1391?.['map'](_0x2c6074=>({'path':_0x2c6074['path'],'lines':_0x2c6074[_0x32a950(0x1f7)]})),'tool_calls':_0x470a1e(_0x250d74['messages']),'messages':_0x250d74[_0x32a950(0x248)]?.[_0x32a950(0x236)](_0x4f0fcf=>({'role':_0x4f0fcf[_0x32a950(0x161)],'content':_0x4f0fcf['content'],..._0x4f0fcf[_0x32a950(0x23e)]?{'tool_calls':_0x4f0fcf[_0x32a950(0x23e)][_0x32a950(0x16f)]}:{},..._0x4f0fcf['tool_call_id']?{'tool_call_id':_0x4f0fcf[_0x32a950(0x185)]}:{}})),'request_content':{'query':_0x4cd2f7[_0x32a950(0x1d3)]['search_string'],'repo_path':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],'repoRoot':a0_0x2fcbcf[_0x32a950(0x17c)](_0x4cd2f7['data']['repo_path']),'model':_0x32a950(0x208)}},'stack_trace':_0x5a792d?.[_0x32a950(0x221)]||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0xcc351d=_0x32a950(0x1ba);}return{'content':[{'type':_0x32a950(0x245),'text':_0xcc351d}]};}catch(_0xae8f8a){const _0xfc3dc7=handleMorphAPIError(_0xae8f8a);if(_0xfc3dc7)return logger['error']('MCP',_0x32a950(0x228),{'tool':_0x32a950(0x17b),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x32a950(0x170)]()-_0x44c3bf}),_0xfc3dc7;const _0x36875c=_0xae8f8a instanceof Error?_0xae8f8a[_0x32a950(0x277)]:String(_0xae8f8a);logger[_0x32a950(0x1dc)]('MCP',_0x32a950(0x228),{'tool':'codebase_search','error':_0x36875c,'repo_path':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],'query':_0x4cd2f7['data'][_0x32a950(0x195)],'latency_ms':Date[_0x32a950(0x170)]()-_0x44c3bf});const _0x35ac39=_0x36875c[_0x32a950(0x1bc)]()[_0x32a950(0x1a3)](_0x32a950(0x1ac))||_0x36875c[_0x32a950(0x1bc)]()[_0x32a950(0x1a3)](_0x32a950(0x180))||_0x36875c['toLowerCase']()[_0x32a950(0x1a3)]('etimedout')||_0xae8f8a instanceof Error&&_0xae8f8a['name']===_0x32a950(0x1df);return reportMorphError({'error_message':_0x36875c,'error_type':_0x35ac39?_0x32a950(0x1df):_0xae8f8a instanceof Error?_0xae8f8a[_0x32a950(0x1bb)]['name']:_0x32a950(0x205),'context':{'tool':_0x32a950(0x17b),'repo_path':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)],'query':_0x4cd2f7['data'][_0x32a950(0x195)],'model':'morph-warp-grep-v2.1','is_timeout':_0x35ac39,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x195)],'repo_path':_0x4cd2f7['data'][_0x32a950(0x276)],'repoRoot':a0_0x2fcbcf[_0x32a950(0x17c)](_0x4cd2f7[_0x32a950(0x1d3)][_0x32a950(0x276)]),'model':_0x32a950(0x208)}},'stack_trace':_0xae8f8a instanceof Error?_0xae8f8a[_0x32a950(0x221)]:undefined,'source':_0x32a950(0x1b1)})[_0x32a950(0x1ce)](()=>{}),{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x1c0)+_0x36875c}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x7b96b9=WarpGrepGitHubArgsSchema[_0x32a950(0x1be)](_0x245588);if(!_0x7b96b9[_0x32a950(0x1af)])return{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x26e)+_0x7b96b9[_0x32a950(0x1dc)]}],'isError':!![]};const _0x455e94=_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x19f)]||_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x18b)];if(!_0x455e94)return{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x23f)}],'isError':!![]};const _0x3fe051=MORPH_API_KEY;if(!_0x3fe051)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x4b9c0e=Date['now']();logger[_0x32a950(0x197)](_0x32a950(0x156),_0x32a950(0x1c7),{'identifier':_0x455e94,'query':_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x195)],'branch':_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x1cc)]});try{const _0xaa803b=new WarpGrepClient({'morphApiKey':_0x3fe051,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4932a2=await _0xaa803b[_0x32a950(0x271)]({'searchTerm':_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x195)],'github':_0x455e94,'branch':_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x1cc)]}),_0x4dcd68=Date['now']()-_0x4b9c0e;logMcpStderr(_0x32a950(0x19e)+_0x4dcd68+'ms.\x20Success:\x20'+_0x4932a2[_0x32a950(0x1af)]);const _0x4e981a=formatResult(_0x4932a2);return{'content':[{'type':'text','text':_0x4e981a}]};}catch(_0x1cecd2){const _0xdba2fe=handleMorphAPIError(_0x1cecd2);if(_0xdba2fe)return _0xdba2fe;const _0x2d860d=Date['now']()-_0x4b9c0e,_0x193fc9=_0x1cecd2 instanceof Error?_0x1cecd2[_0x32a950(0x277)]:String(_0x1cecd2);return logMcpStderr(_0x32a950(0x23b)+_0x2d860d+'ms:',_0x193fc9),reportMorphError({'error_message':_0x193fc9,'error_type':_0x1cecd2 instanceof Error?_0x1cecd2[_0x32a950(0x1bb)]['name']:_0x32a950(0x205),'context':{'tool':_0x32a950(0x1c4),'github_url':_0x455e94,'search_string':_0x7b96b9[_0x32a950(0x1d3)][_0x32a950(0x195)],'branch':_0x7b96b9[_0x32a950(0x1d3)]['branch']},'stack_trace':_0x1cecd2 instanceof Error?_0x1cecd2[_0x32a950(0x221)]:undefined,'source':_0x32a950(0x1b1),'tool':_0x32a950(0x1c4),'latency_ms':_0x2d860d})[_0x32a950(0x1ce)](()=>{}),{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x282)+_0x193fc9}],'isError':![]};}}default:throw new Error(_0x32a950(0x1f0)+_0x5ec9b5);}}catch(_0xa6e2d3){const _0x56b6c1=_0xa6e2d3 instanceof Error?_0xa6e2d3['message']:String(_0xa6e2d3);return reportMorphError({'error_message':_0x56b6c1,'error_type':_0xa6e2d3 instanceof Error?_0xa6e2d3[_0x32a950(0x1bb)]['name']:_0x32a950(0x205),'context':{'tool':_0x5ec9b5,'arguments':_0x245588?JSON['stringify'](_0x245588)[_0x32a950(0x171)](0x0,0x1f4):undefined,'mcp_server_version':_0x32a950(0x1e3)},'stack_trace':_0xa6e2d3 instanceof Error?_0xa6e2d3[_0x32a950(0x221)]:undefined,'source':_0x32a950(0x1b1)})['catch'](()=>{}),{'content':[{'type':_0x32a950(0x245),'text':_0x32a950(0x281)+_0x56b6c1}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4f2ba9){const _0x2d3ba7=a0_0xc88ac9,_0x4b2fe9=await getValidRootDirectories(_0x4f2ba9);if(_0x4b2fe9['length']>0x0)allowedDirectories=[..._0x4b2fe9],logMcpStderr(_0x2d3ba7(0x1fb)+_0x4b2fe9[_0x2d3ba7(0x16f)]+_0x2d3ba7(0x273));else{logMcpStderr(_0x2d3ba7(0x243));if(ENABLE_WORKSPACE_MODE)try{const _0x3644a5=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x3644a5&&(allowedDirectories=[_0x3644a5],logMcpStderr(_0x2d3ba7(0x1d8)+_0x3644a5));}catch(_0x39c73b){logMcpStderr(_0x2d3ba7(0x280)+_0x39c73b);}}}server[a0_0xc88ac9(0x22e)](RootsListChangedNotificationSchema,async()=>{const _0x18ece7=a0_0xc88ac9;try{const _0x2a2e48=await server['listRoots']();_0x2a2e48&&_0x18ece7(0x190)in _0x2a2e48&&await updateAllowedDirectoriesFromRoots(_0x2a2e48[_0x18ece7(0x190)]);}catch(_0x145b6d){logMcpStderr(_0x18ece7(0x1e8),_0x145b6d instanceof Error?_0x145b6d['message']:String(_0x145b6d));}}),server[a0_0xc88ac9(0x1f8)]=async()=>{const _0xcd9248=a0_0xc88ac9,_0x4b2aa4=server['getClientCapabilities']();if(_0x4b2aa4?.[_0xcd9248(0x190)])try{const _0x1a9ba0=await server['listRoots']();_0x1a9ba0&&_0xcd9248(0x190)in _0x1a9ba0?await updateAllowedDirectoriesFromRoots(_0x1a9ba0[_0xcd9248(0x190)]):logMcpStderr(_0xcd9248(0x21e));}catch(_0x44085c){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x44085c instanceof Error?_0x44085c[_0xcd9248(0x277)]:String(_0x44085c));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0xcd9248(0x23a),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0xcd9248(0x23c));}}};async function runServer(){const _0x5ef245=a0_0xc88ac9,_0x5309a2=new StdioServerTransport();await server[_0x5ef245(0x1a9)](_0x5309a2),logMcpStderr(_0x5ef245(0x1a2)),allowedDirectories[_0x5ef245(0x16f)]===0x0&&logMcpStderr(_0x5ef245(0x16a));}runServer()[a0_0xc88ac9(0x1ce)](_0x5572ca=>{const _0x3dfdad=a0_0xc88ac9;logMcpStderr(_0x3dfdad(0x196),_0x5572ca),process[_0x3dfdad(0x16e)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- function a1_0x4a1c(_0x455748,_0x3c0601){_0x455748=_0x455748-0x1bd;var _0x544434=a1_0x5444();var _0x4a1cf9=_0x544434[_0x455748];return _0x4a1cf9;}var a1_0xcfa1e6=a1_0x4a1c;(function(_0x156c9d,_0x4a0195){var _0x3e661c=a1_0x4a1c,_0x1d4765=_0x156c9d();while(!![]){try{var _0x1f0255=parseInt(_0x3e661c(0x1c1))/0x1+parseInt(_0x3e661c(0x1c2))/0x2+parseInt(_0x3e661c(0x1c6))/0x3+parseInt(_0x3e661c(0x1c3))/0x4+-parseInt(_0x3e661c(0x1cb))/0x5+-parseInt(_0x3e661c(0x1cf))/0x6*(-parseInt(_0x3e661c(0x1bd))/0x7)+-parseInt(_0x3e661c(0x1ce))/0x8*(parseInt(_0x3e661c(0x1c4))/0x9);if(_0x1f0255===_0x4a0195)break;else _0x1d4765['push'](_0x1d4765['shift']());}catch(_0x5f2e66){_0x1d4765['push'](_0x1d4765['shift']());}}}(a1_0x5444,0x7af87));import a1_0x567204 from'os';import{logger}from'./logger.js';function a1_0x5444(){var _0x5e3f04=['map','Linux','platform','539529oPfvJl','1838506SqOTBU','894984LcHUiT','1005174eIWjZj','info','2773632IXsyvg','[os=','linux','length','Unknown','1109640sPtxCD','error','MCP','184YRRHxN','54kxXqOR','534583Kozbcf'];a1_0x5444=function(){return _0x5e3f04;};return a1_0x5444();}export function getOperatingSystemType(_0x38f7d5=a1_0x567204[a1_0xcfa1e6(0x1c0)]()){var _0x44f91b=a1_0xcfa1e6;switch(_0x38f7d5){case'darwin':return'macOS';case'win32':return'Windows';case _0x44f91b(0x1c8):return _0x44f91b(0x1bf);default:return _0x44f91b(0x1ca);}}export function formatMcpLogMessage(_0x255ced,_0x6ba00a=a1_0x567204[a1_0xcfa1e6(0x1c0)]()){var _0x310371=a1_0xcfa1e6;return _0x310371(0x1c7)+getOperatingSystemType(_0x6ba00a)+']\x20'+_0x255ced;}export function logMcpStderr(_0x2509a1,..._0x563016){var _0x57b3c8=a1_0xcfa1e6;console[_0x57b3c8(0x1cc)](formatMcpLogMessage(_0x2509a1),..._0x563016),logger[_0x57b3c8(0x1c5)](_0x57b3c8(0x1cd),_0x2509a1,_0x563016[_0x57b3c8(0x1c9)]?{'args':_0x563016[_0x57b3c8(0x1be)](_0x41eb1b=>String(_0x41eb1b))}:undefined);}
1
+ var a1_0x46753c=a1_0x530c;(function(_0x52f32a,_0x476b7e){var _0x345cd7=a1_0x530c,_0x6ba256=_0x52f32a();while(!![]){try{var _0x20fd58=parseInt(_0x345cd7(0xcb))/0x1*(parseInt(_0x345cd7(0xd1))/0x2)+-parseInt(_0x345cd7(0xce))/0x3+parseInt(_0x345cd7(0xc7))/0x4*(parseInt(_0x345cd7(0xc4))/0x5)+parseInt(_0x345cd7(0xca))/0x6*(parseInt(_0x345cd7(0xd3))/0x7)+-parseInt(_0x345cd7(0xc0))/0x8+-parseInt(_0x345cd7(0xd4))/0x9+parseInt(_0x345cd7(0xc8))/0xa;if(_0x20fd58===_0x476b7e)break;else _0x6ba256['push'](_0x6ba256['shift']());}catch(_0x3ae6e6){_0x6ba256['push'](_0x6ba256['shift']());}}}(a1_0x28ec,0x3ef9b));function a1_0x530c(_0x14654b,_0x449404){_0x14654b=_0x14654b-0xc0;var _0x28ec8a=a1_0x28ec();var _0x530c3c=_0x28ec8a[_0x14654b];return _0x530c3c;}import a1_0x1b3941 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x2972db=a1_0x1b3941['platform']()){var _0x2220ea=a1_0x530c;switch(_0x2972db){case _0x2220ea(0xd2):return _0x2220ea(0xcc);case _0x2220ea(0xc9):return _0x2220ea(0xcd);case _0x2220ea(0xd0):return _0x2220ea(0xcf);default:return _0x2220ea(0xd5);}}function a1_0x28ec(){var _0x279fc5=['114CXunZl','4540SzJhZO','macOS','Windows','160284vGiwat','Linux','linux','40FokveA','darwin','83489vhQbBU','4336101guLtDX','Unknown','2586392xwOXrW','MCP','[os=','platform','587645SyNYGq','map','error','4jbkqEC','6815210qZNxCx','win32'];a1_0x28ec=function(){return _0x279fc5;};return a1_0x28ec();}export function formatMcpLogMessage(_0x136e23,_0x27af1e=a1_0x1b3941[a1_0x46753c(0xc3)]()){var _0x10604f=a1_0x46753c;return _0x10604f(0xc2)+getOperatingSystemType(_0x27af1e)+']\x20'+_0x136e23;}export function logMcpStderr(_0x3de374,..._0x159d9f){var _0x324fae=a1_0x46753c;console[_0x324fae(0xc6)](formatMcpLogMessage(_0x3de374),..._0x159d9f),logger['info'](_0x324fae(0xc1),_0x3de374,_0x159d9f['length']?{'args':_0x159d9f[_0x324fae(0xc5)](_0x3220c5=>String(_0x3220c5))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- function a2_0xe49f(_0x5bc438,_0x4e5319){_0x5bc438=_0x5bc438-0x77;const _0x3a5386=a2_0x3a53();let _0xe49f55=_0x3a5386[_0x5bc438];return _0xe49f55;}const a2_0x22628d=a2_0xe49f;(function(_0x68f63b,_0x44b422){const _0x98057d=a2_0xe49f,_0x25e111=_0x68f63b();while(!![]){try{const _0x3f1241=parseInt(_0x98057d(0x7a))/0x1+-parseInt(_0x98057d(0x8e))/0x2*(-parseInt(_0x98057d(0x88))/0x3)+-parseInt(_0x98057d(0x7e))/0x4*(-parseInt(_0x98057d(0x90))/0x5)+parseInt(_0x98057d(0x77))/0x6*(-parseInt(_0x98057d(0x7f))/0x7)+-parseInt(_0x98057d(0x8f))/0x8*(-parseInt(_0x98057d(0x8c))/0x9)+-parseInt(_0x98057d(0x86))/0xa+-parseInt(_0x98057d(0x89))/0xb;if(_0x3f1241===_0x44b422)break;else _0x25e111['push'](_0x25e111['shift']());}catch(_0x53e76d){_0x25e111['push'](_0x25e111['shift']());}}}(a2_0x3a53,0x32d35));import{createWriteStream}from'fs';function a2_0x3a53(){const _0x37d40d=['info','MORPH_DEBUG','113897oVpHkv','write','debug','toUpperCase','4QOSNbR','2299003MHtBcC','MORPH_LOG_FILE','enabled','warn','enable','fileStream','error','1352240CZCsWV','_log','14376uNaxpv','312664GMNlFh',']\x20[','stringify','9aISvqj','env','134bVslwr','1129400WINPAE','620610haVpOI','6NTPxhL'];a2_0x3a53=function(){return _0x37d40d;};return a2_0x3a53();}class MorphLogger{[a2_0x22628d(0x81)];[a2_0x22628d(0x84)];constructor(){const _0x12ce52=a2_0x22628d;this['enabled']=process[_0x12ce52(0x8d)][_0x12ce52(0x79)]==='1'||!!process[_0x12ce52(0x8d)][_0x12ce52(0x80)];const _0x39ff8f=process[_0x12ce52(0x8d)]['MORPH_LOG_FILE'];this[_0x12ce52(0x84)]=_0x39ff8f?createWriteStream(_0x39ff8f,{'flags':'a'}):null;}['debug'](_0x2986e9,_0x1bb067,_0x549c95){const _0x32412d=a2_0x22628d;this[_0x32412d(0x87)](_0x32412d(0x7c),_0x2986e9,_0x1bb067,_0x549c95);}[a2_0x22628d(0x78)](_0x312369,_0x455cac,_0x4d06b1){const _0x3fb8c9=a2_0x22628d;this[_0x3fb8c9(0x87)](_0x3fb8c9(0x78),_0x312369,_0x455cac,_0x4d06b1);}['warn'](_0x748f55,_0x1c6dd6,_0x45d1f6){const _0x1606af=a2_0x22628d;this['_log'](_0x1606af(0x82),_0x748f55,_0x1c6dd6,_0x45d1f6);}[a2_0x22628d(0x85)](_0x43dbe7,_0x3aac8b,_0x34e8ac){this['_log']('error',_0x43dbe7,_0x3aac8b,_0x34e8ac);}[a2_0x22628d(0x83)](){const _0x2b8023=a2_0x22628d;this[_0x2b8023(0x81)]=!![];}get['isEnabled'](){const _0x1342bf=a2_0x22628d;return this[_0x1342bf(0x81)];}[a2_0x22628d(0x87)](_0x14b0fe,_0x4bce80,_0x26aa7f,_0x278bf9){const _0x13ba5b=a2_0x22628d;if(_0x14b0fe!=='error'&&!this[_0x13ba5b(0x81)])return;const _0x1bcd0e=new Date()['toISOString'](),_0x534a79='['+_0x1bcd0e+_0x13ba5b(0x8a)+_0x14b0fe[_0x13ba5b(0x7d)]()+_0x13ba5b(0x8a)+_0x4bce80+']';console[_0x13ba5b(0x85)](_0x278bf9?_0x534a79+'\x20'+_0x26aa7f+'\x20'+JSON[_0x13ba5b(0x8b)](_0x278bf9):_0x534a79+'\x20'+_0x26aa7f),this[_0x13ba5b(0x84)]?.[_0x13ba5b(0x7b)](JSON['stringify']({'ts':_0x1bcd0e,'level':_0x14b0fe,'component':_0x4bce80,'msg':_0x26aa7f,..._0x278bf9&&{'data':_0x278bf9}})+'\x0a');}}export const logger=new MorphLogger();
1
+ function a2_0x4339(){const _0xbc4be9=[']\x20[','2192kBoARY','stringify','error','7465255kxrtDB','toISOString','enable','7494516aoYGOl','_log','warn','debug','388iplkAi','write','info','enabled','fileStream','3095460usUfNu','132208CyIDee','3wtvUgT','env','4486152vkYjas','11764593wWBgHf','isEnabled'];a2_0x4339=function(){return _0xbc4be9;};return a2_0x4339();}const a2_0x476d74=a2_0x38f1;function a2_0x38f1(_0x472384,_0x440b1f){_0x472384=_0x472384-0x155;const _0x433903=a2_0x4339();let _0x38f196=_0x433903[_0x472384];return _0x38f196;}(function(_0x5ecf55,_0x53fbad){const _0x1010c2=a2_0x38f1,_0xc903a0=_0x5ecf55();while(!![]){try{const _0x34ccf2=parseInt(_0x1010c2(0x168))/0x1*(parseInt(_0x1010c2(0x15e))/0x2)+-parseInt(_0x1010c2(0x158))/0x3*(-parseInt(_0x1010c2(0x157))/0x4)+parseInt(_0x1010c2(0x156))/0x5+-parseInt(_0x1010c2(0x164))/0x6+-parseInt(_0x1010c2(0x161))/0x7+parseInt(_0x1010c2(0x15a))/0x8+parseInt(_0x1010c2(0x15b))/0x9;if(_0x34ccf2===_0x53fbad)break;else _0xc903a0['push'](_0xc903a0['shift']());}catch(_0xf8a70d){_0xc903a0['push'](_0xc903a0['shift']());}}}(a2_0x4339,0x99c1b));import{createWriteStream}from'fs';class MorphLogger{[a2_0x476d74(0x16b)];[a2_0x476d74(0x155)];constructor(){const _0x1991cc=a2_0x476d74;this['enabled']=process[_0x1991cc(0x159)]['MORPH_DEBUG']==='1'||!!process[_0x1991cc(0x159)]['MORPH_LOG_FILE'];const _0x6388da=process['env']['MORPH_LOG_FILE'];this[_0x1991cc(0x155)]=_0x6388da?createWriteStream(_0x6388da,{'flags':'a'}):null;}[a2_0x476d74(0x167)](_0x57af0c,_0x480b05,_0x4cd7f3){const _0x5938f8=a2_0x476d74;this['_log'](_0x5938f8(0x167),_0x57af0c,_0x480b05,_0x4cd7f3);}[a2_0x476d74(0x16a)](_0x590877,_0xccf82b,_0xb91d0){const _0x3c7aa5=a2_0x476d74;this[_0x3c7aa5(0x165)](_0x3c7aa5(0x16a),_0x590877,_0xccf82b,_0xb91d0);}[a2_0x476d74(0x166)](_0x39175c,_0x3f9fdc,_0x4330e7){const _0x1745ec=a2_0x476d74;this[_0x1745ec(0x165)](_0x1745ec(0x166),_0x39175c,_0x3f9fdc,_0x4330e7);}[a2_0x476d74(0x160)](_0x264e3f,_0x582517,_0x55521c){const _0x138da3=a2_0x476d74;this[_0x138da3(0x165)]('error',_0x264e3f,_0x582517,_0x55521c);}[a2_0x476d74(0x163)](){const _0x4c48eb=a2_0x476d74;this[_0x4c48eb(0x16b)]=!![];}get[a2_0x476d74(0x15c)](){const _0x129707=a2_0x476d74;return this[_0x129707(0x16b)];}[a2_0x476d74(0x165)](_0x319338,_0x3e3f93,_0x15d700,_0x21d6d9){const _0xb05933=a2_0x476d74;if(_0x319338!=='error'&&!this[_0xb05933(0x16b)])return;const _0x5a0d0b=new Date()[_0xb05933(0x162)](),_0x56690b='['+_0x5a0d0b+_0xb05933(0x15d)+_0x319338['toUpperCase']()+_0xb05933(0x15d)+_0x3e3f93+']';console[_0xb05933(0x160)](_0x21d6d9?_0x56690b+'\x20'+_0x15d700+'\x20'+JSON[_0xb05933(0x15f)](_0x21d6d9):_0x56690b+'\x20'+_0x15d700),this[_0xb05933(0x155)]?.[_0xb05933(0x169)](JSON[_0xb05933(0x15f)]({'ts':_0x5a0d0b,'level':_0x319338,'component':_0x3e3f93,'msg':_0x15d700,..._0x21d6d9&&{'data':_0x21d6d9}})+'\x0a');}}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- function a3_0x3e5d(){const _0x5081a6=['homedir','1405bBSeYU','startsWith','slice','substring','222943ADhOdK','replace','join','normalize','match','84601icAmJj','5452QmLjtp','2BCpIKM','174304ApfQZj','toUpperCase','trim','102OyrrCU','1354344tQTSSs','charAt','10175715PRnipg','4065660loKDGV','198FyjDaH'];a3_0x3e5d=function(){return _0x5081a6;};return a3_0x3e5d();}(function(_0x30de78,_0x5bf1d2){const _0x57003f=a3_0xa8b1,_0x3fa0b4=_0x30de78();while(!![]){try{const _0x45c970=parseInt(_0x57003f(0x1d7))/0x1*(-parseInt(_0x57003f(0x1d9))/0x2)+-parseInt(_0x57003f(0x1de))/0x3+parseInt(_0x57003f(0x1d8))/0x4*(parseInt(_0x57003f(0x1e4))/0x5)+-parseInt(_0x57003f(0x1dd))/0x6*(-parseInt(_0x57003f(0x1e8))/0x7)+parseInt(_0x57003f(0x1da))/0x8*(parseInt(_0x57003f(0x1e2))/0x9)+parseInt(_0x57003f(0x1e1))/0xa+-parseInt(_0x57003f(0x1e0))/0xb;if(_0x45c970===_0x5bf1d2)break;else _0x3fa0b4['push'](_0x3fa0b4['shift']());}catch(_0x21c803){_0x3fa0b4['push'](_0x3fa0b4['shift']());}}}(a3_0x3e5d,0x55428));import a3_0x1fdefa from'path';function a3_0xa8b1(_0x2d2946,_0x409174){_0x2d2946=_0x2d2946-0x1d7;const _0x3e5d7e=a3_0x3e5d();let _0xa8b116=_0x3e5d7e[_0x2d2946];return _0xa8b116;}import a3_0x1a9c1e from'os';export function convertToWindowsPath(_0x47d12a){const _0x10863a=a3_0xa8b1;if(_0x47d12a[_0x10863a(0x1e5)]('/mnt/')){const _0x4126c6=_0x47d12a['charAt'](0x5)[_0x10863a(0x1db)](),_0x36bd75=_0x47d12a[_0x10863a(0x1e6)](0x6)['replace'](/\//g,'\x5c');return _0x4126c6+':'+_0x36bd75;}if(_0x47d12a[_0x10863a(0x1ec)](/^\/[a-zA-Z]\//)){const _0x238ca2=_0x47d12a[_0x10863a(0x1df)](0x1)[_0x10863a(0x1db)](),_0x305c26=_0x47d12a[_0x10863a(0x1e6)](0x2)[_0x10863a(0x1e9)](/\//g,'\x5c');return _0x238ca2+':'+_0x305c26;}if(_0x47d12a[_0x10863a(0x1ec)](/^[a-zA-Z]:/))return _0x47d12a[_0x10863a(0x1e9)](/\//g,'\x5c');return _0x47d12a;}export function normalizePath(_0x1b8b1d){const _0xac7915=a3_0xa8b1;_0x1b8b1d=_0x1b8b1d[_0xac7915(0x1dc)]()['replace'](/^["']|["']$/g,'');const _0x4b1a22=_0x1b8b1d[_0xac7915(0x1e5)]('/')&&!_0x1b8b1d[_0xac7915(0x1ec)](/^\/mnt\/[a-z]\//i)&&!_0x1b8b1d[_0xac7915(0x1ec)](/^\/[a-zA-Z]\//);if(_0x4b1a22)return _0x1b8b1d[_0xac7915(0x1e9)](/\/+/g,'/')[_0xac7915(0x1e9)](/\/+$/,'');_0x1b8b1d=convertToWindowsPath(_0x1b8b1d);if(_0x1b8b1d['startsWith']('\x5c\x5c')){let _0x2a868f=_0x1b8b1d;_0x2a868f=_0x2a868f[_0xac7915(0x1e9)](/^\\{2,}/,'\x5c\x5c');const _0x50a5a2=_0x2a868f[_0xac7915(0x1e7)](0x2)['replace'](/\\\\/g,'\x5c');_0x1b8b1d='\x5c\x5c'+_0x50a5a2;}else _0x1b8b1d=_0x1b8b1d[_0xac7915(0x1e9)](/\\\\/g,'\x5c');let _0x2bbd61=a3_0x1fdefa[_0xac7915(0x1eb)](_0x1b8b1d);_0x1b8b1d[_0xac7915(0x1e5)]('\x5c\x5c')&&!_0x2bbd61[_0xac7915(0x1e5)]('\x5c\x5c')&&(_0x2bbd61='\x5c'+_0x2bbd61);if(_0x2bbd61[_0xac7915(0x1ec)](/^[a-zA-Z]:/)){let _0x1edd50=_0x2bbd61[_0xac7915(0x1e9)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x1edd50)&&(_0x1edd50=_0x1edd50[_0xac7915(0x1df)](0x0)[_0xac7915(0x1db)]()+_0x1edd50[_0xac7915(0x1e6)](0x1)),_0x1edd50;}return _0x2bbd61[_0xac7915(0x1e9)](/\//g,'\x5c');}export function expandHome(_0x98e824){const _0x276f5d=a3_0xa8b1;if(_0x98e824[_0x276f5d(0x1e5)]('~/')||_0x98e824==='~')return a3_0x1fdefa[_0x276f5d(0x1ea)](a3_0x1a9c1e[_0x276f5d(0x1e3)](),_0x98e824['slice'](0x1));return _0x98e824;}
1
+ (function(_0x47ebb5,_0x2721f1){const _0x3f3b16=a3_0x45e1,_0xb47b35=_0x47ebb5();while(!![]){try{const _0x2afcff=-parseInt(_0x3f3b16(0x81))/0x1+parseInt(_0x3f3b16(0x82))/0x2+parseInt(_0x3f3b16(0x74))/0x3*(parseInt(_0x3f3b16(0x77))/0x4)+-parseInt(_0x3f3b16(0x72))/0x5*(-parseInt(_0x3f3b16(0x75))/0x6)+-parseInt(_0x3f3b16(0x84))/0x7*(-parseInt(_0x3f3b16(0x83))/0x8)+-parseInt(_0x3f3b16(0x7b))/0x9+-parseInt(_0x3f3b16(0x7d))/0xa;if(_0x2afcff===_0x2721f1)break;else _0xb47b35['push'](_0xb47b35['shift']());}catch(_0x21504b){_0xb47b35['push'](_0xb47b35['shift']());}}}(a3_0x50ff,0x46965));import a3_0x141ef7 from'path';function a3_0x45e1(_0x3a509c,_0x3d0db3){_0x3a509c=_0x3a509c-0x72;const _0x50ff2e=a3_0x50ff();let _0x45e12a=_0x50ff2e[_0x3a509c];return _0x45e12a;}import a3_0x3625d6 from'os';function a3_0x50ff(){const _0xe3baff=['replace','match','slice','70398qzVAiT','637888AqlYqU','8cMGPRx','136633DuxojV','5495outzXG','startsWith','3ZecCVF','258WOkiRG','substring','1982632AioEEL','charAt','toUpperCase','join','1613178ezVWye','normalize','3426130nmDxWw'];a3_0x50ff=function(){return _0xe3baff;};return a3_0x50ff();}export function convertToWindowsPath(_0x250a3e){const _0x18dd72=a3_0x45e1;if(_0x250a3e['startsWith']('/mnt/')){const _0x3e8752=_0x250a3e['charAt'](0x5)[_0x18dd72(0x79)](),_0x5ef481=_0x250a3e['slice'](0x6)['replace'](/\//g,'\x5c');return _0x3e8752+':'+_0x5ef481;}if(_0x250a3e[_0x18dd72(0x7f)](/^\/[a-zA-Z]\//)){const _0x56d7c5=_0x250a3e['charAt'](0x1)[_0x18dd72(0x79)](),_0x4205ab=_0x250a3e[_0x18dd72(0x80)](0x2)[_0x18dd72(0x7e)](/\//g,'\x5c');return _0x56d7c5+':'+_0x4205ab;}if(_0x250a3e['match'](/^[a-zA-Z]:/))return _0x250a3e[_0x18dd72(0x7e)](/\//g,'\x5c');return _0x250a3e;}export function normalizePath(_0x35048b){const _0x4f970d=a3_0x45e1;_0x35048b=_0x35048b['trim']()[_0x4f970d(0x7e)](/^["']|["']$/g,'');const _0x422d09=_0x35048b[_0x4f970d(0x73)]('/')&&!_0x35048b[_0x4f970d(0x7f)](/^\/mnt\/[a-z]\//i)&&!_0x35048b[_0x4f970d(0x7f)](/^\/[a-zA-Z]\//);if(_0x422d09)return _0x35048b['replace'](/\/+/g,'/')['replace'](/\/+$/,'');_0x35048b=convertToWindowsPath(_0x35048b);if(_0x35048b[_0x4f970d(0x73)]('\x5c\x5c')){let _0x4ad598=_0x35048b;_0x4ad598=_0x4ad598['replace'](/^\\{2,}/,'\x5c\x5c');const _0x42fd4c=_0x4ad598[_0x4f970d(0x76)](0x2)['replace'](/\\\\/g,'\x5c');_0x35048b='\x5c\x5c'+_0x42fd4c;}else _0x35048b=_0x35048b[_0x4f970d(0x7e)](/\\\\/g,'\x5c');let _0x28f97b=a3_0x141ef7[_0x4f970d(0x7c)](_0x35048b);_0x35048b[_0x4f970d(0x73)]('\x5c\x5c')&&!_0x28f97b[_0x4f970d(0x73)]('\x5c\x5c')&&(_0x28f97b='\x5c'+_0x28f97b);if(_0x28f97b[_0x4f970d(0x7f)](/^[a-zA-Z]:/)){let _0x3ffd5f=_0x28f97b['replace'](/\//g,'\x5c');return/^[a-z]:/['test'](_0x3ffd5f)&&(_0x3ffd5f=_0x3ffd5f[_0x4f970d(0x78)](0x0)[_0x4f970d(0x79)]()+_0x3ffd5f[_0x4f970d(0x80)](0x1)),_0x3ffd5f;}return _0x28f97b[_0x4f970d(0x7e)](/\//g,'\x5c');}export function expandHome(_0x3a5a49){const _0x1d6491=a3_0x45e1;if(_0x3a5a49[_0x1d6491(0x73)]('~/')||_0x3a5a49==='~')return a3_0x141ef7[_0x1d6491(0x7a)](a3_0x3625d6['homedir'](),_0x3a5a49[_0x1d6491(0x80)](0x1));return _0x3a5a49;}
@@ -1 +1 @@
1
- (function(_0x346ac5,_0x22e176){const _0x3be59a=a4_0x5bb4,_0x192e22=_0x346ac5();while(!![]){try{const _0x21ef6d=parseInt(_0x3be59a(0x1ee))/0x1*(parseInt(_0x3be59a(0x1e5))/0x2)+-parseInt(_0x3be59a(0x1e2))/0x3+-parseInt(_0x3be59a(0x1eb))/0x4*(-parseInt(_0x3be59a(0x1e6))/0x5)+-parseInt(_0x3be59a(0x1e9))/0x6+-parseInt(_0x3be59a(0x1f5))/0x7*(parseInt(_0x3be59a(0x1e4))/0x8)+parseInt(_0x3be59a(0x1ed))/0x9+-parseInt(_0x3be59a(0x1f0))/0xa;if(_0x21ef6d===_0x22e176)break;else _0x192e22['push'](_0x192e22['shift']());}catch(_0x12ba69){_0x192e22['push'](_0x192e22['shift']());}}}(a4_0x55cb,0xa1112));import a4_0x2609d9 from'path';function a4_0x5bb4(_0x26080e,_0x397f37){_0x26080e=_0x26080e-0x1e0;const _0x55cba0=a4_0x55cb();let _0x5bb4e6=_0x55cba0[_0x26080e];return _0x5bb4e6;}export function isPathWithinAllowedDirectories(_0x58cd1e,_0x1af294){const _0x1fc48d=a4_0x5bb4;if(typeof _0x58cd1e!==_0x1fc48d(0x1f4)||!Array[_0x1fc48d(0x1e7)](_0x1af294))return![];if(!_0x58cd1e||_0x1af294[_0x1fc48d(0x1f2)]===0x0)return![];if(_0x58cd1e[_0x1fc48d(0x1f3)]('\x00'))return![];let _0x57ad72;try{_0x57ad72=a4_0x2609d9[_0x1fc48d(0x1e8)](a4_0x2609d9[_0x1fc48d(0x1e3)](_0x58cd1e));}catch{return![];}if(!a4_0x2609d9['isAbsolute'](_0x57ad72))throw new Error(_0x1fc48d(0x1e1));return _0x1af294[_0x1fc48d(0x1ef)](_0x3b497d=>{const _0xe1feec=_0x1fc48d;if(typeof _0x3b497d!==_0xe1feec(0x1f4)||!_0x3b497d)return![];if(_0x3b497d['includes']('\x00'))return![];let _0x35da08;try{_0x35da08=a4_0x2609d9['resolve'](a4_0x2609d9[_0xe1feec(0x1e3)](_0x3b497d));}catch{return![];}if(!a4_0x2609d9[_0xe1feec(0x1ea)](_0x35da08))throw new Error(_0xe1feec(0x1ec));if(_0x57ad72===_0x35da08)return!![];if(_0x35da08===a4_0x2609d9[_0xe1feec(0x1f1)])return _0x57ad72[_0xe1feec(0x1e0)](a4_0x2609d9['sep']);return _0x57ad72[_0xe1feec(0x1e0)](_0x35da08+a4_0x2609d9[_0xe1feec(0x1f1)]);});}function a4_0x55cb(){const _0x33140b=['resolve','388116zZEekd','isAbsolute','44CjZDik','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','3575421dLZPfZ','22oqoucG','some','5611940GsxYgG','sep','length','includes','string','12523JInwKY','startsWith','Path\x20must\x20be\x20absolute\x20after\x20normalization','465024iOLPvJ','normalize','2704wyWtpy','106462vBrwDR','216795nWIvkt','isArray'];a4_0x55cb=function(){return _0x33140b;};return a4_0x55cb();}
1
+ function a4_0x6bc9(_0xf1aae1,_0x1d2494){_0xf1aae1=_0xf1aae1-0x12c;const _0x3525bd=a4_0x3525();let _0x6bc9b5=_0x3525bd[_0xf1aae1];return _0x6bc9b5;}(function(_0x898191,_0x358916){const _0x4c261c=a4_0x6bc9,_0x27d063=_0x898191();while(!![]){try{const _0x30c08a=parseInt(_0x4c261c(0x13f))/0x1+-parseInt(_0x4c261c(0x130))/0x2*(-parseInt(_0x4c261c(0x131))/0x3)+parseInt(_0x4c261c(0x134))/0x4+parseInt(_0x4c261c(0x13a))/0x5*(-parseInt(_0x4c261c(0x12d))/0x6)+parseInt(_0x4c261c(0x135))/0x7*(parseInt(_0x4c261c(0x133))/0x8)+-parseInt(_0x4c261c(0x13b))/0x9+-parseInt(_0x4c261c(0x12c))/0xa;if(_0x30c08a===_0x358916)break;else _0x27d063['push'](_0x27d063['shift']());}catch(_0x4202f3){_0x27d063['push'](_0x27d063['shift']());}}}(a4_0x3525,0xe3db2));import a4_0x4549cc from'path';function a4_0x3525(){const _0x2ae655=['sep','Path\x20must\x20be\x20absolute\x20after\x20normalization','355eZTtwO','14596398wTsOpN','normalize','includes','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1087482wyPbHr','string','7616980DqrovA','59334GpBJEd','isAbsolute','length','1044052TRaOZU','3nZcOUO','isArray','32BFaslp','5917060SWoZzt','1627787MPxMZV','startsWith','some'];a4_0x3525=function(){return _0x2ae655;};return a4_0x3525();}export function isPathWithinAllowedDirectories(_0x41e63a,_0x191beb){const _0x272ab0=a4_0x6bc9;if(typeof _0x41e63a!==_0x272ab0(0x140)||!Array[_0x272ab0(0x132)](_0x191beb))return![];if(!_0x41e63a||_0x191beb[_0x272ab0(0x12f)]===0x0)return![];if(_0x41e63a[_0x272ab0(0x13d)]('\x00'))return![];let _0x4d4143;try{_0x4d4143=a4_0x4549cc['resolve'](a4_0x4549cc[_0x272ab0(0x13c)](_0x41e63a));}catch{return![];}if(!a4_0x4549cc['isAbsolute'](_0x4d4143))throw new Error(_0x272ab0(0x139));return _0x191beb[_0x272ab0(0x137)](_0x379a32=>{const _0x1bae58=_0x272ab0;if(typeof _0x379a32!==_0x1bae58(0x140)||!_0x379a32)return![];if(_0x379a32[_0x1bae58(0x13d)]('\x00'))return![];let _0x231b7f;try{_0x231b7f=a4_0x4549cc['resolve'](a4_0x4549cc[_0x1bae58(0x13c)](_0x379a32));}catch{return![];}if(!a4_0x4549cc[_0x1bae58(0x12e)](_0x231b7f))throw new Error(_0x1bae58(0x13e));if(_0x4d4143===_0x231b7f)return!![];if(_0x231b7f===a4_0x4549cc['sep'])return _0x4d4143['startsWith'](a4_0x4549cc[_0x1bae58(0x138)]);return _0x4d4143[_0x1bae58(0x136)](_0x231b7f+a4_0x4549cc[_0x1bae58(0x138)]);});}
@@ -1 +1 @@
1
- (function(_0x116d70,_0x42843f){const _0x40a4a4=a5_0x4c00,_0x361ab5=_0x116d70();while(!![]){try{const _0x13063b=parseInt(_0x40a4a4(0x1aa))/0x1+parseInt(_0x40a4a4(0x1a6))/0x2*(-parseInt(_0x40a4a4(0x19c))/0x3)+parseInt(_0x40a4a4(0x19e))/0x4*(parseInt(_0x40a4a4(0x1af))/0x5)+parseInt(_0x40a4a4(0x1a8))/0x6+parseInt(_0x40a4a4(0x1b1))/0x7+-parseInt(_0x40a4a4(0x1ad))/0x8*(parseInt(_0x40a4a4(0x1b0))/0x9)+parseInt(_0x40a4a4(0x19f))/0xa*(-parseInt(_0x40a4a4(0x199))/0xb);if(_0x13063b===_0x42843f)break;else _0x361ab5['push'](_0x361ab5['shift']());}catch(_0x4216ca){_0x361ab5['push'](_0x361ab5['shift']());}}}(a5_0x2ca6,0xb5da8));function a5_0x2ca6(){const _0x59b6f8=['uri','isDirectory','invalid\x20path\x20or\x20inaccessible','startsWith','non-directory\x20root','resolve','24558htrvbZ','slice','610224KqZjar','\x20due\x20to\x20error:\x20','355470DJvjGy','push','message','8fKQDVH','homedir','100BHpGdg','5956866WIlIqf','9248862liPMqf','Skipping\x20invalid\x20directory:\x20','1261821loArbU','file://','stat','9dvNKJl','Skipping\x20','93624clJJiP','70yppsGp'];a5_0x2ca6=function(){return _0x59b6f8;};return a5_0x2ca6();}import{promises as a5_0x4c6e04}from'fs';function a5_0x4c00(_0xc539ea,_0x16a9d4){_0xc539ea=_0xc539ea-0x199;const _0x2ca6ca=a5_0x2ca6();let _0x4c00ba=_0x2ca6ca[_0xc539ea];return _0x4c00ba;}import a5_0x4e1693 from'path';import a5_0x18398e from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x1489d8){const _0x42e114=a5_0x4c00;try{const _0x4fff79=_0x1489d8['startsWith'](_0x42e114(0x19a))?_0x1489d8[_0x42e114(0x1a7)](0x7):_0x1489d8,_0x33bd3a=_0x4fff79[_0x42e114(0x1a3)]('~/')||_0x4fff79==='~'?a5_0x4e1693['join'](a5_0x18398e[_0x42e114(0x1ae)](),_0x4fff79['slice'](0x1)):_0x4fff79,_0x5b5dd7=a5_0x4e1693[_0x42e114(0x1a5)](_0x33bd3a),_0x2b8e7f=await a5_0x4c6e04['realpath'](_0x5b5dd7);return normalizePath(_0x2b8e7f);}catch{return null;}}function formatDirectoryError(_0x1440de,_0x22869b,_0x493698){const _0x3d63ee=a5_0x4c00;if(_0x493698)return _0x3d63ee(0x19d)+_0x493698+':\x20'+_0x1440de;const _0x3420c0=_0x22869b instanceof Error?_0x22869b[_0x3d63ee(0x1ac)]:String(_0x22869b);return _0x3d63ee(0x1b2)+_0x1440de+_0x3d63ee(0x1a9)+_0x3420c0;}export async function getValidRootDirectories(_0x3c6f0e){const _0xe1d8a8=a5_0x4c00,_0x10b2e2=[];for(const _0x476efc of _0x3c6f0e){const _0x55bf89=await parseRootUri(_0x476efc[_0xe1d8a8(0x1a0)]);if(!_0x55bf89){logMcpStderr(formatDirectoryError(_0x476efc[_0xe1d8a8(0x1a0)],undefined,_0xe1d8a8(0x1a2)));continue;}try{const _0x59e6f4=await a5_0x4c6e04[_0xe1d8a8(0x19b)](_0x55bf89);_0x59e6f4[_0xe1d8a8(0x1a1)]()?_0x10b2e2[_0xe1d8a8(0x1ab)](_0x55bf89):logMcpStderr(formatDirectoryError(_0x55bf89,undefined,_0xe1d8a8(0x1a4)));}catch(_0x14a39e){logMcpStderr(formatDirectoryError(_0x55bf89,_0x14a39e));}}return _0x10b2e2;}
1
+ (function(_0x139d2a,_0xa5b752){const _0x47b93c=a5_0x14f2,_0x28f055=_0x139d2a();while(!![]){try{const _0x39961b=-parseInt(_0x47b93c(0x135))/0x1+parseInt(_0x47b93c(0x13c))/0x2*(parseInt(_0x47b93c(0x137))/0x3)+-parseInt(_0x47b93c(0x13a))/0x4*(parseInt(_0x47b93c(0x130))/0x5)+parseInt(_0x47b93c(0x136))/0x6+-parseInt(_0x47b93c(0x134))/0x7*(-parseInt(_0x47b93c(0x123))/0x8)+parseInt(_0x47b93c(0x133))/0x9+-parseInt(_0x47b93c(0x139))/0xa;if(_0x39961b===_0xa5b752)break;else _0x28f055['push'](_0x28f055['shift']());}catch(_0x70675d){_0x28f055['push'](_0x28f055['shift']());}}}(a5_0x2099,0x6e3a0));function a5_0x2099(){const _0x2de26f=['file://','join','homedir','5ZuxRob','push','message','5161050ZnkaHJ','553NGPqPO','833956uVIxgq','4360632liyLnF','1754139XSGnMQ','resolve','4189960fipoCW','3518264JmyZfa','stat','2fqjVgx','70792NSNQHJ','slice','non-directory\x20root','realpath','uri','invalid\x20path\x20or\x20inaccessible','\x20due\x20to\x20error:\x20','startsWith','Skipping\x20invalid\x20directory:\x20','Skipping\x20'];a5_0x2099=function(){return _0x2de26f;};return a5_0x2099();}import{promises as a5_0x968f78}from'fs';import a5_0x49e055 from'path';import a5_0x5df5cf from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x259ae7){const _0x412431=a5_0x14f2;try{const _0x10c98e=_0x259ae7[_0x412431(0x12a)](_0x412431(0x12d))?_0x259ae7[_0x412431(0x124)](0x7):_0x259ae7,_0x1eed79=_0x10c98e[_0x412431(0x12a)]('~/')||_0x10c98e==='~'?a5_0x49e055[_0x412431(0x12e)](a5_0x5df5cf[_0x412431(0x12f)](),_0x10c98e['slice'](0x1)):_0x10c98e,_0x506001=a5_0x49e055[_0x412431(0x138)](_0x1eed79),_0x444f5c=await a5_0x968f78[_0x412431(0x126)](_0x506001);return normalizePath(_0x444f5c);}catch{return null;}}function formatDirectoryError(_0x36edb3,_0x4d2dae,_0x4f0ed4){const _0x1a06df=a5_0x14f2;if(_0x4f0ed4)return _0x1a06df(0x12c)+_0x4f0ed4+':\x20'+_0x36edb3;const _0x3cadcb=_0x4d2dae instanceof Error?_0x4d2dae[_0x1a06df(0x132)]:String(_0x4d2dae);return _0x1a06df(0x12b)+_0x36edb3+_0x1a06df(0x129)+_0x3cadcb;}function a5_0x14f2(_0x5758e1,_0x2c92c6){_0x5758e1=_0x5758e1-0x123;const _0x209937=a5_0x2099();let _0x14f2da=_0x209937[_0x5758e1];return _0x14f2da;}export async function getValidRootDirectories(_0x3224eb){const _0xc3a36=a5_0x14f2,_0x4040d4=[];for(const _0x2f5ab1 of _0x3224eb){const _0x56885d=await parseRootUri(_0x2f5ab1[_0xc3a36(0x127)]);if(!_0x56885d){logMcpStderr(formatDirectoryError(_0x2f5ab1[_0xc3a36(0x127)],undefined,_0xc3a36(0x128)));continue;}try{const _0x249bcc=await a5_0x968f78[_0xc3a36(0x13b)](_0x56885d);_0x249bcc['isDirectory']()?_0x4040d4[_0xc3a36(0x131)](_0x56885d):logMcpStderr(formatDirectoryError(_0x56885d,undefined,_0xc3a36(0x125)));}catch(_0x43ac68){logMcpStderr(formatDirectoryError(_0x56885d,_0x43ac68));}}return _0x4040d4;}
@@ -1 +1 @@
1
- function a6_0x239b(){const _0x150a49=['899346ggmZbi','values','2297670TksBWm','edit_file','2165184loFbsv','129739CDahHB','3467272xnpKFq','codebase_search','425240VsbrGm','6570676ggGMLi'];a6_0x239b=function(){return _0x150a49;};return a6_0x239b();}const a6_0x38f817=a6_0x41b2;(function(_0x294db1,_0x1a8acc){const _0x30b211=a6_0x41b2,_0x376942=_0x294db1();while(!![]){try{const _0x2e5695=-parseInt(_0x30b211(0x102))/0x1+parseInt(_0x30b211(0xff))/0x2+-parseInt(_0x30b211(0x101))/0x3+-parseInt(_0x30b211(0x103))/0x4+parseInt(_0x30b211(0xfb))/0x5+parseInt(_0x30b211(0xfd))/0x6+parseInt(_0x30b211(0xfc))/0x7;if(_0x2e5695===_0x1a8acc)break;else _0x376942['push'](_0x376942['shift']());}catch(_0x3cd5b3){_0x376942['push'](_0x376942['shift']());}}}(a6_0x239b,0x937fd));export const TOOL_NAMES={'EDIT_FILE':a6_0x38f817(0x100),'CODEBASE_SEARCH':a6_0x38f817(0xfa),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};function a6_0x41b2(_0x35f97a,_0x1e03d8){_0x35f97a=_0x35f97a-0xfa;const _0x239bfd=a6_0x239b();let _0x41b266=_0x239bfd[_0x35f97a];return _0x41b266;}export const ALL_TOOL_NAMES=Object[a6_0x38f817(0xfe)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ const a6_0x5a54dc=a6_0x36d9;function a6_0x38be(){const _0x163d3d=['498404budhJY','1742428wiwMgS','859746kLVbnn','edit_file','11959122FNgtKs','2449104HYFHNw','values','4180100regQDf','998382ighyes'];a6_0x38be=function(){return _0x163d3d;};return a6_0x38be();}(function(_0x440350,_0x21ed4){const _0x10e2a3=a6_0x36d9,_0x1d451a=_0x440350();while(!![]){try{const _0x1f94b9=parseInt(_0x10e2a3(0x135))/0x1+parseInt(_0x10e2a3(0x12d))/0x2+-parseInt(_0x10e2a3(0x132))/0x3+-parseInt(_0x10e2a3(0x12e))/0x4+-parseInt(_0x10e2a3(0x134))/0x5+-parseInt(_0x10e2a3(0x12f))/0x6+parseInt(_0x10e2a3(0x131))/0x7;if(_0x1f94b9===_0x21ed4)break;else _0x1d451a['push'](_0x1d451a['shift']());}catch(_0x340949){_0x1d451a['push'](_0x1d451a['shift']());}}}(a6_0x38be,0xb0f08));export const TOOL_NAMES={'EDIT_FILE':a6_0x5a54dc(0x130),'CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':'github_codebase_search'};function a6_0x36d9(_0x25c916,_0x382a34){_0x25c916=_0x25c916-0x12d;const _0x38be7a=a6_0x38be();let _0x36d900=_0x38be7a[_0x25c916];return _0x36d900;}export const ALL_TOOL_NAMES=Object[a6_0x5a54dc(0x133)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.188",
3
+ "version": "0.8.189",
4
4
  "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.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@google/generative-ai": "^0.21.0",
37
37
  "@modelcontextprotocol/sdk": "^1.12.3",
38
- "@morphllm/morphsdk": "0.2.178",
38
+ "@morphllm/morphsdk": "0.2.179",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",