@morphllm/morphmcp 0.8.165 → 0.8.166

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_0x415e44=a0_0x1052;function a0_0x47df(){const _0x5dd144=['assistant','timed\x20out','Unknown\x20error','homedir','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','TimeoutError','trim','Here\x20is\x20the\x20content\x20of\x20files:\x0a','UnknownError','code_edit','unknown','env','oninitialized','isDirectory','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','catch','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','[github_codebase_search]\x20Failed\x20in\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','api_request_start','user','status','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','PWD','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','has','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','API\x20error\x20(auth/rate-limit)','10190640ZswQqT','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','--version','list_directory\x20','github_url','role','enum','-\x20Glob\x20search\x20`','dryRun','Workspace\x20mode\x20enabled:\x20Using\x20','linesAdded','Cargo.toml','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','every','edit_file','realpath','name','getClientCapabilities','api-key','.\x20Path:\x20','metadata','Rules:\x0a','map','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Invalid\x20arguments:\x20','Error\x20running\x20fast\x20context\x20search:\x20','go.mod','github_codebase_search','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','completed','floor','split','8692888Igzuev','default','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','tool_calls','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','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.','16JWVqHJ','basename','timings','WORKSPACE_ROOT','command','SubToolError','added\x20','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.','ReadError','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','substring','payload','GitHub\x20search\x20failed:\x20','startsWith','lines','params','grep\x20\x27','slice','unknown\x20error','File\x20read\x20error:','FileReadError','instructions','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','tsconfig.json','log','finish','boolean','tool_call_complete','branch','stat','path_validation_failed','parse','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','object','github_search_start','completionId','source','922705naWXwP','error','MORPH_WARP_GREP_TIMEOUT','success','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','access','MORPH_API_URL','dirname',',\x20modified\x20','readFile','Morph\x20Edit\x20Preview','instruction','search_string','runWarpGrep_call','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','read','context','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','linesModified','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','RipgrepNotAvailable','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','\x20\x20morph-mcp','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','messages','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.','match','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','https://morphllm.com/api/error-report','length','MORPH_LARGE_APPLY','stringify','.\x20Changes:\x20','content','\x22>\x0aError\x20reading\x20file:\x20','toLowerCase','Unknown\x20tool:\x20','Disabled\x20tools:\x20','ms:','-\x20Read\x20file\x20`','sk-','../package.json','Created\x20File','array','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','\x20error(s)','version','argv','arguments','read\x20','errors','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','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.','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','morph-','Fallback:\x20Using\x20workspace\x20root\x20','number','search_type','mcp-filesystem','resolve','text','etimedout','tool_call_error','WarpGrep\x20sub-tool\x20errors:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','application/json','owner_repo','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','isArray','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','timeout','roots','FileNotFound','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','❌\x20Morph\x20Edit\x20Failed:\x20','toISOString','\x0a...\x20(truncated,\x20total:\x20','sep','MORPH_API_KEY','Morph\x20Edit\x20','Error\x20accessing\x20directory\x20','response','debug','RipgrepError','path_validation_start','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','BinaryFile','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','262CmjPOG','safeParse','--help','SymlinkError','completed_with_file_errors','warn','<file\x20path=\x22','searchGitHub','MCP','\x0a</file>','requiresApiKey','[could\x20not\x20read\x20file:\x20','-\x20Grepped\x20\x27','code','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.','path','setRequestHandler','.vscode','push','ENABLE_WORKSPACE_MODE','Failed\x20to\x20request\x20roots\x20from\x20client:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','ENOENT','tool_call_id','glob\x20\x27','inputSchema','join','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Applied','warp_grep_start','pattern','setNotificationHandler','Warning:\x20','\x20is\x20not\x20a\x20directory','filter','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','compaction_failed','exit','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','list_directory','now','morph-v3-fast','listRoots','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','composer.json','`\x20in\x20`','0.2.0','optional','Fatal\x20error\x20running\x20server:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','24600BrvZHH','pyproject.toml','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Benefits:\x0a','linesRemoved','\x22.\x20Known\x20tools:\x20','string','description','some','files','For\x20deletions:\x0a','repo_path','terminationReason','function','file_read_complete','Tool\x20','data','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','normalize','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','codebase_search','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','--api-key=','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','grep_search','terminated','Specific\x20commit\x20hash\x20to\x20search','glob','constructor','Tool\x20\x22','Repository\x20identifier','node_modules','morph-v3-large','grep','utf-8','includes','--api-key','false','10085782upkddK','Preview\x20changes\x20without\x20applying\x20them.','ToolException','connect','stack','16761708akEyCo','min','\x0aOptions:','describe','path_validation_resolved','DISABLED_TOOLS','803447qWkFhG','morph-warp-grep-v2.1','Parent\x20directory\x20does\x20not\x20exist:\x20','message','cwd','\x20-\x20'];a0_0x47df=function(){return _0x5dd144;};return a0_0x47df();}(function(_0x2ef058,_0x3f276c){const _0x4ed1c3=a0_0x1052,_0x47f689=_0x2ef058();while(!![]){try{const _0x338caf=parseInt(_0x4ed1c3(0x1a6))/0x1+parseInt(_0x4ed1c3(0x142))/0x2*(-parseInt(_0x4ed1c3(0x175))/0x3)+-parseInt(_0x4ed1c3(0x1ef))/0x4*(-parseInt(_0x4ed1c3(0x214))/0x5)+-parseInt(_0x4ed1c3(0x1c9))/0x6+parseInt(_0x4ed1c3(0x19b))/0x7+-parseInt(_0x4ed1c3(0x1e9))/0x8+parseInt(_0x4ed1c3(0x1a0))/0x9;if(_0x338caf===_0x3f276c)break;else _0x47f689['push'](_0x47f689['shift']());}catch(_0x561e9d){_0x47f689['push'](_0x47f689['shift']());}}}(a0_0x47df,0xf09fe));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_0x5043e6 from'fs/promises';import a0_0x5053d5 from'path';import a0_0x192da8 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_0x2c9a83 from'axios';function fixPathRepetition(_0x2c225e){const _0x2f0f8b=a0_0x1052,_0x5962f9=_0x2c225e[_0x2f0f8b(0x1e8)](a0_0x5053d5[_0x2f0f8b(0x137)])[_0x2f0f8b(0x165)](Boolean);if(_0x5962f9[_0x2f0f8b(0x231)]<0x2)return null;for(let _0x5987a6=Math[_0x2f0f8b(0x1e7)](_0x5962f9['length']/0x2);_0x5987a6>=0x1;_0x5987a6--){for(let _0x285391=0x0;_0x285391<=_0x5962f9[_0x2f0f8b(0x231)]-0x2*_0x5987a6;_0x285391++){const _0x5d28c6=_0x5962f9[_0x2f0f8b(0x200)](_0x285391,_0x285391+_0x5987a6),_0x2500b0=_0x5962f9[_0x2f0f8b(0x200)](_0x285391+_0x5987a6,_0x285391+0x2*_0x5987a6);if(_0x5d28c6[_0x2f0f8b(0x1d6)]((_0x36d334,_0x8e5afe)=>_0x36d334===_0x2500b0[_0x8e5afe])){const _0xdfb6ef=[..._0x5962f9[_0x2f0f8b(0x200)](0x0,_0x285391),..._0x5962f9[_0x2f0f8b(0x200)](_0x285391+_0x5987a6)];return a0_0x5053d5[_0x2f0f8b(0x137)]+_0xdfb6ef[_0x2f0f8b(0x15c)](a0_0x5053d5[_0x2f0f8b(0x137)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x14dd23=a0_0x1052;try{const _0x2b1c48=require(_0x14dd23(0x23d));return _0x2b1c48[_0x14dd23(0x242)]??_0x14dd23(0x1b6);}catch(_0x2bcbd8){return logMcpStderr(_0x14dd23(0x205),_0x2bcbd8),_0x14dd23(0x1b6);}}function printHelp(){const _0x20ef8f=a0_0x1052;console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x20ef8f(0x207)](_0x20ef8f(0x13f)),console['log'](_0x20ef8f(0x1a2)),console['log'](_0x20ef8f(0x133)),console[_0x20ef8f(0x207)](_0x20ef8f(0x1b0)),console['log'](_0x20ef8f(0x12f)),console[_0x20ef8f(0x207)]('\x0aExamples:'),console[_0x20ef8f(0x207)](_0x20ef8f(0x22a)),console[_0x20ef8f(0x207)](_0x20ef8f(0x249));}const cliArgs=process[a0_0x415e44(0x243)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x415e44(0x1cb),'-v','-V']),HELP_FLAGS=new Set([a0_0x415e44(0x144),'-h']);function a0_0x1052(_0x5ce040,_0x3e13e5){_0x5ce040=_0x5ce040-0x126;const _0x47dfd4=a0_0x47df();let _0x1052d1=_0x47dfd4[_0x5ce040];return _0x1052d1;}cliArgs['some'](_0x3e9fec=>VERSION_FLAGS[a0_0x415e44(0x1c6)](_0x3e9fec))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x415e44(0x168)](0x0));cliArgs[a0_0x415e44(0x17d)](_0x50a00a=>HELP_FLAGS[a0_0x415e44(0x1c6)](_0x50a00a))&&(printHelp(),process[a0_0x415e44(0x168)](0x0));function getCliArg(_0x58953b){const _0x522523=a0_0x415e44;for(let _0xabb8cd=0x0;_0xabb8cd<cliArgs[_0x522523(0x231)];_0xabb8cd++){const _0x116ac1=cliArgs[_0xabb8cd];if(_0x116ac1[_0x522523(0x1fc)]('--'+_0x58953b+'='))return _0x116ac1[_0x522523(0x200)](('--'+_0x58953b+'=')[_0x522523(0x231)]);if(_0x116ac1==='--'+_0x58953b&&_0xabb8cd+0x1<cliArgs[_0x522523(0x231)])return cliArgs[_0xabb8cd+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x415e44(0x231)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x415e44(0x1c6)](arg)||HELP_FLAGS[a0_0x415e44(0x1c6)](arg))continue;if(arg[a0_0x415e44(0x1fc)](a0_0x415e44(0x18b)))continue;if(arg===a0_0x415e44(0x199)){i++;continue;}args[a0_0x415e44(0x154)](arg);}const WORKSPACE_ROOT=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x1f2)]||process[a0_0x415e44(0x1b7)][a0_0x415e44(0x1c4)]||process[a0_0x415e44(0x1aa)](),ENABLE_WORKSPACE_MODE=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x155)]!==a0_0x415e44(0x19a),MORPH_API_KEY=getCliArg(a0_0x415e44(0x1db))??process[a0_0x415e44(0x1b7)][a0_0x415e44(0x138)],MORPH_API_URL=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x21a)],MORPH_LARGE_APPLY=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x232)]!==a0_0x415e44(0x19a),MORPH_WARP_GREP_TIMEOUT=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x216)]?parseInt(process[a0_0x415e44(0x1b7)][a0_0x415e44(0x216)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x415e44(0x1d7),a0_0x415e44(0x189),a0_0x415e44(0x1e4)]),DEFAULT_DISABLED_TOOLS=new Set(['edit_file']),DISABLED_TOOLS=process['env'][a0_0x415e44(0x1a5)]?new Set(process[a0_0x415e44(0x1b7)]['DISABLED_TOOLS'][a0_0x415e44(0x1e8)](',')[a0_0x415e44(0x1df)](_0x470f66=>_0x470f66[a0_0x415e44(0x1b2)]())[a0_0x415e44(0x165)](_0x541c98=>_0x541c98[a0_0x415e44(0x231)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x415e44(0x1c6)](tool)&&console[a0_0x415e44(0x215)](a0_0x415e44(0x1c7)+tool+a0_0x415e44(0x17a)+[...KNOWN_TOOL_NAMES][a0_0x415e44(0x15c)](',\x20'));}console[a0_0x415e44(0x215)](a0_0x415e44(0x239)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x415e44(0x1fc)](a0_0x415e44(0x23c))&&!MORPH_API_KEY['startsWith'](a0_0x415e44(0x24a))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x3db515){const _0x26010f=a0_0x415e44;try{await a0_0x2c9a83['post'](_0x26010f(0x230),{..._0x3db515,'timestamp':new Date()[_0x26010f(0x135)](),'source':_0x3db515['source']||_0x26010f(0x24e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x3db515[_0x26010f(0x224)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x26010f(0x12b),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x487b9d,_0x108f95){const _0x47782d=a0_0x415e44;if(_0x487b9d&&typeof _0x487b9d===_0x47782d(0x210)&&_0x47782d(0x1c2)in _0x487b9d)return _0x487b9d['status'];if(_0x487b9d&&typeof _0x487b9d===_0x47782d(0x210)&&_0x47782d(0x13b)in _0x487b9d)return _0x487b9d[_0x47782d(0x13b)]?.['status'];const _0x2a62a1=_0x108f95[_0x47782d(0x22e)](/\b(401|429)\b/);return _0x2a62a1?parseInt(_0x2a62a1[0x1],0xa):null;}function handleMorphAPIError(_0x4ee477){const _0x57637e=a0_0x415e44,_0x479c83=_0x4ee477 instanceof Error?_0x4ee477[_0x57637e(0x1a9)]:String(_0x4ee477),_0x597fd3=extractStatusCode(_0x4ee477,_0x479c83);switch(_0x597fd3){case 0x191:return{'content':[{'type':'text','text':_0x57637e(0x150)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x57637e(0x126),'text':_0x57637e(0x1c3)}],'isError':!![]};default:return null;}}args[a0_0x415e44(0x231)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x415e44(0x1f8)),logMcpStderr(a0_0x415e44(0x225)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x415e44(0x1ed)),logMcpStderr(a0_0x415e44(0x18c)));function normalizePath(_0x458df4){const _0x16c6ee=a0_0x415e44;return a0_0x5053d5[_0x16c6ee(0x187)](_0x458df4);}function expandHome(_0x1aff37){const _0x5f4d1c=a0_0x415e44;if(_0x1aff37[_0x5f4d1c(0x1fc)]('~/')||_0x1aff37==='~')return a0_0x5053d5[_0x5f4d1c(0x15c)](a0_0x192da8[_0x5f4d1c(0x1af)](),_0x1aff37['slice'](0x1));return _0x1aff37;}let allowedDirectories=await Promise['all'](args['map'](async _0x2dab3a=>{const _0x4028b3=a0_0x415e44,_0x42843e=expandHome(_0x2dab3a),_0x11d8d9=a0_0x5053d5[_0x4028b3(0x24f)](_0x42843e);try{const _0x58ebfc=await a0_0x5043e6[_0x4028b3(0x1d8)](_0x11d8d9);return normalizePath(_0x58ebfc);}catch(_0x4a9031){return normalizePath(_0x11d8d9);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x415e44(0x1d2)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x186804){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x186804);}async function detectWorkspaceRoot(_0x746e1d){const _0x2e6c0d=a0_0x415e44;let _0x22286b=a0_0x5053d5['resolve'](_0x746e1d);const _0x514366=['.git',_0x2e6c0d(0x153),'package.json',_0x2e6c0d(0x1d4),_0x2e6c0d(0x176),_0x2e6c0d(0x1e3),'.cursor',_0x2e6c0d(0x206),_0x2e6c0d(0x16f)];while(_0x22286b!==a0_0x5053d5['dirname'](_0x22286b)){for(const _0x3eaa4e of _0x514366){const _0x18a63d=a0_0x5053d5['join'](_0x22286b,_0x3eaa4e);try{return await a0_0x5043e6[_0x2e6c0d(0x219)](_0x18a63d),normalizePath(_0x22286b);}catch{}}_0x22286b=a0_0x5053d5[_0x2e6c0d(0x21b)](_0x22286b);}return normalizePath(_0x746e1d);}await Promise['all'](args[a0_0x415e44(0x1df)](async _0x4dc292=>{const _0x55b2f0=a0_0x415e44;try{const _0xdf897c=await a0_0x5043e6[_0x55b2f0(0x20c)](expandHome(_0x4dc292));!_0xdf897c[_0x55b2f0(0x1b9)]()&&(logMcpStderr('Error:\x20'+_0x4dc292+_0x55b2f0(0x164)),process[_0x55b2f0(0x168)](0x1));}catch(_0x216186){logMcpStderr(_0x55b2f0(0x13a)+_0x4dc292+':',_0x216186),process[_0x55b2f0(0x168)](0x1);}}));async function validatePath(_0x11aa68){const _0x34280b=a0_0x415e44,_0x134e0=expandHome(_0x11aa68),_0x37c0b5=a0_0x5053d5[_0x34280b(0x24f)](_0x134e0);logger[_0x34280b(0x13c)](_0x34280b(0x14a),_0x34280b(0x13e),{'raw_path':_0x11aa68,'absolute':_0x37c0b5});try{const _0x4d9583=await a0_0x5043e6[_0x34280b(0x1d8)](_0x37c0b5);return logger['debug'](_0x34280b(0x14a),_0x34280b(0x1a4),{'resolved':_0x4d9583,'symlink':_0x4d9583!==_0x37c0b5}),_0x4d9583;}catch(_0x508f24){if(_0x508f24[_0x34280b(0x14f)]==='ENOENT'){const _0x4ed7a9=a0_0x5053d5[_0x34280b(0x21b)](_0x37c0b5);try{const _0xd2b024=await a0_0x5043e6['realpath'](_0x4ed7a9),_0x17d1a7=a0_0x5053d5['join'](_0xd2b024,a0_0x5053d5[_0x34280b(0x1f0)](_0x37c0b5));return logger[_0x34280b(0x13c)](_0x34280b(0x14a),'path_validation_resolved',{'resolved':_0x17d1a7,'new_file':!![]}),_0x17d1a7;}catch{logger[_0x34280b(0x215)](_0x34280b(0x14a),_0x34280b(0x20d),{'raw_path':_0x11aa68,'error':_0x34280b(0x1a8)+_0x4ed7a9});throw new Error(_0x34280b(0x1a8)+_0x4ed7a9);}}logger[_0x34280b(0x215)]('MCP',_0x34280b(0x20d),{'raw_path':_0x11aa68,'error':_0x508f24[_0x34280b(0x1a9)]});throw _0x508f24;}}const MorphEditFileArgsSchema=z[a0_0x415e44(0x210)]({'path':z[a0_0x415e44(0x17b)](),'code_edit':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x141)),'instruction':z['string']()[a0_0x415e44(0x1a3)](a0_0x415e44(0x22f)),'dryRun':z[a0_0x415e44(0x209)]()[a0_0x415e44(0x1ea)](![])['describe'](a0_0x415e44(0x19c))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x415e44(0x248),WarpGrepArgsSchema=z[a0_0x415e44(0x210)]({'search_string':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x415e44(0x17b)]()['describe'](a0_0x415e44(0x229)),'search_type':z[a0_0x415e44(0x1cf)](['default',a0_0x415e44(0x194)])['optional']()[a0_0x415e44(0x1a3)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()[a0_0x415e44(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x1f6)),'owner_repo':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x12a)),'branch':z['string']()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x166))}),CodebaseSearchArgsSchema=z[a0_0x415e44(0x210)]({'query':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x193)),'branch':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x18f)),'targetDirectories':z[a0_0x415e44(0x23f)](z[a0_0x415e44(0x17b)]())[a0_0x415e44(0x1ea)]([])[a0_0x415e44(0x1a3)](a0_0x415e44(0x1e5)),'limit':z[a0_0x415e44(0x24c)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1ea)](0xa)[a0_0x415e44(0x1a3)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x415e44(0x171)},{'capabilities':{'tools':{}}});server[a0_0x415e44(0x152)](ListToolsRequestSchema,async()=>{const _0x396b05=a0_0x415e44,_0x1cad55=[{'name':_0x396b05(0x1d7),'description':_0x396b05(0x12d)+_0x396b05(0x1d5)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x396b05(0x1eb)+_0x396b05(0x178)+_0x396b05(0x169)+_0x396b05(0x218)+_0x396b05(0x186)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x396b05(0x1bc)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x396b05(0x17f)+_0x396b05(0x15d)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x396b05(0x1de)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x396b05(0x247)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x396b05(0x240),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x396b05(0x189),'description':_0x396b05(0x20f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x396b05(0x22b)+_0x396b05(0x188)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x289aaf=_0x1cad55[_0x396b05(0x165)](_0x1c31d0=>{const _0x48343d=_0x396b05;if(DISABLED_TOOLS['has'](_0x1c31d0[_0x48343d(0x1d9)]))return console[_0x48343d(0x215)](_0x48343d(0x184)+_0x1c31d0['name']+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if('requiresApiKey'in _0x1c31d0&&_0x1c31d0[_0x48343d(0x14c)]&&!MORPH_API_KEY)return logMcpStderr(_0x48343d(0x163)+_0x1c31d0['name']+_0x48343d(0x222)),![];return!![];});return{'tools':_0x289aaf[_0x396b05(0x1df)](_0x58a888=>({'name':_0x58a888[_0x396b05(0x1d9)],'description':_0x58a888[_0x396b05(0x17c)],'inputSchema':_0x58a888[_0x396b05(0x15b)]}))};}),server[a0_0x415e44(0x152)](CallToolRequestSchema,async _0x480115=>{const _0x3d0ec9=a0_0x415e44,{name:_0x406c0b,arguments:_0x4f30d9}=_0x480115[_0x3d0ec9(0x1fe)],_0x3124bb=Date[_0x3d0ec9(0x16b)]();logger[_0x3d0ec9(0x13c)]('MCP','tool_call_received',{'tool':_0x406c0b,'args':_0x406c0b===_0x3d0ec9(0x1d7)?{'path':_0x4f30d9?.['path'],'instruction':_0x4f30d9?.['instruction']||_0x4f30d9?.['instructions'],'dryRun':_0x4f30d9?.[_0x3d0ec9(0x1d1)]}:_0x4f30d9});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':'No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.'}],'isError':!![]};if(!MORPH_API_KEY[_0x3d0ec9(0x1fc)]('sk-')&&!MORPH_API_KEY[_0x3d0ec9(0x1fc)]('morph-'))return{'content':[{'type':'text','text':_0x3d0ec9(0x1ee)}],'isError':!![]};if(DISABLED_TOOLS[_0x3d0ec9(0x1c6)](_0x406c0b))return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x192)+_0x406c0b+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x406c0b){case'edit_file':{const _0x45182f=_0x4f30d9&&typeof _0x4f30d9===_0x3d0ec9(0x210)&&_0x3d0ec9(0x204)in _0x4f30d9&&!(_0x3d0ec9(0x21f)in _0x4f30d9)?{..._0x4f30d9,'instruction':_0x4f30d9[_0x3d0ec9(0x204)],'instructions':undefined}:_0x4f30d9,_0x37bed7=MorphEditFileArgsSchema[_0x3d0ec9(0x143)](_0x45182f);if(!_0x37bed7[_0x3d0ec9(0x217)])throw new Error(_0x3d0ec9(0x227)+_0x37bed7[_0x3d0ec9(0x215)]);const _0x27f3fe=await validatePath(_0x37bed7['data'][_0x3d0ec9(0x151)]);let _0x57579e=null,_0x2eaf37=!![],_0x3b2cda=null;try{_0x57579e=await a0_0x5043e6[_0x3d0ec9(0x21d)](_0x27f3fe,_0x3d0ec9(0x197)),logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x183),{'path':_0x27f3fe,'size_bytes':_0x57579e['length']});}catch(_0x331ea6){const _0x2ee86a=_0x331ea6[_0x3d0ec9(0x14f)];_0x2ee86a===_0x3d0ec9(0x158)?(_0x2eaf37=![],_0x57579e='',logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x183),{'path':_0x27f3fe,'exists':![]})):(_0x3b2cda='Failed\x20to\x20read\x20file:\x20'+(_0x2ee86a||'unknown')+_0x3d0ec9(0x1ab)+(_0x331ea6 instanceof Error?_0x331ea6[_0x3d0ec9(0x1a9)]:String(_0x331ea6)),logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),'file_read_failed',{'path':_0x27f3fe,'error':_0x3b2cda}),logMcpStderr(_0x3d0ec9(0x163)+_0x3b2cda));}let _0x1402cd;try{const _0x803515=MORPH_API_KEY;if(!_0x803515)throw new Error(_0x3d0ec9(0x1e0));const _0x3c1a4b=a0_0x5053d5[_0x3d0ec9(0x21b)](_0x27f3fe),_0x5b66e0=a0_0x5053d5[_0x3d0ec9(0x1f0)](_0x27f3fe);logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x1c0),{'model':_0x3d0ec9(0x16c),'path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'instruction_len':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x21f)][_0x3d0ec9(0x231)],'code_edit_len':_0x37bed7['data']['code_edit'][_0x3d0ec9(0x231)],'original_code_len':_0x57579e?.['length']??0x0,'dry_run':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)]});const _0x229167=Date['now'](),_0x29696b=await executeEditFile({'target_filepath':_0x5b66e0,'code_edit':_0x37bed7['data'][_0x3d0ec9(0x1b5)],'instruction':_0x37bed7[_0x3d0ec9(0x185)]['instruction']},{'morphApiKey':_0x803515,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x3c1a4b,'autoWrite':!_0x37bed7[_0x3d0ec9(0x185)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x75bdbc=Date[_0x3d0ec9(0x16b)]()-_0x229167;_0x1402cd=_0x29696b[_0x3d0ec9(0x212)];if(!_0x29696b[_0x3d0ec9(0x217)])throw new Error(_0x29696b['error']||_0x3d0ec9(0x15e));const _0x138103=_0x29696b['changes'],_0x3aeaf4=_0x3d0ec9(0x1f5)+_0x138103['linesAdded']+',\x20removed\x20'+_0x138103[_0x3d0ec9(0x179)]+_0x3d0ec9(0x21c)+_0x138103[_0x3d0ec9(0x226)];logger['debug'](_0x3d0ec9(0x14a),_0x3d0ec9(0x20a),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb,'edit_latency_ms':_0x75bdbc,'changes':{'added':_0x138103[_0x3d0ec9(0x1d3)],'removed':_0x138103[_0x3d0ec9(0x179)],'modified':_0x138103[_0x3d0ec9(0x226)]},'completion_id':_0x1402cd});if(_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)])return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x21e)+(_0x2eaf37?'':'\x20(new\x20file)')+':\x20'+_0x37bed7['data']['instruction']+_0x3d0ec9(0x234)+_0x3aeaf4+_0x3d0ec9(0x1dc)+_0x37bed7[_0x3d0ec9(0x185)]['path']+'.'}]};return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x139)+(_0x2eaf37?_0x3d0ec9(0x15f):_0x3d0ec9(0x23e))+':\x20'+_0x37bed7['data'][_0x3d0ec9(0x21f)]+_0x3d0ec9(0x234)+_0x3aeaf4+'.\x20Path:\x20'+_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)]+'.'}]};}catch(_0x101588){const _0x2039fb=handleMorphAPIError(_0x101588);if(_0x2039fb)return logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),_0x3d0ec9(0x128),{'tool':_0x3d0ec9(0x1d7),'error':_0x3d0ec9(0x1c8),'latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb}),_0x2039fb;const _0x12f78a=_0x101588 instanceof Error?_0x101588[_0x3d0ec9(0x1a9)]:String(_0x101588);return logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),_0x3d0ec9(0x128),{'tool':_0x3d0ec9(0x1d7),'error':_0x12f78a,'path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'validated_path':_0x27f3fe,'latency_ms':Date['now']()-_0x3124bb,'stack':_0x101588 instanceof Error?_0x101588[_0x3d0ec9(0x19f)]:undefined}),reportMorphError({'error_message':_0x12f78a,'error_type':_0x101588 instanceof Error?_0x101588[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:'UnknownError','context':{'tool':'edit_file','completion_id':_0x1402cd,'file_path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'validated_path':_0x27f3fe,'instruction':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x21f)],'model':MORPH_LARGE_APPLY?_0x3d0ec9(0x195):'morph-v3-fast','dry_run':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)],'file_exists':_0x2eaf37,'file_read_error':_0x3b2cda,'file_readable':_0x57579e!==null,'request_content':{'path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'code_edit':_0x37bed7[_0x3d0ec9(0x185)]['code_edit'],'instruction':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x21f)],'original_code':_0x57579e!==null?_0x57579e[_0x3d0ec9(0x231)]>0xc350?_0x57579e[_0x3d0ec9(0x1f9)](0x0,0xc350)+_0x3d0ec9(0x136)+_0x57579e[_0x3d0ec9(0x231)]+'\x20chars)':_0x57579e:_0x3d0ec9(0x14d)+(_0x3b2cda||_0x3d0ec9(0x201))+']','original_code_length':_0x57579e?.[_0x3d0ec9(0x231)]??0x0,'model':MORPH_LARGE_APPLY?_0x3d0ec9(0x195):'morph-v3-fast','dry_run':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)]}},'stack_trace':_0x101588 instanceof Error?_0x101588['stack']:undefined,'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x134)+_0x12f78a}],'isError':!![]};}}case _0x3d0ec9(0x189):{const _0x4d950d=WarpGrepArgsSchema['safeParse'](_0x4f30d9);if(!_0x4d950d[_0x3d0ec9(0x217)])return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1e1)+_0x4d950d['error']}],'isError':!![]};const _0x3318d3=_0x2d8c18=>{const _0x2e15c3=_0x3d0ec9,_0x559329=[];for(const _0x4fad64 of _0x2d8c18||[]){if(_0x4fad64[_0x2e15c3(0x1ce)]==='assistant'&&Array[_0x2e15c3(0x12e)](_0x4fad64['tool_calls']))for(const _0x44df38 of _0x4fad64[_0x2e15c3(0x1ec)]){try{const _0x19869e=_0x44df38['function']?.[_0x2e15c3(0x1d9)],_0x638af1=JSON[_0x2e15c3(0x20e)](_0x44df38[_0x2e15c3(0x182)]?.[_0x2e15c3(0x244)]||'{}');if(_0x19869e===_0x2e15c3(0x18d))_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x1ff)+_0x638af1[_0x2e15c3(0x161)]+'\x27\x20'+(_0x638af1[_0x2e15c3(0x151)]||'.'));else{if(_0x19869e===_0x2e15c3(0x223))_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x245)+_0x638af1['path']);else{if(_0x19869e===_0x2e15c3(0x16a))_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x1cc)+(_0x638af1[_0x2e15c3(0x1f3)]||'.'));else{if(_0x19869e==='glob')_0x559329['push'](_0x2e15c3(0x15a)+_0x638af1[_0x2e15c3(0x161)]+'\x27\x20'+(_0x638af1[_0x2e15c3(0x151)]||'.'));else _0x19869e===_0x2e15c3(0x208)&&_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x208));}}}}catch{}}}return _0x559329;},_0x55a272=_0x106bec=>{const _0x33a621=_0x3d0ec9,_0x19bc5a=[];if(!_0x106bec||!Array[_0x33a621(0x12e)](_0x106bec))return _0x19bc5a;const _0x52c8cb=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x33a621(0x132),'tool':_0x33a621(0x223)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x33a621(0x223)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x33a621(0x223)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x33a621(0x140),'tool':_0x33a621(0x223)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x33a621(0x13d),'tool':_0x33a621(0x196)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x33a621(0x228),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x33a621(0x140),'tool':_0x33a621(0x223)},{'pattern':/\[SYMLINK\]/,'error_type':_0x33a621(0x145),'tool':_0x33a621(0x223)},{'pattern':/not a text file/,'error_type':_0x33a621(0x140),'tool':_0x33a621(0x223)},{'pattern':/symbolic link/,'error_type':_0x33a621(0x145),'tool':_0x33a621(0x223)},{'pattern':/Error reading file:/,'error_type':_0x33a621(0x1f7),'tool':_0x33a621(0x223)},{'pattern':/status="error"/,'error_type':_0x33a621(0x19d),'tool':_0x33a621(0x1b6)}];let _0x203572=0x0;for(const _0x418a2b of _0x106bec){_0x418a2b[_0x33a621(0x1ce)]===_0x33a621(0x1ac)&&Array[_0x33a621(0x12e)](_0x418a2b[_0x33a621(0x1ec)])&&_0x203572++;const _0x875e78=_0x418a2b[_0x33a621(0x235)];if((_0x418a2b[_0x33a621(0x1ce)]==='tool'||_0x418a2b['role']===_0x33a621(0x1c1))&&_0x875e78&&typeof _0x875e78==='string')for(const {pattern:_0x51486b,error_type:_0xe5d755,tool:_0x3e8bad}of _0x52c8cb){const _0x35bd31=_0x875e78[_0x33a621(0x22e)](new RegExp(_0x51486b[_0x33a621(0x213)],'g'));if(_0x35bd31)for(const _0x582981 of _0x35bd31){const _0x3f7bda=_0x875e78['indexOf'](_0x582981),_0x40d519=_0x875e78[_0x33a621(0x1f9)](_0x3f7bda,Math[_0x33a621(0x1a1)](_0x3f7bda+0xc8,_0x875e78[_0x33a621(0x231)]));_0x19bc5a['push']({'tool':_0x3e8bad,'error_type':_0xe5d755,'error_message':_0x40d519[_0x33a621(0x1e8)]('\x0a')[0x0],'turn':_0x203572});}}}return _0x19bc5a;};try{const _0x235771=a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)]),_0x31d763=_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x24d)],_0x58e9d6=_0x31d763===_0x3d0ec9(0x194)?{'allowNames':['node_modules']}:undefined,_0x352deb=new LocalRipgrepProvider(_0x235771,undefined,_0x58e9d6);logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),'provider_created',{'type':'LocalRipgrepProvider','repo_root':_0x235771,'search_type':_0x31d763||_0x3d0ec9(0x1ea)}),logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x160),{'query':_0x4d950d['data'][_0x3d0ec9(0x220)],'repo_root':_0x235771,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x389dba=Date[_0x3d0ec9(0x16b)](),_0x41cedf=await runWarpGrep({'searchTerm':_0x4d950d['data'][_0x3d0ec9(0x220)],'repoRoot':_0x235771,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x352deb,'search_type':_0x31d763}),_0x4e87fd=Date['now']()-_0x389dba,_0x10d189=_0x41cedf[_0x3d0ec9(0x208)]?.[_0x3d0ec9(0x1dd)]?.[_0x3d0ec9(0x17e)]?.[_0x3d0ec9(0x231)]??0x0;logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),'warp_grep_complete',{'termination':_0x41cedf[_0x3d0ec9(0x181)],'turns':_0x41cedf[_0x3d0ec9(0x1f1)]?.['turns']??0x0,'files_found':_0x10d189,'latency_ms':_0x4e87fd});const _0x27300d=_0x55a272(_0x41cedf[_0x3d0ec9(0x22c)]);_0x27300d[_0x3d0ec9(0x231)]>0x0&&reportMorphError({'error_message':_0x3d0ec9(0x129)+_0x27300d['length']+_0x3d0ec9(0x241),'error_type':_0x3d0ec9(0x1f4),'level':_0x3d0ec9(0x147),'tool':_0x3d0ec9(0x189),'context':{'repo_path':_0x4d950d[_0x3d0ec9(0x185)]['repo_path'],'query':_0x4d950d['data']['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x41cedf[_0x3d0ec9(0x181)],'sub_tool_errors':_0x27300d,'timings':_0x41cedf[_0x3d0ec9(0x1f1)],'tool_calls':_0x3318d3(_0x41cedf[_0x3d0ec9(0x22c)]),'messages':_0x41cedf[_0x3d0ec9(0x22c)]?.['map'](_0x59364b=>({'role':_0x59364b[_0x3d0ec9(0x1ce)],'content':_0x59364b[_0x3d0ec9(0x235)],..._0x59364b['tool_calls']?{'tool_calls':_0x59364b[_0x3d0ec9(0x1ec)]['length']}:{},..._0x59364b[_0x3d0ec9(0x159)]?{'tool_call_id':_0x59364b[_0x3d0ec9(0x159)]}:{}}))},'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{});let _0x4e82ad='';if(_0x41cedf['terminationReason']===_0x3d0ec9(0x1e6)&&_0x41cedf[_0x3d0ec9(0x208)]?.[_0x3d0ec9(0x1dd)]?.[_0x3d0ec9(0x17e)]){const _0x24f17f=_0x41cedf[_0x3d0ec9(0x208)][_0x3d0ec9(0x1dd)][_0x3d0ec9(0x17e)];if(_0x24f17f[_0x3d0ec9(0x231)]===0x0)return _0x4e82ad=_0x41cedf[_0x3d0ec9(0x208)][_0x3d0ec9(0x1fa)]||_0x3d0ec9(0x177),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x4e82ad}]};const _0x3db54e=[],_0x40c012=[_0x3d0ec9(0x1ca)];for(const _0x376401 of _0x41cedf[_0x3d0ec9(0x22c)]){if(_0x376401[_0x3d0ec9(0x1ce)]===_0x3d0ec9(0x1ac)&&Array[_0x3d0ec9(0x12e)](_0x376401[_0x3d0ec9(0x1ec)]))for(const _0x8fbd8a of _0x376401['tool_calls']){try{const _0x10206e=_0x8fbd8a[_0x3d0ec9(0x182)]?.[_0x3d0ec9(0x1d9)],_0x38faf5=JSON[_0x3d0ec9(0x20e)](_0x8fbd8a[_0x3d0ec9(0x182)]?.[_0x3d0ec9(0x244)]||'{}');if(_0x10206e===_0x3d0ec9(0x18d))_0x40c012[_0x3d0ec9(0x154)](_0x3d0ec9(0x14e)+_0x38faf5['pattern']+'\x27\x20in\x20`'+(_0x38faf5[_0x3d0ec9(0x151)]||'.')+'`');else{if(_0x10206e==='read')_0x40c012[_0x3d0ec9(0x154)](_0x3d0ec9(0x23b)+_0x38faf5[_0x3d0ec9(0x151)]+'`');else{if(_0x10206e==='list_directory')_0x40c012[_0x3d0ec9(0x154)]('-\x20Listed\x20directory\x20`'+(_0x38faf5[_0x3d0ec9(0x1f3)]||'.')+'`');else _0x10206e===_0x3d0ec9(0x190)&&_0x40c012[_0x3d0ec9(0x154)](_0x3d0ec9(0x1d0)+_0x38faf5['pattern']+_0x3d0ec9(0x170)+(_0x38faf5[_0x3d0ec9(0x151)]||'.')+'`');}}}catch{}}}_0x3db54e[_0x3d0ec9(0x154)](_0x40c012['join']('\x0a'));const _0x2c60a1=['','Relevant\x20context\x20found:'];for(const _0x56a83a of _0x24f17f){if(_0x56a83a[_0x3d0ec9(0x1fd)]==='*')_0x2c60a1[_0x3d0ec9(0x154)]('-\x20'+_0x56a83a[_0x3d0ec9(0x151)]+':*');else{if(Array[_0x3d0ec9(0x12e)](_0x56a83a[_0x3d0ec9(0x1fd)])){const _0x47eccc=_0x56a83a[_0x3d0ec9(0x1fd)]['map'](([_0x1a00b4,_0xb6924d])=>{if(_0x1a00b4===_0xb6924d)return''+_0x1a00b4;return _0x1a00b4+'-'+_0xb6924d;});_0x2c60a1['push']('-\x20'+_0x56a83a[_0x3d0ec9(0x151)]+':'+_0x47eccc['join'](','));}else _0x2c60a1[_0x3d0ec9(0x154)]('-\x20'+_0x56a83a[_0x3d0ec9(0x151)]+':*');}}_0x2c60a1[_0x3d0ec9(0x154)](''),_0x3db54e[_0x3d0ec9(0x154)](_0x2c60a1[_0x3d0ec9(0x15c)]('\x0a')),_0x3db54e[_0x3d0ec9(0x154)](_0x3d0ec9(0x1b3));const _0x5db25a=[],_0x5e6255=[];for(const _0x52329e of _0x24f17f){let _0x52b7f7=a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)],_0x52329e[_0x3d0ec9(0x151)]),_0x2be325=null,_0x4c0310=null;try{_0x2be325=await a0_0x5043e6['readFile'](_0x52b7f7,{'encoding':_0x3d0ec9(0x197)});}catch(_0x269763){const _0x4e16b9=fixPathRepetition(_0x52b7f7);if(_0x4e16b9)try{_0x2be325=await a0_0x5043e6[_0x3d0ec9(0x21d)](_0x4e16b9,{'encoding':_0x3d0ec9(0x197)}),_0x52b7f7=_0x4e16b9;}catch{_0x4c0310=_0x269763 instanceof Error?_0x269763:new Error(String(_0x269763));}else _0x4c0310=_0x269763 instanceof Error?_0x269763:new Error(String(_0x269763));}if(_0x2be325!==null){const _0x4fb047=_0x2be325[_0x3d0ec9(0x1e8)](/\r?\n/),_0x4dd74c=[];if(_0x52329e[_0x3d0ec9(0x1fd)]==='*'||!Array['isArray'](_0x52329e[_0x3d0ec9(0x1fd)]))for(let _0x39f744=0x1;_0x39f744<=_0x4fb047['length'];_0x39f744++){const _0x270238=_0x4fb047[_0x39f744-0x1];_0x4dd74c[_0x3d0ec9(0x154)](_0x39f744+'|\x20'+_0x270238);}else for(const [_0x3be264,_0x257d10]of _0x52329e[_0x3d0ec9(0x1fd)]){_0x4dd74c['length']>0x0&&_0x4dd74c[_0x3d0ec9(0x154)]('');for(let _0x4326e7=_0x3be264;_0x4326e7<=_0x257d10&&_0x4326e7<=_0x4fb047[_0x3d0ec9(0x231)];_0x4326e7++){const _0x3840af=_0x4fb047[_0x4326e7-0x1];_0x4dd74c[_0x3d0ec9(0x154)](_0x4326e7+'|\x20'+_0x3840af);}}_0x5e6255[_0x3d0ec9(0x154)]({'path':_0x52329e[_0x3d0ec9(0x151)],'content':_0x4dd74c[_0x3d0ec9(0x15c)]('\x0a')});}else _0x5db25a[_0x3d0ec9(0x154)](_0x3d0ec9(0x148)+_0x52329e['path']+_0x3d0ec9(0x236)+(_0x4c0310?.[_0x3d0ec9(0x1a9)]||_0x3d0ec9(0x1ae))+'\x0a</file>');}try{const _0x642728=await compactFileContexts(_0x5e6255,_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],MORPH_API_KEY,MORPH_API_URL);for(const _0xb0c3a6 of _0x642728){_0x5db25a[_0x3d0ec9(0x154)](_0x3d0ec9(0x148)+_0xb0c3a6['path']+'\x22>\x0a'+_0xb0c3a6[_0x3d0ec9(0x235)]+_0x3d0ec9(0x14b));}}catch(_0x17c107){logger[_0x3d0ec9(0x147)](_0x3d0ec9(0x14a),_0x3d0ec9(0x167),{'error':_0x17c107 instanceof Error?_0x17c107[_0x3d0ec9(0x1a9)]:String(_0x17c107),'files_count':_0x5e6255[_0x3d0ec9(0x231)]});for(const _0x495827 of _0x5e6255){_0x5db25a['push'](_0x3d0ec9(0x148)+_0x495827[_0x3d0ec9(0x151)]+'\x22>\x0a'+_0x495827[_0x3d0ec9(0x235)]+_0x3d0ec9(0x14b));}}_0x3db54e['push'](_0x5db25a[_0x3d0ec9(0x15c)]('\x0a\x0a')),_0x4e82ad=_0x3db54e[_0x3d0ec9(0x15c)]('\x0a');const _0x1893d4=_0x41cedf[_0x3d0ec9(0x246)]?.['filter'](_0x4d0895=>_0x4d0895[_0x3d0ec9(0x1a9)]?.[_0x3d0ec9(0x1fc)](_0x3d0ec9(0x202)))||[];if(_0x1893d4[_0x3d0ec9(0x231)]>0x0){const _0x45b3e4=_0x1893d4[_0x3d0ec9(0x1df)](_0x529db7=>_0x529db7[_0x3d0ec9(0x1a9)])[_0x3d0ec9(0x15c)](';\x20');reportMorphError({'error_message':_0x45b3e4,'error_type':_0x3d0ec9(0x203),'context':{'tool':_0x3d0ec9(0x189),'repo_path':_0x4d950d['data'][_0x3d0ec9(0x180)],'query':_0x4d950d['data'][_0x3d0ec9(0x220)],'model':'morph-warp-grep-v2.1','termination_reason':_0x3d0ec9(0x146),'error_count':_0x1893d4[_0x3d0ec9(0x231)],'is_timeout':![],'timings':_0x41cedf[_0x3d0ec9(0x1f1)],'files_attempted':_0x24f17f[_0x3d0ec9(0x1df)](_0x5747de=>({'path':_0x5747de[_0x3d0ec9(0x151)],'lines':_0x5747de[_0x3d0ec9(0x1fd)]})),'tool_calls':_0x3318d3(_0x41cedf['messages']),'messages':_0x41cedf[_0x3d0ec9(0x22c)]?.[_0x3d0ec9(0x1df)](_0x4b536d=>({'role':_0x4b536d['role'],'content':_0x4b536d[_0x3d0ec9(0x235)],..._0x4b536d['tool_calls']?{'tool_calls':_0x4b536d['tool_calls']['length']}:{},..._0x4b536d[_0x3d0ec9(0x159)]?{'tool_call_id':_0x4b536d[_0x3d0ec9(0x159)]}:{}})),'request_content':{'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'repo_path':_0x4d950d[_0x3d0ec9(0x185)]['repo_path'],'repoRoot':a0_0x5053d5['resolve'](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)]),'model':_0x3d0ec9(0x1a7)}},'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{});}}else{if(_0x41cedf[_0x3d0ec9(0x181)]===_0x3d0ec9(0x18e)&&_0x41cedf[_0x3d0ec9(0x246)]['length']>0x0){const _0x4080ac=_0x41cedf[_0x3d0ec9(0x246)][_0x3d0ec9(0x1df)](_0x12c835=>_0x12c835[_0x3d0ec9(0x1a9)])[_0x3d0ec9(0x15c)](';\x20');_0x4e82ad='Error:\x20'+_0x4080ac;const _0x10bf92=_0x4080ac[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x130))||_0x4080ac[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)]('timed\x20out')||_0x4080ac[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x127)),_0x3226ac=_0x41cedf[_0x3d0ec9(0x208)]?.[_0x3d0ec9(0x1dd)]?.[_0x3d0ec9(0x17e)],_0x36028c=_0x41cedf['errors'][0x0];reportMorphError({'error_message':_0x4080ac,'error_type':_0x10bf92?_0x3d0ec9(0x1b1):_0x36028c?.[_0x3d0ec9(0x191)]?.[_0x3d0ec9(0x1d9)]||'WarpGrepError','context':{'tool':'codebase_search','repo_path':_0x4d950d[_0x3d0ec9(0x185)]['repo_path'],'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'model':_0x3d0ec9(0x1a7),'termination_reason':_0x41cedf[_0x3d0ec9(0x181)],'error_count':_0x41cedf[_0x3d0ec9(0x246)][_0x3d0ec9(0x231)],'is_timeout':_0x10bf92,'timings':_0x41cedf[_0x3d0ec9(0x1f1)],'files_attempted':_0x3226ac?.['map'](_0x5288fe=>({'path':_0x5288fe[_0x3d0ec9(0x151)],'lines':_0x5288fe[_0x3d0ec9(0x1fd)]})),'tool_calls':_0x3318d3(_0x41cedf[_0x3d0ec9(0x22c)]),'messages':_0x41cedf[_0x3d0ec9(0x22c)]?.[_0x3d0ec9(0x1df)](_0x5eaf4a=>({'role':_0x5eaf4a[_0x3d0ec9(0x1ce)],'content':_0x5eaf4a[_0x3d0ec9(0x235)],..._0x5eaf4a[_0x3d0ec9(0x1ec)]?{'tool_calls':_0x5eaf4a[_0x3d0ec9(0x1ec)][_0x3d0ec9(0x231)]}:{},..._0x5eaf4a[_0x3d0ec9(0x159)]?{'tool_call_id':_0x5eaf4a[_0x3d0ec9(0x159)]}:{}})),'request_content':{'query':_0x4d950d[_0x3d0ec9(0x185)]['search_string'],'repo_path':_0x4d950d['data']['repo_path'],'repoRoot':a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)]),'model':_0x3d0ec9(0x1a7)}},'stack_trace':_0x36028c?.[_0x3d0ec9(0x19f)]||undefined,'source':_0x3d0ec9(0x24e)})['catch'](()=>{});}else _0x4e82ad='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x4e82ad}]};}catch(_0x485396){const _0xadd2ef=handleMorphAPIError(_0x485396);if(_0xadd2ef)return logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),_0x3d0ec9(0x128),{'tool':'codebase_search','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb}),_0xadd2ef;const _0xef5905=_0x485396 instanceof Error?_0x485396[_0x3d0ec9(0x1a9)]:String(_0x485396);logger[_0x3d0ec9(0x215)]('MCP',_0x3d0ec9(0x128),{'tool':_0x3d0ec9(0x189),'error':_0xef5905,'repo_path':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)],'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb});const _0x2f68f8=_0xef5905[_0x3d0ec9(0x237)]()['includes'](_0x3d0ec9(0x130))||_0xef5905[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x1ad))||_0xef5905[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x127))||_0x485396 instanceof Error&&_0x485396[_0x3d0ec9(0x1d9)]===_0x3d0ec9(0x1b1);return reportMorphError({'error_message':_0xef5905,'error_type':_0x2f68f8?'TimeoutError':_0x485396 instanceof Error?_0x485396[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:_0x3d0ec9(0x1b4),'context':{'tool':_0x3d0ec9(0x189),'repo_path':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)],'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'model':_0x3d0ec9(0x1a7),'is_timeout':_0x2f68f8,'exception_phase':_0x3d0ec9(0x221),'request_content':{'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'repo_path':_0x4d950d['data'][_0x3d0ec9(0x180)],'repoRoot':a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)]['repo_path']),'model':_0x3d0ec9(0x1a7)}},'stack_trace':_0x485396 instanceof Error?_0x485396[_0x3d0ec9(0x19f)]:undefined,'source':'mcp-filesystem'})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1e2)+_0xef5905}],'isError':![]};}}case'github_codebase_search':{const _0x26052e=WarpGrepGitHubArgsSchema[_0x3d0ec9(0x143)](_0x4f30d9);if(!_0x26052e[_0x3d0ec9(0x217)])return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1e1)+_0x26052e['error']}],'isError':!![]};const _0x58b323=_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x1cd)]||_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x12c)];if(!_0x58b323)return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1bd)}],'isError':!![]};const _0x14ddf4=MORPH_API_KEY;if(!_0x14ddf4)throw new Error(_0x3d0ec9(0x1e0));const _0x1b2a5e=Date[_0x3d0ec9(0x16b)]();logger['debug']('MCP',_0x3d0ec9(0x211),{'identifier':_0x58b323,'query':_0x26052e['data'][_0x3d0ec9(0x220)],'branch':_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x20b)]});try{const _0x20a8cc=new WarpGrepClient({'morphApiKey':_0x14ddf4,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3f7a08=await _0x20a8cc[_0x3d0ec9(0x149)]({'searchTerm':_0x26052e['data'][_0x3d0ec9(0x220)],'github':_0x58b323,'branch':_0x26052e['data'][_0x3d0ec9(0x20b)]}),_0x4f265e=Date[_0x3d0ec9(0x16b)]()-_0x1b2a5e;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x4f265e+'ms.\x20Success:\x20'+_0x3f7a08[_0x3d0ec9(0x217)]);const _0x58930f=formatResult(_0x3f7a08);return{'content':[{'type':'text','text':_0x58930f}]};}catch(_0x394899){const _0x36be6b=handleMorphAPIError(_0x394899);if(_0x36be6b)return _0x36be6b;const _0x3ca6c1=Date[_0x3d0ec9(0x16b)]()-_0x1b2a5e,_0x41fbdd=_0x394899 instanceof Error?_0x394899['message']:String(_0x394899);return logMcpStderr(_0x3d0ec9(0x1be)+_0x3ca6c1+_0x3d0ec9(0x23a),_0x41fbdd),reportMorphError({'error_message':_0x41fbdd,'error_type':_0x394899 instanceof Error?_0x394899[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:_0x3d0ec9(0x1b4),'context':{'tool':'github_codebase_search','github_url':_0x58b323,'search_string':_0x26052e['data'][_0x3d0ec9(0x220)],'branch':_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x20b)]},'stack_trace':_0x394899 instanceof Error?_0x394899[_0x3d0ec9(0x19f)]:undefined,'source':_0x3d0ec9(0x24e),'tool':_0x3d0ec9(0x1e4),'latency_ms':_0x3ca6c1})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1fb)+_0x41fbdd}],'isError':![]};}}default:throw new Error(_0x3d0ec9(0x238)+_0x406c0b);}}catch(_0x24ed2a){const _0x5b40b6=_0x24ed2a instanceof Error?_0x24ed2a['message']:String(_0x24ed2a);return reportMorphError({'error_message':_0x5b40b6,'error_type':_0x24ed2a instanceof Error?_0x24ed2a[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:_0x3d0ec9(0x1b4),'context':{'tool':_0x406c0b,'arguments':_0x4f30d9?JSON[_0x3d0ec9(0x233)](_0x4f30d9)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x3d0ec9(0x171)},'stack_trace':_0x24ed2a instanceof Error?_0x24ed2a[_0x3d0ec9(0x19f)]:undefined,'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':'text','text':'Error:\x20'+_0x5b40b6}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4850f3){const _0x3736b7=a0_0x415e44,_0x26f8b3=await getValidRootDirectories(_0x4850f3);if(_0x26f8b3['length']>0x0)allowedDirectories=[..._0x26f8b3],logMcpStderr(_0x3736b7(0x18a)+_0x26f8b3[_0x3736b7(0x231)]+'\x20valid\x20directories');else{logMcpStderr(_0x3736b7(0x1bf));if(ENABLE_WORKSPACE_MODE)try{const _0x4a79fe=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4a79fe&&(allowedDirectories=[_0x4a79fe],logMcpStderr(_0x3736b7(0x24b)+_0x4a79fe));}catch(_0x45db7e){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x45db7e);}}}server[a0_0x415e44(0x162)](RootsListChangedNotificationSchema,async()=>{const _0x451702=a0_0x415e44;try{const _0x576e0e=await server['listRoots']();_0x576e0e&&_0x451702(0x131)in _0x576e0e&&await updateAllowedDirectoriesFromRoots(_0x576e0e[_0x451702(0x131)]);}catch(_0x52cfa3){logMcpStderr(_0x451702(0x156),_0x52cfa3 instanceof Error?_0x52cfa3[_0x451702(0x1a9)]:String(_0x52cfa3));}}),server[a0_0x415e44(0x1b8)]=async()=>{const _0x1766ab=a0_0x415e44,_0x3dd653=server[_0x1766ab(0x1da)]();if(_0x3dd653?.[_0x1766ab(0x131)])try{const _0x477677=await server[_0x1766ab(0x16d)]();_0x477677&&_0x1766ab(0x131)in _0x477677?await updateAllowedDirectoriesFromRoots(_0x477677[_0x1766ab(0x131)]):logMcpStderr(_0x1766ab(0x16e));}catch(_0x4c9924){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x4c9924 instanceof Error?_0x4c9924[_0x1766ab(0x1a9)]:String(_0x4c9924));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x1766ab(0x157),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1766ab(0x174));else throw new Error(_0x1766ab(0x22d));}}};async function runServer(){const _0x4a179c=a0_0x415e44,_0x4c6691=new StdioServerTransport();await server[_0x4a179c(0x19e)](_0x4c6691),logMcpStderr(_0x4a179c(0x1ba)),allowedDirectories[_0x4a179c(0x231)]===0x0&&logMcpStderr(_0x4a179c(0x1c5));}runServer()[a0_0x415e44(0x1bb)](_0x2204f3=>{const _0x4a4e31=a0_0x415e44;logMcpStderr(_0x4a4e31(0x173),_0x2204f3),process[_0x4a4e31(0x168)](0x1);});
2
+ const a0_0x52d368=a0_0x179e;(function(_0x117f1f,_0x1ff137){const _0x1861c2=a0_0x179e,_0xb059c8=_0x117f1f();while(!![]){try{const _0x4bc348=parseInt(_0x1861c2(0x13a))/0x1*(-parseInt(_0x1861c2(0x254))/0x2)+-parseInt(_0x1861c2(0x186))/0x3*(parseInt(_0x1861c2(0x1a2))/0x4)+-parseInt(_0x1861c2(0x21e))/0x5+-parseInt(_0x1861c2(0x244))/0x6+parseInt(_0x1861c2(0x210))/0x7*(parseInt(_0x1861c2(0x256))/0x8)+parseInt(_0x1861c2(0x185))/0x9+parseInt(_0x1861c2(0x14b))/0xa;if(_0x4bc348===_0x1ff137)break;else _0xb059c8['push'](_0xb059c8['shift']());}catch(_0x3d202f){_0xb059c8['push'](_0xb059c8['shift']());}}}(a0_0x227d,0x9e8d1));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_0x114a5e from'fs/promises';import a0_0x1c35ef from'path';import a0_0x5d7550 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_0x42921c from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x5dfdf6){const _0x25ae14=a0_0x179e,_0x3defeb=_0x5dfdf6[_0x25ae14(0x228)](a0_0x1c35ef[_0x25ae14(0x243)])[_0x25ae14(0x14f)](Boolean);if(_0x3defeb[_0x25ae14(0x1a1)]<0x2)return null;for(let _0x16cd23=Math[_0x25ae14(0x1d2)](_0x3defeb['length']/0x2);_0x16cd23>=0x1;_0x16cd23--){for(let _0x12c4b6=0x0;_0x12c4b6<=_0x3defeb[_0x25ae14(0x1a1)]-0x2*_0x16cd23;_0x12c4b6++){const _0x387d33=_0x3defeb[_0x25ae14(0x183)](_0x12c4b6,_0x12c4b6+_0x16cd23),_0x98a22f=_0x3defeb[_0x25ae14(0x183)](_0x12c4b6+_0x16cd23,_0x12c4b6+0x2*_0x16cd23);if(_0x387d33['every']((_0x1140cd,_0x2f5ca1)=>_0x1140cd===_0x98a22f[_0x2f5ca1])){const _0x37be2e=[..._0x3defeb[_0x25ae14(0x183)](0x0,_0x12c4b6),..._0x3defeb[_0x25ae14(0x183)](_0x12c4b6+_0x16cd23)];return a0_0x1c35ef['sep']+_0x37be2e['join'](a0_0x1c35ef['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x36a994=a0_0x179e;try{const _0xb47872=require(_0x36a994(0x192));return _0xb47872[_0x36a994(0x202)]??'unknown';}catch(_0x249e17){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x249e17),_0x36a994(0x139);}}function printHelp(){const _0x24dc3c=a0_0x179e;console[_0x24dc3c(0x157)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x24dc3c(0x157)](_0x24dc3c(0x230)),console[_0x24dc3c(0x157)](_0x24dc3c(0x1a7)),console['log'](_0x24dc3c(0x1b0)),console[_0x24dc3c(0x157)](_0x24dc3c(0x18b)),console[_0x24dc3c(0x157)](_0x24dc3c(0x263)),console['log']('\x0aExamples:'),console[_0x24dc3c(0x157)](_0x24dc3c(0x264)),console[_0x24dc3c(0x157)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x52d368(0x253)][a0_0x52d368(0x183)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x52d368(0x195),'-h']);cliArgs[a0_0x52d368(0x251)](_0x3df83d=>VERSION_FLAGS[a0_0x52d368(0x231)](_0x3df83d))&&(console[a0_0x52d368(0x157)](a0_0x52d368(0x1e6)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x52d368(0x251)](_0x416d75=>HELP_FLAGS[a0_0x52d368(0x231)](_0x416d75))&&(printHelp(),process[a0_0x52d368(0x18a)](0x0));function getCliArg(_0x56cb04){const _0x320597=a0_0x52d368;for(let _0x5bc49d=0x0;_0x5bc49d<cliArgs[_0x320597(0x1a1)];_0x5bc49d++){const _0x3f9f64=cliArgs[_0x5bc49d];if(_0x3f9f64[_0x320597(0x242)]('--'+_0x56cb04+'='))return _0x3f9f64['slice'](('--'+_0x56cb04+'=')[_0x320597(0x1a1)]);if(_0x3f9f64==='--'+_0x56cb04&&_0x5bc49d+0x1<cliArgs['length'])return cliArgs[_0x5bc49d+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x52d368(0x1a1)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x52d368(0x231)](arg)||HELP_FLAGS[a0_0x52d368(0x231)](arg))continue;if(arg['startsWith'](a0_0x52d368(0x145)))continue;if(arg===a0_0x52d368(0x16f)){i++;continue;}args[a0_0x52d368(0x224)](arg);}function a0_0x179e(_0xdb5d29,_0x2ec524){_0xdb5d29=_0xdb5d29-0x134;const _0x227da6=a0_0x227d();let _0x179efa=_0x227da6[_0xdb5d29];return _0x179efa;}const WORKSPACE_ROOT=process['env'][a0_0x52d368(0x1d4)]||process[a0_0x52d368(0x229)][a0_0x52d368(0x1a8)]||process[a0_0x52d368(0x234)](),ENABLE_WORKSPACE_MODE=process[a0_0x52d368(0x229)]['ENABLE_WORKSPACE_MODE']!=='false',MORPH_API_KEY=getCliArg(a0_0x52d368(0x143))??process[a0_0x52d368(0x229)][a0_0x52d368(0x1da)],MORPH_API_URL=process[a0_0x52d368(0x229)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x52d368(0x229)][a0_0x52d368(0x21d)]!==a0_0x52d368(0x1e7),MORPH_WARP_GREP_TIMEOUT=process[a0_0x52d368(0x229)][a0_0x52d368(0x250)]?parseInt(process[a0_0x52d368(0x229)][a0_0x52d368(0x250)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x52d368(0x229)]['DISABLED_TOOLS']?new Set(process[a0_0x52d368(0x229)][a0_0x52d368(0x137)]['split'](',')[a0_0x52d368(0x21c)](_0x17d14a=>_0x17d14a[a0_0x52d368(0x259)]())['filter'](_0x19ea9e=>_0x19ea9e['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x52d368(0x220)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x52d368(0x231)](tool)&&console[a0_0x52d368(0x174)](a0_0x52d368(0x17d)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x52d368(0x1cb)](',\x20'));}console[a0_0x52d368(0x174)](a0_0x52d368(0x13c)+[...DISABLED_TOOLS][a0_0x52d368(0x1cb)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x52d368(0x242)](a0_0x52d368(0x166))&&!MORPH_API_KEY[a0_0x52d368(0x242)](a0_0x52d368(0x198))&&logMcpStderr(a0_0x52d368(0x235));function a0_0x227d(){const _0x5df29d=['push','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','data','split','env','path','\x22>\x0a','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','-\x20Listed\x20directory\x20`','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','Morph\x20Edit\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','has','Morph\x20Edit\x20Preview','source','cwd','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','LocalRipgrepProvider','File\x20read\x20error:','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','readFile','GITHUB_CODEBASE_SEARCH','payload','composer.json','realpath','repo_path','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','arguments','oninitialized','startsWith','sep','6737724SLlDQF','tool','turns','number','morph-mcp','utf-8','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','timeout','content','access','Relevant\x20context\x20found:','dryRun','MORPH_WARP_GREP_TIMEOUT','some','boolean','argv','277188eKeskY','toLowerCase','8uxGuma','[could\x20not\x20read\x20file:\x20','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.','trim','EDIT_FILE','ToolException','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','Repository\x20identifier','Error\x20running\x20fast\x20context\x20search:\x20','catch','list_directory','\x22>\x0aError\x20reading\x20file:\x20','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','\x20\x20morph-mcp','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','path_validation_failed','etimedout','DISABLED_TOOLS','tool_call_id','unknown','7rFRTGf','Warning:\x20','Disabled\x20tools:\x20','tool_call_error','name','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','Cargo.toml','toISOString','read','api-key','provider_created','--api-key=','linesRemoved','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','terminated','Error:\x20','16191060xbcCJG','timed\x20out','inputSchema','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','filter','For\x20deletions:\x0a','path_validation_start','grep','substring','resolve','\x20chars)','instruction','log','<file\x20path=\x22','RipgrepError','ReadError','enum','github_codebase_search','optional','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Created\x20File','\x20is\x20not\x20a\x20directory','.cursor','normalize','Bearer\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Tool\x20\x22','sk-','GitHub\x20search\x20failed:\x20','❌\x20Morph\x20Edit\x20Failed:\x20','all','min','path_validation_resolved','string','finish','PathError','--api-key','runWarpGrep_call','search_type','Warning:\x20Workspace\x20fallback\x20failed:\x20','roots','error','tool_calls','-\x20High\x20accuracy:\x2098%\x20success\x20rate\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.','linesModified','SymlinkError','safeParse','includes','TimeoutError','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','\x20(new\x20file)','node_modules','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Failed\x20to\x20request\x20roots\x20from\x20client:','morph-v3-fast','slice','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','11605878XRmzLv','24bVvxem','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','errors','exit','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Tool\x20','description','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Specific\x20commit\x20hash\x20to\x20search','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','../package.json','stack','completed_with_file_errors','--help','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','file_read_complete','morph-','api_request_start','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','CODEBASE_SEARCH','searchGitHub','post','messages','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.','search_string','length','142904aPnkNL','warp_grep_complete','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','SubToolError','RipgrepNotAvailable','\x0aOptions:','PWD','compaction_failed','stringify','github_url','mcp-filesystem','Workspace\x20mode\x20enabled:\x20Using\x20','completionId','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.','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','success','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','codebase_search','changes','text','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','BinaryFile','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','glob','constructor','requiresApiKey','listRoots','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a',',\x20modified\x20','morph-v3-large','files','match','package.json','.vscode','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','parse','[github_codebase_search]\x20Done\x20in\x20','Unknown\x20error','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','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','homedir','join','FileReadError','API\x20error\x20(auth/rate-limit)','Failed\x20to\x20read\x20file:\x20','grep_search','glob\x20\x27','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','floor','default','WORKSPACE_ROOT','role','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','.\x20Changes:\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Here\x20is\x20the\x20content\x20of\x20files:\x0a','MORPH_API_KEY','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','ENOENT','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.',',\x20removed\x20','tsconfig.json','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','\x20error(s)','basename','branch','@morphllm/morphmcp\x20','false','edit_file','instructions','morph-warp-grep-v2.1','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','UnknownError','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','timings','params','terminationReason','\x20-\x20','Invalid\x20arguments:\x20','go.mod','assistant','added\x20','unknown\x20error','owner_repo','now','github_search_start','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','https://morphllm.com/api/error-report','dirname','warn','\x0a</file>','0.2.0','isArray','version','function','debug','user','code_edit','metadata','FileNotFound','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Parent\x20directory\x20does\x20not\x20exist:\x20','warp_grep_start','setRequestHandler','[github_codebase_search]\x20Failed\x20in\x20','MCP','Unknown\x20tool:\x20','7506086rceXST','describe','lines','-\x20Glob\x20search\x20`','object','Preview\x20changes\x20without\x20applying\x20them.','response','.git','pattern','`\x20in\x20`','completed','linesAdded','map','MORPH_LARGE_APPLY','4763005yiCeQl','message','size','WarpGrepError','WarpGrep\x20sub-tool\x20errors:\x20','read\x20'];a0_0x227d=function(){return _0x5df29d;};return a0_0x227d();}async function reportMorphError(_0xd616aa){const _0x3c2ee3=a0_0x52d368;try{await a0_0x42921c[_0x3c2ee3(0x19d)](_0x3c2ee3(0x1fc),{..._0xd616aa,'timestamp':new Date()[_0x3c2ee3(0x141)](),'source':_0xd616aa[_0x3c2ee3(0x233)]||_0x3c2ee3(0x1ac),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0xd616aa['context']}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x3c2ee3(0x163)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x520b3d,_0x44dc0d){const _0x40ae4b=a0_0x52d368;if(_0x520b3d&&typeof _0x520b3d===_0x40ae4b(0x214)&&'status'in _0x520b3d)return _0x520b3d['status'];if(_0x520b3d&&typeof _0x520b3d===_0x40ae4b(0x214)&&_0x40ae4b(0x216)in _0x520b3d)return _0x520b3d['response']?.['status'];const _0x3579c4=_0x44dc0d['match'](/\b(401|429)\b/);return _0x3579c4?parseInt(_0x3579c4[0x1],0xa):null;}function handleMorphAPIError(_0x5cc86e){const _0x3c26c4=a0_0x52d368,_0x390c8e=_0x5cc86e instanceof Error?_0x5cc86e[_0x3c26c4(0x21f)]:String(_0x5cc86e),_0x536748=extractStatusCode(_0x5cc86e,_0x390c8e);switch(_0x536748){case 0x191:return{'content':[{'type':_0x3c26c4(0x1b5),'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':'text','text':_0x3c26c4(0x1c4)}],'isError':!![]};default:return null;}}args[a0_0x52d368(0x1a1)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x52d368(0x191)),logMcpStderr(a0_0x52d368(0x1fb)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x52d368(0x209)),logMcpStderr(a0_0x52d368(0x1db)));function normalizePath(_0x5c6db4){const _0x234f86=a0_0x52d368;return a0_0x1c35ef[_0x234f86(0x162)](_0x5c6db4);}function expandHome(_0x2623c7){const _0x492484=a0_0x52d368;if(_0x2623c7[_0x492484(0x242)]('~/')||_0x2623c7==='~')return a0_0x1c35ef[_0x492484(0x1cb)](a0_0x5d7550[_0x492484(0x1ca)](),_0x2623c7[_0x492484(0x183)](0x1));return _0x2623c7;}let allowedDirectories=await Promise[a0_0x52d368(0x169)](args[a0_0x52d368(0x21c)](async _0x4d240d=>{const _0x5f277d=a0_0x52d368,_0x968db0=expandHome(_0x4d240d),_0x8fdb6=a0_0x1c35ef[_0x5f277d(0x154)](_0x968db0);try{const _0x20dc68=await a0_0x114a5e[_0x5f277d(0x23d)](_0x8fdb6);return normalizePath(_0x20dc68);}catch(_0x427206){return normalizePath(_0x8fdb6);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x52d368(0x1a1)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x52d368(0x224)](workspaceDir),logMcpStderr(a0_0x52d368(0x1ad)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x128b1b){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x128b1b);}async function detectWorkspaceRoot(_0x1c7cd0){const _0x8dd621=a0_0x52d368;let _0x535be4=a0_0x1c35ef['resolve'](_0x1c7cd0);const _0x2a1dcc=[_0x8dd621(0x217),_0x8dd621(0x1c3),_0x8dd621(0x1c2),_0x8dd621(0x140),'pyproject.toml',_0x8dd621(0x1f3),_0x8dd621(0x161),_0x8dd621(0x1e1),_0x8dd621(0x23c)];while(_0x535be4!==a0_0x1c35ef[_0x8dd621(0x1fd)](_0x535be4)){for(const _0x308f3a of _0x2a1dcc){const _0x508617=a0_0x1c35ef[_0x8dd621(0x1cb)](_0x535be4,_0x308f3a);try{return await a0_0x114a5e[_0x8dd621(0x24d)](_0x508617),normalizePath(_0x535be4);}catch{}}_0x535be4=a0_0x1c35ef[_0x8dd621(0x1fd)](_0x535be4);}return normalizePath(_0x1c7cd0);}await Promise[a0_0x52d368(0x169)](args['map'](async _0x658c32=>{const _0x39a1a6=a0_0x52d368;try{const _0x5bd8a9=await a0_0x114a5e['stat'](expandHome(_0x658c32));!_0x5bd8a9['isDirectory']()&&(logMcpStderr(_0x39a1a6(0x14a)+_0x658c32+_0x39a1a6(0x160)),process[_0x39a1a6(0x18a)](0x1));}catch(_0xd6a083){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x658c32+':',_0xd6a083),process[_0x39a1a6(0x18a)](0x1);}}));async function validatePath(_0xba31f1){const _0xa7ee44=a0_0x52d368,_0x4ee21e=expandHome(_0xba31f1),_0x7f4624=a0_0x1c35ef[_0xa7ee44(0x154)](_0x4ee21e);logger[_0xa7ee44(0x204)]('MCP',_0xa7ee44(0x151),{'raw_path':_0xba31f1,'absolute':_0x7f4624});try{const _0x30baaa=await a0_0x114a5e['realpath'](_0x7f4624);return logger[_0xa7ee44(0x204)](_0xa7ee44(0x20e),_0xa7ee44(0x16b),{'resolved':_0x30baaa,'symlink':_0x30baaa!==_0x7f4624}),_0x30baaa;}catch(_0x30279d){if(_0x30279d['code']===_0xa7ee44(0x1de)){const _0x53dbc7=a0_0x1c35ef[_0xa7ee44(0x1fd)](_0x7f4624);try{const _0x3abb7e=await a0_0x114a5e[_0xa7ee44(0x23d)](_0x53dbc7),_0x425e6e=a0_0x1c35ef['join'](_0x3abb7e,a0_0x1c35ef[_0xa7ee44(0x1e4)](_0x7f4624));return logger[_0xa7ee44(0x204)](_0xa7ee44(0x20e),'path_validation_resolved',{'resolved':_0x425e6e,'new_file':!![]}),_0x425e6e;}catch{logger[_0xa7ee44(0x174)](_0xa7ee44(0x20e),_0xa7ee44(0x135),{'raw_path':_0xba31f1,'error':_0xa7ee44(0x20a)+_0x53dbc7});throw new Error(_0xa7ee44(0x20a)+_0x53dbc7);}}logger[_0xa7ee44(0x174)]('MCP',_0xa7ee44(0x135),{'raw_path':_0xba31f1,'error':_0x30279d[_0xa7ee44(0x21f)]});throw _0x30279d;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x52d368(0x16c)](),'code_edit':z['string']()[a0_0x52d368(0x211)](a0_0x52d368(0x262)),'instruction':z[a0_0x52d368(0x16c)]()['describe'](a0_0x52d368(0x1df)),'dryRun':z[a0_0x52d368(0x252)]()[a0_0x52d368(0x1d3)](![])[a0_0x52d368(0x211)](a0_0x52d368(0x215))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x52d368(0x1af),WarpGrepArgsSchema=z[a0_0x52d368(0x214)]({'search_string':z[a0_0x52d368(0x16c)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x52d368(0x16c)]()[a0_0x52d368(0x211)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x52d368(0x15b)]([a0_0x52d368(0x1d3),a0_0x52d368(0x17f)])['optional']()[a0_0x52d368(0x211)](a0_0x52d368(0x1e2))}),WarpGrepGitHubArgsSchema=z[a0_0x52d368(0x214)]({'search_string':z['string']()[a0_0x52d368(0x211)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x52d368(0x16c)]()['optional']()[a0_0x52d368(0x211)](a0_0x52d368(0x258)),'owner_repo':z[a0_0x52d368(0x16c)]()['optional']()[a0_0x52d368(0x211)](a0_0x52d368(0x22c)),'branch':z[a0_0x52d368(0x16c)]()['optional']()[a0_0x52d368(0x211)](a0_0x52d368(0x15e))}),CodebaseSearchArgsSchema=z[a0_0x52d368(0x214)]({'query':z[a0_0x52d368(0x16c)]()[a0_0x52d368(0x211)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x52d368(0x16c)]()[a0_0x52d368(0x211)](a0_0x52d368(0x25d)),'branch':z[a0_0x52d368(0x16c)]()[a0_0x52d368(0x15d)]()[a0_0x52d368(0x211)](a0_0x52d368(0x148)),'commitHash':z[a0_0x52d368(0x16c)]()['optional']()[a0_0x52d368(0x211)](a0_0x52d368(0x18f)),'targetDirectories':z['array'](z[a0_0x52d368(0x16c)]())['default']([])['describe'](a0_0x52d368(0x180)),'limit':z[a0_0x52d368(0x247)]()[a0_0x52d368(0x15d)]()['default'](0xa)[a0_0x52d368(0x211)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x52d368(0x248),'version':a0_0x52d368(0x200)},{'capabilities':{'tools':{}}});server[a0_0x52d368(0x20c)](ListToolsRequestSchema,async()=>{const _0x255b64=a0_0x52d368,_0x4fd578=[{'name':TOOL_NAMES['EDIT_FILE'],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x255b64(0x13f)+_0x255b64(0x134)+_0x255b64(0x25c)+'Benefits:\x0a'+_0x255b64(0x1a4)+_0x255b64(0x22e)+_0x255b64(0x176)+_0x255b64(0x1eb)+_0x255b64(0x1c8)+_0x255b64(0x24a)+_0x255b64(0x1dd)+_0x255b64(0x150)+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+_0x255b64(0x1dc)+'Rules:\x0a'+_0x255b64(0x14e)+_0x255b64(0x190)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x255b64(0x23f)+_0x255b64(0x225)+_0x255b64(0x1bd)+_0x255b64(0x1b8),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x255b64(0x19b)],'description':_0x255b64(0x1c9)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x255b64(0x147)+_0x255b64(0x1d6)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x519e3a=_0x4fd578[_0x255b64(0x14f)](_0x6636db=>{const _0x3ad462=_0x255b64;if(DISABLED_TOOLS[_0x3ad462(0x231)](_0x6636db['name']))return console[_0x3ad462(0x174)](_0x3ad462(0x18c)+_0x6636db[_0x3ad462(0x13e)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x3ad462(0x1bb)in _0x6636db&&_0x6636db[_0x3ad462(0x1bb)]&&!MORPH_API_KEY)return logMcpStderr(_0x3ad462(0x13b)+_0x6636db[_0x3ad462(0x13e)]+_0x3ad462(0x196)),![];return!![];});return{'tools':_0x519e3a['map'](_0x1edefd=>({'name':_0x1edefd[_0x255b64(0x13e)],'description':_0x1edefd[_0x255b64(0x18d)],'inputSchema':_0x1edefd[_0x255b64(0x14d)]}))};}),server[a0_0x52d368(0x20c)](CallToolRequestSchema,async _0x214bbf=>{const _0xf4c6c9=a0_0x52d368,{name:_0x22814c,arguments:_0x4e1df1}=_0x214bbf[_0xf4c6c9(0x1ef)],_0xc22f4=Date[_0xf4c6c9(0x1f8)]();logger[_0xf4c6c9(0x204)]('MCP','tool_call_received',{'tool':_0x22814c,'args':_0x22814c==='edit_file'?{'path':_0x4e1df1?.[_0xf4c6c9(0x22a)],'instruction':_0x4e1df1?.[_0xf4c6c9(0x156)]||_0x4e1df1?.[_0xf4c6c9(0x1e9)],'dryRun':_0x4e1df1?.['dryRun']}:_0x4e1df1});try{if(!MORPH_API_KEY)return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x1b6)}],'isError':!![]};if(!MORPH_API_KEY[_0xf4c6c9(0x242)](_0xf4c6c9(0x166))&&!MORPH_API_KEY['startsWith'](_0xf4c6c9(0x198)))return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x19f)}],'isError':!![]};if(DISABLED_TOOLS[_0xf4c6c9(0x231)](_0x22814c))return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x165)+_0x22814c+_0xf4c6c9(0x1ed)}],'isError':![]};switch(_0x22814c){case TOOL_NAMES[_0xf4c6c9(0x25a)]:{const _0x1ab433=_0x4e1df1&&typeof _0x4e1df1===_0xf4c6c9(0x214)&&_0xf4c6c9(0x1e9)in _0x4e1df1&&!(_0xf4c6c9(0x156)in _0x4e1df1)?{..._0x4e1df1,'instruction':_0x4e1df1[_0xf4c6c9(0x1e9)],'instructions':undefined}:_0x4e1df1,_0x378da4=MorphEditFileArgsSchema[_0xf4c6c9(0x17a)](_0x1ab433);if(!_0x378da4[_0xf4c6c9(0x1b1)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x378da4[_0xf4c6c9(0x174)]);const _0x16b4a2=await validatePath(_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x22a)]);let _0x5bd5a3=null,_0x592b02=!![],_0x15dfc3=null;try{_0x5bd5a3=await a0_0x114a5e[_0xf4c6c9(0x239)](_0x16b4a2,_0xf4c6c9(0x249)),logger['debug']('MCP','file_read_complete',{'path':_0x16b4a2,'size_bytes':_0x5bd5a3[_0xf4c6c9(0x1a1)]});}catch(_0xb4d83d){const _0x5b7b07=_0xb4d83d['code'];_0x5b7b07===_0xf4c6c9(0x1de)?(_0x592b02=![],_0x5bd5a3='',logger['debug']('MCP',_0xf4c6c9(0x197),{'path':_0x16b4a2,'exists':![]})):(_0x15dfc3=_0xf4c6c9(0x1ce)+(_0x5b7b07||_0xf4c6c9(0x139))+_0xf4c6c9(0x1f1)+(_0xb4d83d instanceof Error?_0xb4d83d[_0xf4c6c9(0x21f)]:String(_0xb4d83d)),logger['error'](_0xf4c6c9(0x20e),'file_read_failed',{'path':_0x16b4a2,'error':_0x15dfc3}),logMcpStderr(_0xf4c6c9(0x13b)+_0x15dfc3));}let _0x3f01a4;try{const _0x52506c=MORPH_API_KEY;if(!_0x52506c)throw new Error(_0xf4c6c9(0x187));const _0x35a856=a0_0x1c35ef['dirname'](_0x16b4a2),_0x16e292=a0_0x1c35ef[_0xf4c6c9(0x1e4)](_0x16b4a2);logger[_0xf4c6c9(0x204)](_0xf4c6c9(0x20e),_0xf4c6c9(0x199),{'model':_0xf4c6c9(0x182),'path':_0x378da4['data'][_0xf4c6c9(0x22a)],'instruction_len':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x156)][_0xf4c6c9(0x1a1)],'code_edit_len':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x206)][_0xf4c6c9(0x1a1)],'original_code_len':_0x5bd5a3?.[_0xf4c6c9(0x1a1)]??0x0,'dry_run':_0x378da4[_0xf4c6c9(0x227)]['dryRun']});const _0x24d76d=Date[_0xf4c6c9(0x1f8)](),_0x1ea6a4=await executeEditFile({'target_filepath':_0x16e292,'code_edit':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x206)],'instruction':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x156)]},{'morphApiKey':_0x52506c,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x35a856,'autoWrite':!_0x378da4['data'][_0xf4c6c9(0x24f)],'generateUdiff':![],'debug':![]}),_0x39a5ff=Date[_0xf4c6c9(0x1f8)]()-_0x24d76d;_0x3f01a4=_0x1ea6a4[_0xf4c6c9(0x1ae)];if(!_0x1ea6a4[_0xf4c6c9(0x1b1)])throw new Error(_0x1ea6a4[_0xf4c6c9(0x174)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x4c30d8=_0x1ea6a4[_0xf4c6c9(0x1b4)],_0x334a80=_0xf4c6c9(0x1f5)+_0x4c30d8[_0xf4c6c9(0x21b)]+_0xf4c6c9(0x1e0)+_0x4c30d8[_0xf4c6c9(0x146)]+_0xf4c6c9(0x1be)+_0x4c30d8[_0xf4c6c9(0x178)];logger[_0xf4c6c9(0x204)](_0xf4c6c9(0x20e),'tool_call_complete',{'tool':_0xf4c6c9(0x1e8),'success':!![],'latency_ms':Date['now']()-_0xc22f4,'edit_latency_ms':_0x39a5ff,'changes':{'added':_0x4c30d8[_0xf4c6c9(0x21b)],'removed':_0x4c30d8[_0xf4c6c9(0x146)],'modified':_0x4c30d8['linesModified']},'completion_id':_0x3f01a4});if(_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x24f)])return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x232)+(_0x592b02?'':_0xf4c6c9(0x17e))+':\x20'+_0x378da4['data'][_0xf4c6c9(0x156)]+_0xf4c6c9(0x1d7)+_0x334a80+'.\x20Path:\x20'+_0x378da4['data'][_0xf4c6c9(0x22a)]+'.'}]};return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x22f)+(_0x592b02?'Applied':_0xf4c6c9(0x15f))+':\x20'+_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x156)]+_0xf4c6c9(0x1d7)+_0x334a80+'.\x20Path:\x20'+_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x22a)]+'.'}]};}catch(_0x1aeb5a){const _0x446ff3=handleMorphAPIError(_0x1aeb5a);if(_0x446ff3)return logger['error'](_0xf4c6c9(0x20e),_0xf4c6c9(0x13d),{'tool':'edit_file','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0xf4c6c9(0x1f8)]()-_0xc22f4}),_0x446ff3;const _0x2fdec9=_0x1aeb5a instanceof Error?_0x1aeb5a[_0xf4c6c9(0x21f)]:String(_0x1aeb5a);return logger[_0xf4c6c9(0x174)](_0xf4c6c9(0x20e),'tool_call_error',{'tool':'edit_file','error':_0x2fdec9,'path':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x22a)],'validated_path':_0x16b4a2,'latency_ms':Date[_0xf4c6c9(0x1f8)]()-_0xc22f4,'stack':_0x1aeb5a instanceof Error?_0x1aeb5a[_0xf4c6c9(0x193)]:undefined}),reportMorphError({'error_message':_0x2fdec9,'error_type':_0x1aeb5a instanceof Error?_0x1aeb5a[_0xf4c6c9(0x1ba)][_0xf4c6c9(0x13e)]:_0xf4c6c9(0x1ec),'context':{'tool':_0xf4c6c9(0x1e8),'completion_id':_0x3f01a4,'file_path':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x22a)],'validated_path':_0x16b4a2,'instruction':_0x378da4[_0xf4c6c9(0x227)]['instruction'],'model':MORPH_LARGE_APPLY?_0xf4c6c9(0x1bf):_0xf4c6c9(0x182),'dry_run':_0x378da4['data']['dryRun'],'file_exists':_0x592b02,'file_read_error':_0x15dfc3,'file_readable':_0x5bd5a3!==null,'request_content':{'path':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x22a)],'code_edit':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x206)],'instruction':_0x378da4[_0xf4c6c9(0x227)][_0xf4c6c9(0x156)],'original_code':_0x5bd5a3!==null?_0x5bd5a3[_0xf4c6c9(0x1a1)]>0xc350?_0x5bd5a3[_0xf4c6c9(0x153)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x5bd5a3[_0xf4c6c9(0x1a1)]+_0xf4c6c9(0x155):_0x5bd5a3:_0xf4c6c9(0x257)+(_0x15dfc3||_0xf4c6c9(0x1f6))+']','original_code_length':_0x5bd5a3?.[_0xf4c6c9(0x1a1)]??0x0,'model':MORPH_LARGE_APPLY?_0xf4c6c9(0x1bf):_0xf4c6c9(0x182),'dry_run':_0x378da4['data'][_0xf4c6c9(0x24f)]}},'stack_trace':_0x1aeb5a instanceof Error?_0x1aeb5a['stack']:undefined,'source':'mcp-filesystem'})[_0xf4c6c9(0x25f)](()=>{}),{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x168)+_0x2fdec9}],'isError':!![]};}}case TOOL_NAMES[_0xf4c6c9(0x19b)]:{const _0x153b53=WarpGrepArgsSchema[_0xf4c6c9(0x17a)](_0x4e1df1);if(!_0x153b53[_0xf4c6c9(0x1b1)])return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x1f2)+_0x153b53[_0xf4c6c9(0x174)]}],'isError':!![]};const _0x3faed3=_0x5bf861=>{const _0x54277f=_0xf4c6c9,_0x463a6d=[];for(const _0x3c7452 of _0x5bf861||[]){if(_0x3c7452[_0x54277f(0x1d5)]===_0x54277f(0x1f4)&&Array[_0x54277f(0x201)](_0x3c7452[_0x54277f(0x175)]))for(const _0x53910e of _0x3c7452[_0x54277f(0x175)]){try{const _0x50b93e=_0x53910e[_0x54277f(0x203)]?.[_0x54277f(0x13e)],_0x23c70e=JSON['parse'](_0x53910e[_0x54277f(0x203)]?.[_0x54277f(0x240)]||'{}');if(_0x50b93e===_0x54277f(0x1cf))_0x463a6d[_0x54277f(0x224)]('grep\x20\x27'+_0x23c70e[_0x54277f(0x218)]+'\x27\x20'+(_0x23c70e['path']||'.'));else{if(_0x50b93e==='read')_0x463a6d['push'](_0x54277f(0x223)+_0x23c70e[_0x54277f(0x22a)]);else{if(_0x50b93e===_0x54277f(0x260))_0x463a6d[_0x54277f(0x224)]('list_directory\x20'+(_0x23c70e['command']||'.'));else{if(_0x50b93e===_0x54277f(0x1b9))_0x463a6d[_0x54277f(0x224)](_0x54277f(0x1d0)+_0x23c70e[_0x54277f(0x218)]+'\x27\x20'+(_0x23c70e[_0x54277f(0x22a)]||'.'));else _0x50b93e==='finish'&&_0x463a6d['push']('finish');}}}}catch{}}}return _0x463a6d;},_0x80c17b=_0x1d91c9=>{const _0x275d34=_0xf4c6c9,_0x3a612f=[];if(!_0x1d91c9||!Array[_0x275d34(0x201)](_0x1d91c9))return _0x3a612f;const _0x4d980a=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x275d34(0x208),'tool':_0x275d34(0x142)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x275d34(0x16e),'tool':_0x275d34(0x142)},{'pattern':/\[READ ERROR\]/,'error_type':_0x275d34(0x15a),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x275d34(0x142)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x275d34(0x159),'tool':_0x275d34(0x152)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x275d34(0x1a6),'tool':_0x275d34(0x152)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x275d34(0x1b7),'tool':_0x275d34(0x142)},{'pattern':/\[SYMLINK\]/,'error_type':_0x275d34(0x179),'tool':_0x275d34(0x142)},{'pattern':/not a text file/,'error_type':_0x275d34(0x1b7),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x275d34(0x179),'tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x275d34(0x15a),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x275d34(0x25b),'tool':_0x275d34(0x139)}];let _0x377e23=0x0;for(const _0x4fa22a of _0x1d91c9){_0x4fa22a[_0x275d34(0x1d5)]===_0x275d34(0x1f4)&&Array[_0x275d34(0x201)](_0x4fa22a[_0x275d34(0x175)])&&_0x377e23++;const _0x9fa899=_0x4fa22a[_0x275d34(0x24c)];if((_0x4fa22a[_0x275d34(0x1d5)]===_0x275d34(0x245)||_0x4fa22a['role']===_0x275d34(0x205))&&_0x9fa899&&typeof _0x9fa899==='string')for(const {pattern:_0x1c151d,error_type:_0x1d5888,tool:_0x5a59c9}of _0x4d980a){const _0xbd3176=_0x9fa899[_0x275d34(0x1c1)](new RegExp(_0x1c151d[_0x275d34(0x233)],'g'));if(_0xbd3176)for(const _0xee4bf of _0xbd3176){const _0x1cee27=_0x9fa899['indexOf'](_0xee4bf),_0x143259=_0x9fa899[_0x275d34(0x153)](_0x1cee27,Math[_0x275d34(0x16a)](_0x1cee27+0xc8,_0x9fa899[_0x275d34(0x1a1)]));_0x3a612f[_0x275d34(0x224)]({'tool':_0x5a59c9,'error_type':_0x1d5888,'error_message':_0x143259['split']('\x0a')[0x0],'turn':_0x377e23});}}}return _0x3a612f;};try{const _0x399039=a0_0x1c35ef['resolve'](_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)]),_0x4adfbe=_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x171)],_0x205cfe=_0x4adfbe===_0xf4c6c9(0x17f)?{'allowNames':[_0xf4c6c9(0x17f)]}:undefined,_0x11eeec=new LocalRipgrepProvider(_0x399039,undefined,_0x205cfe);logger['debug'](_0xf4c6c9(0x20e),_0xf4c6c9(0x144),{'type':_0xf4c6c9(0x236),'repo_root':_0x399039,'search_type':_0x4adfbe||_0xf4c6c9(0x1d3)}),logger[_0xf4c6c9(0x204)](_0xf4c6c9(0x20e),_0xf4c6c9(0x20b),{'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'repo_root':_0x399039,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1e03c5=Date[_0xf4c6c9(0x1f8)](),_0x12817c=await runWarpGrep({'searchTerm':_0x153b53[_0xf4c6c9(0x227)]['search_string'],'repoRoot':_0x399039,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x11eeec,'search_type':_0x4adfbe}),_0x171851=Date[_0xf4c6c9(0x1f8)]()-_0x1e03c5,_0x47fbea=_0x12817c[_0xf4c6c9(0x16d)]?.[_0xf4c6c9(0x207)]?.['files']?.[_0xf4c6c9(0x1a1)]??0x0;logger[_0xf4c6c9(0x204)]('MCP',_0xf4c6c9(0x1a3),{'termination':_0x12817c[_0xf4c6c9(0x1f0)],'turns':_0x12817c[_0xf4c6c9(0x1ee)]?.[_0xf4c6c9(0x246)]??0x0,'files_found':_0x47fbea,'latency_ms':_0x171851});const _0x234044=_0x80c17b(_0x12817c[_0xf4c6c9(0x19e)]);_0x234044['length']>0x0&&reportMorphError({'error_message':_0xf4c6c9(0x222)+_0x234044[_0xf4c6c9(0x1a1)]+_0xf4c6c9(0x1e3),'error_type':_0xf4c6c9(0x1a5),'level':'warn','tool':_0xf4c6c9(0x1b3),'context':{'repo_path':_0x153b53[_0xf4c6c9(0x227)]['repo_path'],'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'model':_0xf4c6c9(0x1ea),'termination_reason':_0x12817c[_0xf4c6c9(0x1f0)],'sub_tool_errors':_0x234044,'timings':_0x12817c['timings'],'tool_calls':_0x3faed3(_0x12817c[_0xf4c6c9(0x19e)]),'messages':_0x12817c[_0xf4c6c9(0x19e)]?.[_0xf4c6c9(0x21c)](_0x5002b2=>({'role':_0x5002b2[_0xf4c6c9(0x1d5)],'content':_0x5002b2[_0xf4c6c9(0x24c)],..._0x5002b2[_0xf4c6c9(0x175)]?{'tool_calls':_0x5002b2[_0xf4c6c9(0x175)]['length']}:{},..._0x5002b2[_0xf4c6c9(0x138)]?{'tool_call_id':_0x5002b2['tool_call_id']}:{}}))},'source':_0xf4c6c9(0x1ac)})[_0xf4c6c9(0x25f)](()=>{});let _0x32dc5a='';if(_0x12817c[_0xf4c6c9(0x1f0)]===_0xf4c6c9(0x21a)&&_0x12817c[_0xf4c6c9(0x16d)]?.['metadata']?.[_0xf4c6c9(0x1c0)]){const _0x465fe2=_0x12817c[_0xf4c6c9(0x16d)][_0xf4c6c9(0x207)][_0xf4c6c9(0x1c0)];if(_0x465fe2[_0xf4c6c9(0x1a1)]===0x0)return _0x32dc5a=_0x12817c[_0xf4c6c9(0x16d)][_0xf4c6c9(0x23b)]||_0xf4c6c9(0x1fa),{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0x32dc5a}]};const _0x7e6f3d=[],_0x4cacd7=[_0xf4c6c9(0x1b2)];for(const _0x493fb5 of _0x12817c['messages']){if(_0x493fb5['role']===_0xf4c6c9(0x1f4)&&Array[_0xf4c6c9(0x201)](_0x493fb5['tool_calls']))for(const _0x8cb689 of _0x493fb5['tool_calls']){try{const _0x494fba=_0x8cb689[_0xf4c6c9(0x203)]?.[_0xf4c6c9(0x13e)],_0x13276b=JSON[_0xf4c6c9(0x1c5)](_0x8cb689[_0xf4c6c9(0x203)]?.[_0xf4c6c9(0x240)]||'{}');if(_0x494fba===_0xf4c6c9(0x1cf))_0x4cacd7[_0xf4c6c9(0x224)]('-\x20Grepped\x20\x27'+_0x13276b[_0xf4c6c9(0x218)]+'\x27\x20in\x20`'+(_0x13276b[_0xf4c6c9(0x22a)]||'.')+'`');else{if(_0x494fba===_0xf4c6c9(0x142))_0x4cacd7['push']('-\x20Read\x20file\x20`'+_0x13276b[_0xf4c6c9(0x22a)]+'`');else{if(_0x494fba===_0xf4c6c9(0x260))_0x4cacd7[_0xf4c6c9(0x224)](_0xf4c6c9(0x22d)+(_0x13276b['command']||'.')+'`');else _0x494fba===_0xf4c6c9(0x1b9)&&_0x4cacd7['push'](_0xf4c6c9(0x213)+_0x13276b[_0xf4c6c9(0x218)]+_0xf4c6c9(0x219)+(_0x13276b[_0xf4c6c9(0x22a)]||'.')+'`');}}}catch{}}}_0x7e6f3d[_0xf4c6c9(0x224)](_0x4cacd7[_0xf4c6c9(0x1cb)]('\x0a'));const _0x6598e5=['',_0xf4c6c9(0x24e)];for(const _0x4d896a of _0x465fe2){if(_0x4d896a['lines']==='*')_0x6598e5[_0xf4c6c9(0x224)]('-\x20'+_0x4d896a[_0xf4c6c9(0x22a)]+':*');else{if(Array['isArray'](_0x4d896a[_0xf4c6c9(0x212)])){const _0x176b10=_0x4d896a[_0xf4c6c9(0x212)][_0xf4c6c9(0x21c)](([_0x1bd6e3,_0x461fb8])=>{if(_0x1bd6e3===_0x461fb8)return''+_0x1bd6e3;return _0x1bd6e3+'-'+_0x461fb8;});_0x6598e5[_0xf4c6c9(0x224)]('-\x20'+_0x4d896a['path']+':'+_0x176b10[_0xf4c6c9(0x1cb)](','));}else _0x6598e5['push']('-\x20'+_0x4d896a[_0xf4c6c9(0x22a)]+':*');}}_0x6598e5['push'](''),_0x7e6f3d[_0xf4c6c9(0x224)](_0x6598e5['join']('\x0a')),_0x7e6f3d[_0xf4c6c9(0x224)](_0xf4c6c9(0x1d9));const _0x62be28=[],_0x493957=[];for(const _0x2815e8 of _0x465fe2){let _0x5a0eeb=a0_0x1c35ef['resolve'](_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)],_0x2815e8['path']),_0x29aef4=null,_0x241dd7=null;try{_0x29aef4=await a0_0x114a5e[_0xf4c6c9(0x239)](_0x5a0eeb,{'encoding':_0xf4c6c9(0x249)});}catch(_0x5668f3){const _0x6a6179=fixPathRepetition(_0x5a0eeb);if(_0x6a6179)try{_0x29aef4=await a0_0x114a5e['readFile'](_0x6a6179,{'encoding':_0xf4c6c9(0x249)}),_0x5a0eeb=_0x6a6179;}catch{_0x241dd7=_0x5668f3 instanceof Error?_0x5668f3:new Error(String(_0x5668f3));}else _0x241dd7=_0x5668f3 instanceof Error?_0x5668f3:new Error(String(_0x5668f3));}if(_0x29aef4!==null){const _0x1621dc=_0x29aef4[_0xf4c6c9(0x228)](/\r?\n/),_0x2ecee1=[];if(_0x2815e8[_0xf4c6c9(0x212)]==='*'||!Array['isArray'](_0x2815e8['lines']))for(let _0x23a2c8=0x1;_0x23a2c8<=_0x1621dc[_0xf4c6c9(0x1a1)];_0x23a2c8++){const _0x12790f=_0x1621dc[_0x23a2c8-0x1];_0x2ecee1['push'](_0x23a2c8+'|\x20'+_0x12790f);}else for(const [_0x312e91,_0x18128c]of _0x2815e8['lines']){_0x2ecee1['length']>0x0&&_0x2ecee1[_0xf4c6c9(0x224)]('');for(let _0x2fec74=_0x312e91;_0x2fec74<=_0x18128c&&_0x2fec74<=_0x1621dc['length'];_0x2fec74++){const _0x4b04f2=_0x1621dc[_0x2fec74-0x1];_0x2ecee1['push'](_0x2fec74+'|\x20'+_0x4b04f2);}}_0x493957[_0xf4c6c9(0x224)]({'path':_0x2815e8['path'],'content':_0x2ecee1[_0xf4c6c9(0x1cb)]('\x0a')});}else _0x62be28['push'](_0xf4c6c9(0x158)+_0x2815e8[_0xf4c6c9(0x22a)]+_0xf4c6c9(0x261)+(_0x241dd7?.['message']||_0xf4c6c9(0x1c7))+_0xf4c6c9(0x1ff));}try{const _0x28a3f1=await compactFileContexts(_0x493957,_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],MORPH_API_KEY,MORPH_API_URL);for(const _0xa8f2f8 of _0x28a3f1){_0x62be28[_0xf4c6c9(0x224)](_0xf4c6c9(0x158)+_0xa8f2f8[_0xf4c6c9(0x22a)]+_0xf4c6c9(0x22b)+_0xa8f2f8[_0xf4c6c9(0x24c)]+_0xf4c6c9(0x1ff));}}catch(_0x1e70e9){logger[_0xf4c6c9(0x1fe)](_0xf4c6c9(0x20e),_0xf4c6c9(0x1a9),{'error':_0x1e70e9 instanceof Error?_0x1e70e9['message']:String(_0x1e70e9),'files_count':_0x493957['length']});for(const _0x175840 of _0x493957){_0x62be28['push'](_0xf4c6c9(0x158)+_0x175840['path']+_0xf4c6c9(0x22b)+_0x175840[_0xf4c6c9(0x24c)]+_0xf4c6c9(0x1ff));}}_0x7e6f3d[_0xf4c6c9(0x224)](_0x62be28[_0xf4c6c9(0x1cb)]('\x0a\x0a')),_0x32dc5a=_0x7e6f3d[_0xf4c6c9(0x1cb)]('\x0a');const _0x1d7526=_0x12817c[_0xf4c6c9(0x189)]?.[_0xf4c6c9(0x14f)](_0x3f7027=>_0x3f7027[_0xf4c6c9(0x21f)]?.[_0xf4c6c9(0x242)](_0xf4c6c9(0x237)))||[];if(_0x1d7526[_0xf4c6c9(0x1a1)]>0x0){const _0x133e3b=_0x1d7526[_0xf4c6c9(0x21c)](_0x4ae32e=>_0x4ae32e[_0xf4c6c9(0x21f)])[_0xf4c6c9(0x1cb)](';\x20');reportMorphError({'error_message':_0x133e3b,'error_type':_0xf4c6c9(0x1cc),'context':{'tool':_0xf4c6c9(0x1b3),'repo_path':_0x153b53[_0xf4c6c9(0x227)]['repo_path'],'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'model':_0xf4c6c9(0x1ea),'termination_reason':_0xf4c6c9(0x194),'error_count':_0x1d7526[_0xf4c6c9(0x1a1)],'is_timeout':![],'timings':_0x12817c['timings'],'files_attempted':_0x465fe2[_0xf4c6c9(0x21c)](_0xf18267=>({'path':_0xf18267[_0xf4c6c9(0x22a)],'lines':_0xf18267[_0xf4c6c9(0x212)]})),'tool_calls':_0x3faed3(_0x12817c['messages']),'messages':_0x12817c['messages']?.[_0xf4c6c9(0x21c)](_0x2310e2=>({'role':_0x2310e2[_0xf4c6c9(0x1d5)],'content':_0x2310e2[_0xf4c6c9(0x24c)],..._0x2310e2['tool_calls']?{'tool_calls':_0x2310e2[_0xf4c6c9(0x175)][_0xf4c6c9(0x1a1)]}:{},..._0x2310e2[_0xf4c6c9(0x138)]?{'tool_call_id':_0x2310e2[_0xf4c6c9(0x138)]}:{}})),'request_content':{'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'repo_path':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)],'repoRoot':a0_0x1c35ef[_0xf4c6c9(0x154)](_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)]),'model':'morph-warp-grep-v2.1'}},'source':_0xf4c6c9(0x1ac)})[_0xf4c6c9(0x25f)](()=>{});}}else{if(_0x12817c['terminationReason']===_0xf4c6c9(0x149)&&_0x12817c[_0xf4c6c9(0x189)][_0xf4c6c9(0x1a1)]>0x0){const _0x3640b6=_0x12817c['errors'][_0xf4c6c9(0x21c)](_0x2e4a58=>_0x2e4a58[_0xf4c6c9(0x21f)])[_0xf4c6c9(0x1cb)](';\x20');_0x32dc5a='Error:\x20'+_0x3640b6;const _0x5ea0fb=_0x3640b6[_0xf4c6c9(0x255)]()['includes']('timeout')||_0x3640b6['toLowerCase']()[_0xf4c6c9(0x17b)]('timed\x20out')||_0x3640b6[_0xf4c6c9(0x255)]()[_0xf4c6c9(0x17b)](_0xf4c6c9(0x136)),_0x8ec427=_0x12817c[_0xf4c6c9(0x16d)]?.[_0xf4c6c9(0x207)]?.[_0xf4c6c9(0x1c0)],_0x2913e2=_0x12817c[_0xf4c6c9(0x189)][0x0];reportMorphError({'error_message':_0x3640b6,'error_type':_0x5ea0fb?'TimeoutError':_0x2913e2?.[_0xf4c6c9(0x1ba)]?.[_0xf4c6c9(0x13e)]||_0xf4c6c9(0x221),'context':{'tool':_0xf4c6c9(0x1b3),'repo_path':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)],'query':_0x153b53['data']['search_string'],'model':_0xf4c6c9(0x1ea),'termination_reason':_0x12817c[_0xf4c6c9(0x1f0)],'error_count':_0x12817c[_0xf4c6c9(0x189)][_0xf4c6c9(0x1a1)],'is_timeout':_0x5ea0fb,'timings':_0x12817c[_0xf4c6c9(0x1ee)],'files_attempted':_0x8ec427?.['map'](_0x24fdf2=>({'path':_0x24fdf2[_0xf4c6c9(0x22a)],'lines':_0x24fdf2[_0xf4c6c9(0x212)]})),'tool_calls':_0x3faed3(_0x12817c[_0xf4c6c9(0x19e)]),'messages':_0x12817c[_0xf4c6c9(0x19e)]?.[_0xf4c6c9(0x21c)](_0x582257=>({'role':_0x582257[_0xf4c6c9(0x1d5)],'content':_0x582257[_0xf4c6c9(0x24c)],..._0x582257[_0xf4c6c9(0x175)]?{'tool_calls':_0x582257[_0xf4c6c9(0x175)][_0xf4c6c9(0x1a1)]}:{},..._0x582257[_0xf4c6c9(0x138)]?{'tool_call_id':_0x582257[_0xf4c6c9(0x138)]}:{}})),'request_content':{'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'repo_path':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)],'repoRoot':a0_0x1c35ef[_0xf4c6c9(0x154)](_0x153b53[_0xf4c6c9(0x227)]['repo_path']),'model':_0xf4c6c9(0x1ea)}},'stack_trace':_0x2913e2?.['stack']||undefined,'source':_0xf4c6c9(0x1ac)})[_0xf4c6c9(0x25f)](()=>{});}else _0x32dc5a='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0x32dc5a}]};}catch(_0x351a9d){const _0x5cb839=handleMorphAPIError(_0x351a9d);if(_0x5cb839)return logger[_0xf4c6c9(0x174)](_0xf4c6c9(0x20e),_0xf4c6c9(0x13d),{'tool':_0xf4c6c9(0x1b3),'error':_0xf4c6c9(0x1cd),'latency_ms':Date[_0xf4c6c9(0x1f8)]()-_0xc22f4}),_0x5cb839;const _0x51458b=_0x351a9d instanceof Error?_0x351a9d[_0xf4c6c9(0x21f)]:String(_0x351a9d);logger['error'](_0xf4c6c9(0x20e),'tool_call_error',{'tool':_0xf4c6c9(0x1b3),'error':_0x51458b,'repo_path':_0x153b53['data'][_0xf4c6c9(0x23e)],'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'latency_ms':Date['now']()-_0xc22f4});const _0x196592=_0x51458b[_0xf4c6c9(0x255)]()[_0xf4c6c9(0x17b)](_0xf4c6c9(0x24b))||_0x51458b[_0xf4c6c9(0x255)]()[_0xf4c6c9(0x17b)](_0xf4c6c9(0x14c))||_0x51458b[_0xf4c6c9(0x255)]()[_0xf4c6c9(0x17b)](_0xf4c6c9(0x136))||_0x351a9d instanceof Error&&_0x351a9d[_0xf4c6c9(0x13e)]===_0xf4c6c9(0x17c);return reportMorphError({'error_message':_0x51458b,'error_type':_0x196592?_0xf4c6c9(0x17c):_0x351a9d instanceof Error?_0x351a9d['constructor']['name']:_0xf4c6c9(0x1ec),'context':{'tool':'codebase_search','repo_path':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)],'query':_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'model':_0xf4c6c9(0x1ea),'is_timeout':_0x196592,'exception_phase':_0xf4c6c9(0x170),'request_content':{'query':_0x153b53['data'][_0xf4c6c9(0x1a0)],'repo_path':_0x153b53[_0xf4c6c9(0x227)]['repo_path'],'repoRoot':a0_0x1c35ef[_0xf4c6c9(0x154)](_0x153b53[_0xf4c6c9(0x227)][_0xf4c6c9(0x23e)]),'model':_0xf4c6c9(0x1ea)}},'stack_trace':_0x351a9d instanceof Error?_0x351a9d[_0xf4c6c9(0x193)]:undefined,'source':'mcp-filesystem'})[_0xf4c6c9(0x25f)](()=>{}),{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x25e)+_0x51458b}],'isError':![]};}}case TOOL_NAMES[_0xf4c6c9(0x23a)]:{const _0x298a53=WarpGrepGitHubArgsSchema['safeParse'](_0x4e1df1);if(!_0x298a53['success'])return{'content':[{'type':_0xf4c6c9(0x1b5),'text':'Invalid\x20arguments:\x20'+_0x298a53[_0xf4c6c9(0x174)]}],'isError':!![]};const _0x213f01=_0x298a53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1ab)]||_0x298a53['data'][_0xf4c6c9(0x1f7)];if(!_0x213f01)return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x188)}],'isError':!![]};const _0x2641f2=MORPH_API_KEY;if(!_0x2641f2)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x4274b7=Date[_0xf4c6c9(0x1f8)]();logger[_0xf4c6c9(0x204)](_0xf4c6c9(0x20e),_0xf4c6c9(0x1f9),{'identifier':_0x213f01,'query':_0x298a53['data']['search_string'],'branch':_0x298a53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1e5)]});try{const _0x190f23=new WarpGrepClient({'morphApiKey':_0x2641f2,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x424e3d=await _0x190f23[_0xf4c6c9(0x19c)]({'searchTerm':_0x298a53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1a0)],'github':_0x213f01,'branch':_0x298a53[_0xf4c6c9(0x227)][_0xf4c6c9(0x1e5)]}),_0x17f540=Date[_0xf4c6c9(0x1f8)]()-_0x4274b7;logMcpStderr(_0xf4c6c9(0x1c6)+_0x17f540+'ms.\x20Success:\x20'+_0x424e3d['success']);const _0x33d137=formatResult(_0x424e3d);return{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0x33d137}]};}catch(_0x28ce3f){const _0x5027f4=handleMorphAPIError(_0x28ce3f);if(_0x5027f4)return _0x5027f4;const _0x13a03a=Date[_0xf4c6c9(0x1f8)]()-_0x4274b7,_0x3d69a6=_0x28ce3f instanceof Error?_0x28ce3f[_0xf4c6c9(0x21f)]:String(_0x28ce3f);return logMcpStderr(_0xf4c6c9(0x20d)+_0x13a03a+'ms:',_0x3d69a6),reportMorphError({'error_message':_0x3d69a6,'error_type':_0x28ce3f instanceof Error?_0x28ce3f[_0xf4c6c9(0x1ba)][_0xf4c6c9(0x13e)]:_0xf4c6c9(0x1ec),'context':{'tool':_0xf4c6c9(0x15c),'github_url':_0x213f01,'search_string':_0x298a53[_0xf4c6c9(0x227)]['search_string'],'branch':_0x298a53['data'][_0xf4c6c9(0x1e5)]},'stack_trace':_0x28ce3f instanceof Error?_0x28ce3f[_0xf4c6c9(0x193)]:undefined,'source':_0xf4c6c9(0x1ac),'tool':_0xf4c6c9(0x15c),'latency_ms':_0x13a03a})['catch'](()=>{}),{'content':[{'type':_0xf4c6c9(0x1b5),'text':_0xf4c6c9(0x167)+_0x3d69a6}],'isError':![]};}}default:throw new Error(_0xf4c6c9(0x20f)+_0x22814c);}}catch(_0x242897){const _0x533c2e=_0x242897 instanceof Error?_0x242897[_0xf4c6c9(0x21f)]:String(_0x242897);return reportMorphError({'error_message':_0x533c2e,'error_type':_0x242897 instanceof Error?_0x242897[_0xf4c6c9(0x1ba)][_0xf4c6c9(0x13e)]:_0xf4c6c9(0x1ec),'context':{'tool':_0x22814c,'arguments':_0x4e1df1?JSON[_0xf4c6c9(0x1aa)](_0x4e1df1)[_0xf4c6c9(0x153)](0x0,0x1f4):undefined,'mcp_server_version':_0xf4c6c9(0x200)},'stack_trace':_0x242897 instanceof Error?_0x242897[_0xf4c6c9(0x193)]:undefined,'source':'mcp-filesystem'})[_0xf4c6c9(0x25f)](()=>{}),{'content':[{'type':'text','text':_0xf4c6c9(0x14a)+_0x533c2e}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5f484f){const _0x1a3938=a0_0x52d368,_0x3f68e4=await getValidRootDirectories(_0x5f484f);if(_0x3f68e4[_0x1a3938(0x1a1)]>0x0)allowedDirectories=[..._0x3f68e4],logMcpStderr(_0x1a3938(0x1d1)+_0x3f68e4[_0x1a3938(0x1a1)]+'\x20valid\x20directories');else{logMcpStderr(_0x1a3938(0x18e));if(ENABLE_WORKSPACE_MODE)try{const _0x5af0c9=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x5af0c9&&(allowedDirectories=[_0x5af0c9],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x5af0c9));}catch(_0x176c7e){logMcpStderr(_0x1a3938(0x172)+_0x176c7e);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x59a24d=a0_0x52d368;try{const _0x2e4f3d=await server[_0x59a24d(0x1bc)]();_0x2e4f3d&&_0x59a24d(0x173)in _0x2e4f3d&&await updateAllowedDirectoriesFromRoots(_0x2e4f3d[_0x59a24d(0x173)]);}catch(_0x2b3e38){logMcpStderr(_0x59a24d(0x181),_0x2b3e38 instanceof Error?_0x2b3e38[_0x59a24d(0x21f)]:String(_0x2b3e38));}}),server[a0_0x52d368(0x241)]=async()=>{const _0x4eaa63=a0_0x52d368,_0xd73753=server['getClientCapabilities']();if(_0xd73753?.['roots'])try{const _0x42659e=await server[_0x4eaa63(0x1bc)]();_0x42659e&&_0x4eaa63(0x173)in _0x42659e?await updateAllowedDirectoriesFromRoots(_0x42659e[_0x4eaa63(0x173)]):logMcpStderr(_0x4eaa63(0x226));}catch(_0x574e1c){logMcpStderr(_0x4eaa63(0x1d8),_0x574e1c instanceof Error?_0x574e1c[_0x4eaa63(0x21f)]:String(_0x574e1c));}else{if(allowedDirectories[_0x4eaa63(0x1a1)]>0x0)logMcpStderr(_0x4eaa63(0x19a),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x4eaa63(0x184));else throw new Error(_0x4eaa63(0x177));}}};async function runServer(){const _0x1a08aa=a0_0x52d368,_0x578952=new StdioServerTransport();await server['connect'](_0x578952),logMcpStderr(_0x1a08aa(0x164)),allowedDirectories[_0x1a08aa(0x1a1)]===0x0&&logMcpStderr(_0x1a08aa(0x238));}runServer()[a0_0x52d368(0x25f)](_0x846a20=>{const _0x49ce42=a0_0x52d368;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x846a20),process[_0x49ce42(0x18a)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x260a34=a1_0x2967;(function(_0x2b69cf,_0x2bb809){var _0x5f07e2=a1_0x2967,_0x285821=_0x2b69cf();while(!![]){try{var _0x9d82aa=parseInt(_0x5f07e2(0xb2))/0x1+parseInt(_0x5f07e2(0xbe))/0x2*(-parseInt(_0x5f07e2(0xbf))/0x3)+-parseInt(_0x5f07e2(0xba))/0x4+parseInt(_0x5f07e2(0xb8))/0x5*(parseInt(_0x5f07e2(0xc0))/0x6)+parseInt(_0x5f07e2(0xb9))/0x7+-parseInt(_0x5f07e2(0xc3))/0x8+parseInt(_0x5f07e2(0xc4))/0x9;if(_0x9d82aa===_0x2bb809)break;else _0x285821['push'](_0x285821['shift']());}catch(_0x39799c){_0x285821['push'](_0x285821['shift']());}}}(a1_0x329b,0x253f8));function a1_0x329b(){var _0x151af8=['win32','Windows','map','darwin','766730HmANAS','1681666eBEHVg','982280TBzlrp','info','MCP','macOS','135334aSGDtc','9VxrtpD','6abPUst','[os=','platform','1285496coTyFP','2129904ljRMus','error','131586ARXADx','length'];a1_0x329b=function(){return _0x151af8;};return a1_0x329b();}import a1_0x1fa4ab from'os';import{logger}from'./logger.js';function a1_0x2967(_0x9ec5c9,_0x591abd){_0x9ec5c9=_0x9ec5c9-0xb2;var _0x329b58=a1_0x329b();var _0x296743=_0x329b58[_0x9ec5c9];return _0x296743;}export function getOperatingSystemType(_0x421b29=a1_0x1fa4ab[a1_0x260a34(0xc2)]()){var _0x51d62c=a1_0x260a34;switch(_0x421b29){case _0x51d62c(0xb7):return _0x51d62c(0xbd);case _0x51d62c(0xb4):return _0x51d62c(0xb5);case'linux':return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0xf7d8ef,_0x554279=a1_0x1fa4ab[a1_0x260a34(0xc2)]()){var _0x288f93=a1_0x260a34;return _0x288f93(0xc1)+getOperatingSystemType(_0x554279)+']\x20'+_0xf7d8ef;}export function logMcpStderr(_0x43d112,..._0x273a2c){var _0x7a70d0=a1_0x260a34;console[_0x7a70d0(0xc5)](formatMcpLogMessage(_0x43d112),..._0x273a2c),logger[_0x7a70d0(0xbb)](_0x7a70d0(0xbc),_0x43d112,_0x273a2c[_0x7a70d0(0xb3)]?{'args':_0x273a2c[_0x7a70d0(0xb6)](_0x36c2c7=>String(_0x36c2c7))}:undefined);}
1
+ var a1_0x55fc21=a1_0x1eea;(function(_0x5788c0,_0x30b3b1){var _0x1fd56e=a1_0x1eea,_0x3027fe=_0x5788c0();while(!![]){try{var _0x4f074b=parseInt(_0x1fd56e(0xdc))/0x1+-parseInt(_0x1fd56e(0xd9))/0x2*(-parseInt(_0x1fd56e(0xd5))/0x3)+parseInt(_0x1fd56e(0xe5))/0x4+parseInt(_0x1fd56e(0xde))/0x5+parseInt(_0x1fd56e(0xe1))/0x6*(parseInt(_0x1fd56e(0xdb))/0x7)+parseInt(_0x1fd56e(0xe4))/0x8+-parseInt(_0x1fd56e(0xd8))/0x9;if(_0x4f074b===_0x30b3b1)break;else _0x3027fe['push'](_0x3027fe['shift']());}catch(_0x55bab4){_0x3027fe['push'](_0x3027fe['shift']());}}}(a1_0x4ab8,0x967e8));function a1_0x1eea(_0x481d4a,_0x37376c){_0x481d4a=_0x481d4a-0xd4;var _0x4ab8a8=a1_0x4ab8();var _0x1eea3b=_0x4ab8a8[_0x481d4a];return _0x1eea3b;}import a1_0x4f52c5 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x2748aa=a1_0x4f52c5[a1_0x55fc21(0xdf)]()){var _0x256733=a1_0x55fc21;switch(_0x2748aa){case'darwin':return _0x256733(0xe6);case _0x256733(0xd7):return _0x256733(0xd6);case _0x256733(0xda):return _0x256733(0xe0);default:return _0x256733(0xdd);}}function a1_0x4ab8(){var _0x3eb925=['Unknown','4364060fuCTnN','platform','Linux','599598BLSFvy','length','map','5265176JAvmWZ','777320EfjcLu','macOS','MCP','3CAFwPI','Windows','win32','34579701LFKZZF','1940496wCgErh','linux','49YYYOop','1063545CgBPmi'];a1_0x4ab8=function(){return _0x3eb925;};return a1_0x4ab8();}export function formatMcpLogMessage(_0x4d59de,_0x40ec4f=a1_0x4f52c5['platform']()){return'[os='+getOperatingSystemType(_0x40ec4f)+']\x20'+_0x4d59de;}export function logMcpStderr(_0x3599b2,..._0x300155){var _0x4ad55c=a1_0x55fc21;console['error'](formatMcpLogMessage(_0x3599b2),..._0x300155),logger['info'](_0x4ad55c(0xd4),_0x3599b2,_0x300155[_0x4ad55c(0xe2)]?{'args':_0x300155[_0x4ad55c(0xe3)](_0x101b67=>String(_0x101b67))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0x5226cb=a2_0x4bb5;(function(_0x1a0983,_0x411c90){const _0x44413e=a2_0x4bb5,_0x52b50a=_0x1a0983();while(!![]){try{const _0x49810f=parseInt(_0x44413e(0x1d6))/0x1+parseInt(_0x44413e(0x1d3))/0x2*(-parseInt(_0x44413e(0x1c6))/0x3)+parseInt(_0x44413e(0x1cd))/0x4+-parseInt(_0x44413e(0x1c5))/0x5+parseInt(_0x44413e(0x1cb))/0x6+parseInt(_0x44413e(0x1d7))/0x7*(-parseInt(_0x44413e(0x1cf))/0x8)+parseInt(_0x44413e(0x1c4))/0x9;if(_0x49810f===_0x411c90)break;else _0x52b50a['push'](_0x52b50a['shift']());}catch(_0x46728f){_0x52b50a['push'](_0x52b50a['shift']());}}}(a2_0x15c4,0x958a8));import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x7513e7=a2_0x4bb5;this[_0x7513e7(0x1c7)]=process[_0x7513e7(0x1d5)][_0x7513e7(0x1c2)]==='1'||!!process[_0x7513e7(0x1d5)][_0x7513e7(0x1d8)];const _0x2307e5=process[_0x7513e7(0x1d5)][_0x7513e7(0x1d8)];this[_0x7513e7(0x1cc)]=_0x2307e5?createWriteStream(_0x2307e5,{'flags':'a'}):null;}[a2_0x5226cb(0x1c0)](_0x5f3ffe,_0x280a94,_0x204590){const _0x3b9add=a2_0x5226cb;this[_0x3b9add(0x1d4)](_0x3b9add(0x1c0),_0x5f3ffe,_0x280a94,_0x204590);}[a2_0x5226cb(0x1ce)](_0x4cf4ae,_0x44d849,_0x4da8b3){const _0x3ec65f=a2_0x5226cb;this[_0x3ec65f(0x1d4)](_0x3ec65f(0x1ce),_0x4cf4ae,_0x44d849,_0x4da8b3);}[a2_0x5226cb(0x1d2)](_0xf94ab4,_0x25b97b,_0xc9eb64){const _0x28089a=a2_0x5226cb;this[_0x28089a(0x1d4)](_0x28089a(0x1d2),_0xf94ab4,_0x25b97b,_0xc9eb64);}[a2_0x5226cb(0x1d1)](_0x2692c0,_0x4b4065,_0x4a96a7){const _0x293974=a2_0x5226cb;this[_0x293974(0x1d4)](_0x293974(0x1d1),_0x2692c0,_0x4b4065,_0x4a96a7);}[a2_0x5226cb(0x1d0)](){const _0x5cb2e3=a2_0x5226cb;this[_0x5cb2e3(0x1c7)]=!![];}get[a2_0x5226cb(0x1ca)](){const _0x5c37a4=a2_0x5226cb;return this[_0x5c37a4(0x1c7)];}['_log'](_0x28bc11,_0x155394,_0x4655f7,_0x4afde4){const _0x31fe7f=a2_0x5226cb;if(_0x28bc11!==_0x31fe7f(0x1d1)&&!this['enabled'])return;const _0x12ae89=new Date()[_0x31fe7f(0x1c8)](),_0x16add2='['+_0x12ae89+']\x20['+_0x28bc11[_0x31fe7f(0x1c9)]()+']\x20['+_0x155394+']';console[_0x31fe7f(0x1d1)](_0x4afde4?_0x16add2+'\x20'+_0x4655f7+'\x20'+JSON[_0x31fe7f(0x1c3)](_0x4afde4):_0x16add2+'\x20'+_0x4655f7),this[_0x31fe7f(0x1cc)]?.[_0x31fe7f(0x1c1)](JSON[_0x31fe7f(0x1c3)]({'ts':_0x12ae89,'level':_0x28bc11,'component':_0x155394,'msg':_0x4655f7,..._0x4afde4&&{'data':_0x4afde4}})+'\x0a');}}function a2_0x15c4(){const _0x52bc88=['error','warn','2nyFqwK','_log','env','78633MFxCji','301588pgfxJC','MORPH_LOG_FILE','debug','write','MORPH_DEBUG','stringify','4384296OgCyjQ','5742450KQTXQp','152964zTAXqy','enabled','toISOString','toUpperCase','isEnabled','2135826WRWsrI','fileStream','3905672trlvMX','info','16oMPjOA','enable'];a2_0x15c4=function(){return _0x52bc88;};return a2_0x15c4();}function a2_0x4bb5(_0x1723fa,_0x3efd10){_0x1723fa=_0x1723fa-0x1c0;const _0x15c43f=a2_0x15c4();let _0x4bb5ea=_0x15c43f[_0x1723fa];return _0x4bb5ea;}export const logger=new MorphLogger();
1
+ const a2_0x2f48a5=a2_0x2ae2;(function(_0x2eb1b3,_0x1993e5){const _0x13ab66=a2_0x2ae2,_0x53701c=_0x2eb1b3();while(!![]){try{const _0x5ac4ad=-parseInt(_0x13ab66(0x162))/0x1*(-parseInt(_0x13ab66(0x161))/0x2)+-parseInt(_0x13ab66(0x16f))/0x3+-parseInt(_0x13ab66(0x165))/0x4+parseInt(_0x13ab66(0x164))/0x5+parseInt(_0x13ab66(0x171))/0x6+-parseInt(_0x13ab66(0x16d))/0x7+parseInt(_0x13ab66(0x16a))/0x8*(-parseInt(_0x13ab66(0x16c))/0x9);if(_0x5ac4ad===_0x1993e5)break;else _0x53701c['push'](_0x53701c['shift']());}catch(_0x362af){_0x53701c['push'](_0x53701c['shift']());}}}(a2_0x7510,0xa912a));function a2_0x7510(){const _0x29d9db=['19IdkBIG','stringify','3129555MzpUHq','390708jIZKgO','env','enable','warn','info','8UTNtHp','enabled','155817juHCdC','6165649MswGay','MORPH_DEBUG','1012563TqYaMT','fileStream','6110682UowhQo','debug',']\x20[','error','_log','toUpperCase','40156XLunVc'];a2_0x7510=function(){return _0x29d9db;};return a2_0x7510();}import{createWriteStream}from'fs';function a2_0x2ae2(_0x26d52e,_0x1c7cba){_0x26d52e=_0x26d52e-0x161;const _0x7510e=a2_0x7510();let _0x2ae2e8=_0x7510e[_0x26d52e];return _0x2ae2e8;}class MorphLogger{[a2_0x2f48a5(0x16b)];[a2_0x2f48a5(0x170)];constructor(){const _0x56fa55=a2_0x2f48a5;this[_0x56fa55(0x16b)]=process[_0x56fa55(0x166)][_0x56fa55(0x16e)]==='1'||!!process[_0x56fa55(0x166)]['MORPH_LOG_FILE'];const _0x43213f=process[_0x56fa55(0x166)]['MORPH_LOG_FILE'];this[_0x56fa55(0x170)]=_0x43213f?createWriteStream(_0x43213f,{'flags':'a'}):null;}['debug'](_0xc1c681,_0x50316e,_0x1cad0c){const _0x122896=a2_0x2f48a5;this[_0x122896(0x175)](_0x122896(0x172),_0xc1c681,_0x50316e,_0x1cad0c);}[a2_0x2f48a5(0x169)](_0xaee7ce,_0x13c72,_0x112568){const _0x424a97=a2_0x2f48a5;this['_log'](_0x424a97(0x169),_0xaee7ce,_0x13c72,_0x112568);}[a2_0x2f48a5(0x168)](_0x1315a6,_0x1f23b3,_0x1500c2){const _0x28a59c=a2_0x2f48a5;this['_log'](_0x28a59c(0x168),_0x1315a6,_0x1f23b3,_0x1500c2);}['error'](_0x3dad08,_0x4d5aa3,_0x4c4777){const _0x67e0b5=a2_0x2f48a5;this[_0x67e0b5(0x175)](_0x67e0b5(0x174),_0x3dad08,_0x4d5aa3,_0x4c4777);}[a2_0x2f48a5(0x167)](){const _0x20f3d7=a2_0x2f48a5;this[_0x20f3d7(0x16b)]=!![];}get['isEnabled'](){const _0x8cc845=a2_0x2f48a5;return this[_0x8cc845(0x16b)];}['_log'](_0x49cb40,_0x4f2817,_0x39fbb4,_0x5b7872){const _0x332d7f=a2_0x2f48a5;if(_0x49cb40!==_0x332d7f(0x174)&&!this[_0x332d7f(0x16b)])return;const _0x32df2b=new Date()['toISOString'](),_0x2f1aaa='['+_0x32df2b+_0x332d7f(0x173)+_0x49cb40[_0x332d7f(0x176)]()+_0x332d7f(0x173)+_0x4f2817+']';console[_0x332d7f(0x174)](_0x5b7872?_0x2f1aaa+'\x20'+_0x39fbb4+'\x20'+JSON[_0x332d7f(0x163)](_0x5b7872):_0x2f1aaa+'\x20'+_0x39fbb4),this[_0x332d7f(0x170)]?.['write'](JSON[_0x332d7f(0x163)]({'ts':_0x32df2b,'level':_0x49cb40,'component':_0x4f2817,'msg':_0x39fbb4,..._0x5b7872&&{'data':_0x5b7872}})+'\x0a');}}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0x18136e,_0x17c8c7){const _0x21d491=a3_0x3abf,_0x514fcf=_0x18136e();while(!![]){try{const _0x5d054b=parseInt(_0x21d491(0x190))/0x1+parseInt(_0x21d491(0x196))/0x2+parseInt(_0x21d491(0x198))/0x3*(-parseInt(_0x21d491(0x188))/0x4)+-parseInt(_0x21d491(0x187))/0x5+parseInt(_0x21d491(0x189))/0x6*(parseInt(_0x21d491(0x199))/0x7)+-parseInt(_0x21d491(0x192))/0x8*(parseInt(_0x21d491(0x191))/0x9)+-parseInt(_0x21d491(0x197))/0xa*(parseInt(_0x21d491(0x18d))/0xb);if(_0x5d054b===_0x17c8c7)break;else _0x514fcf['push'](_0x514fcf['shift']());}catch(_0x42ad38){_0x514fcf['push'](_0x514fcf['shift']());}}}(a3_0x3f1d,0xdb028));import a3_0x453b06 from'path';import a3_0x102973 from'os';export function convertToWindowsPath(_0x459c2f){const _0x325567=a3_0x3abf;if(_0x459c2f[_0x325567(0x18a)]('/mnt/')){const _0x45a7f=_0x459c2f[_0x325567(0x18c)](0x5)['toUpperCase'](),_0x561aaf=_0x459c2f[_0x325567(0x193)](0x6)[_0x325567(0x194)](/\//g,'\x5c');return _0x45a7f+':'+_0x561aaf;}if(_0x459c2f[_0x325567(0x18e)](/^\/[a-zA-Z]\//)){const _0xe31746=_0x459c2f[_0x325567(0x18c)](0x1)['toUpperCase'](),_0x440e29=_0x459c2f[_0x325567(0x193)](0x2)[_0x325567(0x194)](/\//g,'\x5c');return _0xe31746+':'+_0x440e29;}if(_0x459c2f['match'](/^[a-zA-Z]:/))return _0x459c2f[_0x325567(0x194)](/\//g,'\x5c');return _0x459c2f;}export function normalizePath(_0x20dccf){const _0x694287=a3_0x3abf;_0x20dccf=_0x20dccf['trim']()[_0x694287(0x194)](/^["']|["']$/g,'');const _0x1068cd=_0x20dccf[_0x694287(0x18a)]('/')&&!_0x20dccf['match'](/^\/mnt\/[a-z]\//i)&&!_0x20dccf[_0x694287(0x18e)](/^\/[a-zA-Z]\//);if(_0x1068cd)return _0x20dccf[_0x694287(0x194)](/\/+/g,'/')[_0x694287(0x194)](/\/+$/,'');_0x20dccf=convertToWindowsPath(_0x20dccf);if(_0x20dccf[_0x694287(0x18a)]('\x5c\x5c')){let _0x1e1dc6=_0x20dccf;_0x1e1dc6=_0x1e1dc6['replace'](/^\\{2,}/,'\x5c\x5c');const _0x1906a8=_0x1e1dc6[_0x694287(0x18b)](0x2)[_0x694287(0x194)](/\\\\/g,'\x5c');_0x20dccf='\x5c\x5c'+_0x1906a8;}else _0x20dccf=_0x20dccf[_0x694287(0x194)](/\\\\/g,'\x5c');let _0x4922ac=a3_0x453b06['normalize'](_0x20dccf);_0x20dccf['startsWith']('\x5c\x5c')&&!_0x4922ac[_0x694287(0x18a)]('\x5c\x5c')&&(_0x4922ac='\x5c'+_0x4922ac);if(_0x4922ac[_0x694287(0x18e)](/^[a-zA-Z]:/)){let _0x48372f=_0x4922ac[_0x694287(0x194)](/\//g,'\x5c');return/^[a-z]:/[_0x694287(0x195)](_0x48372f)&&(_0x48372f=_0x48372f[_0x694287(0x18c)](0x0)[_0x694287(0x186)]()+_0x48372f[_0x694287(0x193)](0x1)),_0x48372f;}return _0x4922ac['replace'](/\//g,'\x5c');}export function expandHome(_0x3a5f99){const _0x101a43=a3_0x3abf;if(_0x3a5f99[_0x101a43(0x18a)]('~/')||_0x3a5f99==='~')return a3_0x453b06['join'](a3_0x102973[_0x101a43(0x18f)](),_0x3a5f99[_0x101a43(0x193)](0x1));return _0x3a5f99;}function a3_0x3abf(_0x1e64ac,_0x334e2e){_0x1e64ac=_0x1e64ac-0x186;const _0x3f1de8=a3_0x3f1d();let _0x3abf45=_0x3f1de8[_0x1e64ac];return _0x3abf45;}function a3_0x3f1d(){const _0x4be2a9=['954WMvOkc','startsWith','substring','charAt','4708033GYdvAe','match','homedir','1582988rviypK','535833twkFRk','40SOhMOp','slice','replace','test','3159674qxHMjc','20RNveRm','777888cVOsQI','742iTSPMH','toUpperCase','1755180emyKId','12Ksujom'];a3_0x3f1d=function(){return _0x4be2a9;};return a3_0x3f1d();}
1
+ (function(_0x504165,_0x5a9320){const _0x2a68ee=a3_0x12cc,_0x5b556e=_0x504165();while(!![]){try{const _0x581fcd=parseInt(_0x2a68ee(0x1ca))/0x1+parseInt(_0x2a68ee(0x1c9))/0x2*(parseInt(_0x2a68ee(0x1e0))/0x3)+-parseInt(_0x2a68ee(0x1d8))/0x4*(-parseInt(_0x2a68ee(0x1d6))/0x5)+parseInt(_0x2a68ee(0x1cd))/0x6+parseInt(_0x2a68ee(0x1d7))/0x7*(-parseInt(_0x2a68ee(0x1d5))/0x8)+-parseInt(_0x2a68ee(0x1da))/0x9+-parseInt(_0x2a68ee(0x1df))/0xa*(parseInt(_0x2a68ee(0x1de))/0xb);if(_0x581fcd===_0x5a9320)break;else _0x5b556e['push'](_0x5b556e['shift']());}catch(_0x9ebebf){_0x5b556e['push'](_0x5b556e['shift']());}}}(a3_0x9a67,0x6b56b));import a3_0x5e02a8 from'path';function a3_0x12cc(_0x2ef19e,_0x11a0ea){_0x2ef19e=_0x2ef19e-0x1c9;const _0x9a678e=a3_0x9a67();let _0x12cc26=_0x9a678e[_0x2ef19e];return _0x12cc26;}function a3_0x9a67(){const _0xb46d28=['16dRgvgy','5WVwhYX','1133461ktENuC','449028hgLauz','homedir','3990744OxclFj','join','slice','toUpperCase','1504063CCXGOP','40WwjudB','3UcbhaR','653202MCFzGC','871276zrHFfS','startsWith','match','2662314QyvJLn','replace','/mnt/','charAt','substring','normalize','test','trim'];a3_0x9a67=function(){return _0xb46d28;};return a3_0x9a67();}import a3_0x380b00 from'os';export function convertToWindowsPath(_0x96b4c5){const _0x32ad91=a3_0x12cc;if(_0x96b4c5[_0x32ad91(0x1cb)](_0x32ad91(0x1cf))){const _0x210bd6=_0x96b4c5[_0x32ad91(0x1d0)](0x5)[_0x32ad91(0x1dd)](),_0x11230e=_0x96b4c5[_0x32ad91(0x1dc)](0x6)['replace'](/\//g,'\x5c');return _0x210bd6+':'+_0x11230e;}if(_0x96b4c5[_0x32ad91(0x1cc)](/^\/[a-zA-Z]\//)){const _0x29bb4f=_0x96b4c5['charAt'](0x1)[_0x32ad91(0x1dd)](),_0x2dbd48=_0x96b4c5[_0x32ad91(0x1dc)](0x2)[_0x32ad91(0x1ce)](/\//g,'\x5c');return _0x29bb4f+':'+_0x2dbd48;}if(_0x96b4c5[_0x32ad91(0x1cc)](/^[a-zA-Z]:/))return _0x96b4c5[_0x32ad91(0x1ce)](/\//g,'\x5c');return _0x96b4c5;}export function normalizePath(_0x4dfc6f){const _0x400e80=a3_0x12cc;_0x4dfc6f=_0x4dfc6f[_0x400e80(0x1d4)]()[_0x400e80(0x1ce)](/^["']|["']$/g,'');const _0x3c274e=_0x4dfc6f['startsWith']('/')&&!_0x4dfc6f[_0x400e80(0x1cc)](/^\/mnt\/[a-z]\//i)&&!_0x4dfc6f[_0x400e80(0x1cc)](/^\/[a-zA-Z]\//);if(_0x3c274e)return _0x4dfc6f[_0x400e80(0x1ce)](/\/+/g,'/')['replace'](/\/+$/,'');_0x4dfc6f=convertToWindowsPath(_0x4dfc6f);if(_0x4dfc6f[_0x400e80(0x1cb)]('\x5c\x5c')){let _0x5c7782=_0x4dfc6f;_0x5c7782=_0x5c7782[_0x400e80(0x1ce)](/^\\{2,}/,'\x5c\x5c');const _0xe6d217=_0x5c7782[_0x400e80(0x1d1)](0x2)['replace'](/\\\\/g,'\x5c');_0x4dfc6f='\x5c\x5c'+_0xe6d217;}else _0x4dfc6f=_0x4dfc6f[_0x400e80(0x1ce)](/\\\\/g,'\x5c');let _0x51113f=a3_0x5e02a8[_0x400e80(0x1d2)](_0x4dfc6f);_0x4dfc6f['startsWith']('\x5c\x5c')&&!_0x51113f[_0x400e80(0x1cb)]('\x5c\x5c')&&(_0x51113f='\x5c'+_0x51113f);if(_0x51113f[_0x400e80(0x1cc)](/^[a-zA-Z]:/)){let _0x43f715=_0x51113f[_0x400e80(0x1ce)](/\//g,'\x5c');return/^[a-z]:/[_0x400e80(0x1d3)](_0x43f715)&&(_0x43f715=_0x43f715['charAt'](0x0)[_0x400e80(0x1dd)]()+_0x43f715[_0x400e80(0x1dc)](0x1)),_0x43f715;}return _0x51113f[_0x400e80(0x1ce)](/\//g,'\x5c');}export function expandHome(_0x17d368){const _0x20325f=a3_0x12cc;if(_0x17d368[_0x20325f(0x1cb)]('~/')||_0x17d368==='~')return a3_0x5e02a8[_0x20325f(0x1db)](a3_0x380b00[_0x20325f(0x1d9)](),_0x17d368[_0x20325f(0x1dc)](0x1));return _0x17d368;}
@@ -1 +1 @@
1
- function a4_0x3199(){const _0x5b074b=['normalize','198BBJIQV','2288930amRFAh','6iOoueK','isArray','1090zjbeMY','4172232VQBlRl','75427rhmaVF','15532CnPDLi','2415807skEJhL','907494TzviGc','sep','resolve','isAbsolute','501lnRegU','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some','string','includes','4288mwfXCg','16XWkGvx','Path\x20must\x20be\x20absolute\x20after\x20normalization'];a4_0x3199=function(){return _0x5b074b;};return a4_0x3199();}(function(_0x1ff8f7,_0x52f931){const _0x3780c3=a4_0x2476,_0x24b467=_0x1ff8f7();while(!![]){try{const _0x38f81a=parseInt(_0x3780c3(0x1c2))/0x1*(-parseInt(_0x3780c3(0x1c6))/0x2)+-parseInt(_0x3780c3(0x1bd))/0x3*(-parseInt(_0x3780c3(0x1cd))/0x4)+parseInt(_0x3780c3(0x1c7))/0x5*(parseInt(_0x3780c3(0x1c8))/0x6)+parseInt(_0x3780c3(0x1cf))/0x7+-parseInt(_0x3780c3(0x1c3))/0x8*(parseInt(_0x3780c3(0x1ce))/0x9)+-parseInt(_0x3780c3(0x1ca))/0xa*(-parseInt(_0x3780c3(0x1cc))/0xb)+-parseInt(_0x3780c3(0x1cb))/0xc;if(_0x38f81a===_0x52f931)break;else _0x24b467['push'](_0x24b467['shift']());}catch(_0x4431fc){_0x24b467['push'](_0x24b467['shift']());}}}(a4_0x3199,0xa49d2));function a4_0x2476(_0x34f40e,_0x209605){_0x34f40e=_0x34f40e-0x1bc;const _0x31991f=a4_0x3199();let _0x2476ff=_0x31991f[_0x34f40e];return _0x2476ff;}import a4_0x1eeeb3 from'path';export function isPathWithinAllowedDirectories(_0xda619e,_0x33914f){const _0x4d23f8=a4_0x2476;if(typeof _0xda619e!=='string'||!Array[_0x4d23f8(0x1c9)](_0x33914f))return![];if(!_0xda619e||_0x33914f['length']===0x0)return![];if(_0xda619e['includes']('\x00'))return![];let _0x38aec8;try{_0x38aec8=a4_0x1eeeb3[_0x4d23f8(0x1d1)](a4_0x1eeeb3[_0x4d23f8(0x1c5)](_0xda619e));}catch{return![];}if(!a4_0x1eeeb3[_0x4d23f8(0x1bc)](_0x38aec8))throw new Error(_0x4d23f8(0x1c4));return _0x33914f[_0x4d23f8(0x1bf)](_0x40647e=>{const _0x26ec3a=_0x4d23f8;if(typeof _0x40647e!==_0x26ec3a(0x1c0)||!_0x40647e)return![];if(_0x40647e[_0x26ec3a(0x1c1)]('\x00'))return![];let _0x49a49d;try{_0x49a49d=a4_0x1eeeb3[_0x26ec3a(0x1d1)](a4_0x1eeeb3['normalize'](_0x40647e));}catch{return![];}if(!a4_0x1eeeb3[_0x26ec3a(0x1bc)](_0x49a49d))throw new Error(_0x26ec3a(0x1be));if(_0x38aec8===_0x49a49d)return!![];if(_0x49a49d===a4_0x1eeeb3[_0x26ec3a(0x1d0)])return _0x38aec8['startsWith'](a4_0x1eeeb3[_0x26ec3a(0x1d0)]);return _0x38aec8['startsWith'](_0x49a49d+a4_0x1eeeb3[_0x26ec3a(0x1d0)]);});}
1
+ (function(_0x5d219c,_0x250648){const _0x3ea2e1=a4_0xb027,_0x27f4a5=_0x5d219c();while(!![]){try{const _0xabd224=-parseInt(_0x3ea2e1(0xd8))/0x1*(-parseInt(_0x3ea2e1(0xdb))/0x2)+-parseInt(_0x3ea2e1(0xe6))/0x3+-parseInt(_0x3ea2e1(0xde))/0x4+parseInt(_0x3ea2e1(0xdc))/0x5+-parseInt(_0x3ea2e1(0xd4))/0x6+-parseInt(_0x3ea2e1(0xe4))/0x7*(-parseInt(_0x3ea2e1(0xd6))/0x8)+parseInt(_0x3ea2e1(0xd9))/0x9*(parseInt(_0x3ea2e1(0xd7))/0xa);if(_0xabd224===_0x250648)break;else _0x27f4a5['push'](_0x27f4a5['shift']());}catch(_0x1f37e8){_0x27f4a5['push'](_0x27f4a5['shift']());}}}(a4_0x2b9e,0x3900f));function a4_0x2b9e(){const _0x3655c0=['startsWith','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','1271459NBrkFo','sep','1229127lcMbJj','includes','1943568LrHmlM','string','16RTskAs','230KemyRu','213ASGZxz','172764qYlZtX','normalize','2642BymTrt','1338030hXGKXT','some','1546548xNcRXG','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute'];a4_0x2b9e=function(){return _0x3655c0;};return a4_0x2b9e();}function a4_0xb027(_0x266749,_0x8d6734){_0x266749=_0x266749-0xd3;const _0x2b9e22=a4_0x2b9e();let _0xb027b0=_0x2b9e22[_0x266749];return _0xb027b0;}import a4_0x3633f9 from'path';export function isPathWithinAllowedDirectories(_0x44f146,_0x34e2b9){const _0x327f44=a4_0xb027;if(typeof _0x44f146!==_0x327f44(0xd5)||!Array['isArray'](_0x34e2b9))return![];if(!_0x44f146||_0x34e2b9['length']===0x0)return![];if(_0x44f146['includes']('\x00'))return![];let _0x828ade;try{_0x828ade=a4_0x3633f9[_0x327f44(0xe2)](a4_0x3633f9[_0x327f44(0xda)](_0x44f146));}catch{return![];}if(!a4_0x3633f9[_0x327f44(0xe0)](_0x828ade))throw new Error(_0x327f44(0xe3));return _0x34e2b9[_0x327f44(0xdd)](_0x2930aa=>{const _0x1f9340=_0x327f44;if(typeof _0x2930aa!==_0x1f9340(0xd5)||!_0x2930aa)return![];if(_0x2930aa[_0x1f9340(0xd3)]('\x00'))return![];let _0x52c5d7;try{_0x52c5d7=a4_0x3633f9['resolve'](a4_0x3633f9[_0x1f9340(0xda)](_0x2930aa));}catch{return![];}if(!a4_0x3633f9[_0x1f9340(0xe0)](_0x52c5d7))throw new Error(_0x1f9340(0xdf));if(_0x828ade===_0x52c5d7)return!![];if(_0x52c5d7===a4_0x3633f9[_0x1f9340(0xe5)])return _0x828ade[_0x1f9340(0xe1)](a4_0x3633f9[_0x1f9340(0xe5)]);return _0x828ade[_0x1f9340(0xe1)](_0x52c5d7+a4_0x3633f9['sep']);});}
@@ -1 +1 @@
1
- (function(_0x14add4,_0x5b247b){const _0x4cf208=a5_0x21d9,_0x31e407=_0x14add4();while(!![]){try{const _0x4c75fa=-parseInt(_0x4cf208(0x16d))/0x1+-parseInt(_0x4cf208(0x164))/0x2*(parseInt(_0x4cf208(0x16c))/0x3)+parseInt(_0x4cf208(0x170))/0x4*(parseInt(_0x4cf208(0x15e))/0x5)+parseInt(_0x4cf208(0x16f))/0x6*(parseInt(_0x4cf208(0x163))/0x7)+-parseInt(_0x4cf208(0x167))/0x8+parseInt(_0x4cf208(0x160))/0x9*(-parseInt(_0x4cf208(0x166))/0xa)+-parseInt(_0x4cf208(0x169))/0xb*(-parseInt(_0x4cf208(0x168))/0xc);if(_0x4c75fa===_0x5b247b)break;else _0x31e407['push'](_0x31e407['shift']());}catch(_0x349c2c){_0x31e407['push'](_0x31e407['shift']());}}}(a5_0x6067,0x1d5ef));import{promises as a5_0x472eb2}from'fs';import a5_0x11bf4d from'path';import a5_0x5738d2 from'os';function a5_0x6067(){const _0x4be585=['\x20due\x20to\x20error:\x20','non-directory\x20root','invalid\x20path\x20or\x20inaccessible','9965sKHKoV','resolve','9WfOAXO','join','uri','14Nhtbzi','52ZnYnNJ','startsWith','2194190JgjUyp','1736680bOcxZO','200628MhABvu','605JWoDYT','file://','Skipping\x20','25182VClrzb','217215MEuCWs','slice','80646OBvkGt','92WZsnbt','message','realpath','homedir'];a5_0x6067=function(){return _0x4be585;};return a5_0x6067();}import{normalizePath}from'./path-utils.js';function a5_0x21d9(_0x525119,_0x3d5af2){_0x525119=_0x525119-0x15a;const _0x606712=a5_0x6067();let _0x21d9df=_0x606712[_0x525119];return _0x21d9df;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x22981b){const _0x2c002d=a5_0x21d9;try{const _0x407b8a=_0x22981b['startsWith'](_0x2c002d(0x16a))?_0x22981b[_0x2c002d(0x16e)](0x7):_0x22981b,_0x3a3f7e=_0x407b8a[_0x2c002d(0x165)]('~/')||_0x407b8a==='~'?a5_0x11bf4d[_0x2c002d(0x161)](a5_0x5738d2[_0x2c002d(0x15a)](),_0x407b8a['slice'](0x1)):_0x407b8a,_0x21ad64=a5_0x11bf4d[_0x2c002d(0x15f)](_0x3a3f7e),_0x5dc9c2=await a5_0x472eb2[_0x2c002d(0x172)](_0x21ad64);return normalizePath(_0x5dc9c2);}catch{return null;}}function formatDirectoryError(_0x15b76e,_0x5980b7,_0x5f3a4f){const _0x3b133f=a5_0x21d9;if(_0x5f3a4f)return _0x3b133f(0x16b)+_0x5f3a4f+':\x20'+_0x15b76e;const _0x2c87fb=_0x5980b7 instanceof Error?_0x5980b7[_0x3b133f(0x171)]:String(_0x5980b7);return'Skipping\x20invalid\x20directory:\x20'+_0x15b76e+_0x3b133f(0x15b)+_0x2c87fb;}export async function getValidRootDirectories(_0x155dab){const _0x3a0969=a5_0x21d9,_0x5e779b=[];for(const _0x615fce of _0x155dab){const _0x3f6877=await parseRootUri(_0x615fce['uri']);if(!_0x3f6877){logMcpStderr(formatDirectoryError(_0x615fce[_0x3a0969(0x162)],undefined,_0x3a0969(0x15d)));continue;}try{const _0x22f2ae=await a5_0x472eb2['stat'](_0x3f6877);_0x22f2ae['isDirectory']()?_0x5e779b['push'](_0x3f6877):logMcpStderr(formatDirectoryError(_0x3f6877,undefined,_0x3a0969(0x15c)));}catch(_0xb135f9){logMcpStderr(formatDirectoryError(_0x3f6877,_0xb135f9));}}return _0x5e779b;}
1
+ (function(_0xa0c7b8,_0x38baec){const _0x24dc21=a5_0x3046,_0x345437=_0xa0c7b8();while(!![]){try{const _0x38b37f=-parseInt(_0x24dc21(0x163))/0x1*(-parseInt(_0x24dc21(0x166))/0x2)+parseInt(_0x24dc21(0x155))/0x3*(-parseInt(_0x24dc21(0x168))/0x4)+-parseInt(_0x24dc21(0x159))/0x5*(-parseInt(_0x24dc21(0x160))/0x6)+parseInt(_0x24dc21(0x15e))/0x7+-parseInt(_0x24dc21(0x158))/0x8+parseInt(_0x24dc21(0x15a))/0x9+-parseInt(_0x24dc21(0x154))/0xa*(parseInt(_0x24dc21(0x15c))/0xb);if(_0x38b37f===_0x38baec)break;else _0x345437['push'](_0x345437['shift']());}catch(_0x51150e){_0x345437['push'](_0x345437['shift']());}}}(a5_0x462c,0x3c541));import{promises as a5_0x48abf6}from'fs';function a5_0x462c(){const _0x51916f=['2uVNqCN','\x20due\x20to\x20error:\x20','30028BUtFTV','isDirectory','10hfPgHx','183dgnmJY','Skipping\x20invalid\x20directory:\x20','push','1193048SehmTo','10HSdEfL','2527470LjkQgy','uri','2103761SeItIT','realpath','1549737Lfhguk','Skipping\x20','1018728bkZOFZ','join','message','203617oRCLCx','slice','non-directory\x20root'];a5_0x462c=function(){return _0x51916f;};return a5_0x462c();}import a5_0x32a4fd from'path';import a5_0x1effb2 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';function a5_0x3046(_0x2b53d3,_0x4d067a){_0x2b53d3=_0x2b53d3-0x154;const _0x462c41=a5_0x462c();let _0x3046f9=_0x462c41[_0x2b53d3];return _0x3046f9;}async function parseRootUri(_0x57a859){const _0x2f6d25=a5_0x3046;try{const _0x25530e=_0x57a859['startsWith']('file://')?_0x57a859[_0x2f6d25(0x164)](0x7):_0x57a859,_0xfe7942=_0x25530e['startsWith']('~/')||_0x25530e==='~'?a5_0x32a4fd[_0x2f6d25(0x161)](a5_0x1effb2['homedir'](),_0x25530e[_0x2f6d25(0x164)](0x1)):_0x25530e,_0x224aaf=a5_0x32a4fd['resolve'](_0xfe7942),_0x4e300f=await a5_0x48abf6[_0x2f6d25(0x15d)](_0x224aaf);return normalizePath(_0x4e300f);}catch{return null;}}function formatDirectoryError(_0x3c59d6,_0x963c0f,_0x219792){const _0x4acf0c=a5_0x3046;if(_0x219792)return _0x4acf0c(0x15f)+_0x219792+':\x20'+_0x3c59d6;const _0x1db556=_0x963c0f instanceof Error?_0x963c0f[_0x4acf0c(0x162)]:String(_0x963c0f);return _0x4acf0c(0x156)+_0x3c59d6+_0x4acf0c(0x167)+_0x1db556;}export async function getValidRootDirectories(_0x11350b){const _0x4e6298=a5_0x3046,_0x18b172=[];for(const _0x37756f of _0x11350b){const _0x450330=await parseRootUri(_0x37756f[_0x4e6298(0x15b)]);if(!_0x450330){logMcpStderr(formatDirectoryError(_0x37756f[_0x4e6298(0x15b)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x5645ef=await a5_0x48abf6['stat'](_0x450330);_0x5645ef[_0x4e6298(0x169)]()?_0x18b172[_0x4e6298(0x157)](_0x450330):logMcpStderr(formatDirectoryError(_0x450330,undefined,_0x4e6298(0x165)));}catch(_0x1fa206){logMcpStderr(formatDirectoryError(_0x450330,_0x1fa206));}}return _0x18b172;}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Canonical MCP tool names.
3
+ *
4
+ * Both the server (index.ts) and tests import from here so
5
+ * the set of advertised tools stays in sync.
6
+ */
7
+ export declare const TOOL_NAMES: {
8
+ readonly EDIT_FILE: "edit_file";
9
+ readonly CODEBASE_SEARCH: "codebase_search";
10
+ readonly GITHUB_CODEBASE_SEARCH: "github_codebase_search";
11
+ };
12
+ export type ToolName = (typeof TOOL_NAMES)[keyof typeof TOOL_NAMES];
13
+ export declare const ALL_TOOL_NAMES: readonly ToolName[];
14
+ export declare const KNOWN_TOOL_NAMES: Set<string>;
@@ -0,0 +1 @@
1
+ function a6_0x38b9(_0x3a3150,_0x1fc209){_0x3a3150=_0x3a3150-0x74;const _0x36bdae=a6_0x36bd();let _0x38b9f8=_0x36bdae[_0x3a3150];return _0x38b9f8;}const a6_0x34434c=a6_0x38b9;function a6_0x36bd(){const _0x155873=['4518441AFftjT','6HORzZB','21832ubmEYu','189qjfDMj','11NFyWzh','622228mmQWTw','codebase_search','184050UGdhsF','github_codebase_search','18498kzttsQ','1964750bmgIzO','295YXdXBn','edit_file','929060KwWomh'];a6_0x36bd=function(){return _0x155873;};return a6_0x36bd();}(function(_0x98ba3d,_0x3c793e){const _0xed665=a6_0x38b9,_0x317040=_0x98ba3d();while(!![]){try{const _0x155fd2=-parseInt(_0xed665(0x74))/0x1+-parseInt(_0xed665(0x7a))/0x2+-parseInt(_0xed665(0x7c))/0x3*(-parseInt(_0xed665(0x80))/0x4)+parseInt(_0xed665(0x78))/0x5*(-parseInt(_0xed665(0x76))/0x6)+-parseInt(_0xed665(0x7e))/0x7*(-parseInt(_0xed665(0x7d))/0x8)+parseInt(_0xed665(0x7b))/0x9+-parseInt(_0xed665(0x77))/0xa*(-parseInt(_0xed665(0x7f))/0xb);if(_0x155fd2===_0x3c793e)break;else _0x317040['push'](_0x317040['shift']());}catch(_0xf67d64){_0x317040['push'](_0x317040['shift']());}}}(a6_0x36bd,0x3dbac));export const TOOL_NAMES={'EDIT_FILE':a6_0x34434c(0x79),'CODEBASE_SEARCH':a6_0x34434c(0x81),'GITHUB_CODEBASE_SEARCH':a6_0x34434c(0x75)};export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.165",
3
+ "version": "0.8.166",
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.164",
38
+ "@morphllm/morphsdk": "0.2.166",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",