@morphllm/morphmcp 0.8.119 → 0.8.120
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 +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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);});
|
|
2
|
+
const a0_0x362242=a0_0x5218;(function(_0x3b04de,_0x448535){const _0xfe3942=a0_0x5218,_0x43acc9=_0x3b04de();while(!![]){try{const _0x1733b5=-parseInt(_0xfe3942(0x1fa))/0x1+parseInt(_0xfe3942(0x13c))/0x2+-parseInt(_0xfe3942(0x1d6))/0x3+-parseInt(_0xfe3942(0x194))/0x4+-parseInt(_0xfe3942(0x1b2))/0x5*(-parseInt(_0xfe3942(0x11c))/0x6)+-parseInt(_0xfe3942(0x124))/0x7+parseInt(_0xfe3942(0x205))/0x8*(parseInt(_0xfe3942(0x1a7))/0x9);if(_0x1733b5===_0x448535)break;else _0x43acc9['push'](_0x43acc9['shift']());}catch(_0x4d0e98){_0x43acc9['push'](_0x43acc9['shift']());}}}(a0_0x13c2,0x2e194));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_0x1505da from'fs/promises';import a0_0x392035 from'path';import a0_0x4ad339 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_0x1615bb from'axios';function fixPathRepetition(_0x32a0b3){const _0x509a85=a0_0x5218,_0x3690d9=_0x32a0b3[_0x509a85(0x143)](a0_0x392035[_0x509a85(0x16d)])['filter'](Boolean);if(_0x3690d9[_0x509a85(0x164)]<0x2)return null;for(let _0x1724fd=Math[_0x509a85(0x149)](_0x3690d9[_0x509a85(0x164)]/0x2);_0x1724fd>=0x1;_0x1724fd--){for(let _0x57ac52=0x0;_0x57ac52<=_0x3690d9[_0x509a85(0x164)]-0x2*_0x1724fd;_0x57ac52++){const _0x15c912=_0x3690d9[_0x509a85(0x1e7)](_0x57ac52,_0x57ac52+_0x1724fd),_0x6a7776=_0x3690d9[_0x509a85(0x1e7)](_0x57ac52+_0x1724fd,_0x57ac52+0x2*_0x1724fd);if(_0x15c912[_0x509a85(0x1b1)]((_0x3218dd,_0x1826be)=>_0x3218dd===_0x6a7776[_0x1826be])){const _0x2c20ea=[..._0x3690d9[_0x509a85(0x1e7)](0x0,_0x57ac52),..._0x3690d9[_0x509a85(0x1e7)](_0x57ac52+_0x1724fd)];return a0_0x392035[_0x509a85(0x16d)]+_0x2c20ea[_0x509a85(0x1d3)](a0_0x392035[_0x509a85(0x16d)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x369813=a0_0x5218;try{const _0x407018=require(_0x369813(0x1e4));return _0x407018[_0x369813(0x14b)]??_0x369813(0x12c);}catch(_0x42e31c){return console['error']('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x42e31c),_0x369813(0x12c);}}function printHelp(){const _0x37bd18=a0_0x5218;console['log'](_0x37bd18(0x1af)+getPackageVersion()),console[_0x37bd18(0x1dc)](_0x37bd18(0x1ca)),console[_0x37bd18(0x1dc)](_0x37bd18(0x220)),console[_0x37bd18(0x1dc)](_0x37bd18(0x217)),console[_0x37bd18(0x1dc)](_0x37bd18(0x17c)),console[_0x37bd18(0x1dc)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x37bd18(0x1dc)]('\x0aExamples:'),console['log']('\x20\x20morph-mcp'),console[_0x37bd18(0x1dc)](_0x37bd18(0x134));}const cliArgs=process[a0_0x362242(0x161)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x362242(0x193),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x362242(0x130)](_0x328d13=>VERSION_FLAGS['has'](_0x328d13))&&(console[a0_0x362242(0x1dc)](a0_0x362242(0x1af)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x362242(0x130)](_0x1e14ad=>HELP_FLAGS[a0_0x362242(0x198)](_0x1e14ad))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x26ad3d){const _0x2fc5e6=a0_0x362242;for(let _0x1f5ba1=0x0;_0x1f5ba1<cliArgs[_0x2fc5e6(0x164)];_0x1f5ba1++){const _0x4135a7=cliArgs[_0x1f5ba1];if(_0x4135a7['startsWith']('--'+_0x26ad3d+'='))return _0x4135a7['slice'](('--'+_0x26ad3d+'=')[_0x2fc5e6(0x164)]);if(_0x4135a7==='--'+_0x26ad3d&&_0x1f5ba1+0x1<cliArgs[_0x2fc5e6(0x164)])return cliArgs[_0x1f5ba1+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x362242(0x164)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x362242(0x198)](arg)||HELP_FLAGS[a0_0x362242(0x198)](arg))continue;if(arg[a0_0x362242(0x1cf)](a0_0x362242(0x199)))continue;if(arg===a0_0x362242(0x15f)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x362242(0x1fe)][a0_0x362242(0x15d)]||process[a0_0x362242(0x1fe)][a0_0x362242(0x1bc)]||process[a0_0x362242(0x216)](),ENABLE_WORKSPACE_MODE=process[a0_0x362242(0x1fe)][a0_0x362242(0x12e)]!==a0_0x362242(0x1e8),MORPH_API_KEY=getCliArg(a0_0x362242(0x14f))??process[a0_0x362242(0x1fe)][a0_0x362242(0x17e)],MORPH_API_URL=process[a0_0x362242(0x1fe)][a0_0x362242(0x1a3)],MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x362242(0x1c2)]?parseInt(process[a0_0x362242(0x1fe)][a0_0x362242(0x1c2)],0xa):undefined;MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x362242(0x1bd))&&!MORPH_API_KEY[a0_0x362242(0x1cf)](a0_0x362242(0x163))&&console[a0_0x362242(0x16a)](a0_0x362242(0x1c1));async function reportMorphError(_0x3baf70){const _0x1efe6c=a0_0x362242;try{await a0_0x1615bb['post'](_0x1efe6c(0x182),{..._0x3baf70,'timestamp':new Date()['toISOString'](),'source':_0x3baf70['source']||'mcp-filesystem'},{'timeout':0x1388,'headers':{'Content-Type':_0x1efe6c(0x1ad),'Authorization':_0x1efe6c(0x169)+MORPH_API_KEY}});}catch{}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(console[a0_0x362242(0x16a)](a0_0x362242(0x184)),console[a0_0x362242(0x16a)]('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),console[a0_0x362242(0x16a)]('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),console['error'](a0_0x362242(0x1ab)),console[a0_0x362242(0x16a)](a0_0x362242(0x14d)),console[a0_0x362242(0x16a)]('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x31366d){const _0x523a7f=a0_0x362242;return a0_0x392035[_0x523a7f(0x19c)](_0x31366d);}function expandHome(_0x4b7105){const _0x425c89=a0_0x362242;if(_0x4b7105['startsWith']('~/')||_0x4b7105==='~')return a0_0x392035['join'](a0_0x4ad339['homedir'](),_0x4b7105[_0x425c89(0x1e7)](0x1));return _0x4b7105;}let allowedDirectories=await Promise[a0_0x362242(0x187)](args[a0_0x362242(0x18b)](async _0x1a3496=>{const _0x6e942e=a0_0x362242,_0x176d16=expandHome(_0x1a3496),_0x377f64=a0_0x392035[_0x6e942e(0x116)](_0x176d16);try{const _0x17e0ce=await a0_0x1505da[_0x6e942e(0x132)](_0x377f64);return normalizePath(_0x17e0ce);}catch(_0x4b5680){return normalizePath(_0x377f64);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x362242(0x188)](workspaceDir),console[a0_0x362242(0x16a)](a0_0x362242(0x142)+workspaceDir+a0_0x362242(0x1d5)));}catch(a0_0x53b21d){console['error'](a0_0x362242(0x207)+a0_0x53b21d);}async function detectWorkspaceRoot(_0x11e2f8){const _0x5a1e51=a0_0x362242;let _0x47413b=a0_0x392035[_0x5a1e51(0x116)](_0x11e2f8);const _0x1ac43c=['.git',_0x5a1e51(0x1a5),'package.json',_0x5a1e51(0x119),'pyproject.toml',_0x5a1e51(0x11e),_0x5a1e51(0x20c),'tsconfig.json',_0x5a1e51(0x1bb)];while(_0x47413b!==a0_0x392035[_0x5a1e51(0x123)](_0x47413b)){for(const _0x2c8b1e of _0x1ac43c){const _0xbacdc0=a0_0x392035['join'](_0x47413b,_0x2c8b1e);try{return await a0_0x1505da[_0x5a1e51(0x1a8)](_0xbacdc0),normalizePath(_0x47413b);}catch{}}_0x47413b=a0_0x392035[_0x5a1e51(0x123)](_0x47413b);}return normalizePath(_0x11e2f8);}function a0_0x5218(_0x44f5c2,_0x5da20e){_0x44f5c2=_0x44f5c2-0x116;const _0x13c22f=a0_0x13c2();let _0x5218b5=_0x13c22f[_0x44f5c2];return _0x5218b5;}await Promise[a0_0x362242(0x187)](args[a0_0x362242(0x18b)](async _0x2173e5=>{const _0x57d6f2=a0_0x362242;try{const _0x27e3bd=await a0_0x1505da['stat'](expandHome(_0x2173e5));!_0x27e3bd[_0x57d6f2(0x1c8)]()&&(console[_0x57d6f2(0x16a)]('Error:\x20'+_0x2173e5+_0x57d6f2(0x122)),process[_0x57d6f2(0x12f)](0x1));}catch(_0x396e07){console['error'](_0x57d6f2(0x1f2)+_0x2173e5+':',_0x396e07),process['exit'](0x1);}}));async function validatePath(_0x38c96d){const _0x354020=a0_0x362242,_0x13ad3c=expandHome(_0x38c96d),_0x494e91=a0_0x392035['resolve'](_0x13ad3c);try{const _0x5945d3=await a0_0x1505da[_0x354020(0x132)](_0x494e91);return _0x5945d3;}catch(_0x10c162){if(_0x10c162[_0x354020(0x1f1)]===_0x354020(0x177)){const _0x10beac=a0_0x392035[_0x354020(0x123)](_0x494e91);try{const _0x1419eb=await a0_0x1505da[_0x354020(0x132)](_0x10beac);return a0_0x392035[_0x354020(0x1d3)](_0x1419eb,a0_0x392035[_0x354020(0x140)](_0x494e91));}catch{throw new Error(_0x354020(0x1c4)+_0x10beac);}}throw _0x10c162;}}const MorphEditFileArgsSchema=z[a0_0x362242(0x11a)]({'path':z['string'](),'code_edit':z['string']()[a0_0x362242(0x170)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z['string']()[a0_0x362242(0x170)](a0_0x362242(0x1b5)),'dryRun':z[a0_0x362242(0x176)]()[a0_0x362242(0x1b8)](![])[a0_0x362242(0x170)](a0_0x362242(0x1ea))}),WarpGrepArgsSchema=z[a0_0x362242(0x11a)]({'search_string':z[a0_0x362242(0x166)]()['describe'](a0_0x362242(0x1d0)),'repo_path':z[a0_0x362242(0x166)]()[a0_0x362242(0x170)](a0_0x362242(0x212)),'search_type':z['enum']([a0_0x362242(0x1b8),a0_0x362242(0x1a6)])[a0_0x362242(0x1fd)]()[a0_0x362242(0x170)](a0_0x362242(0x201))}),WarpGrepGitHubArgsSchema=z[a0_0x362242(0x11a)]({'search_string':z[a0_0x362242(0x166)]()[a0_0x362242(0x170)](a0_0x362242(0x1d0)),'github_url':z[a0_0x362242(0x166)]()[a0_0x362242(0x1fd)]()[a0_0x362242(0x170)](a0_0x362242(0x155)),'owner_repo':z['string']()[a0_0x362242(0x1fd)]()[a0_0x362242(0x170)](a0_0x362242(0x135)),'branch':z[a0_0x362242(0x166)]()[a0_0x362242(0x1fd)]()['describe'](a0_0x362242(0x131))}),CodebaseSearchArgsSchema=z[a0_0x362242(0x11a)]({'query':z[a0_0x362242(0x166)]()[a0_0x362242(0x170)](a0_0x362242(0x20a)),'repoId':z['string']()['describe'](a0_0x362242(0x152)),'branch':z[a0_0x362242(0x166)]()[a0_0x362242(0x1fd)]()[a0_0x362242(0x170)](a0_0x362242(0x213)),'commitHash':z[a0_0x362242(0x166)]()['optional']()[a0_0x362242(0x170)](a0_0x362242(0x223)),'targetDirectories':z['array'](z['string']())[a0_0x362242(0x1b8)]([])[a0_0x362242(0x170)](a0_0x362242(0x13a)),'limit':z[a0_0x362242(0x1c7)]()[a0_0x362242(0x1fd)]()[a0_0x362242(0x1b8)](0xa)[a0_0x362242(0x170)](a0_0x362242(0x1f9))}),server=new Server({'name':a0_0x362242(0x185),'version':a0_0x362242(0x147)},{'capabilities':{'tools':{}}});server[a0_0x362242(0x20e)](ListToolsRequestSchema,async()=>{const _0x2c524d=a0_0x362242,_0x51f7f6=[{'name':_0x2c524d(0x174),'description':_0x2c524d(0x21a)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x2c524d(0x20f)+'Benefits:\x0a'+_0x2c524d(0x1d2)+_0x2c524d(0x21b)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x2c524d(0x154)+_0x2c524d(0x18d)+_0x2c524d(0x19a)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x2c524d(0x167)+'-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a'+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x2c524d(0x16f)+_0x2c524d(0x181)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x2c524d(0x18c)+_0x2c524d(0x1eb)+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+_0x2c524d(0x14c)+_0x2c524d(0x153),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'warpgrep_codebase_search','description':_0x2c524d(0x118)+_0x2c524d(0x1f6)+'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'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20subagent\x20in\x20its\x20search.\x20'+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.'+'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'+'You\x20should\x20consider\x20using\x20classical\x20search\x20tools\x20afterwards\x20to\x20locate\x20the\x20rest,\x20but\x20only\x20if\x20necessary.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]},{'name':_0x2c524d(0x15c),'description':'**SEMANTIC\x20CODE\x20SEARCH\x20-\x20USE\x20FOR\x20FINDING\x20CODE**\x0a\x0a'+'⚡\x20INTELLIGENT:\x20Natural\x20language\x20search\x20across\x20your\x20entire\x20codebase\x20using\x20AI\x20embeddings.\x0a'+_0x2c524d(0x218)+_0x2c524d(0x1ee)+_0x2c524d(0x1c9)+_0x2c524d(0x200)+_0x2c524d(0x158)+_0x2c524d(0x21d)+_0x2c524d(0x1e6)+'Returns\x20ranked\x20code\x20chunks\x20with\x20relevance\x20scores,\x20file\x20paths,\x20and\x20line\x20numbers.\x20'+'Example\x20queries:\x20\x27Where\x20is\x20JWT\x20validation?\x27,\x20\x27How\x20does\x20auth\x20work?\x27,\x20\x27Find\x20database\x20connection\x20logic\x27.','inputSchema':zodToJsonSchema(CodebaseSearchArgsSchema),'requiresApiKey':!![]}],_0x358f9f=_0x51f7f6['filter'](_0x508c2f=>{const _0x234781=_0x2c524d;if(_0x234781(0x21c)in _0x508c2f&&_0x508c2f[_0x234781(0x21c)]&&!MORPH_API_KEY)return console['error'](_0x234781(0x160)+_0x508c2f[_0x234781(0x17f)]+_0x234781(0x1c0)),![];return!![];});return{'tools':_0x358f9f[_0x2c524d(0x18b)](_0x3264ff=>({'name':_0x3264ff[_0x2c524d(0x17f)],'description':_0x3264ff['description'],'inputSchema':_0x3264ff[_0x2c524d(0x20b)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x5d5439=>{const _0x252e3b=a0_0x362242;try{const {name:_0x5c328e,arguments:_0x87f8a3}=_0x5d5439[_0x252e3b(0x148)];switch(_0x5c328e){case'edit_file':{const _0x1e8eea=MorphEditFileArgsSchema[_0x252e3b(0x196)](_0x87f8a3);if(!_0x1e8eea[_0x252e3b(0x168)])throw new Error(_0x252e3b(0x1e9)+_0x1e8eea['error']);const _0x4dfd00=await validatePath(_0x1e8eea['data'][_0x252e3b(0x1e3)]);let _0x50a512=null,_0x8e98e6=!![],_0x5833d5=null;try{_0x50a512=await a0_0x1505da[_0x252e3b(0x144)](_0x4dfd00,'utf-8');}catch(_0x4b33e8){const _0x3e2375=_0x4b33e8['code'];_0x3e2375==='ENOENT'?(_0x8e98e6=![],_0x50a512=''):(_0x5833d5=_0x252e3b(0x1d9)+(_0x3e2375||_0x252e3b(0x12c))+_0x252e3b(0x129)+(_0x4b33e8 instanceof Error?_0x4b33e8['message']:String(_0x4b33e8)),console['error'](_0x252e3b(0x160)+_0x5833d5));}let _0x2535e9;try{const _0x1dad48=MORPH_API_KEY;if(!_0x1dad48)throw new Error(_0x252e3b(0x1a4));const _0x5eb5a9=a0_0x392035[_0x252e3b(0x123)](_0x4dfd00),_0xb86516=a0_0x392035[_0x252e3b(0x140)](_0x4dfd00),_0x1e9c66=await executeEditFile({'target_filepath':_0xb86516,'code_edit':_0x1e8eea[_0x252e3b(0x1db)]['code_edit'],'instructions':_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x117)]},{'morphApiKey':_0x1dad48,'morphApiUrl':MORPH_API_URL,'baseDir':_0x5eb5a9,'autoWrite':!_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x18a)],'generateUdiff':![],'debug':![]});_0x2535e9=_0x1e9c66['completionId'];if(!_0x1e9c66[_0x252e3b(0x168)])throw new Error(_0x1e9c66[_0x252e3b(0x16a)]||_0x252e3b(0x120));const _0x5e7103=_0x1e9c66['changes'],_0x32b92b='added\x20'+_0x5e7103[_0x252e3b(0x14e)]+_0x252e3b(0x18e)+_0x5e7103['linesRemoved']+_0x252e3b(0x13b)+_0x5e7103[_0x252e3b(0x13e)];if(_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x18a)])return{'content':[{'type':'text','text':_0x252e3b(0x186)+(_0x8e98e6?'':_0x252e3b(0x202))+':\x20'+_0x1e8eea['data'][_0x252e3b(0x117)]+'.\x20Changes:\x20'+_0x32b92b+_0x252e3b(0x1bf)+_0x1e8eea[_0x252e3b(0x1db)]['path']+'.'}]};return{'content':[{'type':'text','text':_0x252e3b(0x13f)+(_0x8e98e6?_0x252e3b(0x11f):_0x252e3b(0x1a1))+':\x20'+_0x1e8eea['data'][_0x252e3b(0x117)]+_0x252e3b(0x125)+_0x32b92b+_0x252e3b(0x1bf)+_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x1e3)]+'.'}]};}catch(_0x37e2d8){const _0x570bcc=_0x37e2d8 instanceof Error?_0x37e2d8[_0x252e3b(0x204)]:String(_0x37e2d8);return reportMorphError({'error_message':_0x570bcc,'error_type':_0x37e2d8 instanceof Error?_0x37e2d8[_0x252e3b(0x1cb)][_0x252e3b(0x17f)]:_0x252e3b(0x1dd),'context':{'tool':'edit_file','completion_id':_0x2535e9,'file_path':_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x1e3)],'validated_path':_0x4dfd00,'instruction':_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x117)],'model':'morph-v3-fast','dry_run':_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x18a)],'file_exists':_0x8e98e6,'file_read_error':_0x5833d5,'file_readable':_0x50a512!==null,'request_content':{'path':_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x1e3)],'code_edit':_0x1e8eea[_0x252e3b(0x1db)]['code_edit'],'instruction':_0x1e8eea[_0x252e3b(0x1db)]['instruction'],'original_code':_0x50a512!==null?_0x50a512[_0x252e3b(0x164)]>0xc350?_0x50a512[_0x252e3b(0x1cc)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x50a512[_0x252e3b(0x164)]+_0x252e3b(0x1b4):_0x50a512:_0x252e3b(0x1c3)+(_0x5833d5||'unknown\x20error')+']','original_code_length':_0x50a512?.[_0x252e3b(0x164)]??0x0,'model':_0x252e3b(0x1d1),'dry_run':_0x1e8eea[_0x252e3b(0x1db)][_0x252e3b(0x18a)]}},'stack_trace':_0x37e2d8 instanceof Error?_0x37e2d8[_0x252e3b(0x1ce)]:undefined,'source':'mcp-filesystem'})[_0x252e3b(0x195)](()=>{}),{'content':[{'type':_0x252e3b(0x137),'text':_0x252e3b(0x214)+_0x570bcc}],'isError':!![]};}}case _0x252e3b(0x221):{const _0x3b8705=WarpGrepArgsSchema[_0x252e3b(0x196)](_0x87f8a3);if(!_0x3b8705['success'])return{'content':[{'type':_0x252e3b(0x137),'text':_0x252e3b(0x1fc)+_0x3b8705[_0x252e3b(0x16a)]}],'isError':!![]};const _0x4ab77e=_0x5caa06=>{const _0x36348e=_0x252e3b,_0xf006a8=[];for(const _0x3b73a9 of _0x5caa06||[]){const _0x54f549=_0x3b73a9[_0x36348e(0x171)],_0x45f055=_0x3b73a9[_0x36348e(0x1ae)];if(_0x54f549==='assistant'&&_0x45f055){const _0x70a047=_0x45f055[_0x36348e(0x143)]('\x0a')[_0x36348e(0x1a9)](_0x3cc72d=>_0x3cc72d[_0x36348e(0x1ef)]());for(const _0x4e75a5 of _0x70a047){const _0x23585f=_0x4e75a5[_0x36348e(0x138)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x23585f){_0xf006a8['push'](_0x36348e(0x173)+_0x23585f[0x1]+'\x27\x20'+_0x23585f[0x2]);continue;}const _0x515dcf=_0x4e75a5[_0x36348e(0x138)](/^read\s+(.+)$/);if(_0x515dcf){_0xf006a8[_0x36348e(0x188)]('read\x20'+_0x515dcf[0x1]);continue;}const _0x43dbbb=_0x4e75a5['match'](/^list_directory\s+(.+)$/);if(_0x43dbbb){_0xf006a8[_0x36348e(0x188)](_0x36348e(0x1be)+_0x43dbbb[0x1]);continue;}}}}return _0xf006a8;},_0x1b1204=_0x59a6e3=>{const _0x1d075b=_0x252e3b,_0x16317f=[];if(!_0x59a6e3||!Array[_0x1d075b(0x15e)](_0x59a6e3))return _0x16317f;const _0x91aefc=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1d075b(0x121),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1d075b(0x19e),'tool':_0x1d075b(0x1e2)},{'pattern':/\[READ ERROR\]/,'error_type':_0x1d075b(0x1aa),'tool':_0x1d075b(0x1e2)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1d075b(0x1c6),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x1d075b(0x16b)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1d075b(0x1cd),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1d075b(0x1c6),'tool':_0x1d075b(0x1e2)},{'pattern':/\[SYMLINK\]/,'error_type':_0x1d075b(0x1f3),'tool':'read'},{'pattern':/not a text file/,'error_type':_0x1d075b(0x1c6),'tool':_0x1d075b(0x1e2)},{'pattern':/symbolic link/,'error_type':_0x1d075b(0x1f3),'tool':_0x1d075b(0x1e2)},{'pattern':/Error reading file:/,'error_type':_0x1d075b(0x1aa),'tool':_0x1d075b(0x1e2)},{'pattern':/status="error"/,'error_type':_0x1d075b(0x19d),'tool':_0x1d075b(0x12c)}];let _0x3926ec=0x0;for(const _0x21a72f of _0x59a6e3){if(_0x21a72f['role']===_0x1d075b(0x1ec)){_0x3926ec++;const _0xa29ecf=_0x21a72f[_0x1d075b(0x1ae)];if(!_0xa29ecf||typeof _0xa29ecf!==_0x1d075b(0x166))continue;for(const {pattern:_0xa4528c,error_type:_0x5991a7,tool:_0x3f770b}of _0x91aefc){const _0x40dd9b=_0xa29ecf['match'](new RegExp(_0xa4528c['source'],'g'));if(_0x40dd9b)for(const _0x3912ec of _0x40dd9b){const _0x1f250c=_0xa29ecf[_0x1d075b(0x1c5)](_0x3912ec),_0x46bfcd=_0xa29ecf[_0x1d075b(0x1cc)](_0x1f250c,Math[_0x1d075b(0x1df)](_0x1f250c+0xc8,_0xa29ecf['length']));_0x16317f[_0x1d075b(0x188)]({'tool':_0x3f770b,'error_type':_0x5991a7,'error_message':_0x46bfcd['split']('\x0a')[0x0],'turn':_0x3926ec});}}}}return _0x16317f;};try{const _0x5da3ff=a0_0x392035[_0x252e3b(0x116)](_0x3b8705[_0x252e3b(0x1db)]['repo_path']),_0x4db2a1=_0x3b8705['data'][_0x252e3b(0x127)],_0x3da041=_0x4db2a1===_0x252e3b(0x1a6)?{'allowNames':['node_modules']}:undefined,_0x3a7efc=new LocalRipgrepProvider(_0x5da3ff,undefined,_0x3da041),_0x1d929b=await runWarpGrep({'searchTerm':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'repoRoot':_0x5da3ff,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x3a7efc,'search_type':_0x4db2a1}),_0x5daa1a=_0x1b1204(_0x1d929b['messages']);_0x5daa1a['length']>0x0&&reportMorphError({'error_message':_0x252e3b(0x1d7)+_0x5daa1a[_0x252e3b(0x164)]+_0x252e3b(0x21e),'error_type':_0x252e3b(0x192),'level':_0x252e3b(0x1f4),'tool':_0x252e3b(0x221),'context':{'repo_path':_0x3b8705['data'][_0x252e3b(0x20d)],'query':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'model':_0x252e3b(0x191),'termination_reason':_0x1d929b[_0x252e3b(0x126)],'sub_tool_errors':_0x5daa1a,'timings':_0x1d929b[_0x252e3b(0x208)],'tool_calls':_0x4ab77e(_0x1d929b[_0x252e3b(0x206)]),'messages':_0x1d929b['messages']?.[_0x252e3b(0x18b)](_0x809d9f=>({'role':_0x809d9f['role'],'content':_0x809d9f['content']}))},'source':_0x252e3b(0x1da)})[_0x252e3b(0x195)](()=>{});let _0x1b249a='';if(_0x1d929b['terminationReason']===_0x252e3b(0x157)&&_0x1d929b[_0x252e3b(0x190)]?.[_0x252e3b(0x219)]?.[_0x252e3b(0x203)]){const _0x3ff0c0=_0x1d929b[_0x252e3b(0x190)]['metadata'][_0x252e3b(0x203)];if(_0x3ff0c0[_0x252e3b(0x164)]===0x0)return _0x1b249a=_0x1d929b[_0x252e3b(0x190)][_0x252e3b(0x1b0)]||_0x252e3b(0x1f0),{'content':[{'type':_0x252e3b(0x137),'text':_0x1b249a}]};const _0x3731a6=[],_0x57f1c2=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x3945d3 of _0x1d929b[_0x252e3b(0x206)]){const _0x2bb169=_0x3945d3[_0x252e3b(0x171)],_0x255d6a=_0x3945d3['content'];if(_0x2bb169===_0x252e3b(0x1b7)&&_0x255d6a){const _0x29c40c=_0x255d6a[_0x252e3b(0x143)]('\x0a')[_0x252e3b(0x1a9)](_0x364ab1=>_0x364ab1[_0x252e3b(0x1ef)]());for(const _0xc1192c of _0x29c40c){const _0x1e0bc6=_0xc1192c[_0x252e3b(0x138)](/^grep\s+'([^']+)'\s+(.+)$/);if(_0x1e0bc6){_0x57f1c2[_0x252e3b(0x188)]('-\x20Grepped\x20\x27'+_0x1e0bc6[0x1]+'\x27\x20in\x20`'+_0x1e0bc6[0x2]+'`');continue;}const _0x2ff987=_0xc1192c[_0x252e3b(0x138)](/^read\s+(.+)$/);if(_0x2ff987){_0x57f1c2[_0x252e3b(0x188)](_0x252e3b(0x1ac)+_0x2ff987[0x1]+'`');continue;}const _0x2a1f54=_0xc1192c['match'](/^list_directory\s+(.+)$/);if(_0x2a1f54){_0x57f1c2[_0x252e3b(0x188)](_0x252e3b(0x183)+_0x2a1f54[0x1]+'`');continue;}}}}_0x3731a6[_0x252e3b(0x188)](_0x57f1c2[_0x252e3b(0x1d3)]('\x0a'));const _0xbe5a4e=['',_0x252e3b(0x21f)];for(const _0x3b1151 of _0x3ff0c0){if(_0x3b1151[_0x252e3b(0x133)]==='*')_0xbe5a4e[_0x252e3b(0x188)]('-\x20'+_0x3b1151[_0x252e3b(0x1e3)]+':*');else{if(Array[_0x252e3b(0x15e)](_0x3b1151['lines'])){const _0x2c7b2d=_0x3b1151[_0x252e3b(0x133)][_0x252e3b(0x18b)](([_0x10e784,_0x35e0d6])=>{if(_0x10e784===_0x35e0d6)return''+_0x10e784;return _0x10e784+'-'+_0x35e0d6;});_0xbe5a4e['push']('-\x20'+_0x3b1151[_0x252e3b(0x1e3)]+':'+_0x2c7b2d['join'](','));}else _0xbe5a4e[_0x252e3b(0x188)]('-\x20'+_0x3b1151[_0x252e3b(0x1e3)]+':*');}}_0xbe5a4e[_0x252e3b(0x188)](''),_0x3731a6[_0x252e3b(0x188)](_0xbe5a4e['join']('\x0a')),_0x3731a6[_0x252e3b(0x188)](_0x252e3b(0x156));const _0x554864=[];for(const _0x1f1631 of _0x3ff0c0){let _0x175573=a0_0x392035[_0x252e3b(0x116)](_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)],_0x1f1631['path']),_0x53244e=null,_0x2b3a45=null;try{_0x53244e=await a0_0x1505da['readFile'](_0x175573,{'encoding':'utf-8'});}catch(_0x568322){const _0x38c414=fixPathRepetition(_0x175573);if(_0x38c414)try{_0x53244e=await a0_0x1505da[_0x252e3b(0x144)](_0x38c414,{'encoding':'utf-8'}),_0x175573=_0x38c414;}catch{_0x2b3a45=_0x568322 instanceof Error?_0x568322:new Error(String(_0x568322));}else _0x2b3a45=_0x568322 instanceof Error?_0x568322:new Error(String(_0x568322));}if(_0x53244e!==null){const _0x582a9b=_0x53244e['split'](/\r?\n/),_0x374ea7=[_0x252e3b(0x146)+_0x1f1631['path']+'\x22>'];if(_0x1f1631[_0x252e3b(0x133)]==='*'||!Array['isArray'](_0x1f1631[_0x252e3b(0x133)]))for(let _0x2d0bfd=0x1;_0x2d0bfd<=_0x582a9b['length'];_0x2d0bfd++){const _0x3a3cbf=_0x582a9b[_0x2d0bfd-0x1];_0x374ea7[_0x252e3b(0x188)](_0x2d0bfd+'|\x20'+_0x3a3cbf);}else for(const [_0x4cd28d,_0x59c6c4]of _0x1f1631[_0x252e3b(0x133)]){_0x374ea7[_0x252e3b(0x164)]>0x1&&_0x374ea7[_0x252e3b(0x188)]('');for(let _0xf536a3=_0x4cd28d;_0xf536a3<=_0x59c6c4&&_0xf536a3<=_0x582a9b[_0x252e3b(0x164)];_0xf536a3++){const _0x189814=_0x582a9b[_0xf536a3-0x1];_0x374ea7[_0x252e3b(0x188)](_0xf536a3+'|\x20'+_0x189814);}}_0x374ea7['push'](_0x252e3b(0x1d8)),_0x554864[_0x252e3b(0x188)](_0x374ea7[_0x252e3b(0x1d3)]('\x0a'));}else _0x554864[_0x252e3b(0x188)](_0x252e3b(0x146)+_0x1f1631[_0x252e3b(0x1e3)]+_0x252e3b(0x1f5)+(_0x2b3a45?.[_0x252e3b(0x204)]||'Unknown\x20error')+'\x0a</file>');}_0x3731a6[_0x252e3b(0x188)](_0x554864[_0x252e3b(0x1d3)]('\x0a\x0a')),_0x1b249a=_0x3731a6[_0x252e3b(0x1d3)]('\x0a');const _0x1b8d8a=_0x1d929b[_0x252e3b(0x16e)]?.[_0x252e3b(0x1a9)](_0x33fef3=>_0x33fef3['message']?.[_0x252e3b(0x1cf)]('File\x20read\x20error:'))||[];if(_0x1b8d8a['length']>0x0){const _0x3d3ccd=_0x1b8d8a[_0x252e3b(0x18b)](_0x647e80=>_0x647e80[_0x252e3b(0x204)])[_0x252e3b(0x1d3)](';\x20');reportMorphError({'error_message':_0x3d3ccd,'error_type':_0x252e3b(0x162),'context':{'tool':_0x252e3b(0x221),'repo_path':_0x3b8705['data'][_0x252e3b(0x20d)],'query':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'model':'morph-warp-grep-v1-1111v0','termination_reason':'completed_with_file_errors','error_count':_0x1b8d8a[_0x252e3b(0x164)],'is_timeout':![],'timings':_0x1d929b[_0x252e3b(0x208)],'files_attempted':_0x3ff0c0[_0x252e3b(0x18b)](_0x3b8f46=>({'path':_0x3b8f46[_0x252e3b(0x1e3)],'lines':_0x3b8f46[_0x252e3b(0x133)]})),'tool_calls':_0x4ab77e(_0x1d929b[_0x252e3b(0x206)]),'messages':_0x1d929b[_0x252e3b(0x206)]?.[_0x252e3b(0x18b)](_0x4b7d56=>({'role':_0x4b7d56['role'],'content':_0x4b7d56[_0x252e3b(0x1ae)]})),'request_content':{'query':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'repo_path':_0x3b8705['data'][_0x252e3b(0x20d)],'repoRoot':a0_0x392035[_0x252e3b(0x116)](_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)]),'model':_0x252e3b(0x191)}},'source':'mcp-filesystem'})[_0x252e3b(0x195)](()=>{});}}else{if(_0x1d929b[_0x252e3b(0x126)]===_0x252e3b(0x172)&&_0x1d929b[_0x252e3b(0x16e)][_0x252e3b(0x164)]>0x0){const _0x5b041f=_0x1d929b[_0x252e3b(0x16e)][_0x252e3b(0x18b)](_0x331d6a=>_0x331d6a[_0x252e3b(0x204)])[_0x252e3b(0x1d3)](';\x20');_0x1b249a=_0x252e3b(0x1f8)+_0x5b041f;const _0xa24457=_0x5b041f[_0x252e3b(0x1ed)]()[_0x252e3b(0x15a)](_0x252e3b(0x210))||_0x5b041f[_0x252e3b(0x1ed)]()[_0x252e3b(0x15a)](_0x252e3b(0x136))||_0x5b041f[_0x252e3b(0x1ed)]()[_0x252e3b(0x15a)](_0x252e3b(0x1e0)),_0xb182b8=_0x1d929b[_0x252e3b(0x190)]?.[_0x252e3b(0x219)]?.[_0x252e3b(0x203)],_0x442b3c=_0x1d929b['errors'][0x0];reportMorphError({'error_message':_0x5b041f,'error_type':_0xa24457?_0x252e3b(0x139):_0x442b3c?.[_0x252e3b(0x1cb)]?.['name']||'WarpGrepError','context':{'tool':'warpgrep_codebase_search','repo_path':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)],'query':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'model':_0x252e3b(0x191),'termination_reason':_0x1d929b[_0x252e3b(0x126)],'error_count':_0x1d929b['errors'][_0x252e3b(0x164)],'is_timeout':_0xa24457,'timings':_0x1d929b[_0x252e3b(0x208)],'files_attempted':_0xb182b8?.[_0x252e3b(0x18b)](_0x5af9b1=>({'path':_0x5af9b1[_0x252e3b(0x1e3)],'lines':_0x5af9b1[_0x252e3b(0x133)]})),'tool_calls':_0x4ab77e(_0x1d929b['messages']),'messages':_0x1d929b[_0x252e3b(0x206)]?.[_0x252e3b(0x18b)](_0x6b995=>({'role':_0x6b995['role'],'content':_0x6b995[_0x252e3b(0x1ae)]})),'request_content':{'query':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'repo_path':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)],'repoRoot':a0_0x392035['resolve'](_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)]),'model':_0x252e3b(0x191)}},'stack_trace':_0x442b3c?.[_0x252e3b(0x1ce)]||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0x1b249a=_0x252e3b(0x141);}return{'content':[{'type':'text','text':_0x1b249a}]};}catch(_0x52977b){const _0x3366bc=_0x52977b instanceof Error?_0x52977b[_0x252e3b(0x204)]:String(_0x52977b),_0xa59662=_0x3366bc[_0x252e3b(0x1ed)]()['includes'](_0x252e3b(0x210))||_0x3366bc[_0x252e3b(0x1ed)]()[_0x252e3b(0x15a)](_0x252e3b(0x136))||_0x3366bc[_0x252e3b(0x1ed)]()[_0x252e3b(0x15a)]('etimedout')||_0x52977b instanceof Error&&_0x52977b[_0x252e3b(0x17f)]===_0x252e3b(0x139);return reportMorphError({'error_message':_0x3366bc,'error_type':_0xa59662?_0x252e3b(0x139):_0x52977b instanceof Error?_0x52977b[_0x252e3b(0x1cb)]['name']:_0x252e3b(0x1dd),'context':{'tool':_0x252e3b(0x221),'repo_path':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)],'query':_0x3b8705[_0x252e3b(0x1db)]['search_string'],'model':_0x252e3b(0x191),'is_timeout':_0xa59662,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'repo_path':_0x3b8705[_0x252e3b(0x1db)]['repo_path'],'repoRoot':a0_0x392035[_0x252e3b(0x116)](_0x3b8705[_0x252e3b(0x1db)][_0x252e3b(0x20d)]),'model':_0x252e3b(0x191)}},'stack_trace':_0x52977b instanceof Error?_0x52977b[_0x252e3b(0x1ce)]:undefined,'source':_0x252e3b(0x1da)})[_0x252e3b(0x195)](()=>{}),{'content':[{'type':'text','text':_0x252e3b(0x14a)+_0x3366bc}],'isError':![]};}}case _0x252e3b(0x175):{const _0x176b3e=WarpGrepGitHubArgsSchema[_0x252e3b(0x196)](_0x87f8a3);if(!_0x176b3e['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x176b3e[_0x252e3b(0x16a)]}],'isError':!![]};const _0x4e77b4=_0x176b3e[_0x252e3b(0x1db)][_0x252e3b(0x15b)]||_0x176b3e['data'][_0x252e3b(0x1b6)];if(!_0x4e77b4)return{'content':[{'type':'text','text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0xbb2433=MORPH_API_KEY;if(!_0xbb2433)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x14f380=Date[_0x252e3b(0x128)]();console[_0x252e3b(0x16a)](_0x252e3b(0x11d)+_0x4e77b4+_0x252e3b(0x1d4)+_0x176b3e[_0x252e3b(0x1db)][_0x252e3b(0x1ff)]+'\x22');try{const _0x3cf2a3=new WarpGrepClient({'morphApiKey':_0xbb2433,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x46e1e8=await _0x3cf2a3[_0x252e3b(0x145)]({'searchTerm':_0x176b3e[_0x252e3b(0x1db)]['search_string'],'github':_0x4e77b4,'branch':_0x176b3e[_0x252e3b(0x1db)]['branch']}),_0x5764e8=Date[_0x252e3b(0x128)]()-_0x14f380;console[_0x252e3b(0x16a)]('[warpgrep_github_search]\x20Done\x20in\x20'+_0x5764e8+_0x252e3b(0x151)+_0x46e1e8[_0x252e3b(0x168)]);const _0x156ca9=formatResult(_0x46e1e8);return{'content':[{'type':_0x252e3b(0x137),'text':_0x156ca9}]};}catch(_0x4f5218){const _0x829805=Date[_0x252e3b(0x128)]()-_0x14f380,_0x543551=_0x4f5218 instanceof Error?_0x4f5218[_0x252e3b(0x204)]:String(_0x4f5218);return console[_0x252e3b(0x16a)](_0x252e3b(0x179)+_0x829805+_0x252e3b(0x1e5),_0x543551),reportMorphError({'error_message':_0x543551,'error_type':_0x4f5218 instanceof Error?_0x4f5218[_0x252e3b(0x1cb)]['name']:_0x252e3b(0x1dd),'context':{'tool':_0x252e3b(0x175),'github_url':_0x4e77b4,'search_string':_0x176b3e[_0x252e3b(0x1db)][_0x252e3b(0x1ff)],'branch':_0x176b3e[_0x252e3b(0x1db)][_0x252e3b(0x1a2)]},'stack_trace':_0x4f5218 instanceof Error?_0x4f5218[_0x252e3b(0x1ce)]:undefined,'source':_0x252e3b(0x1da),'tool':_0x252e3b(0x175),'latency_ms':_0x829805})[_0x252e3b(0x195)](()=>{}),{'content':[{'type':_0x252e3b(0x137),'text':_0x252e3b(0x150)+_0x543551}],'isError':![]};}}case'codebase_search':{const _0x11bab7=CodebaseSearchArgsSchema['safeParse'](_0x87f8a3);if(!_0x11bab7[_0x252e3b(0x168)])return{'content':[{'type':_0x252e3b(0x137),'text':'Invalid\x20arguments:\x20'+_0x11bab7[_0x252e3b(0x16a)]}],'isError':!![]};try{const _0x590b14=MORPH_API_KEY;if(!_0x590b14)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.');const _0x3b13f7=_0x11bab7[_0x252e3b(0x1db)][_0x252e3b(0x18f)],_0xaea5fc=await executeCodebaseSearch({'query':_0x11bab7[_0x252e3b(0x1db)][_0x252e3b(0x1e1)],'target_directories':_0x3b13f7,'limit':_0x11bab7['data'][_0x252e3b(0x1de)]},{'apiKey':_0x590b14,'repoId':_0x11bab7[_0x252e3b(0x1db)]['repoId'],'branch':_0x11bab7[_0x252e3b(0x1db)]['branch'],'commitHash':_0x11bab7['data'][_0x252e3b(0x180)],'debug':![]});if(!_0xaea5fc[_0x252e3b(0x168)])return{'content':[{'type':_0x252e3b(0x137),'text':_0x252e3b(0x215)+_0xaea5fc[_0x252e3b(0x16a)]}],'isError':!![]};const _0x799428=_0xaea5fc['results'][_0x252e3b(0x164)]===0x0?_0x252e3b(0x1b9)+_0x11bab7[_0x252e3b(0x1db)][_0x252e3b(0x1e1)]+'\x22':_0x252e3b(0x16c)+_0xaea5fc[_0x252e3b(0x17d)]['length']+'\x20results\x20in\x20'+_0xaea5fc['stats'][_0x252e3b(0x17a)]+'ms:\x0a\x0a'+_0xaea5fc[_0x252e3b(0x17d)][_0x252e3b(0x18b)]((_0x54fe33,_0x4b1713)=>_0x4b1713+0x1+'.\x20'+_0x54fe33[_0x252e3b(0x11b)]+'\x20('+(_0x54fe33[_0x252e3b(0x12d)]*0x64)[_0x252e3b(0x13d)](0x1)+_0x252e3b(0x209)+(_0x252e3b(0x17b)+_0x54fe33[_0x252e3b(0x19b)]+'-'+_0x54fe33[_0x252e3b(0x165)]+'\x0a')+('\x20\x20\x20'+_0x54fe33[_0x252e3b(0x1ae)][_0x252e3b(0x1cc)](0x0,0xc8)+(_0x54fe33['content']['length']>0xc8?'...':'')+'\x0a'))['join']('\x0a');return{'content':[{'type':_0x252e3b(0x137),'text':_0x799428}]};}catch(_0x1e246e){const _0x1dcefd=_0x1e246e instanceof Error?_0x1e246e[_0x252e3b(0x204)]:String(_0x1e246e);return reportMorphError({'error_message':_0x1dcefd,'error_type':_0x1e246e instanceof Error?_0x1e246e[_0x252e3b(0x1cb)][_0x252e3b(0x17f)]:_0x252e3b(0x1dd),'context':{'tool':'codebase_search','query':_0x11bab7[_0x252e3b(0x1db)]['query'],'repo_id':_0x11bab7[_0x252e3b(0x1db)]['repoId'],'target_directories':_0x11bab7[_0x252e3b(0x1db)][_0x252e3b(0x18f)]},'stack_trace':_0x1e246e instanceof Error?_0x1e246e['stack']:undefined,'source':'mcp-filesystem'})[_0x252e3b(0x195)](()=>{}),{'content':[{'type':_0x252e3b(0x137),'text':_0x252e3b(0x1f8)+_0x1dcefd}],'isError':!![]};}}default:throw new Error(_0x252e3b(0x222)+_0x5c328e);}}catch(_0x5e951e){const _0x3ac978=_0x5e951e instanceof Error?_0x5e951e[_0x252e3b(0x204)]:String(_0x5e951e);return reportMorphError({'error_message':_0x3ac978,'error_type':_0x5e951e instanceof Error?_0x5e951e[_0x252e3b(0x1cb)][_0x252e3b(0x17f)]:_0x252e3b(0x1dd),'context':{'tool':name,'arguments':args?JSON[_0x252e3b(0x19f)](args)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x252e3b(0x147)},'stack_trace':_0x5e951e instanceof Error?_0x5e951e[_0x252e3b(0x1ce)]:undefined,'source':_0x252e3b(0x1da)})['catch'](()=>{}),{'content':[{'type':_0x252e3b(0x137),'text':_0x252e3b(0x1f8)+_0x3ac978}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5c8760){const _0xf050c5=a0_0x362242,_0x352421=await getValidRootDirectories(_0x5c8760);if(_0x352421[_0xf050c5(0x164)]>0x0)allowedDirectories=[..._0x352421],console[_0xf050c5(0x16a)]('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x352421[_0xf050c5(0x164)]+_0xf050c5(0x159));else{console[_0xf050c5(0x16a)]('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x456e19=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x456e19&&(allowedDirectories=[_0x456e19],console[_0xf050c5(0x16a)](_0xf050c5(0x1f7)+_0x456e19));}catch(_0x2ce93a){console['error'](_0xf050c5(0x189)+_0x2ce93a);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x4abb63=a0_0x362242;try{const _0x28c4e0=await server['listRoots']();_0x28c4e0&&'roots'in _0x28c4e0&&await updateAllowedDirectoriesFromRoots(_0x28c4e0[_0x4abb63(0x12b)]);}catch(_0x1a21ab){console[_0x4abb63(0x16a)]('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x1a21ab instanceof Error?_0x1a21ab[_0x4abb63(0x204)]:String(_0x1a21ab));}}),server['oninitialized']=async()=>{const _0x4361b5=a0_0x362242,_0x3d4c8e=server['getClientCapabilities']();if(_0x3d4c8e?.[_0x4361b5(0x12b)])try{const _0x11afc9=await server[_0x4361b5(0x197)]();_0x11afc9&&_0x4361b5(0x12b)in _0x11afc9?await updateAllowedDirectoriesFromRoots(_0x11afc9['roots']):console['error'](_0x4361b5(0x1ba));}catch(_0x19a554){console[_0x4361b5(0x16a)](_0x4361b5(0x1fb),_0x19a554 instanceof Error?_0x19a554[_0x4361b5(0x204)]:String(_0x19a554));}else{if(allowedDirectories[_0x4361b5(0x164)]>0x0)console[_0x4361b5(0x16a)](_0x4361b5(0x211),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)console[_0x4361b5(0x16a)](_0x4361b5(0x1b3));else throw new Error(_0x4361b5(0x1a0));}}};async function runServer(){const _0xb16c0f=a0_0x362242,_0x4d42ab=new StdioServerTransport();await server[_0xb16c0f(0x12a)](_0x4d42ab),console[_0xb16c0f(0x16a)]('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0xb16c0f(0x164)]===0x0&&console[_0xb16c0f(0x16a)](_0xb16c0f(0x178));}function a0_0x13c2(){const _0x4e04ef=['number','isDirectory','-\x20Two-stage\x20retrieval:\x20vector\x20search\x20(~240ms)\x20+\x20GPU\x20reranking\x20(~630ms)\x0a','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','constructor','substring','RipgrepNotAvailable','stack','startsWith','Search\x20problem\x20statement\x20that\x20this\x20subagent\x20is\x20supposed\x20to\x20research\x20for','morph-v3-fast','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','join','\x20for:\x20\x22','\x20as\x20allowed\x20directory','760089EMFwDF','WarpGrep\x20sub-tool\x20errors:\x20','</file>','Failed\x20to\x20read\x20file:\x20','mcp-filesystem','data','log','UnknownError','limit','min','etimedout','query','read','path','../package.json','ms:','Search\x20your\x20codebase\x20using\x20natural\x20language\x20queries.\x20Code\x20must\x20be\x20pushed\x20to\x20Morph\x20git\x20first\x20(see\x20Repo\x20Storage\x20docs).\x20','slice','false','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','Preview\x20changes\x20without\x20applying\x20them.','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','user','toLowerCase','Benefits:\x0a','trim','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','code','Error\x20accessing\x20directory\x20','SymlinkError','warn','\x22>\x0aError\x20reading\x20file:\x20','This\x20tool\x20invokes\x20a\x20subagent\x20that\x20runs\x20parallel\x20grep\x20and\x20readfile\x20calls\x20over\x20multiple\x20turns\x20to\x20locate\x20line\x20ranges\x20and\x20files\x20which\x20might\x20be\x20relevant\x20to\x20the\x20request.\x20','Fallback:\x20Using\x20workspace\x20root\x20','Error:\x20','Max\x20results\x20to\x20return','302343pTXfsG','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Invalid\x20arguments:\x20','optional','env','search_string','-\x20Returns\x20precise\x20code\x20chunks\x20with\x20relevance\x20scores\x0a','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','\x20(new\x20file)','files','message','8BCYWEI','messages','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','timings','%\x20match)\x0a','Natural\x20language\x20query\x20to\x20search\x20for\x20code','inputSchema','.cursor','repo_path','setRequestHandler','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','timeout','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','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','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','❌\x20Morph\x20Edit\x20Failed:\x20','Search\x20failed:\x20','cwd','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','🎯\x20USE\x20THIS\x20TOOL\x20to\x20find\x20code\x20when\x20you\x20need\x20to\x20understand\x20existing\x20implementations.\x0a\x0a','metadata','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','requiresApiKey','-\x20Works\x20across\x20all\x20files\x20and\x20languages\x0a\x0a','\x20error(s)','Relevant\x20context\x20found:','\x0aOptions:','warpgrep_codebase_search','Unknown\x20tool:\x20','Specific\x20commit\x20hash\x20to\x20search','resolve','instruction','A\x20search\x20subagent\x20the\x20user\x20refers\x20to\x20as\x20\x27WarpGrep\x27\x20that\x20is\x20ideal\x20for\x20exploring\x20the\x20codebase\x20based\x20on\x20a\x20request.\x20','Cargo.toml','object','filepath','44784BDCwHi','[warpgrep_github_search]\x20Searching\x20','go.mod','Applied','Morph\x20FastApply\x20failed\x20without\x20error\x20message','FileNotFound','\x20is\x20not\x20a\x20directory','dirname','419230oGiSVj','.\x20Changes:\x20','terminationReason','search_type','now','\x20-\x20','connect','roots','unknown','rerankScore','ENABLE_WORKSPACE_MODE','exit','some','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','realpath','lines','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','timed\x20out','text','match','TimeoutError','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all',',\x20modified\x20','41476vFhrCd','toFixed','linesModified','Morph\x20Edit\x20','basename','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Workspace\x20mode\x20enabled:\x20Using\x20','split','readFile','searchGitHub','<file\x20path=\x22','0.2.0','params','floor','Error\x20running\x20fast\x20context\x20search:\x20','version','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','linesAdded','api-key','GitHub\x20search\x20failed:\x20','ms.\x20Success:\x20','Repository\x20identifier','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','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Here\x20is\x20the\x20content\x20of\x20files:\x0a','completed','-\x20Searches\x20by\x20semantic\x20meaning,\x20not\x20just\x20keywords\x0a','\x20valid\x20directories','includes','github_url','codebase_search','WORKSPACE_ROOT','isArray','--api-key','Warning:\x20','argv','FileReadError','morph-','length','endLine','string','For\x20deletions:\x0a','success','Bearer\x20','error','grep','Found\x20','sep','errors','Rules:\x0a','describe','role','terminated','grep\x20\x27','edit_file','warpgrep_github_search','boolean','ENOENT','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','[warpgrep_github_search]\x20Failed\x20in\x20','searchTimeMs','\x20\x20\x20Lines\x20','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','results','MORPH_API_KEY','name','commitHash','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','https://morphllm.com/api/error-report','-\x20Listed\x20directory\x20`','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','morph-mcp','Morph\x20Edit\x20Preview','all','push','Warning:\x20Workspace\x20fallback\x20failed:\x20','dryRun','map','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a',',\x20removed\x20','targetDirectories','finish','morph-warp-grep-v1-1111v0','SubToolError','--version','677892WRQKIv','catch','safeParse','listRoots','has','--api-key=','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','startLine','normalize','ToolException','PathError','stringify','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.','Created\x20File','branch','MORPH_API_URL','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','.vscode','node_modules','6160023xPXzRT','access','filter','ReadError','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','-\x20Read\x20file\x20`','application/json','content','@morphllm/morphmcp\x20','payload','every','180plJCYC','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x20chars)','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','owner_repo','assistant','default','No\x20results\x20found\x20for\x20query:\x20\x22','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','composer.json','PWD','sk-','list_directory\x20','.\x20Path:\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','MORPH_WARP_GREP_TIMEOUT','[could\x20not\x20read\x20file:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','indexOf','BinaryFile'];a0_0x13c2=function(){return _0x4e04ef;};return a0_0x13c2();}runServer()[a0_0x362242(0x195)](_0x46fa7c=>{const _0x37916d=a0_0x362242;console[_0x37916d(0x16a)]('Fatal\x20error\x20running\x20server:',_0x46fa7c),process['exit'](0x1);});
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4a8032,_0x415622){const _0x4fe622=a1_0x1807,_0x51cafb=_0x4a8032();while(!![]){try{const _0x4f53d6=parseInt(_0x4fe622(0x15b))/0x1+-parseInt(_0x4fe622(0x160))/0x2+-parseInt(_0x4fe622(0x15e))/0x3+-parseInt(_0x4fe622(0x161))/0x4+parseInt(_0x4fe622(0x157))/0x5*(parseInt(_0x4fe622(0x154))/0x6)+parseInt(_0x4fe622(0x164))/0x7+-parseInt(_0x4fe622(0x15f))/0x8*(parseInt(_0x4fe622(0x151))/0x9);if(_0x4f53d6===_0x415622)break;else _0x51cafb['push'](_0x51cafb['shift']());}catch(_0x4959fe){_0x51cafb['push'](_0x51cafb['shift']());}}}(a1_0x2cd0,0x5f6c7));import a1_0x5dcc48 from'path';import a1_0x1da6c2 from'os';export function convertToWindowsPath(_0x238124){const _0x139a8c=a1_0x1807;if(_0x238124[_0x139a8c(0x152)]('/mnt/')){const _0x3a112b=_0x238124[_0x139a8c(0x158)](0x5)[_0x139a8c(0x153)](),_0x2bf258=_0x238124['slice'](0x6)[_0x139a8c(0x15a)](/\//g,'\x5c');return _0x3a112b+':'+_0x2bf258;}if(_0x238124[_0x139a8c(0x162)](/^\/[a-zA-Z]\//)){const _0x383b75=_0x238124[_0x139a8c(0x158)](0x1)[_0x139a8c(0x153)](),_0x1269d0=_0x238124['slice'](0x2)[_0x139a8c(0x15a)](/\//g,'\x5c');return _0x383b75+':'+_0x1269d0;}if(_0x238124[_0x139a8c(0x162)](/^[a-zA-Z]:/))return _0x238124[_0x139a8c(0x15a)](/\//g,'\x5c');return _0x238124;}export function normalizePath(_0x4feaac){const _0x5a93ee=a1_0x1807;_0x4feaac=_0x4feaac[_0x5a93ee(0x15c)]()[_0x5a93ee(0x15a)](/^["']|["']$/g,'');const _0x44beec=_0x4feaac['startsWith']('/')&&!_0x4feaac['match'](/^\/mnt\/[a-z]\//i)&&!_0x4feaac['match'](/^\/[a-zA-Z]\//);if(_0x44beec)return _0x4feaac[_0x5a93ee(0x15a)](/\/+/g,'/')[_0x5a93ee(0x15a)](/\/+$/,'');_0x4feaac=convertToWindowsPath(_0x4feaac);if(_0x4feaac[_0x5a93ee(0x152)]('\x5c\x5c')){let _0x35edb5=_0x4feaac;_0x35edb5=_0x35edb5[_0x5a93ee(0x15a)](/^\\{2,}/,'\x5c\x5c');const _0x13c937=_0x35edb5[_0x5a93ee(0x163)](0x2)[_0x5a93ee(0x15a)](/\\\\/g,'\x5c');_0x4feaac='\x5c\x5c'+_0x13c937;}else _0x4feaac=_0x4feaac[_0x5a93ee(0x15a)](/\\\\/g,'\x5c');let _0x583274=a1_0x5dcc48['normalize'](_0x4feaac);_0x4feaac[_0x5a93ee(0x152)]('\x5c\x5c')&&!_0x583274[_0x5a93ee(0x152)]('\x5c\x5c')&&(_0x583274='\x5c'+_0x583274);if(_0x583274[_0x5a93ee(0x162)](/^[a-zA-Z]:/)){let _0x4fa3d8=_0x583274[_0x5a93ee(0x15a)](/\//g,'\x5c');return/^[a-z]:/[_0x5a93ee(0x156)](_0x4fa3d8)&&(_0x4fa3d8=_0x4fa3d8['charAt'](0x0)[_0x5a93ee(0x153)]()+_0x4fa3d8[_0x5a93ee(0x159)](0x1)),_0x4fa3d8;}return _0x583274[_0x5a93ee(0x15a)](/\//g,'\x5c');}function a1_0x1807(_0x4930fa,_0x4d82ea){_0x4930fa=_0x4930fa-0x151;const _0x2cd07f=a1_0x2cd0();let _0x180759=_0x2cd07f[_0x4930fa];return _0x180759;}export function expandHome(_0x699736){const _0x21f3a5=a1_0x1807;if(_0x699736[_0x21f3a5(0x152)]('~/')||_0x699736==='~')return a1_0x5dcc48[_0x21f3a5(0x15d)](a1_0x1da6c2[_0x21f3a5(0x155)](),_0x699736[_0x21f3a5(0x159)](0x1));return _0x699736;}function a1_0x2cd0(){const _0x160190=['trim','join','356454QznXoE','4757320eavqxL','99300ygTLJs','2285512qtGtms','match','substring','5271175OqpqAg','9vLIMKF','startsWith','toUpperCase','18UIxmyf','homedir','test','1103570YoCapl','charAt','slice','replace','310199oBpPCR'];a1_0x2cd0=function(){return _0x160190;};return a1_0x2cd0();}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x122c44,_0x5124d3){const _0x5b8511=a2_0x1261,_0x51dd4f=_0x122c44();while(!![]){try{const _0x29c56a=parseInt(_0x5b8511(0x6e))/0x1+-parseInt(_0x5b8511(0x66))/0x2*(-parseInt(_0x5b8511(0x77))/0x3)+parseInt(_0x5b8511(0x6f))/0x4*(parseInt(_0x5b8511(0x6c))/0x5)+-parseInt(_0x5b8511(0x71))/0x6+parseInt(_0x5b8511(0x74))/0x7+-parseInt(_0x5b8511(0x70))/0x8+-parseInt(_0x5b8511(0x68))/0x9;if(_0x29c56a===_0x5124d3)break;else _0x51dd4f['push'](_0x51dd4f['shift']());}catch(_0x20f404){_0x51dd4f['push'](_0x51dd4f['shift']());}}}(a2_0x15ce,0xab7ce));import a2_0x197b60 from'path';function a2_0x15ce(){const _0xe0d21f=['resolve','some','4670099jOcDac','length','includes','3uBqfpX','startsWith','normalize','863152LvWHrt','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','12543777mjMHfr','sep','string','Path\x20must\x20be\x20absolute\x20after\x20normalization','440145fdvbgr','isAbsolute','1195567yxWCkY','36mWlyPI','3192coAjrw','5939970ebmqks'];a2_0x15ce=function(){return _0xe0d21f;};return a2_0x15ce();}function a2_0x1261(_0x4604fc,_0x415c6b){_0x4604fc=_0x4604fc-0x64;const _0x15ce5a=a2_0x15ce();let _0x126183=_0x15ce5a[_0x4604fc];return _0x126183;}export function isPathWithinAllowedDirectories(_0x40180f,_0x4fbc9e){const _0xfcbe7b=a2_0x1261;if(typeof _0x40180f!==_0xfcbe7b(0x6a)||!Array['isArray'](_0x4fbc9e))return![];if(!_0x40180f||_0x4fbc9e[_0xfcbe7b(0x75)]===0x0)return![];if(_0x40180f[_0xfcbe7b(0x76)]('\x00'))return![];let _0x555878;try{_0x555878=a2_0x197b60[_0xfcbe7b(0x72)](a2_0x197b60[_0xfcbe7b(0x65)](_0x40180f));}catch{return![];}if(!a2_0x197b60[_0xfcbe7b(0x6d)](_0x555878))throw new Error(_0xfcbe7b(0x6b));return _0x4fbc9e[_0xfcbe7b(0x73)](_0x117f33=>{const _0x4ec8a5=_0xfcbe7b;if(typeof _0x117f33!==_0x4ec8a5(0x6a)||!_0x117f33)return![];if(_0x117f33[_0x4ec8a5(0x76)]('\x00'))return![];let _0x1de981;try{_0x1de981=a2_0x197b60[_0x4ec8a5(0x72)](a2_0x197b60[_0x4ec8a5(0x65)](_0x117f33));}catch{return![];}if(!a2_0x197b60[_0x4ec8a5(0x6d)](_0x1de981))throw new Error(_0x4ec8a5(0x67));if(_0x555878===_0x1de981)return!![];if(_0x1de981===a2_0x197b60[_0x4ec8a5(0x69)])return _0x555878[_0x4ec8a5(0x64)](a2_0x197b60['sep']);return _0x555878['startsWith'](_0x1de981+a2_0x197b60[_0x4ec8a5(0x69)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a3_0x2981(_0x196e98,_0x241fae){_0x196e98=_0x196e98-0x14b;const _0x5758a5=a3_0x5758();let _0x2981ac=_0x5758a5[_0x196e98];return _0x2981ac;}function a3_0x5758(){const _0x276d29=['homedir','81546ttZRXc','354335Txxggp','error','890iyLlpN','14643zlugkn','message','slice','join','startsWith','stat','Skipping\x20','135234JTDwzA','isDirectory','692848xbUCQh','Skipping\x20invalid\x20directory:\x20','24HFbztj','604056cBWYsx','339495BgfRjn','resolve','14UxOiTb','143zecTdY','file://','realpath','8IDVlWf','\x20due\x20to\x20error:\x20','non-directory\x20root','invalid\x20path\x20or\x20inaccessible'];a3_0x5758=function(){return _0x276d29;};return a3_0x5758();}(function(_0x3c8a3f,_0x55f3cd){const _0x56cbdd=a3_0x2981,_0x33e824=_0x3c8a3f();while(!![]){try{const _0x26b793=-parseInt(_0x56cbdd(0x151))/0x1+parseInt(_0x56cbdd(0x15b))/0x2+parseInt(_0x56cbdd(0x150))/0x3*(parseInt(_0x56cbdd(0x14b))/0x4)+-parseInt(_0x56cbdd(0x161))/0x5*(parseInt(_0x56cbdd(0x15f))/0x6)+-parseInt(_0x56cbdd(0x163))/0x7*(-parseInt(_0x56cbdd(0x15d))/0x8)+-parseInt(_0x56cbdd(0x154))/0x9*(parseInt(_0x56cbdd(0x153))/0xa)+-parseInt(_0x56cbdd(0x164))/0xb*(-parseInt(_0x56cbdd(0x160))/0xc);if(_0x26b793===_0x55f3cd)break;else _0x33e824['push'](_0x33e824['shift']());}catch(_0x2e803f){_0x33e824['push'](_0x33e824['shift']());}}}(a3_0x5758,0x2baa5));import{promises as a3_0x591daf}from'fs';import a3_0x4aa5e9 from'path';import a3_0x555b5b from'os';import{normalizePath}from'./path-utils.js';async function parseRootUri(_0x5a495b){const _0x26ab93=a3_0x2981;try{const _0x406367=_0x5a495b[_0x26ab93(0x158)](_0x26ab93(0x165))?_0x5a495b[_0x26ab93(0x156)](0x7):_0x5a495b,_0x59a725=_0x406367[_0x26ab93(0x158)]('~/')||_0x406367==='~'?a3_0x4aa5e9[_0x26ab93(0x157)](a3_0x555b5b[_0x26ab93(0x14f)](),_0x406367[_0x26ab93(0x156)](0x1)):_0x406367,_0x1557e0=a3_0x4aa5e9[_0x26ab93(0x162)](_0x59a725),_0x5270d8=await a3_0x591daf[_0x26ab93(0x166)](_0x1557e0);return normalizePath(_0x5270d8);}catch{return null;}}function formatDirectoryError(_0x31e270,_0x5c2a03,_0x507c2d){const _0x2cf94d=a3_0x2981;if(_0x507c2d)return _0x2cf94d(0x15a)+_0x507c2d+':\x20'+_0x31e270;const _0x5d5944=_0x5c2a03 instanceof Error?_0x5c2a03[_0x2cf94d(0x155)]:String(_0x5c2a03);return _0x2cf94d(0x15e)+_0x31e270+_0x2cf94d(0x14c)+_0x5d5944;}export async function getValidRootDirectories(_0x209ebe){const _0x5bd9ef=a3_0x2981,_0x515764=[];for(const _0x1dfb55 of _0x209ebe){const _0x4facf1=await parseRootUri(_0x1dfb55['uri']);if(!_0x4facf1){console['error'](formatDirectoryError(_0x1dfb55['uri'],undefined,_0x5bd9ef(0x14e)));continue;}try{const _0x1d8cab=await a3_0x591daf[_0x5bd9ef(0x159)](_0x4facf1);_0x1d8cab[_0x5bd9ef(0x15c)]()?_0x515764['push'](_0x4facf1):console[_0x5bd9ef(0x152)](formatDirectoryError(_0x4facf1,undefined,_0x5bd9ef(0x14d)));}catch(_0x399db8){console[_0x5bd9ef(0x152)](formatDirectoryError(_0x4facf1,_0x399db8));}}return _0x515764;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.120",
|
|
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)",
|