@morphllm/morphmcp 0.8.110 → 0.8.112
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/README.md +1 -0
- package/dist/index.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/package.json +2 -2
package/README.md
CHANGED
|
@@ -91,6 +91,7 @@ A search sub-agent that explores your codebase autonomously. Give it a problem a
|
|
|
91
91
|
Input:
|
|
92
92
|
search_string: "Find where authentication tokens are validated"
|
|
93
93
|
repo_path: "/Users/me/project"
|
|
94
|
+
search_type: "default" # optional: "default" or "node_modules"
|
|
94
95
|
|
|
95
96
|
Output: List of files with specific line ranges + actual code content
|
|
96
97
|
```
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x1f8383=a0_0x2756;(function(_0x2851b0,_0x438d41){const _0x1ed1b2=a0_0x2756,_0x5d5fbc=_0x2851b0();while(!![]){try{const _0x2429dd=parseInt(_0x1ed1b2(0x289))/0x1+-parseInt(_0x1ed1b2(0x23b))/0x2+-parseInt(_0x1ed1b2(0x232))/0x3+parseInt(_0x1ed1b2(0x1b6))/0x4*(parseInt(_0x1ed1b2(0x19a))/0x5)+-parseInt(_0x1ed1b2(0x207))/0x6+-parseInt(_0x1ed1b2(0x1ac))/0x7*(parseInt(_0x1ed1b2(0x1a8))/0x8)+parseInt(_0x1ed1b2(0x283))/0x9;if(_0x2429dd===_0x438d41)break;else _0x5d5fbc['push'](_0x5d5fbc['shift']());}catch(_0x29887b){_0x5d5fbc['push'](_0x5d5fbc['shift']());}}}(a0_0x5655,0x52bb4));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_0x41cac1 from'fs/promises';import a0_0x59b14c from'path';import a0_0x490833 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.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{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x436e9f from'axios';function fixPathRepetition(_0x4a5830){const _0x4e9710=a0_0x2756,_0x213d8a=_0x4a5830[_0x4e9710(0x1ec)](a0_0x59b14c[_0x4e9710(0x276)])[_0x4e9710(0x1d4)](Boolean);if(_0x213d8a[_0x4e9710(0x269)]<0x2)return null;for(let _0x37db86=Math[_0x4e9710(0x1e6)](_0x213d8a[_0x4e9710(0x269)]/0x2);_0x37db86>=0x1;_0x37db86--){for(let _0x153b73=0x0;_0x153b73<=_0x213d8a[_0x4e9710(0x269)]-0x2*_0x37db86;_0x153b73++){const _0xaf44f8=_0x213d8a[_0x4e9710(0x220)](_0x153b73,_0x153b73+_0x37db86),_0x6f9814=_0x213d8a[_0x4e9710(0x220)](_0x153b73+_0x37db86,_0x153b73+0x2*_0x37db86);if(_0xaf44f8['every']((_0x337824,_0x3b6c5b)=>_0x337824===_0x6f9814[_0x3b6c5b])){const _0x45935e=[..._0x213d8a[_0x4e9710(0x220)](0x0,_0x153b73),..._0x213d8a[_0x4e9710(0x220)](_0x153b73+_0x37db86)];return a0_0x59b14c[_0x4e9710(0x276)]+_0x45935e[_0x4e9710(0x250)](a0_0x59b14c[_0x4e9710(0x276)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x47ac9f=a0_0x2756;try{const _0x100d5b=require(_0x47ac9f(0x26f));return _0x100d5b[_0x47ac9f(0x1fa)]??'unknown';}catch(_0xb4a1fa){return console[_0x47ac9f(0x28e)](_0x47ac9f(0x277),_0xb4a1fa),_0x47ac9f(0x2ab);}}function printHelp(){const _0x22f072=a0_0x2756;console[_0x22f072(0x278)](_0x22f072(0x264)+getPackageVersion()),console[_0x22f072(0x278)](_0x22f072(0x1d8)),console[_0x22f072(0x278)](_0x22f072(0x294)),console[_0x22f072(0x278)](_0x22f072(0x27b)),console[_0x22f072(0x278)](_0x22f072(0x1db)),console[_0x22f072(0x278)](_0x22f072(0x1de)),console['log'](_0x22f072(0x1c5)),console[_0x22f072(0x278)]('\x20\x20morph-mcp'),console[_0x22f072(0x278)](_0x22f072(0x209));}function a0_0x5655(){const _0x5725d1=['-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','slice','Max\x20results\x20to\x20return','Error\x20accessing\x20directory\x20','Unknown\x20tool:\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','toLowerCase','isDirectory','description','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','--help','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','WORKSPACE_ROOT','BinaryFile','listRoots','ENOENT','SymlinkError','\x20for:\x20\x22','data','1474278FJDMzD','morph-warp-grep-v1-1111v0','constructor','includes','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','isArray','Relevant\x20context\x20found:','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.','\x20\x20\x20','1258742UEYTUt','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','success','\x20error(s)','changes','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','[could\x20not\x20read\x20file:\x20','substring','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','composer.json','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','limit','<file\x20path=\x22','MORPH_WARP_GREP_TIMEOUT','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','%\x20match)\x0a','Natural\x20language\x20query\x20to\x20search\x20for\x20code','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','RipgrepNotAvailable','name','codebase_search','join','Morph\x20FastApply\x20failed\x20without\x20error\x20message','...','\x20is\x20not\x20a\x20directory','[warpgrep_github_search]\x20Searching\x20','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','results','min','getClientCapabilities','query_type','inputSchema','rerankScore','pyproject.toml','ENABLED_TOOLS','Warning:\x20Workspace\x20fallback\x20failed:\x20','Search\x20failed:\x20','code','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','Benefits:\x0a','enum','@morphllm/morphmcp\x20','-\x20Read\x20file\x20`','timings','FileReadError','read','length','WarpGrep\x20sub-tool\x20errors:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','source','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','metadata','../package.json','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','package.json','resolve','search_string','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','UnknownError','sep','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','log','requiresApiKey','query','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','WarpGrepError','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','warpgrep_codebase_search','realpath','false','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','application/json','12095748anrDkQ','optional','.git','Error:\x20','morph-','.\x20Changes:\x20','521793sRsqzk','text','timed\x20out','stack','some','error','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','grep','message','node_modules','Enabled\x20tools:\x20','\x0aOptions:','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','completed_with_file_errors','unknown\x20error','\x20results\x20in\x20','GitHub\x20search\x20failed:\x20','stats','owner_repo','instruction','toISOString','.vscode','ENABLE_WORKSPACE_MODE','lines','warpgrep_github_search','mcp-filesystem','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','content','morph-v3-fast','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','env','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','unknown','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','path','terminationReason','safeParse','object','searchTimeMs','sk-','targetDirectories','basename','[warpgrep_github_search]\x20Failed\x20in\x20','\x20as\x20allowed\x20directory','PathError','ms:','1285405sFgDMv','added\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','cwd','filepath',',\x20removed\x20','indexOf','now','.cursor','PWD','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','terminated','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','push','8DjPDdn','-\x20Listed\x20directory\x20`','linesModified','For\x20deletions:\x0a','3191587kzxbWE','repoId','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','utf-8','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','access','role','all','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x20-\x20','8xdxbSA','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','tsconfig.json','--api-key=','boolean','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','Warning:\x20','startsWith','connect','branch','MORPH_API_URL','TimeoutError','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','readFile','user','\x0aExamples:','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','0.2.0','finish','repo_path','messages','runWarpGrep_call','morph-mcp','[warpgrep_github_search]\x20Done\x20in\x20','--version','params','--api-key','warn','map','setRequestHandler','filter','Cargo.toml','searchGitHub','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','exit','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','describe','string','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','\x20\x20\x20Lines\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','linesAdded','\x27\x20in\x20`','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','floor','completionId','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','etimedout','FileNotFound','Morph\x20Edit\x20Preview','split','ReadError','.\x20Path:\x20','dirname','completed','default','timeout','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','SubToolError','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','setNotificationHandler','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Repository\x20identifier','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','version','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','roots','files','Failed\x20to\x20read\x20file:\x20','homedir','-\x20Grepped\x20\x27','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Invalid\x20arguments:\x20','assistant','startLine','errors','2785926pFdcGQ','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','trim','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','Query\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','number','edit_file','Error\x20running\x20fast\x20context\x20search:\x20','ToolException','api-key','match','\x0a...\x20(truncated,\x20total:\x20','oninitialized','catch','RipgrepError','has','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','File\x20read\x20error:','dryRun','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'];a0_0x5655=function(){return _0x5725d1;};return a0_0x5655();}const cliArgs=process['argv'][a0_0x1f8383(0x220)](0x2),VERSION_FLAGS=new Set([a0_0x1f8383(0x1ce),'-v','-V']),HELP_FLAGS=new Set([a0_0x1f8383(0x229),'-h']);function a0_0x2756(_0x1ae602,_0x222eea){_0x1ae602=_0x1ae602-0x18f;const _0x5655ef=a0_0x5655();let _0x27569e=_0x5655ef[_0x1ae602];return _0x27569e;}cliArgs[a0_0x1f8383(0x28d)](_0xb2553d=>VERSION_FLAGS['has'](_0xb2553d))&&(console[a0_0x1f8383(0x278)](a0_0x1f8383(0x264)+getPackageVersion()),process[a0_0x1f8383(0x1d9)](0x0));cliArgs['some'](_0x1e568d=>HELP_FLAGS[a0_0x1f8383(0x219)](_0x1e568d))&&(printHelp(),process[a0_0x1f8383(0x1d9)](0x0));function getCliArg(_0x236a82){const _0x5df50a=a0_0x1f8383;for(let _0x268773=0x0;_0x268773<cliArgs[_0x5df50a(0x269)];_0x268773++){const _0x562ae9=cliArgs[_0x268773];if(_0x562ae9[_0x5df50a(0x1bd)]('--'+_0x236a82+'='))return _0x562ae9[_0x5df50a(0x220)](('--'+_0x236a82+'=')['length']);if(_0x562ae9==='--'+_0x236a82&&_0x268773+0x1<cliArgs[_0x5df50a(0x269)])return cliArgs[_0x268773+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x1f8383(0x269)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x1f8383(0x219)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x1f8383(0x1bd)](a0_0x1f8383(0x1b9)))continue;if(arg===a0_0x1f8383(0x1d0)){i++;continue;}args[a0_0x1f8383(0x1a7)](arg);}const ALL_TOOLS=[a0_0x1f8383(0x210),a0_0x1f8383(0x27e),a0_0x1f8383(0x2a3),'codebase_search'],DEFAULT_TOOLS=['edit_file',a0_0x1f8383(0x27e),a0_0x1f8383(0x2a3)],ENABLED_TOOLS=process[a0_0x1f8383(0x2a9)][a0_0x1f8383(0x25d)]?process[a0_0x1f8383(0x2a9)]['ENABLED_TOOLS']===a0_0x1f8383(0x1b3)?ALL_TOOLS:process[a0_0x1f8383(0x2a9)]['ENABLED_TOOLS']['split'](',')[a0_0x1f8383(0x1d2)](_0x128045=>_0x128045[a0_0x1f8383(0x20a)]()):DEFAULT_TOOLS;console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x293)+ENABLED_TOOLS[a0_0x1f8383(0x250)](',\x20'));const WORKSPACE_ROOT=process[a0_0x1f8383(0x2a9)][a0_0x1f8383(0x22b)]||process[a0_0x1f8383(0x2a9)][a0_0x1f8383(0x1a3)]||process[a0_0x1f8383(0x19d)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x1f8383(0x2a1)]!==a0_0x1f8383(0x280),MORPH_API_KEY=getCliArg(a0_0x1f8383(0x213))??process['env']['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x1f8383(0x2a9)][a0_0x1f8383(0x1c0)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x1f8383(0x2a9)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x1f8383(0x2a9)][a0_0x1f8383(0x248)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x1f8383(0x1bd)](a0_0x1f8383(0x193))&&!MORPH_API_KEY[a0_0x1f8383(0x1bd)](a0_0x1f8383(0x287))&&console['error'](a0_0x1f8383(0x1a4));async function reportMorphError(_0x20a05d){const _0x531954=a0_0x1f8383;try{await a0_0x436e9f['post']('https://morphllm.com/api/error-report',{..._0x20a05d,'timestamp':new Date()[_0x531954(0x29f)](),'source':_0x20a05d[_0x531954(0x26c)]||_0x531954(0x2a4)},{'timeout':0x1388,'headers':{'Content-Type':_0x531954(0x282),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}args[a0_0x1f8383(0x269)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x274)),console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x1b4)),console['error'](a0_0x1f8383(0x281)),console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x28f)),console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x1a6)),console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x1e5)));function normalizePath(_0x43b8c0){return a0_0x59b14c['normalize'](_0x43b8c0);}function expandHome(_0x59173c){const _0x445111=a0_0x1f8383;if(_0x59173c[_0x445111(0x1bd)]('~/')||_0x59173c==='~')return a0_0x59b14c['join'](a0_0x490833[_0x445111(0x200)](),_0x59173c[_0x445111(0x220)](0x1));return _0x59173c;}let allowedDirectories=await Promise[a0_0x1f8383(0x1b3)](args[a0_0x1f8383(0x1d2)](async _0x4a31d2=>{const _0x4fccc1=a0_0x1f8383,_0x49efa6=expandHome(_0x4a31d2),_0x4ab0da=a0_0x59b14c[_0x4fccc1(0x272)](_0x49efa6);try{const _0x176b56=await a0_0x41cac1['realpath'](_0x4ab0da);return normalizePath(_0x176b56);}catch(_0x4a2052){return normalizePath(_0x4ab0da);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x1f8383(0x1a7)](workspaceDir),console[a0_0x1f8383(0x28e)]('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x1f8383(0x197)));}catch(a0_0x4e8d1b){console[a0_0x1f8383(0x28e)](a0_0x1f8383(0x202)+a0_0x4e8d1b);}async function detectWorkspaceRoot(_0x18e996){const _0x573e3f=a0_0x1f8383;let _0x1d90a4=a0_0x59b14c[_0x573e3f(0x272)](_0x18e996);const _0x5d76f1=[_0x573e3f(0x285),_0x573e3f(0x2a0),_0x573e3f(0x271),_0x573e3f(0x1d5),_0x573e3f(0x25c),'go.mod',_0x573e3f(0x1a2),_0x573e3f(0x1b8),_0x573e3f(0x244)];while(_0x1d90a4!==a0_0x59b14c['dirname'](_0x1d90a4)){for(const _0x3e8260 of _0x5d76f1){const _0x1bd6ba=a0_0x59b14c[_0x573e3f(0x250)](_0x1d90a4,_0x3e8260);try{return await a0_0x41cac1[_0x573e3f(0x1b1)](_0x1bd6ba),normalizePath(_0x1d90a4);}catch{}}_0x1d90a4=a0_0x59b14c['dirname'](_0x1d90a4);}return normalizePath(_0x18e996);}await Promise['all'](args[a0_0x1f8383(0x1d2)](async _0x15efe6=>{const _0x3fdcc2=a0_0x1f8383;try{const _0x3e91c5=await a0_0x41cac1['stat'](expandHome(_0x15efe6));!_0x3e91c5[_0x3fdcc2(0x226)]()&&(console[_0x3fdcc2(0x28e)](_0x3fdcc2(0x286)+_0x15efe6+_0x3fdcc2(0x253)),process[_0x3fdcc2(0x1d9)](0x1));}catch(_0x79a507){console[_0x3fdcc2(0x28e)](_0x3fdcc2(0x222)+_0x15efe6+':',_0x79a507),process[_0x3fdcc2(0x1d9)](0x1);}}));async function validatePath(_0x587462){const _0x158185=a0_0x1f8383,_0x10d591=expandHome(_0x587462),_0x4b4213=a0_0x59b14c[_0x158185(0x272)](_0x10d591);try{const _0x5eccd8=await a0_0x41cac1['realpath'](_0x4b4213);return _0x5eccd8;}catch(_0x2f3869){if(_0x2f3869[_0x158185(0x260)]===_0x158185(0x22e)){const _0x413d55=a0_0x59b14c[_0x158185(0x1ef)](_0x4b4213);try{const _0x58cb4a=await a0_0x41cac1[_0x158185(0x27f)](_0x413d55);return a0_0x59b14c[_0x158185(0x250)](_0x58cb4a,a0_0x59b14c[_0x158185(0x195)](_0x4b4213));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x413d55);}}throw _0x2f3869;}}const MorphEditFileArgsSchema=z[a0_0x1f8383(0x191)]({'path':z[a0_0x1f8383(0x1dd)](),'code_edit':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x243)),'instruction':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x297)),'dryRun':z[a0_0x1f8383(0x1ba)]()[a0_0x1f8383(0x1f1)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x27d)),'repo_path':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x1f9)),'query_type':z[a0_0x1f8383(0x263)]([a0_0x1f8383(0x1f1),a0_0x1f8383(0x292)])[a0_0x1f8383(0x284)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x20e))}),WarpGrepGitHubArgsSchema=z[a0_0x1f8383(0x191)]({'search_string':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x27d)),'github_url':z['string']()[a0_0x1f8383(0x284)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x1e2)),'owner_repo':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x284)]()['describe'](a0_0x1f8383(0x21a)),'branch':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x284)]()[a0_0x1f8383(0x1dc)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x1f8383(0x191)]({'query':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x24b)),'repoId':z['string']()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x1f8)),'branch':z[a0_0x1f8383(0x1dd)]()['optional']()[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x1f7)),'commitHash':z[a0_0x1f8383(0x1dd)]()[a0_0x1f8383(0x284)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z['array'](z[a0_0x1f8383(0x1dd)]())[a0_0x1f8383(0x1f1)]([])[a0_0x1f8383(0x1dc)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x1f8383(0x20f)]()[a0_0x1f8383(0x284)]()['default'](0xa)[a0_0x1f8383(0x1dc)](a0_0x1f8383(0x221))}),server=new Server({'name':a0_0x1f8383(0x1cc),'version':a0_0x1f8383(0x1c7)},{'capabilities':{'tools':{}}});server[a0_0x1f8383(0x1d3)](ListToolsRequestSchema,async()=>{const _0xd5f4d4=a0_0x1f8383,_0x5cdce8=[{'name':_0xd5f4d4(0x210),'description':_0xd5f4d4(0x23c)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0xd5f4d4(0x21b)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0xd5f4d4(0x262)+_0xd5f4d4(0x295)+_0xd5f4d4(0x21e)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0xd5f4d4(0x1fc)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0xd5f4d4(0x1f3)+_0xd5f4d4(0x228)+_0xd5f4d4(0x1ab)+_0xd5f4d4(0x240)+_0xd5f4d4(0x20b)+'Rules:\x0a'+_0xd5f4d4(0x21f)+_0xd5f4d4(0x1e1)+_0xd5f4d4(0x2ac)+_0xd5f4d4(0x296)+_0xd5f4d4(0x224)+_0xd5f4d4(0x1d7)+_0xd5f4d4(0x1bb),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0xd5f4d4(0x27e),'description':_0xd5f4d4(0x1b0)+_0xd5f4d4(0x255)+_0xd5f4d4(0x208)+_0xd5f4d4(0x2a5)+_0xd5f4d4(0x245)+'Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20'+_0xd5f4d4(0x24c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':_0xd5f4d4(0x24f),'description':'**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a'+_0xd5f4d4(0x20d)+_0xd5f4d4(0x1f5)+_0xd5f4d4(0x262)+'-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a'+_0xd5f4d4(0x2a8)+_0xd5f4d4(0x1c2)+'-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a'+'Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20'+_0xd5f4d4(0x261)+_0xd5f4d4(0x1b7),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x4ab8b0=_0x5cdce8['filter'](_0x52df27=>{const _0x161880=_0xd5f4d4;if(!ENABLED_TOOLS['includes'](_0x52df27['name']))return![];if(_0x161880(0x279)in _0x52df27&&_0x52df27[_0x161880(0x279)]&&!MORPH_API_KEY)return console[_0x161880(0x28e)](_0x161880(0x1bc)+_0x52df27[_0x161880(0x24e)]+_0x161880(0x1c6)),![];return!![];});return{'tools':_0x4ab8b0[_0xd5f4d4(0x1d2)](_0x54a475=>({'name':_0x54a475[_0xd5f4d4(0x24e)],'description':_0x54a475[_0xd5f4d4(0x227)],'inputSchema':_0x54a475[_0xd5f4d4(0x25a)]}))};}),server[a0_0x1f8383(0x1d3)](CallToolRequestSchema,async _0x37a752=>{const _0x1b4e68=a0_0x1f8383;try{const {name:_0x305adc,arguments:_0x55427b}=_0x37a752[_0x1b4e68(0x1cf)];switch(_0x305adc){case _0x1b4e68(0x210):{const _0x217260=MorphEditFileArgsSchema[_0x1b4e68(0x190)](_0x55427b);if(!_0x217260[_0x1b4e68(0x23d)])throw new Error(_0x1b4e68(0x26d)+_0x217260[_0x1b4e68(0x28e)]);const _0x18849d=await validatePath(_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x2ad)]);let _0x5b1df5=null,_0x3f6b7c=!![],_0xb803eb=null;try{_0x5b1df5=await a0_0x41cac1[_0x1b4e68(0x1c3)](_0x18849d,_0x1b4e68(0x1af));}catch(_0x362913){const _0x3a5973=_0x362913['code'];_0x3a5973==='ENOENT'?(_0x3f6b7c=![],_0x5b1df5=''):(_0xb803eb=_0x1b4e68(0x1ff)+(_0x3a5973||_0x1b4e68(0x2ab))+_0x1b4e68(0x1b5)+(_0x362913 instanceof Error?_0x362913[_0x1b4e68(0x291)]:String(_0x362913)),console[_0x1b4e68(0x28e)](_0x1b4e68(0x1bc)+_0xb803eb));}let _0x5d4834;try{const _0x269db9=MORPH_API_KEY;if(!_0x269db9)throw new Error(_0x1b4e68(0x236));const _0x5df2f6=a0_0x59b14c[_0x1b4e68(0x1ef)](_0x18849d),_0x34cbc9=a0_0x59b14c[_0x1b4e68(0x195)](_0x18849d),_0x6ed28c=await executeEditFile({'target_filepath':_0x34cbc9,'code_edit':_0x217260[_0x1b4e68(0x231)]['code_edit'],'instructions':_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x29e)]},{'morphApiKey':_0x269db9,'morphApiUrl':MORPH_API_URL,'baseDir':_0x5df2f6,'autoWrite':!_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x21d)],'generateUdiff':![],'debug':![]});_0x5d4834=_0x6ed28c[_0x1b4e68(0x1e7)];if(!_0x6ed28c[_0x1b4e68(0x23d)])throw new Error(_0x6ed28c[_0x1b4e68(0x28e)]||_0x1b4e68(0x251));const _0x397acb=_0x6ed28c[_0x1b4e68(0x23f)],_0xdc687c=_0x1b4e68(0x19b)+_0x397acb[_0x1b4e68(0x1e3)]+_0x1b4e68(0x19f)+_0x397acb['linesRemoved']+',\x20modified\x20'+_0x397acb[_0x1b4e68(0x1aa)];if(_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x21d)])return{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x1eb)+(_0x3f6b7c?'':'\x20(new\x20file)')+':\x20'+_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x29e)]+'.\x20Changes:\x20'+_0xdc687c+_0x1b4e68(0x1ee)+_0x217260['data'][_0x1b4e68(0x2ad)]+'.'}]};return{'content':[{'type':_0x1b4e68(0x28a),'text':'Morph\x20Edit\x20'+(_0x3f6b7c?'Applied':'Created\x20File')+':\x20'+_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x29e)]+_0x1b4e68(0x288)+_0xdc687c+_0x1b4e68(0x1ee)+_0x217260['data'][_0x1b4e68(0x2ad)]+'.'}]};}catch(_0x3a7cca){const _0x37c6fa=_0x3a7cca instanceof Error?_0x3a7cca[_0x1b4e68(0x291)]:String(_0x3a7cca);return reportMorphError({'error_message':_0x37c6fa,'error_type':_0x3a7cca instanceof Error?_0x3a7cca[_0x1b4e68(0x234)][_0x1b4e68(0x24e)]:'UnknownError','context':{'tool':_0x1b4e68(0x210),'completion_id':_0x5d4834,'file_path':_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x2ad)],'validated_path':_0x18849d,'instruction':_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x29e)],'model':_0x1b4e68(0x2a7),'dry_run':_0x217260[_0x1b4e68(0x231)]['dryRun'],'file_exists':_0x3f6b7c,'file_read_error':_0xb803eb,'file_readable':_0x5b1df5!==null,'request_content':{'path':_0x217260['data'][_0x1b4e68(0x2ad)],'code_edit':_0x217260[_0x1b4e68(0x231)]['code_edit'],'instruction':_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x29e)],'original_code':_0x5b1df5!==null?_0x5b1df5['length']>0xc350?_0x5b1df5['substring'](0x0,0xc350)+_0x1b4e68(0x215)+_0x5b1df5[_0x1b4e68(0x269)]+'\x20chars)':_0x5b1df5:_0x1b4e68(0x241)+(_0xb803eb||_0x1b4e68(0x299))+']','original_code_length':_0x5b1df5?.[_0x1b4e68(0x269)]??0x0,'model':_0x1b4e68(0x2a7),'dry_run':_0x217260[_0x1b4e68(0x231)][_0x1b4e68(0x21d)]}},'stack_trace':_0x3a7cca instanceof Error?_0x3a7cca[_0x1b4e68(0x28c)]:undefined,'source':_0x1b4e68(0x2a4)})[_0x1b4e68(0x217)](()=>{}),{'content':[{'type':_0x1b4e68(0x28a),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x37c6fa}],'isError':!![]};}}case _0x1b4e68(0x27e):{const _0x474cec=WarpGrepArgsSchema[_0x1b4e68(0x190)](_0x55427b);if(!_0x474cec[_0x1b4e68(0x23d)])return{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x203)+_0x474cec[_0x1b4e68(0x28e)]}],'isError':!![]};const _0x3db202=_0x316714=>{const _0x500647=_0x1b4e68,_0xf8f343=[];for(const _0x1ec788 of _0x316714||[]){const _0x2c4448=_0x1ec788[_0x500647(0x1b2)],_0x2be555=_0x1ec788['content'];if(_0x2c4448==='assistant'&&_0x2be555){const _0x1275ca=_0x2be555[_0x500647(0x1ec)]('\x0a')[_0x500647(0x1d4)](_0x2fb3c5=>_0x2fb3c5[_0x500647(0x20a)]());for(const _0x331568 of _0x1275ca){const _0x37d730=_0x331568[_0x500647(0x214)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x37d730){_0xf8f343[_0x500647(0x1a7)]('grep\x20\x27'+_0x37d730[0x1]+'\x27\x20'+_0x37d730[0x2]);continue;}const _0x1002b5=_0x331568[_0x500647(0x214)](/^read\s+(.+)$/);if(_0x1002b5){_0xf8f343[_0x500647(0x1a7)]('read\x20'+_0x1002b5[0x1]);continue;}const _0x304c93=_0x331568[_0x500647(0x214)](/^list_directory\s+(.+)$/);if(_0x304c93){_0xf8f343['push']('list_directory\x20'+_0x304c93[0x1]);continue;}}}}return _0xf8f343;},_0x5a8065=_0x12e1d4=>{const _0x2f61c3=_0x1b4e68,_0x1370cb=[];if(!_0x12e1d4||!Array['isArray'](_0x12e1d4))return _0x1370cb;const _0x4e26c2=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2f61c3(0x1ea),'tool':_0x2f61c3(0x268)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x2f61c3(0x198),'tool':_0x2f61c3(0x268)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2f61c3(0x22c),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2f61c3(0x218),'tool':_0x2f61c3(0x290)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2f61c3(0x24d),'tool':_0x2f61c3(0x290)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2f61c3(0x22c),'tool':_0x2f61c3(0x268)},{'pattern':/\[SYMLINK\]/,'error_type':_0x2f61c3(0x22f),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x2f61c3(0x22c),'tool':'read'},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x2f61c3(0x268)},{'pattern':/Error reading file:/,'error_type':_0x2f61c3(0x1ed),'tool':_0x2f61c3(0x268)},{'pattern':/status="error"/,'error_type':_0x2f61c3(0x212),'tool':_0x2f61c3(0x2ab)}];let _0x129dd7=0x0;for(const _0x5d958c of _0x12e1d4){if(_0x5d958c[_0x2f61c3(0x1b2)]===_0x2f61c3(0x1c4)){_0x129dd7++;const _0x575070=_0x5d958c[_0x2f61c3(0x2a6)];if(!_0x575070||typeof _0x575070!==_0x2f61c3(0x1dd))continue;for(const {pattern:_0x4db972,error_type:_0x4acb31,tool:_0x49ec05}of _0x4e26c2){const _0x2a629b=_0x575070[_0x2f61c3(0x214)](new RegExp(_0x4db972[_0x2f61c3(0x26c)],'g'));if(_0x2a629b)for(const _0x439dfb of _0x2a629b){const _0x50c849=_0x575070[_0x2f61c3(0x1a0)](_0x439dfb),_0x13cfe8=_0x575070['substring'](_0x50c849,Math[_0x2f61c3(0x257)](_0x50c849+0xc8,_0x575070['length']));_0x1370cb[_0x2f61c3(0x1a7)]({'tool':_0x49ec05,'error_type':_0x4acb31,'error_message':_0x13cfe8[_0x2f61c3(0x1ec)]('\x0a')[0x0],'turn':_0x129dd7});}}}}return _0x1370cb;};try{const _0x422766=a0_0x59b14c[_0x1b4e68(0x272)](_0x474cec['data'][_0x1b4e68(0x1c9)]),_0x1ad61f=_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x259)],_0x14f72f=_0x1ad61f===_0x1b4e68(0x292)?{'allowNames':[_0x1b4e68(0x292)]}:undefined,_0x15b8a2=new LocalRipgrepProvider(_0x422766,undefined,_0x14f72f),_0x30d1c1=await runWarpGrep({'query':_0x474cec['data']['search_string'],'repoRoot':_0x422766,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x15b8a2,'query_type':_0x1ad61f}),_0x972c1=_0x5a8065(_0x30d1c1[_0x1b4e68(0x1ca)]);_0x972c1[_0x1b4e68(0x269)]>0x0&&reportMorphError({'error_message':_0x1b4e68(0x26a)+_0x972c1[_0x1b4e68(0x269)]+_0x1b4e68(0x23e),'error_type':_0x1b4e68(0x1f4),'level':_0x1b4e68(0x1d1),'tool':_0x1b4e68(0x27e),'context':{'repo_path':_0x474cec['data'][_0x1b4e68(0x1c9)],'query':_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x30d1c1[_0x1b4e68(0x18f)],'sub_tool_errors':_0x972c1,'timings':_0x30d1c1[_0x1b4e68(0x266)],'tool_calls':_0x3db202(_0x30d1c1['messages']),'messages':_0x30d1c1[_0x1b4e68(0x1ca)]?.[_0x1b4e68(0x1d2)](_0x28f843=>({'role':_0x28f843['role'],'content':_0x28f843[_0x1b4e68(0x2a6)]}))},'source':'mcp-filesystem'})[_0x1b4e68(0x217)](()=>{});let _0x4eb1ee='';if(_0x30d1c1[_0x1b4e68(0x18f)]===_0x1b4e68(0x1f0)&&_0x30d1c1[_0x1b4e68(0x1c8)]?.[_0x1b4e68(0x26e)]?.['files']){const _0x2fb14c=_0x30d1c1[_0x1b4e68(0x1c8)][_0x1b4e68(0x26e)][_0x1b4e68(0x1fe)];if(_0x2fb14c['length']===0x0)return _0x4eb1ee=_0x30d1c1[_0x1b4e68(0x1c8)]['payload']||_0x1b4e68(0x2aa),{'content':[{'type':_0x1b4e68(0x28a),'text':_0x4eb1ee}]};const _0x39dbb0=[],_0x5208b9=[_0x1b4e68(0x1da)];for(const _0x117b6a of _0x30d1c1[_0x1b4e68(0x1ca)]){const _0x3c4a17=_0x117b6a[_0x1b4e68(0x1b2)],_0x2c96c1=_0x117b6a[_0x1b4e68(0x2a6)];if(_0x3c4a17===_0x1b4e68(0x204)&&_0x2c96c1){const _0x410487=_0x2c96c1[_0x1b4e68(0x1ec)]('\x0a')[_0x1b4e68(0x1d4)](_0x57a1ad=>_0x57a1ad[_0x1b4e68(0x20a)]());for(const _0x48515d of _0x410487){const _0x3e4719=_0x48515d['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x3e4719){_0x5208b9[_0x1b4e68(0x1a7)](_0x1b4e68(0x201)+_0x3e4719[0x1]+_0x1b4e68(0x1e4)+_0x3e4719[0x2]+'`');continue;}const _0x2ed798=_0x48515d[_0x1b4e68(0x214)](/^read\s+(.+)$/);if(_0x2ed798){_0x5208b9[_0x1b4e68(0x1a7)](_0x1b4e68(0x265)+_0x2ed798[0x1]+'`');continue;}const _0x4806ed=_0x48515d[_0x1b4e68(0x214)](/^list_directory\s+(.+)$/);if(_0x4806ed){_0x5208b9[_0x1b4e68(0x1a7)](_0x1b4e68(0x1a9)+_0x4806ed[0x1]+'`');continue;}}}}_0x39dbb0[_0x1b4e68(0x1a7)](_0x5208b9['join']('\x0a'));const _0x1c7a92=['',_0x1b4e68(0x238)];for(const _0xf38ddc of _0x2fb14c){if(_0xf38ddc[_0x1b4e68(0x2a2)]==='*')_0x1c7a92[_0x1b4e68(0x1a7)]('-\x20'+_0xf38ddc[_0x1b4e68(0x2ad)]+':*');else{if(Array[_0x1b4e68(0x237)](_0xf38ddc[_0x1b4e68(0x2a2)])){const _0x3354b2=_0xf38ddc[_0x1b4e68(0x2a2)][_0x1b4e68(0x1d2)](([_0x24e8b1,_0x399c26])=>{if(_0x24e8b1===_0x399c26)return''+_0x24e8b1;return _0x24e8b1+'-'+_0x399c26;});_0x1c7a92[_0x1b4e68(0x1a7)]('-\x20'+_0xf38ddc[_0x1b4e68(0x2ad)]+':'+_0x3354b2['join'](','));}else _0x1c7a92[_0x1b4e68(0x1a7)]('-\x20'+_0xf38ddc[_0x1b4e68(0x2ad)]+':*');}}_0x1c7a92[_0x1b4e68(0x1a7)](''),_0x39dbb0['push'](_0x1c7a92[_0x1b4e68(0x250)]('\x0a')),_0x39dbb0[_0x1b4e68(0x1a7)](_0x1b4e68(0x26b));const _0x4009f0=[];for(const _0x16ce98 of _0x2fb14c){let _0x211afa=a0_0x59b14c[_0x1b4e68(0x272)](_0x474cec['data'][_0x1b4e68(0x1c9)],_0x16ce98[_0x1b4e68(0x2ad)]),_0x371a09=null,_0x374a39=null;try{_0x371a09=await a0_0x41cac1['readFile'](_0x211afa,{'encoding':_0x1b4e68(0x1af)});}catch(_0x16d876){const _0x2b3d02=fixPathRepetition(_0x211afa);if(_0x2b3d02)try{_0x371a09=await a0_0x41cac1[_0x1b4e68(0x1c3)](_0x2b3d02,{'encoding':_0x1b4e68(0x1af)}),_0x211afa=_0x2b3d02;}catch{_0x374a39=_0x16d876 instanceof Error?_0x16d876:new Error(String(_0x16d876));}else _0x374a39=_0x16d876 instanceof Error?_0x16d876:new Error(String(_0x16d876));}if(_0x371a09!==null){const _0xfec1=_0x371a09[_0x1b4e68(0x1ec)](/\r?\n/),_0x462712=[_0x1b4e68(0x247)+_0x16ce98[_0x1b4e68(0x2ad)]+'\x22>'];if(_0x16ce98['lines']==='*'||!Array[_0x1b4e68(0x237)](_0x16ce98[_0x1b4e68(0x2a2)]))for(let _0x458d2d=0x1;_0x458d2d<=_0xfec1[_0x1b4e68(0x269)];_0x458d2d++){const _0x95ce0e=_0xfec1[_0x458d2d-0x1];_0x462712['push'](_0x458d2d+'|\x20'+_0x95ce0e);}else for(const [_0x46aeae,_0x48d814]of _0x16ce98[_0x1b4e68(0x2a2)]){_0x462712[_0x1b4e68(0x269)]>0x1&&_0x462712[_0x1b4e68(0x1a7)]('');for(let _0x33b1cc=_0x46aeae;_0x33b1cc<=_0x48d814&&_0x33b1cc<=_0xfec1['length'];_0x33b1cc++){const _0x2c8e23=_0xfec1[_0x33b1cc-0x1];_0x462712[_0x1b4e68(0x1a7)](_0x33b1cc+'|\x20'+_0x2c8e23);}}_0x462712[_0x1b4e68(0x1a7)]('</file>'),_0x4009f0[_0x1b4e68(0x1a7)](_0x462712[_0x1b4e68(0x250)]('\x0a'));}else _0x4009f0[_0x1b4e68(0x1a7)](_0x1b4e68(0x247)+_0x16ce98[_0x1b4e68(0x2ad)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x374a39?.[_0x1b4e68(0x291)]||'Unknown\x20error')+'\x0a</file>');}_0x39dbb0[_0x1b4e68(0x1a7)](_0x4009f0[_0x1b4e68(0x250)]('\x0a\x0a')),_0x4eb1ee=_0x39dbb0[_0x1b4e68(0x250)]('\x0a');const _0x2065c5=_0x30d1c1[_0x1b4e68(0x206)]?.[_0x1b4e68(0x1d4)](_0x3cb8ba=>_0x3cb8ba[_0x1b4e68(0x291)]?.[_0x1b4e68(0x1bd)](_0x1b4e68(0x21c)))||[];if(_0x2065c5[_0x1b4e68(0x269)]>0x0){const _0x525140=_0x2065c5['map'](_0x426c82=>_0x426c82[_0x1b4e68(0x291)])['join'](';\x20');reportMorphError({'error_message':_0x525140,'error_type':_0x1b4e68(0x267),'context':{'tool':_0x1b4e68(0x27e),'repo_path':_0x474cec['data'][_0x1b4e68(0x1c9)],'query':_0x474cec[_0x1b4e68(0x231)]['search_string'],'model':_0x1b4e68(0x233),'termination_reason':_0x1b4e68(0x298),'error_count':_0x2065c5[_0x1b4e68(0x269)],'is_timeout':![],'timings':_0x30d1c1['timings'],'files_attempted':_0x2fb14c['map'](_0x191457=>({'path':_0x191457[_0x1b4e68(0x2ad)],'lines':_0x191457[_0x1b4e68(0x2a2)]})),'tool_calls':_0x3db202(_0x30d1c1[_0x1b4e68(0x1ca)]),'messages':_0x30d1c1[_0x1b4e68(0x1ca)]?.[_0x1b4e68(0x1d2)](_0x27652c=>({'role':_0x27652c[_0x1b4e68(0x1b2)],'content':_0x27652c['content']})),'request_content':{'query':_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'repo_path':_0x474cec['data'][_0x1b4e68(0x1c9)],'repoRoot':a0_0x59b14c[_0x1b4e68(0x272)](_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x1c9)]),'model':_0x1b4e68(0x233)}},'source':'mcp-filesystem'})[_0x1b4e68(0x217)](()=>{});}}else{if(_0x30d1c1['terminationReason']===_0x1b4e68(0x1a5)&&_0x30d1c1['errors'][_0x1b4e68(0x269)]>0x0){const _0x3e8ed9=_0x30d1c1['errors'][_0x1b4e68(0x1d2)](_0x167ae3=>_0x167ae3[_0x1b4e68(0x291)])[_0x1b4e68(0x250)](';\x20');_0x4eb1ee=_0x1b4e68(0x286)+_0x3e8ed9;const _0x256fd4=_0x3e8ed9[_0x1b4e68(0x225)]()[_0x1b4e68(0x235)]('timeout')||_0x3e8ed9['toLowerCase']()[_0x1b4e68(0x235)]('timed\x20out')||_0x3e8ed9[_0x1b4e68(0x225)]()[_0x1b4e68(0x235)](_0x1b4e68(0x1e9)),_0x56b2e7=_0x30d1c1['finish']?.[_0x1b4e68(0x26e)]?.[_0x1b4e68(0x1fe)],_0xe3ba2c=_0x30d1c1[_0x1b4e68(0x206)][0x0];reportMorphError({'error_message':_0x3e8ed9,'error_type':_0x256fd4?_0x1b4e68(0x1c1):_0xe3ba2c?.[_0x1b4e68(0x234)]?.[_0x1b4e68(0x24e)]||_0x1b4e68(0x27c),'context':{'tool':_0x1b4e68(0x27e),'repo_path':_0x474cec[_0x1b4e68(0x231)]['repo_path'],'query':_0x474cec['data'][_0x1b4e68(0x273)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x30d1c1[_0x1b4e68(0x18f)],'error_count':_0x30d1c1[_0x1b4e68(0x206)][_0x1b4e68(0x269)],'is_timeout':_0x256fd4,'timings':_0x30d1c1[_0x1b4e68(0x266)],'files_attempted':_0x56b2e7?.['map'](_0x155f2a=>({'path':_0x155f2a[_0x1b4e68(0x2ad)],'lines':_0x155f2a['lines']})),'tool_calls':_0x3db202(_0x30d1c1[_0x1b4e68(0x1ca)]),'messages':_0x30d1c1[_0x1b4e68(0x1ca)]?.['map'](_0x2634da=>({'role':_0x2634da[_0x1b4e68(0x1b2)],'content':_0x2634da[_0x1b4e68(0x2a6)]})),'request_content':{'query':_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'repo_path':_0x474cec['data'][_0x1b4e68(0x1c9)],'repoRoot':a0_0x59b14c[_0x1b4e68(0x272)](_0x474cec['data'][_0x1b4e68(0x1c9)]),'model':_0x1b4e68(0x233)}},'stack_trace':_0xe3ba2c?.[_0x1b4e68(0x28c)]||undefined,'source':_0x1b4e68(0x2a4)})[_0x1b4e68(0x217)](()=>{});}else _0x4eb1ee=_0x1b4e68(0x1fb);}return{'content':[{'type':'text','text':_0x4eb1ee}]};}catch(_0x2acdef){const _0x2c9b5e=_0x2acdef instanceof Error?_0x2acdef[_0x1b4e68(0x291)]:String(_0x2acdef),_0xea0919=_0x2c9b5e[_0x1b4e68(0x225)]()[_0x1b4e68(0x235)](_0x1b4e68(0x1f2))||_0x2c9b5e[_0x1b4e68(0x225)]()[_0x1b4e68(0x235)](_0x1b4e68(0x28b))||_0x2c9b5e[_0x1b4e68(0x225)]()[_0x1b4e68(0x235)](_0x1b4e68(0x1e9))||_0x2acdef instanceof Error&&_0x2acdef[_0x1b4e68(0x24e)]==='TimeoutError';return reportMorphError({'error_message':_0x2c9b5e,'error_type':_0xea0919?'TimeoutError':_0x2acdef instanceof Error?_0x2acdef[_0x1b4e68(0x234)]['name']:'UnknownError','context':{'tool':'warpgrep_codebase_search','repo_path':_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x1c9)],'query':_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'model':_0x1b4e68(0x233),'is_timeout':_0xea0919,'exception_phase':_0x1b4e68(0x1cb),'request_content':{'query':_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'repo_path':_0x474cec[_0x1b4e68(0x231)]['repo_path'],'repoRoot':a0_0x59b14c[_0x1b4e68(0x272)](_0x474cec[_0x1b4e68(0x231)][_0x1b4e68(0x1c9)]),'model':_0x1b4e68(0x233)}},'stack_trace':_0x2acdef instanceof Error?_0x2acdef[_0x1b4e68(0x28c)]:undefined,'source':_0x1b4e68(0x2a4)})[_0x1b4e68(0x217)](()=>{}),{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x211)+_0x2c9b5e}],'isError':![]};}}case _0x1b4e68(0x2a3):{const _0x56b48a=WarpGrepGitHubArgsSchema['safeParse'](_0x55427b);if(!_0x56b48a[_0x1b4e68(0x23d)])return{'content':[{'type':_0x1b4e68(0x28a),'text':'Invalid\x20arguments:\x20'+_0x56b48a['error']}],'isError':!![]};const _0x1b5408=_0x56b48a[_0x1b4e68(0x231)]['github_url']||_0x56b48a[_0x1b4e68(0x231)][_0x1b4e68(0x29d)];if(!_0x1b5408)return{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x1e8)}],'isError':!![]};const _0x4590f4=MORPH_API_KEY;if(!_0x4590f4)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x3d5b3e=Date[_0x1b4e68(0x1a1)]();console[_0x1b4e68(0x28e)](_0x1b4e68(0x254)+_0x1b5408+_0x1b4e68(0x230)+_0x56b48a[_0x1b4e68(0x231)]['search_string']+'\x22');try{const _0x3512aa=new WarpGrepClient({'morphApiKey':_0x4590f4,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x367e21=await _0x3512aa[_0x1b4e68(0x1d6)]({'query':_0x56b48a[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'github':_0x1b5408,'branch':_0x56b48a[_0x1b4e68(0x231)][_0x1b4e68(0x1bf)]}),_0x3fd533=Date[_0x1b4e68(0x1a1)]()-_0x3d5b3e;console[_0x1b4e68(0x28e)](_0x1b4e68(0x1cd)+_0x3fd533+'ms.\x20Success:\x20'+_0x367e21[_0x1b4e68(0x23d)]);const _0x437802=formatResult(_0x367e21);return{'content':[{'type':_0x1b4e68(0x28a),'text':_0x437802}]};}catch(_0x15caee){const _0x14c047=Date[_0x1b4e68(0x1a1)]()-_0x3d5b3e,_0xac5a0=_0x15caee instanceof Error?_0x15caee[_0x1b4e68(0x291)]:String(_0x15caee);return console[_0x1b4e68(0x28e)](_0x1b4e68(0x196)+_0x14c047+_0x1b4e68(0x199),_0xac5a0),reportMorphError({'error_message':_0xac5a0,'error_type':_0x15caee instanceof Error?_0x15caee[_0x1b4e68(0x234)][_0x1b4e68(0x24e)]:_0x1b4e68(0x275),'context':{'tool':'warpgrep_github_search','github_url':_0x1b5408,'search_string':_0x56b48a[_0x1b4e68(0x231)][_0x1b4e68(0x273)],'branch':_0x56b48a[_0x1b4e68(0x231)]['branch']},'stack_trace':_0x15caee instanceof Error?_0x15caee[_0x1b4e68(0x28c)]:undefined,'source':_0x1b4e68(0x2a4),'tool':_0x1b4e68(0x2a3),'latency_ms':_0x14c047})[_0x1b4e68(0x217)](()=>{}),{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x29b)+_0xac5a0}],'isError':![]};}}case _0x1b4e68(0x24f):{const _0x54350a=CodebaseSearchArgsSchema[_0x1b4e68(0x190)](_0x55427b);if(!_0x54350a[_0x1b4e68(0x23d)])return{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x203)+_0x54350a['error']}],'isError':!![]};try{const _0x28d93d=MORPH_API_KEY;if(!_0x28d93d)throw new Error(_0x1b4e68(0x1ae));const _0xe0c9ef=_0x54350a[_0x1b4e68(0x231)][_0x1b4e68(0x194)],_0x574c46=await executeCodebaseSearch({'query':_0x54350a['data'][_0x1b4e68(0x27a)],'target_directories':_0xe0c9ef,'limit':_0x54350a['data'][_0x1b4e68(0x246)]},{'apiKey':_0x28d93d,'repoId':_0x54350a['data'][_0x1b4e68(0x1ad)],'branch':_0x54350a[_0x1b4e68(0x231)]['branch'],'commitHash':_0x54350a[_0x1b4e68(0x231)]['commitHash'],'debug':![]});if(!_0x574c46['success'])return{'content':[{'type':'text','text':_0x1b4e68(0x25f)+_0x574c46[_0x1b4e68(0x28e)]}],'isError':!![]};const _0x493adf=_0x574c46[_0x1b4e68(0x256)]['length']===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x54350a[_0x1b4e68(0x231)][_0x1b4e68(0x27a)]+'\x22':'Found\x20'+_0x574c46[_0x1b4e68(0x256)]['length']+_0x1b4e68(0x29a)+_0x574c46[_0x1b4e68(0x29c)][_0x1b4e68(0x192)]+'ms:\x0a\x0a'+_0x574c46[_0x1b4e68(0x256)][_0x1b4e68(0x1d2)]((_0x1b0bbb,_0x44da56)=>_0x44da56+0x1+'.\x20'+_0x1b0bbb[_0x1b4e68(0x19e)]+'\x20('+(_0x1b0bbb[_0x1b4e68(0x25b)]*0x64)['toFixed'](0x1)+_0x1b4e68(0x24a)+(_0x1b4e68(0x1e0)+_0x1b0bbb[_0x1b4e68(0x205)]+'-'+_0x1b0bbb['endLine']+'\x0a')+(_0x1b4e68(0x23a)+_0x1b0bbb[_0x1b4e68(0x2a6)]['substring'](0x0,0xc8)+(_0x1b0bbb[_0x1b4e68(0x2a6)][_0x1b4e68(0x269)]>0xc8?_0x1b4e68(0x252):'')+'\x0a'))[_0x1b4e68(0x250)]('\x0a');return{'content':[{'type':_0x1b4e68(0x28a),'text':_0x493adf}]};}catch(_0x24de63){const _0x51c5b7=_0x24de63 instanceof Error?_0x24de63['message']:String(_0x24de63);return reportMorphError({'error_message':_0x51c5b7,'error_type':_0x24de63 instanceof Error?_0x24de63[_0x1b4e68(0x234)][_0x1b4e68(0x24e)]:'UnknownError','context':{'tool':_0x1b4e68(0x24f),'query':_0x54350a[_0x1b4e68(0x231)][_0x1b4e68(0x27a)],'repo_id':_0x54350a[_0x1b4e68(0x231)]['repoId'],'target_directories':_0x54350a[_0x1b4e68(0x231)][_0x1b4e68(0x194)]},'stack_trace':_0x24de63 instanceof Error?_0x24de63[_0x1b4e68(0x28c)]:undefined,'source':_0x1b4e68(0x2a4)})['catch'](()=>{}),{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x286)+_0x51c5b7}],'isError':!![]};}}default:throw new Error(_0x1b4e68(0x223)+_0x305adc);}}catch(_0x3c635a){const _0x5b7af0=_0x3c635a instanceof Error?_0x3c635a[_0x1b4e68(0x291)]:String(_0x3c635a);return reportMorphError({'error_message':_0x5b7af0,'error_type':_0x3c635a instanceof Error?_0x3c635a[_0x1b4e68(0x234)][_0x1b4e68(0x24e)]:'UnknownError','context':{'tool':name,'arguments':args?JSON['stringify'](args)[_0x1b4e68(0x242)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x3c635a instanceof Error?_0x3c635a[_0x1b4e68(0x28c)]:undefined,'source':_0x1b4e68(0x2a4)})[_0x1b4e68(0x217)](()=>{}),{'content':[{'type':_0x1b4e68(0x28a),'text':_0x1b4e68(0x286)+_0x5b7af0}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x445d5a){const _0x5bfc27=a0_0x1f8383,_0x3a2c29=await getValidRootDirectories(_0x445d5a);if(_0x3a2c29[_0x5bfc27(0x269)]>0x0)allowedDirectories=[..._0x3a2c29],console[_0x5bfc27(0x28e)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x3a2c29[_0x5bfc27(0x269)]+'\x20valid\x20directories');else{console[_0x5bfc27(0x28e)](_0x5bfc27(0x270));if(ENABLE_WORKSPACE_MODE)try{const _0x553d72=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x553d72&&(allowedDirectories=[_0x553d72],console[_0x5bfc27(0x28e)]('Fallback:\x20Using\x20workspace\x20root\x20'+_0x553d72));}catch(_0x537d60){console['error'](_0x5bfc27(0x25e)+_0x537d60);}}}server[a0_0x1f8383(0x1f6)](RootsListChangedNotificationSchema,async()=>{const _0x56a453=a0_0x1f8383;try{const _0x5225b3=await server['listRoots']();_0x5225b3&&_0x56a453(0x1fd)in _0x5225b3&&await updateAllowedDirectoriesFromRoots(_0x5225b3[_0x56a453(0x1fd)]);}catch(_0x307349){console[_0x56a453(0x28e)]('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x307349 instanceof Error?_0x307349[_0x56a453(0x291)]:String(_0x307349));}}),server[a0_0x1f8383(0x216)]=async()=>{const _0x5eb64d=a0_0x1f8383,_0x305734=server[_0x5eb64d(0x258)]();if(_0x305734?.[_0x5eb64d(0x1fd)])try{const _0x56eb96=await server[_0x5eb64d(0x22d)]();_0x56eb96&&_0x5eb64d(0x1fd)in _0x56eb96?await updateAllowedDirectoriesFromRoots(_0x56eb96['roots']):console[_0x5eb64d(0x28e)](_0x5eb64d(0x1df));}catch(_0x59a34b){console[_0x5eb64d(0x28e)](_0x5eb64d(0x22a),_0x59a34b instanceof Error?_0x59a34b[_0x5eb64d(0x291)]:String(_0x59a34b));}else{if(allowedDirectories[_0x5eb64d(0x269)]>0x0)console['error'](_0x5eb64d(0x249),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x5eb64d(0x28e)](_0x5eb64d(0x19c));else throw new Error(_0x5eb64d(0x239));}}};async function runServer(){const _0x4e6308=a0_0x1f8383,_0x2ac8b7=new StdioServerTransport();await server[_0x4e6308(0x1be)](_0x2ac8b7),console[_0x4e6308(0x28e)]('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x4e6308(0x269)]===0x0&&console[_0x4e6308(0x28e)](_0x4e6308(0x20c));}runServer()[a0_0x1f8383(0x217)](_0x554ce7=>{const _0x34391a=a0_0x1f8383;console[_0x34391a(0x28e)]('Fatal\x20error\x20running\x20server:',_0x554ce7),process[_0x34391a(0x1d9)](0x1);});
|
|
2
|
+
const a0_0x4ac72e=a0_0x56fe;(function(_0x50136e,_0x8a271c){const _0x461440=a0_0x56fe,_0x2c2d1d=_0x50136e();while(!![]){try{const _0x18e2a1=parseInt(_0x461440(0x2e2))/0x1+parseInt(_0x461440(0x2f1))/0x2*(-parseInt(_0x461440(0x214))/0x3)+-parseInt(_0x461440(0x2d1))/0x4*(-parseInt(_0x461440(0x23a))/0x5)+-parseInt(_0x461440(0x2df))/0x6*(-parseInt(_0x461440(0x2bc))/0x7)+parseInt(_0x461440(0x256))/0x8+-parseInt(_0x461440(0x1f3))/0x9+-parseInt(_0x461440(0x2f2))/0xa;if(_0x18e2a1===_0x8a271c)break;else _0x2c2d1d['push'](_0x2c2d1d['shift']());}catch(_0x2169a6){_0x2c2d1d['push'](_0x2c2d1d['shift']());}}}(a0_0x77c6,0xede1d));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_0x269482 from'fs/promises';import a0_0x17d018 from'path';import a0_0x2b8454 from'os';function a0_0x77c6(){const _0x2e1264=['filter','Note:\x20The\x20files\x20and\x20line\x20ranges\x20returned\x20by\x20this\x20tool\x20may\x20be\x20some\x20of\x20the\x20ones\x20needed\x20to\x20complete\x20the\x20user\x27s\x20request,\x20but\x20you\x20should\x20be\x20careful\x20in\x20evaluating\x20the\x20relevance\x20of\x20the\x20results,\x20since\x20the\x20subagent\x20might\x20make\x20mistakes.\x20','added\x20','%\x20match)\x0a','Error\x20accessing\x20directory\x20','pyproject.toml','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Search\x20failed:\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','FileNotFound','https://morphllm.com/api/error-report','Failed\x20to\x20read\x20file:\x20','Repository\x20identifier','\x20-\x20','warpgrep_codebase_search','ENOENT','@morphllm/morphmcp\x20','optional','\x20\x20\x20','assistant','search_string','.\x20Path:\x20','Specific\x20commit\x20hash\x20to\x20search','tsconfig.json','resolve','map','RipgrepNotAvailable','user','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','messages','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','github_url','\x20\x20\x20Lines\x20','sep','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Error:\x20','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','name','Benefits:\x0a','Created\x20File','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','edit_file','[could\x20not\x20read\x20file:\x20','MORPH_WARP_GREP_TIMEOUT','catch','push','\x20\x20morph-mcp','join','limit','default','\x20valid\x20directories','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','UnknownError','Applied','stats','slice','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','stack','safeParse','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Fatal\x20error\x20running\x20server:','readFile','min','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Natural\x20language\x20query\x20to\x20search\x20for\x20code','grep','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','text','.\x20Changes:\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','composer.json','searchGitHub','completed','0.2.0','search_type','code_edit','.git','\x27\x20in\x20`','\x20for:\x20\x22','code','[warpgrep_github_search]\x20Failed\x20in\x20','isDirectory','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','number','runWarpGrep_call','-\x20Grepped\x20\x27','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','etimedout','WarpGrep\x20sub-tool\x20errors:\x20','</file>','\x20is\x20not\x20a\x20directory','setNotificationHandler','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','\x0aOptions:','completionId','unknown\x20error','213521jAuBrH','warpgrep_github_search','morph-','realpath','indexOf','Workspace\x20mode\x20enabled:\x20Using\x20','string','WORKSPACE_ROOT','false','argv','setRequestHandler','codebase_search','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','success','-\x20Listed\x20directory\x20`','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Failed\x20to\x20request\x20roots\x20from\x20client:','basename','listRoots','\x20error(s)','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','1455864cyLJlL','startsWith','The\x20search\x20term\x20should\x20be\x20a\x20targeted\x20natural\x20language\x20query\x20based\x20on\x20what\x20you\x20are\x20trying\x20to\x20accomplish,\x20like\x20\x27Find\x20where\x20authentication\x20requests\x20are\x20handled\x20in\x20the\x20Express\x20routes\x27\x20or\x20\x27Modify\x20the\x20agentic\x20rollout\x20to\x20use\x20the\x20new\x20tokenizer\x20and\x20chat\x20template\x27\x20or\x20\x27Fix\x20the\x20bug\x20where\x20the\x20user\x20gets\x20redirected\x20from\x20the\x20/feed\x20page\x27.\x20','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','MORPH_API_KEY','files','getClientCapabilities','repo_path','sk-','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','split','includes','ms.\x20Success:\x20','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','246LjDhOv','Warning:\x20Workspace\x20fallback\x20failed:\x20','Bearer\x20','1876719YNiXUd','floor','timed\x20out','[warpgrep_github_search]\x20Done\x20in\x20','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','constructor','trim','\x20results\x20in\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','some','\x20as\x20allowed\x20directory','File\x20read\x20error:','content','read','808yyJKFo','30589720ePHGTx','errors','env','path','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','--help','terminationReason','has','morph-v3-fast','instruction','stringify','post','describe','finish','data','Morph\x20Edit\x20Preview','description','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','lines','role','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','-\x20Read\x20file\x20`','node_modules','owner_repo','linesAdded','timeout','Fallback:\x20Using\x20workspace\x20root\x20','terminated','params','Found\x20','dryRun','TimeoutError','requiresApiKey','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','SymlinkError','2448369EUvFmd','api-key','substring','ToolException','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','branch','WarpGrepError','searchTimeMs','warn','linesModified','oninitialized','No\x20results\x20found\x20for\x20query:\x20\x22','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','stat','now','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x0aExamples:','boolean','utf-8','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','array','timings','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','connect','SubToolError','--version','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','query','.cursor','Relevant\x20context\x20found:','7302cmTirN','Unknown\x20tool:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Enabled\x20tools:\x20','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','message','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','normalize','BinaryFile','[warpgrep_github_search]\x20Searching\x20','match','dirname','roots','Morph\x20Edit\x20','morph-warp-grep-v1-1111v0','FileReadError','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','exit','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','isArray',',\x20modified\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','go.mod','ENABLED_TOOLS','every','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','ReadError','length','unknown','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','error','enum','ms:','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','application/json','Parent\x20directory\x20does\x20not\x20exist:\x20','10wtyMaX','<file\x20path=\x22','\x22>\x0aError\x20reading\x20file:\x20','ms:\x0a\x0a','ENABLE_WORKSPACE_MODE','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','results','mcp-filesystem','\x0a</file>','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','toISOString','morph-mcp','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','access','Invalid\x20arguments:\x20','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','RipgrepError','source','Preview\x20changes\x20without\x20applying\x20them.','Warning:\x20','toLowerCase','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','toFixed','Morph\x20FastApply\x20failed\x20without\x20error\x20message','metadata','all','...','11467520lwcwpd','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Unknown\x20error','log'];a0_0x77c6=function(){return _0x2e1264;};return a0_0x77c6();}import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.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{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x135a0b from'axios';function fixPathRepetition(_0x120945){const _0x4e7940=a0_0x56fe,_0x3b6bed=_0x120945[_0x4e7940(0x2db)](a0_0x17d018[_0x4e7940(0x27c)])[_0x4e7940(0x25a)](Boolean);if(_0x3b6bed['length']<0x2)return null;for(let _0x1e216a=Math[_0x4e7940(0x2e3)](_0x3b6bed[_0x4e7940(0x230)]/0x2);_0x1e216a>=0x1;_0x1e216a--){for(let _0xea0f54=0x0;_0xea0f54<=_0x3b6bed[_0x4e7940(0x230)]-0x2*_0x1e216a;_0xea0f54++){const _0x130b73=_0x3b6bed[_0x4e7940(0x292)](_0xea0f54,_0xea0f54+_0x1e216a),_0x119ead=_0x3b6bed[_0x4e7940(0x292)](_0xea0f54+_0x1e216a,_0xea0f54+0x2*_0x1e216a);if(_0x130b73[_0x4e7940(0x22d)]((_0x2af965,_0x2639bd)=>_0x2af965===_0x119ead[_0x2639bd])){const _0x593e91=[..._0x3b6bed[_0x4e7940(0x292)](0x0,_0xea0f54),..._0x3b6bed[_0x4e7940(0x292)](_0xea0f54+_0x1e216a)];return a0_0x17d018['sep']+_0x593e91['join'](a0_0x17d018['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x457b5e=a0_0x56fe;try{const _0x27d1fa=require('../package.json');return _0x27d1fa['version']??_0x457b5e(0x231);}catch(_0x527673){return console['error'](_0x457b5e(0x1d3),_0x527673),_0x457b5e(0x231);}}function printHelp(){const _0x28ac8c=a0_0x56fe;console[_0x28ac8c(0x259)](_0x28ac8c(0x26b)+getPackageVersion()),console[_0x28ac8c(0x259)](_0x28ac8c(0x29b)),console[_0x28ac8c(0x259)](_0x28ac8c(0x2b9)),console[_0x28ac8c(0x259)](_0x28ac8c(0x225)),console[_0x28ac8c(0x259)](_0x28ac8c(0x24a)),console['log'](_0x28ac8c(0x2ea)),console[_0x28ac8c(0x259)](_0x28ac8c(0x205)),console[_0x28ac8c(0x259)](_0x28ac8c(0x289)),console[_0x28ac8c(0x259)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x4ac72e(0x2c5)][a0_0x4ac72e(0x292)](0x2),VERSION_FLAGS=new Set([a0_0x4ac72e(0x20f),'-v','-V']),HELP_FLAGS=new Set([a0_0x4ac72e(0x1d5),'-h']);cliArgs[a0_0x4ac72e(0x2ec)](_0x136126=>VERSION_FLAGS[a0_0x4ac72e(0x1d7)](_0x136126))&&(console[a0_0x4ac72e(0x259)](a0_0x4ac72e(0x26b)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x4ac72e(0x2ec)](_0x536bc4=>HELP_FLAGS['has'](_0x536bc4))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x5af946){const _0x1b5610=a0_0x4ac72e;for(let _0x58bd9f=0x0;_0x58bd9f<cliArgs['length'];_0x58bd9f++){const _0x26b9ba=cliArgs[_0x58bd9f];if(_0x26b9ba[_0x1b5610(0x2d2)]('--'+_0x5af946+'='))return _0x26b9ba[_0x1b5610(0x292)](('--'+_0x5af946+'=')[_0x1b5610(0x230)]);if(_0x26b9ba==='--'+_0x5af946&&_0x58bd9f+0x1<cliArgs['length'])return cliArgs[_0x58bd9f+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x4ac72e(0x230)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4ac72e(0x1d7)](arg)||HELP_FLAGS[a0_0x4ac72e(0x1d7)](arg))continue;if(arg[a0_0x4ac72e(0x2d2)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const ALL_TOOLS=['edit_file',a0_0x4ac72e(0x269),a0_0x4ac72e(0x2bd),a0_0x4ac72e(0x2c7)],DEFAULT_TOOLS=['edit_file',a0_0x4ac72e(0x269),a0_0x4ac72e(0x2bd)],ENABLED_TOOLS=process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x22c)]?process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x22c)]===a0_0x4ac72e(0x254)?ALL_TOOLS:process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x22c)][a0_0x4ac72e(0x2db)](',')[a0_0x4ac72e(0x274)](_0x32c9dd=>_0x32c9dd[a0_0x4ac72e(0x2e8)]()):DEFAULT_TOOLS;console['error'](a0_0x4ac72e(0x217)+ENABLED_TOOLS[a0_0x4ac72e(0x28a)](',\x20'));const WORKSPACE_ROOT=process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x2c3)]||process['env']['PWD']||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x23e)]!==a0_0x4ac72e(0x2c4),MORPH_API_KEY=getCliArg(a0_0x4ac72e(0x1f4))??process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x2d5)],MORPH_API_URL=process['env']['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x4ac72e(0x2f4)][a0_0x4ac72e(0x286)]?parseInt(process['env'][a0_0x4ac72e(0x286)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x4ac72e(0x2d2)](a0_0x4ac72e(0x2d9))&&!MORPH_API_KEY[a0_0x4ac72e(0x2d2)](a0_0x4ac72e(0x2be))&&console['error'](a0_0x4ac72e(0x1d4));async function reportMorphError(_0x26ecc5){const _0x19b599=a0_0x4ac72e;try{await a0_0x135a0b[_0x19b599(0x1db)](_0x19b599(0x265),{..._0x26ecc5,'timestamp':new Date()[_0x19b599(0x245)](),'source':_0x26ecc5[_0x19b599(0x24c)]||_0x19b599(0x242)},{'timeout':0x1388,'headers':{'Content-Type':_0x19b599(0x238),'Authorization':_0x19b599(0x2e1)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x4ac72e(0x234)](a0_0x4ac72e(0x203)),console[a0_0x4ac72e(0x234)](a0_0x4ac72e(0x2b2)),console['error'](a0_0x4ac72e(0x2cb)),console[a0_0x4ac72e(0x234)](a0_0x4ac72e(0x227)),console['error']('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console[a0_0x4ac72e(0x234)](a0_0x4ac72e(0x250)));function normalizePath(_0x12d422){const _0x10035a=a0_0x4ac72e;return a0_0x17d018[_0x10035a(0x21c)](_0x12d422);}function expandHome(_0x5c2fa1){const _0x28d848=a0_0x4ac72e;if(_0x5c2fa1[_0x28d848(0x2d2)]('~/')||_0x5c2fa1==='~')return a0_0x17d018[_0x28d848(0x28a)](a0_0x2b8454['homedir'](),_0x5c2fa1['slice'](0x1));return _0x5c2fa1;}let allowedDirectories=await Promise[a0_0x4ac72e(0x254)](args['map'](async _0x3699e9=>{const _0x27ac03=a0_0x4ac72e,_0x4581b6=expandHome(_0x3699e9),_0x584808=a0_0x17d018[_0x27ac03(0x273)](_0x4581b6);try{const _0x131dc2=await a0_0x269482[_0x27ac03(0x2bf)](_0x584808);return normalizePath(_0x131dc2);}catch(_0x5dd7d8){return normalizePath(_0x584808);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4ac72e(0x230)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4ac72e(0x288)](workspaceDir),console[a0_0x4ac72e(0x234)](a0_0x4ac72e(0x2c1)+workspaceDir+a0_0x4ac72e(0x2ed)));}catch(a0_0x506c85){console['error'](a0_0x4ac72e(0x293)+a0_0x506c85);}async function detectWorkspaceRoot(_0x5e7dd8){const _0x28bbc3=a0_0x4ac72e;let _0x3b64ab=a0_0x17d018[_0x28bbc3(0x273)](_0x5e7dd8);const _0x58b864=[_0x28bbc3(0x2a8),'.vscode','package.json','Cargo.toml',_0x28bbc3(0x25f),_0x28bbc3(0x22b),_0x28bbc3(0x212),_0x28bbc3(0x272),_0x28bbc3(0x2a2)];while(_0x3b64ab!==a0_0x17d018['dirname'](_0x3b64ab)){for(const _0x4f0b55 of _0x58b864){const _0x420add=a0_0x17d018[_0x28bbc3(0x28a)](_0x3b64ab,_0x4f0b55);try{return await a0_0x269482[_0x28bbc3(0x248)](_0x420add),normalizePath(_0x3b64ab);}catch{}}_0x3b64ab=a0_0x17d018[_0x28bbc3(0x220)](_0x3b64ab);}return normalizePath(_0x5e7dd8);}await Promise[a0_0x4ac72e(0x254)](args[a0_0x4ac72e(0x274)](async _0x5cee3d=>{const _0x59ff77=a0_0x4ac72e;try{const _0x383de5=await a0_0x269482[_0x59ff77(0x201)](expandHome(_0x5cee3d));!_0x383de5[_0x59ff77(0x2ad)]()&&(console[_0x59ff77(0x234)](_0x59ff77(0x27e)+_0x5cee3d+_0x59ff77(0x2b6)),process['exit'](0x1));}catch(_0x539dbb){console['error'](_0x59ff77(0x25e)+_0x5cee3d+':',_0x539dbb),process[_0x59ff77(0x226)](0x1);}}));async function validatePath(_0x157617){const _0x53e3a4=a0_0x4ac72e,_0x1a47f1=expandHome(_0x157617),_0x5f0313=a0_0x17d018[_0x53e3a4(0x273)](_0x1a47f1);try{const _0x4c2230=await a0_0x269482[_0x53e3a4(0x2bf)](_0x5f0313);return _0x4c2230;}catch(_0x8bab32){if(_0x8bab32['code']===_0x53e3a4(0x26a)){const _0x30757a=a0_0x17d018[_0x53e3a4(0x220)](_0x5f0313);try{const _0x388b1c=await a0_0x269482[_0x53e3a4(0x2bf)](_0x30757a);return a0_0x17d018[_0x53e3a4(0x28a)](_0x388b1c,a0_0x17d018[_0x53e3a4(0x2cd)](_0x5f0313));}catch{throw new Error(_0x53e3a4(0x239)+_0x30757a);}}throw _0x8bab32;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x4ac72e(0x2c2)](),'code_edit':z['string']()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x28e)),'instruction':z[a0_0x4ac72e(0x2c2)]()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x233)),'dryRun':z[a0_0x4ac72e(0x206)]()[a0_0x4ac72e(0x28c)](![])[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x24d))}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x4ac72e(0x2c2)]()['describe'](a0_0x4ac72e(0x21b)),'repo_path':z['string']()['describe']('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z[a0_0x4ac72e(0x235)]([a0_0x4ac72e(0x28c),a0_0x4ac72e(0x1e6)])[a0_0x4ac72e(0x26c)]()['describe'](a0_0x4ac72e(0x2ae))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()[a0_0x4ac72e(0x1dc)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'github_url':z[a0_0x4ac72e(0x2c2)]()[a0_0x4ac72e(0x26c)]()[a0_0x4ac72e(0x1dc)]('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.'),'owner_repo':z['string']()[a0_0x4ac72e(0x26c)]()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x260)),'branch':z['string']()[a0_0x4ac72e(0x26c)]()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x279))}),CodebaseSearchArgsSchema=z['object']({'query':z['string']()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x29c)),'repoId':z[a0_0x4ac72e(0x2c2)]()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x267)),'branch':z[a0_0x4ac72e(0x2c2)]()[a0_0x4ac72e(0x26c)]()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x1f8)),'commitHash':z[a0_0x4ac72e(0x2c2)]()[a0_0x4ac72e(0x26c)]()[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x271)),'targetDirectories':z[a0_0x4ac72e(0x20a)](z[a0_0x4ac72e(0x2c2)]())[a0_0x4ac72e(0x28c)]([])[a0_0x4ac72e(0x1dc)](a0_0x4ac72e(0x210)),'limit':z[a0_0x4ac72e(0x2af)]()['optional']()[a0_0x4ac72e(0x28c)](0xa)[a0_0x4ac72e(0x1dc)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x4ac72e(0x246),'version':a0_0x4ac72e(0x2a5)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x31dc57=a0_0x4ac72e,_0x4fd9a7=[{'name':_0x31dc57(0x284),'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x31dc57(0x2de)+_0x31dc57(0x22a)+_0x31dc57(0x263)+_0x31dc57(0x281)+_0x31dc57(0x247)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x31dc57(0x2d0)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+_0x31dc57(0x240)+_0x31dc57(0x2c8)+_0x31dc57(0x2e6)+'For\x20deletions:\x0a'+_0x31dc57(0x232)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+'Rules:\x0a'+_0x31dc57(0x1e1)+_0x31dc57(0x283)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+_0x31dc57(0x209)+_0x31dc57(0x237)+_0x31dc57(0x2eb)+'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','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x31dc57(0x200)+_0x31dc57(0x1e4)+_0x31dc57(0x2d3)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+_0x31dc57(0x2a1)+_0x31dc57(0x25b)+_0x31dc57(0x277)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':_0x31dc57(0x2c7),'description':_0x31dc57(0x1f1)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x31dc57(0x244)+_0x31dc57(0x281)+_0x31dc57(0x294)+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x31dc57(0x218)+_0x31dc57(0x22e)+_0x31dc57(0x29e)+_0x31dc57(0x27f)+_0x31dc57(0x208),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x415800=_0x4fd9a7[_0x31dc57(0x25a)](_0x7f5bee=>{const _0x6d31e9=_0x31dc57;if(!ENABLED_TOOLS[_0x6d31e9(0x2dc)](_0x7f5bee[_0x6d31e9(0x280)]))return![];if('requiresApiKey'in _0x7f5bee&&_0x7f5bee[_0x6d31e9(0x1f0)]&&!MORPH_API_KEY)return console[_0x6d31e9(0x234)]('Warning:\x20'+_0x7f5bee[_0x6d31e9(0x280)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x415800[_0x31dc57(0x274)](_0x527311=>({'name':_0x527311[_0x31dc57(0x280)],'description':_0x527311[_0x31dc57(0x1e0)],'inputSchema':_0x527311['inputSchema']}))};}),server[a0_0x4ac72e(0x2c6)](CallToolRequestSchema,async _0x44359d=>{const _0x33c473=a0_0x4ac72e;try{const {name:_0xa3bb73,arguments:_0x3ffd1a}=_0x44359d[_0x33c473(0x1ec)];switch(_0xa3bb73){case'edit_file':{const _0x349eca=MorphEditFileArgsSchema[_0x33c473(0x296)](_0x3ffd1a);if(!_0x349eca[_0x33c473(0x2c9)])throw new Error(_0x33c473(0x204)+_0x349eca[_0x33c473(0x234)]);const _0x141479=await validatePath(_0x349eca['data'][_0x33c473(0x1d2)]);let _0x5d131c=null,_0xc7ebb8=!![],_0x543d92=null;try{_0x5d131c=await a0_0x269482['readFile'](_0x141479,_0x33c473(0x207));}catch(_0x5546ba){const _0x45bca9=_0x5546ba[_0x33c473(0x2ab)];_0x45bca9===_0x33c473(0x26a)?(_0xc7ebb8=![],_0x5d131c=''):(_0x543d92=_0x33c473(0x266)+(_0x45bca9||_0x33c473(0x231))+_0x33c473(0x268)+(_0x5546ba instanceof Error?_0x5546ba[_0x33c473(0x21a)]:String(_0x5546ba)),console[_0x33c473(0x234)](_0x33c473(0x24e)+_0x543d92));}let _0x213ded;try{const _0x351b0f=MORPH_API_KEY;if(!_0x351b0f)throw new Error(_0x33c473(0x262));const _0xb1732f=a0_0x17d018['dirname'](_0x141479),_0x5df8b6=a0_0x17d018[_0x33c473(0x2cd)](_0x141479),_0x3c8c57=await executeEditFile({'target_filepath':_0x5df8b6,'code_edit':_0x349eca[_0x33c473(0x1de)][_0x33c473(0x2a7)],'instructions':_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1d9)]},{'morphApiKey':_0x351b0f,'morphApiUrl':MORPH_API_URL,'baseDir':_0xb1732f,'autoWrite':!_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1ee)],'generateUdiff':![],'debug':![]});_0x213ded=_0x3c8c57[_0x33c473(0x2ba)];if(!_0x3c8c57['success'])throw new Error(_0x3c8c57[_0x33c473(0x234)]||_0x33c473(0x252));const _0x32f310=_0x3c8c57['changes'],_0x3d65bb=_0x33c473(0x25c)+_0x32f310[_0x33c473(0x1e8)]+',\x20removed\x20'+_0x32f310['linesRemoved']+_0x33c473(0x229)+_0x32f310[_0x33c473(0x1fd)];if(_0x349eca[_0x33c473(0x1de)]['dryRun'])return{'content':[{'type':'text','text':_0x33c473(0x1df)+(_0xc7ebb8?'':'\x20(new\x20file)')+':\x20'+_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1d9)]+_0x33c473(0x2a0)+_0x3d65bb+'.\x20Path:\x20'+_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1d2)]+'.'}]};return{'content':[{'type':'text','text':_0x33c473(0x222)+(_0xc7ebb8?_0x33c473(0x290):_0x33c473(0x282))+':\x20'+_0x349eca[_0x33c473(0x1de)]['instruction']+_0x33c473(0x2a0)+_0x3d65bb+_0x33c473(0x270)+_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1d2)]+'.'}]};}catch(_0xc467e0){const _0x24cefa=_0xc467e0 instanceof Error?_0xc467e0['message']:String(_0xc467e0);return reportMorphError({'error_message':_0x24cefa,'error_type':_0xc467e0 instanceof Error?_0xc467e0['constructor'][_0x33c473(0x280)]:_0x33c473(0x28f),'context':{'tool':_0x33c473(0x284),'completion_id':_0x213ded,'file_path':_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1d2)],'validated_path':_0x141479,'instruction':_0x349eca['data'][_0x33c473(0x1d9)],'model':_0x33c473(0x1d8),'dry_run':_0x349eca[_0x33c473(0x1de)]['dryRun'],'file_exists':_0xc7ebb8,'file_read_error':_0x543d92,'file_readable':_0x5d131c!==null,'request_content':{'path':_0x349eca[_0x33c473(0x1de)]['path'],'code_edit':_0x349eca[_0x33c473(0x1de)][_0x33c473(0x2a7)],'instruction':_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1d9)],'original_code':_0x5d131c!==null?_0x5d131c[_0x33c473(0x230)]>0xc350?_0x5d131c[_0x33c473(0x1f5)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x5d131c['length']+'\x20chars)':_0x5d131c:_0x33c473(0x285)+(_0x543d92||_0x33c473(0x2bb))+']','original_code_length':_0x5d131c?.['length']??0x0,'model':'morph-v3-fast','dry_run':_0x349eca[_0x33c473(0x1de)][_0x33c473(0x1ee)]}},'stack_trace':_0xc467e0 instanceof Error?_0xc467e0[_0x33c473(0x295)]:undefined,'source':'mcp-filesystem'})[_0x33c473(0x287)](()=>{}),{'content':[{'type':_0x33c473(0x29f),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x24cefa}],'isError':!![]};}}case _0x33c473(0x269):{const _0x1cc8f6=WarpGrepArgsSchema[_0x33c473(0x296)](_0x3ffd1a);if(!_0x1cc8f6[_0x33c473(0x2c9)])return{'content':[{'type':_0x33c473(0x29f),'text':_0x33c473(0x249)+_0x1cc8f6[_0x33c473(0x234)]}],'isError':!![]};const _0x2741d1=_0x107c8c=>{const _0x46b719=_0x33c473,_0x4488b8=[];for(const _0xc641fc of _0x107c8c||[]){const _0x133931=_0xc641fc[_0x46b719(0x1e3)],_0x6fa72f=_0xc641fc[_0x46b719(0x2ef)];if(_0x133931===_0x46b719(0x26e)&&_0x6fa72f){const _0x23e98d=_0x6fa72f[_0x46b719(0x2db)]('\x0a')[_0x46b719(0x25a)](_0x31000c=>_0x31000c[_0x46b719(0x2e8)]());for(const _0x2912ad of _0x23e98d){const _0x4c50ed=_0x2912ad['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x4c50ed){_0x4488b8[_0x46b719(0x288)]('grep\x20\x27'+_0x4c50ed[0x1]+'\x27\x20'+_0x4c50ed[0x2]);continue;}const _0x1f5e76=_0x2912ad[_0x46b719(0x21f)](/^read\s+(.+)$/);if(_0x1f5e76){_0x4488b8[_0x46b719(0x288)]('read\x20'+_0x1f5e76[0x1]);continue;}const _0x44dd7b=_0x2912ad[_0x46b719(0x21f)](/^list_directory\s+(.+)$/);if(_0x44dd7b){_0x4488b8[_0x46b719(0x288)]('list_directory\x20'+_0x44dd7b[0x1]);continue;}}}}return _0x4488b8;},_0x2c506a=_0x54cc9f=>{const _0x18fa40=_0x33c473,_0x2c4f30=[];if(!_0x54cc9f||!Array[_0x18fa40(0x228)](_0x54cc9f))return _0x2c4f30;const _0x19a2cc=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x18fa40(0x264),'tool':_0x18fa40(0x2f0)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x18fa40(0x2f0)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x18fa40(0x2f0)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x18fa40(0x21d),'tool':_0x18fa40(0x2f0)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x18fa40(0x24b),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x18fa40(0x275),'tool':_0x18fa40(0x29d)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x18fa40(0x21d),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x18fa40(0x1f2),'tool':_0x18fa40(0x2f0)},{'pattern':/not a text file/,'error_type':_0x18fa40(0x21d),'tool':_0x18fa40(0x2f0)},{'pattern':/symbolic link/,'error_type':_0x18fa40(0x1f2),'tool':_0x18fa40(0x2f0)},{'pattern':/Error reading file:/,'error_type':_0x18fa40(0x22f),'tool':_0x18fa40(0x2f0)},{'pattern':/status="error"/,'error_type':_0x18fa40(0x1f6),'tool':_0x18fa40(0x231)}];let _0x35c6f1=0x0;for(const _0x20104a of _0x54cc9f){if(_0x20104a[_0x18fa40(0x1e3)]===_0x18fa40(0x276)){_0x35c6f1++;const _0x4b37ec=_0x20104a['content'];if(!_0x4b37ec||typeof _0x4b37ec!=='string')continue;for(const {pattern:_0x58a4d5,error_type:_0x3555c,tool:_0x26817f}of _0x19a2cc){const _0xc8b778=_0x4b37ec['match'](new RegExp(_0x58a4d5[_0x18fa40(0x24c)],'g'));if(_0xc8b778)for(const _0x5a6f6f of _0xc8b778){const _0x1641d0=_0x4b37ec[_0x18fa40(0x2c0)](_0x5a6f6f),_0x23af91=_0x4b37ec[_0x18fa40(0x1f5)](_0x1641d0,Math[_0x18fa40(0x29a)](_0x1641d0+0xc8,_0x4b37ec[_0x18fa40(0x230)]));_0x2c4f30[_0x18fa40(0x288)]({'tool':_0x26817f,'error_type':_0x3555c,'error_message':_0x23af91[_0x18fa40(0x2db)]('\x0a')[0x0],'turn':_0x35c6f1});}}}}return _0x2c4f30;};try{const _0x18a529=a0_0x17d018['resolve'](_0x1cc8f6[_0x33c473(0x1de)]['repo_path']),_0x1765b3=_0x1cc8f6['data'][_0x33c473(0x2a6)],_0x37b086=_0x1765b3===_0x33c473(0x1e6)?{'allowNames':['node_modules']}:undefined,_0x137a68=new LocalRipgrepProvider(_0x18a529,undefined,_0x37b086),_0x3e0695=await runWarpGrep({'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'repoRoot':_0x18a529,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x137a68,'search_type':_0x1765b3}),_0x32f028=_0x2c506a(_0x3e0695[_0x33c473(0x278)]);_0x32f028[_0x33c473(0x230)]>0x0&&reportMorphError({'error_message':_0x33c473(0x2b4)+_0x32f028[_0x33c473(0x230)]+_0x33c473(0x2cf),'error_type':_0x33c473(0x20e),'level':_0x33c473(0x1fc),'tool':_0x33c473(0x269),'context':{'repo_path':_0x1cc8f6[_0x33c473(0x1de)]['repo_path'],'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'model':_0x33c473(0x223),'termination_reason':_0x3e0695['terminationReason'],'sub_tool_errors':_0x32f028,'timings':_0x3e0695[_0x33c473(0x20b)],'tool_calls':_0x2741d1(_0x3e0695[_0x33c473(0x278)]),'messages':_0x3e0695[_0x33c473(0x278)]?.[_0x33c473(0x274)](_0x474700=>({'role':_0x474700['role'],'content':_0x474700[_0x33c473(0x2ef)]}))},'source':_0x33c473(0x242)})[_0x33c473(0x287)](()=>{});let _0x338fd7='';if(_0x3e0695[_0x33c473(0x1d6)]===_0x33c473(0x2a4)&&_0x3e0695[_0x33c473(0x1dd)]?.[_0x33c473(0x253)]?.[_0x33c473(0x2d6)]){const _0x25d10b=_0x3e0695[_0x33c473(0x1dd)][_0x33c473(0x253)][_0x33c473(0x2d6)];if(_0x25d10b[_0x33c473(0x230)]===0x0)return _0x338fd7=_0x3e0695[_0x33c473(0x1dd)]['payload']||_0x33c473(0x23f),{'content':[{'type':_0x33c473(0x29f),'text':_0x338fd7}]};const _0x188a2e=[],_0x4f8db3=[_0x33c473(0x20c)];for(const _0x52ece2 of _0x3e0695[_0x33c473(0x278)]){const _0x5eb73a=_0x52ece2[_0x33c473(0x1e3)],_0x332a0a=_0x52ece2[_0x33c473(0x2ef)];if(_0x5eb73a===_0x33c473(0x26e)&&_0x332a0a){const _0x3ba5b7=_0x332a0a[_0x33c473(0x2db)]('\x0a')['filter'](_0x44caa7=>_0x44caa7[_0x33c473(0x2e8)]());for(const _0x38cbdf of _0x3ba5b7){const _0x360baa=_0x38cbdf[_0x33c473(0x21f)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x360baa){_0x4f8db3[_0x33c473(0x288)](_0x33c473(0x2b1)+_0x360baa[0x1]+_0x33c473(0x2a9)+_0x360baa[0x2]+'`');continue;}const _0x2864ee=_0x38cbdf[_0x33c473(0x21f)](/^read\s+(.+)$/);if(_0x2864ee){_0x4f8db3[_0x33c473(0x288)](_0x33c473(0x1e5)+_0x2864ee[0x1]+'`');continue;}const _0xb8dd02=_0x38cbdf[_0x33c473(0x21f)](/^list_directory\s+(.+)$/);if(_0xb8dd02){_0x4f8db3[_0x33c473(0x288)](_0x33c473(0x2ca)+_0xb8dd02[0x1]+'`');continue;}}}}_0x188a2e[_0x33c473(0x288)](_0x4f8db3[_0x33c473(0x28a)]('\x0a'));const _0xaccf19=['',_0x33c473(0x213)];for(const _0xc6808b of _0x25d10b){if(_0xc6808b['lines']==='*')_0xaccf19['push']('-\x20'+_0xc6808b[_0x33c473(0x1d2)]+':*');else{if(Array[_0x33c473(0x228)](_0xc6808b[_0x33c473(0x1e2)])){const _0x3a8bc0=_0xc6808b[_0x33c473(0x1e2)][_0x33c473(0x274)](([_0x5783aa,_0x5f4fde])=>{if(_0x5783aa===_0x5f4fde)return''+_0x5783aa;return _0x5783aa+'-'+_0x5f4fde;});_0xaccf19['push']('-\x20'+_0xc6808b['path']+':'+_0x3a8bc0[_0x33c473(0x28a)](','));}else _0xaccf19[_0x33c473(0x288)]('-\x20'+_0xc6808b[_0x33c473(0x1d2)]+':*');}}_0xaccf19[_0x33c473(0x288)](''),_0x188a2e[_0x33c473(0x288)](_0xaccf19[_0x33c473(0x28a)]('\x0a')),_0x188a2e[_0x33c473(0x288)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x59d634=[];for(const _0x186f74 of _0x25d10b){let _0x14320a=a0_0x17d018[_0x33c473(0x273)](_0x1cc8f6[_0x33c473(0x1de)]['repo_path'],_0x186f74['path']),_0x4dee22=null,_0xdf8456=null;try{_0x4dee22=await a0_0x269482[_0x33c473(0x299)](_0x14320a,{'encoding':_0x33c473(0x207)});}catch(_0x271bdf){const _0x3b8add=fixPathRepetition(_0x14320a);if(_0x3b8add)try{_0x4dee22=await a0_0x269482['readFile'](_0x3b8add,{'encoding':_0x33c473(0x207)}),_0x14320a=_0x3b8add;}catch{_0xdf8456=_0x271bdf instanceof Error?_0x271bdf:new Error(String(_0x271bdf));}else _0xdf8456=_0x271bdf instanceof Error?_0x271bdf:new Error(String(_0x271bdf));}if(_0x4dee22!==null){const _0x63ef95=_0x4dee22['split'](/\r?\n/),_0x32ee69=['<file\x20path=\x22'+_0x186f74[_0x33c473(0x1d2)]+'\x22>'];if(_0x186f74[_0x33c473(0x1e2)]==='*'||!Array[_0x33c473(0x228)](_0x186f74[_0x33c473(0x1e2)]))for(let _0x3d4f3a=0x1;_0x3d4f3a<=_0x63ef95['length'];_0x3d4f3a++){const _0x16cc61=_0x63ef95[_0x3d4f3a-0x1];_0x32ee69[_0x33c473(0x288)](_0x3d4f3a+'|\x20'+_0x16cc61);}else for(const [_0xe7506e,_0x400b7c]of _0x186f74[_0x33c473(0x1e2)]){_0x32ee69[_0x33c473(0x230)]>0x1&&_0x32ee69['push']('');for(let _0x3898c6=_0xe7506e;_0x3898c6<=_0x400b7c&&_0x3898c6<=_0x63ef95[_0x33c473(0x230)];_0x3898c6++){const _0x299dc9=_0x63ef95[_0x3898c6-0x1];_0x32ee69['push'](_0x3898c6+'|\x20'+_0x299dc9);}}_0x32ee69[_0x33c473(0x288)](_0x33c473(0x2b5)),_0x59d634[_0x33c473(0x288)](_0x32ee69[_0x33c473(0x28a)]('\x0a'));}else _0x59d634['push'](_0x33c473(0x23b)+_0x186f74[_0x33c473(0x1d2)]+_0x33c473(0x23c)+(_0xdf8456?.[_0x33c473(0x21a)]||_0x33c473(0x258))+_0x33c473(0x243));}_0x188a2e[_0x33c473(0x288)](_0x59d634[_0x33c473(0x28a)]('\x0a\x0a')),_0x338fd7=_0x188a2e[_0x33c473(0x28a)]('\x0a');const _0x34db4b=_0x3e0695['errors']?.[_0x33c473(0x25a)](_0x476d8b=>_0x476d8b[_0x33c473(0x21a)]?.[_0x33c473(0x2d2)](_0x33c473(0x2ee)))||[];if(_0x34db4b[_0x33c473(0x230)]>0x0){const _0x178ff2=_0x34db4b[_0x33c473(0x274)](_0x74646f=>_0x74646f['message'])[_0x33c473(0x28a)](';\x20');reportMorphError({'error_message':_0x178ff2,'error_type':_0x33c473(0x224),'context':{'tool':_0x33c473(0x269),'repo_path':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x2d8)],'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'model':_0x33c473(0x223),'termination_reason':'completed_with_file_errors','error_count':_0x34db4b[_0x33c473(0x230)],'is_timeout':![],'timings':_0x3e0695[_0x33c473(0x20b)],'files_attempted':_0x25d10b[_0x33c473(0x274)](_0x44b7ed=>({'path':_0x44b7ed[_0x33c473(0x1d2)],'lines':_0x44b7ed[_0x33c473(0x1e2)]})),'tool_calls':_0x2741d1(_0x3e0695[_0x33c473(0x278)]),'messages':_0x3e0695[_0x33c473(0x278)]?.['map'](_0x5d5986=>({'role':_0x5d5986['role'],'content':_0x5d5986[_0x33c473(0x2ef)]})),'request_content':{'query':_0x1cc8f6[_0x33c473(0x1de)]['search_string'],'repo_path':_0x1cc8f6[_0x33c473(0x1de)]['repo_path'],'repoRoot':a0_0x17d018['resolve'](_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x2d8)]),'model':_0x33c473(0x223)}},'source':_0x33c473(0x242)})['catch'](()=>{});}}else{if(_0x3e0695[_0x33c473(0x1d6)]===_0x33c473(0x1eb)&&_0x3e0695[_0x33c473(0x2f3)]['length']>0x0){const _0x5e864f=_0x3e0695[_0x33c473(0x2f3)][_0x33c473(0x274)](_0x408063=>_0x408063['message'])[_0x33c473(0x28a)](';\x20');_0x338fd7=_0x33c473(0x27e)+_0x5e864f;const _0x5e0c27=_0x5e864f[_0x33c473(0x24f)]()[_0x33c473(0x2dc)](_0x33c473(0x1e9))||_0x5e864f[_0x33c473(0x24f)]()[_0x33c473(0x2dc)](_0x33c473(0x2e4))||_0x5e864f[_0x33c473(0x24f)]()['includes'](_0x33c473(0x2b3)),_0x532771=_0x3e0695[_0x33c473(0x1dd)]?.[_0x33c473(0x253)]?.['files'],_0x9997b7=_0x3e0695[_0x33c473(0x2f3)][0x0];reportMorphError({'error_message':_0x5e864f,'error_type':_0x5e0c27?_0x33c473(0x1ef):_0x9997b7?.[_0x33c473(0x2e7)]?.[_0x33c473(0x280)]||_0x33c473(0x1fa),'context':{'tool':_0x33c473(0x269),'repo_path':_0x1cc8f6[_0x33c473(0x1de)]['repo_path'],'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'model':_0x33c473(0x223),'termination_reason':_0x3e0695['terminationReason'],'error_count':_0x3e0695[_0x33c473(0x2f3)][_0x33c473(0x230)],'is_timeout':_0x5e0c27,'timings':_0x3e0695[_0x33c473(0x20b)],'files_attempted':_0x532771?.[_0x33c473(0x274)](_0x3d63df=>({'path':_0x3d63df[_0x33c473(0x1d2)],'lines':_0x3d63df[_0x33c473(0x1e2)]})),'tool_calls':_0x2741d1(_0x3e0695[_0x33c473(0x278)]),'messages':_0x3e0695[_0x33c473(0x278)]?.[_0x33c473(0x274)](_0x68a7c2=>({'role':_0x68a7c2[_0x33c473(0x1e3)],'content':_0x68a7c2[_0x33c473(0x2ef)]})),'request_content':{'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'repo_path':_0x1cc8f6[_0x33c473(0x1de)]['repo_path'],'repoRoot':a0_0x17d018['resolve'](_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x2d8)]),'model':_0x33c473(0x223)}},'stack_trace':_0x9997b7?.[_0x33c473(0x295)]||undefined,'source':_0x33c473(0x242)})[_0x33c473(0x287)](()=>{});}else _0x338fd7=_0x33c473(0x1f7);}return{'content':[{'type':_0x33c473(0x29f),'text':_0x338fd7}]};}catch(_0x428c44){const _0x13488b=_0x428c44 instanceof Error?_0x428c44[_0x33c473(0x21a)]:String(_0x428c44),_0x3a85b8=_0x13488b[_0x33c473(0x24f)]()[_0x33c473(0x2dc)](_0x33c473(0x1e9))||_0x13488b[_0x33c473(0x24f)]()[_0x33c473(0x2dc)](_0x33c473(0x2e4))||_0x13488b[_0x33c473(0x24f)]()[_0x33c473(0x2dc)](_0x33c473(0x2b3))||_0x428c44 instanceof Error&&_0x428c44['name']===_0x33c473(0x1ef);return reportMorphError({'error_message':_0x13488b,'error_type':_0x3a85b8?_0x33c473(0x1ef):_0x428c44 instanceof Error?_0x428c44[_0x33c473(0x2e7)][_0x33c473(0x280)]:_0x33c473(0x28f),'context':{'tool':_0x33c473(0x269),'repo_path':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x2d8)],'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'model':_0x33c473(0x223),'is_timeout':_0x3a85b8,'exception_phase':_0x33c473(0x2b0),'request_content':{'query':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x26f)],'repo_path':_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x2d8)],'repoRoot':a0_0x17d018['resolve'](_0x1cc8f6[_0x33c473(0x1de)][_0x33c473(0x2d8)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x428c44 instanceof Error?_0x428c44['stack']:undefined,'source':'mcp-filesystem'})[_0x33c473(0x287)](()=>{}),{'content':[{'type':'text','text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x13488b}],'isError':![]};}}case _0x33c473(0x2bd):{const _0x58e8af=WarpGrepGitHubArgsSchema[_0x33c473(0x296)](_0x3ffd1a);if(!_0x58e8af[_0x33c473(0x2c9)])return{'content':[{'type':_0x33c473(0x29f),'text':'Invalid\x20arguments:\x20'+_0x58e8af[_0x33c473(0x234)]}],'isError':!![]};const _0x212f9c=_0x58e8af[_0x33c473(0x1de)][_0x33c473(0x27a)]||_0x58e8af[_0x33c473(0x1de)][_0x33c473(0x1e7)];if(!_0x212f9c)return{'content':[{'type':'text','text':_0x33c473(0x2d4)}],'isError':!![]};const _0x51291a=MORPH_API_KEY;if(!_0x51291a)throw new Error(_0x33c473(0x262));const _0x12ecc1=Date[_0x33c473(0x202)]();console['error'](_0x33c473(0x21e)+_0x212f9c+_0x33c473(0x2aa)+_0x58e8af[_0x33c473(0x1de)][_0x33c473(0x26f)]+'\x22');try{const _0x367047=new WarpGrepClient({'morphApiKey':_0x51291a,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3e7690=await _0x367047[_0x33c473(0x2a3)]({'query':_0x58e8af['data'][_0x33c473(0x26f)],'github':_0x212f9c,'branch':_0x58e8af['data'][_0x33c473(0x1f9)]}),_0x4abcb2=Date[_0x33c473(0x202)]()-_0x12ecc1;console[_0x33c473(0x234)](_0x33c473(0x2e5)+_0x4abcb2+_0x33c473(0x2dd)+_0x3e7690['success']);const _0x5e341b=formatResult(_0x3e7690);return{'content':[{'type':_0x33c473(0x29f),'text':_0x5e341b}]};}catch(_0x2da1de){const _0x24c703=Date['now']()-_0x12ecc1,_0x33a713=_0x2da1de instanceof Error?_0x2da1de[_0x33c473(0x21a)]:String(_0x2da1de);return console['error'](_0x33c473(0x2ac)+_0x24c703+_0x33c473(0x236),_0x33a713),reportMorphError({'error_message':_0x33a713,'error_type':_0x2da1de instanceof Error?_0x2da1de[_0x33c473(0x2e7)]['name']:'UnknownError','context':{'tool':'warpgrep_github_search','github_url':_0x212f9c,'search_string':_0x58e8af[_0x33c473(0x1de)][_0x33c473(0x26f)],'branch':_0x58e8af['data'][_0x33c473(0x1f9)]},'stack_trace':_0x2da1de instanceof Error?_0x2da1de[_0x33c473(0x295)]:undefined,'source':_0x33c473(0x242),'tool':'warpgrep_github_search','latency_ms':_0x24c703})[_0x33c473(0x287)](()=>{}),{'content':[{'type':_0x33c473(0x29f),'text':'GitHub\x20search\x20failed:\x20'+_0x33a713}],'isError':![]};}}case _0x33c473(0x2c7):{const _0x4af9e9=CodebaseSearchArgsSchema[_0x33c473(0x296)](_0x3ffd1a);if(!_0x4af9e9[_0x33c473(0x2c9)])return{'content':[{'type':'text','text':_0x33c473(0x249)+_0x4af9e9['error']}],'isError':!![]};try{const _0x39746e=MORPH_API_KEY;if(!_0x39746e)throw new Error(_0x33c473(0x2da));const _0x27dbd4=_0x4af9e9[_0x33c473(0x1de)]['targetDirectories'],_0x439138=await executeCodebaseSearch({'query':_0x4af9e9[_0x33c473(0x1de)][_0x33c473(0x211)],'target_directories':_0x27dbd4,'limit':_0x4af9e9[_0x33c473(0x1de)][_0x33c473(0x28b)]},{'apiKey':_0x39746e,'repoId':_0x4af9e9[_0x33c473(0x1de)]['repoId'],'branch':_0x4af9e9[_0x33c473(0x1de)][_0x33c473(0x1f9)],'commitHash':_0x4af9e9[_0x33c473(0x1de)]['commitHash'],'debug':![]});if(!_0x439138[_0x33c473(0x2c9)])return{'content':[{'type':_0x33c473(0x29f),'text':_0x33c473(0x261)+_0x439138[_0x33c473(0x234)]}],'isError':!![]};const _0x107760=_0x439138[_0x33c473(0x241)][_0x33c473(0x230)]===0x0?_0x33c473(0x1ff)+_0x4af9e9[_0x33c473(0x1de)][_0x33c473(0x211)]+'\x22':_0x33c473(0x1ed)+_0x439138[_0x33c473(0x241)]['length']+_0x33c473(0x2e9)+_0x439138[_0x33c473(0x291)][_0x33c473(0x1fb)]+_0x33c473(0x23d)+_0x439138[_0x33c473(0x241)][_0x33c473(0x274)]((_0x26e058,_0x16f992)=>_0x16f992+0x1+'.\x20'+_0x26e058['filepath']+'\x20('+(_0x26e058['rerankScore']*0x64)[_0x33c473(0x251)](0x1)+_0x33c473(0x25d)+(_0x33c473(0x27b)+_0x26e058['startLine']+'-'+_0x26e058['endLine']+'\x0a')+(_0x33c473(0x26d)+_0x26e058[_0x33c473(0x2ef)][_0x33c473(0x1f5)](0x0,0xc8)+(_0x26e058[_0x33c473(0x2ef)][_0x33c473(0x230)]>0xc8?_0x33c473(0x255):'')+'\x0a'))[_0x33c473(0x28a)]('\x0a');return{'content':[{'type':_0x33c473(0x29f),'text':_0x107760}]};}catch(_0x2fa775){const _0x5d4642=_0x2fa775 instanceof Error?_0x2fa775['message']:String(_0x2fa775);return reportMorphError({'error_message':_0x5d4642,'error_type':_0x2fa775 instanceof Error?_0x2fa775['constructor'][_0x33c473(0x280)]:_0x33c473(0x28f),'context':{'tool':'codebase_search','query':_0x4af9e9['data'][_0x33c473(0x211)],'repo_id':_0x4af9e9[_0x33c473(0x1de)]['repoId'],'target_directories':_0x4af9e9[_0x33c473(0x1de)]['targetDirectories']},'stack_trace':_0x2fa775 instanceof Error?_0x2fa775['stack']:undefined,'source':_0x33c473(0x242)})[_0x33c473(0x287)](()=>{}),{'content':[{'type':_0x33c473(0x29f),'text':_0x33c473(0x27e)+_0x5d4642}],'isError':!![]};}}default:throw new Error(_0x33c473(0x215)+_0xa3bb73);}}catch(_0x25d71f){const _0x40f6c8=_0x25d71f instanceof Error?_0x25d71f['message']:String(_0x25d71f);return reportMorphError({'error_message':_0x40f6c8,'error_type':_0x25d71f instanceof Error?_0x25d71f[_0x33c473(0x2e7)][_0x33c473(0x280)]:'UnknownError','context':{'tool':name,'arguments':args?JSON[_0x33c473(0x1da)](args)[_0x33c473(0x1f5)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x25d71f instanceof Error?_0x25d71f[_0x33c473(0x295)]:undefined,'source':'mcp-filesystem'})[_0x33c473(0x287)](()=>{}),{'content':[{'type':_0x33c473(0x29f),'text':_0x33c473(0x27e)+_0x40f6c8}],'isError':!![]};}});function a0_0x56fe(_0x5f5dc4,_0x458b18){_0x5f5dc4=_0x5f5dc4-0x1d2;const _0x77c66=a0_0x77c6();let _0x56fe22=_0x77c66[_0x5f5dc4];return _0x56fe22;}async function updateAllowedDirectoriesFromRoots(_0x4171e8){const _0x4c75ab=a0_0x4ac72e,_0x34d5aa=await getValidRootDirectories(_0x4171e8);if(_0x34d5aa[_0x4c75ab(0x230)]>0x0)allowedDirectories=[..._0x34d5aa],console['error'](_0x4c75ab(0x297)+_0x34d5aa['length']+_0x4c75ab(0x28d));else{console[_0x4c75ab(0x234)](_0x4c75ab(0x27d));if(ENABLE_WORKSPACE_MODE)try{const _0x44a2b5=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x44a2b5&&(allowedDirectories=[_0x44a2b5],console[_0x4c75ab(0x234)](_0x4c75ab(0x1ea)+_0x44a2b5));}catch(_0x4d9c0d){console[_0x4c75ab(0x234)](_0x4c75ab(0x2e0)+_0x4d9c0d);}}}server[a0_0x4ac72e(0x2b7)](RootsListChangedNotificationSchema,async()=>{const _0x50d0c9=a0_0x4ac72e;try{const _0x3e45cb=await server[_0x50d0c9(0x2ce)]();_0x3e45cb&&_0x50d0c9(0x221)in _0x3e45cb&&await updateAllowedDirectoriesFromRoots(_0x3e45cb[_0x50d0c9(0x221)]);}catch(_0x56ba1b){console[_0x50d0c9(0x234)](_0x50d0c9(0x2cc),_0x56ba1b instanceof Error?_0x56ba1b[_0x50d0c9(0x21a)]:String(_0x56ba1b));}}),server[a0_0x4ac72e(0x1fe)]=async()=>{const _0x324672=a0_0x4ac72e,_0x4c0b78=server[_0x324672(0x2d7)]();if(_0x4c0b78?.['roots'])try{const _0x2b9abf=await server[_0x324672(0x2ce)]();_0x2b9abf&&_0x324672(0x221)in _0x2b9abf?await updateAllowedDirectoriesFromRoots(_0x2b9abf[_0x324672(0x221)]):console[_0x324672(0x234)](_0x324672(0x2b8));}catch(_0x38fc53){console['error'](_0x324672(0x257),_0x38fc53 instanceof Error?_0x38fc53['message']:String(_0x38fc53));}else{if(allowedDirectories[_0x324672(0x230)]>0x0)console[_0x324672(0x234)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x324672(0x234)](_0x324672(0x216));else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};async function runServer(){const _0xdf596a=a0_0x4ac72e,_0x46c1ca=new StdioServerTransport();await server[_0xdf596a(0x20d)](_0x46c1ca),console[_0xdf596a(0x234)](_0xdf596a(0x219)),allowedDirectories[_0xdf596a(0x230)]===0x0&&console[_0xdf596a(0x234)]('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x4ac72e(0x287)](_0x315b2e=>{const _0x1d0fb4=a0_0x4ac72e;console[_0x1d0fb4(0x234)](_0x1d0fb4(0x298),_0x315b2e),process[_0x1d0fb4(0x226)](0x1);});
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x31624f,_0x51baf0){const _0x2b8065=a1_0x53e8,_0x18d0a7=_0x31624f();while(!![]){try{const _0x4fc60f=-parseInt(_0x2b8065(0xa2))/0x1+parseInt(_0x2b8065(0xad))/0x2+parseInt(_0x2b8065(0xae))/0x3+parseInt(_0x2b8065(0xa6))/0x4*(parseInt(_0x2b8065(0xa8))/0x5)+-parseInt(_0x2b8065(0xb2))/0x6+parseInt(_0x2b8065(0xb3))/0x7*(parseInt(_0x2b8065(0xaf))/0x8)+parseInt(_0x2b8065(0xaa))/0x9*(-parseInt(_0x2b8065(0xa4))/0xa);if(_0x4fc60f===_0x51baf0)break;else _0x18d0a7['push'](_0x18d0a7['shift']());}catch(_0x1d8ab3){_0x18d0a7['push'](_0x18d0a7['shift']());}}}(a1_0x7d94,0xd7cbe));function a1_0x53e8(_0x1ee4ad,_0x1ddab7){_0x1ee4ad=_0x1ee4ad-0x9f;const _0x7d94a6=a1_0x7d94();let _0x53e8e2=_0x7d94a6[_0x1ee4ad];return _0x53e8e2;}import a1_0x5e4552 from'path';import a1_0x1290de from'os';function a1_0x7d94(){const _0x44c8ef=['4535765WvLPoA','slice','391554fGmwek','match','trim','104496ioUKOr','3194400EoGMxr','712rTEkFk','join','normalize','2059332QESYjE','9303anDYjZ','toUpperCase','substring','replace','test','homedir','610816dhKEuh','charAt','70iRPKmy','/mnt/','4efEgzD','startsWith'];a1_0x7d94=function(){return _0x44c8ef;};return a1_0x7d94();}export function convertToWindowsPath(_0x118854){const _0x564ee3=a1_0x53e8;if(_0x118854[_0x564ee3(0xa7)](_0x564ee3(0xa5))){const _0x3f992f=_0x118854[_0x564ee3(0xa3)](0x5)['toUpperCase'](),_0x317b05=_0x118854[_0x564ee3(0xa9)](0x6)[_0x564ee3(0x9f)](/\//g,'\x5c');return _0x3f992f+':'+_0x317b05;}if(_0x118854['match'](/^\/[a-zA-Z]\//)){const _0x306681=_0x118854[_0x564ee3(0xa3)](0x1)[_0x564ee3(0xb4)](),_0x57f162=_0x118854[_0x564ee3(0xa9)](0x2)[_0x564ee3(0x9f)](/\//g,'\x5c');return _0x306681+':'+_0x57f162;}if(_0x118854['match'](/^[a-zA-Z]:/))return _0x118854[_0x564ee3(0x9f)](/\//g,'\x5c');return _0x118854;}export function normalizePath(_0x388dbb){const _0x44c1a8=a1_0x53e8;_0x388dbb=_0x388dbb[_0x44c1a8(0xac)]()['replace'](/^["']|["']$/g,'');const _0x1139ac=_0x388dbb[_0x44c1a8(0xa7)]('/')&&!_0x388dbb[_0x44c1a8(0xab)](/^\/mnt\/[a-z]\//i)&&!_0x388dbb[_0x44c1a8(0xab)](/^\/[a-zA-Z]\//);if(_0x1139ac)return _0x388dbb['replace'](/\/+/g,'/')[_0x44c1a8(0x9f)](/\/+$/,'');_0x388dbb=convertToWindowsPath(_0x388dbb);if(_0x388dbb[_0x44c1a8(0xa7)]('\x5c\x5c')){let _0x4c80d7=_0x388dbb;_0x4c80d7=_0x4c80d7[_0x44c1a8(0x9f)](/^\\{2,}/,'\x5c\x5c');const _0x2ed849=_0x4c80d7[_0x44c1a8(0xb5)](0x2)[_0x44c1a8(0x9f)](/\\\\/g,'\x5c');_0x388dbb='\x5c\x5c'+_0x2ed849;}else _0x388dbb=_0x388dbb[_0x44c1a8(0x9f)](/\\\\/g,'\x5c');let _0x45fd43=a1_0x5e4552[_0x44c1a8(0xb1)](_0x388dbb);_0x388dbb[_0x44c1a8(0xa7)]('\x5c\x5c')&&!_0x45fd43[_0x44c1a8(0xa7)]('\x5c\x5c')&&(_0x45fd43='\x5c'+_0x45fd43);if(_0x45fd43[_0x44c1a8(0xab)](/^[a-zA-Z]:/)){let _0x58c956=_0x45fd43[_0x44c1a8(0x9f)](/\//g,'\x5c');return/^[a-z]:/[_0x44c1a8(0xa0)](_0x58c956)&&(_0x58c956=_0x58c956['charAt'](0x0)[_0x44c1a8(0xb4)]()+_0x58c956['slice'](0x1)),_0x58c956;}return _0x45fd43['replace'](/\//g,'\x5c');}export function expandHome(_0x35df53){const _0x3fa7a8=a1_0x53e8;if(_0x35df53[_0x3fa7a8(0xa7)]('~/')||_0x35df53==='~')return a1_0x5e4552[_0x3fa7a8(0xb0)](a1_0x1290de[_0x3fa7a8(0xa1)](),_0x35df53[_0x3fa7a8(0xa9)](0x1));return _0x35df53;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a2_0x2f21(_0x1062ec,_0x4027ea){_0x1062ec=_0x1062ec-0x9b;const _0x415bf9=a2_0x415b();let _0x2f21ce=_0x415bf9[_0x1062ec];return _0x2f21ce;}function a2_0x415b(){const _0x45c8e3=['includes','sep','9ickqYx','44GHHTLW','isArray','21hPMjUe','464560BsDZkm','41964JzhPgL','136526rdjWCX','637624MuJucE','length','129133LAoiKz','resolve','3312309bePQNW','normalize','startsWith','10ffnxNL','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute','string','386598lzfoMD'];a2_0x415b=function(){return _0x45c8e3;};return a2_0x415b();}(function(_0x50e80d,_0x51621b){const _0x2150f1=a2_0x2f21,_0x2617f5=_0x50e80d();while(!![]){try{const _0x1b89f5=-parseInt(_0x2150f1(0xab))/0x1+-parseInt(_0x2150f1(0xa8))/0x2+-parseInt(_0x2150f1(0xa7))/0x3*(parseInt(_0x2150f1(0xa3))/0x4)+parseInt(_0x2150f1(0xa6))/0x5+parseInt(_0x2150f1(0x9f))/0x6*(parseInt(_0x2150f1(0xa5))/0x7)+parseInt(_0x2150f1(0xa9))/0x8*(-parseInt(_0x2150f1(0xa2))/0x9)+parseInt(_0x2150f1(0x9b))/0xa*(parseInt(_0x2150f1(0xad))/0xb);if(_0x1b89f5===_0x51621b)break;else _0x2617f5['push'](_0x2617f5['shift']());}catch(_0x8df46b){_0x2617f5['push'](_0x2617f5['shift']());}}}(a2_0x415b,0x262cb));import a2_0x50d175 from'path';export function isPathWithinAllowedDirectories(_0x204ea7,_0x378ba4){const _0x3874d6=a2_0x2f21;if(typeof _0x204ea7!=='string'||!Array[_0x3874d6(0xa4)](_0x378ba4))return![];if(!_0x204ea7||_0x378ba4[_0x3874d6(0xaa)]===0x0)return![];if(_0x204ea7[_0x3874d6(0xa0)]('\x00'))return![];let _0x4d432b;try{_0x4d432b=a2_0x50d175[_0x3874d6(0xac)](a2_0x50d175[_0x3874d6(0xae)](_0x204ea7));}catch{return![];}if(!a2_0x50d175[_0x3874d6(0x9d)](_0x4d432b))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x378ba4['some'](_0x7c69ea=>{const _0x60909f=_0x3874d6;if(typeof _0x7c69ea!==_0x60909f(0x9e)||!_0x7c69ea)return![];if(_0x7c69ea[_0x60909f(0xa0)]('\x00'))return![];let _0x1b1f5d;try{_0x1b1f5d=a2_0x50d175['resolve'](a2_0x50d175['normalize'](_0x7c69ea));}catch{return![];}if(!a2_0x50d175['isAbsolute'](_0x1b1f5d))throw new Error(_0x60909f(0x9c));if(_0x4d432b===_0x1b1f5d)return!![];if(_0x1b1f5d===a2_0x50d175[_0x60909f(0xa1)])return _0x4d432b[_0x60909f(0xaf)](a2_0x50d175[_0x60909f(0xa1)]);return _0x4d432b[_0x60909f(0xaf)](_0x1b1f5d+a2_0x50d175[_0x60909f(0xa1)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5981f5,_0x2a6bfd){const _0x254d2b=a3_0x582a,_0x55c509=_0x5981f5();while(!![]){try{const _0x55c9fe=-parseInt(_0x254d2b(0x1a9))/0x1+-parseInt(_0x254d2b(0x1b5))/0x2+-parseInt(_0x254d2b(0x1aa))/0x3*(-parseInt(_0x254d2b(0x1b6))/0x4)+parseInt(_0x254d2b(0x1b8))/0x5+-parseInt(_0x254d2b(0x1b2))/0x6+-parseInt(_0x254d2b(0x1ae))/0x7+parseInt(_0x254d2b(0x1bf))/0x8;if(_0x55c9fe===_0x2a6bfd)break;else _0x55c509['push'](_0x55c509['shift']());}catch(_0x5728c4){_0x55c509['push'](_0x55c509['shift']());}}}(a3_0x1755,0x88ca2));function a3_0x582a(_0x6f2006,_0x175dbc){_0x6f2006=_0x6f2006-0x1a9;const _0x175557=a3_0x1755();let _0x582ae6=_0x175557[_0x6f2006];return _0x582ae6;}function a3_0x1755(){const _0x3f7f68=['message','4737610IOmoZY','stat','error','\x20due\x20to\x20error:\x20','realpath','file://','resolve','4984368bBkFVJ','989652CDXwea','57rZWfru','Skipping\x20','uri','isDirectory','1443498BVyPjW','startsWith','invalid\x20path\x20or\x20inaccessible','slice','4521240PFRhZD','join','Skipping\x20invalid\x20directory:\x20','304882qJVgih','229804EFTVEU'];a3_0x1755=function(){return _0x3f7f68;};return a3_0x1755();}import{promises as a3_0x455aeb}from'fs';import a3_0x5152b2 from'path';import a3_0x57fec9 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x510396){const _0x4558d0=a3_0x582a;try{const _0x4a72a9=_0x510396['startsWith'](_0x4558d0(0x1bd))?_0x510396[_0x4558d0(0x1b1)](0x7):_0x510396,_0x37fb0b=_0x4a72a9[_0x4558d0(0x1af)]('~/')||_0x4a72a9==='~'?a3_0x5152b2[_0x4558d0(0x1b3)](a3_0x57fec9['homedir'](),_0x4a72a9[_0x4558d0(0x1b1)](0x1)):_0x4a72a9,_0x4cc163=a3_0x5152b2[_0x4558d0(0x1be)](_0x37fb0b),_0x2b7641=await a3_0x455aeb[_0x4558d0(0x1bc)](_0x4cc163);return normalizePath(_0x2b7641);}catch{return null;}}function formatDirectoryError(_0x483e6f,_0x37a9eb,_0x282e38){const _0x578e0f=a3_0x582a;if(_0x282e38)return _0x578e0f(0x1ab)+_0x282e38+':\x20'+_0x483e6f;const _0x574216=_0x37a9eb instanceof Error?_0x37a9eb[_0x578e0f(0x1b7)]:String(_0x37a9eb);return _0x578e0f(0x1b4)+_0x483e6f+_0x578e0f(0x1bb)+_0x574216;}export async function getValidRootDirectories(_0x553947){const _0x32847f=a3_0x582a,_0x2eb1e0=[];for(const _0x1c9dd9 of _0x553947){const _0x247957=await parseRootUri(_0x1c9dd9[_0x32847f(0x1ac)]);if(!_0x247957){console[_0x32847f(0x1ba)](formatDirectoryError(_0x1c9dd9[_0x32847f(0x1ac)],undefined,_0x32847f(0x1b0)));continue;}try{const _0x4a8f7e=await a3_0x455aeb[_0x32847f(0x1b9)](_0x247957);_0x4a8f7e[_0x32847f(0x1ad)]()?_0x2eb1e0['push'](_0x247957):console['error'](formatDirectoryError(_0x247957,undefined,'non-directory\x20root'));}catch(_0x524e0a){console[_0x32847f(0x1ba)](formatDirectoryError(_0x247957,_0x524e0a));}}return _0x2eb1e0;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.112",
|
|
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.128",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|