@morphllm/morphmcp 0.8.192 → 0.8.194

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_0x510957=a0_0x4273;(function(_0x1dddc3,_0x268a3b){const _0x2c08f9=a0_0x4273,_0x118c89=_0x1dddc3();while(!![]){try{const _0x44fb74=-parseInt(_0x2c08f9(0x205))/0x1*(parseInt(_0x2c08f9(0x247))/0x2)+-parseInt(_0x2c08f9(0x2ff))/0x3+parseInt(_0x2c08f9(0x26b))/0x4*(-parseInt(_0x2c08f9(0x2a7))/0x5)+-parseInt(_0x2c08f9(0x248))/0x6*(-parseInt(_0x2c08f9(0x2b8))/0x7)+parseInt(_0x2c08f9(0x238))/0x8*(parseInt(_0x2c08f9(0x22d))/0x9)+-parseInt(_0x2c08f9(0x275))/0xa+-parseInt(_0x2c08f9(0x2f4))/0xb*(-parseInt(_0x2c08f9(0x21f))/0xc);if(_0x44fb74===_0x268a3b)break;else _0x118c89['push'](_0x118c89['shift']());}catch(_0x341e7e){_0x118c89['push'](_0x118c89['shift']());}}}(a0_0x2384,0x81584));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_0x53dc6d from'fs/promises';import a0_0xa4cb51 from'path';import a0_0xd57d56 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';function a0_0x4273(_0x2ace7e,_0x299241){_0x2ace7e=_0x2ace7e-0x1d9;const _0x2384b7=a0_0x2384();let _0x42734f=_0x2384b7[_0x2ace7e];return _0x42734f;}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_0x56b343 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x186c5d){const _0x220dfc=a0_0x4273,_0x347c2c=_0x186c5d[_0x220dfc(0x2da)](a0_0xa4cb51['sep'])[_0x220dfc(0x2c6)](Boolean);if(_0x347c2c['length']<0x2)return null;for(let _0x4ff2af=Math[_0x220dfc(0x1de)](_0x347c2c['length']/0x2);_0x4ff2af>=0x1;_0x4ff2af--){for(let _0x5315d4=0x0;_0x5315d4<=_0x347c2c[_0x220dfc(0x244)]-0x2*_0x4ff2af;_0x5315d4++){const _0x34f68e=_0x347c2c[_0x220dfc(0x2b2)](_0x5315d4,_0x5315d4+_0x4ff2af),_0x590a9d=_0x347c2c['slice'](_0x5315d4+_0x4ff2af,_0x5315d4+0x2*_0x4ff2af);if(_0x34f68e[_0x220dfc(0x2ba)]((_0x4e80b8,_0x488b4a)=>_0x4e80b8===_0x590a9d[_0x488b4a])){const _0x5722e2=[..._0x347c2c[_0x220dfc(0x2b2)](0x0,_0x5315d4),..._0x347c2c[_0x220dfc(0x2b2)](_0x5315d4+_0x4ff2af)];return a0_0xa4cb51[_0x220dfc(0x2c3)]+_0x5722e2[_0x220dfc(0x201)](a0_0xa4cb51[_0x220dfc(0x2c3)]);}}}return null;}function a0_0x2384(){const _0x3c7f2e=['object','.vscode',',\x20removed\x20','repo_path','optional','`\x20in\x20`','\x20(new\x20file)','isDirectory','getClientCapabilities','-\x20Preserve\x20exact\x20indentation\x0a','Tool\x20','DISABLED_TOOLS','grep_search','Created\x20File','now','morph-v3-fast','filePath','\x20valid\x20directories','path_validation_start','morph-mcp','homedir','ReadError','error','tool_calls','env','MORPH_API_KEY','Specific\x20commit\x20hash\x20to\x20search','terminationReason','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.','etimedout','--version','target_file','Rules:\x0a','join','messages','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','read','45bidVME','UnknownError','node_modules','default','Tool\x20\x22','argv','path_validation_resolved','API\x20error\x20(auth/rate-limit)','FileReadError','list_directory','branch','SubToolError','linesModified','timeout','response','metadata','0.2.0','ENOENT','path','toISOString','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','string','Invalid\x20arguments:\x20','substring','basename','\x0a</file>','714036nPGuNm','--api-key','toLowerCase','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','Parent\x20directory\x20does\x20not\x20exist:\x20','description','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','stack','readFile','size','post','pattern','\x20as\x20allowed\x20directory','.\x20Changes:\x20','376749LYBivI','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','access','tool','realpath','log','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','codebase_search','includes','setNotificationHandler','morph-warp-grep-v2.1','16cgFLwq','role','github_search_start','Warning:\x20Workspace\x20fallback\x20failed:\x20','mcp-filesystem','RipgrepError','application/json','Warning:\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','params','<file\x20path=\x22','completed_with_file_errors','length','grep\x20\x27','[github_codebase_search]\x20Done\x20in\x20','15538FIrFrB','2137050YQQOoe','read\x20','instructions','\x0aExamples:','GITHUB_CODEBASE_SEARCH','File\x20read\x20error:','linesRemoved','grep','Error:\x20','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','map','\x20disabled\x20via\x20DISABLED_TOOLS','instruction','describe','-\x20Grepped\x20\x27','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','runWarpGrep_call','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','https://morphllm.com/api/error-report','terminated','finish',',\x20modified\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Applied','normalize','command','success','\x27\x20in\x20`','lines','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','false','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','parse','\x20is\x20not\x20a\x20directory','version','17324nkhmOk','debug','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','LocalRipgrepProvider','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','catch','listRoots','\x20\x20morph-mcp','2250440xbpLVU','MORPH_API_URL','EDIT_FILE','Max\x20results\x20to\x20return','inputSchema','morph-','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','stringify','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','CODEBASE_SEARCH','-\x20Read\x20file\x20`','tool_call_complete','file_read_complete','cwd','requiresApiKey','composer.json','dryRun','.\x20Path:\x20','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','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','code_edit','indexOf','number','some','data','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','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.','startsWith','trim','MORPH_WARP_GREP_TIMEOUT','target_filepath','path_validation_failed','code','function','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','text','added\x20','safeParse','PWD','morph-v3-large','linesAdded','has','tool_call_error','resolve','Fatal\x20error\x20running\x20server:','Morph\x20Edit\x20','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','exit','1105iMbVhB','context','-\x20Glob\x20search\x20`','roots','push','Preview\x20changes\x20without\x20applying\x20them.','message','Here\x20is\x20the\x20content\x20of\x20files:\x0a','warp_grep_complete','WarpGrepError','completed','slice','\x20chars)','glob','\x22>\x0a','setRequestHandler','.cursor','7zLChNc','\x22.\x20Known\x20tools:\x20','every','ToolException','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','source','SymlinkError','Workspace\x20mode\x20enabled:\x20Using\x20','dirname','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','Morph\x20Edit\x20Preview','sep','Fallback:\x20Using\x20workspace\x20root\x20','FileNotFound','filter','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','BinaryFile','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','name','file','PathError','tool_call_id','changes','Relevant\x20context\x20found:','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Example\x20format:\x0a','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','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.','ms:','searchGitHub','list_directory\x20','timed\x20out','❌\x20Morph\x20Edit\x20Failed:\x20','utf-8','split','stat','Parameters:\x0a','ms.\x20Success:\x20','files','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Bearer\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','connect','user','\x20-\x20','\x0a...\x20(truncated,\x20total:\x20','MCP','../package.json','go.mod','timings','unknown','Error\x20accessing\x20directory\x20','Unknown\x20error','Unknown\x20tool:\x20','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','all','Failed\x20to\x20read\x20file:\x20','search_string','isArray','341uQWQLe','errors','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','array','RipgrepNotAvailable','edit_file','\x20error(s)','content','assistant','Repository\x20identifier','TimeoutError','668682alXmAv','github_codebase_search','arguments','sk-','tsconfig.json','constructor','status','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','min','\x22>\x0aError\x20reading\x20file:\x20','GitHub\x20search\x20failed:\x20','floor','match'];a0_0x2384=function(){return _0x3c7f2e;};return a0_0x2384();}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x8d4c68=a0_0x4273;try{const _0x190334=require(_0x8d4c68(0x2e8));return _0x190334[_0x8d4c68(0x26a)]??'unknown';}catch(_0x1cc990){return logMcpStderr(_0x8d4c68(0x27d),_0x1cc990),_0x8d4c68(0x2eb);}}function printHelp(){const _0x44b9d0=a0_0x4273;console[_0x44b9d0(0x232)](_0x44b9d0(0x288)+getPackageVersion()),console[_0x44b9d0(0x232)](_0x44b9d0(0x240)),console['log']('\x0aOptions:'),console[_0x44b9d0(0x232)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x44b9d0(0x232)](_0x44b9d0(0x225)),console[_0x44b9d0(0x232)](_0x44b9d0(0x25e)),console[_0x44b9d0(0x232)](_0x44b9d0(0x24b)),console[_0x44b9d0(0x232)](_0x44b9d0(0x274)),console[_0x44b9d0(0x232)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x510957(0x20a)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x510957(0x1fe),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x510957(0x28d)](_0x50d81b=>VERSION_FLAGS[a0_0x510957(0x29f)](_0x50d81b))&&(console[a0_0x510957(0x232)](a0_0x510957(0x288)+getPackageVersion()),process[a0_0x510957(0x2a6)](0x0));cliArgs[a0_0x510957(0x28d)](_0x52b658=>HELP_FLAGS[a0_0x510957(0x29f)](_0x52b658))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x22ed4d){const _0xfe0bac=a0_0x510957;for(let _0x110ccd=0x0;_0x110ccd<cliArgs[_0xfe0bac(0x244)];_0x110ccd++){const _0xa867f7=cliArgs[_0x110ccd];if(_0xa867f7[_0xfe0bac(0x291)]('--'+_0x22ed4d+'='))return _0xa867f7[_0xfe0bac(0x2b2)](('--'+_0x22ed4d+'=')[_0xfe0bac(0x244)]);if(_0xa867f7==='--'+_0x22ed4d&&_0x110ccd+0x1<cliArgs[_0xfe0bac(0x244)])return cliArgs[_0x110ccd+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x510957(0x29f)](arg))continue;if(arg[a0_0x510957(0x291)]('--api-key='))continue;if(arg===a0_0x510957(0x220)){i++;continue;}args[a0_0x510957(0x2ab)](arg);}const WORKSPACE_ROOT=process[a0_0x510957(0x1f8)]['WORKSPACE_ROOT']||process['env'][a0_0x510957(0x29c)]||process[a0_0x510957(0x282)](),ENABLE_WORKSPACE_MODE=process['env']['ENABLE_WORKSPACE_MODE']!==a0_0x510957(0x266),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x510957(0x1f8)][a0_0x510957(0x1f9)],MORPH_API_URL=process[a0_0x510957(0x1f8)][a0_0x510957(0x276)],MORPH_LARGE_APPLY=process[a0_0x510957(0x1f8)]['MORPH_LARGE_APPLY']!==a0_0x510957(0x266),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x510957(0x293)]?parseInt(process[a0_0x510957(0x1f8)][a0_0x510957(0x293)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process['env'][a0_0x510957(0x1eb)]?new Set(process[a0_0x510957(0x1f8)][a0_0x510957(0x1eb)]['split'](',')[a0_0x510957(0x252)](_0x526c71=>_0x526c71[a0_0x510957(0x292)]())[a0_0x510957(0x2c6)](_0x5b3226=>_0x5b3226[a0_0x510957(0x244)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x510957(0x228)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x510957(0x29f)](tool)&&console[a0_0x510957(0x1f6)](a0_0x510957(0x27b)+tool+a0_0x510957(0x2b9)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x510957(0x1f6)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x510957(0x201)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x510957(0x291)](a0_0x510957(0x302))&&!MORPH_API_KEY[a0_0x510957(0x291)](a0_0x510957(0x27a))&&logMcpStderr(a0_0x510957(0x2a4));async function reportMorphError(_0x3af346){const _0x4f9a85=a0_0x510957;try{await a0_0x56b343[_0x4f9a85(0x229)](_0x4f9a85(0x25a),{..._0x3af346,'timestamp':new Date()[_0x4f9a85(0x218)](),'source':_0x3af346['source']||_0x4f9a85(0x23c),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x3af346[_0x4f9a85(0x2a8)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x4f9a85(0x23e),'Authorization':_0x4f9a85(0x2e1)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x5a80db,_0x4f9cb8){const _0x4b8599=a0_0x510957;if(_0x5a80db&&typeof _0x5a80db===_0x4b8599(0x1e0)&&'status'in _0x5a80db)return _0x5a80db[_0x4b8599(0x1d9)];if(_0x5a80db&&typeof _0x5a80db===_0x4b8599(0x1e0)&&_0x4b8599(0x213)in _0x5a80db)return _0x5a80db[_0x4b8599(0x213)]?.['status'];const _0x1fbad2=_0x4f9cb8[_0x4b8599(0x1df)](/\b(401|429)\b/);return _0x1fbad2?parseInt(_0x1fbad2[0x1],0xa):null;}function handleMorphAPIError(_0x32adb8){const _0x650a22=a0_0x510957,_0x3fdf6f=_0x32adb8 instanceof Error?_0x32adb8[_0x650a22(0x2ad)]:String(_0x32adb8),_0x4a4596=extractStatusCode(_0x32adb8,_0x3fdf6f);switch(_0x4a4596){case 0x191:return{'content':[{'type':_0x650a22(0x299),'text':'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.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x650a22(0x299),'text':_0x650a22(0x222)}],'isError':!![]};default:return null;}}args[a0_0x510957(0x244)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x510957(0x2d0)),logMcpStderr(a0_0x510957(0x2a5)),logMcpStderr(a0_0x510957(0x259)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x510957(0x2e0)),logMcpStderr(a0_0x510957(0x26e)));function normalizePath(_0x485500){const _0xc93e56=a0_0x510957;return a0_0xa4cb51[_0xc93e56(0x260)](_0x485500);}function expandHome(_0x56bddb){const _0x195882=a0_0x510957;if(_0x56bddb[_0x195882(0x291)]('~/')||_0x56bddb==='~')return a0_0xa4cb51['join'](a0_0xd57d56[_0x195882(0x1f4)](),_0x56bddb[_0x195882(0x2b2)](0x1));return _0x56bddb;}let allowedDirectories=await Promise[a0_0x510957(0x2f0)](args[a0_0x510957(0x252)](async _0x95a02=>{const _0x41afdd=a0_0x510957,_0x1e64c9=expandHome(_0x95a02),_0x1d1d23=a0_0xa4cb51[_0x41afdd(0x2a1)](_0x1e64c9);try{const _0x37602f=await a0_0x53dc6d[_0x41afdd(0x231)](_0x1d1d23);return normalizePath(_0x37602f);}catch(_0x1511e6){return normalizePath(_0x1d1d23);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x510957(0x244)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x510957(0x2ab)](workspaceDir),logMcpStderr(a0_0x510957(0x2bf)+workspaceDir+a0_0x510957(0x22b)));}catch(a0_0xd51ef0){logMcpStderr(a0_0x510957(0x1da)+a0_0xd51ef0);}async function detectWorkspaceRoot(_0x1b429a){const _0x338a97=a0_0x510957;let _0x2514af=a0_0xa4cb51[_0x338a97(0x2a1)](_0x1b429a);const _0x2a804e=['.git',_0x338a97(0x1e1),'package.json','Cargo.toml','pyproject.toml',_0x338a97(0x2e9),_0x338a97(0x2b7),_0x338a97(0x303),_0x338a97(0x284)];while(_0x2514af!==a0_0xa4cb51['dirname'](_0x2514af)){for(const _0x5011fa of _0x2a804e){const _0x143166=a0_0xa4cb51['join'](_0x2514af,_0x5011fa);try{return await a0_0x53dc6d[_0x338a97(0x22f)](_0x143166),normalizePath(_0x2514af);}catch{}}_0x2514af=a0_0xa4cb51[_0x338a97(0x2c0)](_0x2514af);}return normalizePath(_0x1b429a);}await Promise[a0_0x510957(0x2f0)](args[a0_0x510957(0x252)](async _0x459dc9=>{const _0x4e497e=a0_0x510957;try{const _0x29ccd1=await a0_0x53dc6d[_0x4e497e(0x2db)](expandHome(_0x459dc9));!_0x29ccd1[_0x4e497e(0x1e7)]()&&(logMcpStderr(_0x4e497e(0x250)+_0x459dc9+_0x4e497e(0x269)),process[_0x4e497e(0x2a6)](0x1));}catch(_0x41c79e){logMcpStderr(_0x4e497e(0x2ec)+_0x459dc9+':',_0x41c79e),process[_0x4e497e(0x2a6)](0x1);}}));async function validatePath(_0xbb079d){const _0x5703a4=a0_0x510957,_0x38890e=expandHome(_0xbb079d),_0x4c0722=a0_0xa4cb51['resolve'](_0x38890e);logger[_0x5703a4(0x26c)](_0x5703a4(0x2e7),_0x5703a4(0x1f2),{'raw_path':_0xbb079d,'absolute':_0x4c0722});try{const _0x4ce698=await a0_0x53dc6d[_0x5703a4(0x231)](_0x4c0722);return logger[_0x5703a4(0x26c)]('MCP',_0x5703a4(0x20b),{'resolved':_0x4ce698,'symlink':_0x4ce698!==_0x4c0722}),_0x4ce698;}catch(_0x484e01){if(_0x484e01[_0x5703a4(0x296)]===_0x5703a4(0x216)){const _0x2bac78=a0_0xa4cb51[_0x5703a4(0x2c0)](_0x4c0722);try{const _0x2b6c16=await a0_0x53dc6d[_0x5703a4(0x231)](_0x2bac78),_0x25233e=a0_0xa4cb51[_0x5703a4(0x201)](_0x2b6c16,a0_0xa4cb51['basename'](_0x4c0722));return logger[_0x5703a4(0x26c)](_0x5703a4(0x2e7),_0x5703a4(0x20b),{'resolved':_0x25233e,'new_file':!![]}),_0x25233e;}catch{logger['error'](_0x5703a4(0x2e7),_0x5703a4(0x295),{'raw_path':_0xbb079d,'error':_0x5703a4(0x223)+_0x2bac78});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x2bac78);}}logger[_0x5703a4(0x1f6)](_0x5703a4(0x2e7),_0x5703a4(0x295),{'raw_path':_0xbb079d,'error':_0x484e01[_0x5703a4(0x2ad)]});throw _0x484e01;}}const MorphEditFileArgsSchema=z['object']({'path':z['string'](),'code_edit':z[a0_0x510957(0x21a)]()['describe'](a0_0x510957(0x2ef)),'instruction':z['string']()[a0_0x510957(0x255)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z['boolean']()[a0_0x510957(0x208)](![])['describe'](a0_0x510957(0x2ac))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z[a0_0x510957(0x1e0)]({'search_string':z[a0_0x510957(0x21a)]()[a0_0x510957(0x255)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x510957(0x21a)]()[a0_0x510957(0x255)](a0_0x510957(0x298)),'search_type':z['enum']([a0_0x510957(0x208),a0_0x510957(0x207)])[a0_0x510957(0x1e4)]()['describe'](a0_0x510957(0x267))}),WarpGrepGitHubArgsSchema=z[a0_0x510957(0x1e0)]({'search_string':z[a0_0x510957(0x21a)]()[a0_0x510957(0x255)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x510957(0x21a)]()[a0_0x510957(0x1e4)]()[a0_0x510957(0x255)](a0_0x510957(0x290)),'owner_repo':z[a0_0x510957(0x21a)]()[a0_0x510957(0x1e4)]()[a0_0x510957(0x255)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x510957(0x21a)]()[a0_0x510957(0x1e4)]()[a0_0x510957(0x255)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x510957(0x1e0)]({'query':z[a0_0x510957(0x21a)]()[a0_0x510957(0x255)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x510957(0x21a)]()[a0_0x510957(0x255)](a0_0x510957(0x2fd)),'branch':z[a0_0x510957(0x21a)]()[a0_0x510957(0x1e4)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x510957(0x21a)]()[a0_0x510957(0x1e4)]()['describe'](a0_0x510957(0x1fa)),'targetDirectories':z[a0_0x510957(0x2f7)](z[a0_0x510957(0x21a)]())[a0_0x510957(0x208)]([])[a0_0x510957(0x255)](a0_0x510957(0x251)),'limit':z[a0_0x510957(0x28c)]()[a0_0x510957(0x1e4)]()['default'](0xa)[a0_0x510957(0x255)](a0_0x510957(0x278))}),server=new Server({'name':a0_0x510957(0x1f3),'version':a0_0x510957(0x215)},{'capabilities':{'tools':{}}});server[a0_0x510957(0x2b6)](ListToolsRequestSchema,async()=>{const _0x32251a=a0_0x510957,_0x31911a=[{'name':TOOL_NAMES['EDIT_FILE'],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a'+_0x32251a(0x2dc)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x32251a(0x271)+_0x32251a(0x28f)+_0x32251a(0x2bc)+_0x32251a(0x2d1)+_0x32251a(0x257)+_0x32251a(0x200)+_0x32251a(0x22e)+_0x32251a(0x1e9)+_0x32251a(0x270)+_0x32251a(0x2d2),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x32251a(0x27e)],'description':'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'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x32251a(0x287)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x5205e6=_0x31911a['filter'](_0x170539=>{const _0x74cda5=_0x32251a;if(DISABLED_TOOLS[_0x74cda5(0x29f)](_0x170539[_0x74cda5(0x2ca)]))return console['error'](_0x74cda5(0x1ea)+_0x170539['name']+_0x74cda5(0x253)),![];if('requiresApiKey'in _0x170539&&_0x170539[_0x74cda5(0x283)]&&!MORPH_API_KEY)return logMcpStderr(_0x74cda5(0x23f)+_0x170539['name']+_0x74cda5(0x2c9)),![];return!![];});return{'tools':_0x5205e6[_0x32251a(0x252)](_0x4629ac=>({'name':_0x4629ac[_0x32251a(0x2ca)],'description':_0x4629ac[_0x32251a(0x224)],'inputSchema':_0x4629ac[_0x32251a(0x279)]}))};}),server[a0_0x510957(0x2b6)](CallToolRequestSchema,async _0x1d7e7a=>{const _0x4c66f0=a0_0x510957,{name:_0x4170d1,arguments:_0x21926f}=_0x1d7e7a[_0x4c66f0(0x241)],_0x551b55=Date[_0x4c66f0(0x1ee)]();logger[_0x4c66f0(0x26c)](_0x4c66f0(0x2e7),'tool_call_received',{'tool':_0x4170d1,'args':_0x4170d1===_0x4c66f0(0x2f9)?{'path':_0x21926f?.[_0x4c66f0(0x217)],'instruction':_0x21926f?.[_0x4c66f0(0x254)]||_0x21926f?.[_0x4c66f0(0x24a)],'dryRun':_0x21926f?.['dryRun']}:_0x21926f});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x2c1)}],'isError':!![]};if(!MORPH_API_KEY[_0x4c66f0(0x291)]('sk-')&&!MORPH_API_KEY['startsWith'](_0x4c66f0(0x27a)))return{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x1fc)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x4170d1))return{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x209)+_0x4170d1+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x4170d1){case TOOL_NAMES[_0x4c66f0(0x277)]:{let _0x169b3d=_0x21926f;if(_0x169b3d&&typeof _0x169b3d===_0x4c66f0(0x1e0)){if(!(_0x4c66f0(0x217)in _0x169b3d)){const _0x59360b=_0x169b3d[_0x4c66f0(0x1ff)]??_0x169b3d[_0x4c66f0(0x1f0)]??_0x169b3d[_0x4c66f0(0x294)]??_0x169b3d['file_path']??_0x169b3d[_0x4c66f0(0x2cb)];if(_0x59360b)_0x169b3d={..._0x169b3d,'path':_0x59360b};}_0x4c66f0(0x24a)in _0x169b3d&&!(_0x4c66f0(0x254)in _0x169b3d)&&(_0x169b3d={..._0x169b3d,'instruction':_0x169b3d['instructions']});if(!(_0x4c66f0(0x28a)in _0x169b3d)){const _0x21d311=_0x169b3d['code']??_0x169b3d['new_string']??_0x169b3d[_0x4c66f0(0x2fb)]??_0x169b3d['edit'];if(_0x21d311)_0x169b3d={..._0x169b3d,'code_edit':_0x21d311};}}const _0x595b70=MorphEditFileArgsSchema[_0x4c66f0(0x29b)](_0x169b3d);if(!_0x595b70[_0x4c66f0(0x262)])throw new Error(_0x4c66f0(0x219)+_0x595b70[_0x4c66f0(0x1f6)]);const _0x3666dc=await validatePath(_0x595b70[_0x4c66f0(0x28e)]['path']);let _0x5af96d=null,_0x3c41bf=!![],_0x169cd3=null;try{_0x5af96d=await a0_0x53dc6d[_0x4c66f0(0x227)](_0x3666dc,_0x4c66f0(0x2d9)),logger[_0x4c66f0(0x26c)](_0x4c66f0(0x2e7),_0x4c66f0(0x281),{'path':_0x3666dc,'size_bytes':_0x5af96d['length']});}catch(_0x13ed9a){const _0x4c429d=_0x13ed9a[_0x4c66f0(0x296)];_0x4c429d===_0x4c66f0(0x216)?(_0x3c41bf=![],_0x5af96d='',logger[_0x4c66f0(0x26c)](_0x4c66f0(0x2e7),'file_read_complete',{'path':_0x3666dc,'exists':![]})):(_0x169cd3=_0x4c66f0(0x2f1)+(_0x4c429d||_0x4c66f0(0x2eb))+_0x4c66f0(0x2e5)+(_0x13ed9a instanceof Error?_0x13ed9a[_0x4c66f0(0x2ad)]:String(_0x13ed9a)),logger[_0x4c66f0(0x1f6)]('MCP','file_read_failed',{'path':_0x3666dc,'error':_0x169cd3}),logMcpStderr(_0x4c66f0(0x23f)+_0x169cd3));}let _0x3c2fb0;try{const _0xb86e4f=MORPH_API_KEY;if(!_0xb86e4f)throw new Error(_0x4c66f0(0x265));const _0x4adbac=a0_0xa4cb51['dirname'](_0x3666dc),_0xedec2e=a0_0xa4cb51[_0x4c66f0(0x21d)](_0x3666dc);logger['debug'](_0x4c66f0(0x2e7),'api_request_start',{'model':_0x4c66f0(0x1ef),'path':_0x595b70['data'][_0x4c66f0(0x217)],'instruction_len':_0x595b70['data']['instruction'][_0x4c66f0(0x244)],'code_edit_len':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x28a)][_0x4c66f0(0x244)],'original_code_len':_0x5af96d?.[_0x4c66f0(0x244)]??0x0,'dry_run':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x285)]});const _0x1cd819=Date['now'](),_0x4400ad=await executeEditFile({'target_filepath':_0xedec2e,'code_edit':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x28a)],'instruction':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x254)]},{'morphApiKey':_0xb86e4f,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x4adbac,'autoWrite':!_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x285)],'generateUdiff':![],'debug':![]}),_0x1f12a0=Date['now']()-_0x1cd819;_0x3c2fb0=_0x4400ad['completionId'];if(!_0x4400ad[_0x4c66f0(0x262)])throw new Error(_0x4400ad[_0x4c66f0(0x1f6)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x49e2a9=_0x4400ad[_0x4c66f0(0x2ce)],_0x312d62=_0x4c66f0(0x29a)+_0x49e2a9[_0x4c66f0(0x29e)]+_0x4c66f0(0x1e2)+_0x49e2a9[_0x4c66f0(0x24e)]+_0x4c66f0(0x25d)+_0x49e2a9[_0x4c66f0(0x211)];logger[_0x4c66f0(0x26c)](_0x4c66f0(0x2e7),_0x4c66f0(0x280),{'tool':_0x4c66f0(0x2f9),'success':!![],'latency_ms':Date[_0x4c66f0(0x1ee)]()-_0x551b55,'edit_latency_ms':_0x1f12a0,'changes':{'added':_0x49e2a9[_0x4c66f0(0x29e)],'removed':_0x49e2a9[_0x4c66f0(0x24e)],'modified':_0x49e2a9[_0x4c66f0(0x211)]},'completion_id':_0x3c2fb0});if(_0x595b70['data'][_0x4c66f0(0x285)])return{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x2c2)+(_0x3c41bf?'':_0x4c66f0(0x1e6))+':\x20'+_0x595b70[_0x4c66f0(0x28e)]['instruction']+_0x4c66f0(0x22c)+_0x312d62+_0x4c66f0(0x286)+_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x217)]+'.'}]};return{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x2a3)+(_0x3c41bf?_0x4c66f0(0x25f):_0x4c66f0(0x1ed))+':\x20'+_0x595b70['data'][_0x4c66f0(0x254)]+_0x4c66f0(0x22c)+_0x312d62+_0x4c66f0(0x286)+_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x217)]+'.'}]};}catch(_0x28f040){const _0xebf647=handleMorphAPIError(_0x28f040);if(_0xebf647)return logger['error'](_0x4c66f0(0x2e7),_0x4c66f0(0x2a0),{'tool':'edit_file','error':_0x4c66f0(0x20c),'latency_ms':Date['now']()-_0x551b55}),_0xebf647;const _0x1904c9=_0x28f040 instanceof Error?_0x28f040[_0x4c66f0(0x2ad)]:String(_0x28f040);return logger['error'](_0x4c66f0(0x2e7),'tool_call_error',{'tool':_0x4c66f0(0x2f9),'error':_0x1904c9,'path':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x217)],'validated_path':_0x3666dc,'latency_ms':Date[_0x4c66f0(0x1ee)]()-_0x551b55,'stack':_0x28f040 instanceof Error?_0x28f040[_0x4c66f0(0x226)]:undefined}),reportMorphError({'error_message':_0x1904c9,'error_type':_0x28f040 instanceof Error?_0x28f040[_0x4c66f0(0x304)][_0x4c66f0(0x2ca)]:_0x4c66f0(0x206),'context':{'tool':'edit_file','completion_id':_0x3c2fb0,'file_path':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x217)],'validated_path':_0x3666dc,'instruction':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x254)],'model':MORPH_LARGE_APPLY?_0x4c66f0(0x29d):_0x4c66f0(0x1ef),'dry_run':_0x595b70[_0x4c66f0(0x28e)]['dryRun'],'file_exists':_0x3c41bf,'file_read_error':_0x169cd3,'file_readable':_0x5af96d!==null,'request_content':{'path':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x217)],'code_edit':_0x595b70['data'][_0x4c66f0(0x28a)],'instruction':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x254)],'original_code':_0x5af96d!==null?_0x5af96d[_0x4c66f0(0x244)]>0xc350?_0x5af96d['substring'](0x0,0xc350)+_0x4c66f0(0x2e6)+_0x5af96d[_0x4c66f0(0x244)]+_0x4c66f0(0x2b3):_0x5af96d:'[could\x20not\x20read\x20file:\x20'+(_0x169cd3||'unknown\x20error')+']','original_code_length':_0x5af96d?.[_0x4c66f0(0x244)]??0x0,'model':MORPH_LARGE_APPLY?_0x4c66f0(0x29d):'morph-v3-fast','dry_run':_0x595b70[_0x4c66f0(0x28e)][_0x4c66f0(0x285)]}},'stack_trace':_0x28f040 instanceof Error?_0x28f040[_0x4c66f0(0x226)]:undefined,'source':_0x4c66f0(0x23c)})[_0x4c66f0(0x272)](()=>{}),{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x2d8)+_0x1904c9}],'isError':!![]};}}case TOOL_NAMES[_0x4c66f0(0x27e)]:{const _0x48afe4=WarpGrepArgsSchema[_0x4c66f0(0x29b)](_0x21926f);if(!_0x48afe4['success'])return{'content':[{'type':'text','text':_0x4c66f0(0x21b)+_0x48afe4['error']}],'isError':!![]};const _0x38fb01=_0x17844e=>{const _0x5c0f0c=_0x4c66f0,_0x5238b3=[];for(const _0x2ea8ae of _0x17844e||[]){if(_0x2ea8ae[_0x5c0f0c(0x239)]===_0x5c0f0c(0x2fc)&&Array[_0x5c0f0c(0x2f3)](_0x2ea8ae[_0x5c0f0c(0x1f7)]))for(const _0x36bc78 of _0x2ea8ae[_0x5c0f0c(0x1f7)]){try{const _0x392518=_0x36bc78[_0x5c0f0c(0x297)]?.[_0x5c0f0c(0x2ca)],_0x3df743=JSON['parse'](_0x36bc78[_0x5c0f0c(0x297)]?.[_0x5c0f0c(0x301)]||'{}');if(_0x392518===_0x5c0f0c(0x1ec))_0x5238b3[_0x5c0f0c(0x2ab)](_0x5c0f0c(0x245)+_0x3df743[_0x5c0f0c(0x22a)]+'\x27\x20'+(_0x3df743[_0x5c0f0c(0x217)]||'.'));else{if(_0x392518===_0x5c0f0c(0x204))_0x5238b3[_0x5c0f0c(0x2ab)](_0x5c0f0c(0x249)+_0x3df743[_0x5c0f0c(0x217)]);else{if(_0x392518===_0x5c0f0c(0x20e))_0x5238b3['push'](_0x5c0f0c(0x2d6)+(_0x3df743['command']||'.'));else{if(_0x392518==='glob')_0x5238b3[_0x5c0f0c(0x2ab)]('glob\x20\x27'+_0x3df743[_0x5c0f0c(0x22a)]+'\x27\x20'+(_0x3df743[_0x5c0f0c(0x217)]||'.'));else _0x392518===_0x5c0f0c(0x25c)&&_0x5238b3[_0x5c0f0c(0x2ab)]('finish');}}}}catch{}}}return _0x5238b3;},_0x214bdb=_0x4ac1f2=>{const _0x5231ca=_0x4c66f0,_0x4f206b=[];if(!_0x4ac1f2||!Array[_0x5231ca(0x2f3)](_0x4ac1f2))return _0x4f206b;const _0x423230=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x5231ca(0x2c5),'tool':_0x5231ca(0x204)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x5231ca(0x2cc),'tool':_0x5231ca(0x204)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x5231ca(0x2c8),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x5231ca(0x23d),'tool':_0x5231ca(0x24f)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x5231ca(0x2f8),'tool':_0x5231ca(0x24f)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x5231ca(0x2c8),'tool':_0x5231ca(0x204)},{'pattern':/\[SYMLINK\]/,'error_type':_0x5231ca(0x2be),'tool':_0x5231ca(0x204)},{'pattern':/not a text file/,'error_type':_0x5231ca(0x2c8),'tool':_0x5231ca(0x204)},{'pattern':/symbolic link/,'error_type':_0x5231ca(0x2be),'tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x5231ca(0x1f5),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x5231ca(0x2bb),'tool':_0x5231ca(0x2eb)}];let _0x2fc591=0x0;for(const _0x2009fb of _0x4ac1f2){_0x2009fb['role']===_0x5231ca(0x2fc)&&Array['isArray'](_0x2009fb[_0x5231ca(0x1f7)])&&_0x2fc591++;const _0xf5092f=_0x2009fb[_0x5231ca(0x2fb)];if((_0x2009fb[_0x5231ca(0x239)]===_0x5231ca(0x230)||_0x2009fb[_0x5231ca(0x239)]===_0x5231ca(0x2e4))&&_0xf5092f&&typeof _0xf5092f===_0x5231ca(0x21a))for(const {pattern:_0x544985,error_type:_0x292caa,tool:_0x3e2d49}of _0x423230){const _0x918175=_0xf5092f[_0x5231ca(0x1df)](new RegExp(_0x544985[_0x5231ca(0x2bd)],'g'));if(_0x918175)for(const _0x1ca073 of _0x918175){const _0x37e41d=_0xf5092f[_0x5231ca(0x28b)](_0x1ca073),_0x2392d4=_0xf5092f[_0x5231ca(0x21c)](_0x37e41d,Math[_0x5231ca(0x1db)](_0x37e41d+0xc8,_0xf5092f[_0x5231ca(0x244)]));_0x4f206b[_0x5231ca(0x2ab)]({'tool':_0x3e2d49,'error_type':_0x292caa,'error_message':_0x2392d4['split']('\x0a')[0x0],'turn':_0x2fc591});}}}return _0x4f206b;};try{const _0x4184a5=a0_0xa4cb51['resolve'](_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)]),_0x1564c8=_0x48afe4[_0x4c66f0(0x28e)]['search_type'],_0x11cdd2=_0x1564c8==='node_modules'?{'allowNames':[_0x4c66f0(0x207)]}:undefined,_0x501107=new LocalRipgrepProvider(_0x4184a5,undefined,_0x11cdd2);logger[_0x4c66f0(0x26c)](_0x4c66f0(0x2e7),'provider_created',{'type':_0x4c66f0(0x26f),'repo_root':_0x4184a5,'search_type':_0x1564c8||_0x4c66f0(0x208)}),logger[_0x4c66f0(0x26c)](_0x4c66f0(0x2e7),'warp_grep_start',{'query':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'repo_root':_0x4184a5,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0xba5e80=Date[_0x4c66f0(0x1ee)](),_0x1675e3=await runWarpGrep({'searchTerm':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'repoRoot':_0x4184a5,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x501107,'search_type':_0x1564c8}),_0x509fe7=Date[_0x4c66f0(0x1ee)]()-_0xba5e80,_0xee7836=_0x1675e3['finish']?.[_0x4c66f0(0x214)]?.[_0x4c66f0(0x2de)]?.['length']??0x0;logger[_0x4c66f0(0x26c)]('MCP',_0x4c66f0(0x2af),{'termination':_0x1675e3[_0x4c66f0(0x1fb)],'turns':_0x1675e3[_0x4c66f0(0x2ea)]?.['turns']??0x0,'files_found':_0xee7836,'latency_ms':_0x509fe7});const _0x2adfcc=_0x214bdb(_0x1675e3[_0x4c66f0(0x202)]);_0x2adfcc['length']>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x2adfcc[_0x4c66f0(0x244)]+_0x4c66f0(0x2fa),'error_type':_0x4c66f0(0x210),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],'query':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'model':_0x4c66f0(0x237),'termination_reason':_0x1675e3['terminationReason'],'sub_tool_errors':_0x2adfcc,'timings':_0x1675e3[_0x4c66f0(0x2ea)],'tool_calls':_0x38fb01(_0x1675e3['messages']),'messages':_0x1675e3[_0x4c66f0(0x202)]?.[_0x4c66f0(0x252)](_0x53fd5e=>({'role':_0x53fd5e[_0x4c66f0(0x239)],'content':_0x53fd5e[_0x4c66f0(0x2fb)],..._0x53fd5e[_0x4c66f0(0x1f7)]?{'tool_calls':_0x53fd5e[_0x4c66f0(0x1f7)]['length']}:{},..._0x53fd5e[_0x4c66f0(0x2cd)]?{'tool_call_id':_0x53fd5e[_0x4c66f0(0x2cd)]}:{}}))},'source':_0x4c66f0(0x23c)})[_0x4c66f0(0x272)](()=>{});let _0x1f8874='';if(_0x1675e3['terminationReason']===_0x4c66f0(0x2b1)&&_0x1675e3[_0x4c66f0(0x25c)]?.[_0x4c66f0(0x214)]?.[_0x4c66f0(0x2de)]){const _0x1591ff=_0x1675e3[_0x4c66f0(0x25c)]['metadata'][_0x4c66f0(0x2de)];if(_0x1591ff['length']===0x0)return _0x1f8874=_0x1675e3[_0x4c66f0(0x25c)]['payload']||_0x4c66f0(0x289),{'content':[{'type':_0x4c66f0(0x299),'text':_0x1f8874}]};const _0xd5aeca=[],_0x18cb88=[_0x4c66f0(0x203)];for(const _0x14b488 of _0x1675e3[_0x4c66f0(0x202)]){if(_0x14b488[_0x4c66f0(0x239)]===_0x4c66f0(0x2fc)&&Array[_0x4c66f0(0x2f3)](_0x14b488['tool_calls']))for(const _0x50805e of _0x14b488[_0x4c66f0(0x1f7)]){try{const _0x41ded1=_0x50805e[_0x4c66f0(0x297)]?.[_0x4c66f0(0x2ca)],_0x523c9d=JSON[_0x4c66f0(0x268)](_0x50805e[_0x4c66f0(0x297)]?.[_0x4c66f0(0x301)]||'{}');if(_0x41ded1===_0x4c66f0(0x1ec))_0x18cb88['push'](_0x4c66f0(0x256)+_0x523c9d['pattern']+_0x4c66f0(0x263)+(_0x523c9d[_0x4c66f0(0x217)]||'.')+'`');else{if(_0x41ded1==='read')_0x18cb88[_0x4c66f0(0x2ab)](_0x4c66f0(0x27f)+_0x523c9d[_0x4c66f0(0x217)]+'`');else{if(_0x41ded1===_0x4c66f0(0x20e))_0x18cb88[_0x4c66f0(0x2ab)]('-\x20Listed\x20directory\x20`'+(_0x523c9d[_0x4c66f0(0x261)]||'.')+'`');else _0x41ded1===_0x4c66f0(0x2b4)&&_0x18cb88[_0x4c66f0(0x2ab)](_0x4c66f0(0x2a9)+_0x523c9d[_0x4c66f0(0x22a)]+_0x4c66f0(0x1e5)+(_0x523c9d[_0x4c66f0(0x217)]||'.')+'`');}}}catch{}}}_0xd5aeca[_0x4c66f0(0x2ab)](_0x18cb88['join']('\x0a'));const _0x3826aa=['',_0x4c66f0(0x2cf)];for(const _0x5d5eef of _0x1591ff){if(_0x5d5eef[_0x4c66f0(0x264)]==='*')_0x3826aa[_0x4c66f0(0x2ab)]('-\x20'+_0x5d5eef['path']+':*');else{if(Array[_0x4c66f0(0x2f3)](_0x5d5eef[_0x4c66f0(0x264)])){const _0x5ef306=_0x5d5eef['lines'][_0x4c66f0(0x252)](([_0x314ce1,_0x49e224])=>{if(_0x314ce1===_0x49e224)return''+_0x314ce1;return _0x314ce1+'-'+_0x49e224;});_0x3826aa[_0x4c66f0(0x2ab)]('-\x20'+_0x5d5eef[_0x4c66f0(0x217)]+':'+_0x5ef306[_0x4c66f0(0x201)](','));}else _0x3826aa['push']('-\x20'+_0x5d5eef['path']+':*');}}_0x3826aa[_0x4c66f0(0x2ab)](''),_0xd5aeca[_0x4c66f0(0x2ab)](_0x3826aa['join']('\x0a')),_0xd5aeca['push'](_0x4c66f0(0x2ae));const _0x5c4887=[],_0x4e8cdc=[];for(const _0x5b9f00 of _0x1591ff){let _0x33d5a2=a0_0xa4cb51[_0x4c66f0(0x2a1)](_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],_0x5b9f00[_0x4c66f0(0x217)]),_0x35080f=null,_0x4d2d92=null;try{_0x35080f=await a0_0x53dc6d[_0x4c66f0(0x227)](_0x33d5a2,{'encoding':_0x4c66f0(0x2d9)});}catch(_0x52819b){const _0x1a369b=fixPathRepetition(_0x33d5a2);if(_0x1a369b)try{_0x35080f=await a0_0x53dc6d['readFile'](_0x1a369b,{'encoding':_0x4c66f0(0x2d9)}),_0x33d5a2=_0x1a369b;}catch{_0x4d2d92=_0x52819b instanceof Error?_0x52819b:new Error(String(_0x52819b));}else _0x4d2d92=_0x52819b instanceof Error?_0x52819b:new Error(String(_0x52819b));}if(_0x35080f!==null){const _0x120246=_0x35080f[_0x4c66f0(0x2da)](/\r?\n/),_0x3c3136=[];if(_0x5b9f00[_0x4c66f0(0x264)]==='*'||!Array[_0x4c66f0(0x2f3)](_0x5b9f00[_0x4c66f0(0x264)]))for(let _0x21a018=0x1;_0x21a018<=_0x120246[_0x4c66f0(0x244)];_0x21a018++){const _0x3950da=_0x120246[_0x21a018-0x1];_0x3c3136[_0x4c66f0(0x2ab)](_0x21a018+'|\x20'+_0x3950da);}else for(const [_0xe26e87,_0x3307b0]of _0x5b9f00['lines']){_0x3c3136[_0x4c66f0(0x244)]>0x0&&_0x3c3136['push']('');for(let _0x5182ab=_0xe26e87;_0x5182ab<=_0x3307b0&&_0x5182ab<=_0x120246[_0x4c66f0(0x244)];_0x5182ab++){const _0x5fbcf4=_0x120246[_0x5182ab-0x1];_0x3c3136['push'](_0x5182ab+'|\x20'+_0x5fbcf4);}}_0x4e8cdc[_0x4c66f0(0x2ab)]({'path':_0x5b9f00['path'],'content':_0x3c3136[_0x4c66f0(0x201)]('\x0a')});}else _0x5c4887['push'](_0x4c66f0(0x242)+_0x5b9f00[_0x4c66f0(0x217)]+_0x4c66f0(0x1dc)+(_0x4d2d92?.[_0x4c66f0(0x2ad)]||_0x4c66f0(0x2ed))+_0x4c66f0(0x21e));}try{const _0x1cf872=await compactFileContexts(_0x4e8cdc,_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],MORPH_API_KEY,MORPH_API_URL);for(const _0x178778 of _0x1cf872){_0x5c4887[_0x4c66f0(0x2ab)](_0x4c66f0(0x242)+_0x178778[_0x4c66f0(0x217)]+'\x22>\x0a'+_0x178778[_0x4c66f0(0x2fb)]+_0x4c66f0(0x21e));}}catch(_0x325101){logger['warn']('MCP','compaction_failed',{'error':_0x325101 instanceof Error?_0x325101[_0x4c66f0(0x2ad)]:String(_0x325101),'files_count':_0x4e8cdc[_0x4c66f0(0x244)]});for(const _0x56a18f of _0x4e8cdc){_0x5c4887[_0x4c66f0(0x2ab)]('<file\x20path=\x22'+_0x56a18f['path']+_0x4c66f0(0x2b5)+_0x56a18f[_0x4c66f0(0x2fb)]+'\x0a</file>');}}_0xd5aeca[_0x4c66f0(0x2ab)](_0x5c4887[_0x4c66f0(0x201)]('\x0a\x0a')),_0x1f8874=_0xd5aeca[_0x4c66f0(0x201)]('\x0a');const _0x3d4d45=_0x1675e3[_0x4c66f0(0x2f5)]?.['filter'](_0x277232=>_0x277232[_0x4c66f0(0x2ad)]?.['startsWith'](_0x4c66f0(0x24d)))||[];if(_0x3d4d45[_0x4c66f0(0x244)]>0x0){const _0x3ba9aa=_0x3d4d45[_0x4c66f0(0x252)](_0x4cdb02=>_0x4cdb02['message'])['join'](';\x20');reportMorphError({'error_message':_0x3ba9aa,'error_type':_0x4c66f0(0x20d),'context':{'tool':_0x4c66f0(0x234),'repo_path':_0x48afe4['data'][_0x4c66f0(0x1e3)],'query':_0x48afe4[_0x4c66f0(0x28e)]['search_string'],'model':_0x4c66f0(0x237),'termination_reason':_0x4c66f0(0x243),'error_count':_0x3d4d45[_0x4c66f0(0x244)],'is_timeout':![],'timings':_0x1675e3[_0x4c66f0(0x2ea)],'files_attempted':_0x1591ff[_0x4c66f0(0x252)](_0x372a1f=>({'path':_0x372a1f['path'],'lines':_0x372a1f['lines']})),'tool_calls':_0x38fb01(_0x1675e3[_0x4c66f0(0x202)]),'messages':_0x1675e3[_0x4c66f0(0x202)]?.[_0x4c66f0(0x252)](_0x45de69=>({'role':_0x45de69['role'],'content':_0x45de69[_0x4c66f0(0x2fb)],..._0x45de69[_0x4c66f0(0x1f7)]?{'tool_calls':_0x45de69[_0x4c66f0(0x1f7)][_0x4c66f0(0x244)]}:{},..._0x45de69['tool_call_id']?{'tool_call_id':_0x45de69['tool_call_id']}:{}})),'request_content':{'query':_0x48afe4['data']['search_string'],'repo_path':_0x48afe4['data'][_0x4c66f0(0x1e3)],'repoRoot':a0_0xa4cb51[_0x4c66f0(0x2a1)](_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)]),'model':'morph-warp-grep-v2.1'}},'source':_0x4c66f0(0x23c)})[_0x4c66f0(0x272)](()=>{});}}else{if(_0x1675e3['terminationReason']===_0x4c66f0(0x25b)&&_0x1675e3[_0x4c66f0(0x2f5)][_0x4c66f0(0x244)]>0x0){const _0x2d5892=_0x1675e3[_0x4c66f0(0x2f5)][_0x4c66f0(0x252)](_0x84ea6e=>_0x84ea6e[_0x4c66f0(0x2ad)])[_0x4c66f0(0x201)](';\x20');_0x1f8874=_0x4c66f0(0x250)+_0x2d5892;const _0x102623=_0x2d5892[_0x4c66f0(0x221)]()[_0x4c66f0(0x235)](_0x4c66f0(0x212))||_0x2d5892[_0x4c66f0(0x221)]()[_0x4c66f0(0x235)]('timed\x20out')||_0x2d5892[_0x4c66f0(0x221)]()['includes'](_0x4c66f0(0x1fd)),_0x5be270=_0x1675e3[_0x4c66f0(0x25c)]?.[_0x4c66f0(0x214)]?.['files'],_0x2af8fd=_0x1675e3[_0x4c66f0(0x2f5)][0x0];reportMorphError({'error_message':_0x2d5892,'error_type':_0x102623?_0x4c66f0(0x2fe):_0x2af8fd?.[_0x4c66f0(0x304)]?.[_0x4c66f0(0x2ca)]||_0x4c66f0(0x2b0),'context':{'tool':_0x4c66f0(0x234),'repo_path':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],'query':_0x48afe4['data'][_0x4c66f0(0x2f2)],'model':_0x4c66f0(0x237),'termination_reason':_0x1675e3[_0x4c66f0(0x1fb)],'error_count':_0x1675e3[_0x4c66f0(0x2f5)][_0x4c66f0(0x244)],'is_timeout':_0x102623,'timings':_0x1675e3[_0x4c66f0(0x2ea)],'files_attempted':_0x5be270?.['map'](_0x2394ed=>({'path':_0x2394ed[_0x4c66f0(0x217)],'lines':_0x2394ed[_0x4c66f0(0x264)]})),'tool_calls':_0x38fb01(_0x1675e3[_0x4c66f0(0x202)]),'messages':_0x1675e3['messages']?.[_0x4c66f0(0x252)](_0x54ac20=>({'role':_0x54ac20[_0x4c66f0(0x239)],'content':_0x54ac20[_0x4c66f0(0x2fb)],..._0x54ac20[_0x4c66f0(0x1f7)]?{'tool_calls':_0x54ac20[_0x4c66f0(0x1f7)][_0x4c66f0(0x244)]}:{},..._0x54ac20[_0x4c66f0(0x2cd)]?{'tool_call_id':_0x54ac20['tool_call_id']}:{}})),'request_content':{'query':_0x48afe4['data']['search_string'],'repo_path':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],'repoRoot':a0_0xa4cb51['resolve'](_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)]),'model':_0x4c66f0(0x237)}},'stack_trace':_0x2af8fd?.[_0x4c66f0(0x226)]||undefined,'source':_0x4c66f0(0x23c)})[_0x4c66f0(0x272)](()=>{});}else _0x1f8874=_0x4c66f0(0x26d);}return{'content':[{'type':_0x4c66f0(0x299),'text':_0x1f8874}]};}catch(_0x4c6c00){const _0x4cfeee=handleMorphAPIError(_0x4c6c00);if(_0x4cfeee)return logger[_0x4c66f0(0x1f6)](_0x4c66f0(0x2e7),_0x4c66f0(0x2a0),{'tool':'codebase_search','error':_0x4c66f0(0x20c),'latency_ms':Date['now']()-_0x551b55}),_0x4cfeee;const _0x94f34d=_0x4c6c00 instanceof Error?_0x4c6c00['message']:String(_0x4c6c00);logger[_0x4c66f0(0x1f6)]('MCP',_0x4c66f0(0x2a0),{'tool':'codebase_search','error':_0x94f34d,'repo_path':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],'query':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'latency_ms':Date['now']()-_0x551b55});const _0xfe50e6=_0x94f34d['toLowerCase']()[_0x4c66f0(0x235)]('timeout')||_0x94f34d['toLowerCase']()[_0x4c66f0(0x235)](_0x4c66f0(0x2d7))||_0x94f34d['toLowerCase']()[_0x4c66f0(0x235)](_0x4c66f0(0x1fd))||_0x4c6c00 instanceof Error&&_0x4c6c00['name']==='TimeoutError';return reportMorphError({'error_message':_0x94f34d,'error_type':_0xfe50e6?_0x4c66f0(0x2fe):_0x4c6c00 instanceof Error?_0x4c6c00['constructor'][_0x4c66f0(0x2ca)]:_0x4c66f0(0x206),'context':{'tool':_0x4c66f0(0x234),'repo_path':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],'query':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'model':_0x4c66f0(0x237),'is_timeout':_0xfe50e6,'exception_phase':_0x4c66f0(0x258),'request_content':{'query':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'repo_path':_0x48afe4[_0x4c66f0(0x28e)][_0x4c66f0(0x1e3)],'repoRoot':a0_0xa4cb51[_0x4c66f0(0x2a1)](_0x48afe4['data']['repo_path']),'model':_0x4c66f0(0x237)}},'stack_trace':_0x4c6c00 instanceof Error?_0x4c6c00[_0x4c66f0(0x226)]:undefined,'source':_0x4c66f0(0x23c)})[_0x4c66f0(0x272)](()=>{}),{'content':[{'type':_0x4c66f0(0x299),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x94f34d}],'isError':![]};}}case TOOL_NAMES[_0x4c66f0(0x24c)]:{const _0x4a8be3=WarpGrepGitHubArgsSchema[_0x4c66f0(0x29b)](_0x21926f);if(!_0x4a8be3['success'])return{'content':[{'type':'text','text':_0x4c66f0(0x21b)+_0x4a8be3[_0x4c66f0(0x1f6)]}],'isError':!![]};const _0x3513ff=_0x4a8be3['data']['github_url']||_0x4a8be3[_0x4c66f0(0x28e)]['owner_repo'];if(!_0x3513ff)return{'content':[{'type':'text','text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x13477d=MORPH_API_KEY;if(!_0x13477d)throw new Error(_0x4c66f0(0x265));const _0x19c831=Date[_0x4c66f0(0x1ee)]();logger['debug'](_0x4c66f0(0x2e7),_0x4c66f0(0x23a),{'identifier':_0x3513ff,'query':_0x4a8be3[_0x4c66f0(0x28e)][_0x4c66f0(0x2f2)],'branch':_0x4a8be3[_0x4c66f0(0x28e)][_0x4c66f0(0x20f)]});try{const _0x5c1fc1=new WarpGrepClient({'morphApiKey':_0x13477d,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x1c6b9e=await _0x5c1fc1[_0x4c66f0(0x2d5)]({'searchTerm':_0x4a8be3['data'][_0x4c66f0(0x2f2)],'github':_0x3513ff,'branch':_0x4a8be3['data'][_0x4c66f0(0x20f)]}),_0x3483db=Date['now']()-_0x19c831;logMcpStderr(_0x4c66f0(0x246)+_0x3483db+_0x4c66f0(0x2dd)+_0x1c6b9e[_0x4c66f0(0x262)]);const _0x2a5260=formatResult(_0x1c6b9e);return{'content':[{'type':_0x4c66f0(0x299),'text':_0x2a5260}]};}catch(_0x6f11f8){const _0x1715b9=handleMorphAPIError(_0x6f11f8);if(_0x1715b9)return _0x1715b9;const _0x5db94e=Date['now']()-_0x19c831,_0x45f634=_0x6f11f8 instanceof Error?_0x6f11f8[_0x4c66f0(0x2ad)]:String(_0x6f11f8);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x5db94e+_0x4c66f0(0x2d4),_0x45f634),reportMorphError({'error_message':_0x45f634,'error_type':_0x6f11f8 instanceof Error?_0x6f11f8['constructor'][_0x4c66f0(0x2ca)]:'UnknownError','context':{'tool':_0x4c66f0(0x300),'github_url':_0x3513ff,'search_string':_0x4a8be3['data'][_0x4c66f0(0x2f2)],'branch':_0x4a8be3[_0x4c66f0(0x28e)][_0x4c66f0(0x20f)]},'stack_trace':_0x6f11f8 instanceof Error?_0x6f11f8[_0x4c66f0(0x226)]:undefined,'source':_0x4c66f0(0x23c),'tool':_0x4c66f0(0x300),'latency_ms':_0x5db94e})[_0x4c66f0(0x272)](()=>{}),{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x1dd)+_0x45f634}],'isError':![]};}}default:throw new Error(_0x4c66f0(0x2ee)+_0x4170d1);}}catch(_0x39d300){const _0x56ebbb=_0x39d300 instanceof Error?_0x39d300[_0x4c66f0(0x2ad)]:String(_0x39d300);return reportMorphError({'error_message':_0x56ebbb,'error_type':_0x39d300 instanceof Error?_0x39d300[_0x4c66f0(0x304)][_0x4c66f0(0x2ca)]:'UnknownError','context':{'tool':_0x4170d1,'arguments':_0x21926f?JSON[_0x4c66f0(0x27c)](_0x21926f)[_0x4c66f0(0x21c)](0x0,0x1f4):undefined,'mcp_server_version':_0x4c66f0(0x215)},'stack_trace':_0x39d300 instanceof Error?_0x39d300['stack']:undefined,'source':_0x4c66f0(0x23c)})['catch'](()=>{}),{'content':[{'type':_0x4c66f0(0x299),'text':_0x4c66f0(0x250)+_0x56ebbb}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x57dae3){const _0x33e8bf=a0_0x510957,_0x52a679=await getValidRootDirectories(_0x57dae3);if(_0x52a679['length']>0x0)allowedDirectories=[..._0x52a679],logMcpStderr(_0x33e8bf(0x2df)+_0x52a679[_0x33e8bf(0x244)]+_0x33e8bf(0x1f1));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x38d0df=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x38d0df&&(allowedDirectories=[_0x38d0df],logMcpStderr(_0x33e8bf(0x2c4)+_0x38d0df));}catch(_0x4392f8){logMcpStderr(_0x33e8bf(0x23b)+_0x4392f8);}}}server[a0_0x510957(0x236)](RootsListChangedNotificationSchema,async()=>{const _0x32578d=a0_0x510957;try{const _0x462052=await server[_0x32578d(0x273)]();_0x462052&&_0x32578d(0x2aa)in _0x462052&&await updateAllowedDirectoriesFromRoots(_0x462052[_0x32578d(0x2aa)]);}catch(_0x3d8abd){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x3d8abd instanceof Error?_0x3d8abd[_0x32578d(0x2ad)]:String(_0x3d8abd));}}),server['oninitialized']=async()=>{const _0x17f33f=a0_0x510957,_0x2c80ad=server[_0x17f33f(0x1e8)]();if(_0x2c80ad?.[_0x17f33f(0x2aa)])try{const _0x1169e0=await server['listRoots']();_0x1169e0&&_0x17f33f(0x2aa)in _0x1169e0?await updateAllowedDirectoriesFromRoots(_0x1169e0[_0x17f33f(0x2aa)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x4029ca){logMcpStderr(_0x17f33f(0x2c7),_0x4029ca instanceof Error?_0x4029ca[_0x17f33f(0x2ad)]:String(_0x4029ca));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x17f33f(0x233),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x17f33f(0x2d3));}}};async function runServer(){const _0x461eb1=a0_0x510957,_0x5e5b79=new StdioServerTransport();await server[_0x461eb1(0x2e3)](_0x5e5b79),logMcpStderr(_0x461eb1(0x2e2)),allowedDirectories[_0x461eb1(0x244)]===0x0&&logMcpStderr(_0x461eb1(0x2f6));}runServer()[a0_0x510957(0x272)](_0x40d508=>{const _0x221de7=a0_0x510957;logMcpStderr(_0x221de7(0x2a2),_0x40d508),process['exit'](0x1);});
2
+ const a0_0x56a8fe=a0_0x4e75;(function(_0x59f9e7,_0x435f22){const _0x4e2c9f=a0_0x4e75,_0x52c45c=_0x59f9e7();while(!![]){try{const _0x49d585=parseInt(_0x4e2c9f(0x258))/0x1*(parseInt(_0x4e2c9f(0x1da))/0x2)+parseInt(_0x4e2c9f(0x1e9))/0x3*(-parseInt(_0x4e2c9f(0x1bb))/0x4)+-parseInt(_0x4e2c9f(0x25b))/0x5*(-parseInt(_0x4e2c9f(0x1be))/0x6)+-parseInt(_0x4e2c9f(0x1d5))/0x7+parseInt(_0x4e2c9f(0x16d))/0x8*(-parseInt(_0x4e2c9f(0x19d))/0x9)+-parseInt(_0x4e2c9f(0x262))/0xa+parseInt(_0x4e2c9f(0x161))/0xb*(parseInt(_0x4e2c9f(0x223))/0xc);if(_0x49d585===_0x435f22)break;else _0x52c45c['push'](_0x52c45c['shift']());}catch(_0x45d84f){_0x52c45c['push'](_0x52c45c['shift']());}}}(a0_0x30e6,0x7c4f4));import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x30e6(){const _0x1904c5=['includes','unknown','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x22>\x0a','\x0a...\x20(truncated,\x20total:\x20','push','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','linesModified','Tool\x20\x22','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','Preview\x20changes\x20without\x20applying\x20them.','GitHub\x20search\x20failed:\x20','map','Parent\x20directory\x20does\x20not\x20exist:\x20','mcp-filesystem','default','description','go.mod','composer.json','../package.json','optional','listRoots','all','list_directory\x20','size','214713mSGgMZ','\x20error(s)','isDirectory','exit','min','false','-\x20Read\x20file\x20`','Rules:\x0a','Example\x20format:\x0a','❌\x20Morph\x20Edit\x20Failed:\x20','Failed\x20to\x20read\x20file:\x20','text','tool_call_error','Warning:\x20','lines','warn','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.','-\x20Listed\x20directory\x20`','messages','Morph\x20FastApply\x20failed\x20without\x20error\x20message','@morphllm/morphmcp\x20','success','response','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','\x20disabled\x20via\x20DISABLED_TOOLS','toISOString','path_validation_failed','Bearer\x20','post','startsWith','4ZtQEmW','dirname','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','6ILunZG','inputSchema','TimeoutError','resolve','errors','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','FileNotFound','setNotificationHandler','branch','File\x20read\x20error:','--version','stack','toLowerCase','roots','search_type','substring','Specific\x20commit\x20hash\x20to\x20search','0.2.0','split','edit','Here\x20is\x20the\x20content\x20of\x20files:\x0a','file_read_complete','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','6543411Gpgyxi','morph-','Error\x20running\x20fast\x20context\x20search:\x20','instructions','stat','322068VlbNJo','now','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','oninitialized','completed','PathError','BinaryFile','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.','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','version','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','number','api-key','terminated','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.','2300913WdBoOU','Applied','Created\x20File','argv','Unknown\x20tool:\x20','RipgrepNotAvailable','\x22.\x20Known\x20tools:\x20','\x0a</file>','WarpGrep\x20sub-tool\x20errors:\x20','FileReadError','\x22>\x0aError\x20reading\x20file:\x20','Max\x20results\x20to\x20return','glob','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','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.','[github_codebase_search]\x20Failed\x20in\x20','trim','MORPH_WARP_GREP_TIMEOUT','Failed\x20to\x20request\x20roots\x20from\x20client:','instruction','EDIT_FILE','list_directory','describe','UnknownError','read','SymlinkError','.\x20Path:\x20','boolean','morph-v3-large','floor','message','isArray','github_search_start','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','catch','timeout','requiresApiKey','Unknown\x20error','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','\x0aOptions:','changes','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','Error\x20accessing\x20directory\x20','<file\x20path=\x22','grep','log','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','setRequestHandler','PWD','ENABLE_WORKSPACE_MODE','ms:','file_read_failed','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','tool_call_received','132564hcpKTQ','connect','https://morphllm.com/api/error-report','repo_path','MCP','stringify','some','code','\x20is\x20not\x20a\x20directory','unknown\x20error','linesRemoved','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','new_string','file','CODEBASE_SEARCH','.vscode','-\x20Grepped\x20\x27','user','object','turns','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','function','completionId','edit_file','LocalRipgrepProvider','array','MORPH_API_URL','code_edit','timed\x20out','morph-mcp','tsconfig.json','.\x20Changes:\x20',',\x20modified\x20','ReadError','parse','payload','metadata','timings','normalize','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','target_filepath','linesAdded','files','morph-v3-fast','github_codebase_search','context','utf-8','ms.\x20Success:\x20','data','\x20as\x20allowed\x20directory','owner_repo','2CfQBNa','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','grep\x20\x27','384315NeiIHT','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','name','morph-warp-grep-v2.1','etimedout','readFile','4204470zFEkrg','node_modules','.cursor','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','finish','homedir','role','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','api_request_start','Error:\x20','path_validation_resolved','env','API\x20error\x20(auth/rate-limit)','--help','length','tool_call_id','dryRun','runWarpGrep_call','sk-','warp_grep_complete','\x20-\x20','string','\x20chars)','constructor','debug','has','Repository\x20identifier','filter','--api-key','**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','\x0aExamples:','status','-\x20Preserve\x20exact\x20indentation\x0a','Morph\x20Edit\x20Preview','join','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','pyproject.toml','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','Invalid\x20arguments:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','arguments','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','searchGitHub','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','slice','2508PwbSIH','every','codebase_search','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','path','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','safeParse','[could\x20not\x20read\x20file:\x20','match','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.','pattern','sep','96UeNHXB','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','completed_with_file_errors','tool','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','Fallback:\x20Using\x20workspace\x20root\x20','terminationReason','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','ToolException','command','basename','tool_calls','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','content','Morph\x20Edit\x20','package.json','--api-key=','error','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','realpath','search_string','enum'];a0_0x30e6=function(){return _0x1904c5;};return a0_0x30e6();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x4dc500 from'fs/promises';import a0_0x27fcca from'path';import a0_0x1b25bd 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_0x19c627 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x685caf){const _0x35bad4=a0_0x4e75,_0x38478e=_0x685caf[_0x35bad4(0x1d0)](a0_0x27fcca['sep'])[_0x35bad4(0x14f)](Boolean);if(_0x38478e[_0x35bad4(0x270)]<0x2)return null;for(let _0x4678fe=Math[_0x35bad4(0x207)](_0x38478e[_0x35bad4(0x270)]/0x2);_0x4678fe>=0x1;_0x4678fe--){for(let _0x1b78bb=0x0;_0x1b78bb<=_0x38478e['length']-0x2*_0x4678fe;_0x1b78bb++){const _0x1a6d54=_0x38478e[_0x35bad4(0x160)](_0x1b78bb,_0x1b78bb+_0x4678fe),_0x21f162=_0x38478e[_0x35bad4(0x160)](_0x1b78bb+_0x4678fe,_0x1b78bb+0x2*_0x4678fe);if(_0x1a6d54[_0x35bad4(0x162)]((_0x35f82d,_0x473ee0)=>_0x35f82d===_0x21f162[_0x473ee0])){const _0x3079cb=[..._0x38478e[_0x35bad4(0x160)](0x0,_0x1b78bb),..._0x38478e[_0x35bad4(0x160)](_0x1b78bb+_0x4678fe)];return a0_0x27fcca[_0x35bad4(0x16c)]+_0x3079cb[_0x35bad4(0x156)](a0_0x27fcca['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1e8372=a0_0x4e75;try{const _0x4c684f=require(_0x1e8372(0x197));return _0x4c684f[_0x1e8372(0x1e3)]??_0x1e8372(0x185);}catch(_0x4b838a){return logMcpStderr(_0x1e8372(0x1f6),_0x4b838a),_0x1e8372(0x185);}}function printHelp(){const _0x11e1a6=a0_0x4e75;console[_0x11e1a6(0x217)](_0x11e1a6(0x1b1)+getPackageVersion()),console[_0x11e1a6(0x217)](_0x11e1a6(0x186)),console['log'](_0x11e1a6(0x211)),console[_0x11e1a6(0x217)](_0x11e1a6(0x221)),console['log'](_0x11e1a6(0x15d)),console[_0x11e1a6(0x217)](_0x11e1a6(0x21b)),console['log'](_0x11e1a6(0x152)),console['log']('\x20\x20morph-mcp'),console[_0x11e1a6(0x217)](_0x11e1a6(0x15f));}const cliArgs=process[a0_0x56a8fe(0x1ec)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x56a8fe(0x1c8),'-v','-V']),HELP_FLAGS=new Set([a0_0x56a8fe(0x26f),'-h']);cliArgs[a0_0x56a8fe(0x229)](_0x1de975=>VERSION_FLAGS[a0_0x56a8fe(0x14d)](_0x1de975))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x56a8fe(0x1a0)](0x0));cliArgs[a0_0x56a8fe(0x229)](_0x3503fa=>HELP_FLAGS[a0_0x56a8fe(0x14d)](_0x3503fa))&&(printHelp(),process[a0_0x56a8fe(0x1a0)](0x0));function getCliArg(_0x1e40f4){const _0x3d92f7=a0_0x56a8fe;for(let _0x547987=0x0;_0x547987<cliArgs[_0x3d92f7(0x270)];_0x547987++){const _0x1c600c=cliArgs[_0x547987];if(_0x1c600c[_0x3d92f7(0x1ba)]('--'+_0x1e40f4+'='))return _0x1c600c[_0x3d92f7(0x160)](('--'+_0x1e40f4+'=')[_0x3d92f7(0x270)]);if(_0x1c600c==='--'+_0x1e40f4&&_0x547987+0x1<cliArgs[_0x3d92f7(0x270)])return cliArgs[_0x547987+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x56a8fe(0x270)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x56a8fe(0x14d)](arg)||HELP_FLAGS[a0_0x56a8fe(0x14d)](arg))continue;if(arg[a0_0x56a8fe(0x1ba)](a0_0x56a8fe(0x17e)))continue;if(arg===a0_0x56a8fe(0x150)){i++;continue;}args[a0_0x56a8fe(0x189)](arg);}const WORKSPACE_ROOT=process[a0_0x56a8fe(0x26d)]['WORKSPACE_ROOT']||process[a0_0x56a8fe(0x26d)][a0_0x56a8fe(0x21d)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x56a8fe(0x26d)][a0_0x56a8fe(0x21e)]!==a0_0x56a8fe(0x1a2),MORPH_API_KEY=getCliArg(a0_0x56a8fe(0x1e6))??process['env']['MORPH_API_KEY'],MORPH_API_URL=process['env'][a0_0x56a8fe(0x23f)],MORPH_LARGE_APPLY=process[a0_0x56a8fe(0x26d)]['MORPH_LARGE_APPLY']!==a0_0x56a8fe(0x1a2),MORPH_WARP_GREP_TIMEOUT=process['env']['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x56a8fe(0x26d)][a0_0x56a8fe(0x1fb)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x56a8fe(0x26d)]['DISABLED_TOOLS']?new Set(process['env']['DISABLED_TOOLS'][a0_0x56a8fe(0x1d0)](',')['map'](_0x4a2a6f=>_0x4a2a6f[a0_0x56a8fe(0x1fa)]())[a0_0x56a8fe(0x14f)](_0x11b4dc=>_0x11b4dc['length']>0x0)):DEFAULT_DISABLED_TOOLS;function a0_0x4e75(_0xa3e864,_0x3497cf){_0xa3e864=_0xa3e864-0x144;const _0x30e6f4=a0_0x30e6();let _0x4e75d6=_0x30e6f4[_0xa3e864];return _0x4e75d6;}if(DISABLED_TOOLS[a0_0x56a8fe(0x19c)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x56a8fe(0x14d)](tool)&&console['error'](a0_0x56a8fe(0x1e4)+tool+a0_0x56a8fe(0x1ef)+[...KNOWN_TOOL_NAMES][a0_0x56a8fe(0x156)](',\x20'));}console['error']('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x56a8fe(0x156)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x56a8fe(0x1ba)](a0_0x56a8fe(0x146))&&!MORPH_API_KEY['startsWith'](a0_0x56a8fe(0x1d6))&&logMcpStderr(a0_0x56a8fe(0x25c));async function reportMorphError(_0x24caa8){const _0x596cbc=a0_0x56a8fe;try{await a0_0x19c627[_0x596cbc(0x1b9)](_0x596cbc(0x225),{..._0x24caa8,'timestamp':new Date()[_0x596cbc(0x1b6)](),'source':_0x24caa8['source']||_0x596cbc(0x192),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x24caa8[_0x596cbc(0x252)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x596cbc(0x1b8)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x5a0375,_0x43486c){const _0x2b009a=a0_0x56a8fe;if(_0x5a0375&&typeof _0x5a0375===_0x2b009a(0x236)&&_0x2b009a(0x153)in _0x5a0375)return _0x5a0375[_0x2b009a(0x153)];if(_0x5a0375&&typeof _0x5a0375==='object'&&_0x2b009a(0x1b3)in _0x5a0375)return _0x5a0375[_0x2b009a(0x1b3)]?.[_0x2b009a(0x153)];const _0x215c24=_0x43486c[_0x2b009a(0x169)](/\b(401|429)\b/);return _0x215c24?parseInt(_0x215c24[0x1],0xa):null;}function handleMorphAPIError(_0x32e2ce){const _0x44c71d=a0_0x56a8fe,_0x5b66d5=_0x32e2ce instanceof Error?_0x32e2ce['message']:String(_0x32e2ce),_0x3aa23f=extractStatusCode(_0x32e2ce,_0x5b66d5);switch(_0x3aa23f){case 0x191:return{'content':[{'type':'text','text':_0x44c71d(0x1e1)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x44c71d(0x171)}],'isError':!![]};default:return null;}}args[a0_0x56a8fe(0x270)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x56a8fe(0x238)),logMcpStderr(a0_0x56a8fe(0x180)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x56a8fe(0x1bd)),logMcpStderr(a0_0x56a8fe(0x18a)),logMcpStderr(a0_0x56a8fe(0x218)));function normalizePath(_0x2b685c){const _0x124d44=a0_0x56a8fe;return a0_0x27fcca[_0x124d44(0x24b)](_0x2b685c);}function expandHome(_0x1b5075){const _0x750bb2=a0_0x56a8fe;if(_0x1b5075[_0x750bb2(0x1ba)]('~/')||_0x1b5075==='~')return a0_0x27fcca['join'](a0_0x1b25bd[_0x750bb2(0x267)](),_0x1b5075[_0x750bb2(0x160)](0x1));return _0x1b5075;}let allowedDirectories=await Promise[a0_0x56a8fe(0x19a)](args[a0_0x56a8fe(0x190)](async _0x2e78d0=>{const _0x16d17a=expandHome(_0x2e78d0),_0x2dcdd8=a0_0x27fcca['resolve'](_0x16d17a);try{const _0x5781ae=await a0_0x4dc500['realpath'](_0x2dcdd8);return normalizePath(_0x5781ae);}catch(_0x4241d1){return normalizePath(_0x2dcdd8);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x56a8fe(0x270)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x56a8fe(0x256)));}catch(a0_0xde4a0d){logMcpStderr(a0_0x56a8fe(0x239)+a0_0xde4a0d);}async function detectWorkspaceRoot(_0x281b4a){const _0x2e07ae=a0_0x56a8fe;let _0x3817fa=a0_0x27fcca[_0x2e07ae(0x1c1)](_0x281b4a);const _0x29a3cb=['.git',_0x2e07ae(0x233),_0x2e07ae(0x17d),'Cargo.toml',_0x2e07ae(0x158),_0x2e07ae(0x195),_0x2e07ae(0x264),_0x2e07ae(0x243),_0x2e07ae(0x196)];while(_0x3817fa!==a0_0x27fcca['dirname'](_0x3817fa)){for(const _0x122b12 of _0x29a3cb){const _0x311805=a0_0x27fcca['join'](_0x3817fa,_0x122b12);try{return await a0_0x4dc500['access'](_0x311805),normalizePath(_0x3817fa);}catch{}}_0x3817fa=a0_0x27fcca[_0x2e07ae(0x1bc)](_0x3817fa);}return normalizePath(_0x281b4a);}await Promise[a0_0x56a8fe(0x19a)](args[a0_0x56a8fe(0x190)](async _0x23928c=>{const _0x3c6933=a0_0x56a8fe;try{const _0x2f65cf=await a0_0x4dc500[_0x3c6933(0x1d9)](expandHome(_0x23928c));!_0x2f65cf[_0x3c6933(0x19f)]()&&(logMcpStderr(_0x3c6933(0x26b)+_0x23928c+_0x3c6933(0x22b)),process[_0x3c6933(0x1a0)](0x1));}catch(_0x54e11f){logMcpStderr(_0x3c6933(0x214)+_0x23928c+':',_0x54e11f),process['exit'](0x1);}}));async function validatePath(_0x46d74b){const _0x3acb09=a0_0x56a8fe,_0x4e8414=expandHome(_0x46d74b),_0x4bcc9e=a0_0x27fcca[_0x3acb09(0x1c1)](_0x4e8414);logger['debug']('MCP','path_validation_start',{'raw_path':_0x46d74b,'absolute':_0x4bcc9e});try{const _0x469e04=await a0_0x4dc500[_0x3acb09(0x181)](_0x4bcc9e);return logger['debug'](_0x3acb09(0x227),_0x3acb09(0x26c),{'resolved':_0x469e04,'symlink':_0x469e04!==_0x4bcc9e}),_0x469e04;}catch(_0x3e8b18){if(_0x3e8b18[_0x3acb09(0x22a)]==='ENOENT'){const _0x3dfcf2=a0_0x27fcca[_0x3acb09(0x1bc)](_0x4bcc9e);try{const _0x2c966c=await a0_0x4dc500[_0x3acb09(0x181)](_0x3dfcf2),_0x35f23f=a0_0x27fcca[_0x3acb09(0x156)](_0x2c966c,a0_0x27fcca[_0x3acb09(0x178)](_0x4bcc9e));return logger[_0x3acb09(0x14c)]('MCP',_0x3acb09(0x26c),{'resolved':_0x35f23f,'new_file':!![]}),_0x35f23f;}catch{logger['error'](_0x3acb09(0x227),_0x3acb09(0x1b7),{'raw_path':_0x46d74b,'error':_0x3acb09(0x191)+_0x3dfcf2});throw new Error(_0x3acb09(0x191)+_0x3dfcf2);}}logger[_0x3acb09(0x17f)](_0x3acb09(0x227),_0x3acb09(0x1b7),{'raw_path':_0x46d74b,'error':_0x3e8b18[_0x3acb09(0x208)]});throw _0x3e8b18;}}const MorphEditFileArgsSchema=z[a0_0x56a8fe(0x236)]({'path':z[a0_0x56a8fe(0x149)](),'code_edit':z['string']()[a0_0x56a8fe(0x200)](a0_0x56a8fe(0x25d)),'instruction':z[a0_0x56a8fe(0x149)]()['describe'](a0_0x56a8fe(0x1c3)),'dryRun':z[a0_0x56a8fe(0x205)]()[a0_0x56a8fe(0x193)](![])[a0_0x56a8fe(0x200)](a0_0x56a8fe(0x18e))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x56a8fe(0x1e8),WarpGrepArgsSchema=z[a0_0x56a8fe(0x236)]({'search_string':z['string']()[a0_0x56a8fe(0x200)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x56a8fe(0x149)]()['describe'](a0_0x56a8fe(0x17a)),'search_type':z[a0_0x56a8fe(0x183)]([a0_0x56a8fe(0x193),a0_0x56a8fe(0x263)])['optional']()[a0_0x56a8fe(0x200)](a0_0x56a8fe(0x21a))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x56a8fe(0x149)]()['optional']()['describe'](a0_0x56a8fe(0x1ad)),'owner_repo':z[a0_0x56a8fe(0x149)]()[a0_0x56a8fe(0x198)]()[a0_0x56a8fe(0x200)](a0_0x56a8fe(0x15b)),'branch':z[a0_0x56a8fe(0x149)]()['optional']()['describe']('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x56a8fe(0x236)]({'query':z[a0_0x56a8fe(0x149)]()[a0_0x56a8fe(0x200)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()['describe'](a0_0x56a8fe(0x14e)),'branch':z['string']()[a0_0x56a8fe(0x198)]()[a0_0x56a8fe(0x200)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x56a8fe(0x149)]()[a0_0x56a8fe(0x198)]()[a0_0x56a8fe(0x200)](a0_0x56a8fe(0x1ce)),'targetDirectories':z[a0_0x56a8fe(0x23e)](z[a0_0x56a8fe(0x149)]())['default']([])[a0_0x56a8fe(0x200)](a0_0x56a8fe(0x175)),'limit':z[a0_0x56a8fe(0x1e5)]()[a0_0x56a8fe(0x198)]()[a0_0x56a8fe(0x193)](0xa)['describe'](a0_0x56a8fe(0x1f4))}),server=new Server({'name':a0_0x56a8fe(0x242),'version':a0_0x56a8fe(0x1cf)},{'capabilities':{'tools':{}}});server[a0_0x56a8fe(0x21c)](ListToolsRequestSchema,async()=>{const _0x417dad=a0_0x56a8fe,_0x7e6b72=[{'name':TOOL_NAMES[_0x417dad(0x1fe)],'description':_0x417dad(0x151)+'Parameters:\x0a'+_0x417dad(0x210)+_0x417dad(0x269)+_0x417dad(0x1b4)+_0x417dad(0x259)+_0x417dad(0x1a5)+_0x417dad(0x213)+_0x417dad(0x1a4)+_0x417dad(0x159)+_0x417dad(0x154)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x417dad(0x265),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x417dad(0x232)],'description':_0x417dad(0x20b)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x417dad(0x18d)+_0x417dad(0x24c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x1255f4=_0x7e6b72['filter'](_0x508518=>{const _0x6b99b1=_0x417dad;if(DISABLED_TOOLS['has'](_0x508518[_0x6b99b1(0x25e)]))return console['error']('Tool\x20'+_0x508518[_0x6b99b1(0x25e)]+_0x6b99b1(0x1b5)),![];if(_0x6b99b1(0x20e)in _0x508518&&_0x508518[_0x6b99b1(0x20e)]&&!MORPH_API_KEY)return logMcpStderr(_0x6b99b1(0x1aa)+_0x508518[_0x6b99b1(0x25e)]+_0x6b99b1(0x16e)),![];return!![];});return{'tools':_0x1255f4[_0x417dad(0x190)](_0x5de66f=>({'name':_0x5de66f[_0x417dad(0x25e)],'description':_0x5de66f[_0x417dad(0x194)],'inputSchema':_0x5de66f[_0x417dad(0x1bf)]}))};}),server[a0_0x56a8fe(0x21c)](CallToolRequestSchema,async _0x591462=>{const _0x36f654=a0_0x56a8fe,{name:_0x33cf74,arguments:_0x431357}=_0x591462['params'],_0x64da5a=Date[_0x36f654(0x1db)]();logger[_0x36f654(0x14c)](_0x36f654(0x227),_0x36f654(0x222),{'tool':_0x33cf74,'args':_0x33cf74===_0x36f654(0x23c)?{'path':_0x431357?.['path'],'instruction':_0x431357?.[_0x36f654(0x1fd)]||_0x431357?.[_0x36f654(0x1d8)],'dryRun':_0x431357?.[_0x36f654(0x144)]}:_0x431357});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x1d4)}],'isError':!![]};if(!MORPH_API_KEY[_0x36f654(0x1ba)](_0x36f654(0x146))&&!MORPH_API_KEY[_0x36f654(0x1ba)](_0x36f654(0x1d6)))return{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x1f8)}],'isError':!![]};if(DISABLED_TOOLS[_0x36f654(0x14d)](_0x33cf74))return{'content':[{'type':'text','text':_0x36f654(0x18c)+_0x33cf74+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x33cf74){case TOOL_NAMES[_0x36f654(0x1fe)]:{let _0x4c2323=_0x431357;if(_0x4c2323&&typeof _0x4c2323===_0x36f654(0x236)){if(!(_0x36f654(0x165)in _0x4c2323)){const _0x1da241=_0x4c2323['target_file']??_0x4c2323['filePath']??_0x4c2323[_0x36f654(0x24d)]??_0x4c2323['file_path']??_0x4c2323[_0x36f654(0x231)];if(_0x1da241)_0x4c2323={..._0x4c2323,'path':_0x1da241};}_0x36f654(0x1d8)in _0x4c2323&&!(_0x36f654(0x1fd)in _0x4c2323)&&(_0x4c2323={..._0x4c2323,'instruction':_0x4c2323[_0x36f654(0x1d8)]});if(!(_0x36f654(0x240)in _0x4c2323)){const _0x1e731a=_0x4c2323['code']??_0x4c2323[_0x36f654(0x230)]??_0x4c2323[_0x36f654(0x17b)]??_0x4c2323[_0x36f654(0x1d1)];if(_0x1e731a)_0x4c2323={..._0x4c2323,'code_edit':_0x1e731a};}}const _0x245ff0=MorphEditFileArgsSchema[_0x36f654(0x167)](_0x4c2323);if(!_0x245ff0[_0x36f654(0x1b2)])throw new Error(_0x36f654(0x1e2)+_0x245ff0[_0x36f654(0x17f)]);const _0x487e49=await validatePath(_0x245ff0[_0x36f654(0x255)][_0x36f654(0x165)]);let _0x1b4aae=null,_0x5e087d=!![],_0x4f40df=null;try{_0x1b4aae=await a0_0x4dc500['readFile'](_0x487e49,_0x36f654(0x253)),logger[_0x36f654(0x14c)](_0x36f654(0x227),_0x36f654(0x1d3),{'path':_0x487e49,'size_bytes':_0x1b4aae[_0x36f654(0x270)]});}catch(_0xd4b36f){const _0x309e8=_0xd4b36f[_0x36f654(0x22a)];_0x309e8==='ENOENT'?(_0x5e087d=![],_0x1b4aae='',logger[_0x36f654(0x14c)](_0x36f654(0x227),_0x36f654(0x1d3),{'path':_0x487e49,'exists':![]})):(_0x4f40df=_0x36f654(0x1a7)+(_0x309e8||_0x36f654(0x185))+_0x36f654(0x148)+(_0xd4b36f instanceof Error?_0xd4b36f[_0x36f654(0x208)]:String(_0xd4b36f)),logger[_0x36f654(0x17f)](_0x36f654(0x227),_0x36f654(0x220),{'path':_0x487e49,'error':_0x4f40df}),logMcpStderr(_0x36f654(0x1aa)+_0x4f40df));}let _0xcd5c72;try{const _0x4b803e=MORPH_API_KEY;if(!_0x4b803e)throw new Error(_0x36f654(0x1f7));const _0x31e2b6=a0_0x27fcca[_0x36f654(0x1bc)](_0x487e49),_0x215b7e=a0_0x27fcca[_0x36f654(0x178)](_0x487e49);logger[_0x36f654(0x14c)](_0x36f654(0x227),_0x36f654(0x26a),{'model':'morph-v3-fast','path':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x165)],'instruction_len':_0x245ff0['data'][_0x36f654(0x1fd)][_0x36f654(0x270)],'code_edit_len':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x240)]['length'],'original_code_len':_0x1b4aae?.[_0x36f654(0x270)]??0x0,'dry_run':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x144)]});const _0x44dcd3=Date[_0x36f654(0x1db)](),_0x1f3d1b=await executeEditFile({'target_filepath':_0x215b7e,'code_edit':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x240)],'instruction':_0x245ff0['data'][_0x36f654(0x1fd)]},{'morphApiKey':_0x4b803e,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x31e2b6,'autoWrite':!_0x245ff0['data']['dryRun'],'generateUdiff':![],'debug':![]}),_0x1a0880=Date['now']()-_0x44dcd3;_0xcd5c72=_0x1f3d1b[_0x36f654(0x23b)];if(!_0x1f3d1b['success'])throw new Error(_0x1f3d1b[_0x36f654(0x17f)]||_0x36f654(0x1b0));const _0xeb1789=_0x1f3d1b[_0x36f654(0x212)],_0x165ef1='added\x20'+_0xeb1789[_0x36f654(0x24e)]+',\x20removed\x20'+_0xeb1789['linesRemoved']+_0x36f654(0x245)+_0xeb1789[_0x36f654(0x18b)];logger[_0x36f654(0x14c)](_0x36f654(0x227),'tool_call_complete',{'tool':'edit_file','success':!![],'latency_ms':Date['now']()-_0x64da5a,'edit_latency_ms':_0x1a0880,'changes':{'added':_0xeb1789['linesAdded'],'removed':_0xeb1789[_0x36f654(0x22d)],'modified':_0xeb1789[_0x36f654(0x18b)]},'completion_id':_0xcd5c72});if(_0x245ff0[_0x36f654(0x255)]['dryRun'])return{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x155)+(_0x5e087d?'':'\x20(new\x20file)')+':\x20'+_0x245ff0[_0x36f654(0x255)][_0x36f654(0x1fd)]+_0x36f654(0x244)+_0x165ef1+'.\x20Path:\x20'+_0x245ff0[_0x36f654(0x255)][_0x36f654(0x165)]+'.'}]};return{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x17c)+(_0x5e087d?_0x36f654(0x1ea):_0x36f654(0x1eb))+':\x20'+_0x245ff0[_0x36f654(0x255)][_0x36f654(0x1fd)]+_0x36f654(0x244)+_0x165ef1+_0x36f654(0x204)+_0x245ff0[_0x36f654(0x255)][_0x36f654(0x165)]+'.'}]};}catch(_0x1e181f){const _0x4bb6c6=handleMorphAPIError(_0x1e181f);if(_0x4bb6c6)return logger[_0x36f654(0x17f)](_0x36f654(0x227),_0x36f654(0x1a9),{'tool':_0x36f654(0x23c),'error':_0x36f654(0x26e),'latency_ms':Date[_0x36f654(0x1db)]()-_0x64da5a}),_0x4bb6c6;const _0x4de622=_0x1e181f instanceof Error?_0x1e181f[_0x36f654(0x208)]:String(_0x1e181f);return logger[_0x36f654(0x17f)](_0x36f654(0x227),_0x36f654(0x1a9),{'tool':_0x36f654(0x23c),'error':_0x4de622,'path':_0x245ff0[_0x36f654(0x255)]['path'],'validated_path':_0x487e49,'latency_ms':Date[_0x36f654(0x1db)]()-_0x64da5a,'stack':_0x1e181f instanceof Error?_0x1e181f[_0x36f654(0x1c9)]:undefined}),reportMorphError({'error_message':_0x4de622,'error_type':_0x1e181f instanceof Error?_0x1e181f[_0x36f654(0x14b)][_0x36f654(0x25e)]:'UnknownError','context':{'tool':_0x36f654(0x23c),'completion_id':_0xcd5c72,'file_path':_0x245ff0['data'][_0x36f654(0x165)],'validated_path':_0x487e49,'instruction':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x1fd)],'model':MORPH_LARGE_APPLY?_0x36f654(0x206):_0x36f654(0x250),'dry_run':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x144)],'file_exists':_0x5e087d,'file_read_error':_0x4f40df,'file_readable':_0x1b4aae!==null,'request_content':{'path':_0x245ff0[_0x36f654(0x255)]['path'],'code_edit':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x240)],'instruction':_0x245ff0[_0x36f654(0x255)][_0x36f654(0x1fd)],'original_code':_0x1b4aae!==null?_0x1b4aae[_0x36f654(0x270)]>0xc350?_0x1b4aae['substring'](0x0,0xc350)+_0x36f654(0x188)+_0x1b4aae[_0x36f654(0x270)]+_0x36f654(0x14a):_0x1b4aae:_0x36f654(0x168)+(_0x4f40df||_0x36f654(0x22c))+']','original_code_length':_0x1b4aae?.[_0x36f654(0x270)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x36f654(0x250),'dry_run':_0x245ff0[_0x36f654(0x255)]['dryRun']}},'stack_trace':_0x1e181f instanceof Error?_0x1e181f[_0x36f654(0x1c9)]:undefined,'source':'mcp-filesystem'})[_0x36f654(0x20c)](()=>{}),{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x1a6)+_0x4de622}],'isError':!![]};}}case TOOL_NAMES[_0x36f654(0x232)]:{const _0x14cf1c=WarpGrepArgsSchema[_0x36f654(0x167)](_0x431357);if(!_0x14cf1c[_0x36f654(0x1b2)])return{'content':[{'type':'text','text':_0x36f654(0x15a)+_0x14cf1c[_0x36f654(0x17f)]}],'isError':!![]};const _0x1fd9e8=_0x1b9cc6=>{const _0x146211=_0x36f654,_0x482b6a=[];for(const _0x3d13ce of _0x1b9cc6||[]){if(_0x3d13ce[_0x146211(0x268)]==='assistant'&&Array['isArray'](_0x3d13ce[_0x146211(0x179)]))for(const _0x31f4b7 of _0x3d13ce['tool_calls']){try{const _0x47e7b7=_0x31f4b7[_0x146211(0x23a)]?.['name'],_0x181326=JSON[_0x146211(0x247)](_0x31f4b7[_0x146211(0x23a)]?.['arguments']||'{}');if(_0x47e7b7==='grep_search')_0x482b6a[_0x146211(0x189)](_0x146211(0x25a)+_0x181326[_0x146211(0x16b)]+'\x27\x20'+(_0x181326[_0x146211(0x165)]||'.'));else{if(_0x47e7b7===_0x146211(0x202))_0x482b6a[_0x146211(0x189)]('read\x20'+_0x181326[_0x146211(0x165)]);else{if(_0x47e7b7===_0x146211(0x1ff))_0x482b6a[_0x146211(0x189)](_0x146211(0x19b)+(_0x181326[_0x146211(0x177)]||'.'));else{if(_0x47e7b7==='glob')_0x482b6a[_0x146211(0x189)]('glob\x20\x27'+_0x181326[_0x146211(0x16b)]+'\x27\x20'+(_0x181326[_0x146211(0x165)]||'.'));else _0x47e7b7===_0x146211(0x266)&&_0x482b6a[_0x146211(0x189)](_0x146211(0x266));}}}}catch{}}}return _0x482b6a;},_0x4c524d=_0x1187fe=>{const _0x38df6e=_0x36f654,_0x5f0166=[];if(!_0x1187fe||!Array['isArray'](_0x1187fe))return _0x5f0166;const _0x202fc4=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x38df6e(0x1c4),'tool':_0x38df6e(0x202)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x38df6e(0x1df),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x38df6e(0x246),'tool':_0x38df6e(0x202)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x38df6e(0x1e0),'tool':_0x38df6e(0x202)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x38df6e(0x1ee),'tool':_0x38df6e(0x216)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x38df6e(0x202)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x38df6e(0x202)},{'pattern':/symbolic link/,'error_type':_0x38df6e(0x203),'tool':_0x38df6e(0x202)},{'pattern':/Error reading file:/,'error_type':_0x38df6e(0x246),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x38df6e(0x176),'tool':_0x38df6e(0x185)}];let _0x11674a=0x0;for(const _0x42351a of _0x1187fe){_0x42351a[_0x38df6e(0x268)]==='assistant'&&Array[_0x38df6e(0x209)](_0x42351a['tool_calls'])&&_0x11674a++;const _0x1459f6=_0x42351a['content'];if((_0x42351a[_0x38df6e(0x268)]===_0x38df6e(0x170)||_0x42351a[_0x38df6e(0x268)]===_0x38df6e(0x235))&&_0x1459f6&&typeof _0x1459f6===_0x38df6e(0x149))for(const {pattern:_0x36c4c0,error_type:_0x56bf53,tool:_0x245751}of _0x202fc4){const _0x560fff=_0x1459f6[_0x38df6e(0x169)](new RegExp(_0x36c4c0['source'],'g'));if(_0x560fff)for(const _0x5734cb of _0x560fff){const _0x57fcb5=_0x1459f6['indexOf'](_0x5734cb),_0xdebf4d=_0x1459f6['substring'](_0x57fcb5,Math[_0x38df6e(0x1a1)](_0x57fcb5+0xc8,_0x1459f6[_0x38df6e(0x270)]));_0x5f0166[_0x38df6e(0x189)]({'tool':_0x245751,'error_type':_0x56bf53,'error_message':_0xdebf4d['split']('\x0a')[0x0],'turn':_0x11674a});}}}return _0x5f0166;};try{const _0x1228b=a0_0x27fcca[_0x36f654(0x1c1)](_0x14cf1c[_0x36f654(0x255)]['repo_path']),_0x1e663d=_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x1cc)],_0x499cb3=_0x1e663d==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x30dcec=new LocalRipgrepProvider(_0x1228b,undefined,_0x499cb3);logger[_0x36f654(0x14c)]('MCP','provider_created',{'type':_0x36f654(0x23d),'repo_root':_0x1228b,'search_type':_0x1e663d||_0x36f654(0x193)}),logger[_0x36f654(0x14c)]('MCP','warp_grep_start',{'query':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x182)],'repo_root':_0x1228b,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x14b848=Date['now'](),_0x4b2dd3=await runWarpGrep({'searchTerm':_0x14cf1c['data'][_0x36f654(0x182)],'repoRoot':_0x1228b,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x30dcec,'search_type':_0x1e663d}),_0x1f61d1=Date[_0x36f654(0x1db)]()-_0x14b848,_0x19af0a=_0x4b2dd3[_0x36f654(0x266)]?.[_0x36f654(0x249)]?.['files']?.[_0x36f654(0x270)]??0x0;logger[_0x36f654(0x14c)](_0x36f654(0x227),_0x36f654(0x147),{'termination':_0x4b2dd3[_0x36f654(0x173)],'turns':_0x4b2dd3[_0x36f654(0x24a)]?.[_0x36f654(0x237)]??0x0,'files_found':_0x19af0a,'latency_ms':_0x1f61d1});const _0x5ee55b=_0x4c524d(_0x4b2dd3[_0x36f654(0x1af)]);_0x5ee55b['length']>0x0&&reportMorphError({'error_message':_0x36f654(0x1f1)+_0x5ee55b[_0x36f654(0x270)]+_0x36f654(0x19e),'error_type':'SubToolError','level':_0x36f654(0x1ac),'tool':_0x36f654(0x163),'context':{'repo_path':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)],'query':_0x14cf1c[_0x36f654(0x255)]['search_string'],'model':_0x36f654(0x25f),'termination_reason':_0x4b2dd3[_0x36f654(0x173)],'sub_tool_errors':_0x5ee55b,'timings':_0x4b2dd3[_0x36f654(0x24a)],'tool_calls':_0x1fd9e8(_0x4b2dd3[_0x36f654(0x1af)]),'messages':_0x4b2dd3['messages']?.['map'](_0x1f70e9=>({'role':_0x1f70e9['role'],'content':_0x1f70e9['content'],..._0x1f70e9[_0x36f654(0x179)]?{'tool_calls':_0x1f70e9[_0x36f654(0x179)][_0x36f654(0x270)]}:{},..._0x1f70e9[_0x36f654(0x271)]?{'tool_call_id':_0x1f70e9[_0x36f654(0x271)]}:{}}))},'source':'mcp-filesystem'})[_0x36f654(0x20c)](()=>{});let _0x233d6f='';if(_0x4b2dd3[_0x36f654(0x173)]===_0x36f654(0x1de)&&_0x4b2dd3['finish']?.['metadata']?.[_0x36f654(0x24f)]){const _0x4d8c92=_0x4b2dd3[_0x36f654(0x266)][_0x36f654(0x249)]['files'];if(_0x4d8c92[_0x36f654(0x270)]===0x0)return _0x233d6f=_0x4b2dd3[_0x36f654(0x266)][_0x36f654(0x248)]||_0x36f654(0x157),{'content':[{'type':_0x36f654(0x1a8),'text':_0x233d6f}]};const _0xa0d50=[],_0x14dfee=[_0x36f654(0x174)];for(const _0x408faf of _0x4b2dd3[_0x36f654(0x1af)]){if(_0x408faf[_0x36f654(0x268)]==='assistant'&&Array[_0x36f654(0x209)](_0x408faf[_0x36f654(0x179)]))for(const _0x35619b of _0x408faf[_0x36f654(0x179)]){try{const _0xcbd6a=_0x35619b['function']?.[_0x36f654(0x25e)],_0x1a1a4f=JSON[_0x36f654(0x247)](_0x35619b['function']?.[_0x36f654(0x15c)]||'{}');if(_0xcbd6a==='grep_search')_0x14dfee[_0x36f654(0x189)](_0x36f654(0x234)+_0x1a1a4f[_0x36f654(0x16b)]+'\x27\x20in\x20`'+(_0x1a1a4f[_0x36f654(0x165)]||'.')+'`');else{if(_0xcbd6a===_0x36f654(0x202))_0x14dfee[_0x36f654(0x189)](_0x36f654(0x1a3)+_0x1a1a4f['path']+'`');else{if(_0xcbd6a==='list_directory')_0x14dfee[_0x36f654(0x189)](_0x36f654(0x1ae)+(_0x1a1a4f['command']||'.')+'`');else _0xcbd6a===_0x36f654(0x1f5)&&_0x14dfee[_0x36f654(0x189)]('-\x20Glob\x20search\x20`'+_0x1a1a4f['pattern']+'`\x20in\x20`'+(_0x1a1a4f[_0x36f654(0x165)]||'.')+'`');}}}catch{}}}_0xa0d50[_0x36f654(0x189)](_0x14dfee[_0x36f654(0x156)]('\x0a'));const _0x3565dd=['','Relevant\x20context\x20found:'];for(const _0x5fbdc1 of _0x4d8c92){if(_0x5fbdc1[_0x36f654(0x1ab)]==='*')_0x3565dd['push']('-\x20'+_0x5fbdc1[_0x36f654(0x165)]+':*');else{if(Array[_0x36f654(0x209)](_0x5fbdc1[_0x36f654(0x1ab)])){const _0x208a5a=_0x5fbdc1[_0x36f654(0x1ab)][_0x36f654(0x190)](([_0x5dd74e,_0x369ae6])=>{if(_0x5dd74e===_0x369ae6)return''+_0x5dd74e;return _0x5dd74e+'-'+_0x369ae6;});_0x3565dd['push']('-\x20'+_0x5fbdc1['path']+':'+_0x208a5a[_0x36f654(0x156)](','));}else _0x3565dd[_0x36f654(0x189)]('-\x20'+_0x5fbdc1['path']+':*');}}_0x3565dd['push'](''),_0xa0d50[_0x36f654(0x189)](_0x3565dd[_0x36f654(0x156)]('\x0a')),_0xa0d50[_0x36f654(0x189)](_0x36f654(0x1d2));const _0x36fa76=[],_0x187b8f=[];for(const _0x103638 of _0x4d8c92){let _0x4b66d4=a0_0x27fcca[_0x36f654(0x1c1)](_0x14cf1c[_0x36f654(0x255)]['repo_path'],_0x103638[_0x36f654(0x165)]),_0x5a2185=null,_0x53bfa5=null;try{_0x5a2185=await a0_0x4dc500[_0x36f654(0x261)](_0x4b66d4,{'encoding':_0x36f654(0x253)});}catch(_0x5eaf32){const _0xffc80c=fixPathRepetition(_0x4b66d4);if(_0xffc80c)try{_0x5a2185=await a0_0x4dc500[_0x36f654(0x261)](_0xffc80c,{'encoding':_0x36f654(0x253)}),_0x4b66d4=_0xffc80c;}catch{_0x53bfa5=_0x5eaf32 instanceof Error?_0x5eaf32:new Error(String(_0x5eaf32));}else _0x53bfa5=_0x5eaf32 instanceof Error?_0x5eaf32:new Error(String(_0x5eaf32));}if(_0x5a2185!==null){const _0x502d53=_0x5a2185[_0x36f654(0x1d0)](/\r?\n/),_0x582d8f=[];if(_0x103638[_0x36f654(0x1ab)]==='*'||!Array[_0x36f654(0x209)](_0x103638[_0x36f654(0x1ab)]))for(let _0x3174a6=0x1;_0x3174a6<=_0x502d53[_0x36f654(0x270)];_0x3174a6++){const _0xeabbbf=_0x502d53[_0x3174a6-0x1];_0x582d8f[_0x36f654(0x189)](_0x3174a6+'|\x20'+_0xeabbbf);}else for(const [_0x7b7e6f,_0x414659]of _0x103638[_0x36f654(0x1ab)]){_0x582d8f[_0x36f654(0x270)]>0x0&&_0x582d8f[_0x36f654(0x189)]('');for(let _0x50735e=_0x7b7e6f;_0x50735e<=_0x414659&&_0x50735e<=_0x502d53[_0x36f654(0x270)];_0x50735e++){const _0x5af397=_0x502d53[_0x50735e-0x1];_0x582d8f[_0x36f654(0x189)](_0x50735e+'|\x20'+_0x5af397);}}_0x187b8f[_0x36f654(0x189)]({'path':_0x103638[_0x36f654(0x165)],'content':_0x582d8f['join']('\x0a')});}else _0x36fa76[_0x36f654(0x189)](_0x36f654(0x215)+_0x103638[_0x36f654(0x165)]+_0x36f654(0x1f3)+(_0x53bfa5?.['message']||_0x36f654(0x20f))+_0x36f654(0x1f0));}try{const _0x2bab0f=await compactFileContexts(_0x187b8f,_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x182)],MORPH_API_KEY,MORPH_API_URL);for(const _0x526760 of _0x2bab0f){_0x36fa76[_0x36f654(0x189)](_0x36f654(0x215)+_0x526760[_0x36f654(0x165)]+_0x36f654(0x187)+_0x526760['content']+_0x36f654(0x1f0));}}catch(_0x13ebbe){logger[_0x36f654(0x1ac)](_0x36f654(0x227),'compaction_failed',{'error':_0x13ebbe instanceof Error?_0x13ebbe[_0x36f654(0x208)]:String(_0x13ebbe),'files_count':_0x187b8f[_0x36f654(0x270)]});for(const _0x23a705 of _0x187b8f){_0x36fa76[_0x36f654(0x189)](_0x36f654(0x215)+_0x23a705[_0x36f654(0x165)]+_0x36f654(0x187)+_0x23a705[_0x36f654(0x17b)]+_0x36f654(0x1f0));}}_0xa0d50[_0x36f654(0x189)](_0x36fa76[_0x36f654(0x156)]('\x0a\x0a')),_0x233d6f=_0xa0d50[_0x36f654(0x156)]('\x0a');const _0x4efe1a=_0x4b2dd3['errors']?.['filter'](_0x53cd09=>_0x53cd09[_0x36f654(0x208)]?.[_0x36f654(0x1ba)](_0x36f654(0x1c7)))||[];if(_0x4efe1a['length']>0x0){const _0x411446=_0x4efe1a[_0x36f654(0x190)](_0x5c9bbc=>_0x5c9bbc['message'])['join'](';\x20');reportMorphError({'error_message':_0x411446,'error_type':_0x36f654(0x1f2),'context':{'tool':_0x36f654(0x163),'repo_path':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)],'query':_0x14cf1c[_0x36f654(0x255)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x36f654(0x16f),'error_count':_0x4efe1a[_0x36f654(0x270)],'is_timeout':![],'timings':_0x4b2dd3[_0x36f654(0x24a)],'files_attempted':_0x4d8c92['map'](_0x5bfb70=>({'path':_0x5bfb70[_0x36f654(0x165)],'lines':_0x5bfb70[_0x36f654(0x1ab)]})),'tool_calls':_0x1fd9e8(_0x4b2dd3['messages']),'messages':_0x4b2dd3[_0x36f654(0x1af)]?.['map'](_0x2902f7=>({'role':_0x2902f7['role'],'content':_0x2902f7[_0x36f654(0x17b)],..._0x2902f7[_0x36f654(0x179)]?{'tool_calls':_0x2902f7[_0x36f654(0x179)][_0x36f654(0x270)]}:{},..._0x2902f7[_0x36f654(0x271)]?{'tool_call_id':_0x2902f7[_0x36f654(0x271)]}:{}})),'request_content':{'query':_0x14cf1c[_0x36f654(0x255)]['search_string'],'repo_path':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)],'repoRoot':a0_0x27fcca[_0x36f654(0x1c1)](_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)]),'model':'morph-warp-grep-v2.1'}},'source':_0x36f654(0x192)})[_0x36f654(0x20c)](()=>{});}}else{if(_0x4b2dd3[_0x36f654(0x173)]===_0x36f654(0x1e7)&&_0x4b2dd3[_0x36f654(0x1c2)]['length']>0x0){const _0x3817e2=_0x4b2dd3[_0x36f654(0x1c2)][_0x36f654(0x190)](_0x4b8f5d=>_0x4b8f5d[_0x36f654(0x208)])['join'](';\x20');_0x233d6f=_0x36f654(0x26b)+_0x3817e2;const _0x163eeb=_0x3817e2[_0x36f654(0x1ca)]()['includes'](_0x36f654(0x20d))||_0x3817e2[_0x36f654(0x1ca)]()[_0x36f654(0x184)](_0x36f654(0x241))||_0x3817e2['toLowerCase']()['includes'](_0x36f654(0x260)),_0x4f213e=_0x4b2dd3[_0x36f654(0x266)]?.[_0x36f654(0x249)]?.[_0x36f654(0x24f)],_0x30833e=_0x4b2dd3[_0x36f654(0x1c2)][0x0];reportMorphError({'error_message':_0x3817e2,'error_type':_0x163eeb?_0x36f654(0x1c0):_0x30833e?.['constructor']?.[_0x36f654(0x25e)]||'WarpGrepError','context':{'tool':'codebase_search','repo_path':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)],'query':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x182)],'model':_0x36f654(0x25f),'termination_reason':_0x4b2dd3[_0x36f654(0x173)],'error_count':_0x4b2dd3[_0x36f654(0x1c2)][_0x36f654(0x270)],'is_timeout':_0x163eeb,'timings':_0x4b2dd3['timings'],'files_attempted':_0x4f213e?.[_0x36f654(0x190)](_0x340fc0=>({'path':_0x340fc0[_0x36f654(0x165)],'lines':_0x340fc0[_0x36f654(0x1ab)]})),'tool_calls':_0x1fd9e8(_0x4b2dd3['messages']),'messages':_0x4b2dd3[_0x36f654(0x1af)]?.[_0x36f654(0x190)](_0x38e507=>({'role':_0x38e507[_0x36f654(0x268)],'content':_0x38e507[_0x36f654(0x17b)],..._0x38e507[_0x36f654(0x179)]?{'tool_calls':_0x38e507[_0x36f654(0x179)][_0x36f654(0x270)]}:{},..._0x38e507[_0x36f654(0x271)]?{'tool_call_id':_0x38e507[_0x36f654(0x271)]}:{}})),'request_content':{'query':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x182)],'repo_path':_0x14cf1c[_0x36f654(0x255)]['repo_path'],'repoRoot':a0_0x27fcca[_0x36f654(0x1c1)](_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x30833e?.[_0x36f654(0x1c9)]||undefined,'source':_0x36f654(0x192)})[_0x36f654(0x20c)](()=>{});}else _0x233d6f='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x36f654(0x1a8),'text':_0x233d6f}]};}catch(_0xa97157){const _0x4032cf=handleMorphAPIError(_0xa97157);if(_0x4032cf)return logger['error'](_0x36f654(0x227),_0x36f654(0x1a9),{'tool':_0x36f654(0x163),'error':_0x36f654(0x26e),'latency_ms':Date['now']()-_0x64da5a}),_0x4032cf;const _0x1f72ef=_0xa97157 instanceof Error?_0xa97157[_0x36f654(0x208)]:String(_0xa97157);logger[_0x36f654(0x17f)]('MCP',_0x36f654(0x1a9),{'tool':_0x36f654(0x163),'error':_0x1f72ef,'repo_path':_0x14cf1c[_0x36f654(0x255)]['repo_path'],'query':_0x14cf1c[_0x36f654(0x255)]['search_string'],'latency_ms':Date[_0x36f654(0x1db)]()-_0x64da5a});const _0x2d8f2b=_0x1f72ef[_0x36f654(0x1ca)]()[_0x36f654(0x184)](_0x36f654(0x20d))||_0x1f72ef[_0x36f654(0x1ca)]()[_0x36f654(0x184)](_0x36f654(0x241))||_0x1f72ef['toLowerCase']()[_0x36f654(0x184)]('etimedout')||_0xa97157 instanceof Error&&_0xa97157[_0x36f654(0x25e)]===_0x36f654(0x1c0);return reportMorphError({'error_message':_0x1f72ef,'error_type':_0x2d8f2b?'TimeoutError':_0xa97157 instanceof Error?_0xa97157[_0x36f654(0x14b)]['name']:_0x36f654(0x201),'context':{'tool':_0x36f654(0x163),'repo_path':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)],'query':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x182)],'model':_0x36f654(0x25f),'is_timeout':_0x2d8f2b,'exception_phase':_0x36f654(0x145),'request_content':{'query':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x182)],'repo_path':_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)],'repoRoot':a0_0x27fcca[_0x36f654(0x1c1)](_0x14cf1c[_0x36f654(0x255)][_0x36f654(0x226)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0xa97157 instanceof Error?_0xa97157[_0x36f654(0x1c9)]:undefined,'source':_0x36f654(0x192)})['catch'](()=>{}),{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x1d7)+_0x1f72ef}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x474f1f=WarpGrepGitHubArgsSchema[_0x36f654(0x167)](_0x431357);if(!_0x474f1f['success'])return{'content':[{'type':_0x36f654(0x1a8),'text':'Invalid\x20arguments:\x20'+_0x474f1f['error']}],'isError':!![]};const _0x11fa01=_0x474f1f[_0x36f654(0x255)]['github_url']||_0x474f1f['data'][_0x36f654(0x257)];if(!_0x11fa01)return{'content':[{'type':_0x36f654(0x1a8),'text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x5821e9=MORPH_API_KEY;if(!_0x5821e9)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0xe18c2b=Date[_0x36f654(0x1db)]();logger[_0x36f654(0x14c)]('MCP',_0x36f654(0x20a),{'identifier':_0x11fa01,'query':_0x474f1f[_0x36f654(0x255)][_0x36f654(0x182)],'branch':_0x474f1f[_0x36f654(0x255)][_0x36f654(0x1c6)]});try{const _0x1f3515=new WarpGrepClient({'morphApiKey':_0x5821e9,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x5d2254=await _0x1f3515[_0x36f654(0x15e)]({'searchTerm':_0x474f1f[_0x36f654(0x255)]['search_string'],'github':_0x11fa01,'branch':_0x474f1f[_0x36f654(0x255)][_0x36f654(0x1c6)]}),_0x3ff45e=Date[_0x36f654(0x1db)]()-_0xe18c2b;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x3ff45e+_0x36f654(0x254)+_0x5d2254[_0x36f654(0x1b2)]);const _0x22daca=formatResult(_0x5d2254);return{'content':[{'type':'text','text':_0x22daca}]};}catch(_0x4311d4){const _0x42ec38=handleMorphAPIError(_0x4311d4);if(_0x42ec38)return _0x42ec38;const _0x5c89ef=Date[_0x36f654(0x1db)]()-_0xe18c2b,_0x537f1c=_0x4311d4 instanceof Error?_0x4311d4[_0x36f654(0x208)]:String(_0x4311d4);return logMcpStderr(_0x36f654(0x1f9)+_0x5c89ef+_0x36f654(0x21f),_0x537f1c),reportMorphError({'error_message':_0x537f1c,'error_type':_0x4311d4 instanceof Error?_0x4311d4[_0x36f654(0x14b)][_0x36f654(0x25e)]:_0x36f654(0x201),'context':{'tool':_0x36f654(0x251),'github_url':_0x11fa01,'search_string':_0x474f1f['data'][_0x36f654(0x182)],'branch':_0x474f1f['data'][_0x36f654(0x1c6)]},'stack_trace':_0x4311d4 instanceof Error?_0x4311d4[_0x36f654(0x1c9)]:undefined,'source':_0x36f654(0x192),'tool':'github_codebase_search','latency_ms':_0x5c89ef})[_0x36f654(0x20c)](()=>{}),{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x18f)+_0x537f1c}],'isError':![]};}}default:throw new Error(_0x36f654(0x1ed)+_0x33cf74);}}catch(_0x150f2b){const _0x48f2a4=_0x150f2b instanceof Error?_0x150f2b['message']:String(_0x150f2b);return reportMorphError({'error_message':_0x48f2a4,'error_type':_0x150f2b instanceof Error?_0x150f2b['constructor'][_0x36f654(0x25e)]:_0x36f654(0x201),'context':{'tool':_0x33cf74,'arguments':_0x431357?JSON[_0x36f654(0x228)](_0x431357)[_0x36f654(0x1cd)](0x0,0x1f4):undefined,'mcp_server_version':_0x36f654(0x1cf)},'stack_trace':_0x150f2b instanceof Error?_0x150f2b[_0x36f654(0x1c9)]:undefined,'source':_0x36f654(0x192)})[_0x36f654(0x20c)](()=>{}),{'content':[{'type':_0x36f654(0x1a8),'text':_0x36f654(0x26b)+_0x48f2a4}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x59a480){const _0x5c506c=a0_0x56a8fe,_0x5034e3=await getValidRootDirectories(_0x59a480);if(_0x5034e3[_0x5c506c(0x270)]>0x0)allowedDirectories=[..._0x5034e3],logMcpStderr(_0x5c506c(0x219)+_0x5034e3['length']+'\x20valid\x20directories');else{logMcpStderr(_0x5c506c(0x166));if(ENABLE_WORKSPACE_MODE)try{const _0x46bc26=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x46bc26&&(allowedDirectories=[_0x46bc26],logMcpStderr(_0x5c506c(0x172)+_0x46bc26));}catch(_0x383dcd){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x383dcd);}}}server[a0_0x56a8fe(0x1c5)](RootsListChangedNotificationSchema,async()=>{const _0x68fc37=a0_0x56a8fe;try{const _0x1cac3d=await server[_0x68fc37(0x199)]();_0x1cac3d&&_0x68fc37(0x1cb)in _0x1cac3d&&await updateAllowedDirectoriesFromRoots(_0x1cac3d[_0x68fc37(0x1cb)]);}catch(_0x413cd5){logMcpStderr(_0x68fc37(0x1fc),_0x413cd5 instanceof Error?_0x413cd5[_0x68fc37(0x208)]:String(_0x413cd5));}}),server[a0_0x56a8fe(0x1dd)]=async()=>{const _0x18c4ae=a0_0x56a8fe,_0x124320=server['getClientCapabilities']();if(_0x124320?.[_0x18c4ae(0x1cb)])try{const _0x4b9d3e=await server['listRoots']();_0x4b9d3e&&_0x18c4ae(0x1cb)in _0x4b9d3e?await updateAllowedDirectoriesFromRoots(_0x4b9d3e[_0x18c4ae(0x1cb)]):logMcpStderr(_0x18c4ae(0x22e));}catch(_0x207b77){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x207b77 instanceof Error?_0x207b77[_0x18c4ae(0x208)]:String(_0x207b77));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x18c4ae(0x22f),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x18c4ae(0x164));else throw new Error(_0x18c4ae(0x16a));}}};async function runServer(){const _0x431daa=a0_0x56a8fe,_0x159eed=new StdioServerTransport();await server[_0x431daa(0x224)](_0x159eed),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x431daa(0x270)]===0x0&&logMcpStderr(_0x431daa(0x1dc));}runServer()[a0_0x56a8fe(0x20c)](_0x1a5b3c=>{const _0x23ab40=a0_0x56a8fe;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x1a5b3c),process[_0x23ab40(0x1a0)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0xb1edfd=a1_0x1449;(function(_0x571dec,_0x2a241f){var _0x3f78a6=a1_0x1449,_0xf37a82=_0x571dec();while(!![]){try{var _0x740230=parseInt(_0x3f78a6(0xd9))/0x1+parseInt(_0x3f78a6(0xcd))/0x2+parseInt(_0x3f78a6(0xd6))/0x3*(parseInt(_0x3f78a6(0xd7))/0x4)+parseInt(_0x3f78a6(0xd3))/0x5*(parseInt(_0x3f78a6(0xd4))/0x6)+-parseInt(_0x3f78a6(0xdd))/0x7*(-parseInt(_0x3f78a6(0xda))/0x8)+-parseInt(_0x3f78a6(0xcc))/0x9*(-parseInt(_0x3f78a6(0xcf))/0xa)+-parseInt(_0x3f78a6(0xd5))/0xb;if(_0x740230===_0x2a241f)break;else _0xf37a82['push'](_0xf37a82['shift']());}catch(_0x58b765){_0xf37a82['push'](_0xf37a82['shift']());}}}(a1_0x8c4f,0x22d9b));import a1_0x553dbd from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0xaf6c6e=a1_0x553dbd[a1_0xb1edfd(0xdf)]()){var _0x474803=a1_0xb1edfd;switch(_0xaf6c6e){case'darwin':return _0x474803(0xd2);case _0x474803(0xcb):return _0x474803(0xd0);case _0x474803(0xdc):return _0x474803(0xd1);default:return'Unknown';}}export function formatMcpLogMessage(_0x18fd48,_0x12c315=a1_0x553dbd[a1_0xb1edfd(0xdf)]()){var _0x487008=a1_0xb1edfd;return _0x487008(0xde)+getOperatingSystemType(_0x12c315)+']\x20'+_0x18fd48;}function a1_0x1449(_0x36dbb2,_0x1df39d){_0x36dbb2=_0x36dbb2-0xcb;var _0x8c4fe4=a1_0x8c4f();var _0x1449ce=_0x8c4fe4[_0x36dbb2];return _0x1449ce;}function a1_0x8c4f(){var _0x771d4e=['win32','127359yciEiG','448202uiPjMg','MCP','190MsmNXY','Windows','Linux','macOS','30445wlayxE','48sNIVoG','10419178sGHdGz','894aSjwyT','3656krYWeN','error','271387BLYXNH','16grUkda','length','linux','15764ushSWo','[os=','platform'];a1_0x8c4f=function(){return _0x771d4e;};return a1_0x8c4f();}export function logMcpStderr(_0x2fd120,..._0x1cdf72){var _0x3ff7c5=a1_0xb1edfd;console[_0x3ff7c5(0xd8)](formatMcpLogMessage(_0x2fd120),..._0x1cdf72),logger['info'](_0x3ff7c5(0xce),_0x2fd120,_0x1cdf72[_0x3ff7c5(0xdb)]?{'args':_0x1cdf72['map'](_0xfe8b9c=>String(_0xfe8b9c))}:undefined);}
1
+ function a1_0x7e5c(_0x3907db,_0x41e6a6){_0x3907db=_0x3907db-0x180;var _0x4e8fc4=a1_0x4e8f();var _0x7e5c85=_0x4e8fc4[_0x3907db];return _0x7e5c85;}var a1_0x327885=a1_0x7e5c;(function(_0x10b3a9,_0x2ff58c){var _0x24c585=a1_0x7e5c,_0x4d047f=_0x10b3a9();while(!![]){try{var _0x52147a=parseInt(_0x24c585(0x18d))/0x1*(parseInt(_0x24c585(0x187))/0x2)+parseInt(_0x24c585(0x189))/0x3+parseInt(_0x24c585(0x185))/0x4+parseInt(_0x24c585(0x195))/0x5*(parseInt(_0x24c585(0x18c))/0x6)+parseInt(_0x24c585(0x18e))/0x7*(-parseInt(_0x24c585(0x184))/0x8)+parseInt(_0x24c585(0x18b))/0x9+-parseInt(_0x24c585(0x18a))/0xa;if(_0x52147a===_0x2ff58c)break;else _0x4d047f['push'](_0x4d047f['shift']());}catch(_0x106d4d){_0x4d047f['push'](_0x4d047f['shift']());}}}(a1_0x4e8f,0x375ee));import a1_0x3c547c from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x5671d6=a1_0x3c547c[a1_0x327885(0x18f)]()){var _0x52d4ea=a1_0x327885;switch(_0x5671d6){case _0x52d4ea(0x192):return _0x52d4ea(0x181);case _0x52d4ea(0x180):return _0x52d4ea(0x182);case _0x52d4ea(0x190):return'Linux';default:return _0x52d4ea(0x194);}}export function formatMcpLogMessage(_0x44a3bd,_0x1b3d1f=a1_0x3c547c[a1_0x327885(0x18f)]()){var _0x3ec1b6=a1_0x327885;return _0x3ec1b6(0x191)+getOperatingSystemType(_0x1b3d1f)+']\x20'+_0x44a3bd;}export function logMcpStderr(_0x458364,..._0x450fe4){var _0x425782=a1_0x327885;console[_0x425782(0x183)](formatMcpLogMessage(_0x458364),..._0x450fe4),logger['info'](_0x425782(0x188),_0x458364,_0x450fe4[_0x425782(0x193)]?{'args':_0x450fe4[_0x425782(0x186)](_0x542baa=>String(_0x542baa))}:undefined);}function a1_0x4e8f(){var _0x3af947=['[os=','darwin','length','Unknown','560DDgEZd','win32','macOS','Windows','error','1329928gXREnQ','178084KFDRCA','map','886586ntvGNi','MCP','482082GLxTNO','1743340egJkGN','71442pKvTtu','4134GSKwPy','1hFntOe','14GryVgD','platform','linux'];a1_0x4e8f=function(){return _0x3af947;};return a1_0x4e8f();}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- function a2_0x226f(_0x252dba,_0x40c0b3){_0x252dba=_0x252dba-0x6f;const _0x131163=a2_0x1311();let _0x226fff=_0x131163[_0x252dba];return _0x226fff;}const a2_0x17f227=a2_0x226f;function a2_0x1311(){const _0x532c13=['info','stringify','777475poBPDh','toUpperCase','111536QanUCw','931880Nlsckv','25gSnmmX','66aUfnyQ','2235828OtHBBk','143109srtBZe','49veEExK','_log','isEnabled','36BgeXFh','env','enabled','455972lnELYY','enable','MORPH_DEBUG','write','error','warn','fileStream','debug','12zwaVoa','4706QeqMlY',']\x20[','MORPH_LOG_FILE'];a2_0x1311=function(){return _0x532c13;};return a2_0x1311();}(function(_0x3cb635,_0x4aea6a){const _0x29c62d=a2_0x226f,_0x33d3db=_0x3cb635();while(!![]){try{const _0x16389a=parseInt(_0x29c62d(0x80))/0x1*(-parseInt(_0x29c62d(0x77))/0x2)+parseInt(_0x29c62d(0x83))/0x3+-parseInt(_0x29c62d(0x8a))/0x4+parseInt(_0x29c62d(0x7c))/0x5*(-parseInt(_0x29c62d(0x76))/0x6)+-parseInt(_0x29c62d(0x84))/0x7*(parseInt(_0x29c62d(0x7e))/0x8)+-parseInt(_0x29c62d(0x87))/0x9*(parseInt(_0x29c62d(0x7f))/0xa)+parseInt(_0x29c62d(0x81))/0xb*(parseInt(_0x29c62d(0x82))/0xc);if(_0x16389a===_0x4aea6a)break;else _0x33d3db['push'](_0x33d3db['shift']());}catch(_0xbb66b4){_0x33d3db['push'](_0x33d3db['shift']());}}}(a2_0x1311,0x33a07));import{createWriteStream}from'fs';class MorphLogger{[a2_0x17f227(0x89)];[a2_0x17f227(0x74)];constructor(){const _0x397e8b=a2_0x17f227;this[_0x397e8b(0x89)]=process['env'][_0x397e8b(0x70)]==='1'||!!process['env'][_0x397e8b(0x79)];const _0x37b1d3=process[_0x397e8b(0x88)]['MORPH_LOG_FILE'];this[_0x397e8b(0x74)]=_0x37b1d3?createWriteStream(_0x37b1d3,{'flags':'a'}):null;}[a2_0x17f227(0x75)](_0x35e90f,_0x27e7c9,_0x2ab8fc){const _0x422150=a2_0x17f227;this[_0x422150(0x85)](_0x422150(0x75),_0x35e90f,_0x27e7c9,_0x2ab8fc);}[a2_0x17f227(0x7a)](_0x5a9725,_0x4158bd,_0x5ce550){const _0x61da31=a2_0x17f227;this[_0x61da31(0x85)](_0x61da31(0x7a),_0x5a9725,_0x4158bd,_0x5ce550);}['warn'](_0x485e83,_0x5d3f79,_0x3c3cb8){const _0x388d3f=a2_0x17f227;this['_log'](_0x388d3f(0x73),_0x485e83,_0x5d3f79,_0x3c3cb8);}[a2_0x17f227(0x72)](_0x58fa32,_0x18eaef,_0x1df5d7){const _0x315251=a2_0x17f227;this[_0x315251(0x85)](_0x315251(0x72),_0x58fa32,_0x18eaef,_0x1df5d7);}[a2_0x17f227(0x6f)](){const _0x4fbc42=a2_0x17f227;this[_0x4fbc42(0x89)]=!![];}get[a2_0x17f227(0x86)](){const _0x2c5867=a2_0x17f227;return this[_0x2c5867(0x89)];}[a2_0x17f227(0x85)](_0x21887e,_0x471ba8,_0x561bce,_0x3d89f2){const _0x3e035d=a2_0x17f227;if(_0x21887e!==_0x3e035d(0x72)&&!this[_0x3e035d(0x89)])return;const _0x24b130=new Date()['toISOString'](),_0x15c431='['+_0x24b130+']\x20['+_0x21887e[_0x3e035d(0x7d)]()+_0x3e035d(0x78)+_0x471ba8+']';console[_0x3e035d(0x72)](_0x3d89f2?_0x15c431+'\x20'+_0x561bce+'\x20'+JSON[_0x3e035d(0x7b)](_0x3d89f2):_0x15c431+'\x20'+_0x561bce),this[_0x3e035d(0x74)]?.[_0x3e035d(0x71)](JSON['stringify']({'ts':_0x24b130,'level':_0x21887e,'component':_0x471ba8,'msg':_0x561bce,..._0x3d89f2&&{'data':_0x3d89f2}})+'\x0a');}}export const logger=new MorphLogger();
1
+ function a2_0x23be(){const _0x152208=['22824hhzUbv','enable','MORPH_LOG_FILE',']\x20[','33400ZjoYWt','179694OBvdds','info','1344paCycd','debug','fileStream','9492480rFCwNq','stringify','3352671UqWlSF','384366iTcmOf','3006612PLqzqN','enabled','env','toUpperCase','2URkloM','warn','write','error','_log','120qkDRni','toISOString'];a2_0x23be=function(){return _0x152208;};return a2_0x23be();}const a2_0x24fef4=a2_0x3787;(function(_0x387f01,_0x535cf9){const _0x1f45b8=a2_0x3787,_0x18b0b0=_0x387f01();while(!![]){try{const _0x3c1618=-parseInt(_0x1f45b8(0x1c8))/0x1+-parseInt(_0x1f45b8(0x1cd))/0x2*(parseInt(_0x1f45b8(0x1d9))/0x3)+parseInt(_0x1f45b8(0x1d2))/0x4*(parseInt(_0x1f45b8(0x1d8))/0x5)+parseInt(_0x1f45b8(0x1c9))/0x6+parseInt(_0x1f45b8(0x1db))/0x7*(-parseInt(_0x1f45b8(0x1d4))/0x8)+-parseInt(_0x1f45b8(0x1e0))/0x9+parseInt(_0x1f45b8(0x1de))/0xa;if(_0x3c1618===_0x535cf9)break;else _0x18b0b0['push'](_0x18b0b0['shift']());}catch(_0x17bcf2){_0x18b0b0['push'](_0x18b0b0['shift']());}}}(a2_0x23be,0x45def));function a2_0x3787(_0x3e85be,_0x1d08c0){_0x3e85be=_0x3e85be-0x1c8;const _0x23beb5=a2_0x23be();let _0x37878c=_0x23beb5[_0x3e85be];return _0x37878c;}import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x24fef4(0x1dd)];constructor(){const _0x122377=a2_0x24fef4;this[_0x122377(0x1ca)]=process['env']['MORPH_DEBUG']==='1'||!!process[_0x122377(0x1cb)][_0x122377(0x1d6)];const _0x5f22aa=process[_0x122377(0x1cb)][_0x122377(0x1d6)];this[_0x122377(0x1dd)]=_0x5f22aa?createWriteStream(_0x5f22aa,{'flags':'a'}):null;}[a2_0x24fef4(0x1dc)](_0x39d7ad,_0x161105,_0x2aeba8){const _0x4ebf93=a2_0x24fef4;this[_0x4ebf93(0x1d1)](_0x4ebf93(0x1dc),_0x39d7ad,_0x161105,_0x2aeba8);}[a2_0x24fef4(0x1da)](_0x16b9ce,_0x249a1c,_0x49f46f){const _0x408c54=a2_0x24fef4;this['_log'](_0x408c54(0x1da),_0x16b9ce,_0x249a1c,_0x49f46f);}[a2_0x24fef4(0x1ce)](_0x556ad9,_0x200e2c,_0x1642ae){const _0x390b9f=a2_0x24fef4;this['_log'](_0x390b9f(0x1ce),_0x556ad9,_0x200e2c,_0x1642ae);}[a2_0x24fef4(0x1d0)](_0x27c213,_0x3a31cc,_0x3f712c){const _0x345d47=a2_0x24fef4;this[_0x345d47(0x1d1)](_0x345d47(0x1d0),_0x27c213,_0x3a31cc,_0x3f712c);}[a2_0x24fef4(0x1d5)](){const _0x4ab7a3=a2_0x24fef4;this[_0x4ab7a3(0x1ca)]=!![];}get['isEnabled'](){const _0x310fc6=a2_0x24fef4;return this[_0x310fc6(0x1ca)];}[a2_0x24fef4(0x1d1)](_0x5ed082,_0x14f5e6,_0x503a15,_0x40b87a){const _0x4bbc63=a2_0x24fef4;if(_0x5ed082!==_0x4bbc63(0x1d0)&&!this['enabled'])return;const _0x98ed57=new Date()[_0x4bbc63(0x1d3)](),_0x47bf3a='['+_0x98ed57+_0x4bbc63(0x1d7)+_0x5ed082[_0x4bbc63(0x1cc)]()+_0x4bbc63(0x1d7)+_0x14f5e6+']';console[_0x4bbc63(0x1d0)](_0x40b87a?_0x47bf3a+'\x20'+_0x503a15+'\x20'+JSON[_0x4bbc63(0x1df)](_0x40b87a):_0x47bf3a+'\x20'+_0x503a15),this[_0x4bbc63(0x1dd)]?.[_0x4bbc63(0x1cf)](JSON[_0x4bbc63(0x1df)]({'ts':_0x98ed57,'level':_0x5ed082,'component':_0x14f5e6,'msg':_0x503a15,..._0x40b87a&&{'data':_0x40b87a}})+'\x0a');}}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0x341bd1,_0x36e350){const _0x54b19c=a3_0x1525,_0x114c16=_0x341bd1();while(!![]){try{const _0x5afd55=-parseInt(_0x54b19c(0x13e))/0x1*(-parseInt(_0x54b19c(0x12f))/0x2)+parseInt(_0x54b19c(0x131))/0x3*(parseInt(_0x54b19c(0x129))/0x4)+-parseInt(_0x54b19c(0x132))/0x5*(-parseInt(_0x54b19c(0x13b))/0x6)+parseInt(_0x54b19c(0x12e))/0x7*(-parseInt(_0x54b19c(0x13d))/0x8)+parseInt(_0x54b19c(0x136))/0x9+parseInt(_0x54b19c(0x13c))/0xa+parseInt(_0x54b19c(0x137))/0xb*(-parseInt(_0x54b19c(0x139))/0xc);if(_0x5afd55===_0x36e350)break;else _0x114c16['push'](_0x114c16['shift']());}catch(_0x32c2db){_0x114c16['push'](_0x114c16['shift']());}}}(a3_0x160a,0x3e397));import a3_0x151a0d from'path';import a3_0x4f7b5c from'os';export function convertToWindowsPath(_0x1a9642){const _0x30e2a5=a3_0x1525;if(_0x1a9642[_0x30e2a5(0x138)](_0x30e2a5(0x12a))){const _0x413dd8=_0x1a9642[_0x30e2a5(0x135)](0x5)[_0x30e2a5(0x12b)](),_0x2bc99a=_0x1a9642['slice'](0x6)['replace'](/\//g,'\x5c');return _0x413dd8+':'+_0x2bc99a;}if(_0x1a9642[_0x30e2a5(0x12c)](/^\/[a-zA-Z]\//)){const _0x2b038b=_0x1a9642[_0x30e2a5(0x135)](0x1)['toUpperCase'](),_0x443054=_0x1a9642[_0x30e2a5(0x134)](0x2)[_0x30e2a5(0x13a)](/\//g,'\x5c');return _0x2b038b+':'+_0x443054;}if(_0x1a9642[_0x30e2a5(0x12c)](/^[a-zA-Z]:/))return _0x1a9642['replace'](/\//g,'\x5c');return _0x1a9642;}export function normalizePath(_0x9d5380){const _0xe46d1a=a3_0x1525;_0x9d5380=_0x9d5380[_0xe46d1a(0x130)]()[_0xe46d1a(0x13a)](/^["']|["']$/g,'');const _0x262b05=_0x9d5380[_0xe46d1a(0x138)]('/')&&!_0x9d5380['match'](/^\/mnt\/[a-z]\//i)&&!_0x9d5380[_0xe46d1a(0x12c)](/^\/[a-zA-Z]\//);if(_0x262b05)return _0x9d5380['replace'](/\/+/g,'/')[_0xe46d1a(0x13a)](/\/+$/,'');_0x9d5380=convertToWindowsPath(_0x9d5380);if(_0x9d5380[_0xe46d1a(0x138)]('\x5c\x5c')){let _0xcf8267=_0x9d5380;_0xcf8267=_0xcf8267['replace'](/^\\{2,}/,'\x5c\x5c');const _0x28cd6d=_0xcf8267[_0xe46d1a(0x133)](0x2)[_0xe46d1a(0x13a)](/\\\\/g,'\x5c');_0x9d5380='\x5c\x5c'+_0x28cd6d;}else _0x9d5380=_0x9d5380[_0xe46d1a(0x13a)](/\\\\/g,'\x5c');let _0x1b782a=a3_0x151a0d['normalize'](_0x9d5380);_0x9d5380[_0xe46d1a(0x138)]('\x5c\x5c')&&!_0x1b782a['startsWith']('\x5c\x5c')&&(_0x1b782a='\x5c'+_0x1b782a);if(_0x1b782a['match'](/^[a-zA-Z]:/)){let _0x153181=_0x1b782a['replace'](/\//g,'\x5c');return/^[a-z]:/['test'](_0x153181)&&(_0x153181=_0x153181['charAt'](0x0)[_0xe46d1a(0x12b)]()+_0x153181['slice'](0x1)),_0x153181;}return _0x1b782a['replace'](/\//g,'\x5c');}function a3_0x1525(_0x4bf649,_0x5cbcf0){_0x4bf649=_0x4bf649-0x128;const _0x160ad1=a3_0x160a();let _0x15252e=_0x160ad1[_0x4bf649];return _0x15252e;}function a3_0x160a(){const _0x29181c=['1860xUXeBv','replace','6xQdkup','4745980niyhWS','8vmfxRz','10HWTJqu','join','4nUhgGj','/mnt/','toUpperCase','match','homedir','2948526SuIrHF','77218TMiBSX','trim','622527jmvRLr','1756385MBTiJu','substring','slice','charAt','99000ldgvCe','53537QdMayj','startsWith'];a3_0x160a=function(){return _0x29181c;};return a3_0x160a();}export function expandHome(_0xd971a9){const _0x48a89a=a3_0x1525;if(_0xd971a9['startsWith']('~/')||_0xd971a9==='~')return a3_0x151a0d[_0x48a89a(0x128)](a3_0x4f7b5c[_0x48a89a(0x12d)](),_0xd971a9[_0x48a89a(0x134)](0x1));return _0xd971a9;}
1
+ (function(_0x2dc26b,_0x43a874){const _0x1d4989=a3_0x17a1,_0x53d0b8=_0x2dc26b();while(!![]){try{const _0x39dfee=-parseInt(_0x1d4989(0x9a))/0x1*(-parseInt(_0x1d4989(0x99))/0x2)+-parseInt(_0x1d4989(0x92))/0x3+parseInt(_0x1d4989(0x9b))/0x4+parseInt(_0x1d4989(0x8a))/0x5*(parseInt(_0x1d4989(0x98))/0x6)+parseInt(_0x1d4989(0x8e))/0x7+-parseInt(_0x1d4989(0x89))/0x8+-parseInt(_0x1d4989(0x97))/0x9;if(_0x39dfee===_0x43a874)break;else _0x53d0b8['push'](_0x53d0b8['shift']());}catch(_0x32d6ca){_0x53d0b8['push'](_0x53d0b8['shift']());}}}(a3_0x11f6,0xe3033));function a3_0x11f6(){const _0x142c93=['6coBXKW','2396sPbaCB','23AabPnY','519960PLAfef','trim','2344960MaYAjl','5522365NaSiFF','startsWith','charAt','replace','12271483tTVRCv','match','test','/mnt/','2583396llYMuN','join','slice','toUpperCase','normalize','8378919cAbXPf'];a3_0x11f6=function(){return _0x142c93;};return a3_0x11f6();}import a3_0x157c57 from'path';import a3_0x157f7a from'os';export function convertToWindowsPath(_0x2e8b6a){const _0x2c4238=a3_0x17a1;if(_0x2e8b6a[_0x2c4238(0x8b)](_0x2c4238(0x91))){const _0xacc346=_0x2e8b6a['charAt'](0x5)['toUpperCase'](),_0x8c7434=_0x2e8b6a[_0x2c4238(0x94)](0x6)['replace'](/\//g,'\x5c');return _0xacc346+':'+_0x8c7434;}if(_0x2e8b6a[_0x2c4238(0x8f)](/^\/[a-zA-Z]\//)){const _0x348b36=_0x2e8b6a[_0x2c4238(0x8c)](0x1)['toUpperCase'](),_0x51c8c2=_0x2e8b6a[_0x2c4238(0x94)](0x2)[_0x2c4238(0x8d)](/\//g,'\x5c');return _0x348b36+':'+_0x51c8c2;}if(_0x2e8b6a[_0x2c4238(0x8f)](/^[a-zA-Z]:/))return _0x2e8b6a[_0x2c4238(0x8d)](/\//g,'\x5c');return _0x2e8b6a;}function a3_0x17a1(_0x10bdb4,_0x789406){_0x10bdb4=_0x10bdb4-0x89;const _0x11f67b=a3_0x11f6();let _0x17a1f7=_0x11f67b[_0x10bdb4];return _0x17a1f7;}export function normalizePath(_0x3b1b92){const _0x592170=a3_0x17a1;_0x3b1b92=_0x3b1b92[_0x592170(0x9c)]()[_0x592170(0x8d)](/^["']|["']$/g,'');const _0x5ee501=_0x3b1b92['startsWith']('/')&&!_0x3b1b92[_0x592170(0x8f)](/^\/mnt\/[a-z]\//i)&&!_0x3b1b92[_0x592170(0x8f)](/^\/[a-zA-Z]\//);if(_0x5ee501)return _0x3b1b92[_0x592170(0x8d)](/\/+/g,'/')[_0x592170(0x8d)](/\/+$/,'');_0x3b1b92=convertToWindowsPath(_0x3b1b92);if(_0x3b1b92[_0x592170(0x8b)]('\x5c\x5c')){let _0x5038de=_0x3b1b92;_0x5038de=_0x5038de[_0x592170(0x8d)](/^\\{2,}/,'\x5c\x5c');const _0x254159=_0x5038de['substring'](0x2)[_0x592170(0x8d)](/\\\\/g,'\x5c');_0x3b1b92='\x5c\x5c'+_0x254159;}else _0x3b1b92=_0x3b1b92[_0x592170(0x8d)](/\\\\/g,'\x5c');let _0x3f6500=a3_0x157c57[_0x592170(0x96)](_0x3b1b92);_0x3b1b92[_0x592170(0x8b)]('\x5c\x5c')&&!_0x3f6500[_0x592170(0x8b)]('\x5c\x5c')&&(_0x3f6500='\x5c'+_0x3f6500);if(_0x3f6500[_0x592170(0x8f)](/^[a-zA-Z]:/)){let _0x24e5d1=_0x3f6500[_0x592170(0x8d)](/\//g,'\x5c');return/^[a-z]:/[_0x592170(0x90)](_0x24e5d1)&&(_0x24e5d1=_0x24e5d1['charAt'](0x0)[_0x592170(0x95)]()+_0x24e5d1[_0x592170(0x94)](0x1)),_0x24e5d1;}return _0x3f6500['replace'](/\//g,'\x5c');}export function expandHome(_0x266c62){const _0x3c274a=a3_0x17a1;if(_0x266c62[_0x3c274a(0x8b)]('~/')||_0x266c62==='~')return a3_0x157c57[_0x3c274a(0x93)](a3_0x157f7a['homedir'](),_0x266c62[_0x3c274a(0x94)](0x1));return _0x266c62;}
@@ -1 +1 @@
1
- (function(_0x55b880,_0xe8d60c){const _0x15712f=a4_0x95db,_0x508bf4=_0x55b880();while(!![]){try{const _0x556007=-parseInt(_0x15712f(0x1b9))/0x1+-parseInt(_0x15712f(0x1b3))/0x2*(parseInt(_0x15712f(0x1bf))/0x3)+parseInt(_0x15712f(0x1c0))/0x4*(parseInt(_0x15712f(0x1bd))/0x5)+parseInt(_0x15712f(0x1b6))/0x6*(-parseInt(_0x15712f(0x1c1))/0x7)+parseInt(_0x15712f(0x1be))/0x8*(-parseInt(_0x15712f(0x1b2))/0x9)+parseInt(_0x15712f(0x1b0))/0xa+parseInt(_0x15712f(0x1b5))/0xb;if(_0x556007===_0xe8d60c)break;else _0x508bf4['push'](_0x508bf4['shift']());}catch(_0xc5c739){_0x508bf4['push'](_0x508bf4['shift']());}}}(a4_0x4396,0x845d6));import a4_0x40d21b from'path';function a4_0x95db(_0x39f1f6,_0x14e440){_0x39f1f6=_0x39f1f6-0x1ae;const _0x439633=a4_0x4396();let _0x95dbf4=_0x439633[_0x39f1f6];return _0x95dbf4;}function a4_0x4396(){const _0x213563=['sep','isArray','1850570TlCDMq','some','3231qUtJHk','4120NbuLsZ','isAbsolute','30291261uhQWjP','399522zhUEeh','length','string','818178Aemmbn','normalize','startsWith','resolve','153985drpNhe','8152QzOnnd','789bbLgWR','8nFNGBV','77JKsKSi','includes'];a4_0x4396=function(){return _0x213563;};return a4_0x4396();}export function isPathWithinAllowedDirectories(_0x24e64c,_0x1e92d2){const _0x4a8885=a4_0x95db;if(typeof _0x24e64c!=='string'||!Array[_0x4a8885(0x1af)](_0x1e92d2))return![];if(!_0x24e64c||_0x1e92d2[_0x4a8885(0x1b7)]===0x0)return![];if(_0x24e64c[_0x4a8885(0x1c2)]('\x00'))return![];let _0x477365;try{_0x477365=a4_0x40d21b['resolve'](a4_0x40d21b['normalize'](_0x24e64c));}catch{return![];}if(!a4_0x40d21b[_0x4a8885(0x1b4)](_0x477365))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x1e92d2[_0x4a8885(0x1b1)](_0x38fe7b=>{const _0x2c92a3=_0x4a8885;if(typeof _0x38fe7b!==_0x2c92a3(0x1b8)||!_0x38fe7b)return![];if(_0x38fe7b[_0x2c92a3(0x1c2)]('\x00'))return![];let _0x4a3d55;try{_0x4a3d55=a4_0x40d21b[_0x2c92a3(0x1bc)](a4_0x40d21b[_0x2c92a3(0x1ba)](_0x38fe7b));}catch{return![];}if(!a4_0x40d21b[_0x2c92a3(0x1b4)](_0x4a3d55))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x477365===_0x4a3d55)return!![];if(_0x4a3d55===a4_0x40d21b['sep'])return _0x477365[_0x2c92a3(0x1bb)](a4_0x40d21b[_0x2c92a3(0x1ae)]);return _0x477365[_0x2c92a3(0x1bb)](_0x4a3d55+a4_0x40d21b[_0x2c92a3(0x1ae)]);});}
1
+ (function(_0x472dd0,_0x16f56d){const _0x5e674f=a4_0x490b,_0x43c92d=_0x472dd0();while(!![]){try{const _0x2a024e=-parseInt(_0x5e674f(0x12f))/0x1+parseInt(_0x5e674f(0x12e))/0x2+parseInt(_0x5e674f(0x126))/0x3+-parseInt(_0x5e674f(0x138))/0x4*(-parseInt(_0x5e674f(0x137))/0x5)+parseInt(_0x5e674f(0x133))/0x6+parseInt(_0x5e674f(0x12d))/0x7+parseInt(_0x5e674f(0x135))/0x8*(-parseInt(_0x5e674f(0x134))/0x9);if(_0x2a024e===_0x16f56d)break;else _0x43c92d['push'](_0x43c92d['shift']());}catch(_0x254185){_0x43c92d['push'](_0x43c92d['shift']());}}}(a4_0x27e8,0xcc979));import a4_0x4ccad0 from'path';export function isPathWithinAllowedDirectories(_0x23a533,_0x1c5d8b){const _0x211fec=a4_0x490b;if(typeof _0x23a533!=='string'||!Array[_0x211fec(0x125)](_0x1c5d8b))return![];if(!_0x23a533||_0x1c5d8b[_0x211fec(0x12b)]===0x0)return![];if(_0x23a533[_0x211fec(0x136)]('\x00'))return![];let _0x533f56;try{_0x533f56=a4_0x4ccad0['resolve'](a4_0x4ccad0['normalize'](_0x23a533));}catch{return![];}if(!a4_0x4ccad0[_0x211fec(0x132)](_0x533f56))throw new Error(_0x211fec(0x12c));return _0x1c5d8b[_0x211fec(0x12a)](_0x248ba0=>{const _0x3738bc=_0x211fec;if(typeof _0x248ba0!==_0x3738bc(0x139)||!_0x248ba0)return![];if(_0x248ba0['includes']('\x00'))return![];let _0x3f9f42;try{_0x3f9f42=a4_0x4ccad0[_0x3738bc(0x130)](a4_0x4ccad0[_0x3738bc(0x127)](_0x248ba0));}catch{return![];}if(!a4_0x4ccad0[_0x3738bc(0x132)](_0x3f9f42))throw new Error(_0x3738bc(0x129));if(_0x533f56===_0x3f9f42)return!![];if(_0x3f9f42===a4_0x4ccad0[_0x3738bc(0x128)])return _0x533f56[_0x3738bc(0x131)](a4_0x4ccad0[_0x3738bc(0x128)]);return _0x533f56[_0x3738bc(0x131)](_0x3f9f42+a4_0x4ccad0['sep']);});}function a4_0x490b(_0x492773,_0x313e63){_0x492773=_0x492773-0x125;const _0x27e825=a4_0x27e8();let _0x490b99=_0x27e825[_0x492773];return _0x490b99;}function a4_0x27e8(){const _0x40c1e4=['isArray','4464792MAwxqb','normalize','sep','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some','length','Path\x20must\x20be\x20absolute\x20after\x20normalization','5740665iNTCwO','1377478pkwfjN','1205518WSZCzi','resolve','startsWith','isAbsolute','1113810IBtfrd','138879psmJnN','768gbnhin','includes','171085eIKOwR','40ghUeCt','string'];a4_0x27e8=function(){return _0x40c1e4;};return a4_0x27e8();}
@@ -1 +1 @@
1
- function a5_0x4ac0(_0x35db91,_0xdd7c1a){_0x35db91=_0x35db91-0x168;const _0x1d5047=a5_0x1d50();let _0x4ac07a=_0x1d5047[_0x35db91];return _0x4ac07a;}function a5_0x1d50(){const _0xdc71f7=['message','4932QPVEWp','non-directory\x20root','704cHDlIe','997350mnfPlL','85fXDoym','120gCNqUW','isDirectory','Skipping\x20','resolve','3973410agKTaJ','realpath','homedir','Skipping\x20invalid\x20directory:\x20','2929527mKvgol','startsWith','1733052bVFooD','228116OKjlsj','join','slice','uri','stat','11120WJGAZH'];a5_0x1d50=function(){return _0xdc71f7;};return a5_0x1d50();}(function(_0x2fca48,_0x7d5815){const _0x58f817=a5_0x4ac0,_0x47a825=_0x2fca48();while(!![]){try{const _0x116171=parseInt(_0x58f817(0x16d))/0x1*(parseInt(_0x58f817(0x17e))/0x2)+parseInt(_0x58f817(0x169))/0x3*(parseInt(_0x58f817(0x16b))/0x4)+-parseInt(_0x58f817(0x16c))/0x5+parseInt(_0x58f817(0x178))/0x6+-parseInt(_0x58f817(0x179))/0x7*(parseInt(_0x58f817(0x16e))/0x8)+parseInt(_0x58f817(0x176))/0x9+-parseInt(_0x58f817(0x172))/0xa;if(_0x116171===_0x7d5815)break;else _0x47a825['push'](_0x47a825['shift']());}catch(_0x5b917d){_0x47a825['push'](_0x47a825['shift']());}}}(a5_0x1d50,0x46f62));import{promises as a5_0x1a611f}from'fs';import a5_0x1b4b21 from'path';import a5_0x2d5c4d from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x37c5d7){const _0x1ea04e=a5_0x4ac0;try{const _0x1436bb=_0x37c5d7[_0x1ea04e(0x177)]('file://')?_0x37c5d7[_0x1ea04e(0x17b)](0x7):_0x37c5d7,_0x51dfa7=_0x1436bb[_0x1ea04e(0x177)]('~/')||_0x1436bb==='~'?a5_0x1b4b21[_0x1ea04e(0x17a)](a5_0x2d5c4d[_0x1ea04e(0x174)](),_0x1436bb[_0x1ea04e(0x17b)](0x1)):_0x1436bb,_0x4b70bf=a5_0x1b4b21[_0x1ea04e(0x171)](_0x51dfa7),_0x22de7d=await a5_0x1a611f[_0x1ea04e(0x173)](_0x4b70bf);return normalizePath(_0x22de7d);}catch{return null;}}function formatDirectoryError(_0x15b853,_0x36fa57,_0x3b436f){const _0x5d8a46=a5_0x4ac0;if(_0x3b436f)return _0x5d8a46(0x170)+_0x3b436f+':\x20'+_0x15b853;const _0x547bd5=_0x36fa57 instanceof Error?_0x36fa57[_0x5d8a46(0x168)]:String(_0x36fa57);return _0x5d8a46(0x175)+_0x15b853+'\x20due\x20to\x20error:\x20'+_0x547bd5;}export async function getValidRootDirectories(_0x467c6a){const _0x4d86e0=a5_0x4ac0,_0x16155e=[];for(const _0xe1abb of _0x467c6a){const _0x49617d=await parseRootUri(_0xe1abb[_0x4d86e0(0x17c)]);if(!_0x49617d){logMcpStderr(formatDirectoryError(_0xe1abb[_0x4d86e0(0x17c)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x2a3589=await a5_0x1a611f[_0x4d86e0(0x17d)](_0x49617d);_0x2a3589[_0x4d86e0(0x16f)]()?_0x16155e['push'](_0x49617d):logMcpStderr(formatDirectoryError(_0x49617d,undefined,_0x4d86e0(0x16a)));}catch(_0xbab4ee){logMcpStderr(formatDirectoryError(_0x49617d,_0xbab4ee));}}return _0x16155e;}
1
+ (function(_0x228c0c,_0x2e3e4d){const _0x205f34=a5_0x4669,_0x37f96c=_0x228c0c();while(!![]){try{const _0x2c4a56=-parseInt(_0x205f34(0x176))/0x1+-parseInt(_0x205f34(0x171))/0x2*(parseInt(_0x205f34(0x170))/0x3)+parseInt(_0x205f34(0x173))/0x4*(parseInt(_0x205f34(0x17a))/0x5)+-parseInt(_0x205f34(0x174))/0x6+parseInt(_0x205f34(0x16a))/0x7+-parseInt(_0x205f34(0x17b))/0x8+parseInt(_0x205f34(0x169))/0x9;if(_0x2c4a56===_0x2e3e4d)break;else _0x37f96c['push'](_0x37f96c['shift']());}catch(_0x2096ab){_0x37f96c['push'](_0x37f96c['shift']());}}}(a5_0x29c3,0x3172a));import{promises as a5_0x209606}from'fs';function a5_0x4669(_0x75fece,_0x498da7){_0x75fece=_0x75fece-0x169;const _0x29c3fe=a5_0x29c3();let _0x4669d0=_0x29c3fe[_0x75fece];return _0x4669d0;}import a5_0x2acb68 from'path';import a5_0x14b95c from'os';import{normalizePath}from'./path-utils.js';function a5_0x29c3(){const _0x27ee84=['3583197gqLcjN','245910lwMVpd','file://','homedir','Skipping\x20invalid\x20directory:\x20','startsWith','uri','27RoNokG','13358uOkJxc','stat','36QTooIE','624534LflfQS','slice','96142pkFcQH','\x20due\x20to\x20error:\x20','push','message','202715bKhepA','2682160KjcadH','non-directory\x20root','isDirectory','Skipping\x20'];a5_0x29c3=function(){return _0x27ee84;};return a5_0x29c3();}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x120feb){const _0x131a2e=a5_0x4669;try{const _0x4f7363=_0x120feb[_0x131a2e(0x16e)](_0x131a2e(0x16b))?_0x120feb[_0x131a2e(0x175)](0x7):_0x120feb,_0x58bbee=_0x4f7363['startsWith']('~/')||_0x4f7363==='~'?a5_0x2acb68['join'](a5_0x14b95c[_0x131a2e(0x16c)](),_0x4f7363[_0x131a2e(0x175)](0x1)):_0x4f7363,_0x22ee0b=a5_0x2acb68['resolve'](_0x58bbee),_0x502e2a=await a5_0x209606['realpath'](_0x22ee0b);return normalizePath(_0x502e2a);}catch{return null;}}function formatDirectoryError(_0x20738d,_0x17ecab,_0x554bbe){const _0x3f61f0=a5_0x4669;if(_0x554bbe)return _0x3f61f0(0x17e)+_0x554bbe+':\x20'+_0x20738d;const _0xdd5c5b=_0x17ecab instanceof Error?_0x17ecab[_0x3f61f0(0x179)]:String(_0x17ecab);return _0x3f61f0(0x16d)+_0x20738d+_0x3f61f0(0x177)+_0xdd5c5b;}export async function getValidRootDirectories(_0x392db6){const _0x3ca68f=a5_0x4669,_0x1b4b72=[];for(const _0x41520a of _0x392db6){const _0x111fd7=await parseRootUri(_0x41520a['uri']);if(!_0x111fd7){logMcpStderr(formatDirectoryError(_0x41520a[_0x3ca68f(0x16f)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x1cb6ec=await a5_0x209606[_0x3ca68f(0x172)](_0x111fd7);_0x1cb6ec[_0x3ca68f(0x17d)]()?_0x1b4b72[_0x3ca68f(0x178)](_0x111fd7):logMcpStderr(formatDirectoryError(_0x111fd7,undefined,_0x3ca68f(0x17c)));}catch(_0x761331){logMcpStderr(formatDirectoryError(_0x111fd7,_0x761331));}}return _0x1b4b72;}
@@ -1 +1 @@
1
- function a6_0x514f(_0x4d3732,_0xb4f928){_0x4d3732=_0x4d3732-0x156;const _0x1a3afe=a6_0x1a3a();let _0x514f48=_0x1a3afe[_0x4d3732];return _0x514f48;}const a6_0x5ec5ff=a6_0x514f;(function(_0x5b6180,_0x4eec6e){const _0x32724f=a6_0x514f,_0x5cb185=_0x5b6180();while(!![]){try{const _0x40ac4c=parseInt(_0x32724f(0x15d))/0x1+parseInt(_0x32724f(0x15e))/0x2+parseInt(_0x32724f(0x158))/0x3+parseInt(_0x32724f(0x15a))/0x4*(parseInt(_0x32724f(0x15c))/0x5)+-parseInt(_0x32724f(0x15f))/0x6+-parseInt(_0x32724f(0x156))/0x7*(parseInt(_0x32724f(0x159))/0x8)+-parseInt(_0x32724f(0x15b))/0x9;if(_0x40ac4c===_0x4eec6e)break;else _0x5cb185['push'](_0x5cb185['shift']());}catch(_0x537f3e){_0x5cb185['push'](_0x5cb185['shift']());}}}(a6_0x1a3a,0x97f4d));export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':a6_0x5ec5ff(0x160),'GITHUB_CODEBASE_SEARCH':a6_0x5ec5ff(0x157)};function a6_0x1a3a(){const _0x8d4ae7=['7zHvSWs','github_codebase_search','1212399HTLUJQ','6204408ryhuWm','2629804gwuoOg','2348847lBKLxJ','5jnoKZC','498678nMpfJo','1297380MTSxwr','3300030oLIcel','codebase_search'];a6_0x1a3a=function(){return _0x8d4ae7;};return a6_0x1a3a();}export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ const a6_0x272bb6=a6_0x3f2f;(function(_0x24e3aa,_0x4e7375){const _0x2d646c=a6_0x3f2f,_0x259eb1=_0x24e3aa();while(!![]){try{const _0x410f81=-parseInt(_0x2d646c(0x18f))/0x1+parseInt(_0x2d646c(0x195))/0x2+parseInt(_0x2d646c(0x193))/0x3+parseInt(_0x2d646c(0x196))/0x4*(parseInt(_0x2d646c(0x18d))/0x5)+parseInt(_0x2d646c(0x198))/0x6+parseInt(_0x2d646c(0x191))/0x7+parseInt(_0x2d646c(0x190))/0x8*(-parseInt(_0x2d646c(0x192))/0x9);if(_0x410f81===_0x4e7375)break;else _0x259eb1['push'](_0x259eb1['shift']());}catch(_0x9d866){_0x259eb1['push'](_0x259eb1['shift']());}}}(a6_0x36b9,0x99a6a));export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':a6_0x272bb6(0x18e),'GITHUB_CODEBASE_SEARCH':a6_0x272bb6(0x197)};function a6_0x36b9(){const _0xc32c22=['705404OESDad','56360CSeMfg','2334934cZydpn','729GKdznc','1134804RJRCCr','values','956724RdeoZX','4jiPjLF','github_codebase_search','1983780IxvDol','1922905lSFpNp','codebase_search'];a6_0x36b9=function(){return _0xc32c22;};return a6_0x36b9();}export const ALL_TOOL_NAMES=Object[a6_0x272bb6(0x194)](TOOL_NAMES);function a6_0x3f2f(_0x3f8856,_0x3138b0){_0x3f8856=_0x3f8856-0x18d;const _0x36b9db=a6_0x36b9();let _0x3f2f6c=_0x36b9db[_0x3f8856];return _0x3f2f6c;}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.192",
3
+ "version": "0.8.194",
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.182",
38
+ "@morphllm/morphsdk": "0.2.184",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",