@morphllm/morphmcp 0.8.106 → 0.8.108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x2ad189=a0_0x13cb;(function(_0x1a2895,_0x45b3c4){const _0x56f7d5=a0_0x13cb,_0x355f0e=_0x1a2895();while(!![]){try{const _0x587b75=-parseInt(_0x56f7d5(0x293))/0x1*(-parseInt(_0x56f7d5(0x201))/0x2)+parseInt(_0x56f7d5(0x260))/0x3+parseInt(_0x56f7d5(0x2ab))/0x4+parseInt(_0x56f7d5(0x2e5))/0x5+parseInt(_0x56f7d5(0x240))/0x6+-parseInt(_0x56f7d5(0x273))/0x7+-parseInt(_0x56f7d5(0x1fc))/0x8;if(_0x587b75===_0x45b3c4)break;else _0x355f0e['push'](_0x355f0e['shift']());}catch(_0xa2f068){_0x355f0e['push'](_0x355f0e['shift']());}}}(a0_0x29e0,0x8fd42));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_0x27c95d from'fs/promises';import a0_0x192533 from'path';import a0_0x2b9994 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_0x582a22 from'axios';function fixPathRepetition(_0x181f2f){const _0x1497ef=a0_0x13cb,_0xcdc556=_0x181f2f[_0x1497ef(0x2a6)](a0_0x192533[_0x1497ef(0x263)])[_0x1497ef(0x2f1)](Boolean);if(_0xcdc556[_0x1497ef(0x2cf)]<0x2)return null;for(let _0x3eed8e=Math[_0x1497ef(0x2de)](_0xcdc556[_0x1497ef(0x2cf)]/0x2);_0x3eed8e>=0x1;_0x3eed8e--){for(let _0x3722b3=0x0;_0x3722b3<=_0xcdc556[_0x1497ef(0x2cf)]-0x2*_0x3eed8e;_0x3722b3++){const _0x445783=_0xcdc556['slice'](_0x3722b3,_0x3722b3+_0x3eed8e),_0xed3c7b=_0xcdc556[_0x1497ef(0x26e)](_0x3722b3+_0x3eed8e,_0x3722b3+0x2*_0x3eed8e);if(_0x445783[_0x1497ef(0x304)]((_0x328bc0,_0x53f84a)=>_0x328bc0===_0xed3c7b[_0x53f84a])){const _0x24b306=[..._0xcdc556['slice'](0x0,_0x3722b3),..._0xcdc556['slice'](_0x3722b3+_0x3eed8e)];return a0_0x192533['sep']+_0x24b306[_0x1497ef(0x220)](a0_0x192533[_0x1497ef(0x263)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4d8d98=a0_0x13cb;try{const _0x5a4839=require(_0x4d8d98(0x218));return _0x5a4839[_0x4d8d98(0x268)]??_0x4d8d98(0x21d);}catch(_0x5dd389){return console[_0x4d8d98(0x1f8)](_0x4d8d98(0x27d),_0x5dd389),_0x4d8d98(0x21d);}}function printHelp(){const _0x1a2126=a0_0x13cb;console[_0x1a2126(0x2ae)](_0x1a2126(0x2bf)+getPackageVersion()),console[_0x1a2126(0x2ae)](_0x1a2126(0x288)),console[_0x1a2126(0x2ae)](_0x1a2126(0x29f)),console['log'](_0x1a2126(0x256)),console[_0x1a2126(0x2ae)](_0x1a2126(0x2f4)),console['log'](_0x1a2126(0x236)),console[_0x1a2126(0x2ae)]('\x0aExamples:'),console[_0x1a2126(0x2ae)](_0x1a2126(0x2ce)),console['log'](_0x1a2126(0x283));}const cliArgs=process[a0_0x2ad189(0x1f9)][a0_0x2ad189(0x26e)](0x2),VERSION_FLAGS=new Set([a0_0x2ad189(0x247),'-v','-V']),HELP_FLAGS=new Set([a0_0x2ad189(0x318),'-h']);cliArgs[a0_0x2ad189(0x25a)](_0x20cd6c=>VERSION_FLAGS[a0_0x2ad189(0x2d2)](_0x20cd6c))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x2ad189(0x204)](0x0));cliArgs[a0_0x2ad189(0x25a)](_0x20923e=>HELP_FLAGS[a0_0x2ad189(0x2d2)](_0x20923e))&&(printHelp(),process[a0_0x2ad189(0x204)](0x0));function getCliArg(_0x557649){const _0x1bb3ed=a0_0x2ad189;for(let _0xcc7f5c=0x0;_0xcc7f5c<cliArgs[_0x1bb3ed(0x2cf)];_0xcc7f5c++){const _0x67e365=cliArgs[_0xcc7f5c];if(_0x67e365[_0x1bb3ed(0x21b)]('--'+_0x557649+'='))return _0x67e365[_0x1bb3ed(0x26e)](('--'+_0x557649+'=')[_0x1bb3ed(0x2cf)]);if(_0x67e365==='--'+_0x557649&&_0xcc7f5c+0x1<cliArgs[_0x1bb3ed(0x2cf)])return cliArgs[_0xcc7f5c+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x2ad189(0x2cf)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x2ad189(0x2d2)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x2ad189(0x21b)](a0_0x2ad189(0x2f0)))continue;if(arg===a0_0x2ad189(0x2a1)){i++;continue;}args[a0_0x2ad189(0x2c6)](arg);}const ALL_TOOLS=[a0_0x2ad189(0x20c),a0_0x2ad189(0x21a),a0_0x2ad189(0x2ee),'codebase_search'],DEFAULT_TOOLS=['edit_file',a0_0x2ad189(0x21a),a0_0x2ad189(0x2ee)],ENABLED_TOOLS=process[a0_0x2ad189(0x2b5)][a0_0x2ad189(0x29c)]?process[a0_0x2ad189(0x2b5)][a0_0x2ad189(0x29c)]===a0_0x2ad189(0x276)?ALL_TOOLS:process[a0_0x2ad189(0x2b5)]['ENABLED_TOOLS']['split'](',')[a0_0x2ad189(0x239)](_0x552a62=>_0x552a62[a0_0x2ad189(0x2e3)]()):DEFAULT_TOOLS;console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x233)+ENABLED_TOOLS['join'](',\x20'));function a0_0x29e0(){const _0x28604b=['%\x20match)\x0a','normalize','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','../package.json','min','warpgrep_codebase_search','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','unknown','Failed\x20to\x20request\x20roots\x20from\x20client:','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','join','list_directory\x20','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','MORPH_API_URL','description','ms.\x20Success:\x20','stats','\x20\x20\x20','code_edit','Invalid\x20arguments:\x20','path','mcp-filesystem','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','WarpGrepError','match','completed_with_file_errors','readFile','source','Enabled\x20tools:\x20','constructor','\x20for:\x20\x22','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','runWarpGrep_call','TimeoutError','map','indexOf','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','isArray','completed','[warpgrep_github_search]\x20Searching\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','6833694DFQKQT','substring','describe','safeParse','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','application/json','--version','Cargo.toml','errors','RipgrepError','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Rules:\x0a','RipgrepNotAvailable','message','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Fallback:\x20Using\x20workspace\x20root\x20','homedir','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','\x0a</file>','timings','.git','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','[warpgrep_github_search]\x20Failed\x20in\x20','includes','user','some','</file>','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','content','GitHub\x20repository\x20URL\x20or\x20\x27owner/repo\x27\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27\x20or\x20\x27https://github.com/vercel/next.js\x27)','repo_path','356931QbVTNS','SymlinkError','Fatal\x20error\x20running\x20server:','sep','inputSchema','utf-8','role','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','version','etimedout','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','0.2.0','<file\x20path=\x22','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','slice','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','repoId','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','pyproject.toml','2408889QIamEF','\x20-\x20','toLowerCase','all','ReadError','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','ENOENT','Bearer\x20','searchGitHub','Created\x20File','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','\x20is\x20not\x20a\x20directory','UnknownError','requiresApiKey','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Failed\x20to\x20read\x20file:\x20','FileNotFound','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Error\x20running\x20fast\x20context\x20search:\x20','.\x20Changes:\x20','Repository\x20identifier','stat','array','timed\x20out','Parent\x20directory\x20does\x20not\x20exist:\x20','Natural\x20language\x20query\x20to\x20search\x20for\x20code','resolve','data','181411CrIJgo','toFixed','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Applied','PathError','\x20error(s)','FileReadError','warn','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','ENABLED_TOOLS','now','morph-v3-fast','\x0aOptions:','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','--api-key','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','split','listRoots','targetDirectories','dirname','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','3788640uRTXXp','\x27\x20in\x20`','ENABLE_WORKSPACE_MODE','log','unknown\x20error','assistant','catch','[warpgrep_github_search]\x20Done\x20in\x20','timeout','success','env','instruction','go.mod','.cursor','\x0a...\x20(truncated,\x20total:\x20','added\x20','SubToolError','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','.vscode','messages','@morphllm/morphmcp\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','lines','startLine','push','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a',',\x20removed\x20','read\x20','Benefits:\x0a','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','default','WORKSPACE_ROOT','\x20\x20morph-mcp','length',',\x20modified\x20','name','has','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','cwd','branch','No\x20results\x20found\x20for\x20query:\x20\x22','read','setRequestHandler','limit','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','search_string','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','floor','string','Unknown\x20error','filepath','files','trim','post','4722540BaHnlE','stack','commitHash','codebase_search','linesAdded','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','.\x20Path:\x20','setNotificationHandler','Workspace\x20mode\x20enabled:\x20Using\x20','warpgrep_github_search','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','--api-key=','filter','Error\x20accessing\x20directory\x20','morph-warp-grep-v1-1111v0','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','ms:\x0a\x0a','\x20valid\x20directories','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','linesRemoved','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Error:\x20','MORPH_WARP_GREP_TIMEOUT','terminationReason','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.','roots','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','morph-','finish','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','code','every','changes','ms:','\x20\x20\x20Lines\x20','❌\x20Morph\x20Edit\x20Failed:\x20','isDirectory','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','File\x20read\x20error:','github_url','package.json','toISOString','composer.json','false','results','Morph\x20FastApply\x20failed\x20without\x20error\x20message','[could\x20not\x20read\x20file:\x20','dryRun','BinaryFile','params','Warning:\x20','--help','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','terminated','-\x20Listed\x20directory\x20`','metadata','getClientCapabilities','basename','error','argv','query','completionId','23535912PlPrEB','For\x20deletions:\x0a','optional','tsconfig.json','sk-','8kuJkpa','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Specific\x20commit\x20hash\x20to\x20search','exit','object','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Unknown\x20tool:\x20','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','Morph\x20Edit\x20Preview','\x20chars)','edit_file','rerankScore','realpath','grep','-\x20Read\x20file\x20`','text','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','api-key','\x20(new\x20file)'];a0_0x29e0=function(){return _0x28604b;};return a0_0x29e0();}function a0_0x13cb(_0x51cdce,_0x4c6c67){_0x51cdce=_0x51cdce-0x1f3;const _0x29e049=a0_0x29e0();let _0x13cb45=_0x29e049[_0x51cdce];return _0x13cb45;}const WORKSPACE_ROOT=process[a0_0x2ad189(0x2b5)][a0_0x2ad189(0x2cd)]||process[a0_0x2ad189(0x2b5)]['PWD']||process[a0_0x2ad189(0x2d5)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x2ad189(0x2ad)]!==a0_0x2ad189(0x310),MORPH_API_KEY=getCliArg(a0_0x2ad189(0x213))??process['env']['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x2ad189(0x2b5)][a0_0x2ad189(0x223)],MORPH_WARP_GREP_TIMEOUT=process[a0_0x2ad189(0x2b5)][a0_0x2ad189(0x2fb)]?parseInt(process[a0_0x2ad189(0x2b5)][a0_0x2ad189(0x2fb)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x2ad189(0x200))&&!MORPH_API_KEY[a0_0x2ad189(0x21b)](a0_0x2ad189(0x300))&&console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x2c2));async function reportMorphError(_0x36f09a){const _0x235c0b=a0_0x2ad189;try{await a0_0x582a22[_0x235c0b(0x2e4)]('https://morphllm.com/api/error-report',{..._0x36f09a,'timestamp':new Date()[_0x235c0b(0x30e)](),'source':_0x36f09a[_0x235c0b(0x232)]||'mcp-filesystem'},{'timeout':0x1388,'headers':{'Content-Type':_0x235c0b(0x246),'Authorization':_0x235c0b(0x27a)+MORPH_API_KEY}});}catch{}}args[a0_0x2ad189(0x2cf)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x23f)),console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x222)),console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x252)),console['error'](a0_0x2ad189(0x27e)),console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x2cb)),console[a0_0x2ad189(0x1f8)]('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x525eda){const _0x1f157f=a0_0x2ad189;return a0_0x192533[_0x1f157f(0x216)](_0x525eda);}function expandHome(_0x382cae){const _0x2745d5=a0_0x2ad189;if(_0x382cae['startsWith']('~/')||_0x382cae==='~')return a0_0x192533[_0x2745d5(0x220)](a0_0x2b9994[_0x2745d5(0x251)](),_0x382cae[_0x2745d5(0x26e)](0x1));return _0x382cae;}let allowedDirectories=await Promise[a0_0x2ad189(0x276)](args['map'](async _0x16f186=>{const _0xae2ab0=expandHome(_0x16f186),_0x1d3c3c=a0_0x192533['resolve'](_0xae2ab0);try{const _0x158be6=await a0_0x27c95d['realpath'](_0x1d3c3c);return normalizePath(_0x158be6);}catch(_0x59e809){return normalizePath(_0x1d3c3c);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x2ad189(0x2cf)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x2ad189(0x2c6)](workspaceDir),console[a0_0x2ad189(0x1f8)](a0_0x2ad189(0x2ed)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x59cd85){console[a0_0x2ad189(0x1f8)]('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x59cd85);}async function detectWorkspaceRoot(_0x47e669){const _0x24ebef=a0_0x2ad189;let _0xa6a8ff=a0_0x192533[_0x24ebef(0x291)](_0x47e669);const _0x28a7fe=[_0x24ebef(0x255),_0x24ebef(0x2bd),_0x24ebef(0x30d),_0x24ebef(0x248),_0x24ebef(0x272),_0x24ebef(0x2b7),_0x24ebef(0x2b8),_0x24ebef(0x1ff),_0x24ebef(0x30f)];while(_0xa6a8ff!==a0_0x192533[_0x24ebef(0x2a9)](_0xa6a8ff)){for(const _0x46ca35 of _0x28a7fe){const _0x416578=a0_0x192533[_0x24ebef(0x220)](_0xa6a8ff,_0x46ca35);try{return await a0_0x27c95d['access'](_0x416578),normalizePath(_0xa6a8ff);}catch{}}_0xa6a8ff=a0_0x192533['dirname'](_0xa6a8ff);}return normalizePath(_0x47e669);}await Promise[a0_0x2ad189(0x276)](args[a0_0x2ad189(0x239)](async _0x199bf0=>{const _0x371dbb=a0_0x2ad189;try{const _0x30ac74=await a0_0x27c95d[_0x371dbb(0x28c)](expandHome(_0x199bf0));!_0x30ac74[_0x371dbb(0x309)]()&&(console[_0x371dbb(0x1f8)](_0x371dbb(0x2fa)+_0x199bf0+_0x371dbb(0x280)),process[_0x371dbb(0x204)](0x1));}catch(_0x80b6b6){console[_0x371dbb(0x1f8)](_0x371dbb(0x2f2)+_0x199bf0+':',_0x80b6b6),process[_0x371dbb(0x204)](0x1);}}));async function validatePath(_0x5e39e0){const _0x4fb94f=a0_0x2ad189,_0x4b7086=expandHome(_0x5e39e0),_0x505227=a0_0x192533[_0x4fb94f(0x291)](_0x4b7086);try{const _0x39c688=await a0_0x27c95d[_0x4fb94f(0x20e)](_0x505227);return _0x39c688;}catch(_0xe7bed0){if(_0xe7bed0[_0x4fb94f(0x303)]==='ENOENT'){const _0x15278a=a0_0x192533['dirname'](_0x505227);try{const _0x130cd9=await a0_0x27c95d[_0x4fb94f(0x20e)](_0x15278a);return a0_0x192533[_0x4fb94f(0x220)](_0x130cd9,a0_0x192533[_0x4fb94f(0x1f7)](_0x505227));}catch{throw new Error(_0x4fb94f(0x28f)+_0x15278a);}}throw _0xe7bed0;}}const MorphEditFileArgsSchema=z[a0_0x2ad189(0x205)]({'path':z[a0_0x2ad189(0x2df)](),'code_edit':z[a0_0x2ad189(0x2df)]()[a0_0x2ad189(0x242)](a0_0x2ad189(0x202)),'instruction':z[a0_0x2ad189(0x2df)]()['describe'](a0_0x2ad189(0x267)),'dryRun':z['boolean']()[a0_0x2ad189(0x2cc)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z[a0_0x2ad189(0x205)]({'search_string':z['string']()[a0_0x2ad189(0x242)](a0_0x2ad189(0x2f7)),'repo_path':z['string']()[a0_0x2ad189(0x242)](a0_0x2ad189(0x278))}),WarpGrepGitHubArgsSchema=z[a0_0x2ad189(0x205)]({'search_string':z['string']()[a0_0x2ad189(0x242)](a0_0x2ad189(0x2f7)),'github_url':z[a0_0x2ad189(0x2df)]()[a0_0x2ad189(0x242)](a0_0x2ad189(0x25e)),'branch':z[a0_0x2ad189(0x2df)]()[a0_0x2ad189(0x1fe)]()[a0_0x2ad189(0x242)](a0_0x2ad189(0x271))}),CodebaseSearchArgsSchema=z[a0_0x2ad189(0x205)]({'query':z[a0_0x2ad189(0x2df)]()[a0_0x2ad189(0x242)](a0_0x2ad189(0x290)),'repoId':z['string']()[a0_0x2ad189(0x242)](a0_0x2ad189(0x28b)),'branch':z['string']()['optional']()[a0_0x2ad189(0x242)](a0_0x2ad189(0x319)),'commitHash':z[a0_0x2ad189(0x2df)]()[a0_0x2ad189(0x1fe)]()['describe'](a0_0x2ad189(0x203)),'targetDirectories':z[a0_0x2ad189(0x28d)](z['string']())[a0_0x2ad189(0x2cc)]([])[a0_0x2ad189(0x242)](a0_0x2ad189(0x22c)),'limit':z['number']()[a0_0x2ad189(0x1fe)]()[a0_0x2ad189(0x2cc)](0xa)['describe']('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x2ad189(0x26b)},{'capabilities':{'tools':{}}});server[a0_0x2ad189(0x2d9)](ListToolsRequestSchema,async()=>{const _0x33e8fb=a0_0x2ad189,_0x1959dd=[{'name':'edit_file','description':_0x33e8fb(0x2c3)+_0x33e8fb(0x2c1)+_0x33e8fb(0x244)+_0x33e8fb(0x21f)+_0x33e8fb(0x2ca)+_0x33e8fb(0x26f)+_0x33e8fb(0x27f)+_0x33e8fb(0x24f)+_0x33e8fb(0x286)+_0x33e8fb(0x2a3)+_0x33e8fb(0x2a0)+_0x33e8fb(0x23b)+_0x33e8fb(0x1fd)+_0x33e8fb(0x2bc)+_0x33e8fb(0x2ea)+_0x33e8fb(0x24c)+_0x33e8fb(0x26d)+_0x33e8fb(0x2c7)+_0x33e8fb(0x2a5)+_0x33e8fb(0x24b)+_0x33e8fb(0x2ff)+_0x33e8fb(0x29b)+'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':_0x33e8fb(0x21a),'description':_0x33e8fb(0x217)+'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'+_0x33e8fb(0x21c)+_0x33e8fb(0x2a2)+_0x33e8fb(0x209)+'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'+_0x33e8fb(0x2db)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':_0x33e8fb(0x2e8),'description':'**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a'+_0x33e8fb(0x2d4)+_0x33e8fb(0x302)+_0x33e8fb(0x2ca)+'-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a'+'-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a'+_0x33e8fb(0x295)+_0x33e8fb(0x287)+_0x33e8fb(0x212)+'Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20'+_0x33e8fb(0x25c),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x32af72=_0x1959dd[_0x33e8fb(0x2f1)](_0x13f284=>{const _0x488f63=_0x33e8fb;if(!ENABLED_TOOLS['includes'](_0x13f284['name']))return![];if(_0x488f63(0x282)in _0x13f284&&_0x13f284[_0x488f63(0x282)]&&!MORPH_API_KEY)return console['error'](_0x488f63(0x317)+_0x13f284[_0x488f63(0x2d1)]+_0x488f63(0x2aa)),![];return!![];});return{'tools':_0x32af72[_0x33e8fb(0x239)](_0x1251b4=>({'name':_0x1251b4[_0x33e8fb(0x2d1)],'description':_0x1251b4[_0x33e8fb(0x224)],'inputSchema':_0x1251b4[_0x33e8fb(0x264)]}))};}),server[a0_0x2ad189(0x2d9)](CallToolRequestSchema,async _0x3ef6e7=>{const _0x513d1d=a0_0x2ad189;try{const {name:_0x1f13bf,arguments:_0x44fa3b}=_0x3ef6e7[_0x513d1d(0x316)];switch(_0x1f13bf){case _0x513d1d(0x20c):{const _0x13288b=MorphEditFileArgsSchema['safeParse'](_0x44fa3b);if(!_0x13288b[_0x513d1d(0x2b4)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x13288b[_0x513d1d(0x1f8)]);const _0x4c015d=await validatePath(_0x13288b['data'][_0x513d1d(0x22a)]);let _0x5b3009=null,_0x5d4f28=!![],_0x3e8001=null;try{_0x5b3009=await a0_0x27c95d[_0x513d1d(0x231)](_0x4c015d,_0x513d1d(0x265));}catch(_0x351870){const _0x7b3535=_0x351870['code'];_0x7b3535===_0x513d1d(0x279)?(_0x5d4f28=![],_0x5b3009=''):(_0x3e8001=_0x513d1d(0x284)+(_0x7b3535||_0x513d1d(0x21d))+_0x513d1d(0x274)+(_0x351870 instanceof Error?_0x351870[_0x513d1d(0x24e)]:String(_0x351870)),console[_0x513d1d(0x1f8)](_0x513d1d(0x317)+_0x3e8001));}let _0x5547be;try{const _0x377855=MORPH_API_KEY;if(!_0x377855)throw new Error(_0x513d1d(0x206));const _0x3e4481=a0_0x192533[_0x513d1d(0x2a9)](_0x4c015d),_0x1ef66e=a0_0x192533[_0x513d1d(0x1f7)](_0x4c015d),_0x5468df=await executeEditFile({'target_filepath':_0x1ef66e,'code_edit':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x228)],'instructions':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x2b6)]},{'morphApiKey':_0x377855,'morphApiUrl':MORPH_API_URL,'baseDir':_0x3e4481,'autoWrite':!_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x314)],'generateUdiff':![],'debug':![]});_0x5547be=_0x5468df[_0x513d1d(0x1fb)];if(!_0x5468df[_0x513d1d(0x2b4)])throw new Error(_0x5468df[_0x513d1d(0x1f8)]||_0x513d1d(0x312));const _0x468954=_0x5468df[_0x513d1d(0x305)],_0xa894f4=_0x513d1d(0x2ba)+_0x468954[_0x513d1d(0x2e9)]+_0x513d1d(0x2c8)+_0x468954[_0x513d1d(0x2f8)]+_0x513d1d(0x2d0)+_0x468954['linesModified'];if(_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x314)])return{'content':[{'type':'text','text':_0x513d1d(0x20a)+(_0x5d4f28?'':_0x513d1d(0x214))+':\x20'+_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x2b6)]+_0x513d1d(0x28a)+_0xa894f4+_0x513d1d(0x2eb)+_0x13288b['data'][_0x513d1d(0x22a)]+'.'}]};return{'content':[{'type':_0x513d1d(0x211),'text':'Morph\x20Edit\x20'+(_0x5d4f28?_0x513d1d(0x296):_0x513d1d(0x27c))+':\x20'+_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x2b6)]+_0x513d1d(0x28a)+_0xa894f4+_0x513d1d(0x2eb)+_0x13288b[_0x513d1d(0x292)]['path']+'.'}]};}catch(_0x53cfa2){const _0x1a5c1e=_0x53cfa2 instanceof Error?_0x53cfa2['message']:String(_0x53cfa2);return reportMorphError({'error_message':_0x1a5c1e,'error_type':_0x53cfa2 instanceof Error?_0x53cfa2[_0x513d1d(0x234)]['name']:'UnknownError','context':{'tool':_0x513d1d(0x20c),'completion_id':_0x5547be,'file_path':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x22a)],'validated_path':_0x4c015d,'instruction':_0x13288b['data'][_0x513d1d(0x2b6)],'model':_0x513d1d(0x29e),'dry_run':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x314)],'file_exists':_0x5d4f28,'file_read_error':_0x3e8001,'file_readable':_0x5b3009!==null,'request_content':{'path':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x22a)],'code_edit':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x228)],'instruction':_0x13288b[_0x513d1d(0x292)][_0x513d1d(0x2b6)],'original_code':_0x5b3009!==null?_0x5b3009['length']>0xc350?_0x5b3009[_0x513d1d(0x241)](0x0,0xc350)+_0x513d1d(0x2b9)+_0x5b3009[_0x513d1d(0x2cf)]+_0x513d1d(0x20b):_0x5b3009:_0x513d1d(0x313)+(_0x3e8001||_0x513d1d(0x2af))+']','original_code_length':_0x5b3009?.['length']??0x0,'model':_0x513d1d(0x29e),'dry_run':_0x13288b['data'][_0x513d1d(0x314)]}},'stack_trace':_0x53cfa2 instanceof Error?_0x53cfa2[_0x513d1d(0x2e6)]:undefined,'source':_0x513d1d(0x22b)})[_0x513d1d(0x2b1)](()=>{}),{'content':[{'type':_0x513d1d(0x211),'text':_0x513d1d(0x308)+_0x1a5c1e}],'isError':!![]};}}case _0x513d1d(0x21a):{const _0x630583=WarpGrepArgsSchema[_0x513d1d(0x243)](_0x44fa3b);if(!_0x630583['success'])return{'content':[{'type':_0x513d1d(0x211),'text':'Invalid\x20arguments:\x20'+_0x630583[_0x513d1d(0x1f8)]}],'isError':!![]};const _0x463032=_0x5b5a48=>{const _0xf713c9=_0x513d1d,_0x4879b1=[];for(const _0x20ef7d of _0x5b5a48||[]){const _0x4557a0=_0x20ef7d[_0xf713c9(0x266)],_0x94683f=_0x20ef7d[_0xf713c9(0x25d)];if(_0x4557a0===_0xf713c9(0x2b0)&&_0x94683f){const _0x54a65e=_0x94683f[_0xf713c9(0x2a6)]('\x0a')[_0xf713c9(0x2f1)](_0x541e0d=>_0x541e0d[_0xf713c9(0x2e3)]());for(const _0x35f30a of _0x54a65e){const _0x501fc8=_0x35f30a['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x501fc8){_0x4879b1[_0xf713c9(0x2c6)]('grep\x20\x27'+_0x501fc8[0x1]+'\x27\x20'+_0x501fc8[0x2]);continue;}const _0xc75fd2=_0x35f30a[_0xf713c9(0x22f)](/^read\s+(.+)$/);if(_0xc75fd2){_0x4879b1[_0xf713c9(0x2c6)](_0xf713c9(0x2c9)+_0xc75fd2[0x1]);continue;}const _0x12fcdd=_0x35f30a[_0xf713c9(0x22f)](/^list_directory\s+(.+)$/);if(_0x12fcdd){_0x4879b1['push'](_0xf713c9(0x221)+_0x12fcdd[0x1]);continue;}}}}return _0x4879b1;},_0x277857=_0x42d2fd=>{const _0x1408d6=_0x513d1d,_0xd1d814=[];if(!_0x42d2fd||!Array[_0x1408d6(0x23c)](_0x42d2fd))return _0xd1d814;const _0x1b50a4=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1408d6(0x285),'tool':_0x1408d6(0x2d8)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1408d6(0x297),'tool':_0x1408d6(0x2d8)},{'pattern':/\[READ ERROR\]/,'error_type':_0x1408d6(0x277),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1408d6(0x315),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1408d6(0x24a),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1408d6(0x24d),'tool':_0x1408d6(0x20f)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1408d6(0x315),'tool':_0x1408d6(0x2d8)},{'pattern':/\[SYMLINK\]/,'error_type':_0x1408d6(0x261),'tool':_0x1408d6(0x2d8)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':'read'},{'pattern':/symbolic link/,'error_type':_0x1408d6(0x261),'tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x1408d6(0x277),'tool':_0x1408d6(0x2d8)},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x1408d6(0x21d)}];let _0x419b3c=0x0;for(const _0x4495a3 of _0x42d2fd){if(_0x4495a3[_0x1408d6(0x266)]===_0x1408d6(0x259)){_0x419b3c++;const _0x401167=_0x4495a3['content'];if(!_0x401167||typeof _0x401167!==_0x1408d6(0x2df))continue;for(const {pattern:_0x34b969,error_type:_0x311b92,tool:_0x418385}of _0x1b50a4){const _0x5f4c77=_0x401167[_0x1408d6(0x22f)](new RegExp(_0x34b969[_0x1408d6(0x232)],'g'));if(_0x5f4c77)for(const _0x159bf5 of _0x5f4c77){const _0x39bf62=_0x401167[_0x1408d6(0x23a)](_0x159bf5),_0x9fb32e=_0x401167[_0x1408d6(0x241)](_0x39bf62,Math[_0x1408d6(0x219)](_0x39bf62+0xc8,_0x401167[_0x1408d6(0x2cf)]));_0xd1d814['push']({'tool':_0x418385,'error_type':_0x311b92,'error_message':_0x9fb32e[_0x1408d6(0x2a6)]('\x0a')[0x0],'turn':_0x419b3c});}}}}return _0xd1d814;};try{const _0xf96fff=a0_0x192533[_0x513d1d(0x291)](_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)]),_0xd60a1d=new LocalRipgrepProvider(_0xf96fff),_0x4fa222=await runWarpGrep({'query':_0x630583[_0x513d1d(0x292)]['search_string'],'repoRoot':_0xf96fff,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xd60a1d}),_0x4226d3=_0x277857(_0x4fa222[_0x513d1d(0x2be)]);_0x4226d3['length']>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x4226d3[_0x513d1d(0x2cf)]+_0x513d1d(0x298),'error_type':_0x513d1d(0x2bb),'level':_0x513d1d(0x29a),'tool':'warpgrep_codebase_search','context':{'repo_path':_0x630583['data'][_0x513d1d(0x25f)],'query':_0x630583['data'][_0x513d1d(0x2dc)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x4fa222[_0x513d1d(0x2fc)],'sub_tool_errors':_0x4226d3,'timings':_0x4fa222[_0x513d1d(0x254)],'tool_calls':_0x463032(_0x4fa222[_0x513d1d(0x2be)]),'messages':_0x4fa222[_0x513d1d(0x2be)]?.[_0x513d1d(0x239)](_0x328935=>({'role':_0x328935['role'],'content':_0x328935[_0x513d1d(0x25d)]}))},'source':_0x513d1d(0x22b)})[_0x513d1d(0x2b1)](()=>{});let _0x2dc521='';if(_0x4fa222['terminationReason']===_0x513d1d(0x23d)&&_0x4fa222[_0x513d1d(0x301)]?.[_0x513d1d(0x1f5)]?.[_0x513d1d(0x2e2)]){const _0x1e917f=_0x4fa222[_0x513d1d(0x301)]['metadata']['files'];if(_0x1e917f[_0x513d1d(0x2cf)]===0x0)return _0x2dc521=_0x4fa222[_0x513d1d(0x301)]['payload']||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':'text','text':_0x2dc521}]};const _0xc76ca7=[],_0x3ee1f8=[_0x513d1d(0x2a4)];for(const _0x4c3ea6 of _0x4fa222[_0x513d1d(0x2be)]){const _0x179004=_0x4c3ea6[_0x513d1d(0x266)],_0x27ef18=_0x4c3ea6[_0x513d1d(0x25d)];if(_0x179004==='assistant'&&_0x27ef18){const _0x53d6ae=_0x27ef18['split']('\x0a')[_0x513d1d(0x2f1)](_0x2e014c=>_0x2e014c['trim']());for(const _0x4385c1 of _0x53d6ae){const _0x370351=_0x4385c1[_0x513d1d(0x22f)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x370351){_0x3ee1f8[_0x513d1d(0x2c6)]('-\x20Grepped\x20\x27'+_0x370351[0x1]+_0x513d1d(0x2ac)+_0x370351[0x2]+'`');continue;}const _0x36a632=_0x4385c1[_0x513d1d(0x22f)](/^read\s+(.+)$/);if(_0x36a632){_0x3ee1f8[_0x513d1d(0x2c6)](_0x513d1d(0x210)+_0x36a632[0x1]+'`');continue;}const _0x420ee4=_0x4385c1[_0x513d1d(0x22f)](/^list_directory\s+(.+)$/);if(_0x420ee4){_0x3ee1f8[_0x513d1d(0x2c6)](_0x513d1d(0x1f4)+_0x420ee4[0x1]+'`');continue;}}}}_0xc76ca7['push'](_0x3ee1f8[_0x513d1d(0x220)]('\x0a'));const _0x203fe8=['','Relevant\x20context\x20found:'];for(const _0x3df37a of _0x1e917f){if(_0x3df37a[_0x513d1d(0x2c4)]==='*')_0x203fe8['push']('-\x20'+_0x3df37a[_0x513d1d(0x22a)]+':*');else{if(Array[_0x513d1d(0x23c)](_0x3df37a[_0x513d1d(0x2c4)])){const _0x427f41=_0x3df37a['lines'][_0x513d1d(0x239)](([_0x3f87b5,_0x576ceb])=>{if(_0x3f87b5===_0x576ceb)return''+_0x3f87b5;return _0x3f87b5+'-'+_0x576ceb;});_0x203fe8[_0x513d1d(0x2c6)]('-\x20'+_0x3df37a[_0x513d1d(0x22a)]+':'+_0x427f41[_0x513d1d(0x220)](','));}else _0x203fe8[_0x513d1d(0x2c6)]('-\x20'+_0x3df37a[_0x513d1d(0x22a)]+':*');}}_0x203fe8[_0x513d1d(0x2c6)](''),_0xc76ca7[_0x513d1d(0x2c6)](_0x203fe8[_0x513d1d(0x220)]('\x0a')),_0xc76ca7['push'](_0x513d1d(0x2c0));const _0x56fc53=[];for(const _0x435c8f of _0x1e917f){let _0x12e4c3=a0_0x192533['resolve'](_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)],_0x435c8f[_0x513d1d(0x22a)]),_0x1185e8=null,_0x477af3=null;try{_0x1185e8=await a0_0x27c95d['readFile'](_0x12e4c3,{'encoding':_0x513d1d(0x265)});}catch(_0x7a5d96){const _0x47d6d1=fixPathRepetition(_0x12e4c3);if(_0x47d6d1)try{_0x1185e8=await a0_0x27c95d[_0x513d1d(0x231)](_0x47d6d1,{'encoding':_0x513d1d(0x265)}),_0x12e4c3=_0x47d6d1;}catch{_0x477af3=_0x7a5d96 instanceof Error?_0x7a5d96:new Error(String(_0x7a5d96));}else _0x477af3=_0x7a5d96 instanceof Error?_0x7a5d96:new Error(String(_0x7a5d96));}if(_0x1185e8!==null){const _0x4d7465=_0x1185e8[_0x513d1d(0x2a6)](/\r?\n/),_0xdb12e3=[_0x513d1d(0x26c)+_0x435c8f[_0x513d1d(0x22a)]+'\x22>'];if(_0x435c8f[_0x513d1d(0x2c4)]==='*'||!Array[_0x513d1d(0x23c)](_0x435c8f[_0x513d1d(0x2c4)]))for(let _0x3dd9aa=0x1;_0x3dd9aa<=_0x4d7465[_0x513d1d(0x2cf)];_0x3dd9aa++){const _0x4669c5=_0x4d7465[_0x3dd9aa-0x1];_0xdb12e3['push'](_0x3dd9aa+'|\x20'+_0x4669c5);}else for(const [_0x284032,_0x5bef97]of _0x435c8f[_0x513d1d(0x2c4)]){_0xdb12e3['length']>0x1&&_0xdb12e3[_0x513d1d(0x2c6)]('');for(let _0x2ebf01=_0x284032;_0x2ebf01<=_0x5bef97&&_0x2ebf01<=_0x4d7465['length'];_0x2ebf01++){const _0x1920a7=_0x4d7465[_0x2ebf01-0x1];_0xdb12e3[_0x513d1d(0x2c6)](_0x2ebf01+'|\x20'+_0x1920a7);}}_0xdb12e3[_0x513d1d(0x2c6)](_0x513d1d(0x25b)),_0x56fc53[_0x513d1d(0x2c6)](_0xdb12e3[_0x513d1d(0x220)]('\x0a'));}else _0x56fc53[_0x513d1d(0x2c6)]('<file\x20path=\x22'+_0x435c8f[_0x513d1d(0x22a)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x477af3?.['message']||_0x513d1d(0x2e0))+_0x513d1d(0x253));}_0xc76ca7[_0x513d1d(0x2c6)](_0x56fc53['join']('\x0a\x0a')),_0x2dc521=_0xc76ca7['join']('\x0a');const _0x51efc7=_0x4fa222[_0x513d1d(0x249)]?.['filter'](_0x586dbf=>_0x586dbf[_0x513d1d(0x24e)]?.[_0x513d1d(0x21b)](_0x513d1d(0x30b)))||[];if(_0x51efc7[_0x513d1d(0x2cf)]>0x0){const _0x2fe6e2=_0x51efc7[_0x513d1d(0x239)](_0x4c6e47=>_0x4c6e47['message'])[_0x513d1d(0x220)](';\x20');reportMorphError({'error_message':_0x2fe6e2,'error_type':_0x513d1d(0x299),'context':{'tool':_0x513d1d(0x21a),'repo_path':_0x630583['data']['repo_path'],'query':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x2dc)],'model':_0x513d1d(0x2f3),'termination_reason':_0x513d1d(0x230),'error_count':_0x51efc7[_0x513d1d(0x2cf)],'is_timeout':![],'timings':_0x4fa222['timings'],'files_attempted':_0x1e917f[_0x513d1d(0x239)](_0x5a8408=>({'path':_0x5a8408[_0x513d1d(0x22a)],'lines':_0x5a8408[_0x513d1d(0x2c4)]})),'tool_calls':_0x463032(_0x4fa222[_0x513d1d(0x2be)]),'messages':_0x4fa222[_0x513d1d(0x2be)]?.[_0x513d1d(0x239)](_0x7d074a=>({'role':_0x7d074a[_0x513d1d(0x266)],'content':_0x7d074a[_0x513d1d(0x25d)]})),'request_content':{'query':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x2dc)],'repo_path':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)],'repoRoot':a0_0x192533['resolve'](_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)]),'model':_0x513d1d(0x2f3)}},'source':_0x513d1d(0x22b)})['catch'](()=>{});}}else{if(_0x4fa222[_0x513d1d(0x2fc)]===_0x513d1d(0x1f3)&&_0x4fa222[_0x513d1d(0x249)]['length']>0x0){const _0x330fde=_0x4fa222[_0x513d1d(0x249)][_0x513d1d(0x239)](_0x59ee5b=>_0x59ee5b[_0x513d1d(0x24e)])[_0x513d1d(0x220)](';\x20');_0x2dc521=_0x513d1d(0x2fa)+_0x330fde;const _0x491ceb=_0x330fde['toLowerCase']()['includes'](_0x513d1d(0x2b3))||_0x330fde[_0x513d1d(0x275)]()[_0x513d1d(0x258)](_0x513d1d(0x28e))||_0x330fde[_0x513d1d(0x275)]()[_0x513d1d(0x258)]('etimedout'),_0x49f15c=_0x4fa222['finish']?.[_0x513d1d(0x1f5)]?.[_0x513d1d(0x2e2)],_0x1f104d=_0x4fa222[_0x513d1d(0x249)][0x0];reportMorphError({'error_message':_0x330fde,'error_type':_0x491ceb?_0x513d1d(0x238):_0x1f104d?.['constructor']?.[_0x513d1d(0x2d1)]||_0x513d1d(0x22e),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x630583['data'][_0x513d1d(0x25f)],'query':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x2dc)],'model':'morph-warp-grep-v1-1111v0','termination_reason':_0x4fa222['terminationReason'],'error_count':_0x4fa222[_0x513d1d(0x249)][_0x513d1d(0x2cf)],'is_timeout':_0x491ceb,'timings':_0x4fa222[_0x513d1d(0x254)],'files_attempted':_0x49f15c?.[_0x513d1d(0x239)](_0x5b36dd=>({'path':_0x5b36dd[_0x513d1d(0x22a)],'lines':_0x5b36dd[_0x513d1d(0x2c4)]})),'tool_calls':_0x463032(_0x4fa222[_0x513d1d(0x2be)]),'messages':_0x4fa222[_0x513d1d(0x2be)]?.[_0x513d1d(0x239)](_0x399157=>({'role':_0x399157[_0x513d1d(0x266)],'content':_0x399157[_0x513d1d(0x25d)]})),'request_content':{'query':_0x630583[_0x513d1d(0x292)]['search_string'],'repo_path':_0x630583['data'][_0x513d1d(0x25f)],'repoRoot':a0_0x192533[_0x513d1d(0x291)](_0x630583[_0x513d1d(0x292)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x1f104d?.[_0x513d1d(0x2e6)]||undefined,'source':_0x513d1d(0x22b)})[_0x513d1d(0x2b1)](()=>{});}else _0x2dc521=_0x513d1d(0x26a);}return{'content':[{'type':_0x513d1d(0x211),'text':_0x2dc521}]};}catch(_0x419725){const _0x11e058=_0x419725 instanceof Error?_0x419725[_0x513d1d(0x24e)]:String(_0x419725),_0x33288c=_0x11e058[_0x513d1d(0x275)]()[_0x513d1d(0x258)](_0x513d1d(0x2b3))||_0x11e058[_0x513d1d(0x275)]()[_0x513d1d(0x258)]('timed\x20out')||_0x11e058['toLowerCase']()[_0x513d1d(0x258)](_0x513d1d(0x269))||_0x419725 instanceof Error&&_0x419725[_0x513d1d(0x2d1)]===_0x513d1d(0x238);return reportMorphError({'error_message':_0x11e058,'error_type':_0x33288c?_0x513d1d(0x238):_0x419725 instanceof Error?_0x419725['constructor'][_0x513d1d(0x2d1)]:_0x513d1d(0x281),'context':{'tool':_0x513d1d(0x21a),'repo_path':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)],'query':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x2dc)],'model':_0x513d1d(0x2f3),'is_timeout':_0x33288c,'exception_phase':_0x513d1d(0x237),'request_content':{'query':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x2dc)],'repo_path':_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)],'repoRoot':a0_0x192533[_0x513d1d(0x291)](_0x630583[_0x513d1d(0x292)][_0x513d1d(0x25f)]),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x419725 instanceof Error?_0x419725[_0x513d1d(0x2e6)]:undefined,'source':_0x513d1d(0x22b)})['catch'](()=>{}),{'content':[{'type':_0x513d1d(0x211),'text':_0x513d1d(0x289)+_0x11e058}],'isError':![]};}}case _0x513d1d(0x2ee):{const _0x4d7907=WarpGrepGitHubArgsSchema[_0x513d1d(0x243)](_0x44fa3b);if(!_0x4d7907['success'])return{'content':[{'type':_0x513d1d(0x211),'text':_0x513d1d(0x229)+_0x4d7907[_0x513d1d(0x1f8)]}],'isError':!![]};const _0x3ac3dd=MORPH_API_KEY;if(!_0x3ac3dd)throw new Error(_0x513d1d(0x206));const _0x402a41=Date[_0x513d1d(0x29d)]();console[_0x513d1d(0x1f8)](_0x513d1d(0x23e)+_0x4d7907['data'][_0x513d1d(0x30c)]+_0x513d1d(0x235)+_0x4d7907[_0x513d1d(0x292)][_0x513d1d(0x2dc)]+'\x22');try{const _0xac570b=new WarpGrepClient({'morphApiKey':_0x3ac3dd,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x1d4997=await _0xac570b[_0x513d1d(0x27b)]({'query':_0x4d7907['data'][_0x513d1d(0x2dc)],'github':_0x4d7907[_0x513d1d(0x292)][_0x513d1d(0x30c)],'branch':_0x4d7907['data'][_0x513d1d(0x2d6)]}),_0x405da1=Date['now']()-_0x402a41;console['error'](_0x513d1d(0x2b2)+_0x405da1+_0x513d1d(0x225)+_0x1d4997[_0x513d1d(0x2b4)]);const _0xb96c5=formatResult(_0x1d4997);return{'content':[{'type':_0x513d1d(0x211),'text':_0xb96c5}]};}catch(_0x4a4147){const _0x1c99e8=Date['now']()-_0x402a41,_0x15c4a3=_0x4a4147 instanceof Error?_0x4a4147[_0x513d1d(0x24e)]:String(_0x4a4147);return console['error'](_0x513d1d(0x257)+_0x1c99e8+_0x513d1d(0x306),_0x15c4a3),reportMorphError({'error_message':_0x15c4a3,'error_type':_0x4a4147 instanceof Error?_0x4a4147[_0x513d1d(0x234)][_0x513d1d(0x2d1)]:'UnknownError','context':{'tool':'warpgrep_github_search','github_url':_0x4d7907[_0x513d1d(0x292)][_0x513d1d(0x30c)],'search_string':_0x4d7907[_0x513d1d(0x292)][_0x513d1d(0x2dc)],'branch':_0x4d7907[_0x513d1d(0x292)][_0x513d1d(0x2d6)]},'stack_trace':_0x4a4147 instanceof Error?_0x4a4147[_0x513d1d(0x2e6)]:undefined,'source':_0x513d1d(0x22b),'tool':_0x513d1d(0x2ee),'latency_ms':_0x1c99e8})[_0x513d1d(0x2b1)](()=>{}),{'content':[{'type':_0x513d1d(0x211),'text':'GitHub\x20search\x20failed:\x20'+_0x15c4a3}],'isError':![]};}}case _0x513d1d(0x2e8):{const _0xbf0121=CodebaseSearchArgsSchema[_0x513d1d(0x243)](_0x44fa3b);if(!_0xbf0121[_0x513d1d(0x2b4)])return{'content':[{'type':_0x513d1d(0x211),'text':_0x513d1d(0x229)+_0xbf0121[_0x513d1d(0x1f8)]}],'isError':!![]};try{const _0x72b552=MORPH_API_KEY;if(!_0x72b552)throw new Error(_0x513d1d(0x2ef));const _0x54532b=_0xbf0121[_0x513d1d(0x292)]['targetDirectories'],_0x322baa=await executeCodebaseSearch({'query':_0xbf0121[_0x513d1d(0x292)][_0x513d1d(0x1fa)],'target_directories':_0x54532b,'limit':_0xbf0121['data'][_0x513d1d(0x2da)]},{'apiKey':_0x72b552,'repoId':_0xbf0121['data'][_0x513d1d(0x270)],'branch':_0xbf0121['data'][_0x513d1d(0x2d6)],'commitHash':_0xbf0121['data'][_0x513d1d(0x2e7)],'debug':![]});if(!_0x322baa[_0x513d1d(0x2b4)])return{'content':[{'type':_0x513d1d(0x211),'text':'Search\x20failed:\x20'+_0x322baa['error']}],'isError':!![]};const _0x3f0235=_0x322baa['results'][_0x513d1d(0x2cf)]===0x0?_0x513d1d(0x2d7)+_0xbf0121[_0x513d1d(0x292)]['query']+'\x22':'Found\x20'+_0x322baa[_0x513d1d(0x311)][_0x513d1d(0x2cf)]+'\x20results\x20in\x20'+_0x322baa[_0x513d1d(0x226)]['searchTimeMs']+_0x513d1d(0x2f5)+_0x322baa[_0x513d1d(0x311)][_0x513d1d(0x239)]((_0x121c66,_0x86f0d)=>_0x86f0d+0x1+'.\x20'+_0x121c66[_0x513d1d(0x2e1)]+'\x20('+(_0x121c66[_0x513d1d(0x20d)]*0x64)[_0x513d1d(0x294)](0x1)+_0x513d1d(0x215)+(_0x513d1d(0x307)+_0x121c66[_0x513d1d(0x2c5)]+'-'+_0x121c66['endLine']+'\x0a')+(_0x513d1d(0x227)+_0x121c66['content'][_0x513d1d(0x241)](0x0,0xc8)+(_0x121c66[_0x513d1d(0x25d)][_0x513d1d(0x2cf)]>0xc8?'...':'')+'\x0a'))[_0x513d1d(0x220)]('\x0a');return{'content':[{'type':_0x513d1d(0x211),'text':_0x3f0235}]};}catch(_0x502272){const _0x4f000b=_0x502272 instanceof Error?_0x502272[_0x513d1d(0x24e)]:String(_0x502272);return reportMorphError({'error_message':_0x4f000b,'error_type':_0x502272 instanceof Error?_0x502272[_0x513d1d(0x234)][_0x513d1d(0x2d1)]:_0x513d1d(0x281),'context':{'tool':_0x513d1d(0x2e8),'query':_0xbf0121[_0x513d1d(0x292)][_0x513d1d(0x1fa)],'repo_id':_0xbf0121[_0x513d1d(0x292)][_0x513d1d(0x270)],'target_directories':_0xbf0121[_0x513d1d(0x292)][_0x513d1d(0x2a8)]},'stack_trace':_0x502272 instanceof Error?_0x502272[_0x513d1d(0x2e6)]:undefined,'source':'mcp-filesystem'})[_0x513d1d(0x2b1)](()=>{}),{'content':[{'type':_0x513d1d(0x211),'text':_0x513d1d(0x2fa)+_0x4f000b}],'isError':!![]};}}default:throw new Error(_0x513d1d(0x208)+_0x1f13bf);}}catch(_0x4f05a6){const _0x411ff0=_0x4f05a6 instanceof Error?_0x4f05a6[_0x513d1d(0x24e)]:String(_0x4f05a6);return reportMorphError({'error_message':_0x411ff0,'error_type':_0x4f05a6 instanceof Error?_0x4f05a6[_0x513d1d(0x234)]['name']:_0x513d1d(0x281),'context':{'tool':name,'arguments':args?JSON['stringify'](args)[_0x513d1d(0x241)](0x0,0x1f4):undefined,'mcp_server_version':_0x513d1d(0x26b)},'stack_trace':_0x4f05a6 instanceof Error?_0x4f05a6[_0x513d1d(0x2e6)]:undefined,'source':_0x513d1d(0x22b)})[_0x513d1d(0x2b1)](()=>{}),{'content':[{'type':_0x513d1d(0x211),'text':'Error:\x20'+_0x411ff0}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0xd87000){const _0x19cde9=a0_0x2ad189,_0x34fe86=await getValidRootDirectories(_0xd87000);if(_0x34fe86[_0x19cde9(0x2cf)]>0x0)allowedDirectories=[..._0x34fe86],console[_0x19cde9(0x1f8)](_0x19cde9(0x2dd)+_0x34fe86[_0x19cde9(0x2cf)]+_0x19cde9(0x2f6));else{console[_0x19cde9(0x1f8)](_0x19cde9(0x207));if(ENABLE_WORKSPACE_MODE)try{const _0x324c21=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x324c21&&(allowedDirectories=[_0x324c21],console['error'](_0x19cde9(0x250)+_0x324c21));}catch(_0x2a9297){console[_0x19cde9(0x1f8)]('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2a9297);}}}server[a0_0x2ad189(0x2ec)](RootsListChangedNotificationSchema,async()=>{const _0x42ff0e=a0_0x2ad189;try{const _0x589f9e=await server['listRoots']();_0x589f9e&&_0x42ff0e(0x2fe)in _0x589f9e&&await updateAllowedDirectoriesFromRoots(_0x589f9e[_0x42ff0e(0x2fe)]);}catch(_0x425fe3){console[_0x42ff0e(0x1f8)](_0x42ff0e(0x21e),_0x425fe3 instanceof Error?_0x425fe3[_0x42ff0e(0x24e)]:String(_0x425fe3));}}),server['oninitialized']=async()=>{const _0x518d99=a0_0x2ad189,_0x4cdb41=server[_0x518d99(0x1f6)]();if(_0x4cdb41?.[_0x518d99(0x2fe)])try{const _0x393179=await server[_0x518d99(0x2a7)]();_0x393179&&'roots'in _0x393179?await updateAllowedDirectoriesFromRoots(_0x393179[_0x518d99(0x2fe)]):console[_0x518d99(0x1f8)](_0x518d99(0x245));}catch(_0x3c39ea){console['error'](_0x518d99(0x2f9),_0x3c39ea instanceof Error?_0x3c39ea['message']:String(_0x3c39ea));}else{if(allowedDirectories[_0x518d99(0x2cf)]>0x0)console['error'](_0x518d99(0x22d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x518d99(0x1f8)](_0x518d99(0x30a));else throw new Error(_0x518d99(0x2fd));}}};async function runServer(){const _0x2bf3a5=a0_0x2ad189,_0x1b4998=new StdioServerTransport();await server['connect'](_0x1b4998),console[_0x2bf3a5(0x1f8)]('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories['length']===0x0&&console[_0x2bf3a5(0x1f8)](_0x2bf3a5(0x2d3));}runServer()['catch'](_0x433046=>{const _0x3fdcb3=a0_0x2ad189;console['error'](_0x3fdcb3(0x262),_0x433046),process[_0x3fdcb3(0x204)](0x1);});
2
+ const a0_0x514987=a0_0xc007;(function(_0xa17b4a,_0x3cae17){const _0x3b9810=a0_0xc007,_0x35a8b1=_0xa17b4a();while(!![]){try{const _0xafa5ab=-parseInt(_0x3b9810(0x21e))/0x1*(-parseInt(_0x3b9810(0x1cb))/0x2)+parseInt(_0x3b9810(0x2dc))/0x3*(parseInt(_0x3b9810(0x299))/0x4)+-parseInt(_0x3b9810(0x1c2))/0x5*(-parseInt(_0x3b9810(0x1f9))/0x6)+parseInt(_0x3b9810(0x28c))/0x7*(parseInt(_0x3b9810(0x2a6))/0x8)+-parseInt(_0x3b9810(0x1da))/0x9*(parseInt(_0x3b9810(0x1d4))/0xa)+-parseInt(_0x3b9810(0x229))/0xb+-parseInt(_0x3b9810(0x1d1))/0xc;if(_0xafa5ab===_0x3cae17)break;else _0x35a8b1['push'](_0x35a8b1['shift']());}catch(_0x6fe9e){_0x35a8b1['push'](_0x35a8b1['shift']());}}}(a0_0x3be4,0xc64f3));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_0x3d154a from'fs/promises';import a0_0x3c2000 from'path';import a0_0x3d97a1 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';function a0_0x3be4(){const _0x12fdc3=['MORPH_WARP_GREP_TIMEOUT','-\x20Listed\x20directory\x20`','roots','access','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','commitHash','880rOxdRh','ms:','Unknown\x20error','log','completed','.vscode','normalize','toLowerCase','.git','\x20\x20\x20Lines\x20','[warpgrep_github_search]\x20Searching\x20','9197243VqGHDR','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','Max\x20results\x20to\x20return','.\x20Path:\x20','success','stack','\x20valid\x20directories','Morph\x20Edit\x20Preview','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','searchGitHub','Invalid\x20arguments:\x20','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','edit_file','timeout','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','github_url','\x20error(s)','safeParse','TimeoutError','path','indexOf','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','codebase_search','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','runWarpGrep_call','metadata','WarpGrepError','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','--help','Benefits:\x0a','❌\x20Morph\x20Edit\x20Failed:\x20','endLine','filter','terminated','node_modules','-\x20Read\x20file\x20`','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','text','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','object','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','Fallback:\x20Using\x20workspace\x20root\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','stringify','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','ENOENT','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','\x0aExamples:','completionId','setRequestHandler','Morph\x20FastApply\x20failed\x20without\x20error\x20message','now','join','push','\x20results\x20in\x20','branch','morph-','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','isDirectory','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','mcp-filesystem','--version','repoId','default','instruction','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Warning:\x20Workspace\x20fallback\x20failed:\x20','grep','\x20is\x20not\x20a\x20directory','WarpGrep\x20sub-tool\x20errors:\x20','</file>','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','limit','.\x20Changes:\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','ReadError','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','ms.\x20Success:\x20','../package.json','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','timings','application/json','FileNotFound','catch','targetDirectories','SymlinkError','MORPH_API_KEY','assistant','ms:\x0a\x0a','Created\x20File','getClientCapabilities','substring','includes','\x20\x20morph-mcp','startLine','340774gmWXcx','\x20-\x20','toISOString',',\x20removed\x20','Error:\x20','https://morphllm.com/api/error-report','warpgrep_github_search','version','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','dirname','[warpgrep_github_search]\x20Failed\x20in\x20','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','connect','4WoPzHv','ToolException','constructor','filepath','some','morph-mcp','rerankScore','describe','Unknown\x20tool:\x20','FileReadError','WORKSPACE_ROOT','tsconfig.json','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','184Qxswum','--api-key','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','Bearer\x20','argv','Error\x20accessing\x20directory\x20','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','read','content','ENABLED_TOOLS','lines','messages','sep','number','File\x20read\x20error:','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Workspace\x20mode\x20enabled:\x20Using\x20','GitHub\x20search\x20failed:\x20','dryRun','data','linesModified','finish','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','read\x20','SubToolError','setNotificationHandler','PWD','0.2.0','homedir','startsWith','unknown','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.','code_edit','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','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','string','search_string','RipgrepError','realpath','slice','[could\x20not\x20read\x20file:\x20','exit','readFile','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Specific\x20commit\x20hash\x20to\x20search','\x20for:\x20\x22','min','linesAdded','unknown\x20error','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','\x22>\x0aError\x20reading\x20file:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','split','sk-','835446mvCdoW','morph-v3-fast','pyproject.toml','isArray','every','name','\x0aOptions:','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','Relevant\x20context\x20found:','\x0a</file>','Enabled\x20tools:\x20','Here\x20is\x20the\x20content\x20of\x20files:\x0a','requiresApiKey','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','terminationReason','\x20(new\x20file)','false','...','floor','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','linesRemoved','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','155gRtuET','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','match','.cursor','added\x20','length','toFixed','GitHub\x20repository\x20URL\x20or\x20\x27owner/repo\x27\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27\x20or\x20\x27https://github.com/vercel/next.js\x27)','@morphllm/morphmcp\x20','212wgUxpI','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Applied','grep\x20\x27','message','--api-key=','10301520DIpuhW','\x20chars)','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','2312340DLsIty','go.mod','\x0a...\x20(truncated,\x20total:\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','list_directory\x20','Rules:\x0a','9PZQULK','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','stats','has','env','UnknownError','all','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','Failed\x20to\x20read\x20file:\x20','payload','oninitialized','api-key','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','optional','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','code','RipgrepNotAvailable','utf-8','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','role','composer.json','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','Warning:\x20','completed_with_file_errors','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','warpgrep_codebase_search','trim','[warpgrep_github_search]\x20Done\x20in\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','241284gzNuOe','Found\x20','Cargo.toml','\x27\x20in\x20`','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','results','morph-warp-grep-v1-1111v0','enum','files','Query\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','boolean',',\x20modified\x20','listRoots','\x20\x20\x20','timed\x20out','repo_path','basename','warn','resolve','error','query_type','inputSchema','BinaryFile','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','source','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','errors','map','<file\x20path=\x22'];a0_0x3be4=function(){return _0x12fdc3;};return a0_0x3be4();}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_0x5be7c4 from'axios';function fixPathRepetition(_0x35147f){const _0x275fda=a0_0xc007,_0x280c66=_0x35147f['split'](a0_0x3c2000[_0x275fda(0x2b2)])['filter'](Boolean);if(_0x280c66['length']<0x2)return null;for(let _0x25f9dc=Math[_0x275fda(0x1be)](_0x280c66[_0x275fda(0x1c7)]/0x2);_0x25f9dc>=0x1;_0x25f9dc--){for(let _0x33ccb1=0x0;_0x33ccb1<=_0x280c66['length']-0x2*_0x25f9dc;_0x33ccb1++){const _0x591f7f=_0x280c66[_0x275fda(0x2cd)](_0x33ccb1,_0x33ccb1+_0x25f9dc),_0x103d12=_0x280c66[_0x275fda(0x2cd)](_0x33ccb1+_0x25f9dc,_0x33ccb1+0x2*_0x25f9dc);if(_0x591f7f[_0x275fda(0x1b0)]((_0x149405,_0x59916b)=>_0x149405===_0x103d12[_0x59916b])){const _0x166856=[..._0x280c66['slice'](0x0,_0x33ccb1),..._0x280c66['slice'](_0x33ccb1+_0x25f9dc)];return a0_0x3c2000[_0x275fda(0x2b2)]+_0x166856[_0x275fda(0x261)](a0_0x3c2000[_0x275fda(0x2b2)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x4ab9c7=a0_0xc007;try{const _0x21edff=require(_0x4ab9c7(0x27b));return _0x21edff[_0x4ab9c7(0x293)]??_0x4ab9c7(0x2c4);}catch(_0x2fad3e){return console['error'](_0x4ab9c7(0x279),_0x2fad3e),_0x4ab9c7(0x2c4);}}function printHelp(){const _0x52ccea=a0_0xc007;console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x52ccea(0x221)](_0x52ccea(0x294)),console[_0x52ccea(0x221)](_0x52ccea(0x1b2)),console['log'](_0x52ccea(0x1d3)),console[_0x52ccea(0x221)](_0x52ccea(0x1e9)),console[_0x52ccea(0x221)](_0x52ccea(0x1d7)),console[_0x52ccea(0x221)](_0x52ccea(0x25c)),console[_0x52ccea(0x221)](_0x52ccea(0x28a)),console[_0x52ccea(0x221)](_0x52ccea(0x252));}function a0_0xc007(_0x496cba,_0xe6e51f){_0x496cba=_0x496cba-0x1b0;const _0x3be4dd=a0_0x3be4();let _0xc00759=_0x3be4dd[_0x496cba];return _0xc00759;}const cliArgs=process[a0_0x514987(0x2aa)][a0_0x514987(0x2cd)](0x2),VERSION_FLAGS=new Set([a0_0x514987(0x26a),'-v','-V']),HELP_FLAGS=new Set([a0_0x514987(0x247),'-h']);cliArgs[a0_0x514987(0x29d)](_0x410bff=>VERSION_FLAGS[a0_0x514987(0x1dd)](_0x410bff))&&(console[a0_0x514987(0x221)](a0_0x514987(0x1ca)+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x91d85=>HELP_FLAGS[a0_0x514987(0x1dd)](_0x91d85))&&(printHelp(),process[a0_0x514987(0x2cf)](0x0));function getCliArg(_0x3d541d){const _0x29295d=a0_0x514987;for(let _0x2d20cd=0x0;_0x2d20cd<cliArgs[_0x29295d(0x1c7)];_0x2d20cd++){const _0x117281=cliArgs[_0x2d20cd];if(_0x117281[_0x29295d(0x2c3)]('--'+_0x3d541d+'='))return _0x117281[_0x29295d(0x2cd)](('--'+_0x3d541d+'=')[_0x29295d(0x1c7)]);if(_0x117281==='--'+_0x3d541d&&_0x2d20cd+0x1<cliArgs[_0x29295d(0x1c7)])return cliArgs[_0x2d20cd+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x514987(0x1c7)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x514987(0x2c3)](a0_0x514987(0x1d0)))continue;if(arg===a0_0x514987(0x2a7)){i++;continue;}args[a0_0x514987(0x262)](arg);}const ALL_TOOLS=[a0_0x514987(0x237),a0_0x514987(0x1f5),a0_0x514987(0x292),a0_0x514987(0x241)],DEFAULT_TOOLS=[a0_0x514987(0x237),a0_0x514987(0x1f5),a0_0x514987(0x292)],ENABLED_TOOLS=process[a0_0x514987(0x1de)][a0_0x514987(0x2af)]?process[a0_0x514987(0x1de)][a0_0x514987(0x2af)]===a0_0x514987(0x1e0)?ALL_TOOLS:process[a0_0x514987(0x1de)][a0_0x514987(0x2af)][a0_0x514987(0x2da)](',')[a0_0x514987(0x215)](_0x33a0f3=>_0x33a0f3[a0_0x514987(0x1f6)]()):DEFAULT_TOOLS;console[a0_0x514987(0x20c)](a0_0x514987(0x1b6)+ENABLED_TOOLS['join'](',\x20'));const WORKSPACE_ROOT=process[a0_0x514987(0x1de)][a0_0x514987(0x2a3)]||process[a0_0x514987(0x1de)][a0_0x514987(0x2c0)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x514987(0x1de)]['ENABLE_WORKSPACE_MODE']!==a0_0x514987(0x1bc),MORPH_API_KEY=getCliArg(a0_0x514987(0x1e6))??process[a0_0x514987(0x1de)][a0_0x514987(0x283)],MORPH_API_URL=process[a0_0x514987(0x1de)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x514987(0x1de)][a0_0x514987(0x217)]?parseInt(process[a0_0x514987(0x1de)][a0_0x514987(0x217)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x514987(0x2c3)](a0_0x514987(0x2db))&&!MORPH_API_KEY[a0_0x514987(0x2c3)](a0_0x514987(0x265))&&console[a0_0x514987(0x20c)](a0_0x514987(0x236));async function reportMorphError(_0x5c5f80){const _0x525e6a=a0_0x514987;try{await a0_0x5be7c4['post'](_0x525e6a(0x291),{..._0x5c5f80,'timestamp':new Date()[_0x525e6a(0x28e)](),'source':_0x5c5f80[_0x525e6a(0x211)]||_0x525e6a(0x269)},{'timeout':0x1388,'headers':{'Content-Type':_0x525e6a(0x27e),'Authorization':_0x525e6a(0x2a9)+MORPH_API_KEY}});}catch{}}args[a0_0x514987(0x1c7)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x514987(0x20c)](a0_0x514987(0x1e1)),console[a0_0x514987(0x20c)](a0_0x514987(0x297)),console[a0_0x514987(0x20c)](a0_0x514987(0x1e2)),console[a0_0x514987(0x20c)]('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),console[a0_0x514987(0x20c)]('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),console['error'](a0_0x514987(0x1fd)));function normalizePath(_0x28364b){const _0x18fa6d=a0_0x514987;return a0_0x3c2000[_0x18fa6d(0x224)](_0x28364b);}function expandHome(_0x5dab8f){const _0x2bf554=a0_0x514987;if(_0x5dab8f[_0x2bf554(0x2c3)]('~/')||_0x5dab8f==='~')return a0_0x3c2000[_0x2bf554(0x261)](a0_0x3d97a1[_0x2bf554(0x2c2)](),_0x5dab8f[_0x2bf554(0x2cd)](0x1));return _0x5dab8f;}let allowedDirectories=await Promise[a0_0x514987(0x1e0)](args[a0_0x514987(0x215)](async _0x367d3e=>{const _0x5f066f=a0_0x514987,_0x22d5ba=expandHome(_0x367d3e),_0x17bfa9=a0_0x3c2000[_0x5f066f(0x20b)](_0x22d5ba);try{const _0x7d832=await a0_0x3d154a['realpath'](_0x17bfa9);return normalizePath(_0x7d832);}catch(_0x51ffa6){return normalizePath(_0x17bfa9);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x514987(0x1c7)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),console['error'](a0_0x514987(0x2b6)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x53606e){console['error'](a0_0x514987(0x2b5)+a0_0x53606e);}async function detectWorkspaceRoot(_0x1f1858){const _0x12343f=a0_0x514987;let _0x7ee556=a0_0x3c2000[_0x12343f(0x20b)](_0x1f1858);const _0xf4c2fa=[_0x12343f(0x226),_0x12343f(0x223),'package.json',_0x12343f(0x1fb),_0x12343f(0x2de),_0x12343f(0x1d5),_0x12343f(0x1c5),_0x12343f(0x2a4),_0x12343f(0x1ef)];while(_0x7ee556!==a0_0x3c2000['dirname'](_0x7ee556)){for(const _0x109423 of _0xf4c2fa){const _0x359fd2=a0_0x3c2000[_0x12343f(0x261)](_0x7ee556,_0x109423);try{return await a0_0x3d154a[_0x12343f(0x21a)](_0x359fd2),normalizePath(_0x7ee556);}catch{}}_0x7ee556=a0_0x3c2000[_0x12343f(0x295)](_0x7ee556);}return normalizePath(_0x1f1858);}await Promise[a0_0x514987(0x1e0)](args[a0_0x514987(0x215)](async _0x1ce9ab=>{const _0x5e0951=a0_0x514987;try{const _0x1e1f83=await a0_0x3d154a['stat'](expandHome(_0x1ce9ab));!_0x1e1f83[_0x5e0951(0x267)]()&&(console[_0x5e0951(0x20c)](_0x5e0951(0x290)+_0x1ce9ab+_0x5e0951(0x271)),process[_0x5e0951(0x2cf)](0x1));}catch(_0x1f2889){console[_0x5e0951(0x20c)](_0x5e0951(0x2ab)+_0x1ce9ab+':',_0x1f2889),process[_0x5e0951(0x2cf)](0x1);}}));async function validatePath(_0x1e8c84){const _0xa93cb2=a0_0x514987,_0x82a2a=expandHome(_0x1e8c84),_0x282cf6=a0_0x3c2000['resolve'](_0x82a2a);try{const _0x2679fe=await a0_0x3d154a[_0xa93cb2(0x2cc)](_0x282cf6);return _0x2679fe;}catch(_0x2e1fa7){if(_0x2e1fa7[_0xa93cb2(0x1ea)]===_0xa93cb2(0x25a)){const _0x562da6=a0_0x3c2000['dirname'](_0x282cf6);try{const _0x32e010=await a0_0x3d154a['realpath'](_0x562da6);return a0_0x3c2000[_0xa93cb2(0x261)](_0x32e010,a0_0x3c2000[_0xa93cb2(0x209)](_0x282cf6));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x562da6);}}throw _0x2e1fa7;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x514987(0x2c9)](),'code_edit':z[a0_0x514987(0x2c9)]()['describe']('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x514987(0x2c9)]()['describe'](a0_0x514987(0x1f8)),'dryRun':z[a0_0x514987(0x203)]()[a0_0x514987(0x26c)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x514987(0x2c9)]()[a0_0x514987(0x2a0)](a0_0x514987(0x1f1)),'repo_path':z['string']()[a0_0x514987(0x2a0)](a0_0x514987(0x1f4)),'query_type':z[a0_0x514987(0x200)]([a0_0x514987(0x26c),a0_0x514987(0x24d)])['optional']()[a0_0x514987(0x2a0)](a0_0x514987(0x202))}),WarpGrepGitHubArgsSchema=z[a0_0x514987(0x253)]({'search_string':z[a0_0x514987(0x2c9)]()[a0_0x514987(0x2a0)](a0_0x514987(0x1f1)),'github_url':z['string']()[a0_0x514987(0x2a0)](a0_0x514987(0x1c9)),'branch':z[a0_0x514987(0x2c9)]()[a0_0x514987(0x1e8)]()[a0_0x514987(0x2a0)](a0_0x514987(0x1c3))}),CodebaseSearchArgsSchema=z[a0_0x514987(0x253)]({'query':z[a0_0x514987(0x2c9)]()[a0_0x514987(0x2a0)]('Natural\x20language\x20query\x20to\x20search\x20for\x20code'),'repoId':z[a0_0x514987(0x2c9)]()[a0_0x514987(0x2a0)]('Repository\x20identifier'),'branch':z[a0_0x514987(0x2c9)]()['optional']()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x514987(0x2c9)]()[a0_0x514987(0x1e8)]()[a0_0x514987(0x2a0)](a0_0x514987(0x2d2)),'targetDirectories':z['array'](z['string']())['default']([])[a0_0x514987(0x2a0)](a0_0x514987(0x2c7)),'limit':z[a0_0x514987(0x2b3)]()[a0_0x514987(0x1e8)]()[a0_0x514987(0x26c)](0xa)[a0_0x514987(0x2a0)](a0_0x514987(0x22b))}),server=new Server({'name':a0_0x514987(0x29e),'version':a0_0x514987(0x2c1)},{'capabilities':{'tools':{}}});server[a0_0x514987(0x25e)](ListToolsRequestSchema,async()=>{const _0x2397d7=a0_0x514987,_0x40df91=[{'name':_0x2397d7(0x237),'description':_0x2397d7(0x1cc)+_0x2397d7(0x240)+_0x2397d7(0x256)+_0x2397d7(0x246)+_0x2397d7(0x248)+_0x2397d7(0x254)+_0x2397d7(0x251)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x2397d7(0x235)+_0x2397d7(0x239)+_0x2397d7(0x27c)+_0x2397d7(0x26e)+'For\x20deletions:\x0a'+_0x2397d7(0x231)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x2397d7(0x1d9)+_0x2397d7(0x1ed)+_0x2397d7(0x277)+_0x2397d7(0x232)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x2397d7(0x268)+_0x2397d7(0x21c)+'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':_0x2397d7(0x1f5),'description':_0x2397d7(0x257)+_0x2397d7(0x1db)+_0x2397d7(0x2d7)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+_0x2397d7(0x242)+_0x2397d7(0x2c8)+_0x2397d7(0x1bf)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':_0x2397d7(0x241),'description':_0x2397d7(0x1b3)+_0x2397d7(0x2ac)+'🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a'+'Benefits:\x0a'+_0x2397d7(0x1b9)+_0x2397d7(0x1c1)+_0x2397d7(0x2a8)+_0x2397d7(0x210)+_0x2397d7(0x2a5)+_0x2397d7(0x2bc)+_0x2397d7(0x266),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x3ffc77=_0x40df91[_0x2397d7(0x24b)](_0x50c152=>{const _0x5b467d=_0x2397d7;if(!ENABLED_TOOLS[_0x5b467d(0x289)](_0x50c152[_0x5b467d(0x1b1)]))return![];if('requiresApiKey'in _0x50c152&&_0x50c152[_0x5b467d(0x1b8)]&&!MORPH_API_KEY)return console[_0x5b467d(0x20c)]('Warning:\x20'+_0x50c152['name']+_0x5b467d(0x259)),![];return!![];});return{'tools':_0x3ffc77['map'](_0x281b69=>({'name':_0x281b69[_0x2397d7(0x1b1)],'description':_0x281b69['description'],'inputSchema':_0x281b69[_0x2397d7(0x20e)]}))};}),server[a0_0x514987(0x25e)](CallToolRequestSchema,async _0x49e7b8=>{const _0x5899f2=a0_0x514987;try{const {name:_0x4ee7c6,arguments:_0x4c9bb1}=_0x49e7b8['params'];switch(_0x4ee7c6){case _0x5899f2(0x237):{const _0x27fae7=MorphEditFileArgsSchema[_0x5899f2(0x23c)](_0x4c9bb1);if(!_0x27fae7[_0x5899f2(0x22d)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x27fae7['error']);const _0x2e2e31=await validatePath(_0x27fae7['data']['path']);let _0x3d71e3=null,_0x45401f=!![],_0x10329f=null;try{_0x3d71e3=await a0_0x3d154a[_0x5899f2(0x2d0)](_0x2e2e31,_0x5899f2(0x1ec));}catch(_0x25e194){const _0x55b7bd=_0x25e194[_0x5899f2(0x1ea)];_0x55b7bd==='ENOENT'?(_0x45401f=![],_0x3d71e3=''):(_0x10329f=_0x5899f2(0x1e3)+(_0x55b7bd||_0x5899f2(0x2c4))+_0x5899f2(0x28d)+(_0x25e194 instanceof Error?_0x25e194[_0x5899f2(0x1cf)]:String(_0x25e194)),console['error'](_0x5899f2(0x1f2)+_0x10329f));}let _0x7a4cd6;try{const _0x418aaa=MORPH_API_KEY;if(!_0x418aaa)throw new Error(_0x5899f2(0x2d1));const _0x80e517=a0_0x3c2000[_0x5899f2(0x295)](_0x2e2e31),_0x3c303f=a0_0x3c2000['basename'](_0x2e2e31),_0x3e2a1a=await executeEditFile({'target_filepath':_0x3c303f,'code_edit':_0x27fae7['data'][_0x5899f2(0x2c6)],'instructions':_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x26d)]},{'morphApiKey':_0x418aaa,'morphApiUrl':MORPH_API_URL,'baseDir':_0x80e517,'autoWrite':!_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x2b8)],'generateUdiff':![],'debug':![]});_0x7a4cd6=_0x3e2a1a[_0x5899f2(0x25d)];if(!_0x3e2a1a[_0x5899f2(0x22d)])throw new Error(_0x3e2a1a[_0x5899f2(0x20c)]||_0x5899f2(0x25f));const _0x1080fd=_0x3e2a1a['changes'],_0x1700ae=_0x5899f2(0x1c6)+_0x1080fd[_0x5899f2(0x2d5)]+_0x5899f2(0x28f)+_0x1080fd[_0x5899f2(0x1c0)]+_0x5899f2(0x204)+_0x1080fd[_0x5899f2(0x2ba)];if(_0x27fae7['data'][_0x5899f2(0x2b8)])return{'content':[{'type':_0x5899f2(0x250),'text':_0x5899f2(0x230)+(_0x45401f?'':_0x5899f2(0x1bb))+':\x20'+_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x26d)]+_0x5899f2(0x276)+_0x1700ae+_0x5899f2(0x22c)+_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x23e)]+'.'}]};return{'content':[{'type':_0x5899f2(0x250),'text':'Morph\x20Edit\x20'+(_0x45401f?_0x5899f2(0x1cd):_0x5899f2(0x286))+':\x20'+_0x27fae7[_0x5899f2(0x2b9)]['instruction']+_0x5899f2(0x276)+_0x1700ae+_0x5899f2(0x22c)+_0x27fae7['data'][_0x5899f2(0x23e)]+'.'}]};}catch(_0x164754){const _0x3f5ac9=_0x164754 instanceof Error?_0x164754[_0x5899f2(0x1cf)]:String(_0x164754);return reportMorphError({'error_message':_0x3f5ac9,'error_type':_0x164754 instanceof Error?_0x164754[_0x5899f2(0x29b)][_0x5899f2(0x1b1)]:_0x5899f2(0x1df),'context':{'tool':_0x5899f2(0x237),'completion_id':_0x7a4cd6,'file_path':_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x23e)],'validated_path':_0x2e2e31,'instruction':_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x26d)],'model':_0x5899f2(0x2dd),'dry_run':_0x27fae7[_0x5899f2(0x2b9)]['dryRun'],'file_exists':_0x45401f,'file_read_error':_0x10329f,'file_readable':_0x3d71e3!==null,'request_content':{'path':_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x23e)],'code_edit':_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x2c6)],'instruction':_0x27fae7['data'][_0x5899f2(0x26d)],'original_code':_0x3d71e3!==null?_0x3d71e3[_0x5899f2(0x1c7)]>0xc350?_0x3d71e3[_0x5899f2(0x288)](0x0,0xc350)+_0x5899f2(0x1d6)+_0x3d71e3['length']+_0x5899f2(0x1d2):_0x3d71e3:_0x5899f2(0x2ce)+(_0x10329f||_0x5899f2(0x2d6))+']','original_code_length':_0x3d71e3?.[_0x5899f2(0x1c7)]??0x0,'model':'morph-v3-fast','dry_run':_0x27fae7[_0x5899f2(0x2b9)][_0x5899f2(0x2b8)]}},'stack_trace':_0x164754 instanceof Error?_0x164754[_0x5899f2(0x22e)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x5899f2(0x250),'text':_0x5899f2(0x249)+_0x3f5ac9}],'isError':!![]};}}case _0x5899f2(0x1f5):{const _0x1ef080=WarpGrepArgsSchema[_0x5899f2(0x23c)](_0x4c9bb1);if(!_0x1ef080[_0x5899f2(0x22d)])return{'content':[{'type':_0x5899f2(0x250),'text':'Invalid\x20arguments:\x20'+_0x1ef080[_0x5899f2(0x20c)]}],'isError':!![]};const _0x3f2a55=_0x517dc2=>{const _0x2bc64e=_0x5899f2,_0x193485=[];for(const _0x41efbd of _0x517dc2||[]){const _0x160b5f=_0x41efbd[_0x2bc64e(0x1ee)],_0x55680d=_0x41efbd[_0x2bc64e(0x2ae)];if(_0x160b5f===_0x2bc64e(0x284)&&_0x55680d){const _0x1c3abe=_0x55680d['split']('\x0a')[_0x2bc64e(0x24b)](_0x2e6226=>_0x2e6226[_0x2bc64e(0x1f6)]());for(const _0x45a69f of _0x1c3abe){const _0x478ab1=_0x45a69f[_0x2bc64e(0x1c4)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x478ab1){_0x193485[_0x2bc64e(0x262)](_0x2bc64e(0x1ce)+_0x478ab1[0x1]+'\x27\x20'+_0x478ab1[0x2]);continue;}const _0x2aa5b2=_0x45a69f[_0x2bc64e(0x1c4)](/^read\s+(.+)$/);if(_0x2aa5b2){_0x193485[_0x2bc64e(0x262)](_0x2bc64e(0x2bd)+_0x2aa5b2[0x1]);continue;}const _0x2e8de2=_0x45a69f[_0x2bc64e(0x1c4)](/^list_directory\s+(.+)$/);if(_0x2e8de2){_0x193485['push'](_0x2bc64e(0x1d8)+_0x2e8de2[0x1]);continue;}}}}return _0x193485;},_0x45e50d=_0x133982=>{const _0x4ed7e0=_0x5899f2,_0x56bb1b=[];if(!_0x133982||!Array[_0x4ed7e0(0x2df)](_0x133982))return _0x56bb1b;const _0x5a26b2=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x4ed7e0(0x27f),'tool':_0x4ed7e0(0x2ad)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x4ed7e0(0x2ad)},{'pattern':/\[READ ERROR\]/,'error_type':_0x4ed7e0(0x278),'tool':_0x4ed7e0(0x2ad)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x4ed7e0(0x2ad)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x4ed7e0(0x2cb),'tool':_0x4ed7e0(0x270)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x4ed7e0(0x1eb),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x4ed7e0(0x282),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x4ed7e0(0x20f),'tool':_0x4ed7e0(0x2ad)},{'pattern':/symbolic link/,'error_type':_0x4ed7e0(0x282),'tool':_0x4ed7e0(0x2ad)},{'pattern':/Error reading file:/,'error_type':_0x4ed7e0(0x278),'tool':_0x4ed7e0(0x2ad)},{'pattern':/status="error"/,'error_type':_0x4ed7e0(0x29a),'tool':'unknown'}];let _0x3381e3=0x0;for(const _0x5d40a4 of _0x133982){if(_0x5d40a4['role']==='user'){_0x3381e3++;const _0x2c6bee=_0x5d40a4[_0x4ed7e0(0x2ae)];if(!_0x2c6bee||typeof _0x2c6bee!==_0x4ed7e0(0x2c9))continue;for(const {pattern:_0x2ff929,error_type:_0x17762e,tool:_0xf31927}of _0x5a26b2){const _0x14355a=_0x2c6bee[_0x4ed7e0(0x1c4)](new RegExp(_0x2ff929['source'],'g'));if(_0x14355a)for(const _0x1ee32b of _0x14355a){const _0x24c7bf=_0x2c6bee[_0x4ed7e0(0x23f)](_0x1ee32b),_0xdefa36=_0x2c6bee[_0x4ed7e0(0x288)](_0x24c7bf,Math[_0x4ed7e0(0x2d4)](_0x24c7bf+0xc8,_0x2c6bee['length']));_0x56bb1b[_0x4ed7e0(0x262)]({'tool':_0xf31927,'error_type':_0x17762e,'error_message':_0xdefa36['split']('\x0a')[0x0],'turn':_0x3381e3});}}}}return _0x56bb1b;};try{const _0x13952e=a0_0x3c2000[_0x5899f2(0x20b)](_0x1ef080[_0x5899f2(0x2b9)]['repo_path']),_0x1d87a1=_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x20d)],_0x4de88c=_0x1d87a1===_0x5899f2(0x24d)?{'allowNames':['node_modules']}:undefined,_0x6a1052=new LocalRipgrepProvider(_0x13952e,undefined,_0x4de88c),_0x2f63d3=await runWarpGrep({'query':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x2ca)],'repoRoot':_0x13952e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x6a1052,'query_type':_0x1d87a1}),_0x2f72c0=_0x45e50d(_0x2f63d3[_0x5899f2(0x2b1)]);_0x2f72c0[_0x5899f2(0x1c7)]>0x0&&reportMorphError({'error_message':_0x5899f2(0x272)+_0x2f72c0[_0x5899f2(0x1c7)]+_0x5899f2(0x23b),'error_type':_0x5899f2(0x2be),'level':_0x5899f2(0x20a),'tool':_0x5899f2(0x1f5),'context':{'repo_path':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x208)],'query':_0x1ef080['data'][_0x5899f2(0x2ca)],'model':_0x5899f2(0x1ff),'termination_reason':_0x2f63d3['terminationReason'],'sub_tool_errors':_0x2f72c0,'timings':_0x2f63d3['timings'],'tool_calls':_0x3f2a55(_0x2f63d3[_0x5899f2(0x2b1)]),'messages':_0x2f63d3['messages']?.[_0x5899f2(0x215)](_0x3b0524=>({'role':_0x3b0524[_0x5899f2(0x1ee)],'content':_0x3b0524[_0x5899f2(0x2ae)]}))},'source':'mcp-filesystem'})['catch'](()=>{});let _0x3e0425='';if(_0x2f63d3[_0x5899f2(0x1ba)]===_0x5899f2(0x222)&&_0x2f63d3[_0x5899f2(0x2bb)]?.[_0x5899f2(0x244)]?.[_0x5899f2(0x201)]){const _0x4bcb93=_0x2f63d3['finish'][_0x5899f2(0x244)][_0x5899f2(0x201)];if(_0x4bcb93['length']===0x0)return _0x3e0425=_0x2f63d3['finish'][_0x5899f2(0x1e4)]||_0x5899f2(0x25b),{'content':[{'type':_0x5899f2(0x250),'text':_0x3e0425}]};const _0x495bff=[],_0x2592bb=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x78e1e4 of _0x2f63d3['messages']){const _0x2950ab=_0x78e1e4['role'],_0x32085e=_0x78e1e4[_0x5899f2(0x2ae)];if(_0x2950ab===_0x5899f2(0x284)&&_0x32085e){const _0x37aede=_0x32085e['split']('\x0a')[_0x5899f2(0x24b)](_0x422a2b=>_0x422a2b[_0x5899f2(0x1f6)]());for(const _0x195d59 of _0x37aede){const _0x579163=_0x195d59[_0x5899f2(0x1c4)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x579163){_0x2592bb['push']('-\x20Grepped\x20\x27'+_0x579163[0x1]+_0x5899f2(0x1fc)+_0x579163[0x2]+'`');continue;}const _0x46ae11=_0x195d59['match'](/^read\s+(.+)$/);if(_0x46ae11){_0x2592bb[_0x5899f2(0x262)](_0x5899f2(0x24e)+_0x46ae11[0x1]+'`');continue;}const _0x59a24b=_0x195d59['match'](/^list_directory\s+(.+)$/);if(_0x59a24b){_0x2592bb['push'](_0x5899f2(0x218)+_0x59a24b[0x1]+'`');continue;}}}}_0x495bff['push'](_0x2592bb[_0x5899f2(0x261)]('\x0a'));const _0x55cbfa=['',_0x5899f2(0x1b4)];for(const _0x42835c of _0x4bcb93){if(_0x42835c[_0x5899f2(0x2b0)]==='*')_0x55cbfa[_0x5899f2(0x262)]('-\x20'+_0x42835c[_0x5899f2(0x23e)]+':*');else{if(Array[_0x5899f2(0x2df)](_0x42835c[_0x5899f2(0x2b0)])){const _0x57df1b=_0x42835c[_0x5899f2(0x2b0)][_0x5899f2(0x215)](([_0xf46866,_0x1b9ac2])=>{if(_0xf46866===_0x1b9ac2)return''+_0xf46866;return _0xf46866+'-'+_0x1b9ac2;});_0x55cbfa[_0x5899f2(0x262)]('-\x20'+_0x42835c[_0x5899f2(0x23e)]+':'+_0x57df1b[_0x5899f2(0x261)](','));}else _0x55cbfa[_0x5899f2(0x262)]('-\x20'+_0x42835c[_0x5899f2(0x23e)]+':*');}}_0x55cbfa['push'](''),_0x495bff[_0x5899f2(0x262)](_0x55cbfa[_0x5899f2(0x261)]('\x0a')),_0x495bff['push'](_0x5899f2(0x1b7));const _0x14fb43=[];for(const _0x48196e of _0x4bcb93){let _0x3c9e1c=a0_0x3c2000[_0x5899f2(0x20b)](_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x208)],_0x48196e[_0x5899f2(0x23e)]),_0x146ffc=null,_0x592946=null;try{_0x146ffc=await a0_0x3d154a[_0x5899f2(0x2d0)](_0x3c9e1c,{'encoding':'utf-8'});}catch(_0x120f12){const _0x3b5a89=fixPathRepetition(_0x3c9e1c);if(_0x3b5a89)try{_0x146ffc=await a0_0x3d154a[_0x5899f2(0x2d0)](_0x3b5a89,{'encoding':_0x5899f2(0x1ec)}),_0x3c9e1c=_0x3b5a89;}catch{_0x592946=_0x120f12 instanceof Error?_0x120f12:new Error(String(_0x120f12));}else _0x592946=_0x120f12 instanceof Error?_0x120f12:new Error(String(_0x120f12));}if(_0x146ffc!==null){const _0x53f3fc=_0x146ffc[_0x5899f2(0x2da)](/\r?\n/),_0x4d48e6=[_0x5899f2(0x216)+_0x48196e[_0x5899f2(0x23e)]+'\x22>'];if(_0x48196e[_0x5899f2(0x2b0)]==='*'||!Array[_0x5899f2(0x2df)](_0x48196e[_0x5899f2(0x2b0)]))for(let _0x283265=0x1;_0x283265<=_0x53f3fc['length'];_0x283265++){const _0x2bef10=_0x53f3fc[_0x283265-0x1];_0x4d48e6[_0x5899f2(0x262)](_0x283265+'|\x20'+_0x2bef10);}else for(const [_0x1326e9,_0x597e72]of _0x48196e[_0x5899f2(0x2b0)]){_0x4d48e6[_0x5899f2(0x1c7)]>0x1&&_0x4d48e6[_0x5899f2(0x262)]('');for(let _0x3b8316=_0x1326e9;_0x3b8316<=_0x597e72&&_0x3b8316<=_0x53f3fc[_0x5899f2(0x1c7)];_0x3b8316++){const _0x364e75=_0x53f3fc[_0x3b8316-0x1];_0x4d48e6[_0x5899f2(0x262)](_0x3b8316+'|\x20'+_0x364e75);}}_0x4d48e6[_0x5899f2(0x262)](_0x5899f2(0x273)),_0x14fb43[_0x5899f2(0x262)](_0x4d48e6['join']('\x0a'));}else _0x14fb43[_0x5899f2(0x262)](_0x5899f2(0x216)+_0x48196e[_0x5899f2(0x23e)]+_0x5899f2(0x2d8)+(_0x592946?.[_0x5899f2(0x1cf)]||_0x5899f2(0x220))+_0x5899f2(0x1b5));}_0x495bff['push'](_0x14fb43['join']('\x0a\x0a')),_0x3e0425=_0x495bff[_0x5899f2(0x261)]('\x0a');const _0x2c2956=_0x2f63d3[_0x5899f2(0x214)]?.[_0x5899f2(0x24b)](_0x431f92=>_0x431f92[_0x5899f2(0x1cf)]?.[_0x5899f2(0x2c3)](_0x5899f2(0x2b4)))||[];if(_0x2c2956[_0x5899f2(0x1c7)]>0x0){const _0x4c3966=_0x2c2956['map'](_0x1ba44e=>_0x1ba44e[_0x5899f2(0x1cf)])[_0x5899f2(0x261)](';\x20');reportMorphError({'error_message':_0x4c3966,'error_type':_0x5899f2(0x2a2),'context':{'tool':_0x5899f2(0x1f5),'repo_path':_0x1ef080[_0x5899f2(0x2b9)]['repo_path'],'query':_0x1ef080[_0x5899f2(0x2b9)]['search_string'],'model':_0x5899f2(0x1ff),'termination_reason':_0x5899f2(0x1f3),'error_count':_0x2c2956[_0x5899f2(0x1c7)],'is_timeout':![],'timings':_0x2f63d3[_0x5899f2(0x27d)],'files_attempted':_0x4bcb93[_0x5899f2(0x215)](_0x11cc79=>({'path':_0x11cc79[_0x5899f2(0x23e)],'lines':_0x11cc79[_0x5899f2(0x2b0)]})),'tool_calls':_0x3f2a55(_0x2f63d3['messages']),'messages':_0x2f63d3['messages']?.[_0x5899f2(0x215)](_0x1aea54=>({'role':_0x1aea54['role'],'content':_0x1aea54[_0x5899f2(0x2ae)]})),'request_content':{'query':_0x1ef080[_0x5899f2(0x2b9)]['search_string'],'repo_path':_0x1ef080[_0x5899f2(0x2b9)]['repo_path'],'repoRoot':a0_0x3c2000['resolve'](_0x1ef080['data']['repo_path']),'model':_0x5899f2(0x1ff)}},'source':_0x5899f2(0x269)})[_0x5899f2(0x280)](()=>{});}}else{if(_0x2f63d3[_0x5899f2(0x1ba)]===_0x5899f2(0x24c)&&_0x2f63d3[_0x5899f2(0x214)][_0x5899f2(0x1c7)]>0x0){const _0x4d326c=_0x2f63d3[_0x5899f2(0x214)][_0x5899f2(0x215)](_0x76d105=>_0x76d105[_0x5899f2(0x1cf)])['join'](';\x20');_0x3e0425=_0x5899f2(0x290)+_0x4d326c;const _0x1bc0eb=_0x4d326c['toLowerCase']()[_0x5899f2(0x289)](_0x5899f2(0x238))||_0x4d326c[_0x5899f2(0x225)]()[_0x5899f2(0x289)](_0x5899f2(0x207))||_0x4d326c[_0x5899f2(0x225)]()['includes']('etimedout'),_0xf930f1=_0x2f63d3['finish']?.[_0x5899f2(0x244)]?.[_0x5899f2(0x201)],_0x2832ef=_0x2f63d3[_0x5899f2(0x214)][0x0];reportMorphError({'error_message':_0x4d326c,'error_type':_0x1bc0eb?'TimeoutError':_0x2832ef?.[_0x5899f2(0x29b)]?.[_0x5899f2(0x1b1)]||_0x5899f2(0x245),'context':{'tool':_0x5899f2(0x1f5),'repo_path':_0x1ef080[_0x5899f2(0x2b9)]['repo_path'],'query':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x2ca)],'model':_0x5899f2(0x1ff),'termination_reason':_0x2f63d3[_0x5899f2(0x1ba)],'error_count':_0x2f63d3[_0x5899f2(0x214)][_0x5899f2(0x1c7)],'is_timeout':_0x1bc0eb,'timings':_0x2f63d3[_0x5899f2(0x27d)],'files_attempted':_0xf930f1?.[_0x5899f2(0x215)](_0x5ed6c2=>({'path':_0x5ed6c2['path'],'lines':_0x5ed6c2[_0x5899f2(0x2b0)]})),'tool_calls':_0x3f2a55(_0x2f63d3[_0x5899f2(0x2b1)]),'messages':_0x2f63d3[_0x5899f2(0x2b1)]?.[_0x5899f2(0x215)](_0x1a8d2d=>({'role':_0x1a8d2d[_0x5899f2(0x1ee)],'content':_0x1a8d2d[_0x5899f2(0x2ae)]})),'request_content':{'query':_0x1ef080[_0x5899f2(0x2b9)]['search_string'],'repo_path':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x208)],'repoRoot':a0_0x3c2000[_0x5899f2(0x20b)](_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x208)]),'model':_0x5899f2(0x1ff)}},'stack_trace':_0x2832ef?.[_0x5899f2(0x22e)]||undefined,'source':_0x5899f2(0x269)})['catch'](()=>{});}else _0x3e0425=_0x5899f2(0x212);}return{'content':[{'type':_0x5899f2(0x250),'text':_0x3e0425}]};}catch(_0x474a4f){const _0x2db4ae=_0x474a4f instanceof Error?_0x474a4f[_0x5899f2(0x1cf)]:String(_0x474a4f),_0x221f84=_0x2db4ae['toLowerCase']()[_0x5899f2(0x289)](_0x5899f2(0x238))||_0x2db4ae[_0x5899f2(0x225)]()['includes']('timed\x20out')||_0x2db4ae['toLowerCase']()[_0x5899f2(0x289)]('etimedout')||_0x474a4f instanceof Error&&_0x474a4f['name']===_0x5899f2(0x23d);return reportMorphError({'error_message':_0x2db4ae,'error_type':_0x221f84?_0x5899f2(0x23d):_0x474a4f instanceof Error?_0x474a4f[_0x5899f2(0x29b)][_0x5899f2(0x1b1)]:_0x5899f2(0x1df),'context':{'tool':_0x5899f2(0x1f5),'repo_path':_0x1ef080['data'][_0x5899f2(0x208)],'query':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x2ca)],'model':'morph-warp-grep-v1-1111v0','is_timeout':_0x221f84,'exception_phase':_0x5899f2(0x243),'request_content':{'query':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x2ca)],'repo_path':_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x208)],'repoRoot':a0_0x3c2000['resolve'](_0x1ef080[_0x5899f2(0x2b9)][_0x5899f2(0x208)]),'model':_0x5899f2(0x1ff)}},'stack_trace':_0x474a4f instanceof Error?_0x474a4f[_0x5899f2(0x22e)]:undefined,'source':_0x5899f2(0x269)})[_0x5899f2(0x280)](()=>{}),{'content':[{'type':_0x5899f2(0x250),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x2db4ae}],'isError':![]};}}case _0x5899f2(0x292):{const _0x48184a=WarpGrepGitHubArgsSchema[_0x5899f2(0x23c)](_0x4c9bb1);if(!_0x48184a['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x48184a[_0x5899f2(0x20c)]}],'isError':!![]};const _0x2a180d=MORPH_API_KEY;if(!_0x2a180d)throw new Error(_0x5899f2(0x2d1));const _0x40f269=Date[_0x5899f2(0x260)]();console['error'](_0x5899f2(0x228)+_0x48184a['data'][_0x5899f2(0x23a)]+_0x5899f2(0x2d3)+_0x48184a[_0x5899f2(0x2b9)]['search_string']+'\x22');try{const _0x45d79e=new WarpGrepClient({'morphApiKey':_0x2a180d,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4d7d03=await _0x45d79e[_0x5899f2(0x233)]({'query':_0x48184a[_0x5899f2(0x2b9)][_0x5899f2(0x2ca)],'github':_0x48184a['data'][_0x5899f2(0x23a)],'branch':_0x48184a[_0x5899f2(0x2b9)][_0x5899f2(0x264)]}),_0x26a016=Date['now']()-_0x40f269;console[_0x5899f2(0x20c)](_0x5899f2(0x1f7)+_0x26a016+_0x5899f2(0x27a)+_0x4d7d03[_0x5899f2(0x22d)]);const _0x2c7f66=formatResult(_0x4d7d03);return{'content':[{'type':'text','text':_0x2c7f66}]};}catch(_0x33fffe){const _0x34da35=Date[_0x5899f2(0x260)]()-_0x40f269,_0x55f8e4=_0x33fffe instanceof Error?_0x33fffe[_0x5899f2(0x1cf)]:String(_0x33fffe);return console[_0x5899f2(0x20c)](_0x5899f2(0x296)+_0x34da35+_0x5899f2(0x21f),_0x55f8e4),reportMorphError({'error_message':_0x55f8e4,'error_type':_0x33fffe instanceof Error?_0x33fffe[_0x5899f2(0x29b)]['name']:'UnknownError','context':{'tool':_0x5899f2(0x292),'github_url':_0x48184a[_0x5899f2(0x2b9)][_0x5899f2(0x23a)],'search_string':_0x48184a[_0x5899f2(0x2b9)]['search_string'],'branch':_0x48184a['data'][_0x5899f2(0x264)]},'stack_trace':_0x33fffe instanceof Error?_0x33fffe['stack']:undefined,'source':_0x5899f2(0x269),'tool':_0x5899f2(0x292),'latency_ms':_0x34da35})['catch'](()=>{}),{'content':[{'type':'text','text':_0x5899f2(0x2b7)+_0x55f8e4}],'isError':![]};}}case _0x5899f2(0x241):{const _0x597b8e=CodebaseSearchArgsSchema[_0x5899f2(0x23c)](_0x4c9bb1);if(!_0x597b8e[_0x5899f2(0x22d)])return{'content':[{'type':_0x5899f2(0x250),'text':_0x5899f2(0x234)+_0x597b8e['error']}],'isError':!![]};try{const _0x11c4ae=MORPH_API_KEY;if(!_0x11c4ae)throw new Error(_0x5899f2(0x22a));const _0x21ec5a=_0x597b8e[_0x5899f2(0x2b9)]['targetDirectories'],_0x24cc53=await executeCodebaseSearch({'query':_0x597b8e[_0x5899f2(0x2b9)]['query'],'target_directories':_0x21ec5a,'limit':_0x597b8e[_0x5899f2(0x2b9)][_0x5899f2(0x275)]},{'apiKey':_0x11c4ae,'repoId':_0x597b8e[_0x5899f2(0x2b9)][_0x5899f2(0x26b)],'branch':_0x597b8e[_0x5899f2(0x2b9)][_0x5899f2(0x264)],'commitHash':_0x597b8e[_0x5899f2(0x2b9)][_0x5899f2(0x21d)],'debug':![]});if(!_0x24cc53[_0x5899f2(0x22d)])return{'content':[{'type':'text','text':'Search\x20failed:\x20'+_0x24cc53[_0x5899f2(0x20c)]}],'isError':!![]};const _0x5979a3=_0x24cc53['results'][_0x5899f2(0x1c7)]===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x597b8e[_0x5899f2(0x2b9)]['query']+'\x22':_0x5899f2(0x1fa)+_0x24cc53[_0x5899f2(0x1fe)]['length']+_0x5899f2(0x263)+_0x24cc53[_0x5899f2(0x1dc)]['searchTimeMs']+_0x5899f2(0x285)+_0x24cc53[_0x5899f2(0x1fe)][_0x5899f2(0x215)]((_0x262dda,_0x46757c)=>_0x46757c+0x1+'.\x20'+_0x262dda[_0x5899f2(0x29c)]+'\x20('+(_0x262dda[_0x5899f2(0x29f)]*0x64)[_0x5899f2(0x1c8)](0x1)+'%\x20match)\x0a'+(_0x5899f2(0x227)+_0x262dda[_0x5899f2(0x28b)]+'-'+_0x262dda[_0x5899f2(0x24a)]+'\x0a')+(_0x5899f2(0x206)+_0x262dda['content'][_0x5899f2(0x288)](0x0,0xc8)+(_0x262dda[_0x5899f2(0x2ae)]['length']>0xc8?_0x5899f2(0x1bd):'')+'\x0a'))[_0x5899f2(0x261)]('\x0a');return{'content':[{'type':'text','text':_0x5979a3}]};}catch(_0x38e4b0){const _0x4e8f27=_0x38e4b0 instanceof Error?_0x38e4b0[_0x5899f2(0x1cf)]:String(_0x38e4b0);return reportMorphError({'error_message':_0x4e8f27,'error_type':_0x38e4b0 instanceof Error?_0x38e4b0[_0x5899f2(0x29b)][_0x5899f2(0x1b1)]:'UnknownError','context':{'tool':_0x5899f2(0x241),'query':_0x597b8e['data']['query'],'repo_id':_0x597b8e[_0x5899f2(0x2b9)]['repoId'],'target_directories':_0x597b8e['data'][_0x5899f2(0x281)]},'stack_trace':_0x38e4b0 instanceof Error?_0x38e4b0[_0x5899f2(0x22e)]:undefined,'source':_0x5899f2(0x269)})[_0x5899f2(0x280)](()=>{}),{'content':[{'type':_0x5899f2(0x250),'text':_0x5899f2(0x290)+_0x4e8f27}],'isError':!![]};}}default:throw new Error(_0x5899f2(0x2a1)+_0x4ee7c6);}}catch(_0x256153){const _0x1a8853=_0x256153 instanceof Error?_0x256153['message']:String(_0x256153);return reportMorphError({'error_message':_0x1a8853,'error_type':_0x256153 instanceof Error?_0x256153[_0x5899f2(0x29b)]['name']:_0x5899f2(0x1df),'context':{'tool':name,'arguments':args?JSON[_0x5899f2(0x258)](args)[_0x5899f2(0x288)](0x0,0x1f4):undefined,'mcp_server_version':_0x5899f2(0x2c1)},'stack_trace':_0x256153 instanceof Error?_0x256153['stack']:undefined,'source':_0x5899f2(0x269)})['catch'](()=>{}),{'content':[{'type':_0x5899f2(0x250),'text':_0x5899f2(0x290)+_0x1a8853}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4540ea){const _0xceaa87=a0_0x514987,_0x575fb5=await getValidRootDirectories(_0x4540ea);if(_0x575fb5[_0xceaa87(0x1c7)]>0x0)allowedDirectories=[..._0x575fb5],console[_0xceaa87(0x20c)](_0xceaa87(0x274)+_0x575fb5['length']+_0xceaa87(0x22f));else{console[_0xceaa87(0x20c)](_0xceaa87(0x1f0));if(ENABLE_WORKSPACE_MODE)try{const _0xa8521d=await detectWorkspaceRoot(WORKSPACE_ROOT);_0xa8521d&&(allowedDirectories=[_0xa8521d],console[_0xceaa87(0x20c)](_0xceaa87(0x255)+_0xa8521d));}catch(_0x2b4c40){console[_0xceaa87(0x20c)](_0xceaa87(0x26f)+_0x2b4c40);}}}server[a0_0x514987(0x2bf)](RootsListChangedNotificationSchema,async()=>{const _0x34387e=a0_0x514987;try{const _0x14b951=await server[_0x34387e(0x205)]();_0x14b951&&_0x34387e(0x219)in _0x14b951&&await updateAllowedDirectoriesFromRoots(_0x14b951[_0x34387e(0x219)]);}catch(_0x1ba307){console[_0x34387e(0x20c)]('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x1ba307 instanceof Error?_0x1ba307['message']:String(_0x1ba307));}}),server[a0_0x514987(0x1e5)]=async()=>{const _0x1d31ee=a0_0x514987,_0x2c9d5d=server[_0x1d31ee(0x287)]();if(_0x2c9d5d?.['roots'])try{const _0x255282=await server[_0x1d31ee(0x205)]();_0x255282&&_0x1d31ee(0x219)in _0x255282?await updateAllowedDirectoriesFromRoots(_0x255282['roots']):console[_0x1d31ee(0x20c)](_0x1d31ee(0x21b));}catch(_0x4007a2){console[_0x1d31ee(0x20c)](_0x1d31ee(0x1e7),_0x4007a2 instanceof Error?_0x4007a2[_0x1d31ee(0x1cf)]:String(_0x4007a2));}else{if(allowedDirectories[_0x1d31ee(0x1c7)]>0x0)console['error'](_0x1d31ee(0x2d9),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console['error'](_0x1d31ee(0x213));else throw new Error(_0x1d31ee(0x2c5));}}};async function runServer(){const _0x225032=a0_0x514987,_0x277a83=new StdioServerTransport();await server[_0x225032(0x298)](_0x277a83),console['error'](_0x225032(0x24f)),allowedDirectories[_0x225032(0x1c7)]===0x0&&console[_0x225032(0x20c)]('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x514987(0x280)](_0x16671c=>{const _0x22f074=a0_0x514987;console[_0x22f074(0x20c)]('Fatal\x20error\x20running\x20server:',_0x16671c),process[_0x22f074(0x2cf)](0x1);});
@@ -1 +1 @@
1
- (function(_0x4b7e42,_0x470857){const _0x109907=a1_0x2d03,_0x52c9c1=_0x4b7e42();while(!![]){try{const _0x34c4d5=-parseInt(_0x109907(0x13a))/0x1*(-parseInt(_0x109907(0x149))/0x2)+parseInt(_0x109907(0x146))/0x3*(-parseInt(_0x109907(0x147))/0x4)+parseInt(_0x109907(0x143))/0x5*(-parseInt(_0x109907(0x142))/0x6)+parseInt(_0x109907(0x139))/0x7*(parseInt(_0x109907(0x132))/0x8)+-parseInt(_0x109907(0x138))/0x9*(parseInt(_0x109907(0x133))/0xa)+parseInt(_0x109907(0x14a))/0xb+parseInt(_0x109907(0x135))/0xc*(-parseInt(_0x109907(0x13e))/0xd);if(_0x34c4d5===_0x470857)break;else _0x52c9c1['push'](_0x52c9c1['shift']());}catch(_0x4a58c4){_0x52c9c1['push'](_0x52c9c1['shift']());}}}(a1_0x2136,0xdfd80));import a1_0x1e4475 from'path';import a1_0x301650 from'os';function a1_0x2d03(_0x193910,_0x1d6f76){_0x193910=_0x193910-0x132;const _0x21364d=a1_0x2136();let _0x2d0350=_0x21364d[_0x193910];return _0x2d0350;}export function convertToWindowsPath(_0x2d1b03){const _0x49be38=a1_0x2d03;if(_0x2d1b03[_0x49be38(0x13c)](_0x49be38(0x13b))){const _0x31fdf7=_0x2d1b03[_0x49be38(0x140)](0x5)['toUpperCase'](),_0x425ab9=_0x2d1b03['slice'](0x6)[_0x49be38(0x13f)](/\//g,'\x5c');return _0x31fdf7+':'+_0x425ab9;}if(_0x2d1b03[_0x49be38(0x141)](/^\/[a-zA-Z]\//)){const _0xb63525=_0x2d1b03[_0x49be38(0x140)](0x1)[_0x49be38(0x134)](),_0x5a308a=_0x2d1b03['slice'](0x2)['replace'](/\//g,'\x5c');return _0xb63525+':'+_0x5a308a;}if(_0x2d1b03['match'](/^[a-zA-Z]:/))return _0x2d1b03[_0x49be38(0x13f)](/\//g,'\x5c');return _0x2d1b03;}function a1_0x2136(){const _0x2fcba5=['24hJHdbn','20EwBcQe','toUpperCase','1069368BVwawo','join','normalize','2287305EXyUHy','4266052vagdky','47QzwMsr','/mnt/','startsWith','trim','39JXOJNN','replace','charAt','match','492pLYuhB','43620eaDQCn','substring','slice','4742625YuFKiZ','4ZUPAvK','homedir','33674exWkfN','15060012VmXcQJ'];a1_0x2136=function(){return _0x2fcba5;};return a1_0x2136();}export function normalizePath(_0x2e3b04){const _0x44939c=a1_0x2d03;_0x2e3b04=_0x2e3b04[_0x44939c(0x13d)]()[_0x44939c(0x13f)](/^["']|["']$/g,'');const _0x1f40e7=_0x2e3b04[_0x44939c(0x13c)]('/')&&!_0x2e3b04[_0x44939c(0x141)](/^\/mnt\/[a-z]\//i)&&!_0x2e3b04[_0x44939c(0x141)](/^\/[a-zA-Z]\//);if(_0x1f40e7)return _0x2e3b04[_0x44939c(0x13f)](/\/+/g,'/')[_0x44939c(0x13f)](/\/+$/,'');_0x2e3b04=convertToWindowsPath(_0x2e3b04);if(_0x2e3b04['startsWith']('\x5c\x5c')){let _0x55be79=_0x2e3b04;_0x55be79=_0x55be79[_0x44939c(0x13f)](/^\\{2,}/,'\x5c\x5c');const _0x39b998=_0x55be79[_0x44939c(0x144)](0x2)[_0x44939c(0x13f)](/\\\\/g,'\x5c');_0x2e3b04='\x5c\x5c'+_0x39b998;}else _0x2e3b04=_0x2e3b04[_0x44939c(0x13f)](/\\\\/g,'\x5c');let _0x1b3f74=a1_0x1e4475[_0x44939c(0x137)](_0x2e3b04);_0x2e3b04[_0x44939c(0x13c)]('\x5c\x5c')&&!_0x1b3f74[_0x44939c(0x13c)]('\x5c\x5c')&&(_0x1b3f74='\x5c'+_0x1b3f74);if(_0x1b3f74[_0x44939c(0x141)](/^[a-zA-Z]:/)){let _0x47802d=_0x1b3f74[_0x44939c(0x13f)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x47802d)&&(_0x47802d=_0x47802d[_0x44939c(0x140)](0x0)[_0x44939c(0x134)]()+_0x47802d[_0x44939c(0x145)](0x1)),_0x47802d;}return _0x1b3f74[_0x44939c(0x13f)](/\//g,'\x5c');}export function expandHome(_0x1d1622){const _0x452c0b=a1_0x2d03;if(_0x1d1622[_0x452c0b(0x13c)]('~/')||_0x1d1622==='~')return a1_0x1e4475[_0x452c0b(0x136)](a1_0x301650[_0x452c0b(0x148)](),_0x1d1622['slice'](0x1));return _0x1d1622;}
1
+ (function(_0xcdeafb,_0x7ed588){const _0x3793a9=a1_0x44c2,_0x1e85f6=_0xcdeafb();while(!![]){try{const _0x5e8030=parseInt(_0x3793a9(0x133))/0x1*(parseInt(_0x3793a9(0x136))/0x2)+-parseInt(_0x3793a9(0x131))/0x3*(-parseInt(_0x3793a9(0x13f))/0x4)+-parseInt(_0x3793a9(0x12b))/0x5+parseInt(_0x3793a9(0x12d))/0x6+-parseInt(_0x3793a9(0x12f))/0x7*(-parseInt(_0x3793a9(0x137))/0x8)+-parseInt(_0x3793a9(0x138))/0x9+parseInt(_0x3793a9(0x130))/0xa;if(_0x5e8030===_0x7ed588)break;else _0x1e85f6['push'](_0x1e85f6['shift']());}catch(_0x32eee5){_0x1e85f6['push'](_0x1e85f6['shift']());}}}(a1_0x4e1a,0x300c6));function a1_0x4e1a(){const _0x385345=['charAt','268KZFdbl','8NTMAYd','1539027xPxTHA','join','slice','match','toUpperCase','startsWith','substring','8gVNwmT','normalize','1965575XfHdKK','test','567072gNVCTf','replace','1250200Adnyfz','640520yVOHNu','202887WvXITU','trim','2153YssRGW','homedir'];a1_0x4e1a=function(){return _0x385345;};return a1_0x4e1a();}import a1_0x38561e from'path';function a1_0x44c2(_0x4b63d4,_0x42cdb3){_0x4b63d4=_0x4b63d4-0x12a;const _0x4e1aef=a1_0x4e1a();let _0x44c23e=_0x4e1aef[_0x4b63d4];return _0x44c23e;}import a1_0x2a2f98 from'os';export function convertToWindowsPath(_0x551622){const _0x2bc2b2=a1_0x44c2;if(_0x551622['startsWith']('/mnt/')){const _0x5e7452=_0x551622[_0x2bc2b2(0x135)](0x5)[_0x2bc2b2(0x13c)](),_0x4a267d=_0x551622[_0x2bc2b2(0x13a)](0x6)[_0x2bc2b2(0x12e)](/\//g,'\x5c');return _0x5e7452+':'+_0x4a267d;}if(_0x551622['match'](/^\/[a-zA-Z]\//)){const _0x53795=_0x551622[_0x2bc2b2(0x135)](0x1)[_0x2bc2b2(0x13c)](),_0x557c18=_0x551622[_0x2bc2b2(0x13a)](0x2)[_0x2bc2b2(0x12e)](/\//g,'\x5c');return _0x53795+':'+_0x557c18;}if(_0x551622[_0x2bc2b2(0x13b)](/^[a-zA-Z]:/))return _0x551622[_0x2bc2b2(0x12e)](/\//g,'\x5c');return _0x551622;}export function normalizePath(_0x561fc2){const _0x8d7522=a1_0x44c2;_0x561fc2=_0x561fc2[_0x8d7522(0x132)]()[_0x8d7522(0x12e)](/^["']|["']$/g,'');const _0xbfc284=_0x561fc2[_0x8d7522(0x13d)]('/')&&!_0x561fc2[_0x8d7522(0x13b)](/^\/mnt\/[a-z]\//i)&&!_0x561fc2['match'](/^\/[a-zA-Z]\//);if(_0xbfc284)return _0x561fc2[_0x8d7522(0x12e)](/\/+/g,'/')[_0x8d7522(0x12e)](/\/+$/,'');_0x561fc2=convertToWindowsPath(_0x561fc2);if(_0x561fc2[_0x8d7522(0x13d)]('\x5c\x5c')){let _0x93ddec=_0x561fc2;_0x93ddec=_0x93ddec[_0x8d7522(0x12e)](/^\\{2,}/,'\x5c\x5c');const _0x388758=_0x93ddec[_0x8d7522(0x13e)](0x2)['replace'](/\\\\/g,'\x5c');_0x561fc2='\x5c\x5c'+_0x388758;}else _0x561fc2=_0x561fc2[_0x8d7522(0x12e)](/\\\\/g,'\x5c');let _0x1faac0=a1_0x38561e[_0x8d7522(0x12a)](_0x561fc2);_0x561fc2[_0x8d7522(0x13d)]('\x5c\x5c')&&!_0x1faac0[_0x8d7522(0x13d)]('\x5c\x5c')&&(_0x1faac0='\x5c'+_0x1faac0);if(_0x1faac0[_0x8d7522(0x13b)](/^[a-zA-Z]:/)){let _0x524f74=_0x1faac0[_0x8d7522(0x12e)](/\//g,'\x5c');return/^[a-z]:/[_0x8d7522(0x12c)](_0x524f74)&&(_0x524f74=_0x524f74[_0x8d7522(0x135)](0x0)[_0x8d7522(0x13c)]()+_0x524f74['slice'](0x1)),_0x524f74;}return _0x1faac0[_0x8d7522(0x12e)](/\//g,'\x5c');}export function expandHome(_0x5a5e4e){const _0x4a9287=a1_0x44c2;if(_0x5a5e4e['startsWith']('~/')||_0x5a5e4e==='~')return a1_0x38561e[_0x4a9287(0x139)](a1_0x2a2f98[_0x4a9287(0x134)](),_0x5a5e4e['slice'](0x1));return _0x5a5e4e;}
@@ -1 +1 @@
1
- function a2_0x3425(){const _0x5bea74=['includes','resolve','175bLhkDO','isArray','startsWith','433183pFidPs','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','3795520vfolpL','sep','3MzBWvQ','5338684MHqKgK','6695136gSQPMt','isAbsolute','18438BqSnWH','1752976WbrGkU','normalize','2508246uoLWVU'];a2_0x3425=function(){return _0x5bea74;};return a2_0x3425();}(function(_0x5b8e69,_0x2b432a){const _0x313f5e=a2_0x3d2e,_0x2d9785=_0x5b8e69();while(!![]){try{const _0x2cab54=parseInt(_0x313f5e(0x142))/0x1+-parseInt(_0x313f5e(0x13a))/0x2+parseInt(_0x313f5e(0x146))/0x3*(parseInt(_0x313f5e(0x147))/0x4)+-parseInt(_0x313f5e(0x144))/0x5+-parseInt(_0x313f5e(0x139))/0x6*(-parseInt(_0x313f5e(0x13f))/0x7)+parseInt(_0x313f5e(0x148))/0x8+-parseInt(_0x313f5e(0x13c))/0x9;if(_0x2cab54===_0x2b432a)break;else _0x2d9785['push'](_0x2d9785['shift']());}catch(_0x310a33){_0x2d9785['push'](_0x2d9785['shift']());}}}(a2_0x3425,0xbb535));import a2_0x27feaf from'path';function a2_0x3d2e(_0x4d05bd,_0x1d62d0){_0x4d05bd=_0x4d05bd-0x138;const _0x342530=a2_0x3425();let _0x3d2e96=_0x342530[_0x4d05bd];return _0x3d2e96;}export function isPathWithinAllowedDirectories(_0x15911d,_0x177965){const _0x1702aa=a2_0x3d2e;if(typeof _0x15911d!=='string'||!Array[_0x1702aa(0x140)](_0x177965))return![];if(!_0x15911d||_0x177965['length']===0x0)return![];if(_0x15911d[_0x1702aa(0x13d)]('\x00'))return![];let _0xf52278;try{_0xf52278=a2_0x27feaf[_0x1702aa(0x13e)](a2_0x27feaf[_0x1702aa(0x13b)](_0x15911d));}catch{return![];}if(!a2_0x27feaf[_0x1702aa(0x138)](_0xf52278))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x177965['some'](_0x2aa806=>{const _0x3cc9f5=_0x1702aa;if(typeof _0x2aa806!=='string'||!_0x2aa806)return![];if(_0x2aa806[_0x3cc9f5(0x13d)]('\x00'))return![];let _0x2c5495;try{_0x2c5495=a2_0x27feaf[_0x3cc9f5(0x13e)](a2_0x27feaf[_0x3cc9f5(0x13b)](_0x2aa806));}catch{return![];}if(!a2_0x27feaf['isAbsolute'](_0x2c5495))throw new Error(_0x3cc9f5(0x143));if(_0xf52278===_0x2c5495)return!![];if(_0x2c5495===a2_0x27feaf['sep'])return _0xf52278[_0x3cc9f5(0x141)](a2_0x27feaf[_0x3cc9f5(0x145)]);return _0xf52278[_0x3cc9f5(0x141)](_0x2c5495+a2_0x27feaf[_0x3cc9f5(0x145)]);});}
1
+ function a2_0x4017(){const _0x49bbe9=['some','3272248nljPaN','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','571541SBwrJf','Path\x20must\x20be\x20absolute\x20after\x20normalization','9045248HdbEme','357039hGHUMA','string','isArray','5KouDGN','133114TdIpAu','isAbsolute','931840TuFrNN','normalize','6089604wIRyka','length','includes','startsWith'];a2_0x4017=function(){return _0x49bbe9;};return a2_0x4017();}(function(_0x1bf5e8,_0x16e16e){const _0x14ea95=a2_0x417c,_0x340f88=_0x1bf5e8();while(!![]){try{const _0x4aecd9=-parseInt(_0x14ea95(0x1bf))/0x1+-parseInt(_0x14ea95(0x1c6))/0x2+parseInt(_0x14ea95(0x1c2))/0x3+parseInt(_0x14ea95(0x1bc))/0x4*(parseInt(_0x14ea95(0x1c5))/0x5)+-parseInt(_0x14ea95(0x1b7))/0x6+parseInt(_0x14ea95(0x1c8))/0x7+parseInt(_0x14ea95(0x1c1))/0x8;if(_0x4aecd9===_0x16e16e)break;else _0x340f88['push'](_0x340f88['shift']());}catch(_0x18ff84){_0x340f88['push'](_0x340f88['shift']());}}}(a2_0x4017,0x85beb));function a2_0x417c(_0x1dabd5,_0x4a18d2){_0x1dabd5=_0x1dabd5-0x1b6;const _0x4017cc=a2_0x4017();let _0x417cfe=_0x4017cc[_0x1dabd5];return _0x417cfe;}import a2_0x89292f from'path';export function isPathWithinAllowedDirectories(_0x483144,_0x5d2a37){const _0x581b6f=a2_0x417c;if(typeof _0x483144!=='string'||!Array[_0x581b6f(0x1c4)](_0x5d2a37))return![];if(!_0x483144||_0x5d2a37[_0x581b6f(0x1b8)]===0x0)return![];if(_0x483144[_0x581b6f(0x1b9)]('\x00'))return![];let _0x2524c2;try{_0x2524c2=a2_0x89292f['resolve'](a2_0x89292f[_0x581b6f(0x1b6)](_0x483144));}catch{return![];}if(!a2_0x89292f[_0x581b6f(0x1c7)](_0x2524c2))throw new Error(_0x581b6f(0x1c0));return _0x5d2a37[_0x581b6f(0x1bb)](_0x529ed3=>{const _0x390a6a=_0x581b6f;if(typeof _0x529ed3!==_0x390a6a(0x1c3)||!_0x529ed3)return![];if(_0x529ed3[_0x390a6a(0x1b9)]('\x00'))return![];let _0x43ac9a;try{_0x43ac9a=a2_0x89292f['resolve'](a2_0x89292f['normalize'](_0x529ed3));}catch{return![];}if(!a2_0x89292f[_0x390a6a(0x1c7)](_0x43ac9a))throw new Error(_0x390a6a(0x1bd));if(_0x2524c2===_0x43ac9a)return!![];if(_0x43ac9a===a2_0x89292f['sep'])return _0x2524c2[_0x390a6a(0x1ba)](a2_0x89292f[_0x390a6a(0x1be)]);return _0x2524c2[_0x390a6a(0x1ba)](_0x43ac9a+a2_0x89292f['sep']);});}
@@ -1 +1 @@
1
- (function(_0x27ec02,_0x256a22){const _0x541017=a3_0x56ff,_0x405a3b=_0x27ec02();while(!![]){try{const _0x277473=-parseInt(_0x541017(0x1e9))/0x1+parseInt(_0x541017(0x1e2))/0x2+parseInt(_0x541017(0x1eb))/0x3+parseInt(_0x541017(0x1db))/0x4+-parseInt(_0x541017(0x1e8))/0x5+-parseInt(_0x541017(0x1e0))/0x6*(parseInt(_0x541017(0x1df))/0x7)+-parseInt(_0x541017(0x1e6))/0x8*(-parseInt(_0x541017(0x1ef))/0x9);if(_0x277473===_0x256a22)break;else _0x405a3b['push'](_0x405a3b['shift']());}catch(_0x3a9ee5){_0x405a3b['push'](_0x405a3b['shift']());}}}(a3_0x1942,0x61c32));import{promises as a3_0x39b7e8}from'fs';import a3_0x5e3011 from'path';import a3_0x5c7948 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x5a6622){const _0x2760dd=a3_0x56ff;try{const _0x4bb7e3=_0x5a6622[_0x2760dd(0x1d9)]('file://')?_0x5a6622[_0x2760dd(0x1da)](0x7):_0x5a6622,_0x14b68f=_0x4bb7e3[_0x2760dd(0x1d9)]('~/')||_0x4bb7e3==='~'?a3_0x5e3011[_0x2760dd(0x1ee)](a3_0x5c7948[_0x2760dd(0x1dd)](),_0x4bb7e3[_0x2760dd(0x1da)](0x1)):_0x4bb7e3,_0x1525c3=a3_0x5e3011[_0x2760dd(0x1ea)](_0x14b68f),_0x236676=await a3_0x39b7e8[_0x2760dd(0x1e5)](_0x1525c3);return normalizePath(_0x236676);}catch{return null;}}function formatDirectoryError(_0x4b5f94,_0x3c03c2,_0x51567a){const _0x15ad44=a3_0x56ff;if(_0x51567a)return _0x15ad44(0x1de)+_0x51567a+':\x20'+_0x4b5f94;const _0x2495ff=_0x3c03c2 instanceof Error?_0x3c03c2[_0x15ad44(0x1e3)]:String(_0x3c03c2);return'Skipping\x20invalid\x20directory:\x20'+_0x4b5f94+_0x15ad44(0x1e4)+_0x2495ff;}function a3_0x56ff(_0x52ca9e,_0x4d971a){_0x52ca9e=_0x52ca9e-0x1d9;const _0x19420c=a3_0x1942();let _0x56ff99=_0x19420c[_0x52ca9e];return _0x56ff99;}function a3_0x1942(){const _0xc04d32=['error','uri','join','9BhLZDJ','startsWith','slice','339968PShxdp','push','homedir','Skipping\x20','53928EtFBlK','390basmEQ','invalid\x20path\x20or\x20inaccessible','1404668tpqgyX','message','\x20due\x20to\x20error:\x20','realpath','4920392XNfqLp','stat','1173660ZQkrOQ','519434KDNqVm','resolve','758955jgnswE'];a3_0x1942=function(){return _0xc04d32;};return a3_0x1942();}export async function getValidRootDirectories(_0x6c5fbb){const _0xc2c847=a3_0x56ff,_0x3d6580=[];for(const _0x192dfd of _0x6c5fbb){const _0x2ef340=await parseRootUri(_0x192dfd['uri']);if(!_0x2ef340){console[_0xc2c847(0x1ec)](formatDirectoryError(_0x192dfd[_0xc2c847(0x1ed)],undefined,_0xc2c847(0x1e1)));continue;}try{const _0x233cad=await a3_0x39b7e8[_0xc2c847(0x1e7)](_0x2ef340);_0x233cad['isDirectory']()?_0x3d6580[_0xc2c847(0x1dc)](_0x2ef340):console[_0xc2c847(0x1ec)](formatDirectoryError(_0x2ef340,undefined,'non-directory\x20root'));}catch(_0x160be4){console[_0xc2c847(0x1ec)](formatDirectoryError(_0x2ef340,_0x160be4));}}return _0x3d6580;}
1
+ (function(_0x3be589,_0x3e68a6){const _0x27ed58=a3_0x15ca,_0x84c50d=_0x3be589();while(!![]){try{const _0x4f79c0=parseInt(_0x27ed58(0x1e9))/0x1*(-parseInt(_0x27ed58(0x1d6))/0x2)+-parseInt(_0x27ed58(0x1e0))/0x3+-parseInt(_0x27ed58(0x1d5))/0x4*(-parseInt(_0x27ed58(0x1d8))/0x5)+parseInt(_0x27ed58(0x1e5))/0x6+-parseInt(_0x27ed58(0x1eb))/0x7+parseInt(_0x27ed58(0x1ee))/0x8+-parseInt(_0x27ed58(0x1e3))/0x9*(-parseInt(_0x27ed58(0x1da))/0xa);if(_0x4f79c0===_0x3e68a6)break;else _0x84c50d['push'](_0x84c50d['shift']());}catch(_0x10e319){_0x84c50d['push'](_0x84c50d['shift']());}}}(a3_0x229c,0x2ce83));import{promises as a3_0x24df6e}from'fs';import a3_0x6efa96 from'path';import a3_0x120efa from'os';import{normalizePath}from'./path-utils.js';function a3_0x229c(){const _0x233d73=['95754fmBLUH','startsWith','realpath','Skipping\x20invalid\x20directory:\x20','1DDpXIt','non-directory\x20root','911337oIgiEx','homedir','stat','394528KRrwvH','69104xIIfxN','612526EmAXwv','slice','95cVaJuH','file://','160670nrXFDo','Skipping\x20','message','resolve','push','\x20due\x20to\x20error:\x20','813609SatKQw','uri','invalid\x20path\x20or\x20inaccessible','279QZHCBk','error'];a3_0x229c=function(){return _0x233d73;};return a3_0x229c();}async function parseRootUri(_0x339908){const _0xb9aef6=a3_0x15ca;try{const _0xb1b5ef=_0x339908[_0xb9aef6(0x1e6)](_0xb9aef6(0x1d9))?_0x339908[_0xb9aef6(0x1d7)](0x7):_0x339908,_0x2e387f=_0xb1b5ef[_0xb9aef6(0x1e6)]('~/')||_0xb1b5ef==='~'?a3_0x6efa96['join'](a3_0x120efa[_0xb9aef6(0x1ec)](),_0xb1b5ef[_0xb9aef6(0x1d7)](0x1)):_0xb1b5ef,_0x47d024=a3_0x6efa96[_0xb9aef6(0x1dd)](_0x2e387f),_0x4743c0=await a3_0x24df6e[_0xb9aef6(0x1e7)](_0x47d024);return normalizePath(_0x4743c0);}catch{return null;}}function formatDirectoryError(_0x4fb0ca,_0x40df6f,_0xd73fbc){const _0x268118=a3_0x15ca;if(_0xd73fbc)return _0x268118(0x1db)+_0xd73fbc+':\x20'+_0x4fb0ca;const _0x434b40=_0x40df6f instanceof Error?_0x40df6f[_0x268118(0x1dc)]:String(_0x40df6f);return _0x268118(0x1e8)+_0x4fb0ca+_0x268118(0x1df)+_0x434b40;}function a3_0x15ca(_0x503d5c,_0x31a8ab){_0x503d5c=_0x503d5c-0x1d5;const _0x229c92=a3_0x229c();let _0x15cace=_0x229c92[_0x503d5c];return _0x15cace;}export async function getValidRootDirectories(_0x2a3359){const _0x1925f4=a3_0x15ca,_0x5c3e39=[];for(const _0x3930e0 of _0x2a3359){const _0x43c838=await parseRootUri(_0x3930e0[_0x1925f4(0x1e1)]);if(!_0x43c838){console['error'](formatDirectoryError(_0x3930e0[_0x1925f4(0x1e1)],undefined,_0x1925f4(0x1e2)));continue;}try{const _0x352265=await a3_0x24df6e[_0x1925f4(0x1ed)](_0x43c838);_0x352265['isDirectory']()?_0x5c3e39[_0x1925f4(0x1de)](_0x43c838):console['error'](formatDirectoryError(_0x43c838,undefined,_0x1925f4(0x1ea)));}catch(_0x382257){console[_0x1925f4(0x1e4)](formatDirectoryError(_0x43c838,_0x382257));}}return _0x5c3e39;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.106",
3
+ "version": "0.8.108",
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.125",
38
+ "@morphllm/morphsdk": "0.2.126",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",