@morphllm/morphmcp 0.8.117 → 0.8.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x4694d0=a0_0x565c;(function(_0x3c97c4,_0x530d43){const _0x1444a6=a0_0x565c,_0x1a8cd5=_0x3c97c4();while(!![]){try{const _0x5adb78=-parseInt(_0x1444a6(0x237))/0x1+-parseInt(_0x1444a6(0x2f8))/0x2+-parseInt(_0x1444a6(0x2d3))/0x3+parseInt(_0x1444a6(0x21b))/0x4+-parseInt(_0x1444a6(0x202))/0x5+-parseInt(_0x1444a6(0x2c6))/0x6*(-parseInt(_0x1444a6(0x228))/0x7)+parseInt(_0x1444a6(0x225))/0x8;if(_0x5adb78===_0x530d43)break;else _0x1a8cd5['push'](_0x1a8cd5['shift']());}catch(_0x5726a3){_0x1a8cd5['push'](_0x1a8cd5['shift']());}}}(a0_0x3d15,0x98add));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_0x4740ab from'fs/promises';import a0_0x245c9c from'path';import a0_0x2ca012 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';function a0_0x3d15(){const _0x1bab42=['Workspace\x20mode\x20enabled:\x20Using\x20','ENABLE_WORKSPACE_MODE','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','PWD','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','cwd','path','morph-','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','optional','BinaryFile','floor','includes','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','Natural\x20language\x20query\x20to\x20search\x20for\x20code','956288dzJOSN','pyproject.toml','</file>','map','search_string','api-key','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','match','Fatal\x20error\x20running\x20server:','read\x20','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','all','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','substring','has','For\x20deletions:\x0a','\x20as\x20allowed\x20directory','list_directory\x20','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','Error:\x20','some','grep','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','finish','GitHub\x20search\x20failed:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Max\x20results\x20to\x20return','Unknown\x20tool:\x20','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','\x20-\x20','unknown\x20error','stats','\x27\x20in\x20`','ms:\x0a\x0a','object',',\x20modified\x20','warpgrep_codebase_search','timed\x20out','UnknownError','\x0a</file>','2686925rULWgK','content','listRoots','.cursor','\x0a...\x20(truncated,\x20total:\x20','node_modules','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','isDirectory','runWarpGrep_call','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','toISOString','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','unknown','Rules:\x0a','env','ms.\x20Success:\x20','role','log','@morphllm/morphmcp\x20','array','terminated','boolean','\x20error(s)','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','2850096mPBglM','Search\x20failed:\x20','etimedout','timeout','instruction','MORPH_API_KEY','rerankScore','getClientCapabilities','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','14239784dnOqiW','toLowerCase','payload','1133447yQkJxe','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','No\x20results\x20found\x20for\x20query:\x20\x22','roots','\x0aOptions:','split','MORPH_API_URL','codebase_search','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','repo_path','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','utf-8','access','constructor','WarpGrepError','775624Lvvxsc','params','morph-v3-fast','mcp-filesystem','isArray','argv','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Invalid\x20arguments:\x20','Specific\x20commit\x20hash\x20to\x20search','setRequestHandler','linesModified','name','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','\x20for:\x20\x22','https://morphllm.com/api/error-report','data','files','repoId','code','assistant','completed_with_file_errors','Warning:\x20','user','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','basename','metadata','\x20is\x20not\x20a\x20directory','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','grep\x20\x27','RipgrepError','toFixed','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x22>\x0aError\x20reading\x20file:\x20','MORPH_WARP_GREP_TIMEOUT','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','errors','sep','commitHash','enum','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','code_edit','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','morph-mcp','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','github_url','\x20\x20morph-mcp','ENOENT','messages','describe','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','default','now','dirname','lines','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','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\x20error','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','push','Morph\x20Edit\x20Preview','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Failed\x20to\x20request\x20roots\x20from\x20client:','ReadError','search_type','Cargo.toml','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','stat','RipgrepNotAvailable','realpath','0.2.0','application/json','source','edit_file','Benefits:\x0a','../package.json','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','inputSchema','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','string','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','FileReadError','Bearer\x20','slice','composer.json','-\x20Read\x20file\x20`','TimeoutError','Here\x20is\x20the\x20content\x20of\x20files:\x0a','...','FileNotFound','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','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','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.','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','version','Error\x20running\x20fast\x20context\x20search:\x20','catch','success','endLine','read','\x20chars)','Found\x20','exit','readFile','--api-key=','Applied','searchGitHub','\x20\x20\x20Lines\x20','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','message','ToolException','requiresApiKey','tsconfig.json','join','\x20(new\x20file)','ms:','Repository\x20identifier','startsWith','false','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','warpgrep_github_search','number','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','SymlinkError','dryRun','linesRemoved','%\x20match)\x0a','error','SubToolError','timings','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20\x20\x20','<file\x20path=\x22','branch','text','startLine','Relevant\x20context\x20found:','terminationReason','\x20results\x20in\x20','36FmYroi','Morph\x20Edit\x20','query','safeParse','morph-warp-grep-v1-1111v0','every','stringify','min','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','description','sk-','3142491aKZnRU','resolve','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','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','connect','Preview\x20changes\x20without\x20applying\x20them.','.\x20Changes:\x20','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','stack','searchTimeMs','trim','length','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','filter','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','limit','.\x20Path:\x20','PathError','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','package.json','.vscode','WarpGrep\x20sub-tool\x20errors:\x20'];a0_0x3d15=function(){return _0x1bab42;};return a0_0x3d15();}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{executeCodebaseSearch}from'@morphllm/morphsdk/tools/codebase-search';import a0_0x18fc9c from'axios';function fixPathRepetition(_0x447c59){const _0x161585=a0_0x565c,_0x45b84e=_0x447c59[_0x161585(0x22d)](a0_0x245c9c[_0x161585(0x25c)])[_0x161585(0x2e0)](Boolean);if(_0x45b84e[_0x161585(0x2de)]<0x2)return null;for(let _0x248649=Math[_0x161585(0x2f4)](_0x45b84e[_0x161585(0x2de)]/0x2);_0x248649>=0x1;_0x248649--){for(let _0x4b91e4=0x0;_0x4b91e4<=_0x45b84e['length']-0x2*_0x248649;_0x4b91e4++){const _0x1b122f=_0x45b84e['slice'](_0x4b91e4,_0x4b91e4+_0x248649),_0x56de36=_0x45b84e[_0x161585(0x28d)](_0x4b91e4+_0x248649,_0x4b91e4+0x2*_0x248649);if(_0x1b122f[_0x161585(0x2cb)]((_0x276584,_0x283def)=>_0x276584===_0x56de36[_0x283def])){const _0x1cbafb=[..._0x45b84e[_0x161585(0x28d)](0x0,_0x4b91e4),..._0x45b84e[_0x161585(0x28d)](_0x4b91e4+_0x248649)];return a0_0x245c9c[_0x161585(0x25c)]+_0x1cbafb['join'](a0_0x245c9c[_0x161585(0x25c)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x156f22=a0_0x565c;try{const _0x1a42f5=require(_0x156f22(0x283));return _0x1a42f5[_0x156f22(0x299)]??_0x156f22(0x20f);}catch(_0x5b1f00){return console['error'](_0x156f22(0x2d5),_0x5b1f00),'unknown';}}function printHelp(){const _0x3e3ce0=a0_0x565c;console[_0x3e3ce0(0x214)](_0x3e3ce0(0x215)+getPackageVersion()),console[_0x3e3ce0(0x214)](_0x3e3ce0(0x271)),console[_0x3e3ce0(0x214)](_0x3e3ce0(0x22c)),console[_0x3e3ce0(0x214)](_0x3e3ce0(0x229)),console['log'](_0x3e3ce0(0x20e)),console[_0x3e3ce0(0x214)](_0x3e3ce0(0x23e)),console[_0x3e3ce0(0x214)]('\x0aExamples:'),console['log'](_0x3e3ce0(0x265)),console[_0x3e3ce0(0x214)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x4694d0(0x23c)]['slice'](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs['some'](_0x58bad3=>VERSION_FLAGS[a0_0x4694d0(0x1e8)](_0x58bad3))&&(console[a0_0x4694d0(0x214)]('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x4694d0(0x2a1)](0x0));cliArgs[a0_0x4694d0(0x1ee)](_0x3c4155=>HELP_FLAGS['has'](_0x3c4155))&&(printHelp(),process[a0_0x4694d0(0x2a1)](0x0));function getCliArg(_0x59591c){const _0x4d2320=a0_0x4694d0;for(let _0x37946c=0x0;_0x37946c<cliArgs['length'];_0x37946c++){const _0x21ff36=cliArgs[_0x37946c];if(_0x21ff36[_0x4d2320(0x2b0)]('--'+_0x59591c+'='))return _0x21ff36['slice'](('--'+_0x59591c+'=')[_0x4d2320(0x2de)]);if(_0x21ff36==='--'+_0x59591c&&_0x37946c+0x1<cliArgs[_0x4d2320(0x2de)])return cliArgs[_0x37946c+0x1];}return undefined;}function a0_0x565c(_0x2223e7,_0x3c2eb0){_0x2223e7=_0x2223e7-0x1da;const _0x3d150e=a0_0x3d15();let _0x565c4a=_0x3d150e[_0x2223e7];return _0x565c4a;}const args=[];for(let i=0x0;i<cliArgs[a0_0x4694d0(0x2de)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4694d0(0x1e8)](arg)||HELP_FLAGS[a0_0x4694d0(0x1e8)](arg))continue;if(arg[a0_0x4694d0(0x2b0)](a0_0x4694d0(0x2a3)))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x4694d0(0x272)](arg);}const WORKSPACE_ROOT=process[a0_0x4694d0(0x211)]['WORKSPACE_ROOT']||process[a0_0x4694d0(0x211)][a0_0x4694d0(0x2ec)]||process[a0_0x4694d0(0x2ee)](),ENABLE_WORKSPACE_MODE=process[a0_0x4694d0(0x211)][a0_0x4694d0(0x2ea)]!==a0_0x4694d0(0x2b1),MORPH_API_KEY=getCliArg(a0_0x4694d0(0x1db))??process[a0_0x4694d0(0x211)][a0_0x4694d0(0x220)],MORPH_API_URL=process['env'][a0_0x4694d0(0x22e)],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x4694d0(0x259)]?parseInt(process[a0_0x4694d0(0x211)][a0_0x4694d0(0x259)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x4694d0(0x2b0)](a0_0x4694d0(0x2d2))&&!MORPH_API_KEY['startsWith'](a0_0x4694d0(0x2f0))&&console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x1e4));async function reportMorphError(_0x14218c){const _0x36fce2=a0_0x4694d0;try{await a0_0x18fc9c['post'](_0x36fce2(0x246),{..._0x14218c,'timestamp':new Date()[_0x36fce2(0x20d)](),'source':_0x14218c[_0x36fce2(0x280)]||_0x36fce2(0x23a)},{'timeout':0x1388,'headers':{'Content-Type':_0x36fce2(0x27f),'Authorization':_0x36fce2(0x28c)+MORPH_API_KEY}});}catch{}}args[a0_0x4694d0(0x2de)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x4694d0(0x2ba)]('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x1e6)),console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x2b5)),console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x2bd)),console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x1e1)),console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x230)));function normalizePath(_0x2000cc){return a0_0x245c9c['normalize'](_0x2000cc);}function expandHome(_0x34e94e){const _0x2aa4c0=a0_0x4694d0;if(_0x34e94e[_0x2aa4c0(0x2b0)]('~/')||_0x34e94e==='~')return a0_0x245c9c['join'](a0_0x2ca012['homedir'](),_0x34e94e[_0x2aa4c0(0x28d)](0x1));return _0x34e94e;}let allowedDirectories=await Promise[a0_0x4694d0(0x1e5)](args['map'](async _0x5406e1=>{const _0x393259=a0_0x4694d0,_0x1f29a4=expandHome(_0x5406e1),_0x2cc10e=a0_0x245c9c[_0x393259(0x2d4)](_0x1f29a4);try{const _0x52eb43=await a0_0x4740ab[_0x393259(0x27d)](_0x2cc10e);return normalizePath(_0x52eb43);}catch(_0x397d29){return normalizePath(_0x2cc10e);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4694d0(0x2de)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4694d0(0x272)](workspaceDir),console[a0_0x4694d0(0x2ba)](a0_0x4694d0(0x2e9)+workspaceDir+a0_0x4694d0(0x1ea)));}catch(a0_0x502d48){console['error'](a0_0x4694d0(0x286)+a0_0x502d48);}async function detectWorkspaceRoot(_0x540d27){const _0x43f0e4=a0_0x4694d0;let _0x5f0603=a0_0x245c9c['resolve'](_0x540d27);const _0x3e60fd=['.git',_0x43f0e4(0x2e7),_0x43f0e4(0x2e6),_0x43f0e4(0x278),_0x43f0e4(0x2f9),'go.mod',_0x43f0e4(0x205),_0x43f0e4(0x2ab),_0x43f0e4(0x28e)];while(_0x5f0603!==a0_0x245c9c[_0x43f0e4(0x26c)](_0x5f0603)){for(const _0x16b853 of _0x3e60fd){const _0x1cb922=a0_0x245c9c['join'](_0x5f0603,_0x16b853);try{return await a0_0x4740ab[_0x43f0e4(0x234)](_0x1cb922),normalizePath(_0x5f0603);}catch{}}_0x5f0603=a0_0x245c9c[_0x43f0e4(0x26c)](_0x5f0603);}return normalizePath(_0x540d27);}await Promise[a0_0x4694d0(0x1e5)](args['map'](async _0xdf180=>{const _0x5b370d=a0_0x4694d0;try{const _0x56200e=await a0_0x4740ab[_0x5b370d(0x27b)](expandHome(_0xdf180));!_0x56200e[_0x5b370d(0x20a)]()&&(console['error']('Error:\x20'+_0xdf180+_0x5b370d(0x252)),process[_0x5b370d(0x2a1)](0x1));}catch(_0x18e438){console[_0x5b370d(0x2ba)]('Error\x20accessing\x20directory\x20'+_0xdf180+':',_0x18e438),process[_0x5b370d(0x2a1)](0x1);}}));async function validatePath(_0x1db1d5){const _0x48ea15=a0_0x4694d0,_0x2dae7b=expandHome(_0x1db1d5),_0x2df629=a0_0x245c9c['resolve'](_0x2dae7b);try{const _0x296905=await a0_0x4740ab['realpath'](_0x2df629);return _0x296905;}catch(_0xb1377f){if(_0xb1377f[_0x48ea15(0x24a)]==='ENOENT'){const _0x4e4d57=a0_0x245c9c[_0x48ea15(0x26c)](_0x2df629);try{const _0x1a4612=await a0_0x4740ab[_0x48ea15(0x27d)](_0x4e4d57);return a0_0x245c9c[_0x48ea15(0x2ac)](_0x1a4612,a0_0x245c9c[_0x48ea15(0x250)](_0x2df629));}catch{throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x4e4d57);}}throw _0xb1377f;}}const MorphEditFileArgsSchema=z[a0_0x4694d0(0x1fc)]({'path':z[a0_0x4694d0(0x289)](),'code_edit':z['string']()[a0_0x4694d0(0x268)](a0_0x4694d0(0x1dc)),'instruction':z['string']()[a0_0x4694d0(0x268)](a0_0x4694d0(0x28a)),'dryRun':z[a0_0x4694d0(0x218)]()['default'](![])[a0_0x4694d0(0x268)](a0_0x4694d0(0x2d8))}),WarpGrepArgsSchema=z[a0_0x4694d0(0x1fc)]({'search_string':z['string']()[a0_0x4694d0(0x268)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'repo_path':z[a0_0x4694d0(0x289)]()[a0_0x4694d0(0x268)](a0_0x4694d0(0x21a)),'search_type':z[a0_0x4694d0(0x25e)](['default',a0_0x4694d0(0x207)])[a0_0x4694d0(0x2f2)]()[a0_0x4694d0(0x268)](a0_0x4694d0(0x2eb))}),WarpGrepGitHubArgsSchema=z[a0_0x4694d0(0x1fc)]({'search_string':z[a0_0x4694d0(0x289)]()[a0_0x4694d0(0x268)](a0_0x4694d0(0x2d0)),'github_url':z['string']()['optional']()['describe'](a0_0x4694d0(0x284)),'owner_repo':z[a0_0x4694d0(0x289)]()[a0_0x4694d0(0x2f2)]()[a0_0x4694d0(0x268)](a0_0x4694d0(0x257)),'branch':z['string']()[a0_0x4694d0(0x2f2)]()[a0_0x4694d0(0x268)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x4694d0(0x1fc)]({'query':z['string']()['describe'](a0_0x4694d0(0x2f7)),'repoId':z['string']()[a0_0x4694d0(0x268)](a0_0x4694d0(0x2af)),'branch':z[a0_0x4694d0(0x289)]()[a0_0x4694d0(0x2f2)]()[a0_0x4694d0(0x268)](a0_0x4694d0(0x288)),'commitHash':z[a0_0x4694d0(0x289)]()[a0_0x4694d0(0x2f2)]()['describe'](a0_0x4694d0(0x240)),'targetDirectories':z[a0_0x4694d0(0x216)](z[a0_0x4694d0(0x289)]())[a0_0x4694d0(0x26a)]([])[a0_0x4694d0(0x268)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z[a0_0x4694d0(0x2b4)]()[a0_0x4694d0(0x2f2)]()[a0_0x4694d0(0x26a)](0xa)[a0_0x4694d0(0x268)](a0_0x4694d0(0x1f4))}),server=new Server({'name':a0_0x4694d0(0x262),'version':a0_0x4694d0(0x27e)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x28ef31=a0_0x4694d0,_0x2c8844=[{'name':_0x28ef31(0x281),'description':_0x28ef31(0x2f6)+_0x28ef31(0x253)+_0x28ef31(0x1f6)+_0x28ef31(0x224)+_0x28ef31(0x282)+_0x28ef31(0x2f1)+_0x28ef31(0x1dd)+_0x28ef31(0x263)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+_0x28ef31(0x208)+_0x28ef31(0x261)+_0x28ef31(0x26e)+_0x28ef31(0x1e9)+_0x28ef31(0x1f0)+_0x28ef31(0x294)+_0x28ef31(0x210)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+_0x28ef31(0x1e3)+_0x28ef31(0x269)+_0x28ef31(0x2ed)+_0x28ef31(0x25a)+_0x28ef31(0x2e5)+_0x28ef31(0x1ec),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x28ef31(0x1fe),'description':_0x28ef31(0x2a7)+_0x28ef31(0x296)+_0x28ef31(0x26f)+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+_0x28ef31(0x232)+_0x28ef31(0x2d6)+_0x28ef31(0x2ce)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x28ef31(0x2da)+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x28ef31(0x285)+_0x28ef31(0x282)+_0x28ef31(0x2cf)+_0x28ef31(0x223)+_0x28ef31(0x23d)+_0x28ef31(0x295)+_0x28ef31(0x1e2)+_0x28ef31(0x244)+_0x28ef31(0x27a),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x20efc5=_0x2c8844[_0x28ef31(0x2e0)](_0x5de0b1=>{const _0xfe637a=_0x28ef31;if(_0xfe637a(0x2aa)in _0x5de0b1&&_0x5de0b1['requiresApiKey']&&!MORPH_API_KEY)return console[_0xfe637a(0x2ba)](_0xfe637a(0x24d)+_0x5de0b1[_0xfe637a(0x243)]+_0xfe637a(0x25f)),![];return!![];});return{'tools':_0x20efc5[_0x28ef31(0x2fb)](_0x24ba96=>({'name':_0x24ba96['name'],'description':_0x24ba96[_0x28ef31(0x2d1)],'inputSchema':_0x24ba96[_0x28ef31(0x287)]}))};}),server[a0_0x4694d0(0x241)](CallToolRequestSchema,async _0x4ae123=>{const _0x2ddd93=a0_0x4694d0;try{const {name:_0x14295d,arguments:_0x22e4ac}=_0x4ae123[_0x2ddd93(0x238)];switch(_0x14295d){case _0x2ddd93(0x281):{const _0xc5c1f7=MorphEditFileArgsSchema[_0x2ddd93(0x2c9)](_0x22e4ac);if(!_0xc5c1f7['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0xc5c1f7[_0x2ddd93(0x2ba)]);const _0x3bbb8d=await validatePath(_0xc5c1f7['data'][_0x2ddd93(0x2ef)]);let _0x27cf57=null,_0x17441f=!![],_0x35a464=null;try{_0x27cf57=await a0_0x4740ab[_0x2ddd93(0x2a2)](_0x3bbb8d,_0x2ddd93(0x233));}catch(_0x2811fc){const _0x8d8352=_0x2811fc[_0x2ddd93(0x24a)];_0x8d8352===_0x2ddd93(0x266)?(_0x17441f=![],_0x27cf57=''):(_0x35a464='Failed\x20to\x20read\x20file:\x20'+(_0x8d8352||_0x2ddd93(0x20f))+_0x2ddd93(0x1f7)+(_0x2811fc instanceof Error?_0x2811fc['message']:String(_0x2811fc)),console[_0x2ddd93(0x2ba)](_0x2ddd93(0x24d)+_0x35a464));}let _0x37982b;try{const _0x2231ad=MORPH_API_KEY;if(!_0x2231ad)throw new Error(_0x2ddd93(0x2b2));const _0x17e79f=a0_0x245c9c[_0x2ddd93(0x26c)](_0x3bbb8d),_0x53aa20=a0_0x245c9c[_0x2ddd93(0x250)](_0x3bbb8d),_0x1709e5=await executeEditFile({'target_filepath':_0x53aa20,'code_edit':_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x260)],'instructions':_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x21f)]},{'morphApiKey':_0x2231ad,'morphApiUrl':MORPH_API_URL,'baseDir':_0x17e79f,'autoWrite':!_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2b7)],'generateUdiff':![],'debug':![]});_0x37982b=_0x1709e5['completionId'];if(!_0x1709e5[_0x2ddd93(0x29c)])throw new Error(_0x1709e5[_0x2ddd93(0x2ba)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x50f69e=_0x1709e5['changes'],_0x5c2a48='added\x20'+_0x50f69e['linesAdded']+',\x20removed\x20'+_0x50f69e[_0x2ddd93(0x2b8)]+_0x2ddd93(0x1fd)+_0x50f69e[_0x2ddd93(0x242)];if(_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2b7)])return{'content':[{'type':'text','text':_0x2ddd93(0x273)+(_0x17441f?'':_0x2ddd93(0x2ad))+':\x20'+_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x21f)]+_0x2ddd93(0x2d9)+_0x5c2a48+'.\x20Path:\x20'+_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2ef)]+'.'}]};return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x2c7)+(_0x17441f?_0x2ddd93(0x2a4):'Created\x20File')+':\x20'+_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x21f)]+_0x2ddd93(0x2d9)+_0x5c2a48+_0x2ddd93(0x2e3)+_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2ef)]+'.'}]};}catch(_0x4c23ec){const _0x2e89e3=_0x4c23ec instanceof Error?_0x4c23ec[_0x2ddd93(0x2a8)]:String(_0x4c23ec);return reportMorphError({'error_message':_0x2e89e3,'error_type':_0x4c23ec instanceof Error?_0x4c23ec[_0x2ddd93(0x235)][_0x2ddd93(0x243)]:_0x2ddd93(0x200),'context':{'tool':_0x2ddd93(0x281),'completion_id':_0x37982b,'file_path':_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2ef)],'validated_path':_0x3bbb8d,'instruction':_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x21f)],'model':_0x2ddd93(0x239),'dry_run':_0xc5c1f7['data']['dryRun'],'file_exists':_0x17441f,'file_read_error':_0x35a464,'file_readable':_0x27cf57!==null,'request_content':{'path':_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2ef)],'code_edit':_0xc5c1f7['data']['code_edit'],'instruction':_0xc5c1f7[_0x2ddd93(0x247)]['instruction'],'original_code':_0x27cf57!==null?_0x27cf57[_0x2ddd93(0x2de)]>0xc350?_0x27cf57[_0x2ddd93(0x1e7)](0x0,0xc350)+_0x2ddd93(0x206)+_0x27cf57[_0x2ddd93(0x2de)]+_0x2ddd93(0x29f):_0x27cf57:'[could\x20not\x20read\x20file:\x20'+(_0x35a464||_0x2ddd93(0x1f8))+']','original_code_length':_0x27cf57?.[_0x2ddd93(0x2de)]??0x0,'model':_0x2ddd93(0x239),'dry_run':_0xc5c1f7[_0x2ddd93(0x247)][_0x2ddd93(0x2b7)]}},'stack_trace':_0x4c23ec instanceof Error?_0x4c23ec[_0x2ddd93(0x2db)]:undefined,'source':_0x2ddd93(0x23a)})[_0x2ddd93(0x29b)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x2e89e3}],'isError':!![]};}}case _0x2ddd93(0x1fe):{const _0x1bf214=WarpGrepArgsSchema[_0x2ddd93(0x2c9)](_0x22e4ac);if(!_0x1bf214[_0x2ddd93(0x29c)])return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x23f)+_0x1bf214[_0x2ddd93(0x2ba)]}],'isError':!![]};const _0x247c62=_0x32d9df=>{const _0x4843a7=_0x2ddd93,_0x2985ee=[];for(const _0x6eb211 of _0x32d9df||[]){const _0x1c6a75=_0x6eb211[_0x4843a7(0x213)],_0x1edc6c=_0x6eb211[_0x4843a7(0x203)];if(_0x1c6a75===_0x4843a7(0x24b)&&_0x1edc6c){const _0x3f772b=_0x1edc6c[_0x4843a7(0x22d)]('\x0a')[_0x4843a7(0x2e0)](_0x44b29a=>_0x44b29a[_0x4843a7(0x2dd)]());for(const _0x4caea0 of _0x3f772b){const _0x707385=_0x4caea0['match'](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x707385){_0x2985ee[_0x4843a7(0x272)](_0x4843a7(0x254)+_0x707385[0x1]+'\x27\x20'+_0x707385[0x2]);continue;}const _0x399b83=_0x4caea0[_0x4843a7(0x1de)](/^read\s+(.+)$/);if(_0x399b83){_0x2985ee[_0x4843a7(0x272)](_0x4843a7(0x1e0)+_0x399b83[0x1]);continue;}const _0x28e9c8=_0x4caea0[_0x4843a7(0x1de)](/^list_directory\s+(.+)$/);if(_0x28e9c8){_0x2985ee[_0x4843a7(0x272)](_0x4843a7(0x1eb)+_0x28e9c8[0x1]);continue;}}}}return _0x2985ee;},_0x5b622e=_0x14c8c1=>{const _0x415419=_0x2ddd93,_0x40c80e=[];if(!_0x14c8c1||!Array['isArray'](_0x14c8c1))return _0x40c80e;const _0x432709=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x415419(0x293),'tool':_0x415419(0x29e)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x415419(0x2e4),'tool':_0x415419(0x29e)},{'pattern':/\[READ ERROR\]/,'error_type':_0x415419(0x276),'tool':_0x415419(0x29e)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x415419(0x2f3),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x415419(0x255),'tool':_0x415419(0x1ef)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x415419(0x27c),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x415419(0x29e)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x415419(0x29e)},{'pattern':/symbolic link/,'error_type':_0x415419(0x2b6),'tool':_0x415419(0x29e)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x415419(0x29e)},{'pattern':/status="error"/,'error_type':_0x415419(0x2a9),'tool':_0x415419(0x20f)}];let _0x1f2667=0x0;for(const _0x5ecf39 of _0x14c8c1){if(_0x5ecf39[_0x415419(0x213)]===_0x415419(0x24e)){_0x1f2667++;const _0x1fa387=_0x5ecf39['content'];if(!_0x1fa387||typeof _0x1fa387!==_0x415419(0x289))continue;for(const {pattern:_0x28c482,error_type:_0x53ef87,tool:_0x3fa76f}of _0x432709){const _0x602ddc=_0x1fa387[_0x415419(0x1de)](new RegExp(_0x28c482[_0x415419(0x280)],'g'));if(_0x602ddc)for(const _0x3f78b3 of _0x602ddc){const _0x14a051=_0x1fa387['indexOf'](_0x3f78b3),_0x551032=_0x1fa387[_0x415419(0x1e7)](_0x14a051,Math[_0x415419(0x2cd)](_0x14a051+0xc8,_0x1fa387[_0x415419(0x2de)]));_0x40c80e['push']({'tool':_0x3fa76f,'error_type':_0x53ef87,'error_message':_0x551032[_0x415419(0x22d)]('\x0a')[0x0],'turn':_0x1f2667});}}}}return _0x40c80e;};try{const _0x20d16e=a0_0x245c9c[_0x2ddd93(0x2d4)](_0x1bf214['data'][_0x2ddd93(0x231)]),_0x150599=_0x1bf214[_0x2ddd93(0x247)][_0x2ddd93(0x277)],_0x383543=_0x150599===_0x2ddd93(0x207)?{'allowNames':[_0x2ddd93(0x207)]}:undefined,_0x10e5ba=new LocalRipgrepProvider(_0x20d16e,undefined,_0x383543),_0x868dc8=await runWarpGrep({'query':_0x1bf214[_0x2ddd93(0x247)]['search_string'],'repoRoot':_0x20d16e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x10e5ba,'search_type':_0x150599}),_0xbdce1a=_0x5b622e(_0x868dc8[_0x2ddd93(0x267)]);_0xbdce1a['length']>0x0&&reportMorphError({'error_message':_0x2ddd93(0x2e8)+_0xbdce1a[_0x2ddd93(0x2de)]+_0x2ddd93(0x219),'error_type':_0x2ddd93(0x2bb),'level':'warn','tool':_0x2ddd93(0x1fe),'context':{'repo_path':_0x1bf214['data'][_0x2ddd93(0x231)],'query':_0x1bf214[_0x2ddd93(0x247)]['search_string'],'model':_0x2ddd93(0x2ca),'termination_reason':_0x868dc8[_0x2ddd93(0x2c4)],'sub_tool_errors':_0xbdce1a,'timings':_0x868dc8[_0x2ddd93(0x2bc)],'tool_calls':_0x247c62(_0x868dc8[_0x2ddd93(0x267)]),'messages':_0x868dc8[_0x2ddd93(0x267)]?.[_0x2ddd93(0x2fb)](_0x4e80bc=>({'role':_0x4e80bc['role'],'content':_0x4e80bc['content']}))},'source':'mcp-filesystem'})[_0x2ddd93(0x29b)](()=>{});let _0x44e11b='';if(_0x868dc8['terminationReason']==='completed'&&_0x868dc8[_0x2ddd93(0x1f1)]?.['metadata']?.[_0x2ddd93(0x248)]){const _0x7ec1db=_0x868dc8[_0x2ddd93(0x1f1)][_0x2ddd93(0x251)][_0x2ddd93(0x248)];if(_0x7ec1db[_0x2ddd93(0x2de)]===0x0)return _0x44e11b=_0x868dc8['finish'][_0x2ddd93(0x227)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x44e11b}]};const _0x390533=[],_0x2132f0=[_0x2ddd93(0x274)];for(const _0x186934 of _0x868dc8[_0x2ddd93(0x267)]){const _0x2d2dd3=_0x186934[_0x2ddd93(0x213)],_0x715611=_0x186934[_0x2ddd93(0x203)];if(_0x2d2dd3===_0x2ddd93(0x24b)&&_0x715611){const _0x5b2564=_0x715611['split']('\x0a')[_0x2ddd93(0x2e0)](_0x196f96=>_0x196f96[_0x2ddd93(0x2dd)]());for(const _0x2cdb10 of _0x5b2564){const _0x3292d2=_0x2cdb10[_0x2ddd93(0x1de)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x3292d2){_0x2132f0[_0x2ddd93(0x272)]('-\x20Grepped\x20\x27'+_0x3292d2[0x1]+_0x2ddd93(0x1fa)+_0x3292d2[0x2]+'`');continue;}const _0x3e8f65=_0x2cdb10[_0x2ddd93(0x1de)](/^read\s+(.+)$/);if(_0x3e8f65){_0x2132f0['push'](_0x2ddd93(0x28f)+_0x3e8f65[0x1]+'`');continue;}const _0x35f957=_0x2cdb10[_0x2ddd93(0x1de)](/^list_directory\s+(.+)$/);if(_0x35f957){_0x2132f0[_0x2ddd93(0x272)]('-\x20Listed\x20directory\x20`'+_0x35f957[0x1]+'`');continue;}}}}_0x390533[_0x2ddd93(0x272)](_0x2132f0[_0x2ddd93(0x2ac)]('\x0a'));const _0x11f4e8=['',_0x2ddd93(0x2c3)];for(const _0x33bf23 of _0x7ec1db){if(_0x33bf23[_0x2ddd93(0x26d)]==='*')_0x11f4e8['push']('-\x20'+_0x33bf23['path']+':*');else{if(Array[_0x2ddd93(0x23b)](_0x33bf23['lines'])){const _0x12b537=_0x33bf23['lines']['map'](([_0x1dd253,_0x2bca87])=>{if(_0x1dd253===_0x2bca87)return''+_0x1dd253;return _0x1dd253+'-'+_0x2bca87;});_0x11f4e8[_0x2ddd93(0x272)]('-\x20'+_0x33bf23[_0x2ddd93(0x2ef)]+':'+_0x12b537[_0x2ddd93(0x2ac)](','));}else _0x11f4e8[_0x2ddd93(0x272)]('-\x20'+_0x33bf23[_0x2ddd93(0x2ef)]+':*');}}_0x11f4e8[_0x2ddd93(0x272)](''),_0x390533[_0x2ddd93(0x272)](_0x11f4e8[_0x2ddd93(0x2ac)]('\x0a')),_0x390533[_0x2ddd93(0x272)](_0x2ddd93(0x291));const _0x43afea=[];for(const _0x978690 of _0x7ec1db){let _0x21c14a=a0_0x245c9c[_0x2ddd93(0x2d4)](_0x1bf214[_0x2ddd93(0x247)][_0x2ddd93(0x231)],_0x978690[_0x2ddd93(0x2ef)]),_0x5a8bcb=null,_0x2b856b=null;try{_0x5a8bcb=await a0_0x4740ab[_0x2ddd93(0x2a2)](_0x21c14a,{'encoding':'utf-8'});}catch(_0x4ea0d8){const _0x3486c0=fixPathRepetition(_0x21c14a);if(_0x3486c0)try{_0x5a8bcb=await a0_0x4740ab[_0x2ddd93(0x2a2)](_0x3486c0,{'encoding':_0x2ddd93(0x233)}),_0x21c14a=_0x3486c0;}catch{_0x2b856b=_0x4ea0d8 instanceof Error?_0x4ea0d8:new Error(String(_0x4ea0d8));}else _0x2b856b=_0x4ea0d8 instanceof Error?_0x4ea0d8:new Error(String(_0x4ea0d8));}if(_0x5a8bcb!==null){const _0x3a15bd=_0x5a8bcb[_0x2ddd93(0x22d)](/\r?\n/),_0x32f60d=['<file\x20path=\x22'+_0x978690[_0x2ddd93(0x2ef)]+'\x22>'];if(_0x978690[_0x2ddd93(0x26d)]==='*'||!Array[_0x2ddd93(0x23b)](_0x978690[_0x2ddd93(0x26d)]))for(let _0x1a26fa=0x1;_0x1a26fa<=_0x3a15bd[_0x2ddd93(0x2de)];_0x1a26fa++){const _0x5b12d6=_0x3a15bd[_0x1a26fa-0x1];_0x32f60d[_0x2ddd93(0x272)](_0x1a26fa+'|\x20'+_0x5b12d6);}else for(const [_0x10e1b0,_0x17c0e3]of _0x978690[_0x2ddd93(0x26d)]){_0x32f60d[_0x2ddd93(0x2de)]>0x1&&_0x32f60d[_0x2ddd93(0x272)]('');for(let _0x3f1c5b=_0x10e1b0;_0x3f1c5b<=_0x17c0e3&&_0x3f1c5b<=_0x3a15bd[_0x2ddd93(0x2de)];_0x3f1c5b++){const _0x175292=_0x3a15bd[_0x3f1c5b-0x1];_0x32f60d[_0x2ddd93(0x272)](_0x3f1c5b+'|\x20'+_0x175292);}}_0x32f60d['push'](_0x2ddd93(0x2fa)),_0x43afea['push'](_0x32f60d['join']('\x0a'));}else _0x43afea[_0x2ddd93(0x272)](_0x2ddd93(0x2bf)+_0x978690[_0x2ddd93(0x2ef)]+_0x2ddd93(0x258)+(_0x2b856b?.[_0x2ddd93(0x2a8)]||_0x2ddd93(0x270))+_0x2ddd93(0x201));}_0x390533[_0x2ddd93(0x272)](_0x43afea[_0x2ddd93(0x2ac)]('\x0a\x0a')),_0x44e11b=_0x390533[_0x2ddd93(0x2ac)]('\x0a');const _0x460a7a=_0x868dc8[_0x2ddd93(0x25b)]?.[_0x2ddd93(0x2e0)](_0x3ab959=>_0x3ab959[_0x2ddd93(0x2a8)]?.[_0x2ddd93(0x2b0)]('File\x20read\x20error:'))||[];if(_0x460a7a[_0x2ddd93(0x2de)]>0x0){const _0x3d7335=_0x460a7a[_0x2ddd93(0x2fb)](_0x4ed73f=>_0x4ed73f[_0x2ddd93(0x2a8)])[_0x2ddd93(0x2ac)](';\x20');reportMorphError({'error_message':_0x3d7335,'error_type':_0x2ddd93(0x28b),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x1bf214['data'][_0x2ddd93(0x231)],'query':_0x1bf214['data'][_0x2ddd93(0x1da)],'model':_0x2ddd93(0x2ca),'termination_reason':_0x2ddd93(0x24c),'error_count':_0x460a7a['length'],'is_timeout':![],'timings':_0x868dc8[_0x2ddd93(0x2bc)],'files_attempted':_0x7ec1db[_0x2ddd93(0x2fb)](_0x34aa32=>({'path':_0x34aa32[_0x2ddd93(0x2ef)],'lines':_0x34aa32[_0x2ddd93(0x26d)]})),'tool_calls':_0x247c62(_0x868dc8[_0x2ddd93(0x267)]),'messages':_0x868dc8['messages']?.[_0x2ddd93(0x2fb)](_0x293017=>({'role':_0x293017['role'],'content':_0x293017[_0x2ddd93(0x203)]})),'request_content':{'query':_0x1bf214[_0x2ddd93(0x247)]['search_string'],'repo_path':_0x1bf214[_0x2ddd93(0x247)]['repo_path'],'repoRoot':a0_0x245c9c[_0x2ddd93(0x2d4)](_0x1bf214[_0x2ddd93(0x247)][_0x2ddd93(0x231)]),'model':_0x2ddd93(0x2ca)}},'source':'mcp-filesystem'})[_0x2ddd93(0x29b)](()=>{});}}else{if(_0x868dc8['terminationReason']===_0x2ddd93(0x217)&&_0x868dc8['errors'][_0x2ddd93(0x2de)]>0x0){const _0x478041=_0x868dc8[_0x2ddd93(0x25b)]['map'](_0x8423e=>_0x8423e[_0x2ddd93(0x2a8)])[_0x2ddd93(0x2ac)](';\x20');_0x44e11b='Error:\x20'+_0x478041;const _0x2b75b5=_0x478041['toLowerCase']()[_0x2ddd93(0x2f5)](_0x2ddd93(0x21e))||_0x478041[_0x2ddd93(0x226)]()[_0x2ddd93(0x2f5)](_0x2ddd93(0x1ff))||_0x478041[_0x2ddd93(0x226)]()[_0x2ddd93(0x2f5)]('etimedout'),_0x33b235=_0x868dc8[_0x2ddd93(0x1f1)]?.[_0x2ddd93(0x251)]?.[_0x2ddd93(0x248)],_0x322a70=_0x868dc8[_0x2ddd93(0x25b)][0x0];reportMorphError({'error_message':_0x478041,'error_type':_0x2b75b5?_0x2ddd93(0x290):_0x322a70?.[_0x2ddd93(0x235)]?.[_0x2ddd93(0x243)]||_0x2ddd93(0x236),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x1bf214['data'][_0x2ddd93(0x231)],'query':_0x1bf214[_0x2ddd93(0x247)]['search_string'],'model':_0x2ddd93(0x2ca),'termination_reason':_0x868dc8[_0x2ddd93(0x2c4)],'error_count':_0x868dc8[_0x2ddd93(0x25b)][_0x2ddd93(0x2de)],'is_timeout':_0x2b75b5,'timings':_0x868dc8[_0x2ddd93(0x2bc)],'files_attempted':_0x33b235?.[_0x2ddd93(0x2fb)](_0x568bb8=>({'path':_0x568bb8[_0x2ddd93(0x2ef)],'lines':_0x568bb8[_0x2ddd93(0x26d)]})),'tool_calls':_0x247c62(_0x868dc8[_0x2ddd93(0x267)]),'messages':_0x868dc8[_0x2ddd93(0x267)]?.[_0x2ddd93(0x2fb)](_0x48a980=>({'role':_0x48a980[_0x2ddd93(0x213)],'content':_0x48a980[_0x2ddd93(0x203)]})),'request_content':{'query':_0x1bf214[_0x2ddd93(0x247)][_0x2ddd93(0x1da)],'repo_path':_0x1bf214[_0x2ddd93(0x247)][_0x2ddd93(0x231)],'repoRoot':a0_0x245c9c[_0x2ddd93(0x2d4)](_0x1bf214[_0x2ddd93(0x247)][_0x2ddd93(0x231)]),'model':_0x2ddd93(0x2ca)}},'stack_trace':_0x322a70?.[_0x2ddd93(0x2db)]||undefined,'source':'mcp-filesystem'})[_0x2ddd93(0x29b)](()=>{});}else _0x44e11b=_0x2ddd93(0x279);}return{'content':[{'type':'text','text':_0x44e11b}]};}catch(_0x4671c7){const _0x802855=_0x4671c7 instanceof Error?_0x4671c7['message']:String(_0x4671c7),_0x20cbe5=_0x802855[_0x2ddd93(0x226)]()['includes'](_0x2ddd93(0x21e))||_0x802855[_0x2ddd93(0x226)]()['includes'](_0x2ddd93(0x1ff))||_0x802855[_0x2ddd93(0x226)]()[_0x2ddd93(0x2f5)](_0x2ddd93(0x21d))||_0x4671c7 instanceof Error&&_0x4671c7[_0x2ddd93(0x243)]===_0x2ddd93(0x290);return reportMorphError({'error_message':_0x802855,'error_type':_0x20cbe5?_0x2ddd93(0x290):_0x4671c7 instanceof Error?_0x4671c7[_0x2ddd93(0x235)]['name']:_0x2ddd93(0x200),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x1bf214[_0x2ddd93(0x247)]['repo_path'],'query':_0x1bf214[_0x2ddd93(0x247)]['search_string'],'model':_0x2ddd93(0x2ca),'is_timeout':_0x20cbe5,'exception_phase':_0x2ddd93(0x20b),'request_content':{'query':_0x1bf214[_0x2ddd93(0x247)]['search_string'],'repo_path':_0x1bf214['data'][_0x2ddd93(0x231)],'repoRoot':a0_0x245c9c[_0x2ddd93(0x2d4)](_0x1bf214[_0x2ddd93(0x247)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x4671c7 instanceof Error?_0x4671c7[_0x2ddd93(0x2db)]:undefined,'source':'mcp-filesystem'})[_0x2ddd93(0x29b)](()=>{}),{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x29a)+_0x802855}],'isError':![]};}}case _0x2ddd93(0x2b3):{const _0x25d386=WarpGrepGitHubArgsSchema['safeParse'](_0x22e4ac);if(!_0x25d386[_0x2ddd93(0x29c)])return{'content':[{'type':_0x2ddd93(0x2c1),'text':'Invalid\x20arguments:\x20'+_0x25d386['error']}],'isError':!![]};const _0x538169=_0x25d386[_0x2ddd93(0x247)][_0x2ddd93(0x264)]||_0x25d386[_0x2ddd93(0x247)]['owner_repo'];if(!_0x538169)return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x20c)}],'isError':!![]};const _0x20fe4d=MORPH_API_KEY;if(!_0x20fe4d)throw new Error(_0x2ddd93(0x2b2));const _0xd36692=Date[_0x2ddd93(0x26b)]();console[_0x2ddd93(0x2ba)]('[warpgrep_github_search]\x20Searching\x20'+_0x538169+_0x2ddd93(0x245)+_0x25d386[_0x2ddd93(0x247)]['search_string']+'\x22');try{const _0x23980a=new WarpGrepClient({'morphApiKey':_0x20fe4d,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x2de2f2=await _0x23980a[_0x2ddd93(0x2a5)]({'query':_0x25d386['data']['search_string'],'github':_0x538169,'branch':_0x25d386[_0x2ddd93(0x247)][_0x2ddd93(0x2c0)]}),_0x1f49e1=Date[_0x2ddd93(0x26b)]()-_0xd36692;console['error']('[warpgrep_github_search]\x20Done\x20in\x20'+_0x1f49e1+_0x2ddd93(0x212)+_0x2de2f2['success']);const _0x1c993f=formatResult(_0x2de2f2);return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x1c993f}]};}catch(_0x347951){const _0xec1d38=Date[_0x2ddd93(0x26b)]()-_0xd36692,_0x48007e=_0x347951 instanceof Error?_0x347951[_0x2ddd93(0x2a8)]:String(_0x347951);return console[_0x2ddd93(0x2ba)]('[warpgrep_github_search]\x20Failed\x20in\x20'+_0xec1d38+_0x2ddd93(0x2ae),_0x48007e),reportMorphError({'error_message':_0x48007e,'error_type':_0x347951 instanceof Error?_0x347951[_0x2ddd93(0x235)]['name']:_0x2ddd93(0x200),'context':{'tool':'warpgrep_github_search','github_url':_0x538169,'search_string':_0x25d386[_0x2ddd93(0x247)]['search_string'],'branch':_0x25d386[_0x2ddd93(0x247)][_0x2ddd93(0x2c0)]},'stack_trace':_0x347951 instanceof Error?_0x347951[_0x2ddd93(0x2db)]:undefined,'source':_0x2ddd93(0x23a),'tool':_0x2ddd93(0x2b3),'latency_ms':_0xec1d38})[_0x2ddd93(0x29b)](()=>{}),{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x1f2)+_0x48007e}],'isError':![]};}}case _0x2ddd93(0x22f):{const _0x46c13c=CodebaseSearchArgsSchema[_0x2ddd93(0x2c9)](_0x22e4ac);if(!_0x46c13c['success'])return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x23f)+_0x46c13c[_0x2ddd93(0x2ba)]}],'isError':!![]};try{const _0x382774=MORPH_API_KEY;if(!_0x382774)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x29440f=_0x46c13c[_0x2ddd93(0x247)]['targetDirectories'],_0x467fc9=await executeCodebaseSearch({'query':_0x46c13c[_0x2ddd93(0x247)][_0x2ddd93(0x2c8)],'target_directories':_0x29440f,'limit':_0x46c13c['data'][_0x2ddd93(0x2e2)]},{'apiKey':_0x382774,'repoId':_0x46c13c[_0x2ddd93(0x247)][_0x2ddd93(0x249)],'branch':_0x46c13c['data']['branch'],'commitHash':_0x46c13c[_0x2ddd93(0x247)][_0x2ddd93(0x25d)],'debug':![]});if(!_0x467fc9[_0x2ddd93(0x29c)])return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x21c)+_0x467fc9['error']}],'isError':!![]};const _0x4ac98=_0x467fc9['results'][_0x2ddd93(0x2de)]===0x0?_0x2ddd93(0x22a)+_0x46c13c[_0x2ddd93(0x247)]['query']+'\x22':_0x2ddd93(0x2a0)+_0x467fc9['results'][_0x2ddd93(0x2de)]+_0x2ddd93(0x2c5)+_0x467fc9[_0x2ddd93(0x1f9)][_0x2ddd93(0x2dc)]+_0x2ddd93(0x1fb)+_0x467fc9['results'][_0x2ddd93(0x2fb)]((_0x405e51,_0x10e166)=>_0x10e166+0x1+'.\x20'+_0x405e51['filepath']+'\x20('+(_0x405e51[_0x2ddd93(0x221)]*0x64)[_0x2ddd93(0x256)](0x1)+_0x2ddd93(0x2b9)+(_0x2ddd93(0x2a6)+_0x405e51[_0x2ddd93(0x2c2)]+'-'+_0x405e51[_0x2ddd93(0x29d)]+'\x0a')+(_0x2ddd93(0x2be)+_0x405e51['content']['substring'](0x0,0xc8)+(_0x405e51['content'][_0x2ddd93(0x2de)]>0xc8?_0x2ddd93(0x292):'')+'\x0a'))['join']('\x0a');return{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x4ac98}]};}catch(_0x40943c){const _0x1a94ac=_0x40943c instanceof Error?_0x40943c[_0x2ddd93(0x2a8)]:String(_0x40943c);return reportMorphError({'error_message':_0x1a94ac,'error_type':_0x40943c instanceof Error?_0x40943c[_0x2ddd93(0x235)][_0x2ddd93(0x243)]:_0x2ddd93(0x200),'context':{'tool':'codebase_search','query':_0x46c13c['data'][_0x2ddd93(0x2c8)],'repo_id':_0x46c13c[_0x2ddd93(0x247)][_0x2ddd93(0x249)],'target_directories':_0x46c13c[_0x2ddd93(0x247)]['targetDirectories']},'stack_trace':_0x40943c instanceof Error?_0x40943c[_0x2ddd93(0x2db)]:undefined,'source':_0x2ddd93(0x23a)})[_0x2ddd93(0x29b)](()=>{}),{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x1ed)+_0x1a94ac}],'isError':!![]};}}default:throw new Error(_0x2ddd93(0x1f5)+_0x14295d);}}catch(_0x3f22ab){const _0x382291=_0x3f22ab instanceof Error?_0x3f22ab[_0x2ddd93(0x2a8)]:String(_0x3f22ab);return reportMorphError({'error_message':_0x382291,'error_type':_0x3f22ab instanceof Error?_0x3f22ab[_0x2ddd93(0x235)]['name']:_0x2ddd93(0x200),'context':{'tool':name,'arguments':args?JSON[_0x2ddd93(0x2cc)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x2ddd93(0x27e)},'stack_trace':_0x3f22ab instanceof Error?_0x3f22ab[_0x2ddd93(0x2db)]:undefined,'source':_0x2ddd93(0x23a)})['catch'](()=>{}),{'content':[{'type':_0x2ddd93(0x2c1),'text':_0x2ddd93(0x1ed)+_0x382291}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4064f8){const _0x1bf949=a0_0x4694d0,_0x555df6=await getValidRootDirectories(_0x4064f8);if(_0x555df6[_0x1bf949(0x2de)]>0x0)allowedDirectories=[..._0x555df6],console[_0x1bf949(0x2ba)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x555df6[_0x1bf949(0x2de)]+'\x20valid\x20directories');else{console['error'](_0x1bf949(0x209));if(ENABLE_WORKSPACE_MODE)try{const _0x1f8476=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1f8476&&(allowedDirectories=[_0x1f8476],console['error']('Fallback:\x20Using\x20workspace\x20root\x20'+_0x1f8476));}catch(_0x33ac7a){console[_0x1bf949(0x2ba)]('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x33ac7a);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x3b81a6=a0_0x4694d0;try{const _0x352c73=await server['listRoots']();_0x352c73&&_0x3b81a6(0x22b)in _0x352c73&&await updateAllowedDirectoriesFromRoots(_0x352c73[_0x3b81a6(0x22b)]);}catch(_0x5d84b3){console[_0x3b81a6(0x2ba)](_0x3b81a6(0x275),_0x5d84b3 instanceof Error?_0x5d84b3[_0x3b81a6(0x2a8)]:String(_0x5d84b3));}}),server['oninitialized']=async()=>{const _0x4a023d=a0_0x4694d0,_0x24fa46=server[_0x4a023d(0x222)]();if(_0x24fa46?.[_0x4a023d(0x22b)])try{const _0x1e019b=await server[_0x4a023d(0x204)]();_0x1e019b&&_0x4a023d(0x22b)in _0x1e019b?await updateAllowedDirectoriesFromRoots(_0x1e019b['roots']):console[_0x4a023d(0x2ba)](_0x4a023d(0x2df));}catch(_0x2456bd){console[_0x4a023d(0x2ba)](_0x4a023d(0x2e1),_0x2456bd instanceof Error?_0x2456bd[_0x4a023d(0x2a8)]:String(_0x2456bd));}else{if(allowedDirectories['length']>0x0)console[_0x4a023d(0x2ba)](_0x4a023d(0x24f),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x4a023d(0x2ba)]('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x4a023d(0x297));}}};async function runServer(){const _0x4df73f=a0_0x4694d0,_0x2ce216=new StdioServerTransport();await server[_0x4df73f(0x2d7)](_0x2ce216),console[_0x4df73f(0x2ba)](_0x4df73f(0x1f3)),allowedDirectories[_0x4df73f(0x2de)]===0x0&&console[_0x4df73f(0x2ba)](_0x4df73f(0x298));}runServer()['catch'](_0x1bc14a=>{const _0x53449f=a0_0x4694d0;console[_0x53449f(0x2ba)](_0x53449f(0x1df),_0x1bc14a),process[_0x53449f(0x2a1)](0x1);});
|
|
2
|
+
const a0_0x56fcd6=a0_0x32cf;(function(_0x368cf8,_0x48bed1){const _0x2e0353=a0_0x32cf,_0x210f7f=_0x368cf8();while(!![]){try{const _0x2eb568=parseInt(_0x2e0353(0x1ad))/0x1+parseInt(_0x2e0353(0x1f2))/0x2+parseInt(_0x2e0353(0x1c9))/0x3+-parseInt(_0x2e0353(0x1a9))/0x4+-parseInt(_0x2e0353(0x247))/0x5*(parseInt(_0x2e0353(0x267))/0x6)+parseInt(_0x2e0353(0x287))/0x7+parseInt(_0x2e0353(0x1fc))/0x8;if(_0x2eb568===_0x48bed1)break;else _0x210f7f['push'](_0x210f7f['shift']());}catch(_0x1a5aa2){_0x210f7f['push'](_0x210f7f['shift']());}}}(a0_0x55ad,0x7982b));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_0x143afa from'fs/promises';function a0_0x55ad(){const _0xd2a1d4=['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','message','Morph\x20Edit\x20Preview','\x22>\x0aError\x20reading\x20file:\x20','BinaryFile','requiresApiKey','startLine','assistant','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','source','Fatal\x20error\x20running\x20server:','slice','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','object','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','50yJZNoa','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.','getClientCapabilities','searchTimeMs','File\x20read\x20error:','Unknown\x20tool:\x20','MORPH_API_KEY','role','Workspace\x20mode\x20enabled:\x20Using\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','\x27\x20in\x20`','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','../package.json','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','completed','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','.\x20Changes:\x20','setRequestHandler','filter','.git','normalize','substring','ReadError','api-key','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','utf-8','Here\x20is\x20the\x20content\x20of\x20files:\x0a','Invalid\x20arguments:\x20','files','--api-key=','474522jZsJQq','resolve','Benefits:\x0a','MORPH_WARP_GREP_TIMEOUT','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','join','timeout','catch','GitHub\x20search\x20failed:\x20','Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20','default','WarpGrep\x20sub-tool\x20errors:\x20','path','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','etimedout','Error\x20running\x20fast\x20context\x20search:\x20','stats','false','Failed\x20to\x20request\x20roots\x20from\x20client:','repo_path','WORKSPACE_ROOT','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','Fallback:\x20Using\x20workspace\x20root\x20','inputSchema','WarpGrepError','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','pyproject.toml','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','\x0aExamples:','results','TimeoutError','[warpgrep_github_search]\x20Searching\x20','2165744oaKSUA','PathError','warpgrep_github_search','read\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','indexOf','\x20error(s)','\x20is\x20not\x20a\x20directory','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','grep\x20\x27','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','string','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','ENOENT','codebase_search','rerankScore','Specific\x20commit\x20hash\x20to\x20search','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','PWD','listRoots','boolean','has','dryRun','linesRemoved','description','Morph\x20Edit\x20','ToolException','now','payload','.\x20Path:\x20','@morphllm/morphmcp\x20','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','enum','UnknownError','query','exit','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','\x20(new\x20file)','sk-','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','grep','oninitialized','.vscode','ms:\x0a\x0a','setNotificationHandler','\x20results\x20in\x20','node_modules','Morph\x20FastApply\x20failed\x20without\x20error\x20message','safeParse','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','dirname','finish','env','cwd','edit_file','name','added\x20','data','morph-','instruction','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','search_string','.cursor','\x0a</file>','user','describe','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20','ENABLE_WORKSPACE_MODE','argv','556936JePaBS','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','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','toFixed','192170CHdjJn','-\x20Grepped\x20\x27','--help','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','morph-mcp','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','package.json','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','</file>','Found\x20','metadata','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','Unknown\x20error','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20','length','FileReadError','startsWith','Search\x20failed:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','changes','RipgrepNotAvailable','...',',\x20modified\x20','1402875OGSYfh','number','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','<file\x20path=\x22','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','error','code_edit','\x20\x20morph-mcp','isDirectory','realpath','array','ms:','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','some','owner_repo','%\x20match)\x0a','branch','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','read','commitHash','map','\x20for:\x20\x22','morph-warp-grep-v1-1111v0','[warpgrep_github_search]\x20Failed\x20in\x20','completionId','SymlinkError','⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a','Error:\x20','\x20\x20\x20Lines\x20','homedir','[could\x20not\x20read\x20file:\x20','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','\x0a...\x20(truncated,\x20total:\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','mcp-filesystem','trim','success','all','Repository\x20identifier','Created\x20File','588970ujgRix','toISOString','errors','log','content','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','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','runWarpGrep_call','warpgrep_codebase_search','readFile','1313112RRtpkw','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','code','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','morph-v3-fast','push','Warning:\x20','split','unknown','text','RipgrepError','SubToolError','unknown\x20error',',\x20removed\x20','roots','lines','[warpgrep_github_search]\x20Done\x20in\x20','terminated','tsconfig.json','stringify','match','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','repoId','stat','Failed\x20to\x20read\x20file:\x20','targetDirectories','application/json','optional','toLowerCase','\x0aOptions:','Natural\x20language\x20query\x20to\x20search\x20for\x20code','connect','stack','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x20chars)','-\x20Listed\x20directory\x20`','Bearer\x20','Warning:\x20Workspace\x20fallback\x20failed:\x20','0.2.0','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.','Relevant\x20context\x20found:','constructor','terminationReason','messages','every','For\x20deletions:\x0a','timings','\x20\x20\x20','**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a','\x20as\x20allowed\x20directory','sep','https://morphllm.com/api/error-report','isArray','search_type','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','floor','includes','timed\x20out'];a0_0x55ad=function(){return _0xd2a1d4;};return a0_0x55ad();}import a0_0x54e64d from'path';import a0_0x421431 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_0x3cfef5 from'axios';function fixPathRepetition(_0xabb134){const _0x790266=a0_0x32cf,_0x51c8f3=_0xabb134[_0x790266(0x203)](a0_0x54e64d['sep'])[_0x790266(0x25b)](Boolean);if(_0x51c8f3[_0x790266(0x1bf)]<0x2)return null;for(let _0x3c5547=Math[_0x790266(0x233)](_0x51c8f3[_0x790266(0x1bf)]/0x2);_0x3c5547>=0x1;_0x3c5547--){for(let _0x220e36=0x0;_0x220e36<=_0x51c8f3['length']-0x2*_0x3c5547;_0x220e36++){const _0xf687b6=_0x51c8f3[_0x790266(0x242)](_0x220e36,_0x220e36+_0x3c5547),_0x3dfd96=_0x51c8f3['slice'](_0x220e36+_0x3c5547,_0x220e36+0x2*_0x3c5547);if(_0xf687b6[_0x790266(0x228)]((_0xd1cffb,_0x40e0f9)=>_0xd1cffb===_0x3dfd96[_0x40e0f9])){const _0xc97ba4=[..._0x51c8f3['slice'](0x0,_0x220e36),..._0x51c8f3[_0x790266(0x242)](_0x220e36+_0x3c5547)];return a0_0x54e64d['sep']+_0xc97ba4[_0x790266(0x26c)](a0_0x54e64d[_0x790266(0x22e)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x524b31=a0_0x32cf;try{const _0x1f047f=require(_0x524b31(0x254));return _0x1f047f['version']??'unknown';}catch(_0x4acf51){return console[_0x524b31(0x1cf)](_0x524b31(0x1e9),_0x4acf51),_0x524b31(0x204);}}function printHelp(){const _0x4ca407=a0_0x32cf;console[_0x4ca407(0x1f5)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x4ca407(0x1f5)](_0x4ca407(0x1eb)),console['log'](_0x4ca407(0x219)),console[_0x4ca407(0x1f5)](_0x4ca407(0x261)),console['log'](_0x4ca407(0x246)),console[_0x4ca407(0x1f5)](_0x4ca407(0x1ce)),console[_0x4ca407(0x1f5)](_0x4ca407(0x283)),console[_0x4ca407(0x1f5)](_0x4ca407(0x1d1)),console['log'](_0x4ca407(0x1ab));}const cliArgs=process[a0_0x56fcd6(0x1a8)][a0_0x56fcd6(0x242)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x56fcd6(0x1af),'-h']);cliArgs[a0_0x56fcd6(0x1d7)](_0x4ffc6d=>VERSION_FLAGS['has'](_0x4ffc6d))&&(console['log'](a0_0x56fcd6(0x2a5)+getPackageVersion()),process[a0_0x56fcd6(0x2aa)](0x0));cliArgs[a0_0x56fcd6(0x1d7)](_0x307736=>HELP_FLAGS[a0_0x56fcd6(0x29c)](_0x307736))&&(printHelp(),process[a0_0x56fcd6(0x2aa)](0x0));function getCliArg(_0x1103b7){const _0x4d54cc=a0_0x56fcd6;for(let _0xd9d37e=0x0;_0xd9d37e<cliArgs[_0x4d54cc(0x1bf)];_0xd9d37e++){const _0xe861f8=cliArgs[_0xd9d37e];if(_0xe861f8[_0x4d54cc(0x1c1)]('--'+_0x1103b7+'='))return _0xe861f8[_0x4d54cc(0x242)](('--'+_0x1103b7+'=')['length']);if(_0xe861f8==='--'+_0x1103b7&&_0xd9d37e+0x1<cliArgs[_0x4d54cc(0x1bf)])return cliArgs[_0xd9d37e+0x1];}return undefined;}const args=[];function a0_0x32cf(_0x5dc0fd,_0x1f59e2){_0x5dc0fd=_0x5dc0fd-0x18f;const _0x55ad5c=a0_0x55ad();let _0x32cfe8=_0x55ad5c[_0x5dc0fd];return _0x32cfe8;}for(let i=0x0;i<cliArgs[a0_0x56fcd6(0x1bf)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x56fcd6(0x29c)](arg)||HELP_FLAGS[a0_0x56fcd6(0x29c)](arg))continue;if(arg[a0_0x56fcd6(0x1c1)](a0_0x56fcd6(0x266)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x56fcd6(0x198)][a0_0x56fcd6(0x27b)]||process[a0_0x56fcd6(0x198)][a0_0x56fcd6(0x299)]||process[a0_0x56fcd6(0x199)](),ENABLE_WORKSPACE_MODE=process[a0_0x56fcd6(0x198)][a0_0x56fcd6(0x1a7)]!==a0_0x56fcd6(0x278),MORPH_API_KEY=getCliArg(a0_0x56fcd6(0x260))??process[a0_0x56fcd6(0x198)][a0_0x56fcd6(0x24d)],MORPH_API_URL=process[a0_0x56fcd6(0x198)]['MORPH_API_URL'],MORPH_WARP_GREP_TIMEOUT=process[a0_0x56fcd6(0x198)][a0_0x56fcd6(0x26a)]?parseInt(process['env']['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY[a0_0x56fcd6(0x1c1)](a0_0x56fcd6(0x2ad))&&!MORPH_API_KEY[a0_0x56fcd6(0x1c1)](a0_0x56fcd6(0x19e))&&console[a0_0x56fcd6(0x1cf)](a0_0x56fcd6(0x1db));async function reportMorphError(_0x569545){const _0x1acaf4=a0_0x56fcd6;try{await a0_0x3cfef5['post'](_0x1acaf4(0x22f),{..._0x569545,'timestamp':new Date()[_0x1acaf4(0x1f3)](),'source':_0x569545[_0x1acaf4(0x240)]||_0x1acaf4(0x1ec)},{'timeout':0x1388,'headers':{'Content-Type':_0x1acaf4(0x216),'Authorization':_0x1acaf4(0x220)+MORPH_API_KEY}});}catch{}}args[a0_0x56fcd6(0x1bf)]===0x0&&!ENABLE_WORKSPACE_MODE&&(console['error'](a0_0x56fcd6(0x1b5)),console['error']('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console[a0_0x56fcd6(0x1cf)](a0_0x56fcd6(0x2af)),console[a0_0x56fcd6(0x1cf)](a0_0x56fcd6(0x2a6)),console[a0_0x56fcd6(0x1cf)](a0_0x56fcd6(0x255)),console['error']('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x30e69e){const _0x394a20=a0_0x56fcd6;return a0_0x54e64d[_0x394a20(0x25d)](_0x30e69e);}function expandHome(_0x130f9c){const _0x1a425c=a0_0x56fcd6;if(_0x130f9c['startsWith']('~/')||_0x130f9c==='~')return a0_0x54e64d[_0x1a425c(0x26c)](a0_0x421431[_0x1a425c(0x1e7)](),_0x130f9c[_0x1a425c(0x242)](0x1));return _0x130f9c;}let allowedDirectories=await Promise[a0_0x56fcd6(0x1ef)](args['map'](async _0x22bbf0=>{const _0x26e147=a0_0x56fcd6,_0x56060a=expandHome(_0x22bbf0),_0x563bf5=a0_0x54e64d[_0x26e147(0x268)](_0x56060a);try{const _0x383ef3=await a0_0x143afa['realpath'](_0x563bf5);return normalizePath(_0x383ef3);}catch(_0x24164d){return normalizePath(_0x563bf5);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x56fcd6(0x201)](workspaceDir),console[a0_0x56fcd6(0x1cf)](a0_0x56fcd6(0x24f)+workspaceDir+a0_0x56fcd6(0x22d)));}catch(a0_0x27f26c){console[a0_0x56fcd6(0x1cf)](a0_0x56fcd6(0x232)+a0_0x27f26c);}async function detectWorkspaceRoot(_0x13be1d){const _0x36d5ed=a0_0x56fcd6;let _0x1b5f05=a0_0x54e64d[_0x36d5ed(0x268)](_0x13be1d);const _0x3b0f13=[_0x36d5ed(0x25c),_0x36d5ed(0x2b2),_0x36d5ed(0x1b4),'Cargo.toml',_0x36d5ed(0x281),'go.mod',_0x36d5ed(0x1a2),_0x36d5ed(0x20e),'composer.json'];while(_0x1b5f05!==a0_0x54e64d[_0x36d5ed(0x196)](_0x1b5f05)){for(const _0x39cb1d of _0x3b0f13){const _0x44843f=a0_0x54e64d[_0x36d5ed(0x26c)](_0x1b5f05,_0x39cb1d);try{return await a0_0x143afa['access'](_0x44843f),normalizePath(_0x1b5f05);}catch{}}_0x1b5f05=a0_0x54e64d[_0x36d5ed(0x196)](_0x1b5f05);}return normalizePath(_0x13be1d);}await Promise['all'](args['map'](async _0x1886b4=>{const _0x2350a7=a0_0x56fcd6;try{const _0x8b09aa=await a0_0x143afa[_0x2350a7(0x213)](expandHome(_0x1886b4));!_0x8b09aa[_0x2350a7(0x1d2)]()&&(console['error'](_0x2350a7(0x1e5)+_0x1886b4+_0x2350a7(0x28e)),process[_0x2350a7(0x2aa)](0x1));}catch(_0x3ba1ec){console[_0x2350a7(0x1cf)]('Error\x20accessing\x20directory\x20'+_0x1886b4+':',_0x3ba1ec),process[_0x2350a7(0x2aa)](0x1);}}));async function validatePath(_0x5c0815){const _0x547bff=a0_0x56fcd6,_0x3a266e=expandHome(_0x5c0815),_0x39062b=a0_0x54e64d[_0x547bff(0x268)](_0x3a266e);try{const _0x51c330=await a0_0x143afa['realpath'](_0x39062b);return _0x51c330;}catch(_0x284b81){if(_0x284b81[_0x547bff(0x1fe)]===_0x547bff(0x294)){const _0x274b48=a0_0x54e64d[_0x547bff(0x196)](_0x39062b);try{const _0x488b9b=await a0_0x143afa[_0x547bff(0x1d3)](_0x274b48);return a0_0x54e64d['join'](_0x488b9b,a0_0x54e64d['basename'](_0x39062b));}catch{throw new Error(_0x547bff(0x23e)+_0x274b48);}}throw _0x284b81;}}const MorphEditFileArgsSchema=z[a0_0x56fcd6(0x244)]({'path':z[a0_0x56fcd6(0x292)](),'code_edit':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x1a5)](a0_0x56fcd6(0x28f)),'instruction':z[a0_0x56fcd6(0x292)]()['describe'](a0_0x56fcd6(0x253)),'dryRun':z[a0_0x56fcd6(0x29b)]()['default'](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),WarpGrepArgsSchema=z[a0_0x56fcd6(0x244)]({'search_string':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x1a5)](a0_0x56fcd6(0x1bc)),'repo_path':z[a0_0x56fcd6(0x292)]()['describe'](a0_0x56fcd6(0x27c)),'search_type':z[a0_0x56fcd6(0x2a7)]([a0_0x56fcd6(0x271),a0_0x56fcd6(0x192)])[a0_0x56fcd6(0x217)]()[a0_0x56fcd6(0x1a5)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x1a5)]('Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for'),'github_url':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x217)]()['describe'](a0_0x56fcd6(0x256)),'owner_repo':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x217)]()[a0_0x56fcd6(0x1a5)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x217)]()[a0_0x56fcd6(0x1a5)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x56fcd6(0x244)]({'query':z['string']()['describe'](a0_0x56fcd6(0x21a)),'repoId':z[a0_0x56fcd6(0x292)]()[a0_0x56fcd6(0x1a5)](a0_0x56fcd6(0x1f0)),'branch':z['string']()[a0_0x56fcd6(0x217)]()[a0_0x56fcd6(0x1a5)](a0_0x56fcd6(0x2ae)),'commitHash':z['string']()[a0_0x56fcd6(0x217)]()[a0_0x56fcd6(0x1a5)](a0_0x56fcd6(0x297)),'targetDirectories':z[a0_0x56fcd6(0x1d4)](z[a0_0x56fcd6(0x292)]())[a0_0x56fcd6(0x271)]([])[a0_0x56fcd6(0x1a5)](a0_0x56fcd6(0x282)),'limit':z[a0_0x56fcd6(0x1ca)]()[a0_0x56fcd6(0x217)]()[a0_0x56fcd6(0x271)](0xa)['describe']('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x56fcd6(0x1b2),'version':a0_0x56fcd6(0x222)},{'capabilities':{'tools':{}}});server[a0_0x56fcd6(0x25a)](ListToolsRequestSchema,async()=>{const _0x39897d=a0_0x56fcd6,_0x48dd1f=[{'name':'edit_file','description':_0x39897d(0x1ff)+_0x39897d(0x2ab)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x39897d(0x1d6)+_0x39897d(0x269)+_0x39897d(0x1c4)+'-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a'+_0x39897d(0x28b)+_0x39897d(0x1b1)+_0x39897d(0x291)+_0x39897d(0x211)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x39897d(0x229)+_0x39897d(0x298)+_0x39897d(0x1cb)+'Rules:\x0a'+_0x39897d(0x23f)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x39897d(0x250)+_0x39897d(0x1bd)+_0x39897d(0x236),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x39897d(0x1fa),'description':'A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20'+_0x39897d(0x1aa)+_0x39897d(0x293)+_0x39897d(0x1a6)+_0x39897d(0x252)+_0x39897d(0x1f8)+_0x39897d(0x1be)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x39897d(0x22c)+_0x39897d(0x1e4)+_0x39897d(0x280)+_0x39897d(0x269)+_0x39897d(0x26b)+_0x39897d(0x1b3)+'-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a'+'-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a'+_0x39897d(0x1a0)+_0x39897d(0x270)+_0x39897d(0x1ba),'inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x2161b2=_0x48dd1f['filter'](_0x131122=>{const _0x2700f2=_0x39897d;if(_0x2700f2(0x23b)in _0x131122&&_0x131122[_0x2700f2(0x23b)]&&!MORPH_API_KEY)return console[_0x2700f2(0x1cf)]('Warning:\x20'+_0x131122[_0x2700f2(0x19b)]+_0x2700f2(0x21d)),![];return!![];});return{'tools':_0x2161b2[_0x39897d(0x1de)](_0x1e72cc=>({'name':_0x1e72cc[_0x39897d(0x19b)],'description':_0x1e72cc[_0x39897d(0x29f)],'inputSchema':_0x1e72cc[_0x39897d(0x27e)]}))};}),server[a0_0x56fcd6(0x25a)](CallToolRequestSchema,async _0x35418e=>{const _0x3d227b=a0_0x56fcd6;try{const {name:_0x18e272,arguments:_0x1f14b7}=_0x35418e['params'];switch(_0x18e272){case _0x3d227b(0x19a):{const _0x18d1e3=MorphEditFileArgsSchema['safeParse'](_0x1f14b7);if(!_0x18d1e3[_0x3d227b(0x1ee)])throw new Error(_0x3d227b(0x195)+_0x18d1e3[_0x3d227b(0x1cf)]);const _0x56de61=await validatePath(_0x18d1e3[_0x3d227b(0x19d)]['path']);let _0x3d33c0=null,_0x2cd815=!![],_0x3b4b5b=null;try{_0x3d33c0=await a0_0x143afa[_0x3d227b(0x1fb)](_0x56de61,_0x3d227b(0x262));}catch(_0x2246f5){const _0x2b4999=_0x2246f5[_0x3d227b(0x1fe)];_0x2b4999===_0x3d227b(0x294)?(_0x2cd815=![],_0x3d33c0=''):(_0x3b4b5b=_0x3d227b(0x214)+(_0x2b4999||_0x3d227b(0x204))+'\x20-\x20'+(_0x2246f5 instanceof Error?_0x2246f5[_0x3d227b(0x237)]:String(_0x2246f5)),console[_0x3d227b(0x1cf)](_0x3d227b(0x202)+_0x3b4b5b));}let _0x4868d9;try{const _0x8a63f8=MORPH_API_KEY;if(!_0x8a63f8)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x1b1a2f=a0_0x54e64d['dirname'](_0x56de61),_0x44aca9=a0_0x54e64d['basename'](_0x56de61),_0x5ad404=await executeEditFile({'target_filepath':_0x44aca9,'code_edit':_0x18d1e3['data'][_0x3d227b(0x1d0)],'instructions':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x19f)]},{'morphApiKey':_0x8a63f8,'morphApiUrl':MORPH_API_URL,'baseDir':_0x1b1a2f,'autoWrite':!_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x29d)],'generateUdiff':![],'debug':![]});_0x4868d9=_0x5ad404[_0x3d227b(0x1e2)];if(!_0x5ad404[_0x3d227b(0x1ee)])throw new Error(_0x5ad404[_0x3d227b(0x1cf)]||_0x3d227b(0x193));const _0x3c5feb=_0x5ad404[_0x3d227b(0x1c5)],_0x47c92b=_0x3d227b(0x19c)+_0x3c5feb['linesAdded']+_0x3d227b(0x209)+_0x3c5feb[_0x3d227b(0x29e)]+_0x3d227b(0x1c8)+_0x3c5feb['linesModified'];if(_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x29d)])return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x238)+(_0x2cd815?'':_0x3d227b(0x2ac))+':\x20'+_0x18d1e3[_0x3d227b(0x19d)]['instruction']+'.\x20Changes:\x20'+_0x47c92b+_0x3d227b(0x2a4)+_0x18d1e3[_0x3d227b(0x19d)]['path']+'.'}]};return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x2a0)+(_0x2cd815?'Applied':_0x3d227b(0x1f1))+':\x20'+_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x19f)]+_0x3d227b(0x259)+_0x47c92b+_0x3d227b(0x2a4)+_0x18d1e3['data'][_0x3d227b(0x273)]+'.'}]};}catch(_0x4c50d9){const _0x26ede4=_0x4c50d9 instanceof Error?_0x4c50d9[_0x3d227b(0x237)]:String(_0x4c50d9);return reportMorphError({'error_message':_0x26ede4,'error_type':_0x4c50d9 instanceof Error?_0x4c50d9[_0x3d227b(0x225)]['name']:_0x3d227b(0x2a8),'context':{'tool':_0x3d227b(0x19a),'completion_id':_0x4868d9,'file_path':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x273)],'validated_path':_0x56de61,'instruction':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x19f)],'model':_0x3d227b(0x200),'dry_run':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x29d)],'file_exists':_0x2cd815,'file_read_error':_0x3b4b5b,'file_readable':_0x3d33c0!==null,'request_content':{'path':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x273)],'code_edit':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x1d0)],'instruction':_0x18d1e3['data'][_0x3d227b(0x19f)],'original_code':_0x3d33c0!==null?_0x3d33c0[_0x3d227b(0x1bf)]>0xc350?_0x3d33c0['substring'](0x0,0xc350)+_0x3d227b(0x1ea)+_0x3d33c0[_0x3d227b(0x1bf)]+_0x3d227b(0x21e):_0x3d33c0:_0x3d227b(0x1e8)+(_0x3b4b5b||_0x3d227b(0x208))+']','original_code_length':_0x3d33c0?.[_0x3d227b(0x1bf)]??0x0,'model':_0x3d227b(0x200),'dry_run':_0x18d1e3[_0x3d227b(0x19d)][_0x3d227b(0x29d)]}},'stack_trace':_0x4c50d9 instanceof Error?_0x4c50d9[_0x3d227b(0x21c)]:undefined,'source':_0x3d227b(0x1ec)})[_0x3d227b(0x26e)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x26ede4}],'isError':!![]};}}case _0x3d227b(0x1fa):{const _0x3d3914=WarpGrepArgsSchema[_0x3d227b(0x194)](_0x1f14b7);if(!_0x3d3914[_0x3d227b(0x1ee)])return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x264)+_0x3d3914[_0x3d227b(0x1cf)]}],'isError':!![]};const _0x18dcda=_0x460e97=>{const _0x32eeee=_0x3d227b,_0x4183ec=[];for(const _0x915ae1 of _0x460e97||[]){const _0x101cfa=_0x915ae1[_0x32eeee(0x24e)],_0x98ea44=_0x915ae1['content'];if(_0x101cfa===_0x32eeee(0x23d)&&_0x98ea44){const _0x5c0f56=_0x98ea44[_0x32eeee(0x203)]('\x0a')[_0x32eeee(0x25b)](_0x2b280b=>_0x2b280b[_0x32eeee(0x1ed)]());for(const _0x1cf0bb of _0x5c0f56){const _0x88d123=_0x1cf0bb[_0x32eeee(0x210)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x88d123){_0x4183ec[_0x32eeee(0x201)](_0x32eeee(0x290)+_0x88d123[0x1]+'\x27\x20'+_0x88d123[0x2]);continue;}const _0x3f8703=_0x1cf0bb['match'](/^read\s+(.+)$/);if(_0x3f8703){_0x4183ec[_0x32eeee(0x201)](_0x32eeee(0x28a)+_0x3f8703[0x1]);continue;}const _0x3b7757=_0x1cf0bb[_0x32eeee(0x210)](/^list_directory\s+(.+)$/);if(_0x3b7757){_0x4183ec[_0x32eeee(0x201)]('list_directory\x20'+_0x3b7757[0x1]);continue;}}}}return _0x4183ec;},_0x3aba2d=_0x509299=>{const _0x176577=_0x3d227b,_0x2793c9=[];if(!_0x509299||!Array[_0x176577(0x230)](_0x509299))return _0x2793c9;const _0x580de4=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x176577(0x1dc)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x176577(0x288),'tool':_0x176577(0x1dc)},{'pattern':/\[READ ERROR\]/,'error_type':_0x176577(0x25f),'tool':_0x176577(0x1dc)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x176577(0x23a),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x176577(0x206),'tool':_0x176577(0x2b0)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x176577(0x1c6),'tool':_0x176577(0x2b0)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x176577(0x1dc)},{'pattern':/\[SYMLINK\]/,'error_type':_0x176577(0x1e3),'tool':_0x176577(0x1dc)},{'pattern':/not a text file/,'error_type':_0x176577(0x23a),'tool':_0x176577(0x1dc)},{'pattern':/symbolic link/,'error_type':_0x176577(0x1e3),'tool':_0x176577(0x1dc)},{'pattern':/Error reading file:/,'error_type':_0x176577(0x25f),'tool':_0x176577(0x1dc)},{'pattern':/status="error"/,'error_type':_0x176577(0x2a1),'tool':_0x176577(0x204)}];let _0x18380f=0x0;for(const _0x37c73f of _0x509299){if(_0x37c73f[_0x176577(0x24e)]===_0x176577(0x1a4)){_0x18380f++;const _0x4c516f=_0x37c73f[_0x176577(0x1f6)];if(!_0x4c516f||typeof _0x4c516f!==_0x176577(0x292))continue;for(const {pattern:_0x3af1a4,error_type:_0x20cd59,tool:_0x58ed0e}of _0x580de4){const _0x55c627=_0x4c516f[_0x176577(0x210)](new RegExp(_0x3af1a4[_0x176577(0x240)],'g'));if(_0x55c627)for(const _0x314f2d of _0x55c627){const _0x525d82=_0x4c516f[_0x176577(0x28c)](_0x314f2d),_0x4e24cc=_0x4c516f[_0x176577(0x25e)](_0x525d82,Math['min'](_0x525d82+0xc8,_0x4c516f[_0x176577(0x1bf)]));_0x2793c9['push']({'tool':_0x58ed0e,'error_type':_0x20cd59,'error_message':_0x4e24cc[_0x176577(0x203)]('\x0a')[0x0],'turn':_0x18380f});}}}}return _0x2793c9;};try{const _0x5b4b98=a0_0x54e64d[_0x3d227b(0x268)](_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x27a)]),_0x32c85a=_0x3d3914['data'][_0x3d227b(0x231)],_0x5873e5=_0x32c85a===_0x3d227b(0x192)?{'allowNames':[_0x3d227b(0x192)]}:undefined,_0x4b8f07=new LocalRipgrepProvider(_0x5b4b98,undefined,_0x5873e5),_0x42f30a=await runWarpGrep({'searchTerm':_0x3d3914['data'][_0x3d227b(0x1a1)],'repoRoot':_0x5b4b98,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4b8f07,'search_type':_0x32c85a}),_0x5c4026=_0x3aba2d(_0x42f30a[_0x3d227b(0x227)]);_0x5c4026[_0x3d227b(0x1bf)]>0x0&&reportMorphError({'error_message':_0x3d227b(0x272)+_0x5c4026['length']+_0x3d227b(0x28d),'error_type':_0x3d227b(0x207),'level':'warn','tool':_0x3d227b(0x1fa),'context':{'repo_path':_0x3d3914['data'][_0x3d227b(0x27a)],'query':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x1a1)],'model':_0x3d227b(0x1e0),'termination_reason':_0x42f30a[_0x3d227b(0x226)],'sub_tool_errors':_0x5c4026,'timings':_0x42f30a[_0x3d227b(0x22a)],'tool_calls':_0x18dcda(_0x42f30a['messages']),'messages':_0x42f30a[_0x3d227b(0x227)]?.[_0x3d227b(0x1de)](_0x1ea6b5=>({'role':_0x1ea6b5[_0x3d227b(0x24e)],'content':_0x1ea6b5['content']}))},'source':_0x3d227b(0x1ec)})['catch'](()=>{});let _0x2c019b='';if(_0x42f30a[_0x3d227b(0x226)]===_0x3d227b(0x257)&&_0x42f30a[_0x3d227b(0x197)]?.[_0x3d227b(0x1b8)]?.['files']){const _0x321e3f=_0x42f30a[_0x3d227b(0x197)]['metadata'][_0x3d227b(0x265)];if(_0x321e3f[_0x3d227b(0x1bf)]===0x0)return _0x2c019b=_0x42f30a['finish'][_0x3d227b(0x2a3)]||_0x3d227b(0x1b0),{'content':[{'type':_0x3d227b(0x205),'text':_0x2c019b}]};const _0x58f54d=[],_0x5b0a40=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x40961f of _0x42f30a[_0x3d227b(0x227)]){const _0x54eee0=_0x40961f[_0x3d227b(0x24e)],_0x4878e9=_0x40961f['content'];if(_0x54eee0===_0x3d227b(0x23d)&&_0x4878e9){const _0xb19cf1=_0x4878e9['split']('\x0a')[_0x3d227b(0x25b)](_0x263699=>_0x263699[_0x3d227b(0x1ed)]());for(const _0x1a2eec of _0xb19cf1){const _0x2fe996=_0x1a2eec[_0x3d227b(0x210)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x2fe996){_0x5b0a40['push'](_0x3d227b(0x1ae)+_0x2fe996[0x1]+_0x3d227b(0x251)+_0x2fe996[0x2]+'`');continue;}const _0x21e4e5=_0x1a2eec[_0x3d227b(0x210)](/^read\s+(.+)$/);if(_0x21e4e5){_0x5b0a40['push']('-\x20Read\x20file\x20`'+_0x21e4e5[0x1]+'`');continue;}const _0x2f73fd=_0x1a2eec[_0x3d227b(0x210)](/^list_directory\s+(.+)$/);if(_0x2f73fd){_0x5b0a40[_0x3d227b(0x201)](_0x3d227b(0x21f)+_0x2f73fd[0x1]+'`');continue;}}}}_0x58f54d['push'](_0x5b0a40[_0x3d227b(0x26c)]('\x0a'));const _0x5189d2=['',_0x3d227b(0x224)];for(const _0x142401 of _0x321e3f){if(_0x142401[_0x3d227b(0x20b)]==='*')_0x5189d2['push']('-\x20'+_0x142401[_0x3d227b(0x273)]+':*');else{if(Array[_0x3d227b(0x230)](_0x142401['lines'])){const _0x2eb700=_0x142401['lines'][_0x3d227b(0x1de)](([_0x484991,_0x4214e1])=>{if(_0x484991===_0x4214e1)return''+_0x484991;return _0x484991+'-'+_0x4214e1;});_0x5189d2['push']('-\x20'+_0x142401[_0x3d227b(0x273)]+':'+_0x2eb700['join'](','));}else _0x5189d2[_0x3d227b(0x201)]('-\x20'+_0x142401['path']+':*');}}_0x5189d2['push'](''),_0x58f54d['push'](_0x5189d2[_0x3d227b(0x26c)]('\x0a')),_0x58f54d[_0x3d227b(0x201)](_0x3d227b(0x263));const _0x1894ff=[];for(const _0x256f73 of _0x321e3f){let _0x19c41d=a0_0x54e64d[_0x3d227b(0x268)](_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x27a)],_0x256f73[_0x3d227b(0x273)]),_0x4d1915=null,_0xaca8db=null;try{_0x4d1915=await a0_0x143afa['readFile'](_0x19c41d,{'encoding':_0x3d227b(0x262)});}catch(_0x43aa58){const _0x5cf0e3=fixPathRepetition(_0x19c41d);if(_0x5cf0e3)try{_0x4d1915=await a0_0x143afa['readFile'](_0x5cf0e3,{'encoding':_0x3d227b(0x262)}),_0x19c41d=_0x5cf0e3;}catch{_0xaca8db=_0x43aa58 instanceof Error?_0x43aa58:new Error(String(_0x43aa58));}else _0xaca8db=_0x43aa58 instanceof Error?_0x43aa58:new Error(String(_0x43aa58));}if(_0x4d1915!==null){const _0x11b23a=_0x4d1915[_0x3d227b(0x203)](/\r?\n/),_0x2d0710=[_0x3d227b(0x1cc)+_0x256f73[_0x3d227b(0x273)]+'\x22>'];if(_0x256f73[_0x3d227b(0x20b)]==='*'||!Array['isArray'](_0x256f73[_0x3d227b(0x20b)]))for(let _0x484ea6=0x1;_0x484ea6<=_0x11b23a['length'];_0x484ea6++){const _0x175fae=_0x11b23a[_0x484ea6-0x1];_0x2d0710[_0x3d227b(0x201)](_0x484ea6+'|\x20'+_0x175fae);}else for(const [_0x5521cf,_0x888c57]of _0x256f73[_0x3d227b(0x20b)]){_0x2d0710['length']>0x1&&_0x2d0710['push']('');for(let _0x189fbc=_0x5521cf;_0x189fbc<=_0x888c57&&_0x189fbc<=_0x11b23a[_0x3d227b(0x1bf)];_0x189fbc++){const _0x1ba6a4=_0x11b23a[_0x189fbc-0x1];_0x2d0710[_0x3d227b(0x201)](_0x189fbc+'|\x20'+_0x1ba6a4);}}_0x2d0710[_0x3d227b(0x201)](_0x3d227b(0x1b6)),_0x1894ff[_0x3d227b(0x201)](_0x2d0710[_0x3d227b(0x26c)]('\x0a'));}else _0x1894ff[_0x3d227b(0x201)](_0x3d227b(0x1cc)+_0x256f73['path']+_0x3d227b(0x239)+(_0xaca8db?.[_0x3d227b(0x237)]||_0x3d227b(0x1bb))+_0x3d227b(0x1a3));}_0x58f54d['push'](_0x1894ff['join']('\x0a\x0a')),_0x2c019b=_0x58f54d[_0x3d227b(0x26c)]('\x0a');const _0x221dc2=_0x42f30a[_0x3d227b(0x1f4)]?.[_0x3d227b(0x25b)](_0x10b2ce=>_0x10b2ce[_0x3d227b(0x237)]?.['startsWith'](_0x3d227b(0x24b)))||[];if(_0x221dc2[_0x3d227b(0x1bf)]>0x0){const _0x1efbe9=_0x221dc2[_0x3d227b(0x1de)](_0x4b1f91=>_0x4b1f91[_0x3d227b(0x237)])[_0x3d227b(0x26c)](';\x20');reportMorphError({'error_message':_0x1efbe9,'error_type':_0x3d227b(0x1c0),'context':{'tool':_0x3d227b(0x1fa),'repo_path':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x27a)],'query':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x1a1)],'model':'morph-warp-grep-v1-1111v0','termination_reason':'completed_with_file_errors','error_count':_0x221dc2[_0x3d227b(0x1bf)],'is_timeout':![],'timings':_0x42f30a[_0x3d227b(0x22a)],'files_attempted':_0x321e3f[_0x3d227b(0x1de)](_0x5008b3=>({'path':_0x5008b3[_0x3d227b(0x273)],'lines':_0x5008b3[_0x3d227b(0x20b)]})),'tool_calls':_0x18dcda(_0x42f30a[_0x3d227b(0x227)]),'messages':_0x42f30a[_0x3d227b(0x227)]?.[_0x3d227b(0x1de)](_0x3c2221=>({'role':_0x3c2221['role'],'content':_0x3c2221[_0x3d227b(0x1f6)]})),'request_content':{'query':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x1a1)],'repo_path':_0x3d3914[_0x3d227b(0x19d)]['repo_path'],'repoRoot':a0_0x54e64d['resolve'](_0x3d3914['data'][_0x3d227b(0x27a)]),'model':_0x3d227b(0x1e0)}},'source':_0x3d227b(0x1ec)})[_0x3d227b(0x26e)](()=>{});}}else{if(_0x42f30a[_0x3d227b(0x226)]===_0x3d227b(0x20d)&&_0x42f30a[_0x3d227b(0x1f4)][_0x3d227b(0x1bf)]>0x0){const _0xeee496=_0x42f30a[_0x3d227b(0x1f4)][_0x3d227b(0x1de)](_0x1c8169=>_0x1c8169[_0x3d227b(0x237)])[_0x3d227b(0x26c)](';\x20');_0x2c019b=_0x3d227b(0x1e5)+_0xeee496;const _0x17f1c3=_0xeee496[_0x3d227b(0x218)]()[_0x3d227b(0x234)](_0x3d227b(0x26d))||_0xeee496[_0x3d227b(0x218)]()[_0x3d227b(0x234)](_0x3d227b(0x235))||_0xeee496[_0x3d227b(0x218)]()[_0x3d227b(0x234)](_0x3d227b(0x275)),_0x3309d6=_0x42f30a['finish']?.[_0x3d227b(0x1b8)]?.[_0x3d227b(0x265)],_0x5d827e=_0x42f30a[_0x3d227b(0x1f4)][0x0];reportMorphError({'error_message':_0xeee496,'error_type':_0x17f1c3?_0x3d227b(0x285):_0x5d827e?.[_0x3d227b(0x225)]?.[_0x3d227b(0x19b)]||_0x3d227b(0x27f),'context':{'tool':'warpgrep_codebase_search','repo_path':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x27a)],'query':_0x3d3914['data'][_0x3d227b(0x1a1)],'model':_0x3d227b(0x1e0),'termination_reason':_0x42f30a['terminationReason'],'error_count':_0x42f30a[_0x3d227b(0x1f4)][_0x3d227b(0x1bf)],'is_timeout':_0x17f1c3,'timings':_0x42f30a[_0x3d227b(0x22a)],'files_attempted':_0x3309d6?.[_0x3d227b(0x1de)](_0x559cc8=>({'path':_0x559cc8[_0x3d227b(0x273)],'lines':_0x559cc8[_0x3d227b(0x20b)]})),'tool_calls':_0x18dcda(_0x42f30a[_0x3d227b(0x227)]),'messages':_0x42f30a[_0x3d227b(0x227)]?.['map'](_0x3868b1=>({'role':_0x3868b1['role'],'content':_0x3868b1[_0x3d227b(0x1f6)]})),'request_content':{'query':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x1a1)],'repo_path':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x27a)],'repoRoot':a0_0x54e64d['resolve'](_0x3d3914[_0x3d227b(0x19d)]['repo_path']),'model':_0x3d227b(0x1e0)}},'stack_trace':_0x5d827e?.['stack']||undefined,'source':_0x3d227b(0x1ec)})['catch'](()=>{});}else _0x2c019b='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x3d227b(0x205),'text':_0x2c019b}]};}catch(_0x43f540){const _0x331cd8=_0x43f540 instanceof Error?_0x43f540[_0x3d227b(0x237)]:String(_0x43f540),_0x6a6741=_0x331cd8[_0x3d227b(0x218)]()['includes']('timeout')||_0x331cd8[_0x3d227b(0x218)]()[_0x3d227b(0x234)](_0x3d227b(0x235))||_0x331cd8['toLowerCase']()['includes']('etimedout')||_0x43f540 instanceof Error&&_0x43f540[_0x3d227b(0x19b)]==='TimeoutError';return reportMorphError({'error_message':_0x331cd8,'error_type':_0x6a6741?_0x3d227b(0x285):_0x43f540 instanceof Error?_0x43f540[_0x3d227b(0x225)][_0x3d227b(0x19b)]:_0x3d227b(0x2a8),'context':{'tool':_0x3d227b(0x1fa),'repo_path':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x27a)],'query':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x1a1)],'model':_0x3d227b(0x1e0),'is_timeout':_0x6a6741,'exception_phase':_0x3d227b(0x1f9),'request_content':{'query':_0x3d3914[_0x3d227b(0x19d)][_0x3d227b(0x1a1)],'repo_path':_0x3d3914['data'][_0x3d227b(0x27a)],'repoRoot':a0_0x54e64d[_0x3d227b(0x268)](_0x3d3914[_0x3d227b(0x19d)]['repo_path']),'model':'morph-warp-grep-v1-1111v0'}},'stack_trace':_0x43f540 instanceof Error?_0x43f540['stack']:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x276)+_0x331cd8}],'isError':![]};}}case _0x3d227b(0x289):{const _0x591660=WarpGrepGitHubArgsSchema['safeParse'](_0x1f14b7);if(!_0x591660[_0x3d227b(0x1ee)])return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x264)+_0x591660['error']}],'isError':!![]};const _0x348a61=_0x591660[_0x3d227b(0x19d)]['github_url']||_0x591660[_0x3d227b(0x19d)][_0x3d227b(0x1d8)];if(!_0x348a61)return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x1f7)}],'isError':!![]};const _0x1d42f7=MORPH_API_KEY;if(!_0x1d42f7)throw new Error(_0x3d227b(0x1fd));const _0x1c2d06=Date['now']();console[_0x3d227b(0x1cf)](_0x3d227b(0x286)+_0x348a61+_0x3d227b(0x1df)+_0x591660[_0x3d227b(0x19d)][_0x3d227b(0x1a1)]+'\x22');try{const _0x981e45=new WarpGrepClient({'morphApiKey':_0x1d42f7,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x51d1ac=await _0x981e45['searchGitHub']({'searchTerm':_0x591660[_0x3d227b(0x19d)]['search_string'],'github':_0x348a61,'branch':_0x591660[_0x3d227b(0x19d)][_0x3d227b(0x1da)]}),_0x39aa4b=Date[_0x3d227b(0x2a2)]()-_0x1c2d06;console['error'](_0x3d227b(0x20c)+_0x39aa4b+'ms.\x20Success:\x20'+_0x51d1ac[_0x3d227b(0x1ee)]);const _0x15a2ec=formatResult(_0x51d1ac);return{'content':[{'type':_0x3d227b(0x205),'text':_0x15a2ec}]};}catch(_0x274ad4){const _0x35f7b8=Date[_0x3d227b(0x2a2)]()-_0x1c2d06,_0x88644=_0x274ad4 instanceof Error?_0x274ad4[_0x3d227b(0x237)]:String(_0x274ad4);return console['error'](_0x3d227b(0x1e1)+_0x35f7b8+_0x3d227b(0x1d5),_0x88644),reportMorphError({'error_message':_0x88644,'error_type':_0x274ad4 instanceof Error?_0x274ad4[_0x3d227b(0x225)][_0x3d227b(0x19b)]:_0x3d227b(0x2a8),'context':{'tool':_0x3d227b(0x289),'github_url':_0x348a61,'search_string':_0x591660['data'][_0x3d227b(0x1a1)],'branch':_0x591660[_0x3d227b(0x19d)][_0x3d227b(0x1da)]},'stack_trace':_0x274ad4 instanceof Error?_0x274ad4[_0x3d227b(0x21c)]:undefined,'source':_0x3d227b(0x1ec),'tool':_0x3d227b(0x289),'latency_ms':_0x35f7b8})[_0x3d227b(0x26e)](()=>{}),{'content':[{'type':'text','text':_0x3d227b(0x26f)+_0x88644}],'isError':![]};}}case'codebase_search':{const _0x575b7a=CodebaseSearchArgsSchema[_0x3d227b(0x194)](_0x1f14b7);if(!_0x575b7a[_0x3d227b(0x1ee)])return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x264)+_0x575b7a[_0x3d227b(0x1cf)]}],'isError':!![]};try{const _0x219785=MORPH_API_KEY;if(!_0x219785)throw new Error(_0x3d227b(0x248));const _0x4fa4a5=_0x575b7a[_0x3d227b(0x19d)]['targetDirectories'],_0x7fedea=await executeCodebaseSearch({'query':_0x575b7a[_0x3d227b(0x19d)][_0x3d227b(0x2a9)],'target_directories':_0x4fa4a5,'limit':_0x575b7a[_0x3d227b(0x19d)]['limit']},{'apiKey':_0x219785,'repoId':_0x575b7a[_0x3d227b(0x19d)][_0x3d227b(0x212)],'branch':_0x575b7a[_0x3d227b(0x19d)][_0x3d227b(0x1da)],'commitHash':_0x575b7a['data'][_0x3d227b(0x1dd)],'debug':![]});if(!_0x7fedea[_0x3d227b(0x1ee)])return{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x1c2)+_0x7fedea[_0x3d227b(0x1cf)]}],'isError':!![]};const _0xa40ad=_0x7fedea[_0x3d227b(0x284)]['length']===0x0?'No\x20results\x20found\x20for\x20query:\x20\x22'+_0x575b7a[_0x3d227b(0x19d)][_0x3d227b(0x2a9)]+'\x22':_0x3d227b(0x1b7)+_0x7fedea['results']['length']+_0x3d227b(0x191)+_0x7fedea[_0x3d227b(0x277)][_0x3d227b(0x24a)]+_0x3d227b(0x18f)+_0x7fedea[_0x3d227b(0x284)]['map']((_0x5d0993,_0x303a67)=>_0x303a67+0x1+'.\x20'+_0x5d0993['filepath']+'\x20('+(_0x5d0993[_0x3d227b(0x296)]*0x64)[_0x3d227b(0x1ac)](0x1)+_0x3d227b(0x1d9)+(_0x3d227b(0x1e6)+_0x5d0993[_0x3d227b(0x23c)]+'-'+_0x5d0993['endLine']+'\x0a')+(_0x3d227b(0x22b)+_0x5d0993[_0x3d227b(0x1f6)][_0x3d227b(0x25e)](0x0,0xc8)+(_0x5d0993['content'][_0x3d227b(0x1bf)]>0xc8?_0x3d227b(0x1c7):'')+'\x0a'))[_0x3d227b(0x26c)]('\x0a');return{'content':[{'type':'text','text':_0xa40ad}]};}catch(_0x1094bf){const _0x132d99=_0x1094bf instanceof Error?_0x1094bf['message']:String(_0x1094bf);return reportMorphError({'error_message':_0x132d99,'error_type':_0x1094bf instanceof Error?_0x1094bf[_0x3d227b(0x225)][_0x3d227b(0x19b)]:_0x3d227b(0x2a8),'context':{'tool':_0x3d227b(0x295),'query':_0x575b7a[_0x3d227b(0x19d)]['query'],'repo_id':_0x575b7a[_0x3d227b(0x19d)][_0x3d227b(0x212)],'target_directories':_0x575b7a[_0x3d227b(0x19d)][_0x3d227b(0x215)]},'stack_trace':_0x1094bf instanceof Error?_0x1094bf['stack']:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x3d227b(0x205),'text':_0x3d227b(0x1e5)+_0x132d99}],'isError':!![]};}}default:throw new Error(_0x3d227b(0x24c)+_0x18e272);}}catch(_0x128598){const _0x322f08=_0x128598 instanceof Error?_0x128598['message']:String(_0x128598);return reportMorphError({'error_message':_0x322f08,'error_type':_0x128598 instanceof Error?_0x128598[_0x3d227b(0x225)][_0x3d227b(0x19b)]:'UnknownError','context':{'tool':name,'arguments':args?JSON[_0x3d227b(0x20f)](args)[_0x3d227b(0x25e)](0x0,0x1f4):undefined,'mcp_server_version':_0x3d227b(0x222)},'stack_trace':_0x128598 instanceof Error?_0x128598['stack']:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':'text','text':'Error:\x20'+_0x322f08}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4860ca){const _0x2f6b02=a0_0x56fcd6,_0x26c9a4=await getValidRootDirectories(_0x4860ca);if(_0x26c9a4[_0x2f6b02(0x1bf)]>0x0)allowedDirectories=[..._0x26c9a4],console[_0x2f6b02(0x1cf)](_0x2f6b02(0x1cd)+_0x26c9a4['length']+'\x20valid\x20directories');else{console[_0x2f6b02(0x1cf)](_0x2f6b02(0x1b9));if(ENABLE_WORKSPACE_MODE)try{const _0x277610=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x277610&&(allowedDirectories=[_0x277610],console['error'](_0x2f6b02(0x27d)+_0x277610));}catch(_0x5e4193){console[_0x2f6b02(0x1cf)](_0x2f6b02(0x221)+_0x5e4193);}}}server[a0_0x56fcd6(0x190)](RootsListChangedNotificationSchema,async()=>{const _0x45f335=a0_0x56fcd6;try{const _0x153a56=await server[_0x45f335(0x29a)]();_0x153a56&&_0x45f335(0x20a)in _0x153a56&&await updateAllowedDirectoriesFromRoots(_0x153a56[_0x45f335(0x20a)]);}catch(_0x442ba8){console[_0x45f335(0x1cf)](_0x45f335(0x279),_0x442ba8 instanceof Error?_0x442ba8[_0x45f335(0x237)]:String(_0x442ba8));}}),server[a0_0x56fcd6(0x2b1)]=async()=>{const _0x25fcea=a0_0x56fcd6,_0x2c7b0f=server[_0x25fcea(0x249)]();if(_0x2c7b0f?.[_0x25fcea(0x20a)])try{const _0x1d7e77=await server['listRoots']();_0x1d7e77&&_0x25fcea(0x20a)in _0x1d7e77?await updateAllowedDirectoriesFromRoots(_0x1d7e77[_0x25fcea(0x20a)]):console[_0x25fcea(0x1cf)](_0x25fcea(0x258));}catch(_0x264d9d){console[_0x25fcea(0x1cf)]('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x264d9d instanceof Error?_0x264d9d[_0x25fcea(0x237)]:String(_0x264d9d));}else{if(allowedDirectories[_0x25fcea(0x1bf)]>0x0)console[_0x25fcea(0x1cf)](_0x25fcea(0x243),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x25fcea(0x1cf)](_0x25fcea(0x245));else throw new Error(_0x25fcea(0x223));}}};async function runServer(){const _0xd52103=a0_0x56fcd6,_0x2c9492=new StdioServerTransport();await server[_0xd52103(0x21b)](_0x2c9492),console[_0xd52103(0x1cf)](_0xd52103(0x1c3)),allowedDirectories[_0xd52103(0x1bf)]===0x0&&console[_0xd52103(0x1cf)](_0xd52103(0x274));}runServer()[a0_0x56fcd6(0x26e)](_0x4631f7=>{const _0x3cd7a8=a0_0x56fcd6;console[_0x3cd7a8(0x1cf)](_0x3cd7a8(0x241),_0x4631f7),process[_0x3cd7a8(0x2aa)](0x1);});
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x1e1f9f,_0x713f46){const _0x3912e1=a1_0x27d7,_0x4881b6=_0x1e1f9f();while(!![]){try{const _0x8d828c=-parseInt(_0x3912e1(0x126))/0x1*(-parseInt(_0x3912e1(0x11e))/0x2)+-parseInt(_0x3912e1(0x121))/0x3*(-parseInt(_0x3912e1(0x122))/0x4)+-parseInt(_0x3912e1(0x11f))/0x5+-parseInt(_0x3912e1(0x114))/0x6+parseInt(_0x3912e1(0x118))/0x7*(parseInt(_0x3912e1(0x129))/0x8)+-parseInt(_0x3912e1(0x11a))/0x9+-parseInt(_0x3912e1(0x117))/0xa*(parseInt(_0x3912e1(0x11b))/0xb);if(_0x8d828c===_0x713f46)break;else _0x4881b6['push'](_0x4881b6['shift']());}catch(_0x277870){_0x4881b6['push'](_0x4881b6['shift']());}}}(a1_0x1174,0x490ea));function a1_0x1174(){const _0x4678d2=['291370NWXFBZ','1096781UgaJQu','homedir','2827440KsVSNn','44DSjgyp','replace','test','2282WsWjZK','336065WBMLOh','match','3PtAgkz','1871768HsyrPD','toUpperCase','slice','trim','498gJXncx','/mnt/','normalize','8eFMSmj','2374080uaEMdd','startsWith','charAt'];a1_0x1174=function(){return _0x4678d2;};return a1_0x1174();}function a1_0x27d7(_0x356fe8,_0x382800){_0x356fe8=_0x356fe8-0x114;const _0x117422=a1_0x1174();let _0x27d7a3=_0x117422[_0x356fe8];return _0x27d7a3;}import a1_0x437e7c from'path';import a1_0x4f0e3b from'os';export function convertToWindowsPath(_0x45f8cf){const _0x57f4bb=a1_0x27d7;if(_0x45f8cf[_0x57f4bb(0x115)](_0x57f4bb(0x127))){const _0x5f087c=_0x45f8cf[_0x57f4bb(0x116)](0x5)[_0x57f4bb(0x123)](),_0x402f4f=_0x45f8cf['slice'](0x6)[_0x57f4bb(0x11c)](/\//g,'\x5c');return _0x5f087c+':'+_0x402f4f;}if(_0x45f8cf['match'](/^\/[a-zA-Z]\//)){const _0x320a0e=_0x45f8cf[_0x57f4bb(0x116)](0x1)[_0x57f4bb(0x123)](),_0x41991d=_0x45f8cf['slice'](0x2)[_0x57f4bb(0x11c)](/\//g,'\x5c');return _0x320a0e+':'+_0x41991d;}if(_0x45f8cf[_0x57f4bb(0x120)](/^[a-zA-Z]:/))return _0x45f8cf['replace'](/\//g,'\x5c');return _0x45f8cf;}export function normalizePath(_0x498209){const _0x59ee2e=a1_0x27d7;_0x498209=_0x498209[_0x59ee2e(0x125)]()[_0x59ee2e(0x11c)](/^["']|["']$/g,'');const _0x32d1fe=_0x498209[_0x59ee2e(0x115)]('/')&&!_0x498209['match'](/^\/mnt\/[a-z]\//i)&&!_0x498209[_0x59ee2e(0x120)](/^\/[a-zA-Z]\//);if(_0x32d1fe)return _0x498209[_0x59ee2e(0x11c)](/\/+/g,'/')[_0x59ee2e(0x11c)](/\/+$/,'');_0x498209=convertToWindowsPath(_0x498209);if(_0x498209[_0x59ee2e(0x115)]('\x5c\x5c')){let _0x291585=_0x498209;_0x291585=_0x291585[_0x59ee2e(0x11c)](/^\\{2,}/,'\x5c\x5c');const _0x19578f=_0x291585['substring'](0x2)[_0x59ee2e(0x11c)](/\\\\/g,'\x5c');_0x498209='\x5c\x5c'+_0x19578f;}else _0x498209=_0x498209[_0x59ee2e(0x11c)](/\\\\/g,'\x5c');let _0x2c5dd6=a1_0x437e7c[_0x59ee2e(0x128)](_0x498209);_0x498209[_0x59ee2e(0x115)]('\x5c\x5c')&&!_0x2c5dd6['startsWith']('\x5c\x5c')&&(_0x2c5dd6='\x5c'+_0x2c5dd6);if(_0x2c5dd6[_0x59ee2e(0x120)](/^[a-zA-Z]:/)){let _0x1be6bf=_0x2c5dd6[_0x59ee2e(0x11c)](/\//g,'\x5c');return/^[a-z]:/[_0x59ee2e(0x11d)](_0x1be6bf)&&(_0x1be6bf=_0x1be6bf[_0x59ee2e(0x116)](0x0)[_0x59ee2e(0x123)]()+_0x1be6bf[_0x59ee2e(0x124)](0x1)),_0x1be6bf;}return _0x2c5dd6[_0x59ee2e(0x11c)](/\//g,'\x5c');}export function expandHome(_0x40ecdd){const _0x31601a=a1_0x27d7;if(_0x40ecdd['startsWith']('~/')||_0x40ecdd==='~')return a1_0x437e7c['join'](a1_0x4f0e3b[_0x31601a(0x119)](),_0x40ecdd[_0x31601a(0x124)](0x1));return _0x40ecdd;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x587e97,_0x1b598f){const _0x4c1ca5=a2_0x15a9,_0x1eb8d0=_0x587e97();while(!![]){try{const _0x112c71=-parseInt(_0x4c1ca5(0xb0))/0x1+-parseInt(_0x4c1ca5(0xb4))/0x2*(parseInt(_0x4c1ca5(0xaf))/0x3)+-parseInt(_0x4c1ca5(0xaa))/0x4+-parseInt(_0x4c1ca5(0xb5))/0x5*(-parseInt(_0x4c1ca5(0xa7))/0x6)+-parseInt(_0x4c1ca5(0xa2))/0x7+parseInt(_0x4c1ca5(0xb3))/0x8+-parseInt(_0x4c1ca5(0xa8))/0x9*(-parseInt(_0x4c1ca5(0xa5))/0xa);if(_0x112c71===_0x1b598f)break;else _0x1eb8d0['push'](_0x1eb8d0['shift']());}catch(_0xb6e99e){_0x1eb8d0['push'](_0x1eb8d0['shift']());}}}(a2_0x4c5f,0x6ce0e));import a2_0x11e0f5 from'path';function a2_0x15a9(_0x58511f,_0x5c3994){_0x58511f=_0x58511f-0xa2;const _0x4c5f00=a2_0x4c5f();let _0x15a994=_0x4c5f00[_0x58511f];return _0x15a994;}function a2_0x4c5f(){const _0x53f385=['sep','753168fHDZsi','780xFHRlm','330jCRYXZ','isAbsolute','2030483kUezJC','resolve','normalize','10SHovqm','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','29574PcqRYC','12161916SlTYjy','some','260128vXbxdN','includes','startsWith','string','Path\x20must\x20be\x20absolute\x20after\x20normalization','4575hYlccL','374967SJEdQH','isArray'];a2_0x4c5f=function(){return _0x53f385;};return a2_0x4c5f();}export function isPathWithinAllowedDirectories(_0x1f514c,_0x3ceadd){const _0x49a199=a2_0x15a9;if(typeof _0x1f514c!==_0x49a199(0xad)||!Array[_0x49a199(0xb1)](_0x3ceadd))return![];if(!_0x1f514c||_0x3ceadd['length']===0x0)return![];if(_0x1f514c[_0x49a199(0xab)]('\x00'))return![];let _0x32a5a1;try{_0x32a5a1=a2_0x11e0f5[_0x49a199(0xa3)](a2_0x11e0f5['normalize'](_0x1f514c));}catch{return![];}if(!a2_0x11e0f5[_0x49a199(0xb6)](_0x32a5a1))throw new Error(_0x49a199(0xae));return _0x3ceadd[_0x49a199(0xa9)](_0x2c6f5b=>{const _0x41520c=_0x49a199;if(typeof _0x2c6f5b!=='string'||!_0x2c6f5b)return![];if(_0x2c6f5b[_0x41520c(0xab)]('\x00'))return![];let _0xa7fdeb;try{_0xa7fdeb=a2_0x11e0f5['resolve'](a2_0x11e0f5[_0x41520c(0xa4)](_0x2c6f5b));}catch{return![];}if(!a2_0x11e0f5['isAbsolute'](_0xa7fdeb))throw new Error(_0x41520c(0xa6));if(_0x32a5a1===_0xa7fdeb)return!![];if(_0xa7fdeb===a2_0x11e0f5[_0x41520c(0xb2)])return _0x32a5a1['startsWith'](a2_0x11e0f5[_0x41520c(0xb2)]);return _0x32a5a1[_0x41520c(0xac)](_0xa7fdeb+a2_0x11e0f5['sep']);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1aa767,_0x1e96b8){const _0x3a505e=a3_0x3f68,_0x28d961=_0x1aa767();while(!![]){try{const _0x58ef8=parseInt(_0x3a505e(0xf6))/0x1+-parseInt(_0x3a505e(0xf8))/0x2+-parseInt(_0x3a505e(0xfa))/0x3+parseInt(_0x3a505e(0x101))/0x4+-parseInt(_0x3a505e(0x104))/0x5+-parseInt(_0x3a505e(0xf1))/0x6+parseInt(_0x3a505e(0x100))/0x7;if(_0x58ef8===_0x1e96b8)break;else _0x28d961['push'](_0x28d961['shift']());}catch(_0x3a47ec){_0x28d961['push'](_0x28d961['shift']());}}}(a3_0x382b,0xdbd27));import{promises as a3_0x2b5bb5}from'fs';import a3_0x229a19 from'path';import a3_0x2cde03 from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x1c8da9){const _0x584bc3=a3_0x3f68;try{const _0x35fca9=_0x1c8da9[_0x584bc3(0xf7)](_0x584bc3(0xf3))?_0x1c8da9[_0x584bc3(0xfd)](0x7):_0x1c8da9,_0x5bf480=_0x35fca9[_0x584bc3(0xf7)]('~/')||_0x35fca9==='~'?a3_0x229a19[_0x584bc3(0xff)](a3_0x2cde03[_0x584bc3(0xf5)](),_0x35fca9['slice'](0x1)):_0x35fca9,_0x30dfdd=a3_0x229a19[_0x584bc3(0xfc)](_0x5bf480),_0x2fac78=await a3_0x2b5bb5[_0x584bc3(0x102)](_0x30dfdd);return normalizePath(_0x2fac78);}catch{return null;}}function a3_0x3f68(_0x20e0b9,_0x37e79b){_0x20e0b9=_0x20e0b9-0xf0;const _0x382b92=a3_0x382b();let _0x3f6836=_0x382b92[_0x20e0b9];return _0x3f6836;}function formatDirectoryError(_0x2b34e1,_0x59c0ae,_0x575fdb){const _0x2d07f4=a3_0x3f68;if(_0x575fdb)return _0x2d07f4(0xf4)+_0x575fdb+':\x20'+_0x2b34e1;const _0x3bdfc9=_0x59c0ae instanceof Error?_0x59c0ae[_0x2d07f4(0xfb)]:String(_0x59c0ae);return'Skipping\x20invalid\x20directory:\x20'+_0x2b34e1+'\x20due\x20to\x20error:\x20'+_0x3bdfc9;}function a3_0x382b(){const _0x150bc4=['4308804OZLTCT','realpath','error','1068585fTeFws','uri','2586402eaPBXf','push','file://','Skipping\x20','homedir','1701293Prsfuv','startsWith','2831400bTrRyl','stat','4154925nZnGRJ','message','resolve','slice','invalid\x20path\x20or\x20inaccessible','join','10971492ohhLRz'];a3_0x382b=function(){return _0x150bc4;};return a3_0x382b();}export async function getValidRootDirectories(_0x531501){const _0x147b48=a3_0x3f68,_0x589bea=[];for(const _0x4c5c68 of _0x531501){const _0x3bec6d=await parseRootUri(_0x4c5c68[_0x147b48(0xf0)]);if(!_0x3bec6d){console[_0x147b48(0x103)](formatDirectoryError(_0x4c5c68[_0x147b48(0xf0)],undefined,_0x147b48(0xfe)));continue;}try{const _0x507ed3=await a3_0x2b5bb5[_0x147b48(0xf9)](_0x3bec6d);_0x507ed3['isDirectory']()?_0x589bea[_0x147b48(0xf2)](_0x3bec6d):console[_0x147b48(0x103)](formatDirectoryError(_0x3bec6d,undefined,'non-directory\x20root'));}catch(_0x284c3b){console['error'](formatDirectoryError(_0x3bec6d,_0x284c3b));}}return _0x589bea;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.119",
|
|
4
4
|
"description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Morph (https://morphllm.com)",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@google/generative-ai": "^0.21.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
38
|
-
"@morphllm/morphsdk": "0.2.
|
|
38
|
+
"@morphllm/morphsdk": "0.2.134",
|
|
39
39
|
"@vscode/ripgrep": "^1.15.14",
|
|
40
40
|
"axios": "^1.6.0",
|
|
41
41
|
"chalk": "^5.3.0",
|