@morphllm/morphmcp 0.8.165 → 0.8.167
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 +1 -1
- package/dist/log-utils.js +1 -1
- package/dist/logger.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/dist/tool-definitions.d.ts +14 -0
- package/dist/tool-definitions.js +1 -0
- package/package.json +2 -2
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_0x2bc7ea=a0_0x344f;(function(_0x508ccc,_0x33cc97){const _0x174480=a0_0x344f,_0x4cc3f2=_0x508ccc();while(!![]){try{const _0x5f3d94=parseInt(_0x174480(0x296))/0x1+parseInt(_0x174480(0x271))/0x2+-parseInt(_0x174480(0x26b))/0x3+parseInt(_0x174480(0x217))/0x4+parseInt(_0x174480(0x277))/0x5*(parseInt(_0x174480(0x1ef))/0x6)+parseInt(_0x174480(0x2e4))/0x7*(-parseInt(_0x174480(0x1e2))/0x8)+-parseInt(_0x174480(0x1d3))/0x9*(parseInt(_0x174480(0x202))/0xa);if(_0x5f3d94===_0x33cc97)break;else _0x4cc3f2['push'](_0x4cc3f2['shift']());}catch(_0x409164){_0x4cc3f2['push'](_0x4cc3f2['shift']());}}}(a0_0x1d8c,0x80fe9));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_0x497a28 from'fs/promises';import a0_0x51eed8 from'path';import a0_0x339893 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_0x44192c from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x3c901a){const _0x3f21be=a0_0x344f,_0x44c54d=_0x3c901a[_0x3f21be(0x2a8)](a0_0x51eed8[_0x3f21be(0x297)])[_0x3f21be(0x1e9)](Boolean);if(_0x44c54d[_0x3f21be(0x2e5)]<0x2)return null;for(let _0x1e82cd=Math[_0x3f21be(0x207)](_0x44c54d['length']/0x2);_0x1e82cd>=0x1;_0x1e82cd--){for(let _0x412772=0x0;_0x412772<=_0x44c54d[_0x3f21be(0x2e5)]-0x2*_0x1e82cd;_0x412772++){const _0x29f39e=_0x44c54d['slice'](_0x412772,_0x412772+_0x1e82cd),_0x5d2821=_0x44c54d[_0x3f21be(0x266)](_0x412772+_0x1e82cd,_0x412772+0x2*_0x1e82cd);if(_0x29f39e[_0x3f21be(0x2c6)]((_0x114291,_0xa1064d)=>_0x114291===_0x5d2821[_0xa1064d])){const _0x3c663e=[..._0x44c54d[_0x3f21be(0x266)](0x0,_0x412772),..._0x44c54d[_0x3f21be(0x266)](_0x412772+_0x1e82cd)];return a0_0x51eed8['sep']+_0x3c663e[_0x3f21be(0x1dc)](a0_0x51eed8['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x534e09=a0_0x344f;try{const _0x4a5fee=require('../package.json');return _0x4a5fee[_0x534e09(0x25f)]??'unknown';}catch(_0xb9c2a9){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0xb9c2a9),_0x534e09(0x205);}}function printHelp(){const _0x363c4e=a0_0x344f;console[_0x363c4e(0x203)](_0x363c4e(0x21f)+getPackageVersion()),console['log'](_0x363c4e(0x2ce)),console[_0x363c4e(0x203)](_0x363c4e(0x27d)),console[_0x363c4e(0x203)](_0x363c4e(0x2ad)),console[_0x363c4e(0x203)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x363c4e(0x203)](_0x363c4e(0x2ae)),console[_0x363c4e(0x203)]('\x0aExamples:'),console[_0x363c4e(0x203)]('\x20\x20morph-mcp'),console[_0x363c4e(0x203)](_0x363c4e(0x243));}const cliArgs=process[a0_0x2bc7ea(0x244)][a0_0x2bc7ea(0x266)](0x2),VERSION_FLAGS=new Set([a0_0x2bc7ea(0x22c),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs['some'](_0x5adca0=>VERSION_FLAGS[a0_0x2bc7ea(0x272)](_0x5adca0))&&(console[a0_0x2bc7ea(0x203)](a0_0x2bc7ea(0x21f)+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x576bac=>HELP_FLAGS[a0_0x2bc7ea(0x272)](_0x576bac))&&(printHelp(),process[a0_0x2bc7ea(0x1e7)](0x0));function getCliArg(_0x158929){const _0x2bfb11=a0_0x2bc7ea;for(let _0x59e8c0=0x0;_0x59e8c0<cliArgs[_0x2bfb11(0x2e5)];_0x59e8c0++){const _0x59f0f9=cliArgs[_0x59e8c0];if(_0x59f0f9['startsWith']('--'+_0x158929+'='))return _0x59f0f9[_0x2bfb11(0x266)](('--'+_0x158929+'=')[_0x2bfb11(0x2e5)]);if(_0x59f0f9==='--'+_0x158929&&_0x59e8c0+0x1<cliArgs[_0x2bfb11(0x2e5)])return cliArgs[_0x59e8c0+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x2bc7ea(0x2e5)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x2bc7ea(0x272)](arg)||HELP_FLAGS[a0_0x2bc7ea(0x272)](arg))continue;if(arg[a0_0x2bc7ea(0x2b8)](a0_0x2bc7ea(0x237)))continue;if(arg===a0_0x2bc7ea(0x2ed)){i++;continue;}args[a0_0x2bc7ea(0x28a)](arg);}const WORKSPACE_ROOT=process[a0_0x2bc7ea(0x2d7)]['WORKSPACE_ROOT']||process[a0_0x2bc7ea(0x2d7)][a0_0x2bc7ea(0x2e8)]||process[a0_0x2bc7ea(0x1d4)](),ENABLE_WORKSPACE_MODE=process[a0_0x2bc7ea(0x2d7)][a0_0x2bc7ea(0x29b)]!==a0_0x2bc7ea(0x2a9),MORPH_API_KEY=getCliArg(a0_0x2bc7ea(0x259))??process[a0_0x2bc7ea(0x2d7)][a0_0x2bc7ea(0x21d)],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_LARGE_APPLY=process['env'][a0_0x2bc7ea(0x257)]!==a0_0x2bc7ea(0x2a9),MORPH_WARP_GREP_TIMEOUT=process[a0_0x2bc7ea(0x2d7)][a0_0x2bc7ea(0x256)]?parseInt(process[a0_0x2bc7ea(0x2d7)][a0_0x2bc7ea(0x256)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x2bc7ea(0x2d7)]['DISABLED_TOOLS']?new Set(process[a0_0x2bc7ea(0x2d7)][a0_0x2bc7ea(0x216)][a0_0x2bc7ea(0x2a8)](',')[a0_0x2bc7ea(0x231)](_0x59e19d=>_0x59e19d['trim']())[a0_0x2bc7ea(0x1e9)](_0x2e2b12=>_0x2e2b12[a0_0x2bc7ea(0x2e5)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x2bc7ea(0x272)](tool)&&console[a0_0x2bc7ea(0x2c1)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x2bc7ea(0x1dc)](',\x20'));}console[a0_0x2bc7ea(0x2c1)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x2bc7ea(0x1dc)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x2bc7ea(0x2b8)](a0_0x2bc7ea(0x28c))&&!MORPH_API_KEY[a0_0x2bc7ea(0x2b8)](a0_0x2bc7ea(0x2c2))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x254cec){const _0x13dcd0=a0_0x2bc7ea;try{await a0_0x44192c['post'](_0x13dcd0(0x1c9),{..._0x254cec,'timestamp':new Date()[_0x13dcd0(0x284)](),'source':_0x254cec['source']||_0x13dcd0(0x2bd),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x254cec[_0x13dcd0(0x25e)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x13dcd0(0x2ba),'Authorization':_0x13dcd0(0x1f8)+MORPH_API_KEY}});}catch{}}function a0_0x1d8c(){const _0x34173f=['roots','user','command','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','parse','path','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','join','[could\x20not\x20read\x20file:\x20','ms.\x20Success:\x20','node_modules','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','linesRemoved','1296haZBpc','list_directory','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','tool_call_error','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','exit','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','filter','Warning:\x20','0.2.0','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','timeout','linesModified','1934574VpFSzw','WarpGrepError','API\x20error\x20(auth/rate-limit)','Failed\x20to\x20request\x20roots\x20from\x20client:','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','file_read_complete','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','code_edit','timings','Bearer\x20','api_request_start','read\x20','WarpGrep\x20sub-tool\x20errors:\x20','setRequestHandler','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','dirname','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','CODEBASE_SEARCH','name','258030wqhWea','log','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','unknown','GITHUB_CODEBASE_SEARCH','floor','connect','\x20disabled\x20via\x20DISABLED_TOOLS','Created\x20File','File\x20read\x20error:','Workspace\x20mode\x20enabled:\x20Using\x20','toLowerCase','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','oninitialized','response','metadata','dryRun','finish','search_type','TimeoutError','DISABLED_TOOLS','2058744aCPYvH','RipgrepNotAvailable','ReadError','edit_file','warp_grep_start','tsconfig.json','MORPH_API_KEY','Morph\x20Edit\x20','@morphllm/morphmcp\x20','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','ENOENT','For\x20deletions:\x0a','path_validation_failed','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','min','terminated','stack','completionId','Applied','describe','Here\x20is\x20the\x20content\x20of\x20files:\x0a','--version','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','errors','boolean','\x20valid\x20directories','map','Parent\x20directory\x20does\x20not\x20exist:\x20','text','includes','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','--api-key=','github_codebase_search','repo_path','Max\x20results\x20to\x20return','FileReadError','MCP','Error:\x20','default','RipgrepError','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.','SubToolError','pyproject.toml','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','argv','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Tool\x20','enum','\x22>\x0a','all','\x20(new\x20file)','changes','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.','SymlinkError','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','readFile','code','`\x20in\x20`','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','searchGitHub','MORPH_WARP_GREP_TIMEOUT','MORPH_LARGE_APPLY','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','api-key','\x0a</file>','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','params','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','context','version','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.','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','list_directory\x20','branch','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Cargo.toml','slice','success','read','now','grep_search','2254791pUurBk','-\x20Grepped\x20\x27','.\x20Changes:\x20','BinaryFile','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','files','718260vQVjei','has','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','unknown\x20error','search_string','-\x20Listed\x20directory\x20`','15MhUDMH','warn','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','added\x20','ms:','Warning:\x20Workspace\x20fallback\x20failed:\x20','\x0aOptions:','match','Specific\x20commit\x20hash\x20to\x20search','morph-warp-grep-v2.1','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','optional','❌\x20Morph\x20Edit\x20Failed:\x20','toISOString','getClientCapabilities','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Fatal\x20error\x20running\x20server:','Morph\x20Edit\x20Preview','push','package.json','sk-','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','safeParse','instruction','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','tool_call_received','morph-v3-fast','tool','requiresApiKey','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.','204530vYSRxY','sep','catch','isDirectory','instructions','ENABLE_WORKSPACE_MODE','array','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','codebase_search','tool_call_id','runWarpGrep_call','listRoots','tool_calls','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','morph-mcp','\x20-\x20','linesAdded','debug','split','false','Invalid\x20arguments:\x20','.\x20Path:\x20','completed','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','messages',',\x20removed\x20','isArray','\x20error(s)','ToolException','substring','constructor','realpath','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','startsWith','morph-v3-large','application/json','pattern','utf-8','mcp-filesystem','PathError','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','setNotificationHandler','error','morph-','grep','\x27\x20in\x20`','tool_call_complete','every','\x0a...\x20(truncated,\x20total:\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.','lines','GitHub\x20search\x20failed:\x20','\x20chars)','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','FileNotFound','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','content','function','Tool\x20\x22','glob','message','resolve','status','env','path_validation_resolved','inputSchema','terminationReason','Benefits:\x0a','etimedout','Error\x20accessing\x20directory\x20','number','Fallback:\x20Using\x20workspace\x20root\x20','Morph\x20FastApply\x20failed\x20without\x20error\x20message','normalize',',\x20modified\x20','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','7441uyYfFq','length','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','string','PWD','compaction_failed','basename','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','github_search_start','--api-key','\x22>\x0aError\x20reading\x20file:\x20','UnknownError','warp_grep_complete','completed_with_file_errors','go.mod','object','source','assistant','LocalRipgrepProvider','composer.json','.cursor','https://morphllm.com/api/error-report','data','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x20is\x20not\x20a\x20directory','role','indexOf','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','github_url','grep\x20\x27','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','207ZRyWsp','cwd'];a0_0x1d8c=function(){return _0x34173f;};return a0_0x1d8c();}function extractStatusCode(_0x5ad159,_0x17c8c4){const _0x3ad08c=a0_0x2bc7ea;if(_0x5ad159&&typeof _0x5ad159===_0x3ad08c(0x1c3)&&_0x3ad08c(0x2d6)in _0x5ad159)return _0x5ad159[_0x3ad08c(0x2d6)];if(_0x5ad159&&typeof _0x5ad159===_0x3ad08c(0x1c3)&&_0x3ad08c(0x210)in _0x5ad159)return _0x5ad159[_0x3ad08c(0x210)]?.['status'];const _0x7b7ac3=_0x17c8c4[_0x3ad08c(0x27e)](/\b(401|429)\b/);return _0x7b7ac3?parseInt(_0x7b7ac3[0x1],0xa):null;}function handleMorphAPIError(_0x4bfb7b){const _0x4a1702=a0_0x2bc7ea,_0x4b2770=_0x4bfb7b instanceof Error?_0x4bfb7b['message']:String(_0x4bfb7b),_0x141021=extractStatusCode(_0x4bfb7b,_0x4b2770);switch(_0x141021){case 0x191:return{'content':[{'type':_0x4a1702(0x233),'text':_0x4a1702(0x240)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x4a1702(0x2e3)}],'isError':!![]};default:return null;}}args[a0_0x2bc7ea(0x2e5)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x2bc7ea(0x1e4)),logMcpStderr(a0_0x2bc7ea(0x247)),logMcpStderr(a0_0x2bc7ea(0x236)),logMcpStderr(a0_0x2bc7ea(0x2b7)),logMcpStderr(a0_0x2bc7ea(0x290)),logMcpStderr(a0_0x2bc7ea(0x1fd)));function normalizePath(_0x3f4270){const _0x591c11=a0_0x2bc7ea;return a0_0x51eed8[_0x591c11(0x2e1)](_0x3f4270);}function expandHome(_0x4cfd16){const _0x21f7f4=a0_0x2bc7ea;if(_0x4cfd16[_0x21f7f4(0x2b8)]('~/')||_0x4cfd16==='~')return a0_0x51eed8[_0x21f7f4(0x1dc)](a0_0x339893['homedir'](),_0x4cfd16[_0x21f7f4(0x266)](0x1));return _0x4cfd16;}let allowedDirectories=await Promise[a0_0x2bc7ea(0x24b)](args[a0_0x2bc7ea(0x231)](async _0x58b449=>{const _0x1f9b83=a0_0x2bc7ea,_0x360846=expandHome(_0x58b449),_0x441dd7=a0_0x51eed8[_0x1f9b83(0x2d5)](_0x360846);try{const _0x80888=await a0_0x497a28[_0x1f9b83(0x2b6)](_0x441dd7);return normalizePath(_0x80888);}catch(_0x421eed){return normalizePath(_0x441dd7);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x2bc7ea(0x2e5)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x2bc7ea(0x28a)](workspaceDir),logMcpStderr(a0_0x2bc7ea(0x20c)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x2ab406){logMcpStderr(a0_0x2bc7ea(0x264)+a0_0x2ab406);}function a0_0x344f(_0x48bda4,_0x19ecda){_0x48bda4=_0x48bda4-0x1c2;const _0x1d8ce2=a0_0x1d8c();let _0x344ff1=_0x1d8ce2[_0x48bda4];return _0x344ff1;}async function detectWorkspaceRoot(_0x1a893b){const _0x5465cf=a0_0x2bc7ea;let _0x23c029=a0_0x51eed8[_0x5465cf(0x2d5)](_0x1a893b);const _0x1a389e=['.git','.vscode',_0x5465cf(0x28b),_0x5465cf(0x265),_0x5465cf(0x242),_0x5465cf(0x1c2),_0x5465cf(0x1c8),_0x5465cf(0x21c),_0x5465cf(0x1c7)];while(_0x23c029!==a0_0x51eed8[_0x5465cf(0x1fe)](_0x23c029)){for(const _0x2fe736 of _0x1a389e){const _0x394d58=a0_0x51eed8[_0x5465cf(0x1dc)](_0x23c029,_0x2fe736);try{return await a0_0x497a28['access'](_0x394d58),normalizePath(_0x23c029);}catch{}}_0x23c029=a0_0x51eed8[_0x5465cf(0x1fe)](_0x23c029);}return normalizePath(_0x1a893b);}await Promise[a0_0x2bc7ea(0x24b)](args[a0_0x2bc7ea(0x231)](async _0x5f0d29=>{const _0x4f7517=a0_0x2bc7ea;try{const _0x266b42=await a0_0x497a28['stat'](expandHome(_0x5f0d29));!_0x266b42[_0x4f7517(0x299)]()&&(logMcpStderr(_0x4f7517(0x23d)+_0x5f0d29+_0x4f7517(0x1cc)),process[_0x4f7517(0x1e7)](0x1));}catch(_0x17cd66){logMcpStderr(_0x4f7517(0x2dd)+_0x5f0d29+':',_0x17cd66),process[_0x4f7517(0x1e7)](0x1);}}));async function validatePath(_0x57c13d){const _0x136716=a0_0x2bc7ea,_0x354133=expandHome(_0x57c13d),_0x22082a=a0_0x51eed8['resolve'](_0x354133);logger[_0x136716(0x2a7)](_0x136716(0x23c),'path_validation_start',{'raw_path':_0x57c13d,'absolute':_0x22082a});try{const _0x79d9df=await a0_0x497a28[_0x136716(0x2b6)](_0x22082a);return logger[_0x136716(0x2a7)](_0x136716(0x23c),_0x136716(0x2d8),{'resolved':_0x79d9df,'symlink':_0x79d9df!==_0x22082a}),_0x79d9df;}catch(_0x208fc2){if(_0x208fc2[_0x136716(0x252)]===_0x136716(0x221)){const _0x5e74d2=a0_0x51eed8['dirname'](_0x22082a);try{const _0x352f25=await a0_0x497a28['realpath'](_0x5e74d2),_0x2a3a3a=a0_0x51eed8[_0x136716(0x1dc)](_0x352f25,a0_0x51eed8[_0x136716(0x2ea)](_0x22082a));return logger[_0x136716(0x2a7)](_0x136716(0x23c),_0x136716(0x2d8),{'resolved':_0x2a3a3a,'new_file':!![]}),_0x2a3a3a;}catch{logger[_0x136716(0x2c1)](_0x136716(0x23c),_0x136716(0x223),{'raw_path':_0x57c13d,'error':'Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x5e74d2});throw new Error(_0x136716(0x232)+_0x5e74d2);}}logger[_0x136716(0x2c1)](_0x136716(0x23c),'path_validation_failed',{'raw_path':_0x57c13d,'error':_0x208fc2[_0x136716(0x2d4)]});throw _0x208fc2;}}const MorphEditFileArgsSchema=z[a0_0x2bc7ea(0x1c3)]({'path':z[a0_0x2bc7ea(0x2e7)](),'code_edit':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x22a)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x250)),'dryRun':z[a0_0x2bc7ea(0x22f)]()[a0_0x2bc7ea(0x23e)](![])[a0_0x2bc7ea(0x22a)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x2bc7ea(0x24e),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x22a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x258)),'search_type':z[a0_0x2bc7ea(0x249)]([a0_0x2bc7ea(0x23e),'node_modules'])['optional']()[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x1f5))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x22a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x282)]()['describe'](a0_0x2bc7ea(0x2c8)),'owner_repo':z['string']()[a0_0x2bc7ea(0x282)]()[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x1cf)),'branch':z['string']()[a0_0x2bc7ea(0x282)]()[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x1db))}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x2bc7ea(0x22a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x22a)]('Repository\x20identifier'),'branch':z['string']()[a0_0x2bc7ea(0x282)]()[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x1ff)),'commitHash':z[a0_0x2bc7ea(0x2e7)]()[a0_0x2bc7ea(0x282)]()['describe'](a0_0x2bc7ea(0x27f)),'targetDirectories':z[a0_0x2bc7ea(0x29c)](z[a0_0x2bc7ea(0x2e7)]())[a0_0x2bc7ea(0x23e)]([])[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x220)),'limit':z[a0_0x2bc7ea(0x2de)]()[a0_0x2bc7ea(0x282)]()[a0_0x2bc7ea(0x23e)](0xa)[a0_0x2bc7ea(0x22a)](a0_0x2bc7ea(0x23a))}),server=new Server({'name':a0_0x2bc7ea(0x2a4),'version':a0_0x2bc7ea(0x1eb)},{'capabilities':{'tools':{}}});server[a0_0x2bc7ea(0x1fc)](ListToolsRequestSchema,async()=>{const _0x4c68a1=a0_0x2bc7ea,_0x4ef352=[{'name':TOOL_NAMES['EDIT_FILE'],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x4c68a1(0x2bf)+_0x4c68a1(0x246)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0x4c68a1(0x2db)+_0x4c68a1(0x25b)+_0x4c68a1(0x1e8)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+'-\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'+_0x4c68a1(0x26f)+_0x4c68a1(0x20e)+_0x4c68a1(0x222)+_0x4c68a1(0x287)+_0x4c68a1(0x28d)+'Rules:\x0a'+_0x4c68a1(0x2a3)+_0x4c68a1(0x2eb)+_0x4c68a1(0x2cc)+_0x4c68a1(0x224)+_0x4c68a1(0x1f3)+_0x4c68a1(0x261)+_0x4c68a1(0x279),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x4c68a1(0x200)],'description':_0x4c68a1(0x2cf)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x4c68a1(0x204)+_0x4c68a1(0x235)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x1e26c6=_0x4ef352['filter'](_0xc85cb4=>{const _0x5d3343=_0x4c68a1;if(DISABLED_TOOLS[_0x5d3343(0x272)](_0xc85cb4[_0x5d3343(0x201)]))return console[_0x5d3343(0x2c1)](_0x5d3343(0x248)+_0xc85cb4[_0x5d3343(0x201)]+_0x5d3343(0x209)),![];if(_0x5d3343(0x294)in _0xc85cb4&&_0xc85cb4[_0x5d3343(0x294)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0xc85cb4[_0x5d3343(0x201)]+_0x5d3343(0x1cb)),![];return!![];});return{'tools':_0x1e26c6['map'](_0x8aa640=>({'name':_0x8aa640[_0x4c68a1(0x201)],'description':_0x8aa640['description'],'inputSchema':_0x8aa640[_0x4c68a1(0x2d9)]}))};}),server[a0_0x2bc7ea(0x1fc)](CallToolRequestSchema,async _0x5641c6=>{const _0x2dadb5=a0_0x2bc7ea,{name:_0x308a99,arguments:_0x537c23}=_0x5641c6[_0x2dadb5(0x25c)],_0x3a8fb0=Date[_0x2dadb5(0x269)]();logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),_0x2dadb5(0x291),{'tool':_0x308a99,'args':_0x308a99===_0x2dadb5(0x21a)?{'path':_0x537c23?.[_0x2dadb5(0x1da)],'instruction':_0x537c23?.[_0x2dadb5(0x28f)]||_0x537c23?.[_0x2dadb5(0x29a)],'dryRun':_0x537c23?.[_0x2dadb5(0x212)]}:_0x537c23});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x29d)}],'isError':!![]};if(!MORPH_API_KEY[_0x2dadb5(0x2b8)](_0x2dadb5(0x28c))&&!MORPH_API_KEY[_0x2dadb5(0x2b8)]('morph-'))return{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x260)}],'isError':!![]};if(DISABLED_TOOLS[_0x2dadb5(0x272)](_0x308a99))return{'content':[{'type':'text','text':_0x2dadb5(0x2d2)+_0x308a99+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x308a99){case TOOL_NAMES['EDIT_FILE']:{const _0x423d97=_0x537c23&&typeof _0x537c23===_0x2dadb5(0x1c3)&&'instructions'in _0x537c23&&!(_0x2dadb5(0x28f)in _0x537c23)?{..._0x537c23,'instruction':_0x537c23[_0x2dadb5(0x29a)],'instructions':undefined}:_0x537c23,_0x367912=MorphEditFileArgsSchema[_0x2dadb5(0x28e)](_0x423d97);if(!_0x367912['success'])throw new Error(_0x2dadb5(0x1d8)+_0x367912[_0x2dadb5(0x2c1)]);const _0x4818b6=await validatePath(_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x1da)]);let _0x518369=null,_0x2c76c3=!![],_0x3a705a=null;try{_0x518369=await a0_0x497a28[_0x2dadb5(0x251)](_0x4818b6,_0x2dadb5(0x2bc)),logger['debug']('MCP',_0x2dadb5(0x1f4),{'path':_0x4818b6,'size_bytes':_0x518369['length']});}catch(_0x4dd3bd){const _0x1e7bf2=_0x4dd3bd[_0x2dadb5(0x252)];_0x1e7bf2===_0x2dadb5(0x221)?(_0x2c76c3=![],_0x518369='',logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),'file_read_complete',{'path':_0x4818b6,'exists':![]})):(_0x3a705a='Failed\x20to\x20read\x20file:\x20'+(_0x1e7bf2||_0x2dadb5(0x205))+_0x2dadb5(0x2a5)+(_0x4dd3bd instanceof Error?_0x4dd3bd[_0x2dadb5(0x2d4)]:String(_0x4dd3bd)),logger[_0x2dadb5(0x2c1)](_0x2dadb5(0x23c),'file_read_failed',{'path':_0x4818b6,'error':_0x3a705a}),logMcpStderr(_0x2dadb5(0x1ea)+_0x3a705a));}let _0x439208;try{const _0x3b51bf=MORPH_API_KEY;if(!_0x3b51bf)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x34e159=a0_0x51eed8[_0x2dadb5(0x1fe)](_0x4818b6),_0x1db412=a0_0x51eed8[_0x2dadb5(0x2ea)](_0x4818b6);logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),_0x2dadb5(0x1f9),{'model':'morph-v3-fast','path':_0x367912['data']['path'],'instruction_len':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x28f)][_0x2dadb5(0x2e5)],'code_edit_len':_0x367912[_0x2dadb5(0x1ca)]['code_edit']['length'],'original_code_len':_0x518369?.[_0x2dadb5(0x2e5)]??0x0,'dry_run':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x212)]});const _0x334dfc=Date['now'](),_0x317de2=await executeEditFile({'target_filepath':_0x1db412,'code_edit':_0x367912[_0x2dadb5(0x1ca)]['code_edit'],'instruction':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x28f)]},{'morphApiKey':_0x3b51bf,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x34e159,'autoWrite':!_0x367912[_0x2dadb5(0x1ca)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x51cc5a=Date[_0x2dadb5(0x269)]()-_0x334dfc;_0x439208=_0x317de2[_0x2dadb5(0x228)];if(!_0x317de2[_0x2dadb5(0x267)])throw new Error(_0x317de2[_0x2dadb5(0x2c1)]||_0x2dadb5(0x2e0));const _0x332e89=_0x317de2[_0x2dadb5(0x24d)],_0x523764=_0x2dadb5(0x27a)+_0x332e89[_0x2dadb5(0x2a6)]+_0x2dadb5(0x2b0)+_0x332e89[_0x2dadb5(0x1e1)]+_0x2dadb5(0x2e2)+_0x332e89[_0x2dadb5(0x1ee)];logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),_0x2dadb5(0x2c5),{'tool':_0x2dadb5(0x21a),'success':!![],'latency_ms':Date[_0x2dadb5(0x269)]()-_0x3a8fb0,'edit_latency_ms':_0x51cc5a,'changes':{'added':_0x332e89[_0x2dadb5(0x2a6)],'removed':_0x332e89[_0x2dadb5(0x1e1)],'modified':_0x332e89[_0x2dadb5(0x1ee)]},'completion_id':_0x439208});if(_0x367912[_0x2dadb5(0x1ca)]['dryRun'])return{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x289)+(_0x2c76c3?'':_0x2dadb5(0x24c))+':\x20'+_0x367912[_0x2dadb5(0x1ca)]['instruction']+'.\x20Changes:\x20'+_0x523764+_0x2dadb5(0x2ab)+_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x1da)]+'.'}]};return{'content':[{'type':'text','text':_0x2dadb5(0x21e)+(_0x2c76c3?_0x2dadb5(0x229):_0x2dadb5(0x20a))+':\x20'+_0x367912[_0x2dadb5(0x1ca)]['instruction']+_0x2dadb5(0x26d)+_0x523764+_0x2dadb5(0x2ab)+_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x1da)]+'.'}]};}catch(_0x5d3027){const _0x30b7f9=handleMorphAPIError(_0x5d3027);if(_0x30b7f9)return logger[_0x2dadb5(0x2c1)](_0x2dadb5(0x23c),_0x2dadb5(0x1e5),{'tool':_0x2dadb5(0x21a),'error':_0x2dadb5(0x1f1),'latency_ms':Date[_0x2dadb5(0x269)]()-_0x3a8fb0}),_0x30b7f9;const _0x45c80d=_0x5d3027 instanceof Error?_0x5d3027[_0x2dadb5(0x2d4)]:String(_0x5d3027);return logger[_0x2dadb5(0x2c1)](_0x2dadb5(0x23c),'tool_call_error',{'tool':_0x2dadb5(0x21a),'error':_0x45c80d,'path':_0x367912['data'][_0x2dadb5(0x1da)],'validated_path':_0x4818b6,'latency_ms':Date[_0x2dadb5(0x269)]()-_0x3a8fb0,'stack':_0x5d3027 instanceof Error?_0x5d3027[_0x2dadb5(0x227)]:undefined}),reportMorphError({'error_message':_0x45c80d,'error_type':_0x5d3027 instanceof Error?_0x5d3027[_0x2dadb5(0x2b5)][_0x2dadb5(0x201)]:_0x2dadb5(0x2ef),'context':{'tool':_0x2dadb5(0x21a),'completion_id':_0x439208,'file_path':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x1da)],'validated_path':_0x4818b6,'instruction':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x28f)],'model':MORPH_LARGE_APPLY?_0x2dadb5(0x2b9):_0x2dadb5(0x292),'dry_run':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x212)],'file_exists':_0x2c76c3,'file_read_error':_0x3a705a,'file_readable':_0x518369!==null,'request_content':{'path':_0x367912[_0x2dadb5(0x1ca)]['path'],'code_edit':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x1f6)],'instruction':_0x367912[_0x2dadb5(0x1ca)][_0x2dadb5(0x28f)],'original_code':_0x518369!==null?_0x518369[_0x2dadb5(0x2e5)]>0xc350?_0x518369['substring'](0x0,0xc350)+_0x2dadb5(0x2c7)+_0x518369['length']+_0x2dadb5(0x2cb):_0x518369:_0x2dadb5(0x1dd)+(_0x3a705a||_0x2dadb5(0x274))+']','original_code_length':_0x518369?.[_0x2dadb5(0x2e5)]??0x0,'model':MORPH_LARGE_APPLY?_0x2dadb5(0x2b9):_0x2dadb5(0x292),'dry_run':_0x367912[_0x2dadb5(0x1ca)]['dryRun']}},'stack_trace':_0x5d3027 instanceof Error?_0x5d3027['stack']:undefined,'source':_0x2dadb5(0x2bd)})[_0x2dadb5(0x298)](()=>{}),{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x283)+_0x45c80d}],'isError':!![]};}}case TOOL_NAMES[_0x2dadb5(0x200)]:{const _0x7684a=WarpGrepArgsSchema['safeParse'](_0x537c23);if(!_0x7684a['success'])return{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x2aa)+_0x7684a[_0x2dadb5(0x2c1)]}],'isError':!![]};const _0x31efd4=_0x11f497=>{const _0xa4c962=_0x2dadb5,_0xb97b98=[];for(const _0x1b985c of _0x11f497||[]){if(_0x1b985c[_0xa4c962(0x1cd)]===_0xa4c962(0x1c5)&&Array['isArray'](_0x1b985c[_0xa4c962(0x2a2)]))for(const _0xa8d4bf of _0x1b985c['tool_calls']){try{const _0x26f894=_0xa8d4bf['function']?.[_0xa4c962(0x201)],_0x5b130b=JSON[_0xa4c962(0x1d9)](_0xa8d4bf[_0xa4c962(0x2d1)]?.['arguments']||'{}');if(_0x26f894===_0xa4c962(0x26a))_0xb97b98[_0xa4c962(0x28a)](_0xa4c962(0x1d1)+_0x5b130b['pattern']+'\x27\x20'+(_0x5b130b[_0xa4c962(0x1da)]||'.'));else{if(_0x26f894==='read')_0xb97b98[_0xa4c962(0x28a)](_0xa4c962(0x1fa)+_0x5b130b['path']);else{if(_0x26f894==='list_directory')_0xb97b98['push'](_0xa4c962(0x262)+(_0x5b130b[_0xa4c962(0x1d7)]||'.'));else{if(_0x26f894===_0xa4c962(0x2d3))_0xb97b98['push']('glob\x20\x27'+_0x5b130b['pattern']+'\x27\x20'+(_0x5b130b['path']||'.'));else _0x26f894===_0xa4c962(0x213)&&_0xb97b98[_0xa4c962(0x28a)]('finish');}}}}catch{}}}return _0xb97b98;},_0x109d50=_0x15d0f9=>{const _0x495d7e=_0x2dadb5,_0x13ccd1=[];if(!_0x15d0f9||!Array['isArray'](_0x15d0f9))return _0x13ccd1;const _0x5d5ed1=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x495d7e(0x2cd),'tool':_0x495d7e(0x268)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x495d7e(0x2be),'tool':_0x495d7e(0x268)},{'pattern':/\[READ ERROR\]/,'error_type':_0x495d7e(0x219),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x495d7e(0x268)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x495d7e(0x23f),'tool':_0x495d7e(0x2c3)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x495d7e(0x218),'tool':_0x495d7e(0x2c3)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x495d7e(0x26e),'tool':_0x495d7e(0x268)},{'pattern':/\[SYMLINK\]/,'error_type':_0x495d7e(0x24f),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x495d7e(0x26e),'tool':_0x495d7e(0x268)},{'pattern':/symbolic link/,'error_type':_0x495d7e(0x24f),'tool':'read'},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x495d7e(0x268)},{'pattern':/status="error"/,'error_type':_0x495d7e(0x2b3),'tool':'unknown'}];let _0x3b0d9b=0x0;for(const _0x3312e9 of _0x15d0f9){_0x3312e9['role']===_0x495d7e(0x1c5)&&Array[_0x495d7e(0x2b1)](_0x3312e9[_0x495d7e(0x2a2)])&&_0x3b0d9b++;const _0x175fe7=_0x3312e9[_0x495d7e(0x2d0)];if((_0x3312e9['role']===_0x495d7e(0x293)||_0x3312e9[_0x495d7e(0x1cd)]===_0x495d7e(0x1d6))&&_0x175fe7&&typeof _0x175fe7===_0x495d7e(0x2e7))for(const {pattern:_0x44febf,error_type:_0x59fd67,tool:_0x373085}of _0x5d5ed1){const _0x1777d6=_0x175fe7[_0x495d7e(0x27e)](new RegExp(_0x44febf[_0x495d7e(0x1c4)],'g'));if(_0x1777d6)for(const _0x1b8a6c of _0x1777d6){const _0x40d1aa=_0x175fe7[_0x495d7e(0x1ce)](_0x1b8a6c),_0x208fc9=_0x175fe7[_0x495d7e(0x2b4)](_0x40d1aa,Math[_0x495d7e(0x225)](_0x40d1aa+0xc8,_0x175fe7[_0x495d7e(0x2e5)]));_0x13ccd1[_0x495d7e(0x28a)]({'tool':_0x373085,'error_type':_0x59fd67,'error_message':_0x208fc9['split']('\x0a')[0x0],'turn':_0x3b0d9b});}}}return _0x13ccd1;};try{const _0x3a24e4=a0_0x51eed8['resolve'](_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)]),_0x2d9e98=_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x214)],_0x4053c2=_0x2d9e98==='node_modules'?{'allowNames':[_0x2dadb5(0x1df)]}:undefined,_0x20d2ab=new LocalRipgrepProvider(_0x3a24e4,undefined,_0x4053c2);logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),'provider_created',{'type':_0x2dadb5(0x1c6),'repo_root':_0x3a24e4,'search_type':_0x2d9e98||_0x2dadb5(0x23e)}),logger['debug'](_0x2dadb5(0x23c),_0x2dadb5(0x21b),{'query':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],'repo_root':_0x3a24e4,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x2b8b58=Date[_0x2dadb5(0x269)](),_0xed08c9=await runWarpGrep({'searchTerm':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],'repoRoot':_0x3a24e4,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x20d2ab,'search_type':_0x2d9e98}),_0x283917=Date[_0x2dadb5(0x269)]()-_0x2b8b58,_0x1f2abc=_0xed08c9['finish']?.['metadata']?.[_0x2dadb5(0x270)]?.[_0x2dadb5(0x2e5)]??0x0;logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),_0x2dadb5(0x2f0),{'termination':_0xed08c9[_0x2dadb5(0x2da)],'turns':_0xed08c9[_0x2dadb5(0x1f7)]?.['turns']??0x0,'files_found':_0x1f2abc,'latency_ms':_0x283917});const _0x13e7ae=_0x109d50(_0xed08c9[_0x2dadb5(0x2af)]);_0x13e7ae[_0x2dadb5(0x2e5)]>0x0&&reportMorphError({'error_message':_0x2dadb5(0x1fb)+_0x13e7ae[_0x2dadb5(0x2e5)]+_0x2dadb5(0x2b2),'error_type':_0x2dadb5(0x241),'level':_0x2dadb5(0x278),'tool':_0x2dadb5(0x29e),'context':{'repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'query':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],'model':_0x2dadb5(0x280),'termination_reason':_0xed08c9[_0x2dadb5(0x2da)],'sub_tool_errors':_0x13e7ae,'timings':_0xed08c9[_0x2dadb5(0x1f7)],'tool_calls':_0x31efd4(_0xed08c9[_0x2dadb5(0x2af)]),'messages':_0xed08c9['messages']?.[_0x2dadb5(0x231)](_0x18f3ed=>({'role':_0x18f3ed[_0x2dadb5(0x1cd)],'content':_0x18f3ed[_0x2dadb5(0x2d0)],..._0x18f3ed['tool_calls']?{'tool_calls':_0x18f3ed['tool_calls']['length']}:{},..._0x18f3ed[_0x2dadb5(0x29f)]?{'tool_call_id':_0x18f3ed[_0x2dadb5(0x29f)]}:{}}))},'source':'mcp-filesystem'})['catch'](()=>{});let _0x456e48='';if(_0xed08c9[_0x2dadb5(0x2da)]===_0x2dadb5(0x2ac)&&_0xed08c9[_0x2dadb5(0x213)]?.[_0x2dadb5(0x211)]?.[_0x2dadb5(0x270)]){const _0x539c7d=_0xed08c9['finish'][_0x2dadb5(0x211)][_0x2dadb5(0x270)];if(_0x539c7d[_0x2dadb5(0x2e5)]===0x0)return _0x456e48=_0xed08c9[_0x2dadb5(0x213)]['payload']||_0x2dadb5(0x1e6),{'content':[{'type':_0x2dadb5(0x233),'text':_0x456e48}]};const _0x11bd08=[],_0x4bde71=[_0x2dadb5(0x1d2)];for(const _0x34e334 of _0xed08c9[_0x2dadb5(0x2af)]){if(_0x34e334[_0x2dadb5(0x1cd)]===_0x2dadb5(0x1c5)&&Array['isArray'](_0x34e334[_0x2dadb5(0x2a2)]))for(const _0x3b248f of _0x34e334[_0x2dadb5(0x2a2)]){try{const _0x4f5f19=_0x3b248f[_0x2dadb5(0x2d1)]?.[_0x2dadb5(0x201)],_0x261a29=JSON[_0x2dadb5(0x1d9)](_0x3b248f[_0x2dadb5(0x2d1)]?.['arguments']||'{}');if(_0x4f5f19===_0x2dadb5(0x26a))_0x4bde71['push'](_0x2dadb5(0x26c)+_0x261a29[_0x2dadb5(0x2bb)]+_0x2dadb5(0x2c4)+(_0x261a29['path']||'.')+'`');else{if(_0x4f5f19==='read')_0x4bde71[_0x2dadb5(0x28a)]('-\x20Read\x20file\x20`'+_0x261a29['path']+'`');else{if(_0x4f5f19===_0x2dadb5(0x1e3))_0x4bde71[_0x2dadb5(0x28a)](_0x2dadb5(0x276)+(_0x261a29[_0x2dadb5(0x1d7)]||'.')+'`');else _0x4f5f19===_0x2dadb5(0x2d3)&&_0x4bde71[_0x2dadb5(0x28a)]('-\x20Glob\x20search\x20`'+_0x261a29[_0x2dadb5(0x2bb)]+_0x2dadb5(0x253)+(_0x261a29['path']||'.')+'`');}}}catch{}}}_0x11bd08[_0x2dadb5(0x28a)](_0x4bde71[_0x2dadb5(0x1dc)]('\x0a'));const _0x50d28f=['','Relevant\x20context\x20found:'];for(const _0x3ca1c0 of _0x539c7d){if(_0x3ca1c0[_0x2dadb5(0x2c9)]==='*')_0x50d28f['push']('-\x20'+_0x3ca1c0[_0x2dadb5(0x1da)]+':*');else{if(Array[_0x2dadb5(0x2b1)](_0x3ca1c0[_0x2dadb5(0x2c9)])){const _0x4d379f=_0x3ca1c0[_0x2dadb5(0x2c9)][_0x2dadb5(0x231)](([_0x5bc98c,_0x88f79c])=>{if(_0x5bc98c===_0x88f79c)return''+_0x5bc98c;return _0x5bc98c+'-'+_0x88f79c;});_0x50d28f[_0x2dadb5(0x28a)]('-\x20'+_0x3ca1c0[_0x2dadb5(0x1da)]+':'+_0x4d379f[_0x2dadb5(0x1dc)](','));}else _0x50d28f[_0x2dadb5(0x28a)]('-\x20'+_0x3ca1c0['path']+':*');}}_0x50d28f[_0x2dadb5(0x28a)](''),_0x11bd08[_0x2dadb5(0x28a)](_0x50d28f[_0x2dadb5(0x1dc)]('\x0a')),_0x11bd08['push'](_0x2dadb5(0x22b));const _0x3c55b8=[],_0xafdf94=[];for(const _0x9c1293 of _0x539c7d){let _0x449aeb=a0_0x51eed8['resolve'](_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],_0x9c1293[_0x2dadb5(0x1da)]),_0x2d8f92=null,_0xb58a26=null;try{_0x2d8f92=await a0_0x497a28[_0x2dadb5(0x251)](_0x449aeb,{'encoding':_0x2dadb5(0x2bc)});}catch(_0x13f837){const _0x4fe11d=fixPathRepetition(_0x449aeb);if(_0x4fe11d)try{_0x2d8f92=await a0_0x497a28[_0x2dadb5(0x251)](_0x4fe11d,{'encoding':'utf-8'}),_0x449aeb=_0x4fe11d;}catch{_0xb58a26=_0x13f837 instanceof Error?_0x13f837:new Error(String(_0x13f837));}else _0xb58a26=_0x13f837 instanceof Error?_0x13f837:new Error(String(_0x13f837));}if(_0x2d8f92!==null){const _0x46711f=_0x2d8f92[_0x2dadb5(0x2a8)](/\r?\n/),_0x4a847a=[];if(_0x9c1293[_0x2dadb5(0x2c9)]==='*'||!Array[_0x2dadb5(0x2b1)](_0x9c1293[_0x2dadb5(0x2c9)]))for(let _0x4be4e8=0x1;_0x4be4e8<=_0x46711f[_0x2dadb5(0x2e5)];_0x4be4e8++){const _0x4520ab=_0x46711f[_0x4be4e8-0x1];_0x4a847a[_0x2dadb5(0x28a)](_0x4be4e8+'|\x20'+_0x4520ab);}else for(const [_0x4d80cd,_0x3051c2]of _0x9c1293[_0x2dadb5(0x2c9)]){_0x4a847a['length']>0x0&&_0x4a847a['push']('');for(let _0x1d3fe1=_0x4d80cd;_0x1d3fe1<=_0x3051c2&&_0x1d3fe1<=_0x46711f[_0x2dadb5(0x2e5)];_0x1d3fe1++){const _0xaee5fd=_0x46711f[_0x1d3fe1-0x1];_0x4a847a[_0x2dadb5(0x28a)](_0x1d3fe1+'|\x20'+_0xaee5fd);}}_0xafdf94[_0x2dadb5(0x28a)]({'path':_0x9c1293['path'],'content':_0x4a847a[_0x2dadb5(0x1dc)]('\x0a')});}else _0x3c55b8[_0x2dadb5(0x28a)]('<file\x20path=\x22'+_0x9c1293[_0x2dadb5(0x1da)]+_0x2dadb5(0x2ee)+(_0xb58a26?.[_0x2dadb5(0x2d4)]||'Unknown\x20error')+_0x2dadb5(0x25a));}try{const _0x572625=await compactFileContexts(_0xafdf94,_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],MORPH_API_KEY,MORPH_API_URL);for(const _0x5ddf4b of _0x572625){_0x3c55b8[_0x2dadb5(0x28a)]('<file\x20path=\x22'+_0x5ddf4b['path']+_0x2dadb5(0x24a)+_0x5ddf4b[_0x2dadb5(0x2d0)]+_0x2dadb5(0x25a));}}catch(_0x228f28){logger[_0x2dadb5(0x278)](_0x2dadb5(0x23c),_0x2dadb5(0x2e9),{'error':_0x228f28 instanceof Error?_0x228f28[_0x2dadb5(0x2d4)]:String(_0x228f28),'files_count':_0xafdf94['length']});for(const _0x413f75 of _0xafdf94){_0x3c55b8[_0x2dadb5(0x28a)]('<file\x20path=\x22'+_0x413f75[_0x2dadb5(0x1da)]+_0x2dadb5(0x24a)+_0x413f75[_0x2dadb5(0x2d0)]+_0x2dadb5(0x25a));}}_0x11bd08[_0x2dadb5(0x28a)](_0x3c55b8['join']('\x0a\x0a')),_0x456e48=_0x11bd08[_0x2dadb5(0x1dc)]('\x0a');const _0xef467a=_0xed08c9[_0x2dadb5(0x22e)]?.[_0x2dadb5(0x1e9)](_0x43f021=>_0x43f021['message']?.[_0x2dadb5(0x2b8)](_0x2dadb5(0x20b)))||[];if(_0xef467a[_0x2dadb5(0x2e5)]>0x0){const _0x23c3dc=_0xef467a[_0x2dadb5(0x231)](_0x5e7670=>_0x5e7670[_0x2dadb5(0x2d4)])[_0x2dadb5(0x1dc)](';\x20');reportMorphError({'error_message':_0x23c3dc,'error_type':_0x2dadb5(0x23b),'context':{'tool':_0x2dadb5(0x29e),'repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'query':_0x7684a[_0x2dadb5(0x1ca)]['search_string'],'model':_0x2dadb5(0x280),'termination_reason':_0x2dadb5(0x2f1),'error_count':_0xef467a['length'],'is_timeout':![],'timings':_0xed08c9[_0x2dadb5(0x1f7)],'files_attempted':_0x539c7d['map'](_0x3289fb=>({'path':_0x3289fb[_0x2dadb5(0x1da)],'lines':_0x3289fb[_0x2dadb5(0x2c9)]})),'tool_calls':_0x31efd4(_0xed08c9['messages']),'messages':_0xed08c9[_0x2dadb5(0x2af)]?.['map'](_0x58d095=>({'role':_0x58d095[_0x2dadb5(0x1cd)],'content':_0x58d095[_0x2dadb5(0x2d0)],..._0x58d095['tool_calls']?{'tool_calls':_0x58d095['tool_calls'][_0x2dadb5(0x2e5)]}:{},..._0x58d095['tool_call_id']?{'tool_call_id':_0x58d095[_0x2dadb5(0x29f)]}:{}})),'request_content':{'query':_0x7684a[_0x2dadb5(0x1ca)]['search_string'],'repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'repoRoot':a0_0x51eed8[_0x2dadb5(0x2d5)](_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)]),'model':_0x2dadb5(0x280)}},'source':_0x2dadb5(0x2bd)})[_0x2dadb5(0x298)](()=>{});}}else{if(_0xed08c9['terminationReason']===_0x2dadb5(0x226)&&_0xed08c9[_0x2dadb5(0x22e)]['length']>0x0){const _0x5e2ee0=_0xed08c9[_0x2dadb5(0x22e)]['map'](_0x274c99=>_0x274c99[_0x2dadb5(0x2d4)])[_0x2dadb5(0x1dc)](';\x20');_0x456e48='Error:\x20'+_0x5e2ee0;const _0xbedbab=_0x5e2ee0[_0x2dadb5(0x20d)]()[_0x2dadb5(0x234)](_0x2dadb5(0x1ed))||_0x5e2ee0[_0x2dadb5(0x20d)]()[_0x2dadb5(0x234)]('timed\x20out')||_0x5e2ee0[_0x2dadb5(0x20d)]()[_0x2dadb5(0x234)](_0x2dadb5(0x2dc)),_0x3b6781=_0xed08c9[_0x2dadb5(0x213)]?.['metadata']?.[_0x2dadb5(0x270)],_0x198331=_0xed08c9[_0x2dadb5(0x22e)][0x0];reportMorphError({'error_message':_0x5e2ee0,'error_type':_0xbedbab?_0x2dadb5(0x215):_0x198331?.['constructor']?.[_0x2dadb5(0x201)]||_0x2dadb5(0x1f0),'context':{'tool':'codebase_search','repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'query':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],'model':'morph-warp-grep-v2.1','termination_reason':_0xed08c9[_0x2dadb5(0x2da)],'error_count':_0xed08c9[_0x2dadb5(0x22e)][_0x2dadb5(0x2e5)],'is_timeout':_0xbedbab,'timings':_0xed08c9[_0x2dadb5(0x1f7)],'files_attempted':_0x3b6781?.[_0x2dadb5(0x231)](_0xb36a48=>({'path':_0xb36a48[_0x2dadb5(0x1da)],'lines':_0xb36a48[_0x2dadb5(0x2c9)]})),'tool_calls':_0x31efd4(_0xed08c9['messages']),'messages':_0xed08c9['messages']?.['map'](_0x4c7278=>({'role':_0x4c7278[_0x2dadb5(0x1cd)],'content':_0x4c7278[_0x2dadb5(0x2d0)],..._0x4c7278['tool_calls']?{'tool_calls':_0x4c7278['tool_calls'][_0x2dadb5(0x2e5)]}:{},..._0x4c7278[_0x2dadb5(0x29f)]?{'tool_call_id':_0x4c7278[_0x2dadb5(0x29f)]}:{}})),'request_content':{'query':_0x7684a['data'][_0x2dadb5(0x275)],'repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'repoRoot':a0_0x51eed8[_0x2dadb5(0x2d5)](_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)]),'model':_0x2dadb5(0x280)}},'stack_trace':_0x198331?.[_0x2dadb5(0x227)]||undefined,'source':'mcp-filesystem'})[_0x2dadb5(0x298)](()=>{});}else _0x456e48=_0x2dadb5(0x25d);}return{'content':[{'type':'text','text':_0x456e48}]};}catch(_0x4e7f7d){const _0x28762b=handleMorphAPIError(_0x4e7f7d);if(_0x28762b)return logger[_0x2dadb5(0x2c1)](_0x2dadb5(0x23c),_0x2dadb5(0x1e5),{'tool':'codebase_search','error':_0x2dadb5(0x1f1),'latency_ms':Date[_0x2dadb5(0x269)]()-_0x3a8fb0}),_0x28762b;const _0x4a553c=_0x4e7f7d instanceof Error?_0x4e7f7d['message']:String(_0x4e7f7d);logger[_0x2dadb5(0x2c1)](_0x2dadb5(0x23c),'tool_call_error',{'tool':'codebase_search','error':_0x4a553c,'repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'query':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],'latency_ms':Date[_0x2dadb5(0x269)]()-_0x3a8fb0});const _0x3fda90=_0x4a553c[_0x2dadb5(0x20d)]()[_0x2dadb5(0x234)](_0x2dadb5(0x1ed))||_0x4a553c[_0x2dadb5(0x20d)]()[_0x2dadb5(0x234)]('timed\x20out')||_0x4a553c[_0x2dadb5(0x20d)]()[_0x2dadb5(0x234)](_0x2dadb5(0x2dc))||_0x4e7f7d instanceof Error&&_0x4e7f7d[_0x2dadb5(0x201)]===_0x2dadb5(0x215);return reportMorphError({'error_message':_0x4a553c,'error_type':_0x3fda90?_0x2dadb5(0x215):_0x4e7f7d instanceof Error?_0x4e7f7d[_0x2dadb5(0x2b5)][_0x2dadb5(0x201)]:'UnknownError','context':{'tool':'codebase_search','repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'query':_0x7684a['data']['search_string'],'model':_0x2dadb5(0x280),'is_timeout':_0x3fda90,'exception_phase':_0x2dadb5(0x2a0),'request_content':{'query':_0x7684a['data'][_0x2dadb5(0x275)],'repo_path':_0x7684a[_0x2dadb5(0x1ca)][_0x2dadb5(0x239)],'repoRoot':a0_0x51eed8['resolve'](_0x7684a['data']['repo_path']),'model':_0x2dadb5(0x280)}},'stack_trace':_0x4e7f7d instanceof Error?_0x4e7f7d[_0x2dadb5(0x227)]:undefined,'source':_0x2dadb5(0x2bd)})[_0x2dadb5(0x298)](()=>{}),{'content':[{'type':_0x2dadb5(0x233),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x4a553c}],'isError':![]};}}case TOOL_NAMES[_0x2dadb5(0x206)]:{const _0xfc10d9=WarpGrepGitHubArgsSchema[_0x2dadb5(0x28e)](_0x537c23);if(!_0xfc10d9[_0x2dadb5(0x267)])return{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x2aa)+_0xfc10d9[_0x2dadb5(0x2c1)]}],'isError':!![]};const _0x2efa10=_0xfc10d9['data'][_0x2dadb5(0x1d0)]||_0xfc10d9[_0x2dadb5(0x1ca)]['owner_repo'];if(!_0x2efa10)return{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x254)}],'isError':!![]};const _0x1f9098=MORPH_API_KEY;if(!_0x1f9098)throw new Error(_0x2dadb5(0x273));const _0x5a89d9=Date['now']();logger[_0x2dadb5(0x2a7)](_0x2dadb5(0x23c),_0x2dadb5(0x2ec),{'identifier':_0x2efa10,'query':_0xfc10d9['data']['search_string'],'branch':_0xfc10d9['data'][_0x2dadb5(0x263)]});try{const _0x4ae7c3=new WarpGrepClient({'morphApiKey':_0x1f9098,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x20221c=await _0x4ae7c3[_0x2dadb5(0x255)]({'searchTerm':_0xfc10d9[_0x2dadb5(0x1ca)][_0x2dadb5(0x275)],'github':_0x2efa10,'branch':_0xfc10d9['data'][_0x2dadb5(0x263)]}),_0x43b8aa=Date[_0x2dadb5(0x269)]()-_0x5a89d9;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x43b8aa+_0x2dadb5(0x1de)+_0x20221c[_0x2dadb5(0x267)]);const _0x4def30=formatResult(_0x20221c);return{'content':[{'type':'text','text':_0x4def30}]};}catch(_0x582693){const _0x4fc3e6=handleMorphAPIError(_0x582693);if(_0x4fc3e6)return _0x4fc3e6;const _0x33093d=Date[_0x2dadb5(0x269)]()-_0x5a89d9,_0x44967c=_0x582693 instanceof Error?_0x582693[_0x2dadb5(0x2d4)]:String(_0x582693);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x33093d+_0x2dadb5(0x27b),_0x44967c),reportMorphError({'error_message':_0x44967c,'error_type':_0x582693 instanceof Error?_0x582693['constructor']['name']:'UnknownError','context':{'tool':_0x2dadb5(0x238),'github_url':_0x2efa10,'search_string':_0xfc10d9['data'][_0x2dadb5(0x275)],'branch':_0xfc10d9[_0x2dadb5(0x1ca)][_0x2dadb5(0x263)]},'stack_trace':_0x582693 instanceof Error?_0x582693[_0x2dadb5(0x227)]:undefined,'source':_0x2dadb5(0x2bd),'tool':_0x2dadb5(0x238),'latency_ms':_0x33093d})[_0x2dadb5(0x298)](()=>{}),{'content':[{'type':_0x2dadb5(0x233),'text':_0x2dadb5(0x2ca)+_0x44967c}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x308a99);}}catch(_0x31a0e5){const _0x81ca23=_0x31a0e5 instanceof Error?_0x31a0e5[_0x2dadb5(0x2d4)]:String(_0x31a0e5);return reportMorphError({'error_message':_0x81ca23,'error_type':_0x31a0e5 instanceof Error?_0x31a0e5[_0x2dadb5(0x2b5)][_0x2dadb5(0x201)]:_0x2dadb5(0x2ef),'context':{'tool':_0x308a99,'arguments':_0x537c23?JSON['stringify'](_0x537c23)[_0x2dadb5(0x2b4)](0x0,0x1f4):undefined,'mcp_server_version':_0x2dadb5(0x1eb)},'stack_trace':_0x31a0e5 instanceof Error?_0x31a0e5[_0x2dadb5(0x227)]:undefined,'source':_0x2dadb5(0x2bd)})['catch'](()=>{}),{'content':[{'type':_0x2dadb5(0x233),'text':'Error:\x20'+_0x81ca23}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4e8d8e){const _0x25eb7e=a0_0x2bc7ea,_0xba4f7d=await getValidRootDirectories(_0x4e8d8e);if(_0xba4f7d['length']>0x0)allowedDirectories=[..._0xba4f7d],logMcpStderr(_0x25eb7e(0x281)+_0xba4f7d['length']+_0x25eb7e(0x230));else{logMcpStderr(_0x25eb7e(0x22d));if(ENABLE_WORKSPACE_MODE)try{const _0x28136a=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x28136a&&(allowedDirectories=[_0x28136a],logMcpStderr(_0x25eb7e(0x2df)+_0x28136a));}catch(_0x46b55c){logMcpStderr(_0x25eb7e(0x27c)+_0x46b55c);}}}server[a0_0x2bc7ea(0x2c0)](RootsListChangedNotificationSchema,async()=>{const _0x40322a=a0_0x2bc7ea;try{const _0x498671=await server[_0x40322a(0x2a1)]();_0x498671&&_0x40322a(0x1d5)in _0x498671&&await updateAllowedDirectoriesFromRoots(_0x498671['roots']);}catch(_0x2ca9a1){logMcpStderr(_0x40322a(0x1f2),_0x2ca9a1 instanceof Error?_0x2ca9a1['message']:String(_0x2ca9a1));}}),server[a0_0x2bc7ea(0x20f)]=async()=>{const _0x422350=a0_0x2bc7ea,_0x4d3b26=server[_0x422350(0x285)]();if(_0x4d3b26?.[_0x422350(0x1d5)])try{const _0x356264=await server[_0x422350(0x2a1)]();_0x356264&&_0x422350(0x1d5)in _0x356264?await updateAllowedDirectoriesFromRoots(_0x356264[_0x422350(0x1d5)]):logMcpStderr(_0x422350(0x1ec));}catch(_0x297b61){logMcpStderr(_0x422350(0x1e0),_0x297b61 instanceof Error?_0x297b61[_0x422350(0x2d4)]:String(_0x297b61));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x422350(0x2e6),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x422350(0x245));else throw new Error(_0x422350(0x295));}}};async function runServer(){const _0x2448f2=a0_0x2bc7ea,_0x3d76f7=new StdioServerTransport();await server[_0x2448f2(0x208)](_0x3d76f7),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x2448f2(0x2e5)]===0x0&&logMcpStderr(_0x2448f2(0x286));}runServer()[a0_0x2bc7ea(0x298)](_0x198132=>{const _0x2735bc=a0_0x2bc7ea;logMcpStderr(_0x2735bc(0x288),_0x198132),process[_0x2735bc(0x1e7)](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a1_0x4446bd=a1_0x31d3;(function(_0x45f736,_0x58f87a){var _0x186b48=a1_0x31d3,_0x1c50db=_0x45f736();while(!![]){try{var _0x2dc94e=parseInt(_0x186b48(0x9b))/0x1*(parseInt(_0x186b48(0x97))/0x2)+-parseInt(_0x186b48(0xa3))/0x3+-parseInt(_0x186b48(0xa8))/0x4+parseInt(_0x186b48(0xa2))/0x5+parseInt(_0x186b48(0x98))/0x6*(parseInt(_0x186b48(0x96))/0x7)+-parseInt(_0x186b48(0x9e))/0x8+-parseInt(_0x186b48(0xa4))/0x9*(-parseInt(_0x186b48(0x94))/0xa);if(_0x2dc94e===_0x58f87a)break;else _0x1c50db['push'](_0x1c50db['shift']());}catch(_0x4363e6){_0x1c50db['push'](_0x1c50db['shift']());}}}(a1_0x2493,0x97e02));function a1_0x31d3(_0x54d1f8,_0x18d79e){_0x54d1f8=_0x54d1f8-0x94;var _0x2493a2=a1_0x2493();var _0x31d393=_0x2493a2[_0x54d1f8];return _0x31d393;}import a1_0x34462e from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x1a0e19=a1_0x34462e[a1_0x4446bd(0xa6)]()){var _0xf35ff5=a1_0x4446bd;switch(_0x1a0e19){case _0xf35ff5(0xa0):return'macOS';case _0xf35ff5(0xa1):return _0xf35ff5(0xa7);case _0xf35ff5(0x99):return _0xf35ff5(0x9d);default:return'Unknown';}}export function formatMcpLogMessage(_0x4e0839,_0x437741=a1_0x34462e['platform']()){var _0x3463e3=a1_0x4446bd;return _0x3463e3(0x9c)+getOperatingSystemType(_0x437741)+']\x20'+_0x4e0839;}function a1_0x2493(){var _0x1ae334=['2155433gFyrAZ','1024570FMVmpw','12EiqZPl','linux','error','1ouiwxl','[os=','Linux','8641480cnYKlY','info','darwin','win32','2828020wtThrO','566436SyxuQz','9OiOkPQ','length','platform','Windows','980996vyYbzF','4426010tGQhxc','MCP'];a1_0x2493=function(){return _0x1ae334;};return a1_0x2493();}export function logMcpStderr(_0x38d4a6,..._0x53616a){var _0x4d3175=a1_0x4446bd;console[_0x4d3175(0x9a)](formatMcpLogMessage(_0x38d4a6),..._0x53616a),logger[_0x4d3175(0x9f)](_0x4d3175(0x95),_0x38d4a6,_0x53616a[_0x4d3175(0xa5)]?{'args':_0x53616a['map'](_0x195d19=>String(_0x195d19))}:undefined);}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a2_0x2d6db9=a2_0x3784;function a2_0xba9e(){const _0x1e6720=['isEnabled',']\x20[','toUpperCase','fileStream','_log','19234782nXnaqc','789940ImIDxS','write','error','info','1450908lqLCSH','2gEooLb','enable','27340ETCoBi','debug','5681802irmzJq','258hREuXD','enabled','stringify','env','7290088IsOnwb','warn','863590aIqhqi'];a2_0xba9e=function(){return _0x1e6720;};return a2_0xba9e();}(function(_0x36a476,_0x377347){const _0x48225f=a2_0x3784,_0x236836=_0x36a476();while(!![]){try{const _0x3be726=-parseInt(_0x48225f(0x108))/0x1+parseInt(_0x48225f(0x114))/0x2*(parseInt(_0x48225f(0x113))/0x3)+parseInt(_0x48225f(0x10f))/0x4+-parseInt(_0x48225f(0x116))/0x5*(-parseInt(_0x48225f(0x119))/0x6)+-parseInt(_0x48225f(0x118))/0x7+-parseInt(_0x48225f(0x106))/0x8+parseInt(_0x48225f(0x10e))/0x9;if(_0x3be726===_0x377347)break;else _0x236836['push'](_0x236836['shift']());}catch(_0x49e33a){_0x236836['push'](_0x236836['shift']());}}}(a2_0xba9e,0x71fda));function a2_0x3784(_0x254fb8,_0x12a99d){_0x254fb8=_0x254fb8-0x103;const _0xba9eaf=a2_0xba9e();let _0x3784c0=_0xba9eaf[_0x254fb8];return _0x3784c0;}import{createWriteStream}from'fs';class MorphLogger{[a2_0x2d6db9(0x103)];['fileStream'];constructor(){const _0x1a9cbb=a2_0x2d6db9;this[_0x1a9cbb(0x103)]=process[_0x1a9cbb(0x105)]['MORPH_DEBUG']==='1'||!!process['env']['MORPH_LOG_FILE'];const _0x5e9759=process[_0x1a9cbb(0x105)]['MORPH_LOG_FILE'];this[_0x1a9cbb(0x10c)]=_0x5e9759?createWriteStream(_0x5e9759,{'flags':'a'}):null;}[a2_0x2d6db9(0x117)](_0x300269,_0x255a68,_0x5334c9){const _0x54919d=a2_0x2d6db9;this[_0x54919d(0x10d)](_0x54919d(0x117),_0x300269,_0x255a68,_0x5334c9);}['info'](_0x82f33f,_0x3c5c1f,_0x222cb5){const _0x470523=a2_0x2d6db9;this['_log'](_0x470523(0x112),_0x82f33f,_0x3c5c1f,_0x222cb5);}[a2_0x2d6db9(0x107)](_0x4b77be,_0x57ff3d,_0x13e123){const _0x42a5cb=a2_0x2d6db9;this[_0x42a5cb(0x10d)](_0x42a5cb(0x107),_0x4b77be,_0x57ff3d,_0x13e123);}[a2_0x2d6db9(0x111)](_0x177260,_0x3501a3,_0x2520ec){const _0x2add5c=a2_0x2d6db9;this['_log'](_0x2add5c(0x111),_0x177260,_0x3501a3,_0x2520ec);}[a2_0x2d6db9(0x115)](){this['enabled']=!![];}get[a2_0x2d6db9(0x109)](){const _0x5b87b9=a2_0x2d6db9;return this[_0x5b87b9(0x103)];}[a2_0x2d6db9(0x10d)](_0x4226da,_0x1a9e6e,_0x532662,_0x176049){const _0x78e2ea=a2_0x2d6db9;if(_0x4226da!==_0x78e2ea(0x111)&&!this[_0x78e2ea(0x103)])return;const _0x2139df=new Date()['toISOString'](),_0x3820cb='['+_0x2139df+_0x78e2ea(0x10a)+_0x4226da[_0x78e2ea(0x10b)]()+_0x78e2ea(0x10a)+_0x1a9e6e+']';console[_0x78e2ea(0x111)](_0x176049?_0x3820cb+'\x20'+_0x532662+'\x20'+JSON[_0x78e2ea(0x104)](_0x176049):_0x3820cb+'\x20'+_0x532662),this['fileStream']?.[_0x78e2ea(0x110)](JSON['stringify']({'ts':_0x2139df,'level':_0x4226da,'component':_0x1a9e6e,'msg':_0x532662,..._0x176049&&{'data':_0x176049}})+'\x0a');}}export const logger=new MorphLogger();
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x30b287,_0x3653a0){const _0x10f9f9=a3_0xf592,_0x38179c=_0x30b287();while(!![]){try{const _0x168c60=parseInt(_0x10f9f9(0xd6))/0x1+parseInt(_0x10f9f9(0xd5))/0x2+-parseInt(_0x10f9f9(0xdd))/0x3*(parseInt(_0x10f9f9(0xdc))/0x4)+parseInt(_0x10f9f9(0xdb))/0x5+-parseInt(_0x10f9f9(0xde))/0x6*(parseInt(_0x10f9f9(0xd7))/0x7)+-parseInt(_0x10f9f9(0xda))/0x8+-parseInt(_0x10f9f9(0xdf))/0x9*(parseInt(_0x10f9f9(0xd1))/0xa);if(_0x168c60===_0x3653a0)break;else _0x38179c['push'](_0x38179c['shift']());}catch(_0x42d604){_0x38179c['push'](_0x38179c['shift']());}}}(a3_0x399c,0xd1714));import a3_0x36ad67 from'path';import a3_0xf091b1 from'os';export function convertToWindowsPath(_0x3ee920){const _0x52ac3d=a3_0xf592;if(_0x3ee920[_0x52ac3d(0xce)]('/mnt/')){const _0x51abc3=_0x3ee920[_0x52ac3d(0xcf)](0x5)[_0x52ac3d(0xd9)](),_0x32972b=_0x3ee920[_0x52ac3d(0xd4)](0x6)['replace'](/\//g,'\x5c');return _0x51abc3+':'+_0x32972b;}if(_0x3ee920[_0x52ac3d(0xe1)](/^\/[a-zA-Z]\//)){const _0x2b81d1=_0x3ee920[_0x52ac3d(0xcf)](0x1)['toUpperCase'](),_0x258b62=_0x3ee920[_0x52ac3d(0xd4)](0x2)['replace'](/\//g,'\x5c');return _0x2b81d1+':'+_0x258b62;}if(_0x3ee920['match'](/^[a-zA-Z]:/))return _0x3ee920[_0x52ac3d(0xd3)](/\//g,'\x5c');return _0x3ee920;}export function normalizePath(_0x1bce54){const _0x575031=a3_0xf592;_0x1bce54=_0x1bce54['trim']()[_0x575031(0xd3)](/^["']|["']$/g,'');const _0x2f94e4=_0x1bce54[_0x575031(0xce)]('/')&&!_0x1bce54[_0x575031(0xe1)](/^\/mnt\/[a-z]\//i)&&!_0x1bce54[_0x575031(0xe1)](/^\/[a-zA-Z]\//);if(_0x2f94e4)return _0x1bce54[_0x575031(0xd3)](/\/+/g,'/')[_0x575031(0xd3)](/\/+$/,'');_0x1bce54=convertToWindowsPath(_0x1bce54);if(_0x1bce54['startsWith']('\x5c\x5c')){let _0x1dba03=_0x1bce54;_0x1dba03=_0x1dba03[_0x575031(0xd3)](/^\\{2,}/,'\x5c\x5c');const _0x373957=_0x1dba03[_0x575031(0xd2)](0x2)['replace'](/\\\\/g,'\x5c');_0x1bce54='\x5c\x5c'+_0x373957;}else _0x1bce54=_0x1bce54[_0x575031(0xd3)](/\\\\/g,'\x5c');let _0x345188=a3_0x36ad67[_0x575031(0xd8)](_0x1bce54);_0x1bce54['startsWith']('\x5c\x5c')&&!_0x345188[_0x575031(0xce)]('\x5c\x5c')&&(_0x345188='\x5c'+_0x345188);if(_0x345188['match'](/^[a-zA-Z]:/)){let _0x1b85e0=_0x345188[_0x575031(0xd3)](/\//g,'\x5c');return/^[a-z]:/[_0x575031(0xd0)](_0x1b85e0)&&(_0x1b85e0=_0x1b85e0[_0x575031(0xcf)](0x0)[_0x575031(0xd9)]()+_0x1b85e0[_0x575031(0xd4)](0x1)),_0x1b85e0;}return _0x345188[_0x575031(0xd3)](/\//g,'\x5c');}function a3_0xf592(_0x567c21,_0x180630){_0x567c21=_0x567c21-0xce;const _0x399c4e=a3_0x399c();let _0xf592fb=_0x399c4e[_0x567c21];return _0xf592fb;}function a3_0x399c(){const _0xb61698=['join','match','startsWith','charAt','test','1106830jAsJhb','substring','replace','slice','2996692ZnRbzC','1434809fRHpoV','5653347pnDBbo','normalize','toUpperCase','6322384ddPqSh','7311665fCnAXt','288872HzClHm','30fGNfjf','6DNVjUi','99SowcZt'];a3_0x399c=function(){return _0xb61698;};return a3_0x399c();}export function expandHome(_0x1fb148){const _0x522f12=a3_0xf592;if(_0x1fb148[_0x522f12(0xce)]('~/')||_0x1fb148==='~')return a3_0x36ad67[_0x522f12(0xe0)](a3_0xf091b1['homedir'](),_0x1fb148['slice'](0x1));return _0x1fb148;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2c12ce,_0xb24f91){const _0x1ecd4c=a4_0x2ee2,_0x5960d1=_0x2c12ce();while(!![]){try{const _0x12f64f=-parseInt(_0x1ecd4c(0x1a1))/0x1*(parseInt(_0x1ecd4c(0x196))/0x2)+parseInt(_0x1ecd4c(0x198))/0x3*(parseInt(_0x1ecd4c(0x1a5))/0x4)+parseInt(_0x1ecd4c(0x1a6))/0x5*(-parseInt(_0x1ecd4c(0x19c))/0x6)+-parseInt(_0x1ecd4c(0x1a0))/0x7*(parseInt(_0x1ecd4c(0x19f))/0x8)+-parseInt(_0x1ecd4c(0x19e))/0x9*(parseInt(_0x1ecd4c(0x1a4))/0xa)+parseInt(_0x1ecd4c(0x197))/0xb+parseInt(_0x1ecd4c(0x19d))/0xc*(parseInt(_0x1ecd4c(0x19b))/0xd);if(_0x12f64f===_0xb24f91)break;else _0x5960d1['push'](_0x5960d1['shift']());}catch(_0x55528d){_0x5960d1['push'](_0x5960d1['shift']());}}}(a4_0xb414,0xd541a));import a4_0x5e54e6 from'path';function a4_0x2ee2(_0x365d31,_0x391075){_0x365d31=_0x365d31-0x191;const _0xb4140=a4_0xb414();let _0x2ee2fb=_0xb4140[_0x365d31];return _0x2ee2fb;}export function isPathWithinAllowedDirectories(_0x1dbd7f,_0x3a57c4){const _0x2259c0=a4_0x2ee2;if(typeof _0x1dbd7f!==_0x2259c0(0x191)||!Array[_0x2259c0(0x1a2)](_0x3a57c4))return![];if(!_0x1dbd7f||_0x3a57c4[_0x2259c0(0x194)]===0x0)return![];if(_0x1dbd7f[_0x2259c0(0x1a7)]('\x00'))return![];let _0x958ed6;try{_0x958ed6=a4_0x5e54e6[_0x2259c0(0x199)](a4_0x5e54e6[_0x2259c0(0x195)](_0x1dbd7f));}catch{return![];}if(!a4_0x5e54e6[_0x2259c0(0x1a8)](_0x958ed6))throw new Error(_0x2259c0(0x192));return _0x3a57c4[_0x2259c0(0x1a3)](_0x3a208e=>{const _0x2037d9=_0x2259c0;if(typeof _0x3a208e!=='string'||!_0x3a208e)return![];if(_0x3a208e[_0x2037d9(0x1a7)]('\x00'))return![];let _0x2ac7f0;try{_0x2ac7f0=a4_0x5e54e6[_0x2037d9(0x199)](a4_0x5e54e6[_0x2037d9(0x195)](_0x3a208e));}catch{return![];}if(!a4_0x5e54e6[_0x2037d9(0x1a8)](_0x2ac7f0))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x958ed6===_0x2ac7f0)return!![];if(_0x2ac7f0===a4_0x5e54e6[_0x2037d9(0x193)])return _0x958ed6[_0x2037d9(0x19a)](a4_0x5e54e6['sep']);return _0x958ed6['startsWith'](_0x2ac7f0+a4_0x5e54e6[_0x2037d9(0x193)]);});}function a4_0xb414(){const _0x11bb88=['sep','length','normalize','2404LVsiOv','7218640erYeQq','330DbhmbE','resolve','startsWith','13JqCxSK','12pbAsAY','14251764NrcoeI','38286pMrrhM','548152hgKfGn','21bLPEPO','92PxhClS','isArray','some','3890EISjmb','50916VVqGXg','999080GQeENd','includes','isAbsolute','string','Path\x20must\x20be\x20absolute\x20after\x20normalization'];a4_0xb414=function(){return _0x11bb88;};return a4_0xb414();}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x190fc8,_0x440584){const _0x4af51f=a5_0x7070,_0x5aedf6=_0x190fc8();while(!![]){try{const _0xb2c2b9=-parseInt(_0x4af51f(0x104))/0x1*(parseInt(_0x4af51f(0xf8))/0x2)+-parseInt(_0x4af51f(0xf7))/0x3+-parseInt(_0x4af51f(0xf1))/0x4+parseInt(_0x4af51f(0x102))/0x5*(-parseInt(_0x4af51f(0xf3))/0x6)+-parseInt(_0x4af51f(0x103))/0x7*(parseInt(_0x4af51f(0xfc))/0x8)+-parseInt(_0x4af51f(0xf0))/0x9*(parseInt(_0x4af51f(0xef))/0xa)+parseInt(_0x4af51f(0xf9))/0xb;if(_0xb2c2b9===_0x440584)break;else _0x5aedf6['push'](_0x5aedf6['shift']());}catch(_0x277914){_0x5aedf6['push'](_0x5aedf6['shift']());}}}(a5_0x3fe7,0x81377));import{promises as a5_0xcc3813}from'fs';import a5_0x5010c9 from'path';import a5_0x5d58f5 from'os';function a5_0x3fe7(){const _0x37f738=['uri','slice','100nUZqRb','50519BxBnCp','857JopThu','\x20due\x20to\x20error:\x20','push','Skipping\x20','63290MkjNFz','801aIDzSl','854396VOMigs','message','258294bjTEQI','startsWith','stat','Skipping\x20invalid\x20directory:\x20','2981535CYcAeh','2174lhlHIR','47875817kiSmKC','resolve','homedir','288kmmyDb','file://','realpath','non-directory\x20root'];a5_0x3fe7=function(){return _0x37f738;};return a5_0x3fe7();}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x32c2c9){const _0x42bafe=a5_0x7070;try{const _0xfbd538=_0x32c2c9[_0x42bafe(0xf4)](_0x42bafe(0xfd))?_0x32c2c9[_0x42bafe(0x101)](0x7):_0x32c2c9,_0x3cdab7=_0xfbd538[_0x42bafe(0xf4)]('~/')||_0xfbd538==='~'?a5_0x5010c9['join'](a5_0x5d58f5[_0x42bafe(0xfb)](),_0xfbd538[_0x42bafe(0x101)](0x1)):_0xfbd538,_0x5382a6=a5_0x5010c9[_0x42bafe(0xfa)](_0x3cdab7),_0x5ef0fb=await a5_0xcc3813[_0x42bafe(0xfe)](_0x5382a6);return normalizePath(_0x5ef0fb);}catch{return null;}}function a5_0x7070(_0x53665d,_0x484295){_0x53665d=_0x53665d-0xee;const _0x3fe7a5=a5_0x3fe7();let _0x707004=_0x3fe7a5[_0x53665d];return _0x707004;}function formatDirectoryError(_0x597bf3,_0x33a7b8,_0x4196d7){const _0x454a1b=a5_0x7070;if(_0x4196d7)return _0x454a1b(0xee)+_0x4196d7+':\x20'+_0x597bf3;const _0x3f59fa=_0x33a7b8 instanceof Error?_0x33a7b8[_0x454a1b(0xf2)]:String(_0x33a7b8);return _0x454a1b(0xf6)+_0x597bf3+_0x454a1b(0x105)+_0x3f59fa;}export async function getValidRootDirectories(_0x26de6f){const _0xb9524f=a5_0x7070,_0x2a24a6=[];for(const _0x3a8f59 of _0x26de6f){const _0x173eb7=await parseRootUri(_0x3a8f59[_0xb9524f(0x100)]);if(!_0x173eb7){logMcpStderr(formatDirectoryError(_0x3a8f59[_0xb9524f(0x100)],undefined,'invalid\x20path\x20or\x20inaccessible'));continue;}try{const _0x191349=await a5_0xcc3813[_0xb9524f(0xf5)](_0x173eb7);_0x191349['isDirectory']()?_0x2a24a6[_0xb9524f(0x106)](_0x173eb7):logMcpStderr(formatDirectoryError(_0x173eb7,undefined,_0xb9524f(0xff)));}catch(_0x567738){logMcpStderr(formatDirectoryError(_0x173eb7,_0x567738));}}return _0x2a24a6;}
|
|
@@ -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
|
+
const a6_0x1aad6b=a6_0x53b3;(function(_0x1a2337,_0x3b3f9b){const _0x22e952=a6_0x53b3,_0x6d13ef=_0x1a2337();while(!![]){try{const _0x2dd4e6=-parseInt(_0x22e952(0xb4))/0x1*(parseInt(_0x22e952(0xad))/0x2)+-parseInt(_0x22e952(0xaa))/0x3*(-parseInt(_0x22e952(0xab))/0x4)+parseInt(_0x22e952(0xb2))/0x5+-parseInt(_0x22e952(0xac))/0x6*(parseInt(_0x22e952(0xaf))/0x7)+-parseInt(_0x22e952(0xa7))/0x8*(parseInt(_0x22e952(0xb1))/0x9)+parseInt(_0x22e952(0xb0))/0xa*(parseInt(_0x22e952(0xa9))/0xb)+-parseInt(_0x22e952(0xa8))/0xc;if(_0x2dd4e6===_0x3b3f9b)break;else _0x6d13ef['push'](_0x6d13ef['shift']());}catch(_0x827cee){_0x6d13ef['push'](_0x6d13ef['shift']());}}}(a6_0x17ad,0x5dd7b));export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':a6_0x1aad6b(0xb3),'GITHUB_CODEBASE_SEARCH':a6_0x1aad6b(0xae)};export const ALL_TOOL_NAMES=Object[a6_0x1aad6b(0xb5)](TOOL_NAMES);function a6_0x53b3(_0x17df37,_0x2b8914){_0x17df37=_0x17df37-0xa7;const _0x17ad4a=a6_0x17ad();let _0x53b3e3=_0x17ad4a[_0x17df37];return _0x53b3e3;}function a6_0x17ad(){const _0x168aaf=['3499525AtIpGw','codebase_search','85tIizKR','values','1256dlvrtj','1599804azcWJr','175318EngQyO','126735VaNaon','20pneONm','689316UkclEM','662VSDEXv','github_codebase_search','14XDYmRV','170KgtadQ','23301fRulWA'];a6_0x17ad=function(){return _0x168aaf;};return a6_0x17ad();}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.
|
|
3
|
+
"version": "0.8.167",
|
|
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.
|
|
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",
|