@morphllm/morphmcp 0.8.162 → 0.8.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/log-utils.js +1 -1
- package/dist/logger.js +1 -1
- package/dist/path-utils.js +1 -1
- package/dist/path-validation.js +1 -1
- package/dist/roots-utils.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const a0_0x398bd1=a0_0x2ddd;(function(_0xd43212,_0xc39ce1){const _0x3ac3c3=a0_0x2ddd,_0x426b85=_0xd43212();while(!![]){try{const _0x6ce6a1=-parseInt(_0x3ac3c3(0x1d2))/0x1+-parseInt(_0x3ac3c3(0x171))/0x2+parseInt(_0x3ac3c3(0x1b5))/0x3*(-parseInt(_0x3ac3c3(0x12b))/0x4)+-parseInt(_0x3ac3c3(0xee))/0x5*(parseInt(_0x3ac3c3(0x184))/0x6)+-parseInt(_0x3ac3c3(0x1d0))/0x7*(-parseInt(_0x3ac3c3(0x138))/0x8)+parseInt(_0x3ac3c3(0x14e))/0x9*(parseInt(_0x3ac3c3(0x135))/0xa)+parseInt(_0x3ac3c3(0xfa))/0xb*(parseInt(_0x3ac3c3(0x1a6))/0xc);if(_0x6ce6a1===_0xc39ce1)break;else _0x426b85['push'](_0x426b85['shift']());}catch(_0x393030){_0x426b85['push'](_0x426b85['shift']());}}}(a0_0x379f,0xb7d97));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_0x2d3af7 from'fs/promises';import a0_0x39e4da from'path';import a0_0x2455fc from'os';import{createRequire}from'module';function a0_0x379f(){const _0x1a39fe=['realpath','stack','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','.\x20Changes:\x20','tool_call_error','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','RipgrepNotAvailable','8352jQyTNO','tsconfig.json','edit_file','catch','errors','-\x20Listed\x20directory\x20`','list_directory','--api-key','ReadError','assistant','description','role','cwd','length','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','\x27\x20in\x20`','path_validation_start','Invalid\x20arguments:\x20','Morph\x20Edit\x20Preview','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','--api-key=','finish','post','../package.json','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','1437604Jrgpjk','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','107942qSoUPk','homedir','join','BinaryFile','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','user','code','Tool\x20','includes','\x20disabled\x20via\x20DISABLED_TOOLS','lines','path_validation_resolved','Failed\x20to\x20request\x20roots\x20from\x20client:','isArray','SubToolError','repo_path','composer.json','connect','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','grep','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.','UnknownError','tool_calls','code_edit','Specific\x20commit\x20hash\x20to\x20search','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','glob','MCP','safeParse','function','github_url','now','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','size','.cursor','indexOf','content','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','startsWith','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Tool\x20\x22','file_read_failed','list_directory\x20','-\x20Glob\x20search\x20`','Parent\x20directory\x20does\x20not\x20exist:\x20','morph-v3-large','log','--help','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','pattern','path_validation_failed','-\x20Read\x20file\x20`','default','\x0a...\x20(truncated,\x20total:\x20','api_request_start','Repository\x20identifier','\x0a</file>','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','argv','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','getClientCapabilities','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','provider_created','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x20as\x20allowed\x20directory','some','source','290680tMhHTS','context','\x20error(s)','.\x20Path:\x20','substring','branch','isDirectory','https://morphllm.com/api/error-report','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','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','Unknown\x20tool:\x20','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','748ovGtRY','array','ms:','-\x20Grepped\x20\x27','MORPH_LARGE_APPLY','optional','false','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','text','DISABLED_TOOLS','@morphllm/morphmcp\x20','etimedout','version','WarpGrepError','GitHub\x20search\x20failed:\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','TimeoutError','\x20valid\x20directories','oninitialized','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','toLowerCase','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','For\x20deletions:\x0a','requiresApiKey','debug','constructor','timed\x20out','Error\x20accessing\x20directory\x20','arguments','Morph\x20Edit\x20','warp_grep_start','\x20chars)','ENABLE_WORKSPACE_MODE','0.2.0','ms.\x20Success:\x20','data','warp_grep_complete','inputSchema','MORPH_WARP_GREP_TIMEOUT','❌\x20Morph\x20Edit\x20Failed:\x20','Max\x20results\x20to\x20return','SymlinkError','application/json','access','metadata','github_codebase_search','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','776RPuSRp','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','go.mod','added\x20','path','search_string','MORPH_API_KEY','utf-8','linesRemoved','morph-warp-grep-v2.1','10hPqydN','\x0aOptions:','API\x20error\x20(auth/rate-limit)','8AQwUKs','message','--version','turns','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','[could\x20not\x20read\x20file:\x20','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','dryRun','PWD','.git','name','map','instructions','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','FileReadError','has','codebase_search','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','setNotificationHandler','read','morph-mcp','morph-v3-fast','8082819dRDOmG','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:',',\x20removed\x20','setRequestHandler','Preview\x20changes\x20without\x20applying\x20them.','split','filter','Unknown\x20error','grep_search','\x20(new\x20file)','terminationReason','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','<file\x20path=\x22','success','MORPH_API_URL','Benefits:\x0a','timeout','Warning:\x20','floor','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','morph-','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','File\x20read\x20error:','grep\x20\x27','Error\x20running\x20fast\x20context\x20search:\x20','response','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','dirname','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','slice','LocalRipgrepProvider','WarpGrep\x20sub-tool\x20errors:\x20','pyproject.toml','1795284iCWYQE','\x22>\x0aError\x20reading\x20file:\x20','[github_codebase_search]\x20Failed\x20in\x20','glob\x20\x27','describe','changes','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','string','Failed\x20to\x20read\x20file:\x20','object','all','searchGitHub','basename','Rules:\x0a','search_type','node_modules','status','owner_repo','parse','144IdYkRe','timings','linesModified','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','mcp-filesystem','command','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','linesAdded','warn','ENOENT','runWarpGrep_call','\x20is\x20not\x20a\x20directory','roots','Morph\x20FastApply\x20failed\x20without\x20error\x20message','listRoots','files','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','error','match','exit','sk-','env','sep','resolve','package.json','push','instruction','messages','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Relevant\x20context\x20found:','unknown','normalize','tool_call_id','every','457152ZmekAh','readFile','\x20\x20morph-mcp','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','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.','Error:\x20','unknown\x20error','file_read_complete'];a0_0x379f=function(){return _0x1a39fe;};return a0_0x379f();}import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x2249b4 from'axios';function fixPathRepetition(_0x38f1cf){const _0x45ca2a=a0_0x2ddd,_0x59148c=_0x38f1cf[_0x45ca2a(0x153)](a0_0x39e4da[_0x45ca2a(0x19a)])[_0x45ca2a(0x154)](Boolean);if(_0x59148c[_0x45ca2a(0x1c2)]<0x2)return null;for(let _0x21a01a=Math[_0x45ca2a(0x160)](_0x59148c['length']/0x2);_0x21a01a>=0x1;_0x21a01a--){for(let _0x442767=0x0;_0x442767<=_0x59148c[_0x45ca2a(0x1c2)]-0x2*_0x21a01a;_0x442767++){const _0x2c8f1f=_0x59148c[_0x45ca2a(0x16d)](_0x442767,_0x442767+_0x21a01a),_0xa4fd8c=_0x59148c[_0x45ca2a(0x16d)](_0x442767+_0x21a01a,_0x442767+0x2*_0x21a01a);if(_0x2c8f1f[_0x45ca2a(0x1a5)]((_0x12407b,_0xf831d3)=>_0x12407b===_0xa4fd8c[_0xf831d3])){const _0x5bfe71=[..._0x59148c[_0x45ca2a(0x16d)](0x0,_0x442767),..._0x59148c[_0x45ca2a(0x16d)](_0x442767+_0x21a01a)];return a0_0x39e4da[_0x45ca2a(0x19a)]+_0x5bfe71[_0x45ca2a(0x1d4)](a0_0x39e4da[_0x45ca2a(0x19a)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x262590=a0_0x2ddd;try{const _0x545115=require(_0x262590(0x1ce));return _0x545115[_0x262590(0x106)]??_0x262590(0x1a2);}catch(_0x36d1ed){return logMcpStderr(_0x262590(0x13c),_0x36d1ed),_0x262590(0x1a2);}}function printHelp(){const _0x514b43=a0_0x2ddd;console[_0x514b43(0xd8)](_0x514b43(0x104)+getPackageVersion()),console[_0x514b43(0xd8)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x514b43(0xd8)](_0x514b43(0x136)),console[_0x514b43(0xd8)](_0x514b43(0xe6)),console[_0x514b43(0xd8)](_0x514b43(0xe3)),console['log'](_0x514b43(0xcf)),console['log']('\x0aExamples:'),console[_0x514b43(0xd8)](_0x514b43(0x1a8)),console[_0x514b43(0xd8)](_0x514b43(0x16c));}const cliArgs=process[a0_0x398bd1(0xe5)][a0_0x398bd1(0x16d)](0x2),VERSION_FLAGS=new Set([a0_0x398bd1(0x13a),'-v','-V']),HELP_FLAGS=new Set([a0_0x398bd1(0xd9),'-h']);cliArgs[a0_0x398bd1(0xec)](_0x1a4e0f=>VERSION_FLAGS[a0_0x398bd1(0x147)](_0x1a4e0f))&&(console[a0_0x398bd1(0xd8)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x398bd1(0xec)](_0x8b46d1=>HELP_FLAGS[a0_0x398bd1(0x147)](_0x8b46d1))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x34a3e3){const _0xaa4159=a0_0x398bd1;for(let _0x24a5cc=0x0;_0x24a5cc<cliArgs['length'];_0x24a5cc++){const _0x1ffd23=cliArgs[_0x24a5cc];if(_0x1ffd23['startsWith']('--'+_0x34a3e3+'='))return _0x1ffd23[_0xaa4159(0x16d)](('--'+_0x34a3e3+'=')[_0xaa4159(0x1c2)]);if(_0x1ffd23==='--'+_0x34a3e3&&_0x24a5cc+0x1<cliArgs[_0xaa4159(0x1c2)])return cliArgs[_0x24a5cc+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x398bd1(0x147)](arg))continue;if(arg[a0_0x398bd1(0xd0)](a0_0x398bd1(0x1cb)))continue;if(arg===a0_0x398bd1(0x1bc)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x398bd1(0x199)]['WORKSPACE_ROOT']||process[a0_0x398bd1(0x199)][a0_0x398bd1(0x140)]||process[a0_0x398bd1(0x1c1)](),ENABLE_WORKSPACE_MODE=process[a0_0x398bd1(0x199)][a0_0x398bd1(0x11b)]!=='false',MORPH_API_KEY=getCliArg('api-key')??process[a0_0x398bd1(0x199)][a0_0x398bd1(0x131)],MORPH_API_URL=process[a0_0x398bd1(0x199)][a0_0x398bd1(0x15c)],MORPH_LARGE_APPLY=process[a0_0x398bd1(0x199)][a0_0x398bd1(0xfe)]!==a0_0x398bd1(0x100),MORPH_WARP_GREP_TIMEOUT=process[a0_0x398bd1(0x199)][a0_0x398bd1(0x121)]?parseInt(process[a0_0x398bd1(0x199)][a0_0x398bd1(0x121)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set(['edit_file',a0_0x398bd1(0x148),a0_0x398bd1(0x128)]),DISABLED_TOOLS=process[a0_0x398bd1(0x199)][a0_0x398bd1(0x103)]?new Set(process['env'][a0_0x398bd1(0x103)][a0_0x398bd1(0x153)](',')[a0_0x398bd1(0x143)](_0x60536f=>_0x60536f['trim']())[a0_0x398bd1(0x154)](_0x185b99=>_0x185b99['length']>0x0)):new Set();if(DISABLED_TOOLS[a0_0x398bd1(0xcb)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x398bd1(0x147)](tool)&&console[a0_0x398bd1(0x195)]('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES][a0_0x398bd1(0x1d4)](',\x20'));}console[a0_0x398bd1(0x195)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x398bd1(0x1d4)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x398bd1(0x198))&&!MORPH_API_KEY['startsWith'](a0_0x398bd1(0x162))&&logMcpStderr(a0_0x398bd1(0x1ca));async function reportMorphError(_0x1d758){const _0x27b658=a0_0x398bd1;try{await a0_0x2249b4[_0x27b658(0x1cd)](_0x27b658(0xf5),{..._0x1d758,'timestamp':new Date()['toISOString'](),'source':_0x1d758[_0x27b658(0xed)]||_0x27b658(0x188),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x1d758[_0x27b658(0xef)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x27b658(0x125),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x58fcb5,_0x33440a){const _0x1a90e3=a0_0x398bd1;if(_0x58fcb5&&typeof _0x58fcb5==='object'&&'status'in _0x58fcb5)return _0x58fcb5[_0x1a90e3(0x181)];if(_0x58fcb5&&typeof _0x58fcb5==='object'&&'response'in _0x58fcb5)return _0x58fcb5[_0x1a90e3(0x167)]?.[_0x1a90e3(0x181)];const _0x16f756=_0x33440a[_0x1a90e3(0x196)](/\b(401|429)\b/);return _0x16f756?parseInt(_0x16f756[0x1],0xa):null;}function handleMorphAPIError(_0x484ce2){const _0x92c3de=a0_0x398bd1,_0x38680f=_0x484ce2 instanceof Error?_0x484ce2[_0x92c3de(0x139)]:String(_0x484ce2),_0x3404e9=extractStatusCode(_0x484ce2,_0x38680f);switch(_0x3404e9){case 0x191:return{'content':[{'type':'text','text':_0x92c3de(0xbb)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x92c3de(0x102),'text':_0x92c3de(0xc2)}],'isError':!![]};default:return null;}}args[a0_0x398bd1(0x1c2)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x398bd1(0x1c3)),logMcpStderr(a0_0x398bd1(0x14f)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x398bd1(0x194)),logMcpStderr(a0_0x398bd1(0x159)),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x3cdf1b){const _0x3b875e=a0_0x398bd1;return a0_0x39e4da[_0x3b875e(0x1a3)](_0x3cdf1b);}function expandHome(_0xed81de){const _0x40bb2f=a0_0x398bd1;if(_0xed81de[_0x40bb2f(0xd0)]('~/')||_0xed81de==='~')return a0_0x39e4da[_0x40bb2f(0x1d4)](a0_0x2455fc[_0x40bb2f(0x1d3)](),_0xed81de[_0x40bb2f(0x16d)](0x1));return _0xed81de;}function a0_0x2ddd(_0x44ac21,_0x4691a5){_0x44ac21=_0x44ac21-0xb6;const _0x379fd1=a0_0x379f();let _0x2dddb9=_0x379fd1[_0x44ac21];return _0x2dddb9;}let allowedDirectories=await Promise[a0_0x398bd1(0x17b)](args[a0_0x398bd1(0x143)](async _0x3b7e60=>{const _0x57d02d=a0_0x398bd1,_0x311d47=expandHome(_0x3b7e60),_0x3792de=a0_0x39e4da['resolve'](_0x311d47);try{const _0x4ba9ca=await a0_0x2d3af7[_0x57d02d(0x1ae)](_0x3792de);return normalizePath(_0x4ba9ca);}catch(_0x533e5f){return normalizePath(_0x3792de);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x398bd1(0x1c2)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x398bd1(0xeb)));}catch(a0_0x590cee){logMcpStderr(a0_0x398bd1(0x109)+a0_0x590cee);}async function detectWorkspaceRoot(_0x519a9f){const _0x585ffc=a0_0x398bd1;let _0x2288d8=a0_0x39e4da[_0x585ffc(0x19b)](_0x519a9f);const _0x245557=[_0x585ffc(0x141),'.vscode',_0x585ffc(0x19c),'Cargo.toml',_0x585ffc(0x170),_0x585ffc(0x12d),_0x585ffc(0xcc),_0x585ffc(0x1b6),_0x585ffc(0xb8)];while(_0x2288d8!==a0_0x39e4da[_0x585ffc(0x16b)](_0x2288d8)){for(const _0x5d8731 of _0x245557){const _0x383f69=a0_0x39e4da[_0x585ffc(0x1d4)](_0x2288d8,_0x5d8731);try{return await a0_0x2d3af7[_0x585ffc(0x126)](_0x383f69),normalizePath(_0x2288d8);}catch{}}_0x2288d8=a0_0x39e4da[_0x585ffc(0x16b)](_0x2288d8);}return normalizePath(_0x519a9f);}await Promise[a0_0x398bd1(0x17b)](args[a0_0x398bd1(0x143)](async _0x903875=>{const _0x4f9865=a0_0x398bd1;try{const _0x2a1461=await a0_0x2d3af7['stat'](expandHome(_0x903875));!_0x2a1461[_0x4f9865(0xf4)]()&&(logMcpStderr(_0x4f9865(0x1ab)+_0x903875+_0x4f9865(0x18f)),process['exit'](0x1));}catch(_0x5f1d95){logMcpStderr(_0x4f9865(0x116)+_0x903875+':',_0x5f1d95),process[_0x4f9865(0x197)](0x1);}}));async function validatePath(_0x397552){const _0x958308=a0_0x398bd1,_0x3f0903=expandHome(_0x397552),_0x4c18c8=a0_0x39e4da[_0x958308(0x19b)](_0x3f0903);logger[_0x958308(0x113)](_0x958308(0xc5),_0x958308(0x1c6),{'raw_path':_0x397552,'absolute':_0x4c18c8});try{const _0x485cbd=await a0_0x2d3af7[_0x958308(0x1ae)](_0x4c18c8);return logger['debug'](_0x958308(0xc5),'path_validation_resolved',{'resolved':_0x485cbd,'symlink':_0x485cbd!==_0x4c18c8}),_0x485cbd;}catch(_0x497d9a){if(_0x497d9a[_0x958308(0x1d8)]===_0x958308(0x18d)){const _0x283d6a=a0_0x39e4da[_0x958308(0x16b)](_0x4c18c8);try{const _0x2bc0a3=await a0_0x2d3af7['realpath'](_0x283d6a),_0x2d920e=a0_0x39e4da[_0x958308(0x1d4)](_0x2bc0a3,a0_0x39e4da[_0x958308(0x17d)](_0x4c18c8));return logger['debug'](_0x958308(0xc5),_0x958308(0x1dd),{'resolved':_0x2d920e,'new_file':!![]}),_0x2d920e;}catch{logger[_0x958308(0x195)](_0x958308(0xc5),_0x958308(0xdc),{'raw_path':_0x397552,'error':_0x958308(0xd6)+_0x283d6a});throw new Error(_0x958308(0xd6)+_0x283d6a);}}logger[_0x958308(0x195)](_0x958308(0xc5),_0x958308(0xdc),{'raw_path':_0x397552,'error':_0x497d9a[_0x958308(0x139)]});throw _0x497d9a;}}const MorphEditFileArgsSchema=z[a0_0x398bd1(0x17a)]({'path':z[a0_0x398bd1(0x178)](),'code_edit':z['string']()['describe'](a0_0x398bd1(0x1d6)),'instruction':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0x175)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z['boolean']()[a0_0x398bd1(0xde)](![])[a0_0x398bd1(0x175)](a0_0x398bd1(0x152))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z[a0_0x398bd1(0x17a)]({'search_string':z['string']()[a0_0x398bd1(0x175)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()[a0_0x398bd1(0x175)]('The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos'),'search_type':z['enum']([a0_0x398bd1(0xde),a0_0x398bd1(0x180)])[a0_0x398bd1(0xff)]()[a0_0x398bd1(0x175)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x398bd1(0x17a)]({'search_string':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0x175)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0xff)]()[a0_0x398bd1(0x175)](a0_0x398bd1(0xbd)),'owner_repo':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0xff)]()[a0_0x398bd1(0x175)](a0_0x398bd1(0xf6)),'branch':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0xff)]()[a0_0x398bd1(0x175)](a0_0x398bd1(0x177))}),CodebaseSearchArgsSchema=z[a0_0x398bd1(0x17a)]({'query':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0x175)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0x175)](a0_0x398bd1(0xe1)),'branch':z[a0_0x398bd1(0x178)]()['optional']()[a0_0x398bd1(0x175)](a0_0x398bd1(0x129)),'commitHash':z[a0_0x398bd1(0x178)]()[a0_0x398bd1(0xff)]()['describe'](a0_0x398bd1(0xc1)),'targetDirectories':z[a0_0x398bd1(0xfb)](z[a0_0x398bd1(0x178)]())[a0_0x398bd1(0xde)]([])[a0_0x398bd1(0x175)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x398bd1(0xff)]()[a0_0x398bd1(0xde)](0xa)[a0_0x398bd1(0x175)](a0_0x398bd1(0x123))}),server=new Server({'name':a0_0x398bd1(0x14c),'version':a0_0x398bd1(0x11c)},{'capabilities':{'tools':{}}});server[a0_0x398bd1(0x151)](ListToolsRequestSchema,async()=>{const _0x15dad5=a0_0x398bd1,_0x159283=[{'name':_0x15dad5(0x1b7),'description':_0x15dad5(0xc3)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x15dad5(0x18a)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+_0x15dad5(0x15d)+_0x15dad5(0x149)+_0x15dad5(0x163)+_0x15dad5(0x13e)+_0x15dad5(0xf9)+_0x15dad5(0x168)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x15dad5(0x1c4)+_0x15dad5(0x111)+_0x15dad5(0x145)+_0x15dad5(0x101)+_0x15dad5(0x17e)+_0x15dad5(0xe4)+_0x15dad5(0x1a9)+_0x15dad5(0xe8)+_0x15dad5(0x1a0)+_0x15dad5(0x10d)+_0x15dad5(0x110)+_0x15dad5(0xf7),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x15dad5(0x148),'description':_0x15dad5(0x1cf)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x15dad5(0xea)+_0x15dad5(0x1b3)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x523478=_0x159283[_0x15dad5(0x154)](_0x43c57f=>{const _0x7cfe94=_0x15dad5;if(DISABLED_TOOLS['has'](_0x43c57f[_0x7cfe94(0x142)]))return console[_0x7cfe94(0x195)](_0x7cfe94(0x1d9)+_0x43c57f[_0x7cfe94(0x142)]+_0x7cfe94(0x1db)),![];if(_0x7cfe94(0x112)in _0x43c57f&&_0x43c57f['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x7cfe94(0x15f)+_0x43c57f[_0x7cfe94(0x142)]+_0x7cfe94(0xba)),![];return!![];});return{'tools':_0x523478[_0x15dad5(0x143)](_0x35fa0e=>({'name':_0x35fa0e[_0x15dad5(0x142)],'description':_0x35fa0e[_0x15dad5(0x1bf)],'inputSchema':_0x35fa0e[_0x15dad5(0x120)]}))};}),server[a0_0x398bd1(0x151)](CallToolRequestSchema,async _0x1e4c99=>{const _0x4039d6=a0_0x398bd1,{name:_0x3e38cc,arguments:_0x37e640}=_0x1e4c99['params'],_0x1e3dba=Date[_0x4039d6(0xc9)]();logger[_0x4039d6(0x113)](_0x4039d6(0xc5),'tool_call_received',{'tool':_0x3e38cc,'args':_0x3e38cc===_0x4039d6(0x1b7)?{'path':_0x37e640?.['path'],'instruction':_0x37e640?.[_0x4039d6(0x19e)]||_0x37e640?.[_0x4039d6(0x144)],'dryRun':_0x37e640?.[_0x4039d6(0x13f)]}:_0x37e640});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x4039d6(0x102),'text':'No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.'}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x4039d6(0x198))&&!MORPH_API_KEY[_0x4039d6(0xd0)](_0x4039d6(0x162)))return{'content':[{'type':_0x4039d6(0x102),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x4039d6(0x147)](_0x3e38cc))throw new Error(_0x4039d6(0xd2)+_0x3e38cc+_0x4039d6(0x1b0));switch(_0x3e38cc){case'edit_file':{const _0x1f2a89=_0x37e640&&typeof _0x37e640==='object'&&'instructions'in _0x37e640&&!('instruction'in _0x37e640)?{..._0x37e640,'instruction':_0x37e640[_0x4039d6(0x144)],'instructions':undefined}:_0x37e640,_0xab520b=MorphEditFileArgsSchema[_0x4039d6(0xc6)](_0x1f2a89);if(!_0xab520b['success'])throw new Error(_0x4039d6(0x16a)+_0xab520b[_0x4039d6(0x195)]);const _0x49a6f5=await validatePath(_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x12f)]);let _0x110f75=null,_0x40ad7a=!![],_0x5c6779=null;try{_0x110f75=await a0_0x2d3af7[_0x4039d6(0x1a7)](_0x49a6f5,'utf-8'),logger[_0x4039d6(0x113)](_0x4039d6(0xc5),_0x4039d6(0x1ad),{'path':_0x49a6f5,'size_bytes':_0x110f75[_0x4039d6(0x1c2)]});}catch(_0x25cfd2){const _0x4048ae=_0x25cfd2['code'];_0x4048ae===_0x4039d6(0x18d)?(_0x40ad7a=![],_0x110f75='',logger['debug'](_0x4039d6(0xc5),_0x4039d6(0x1ad),{'path':_0x49a6f5,'exists':![]})):(_0x5c6779=_0x4039d6(0x179)+(_0x4048ae||_0x4039d6(0x1a2))+'\x20-\x20'+(_0x25cfd2 instanceof Error?_0x25cfd2['message']:String(_0x25cfd2)),logger[_0x4039d6(0x195)]('MCP',_0x4039d6(0xd3),{'path':_0x49a6f5,'error':_0x5c6779}),logMcpStderr(_0x4039d6(0x15f)+_0x5c6779));}let _0x253237;try{const _0x50998c=MORPH_API_KEY;if(!_0x50998c)throw new Error(_0x4039d6(0x10f));const _0x27491c=a0_0x39e4da[_0x4039d6(0x16b)](_0x49a6f5),_0x51414e=a0_0x39e4da[_0x4039d6(0x17d)](_0x49a6f5);logger['debug']('MCP',_0x4039d6(0xe0),{'model':_0x4039d6(0x14d),'path':_0xab520b['data'][_0x4039d6(0x12f)],'instruction_len':_0xab520b['data']['instruction']['length'],'code_edit_len':_0xab520b['data']['code_edit'][_0x4039d6(0x1c2)],'original_code_len':_0x110f75?.[_0x4039d6(0x1c2)]??0x0,'dry_run':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x13f)]});const _0x39a9ad=Date[_0x4039d6(0xc9)](),_0xa24e2d=await executeEditFile({'target_filepath':_0x51414e,'code_edit':_0xab520b['data'][_0x4039d6(0xc0)],'instruction':_0xab520b['data'][_0x4039d6(0x19e)]},{'morphApiKey':_0x50998c,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x27491c,'autoWrite':!_0xab520b[_0x4039d6(0x11e)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x20322b=Date[_0x4039d6(0xc9)]()-_0x39a9ad;_0x253237=_0xa24e2d['completionId'];if(!_0xa24e2d[_0x4039d6(0x15b)])throw new Error(_0xa24e2d['error']||_0x4039d6(0x191));const _0x14e946=_0xa24e2d[_0x4039d6(0x176)],_0x55f7bb=_0x4039d6(0x12e)+_0x14e946[_0x4039d6(0x18b)]+_0x4039d6(0x150)+_0x14e946['linesRemoved']+',\x20modified\x20'+_0x14e946[_0x4039d6(0x186)];logger[_0x4039d6(0x113)](_0x4039d6(0xc5),'tool_call_complete',{'tool':_0x4039d6(0x1b7),'success':!![],'latency_ms':Date[_0x4039d6(0xc9)]()-_0x1e3dba,'edit_latency_ms':_0x20322b,'changes':{'added':_0x14e946[_0x4039d6(0x18b)],'removed':_0x14e946[_0x4039d6(0x133)],'modified':_0x14e946['linesModified']},'completion_id':_0x253237});if(_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x13f)])return{'content':[{'type':'text','text':_0x4039d6(0x1c8)+(_0x40ad7a?'':_0x4039d6(0x157))+':\x20'+_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x19e)]+_0x4039d6(0x1b1)+_0x55f7bb+_0x4039d6(0xf1)+_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x12f)]+'.'}]};return{'content':[{'type':'text','text':_0x4039d6(0x118)+(_0x40ad7a?'Applied':'Created\x20File')+':\x20'+_0xab520b[_0x4039d6(0x11e)]['instruction']+'.\x20Changes:\x20'+_0x55f7bb+_0x4039d6(0xf1)+_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x12f)]+'.'}]};}catch(_0x516481){const _0x2ed426=handleMorphAPIError(_0x516481);if(_0x2ed426)return logger[_0x4039d6(0x195)](_0x4039d6(0xc5),_0x4039d6(0x1b2),{'tool':_0x4039d6(0x1b7),'error':_0x4039d6(0x137),'latency_ms':Date[_0x4039d6(0xc9)]()-_0x1e3dba}),_0x2ed426;const _0x3a097e=_0x516481 instanceof Error?_0x516481[_0x4039d6(0x139)]:String(_0x516481);return logger[_0x4039d6(0x195)]('MCP','tool_call_error',{'tool':_0x4039d6(0x1b7),'error':_0x3a097e,'path':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x12f)],'validated_path':_0x49a6f5,'latency_ms':Date[_0x4039d6(0xc9)]()-_0x1e3dba,'stack':_0x516481 instanceof Error?_0x516481[_0x4039d6(0x1af)]:undefined}),reportMorphError({'error_message':_0x3a097e,'error_type':_0x516481 instanceof Error?_0x516481[_0x4039d6(0x114)][_0x4039d6(0x142)]:'UnknownError','context':{'tool':_0x4039d6(0x1b7),'completion_id':_0x253237,'file_path':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x12f)],'validated_path':_0x49a6f5,'instruction':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x19e)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x4039d6(0x14d),'dry_run':_0xab520b[_0x4039d6(0x11e)]['dryRun'],'file_exists':_0x40ad7a,'file_read_error':_0x5c6779,'file_readable':_0x110f75!==null,'request_content':{'path':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x12f)],'code_edit':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0xc0)],'instruction':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x19e)],'original_code':_0x110f75!==null?_0x110f75[_0x4039d6(0x1c2)]>0xc350?_0x110f75['substring'](0x0,0xc350)+_0x4039d6(0xdf)+_0x110f75[_0x4039d6(0x1c2)]+_0x4039d6(0x11a):_0x110f75:_0x4039d6(0x13d)+(_0x5c6779||_0x4039d6(0x1ac))+']','original_code_length':_0x110f75?.[_0x4039d6(0x1c2)]??0x0,'model':MORPH_LARGE_APPLY?_0x4039d6(0xd7):_0x4039d6(0x14d),'dry_run':_0xab520b[_0x4039d6(0x11e)][_0x4039d6(0x13f)]}},'stack_trace':_0x516481 instanceof Error?_0x516481['stack']:undefined,'source':_0x4039d6(0x188)})[_0x4039d6(0x1b8)](()=>{}),{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0x122)+_0x3a097e}],'isError':!![]};}}case _0x4039d6(0x148):{const _0x52bf16=WarpGrepArgsSchema['safeParse'](_0x37e640);if(!_0x52bf16['success'])return{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0x1c7)+_0x52bf16[_0x4039d6(0x195)]}],'isError':!![]};const _0x5f3a5f=_0x29ebed=>{const _0x409cfe=_0x4039d6,_0x334eed=[];for(const _0x3b52c1 of _0x29ebed||[]){if(_0x3b52c1[_0x409cfe(0x1c0)]==='assistant'&&Array[_0x409cfe(0x1df)](_0x3b52c1[_0x409cfe(0xbf)]))for(const _0x68a377 of _0x3b52c1[_0x409cfe(0xbf)]){try{const _0x1c4975=_0x68a377[_0x409cfe(0xc7)]?.[_0x409cfe(0x142)],_0xe3a56c=JSON[_0x409cfe(0x183)](_0x68a377[_0x409cfe(0xc7)]?.['arguments']||'{}');if(_0x1c4975===_0x409cfe(0x156))_0x334eed['push'](_0x409cfe(0x165)+_0xe3a56c['pattern']+'\x27\x20'+(_0xe3a56c[_0x409cfe(0x12f)]||'.'));else{if(_0x1c4975===_0x409cfe(0x14b))_0x334eed[_0x409cfe(0x19d)]('read\x20'+_0xe3a56c[_0x409cfe(0x12f)]);else{if(_0x1c4975===_0x409cfe(0x1bb))_0x334eed[_0x409cfe(0x19d)](_0x409cfe(0xd4)+(_0xe3a56c['command']||'.'));else{if(_0x1c4975===_0x409cfe(0xc4))_0x334eed[_0x409cfe(0x19d)](_0x409cfe(0x174)+_0xe3a56c[_0x409cfe(0xdb)]+'\x27\x20'+(_0xe3a56c[_0x409cfe(0x12f)]||'.'));else _0x1c4975===_0x409cfe(0x1cc)&&_0x334eed[_0x409cfe(0x19d)](_0x409cfe(0x1cc));}}}}catch{}}}return _0x334eed;},_0x208b3b=_0x438952=>{const _0x2f37b8=_0x4039d6,_0x38356f=[];if(!_0x438952||!Array[_0x2f37b8(0x1df)](_0x438952))return _0x38356f;const _0x32476b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x2f37b8(0x14b)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x2f37b8(0x14b)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2f37b8(0x1bd),'tool':_0x2f37b8(0x14b)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2f37b8(0x1d5),'tool':_0x2f37b8(0x14b)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x2f37b8(0x1b4),'tool':_0x2f37b8(0xbc)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2f37b8(0x1d5),'tool':_0x2f37b8(0x14b)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x2f37b8(0x14b)},{'pattern':/not a text file/,'error_type':_0x2f37b8(0x1d5),'tool':_0x2f37b8(0x14b)},{'pattern':/symbolic link/,'error_type':_0x2f37b8(0x124),'tool':_0x2f37b8(0x14b)},{'pattern':/Error reading file:/,'error_type':_0x2f37b8(0x1bd),'tool':_0x2f37b8(0x14b)},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x3f06d0=0x0;for(const _0x5a01f5 of _0x438952){_0x5a01f5[_0x2f37b8(0x1c0)]==='assistant'&&Array[_0x2f37b8(0x1df)](_0x5a01f5[_0x2f37b8(0xbf)])&&_0x3f06d0++;const _0x1c9208=_0x5a01f5[_0x2f37b8(0xce)];if((_0x5a01f5['role']==='tool'||_0x5a01f5[_0x2f37b8(0x1c0)]===_0x2f37b8(0x1d7))&&_0x1c9208&&typeof _0x1c9208===_0x2f37b8(0x178))for(const {pattern:_0x2544c1,error_type:_0x50591e,tool:_0x251b08}of _0x32476b){const _0x478ae6=_0x1c9208[_0x2f37b8(0x196)](new RegExp(_0x2544c1['source'],'g'));if(_0x478ae6)for(const _0x5ae1e7 of _0x478ae6){const _0x1a8231=_0x1c9208[_0x2f37b8(0xcd)](_0x5ae1e7),_0x221132=_0x1c9208[_0x2f37b8(0xf2)](_0x1a8231,Math['min'](_0x1a8231+0xc8,_0x1c9208[_0x2f37b8(0x1c2)]));_0x38356f[_0x2f37b8(0x19d)]({'tool':_0x251b08,'error_type':_0x50591e,'error_message':_0x221132[_0x2f37b8(0x153)]('\x0a')[0x0],'turn':_0x3f06d0});}}}return _0x38356f;};try{const _0x4f8ee0=a0_0x39e4da['resolve'](_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)]),_0x213303=_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0x17f)],_0x4ccc3d=_0x213303==='node_modules'?{'allowNames':[_0x4039d6(0x180)]}:undefined,_0xbf3619=new LocalRipgrepProvider(_0x4f8ee0,undefined,_0x4ccc3d);logger['debug']('MCP',_0x4039d6(0xe9),{'type':_0x4039d6(0x16e),'repo_root':_0x4f8ee0,'search_type':_0x213303||'default'}),logger[_0x4039d6(0x113)]('MCP',_0x4039d6(0x119),{'query':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0x130)],'repo_root':_0x4f8ee0,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x4fbf74=Date[_0x4039d6(0xc9)](),_0x263ba1=await runWarpGrep({'searchTerm':_0x52bf16['data'][_0x4039d6(0x130)],'repoRoot':_0x4f8ee0,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xbf3619,'search_type':_0x213303}),_0x1acbc3=Date['now']()-_0x4fbf74,_0x16a7b5=_0x263ba1['finish']?.['metadata']?.[_0x4039d6(0x193)]?.[_0x4039d6(0x1c2)]??0x0;logger['debug'](_0x4039d6(0xc5),_0x4039d6(0x11f),{'termination':_0x263ba1[_0x4039d6(0x158)],'turns':_0x263ba1[_0x4039d6(0x185)]?.[_0x4039d6(0x13b)]??0x0,'files_found':_0x16a7b5,'latency_ms':_0x1acbc3});const _0x47f97a=_0x208b3b(_0x263ba1[_0x4039d6(0x19f)]);_0x47f97a[_0x4039d6(0x1c2)]>0x0&&reportMorphError({'error_message':_0x4039d6(0x16f)+_0x47f97a[_0x4039d6(0x1c2)]+_0x4039d6(0xf0),'error_type':_0x4039d6(0xb6),'level':_0x4039d6(0x18c),'tool':_0x4039d6(0x148),'context':{'repo_path':_0x52bf16[_0x4039d6(0x11e)]['repo_path'],'query':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0x130)],'model':_0x4039d6(0x134),'termination_reason':_0x263ba1[_0x4039d6(0x158)],'sub_tool_errors':_0x47f97a,'timings':_0x263ba1[_0x4039d6(0x185)],'tool_calls':_0x5f3a5f(_0x263ba1[_0x4039d6(0x19f)]),'messages':_0x263ba1[_0x4039d6(0x19f)]?.[_0x4039d6(0x143)](_0x3f8262=>({'role':_0x3f8262['role'],'content':_0x3f8262['content'],..._0x3f8262[_0x4039d6(0xbf)]?{'tool_calls':_0x3f8262['tool_calls']['length']}:{},..._0x3f8262[_0x4039d6(0x1a4)]?{'tool_call_id':_0x3f8262[_0x4039d6(0x1a4)]}:{}}))},'source':_0x4039d6(0x188)})[_0x4039d6(0x1b8)](()=>{});let _0x1f02c1='';if(_0x263ba1[_0x4039d6(0x158)]==='completed'&&_0x263ba1['finish']?.[_0x4039d6(0x127)]?.[_0x4039d6(0x193)]){const _0x29c3d9=_0x263ba1['finish'][_0x4039d6(0x127)][_0x4039d6(0x193)];if(_0x29c3d9[_0x4039d6(0x1c2)]===0x0)return _0x1f02c1=_0x263ba1[_0x4039d6(0x1cc)]['payload']||_0x4039d6(0x1d1),{'content':[{'type':_0x4039d6(0x102),'text':_0x1f02c1}]};const _0x209ff2=[],_0x5ade0b=[_0x4039d6(0xda)];for(const _0x596045 of _0x263ba1[_0x4039d6(0x19f)]){if(_0x596045[_0x4039d6(0x1c0)]===_0x4039d6(0x1be)&&Array[_0x4039d6(0x1df)](_0x596045['tool_calls']))for(const _0x3dce38 of _0x596045['tool_calls']){try{const _0x4787f6=_0x3dce38[_0x4039d6(0xc7)]?.[_0x4039d6(0x142)],_0x394149=JSON['parse'](_0x3dce38[_0x4039d6(0xc7)]?.[_0x4039d6(0x117)]||'{}');if(_0x4787f6===_0x4039d6(0x156))_0x5ade0b['push'](_0x4039d6(0xfd)+_0x394149[_0x4039d6(0xdb)]+_0x4039d6(0x1c5)+(_0x394149['path']||'.')+'`');else{if(_0x4787f6===_0x4039d6(0x14b))_0x5ade0b['push'](_0x4039d6(0xdd)+_0x394149['path']+'`');else{if(_0x4787f6===_0x4039d6(0x1bb))_0x5ade0b[_0x4039d6(0x19d)](_0x4039d6(0x1ba)+(_0x394149[_0x4039d6(0x189)]||'.')+'`');else _0x4787f6===_0x4039d6(0xc4)&&_0x5ade0b[_0x4039d6(0x19d)](_0x4039d6(0xd5)+_0x394149[_0x4039d6(0xdb)]+'`\x20in\x20`'+(_0x394149[_0x4039d6(0x12f)]||'.')+'`');}}}catch{}}}_0x209ff2['push'](_0x5ade0b[_0x4039d6(0x1d4)]('\x0a'));const _0x5309e5=['',_0x4039d6(0x1a1)];for(const _0x5d5892 of _0x29c3d9){if(_0x5d5892[_0x4039d6(0x1dc)]==='*')_0x5309e5[_0x4039d6(0x19d)]('-\x20'+_0x5d5892['path']+':*');else{if(Array[_0x4039d6(0x1df)](_0x5d5892[_0x4039d6(0x1dc)])){const _0x56eb55=_0x5d5892[_0x4039d6(0x1dc)][_0x4039d6(0x143)](([_0x4878dd,_0x34a24c])=>{if(_0x4878dd===_0x34a24c)return''+_0x4878dd;return _0x4878dd+'-'+_0x34a24c;});_0x5309e5[_0x4039d6(0x19d)]('-\x20'+_0x5d5892[_0x4039d6(0x12f)]+':'+_0x56eb55[_0x4039d6(0x1d4)](','));}else _0x5309e5['push']('-\x20'+_0x5d5892[_0x4039d6(0x12f)]+':*');}}_0x5309e5[_0x4039d6(0x19d)](''),_0x209ff2[_0x4039d6(0x19d)](_0x5309e5[_0x4039d6(0x1d4)]('\x0a')),_0x209ff2['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x2839d7=[],_0x303355=[];for(const _0x4f1dc8 of _0x29c3d9){let _0x270536=a0_0x39e4da[_0x4039d6(0x19b)](_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)],_0x4f1dc8[_0x4039d6(0x12f)]),_0x3993a0=null,_0x15b8dd=null;try{_0x3993a0=await a0_0x2d3af7[_0x4039d6(0x1a7)](_0x270536,{'encoding':_0x4039d6(0x132)});}catch(_0x383c88){const _0xc8273e=fixPathRepetition(_0x270536);if(_0xc8273e)try{_0x3993a0=await a0_0x2d3af7[_0x4039d6(0x1a7)](_0xc8273e,{'encoding':_0x4039d6(0x132)}),_0x270536=_0xc8273e;}catch{_0x15b8dd=_0x383c88 instanceof Error?_0x383c88:new Error(String(_0x383c88));}else _0x15b8dd=_0x383c88 instanceof Error?_0x383c88:new Error(String(_0x383c88));}if(_0x3993a0!==null){const _0x5caf2e=_0x3993a0[_0x4039d6(0x153)](/\r?\n/),_0x3b913e=[];if(_0x4f1dc8['lines']==='*'||!Array[_0x4039d6(0x1df)](_0x4f1dc8[_0x4039d6(0x1dc)]))for(let _0x33639b=0x1;_0x33639b<=_0x5caf2e[_0x4039d6(0x1c2)];_0x33639b++){const _0x36ba7c=_0x5caf2e[_0x33639b-0x1];_0x3b913e[_0x4039d6(0x19d)](_0x33639b+'|\x20'+_0x36ba7c);}else for(const [_0x1d2fe5,_0x43cea2]of _0x4f1dc8[_0x4039d6(0x1dc)]){_0x3b913e['length']>0x0&&_0x3b913e[_0x4039d6(0x19d)]('');for(let _0x347c37=_0x1d2fe5;_0x347c37<=_0x43cea2&&_0x347c37<=_0x5caf2e[_0x4039d6(0x1c2)];_0x347c37++){const _0xb0ca3c=_0x5caf2e[_0x347c37-0x1];_0x3b913e[_0x4039d6(0x19d)](_0x347c37+'|\x20'+_0xb0ca3c);}}_0x303355[_0x4039d6(0x19d)]({'path':_0x4f1dc8[_0x4039d6(0x12f)],'content':_0x3b913e[_0x4039d6(0x1d4)]('\x0a')});}else _0x2839d7[_0x4039d6(0x19d)]('<file\x20path=\x22'+_0x4f1dc8[_0x4039d6(0x12f)]+_0x4039d6(0x172)+(_0x15b8dd?.[_0x4039d6(0x139)]||_0x4039d6(0x155))+_0x4039d6(0xe2));}try{const _0x197089=await compactFileContexts(_0x303355,_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0x130)],MORPH_API_KEY,MORPH_API_URL);for(const _0x235859 of _0x197089){_0x2839d7[_0x4039d6(0x19d)](_0x4039d6(0x15a)+_0x235859[_0x4039d6(0x12f)]+'\x22>\x0a'+_0x235859['content']+_0x4039d6(0xe2));}}catch(_0x1ffa74){logger['warn'](_0x4039d6(0xc5),'compaction_failed',{'error':_0x1ffa74 instanceof Error?_0x1ffa74['message']:String(_0x1ffa74),'files_count':_0x303355[_0x4039d6(0x1c2)]});for(const _0x547930 of _0x303355){_0x2839d7[_0x4039d6(0x19d)](_0x4039d6(0x15a)+_0x547930[_0x4039d6(0x12f)]+'\x22>\x0a'+_0x547930['content']+'\x0a</file>');}}_0x209ff2['push'](_0x2839d7[_0x4039d6(0x1d4)]('\x0a\x0a')),_0x1f02c1=_0x209ff2['join']('\x0a');const _0x25d361=_0x263ba1[_0x4039d6(0x1b9)]?.[_0x4039d6(0x154)](_0x1d8ec6=>_0x1d8ec6[_0x4039d6(0x139)]?.[_0x4039d6(0xd0)](_0x4039d6(0x164)))||[];if(_0x25d361[_0x4039d6(0x1c2)]>0x0){const _0x4c4321=_0x25d361[_0x4039d6(0x143)](_0x521640=>_0x521640['message'])[_0x4039d6(0x1d4)](';\x20');reportMorphError({'error_message':_0x4c4321,'error_type':_0x4039d6(0x146),'context':{'tool':_0x4039d6(0x148),'repo_path':_0x52bf16[_0x4039d6(0x11e)]['repo_path'],'query':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0x130)],'model':_0x4039d6(0x134),'termination_reason':'completed_with_file_errors','error_count':_0x25d361[_0x4039d6(0x1c2)],'is_timeout':![],'timings':_0x263ba1[_0x4039d6(0x185)],'files_attempted':_0x29c3d9[_0x4039d6(0x143)](_0x25b5a9=>({'path':_0x25b5a9[_0x4039d6(0x12f)],'lines':_0x25b5a9[_0x4039d6(0x1dc)]})),'tool_calls':_0x5f3a5f(_0x263ba1['messages']),'messages':_0x263ba1[_0x4039d6(0x19f)]?.[_0x4039d6(0x143)](_0x3e24df=>({'role':_0x3e24df[_0x4039d6(0x1c0)],'content':_0x3e24df['content'],..._0x3e24df['tool_calls']?{'tool_calls':_0x3e24df[_0x4039d6(0xbf)]['length']}:{},..._0x3e24df[_0x4039d6(0x1a4)]?{'tool_call_id':_0x3e24df['tool_call_id']}:{}})),'request_content':{'query':_0x52bf16['data'][_0x4039d6(0x130)],'repo_path':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)],'repoRoot':a0_0x39e4da['resolve'](_0x52bf16[_0x4039d6(0x11e)]['repo_path']),'model':_0x4039d6(0x134)}},'source':'mcp-filesystem'})['catch'](()=>{});}}else{if(_0x263ba1[_0x4039d6(0x158)]==='terminated'&&_0x263ba1[_0x4039d6(0x1b9)][_0x4039d6(0x1c2)]>0x0){const _0x3dcaa7=_0x263ba1[_0x4039d6(0x1b9)][_0x4039d6(0x143)](_0x33a2a8=>_0x33a2a8[_0x4039d6(0x139)])['join'](';\x20');_0x1f02c1=_0x4039d6(0x1ab)+_0x3dcaa7;const _0x51f25b=_0x3dcaa7['toLowerCase']()[_0x4039d6(0x1da)](_0x4039d6(0x15e))||_0x3dcaa7[_0x4039d6(0x10e)]()[_0x4039d6(0x1da)](_0x4039d6(0x115))||_0x3dcaa7[_0x4039d6(0x10e)]()[_0x4039d6(0x1da)](_0x4039d6(0x105)),_0x30c934=_0x263ba1[_0x4039d6(0x1cc)]?.[_0x4039d6(0x127)]?.[_0x4039d6(0x193)],_0x135c6a=_0x263ba1[_0x4039d6(0x1b9)][0x0];reportMorphError({'error_message':_0x3dcaa7,'error_type':_0x51f25b?_0x4039d6(0x10a):_0x135c6a?.['constructor']?.[_0x4039d6(0x142)]||_0x4039d6(0x107),'context':{'tool':_0x4039d6(0x148),'repo_path':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)],'query':_0x52bf16['data'][_0x4039d6(0x130)],'model':_0x4039d6(0x134),'termination_reason':_0x263ba1[_0x4039d6(0x158)],'error_count':_0x263ba1[_0x4039d6(0x1b9)][_0x4039d6(0x1c2)],'is_timeout':_0x51f25b,'timings':_0x263ba1[_0x4039d6(0x185)],'files_attempted':_0x30c934?.[_0x4039d6(0x143)](_0x53a626=>({'path':_0x53a626[_0x4039d6(0x12f)],'lines':_0x53a626['lines']})),'tool_calls':_0x5f3a5f(_0x263ba1[_0x4039d6(0x19f)]),'messages':_0x263ba1['messages']?.['map'](_0x5f0657=>({'role':_0x5f0657[_0x4039d6(0x1c0)],'content':_0x5f0657[_0x4039d6(0xce)],..._0x5f0657['tool_calls']?{'tool_calls':_0x5f0657[_0x4039d6(0xbf)]['length']}:{},..._0x5f0657[_0x4039d6(0x1a4)]?{'tool_call_id':_0x5f0657[_0x4039d6(0x1a4)]}:{}})),'request_content':{'query':_0x52bf16[_0x4039d6(0x11e)]['search_string'],'repo_path':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)],'repoRoot':a0_0x39e4da[_0x4039d6(0x19b)](_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)]),'model':_0x4039d6(0x134)}},'stack_trace':_0x135c6a?.['stack']||undefined,'source':_0x4039d6(0x188)})[_0x4039d6(0x1b8)](()=>{});}else _0x1f02c1=_0x4039d6(0x1c9);}return{'content':[{'type':_0x4039d6(0x102),'text':_0x1f02c1}]};}catch(_0x48a767){const _0x5c6da2=handleMorphAPIError(_0x48a767);if(_0x5c6da2)return logger[_0x4039d6(0x195)](_0x4039d6(0xc5),_0x4039d6(0x1b2),{'tool':'codebase_search','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x4039d6(0xc9)]()-_0x1e3dba}),_0x5c6da2;const _0x5e78db=_0x48a767 instanceof Error?_0x48a767[_0x4039d6(0x139)]:String(_0x48a767);logger[_0x4039d6(0x195)](_0x4039d6(0xc5),_0x4039d6(0x1b2),{'tool':_0x4039d6(0x148),'error':_0x5e78db,'repo_path':_0x52bf16[_0x4039d6(0x11e)]['repo_path'],'query':_0x52bf16['data']['search_string'],'latency_ms':Date[_0x4039d6(0xc9)]()-_0x1e3dba});const _0x38f518=_0x5e78db[_0x4039d6(0x10e)]()[_0x4039d6(0x1da)](_0x4039d6(0x15e))||_0x5e78db[_0x4039d6(0x10e)]()[_0x4039d6(0x1da)](_0x4039d6(0x115))||_0x5e78db[_0x4039d6(0x10e)]()[_0x4039d6(0x1da)]('etimedout')||_0x48a767 instanceof Error&&_0x48a767[_0x4039d6(0x142)]===_0x4039d6(0x10a);return reportMorphError({'error_message':_0x5e78db,'error_type':_0x38f518?_0x4039d6(0x10a):_0x48a767 instanceof Error?_0x48a767['constructor'][_0x4039d6(0x142)]:_0x4039d6(0xbe),'context':{'tool':_0x4039d6(0x148),'repo_path':_0x52bf16[_0x4039d6(0x11e)]['repo_path'],'query':_0x52bf16['data'][_0x4039d6(0x130)],'model':_0x4039d6(0x134),'is_timeout':_0x38f518,'exception_phase':_0x4039d6(0x18e),'request_content':{'query':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0x130)],'repo_path':_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)],'repoRoot':a0_0x39e4da['resolve'](_0x52bf16[_0x4039d6(0x11e)][_0x4039d6(0xb7)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x48a767 instanceof Error?_0x48a767[_0x4039d6(0x1af)]:undefined,'source':_0x4039d6(0x188)})[_0x4039d6(0x1b8)](()=>{}),{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0x166)+_0x5e78db}],'isError':![]};}}case'github_codebase_search':{const _0x583974=WarpGrepGitHubArgsSchema[_0x4039d6(0xc6)](_0x37e640);if(!_0x583974[_0x4039d6(0x15b)])return{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0x1c7)+_0x583974[_0x4039d6(0x195)]}],'isError':!![]};const _0x7efdf2=_0x583974[_0x4039d6(0x11e)][_0x4039d6(0xc8)]||_0x583974['data'][_0x4039d6(0x182)];if(!_0x7efdf2)return{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0xd1)}],'isError':!![]};const _0x23dde6=MORPH_API_KEY;if(!_0x23dde6)throw new Error(_0x4039d6(0x10f));const _0x5b445c=Date[_0x4039d6(0xc9)]();logger[_0x4039d6(0x113)](_0x4039d6(0xc5),'github_search_start',{'identifier':_0x7efdf2,'query':_0x583974['data'][_0x4039d6(0x130)],'branch':_0x583974['data'][_0x4039d6(0xf3)]});try{const _0x4d6228=new WarpGrepClient({'morphApiKey':_0x23dde6,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x404f2d=await _0x4d6228[_0x4039d6(0x17c)]({'searchTerm':_0x583974[_0x4039d6(0x11e)][_0x4039d6(0x130)],'github':_0x7efdf2,'branch':_0x583974[_0x4039d6(0x11e)][_0x4039d6(0xf3)]}),_0x98306f=Date['now']()-_0x5b445c;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x98306f+_0x4039d6(0x11d)+_0x404f2d['success']);const _0x3546e6=formatResult(_0x404f2d);return{'content':[{'type':_0x4039d6(0x102),'text':_0x3546e6}]};}catch(_0x5a931c){const _0x27578b=handleMorphAPIError(_0x5a931c);if(_0x27578b)return _0x27578b;const _0x27a575=Date[_0x4039d6(0xc9)]()-_0x5b445c,_0x2dffe4=_0x5a931c instanceof Error?_0x5a931c['message']:String(_0x5a931c);return logMcpStderr(_0x4039d6(0x173)+_0x27a575+_0x4039d6(0xfc),_0x2dffe4),reportMorphError({'error_message':_0x2dffe4,'error_type':_0x5a931c instanceof Error?_0x5a931c[_0x4039d6(0x114)][_0x4039d6(0x142)]:_0x4039d6(0xbe),'context':{'tool':_0x4039d6(0x128),'github_url':_0x7efdf2,'search_string':_0x583974[_0x4039d6(0x11e)][_0x4039d6(0x130)],'branch':_0x583974[_0x4039d6(0x11e)][_0x4039d6(0xf3)]},'stack_trace':_0x5a931c instanceof Error?_0x5a931c[_0x4039d6(0x1af)]:undefined,'source':_0x4039d6(0x188),'tool':_0x4039d6(0x128),'latency_ms':_0x27a575})[_0x4039d6(0x1b8)](()=>{}),{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0x108)+_0x2dffe4}],'isError':![]};}}default:throw new Error(_0x4039d6(0xf8)+_0x3e38cc);}}catch(_0xdc2a51){const _0x17ce84=_0xdc2a51 instanceof Error?_0xdc2a51[_0x4039d6(0x139)]:String(_0xdc2a51);return reportMorphError({'error_message':_0x17ce84,'error_type':_0xdc2a51 instanceof Error?_0xdc2a51[_0x4039d6(0x114)]['name']:_0x4039d6(0xbe),'context':{'tool':_0x3e38cc,'arguments':_0x37e640?JSON['stringify'](_0x37e640)[_0x4039d6(0xf2)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0xdc2a51 instanceof Error?_0xdc2a51[_0x4039d6(0x1af)]:undefined,'source':'mcp-filesystem'})[_0x4039d6(0x1b8)](()=>{}),{'content':[{'type':_0x4039d6(0x102),'text':_0x4039d6(0x1ab)+_0x17ce84}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3ef385){const _0x2cd2d9=a0_0x398bd1,_0xd8df21=await getValidRootDirectories(_0x3ef385);if(_0xd8df21[_0x2cd2d9(0x1c2)]>0x0)allowedDirectories=[..._0xd8df21],logMcpStderr(_0x2cd2d9(0x169)+_0xd8df21['length']+_0x2cd2d9(0x10b));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x56902e=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x56902e&&(allowedDirectories=[_0x56902e],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x56902e));}catch(_0x352e53){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x352e53);}}}server[a0_0x398bd1(0x14a)](RootsListChangedNotificationSchema,async()=>{const _0x46e3f0=a0_0x398bd1;try{const _0x223316=await server[_0x46e3f0(0x192)]();_0x223316&&'roots'in _0x223316&&await updateAllowedDirectoriesFromRoots(_0x223316[_0x46e3f0(0x190)]);}catch(_0x12f00c){logMcpStderr(_0x46e3f0(0x1de),_0x12f00c instanceof Error?_0x12f00c['message']:String(_0x12f00c));}}),server[a0_0x398bd1(0x10c)]=async()=>{const _0x44918e=a0_0x398bd1,_0x3bd6e3=server[_0x44918e(0xe7)]();if(_0x3bd6e3?.[_0x44918e(0x190)])try{const _0x26724c=await server[_0x44918e(0x192)]();_0x26724c&&_0x44918e(0x190)in _0x26724c?await updateAllowedDirectoriesFromRoots(_0x26724c['roots']):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x3c6e11){logMcpStderr(_0x44918e(0x161),_0x3c6e11 instanceof Error?_0x3c6e11[_0x44918e(0x139)]:String(_0x3c6e11));}else{if(allowedDirectories[_0x44918e(0x1c2)]>0x0)logMcpStderr(_0x44918e(0x187),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x44918e(0x12c));else throw new Error(_0x44918e(0x1aa));}}};async function runServer(){const _0x36fd4b=a0_0x398bd1,_0x5e6326=new StdioServerTransport();await server[_0x36fd4b(0xb9)](_0x5e6326),logMcpStderr(_0x36fd4b(0x12a)),allowedDirectories['length']===0x0&&logMcpStderr(_0x36fd4b(0xca));}runServer()[a0_0x398bd1(0x1b8)](_0x216aa4=>{const _0x5e7f8f=a0_0x398bd1;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x216aa4),process[_0x5e7f8f(0x197)](0x1);});
|
|
2
|
+
const a0_0x43b56b=a0_0x1c30;(function(_0x189010,_0x75d701){const _0x6c0f88=a0_0x1c30,_0x390661=_0x189010();while(!![]){try{const _0x2c2d76=parseInt(_0x6c0f88(0x1e9))/0x1+-parseInt(_0x6c0f88(0x15f))/0x2*(-parseInt(_0x6c0f88(0x22d))/0x3)+parseInt(_0x6c0f88(0x215))/0x4*(-parseInt(_0x6c0f88(0x1b6))/0x5)+parseInt(_0x6c0f88(0x18c))/0x6*(-parseInt(_0x6c0f88(0x181))/0x7)+-parseInt(_0x6c0f88(0x1d5))/0x8*(-parseInt(_0x6c0f88(0x217))/0x9)+parseInt(_0x6c0f88(0x189))/0xa+parseInt(_0x6c0f88(0x1bf))/0xb*(-parseInt(_0x6c0f88(0x148))/0xc);if(_0x2c2d76===_0x75d701)break;else _0x390661['push'](_0x390661['shift']());}catch(_0x14a803){_0x390661['push'](_0x390661['shift']());}}}(a0_0x2b08,0x5cc89));function a0_0x1c30(_0x279a26,_0x224a88){_0x279a26=_0x279a26-0x10c;const _0x2b08e4=a0_0x2b08();let _0x1c306e=_0x2b08e4[_0x279a26];return _0x1c306e;}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_0x2f91f5 from'fs/promises';import a0_0x26b8c3 from'path';import a0_0x49f44b from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x10c885 from'axios';function fixPathRepetition(_0x36fbf0){const _0x4b40cd=a0_0x1c30,_0xe7b0f6=_0x36fbf0['split'](a0_0x26b8c3[_0x4b40cd(0x1be)])[_0x4b40cd(0x1e1)](Boolean);if(_0xe7b0f6[_0x4b40cd(0x198)]<0x2)return null;for(let _0x4e90d6=Math[_0x4b40cd(0x185)](_0xe7b0f6['length']/0x2);_0x4e90d6>=0x1;_0x4e90d6--){for(let _0x4886ba=0x0;_0x4886ba<=_0xe7b0f6['length']-0x2*_0x4e90d6;_0x4886ba++){const _0x38bebb=_0xe7b0f6[_0x4b40cd(0x1ca)](_0x4886ba,_0x4886ba+_0x4e90d6),_0x1240a2=_0xe7b0f6[_0x4b40cd(0x1ca)](_0x4886ba+_0x4e90d6,_0x4886ba+0x2*_0x4e90d6);if(_0x38bebb[_0x4b40cd(0x221)]((_0x3dfb25,_0x13cec6)=>_0x3dfb25===_0x1240a2[_0x13cec6])){const _0x47c9ce=[..._0xe7b0f6['slice'](0x0,_0x4886ba),..._0xe7b0f6[_0x4b40cd(0x1ca)](_0x4886ba+_0x4e90d6)];return a0_0x26b8c3['sep']+_0x47c9ce[_0x4b40cd(0x1eb)](a0_0x26b8c3[_0x4b40cd(0x1be)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1cef48=a0_0x1c30;try{const _0x196eaa=require(_0x1cef48(0x1f8));return _0x196eaa[_0x1cef48(0x154)]??_0x1cef48(0x1d2);}catch(_0x42347c){return logMcpStderr(_0x1cef48(0x150),_0x42347c),_0x1cef48(0x1d2);}}function printHelp(){const _0x39a4ce=a0_0x1c30;console[_0x39a4ce(0x1fe)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x39a4ce(0x1fe)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x1c9)),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x127)),console['log'](_0x39a4ce(0x133)),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x239)),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x1bc)),console[_0x39a4ce(0x1fe)]('\x20\x20morph-mcp'),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x223));}const cliArgs=process[a0_0x43b56b(0x1cf)][a0_0x43b56b(0x1ca)](0x2),VERSION_FLAGS=new Set([a0_0x43b56b(0x1f5),'-v','-V']),HELP_FLAGS=new Set([a0_0x43b56b(0x192),'-h']);cliArgs[a0_0x43b56b(0x13a)](_0x25e489=>VERSION_FLAGS[a0_0x43b56b(0x1b2)](_0x25e489))&&(console[a0_0x43b56b(0x1fe)](a0_0x43b56b(0x231)+getPackageVersion()),process[a0_0x43b56b(0x131)](0x0));function a0_0x2b08(){const _0x26b7f5=['\x22>\x0aError\x20reading\x20file:\x20','changes','argv','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','MORPH_WARP_GREP_TIMEOUT','unknown','file_read_complete','split','984FvwxQY','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','-\x20Grepped\x20\x27','optional','stack','read\x20','read','\x20as\x20allowed\x20directory','tool_call_error','Error\x20accessing\x20directory\x20','pattern','warn','filter','message','Morph\x20Edit\x20Preview','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','WarpGrepError','terminationReason','--api-key=','ENABLE_WORKSPACE_MODE','657483CYocAT','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','join','object','-\x20Glob\x20search\x20`','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','status','\x20-\x20','tsconfig.json','homedir','WarpGrep\x20sub-tool\x20errors:\x20','Benefits:\x0a','--version','debug','\x20(new\x20file)','../package.json','mcp-filesystem','`\x20in\x20`','Unknown\x20error','ms:','timings','log','false','payload','inputSchema','\x20is\x20not\x20a\x20directory','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','toISOString','Cargo.toml','number','toLowerCase','grep\x20\x27','-\x20Listed\x20directory\x20`','PathError','github_codebase_search','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','list_directory\x20','Error:\x20','grep_search','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','tool_call_complete','params','instructions','43844XbQBjg','basename','44262znlVPC','MORPH_API_KEY','composer.json','Morph\x20FastApply\x20failed\x20without\x20error\x20message','completed_with_file_errors','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','tool_calls','SubToolError','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Applied','every','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','readFile','errors','code','RipgrepError','match','0.2.0','api_request_start','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','completed','3uuoFoJ','unknown\x20error','owner_repo','glob','@morphllm/morphmcp\x20','codebase_search','grep','search_type','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all',',\x20modified\x20','.git','LocalRipgrepProvider','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','role','setNotificationHandler',',\x20removed\x20','file_read_failed','setRequestHandler','path_validation_resolved','tool_call_received','name','isArray','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.','GitHub\x20search\x20failed:\x20','A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20','ToolException','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','cwd','\x0a...\x20(truncated,\x20total:\x20','path_validation_failed','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','branch','error','.\x20Changes:\x20','sk-','data','utf-8','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','source','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','now','node_modules','safeParse','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','push','github_search_start','[github_codebase_search]\x20Done\x20in\x20','exit','files','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','assistant','string','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','listRoots','normalize','morph-','some','connect','RipgrepNotAvailable','command','TimeoutError','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','API\x20error\x20(auth/rate-limit)','Invalid\x20arguments:\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','isDirectory','trim','pyproject.toml','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','852fZuCtl','Parent\x20directory\x20does\x20not\x20exist:\x20','\x0a</file>','FileReadError','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.','DISABLED_TOOLS','morph-mcp','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','File\x20read\x20error:','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','morph-warp-grep-v2.1','version','substring','size','requiresApiKey','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','UnknownError','linesModified','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Tool\x20\x22','access','Repository\x20identifier','1029624cPNkrn','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','\x20valid\x20directories','function','describe','dirname','Bearer\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','ReadError','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','linesAdded','api-key','[github_codebase_search]\x20Failed\x20in\x20','min','morph-v3-large','finish','path','metadata','content','map','search_string','PWD','Warning:\x20','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','.vscode','code_edit','tool','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Workspace\x20mode\x20enabled:\x20Using\x20','path_validation_start','MORPH_LARGE_APPLY','constructor','resolve','84AMqJUu','response','stringify','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','floor','\x22>\x0a','-\x20Read\x20file\x20`','instruction','2125950bOQWtT','Warning:\x20Workspace\x20fallback\x20failed:\x20','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','235446TNOovY','warp_grep_start','<file\x20path=\x22','Fatal\x20error\x20running\x20server:','\x20chars)','edit_file','--help','parse','success','repo_path','[could\x20not\x20read\x20file:\x20','Error\x20running\x20fast\x20context\x20search:\x20','length','\x20error(s)','application/json','catch','.cursor','env','MCP','Morph\x20Edit\x20','go.mod','https://morphllm.com/api/error-report','\x20disabled\x20via\x20DISABLED_TOOLS','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','array','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','timed\x20out','morph-v3-fast','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Max\x20results\x20to\x20return','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','startsWith','provider_created','\x22.\x20Known\x20tools:\x20','boolean','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','has','tool_call_id','default','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','295mJpZGa','roots','dryRun','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','messages','.\x20Path:\x20','\x0aExamples:','post','sep','76252ZSkVmD','text','lines','includes','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','Created\x20File','terminated','list_directory','indexOf','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','\x0aOptions:','slice','timeout','linesRemoved'];a0_0x2b08=function(){return _0x26b7f5;};return a0_0x2b08();}cliArgs[a0_0x43b56b(0x13a)](_0x181e65=>HELP_FLAGS[a0_0x43b56b(0x1b2)](_0x181e65))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x59cbd9){const _0x1b7f87=a0_0x43b56b;for(let _0xbd67f7=0x0;_0xbd67f7<cliArgs[_0x1b7f87(0x198)];_0xbd67f7++){const _0x4b1b7c=cliArgs[_0xbd67f7];if(_0x4b1b7c[_0x1b7f87(0x1ac)]('--'+_0x59cbd9+'='))return _0x4b1b7c[_0x1b7f87(0x1ca)](('--'+_0x59cbd9+'=')['length']);if(_0x4b1b7c==='--'+_0x59cbd9&&_0xbd67f7+0x1<cliArgs[_0x1b7f87(0x198)])return cliArgs[_0xbd67f7+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x43b56b(0x198)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x43b56b(0x1b2)](arg)||HELP_FLAGS[a0_0x43b56b(0x1b2)](arg))continue;if(arg['startsWith'](a0_0x43b56b(0x1e7)))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x43b56b(0x12e)](arg);}const WORKSPACE_ROOT=process[a0_0x43b56b(0x19d)]['WORKSPACE_ROOT']||process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x174)]||process[a0_0x43b56b(0x11c)](),ENABLE_WORKSPACE_MODE=process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x1e8)]!==a0_0x43b56b(0x1ff),MORPH_API_KEY=getCliArg(a0_0x43b56b(0x16a))??process['env'][a0_0x43b56b(0x218)],MORPH_API_URL=process[a0_0x43b56b(0x19d)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x17e)]!==a0_0x43b56b(0x1ff),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x43b56b(0x1d1)]?parseInt(process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x1d1)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set(['edit_file',a0_0x43b56b(0x232),a0_0x43b56b(0x20c)]),DEFAULT_DISABLED_TOOLS=new Set([a0_0x43b56b(0x191)]),DISABLED_TOOLS=process['env']['DISABLED_TOOLS']?new Set(process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x14d)][a0_0x43b56b(0x1d4)](',')[a0_0x43b56b(0x172)](_0x54f164=>_0x54f164[a0_0x43b56b(0x145)]())[a0_0x43b56b(0x1e1)](_0x51eb95=>_0x51eb95[a0_0x43b56b(0x198)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x43b56b(0x156)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x43b56b(0x1b2)](tool)&&console[a0_0x43b56b(0x122)](a0_0x43b56b(0x17b)+tool+a0_0x43b56b(0x1ae)+[...KNOWN_TOOL_NAMES][a0_0x43b56b(0x1eb)](',\x20'));}console[a0_0x43b56b(0x122)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x43b56b(0x1eb)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x43b56b(0x124))&&!MORPH_API_KEY[a0_0x43b56b(0x1ac)](a0_0x43b56b(0x139))&&logMcpStderr(a0_0x43b56b(0x11a));async function reportMorphError(_0x393422){const _0x18c680=a0_0x43b56b;try{await a0_0x10c885[_0x18c680(0x1bd)](_0x18c680(0x1a1),{..._0x393422,'timestamp':new Date()[_0x18c680(0x205)](),'source':_0x393422[_0x18c680(0x128)]||_0x18c680(0x1f9),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x393422['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x18c680(0x19a),'Authorization':_0x18c680(0x165)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x333c8e,_0x23212b){const _0x5c9281=a0_0x43b56b;if(_0x333c8e&&typeof _0x333c8e===_0x5c9281(0x1ec)&&_0x5c9281(0x1ef)in _0x333c8e)return _0x333c8e[_0x5c9281(0x1ef)];if(_0x333c8e&&typeof _0x333c8e===_0x5c9281(0x1ec)&&_0x5c9281(0x182)in _0x333c8e)return _0x333c8e[_0x5c9281(0x182)]?.[_0x5c9281(0x1ef)];const _0x59d0c3=_0x23212b[_0x5c9281(0x228)](/\b(401|429)\b/);return _0x59d0c3?parseInt(_0x59d0c3[0x1],0xa):null;}function handleMorphAPIError(_0x408d41){const _0x39251d=a0_0x43b56b,_0x1e0067=_0x408d41 instanceof Error?_0x408d41['message']:String(_0x408d41),_0x1836ed=extractStatusCode(_0x408d41,_0x1e0067);switch(_0x1836ed){case 0x191:return{'content':[{'type':_0x39251d(0x1c0),'text':_0x39251d(0x22b)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':'Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.'}],'isError':!![]};default:return null;}}args[a0_0x43b56b(0x198)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x43b56b(0x143)),logMcpStderr(a0_0x43b56b(0x1d0)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x43b56b(0x1a6)),logMcpStderr(a0_0x43b56b(0x1a9)),logMcpStderr(a0_0x43b56b(0x1b0)));function normalizePath(_0x5651c5){const _0x31dc3d=a0_0x43b56b;return a0_0x26b8c3[_0x31dc3d(0x138)](_0x5651c5);}function expandHome(_0x128643){const _0x3feccb=a0_0x43b56b;if(_0x128643[_0x3feccb(0x1ac)]('~/')||_0x128643==='~')return a0_0x26b8c3[_0x3feccb(0x1eb)](a0_0x49f44b[_0x3feccb(0x1f2)](),_0x128643[_0x3feccb(0x1ca)](0x1));return _0x128643;}let allowedDirectories=await Promise['all'](args[a0_0x43b56b(0x172)](async _0x236619=>{const _0x30f04a=a0_0x43b56b,_0x3d04d3=expandHome(_0x236619),_0x399dac=a0_0x26b8c3[_0x30f04a(0x180)](_0x3d04d3);try{const _0x25586c=await a0_0x2f91f5['realpath'](_0x399dac);return normalizePath(_0x25586c);}catch(_0x22267d){return normalizePath(_0x399dac);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x43b56b(0x198)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x43b56b(0x17c)+workspaceDir+a0_0x43b56b(0x1dc)));}catch(a0_0x10922d){logMcpStderr(a0_0x43b56b(0x17a)+a0_0x10922d);}async function detectWorkspaceRoot(_0x20cedc){const _0x309edb=a0_0x43b56b;let _0x497cca=a0_0x26b8c3['resolve'](_0x20cedc);const _0x90cb63=[_0x309edb(0x237),_0x309edb(0x177),'package.json',_0x309edb(0x206),_0x309edb(0x146),_0x309edb(0x1a0),_0x309edb(0x19c),_0x309edb(0x1f1),_0x309edb(0x219)];while(_0x497cca!==a0_0x26b8c3[_0x309edb(0x164)](_0x497cca)){for(const _0x46128d of _0x90cb63){const _0x338953=a0_0x26b8c3[_0x309edb(0x1eb)](_0x497cca,_0x46128d);try{return await a0_0x2f91f5[_0x309edb(0x15d)](_0x338953),normalizePath(_0x497cca);}catch{}}_0x497cca=a0_0x26b8c3[_0x309edb(0x164)](_0x497cca);}return normalizePath(_0x20cedc);}await Promise['all'](args[a0_0x43b56b(0x172)](async _0x2b3e10=>{const _0x26300e=a0_0x43b56b;try{const _0x26bc29=await a0_0x2f91f5['stat'](expandHome(_0x2b3e10));!_0x26bc29[_0x26300e(0x144)]()&&(logMcpStderr(_0x26300e(0x20f)+_0x2b3e10+_0x26300e(0x202)),process[_0x26300e(0x131)](0x1));}catch(_0x1c2b1d){logMcpStderr(_0x26300e(0x1de)+_0x2b3e10+':',_0x1c2b1d),process[_0x26300e(0x131)](0x1);}}));async function validatePath(_0x114321){const _0x3bb51c=a0_0x43b56b,_0x4e8769=expandHome(_0x114321),_0x104580=a0_0x26b8c3['resolve'](_0x4e8769);logger[_0x3bb51c(0x1f6)](_0x3bb51c(0x19e),_0x3bb51c(0x17d),{'raw_path':_0x114321,'absolute':_0x104580});try{const _0x4077ca=await a0_0x2f91f5['realpath'](_0x104580);return logger[_0x3bb51c(0x1f6)]('MCP',_0x3bb51c(0x111),{'resolved':_0x4077ca,'symlink':_0x4077ca!==_0x104580}),_0x4077ca;}catch(_0x37e602){if(_0x37e602['code']==='ENOENT'){const _0x379fd7=a0_0x26b8c3[_0x3bb51c(0x164)](_0x104580);try{const _0x30f78a=await a0_0x2f91f5['realpath'](_0x379fd7),_0x299bf0=a0_0x26b8c3[_0x3bb51c(0x1eb)](_0x30f78a,a0_0x26b8c3['basename'](_0x104580));return logger['debug'](_0x3bb51c(0x19e),_0x3bb51c(0x111),{'resolved':_0x299bf0,'new_file':!![]}),_0x299bf0;}catch{logger['error']('MCP',_0x3bb51c(0x11e),{'raw_path':_0x114321,'error':_0x3bb51c(0x149)+_0x379fd7});throw new Error(_0x3bb51c(0x149)+_0x379fd7);}}logger[_0x3bb51c(0x122)](_0x3bb51c(0x19e),_0x3bb51c(0x11e),{'raw_path':_0x114321,'error':_0x37e602['message']});throw _0x37e602;}}const MorphEditFileArgsSchema=z[a0_0x43b56b(0x1ec)]({'path':z[a0_0x43b56b(0x135)](),'code_edit':z[a0_0x43b56b(0x135)]()['describe'](a0_0x43b56b(0x1ea)),'instruction':z[a0_0x43b56b(0x135)]()[a0_0x43b56b(0x163)](a0_0x43b56b(0x166)),'dryRun':z[a0_0x43b56b(0x1af)]()[a0_0x43b56b(0x1b4)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x43b56b(0x160),WarpGrepArgsSchema=z['object']({'search_string':z['string']()[a0_0x43b56b(0x163)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x43b56b(0x135)]()[a0_0x43b56b(0x163)](a0_0x43b56b(0x168)),'search_type':z['enum']([a0_0x43b56b(0x1b4),a0_0x43b56b(0x12b)])[a0_0x43b56b(0x1d8)]()[a0_0x43b56b(0x163)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x43b56b(0x135)]()[a0_0x43b56b(0x1d8)]()[a0_0x43b56b(0x163)](a0_0x43b56b(0x115)),'owner_repo':z['string']()['optional']()[a0_0x43b56b(0x163)](a0_0x43b56b(0x13f)),'branch':z[a0_0x43b56b(0x135)]()['optional']()[a0_0x43b56b(0x163)](a0_0x43b56b(0x15b))}),CodebaseSearchArgsSchema=z[a0_0x43b56b(0x1ec)]({'query':z[a0_0x43b56b(0x135)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x43b56b(0x135)]()['describe'](a0_0x43b56b(0x15e)),'branch':z['string']()['optional']()['describe'](a0_0x43b56b(0x203)),'commitHash':z['string']()['optional']()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x43b56b(0x1a5)](z[a0_0x43b56b(0x135)]())[a0_0x43b56b(0x1b4)]([])[a0_0x43b56b(0x163)](a0_0x43b56b(0x235)),'limit':z[a0_0x43b56b(0x207)]()[a0_0x43b56b(0x1d8)]()['default'](0xa)['describe'](a0_0x43b56b(0x1aa))}),server=new Server({'name':a0_0x43b56b(0x14e),'version':a0_0x43b56b(0x229)},{'capabilities':{'tools':{}}});server[a0_0x43b56b(0x110)](ListToolsRequestSchema,async()=>{const _0x91ee03=a0_0x43b56b,_0x48b791=[{'name':_0x91ee03(0x191),'description':_0x91ee03(0x1d6)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x91ee03(0x158)+_0x91ee03(0x1a4)+_0x91ee03(0x1f4)+_0x91ee03(0x147)+_0x91ee03(0x152)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x91ee03(0x21c)+_0x91ee03(0x129)+_0x91ee03(0x1c8)+_0x91ee03(0x119)+'For\x20deletions:\x0a'+_0x91ee03(0x1ee)+_0x91ee03(0x1a3)+'Rules:\x0a'+_0x91ee03(0x184)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x91ee03(0x14f)+_0x91ee03(0x18b)+_0x91ee03(0x142)+_0x91ee03(0x222)+_0x91ee03(0x176),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x91ee03(0x117)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20'+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x430e16=_0x48b791['filter'](_0x5aa262=>{const _0x30280b=_0x91ee03;if(DISABLED_TOOLS[_0x30280b(0x1b2)](_0x5aa262[_0x30280b(0x113)]))return console[_0x30280b(0x122)]('Tool\x20'+_0x5aa262['name']+_0x30280b(0x1a2)),![];if(_0x30280b(0x157)in _0x5aa262&&_0x5aa262[_0x30280b(0x157)]&&!MORPH_API_KEY)return logMcpStderr(_0x30280b(0x175)+_0x5aa262['name']+_0x30280b(0x211)),![];return!![];});return{'tools':_0x430e16['map'](_0x1ba6eb=>({'name':_0x1ba6eb[_0x91ee03(0x113)],'description':_0x1ba6eb['description'],'inputSchema':_0x1ba6eb[_0x91ee03(0x201)]}))};}),server[a0_0x43b56b(0x110)](CallToolRequestSchema,async _0x12806e=>{const _0x163d15=a0_0x43b56b,{name:_0x4886e6,arguments:_0xcaef15}=_0x12806e[_0x163d15(0x213)],_0x1ecf01=Date['now']();logger['debug'](_0x163d15(0x19e),_0x163d15(0x112),{'tool':_0x4886e6,'args':_0x4886e6==='edit_file'?{'path':_0xcaef15?.[_0x163d15(0x16f)],'instruction':_0xcaef15?.['instruction']||_0xcaef15?.[_0x163d15(0x214)],'dryRun':_0xcaef15?.[_0x163d15(0x1b8)]}:_0xcaef15});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x1ab)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x163d15(0x124))&&!MORPH_API_KEY[_0x163d15(0x1ac)](_0x163d15(0x139)))return{'content':[{'type':'text','text':_0x163d15(0x1c3)}],'isError':!![]};if(DISABLED_TOOLS[_0x163d15(0x1b2)](_0x4886e6))throw new Error(_0x163d15(0x15c)+_0x4886e6+_0x163d15(0x12d));switch(_0x4886e6){case _0x163d15(0x191):{const _0x38aed5=_0xcaef15&&typeof _0xcaef15==='object'&&_0x163d15(0x214)in _0xcaef15&&!(_0x163d15(0x188)in _0xcaef15)?{..._0xcaef15,'instruction':_0xcaef15[_0x163d15(0x214)],'instructions':undefined}:_0xcaef15,_0x3c74b7=MorphEditFileArgsSchema[_0x163d15(0x12c)](_0x38aed5);if(!_0x3c74b7['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x3c74b7['error']);const _0x282604=await validatePath(_0x3c74b7['data'][_0x163d15(0x16f)]);let _0x32f863=null,_0xb9f70e=!![],_0x370833=null;try{_0x32f863=await a0_0x2f91f5['readFile'](_0x282604,'utf-8'),logger['debug'](_0x163d15(0x19e),_0x163d15(0x1d3),{'path':_0x282604,'size_bytes':_0x32f863[_0x163d15(0x198)]});}catch(_0x815f6c){const _0x2f96f2=_0x815f6c[_0x163d15(0x226)];_0x2f96f2==='ENOENT'?(_0xb9f70e=![],_0x32f863='',logger[_0x163d15(0x1f6)](_0x163d15(0x19e),_0x163d15(0x1d3),{'path':_0x282604,'exists':![]})):(_0x370833='Failed\x20to\x20read\x20file:\x20'+(_0x2f96f2||_0x163d15(0x1d2))+_0x163d15(0x1f0)+(_0x815f6c instanceof Error?_0x815f6c[_0x163d15(0x1e2)]:String(_0x815f6c)),logger[_0x163d15(0x122)](_0x163d15(0x19e),_0x163d15(0x10f),{'path':_0x282604,'error':_0x370833}),logMcpStderr(_0x163d15(0x175)+_0x370833));}let _0x580a55;try{const _0x42939b=MORPH_API_KEY;if(!_0x42939b)throw new Error(_0x163d15(0x1b1));const _0x22f199=a0_0x26b8c3[_0x163d15(0x164)](_0x282604),_0x464b9f=a0_0x26b8c3[_0x163d15(0x216)](_0x282604);logger[_0x163d15(0x1f6)](_0x163d15(0x19e),_0x163d15(0x22a),{'model':'morph-v3-fast','path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'instruction_len':_0x3c74b7['data']['instruction'][_0x163d15(0x198)],'code_edit_len':_0x3c74b7['data'][_0x163d15(0x178)][_0x163d15(0x198)],'original_code_len':_0x32f863?.['length']??0x0,'dry_run':_0x3c74b7['data']['dryRun']});const _0xdd2cb4=Date['now'](),_0x33733f=await executeEditFile({'target_filepath':_0x464b9f,'code_edit':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x178)],'instruction':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x188)]},{'morphApiKey':_0x42939b,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x22f199,'autoWrite':!_0x3c74b7['data']['dryRun'],'generateUdiff':![],'debug':![]}),_0x557fee=Date[_0x163d15(0x12a)]()-_0xdd2cb4;_0x580a55=_0x33733f['completionId'];if(!_0x33733f[_0x163d15(0x194)])throw new Error(_0x33733f['error']||_0x163d15(0x21a));const _0x266b21=_0x33733f[_0x163d15(0x1ce)],_0xdc4821='added\x20'+_0x266b21['linesAdded']+_0x163d15(0x10e)+_0x266b21[_0x163d15(0x1cc)]+_0x163d15(0x236)+_0x266b21[_0x163d15(0x15a)];logger[_0x163d15(0x1f6)]('MCP',_0x163d15(0x212),{'tool':'edit_file','success':!![],'latency_ms':Date['now']()-_0x1ecf01,'edit_latency_ms':_0x557fee,'changes':{'added':_0x266b21[_0x163d15(0x169)],'removed':_0x266b21['linesRemoved'],'modified':_0x266b21[_0x163d15(0x15a)]},'completion_id':_0x580a55});if(_0x3c74b7['data'][_0x163d15(0x1b8)])return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x1e3)+(_0xb9f70e?'':_0x163d15(0x1f7))+':\x20'+_0x3c74b7['data'][_0x163d15(0x188)]+_0x163d15(0x123)+_0xdc4821+_0x163d15(0x1bb)+_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)]+'.'}]};return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x19f)+(_0xb9f70e?_0x163d15(0x220):_0x163d15(0x1c4))+':\x20'+_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x188)]+'.\x20Changes:\x20'+_0xdc4821+_0x163d15(0x1bb)+_0x3c74b7['data']['path']+'.'}]};}catch(_0x197087){const _0x34b2f6=handleMorphAPIError(_0x197087);if(_0x34b2f6)return logger[_0x163d15(0x122)](_0x163d15(0x19e),_0x163d15(0x1dd),{'tool':_0x163d15(0x191),'error':_0x163d15(0x140),'latency_ms':Date[_0x163d15(0x12a)]()-_0x1ecf01}),_0x34b2f6;const _0x5d2a8d=_0x197087 instanceof Error?_0x197087['message']:String(_0x197087);return logger[_0x163d15(0x122)]('MCP',_0x163d15(0x1dd),{'tool':_0x163d15(0x191),'error':_0x5d2a8d,'path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'validated_path':_0x282604,'latency_ms':Date[_0x163d15(0x12a)]()-_0x1ecf01,'stack':_0x197087 instanceof Error?_0x197087[_0x163d15(0x1d9)]:undefined}),reportMorphError({'error_message':_0x5d2a8d,'error_type':_0x197087 instanceof Error?_0x197087[_0x163d15(0x17f)][_0x163d15(0x113)]:'UnknownError','context':{'tool':'edit_file','completion_id':_0x580a55,'file_path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'validated_path':_0x282604,'instruction':_0x3c74b7['data'][_0x163d15(0x188)],'model':MORPH_LARGE_APPLY?_0x163d15(0x16d):_0x163d15(0x1a8),'dry_run':_0x3c74b7[_0x163d15(0x125)]['dryRun'],'file_exists':_0xb9f70e,'file_read_error':_0x370833,'file_readable':_0x32f863!==null,'request_content':{'path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'code_edit':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x178)],'instruction':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x188)],'original_code':_0x32f863!==null?_0x32f863[_0x163d15(0x198)]>0xc350?_0x32f863['substring'](0x0,0xc350)+_0x163d15(0x11d)+_0x32f863[_0x163d15(0x198)]+_0x163d15(0x190):_0x32f863:_0x163d15(0x196)+(_0x370833||_0x163d15(0x22e))+']','original_code_length':_0x32f863?.[_0x163d15(0x198)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x163d15(0x1a8),'dry_run':_0x3c74b7[_0x163d15(0x125)]['dryRun']}},'stack_trace':_0x197087 instanceof Error?_0x197087['stack']:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x163d15(0x1c0),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x5d2a8d}],'isError':!![]};}}case _0x163d15(0x232):{const _0x57facc=WarpGrepArgsSchema[_0x163d15(0x12c)](_0xcaef15);if(!_0x57facc['success'])return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x141)+_0x57facc[_0x163d15(0x122)]}],'isError':!![]};const _0x591be3=_0x1796c8=>{const _0x239970=_0x163d15,_0x42e814=[];for(const _0x35a617 of _0x1796c8||[]){if(_0x35a617['role']===_0x239970(0x134)&&Array[_0x239970(0x114)](_0x35a617[_0x239970(0x21d)]))for(const _0x5b4dc5 of _0x35a617[_0x239970(0x21d)]){try{const _0x575a99=_0x5b4dc5[_0x239970(0x162)]?.[_0x239970(0x113)],_0x272536=JSON[_0x239970(0x193)](_0x5b4dc5[_0x239970(0x162)]?.['arguments']||'{}');if(_0x575a99==='grep_search')_0x42e814[_0x239970(0x12e)](_0x239970(0x209)+_0x272536[_0x239970(0x1df)]+'\x27\x20'+(_0x272536['path']||'.'));else{if(_0x575a99===_0x239970(0x1db))_0x42e814[_0x239970(0x12e)](_0x239970(0x1da)+_0x272536[_0x239970(0x16f)]);else{if(_0x575a99===_0x239970(0x1c6))_0x42e814[_0x239970(0x12e)](_0x239970(0x20e)+(_0x272536['command']||'.'));else{if(_0x575a99===_0x239970(0x230))_0x42e814[_0x239970(0x12e)]('glob\x20\x27'+_0x272536[_0x239970(0x1df)]+'\x27\x20'+(_0x272536[_0x239970(0x16f)]||'.'));else _0x575a99===_0x239970(0x16e)&&_0x42e814[_0x239970(0x12e)](_0x239970(0x16e));}}}}catch{}}}return _0x42e814;},_0x4435dd=_0x5a1482=>{const _0x292791=_0x163d15,_0x42f953=[];if(!_0x5a1482||!Array[_0x292791(0x114)](_0x5a1482))return _0x42f953;const _0x4b83b9=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x292791(0x1db)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x292791(0x20b),'tool':_0x292791(0x1db)},{'pattern':/\[READ ERROR\]/,'error_type':_0x292791(0x167),'tool':_0x292791(0x1db)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x292791(0x1db)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x292791(0x227),'tool':_0x292791(0x233)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x292791(0x13c),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x292791(0x1db)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x292791(0x1db)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x292791(0x1db)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x292791(0x167),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x292791(0x118),'tool':_0x292791(0x1d2)}];let _0x1019f9=0x0;for(const _0xd246e5 of _0x5a1482){_0xd246e5['role']===_0x292791(0x134)&&Array[_0x292791(0x114)](_0xd246e5[_0x292791(0x21d)])&&_0x1019f9++;const _0xbc981d=_0xd246e5[_0x292791(0x171)];if((_0xd246e5[_0x292791(0x10c)]===_0x292791(0x179)||_0xd246e5[_0x292791(0x10c)]==='user')&&_0xbc981d&&typeof _0xbc981d===_0x292791(0x135))for(const {pattern:_0x9848fe,error_type:_0x282bee,tool:_0x4f9e21}of _0x4b83b9){const _0x358831=_0xbc981d[_0x292791(0x228)](new RegExp(_0x9848fe[_0x292791(0x128)],'g'));if(_0x358831)for(const _0x38b54b of _0x358831){const _0x4d17f0=_0xbc981d[_0x292791(0x1c7)](_0x38b54b),_0x56eeb8=_0xbc981d['substring'](_0x4d17f0,Math[_0x292791(0x16c)](_0x4d17f0+0xc8,_0xbc981d[_0x292791(0x198)]));_0x42f953[_0x292791(0x12e)]({'tool':_0x4f9e21,'error_type':_0x282bee,'error_message':_0x56eeb8[_0x292791(0x1d4)]('\x0a')[0x0],'turn':_0x1019f9});}}}return _0x42f953;};try{const _0x3ffd21=a0_0x26b8c3[_0x163d15(0x180)](_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)]),_0x15f2af=_0x57facc[_0x163d15(0x125)][_0x163d15(0x234)],_0x2da418=_0x15f2af==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x301dc8=new LocalRipgrepProvider(_0x3ffd21,undefined,_0x2da418);logger[_0x163d15(0x1f6)]('MCP',_0x163d15(0x1ad),{'type':_0x163d15(0x238),'repo_root':_0x3ffd21,'search_type':_0x15f2af||_0x163d15(0x1b4)}),logger[_0x163d15(0x1f6)]('MCP',_0x163d15(0x18d),{'query':_0x57facc['data'][_0x163d15(0x173)],'repo_root':_0x3ffd21,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0xf69fe5=Date[_0x163d15(0x12a)](),_0xbc9a13=await runWarpGrep({'searchTerm':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'repoRoot':_0x3ffd21,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x301dc8,'search_type':_0x15f2af}),_0x5962da=Date[_0x163d15(0x12a)]()-_0xf69fe5,_0xaddcc0=_0xbc9a13['finish']?.[_0x163d15(0x170)]?.[_0x163d15(0x132)]?.[_0x163d15(0x198)]??0x0;logger[_0x163d15(0x1f6)]('MCP','warp_grep_complete',{'termination':_0xbc9a13['terminationReason'],'turns':_0xbc9a13[_0x163d15(0x1fd)]?.['turns']??0x0,'files_found':_0xaddcc0,'latency_ms':_0x5962da});const _0x50064b=_0x4435dd(_0xbc9a13[_0x163d15(0x1ba)]);_0x50064b[_0x163d15(0x198)]>0x0&&reportMorphError({'error_message':_0x163d15(0x1f3)+_0x50064b[_0x163d15(0x198)]+_0x163d15(0x199),'error_type':_0x163d15(0x21e),'level':'warn','tool':_0x163d15(0x232),'context':{'repo_path':_0x57facc['data']['repo_path'],'query':_0x57facc['data'][_0x163d15(0x173)],'model':_0x163d15(0x153),'termination_reason':_0xbc9a13[_0x163d15(0x1e6)],'sub_tool_errors':_0x50064b,'timings':_0xbc9a13[_0x163d15(0x1fd)],'tool_calls':_0x591be3(_0xbc9a13['messages']),'messages':_0xbc9a13[_0x163d15(0x1ba)]?.[_0x163d15(0x172)](_0x153029=>({'role':_0x153029[_0x163d15(0x10c)],'content':_0x153029[_0x163d15(0x171)],..._0x153029[_0x163d15(0x21d)]?{'tool_calls':_0x153029[_0x163d15(0x21d)][_0x163d15(0x198)]}:{},..._0x153029[_0x163d15(0x1b3)]?{'tool_call_id':_0x153029[_0x163d15(0x1b3)]}:{}}))},'source':_0x163d15(0x1f9)})[_0x163d15(0x19b)](()=>{});let _0x2fee66='';if(_0xbc9a13[_0x163d15(0x1e6)]===_0x163d15(0x22c)&&_0xbc9a13[_0x163d15(0x16e)]?.[_0x163d15(0x170)]?.['files']){const _0x5375c4=_0xbc9a13[_0x163d15(0x16e)]['metadata'][_0x163d15(0x132)];if(_0x5375c4[_0x163d15(0x198)]===0x0)return _0x2fee66=_0xbc9a13[_0x163d15(0x16e)][_0x163d15(0x200)]||_0x163d15(0x20d),{'content':[{'type':_0x163d15(0x1c0),'text':_0x2fee66}]};const _0x4e34ba=[],_0x2b09bd=[_0x163d15(0x120)];for(const _0x4bbe8f of _0xbc9a13['messages']){if(_0x4bbe8f['role']==='assistant'&&Array['isArray'](_0x4bbe8f[_0x163d15(0x21d)]))for(const _0x148b2b of _0x4bbe8f['tool_calls']){try{const _0x47bbdd=_0x148b2b['function']?.[_0x163d15(0x113)],_0x3b2543=JSON[_0x163d15(0x193)](_0x148b2b[_0x163d15(0x162)]?.['arguments']||'{}');if(_0x47bbdd===_0x163d15(0x210))_0x2b09bd[_0x163d15(0x12e)](_0x163d15(0x1d7)+_0x3b2543[_0x163d15(0x1df)]+'\x27\x20in\x20`'+(_0x3b2543[_0x163d15(0x16f)]||'.')+'`');else{if(_0x47bbdd===_0x163d15(0x1db))_0x2b09bd[_0x163d15(0x12e)](_0x163d15(0x187)+_0x3b2543['path']+'`');else{if(_0x47bbdd===_0x163d15(0x1c6))_0x2b09bd[_0x163d15(0x12e)](_0x163d15(0x20a)+(_0x3b2543[_0x163d15(0x13d)]||'.')+'`');else _0x47bbdd===_0x163d15(0x230)&&_0x2b09bd['push'](_0x163d15(0x1ed)+_0x3b2543['pattern']+_0x163d15(0x1fa)+(_0x3b2543['path']||'.')+'`');}}}catch{}}}_0x4e34ba[_0x163d15(0x12e)](_0x2b09bd[_0x163d15(0x1eb)]('\x0a'));const _0x1d8ad0=['','Relevant\x20context\x20found:'];for(const _0x193df5 of _0x5375c4){if(_0x193df5['lines']==='*')_0x1d8ad0[_0x163d15(0x12e)]('-\x20'+_0x193df5[_0x163d15(0x16f)]+':*');else{if(Array[_0x163d15(0x114)](_0x193df5[_0x163d15(0x1c1)])){const _0x116ebb=_0x193df5['lines'][_0x163d15(0x172)](([_0x88e0e3,_0x29f955])=>{if(_0x88e0e3===_0x29f955)return''+_0x88e0e3;return _0x88e0e3+'-'+_0x29f955;});_0x1d8ad0[_0x163d15(0x12e)]('-\x20'+_0x193df5[_0x163d15(0x16f)]+':'+_0x116ebb[_0x163d15(0x1eb)](','));}else _0x1d8ad0['push']('-\x20'+_0x193df5[_0x163d15(0x16f)]+':*');}}_0x1d8ad0[_0x163d15(0x12e)](''),_0x4e34ba[_0x163d15(0x12e)](_0x1d8ad0[_0x163d15(0x1eb)]('\x0a')),_0x4e34ba['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x20d52f=[],_0x2b05be=[];for(const _0xf11ccb of _0x5375c4){let _0x1070d8=a0_0x26b8c3[_0x163d15(0x180)](_0x57facc[_0x163d15(0x125)]['repo_path'],_0xf11ccb[_0x163d15(0x16f)]),_0x3dfe7f=null,_0x57f434=null;try{_0x3dfe7f=await a0_0x2f91f5[_0x163d15(0x224)](_0x1070d8,{'encoding':_0x163d15(0x126)});}catch(_0x16891d){const _0xc913ff=fixPathRepetition(_0x1070d8);if(_0xc913ff)try{_0x3dfe7f=await a0_0x2f91f5[_0x163d15(0x224)](_0xc913ff,{'encoding':_0x163d15(0x126)}),_0x1070d8=_0xc913ff;}catch{_0x57f434=_0x16891d instanceof Error?_0x16891d:new Error(String(_0x16891d));}else _0x57f434=_0x16891d instanceof Error?_0x16891d:new Error(String(_0x16891d));}if(_0x3dfe7f!==null){const _0x1797f7=_0x3dfe7f['split'](/\r?\n/),_0x46f401=[];if(_0xf11ccb['lines']==='*'||!Array[_0x163d15(0x114)](_0xf11ccb[_0x163d15(0x1c1)]))for(let _0x1beafe=0x1;_0x1beafe<=_0x1797f7[_0x163d15(0x198)];_0x1beafe++){const _0x28bf54=_0x1797f7[_0x1beafe-0x1];_0x46f401[_0x163d15(0x12e)](_0x1beafe+'|\x20'+_0x28bf54);}else for(const [_0xc25b63,_0x3cba40]of _0xf11ccb['lines']){_0x46f401[_0x163d15(0x198)]>0x0&&_0x46f401[_0x163d15(0x12e)]('');for(let _0x40e563=_0xc25b63;_0x40e563<=_0x3cba40&&_0x40e563<=_0x1797f7[_0x163d15(0x198)];_0x40e563++){const _0x530246=_0x1797f7[_0x40e563-0x1];_0x46f401['push'](_0x40e563+'|\x20'+_0x530246);}}_0x2b05be['push']({'path':_0xf11ccb[_0x163d15(0x16f)],'content':_0x46f401['join']('\x0a')});}else _0x20d52f[_0x163d15(0x12e)](_0x163d15(0x18e)+_0xf11ccb[_0x163d15(0x16f)]+_0x163d15(0x1cd)+(_0x57f434?.[_0x163d15(0x1e2)]||_0x163d15(0x1fb))+'\x0a</file>');}try{const _0x1ac9e0=await compactFileContexts(_0x2b05be,_0x57facc[_0x163d15(0x125)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x2fd469 of _0x1ac9e0){_0x20d52f[_0x163d15(0x12e)](_0x163d15(0x18e)+_0x2fd469['path']+_0x163d15(0x186)+_0x2fd469[_0x163d15(0x171)]+_0x163d15(0x14a));}}catch(_0xdbadfa){logger[_0x163d15(0x1e0)](_0x163d15(0x19e),'compaction_failed',{'error':_0xdbadfa instanceof Error?_0xdbadfa[_0x163d15(0x1e2)]:String(_0xdbadfa),'files_count':_0x2b05be[_0x163d15(0x198)]});for(const _0x311b37 of _0x2b05be){_0x20d52f[_0x163d15(0x12e)](_0x163d15(0x18e)+_0x311b37[_0x163d15(0x16f)]+'\x22>\x0a'+_0x311b37[_0x163d15(0x171)]+'\x0a</file>');}}_0x4e34ba['push'](_0x20d52f[_0x163d15(0x1eb)]('\x0a\x0a')),_0x2fee66=_0x4e34ba[_0x163d15(0x1eb)]('\x0a');const _0x29c1b2=_0xbc9a13[_0x163d15(0x225)]?.['filter'](_0x28c3f1=>_0x28c3f1[_0x163d15(0x1e2)]?.[_0x163d15(0x1ac)](_0x163d15(0x151)))||[];if(_0x29c1b2[_0x163d15(0x198)]>0x0){const _0xed5e9a=_0x29c1b2[_0x163d15(0x172)](_0x546556=>_0x546556['message'])[_0x163d15(0x1eb)](';\x20');reportMorphError({'error_message':_0xed5e9a,'error_type':_0x163d15(0x14b),'context':{'tool':_0x163d15(0x232),'repo_path':_0x57facc[_0x163d15(0x125)]['repo_path'],'query':_0x57facc['data'][_0x163d15(0x173)],'model':'morph-warp-grep-v2.1','termination_reason':_0x163d15(0x21b),'error_count':_0x29c1b2['length'],'is_timeout':![],'timings':_0xbc9a13[_0x163d15(0x1fd)],'files_attempted':_0x5375c4['map'](_0x13f690=>({'path':_0x13f690[_0x163d15(0x16f)],'lines':_0x13f690[_0x163d15(0x1c1)]})),'tool_calls':_0x591be3(_0xbc9a13['messages']),'messages':_0xbc9a13[_0x163d15(0x1ba)]?.[_0x163d15(0x172)](_0x27aa8c=>({'role':_0x27aa8c[_0x163d15(0x10c)],'content':_0x27aa8c[_0x163d15(0x171)],..._0x27aa8c[_0x163d15(0x21d)]?{'tool_calls':_0x27aa8c[_0x163d15(0x21d)][_0x163d15(0x198)]}:{},..._0x27aa8c[_0x163d15(0x1b3)]?{'tool_call_id':_0x27aa8c[_0x163d15(0x1b3)]}:{}})),'request_content':{'query':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'repo_path':_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)],'repoRoot':a0_0x26b8c3[_0x163d15(0x180)](_0x57facc['data'][_0x163d15(0x195)]),'model':'morph-warp-grep-v2.1'}},'source':_0x163d15(0x1f9)})[_0x163d15(0x19b)](()=>{});}}else{if(_0xbc9a13[_0x163d15(0x1e6)]===_0x163d15(0x1c5)&&_0xbc9a13[_0x163d15(0x225)]['length']>0x0){const _0x44e3ef=_0xbc9a13['errors'][_0x163d15(0x172)](_0x47c022=>_0x47c022[_0x163d15(0x1e2)])['join'](';\x20');_0x2fee66='Error:\x20'+_0x44e3ef;const _0x110d25=_0x44e3ef[_0x163d15(0x208)]()['includes'](_0x163d15(0x1cb))||_0x44e3ef[_0x163d15(0x208)]()[_0x163d15(0x1c2)](_0x163d15(0x1a7))||_0x44e3ef['toLowerCase']()[_0x163d15(0x1c2)]('etimedout'),_0x580612=_0xbc9a13[_0x163d15(0x16e)]?.['metadata']?.[_0x163d15(0x132)],_0x4439b9=_0xbc9a13[_0x163d15(0x225)][0x0];reportMorphError({'error_message':_0x44e3ef,'error_type':_0x110d25?_0x163d15(0x13e):_0x4439b9?.['constructor']?.[_0x163d15(0x113)]||_0x163d15(0x1e5),'context':{'tool':'codebase_search','repo_path':_0x57facc['data']['repo_path'],'query':_0x57facc['data'][_0x163d15(0x173)],'model':_0x163d15(0x153),'termination_reason':_0xbc9a13[_0x163d15(0x1e6)],'error_count':_0xbc9a13['errors'][_0x163d15(0x198)],'is_timeout':_0x110d25,'timings':_0xbc9a13[_0x163d15(0x1fd)],'files_attempted':_0x580612?.[_0x163d15(0x172)](_0x6c9821=>({'path':_0x6c9821[_0x163d15(0x16f)],'lines':_0x6c9821[_0x163d15(0x1c1)]})),'tool_calls':_0x591be3(_0xbc9a13['messages']),'messages':_0xbc9a13[_0x163d15(0x1ba)]?.[_0x163d15(0x172)](_0x40d6f3=>({'role':_0x40d6f3['role'],'content':_0x40d6f3['content'],..._0x40d6f3[_0x163d15(0x21d)]?{'tool_calls':_0x40d6f3[_0x163d15(0x21d)][_0x163d15(0x198)]}:{},..._0x40d6f3['tool_call_id']?{'tool_call_id':_0x40d6f3[_0x163d15(0x1b3)]}:{}})),'request_content':{'query':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'repo_path':_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)],'repoRoot':a0_0x26b8c3[_0x163d15(0x180)](_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)]),'model':_0x163d15(0x153)}},'stack_trace':_0x4439b9?.['stack']||undefined,'source':_0x163d15(0x1f9)})['catch'](()=>{});}else _0x2fee66=_0x163d15(0x1b9);}return{'content':[{'type':_0x163d15(0x1c0),'text':_0x2fee66}]};}catch(_0x262ea5){const _0x2d50b6=handleMorphAPIError(_0x262ea5);if(_0x2d50b6)return logger[_0x163d15(0x122)]('MCP','tool_call_error',{'tool':_0x163d15(0x232),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x163d15(0x12a)]()-_0x1ecf01}),_0x2d50b6;const _0x3c184a=_0x262ea5 instanceof Error?_0x262ea5[_0x163d15(0x1e2)]:String(_0x262ea5);logger[_0x163d15(0x122)](_0x163d15(0x19e),_0x163d15(0x1dd),{'tool':_0x163d15(0x232),'error':_0x3c184a,'repo_path':_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)],'query':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'latency_ms':Date['now']()-_0x1ecf01});const _0x3b05b4=_0x3c184a[_0x163d15(0x208)]()[_0x163d15(0x1c2)]('timeout')||_0x3c184a[_0x163d15(0x208)]()['includes'](_0x163d15(0x1a7))||_0x3c184a[_0x163d15(0x208)]()[_0x163d15(0x1c2)]('etimedout')||_0x262ea5 instanceof Error&&_0x262ea5['name']===_0x163d15(0x13e);return reportMorphError({'error_message':_0x3c184a,'error_type':_0x3b05b4?_0x163d15(0x13e):_0x262ea5 instanceof Error?_0x262ea5[_0x163d15(0x17f)][_0x163d15(0x113)]:'UnknownError','context':{'tool':_0x163d15(0x232),'repo_path':_0x57facc['data']['repo_path'],'query':_0x57facc[_0x163d15(0x125)]['search_string'],'model':'morph-warp-grep-v2.1','is_timeout':_0x3b05b4,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x57facc['data'][_0x163d15(0x173)],'repo_path':_0x57facc['data'][_0x163d15(0x195)],'repoRoot':a0_0x26b8c3['resolve'](_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)]),'model':_0x163d15(0x153)}},'stack_trace':_0x262ea5 instanceof Error?_0x262ea5['stack']:undefined,'source':'mcp-filesystem'})[_0x163d15(0x19b)](()=>{}),{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x197)+_0x3c184a}],'isError':![]};}}case _0x163d15(0x20c):{const _0xa2ee2a=WarpGrepGitHubArgsSchema[_0x163d15(0x12c)](_0xcaef15);if(!_0xa2ee2a[_0x163d15(0x194)])return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x141)+_0xa2ee2a[_0x163d15(0x122)]}],'isError':!![]};const _0x495124=_0xa2ee2a[_0x163d15(0x125)]['github_url']||_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x22f)];if(!_0x495124)return{'content':[{'type':'text','text':_0x163d15(0x204)}],'isError':!![]};const _0x35b2cc=MORPH_API_KEY;if(!_0x35b2cc)throw new Error(_0x163d15(0x1b1));const _0x19640c=Date['now']();logger[_0x163d15(0x1f6)](_0x163d15(0x19e),_0x163d15(0x12f),{'identifier':_0x495124,'query':_0xa2ee2a[_0x163d15(0x125)]['search_string'],'branch':_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x121)]});try{const _0x10f6ac=new WarpGrepClient({'morphApiKey':_0x35b2cc,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x24b001=await _0x10f6ac['searchGitHub']({'searchTerm':_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x173)],'github':_0x495124,'branch':_0xa2ee2a['data'][_0x163d15(0x121)]}),_0x1bbc9f=Date['now']()-_0x19640c;logMcpStderr(_0x163d15(0x130)+_0x1bbc9f+'ms.\x20Success:\x20'+_0x24b001[_0x163d15(0x194)]);const _0x2d52f3=formatResult(_0x24b001);return{'content':[{'type':_0x163d15(0x1c0),'text':_0x2d52f3}]};}catch(_0xa4deea){const _0x55b5d7=handleMorphAPIError(_0xa4deea);if(_0x55b5d7)return _0x55b5d7;const _0x4f3aca=Date['now']()-_0x19640c,_0x33f9a3=_0xa4deea instanceof Error?_0xa4deea[_0x163d15(0x1e2)]:String(_0xa4deea);return logMcpStderr(_0x163d15(0x16b)+_0x4f3aca+_0x163d15(0x1fc),_0x33f9a3),reportMorphError({'error_message':_0x33f9a3,'error_type':_0xa4deea instanceof Error?_0xa4deea['constructor']['name']:_0x163d15(0x159),'context':{'tool':_0x163d15(0x20c),'github_url':_0x495124,'search_string':_0xa2ee2a['data']['search_string'],'branch':_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x121)]},'stack_trace':_0xa4deea instanceof Error?_0xa4deea[_0x163d15(0x1d9)]:undefined,'source':'mcp-filesystem','tool':_0x163d15(0x20c),'latency_ms':_0x4f3aca})['catch'](()=>{}),{'content':[{'type':'text','text':_0x163d15(0x116)+_0x33f9a3}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x4886e6);}}catch(_0x1052f7){const _0xadd928=_0x1052f7 instanceof Error?_0x1052f7[_0x163d15(0x1e2)]:String(_0x1052f7);return reportMorphError({'error_message':_0xadd928,'error_type':_0x1052f7 instanceof Error?_0x1052f7['constructor'][_0x163d15(0x113)]:_0x163d15(0x159),'context':{'tool':_0x4886e6,'arguments':_0xcaef15?JSON[_0x163d15(0x183)](_0xcaef15)[_0x163d15(0x155)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x1052f7 instanceof Error?_0x1052f7[_0x163d15(0x1d9)]:undefined,'source':_0x163d15(0x1f9)})['catch'](()=>{}),{'content':[{'type':_0x163d15(0x1c0),'text':'Error:\x20'+_0xadd928}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x52499e){const _0x4b94c6=a0_0x43b56b,_0x5c7c32=await getValidRootDirectories(_0x52499e);if(_0x5c7c32[_0x4b94c6(0x198)]>0x0)allowedDirectories=[..._0x5c7c32],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x5c7c32[_0x4b94c6(0x198)]+_0x4b94c6(0x161));else{logMcpStderr(_0x4b94c6(0x11b));if(ENABLE_WORKSPACE_MODE)try{const _0x4d094b=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4d094b&&(allowedDirectories=[_0x4d094b],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4d094b));}catch(_0x3eb85b){logMcpStderr(_0x4b94c6(0x18a)+_0x3eb85b);}}}server[a0_0x43b56b(0x10d)](RootsListChangedNotificationSchema,async()=>{const _0x410249=a0_0x43b56b;try{const _0x2a19ea=await server[_0x410249(0x137)]();_0x2a19ea&&'roots'in _0x2a19ea&&await updateAllowedDirectoriesFromRoots(_0x2a19ea[_0x410249(0x1b7)]);}catch(_0x12cf51){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x12cf51 instanceof Error?_0x12cf51[_0x410249(0x1e2)]:String(_0x12cf51));}}),server['oninitialized']=async()=>{const _0x1973de=a0_0x43b56b,_0x528c35=server['getClientCapabilities']();if(_0x528c35?.[_0x1973de(0x1b7)])try{const _0x530451=await server[_0x1973de(0x137)]();_0x530451&&_0x1973de(0x1b7)in _0x530451?await updateAllowedDirectoriesFromRoots(_0x530451['roots']):logMcpStderr(_0x1973de(0x1e4));}catch(_0x3ec59b){logMcpStderr(_0x1973de(0x11f),_0x3ec59b instanceof Error?_0x3ec59b[_0x1973de(0x1e2)]:String(_0x3ec59b));}else{if(allowedDirectories[_0x1973de(0x198)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1973de(0x1b5));else throw new Error(_0x1973de(0x14c));}}};async function runServer(){const _0x5c8118=a0_0x43b56b,_0x3c244b=new StdioServerTransport();await server[_0x5c8118(0x13b)](_0x3c244b),logMcpStderr(_0x5c8118(0x21f)),allowedDirectories['length']===0x0&&logMcpStderr(_0x5c8118(0x136));}runServer()[a0_0x43b56b(0x19b)](_0xef10e9=>{const _0x139527=a0_0x43b56b;logMcpStderr(_0x139527(0x18f),_0xef10e9),process[_0x139527(0x131)](0x1);});
|
package/dist/log-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var a1_0x202fd8=a1_0x157a;(function(_0x3faa7a,_0x4d63eb){var _0x322b96=a1_0x157a,_0xee876=_0x3faa7a();while(!![]){try{var _0x4f354c=-parseInt(_0x322b96(0x159))/0x1*(-parseInt(_0x322b96(0x14e))/0x2)+parseInt(_0x322b96(0x152))/0x3*(-parseInt(_0x322b96(0x154))/0x4)+parseInt(_0x322b96(0x14d))/0x5*(-parseInt(_0x322b96(0x151))/0x6)+parseInt(_0x322b96(0x14c))/0x7+-parseInt(_0x322b96(0x157))/0x8+parseInt(_0x322b96(0x14f))/0x9+parseInt(_0x322b96(0x14b))/0xa;if(_0x4f354c===_0x4d63eb)break;else _0xee876['push'](_0xee876['shift']());}catch(_0x1eb571){_0xee876['push'](_0xee876['shift']());}}}(a1_0x21b8,0x666dc));import a1_0x28474d from'os';import{logger}from'./logger.js';function a1_0x21b8(){var _0x5bfbfc=['34254rlfLcT','102EUZniN','linux','65728TzfwRa','win32','platform','6601880cTiBpm','info','16804DzmMOO','macOS','Linux','[os=','Unknown','darwin','4941840KyDgjT','2196089mKSXji','60ndhxTh','54oewRTv','5493240jfToZn','Windows'];a1_0x21b8=function(){return _0x5bfbfc;};return a1_0x21b8();}export function getOperatingSystemType(_0x3db9e6=a1_0x28474d['platform']()){var _0x582099=a1_0x157a;switch(_0x3db9e6){case _0x582099(0x14a):return _0x582099(0x15a);case _0x582099(0x155):return _0x582099(0x150);case _0x582099(0x153):return _0x582099(0x15b);default:return _0x582099(0x149);}}export function formatMcpLogMessage(_0x2d03c1,_0x6f55c1=a1_0x28474d[a1_0x202fd8(0x156)]()){var _0x286f06=a1_0x202fd8;return _0x286f06(0x15c)+getOperatingSystemType(_0x6f55c1)+']\x20'+_0x2d03c1;}function a1_0x157a(_0xd29b8f,_0xa41123){_0xd29b8f=_0xd29b8f-0x149;var _0x21b8ac=a1_0x21b8();var _0x157a2b=_0x21b8ac[_0xd29b8f];return _0x157a2b;}export function logMcpStderr(_0x19a7c7,..._0x4430b3){var _0x3e056c=a1_0x202fd8;console['error'](formatMcpLogMessage(_0x19a7c7),..._0x4430b3),logger[_0x3e056c(0x158)]('MCP',_0x19a7c7,_0x4430b3['length']?{'args':_0x4430b3['map'](_0x2fe597=>String(_0x2fe597))}:undefined);}
|
package/dist/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a2_0xd05f8c=a2_0x14ab;(function(_0x1b0f67,_0x1969d5){const _0x1e1b42=a2_0x14ab,_0x56d37e=_0x1b0f67();while(!![]){try{const _0x13648a=-parseInt(_0x1e1b42(0xfd))/0x1+-parseInt(_0x1e1b42(0x104))/0x2+-parseInt(_0x1e1b42(0x102))/0x3+parseInt(_0x1e1b42(0xf6))/0x4*(-parseInt(_0x1e1b42(0x108))/0x5)+parseInt(_0x1e1b42(0xf7))/0x6*(-parseInt(_0x1e1b42(0xff))/0x7)+parseInt(_0x1e1b42(0xfe))/0x8*(parseInt(_0x1e1b42(0x105))/0x9)+parseInt(_0x1e1b42(0xfa))/0xa*(parseInt(_0x1e1b42(0x109))/0xb);if(_0x13648a===_0x1969d5)break;else _0x56d37e['push'](_0x56d37e['shift']());}catch(_0x50261d){_0x56d37e['push'](_0x56d37e['shift']());}}}(a2_0x302a,0xe81e1));function a2_0x14ab(_0x95b78b,_0x2a3e57){_0x95b78b=_0x95b78b-0xee;const _0x302ad5=a2_0x302a();let _0x14ab4e=_0x302ad5[_0x95b78b];return _0x14ab4e;}function a2_0x302a(){const _0x2c1357=['warn','stringify','toISOString','fileStream','88EwnEbS','3740694nqtqLi','env','error','692960zTyaFt',']\x20[','info','1001794hylqJJ','1304abkzQo','7oAvDzd','isEnabled','toUpperCase','2597799BOKkMa','MORPH_LOG_FILE','179704KgXSPE','43587FvqbpN','_log','enable','132690njOMxh','528ksNOEK','debug','write','enabled','MORPH_DEBUG'];a2_0x302a=function(){return _0x2c1357;};return a2_0x302a();}import{createWriteStream}from'fs';class MorphLogger{[a2_0xd05f8c(0xf0)];[a2_0xd05f8c(0xf5)];constructor(){const _0x273445=a2_0xd05f8c;this[_0x273445(0xf0)]=process[_0x273445(0xf8)][_0x273445(0xf1)]==='1'||!!process[_0x273445(0xf8)][_0x273445(0x103)];const _0x175357=process[_0x273445(0xf8)][_0x273445(0x103)];this['fileStream']=_0x175357?createWriteStream(_0x175357,{'flags':'a'}):null;}['debug'](_0x48d401,_0x27cef9,_0x1988e1){const _0x26e3b5=a2_0xd05f8c;this[_0x26e3b5(0x106)](_0x26e3b5(0xee),_0x48d401,_0x27cef9,_0x1988e1);}[a2_0xd05f8c(0xfc)](_0x27847f,_0x1b3ca0,_0x67ed0d){const _0x1b7b8c=a2_0xd05f8c;this[_0x1b7b8c(0x106)](_0x1b7b8c(0xfc),_0x27847f,_0x1b3ca0,_0x67ed0d);}[a2_0xd05f8c(0xf2)](_0x4fe606,_0x8a60ae,_0x330c9c){const _0x13a7aa=a2_0xd05f8c;this[_0x13a7aa(0x106)](_0x13a7aa(0xf2),_0x4fe606,_0x8a60ae,_0x330c9c);}[a2_0xd05f8c(0xf9)](_0x179c8c,_0x4234c6,_0x1f7018){const _0x5e21a4=a2_0xd05f8c;this['_log'](_0x5e21a4(0xf9),_0x179c8c,_0x4234c6,_0x1f7018);}[a2_0xd05f8c(0x107)](){const _0x24e54c=a2_0xd05f8c;this[_0x24e54c(0xf0)]=!![];}get[a2_0xd05f8c(0x100)](){return this['enabled'];}[a2_0xd05f8c(0x106)](_0x996bec,_0x5e8913,_0xdd47da,_0x57850b){const _0xe9d7b=a2_0xd05f8c;if(_0x996bec!=='error'&&!this[_0xe9d7b(0xf0)])return;const _0x2b56e6=new Date()[_0xe9d7b(0xf4)](),_0x4090b9='['+_0x2b56e6+']\x20['+_0x996bec[_0xe9d7b(0x101)]()+_0xe9d7b(0xfb)+_0x5e8913+']';console[_0xe9d7b(0xf9)](_0x57850b?_0x4090b9+'\x20'+_0xdd47da+'\x20'+JSON[_0xe9d7b(0xf3)](_0x57850b):_0x4090b9+'\x20'+_0xdd47da),this[_0xe9d7b(0xf5)]?.[_0xe9d7b(0xef)](JSON[_0xe9d7b(0xf3)]({'ts':_0x2b56e6,'level':_0x996bec,'component':_0x5e8913,'msg':_0xdd47da,..._0x57850b&&{'data':_0x57850b}})+'\x0a');}}export const logger=new MorphLogger();
|
package/dist/path-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xb4dda8,_0x2eec7d){const _0x3af6bb=a3_0x1c2f,_0x3dfca0=_0xb4dda8();while(!![]){try{const _0x5b7742=parseInt(_0x3af6bb(0x124))/0x1*(-parseInt(_0x3af6bb(0x127))/0x2)+parseInt(_0x3af6bb(0x122))/0x3*(parseInt(_0x3af6bb(0x116))/0x4)+-parseInt(_0x3af6bb(0x125))/0x5*(-parseInt(_0x3af6bb(0x11d))/0x6)+parseInt(_0x3af6bb(0x11a))/0x7+-parseInt(_0x3af6bb(0x128))/0x8+parseInt(_0x3af6bb(0x115))/0x9*(-parseInt(_0x3af6bb(0x120))/0xa)+parseInt(_0x3af6bb(0x11e))/0xb;if(_0x5b7742===_0x2eec7d)break;else _0x3dfca0['push'](_0x3dfca0['shift']());}catch(_0x375c16){_0x3dfca0['push'](_0x3dfca0['shift']());}}}(a3_0x13b5,0x57fc1));import a3_0x17c956 from'path';import a3_0x4d9086 from'os';function a3_0x13b5(){const _0xf0f5e1=['homedir','charAt','substring','1225728YTSiCw','startsWith','toUpperCase','2034QnMATK','10070434AvMxZA','test','52990baxQdH','match','107373tMpacr','/mnt/','13nkfZoT','6330HVwrnv','trim','13000ZfJSDx','4562168HHUorV','slice','replace','1161gJMZXU','20DInndh'];a3_0x13b5=function(){return _0xf0f5e1;};return a3_0x13b5();}export function convertToWindowsPath(_0x23eb2f){const _0x43a1df=a3_0x1c2f;if(_0x23eb2f['startsWith'](_0x43a1df(0x123))){const _0x55cacd=_0x23eb2f['charAt'](0x5)['toUpperCase'](),_0xb317ea=_0x23eb2f[_0x43a1df(0x113)](0x6)[_0x43a1df(0x114)](/\//g,'\x5c');return _0x55cacd+':'+_0xb317ea;}if(_0x23eb2f[_0x43a1df(0x121)](/^\/[a-zA-Z]\//)){const _0x410032=_0x23eb2f[_0x43a1df(0x118)](0x1)['toUpperCase'](),_0x12e373=_0x23eb2f[_0x43a1df(0x113)](0x2)['replace'](/\//g,'\x5c');return _0x410032+':'+_0x12e373;}if(_0x23eb2f[_0x43a1df(0x121)](/^[a-zA-Z]:/))return _0x23eb2f[_0x43a1df(0x114)](/\//g,'\x5c');return _0x23eb2f;}function a3_0x1c2f(_0x3af966,_0x3eae5a){_0x3af966=_0x3af966-0x113;const _0x13b547=a3_0x13b5();let _0x1c2fc7=_0x13b547[_0x3af966];return _0x1c2fc7;}export function normalizePath(_0x2a4733){const _0x4f277d=a3_0x1c2f;_0x2a4733=_0x2a4733[_0x4f277d(0x126)]()[_0x4f277d(0x114)](/^["']|["']$/g,'');const _0xe745b8=_0x2a4733[_0x4f277d(0x11b)]('/')&&!_0x2a4733['match'](/^\/mnt\/[a-z]\//i)&&!_0x2a4733[_0x4f277d(0x121)](/^\/[a-zA-Z]\//);if(_0xe745b8)return _0x2a4733[_0x4f277d(0x114)](/\/+/g,'/')[_0x4f277d(0x114)](/\/+$/,'');_0x2a4733=convertToWindowsPath(_0x2a4733);if(_0x2a4733[_0x4f277d(0x11b)]('\x5c\x5c')){let _0x345ace=_0x2a4733;_0x345ace=_0x345ace[_0x4f277d(0x114)](/^\\{2,}/,'\x5c\x5c');const _0x495c3b=_0x345ace[_0x4f277d(0x119)](0x2)[_0x4f277d(0x114)](/\\\\/g,'\x5c');_0x2a4733='\x5c\x5c'+_0x495c3b;}else _0x2a4733=_0x2a4733['replace'](/\\\\/g,'\x5c');let _0x15586d=a3_0x17c956['normalize'](_0x2a4733);_0x2a4733['startsWith']('\x5c\x5c')&&!_0x15586d[_0x4f277d(0x11b)]('\x5c\x5c')&&(_0x15586d='\x5c'+_0x15586d);if(_0x15586d['match'](/^[a-zA-Z]:/)){let _0x11e375=_0x15586d[_0x4f277d(0x114)](/\//g,'\x5c');return/^[a-z]:/[_0x4f277d(0x11f)](_0x11e375)&&(_0x11e375=_0x11e375[_0x4f277d(0x118)](0x0)[_0x4f277d(0x11c)]()+_0x11e375[_0x4f277d(0x113)](0x1)),_0x11e375;}return _0x15586d[_0x4f277d(0x114)](/\//g,'\x5c');}export function expandHome(_0xc58137){const _0x34cbce=a3_0x1c2f;if(_0xc58137[_0x34cbce(0x11b)]('~/')||_0xc58137==='~')return a3_0x17c956['join'](a3_0x4d9086[_0x34cbce(0x117)](),_0xc58137[_0x34cbce(0x113)](0x1));return _0xc58137;}
|
package/dist/path-validation.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a4_0x4fe6(){const _0x26ee04=['2890zmvCTW','Path\x20must\x20be\x20absolute\x20after\x20normalization','12137472bcdcnD','string','some','7agYZOO','5002SKovAt','normalize','startsWith','952086EyTMkW','length','45FPKOiV','5735272zuiFYv','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','785500vqhcZp','sep','includes','177078RSDISC','765UHFzUn','resolve','708384oIuMZT'];a4_0x4fe6=function(){return _0x26ee04;};return a4_0x4fe6();}(function(_0x1e0322,_0x21d391){const _0x2748fe=a4_0x4545,_0x3bac44=_0x1e0322();while(!![]){try{const _0x1d8a54=-parseInt(_0x2748fe(0xf5))/0x1+parseInt(_0x2748fe(0xfc))/0x2*(parseInt(_0x2748fe(0xf3))/0x3)+-parseInt(_0x2748fe(0xef))/0x4*(parseInt(_0x2748fe(0x101))/0x5)+parseInt(_0x2748fe(0xff))/0x6*(parseInt(_0x2748fe(0xfb))/0x7)+-parseInt(_0x2748fe(0xed))/0x8+-parseInt(_0x2748fe(0xf8))/0x9+parseInt(_0x2748fe(0xf6))/0xa*(parseInt(_0x2748fe(0xf2))/0xb);if(_0x1d8a54===_0x21d391)break;else _0x3bac44['push'](_0x3bac44['shift']());}catch(_0x4e15c8){_0x3bac44['push'](_0x3bac44['shift']());}}}(a4_0x4fe6,0xdd8da));import a4_0x195184 from'path';function a4_0x4545(_0x5c751f,_0x1fe371){_0x5c751f=_0x5c751f-0xed;const _0x4fe67b=a4_0x4fe6();let _0x45455a=_0x4fe67b[_0x5c751f];return _0x45455a;}export function isPathWithinAllowedDirectories(_0x244fde,_0x163d1b){const _0x42fb35=a4_0x4545;if(typeof _0x244fde!==_0x42fb35(0xf9)||!Array['isArray'](_0x163d1b))return![];if(!_0x244fde||_0x163d1b[_0x42fb35(0x100)]===0x0)return![];if(_0x244fde[_0x42fb35(0xf1)]('\x00'))return![];let _0x2ea334;try{_0x2ea334=a4_0x195184[_0x42fb35(0xf4)](a4_0x195184[_0x42fb35(0xfd)](_0x244fde));}catch{return![];}if(!a4_0x195184['isAbsolute'](_0x2ea334))throw new Error(_0x42fb35(0xf7));return _0x163d1b[_0x42fb35(0xfa)](_0xa5c2c5=>{const _0x130d24=_0x42fb35;if(typeof _0xa5c2c5!==_0x130d24(0xf9)||!_0xa5c2c5)return![];if(_0xa5c2c5[_0x130d24(0xf1)]('\x00'))return![];let _0x54895a;try{_0x54895a=a4_0x195184[_0x130d24(0xf4)](a4_0x195184[_0x130d24(0xfd)](_0xa5c2c5));}catch{return![];}if(!a4_0x195184['isAbsolute'](_0x54895a))throw new Error(_0x130d24(0xee));if(_0x2ea334===_0x54895a)return!![];if(_0x54895a===a4_0x195184[_0x130d24(0xf0)])return _0x2ea334[_0x130d24(0xfe)](a4_0x195184[_0x130d24(0xf0)]);return _0x2ea334[_0x130d24(0xfe)](_0x54895a+a4_0x195184[_0x130d24(0xf0)]);});}
|
package/dist/roots-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x211011,_0x1b049a){const _0x3df5c3=a5_0x115f,_0x32049d=_0x211011();while(!![]){try{const _0x28f421=-parseInt(_0x3df5c3(0xf5))/0x1*(parseInt(_0x3df5c3(0xe4))/0x2)+-parseInt(_0x3df5c3(0xec))/0x3*(parseInt(_0x3df5c3(0xde))/0x4)+-parseInt(_0x3df5c3(0xeb))/0x5+-parseInt(_0x3df5c3(0xe3))/0x6+-parseInt(_0x3df5c3(0xe7))/0x7+-parseInt(_0x3df5c3(0xf4))/0x8+-parseInt(_0x3df5c3(0xdf))/0x9*(-parseInt(_0x3df5c3(0xe6))/0xa);if(_0x28f421===_0x1b049a)break;else _0x32049d['push'](_0x32049d['shift']());}catch(_0x5a2bb3){_0x32049d['push'](_0x32049d['shift']());}}}(a5_0x6c6b,0xcf692));import{promises as a5_0x585bd4}from'fs';import a5_0x58cd32 from'path';import a5_0x4b73c6 from'os';function a5_0x115f(_0x35bc89,_0x4aabd9){_0x35bc89=_0x35bc89-0xde;const _0x6c6bf6=a5_0x6c6b();let _0x115ffa=_0x6c6bf6[_0x35bc89];return _0x115ffa;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x40de6d){const _0x28bac2=a5_0x115f;try{const _0x3cd7ad=_0x40de6d['startsWith'](_0x28bac2(0xf6))?_0x40de6d['slice'](0x7):_0x40de6d,_0x368895=_0x3cd7ad[_0x28bac2(0xea)]('~/')||_0x3cd7ad==='~'?a5_0x58cd32['join'](a5_0x4b73c6[_0x28bac2(0xe0)](),_0x3cd7ad[_0x28bac2(0xf0)](0x1)):_0x3cd7ad,_0x3434fc=a5_0x58cd32[_0x28bac2(0xf2)](_0x368895),_0x2034fb=await a5_0x585bd4[_0x28bac2(0xe2)](_0x3434fc);return normalizePath(_0x2034fb);}catch{return null;}}function a5_0x6c6b(){const _0x93127e=['1772141lyZVlk','invalid\x20path\x20or\x20inaccessible','message','startsWith','4147035XJQZgY','123eWXZMT','stat','push','\x20due\x20to\x20error:\x20','slice','non-directory\x20root','resolve','uri','7410352GsWkjQ','1454028RawjcJ','file://','108044GFoQcr','537291KKOQwF','homedir','Skipping\x20invalid\x20directory:\x20','realpath','4374600IYWKwi','2XaJrvm','Skipping\x20','1030efGpWy'];a5_0x6c6b=function(){return _0x93127e;};return a5_0x6c6b();}function formatDirectoryError(_0x3284d4,_0xe31dc2,_0x51b09e){const _0x138b6b=a5_0x115f;if(_0x51b09e)return _0x138b6b(0xe5)+_0x51b09e+':\x20'+_0x3284d4;const _0x5c1199=_0xe31dc2 instanceof Error?_0xe31dc2[_0x138b6b(0xe9)]:String(_0xe31dc2);return _0x138b6b(0xe1)+_0x3284d4+_0x138b6b(0xef)+_0x5c1199;}export async function getValidRootDirectories(_0x4238d9){const _0x25136b=a5_0x115f,_0x3b6dd3=[];for(const _0x47395a of _0x4238d9){const _0x5ecee4=await parseRootUri(_0x47395a[_0x25136b(0xf3)]);if(!_0x5ecee4){logMcpStderr(formatDirectoryError(_0x47395a[_0x25136b(0xf3)],undefined,_0x25136b(0xe8)));continue;}try{const _0x189ef7=await a5_0x585bd4[_0x25136b(0xed)](_0x5ecee4);_0x189ef7['isDirectory']()?_0x3b6dd3[_0x25136b(0xee)](_0x5ecee4):logMcpStderr(formatDirectoryError(_0x5ecee4,undefined,_0x25136b(0xf1)));}catch(_0x29a1b8){logMcpStderr(formatDirectoryError(_0x5ecee4,_0x29a1b8));}}return _0x3b6dd3;}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/morphmcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.163",
|
|
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)",
|