🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@morphllm/morphmcp

Package Overview
Dependencies
Maintainers
2
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morphllm/morphmcp - npm Package Compare versions

Comparing version
0.8.172
to
0.8.173
+1
-1
dist/index.js
#!/usr/bin/env node
const a0_0x4592e9=a0_0x1bf7;(function(_0x13f9ae,_0x2f5fb9){const _0x38e128=a0_0x1bf7,_0x24d6cc=_0x13f9ae();while(!![]){try{const _0x3f4dfa=-parseInt(_0x38e128(0x189))/0x1+-parseInt(_0x38e128(0x120))/0x2*(-parseInt(_0x38e128(0xe8))/0x3)+parseInt(_0x38e128(0xf8))/0x4+-parseInt(_0x38e128(0x154))/0x5+-parseInt(_0x38e128(0xdf))/0x6+parseInt(_0x38e128(0x127))/0x7+parseInt(_0x38e128(0x16b))/0x8;if(_0x3f4dfa===_0x2f5fb9)break;else _0x24d6cc['push'](_0x24d6cc['shift']());}catch(_0x3ed3d8){_0x24d6cc['push'](_0x24d6cc['shift']());}}}(a0_0x3bb1,0x8fda1));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_0xb48a10 from'fs/promises';import a0_0xe64fd4 from'path';import a0_0xc72497 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_0x32428b from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x428e4c){const _0x549b88=a0_0x1bf7,_0x30d257=_0x428e4c['split'](a0_0xe64fd4[_0x549b88(0xe7)])[_0x549b88(0x102)](Boolean);if(_0x30d257['length']<0x2)return null;for(let _0x3833e9=Math[_0x549b88(0x18e)](_0x30d257[_0x549b88(0xc1)]/0x2);_0x3833e9>=0x1;_0x3833e9--){for(let _0x6b0518=0x0;_0x6b0518<=_0x30d257['length']-0x2*_0x3833e9;_0x6b0518++){const _0x403c46=_0x30d257[_0x549b88(0x92)](_0x6b0518,_0x6b0518+_0x3833e9),_0x4d1134=_0x30d257[_0x549b88(0x92)](_0x6b0518+_0x3833e9,_0x6b0518+0x2*_0x3833e9);if(_0x403c46[_0x549b88(0xa5)]((_0x21ae8c,_0x2d9b36)=>_0x21ae8c===_0x4d1134[_0x2d9b36])){const _0x26de66=[..._0x30d257[_0x549b88(0x92)](0x0,_0x6b0518),..._0x30d257['slice'](_0x6b0518+_0x3833e9)];return a0_0xe64fd4[_0x549b88(0xe7)]+_0x26de66[_0x549b88(0xd4)](a0_0xe64fd4[_0x549b88(0xe7)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x12c7f7=a0_0x1bf7;try{const _0x67cbee=require(_0x12c7f7(0x137));return _0x67cbee[_0x12c7f7(0x7a)]??_0x12c7f7(0x156);}catch(_0x5d2c5e){return logMcpStderr(_0x12c7f7(0x124),_0x5d2c5e),_0x12c7f7(0x156);}}function printHelp(){const _0x562f26=a0_0x1bf7;console[_0x562f26(0x15b)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x562f26(0x15b)](_0x562f26(0xa0)),console['log'](_0x562f26(0x17f)),console[_0x562f26(0x15b)](_0x562f26(0x119)),console['log']('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x562f26(0x15b)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x562f26(0x15b)]('\x0aExamples:'),console[_0x562f26(0x15b)]('\x20\x20morph-mcp'),console[_0x562f26(0x15b)](_0x562f26(0xe9));}const cliArgs=process[a0_0x4592e9(0x110)][a0_0x4592e9(0x92)](0x2),VERSION_FLAGS=new Set([a0_0x4592e9(0x130),'-v','-V']),HELP_FLAGS=new Set([a0_0x4592e9(0x11c),'-h']);cliArgs[a0_0x4592e9(0x70)](_0xd9183c=>VERSION_FLAGS[a0_0x4592e9(0x18d)](_0xd9183c))&&(console['log'](a0_0x4592e9(0x9f)+getPackageVersion()),process[a0_0x4592e9(0x196)](0x0));function a0_0x1bf7(_0x57af19,_0x936580){_0x57af19=_0x57af19-0x70;const _0x3bb186=a0_0x3bb1();let _0x1bf740=_0x3bb186[_0x57af19];return _0x1bf740;}cliArgs[a0_0x4592e9(0x70)](_0x5c36ff=>HELP_FLAGS[a0_0x4592e9(0x18d)](_0x5c36ff))&&(printHelp(),process[a0_0x4592e9(0x196)](0x0));function getCliArg(_0x27743c){const _0x1089a1=a0_0x4592e9;for(let _0x3e9548=0x0;_0x3e9548<cliArgs[_0x1089a1(0xc1)];_0x3e9548++){const _0x4d81e0=cliArgs[_0x3e9548];if(_0x4d81e0[_0x1089a1(0x19a)]('--'+_0x27743c+'='))return _0x4d81e0[_0x1089a1(0x92)](('--'+_0x27743c+'=')[_0x1089a1(0xc1)]);if(_0x4d81e0==='--'+_0x27743c&&_0x3e9548+0x1<cliArgs['length'])return cliArgs[_0x3e9548+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x4592e9(0x18d)](arg)||HELP_FLAGS[a0_0x4592e9(0x18d)](arg))continue;if(arg[a0_0x4592e9(0x19a)](a0_0x4592e9(0xb2)))continue;if(arg===a0_0x4592e9(0xf0)){i++;continue;}args[a0_0x4592e9(0x19f)](arg);}const WORKSPACE_ROOT=process[a0_0x4592e9(0x183)][a0_0x4592e9(0x171)]||process[a0_0x4592e9(0x183)][a0_0x4592e9(0x19d)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x4592e9(0x183)][a0_0x4592e9(0x17d)]!=='false',MORPH_API_KEY=getCliArg(a0_0x4592e9(0x114))??process[a0_0x4592e9(0x183)][a0_0x4592e9(0x15f)],MORPH_API_URL=process[a0_0x4592e9(0x183)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x4592e9(0x183)][a0_0x4592e9(0xe5)]!=='false',MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x4592e9(0xa9)]?parseInt(process[a0_0x4592e9(0x183)][a0_0x4592e9(0xa9)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x4592e9(0x183)][a0_0x4592e9(0x105)]?new Set(process[a0_0x4592e9(0x183)][a0_0x4592e9(0x105)][a0_0x4592e9(0x16e)](',')[a0_0x4592e9(0xfe)](_0x35351f=>_0x35351f[a0_0x4592e9(0x182)]())[a0_0x4592e9(0x102)](_0x24143f=>_0x24143f[a0_0x4592e9(0xc1)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x4592e9(0x174)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x4592e9(0x18d)](tool)&&console['error'](a0_0x4592e9(0x162)+tool+a0_0x4592e9(0x99)+[...KNOWN_TOOL_NAMES][a0_0x4592e9(0xd4)](',\x20'));}console[a0_0x4592e9(0xd3)](a0_0x4592e9(0xe1)+[...DISABLED_TOOLS][a0_0x4592e9(0xd4)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x4592e9(0x13f))&&!MORPH_API_KEY[a0_0x4592e9(0x19a)](a0_0x4592e9(0x76))&&logMcpStderr(a0_0x4592e9(0x104));async function reportMorphError(_0x307a5f){const _0x52d0ff=a0_0x4592e9;try{await a0_0x32428b[_0x52d0ff(0x12e)](_0x52d0ff(0x9d),{..._0x307a5f,'timestamp':new Date()[_0x52d0ff(0x172)](),'source':_0x307a5f[_0x52d0ff(0x11b)]||_0x52d0ff(0xc2),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x307a5f[_0x52d0ff(0xb7)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x52d0ff(0x10f)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x51f117,_0x44f19d){const _0x43b695=a0_0x4592e9;if(_0x51f117&&typeof _0x51f117==='object'&&_0x43b695(0xf9)in _0x51f117)return _0x51f117[_0x43b695(0xf9)];if(_0x51f117&&typeof _0x51f117===_0x43b695(0x103)&&_0x43b695(0x132)in _0x51f117)return _0x51f117[_0x43b695(0x132)]?.[_0x43b695(0xf9)];const _0x437235=_0x44f19d[_0x43b695(0x10c)](/\b(401|429)\b/);return _0x437235?parseInt(_0x437235[0x1],0xa):null;}function handleMorphAPIError(_0x53d11c){const _0x4a4480=a0_0x4592e9,_0x423262=_0x53d11c instanceof Error?_0x53d11c['message']:String(_0x53d11c),_0x4c4b18=extractStatusCode(_0x53d11c,_0x423262);switch(_0x4c4b18){case 0x191:return{'content':[{'type':_0x4a4480(0x169),'text':_0x4a4480(0xa8)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x4a4480(0x169),'text':_0x4a4480(0x19c)}],'isError':!![]};default:return null;}}args[a0_0x4592e9(0xc1)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr(a0_0x4592e9(0xba)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x4592e9(0x11e)),logMcpStderr(a0_0x4592e9(0xd6)),logMcpStderr(a0_0x4592e9(0x10b)));function normalizePath(_0xd43f01){return a0_0xe64fd4['normalize'](_0xd43f01);}function expandHome(_0x50b4d6){const _0x6b1bbb=a0_0x4592e9;if(_0x50b4d6[_0x6b1bbb(0x19a)]('~/')||_0x50b4d6==='~')return a0_0xe64fd4[_0x6b1bbb(0xd4)](a0_0xc72497[_0x6b1bbb(0x170)](),_0x50b4d6['slice'](0x1));return _0x50b4d6;}let allowedDirectories=await Promise[a0_0x4592e9(0x141)](args[a0_0x4592e9(0xfe)](async _0x43f59e=>{const _0x14ae7f=a0_0x4592e9,_0x1a552f=expandHome(_0x43f59e),_0x18e477=a0_0xe64fd4['resolve'](_0x1a552f);try{const _0x1b0d41=await a0_0xb48a10[_0x14ae7f(0x8e)](_0x18e477);return normalizePath(_0x1b0d41);}catch(_0x27a6ef){return normalizePath(_0x18e477);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x4592e9(0xc1)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x4592e9(0x19f)](workspaceDir),logMcpStderr(a0_0x4592e9(0x16a)+workspaceDir+a0_0x4592e9(0x167)));}catch(a0_0x34b92c){logMcpStderr(a0_0x4592e9(0xfd)+a0_0x34b92c);}async function detectWorkspaceRoot(_0xdd5804){const _0x3e4a44=a0_0x4592e9;let _0x114810=a0_0xe64fd4[_0x3e4a44(0x133)](_0xdd5804);const _0x3ad93c=[_0x3e4a44(0x150),'.vscode',_0x3e4a44(0xd9),_0x3e4a44(0x178),_0x3e4a44(0x180),'go.mod',_0x3e4a44(0x186),_0x3e4a44(0xd5),'composer.json'];while(_0x114810!==a0_0xe64fd4[_0x3e4a44(0x152)](_0x114810)){for(const _0x44f5bd of _0x3ad93c){const _0x5d108c=a0_0xe64fd4[_0x3e4a44(0xd4)](_0x114810,_0x44f5bd);try{return await a0_0xb48a10['access'](_0x5d108c),normalizePath(_0x114810);}catch{}}_0x114810=a0_0xe64fd4[_0x3e4a44(0x152)](_0x114810);}return normalizePath(_0xdd5804);}await Promise[a0_0x4592e9(0x141)](args['map'](async _0xf8c14=>{const _0x5de62e=a0_0x4592e9;try{const _0x251d0e=await a0_0xb48a10['stat'](expandHome(_0xf8c14));!_0x251d0e[_0x5de62e(0x164)]()&&(logMcpStderr(_0x5de62e(0xd1)+_0xf8c14+_0x5de62e(0x131)),process['exit'](0x1));}catch(_0x1050fe){logMcpStderr(_0x5de62e(0xac)+_0xf8c14+':',_0x1050fe),process[_0x5de62e(0x196)](0x1);}}));async function validatePath(_0x454598){const _0xe89a7e=a0_0x4592e9,_0x3eb7ff=expandHome(_0x454598),_0x24b11a=a0_0xe64fd4['resolve'](_0x3eb7ff);logger['debug'](_0xe89a7e(0xff),_0xe89a7e(0x9e),{'raw_path':_0x454598,'absolute':_0x24b11a});try{const _0x25ba00=await a0_0xb48a10[_0xe89a7e(0x8e)](_0x24b11a);return logger[_0xe89a7e(0x79)]('MCP','path_validation_resolved',{'resolved':_0x25ba00,'symlink':_0x25ba00!==_0x24b11a}),_0x25ba00;}catch(_0x594bdd){if(_0x594bdd[_0xe89a7e(0x113)]===_0xe89a7e(0xcc)){const _0x368524=a0_0xe64fd4['dirname'](_0x24b11a);try{const _0xb4775a=await a0_0xb48a10[_0xe89a7e(0x8e)](_0x368524),_0x21be79=a0_0xe64fd4[_0xe89a7e(0xd4)](_0xb4775a,a0_0xe64fd4['basename'](_0x24b11a));return logger['debug'](_0xe89a7e(0xff),'path_validation_resolved',{'resolved':_0x21be79,'new_file':!![]}),_0x21be79;}catch{logger[_0xe89a7e(0xd3)](_0xe89a7e(0xff),_0xe89a7e(0x74),{'raw_path':_0x454598,'error':_0xe89a7e(0x175)+_0x368524});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x368524);}}logger['error']('MCP',_0xe89a7e(0x74),{'raw_path':_0x454598,'error':_0x594bdd['message']});throw _0x594bdd;}}const MorphEditFileArgsSchema=z[a0_0x4592e9(0x103)]({'path':z[a0_0x4592e9(0x135)](),'code_edit':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0x8b)),'instruction':z[a0_0x4592e9(0x135)]()['describe'](a0_0x4592e9(0x190)),'dryRun':z[a0_0x4592e9(0xfa)]()[a0_0x4592e9(0xed)](![])[a0_0x4592e9(0x14c)](a0_0x4592e9(0x12b))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x4592e9(0x166),WarpGrepArgsSchema=z[a0_0x4592e9(0x103)]({'search_string':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0x14c)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0xdb)),'search_type':z[a0_0x4592e9(0x18f)]([a0_0x4592e9(0xed),'node_modules'])[a0_0x4592e9(0xeb)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0x14f))}),WarpGrepGitHubArgsSchema=z[a0_0x4592e9(0x103)]({'search_string':z['string']()[a0_0x4592e9(0x14c)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0xeb)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0x188)),'owner_repo':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0xeb)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0x98)),'branch':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0xeb)]()['describe'](a0_0x4592e9(0x13d))}),CodebaseSearchArgsSchema=z[a0_0x4592e9(0x103)]({'query':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0x14c)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0x138)),'branch':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0xeb)]()[a0_0x4592e9(0x14c)](a0_0x4592e9(0xae)),'commitHash':z[a0_0x4592e9(0x135)]()[a0_0x4592e9(0xeb)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x4592e9(0x1a4)](z[a0_0x4592e9(0x135)]())[a0_0x4592e9(0xed)]([])[a0_0x4592e9(0x14c)](a0_0x4592e9(0x9c)),'limit':z['number']()['optional']()[a0_0x4592e9(0xed)](0xa)[a0_0x4592e9(0x14c)](a0_0x4592e9(0xcf))}),server=new Server({'name':a0_0x4592e9(0x187),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x4592e9(0x121)](ListToolsRequestSchema,async()=>{const _0x51daf8=a0_0x4592e9,_0x16dba7=[{'name':TOOL_NAMES[_0x51daf8(0x14b)],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a'+_0x51daf8(0x108)+_0x51daf8(0x1a2)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+'-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a'+_0x51daf8(0x142)+_0x51daf8(0x123)+_0x51daf8(0x82)+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x51daf8(0x12d)+_0x51daf8(0x118)+_0x51daf8(0xd2)+_0x51daf8(0xfc)+_0x51daf8(0x9a)+_0x51daf8(0x13c)+_0x51daf8(0x88)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x51daf8(0xb6)+_0x51daf8(0x197)+_0x51daf8(0xb9)+_0x51daf8(0x163)+_0x51daf8(0x9b),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x51daf8(0x199)],'description':_0x51daf8(0x19e)+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'+_0x51daf8(0x91)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3c0ae6=_0x16dba7['filter'](_0x249934=>{const _0x20847=_0x51daf8;if(DISABLED_TOOLS['has'](_0x249934[_0x20847(0xaa)]))return console['error'](_0x20847(0x13e)+_0x249934[_0x20847(0xaa)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if('requiresApiKey'in _0x249934&&_0x249934[_0x20847(0x90)]&&!MORPH_API_KEY)return logMcpStderr(_0x20847(0xc6)+_0x249934[_0x20847(0xaa)]+_0x20847(0x17c)),![];return!![];});return{'tools':_0x3c0ae6[_0x51daf8(0xfe)](_0x295d2d=>({'name':_0x295d2d[_0x51daf8(0xaa)],'description':_0x295d2d['description'],'inputSchema':_0x295d2d[_0x51daf8(0xb4)]}))};}),server[a0_0x4592e9(0x121)](CallToolRequestSchema,async _0x2b29de=>{const _0x2e9d5d=a0_0x4592e9,{name:_0x9e8515,arguments:_0x5998fc}=_0x2b29de[_0x2e9d5d(0x7c)],_0xfa9457=Date[_0x2e9d5d(0x19b)]();logger['debug'](_0x2e9d5d(0xff),_0x2e9d5d(0x15e),{'tool':_0x9e8515,'args':_0x9e8515==='edit_file'?{'path':_0x5998fc?.[_0x2e9d5d(0x146)],'instruction':_0x5998fc?.[_0x2e9d5d(0x12a)]||_0x5998fc?.[_0x2e9d5d(0x143)],'dryRun':_0x5998fc?.['dryRun']}:_0x5998fc});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x2e9d5d(0x169),'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[_0x2e9d5d(0x19a)](_0x2e9d5d(0x13f))&&!MORPH_API_KEY[_0x2e9d5d(0x19a)]('morph-'))return{'content':[{'type':'text','text':_0x2e9d5d(0x134)}],'isError':!![]};if(DISABLED_TOOLS[_0x2e9d5d(0x18d)](_0x9e8515))return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0xca)+_0x9e8515+_0x2e9d5d(0x193)}],'isError':![]};switch(_0x9e8515){case TOOL_NAMES[_0x2e9d5d(0x14b)]:{let _0x473179=_0x5998fc;_0x473179&&typeof _0x473179===_0x2e9d5d(0x103)&&(_0x2e9d5d(0x128)in _0x473179&&!(_0x2e9d5d(0x146)in _0x473179)&&(_0x473179={..._0x473179,'path':_0x473179[_0x2e9d5d(0x128)],'target_file':undefined}),_0x2e9d5d(0x143)in _0x473179&&!(_0x2e9d5d(0x12a)in _0x473179)&&(_0x473179={..._0x473179,'instruction':_0x473179[_0x2e9d5d(0x143)],'instructions':undefined}),_0x2e9d5d(0x113)in _0x473179&&!(_0x2e9d5d(0xe0)in _0x473179)&&(_0x473179={..._0x473179,'code_edit':_0x473179[_0x2e9d5d(0x113)],'code':undefined}));const _0x21579a=MorphEditFileArgsSchema[_0x2e9d5d(0x15c)](_0x473179);if(!_0x21579a[_0x2e9d5d(0x158)])throw new Error(_0x2e9d5d(0xbd)+_0x21579a[_0x2e9d5d(0xd3)]);const _0x38ea19=await validatePath(_0x21579a[_0x2e9d5d(0x115)]['path']);let _0x4a67e4=null,_0x3faaeb=!![],_0x1598f9=null;try{_0x4a67e4=await a0_0xb48a10[_0x2e9d5d(0xc3)](_0x38ea19,_0x2e9d5d(0xc0)),logger['debug']('MCP',_0x2e9d5d(0xa1),{'path':_0x38ea19,'size_bytes':_0x4a67e4[_0x2e9d5d(0xc1)]});}catch(_0x701ea9){const _0x5d4bcd=_0x701ea9['code'];_0x5d4bcd===_0x2e9d5d(0xcc)?(_0x3faaeb=![],_0x4a67e4='',logger['debug'](_0x2e9d5d(0xff),_0x2e9d5d(0xa1),{'path':_0x38ea19,'exists':![]})):(_0x1598f9=_0x2e9d5d(0xf5)+(_0x5d4bcd||_0x2e9d5d(0x156))+_0x2e9d5d(0x139)+(_0x701ea9 instanceof Error?_0x701ea9['message']:String(_0x701ea9)),logger['error'](_0x2e9d5d(0xff),_0x2e9d5d(0x8c),{'path':_0x38ea19,'error':_0x1598f9}),logMcpStderr(_0x2e9d5d(0xc6)+_0x1598f9));}let _0x5dee11;try{const _0x553fc4=MORPH_API_KEY;if(!_0x553fc4)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x45d0f5=a0_0xe64fd4[_0x2e9d5d(0x152)](_0x38ea19),_0x2af774=a0_0xe64fd4[_0x2e9d5d(0xc8)](_0x38ea19);logger[_0x2e9d5d(0x79)](_0x2e9d5d(0xff),_0x2e9d5d(0x17a),{'model':_0x2e9d5d(0x73),'path':_0x21579a[_0x2e9d5d(0x115)]['path'],'instruction_len':_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0x12a)][_0x2e9d5d(0xc1)],'code_edit_len':_0x21579a['data'][_0x2e9d5d(0xe0)]['length'],'original_code_len':_0x4a67e4?.['length']??0x0,'dry_run':_0x21579a['data'][_0x2e9d5d(0xc4)]});const _0x2ca5e6=Date[_0x2e9d5d(0x19b)](),_0x5aeb1a=await executeEditFile({'target_filepath':_0x2af774,'code_edit':_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0xe0)],'instruction':_0x21579a['data'][_0x2e9d5d(0x12a)]},{'morphApiKey':_0x553fc4,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x45d0f5,'autoWrite':!_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0xc4)],'generateUdiff':![],'debug':![]}),_0x32a4ca=Date[_0x2e9d5d(0x19b)]()-_0x2ca5e6;_0x5dee11=_0x5aeb1a['completionId'];if(!_0x5aeb1a[_0x2e9d5d(0x158)])throw new Error(_0x5aeb1a[_0x2e9d5d(0xd3)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x4da240=_0x5aeb1a[_0x2e9d5d(0x7e)],_0x559269=_0x2e9d5d(0x185)+_0x4da240['linesAdded']+_0x2e9d5d(0x184)+_0x4da240[_0x2e9d5d(0x191)]+',\x20modified\x20'+_0x4da240['linesModified'];logger[_0x2e9d5d(0x79)](_0x2e9d5d(0xff),'tool_call_complete',{'tool':_0x2e9d5d(0x14a),'success':!![],'latency_ms':Date[_0x2e9d5d(0x19b)]()-_0xfa9457,'edit_latency_ms':_0x32a4ca,'changes':{'added':_0x4da240[_0x2e9d5d(0xa4)],'removed':_0x4da240['linesRemoved'],'modified':_0x4da240[_0x2e9d5d(0x1a0)]},'completion_id':_0x5dee11});if(_0x21579a['data'][_0x2e9d5d(0xc4)])return{'content':[{'type':'text','text':_0x2e9d5d(0x129)+(_0x3faaeb?'':_0x2e9d5d(0x7f))+':\x20'+_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0x12a)]+_0x2e9d5d(0xbe)+_0x559269+_0x2e9d5d(0x84)+_0x21579a[_0x2e9d5d(0x115)]['path']+'.'}]};return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0x14e)+(_0x3faaeb?_0x2e9d5d(0xef):_0x2e9d5d(0xf3))+':\x20'+_0x21579a['data'][_0x2e9d5d(0x12a)]+_0x2e9d5d(0xbe)+_0x559269+_0x2e9d5d(0x84)+_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0x146)]+'.'}]};}catch(_0x350d98){const _0x359fdf=handleMorphAPIError(_0x350d98);if(_0x359fdf)return logger[_0x2e9d5d(0xd3)](_0x2e9d5d(0xff),_0x2e9d5d(0x89),{'tool':'edit_file','error':_0x2e9d5d(0x1a3),'latency_ms':Date[_0x2e9d5d(0x19b)]()-_0xfa9457}),_0x359fdf;const _0x2da0c7=_0x350d98 instanceof Error?_0x350d98['message']:String(_0x350d98);return logger[_0x2e9d5d(0xd3)](_0x2e9d5d(0xff),_0x2e9d5d(0x89),{'tool':_0x2e9d5d(0x14a),'error':_0x2da0c7,'path':_0x21579a['data'][_0x2e9d5d(0x146)],'validated_path':_0x38ea19,'latency_ms':Date[_0x2e9d5d(0x19b)]()-_0xfa9457,'stack':_0x350d98 instanceof Error?_0x350d98[_0x2e9d5d(0x15a)]:undefined}),reportMorphError({'error_message':_0x2da0c7,'error_type':_0x350d98 instanceof Error?_0x350d98['constructor']['name']:_0x2e9d5d(0xf7),'context':{'tool':_0x2e9d5d(0x14a),'completion_id':_0x5dee11,'file_path':_0x21579a[_0x2e9d5d(0x115)]['path'],'validated_path':_0x38ea19,'instruction':_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0x12a)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x2e9d5d(0x73),'dry_run':_0x21579a['data'][_0x2e9d5d(0xc4)],'file_exists':_0x3faaeb,'file_read_error':_0x1598f9,'file_readable':_0x4a67e4!==null,'request_content':{'path':_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0x146)],'code_edit':_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0xe0)],'instruction':_0x21579a[_0x2e9d5d(0x115)]['instruction'],'original_code':_0x4a67e4!==null?_0x4a67e4['length']>0xc350?_0x4a67e4['substring'](0x0,0xc350)+_0x2e9d5d(0xf2)+_0x4a67e4[_0x2e9d5d(0xc1)]+_0x2e9d5d(0x77):_0x4a67e4:'[could\x20not\x20read\x20file:\x20'+(_0x1598f9||'unknown\x20error')+']','original_code_length':_0x4a67e4?.[_0x2e9d5d(0xc1)]??0x0,'model':MORPH_LARGE_APPLY?_0x2e9d5d(0x8a):_0x2e9d5d(0x73),'dry_run':_0x21579a[_0x2e9d5d(0x115)][_0x2e9d5d(0xc4)]}},'stack_trace':_0x350d98 instanceof Error?_0x350d98[_0x2e9d5d(0x15a)]:undefined,'source':_0x2e9d5d(0xc2)})[_0x2e9d5d(0xc9)](()=>{}),{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0x161)+_0x2da0c7}],'isError':!![]};}}case TOOL_NAMES[_0x2e9d5d(0x199)]:{const _0x3970da=WarpGrepArgsSchema[_0x2e9d5d(0x15c)](_0x5998fc);if(!_0x3970da[_0x2e9d5d(0x158)])return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0xc5)+_0x3970da[_0x2e9d5d(0xd3)]}],'isError':!![]};const _0x370c44=_0x46cc63=>{const _0x2e3896=_0x2e9d5d,_0x400199=[];for(const _0x91eaef of _0x46cc63||[]){if(_0x91eaef[_0x2e3896(0x18b)]===_0x2e3896(0x18c)&&Array[_0x2e3896(0xa7)](_0x91eaef[_0x2e3896(0x153)]))for(const _0x47dfb6 of _0x91eaef[_0x2e3896(0x153)]){try{const _0x284f4c=_0x47dfb6[_0x2e3896(0xe6)]?.[_0x2e3896(0xaa)],_0xc7ddf2=JSON[_0x2e3896(0xcb)](_0x47dfb6['function']?.[_0x2e3896(0x7b)]||'{}');if(_0x284f4c===_0x2e3896(0xe2))_0x400199[_0x2e3896(0x19f)](_0x2e3896(0x16d)+_0xc7ddf2[_0x2e3896(0xb0)]+'\x27\x20'+(_0xc7ddf2[_0x2e3896(0x146)]||'.'));else{if(_0x284f4c===_0x2e3896(0x75))_0x400199['push'](_0x2e3896(0x107)+_0xc7ddf2[_0x2e3896(0x146)]);else{if(_0x284f4c==='list_directory')_0x400199['push'](_0x2e3896(0x17b)+(_0xc7ddf2[_0x2e3896(0x17e)]||'.'));else{if(_0x284f4c===_0x2e3896(0x78))_0x400199[_0x2e3896(0x19f)]('glob\x20\x27'+_0xc7ddf2[_0x2e3896(0xb0)]+'\x27\x20'+(_0xc7ddf2['path']||'.'));else _0x284f4c===_0x2e3896(0x181)&&_0x400199['push']('finish');}}}}catch{}}}return _0x400199;},_0x32be53=_0x4c21da=>{const _0x542423=_0x2e9d5d,_0x4ed19d=[];if(!_0x4c21da||!Array[_0x542423(0xa7)](_0x4c21da))return _0x4ed19d;const _0x304cf7=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x542423(0x12c),'tool':_0x542423(0x75)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x542423(0x75)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x542423(0x8f),'tool':_0x542423(0xbf)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x542423(0x168),'tool':_0x542423(0xbf)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x542423(0xdc),'tool':_0x542423(0x75)},{'pattern':/\[SYMLINK\]/,'error_type':_0x542423(0x173),'tool':_0x542423(0x75)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x542423(0x75)},{'pattern':/symbolic link/,'error_type':_0x542423(0x173),'tool':_0x542423(0x75)},{'pattern':/Error reading file:/,'error_type':_0x542423(0x101),'tool':_0x542423(0x75)},{'pattern':/status="error"/,'error_type':_0x542423(0x96),'tool':_0x542423(0x156)}];let _0xdd88c8=0x0;for(const _0xe16ba6 of _0x4c21da){_0xe16ba6['role']===_0x542423(0x18c)&&Array['isArray'](_0xe16ba6['tool_calls'])&&_0xdd88c8++;const _0x54d0b8=_0xe16ba6[_0x542423(0x87)];if((_0xe16ba6[_0x542423(0x18b)]===_0x542423(0xc7)||_0xe16ba6['role']===_0x542423(0x11f))&&_0x54d0b8&&typeof _0x54d0b8===_0x542423(0x135))for(const {pattern:_0x367b3f,error_type:_0x261595,tool:_0x42040a}of _0x304cf7){const _0x36f6e1=_0x54d0b8[_0x542423(0x10c)](new RegExp(_0x367b3f[_0x542423(0x11b)],'g'));if(_0x36f6e1)for(const _0x2b8b56 of _0x36f6e1){const _0x14dab7=_0x54d0b8['indexOf'](_0x2b8b56),_0x279d36=_0x54d0b8[_0x542423(0xbb)](_0x14dab7,Math['min'](_0x14dab7+0xc8,_0x54d0b8[_0x542423(0xc1)]));_0x4ed19d[_0x542423(0x19f)]({'tool':_0x42040a,'error_type':_0x261595,'error_message':_0x279d36[_0x542423(0x16e)]('\x0a')[0x0],'turn':_0xdd88c8});}}}return _0x4ed19d;};try{const _0x34161c=a0_0xe64fd4[_0x2e9d5d(0x133)](_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)]),_0x4fbcfe=_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0x177)],_0x2c62a8=_0x4fbcfe==='node_modules'?{'allowNames':[_0x2e9d5d(0x10d)]}:undefined,_0x1fbb17=new LocalRipgrepProvider(_0x34161c,undefined,_0x2c62a8);logger[_0x2e9d5d(0x79)]('MCP',_0x2e9d5d(0x12f),{'type':_0x2e9d5d(0xf6),'repo_root':_0x34161c,'search_type':_0x4fbcfe||_0x2e9d5d(0xed)}),logger['debug'](_0x2e9d5d(0xff),_0x2e9d5d(0x111),{'query':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'repo_root':_0x34161c,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0xbc9c1=Date[_0x2e9d5d(0x19b)](),_0xfbbb2=await runWarpGrep({'searchTerm':_0x3970da[_0x2e9d5d(0x115)]['search_string'],'repoRoot':_0x34161c,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1fbb17,'search_type':_0x4fbcfe}),_0x134c62=Date['now']()-_0xbc9c1,_0x43d0d4=_0xfbbb2['finish']?.[_0x2e9d5d(0x72)]?.[_0x2e9d5d(0xce)]?.[_0x2e9d5d(0xc1)]??0x0;logger['debug'](_0x2e9d5d(0xff),_0x2e9d5d(0x140),{'termination':_0xfbbb2['terminationReason'],'turns':_0xfbbb2[_0x2e9d5d(0x149)]?.[_0x2e9d5d(0x116)]??0x0,'files_found':_0x43d0d4,'latency_ms':_0x134c62});const _0xc3d9cb=_0x32be53(_0xfbbb2[_0x2e9d5d(0x100)]);_0xc3d9cb[_0x2e9d5d(0xc1)]>0x0&&reportMorphError({'error_message':_0x2e9d5d(0x71)+_0xc3d9cb[_0x2e9d5d(0xc1)]+'\x20error(s)','error_type':_0x2e9d5d(0x94),'level':_0x2e9d5d(0x11d),'tool':_0x2e9d5d(0x151),'context':{'repo_path':_0x3970da['data'][_0x2e9d5d(0xd8)],'query':_0x3970da[_0x2e9d5d(0x115)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0xfbbb2['terminationReason'],'sub_tool_errors':_0xc3d9cb,'timings':_0xfbbb2[_0x2e9d5d(0x149)],'tool_calls':_0x370c44(_0xfbbb2[_0x2e9d5d(0x100)]),'messages':_0xfbbb2['messages']?.['map'](_0xb210fa=>({'role':_0xb210fa[_0x2e9d5d(0x18b)],'content':_0xb210fa[_0x2e9d5d(0x87)],..._0xb210fa[_0x2e9d5d(0x153)]?{'tool_calls':_0xb210fa[_0x2e9d5d(0x153)][_0x2e9d5d(0xc1)]}:{},..._0xb210fa[_0x2e9d5d(0xab)]?{'tool_call_id':_0xb210fa[_0x2e9d5d(0xab)]}:{}}))},'source':_0x2e9d5d(0xc2)})[_0x2e9d5d(0xc9)](()=>{});let _0x251a2e='';if(_0xfbbb2['terminationReason']===_0x2e9d5d(0x122)&&_0xfbbb2[_0x2e9d5d(0x181)]?.[_0x2e9d5d(0x72)]?.[_0x2e9d5d(0xce)]){const _0x36dbba=_0xfbbb2['finish'][_0x2e9d5d(0x72)][_0x2e9d5d(0xce)];if(_0x36dbba['length']===0x0)return _0x251a2e=_0xfbbb2[_0x2e9d5d(0x181)][_0x2e9d5d(0x14d)]||_0x2e9d5d(0x109),{'content':[{'type':'text','text':_0x251a2e}]};const _0x2249fb=[],_0x51166b=[_0x2e9d5d(0x97)];for(const _0x25a109 of _0xfbbb2[_0x2e9d5d(0x100)]){if(_0x25a109['role']===_0x2e9d5d(0x18c)&&Array[_0x2e9d5d(0xa7)](_0x25a109[_0x2e9d5d(0x153)]))for(const _0x22f49f of _0x25a109[_0x2e9d5d(0x153)]){try{const _0x22e63d=_0x22f49f['function']?.[_0x2e9d5d(0xaa)],_0x76a51f=JSON['parse'](_0x22f49f[_0x2e9d5d(0xe6)]?.[_0x2e9d5d(0x7b)]||'{}');if(_0x22e63d===_0x2e9d5d(0xe2))_0x51166b[_0x2e9d5d(0x19f)](_0x2e9d5d(0x195)+_0x76a51f[_0x2e9d5d(0xb0)]+_0x2e9d5d(0x147)+(_0x76a51f[_0x2e9d5d(0x146)]||'.')+'`');else{if(_0x22e63d===_0x2e9d5d(0x75))_0x51166b[_0x2e9d5d(0x19f)](_0x2e9d5d(0x179)+_0x76a51f['path']+'`');else{if(_0x22e63d==='list_directory')_0x51166b[_0x2e9d5d(0x19f)](_0x2e9d5d(0x15d)+(_0x76a51f[_0x2e9d5d(0x17e)]||'.')+'`');else _0x22e63d==='glob'&&_0x51166b['push'](_0x2e9d5d(0x165)+_0x76a51f['pattern']+_0x2e9d5d(0xa6)+(_0x76a51f['path']||'.')+'`');}}}catch{}}}_0x2249fb[_0x2e9d5d(0x19f)](_0x51166b[_0x2e9d5d(0xd4)]('\x0a'));const _0x299b50=['',_0x2e9d5d(0x13a)];for(const _0x285a13 of _0x36dbba){if(_0x285a13[_0x2e9d5d(0x95)]==='*')_0x299b50[_0x2e9d5d(0x19f)]('-\x20'+_0x285a13[_0x2e9d5d(0x146)]+':*');else{if(Array[_0x2e9d5d(0xa7)](_0x285a13[_0x2e9d5d(0x95)])){const _0x41b789=_0x285a13[_0x2e9d5d(0x95)][_0x2e9d5d(0xfe)](([_0x1b6cb7,_0x2d9860])=>{if(_0x1b6cb7===_0x2d9860)return''+_0x1b6cb7;return _0x1b6cb7+'-'+_0x2d9860;});_0x299b50[_0x2e9d5d(0x19f)]('-\x20'+_0x285a13[_0x2e9d5d(0x146)]+':'+_0x41b789[_0x2e9d5d(0xd4)](','));}else _0x299b50[_0x2e9d5d(0x19f)]('-\x20'+_0x285a13[_0x2e9d5d(0x146)]+':*');}}_0x299b50['push'](''),_0x2249fb[_0x2e9d5d(0x19f)](_0x299b50[_0x2e9d5d(0xd4)]('\x0a')),_0x2249fb[_0x2e9d5d(0x19f)](_0x2e9d5d(0xea));const _0x3ef800=[],_0x4712e7=[];for(const _0x4327ca of _0x36dbba){let _0x4e68e5=a0_0xe64fd4[_0x2e9d5d(0x133)](_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)],_0x4327ca['path']),_0x16b3c0=null,_0x25e988=null;try{_0x16b3c0=await a0_0xb48a10['readFile'](_0x4e68e5,{'encoding':_0x2e9d5d(0xc0)});}catch(_0x219d84){const _0x7f8da7=fixPathRepetition(_0x4e68e5);if(_0x7f8da7)try{_0x16b3c0=await a0_0xb48a10[_0x2e9d5d(0xc3)](_0x7f8da7,{'encoding':'utf-8'}),_0x4e68e5=_0x7f8da7;}catch{_0x25e988=_0x219d84 instanceof Error?_0x219d84:new Error(String(_0x219d84));}else _0x25e988=_0x219d84 instanceof Error?_0x219d84:new Error(String(_0x219d84));}if(_0x16b3c0!==null){const _0x1c26de=_0x16b3c0['split'](/\r?\n/),_0x5671c7=[];if(_0x4327ca['lines']==='*'||!Array[_0x2e9d5d(0xa7)](_0x4327ca[_0x2e9d5d(0x95)]))for(let _0x34f7e5=0x1;_0x34f7e5<=_0x1c26de['length'];_0x34f7e5++){const _0x575a67=_0x1c26de[_0x34f7e5-0x1];_0x5671c7['push'](_0x34f7e5+'|\x20'+_0x575a67);}else for(const [_0x5e6f2f,_0x4cebf0]of _0x4327ca[_0x2e9d5d(0x95)]){_0x5671c7[_0x2e9d5d(0xc1)]>0x0&&_0x5671c7[_0x2e9d5d(0x19f)]('');for(let _0x304444=_0x5e6f2f;_0x304444<=_0x4cebf0&&_0x304444<=_0x1c26de[_0x2e9d5d(0xc1)];_0x304444++){const _0x4340b2=_0x1c26de[_0x304444-0x1];_0x5671c7[_0x2e9d5d(0x19f)](_0x304444+'|\x20'+_0x4340b2);}}_0x4712e7['push']({'path':_0x4327ca[_0x2e9d5d(0x146)],'content':_0x5671c7[_0x2e9d5d(0xd4)]('\x0a')});}else _0x3ef800[_0x2e9d5d(0x19f)]('<file\x20path=\x22'+_0x4327ca[_0x2e9d5d(0x146)]+_0x2e9d5d(0x148)+(_0x25e988?.[_0x2e9d5d(0x8d)]||_0x2e9d5d(0x80))+_0x2e9d5d(0x1a1));}try{const _0x53336a=await compactFileContexts(_0x4712e7,_0x3970da['data']['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x38c88f of _0x53336a){_0x3ef800[_0x2e9d5d(0x19f)]('<file\x20path=\x22'+_0x38c88f[_0x2e9d5d(0x146)]+_0x2e9d5d(0x7d)+_0x38c88f[_0x2e9d5d(0x87)]+_0x2e9d5d(0x1a1));}}catch(_0x123124){logger[_0x2e9d5d(0x11d)](_0x2e9d5d(0xff),'compaction_failed',{'error':_0x123124 instanceof Error?_0x123124[_0x2e9d5d(0x8d)]:String(_0x123124),'files_count':_0x4712e7['length']});for(const _0x2eab8d of _0x4712e7){_0x3ef800[_0x2e9d5d(0x19f)](_0x2e9d5d(0x157)+_0x2eab8d[_0x2e9d5d(0x146)]+'\x22>\x0a'+_0x2eab8d['content']+_0x2e9d5d(0x1a1));}}_0x2249fb[_0x2e9d5d(0x19f)](_0x3ef800[_0x2e9d5d(0xd4)]('\x0a\x0a')),_0x251a2e=_0x2249fb[_0x2e9d5d(0xd4)]('\x0a');const _0x18cb63=_0xfbbb2['errors']?.[_0x2e9d5d(0x102)](_0x4d6323=>_0x4d6323[_0x2e9d5d(0x8d)]?.[_0x2e9d5d(0x19a)](_0x2e9d5d(0xfb)))||[];if(_0x18cb63[_0x2e9d5d(0xc1)]>0x0){const _0x3de793=_0x18cb63[_0x2e9d5d(0xfe)](_0x2b333a=>_0x2b333a[_0x2e9d5d(0x8d)])['join'](';\x20');reportMorphError({'error_message':_0x3de793,'error_type':_0x2e9d5d(0x117),'context':{'tool':_0x2e9d5d(0x151),'repo_path':_0x3970da[_0x2e9d5d(0x115)]['repo_path'],'query':_0x3970da['data'][_0x2e9d5d(0x192)],'model':'morph-warp-grep-v2.1','termination_reason':_0x2e9d5d(0x145),'error_count':_0x18cb63[_0x2e9d5d(0xc1)],'is_timeout':![],'timings':_0xfbbb2['timings'],'files_attempted':_0x36dbba[_0x2e9d5d(0xfe)](_0x3e33f8=>({'path':_0x3e33f8[_0x2e9d5d(0x146)],'lines':_0x3e33f8[_0x2e9d5d(0x95)]})),'tool_calls':_0x370c44(_0xfbbb2['messages']),'messages':_0xfbbb2[_0x2e9d5d(0x100)]?.[_0x2e9d5d(0xfe)](_0x32ffd7=>({'role':_0x32ffd7[_0x2e9d5d(0x18b)],'content':_0x32ffd7[_0x2e9d5d(0x87)],..._0x32ffd7[_0x2e9d5d(0x153)]?{'tool_calls':_0x32ffd7[_0x2e9d5d(0x153)][_0x2e9d5d(0xc1)]}:{},..._0x32ffd7[_0x2e9d5d(0xab)]?{'tool_call_id':_0x32ffd7[_0x2e9d5d(0xab)]}:{}})),'request_content':{'query':_0x3970da['data'][_0x2e9d5d(0x192)],'repo_path':_0x3970da[_0x2e9d5d(0x115)]['repo_path'],'repoRoot':a0_0xe64fd4[_0x2e9d5d(0x133)](_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)]),'model':_0x2e9d5d(0x112)}},'source':_0x2e9d5d(0xc2)})['catch'](()=>{});}}else{if(_0xfbbb2[_0x2e9d5d(0xe3)]===_0x2e9d5d(0xad)&&_0xfbbb2[_0x2e9d5d(0x136)][_0x2e9d5d(0xc1)]>0x0){const _0x2cf38b=_0xfbbb2['errors'][_0x2e9d5d(0xfe)](_0x5f081b=>_0x5f081b[_0x2e9d5d(0x8d)])[_0x2e9d5d(0xd4)](';\x20');_0x251a2e=_0x2e9d5d(0xd1)+_0x2cf38b;const _0x45131b=_0x2cf38b[_0x2e9d5d(0x176)]()[_0x2e9d5d(0x13b)](_0x2e9d5d(0xf4))||_0x2cf38b[_0x2e9d5d(0x176)]()['includes'](_0x2e9d5d(0x160))||_0x2cf38b['toLowerCase']()[_0x2e9d5d(0x13b)](_0x2e9d5d(0xa3)),_0x5aad2c=_0xfbbb2[_0x2e9d5d(0x181)]?.[_0x2e9d5d(0x72)]?.[_0x2e9d5d(0xce)],_0x86674d=_0xfbbb2['errors'][0x0];reportMorphError({'error_message':_0x2cf38b,'error_type':_0x45131b?'TimeoutError':_0x86674d?.[_0x2e9d5d(0x18a)]?.['name']||_0x2e9d5d(0xbc),'context':{'tool':_0x2e9d5d(0x151),'repo_path':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)],'query':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'model':_0x2e9d5d(0x112),'termination_reason':_0xfbbb2[_0x2e9d5d(0xe3)],'error_count':_0xfbbb2['errors']['length'],'is_timeout':_0x45131b,'timings':_0xfbbb2[_0x2e9d5d(0x149)],'files_attempted':_0x5aad2c?.['map'](_0x1b668e=>({'path':_0x1b668e['path'],'lines':_0x1b668e[_0x2e9d5d(0x95)]})),'tool_calls':_0x370c44(_0xfbbb2[_0x2e9d5d(0x100)]),'messages':_0xfbbb2['messages']?.[_0x2e9d5d(0xfe)](_0xccecfe=>({'role':_0xccecfe[_0x2e9d5d(0x18b)],'content':_0xccecfe[_0x2e9d5d(0x87)],..._0xccecfe[_0x2e9d5d(0x153)]?{'tool_calls':_0xccecfe[_0x2e9d5d(0x153)]['length']}:{},..._0xccecfe[_0x2e9d5d(0xab)]?{'tool_call_id':_0xccecfe['tool_call_id']}:{}})),'request_content':{'query':_0x3970da[_0x2e9d5d(0x115)]['search_string'],'repo_path':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)],'repoRoot':a0_0xe64fd4['resolve'](_0x3970da[_0x2e9d5d(0x115)]['repo_path']),'model':_0x2e9d5d(0x112)}},'stack_trace':_0x86674d?.[_0x2e9d5d(0x15a)]||undefined,'source':_0x2e9d5d(0xc2)})[_0x2e9d5d(0xc9)](()=>{});}else _0x251a2e=_0x2e9d5d(0x194);}return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x251a2e}]};}catch(_0x1094de){const _0x153120=handleMorphAPIError(_0x1094de);if(_0x153120)return logger[_0x2e9d5d(0xd3)](_0x2e9d5d(0xff),'tool_call_error',{'tool':_0x2e9d5d(0x151),'error':_0x2e9d5d(0x1a3),'latency_ms':Date[_0x2e9d5d(0x19b)]()-_0xfa9457}),_0x153120;const _0x2f7eae=_0x1094de instanceof Error?_0x1094de['message']:String(_0x1094de);logger[_0x2e9d5d(0xd3)](_0x2e9d5d(0xff),_0x2e9d5d(0x89),{'tool':'codebase_search','error':_0x2f7eae,'repo_path':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)],'query':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'latency_ms':Date[_0x2e9d5d(0x19b)]()-_0xfa9457});const _0x3736e7=_0x2f7eae[_0x2e9d5d(0x176)]()[_0x2e9d5d(0x13b)]('timeout')||_0x2f7eae[_0x2e9d5d(0x176)]()[_0x2e9d5d(0x13b)]('timed\x20out')||_0x2f7eae[_0x2e9d5d(0x176)]()[_0x2e9d5d(0x13b)]('etimedout')||_0x1094de instanceof Error&&_0x1094de[_0x2e9d5d(0xaa)]===_0x2e9d5d(0xb1);return reportMorphError({'error_message':_0x2f7eae,'error_type':_0x3736e7?_0x2e9d5d(0xb1):_0x1094de instanceof Error?_0x1094de[_0x2e9d5d(0x18a)][_0x2e9d5d(0xaa)]:_0x2e9d5d(0xf7),'context':{'tool':_0x2e9d5d(0x151),'repo_path':_0x3970da['data'][_0x2e9d5d(0xd8)],'query':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'model':'morph-warp-grep-v2.1','is_timeout':_0x3736e7,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'repo_path':_0x3970da['data'][_0x2e9d5d(0xd8)],'repoRoot':a0_0xe64fd4[_0x2e9d5d(0x133)](_0x3970da[_0x2e9d5d(0x115)][_0x2e9d5d(0xd8)]),'model':_0x2e9d5d(0x112)}},'stack_trace':_0x1094de instanceof Error?_0x1094de[_0x2e9d5d(0x15a)]:undefined,'source':_0x2e9d5d(0xc2)})['catch'](()=>{}),{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0x159)+_0x2f7eae}],'isError':![]};}}case TOOL_NAMES[_0x2e9d5d(0xee)]:{const _0x4f3ab1=WarpGrepGitHubArgsSchema[_0x2e9d5d(0x15c)](_0x5998fc);if(!_0x4f3ab1['success'])return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0xc5)+_0x4f3ab1['error']}],'isError':!![]};const _0x1d84d9=_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x155)]||_0x4f3ab1['data']['owner_repo'];if(!_0x1d84d9)return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0x10e)}],'isError':!![]};const _0x3e91be=MORPH_API_KEY;if(!_0x3e91be)throw new Error(_0x2e9d5d(0xe4));const _0x3d0e89=Date['now']();logger[_0x2e9d5d(0x79)](_0x2e9d5d(0xff),_0x2e9d5d(0xec),{'identifier':_0x1d84d9,'query':_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'branch':_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x16c)]});try{const _0x17b766=new WarpGrepClient({'morphApiKey':_0x3e91be,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x357437=await _0x17b766[_0x2e9d5d(0xb8)]({'searchTerm':_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'github':_0x1d84d9,'branch':_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x16c)]}),_0x1eabc7=Date[_0x2e9d5d(0x19b)]()-_0x3d0e89;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x1eabc7+'ms.\x20Success:\x20'+_0x357437[_0x2e9d5d(0x158)]);const _0x3bbc58=formatResult(_0x357437);return{'content':[{'type':_0x2e9d5d(0x169),'text':_0x3bbc58}]};}catch(_0x2a18d1){const _0xcfe532=handleMorphAPIError(_0x2a18d1);if(_0xcfe532)return _0xcfe532;const _0x50c8ba=Date['now']()-_0x3d0e89,_0x4bfbf=_0x2a18d1 instanceof Error?_0x2a18d1['message']:String(_0x2a18d1);return logMcpStderr(_0x2e9d5d(0x144)+_0x50c8ba+_0x2e9d5d(0xb3),_0x4bfbf),reportMorphError({'error_message':_0x4bfbf,'error_type':_0x2a18d1 instanceof Error?_0x2a18d1['constructor'][_0x2e9d5d(0xaa)]:'UnknownError','context':{'tool':_0x2e9d5d(0x81),'github_url':_0x1d84d9,'search_string':_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x192)],'branch':_0x4f3ab1[_0x2e9d5d(0x115)][_0x2e9d5d(0x16c)]},'stack_trace':_0x2a18d1 instanceof Error?_0x2a18d1[_0x2e9d5d(0x15a)]:undefined,'source':_0x2e9d5d(0xc2),'tool':'github_codebase_search','latency_ms':_0x50c8ba})['catch'](()=>{}),{'content':[{'type':'text','text':_0x2e9d5d(0xa2)+_0x4bfbf}],'isError':![]};}}default:throw new Error(_0x2e9d5d(0xda)+_0x9e8515);}}catch(_0x58a80d){const _0x429036=_0x58a80d instanceof Error?_0x58a80d['message']:String(_0x58a80d);return reportMorphError({'error_message':_0x429036,'error_type':_0x58a80d instanceof Error?_0x58a80d[_0x2e9d5d(0x18a)][_0x2e9d5d(0xaa)]:_0x2e9d5d(0xf7),'context':{'tool':_0x9e8515,'arguments':_0x5998fc?JSON[_0x2e9d5d(0xde)](_0x5998fc)['substring'](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x58a80d instanceof Error?_0x58a80d[_0x2e9d5d(0x15a)]:undefined,'source':_0x2e9d5d(0xc2)})[_0x2e9d5d(0xc9)](()=>{}),{'content':[{'type':_0x2e9d5d(0x169),'text':_0x2e9d5d(0xd1)+_0x429036}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x33b8d0){const _0x52af14=a0_0x4592e9,_0x2a9325=await getValidRootDirectories(_0x33b8d0);if(_0x2a9325[_0x52af14(0xc1)]>0x0)allowedDirectories=[..._0x2a9325],logMcpStderr(_0x52af14(0x16f)+_0x2a9325[_0x52af14(0xc1)]+_0x52af14(0xdd));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x1f33e2=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1f33e2&&(allowedDirectories=[_0x1f33e2],logMcpStderr(_0x52af14(0x93)+_0x1f33e2));}catch(_0x445765){logMcpStderr(_0x52af14(0x198)+_0x445765);}}}server[a0_0x4592e9(0xaf)](RootsListChangedNotificationSchema,async()=>{const _0x24bd49=a0_0x4592e9;try{const _0x3b42ba=await server[_0x24bd49(0xf1)]();_0x3b42ba&&'roots'in _0x3b42ba&&await updateAllowedDirectoriesFromRoots(_0x3b42ba[_0x24bd49(0x11a)]);}catch(_0x574574){logMcpStderr(_0x24bd49(0x125),_0x574574 instanceof Error?_0x574574[_0x24bd49(0x8d)]:String(_0x574574));}}),server[a0_0x4592e9(0x85)]=async()=>{const _0x5f4395=a0_0x4592e9,_0x16393c=server['getClientCapabilities']();if(_0x16393c?.[_0x5f4395(0x11a)])try{const _0x3c9995=await server[_0x5f4395(0xf1)]();_0x3c9995&&_0x5f4395(0x11a)in _0x3c9995?await updateAllowedDirectoriesFromRoots(_0x3c9995['roots']):logMcpStderr(_0x5f4395(0xb5));}catch(_0x314ef9){logMcpStderr(_0x5f4395(0x106),_0x314ef9 instanceof Error?_0x314ef9[_0x5f4395(0x8d)]:String(_0x314ef9));}else{if(allowedDirectories[_0x5f4395(0xc1)]>0x0)logMcpStderr(_0x5f4395(0xcd),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5f4395(0xd0));else throw new Error(_0x5f4395(0x83));}}};function a0_0x3bb1(){const _0x4f0665=['MORPH_API_KEY','timed\x20out','❌\x20Morph\x20Edit\x20Failed:\x20','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','isDirectory','-\x20Glob\x20search\x20`','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.','\x20as\x20allowed\x20directory','RipgrepNotAvailable','text','Workspace\x20mode\x20enabled:\x20Using\x20','2422688MHjtfN','branch','grep\x20\x27','split','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','homedir','WORKSPACE_ROOT','toISOString','SymlinkError','size','Parent\x20directory\x20does\x20not\x20exist:\x20','toLowerCase','search_type','Cargo.toml','-\x20Read\x20file\x20`','api_request_start','list_directory\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','ENABLE_WORKSPACE_MODE','command','\x0aOptions:','pyproject.toml','finish','trim','env',',\x20removed\x20','added\x20','.cursor','morph-mcp','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.','954419aWIrOD','constructor','role','assistant','has','floor','enum','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','linesRemoved','search_string','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','-\x20Grepped\x20\x27','exit','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Warning:\x20Workspace\x20fallback\x20failed:\x20','CODEBASE_SEARCH','startsWith','now','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','PWD','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','push','linesModified','\x0a</file>','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','API\x20error\x20(auth/rate-limit)','array','some','WarpGrep\x20sub-tool\x20errors:\x20','metadata','morph-v3-fast','path_validation_failed','read','morph-','\x20chars)','glob','debug','version','arguments','params','\x22>\x0a','changes','\x20(new\x20file)','Unknown\x20error','github_codebase_search','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\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.','.\x20Path:\x20','oninitialized','Fatal\x20error\x20running\x20server:','content','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','tool_call_error','morph-v3-large','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','file_read_failed','message','realpath','RipgrepError','requiresApiKey','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','slice','Fallback:\x20Using\x20workspace\x20root\x20','SubToolError','lines','ToolException','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x22.\x20Known\x20tools:\x20','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','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','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','https://morphllm.com/api/error-report','path_validation_start','@morphllm/morphmcp\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','file_read_complete','GitHub\x20search\x20failed:\x20','etimedout','linesAdded','every','`\x20in\x20`','isArray','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.','MORPH_WARP_GREP_TIMEOUT','name','tool_call_id','Error\x20accessing\x20directory\x20','terminated','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','setNotificationHandler','pattern','TimeoutError','--api-key=','ms:','inputSchema','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','context','searchGitHub','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','substring','WarpGrepError','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','.\x20Changes:\x20','grep','utf-8','length','mcp-filesystem','readFile','dryRun','Invalid\x20arguments:\x20','Warning:\x20','tool','basename','catch','Tool\x20\x22','parse','ENOENT','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','files','Max\x20results\x20to\x20return','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Error:\x20','For\x20deletions:\x0a','error','join','tsconfig.json','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','repo_path','package.json','Unknown\x20tool:\x20','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','BinaryFile','\x20valid\x20directories','stringify','2263926osvboG','code_edit','Disabled\x20tools:\x20','grep_search','terminationReason','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','MORPH_LARGE_APPLY','function','sep','37773YFUOWH','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Here\x20is\x20the\x20content\x20of\x20files:\x0a','optional','github_search_start','default','GITHUB_CODEBASE_SEARCH','Applied','--api-key','listRoots','\x0a...\x20(truncated,\x20total:\x20','Created\x20File','timeout','Failed\x20to\x20read\x20file:\x20','LocalRipgrepProvider','UnknownError','389992ayQvKu','status','boolean','File\x20read\x20error:','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','map','MCP','messages','ReadError','filter','object','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','DISABLED_TOOLS','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','read\x20','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','connect','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','match','node_modules','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Bearer\x20','argv','warp_grep_start','morph-warp-grep-v2.1','code','api-key','data','turns','FileReadError','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','roots','source','--help','warn','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','user','108zPCjZz','setRequestHandler','completed','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Failed\x20to\x20request\x20roots\x20from\x20client:','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','8225623ddzzSR','target_file','Morph\x20Edit\x20Preview','instruction','Preview\x20changes\x20without\x20applying\x20them.','FileNotFound','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','post','provider_created','--version','\x20is\x20not\x20a\x20directory','response','resolve','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.','string','errors','../package.json','Repository\x20identifier','\x20-\x20','Relevant\x20context\x20found:','includes','Rules:\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Tool\x20','sk-','warp_grep_complete','all','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','instructions','[github_codebase_search]\x20Failed\x20in\x20','completed_with_file_errors','path','\x27\x20in\x20`','\x22>\x0aError\x20reading\x20file:\x20','timings','edit_file','EDIT_FILE','describe','payload','Morph\x20Edit\x20','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','.git','codebase_search','dirname','tool_calls','1671900tAiZwb','github_url','unknown','<file\x20path=\x22','success','Error\x20running\x20fast\x20context\x20search:\x20','stack','log','safeParse','-\x20Listed\x20directory\x20`','tool_call_received'];a0_0x3bb1=function(){return _0x4f0665;};return a0_0x3bb1();}async function runServer(){const _0x5ce72e=a0_0x4592e9,_0x507217=new StdioServerTransport();await server[_0x5ce72e(0x10a)](_0x507217),logMcpStderr(_0x5ce72e(0xd7)),allowedDirectories['length']===0x0&&logMcpStderr(_0x5ce72e(0x126));}runServer()[a0_0x4592e9(0xc9)](_0x20cd4e=>{const _0xd49a7f=a0_0x4592e9;logMcpStderr(_0xd49a7f(0x86),_0x20cd4e),process['exit'](0x1);});
const a0_0x28086a=a0_0x9f0d;(function(_0x2ab0d4,_0x491bea){const _0xbadadd=a0_0x9f0d,_0x5a4802=_0x2ab0d4();while(!![]){try{const _0x1afbaf=parseInt(_0xbadadd(0x127))/0x1+-parseInt(_0xbadadd(0x132))/0x2*(-parseInt(_0xbadadd(0xc8))/0x3)+-parseInt(_0xbadadd(0x1a3))/0x4*(parseInt(_0xbadadd(0x1a5))/0x5)+-parseInt(_0xbadadd(0x126))/0x6*(-parseInt(_0xbadadd(0x111))/0x7)+parseInt(_0xbadadd(0xf1))/0x8*(parseInt(_0xbadadd(0x1a1))/0x9)+parseInt(_0xbadadd(0x84))/0xa+-parseInt(_0xbadadd(0x134))/0xb;if(_0x1afbaf===_0x491bea)break;else _0x5a4802['push'](_0x5a4802['shift']());}catch(_0x4040c9){_0x5a4802['push'](_0x5a4802['shift']());}}}(a0_0x3353,0x241af));function a0_0x9f0d(_0x2b2d1a,_0x325cea){_0x2b2d1a=_0x2b2d1a-0x7a;const _0x335316=a0_0x3353();let _0x9f0d9f=_0x335316[_0x2b2d1a];return _0x9f0d9f;}import{Server}from'@modelcontextprotocol/sdk/server/index.js';function a0_0x3353(){const _0x5bf076=['string','linesModified','\x20is\x20not\x20a\x20directory','files','resolve','filter','terminationReason','optional','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','indexOf','match','pyproject.toml','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','File\x20read\x20error:','application/json','sk-','list_directory\x20','273fJhEuM','array','branch','false','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','tool_call_received','grep','MORPH_API_URL','.\x20Changes:\x20','morph-mcp','.\x20Path:\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','warn','\x20as\x20allowed\x20directory','REQUIRED\x20parameters:\x20`path`\x20(absolute\x20file\x20path),\x20`code_edit`\x20(the\x20new\x20code\x20with\x20placeholders\x20for\x20unchanged\x20sections),\x20`instruction`\x20(brief\x20description\x20of\x20the\x20change).\x20Do\x20NOT\x20use\x20`target_file`,\x20`filePath`,\x20`code`,\x20or\x20`instructions`\x20—\x20use\x20the\x20exact\x20names\x20listed\x20here.\x0a\x0a','linesRemoved','version','has','added\x20','LocalRipgrepProvider','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','11694gwnpRD','146040gdbVus','sep','ENOENT','assistant','morph-warp-grep-v2.1','parse','Repository\x20identifier','WarpGrep\x20sub-tool\x20errors:\x20','Max\x20results\x20to\x20return','isDirectory','Tool\x20\x22','358178lvORtC','Error\x20accessing\x20directory\x20','5449763hUWRVP','\x22>\x0aError\x20reading\x20file:\x20','role','length','github_url','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','instructions','some','basename','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','path_validation_resolved','terminated','timed\x20out','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','slice','search_string','function','api_request_start','instruction','PWD','floor','EDIT_FILE','MCP','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Unknown\x20tool:\x20','constructor','https://morphllm.com/api/error-report','DISABLED_TOOLS','For\x20deletions:\x0a','tool_calls','search_type','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','grep_search','setRequestHandler','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','payload','messages','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','[github_codebase_search]\x20Done\x20in\x20','success','all','API\x20error\x20(auth/rate-limit)','--help','FileNotFound','repo_path','Bearer\x20','size','debug','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','log','morph-v3-large','completed_with_file_errors','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','completionId','\x20valid\x20directories','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','\x20error(s)','Specific\x20commit\x20hash\x20to\x20search','target_file','Here\x20is\x20the\x20content\x20of\x20files:\x0a','TimeoutError','FileReadError','enum','trim','-\x20Read\x20file\x20`','searchGitHub','ENABLE_WORKSPACE_MODE','github_codebase_search','warp_grep_start','--version','dryRun','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','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','\x0aExamples:','lines','data','\x20\x20morph-mcp','default','now','glob\x20\x27','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','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.','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','connect','Rules:\x0a','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','edit_file','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','toISOString','access','status','target_filepath','RipgrepError','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','mcp-filesystem','command','\x22>\x0a','getClientCapabilities','\x20-\x20','safeParse','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','every','api-key','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','.vscode','errors','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','505341WPZIEi','ms.\x20Success:\x20','114872LQYrdf','file_path','30kudCxO','inputSchema','SubToolError','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.','GITHUB_CODEBASE_SEARCH','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','Failed\x20to\x20request\x20roots\x20from\x20client:','code_edit','error','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','dirname','\x20(new\x20file)','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.','tsconfig.json','package.json','code','2460410RfjAsV','Disabled\x20tools:\x20','setNotificationHandler','describe','read','warp_grep_complete','Cargo.toml','node_modules','Created\x20File','morph-v3-fast','BinaryFile','runWarpGrep_call','.cursor','substring','linesAdded','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','codebase_search','user','split','--api-key','boolean','[github_codebase_search]\x20Failed\x20in\x20','file_read_complete','metadata','catch','ReadError','new_string','go.mod','message','response','0.2.0','-\x20Grepped\x20\x27','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Parent\x20directory\x20does\x20not\x20exist:\x20','SymlinkError','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','Invalid\x20arguments:\x20','@morphllm/morphmcp\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','object','path_validation_failed','name','content','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','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.','provider_created','<file\x20path=\x22','\x0a</file>','UnknownError','tool','roots','path_validation_start','tool_call_error','listRoots','readFile','oninitialized','owner_repo','stat','pattern','text','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','Fatal\x20error\x20running\x20server:','timeout','Unknown\x20error','CODEBASE_SEARCH','RipgrepNotAvailable','3rslPUw','\x22.\x20Known\x20tools:\x20','edit','includes','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','join','composer.json','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','filePath','Warning:\x20','requiresApiKey','Morph\x20FastApply\x20failed\x20without\x20error\x20message','unknown','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','env','context','\x27\x20in\x20`','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','ms:','startsWith','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','tool_call_id','utf-8','MORPH_WARP_GREP_TIMEOUT','path','map','exit','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','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.','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','github_search_start','Morph\x20Edit\x20','turns','realpath','ToolException','24usxjyz','isArray','Fallback:\x20Using\x20workspace\x20root\x20','timings','push','\x20chars)','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','arguments','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Error:\x20','stack','grep\x20\x27','finish','toLowerCase','morph-'];a0_0x3353=function(){return _0x5bf076;};return a0_0x3353();}import{StdioServerTransport}from'@modelcontextprotocol/sdk/server/stdio.js';import{CallToolRequestSchema,ListToolsRequestSchema,RootsListChangedNotificationSchema}from'@modelcontextprotocol/sdk/types.js';import a0_0x528ac2 from'fs/promises';import a0_0x577282 from'path';import a0_0x37efbe 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_0x2053fa from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x441172){const _0x5d13d6=a0_0x9f0d,_0x55f050=_0x441172[_0x5d13d6(0x97)](a0_0x577282[_0x5d13d6(0x128)])[_0x5d13d6(0x105)](Boolean);if(_0x55f050[_0x5d13d6(0x137)]<0x2)return null;for(let _0x58c94b=Math[_0x5d13d6(0x148)](_0x55f050['length']/0x2);_0x58c94b>=0x1;_0x58c94b--){for(let _0x5b6a27=0x0;_0x5b6a27<=_0x55f050[_0x5d13d6(0x137)]-0x2*_0x58c94b;_0x5b6a27++){const _0x2d2cf8=_0x55f050[_0x5d13d6(0x142)](_0x5b6a27,_0x5b6a27+_0x58c94b),_0x4abe52=_0x55f050[_0x5d13d6(0x142)](_0x5b6a27+_0x58c94b,_0x5b6a27+0x2*_0x58c94b);if(_0x2d2cf8[_0x5d13d6(0x19a)]((_0x38fd8b,_0x30e2f6)=>_0x38fd8b===_0x4abe52[_0x30e2f6])){const _0x5530b6=[..._0x55f050['slice'](0x0,_0x5b6a27),..._0x55f050[_0x5d13d6(0x142)](_0x5b6a27+_0x58c94b)];return a0_0x577282['sep']+_0x5530b6[_0x5d13d6(0xce)](a0_0x577282[_0x5d13d6(0x128)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xefb79a=a0_0x9f0d;try{const _0x4e376b=require('../package.json');return _0x4e376b[_0xefb79a(0x121)]??_0xefb79a(0xd5);}catch(_0x35c14c){return logMcpStderr(_0xefb79a(0x153),_0x35c14c),_0xefb79a(0xd5);}}function printHelp(){const _0x8826f1=a0_0x9f0d;console[_0x8826f1(0x165)](_0x8826f1(0xaa)+getPackageVersion()),console[_0x8826f1(0x165)](_0x8826f1(0xe8)),console[_0x8826f1(0x165)]('\x0aOptions:'),console[_0x8826f1(0x165)](_0x8826f1(0x168)),console[_0x8826f1(0x165)](_0x8826f1(0xe1)),console[_0x8826f1(0x165)]('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x8826f1(0x165)](_0x8826f1(0x17d)),console['log'](_0x8826f1(0x180)),console['log'](_0x8826f1(0x139));}const cliArgs=process['argv'][a0_0x28086a(0x142)](0x2),VERSION_FLAGS=new Set([a0_0x28086a(0x179),'-v','-V']),HELP_FLAGS=new Set([a0_0x28086a(0x15e),'-h']);cliArgs['some'](_0x2f30cd=>VERSION_FLAGS[a0_0x28086a(0x122)](_0x2f30cd))&&(console[a0_0x28086a(0x165)](a0_0x28086a(0xaa)+getPackageVersion()),process[a0_0x28086a(0xe7)](0x0));cliArgs[a0_0x28086a(0x13b)](_0x20c2ea=>HELP_FLAGS[a0_0x28086a(0x122)](_0x20c2ea))&&(printHelp(),process[a0_0x28086a(0xe7)](0x0));function getCliArg(_0x79c2b6){const _0x33f4bb=a0_0x28086a;for(let _0x31a141=0x0;_0x31a141<cliArgs[_0x33f4bb(0x137)];_0x31a141++){const _0x27ded7=cliArgs[_0x31a141];if(_0x27ded7[_0x33f4bb(0xdf)]('--'+_0x79c2b6+'='))return _0x27ded7[_0x33f4bb(0x142)](('--'+_0x79c2b6+'=')[_0x33f4bb(0x137)]);if(_0x27ded7==='--'+_0x79c2b6&&_0x31a141+0x1<cliArgs[_0x33f4bb(0x137)])return cliArgs[_0x31a141+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x28086a(0x137)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x28086a(0x122)](arg)||HELP_FLAGS[a0_0x28086a(0x122)](arg))continue;if(arg[a0_0x28086a(0xdf)]('--api-key='))continue;if(arg===a0_0x28086a(0x98)){i++;continue;}args[a0_0x28086a(0xf5)](arg);}const WORKSPACE_ROOT=process[a0_0x28086a(0xd9)]['WORKSPACE_ROOT']||process[a0_0x28086a(0xd9)][a0_0x28086a(0x147)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x28086a(0xd9)][a0_0x28086a(0x176)]!==a0_0x28086a(0x114),MORPH_API_KEY=getCliArg(a0_0x28086a(0x19b))??process[a0_0x28086a(0xd9)]['MORPH_API_KEY'],MORPH_API_URL=process['env'][a0_0x28086a(0x118)],MORPH_LARGE_APPLY=process[a0_0x28086a(0xd9)]['MORPH_LARGE_APPLY']!==a0_0x28086a(0x114),MORPH_WARP_GREP_TIMEOUT=process[a0_0x28086a(0xd9)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process['env'][a0_0x28086a(0xe4)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x28086a(0xd9)][a0_0x28086a(0x14f)]?new Set(process[a0_0x28086a(0xd9)][a0_0x28086a(0x14f)][a0_0x28086a(0x97)](',')['map'](_0x131860=>_0x131860[a0_0x28086a(0x173)]())['filter'](_0x13f4f1=>_0x13f4f1[a0_0x28086a(0x137)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x28086a(0x162)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x28086a(0x122)](tool)&&console['error'](a0_0x28086a(0x14b)+tool+a0_0x28086a(0xc9)+[...KNOWN_TOOL_NAMES][a0_0x28086a(0xce)](',\x20'));}console['error'](a0_0x28086a(0x85)+[...DISABLED_TOOLS][a0_0x28086a(0xce)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x28086a(0x10f))&&!MORPH_API_KEY[a0_0x28086a(0xdf)](a0_0x28086a(0xff))&&logMcpStderr(a0_0x28086a(0xeb));async function reportMorphError(_0x4c53ae){const _0x3f3f75=a0_0x28086a;try{await a0_0x2053fa['post'](_0x3f3f75(0x14e),{..._0x4c53ae,'timestamp':new Date()[_0x3f3f75(0x18d)](),'source':_0x4c53ae['source']||_0x3f3f75(0x193),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4c53ae[_0x3f3f75(0xda)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3f3f75(0x10e),'Authorization':_0x3f3f75(0x161)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1c3c50,_0x119224){const _0x430517=a0_0x28086a;if(_0x1c3c50&&typeof _0x1c3c50==='object'&&_0x430517(0x18f)in _0x1c3c50)return _0x1c3c50[_0x430517(0x18f)];if(_0x1c3c50&&typeof _0x1c3c50==='object'&&_0x430517(0xa2)in _0x1c3c50)return _0x1c3c50['response']?.[_0x430517(0x18f)];const _0x19f379=_0x119224[_0x430517(0x10a)](/\b(401|429)\b/);return _0x19f379?parseInt(_0x19f379[0x1],0xa):null;}function handleMorphAPIError(_0x50746d){const _0x417c09=a0_0x28086a,_0x40d0fc=_0x50746d instanceof Error?_0x50746d['message']:String(_0x50746d),_0x433f9e=extractStatusCode(_0x50746d,_0x40d0fc);switch(_0x433f9e){case 0x191:return{'content':[{'type':_0x417c09(0xc0),'text':_0x417c09(0xb1)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':_0x417c09(0x159)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x28086a(0x125)),logMcpStderr(a0_0x28086a(0x1aa)),logMcpStderr(a0_0x28086a(0x141)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x259695){return a0_0x577282['normalize'](_0x259695);}function expandHome(_0x3bd40f){const _0x5a5133=a0_0x28086a;if(_0x3bd40f[_0x5a5133(0xdf)]('~/')||_0x3bd40f==='~')return a0_0x577282[_0x5a5133(0xce)](a0_0x37efbe['homedir'](),_0x3bd40f['slice'](0x1));return _0x3bd40f;}let allowedDirectories=await Promise[a0_0x28086a(0x15c)](args[a0_0x28086a(0xe6)](async _0xc65a2d=>{const _0x22e9da=a0_0x28086a,_0x475733=expandHome(_0xc65a2d),_0x383e44=a0_0x577282[_0x22e9da(0x104)](_0x475733);try{const _0x56d30b=await a0_0x528ac2[_0x22e9da(0xef)](_0x383e44);return normalizePath(_0x56d30b);}catch(_0x25070b){return normalizePath(_0x383e44);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x28086a(0x137)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x28086a(0xf5)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x28086a(0x11e)));}catch(a0_0x5573bc){logMcpStderr(a0_0x28086a(0xe9)+a0_0x5573bc);}async function detectWorkspaceRoot(_0x34c656){const _0x5bc843=a0_0x28086a;let _0x2fe5d5=a0_0x577282['resolve'](_0x34c656);const _0xca3b20=['.git',_0x5bc843(0x19e),_0x5bc843(0x82),_0x5bc843(0x8a),_0x5bc843(0x10b),_0x5bc843(0xa0),_0x5bc843(0x90),_0x5bc843(0x81),_0x5bc843(0xcf)];while(_0x2fe5d5!==a0_0x577282[_0x5bc843(0x7e)](_0x2fe5d5)){for(const _0x57c345 of _0xca3b20){const _0xc5e7a=a0_0x577282[_0x5bc843(0xce)](_0x2fe5d5,_0x57c345);try{return await a0_0x528ac2[_0x5bc843(0x18e)](_0xc5e7a),normalizePath(_0x2fe5d5);}catch{}}_0x2fe5d5=a0_0x577282[_0x5bc843(0x7e)](_0x2fe5d5);}return normalizePath(_0x34c656);}await Promise[a0_0x28086a(0x15c)](args[a0_0x28086a(0xe6)](async _0x2644c1=>{const _0x2e745c=a0_0x28086a;try{const _0x1213af=await a0_0x528ac2[_0x2e745c(0xbe)](expandHome(_0x2644c1));!_0x1213af[_0x2e745c(0x130)]()&&(logMcpStderr(_0x2e745c(0xfa)+_0x2644c1+_0x2e745c(0x102)),process['exit'](0x1));}catch(_0x26fc17){logMcpStderr(_0x2e745c(0x133)+_0x2644c1+':',_0x26fc17),process[_0x2e745c(0xe7)](0x1);}}));async function validatePath(_0x5677cb){const _0x494f89=a0_0x28086a,_0x2477bd=expandHome(_0x5677cb),_0x320723=a0_0x577282[_0x494f89(0x104)](_0x2477bd);logger[_0x494f89(0x163)](_0x494f89(0x14a),_0x494f89(0xb8),{'raw_path':_0x5677cb,'absolute':_0x320723});try{const _0x224ddf=await a0_0x528ac2[_0x494f89(0xef)](_0x320723);return logger[_0x494f89(0x163)](_0x494f89(0x14a),'path_validation_resolved',{'resolved':_0x224ddf,'symlink':_0x224ddf!==_0x320723}),_0x224ddf;}catch(_0x403644){if(_0x403644[_0x494f89(0x83)]==='ENOENT'){const _0x5de685=a0_0x577282[_0x494f89(0x7e)](_0x320723);try{const _0x4a834e=await a0_0x528ac2[_0x494f89(0xef)](_0x5de685),_0x129fe9=a0_0x577282[_0x494f89(0xce)](_0x4a834e,a0_0x577282[_0x494f89(0x13c)](_0x320723));return logger[_0x494f89(0x163)](_0x494f89(0x14a),_0x494f89(0x13e),{'resolved':_0x129fe9,'new_file':!![]}),_0x129fe9;}catch{logger[_0x494f89(0x7c)](_0x494f89(0x14a),'path_validation_failed',{'raw_path':_0x5677cb,'error':_0x494f89(0xa6)+_0x5de685});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x5de685);}}logger['error'](_0x494f89(0x14a),_0x494f89(0xad),{'raw_path':_0x5677cb,'error':_0x403644['message']});throw _0x403644;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x28086a(0x100)](),'code_edit':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](a0_0x28086a(0x184)),'instruction':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](a0_0x28086a(0x115)),'dryRun':z[a0_0x28086a(0x99)]()['default'](![])[a0_0x28086a(0x87)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x28086a(0x1a8),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](a0_0x28086a(0x108)),'search_type':z[a0_0x28086a(0x172)]([a0_0x28086a(0x181),'node_modules'])['optional']()['describe'](a0_0x28086a(0x192))}),WarpGrepGitHubArgsSchema=z[a0_0x28086a(0xac)]({'search_string':z['string']()[a0_0x28086a(0x87)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()[a0_0x28086a(0x87)](a0_0x28086a(0x185)),'owner_repo':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x107)]()['describe'](a0_0x28086a(0x16b)),'branch':z[a0_0x28086a(0x100)]()['optional']()[a0_0x28086a(0x87)](a0_0x28086a(0xa5))}),CodebaseSearchArgsSchema=z['object']({'query':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x87)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x28086a(0x87)](a0_0x28086a(0x12d)),'branch':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x107)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x28086a(0x100)]()[a0_0x28086a(0x107)]()[a0_0x28086a(0x87)](a0_0x28086a(0x16d)),'targetDirectories':z[a0_0x28086a(0x112)](z[a0_0x28086a(0x100)]())[a0_0x28086a(0x181)]([])[a0_0x28086a(0x87)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x28086a(0x107)]()[a0_0x28086a(0x181)](0xa)['describe'](a0_0x28086a(0x12f))}),server=new Server({'name':a0_0x28086a(0x11a),'version':a0_0x28086a(0xa3)},{'capabilities':{'tools':{}}});server[a0_0x28086a(0x155)](ListToolsRequestSchema,async()=>{const _0x449ce6=a0_0x28086a,_0x3807de=[{'name':TOOL_NAMES[_0x449ce6(0x149)],'description':_0x449ce6(0x164)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x449ce6(0x11f)+_0x449ce6(0x199)+'Benefits:\x0a'+_0x449ce6(0x189)+_0x449ce6(0x94)+_0x449ce6(0xcd)+_0x449ce6(0x1a0)+_0x449ce6(0xf7)+'ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a'+_0x449ce6(0xdc)+_0x449ce6(0x150)+_0x449ce6(0xe0)+_0x449ce6(0xdd)+_0x449ce6(0x188)+_0x449ce6(0x156)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x449ce6(0x18c)+_0x449ce6(0x17c)+_0x449ce6(0x93)+_0x449ce6(0x18a)+'IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x449ce6(0xc6)],'description':_0x449ce6(0x17b)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x449ce6(0x19d)+_0x449ce6(0xc2)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x492a61=_0x3807de['filter'](_0x36d560=>{const _0x2c6513=_0x449ce6;if(DISABLED_TOOLS[_0x2c6513(0x122)](_0x36d560['name']))return console['error']('Tool\x20'+_0x36d560[_0x2c6513(0xae)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if('requiresApiKey'in _0x36d560&&_0x36d560[_0x2c6513(0xd3)]&&!MORPH_API_KEY)return logMcpStderr(_0x2c6513(0xd2)+_0x36d560[_0x2c6513(0xae)]+_0x2c6513(0xc1)),![];return!![];});return{'tools':_0x492a61[_0x449ce6(0xe6)](_0x270e9c=>({'name':_0x270e9c[_0x449ce6(0xae)],'description':_0x270e9c['description'],'inputSchema':_0x270e9c[_0x449ce6(0x1a6)]}))};}),server[a0_0x28086a(0x155)](CallToolRequestSchema,async _0x21974f=>{const _0x3ee2c5=a0_0x28086a,{name:_0x2f0d2e,arguments:_0x3cada3}=_0x21974f['params'],_0x33afa6=Date[_0x3ee2c5(0x182)]();logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x116),{'tool':_0x2f0d2e,'args':_0x2f0d2e===_0x3ee2c5(0x18b)?{'path':_0x3cada3?.[_0x3ee2c5(0xe5)],'instruction':_0x3cada3?.[_0x3ee2c5(0x146)]||_0x3cada3?.[_0x3ee2c5(0x13a)],'dryRun':_0x3cada3?.[_0x3ee2c5(0x17a)]}:_0x3cada3});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0xcc)}],'isError':!![]};if(!MORPH_API_KEY[_0x3ee2c5(0xdf)](_0x3ee2c5(0x10f))&&!MORPH_API_KEY['startsWith'](_0x3ee2c5(0xff)))return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0xea)}],'isError':!![]};if(DISABLED_TOOLS[_0x3ee2c5(0x122)](_0x2f0d2e))return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0x131)+_0x2f0d2e+_0x3ee2c5(0x13d)}],'isError':![]};switch(_0x2f0d2e){case TOOL_NAMES[_0x3ee2c5(0x149)]:{let _0x237ecc=_0x3cada3;if(_0x237ecc&&typeof _0x237ecc===_0x3ee2c5(0xac)){if(!('path'in _0x237ecc)){const _0x13d94d=_0x237ecc[_0x3ee2c5(0x16e)]??_0x237ecc[_0x3ee2c5(0xd1)]??_0x237ecc[_0x3ee2c5(0x190)]??_0x237ecc[_0x3ee2c5(0x1a4)]??_0x237ecc['file'];if(_0x13d94d)_0x237ecc={..._0x237ecc,'path':_0x13d94d};}_0x3ee2c5(0x13a)in _0x237ecc&&!(_0x3ee2c5(0x146)in _0x237ecc)&&(_0x237ecc={..._0x237ecc,'instruction':_0x237ecc[_0x3ee2c5(0x13a)]});if(!(_0x3ee2c5(0x7b)in _0x237ecc)){const _0x250252=_0x237ecc[_0x3ee2c5(0x83)]??_0x237ecc[_0x3ee2c5(0x9f)]??_0x237ecc['content']??_0x237ecc[_0x3ee2c5(0xca)];if(_0x250252)_0x237ecc={..._0x237ecc,'code_edit':_0x250252};}}const _0x2340a0=MorphEditFileArgsSchema[_0x3ee2c5(0x198)](_0x237ecc);if(!_0x2340a0[_0x3ee2c5(0x15b)])throw new Error(_0x3ee2c5(0xb0)+_0x2340a0['error']);const _0x257171=await validatePath(_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)]);let _0x4658b2=null,_0x3fa080=!![],_0x1ce2b=null;try{_0x4658b2=await a0_0x528ac2['readFile'](_0x257171,_0x3ee2c5(0xe3)),logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x9b),{'path':_0x257171,'size_bytes':_0x4658b2['length']});}catch(_0x569a22){const _0x3af43b=_0x569a22[_0x3ee2c5(0x83)];_0x3af43b===_0x3ee2c5(0x129)?(_0x3fa080=![],_0x4658b2='',logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x9b),{'path':_0x257171,'exists':![]})):(_0x1ce2b='Failed\x20to\x20read\x20file:\x20'+(_0x3af43b||'unknown')+_0x3ee2c5(0x197)+(_0x569a22 instanceof Error?_0x569a22['message']:String(_0x569a22)),logger[_0x3ee2c5(0x7c)](_0x3ee2c5(0x14a),'file_read_failed',{'path':_0x257171,'error':_0x1ce2b}),logMcpStderr('Warning:\x20'+_0x1ce2b));}let _0xbbd104;try{const _0x1ff86a=MORPH_API_KEY;if(!_0x1ff86a)throw new Error(_0x3ee2c5(0xd0));const _0x963f0d=a0_0x577282[_0x3ee2c5(0x7e)](_0x257171),_0xd8f9cd=a0_0x577282[_0x3ee2c5(0x13c)](_0x257171);logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0x145),{'model':_0x3ee2c5(0x8d),'path':_0x2340a0[_0x3ee2c5(0x17f)]['path'],'instruction_len':_0x2340a0[_0x3ee2c5(0x17f)]['instruction'][_0x3ee2c5(0x137)],'code_edit_len':_0x2340a0['data'][_0x3ee2c5(0x7b)][_0x3ee2c5(0x137)],'original_code_len':_0x4658b2?.[_0x3ee2c5(0x137)]??0x0,'dry_run':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)]});const _0x5186c9=Date[_0x3ee2c5(0x182)](),_0x5e44f0=await executeEditFile({'target_filepath':_0xd8f9cd,'code_edit':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x7b)],'instruction':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x146)]},{'morphApiKey':_0x1ff86a,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x963f0d,'autoWrite':!_0x2340a0[_0x3ee2c5(0x17f)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x31aa54=Date['now']()-_0x5186c9;_0xbbd104=_0x5e44f0[_0x3ee2c5(0x169)];if(!_0x5e44f0['success'])throw new Error(_0x5e44f0['error']||_0x3ee2c5(0xd4));const _0x508171=_0x5e44f0['changes'],_0x4567c2=_0x3ee2c5(0x123)+_0x508171[_0x3ee2c5(0x92)]+',\x20removed\x20'+_0x508171[_0x3ee2c5(0x120)]+',\x20modified\x20'+_0x508171['linesModified'];logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),'tool_call_complete',{'tool':_0x3ee2c5(0x18b),'success':!![],'latency_ms':Date['now']()-_0x33afa6,'edit_latency_ms':_0x31aa54,'changes':{'added':_0x508171[_0x3ee2c5(0x92)],'removed':_0x508171['linesRemoved'],'modified':_0x508171[_0x3ee2c5(0x101)]},'completion_id':_0xbbd104});if(_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)])return{'content':[{'type':_0x3ee2c5(0xc0),'text':'Morph\x20Edit\x20Preview'+(_0x3fa080?'':_0x3ee2c5(0x7f))+':\x20'+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x146)]+_0x3ee2c5(0x119)+_0x4567c2+_0x3ee2c5(0x11b)+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)]+'.'}]};return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0xed)+(_0x3fa080?'Applied':_0x3ee2c5(0x8c))+':\x20'+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x146)]+'.\x20Changes:\x20'+_0x4567c2+_0x3ee2c5(0x11b)+_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)]+'.'}]};}catch(_0x379b7f){const _0x37cb29=handleMorphAPIError(_0x379b7f);if(_0x37cb29)return logger[_0x3ee2c5(0x7c)](_0x3ee2c5(0x14a),_0x3ee2c5(0xb9),{'tool':_0x3ee2c5(0x18b),'error':_0x3ee2c5(0x15d),'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6}),_0x37cb29;const _0x587d99=_0x379b7f instanceof Error?_0x379b7f['message']:String(_0x379b7f);return logger[_0x3ee2c5(0x7c)]('MCP','tool_call_error',{'tool':_0x3ee2c5(0x18b),'error':_0x587d99,'path':_0x2340a0[_0x3ee2c5(0x17f)]['path'],'validated_path':_0x257171,'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6,'stack':_0x379b7f instanceof Error?_0x379b7f[_0x3ee2c5(0xfb)]:undefined}),reportMorphError({'error_message':_0x587d99,'error_type':_0x379b7f instanceof Error?_0x379b7f['constructor']['name']:_0x3ee2c5(0xb5),'context':{'tool':_0x3ee2c5(0x18b),'completion_id':_0xbbd104,'file_path':_0x2340a0['data'][_0x3ee2c5(0xe5)],'validated_path':_0x257171,'instruction':_0x2340a0['data'][_0x3ee2c5(0x146)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x3ee2c5(0x8d),'dry_run':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)],'file_exists':_0x3fa080,'file_read_error':_0x1ce2b,'file_readable':_0x4658b2!==null,'request_content':{'path':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0xe5)],'code_edit':_0x2340a0[_0x3ee2c5(0x17f)]['code_edit'],'instruction':_0x2340a0[_0x3ee2c5(0x17f)]['instruction'],'original_code':_0x4658b2!==null?_0x4658b2[_0x3ee2c5(0x137)]>0xc350?_0x4658b2[_0x3ee2c5(0x91)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x4658b2[_0x3ee2c5(0x137)]+_0x3ee2c5(0xf6):_0x4658b2:'[could\x20not\x20read\x20file:\x20'+(_0x1ce2b||'unknown\x20error')+']','original_code_length':_0x4658b2?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x3ee2c5(0x166):_0x3ee2c5(0x8d),'dry_run':_0x2340a0[_0x3ee2c5(0x17f)][_0x3ee2c5(0x17a)]}},'stack_trace':_0x379b7f instanceof Error?_0x379b7f['stack']:undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x587d99}],'isError':!![]};}}case TOOL_NAMES[_0x3ee2c5(0xc6)]:{const _0xbf9ecd=WarpGrepArgsSchema[_0x3ee2c5(0x198)](_0x3cada3);if(!_0xbf9ecd[_0x3ee2c5(0x15b)])return{'content':[{'type':_0x3ee2c5(0xc0),'text':'Invalid\x20arguments:\x20'+_0xbf9ecd['error']}],'isError':!![]};const _0x325921=_0x40d67d=>{const _0x33b72a=_0x3ee2c5,_0x99752b=[];for(const _0x12159b of _0x40d67d||[]){if(_0x12159b[_0x33b72a(0x136)]===_0x33b72a(0x12a)&&Array[_0x33b72a(0xf2)](_0x12159b[_0x33b72a(0x151)]))for(const _0x2aabb9 of _0x12159b[_0x33b72a(0x151)]){try{const _0x208805=_0x2aabb9[_0x33b72a(0x144)]?.[_0x33b72a(0xae)],_0x13c455=JSON[_0x33b72a(0x12c)](_0x2aabb9[_0x33b72a(0x144)]?.[_0x33b72a(0xf8)]||'{}');if(_0x208805===_0x33b72a(0x154))_0x99752b[_0x33b72a(0xf5)](_0x33b72a(0xfc)+_0x13c455['pattern']+'\x27\x20'+(_0x13c455[_0x33b72a(0xe5)]||'.'));else{if(_0x208805===_0x33b72a(0x88))_0x99752b[_0x33b72a(0xf5)]('read\x20'+_0x13c455[_0x33b72a(0xe5)]);else{if(_0x208805==='list_directory')_0x99752b['push'](_0x33b72a(0x110)+(_0x13c455[_0x33b72a(0x194)]||'.'));else{if(_0x208805==='glob')_0x99752b[_0x33b72a(0xf5)](_0x33b72a(0x183)+_0x13c455['pattern']+'\x27\x20'+(_0x13c455['path']||'.'));else _0x208805===_0x33b72a(0xfd)&&_0x99752b[_0x33b72a(0xf5)]('finish');}}}}catch{}}}return _0x99752b;},_0x19c467=_0x373c7b=>{const _0x20dd0c=_0x3ee2c5,_0x15efee=[];if(!_0x373c7b||!Array['isArray'](_0x373c7b))return _0x15efee;const _0x14145b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x20dd0c(0x15f),'tool':_0x20dd0c(0x88)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x20dd0c(0x9e),'tool':_0x20dd0c(0x88)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x20dd0c(0x8e),'tool':_0x20dd0c(0x88)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x20dd0c(0x191),'tool':_0x20dd0c(0x117)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x20dd0c(0xc7),'tool':_0x20dd0c(0x117)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x20dd0c(0x88)},{'pattern':/\[SYMLINK\]/,'error_type':_0x20dd0c(0xa7),'tool':_0x20dd0c(0x88)},{'pattern':/not a text file/,'error_type':_0x20dd0c(0x8e),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x20dd0c(0xa7),'tool':_0x20dd0c(0x88)},{'pattern':/Error reading file:/,'error_type':_0x20dd0c(0x9e),'tool':_0x20dd0c(0x88)},{'pattern':/status="error"/,'error_type':_0x20dd0c(0xf0),'tool':'unknown'}];let _0x51139c=0x0;for(const _0x5b1fb5 of _0x373c7b){_0x5b1fb5[_0x20dd0c(0x136)]===_0x20dd0c(0x12a)&&Array[_0x20dd0c(0xf2)](_0x5b1fb5[_0x20dd0c(0x151)])&&_0x51139c++;const _0xa6c57e=_0x5b1fb5[_0x20dd0c(0xaf)];if((_0x5b1fb5[_0x20dd0c(0x136)]===_0x20dd0c(0xb6)||_0x5b1fb5[_0x20dd0c(0x136)]===_0x20dd0c(0x96))&&_0xa6c57e&&typeof _0xa6c57e===_0x20dd0c(0x100))for(const {pattern:_0x4494fa,error_type:_0x3ba715,tool:_0x3e534f}of _0x14145b){const _0x1e4d19=_0xa6c57e[_0x20dd0c(0x10a)](new RegExp(_0x4494fa['source'],'g'));if(_0x1e4d19)for(const _0x73ad11 of _0x1e4d19){const _0x96554c=_0xa6c57e[_0x20dd0c(0x109)](_0x73ad11),_0x8f1c76=_0xa6c57e[_0x20dd0c(0x91)](_0x96554c,Math['min'](_0x96554c+0xc8,_0xa6c57e[_0x20dd0c(0x137)]));_0x15efee[_0x20dd0c(0xf5)]({'tool':_0x3e534f,'error_type':_0x3ba715,'error_message':_0x8f1c76[_0x20dd0c(0x97)]('\x0a')[0x0],'turn':_0x51139c});}}}return _0x15efee;};try{const _0x1d0d35=a0_0x577282['resolve'](_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)]),_0x5330a5=_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x152)],_0xba65f3=_0x5330a5==='node_modules'?{'allowNames':[_0x3ee2c5(0x8b)]}:undefined,_0x108fd8=new LocalRipgrepProvider(_0x1d0d35,undefined,_0xba65f3);logger[_0x3ee2c5(0x163)](_0x3ee2c5(0x14a),_0x3ee2c5(0xb2),{'type':_0x3ee2c5(0x124),'repo_root':_0x1d0d35,'search_type':_0x5330a5||_0x3ee2c5(0x181)}),logger[_0x3ee2c5(0x163)]('MCP',_0x3ee2c5(0x178),{'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'repo_root':_0x1d0d35,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1316cc=Date[_0x3ee2c5(0x182)](),_0x5eb3e2=await runWarpGrep({'searchTerm':_0xbf9ecd['data'][_0x3ee2c5(0x143)],'repoRoot':_0x1d0d35,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x108fd8,'search_type':_0x5330a5}),_0x2b756e=Date[_0x3ee2c5(0x182)]()-_0x1316cc,_0x3a98aa=_0x5eb3e2[_0x3ee2c5(0xfd)]?.[_0x3ee2c5(0x9c)]?.[_0x3ee2c5(0x103)]?.[_0x3ee2c5(0x137)]??0x0;logger[_0x3ee2c5(0x163)]('MCP',_0x3ee2c5(0x89),{'termination':_0x5eb3e2[_0x3ee2c5(0x106)],'turns':_0x5eb3e2['timings']?.[_0x3ee2c5(0xee)]??0x0,'files_found':_0x3a98aa,'latency_ms':_0x2b756e});const _0x11f3c9=_0x19c467(_0x5eb3e2[_0x3ee2c5(0x158)]);_0x11f3c9['length']>0x0&&reportMorphError({'error_message':_0x3ee2c5(0x12e)+_0x11f3c9[_0x3ee2c5(0x137)]+_0x3ee2c5(0x16c),'error_type':_0x3ee2c5(0x1a7),'level':_0x3ee2c5(0x11d),'tool':_0x3ee2c5(0x95),'context':{'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'query':_0xbf9ecd['data']['search_string'],'model':_0x3ee2c5(0x12b),'termination_reason':_0x5eb3e2[_0x3ee2c5(0x106)],'sub_tool_errors':_0x11f3c9,'timings':_0x5eb3e2[_0x3ee2c5(0xf4)],'tool_calls':_0x325921(_0x5eb3e2[_0x3ee2c5(0x158)]),'messages':_0x5eb3e2['messages']?.[_0x3ee2c5(0xe6)](_0x4efd9a=>({'role':_0x4efd9a[_0x3ee2c5(0x136)],'content':_0x4efd9a[_0x3ee2c5(0xaf)],..._0x4efd9a['tool_calls']?{'tool_calls':_0x4efd9a['tool_calls']['length']}:{},..._0x4efd9a[_0x3ee2c5(0xe2)]?{'tool_call_id':_0x4efd9a['tool_call_id']}:{}}))},'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{});let _0x31327c='';if(_0x5eb3e2['terminationReason']==='completed'&&_0x5eb3e2[_0x3ee2c5(0xfd)]?.[_0x3ee2c5(0x9c)]?.[_0x3ee2c5(0x103)]){const _0x2047b5=_0x5eb3e2['finish']['metadata'][_0x3ee2c5(0x103)];if(_0x2047b5[_0x3ee2c5(0x137)]===0x0)return _0x31327c=_0x5eb3e2[_0x3ee2c5(0xfd)][_0x3ee2c5(0x157)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x31327c}]};const _0x41e3d7=[],_0x39e67c=[_0x3ee2c5(0xab)];for(const _0x15e3da of _0x5eb3e2[_0x3ee2c5(0x158)]){if(_0x15e3da[_0x3ee2c5(0x136)]==='assistant'&&Array[_0x3ee2c5(0xf2)](_0x15e3da[_0x3ee2c5(0x151)]))for(const _0x102fca of _0x15e3da['tool_calls']){try{const _0x37604a=_0x102fca['function']?.['name'],_0x23cfac=JSON['parse'](_0x102fca[_0x3ee2c5(0x144)]?.[_0x3ee2c5(0xf8)]||'{}');if(_0x37604a===_0x3ee2c5(0x154))_0x39e67c[_0x3ee2c5(0xf5)](_0x3ee2c5(0xa4)+_0x23cfac[_0x3ee2c5(0xbf)]+_0x3ee2c5(0xdb)+(_0x23cfac['path']||'.')+'`');else{if(_0x37604a===_0x3ee2c5(0x88))_0x39e67c[_0x3ee2c5(0xf5)](_0x3ee2c5(0x174)+_0x23cfac['path']+'`');else{if(_0x37604a==='list_directory')_0x39e67c[_0x3ee2c5(0xf5)]('-\x20Listed\x20directory\x20`'+(_0x23cfac['command']||'.')+'`');else _0x37604a==='glob'&&_0x39e67c['push']('-\x20Glob\x20search\x20`'+_0x23cfac[_0x3ee2c5(0xbf)]+'`\x20in\x20`'+(_0x23cfac['path']||'.')+'`');}}}catch{}}}_0x41e3d7[_0x3ee2c5(0xf5)](_0x39e67c['join']('\x0a'));const _0x2784f0=['','Relevant\x20context\x20found:'];for(const _0x21a0cf of _0x2047b5){if(_0x21a0cf[_0x3ee2c5(0x17e)]==='*')_0x2784f0[_0x3ee2c5(0xf5)]('-\x20'+_0x21a0cf[_0x3ee2c5(0xe5)]+':*');else{if(Array['isArray'](_0x21a0cf[_0x3ee2c5(0x17e)])){const _0x36b1d8=_0x21a0cf[_0x3ee2c5(0x17e)]['map'](([_0x322eb1,_0x42eaa8])=>{if(_0x322eb1===_0x42eaa8)return''+_0x322eb1;return _0x322eb1+'-'+_0x42eaa8;});_0x2784f0[_0x3ee2c5(0xf5)]('-\x20'+_0x21a0cf[_0x3ee2c5(0xe5)]+':'+_0x36b1d8[_0x3ee2c5(0xce)](','));}else _0x2784f0[_0x3ee2c5(0xf5)]('-\x20'+_0x21a0cf[_0x3ee2c5(0xe5)]+':*');}}_0x2784f0[_0x3ee2c5(0xf5)](''),_0x41e3d7[_0x3ee2c5(0xf5)](_0x2784f0[_0x3ee2c5(0xce)]('\x0a')),_0x41e3d7[_0x3ee2c5(0xf5)](_0x3ee2c5(0x16f));const _0x4322e1=[],_0x1737da=[];for(const _0x10e6b4 of _0x2047b5){let _0x59efaf=a0_0x577282['resolve'](_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],_0x10e6b4[_0x3ee2c5(0xe5)]),_0x436f17=null,_0xa683a2=null;try{_0x436f17=await a0_0x528ac2[_0x3ee2c5(0xbb)](_0x59efaf,{'encoding':_0x3ee2c5(0xe3)});}catch(_0x2b59dd){const _0x519419=fixPathRepetition(_0x59efaf);if(_0x519419)try{_0x436f17=await a0_0x528ac2[_0x3ee2c5(0xbb)](_0x519419,{'encoding':'utf-8'}),_0x59efaf=_0x519419;}catch{_0xa683a2=_0x2b59dd instanceof Error?_0x2b59dd:new Error(String(_0x2b59dd));}else _0xa683a2=_0x2b59dd instanceof Error?_0x2b59dd:new Error(String(_0x2b59dd));}if(_0x436f17!==null){const _0x3994f9=_0x436f17['split'](/\r?\n/),_0xa750b4=[];if(_0x10e6b4[_0x3ee2c5(0x17e)]==='*'||!Array[_0x3ee2c5(0xf2)](_0x10e6b4[_0x3ee2c5(0x17e)]))for(let _0x2cb4f2=0x1;_0x2cb4f2<=_0x3994f9[_0x3ee2c5(0x137)];_0x2cb4f2++){const _0x853b6b=_0x3994f9[_0x2cb4f2-0x1];_0xa750b4[_0x3ee2c5(0xf5)](_0x2cb4f2+'|\x20'+_0x853b6b);}else for(const [_0x1785ac,_0x576de2]of _0x10e6b4[_0x3ee2c5(0x17e)]){_0xa750b4[_0x3ee2c5(0x137)]>0x0&&_0xa750b4[_0x3ee2c5(0xf5)]('');for(let _0x2cac9d=_0x1785ac;_0x2cac9d<=_0x576de2&&_0x2cac9d<=_0x3994f9['length'];_0x2cac9d++){const _0x158df8=_0x3994f9[_0x2cac9d-0x1];_0xa750b4[_0x3ee2c5(0xf5)](_0x2cac9d+'|\x20'+_0x158df8);}}_0x1737da['push']({'path':_0x10e6b4['path'],'content':_0xa750b4[_0x3ee2c5(0xce)]('\x0a')});}else _0x4322e1[_0x3ee2c5(0xf5)](_0x3ee2c5(0xb3)+_0x10e6b4[_0x3ee2c5(0xe5)]+_0x3ee2c5(0x135)+(_0xa683a2?.[_0x3ee2c5(0xa1)]||_0x3ee2c5(0xc5))+_0x3ee2c5(0xb4));}try{const _0x3e06bd=await compactFileContexts(_0x1737da,_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3b5a99 of _0x3e06bd){_0x4322e1[_0x3ee2c5(0xf5)](_0x3ee2c5(0xb3)+_0x3b5a99[_0x3ee2c5(0xe5)]+_0x3ee2c5(0x195)+_0x3b5a99[_0x3ee2c5(0xaf)]+_0x3ee2c5(0xb4));}}catch(_0x3d30b5){logger[_0x3ee2c5(0x11d)](_0x3ee2c5(0x14a),'compaction_failed',{'error':_0x3d30b5 instanceof Error?_0x3d30b5[_0x3ee2c5(0xa1)]:String(_0x3d30b5),'files_count':_0x1737da['length']});for(const _0x54c0dd of _0x1737da){_0x4322e1[_0x3ee2c5(0xf5)](_0x3ee2c5(0xb3)+_0x54c0dd[_0x3ee2c5(0xe5)]+_0x3ee2c5(0x195)+_0x54c0dd['content']+_0x3ee2c5(0xb4));}}_0x41e3d7[_0x3ee2c5(0xf5)](_0x4322e1['join']('\x0a\x0a')),_0x31327c=_0x41e3d7[_0x3ee2c5(0xce)]('\x0a');const _0x52cfa0=_0x5eb3e2[_0x3ee2c5(0x19f)]?.['filter'](_0x31c893=>_0x31c893[_0x3ee2c5(0xa1)]?.[_0x3ee2c5(0xdf)](_0x3ee2c5(0x10d)))||[];if(_0x52cfa0[_0x3ee2c5(0x137)]>0x0){const _0x2eeea7=_0x52cfa0[_0x3ee2c5(0xe6)](_0x52bd37=>_0x52bd37[_0x3ee2c5(0xa1)])[_0x3ee2c5(0xce)](';\x20');reportMorphError({'error_message':_0x2eeea7,'error_type':_0x3ee2c5(0x171),'context':{'tool':'codebase_search','repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'query':_0xbf9ecd[_0x3ee2c5(0x17f)]['search_string'],'model':_0x3ee2c5(0x12b),'termination_reason':_0x3ee2c5(0x167),'error_count':_0x52cfa0['length'],'is_timeout':![],'timings':_0x5eb3e2['timings'],'files_attempted':_0x2047b5[_0x3ee2c5(0xe6)](_0x2dcc8c=>({'path':_0x2dcc8c[_0x3ee2c5(0xe5)],'lines':_0x2dcc8c[_0x3ee2c5(0x17e)]})),'tool_calls':_0x325921(_0x5eb3e2[_0x3ee2c5(0x158)]),'messages':_0x5eb3e2['messages']?.[_0x3ee2c5(0xe6)](_0x39ab56=>({'role':_0x39ab56[_0x3ee2c5(0x136)],'content':_0x39ab56[_0x3ee2c5(0xaf)],..._0x39ab56[_0x3ee2c5(0x151)]?{'tool_calls':_0x39ab56[_0x3ee2c5(0x151)][_0x3ee2c5(0x137)]}:{},..._0x39ab56[_0x3ee2c5(0xe2)]?{'tool_call_id':_0x39ab56[_0x3ee2c5(0xe2)]}:{}})),'request_content':{'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'repoRoot':a0_0x577282[_0x3ee2c5(0x104)](_0xbf9ecd['data']['repo_path']),'model':_0x3ee2c5(0x12b)}},'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{});}}else{if(_0x5eb3e2[_0x3ee2c5(0x106)]===_0x3ee2c5(0x13f)&&_0x5eb3e2['errors'][_0x3ee2c5(0x137)]>0x0){const _0x5a4208=_0x5eb3e2[_0x3ee2c5(0x19f)][_0x3ee2c5(0xe6)](_0x6160f7=>_0x6160f7[_0x3ee2c5(0xa1)])['join'](';\x20');_0x31327c=_0x3ee2c5(0xfa)+_0x5a4208;const _0x62a67=_0x5a4208[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)](_0x3ee2c5(0xc4))||_0x5a4208['toLowerCase']()[_0x3ee2c5(0xcb)](_0x3ee2c5(0x140))||_0x5a4208[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)]('etimedout'),_0x28da95=_0x5eb3e2['finish']?.[_0x3ee2c5(0x9c)]?.['files'],_0x4c4818=_0x5eb3e2['errors'][0x0];reportMorphError({'error_message':_0x5a4208,'error_type':_0x62a67?_0x3ee2c5(0x170):_0x4c4818?.['constructor']?.[_0x3ee2c5(0xae)]||'WarpGrepError','context':{'tool':_0x3ee2c5(0x95),'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'query':_0xbf9ecd[_0x3ee2c5(0x17f)]['search_string'],'model':_0x3ee2c5(0x12b),'termination_reason':_0x5eb3e2[_0x3ee2c5(0x106)],'error_count':_0x5eb3e2[_0x3ee2c5(0x19f)][_0x3ee2c5(0x137)],'is_timeout':_0x62a67,'timings':_0x5eb3e2['timings'],'files_attempted':_0x28da95?.[_0x3ee2c5(0xe6)](_0x282512=>({'path':_0x282512[_0x3ee2c5(0xe5)],'lines':_0x282512['lines']})),'tool_calls':_0x325921(_0x5eb3e2[_0x3ee2c5(0x158)]),'messages':_0x5eb3e2[_0x3ee2c5(0x158)]?.[_0x3ee2c5(0xe6)](_0x2e3dd3=>({'role':_0x2e3dd3['role'],'content':_0x2e3dd3[_0x3ee2c5(0xaf)],..._0x2e3dd3[_0x3ee2c5(0x151)]?{'tool_calls':_0x2e3dd3['tool_calls'][_0x3ee2c5(0x137)]}:{},..._0x2e3dd3[_0x3ee2c5(0xe2)]?{'tool_call_id':_0x2e3dd3[_0x3ee2c5(0xe2)]}:{}})),'request_content':{'query':_0xbf9ecd['data']['search_string'],'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'repoRoot':a0_0x577282['resolve'](_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x4c4818?.[_0x3ee2c5(0xfb)]||undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{});}else _0x31327c=_0x3ee2c5(0xa8);}return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x31327c}]};}catch(_0x24927e){const _0x49bba5=handleMorphAPIError(_0x24927e);if(_0x49bba5)return logger[_0x3ee2c5(0x7c)]('MCP',_0x3ee2c5(0xb9),{'tool':'codebase_search','error':_0x3ee2c5(0x15d),'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6}),_0x49bba5;const _0x5ceae2=_0x24927e instanceof Error?_0x24927e[_0x3ee2c5(0xa1)]:String(_0x24927e);logger['error'](_0x3ee2c5(0x14a),'tool_call_error',{'tool':_0x3ee2c5(0x95),'error':_0x5ceae2,'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'latency_ms':Date[_0x3ee2c5(0x182)]()-_0x33afa6});const _0x390d68=_0x5ceae2[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)](_0x3ee2c5(0xc4))||_0x5ceae2['toLowerCase']()[_0x3ee2c5(0xcb)](_0x3ee2c5(0x140))||_0x5ceae2[_0x3ee2c5(0xfe)]()[_0x3ee2c5(0xcb)]('etimedout')||_0x24927e instanceof Error&&_0x24927e[_0x3ee2c5(0xae)]===_0x3ee2c5(0x170);return reportMorphError({'error_message':_0x5ceae2,'error_type':_0x390d68?'TimeoutError':_0x24927e instanceof Error?_0x24927e['constructor'][_0x3ee2c5(0xae)]:_0x3ee2c5(0xb5),'context':{'tool':_0x3ee2c5(0x95),'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x160)],'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'model':_0x3ee2c5(0x12b),'is_timeout':_0x390d68,'exception_phase':_0x3ee2c5(0x8f),'request_content':{'query':_0xbf9ecd[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'repo_path':_0xbf9ecd[_0x3ee2c5(0x17f)]['repo_path'],'repoRoot':a0_0x577282[_0x3ee2c5(0x104)](_0xbf9ecd['data'][_0x3ee2c5(0x160)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x24927e instanceof Error?_0x24927e[_0x3ee2c5(0xfb)]:undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':_0x3ee2c5(0xc0),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x5ceae2}],'isError':![]};}}case TOOL_NAMES[_0x3ee2c5(0x1a9)]:{const _0x42c6d9=WarpGrepGitHubArgsSchema[_0x3ee2c5(0x198)](_0x3cada3);if(!_0x42c6d9['success'])return{'content':[{'type':'text','text':_0x3ee2c5(0xa9)+_0x42c6d9[_0x3ee2c5(0x7c)]}],'isError':!![]};const _0x1f7fcf=_0x42c6d9['data'][_0x3ee2c5(0x138)]||_0x42c6d9[_0x3ee2c5(0x17f)][_0x3ee2c5(0xbd)];if(!_0x1f7fcf)return{'content':[{'type':_0x3ee2c5(0xc0),'text':_0x3ee2c5(0x186)}],'isError':!![]};const _0x240ef9=MORPH_API_KEY;if(!_0x240ef9)throw new Error(_0x3ee2c5(0xd0));const _0x3df998=Date[_0x3ee2c5(0x182)]();logger['debug'](_0x3ee2c5(0x14a),_0x3ee2c5(0xec),{'identifier':_0x1f7fcf,'query':_0x42c6d9[_0x3ee2c5(0x17f)][_0x3ee2c5(0x143)],'branch':_0x42c6d9['data']['branch']});try{const _0x2b2580=new WarpGrepClient({'morphApiKey':_0x240ef9,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x92f285=await _0x2b2580[_0x3ee2c5(0x175)]({'searchTerm':_0x42c6d9['data'][_0x3ee2c5(0x143)],'github':_0x1f7fcf,'branch':_0x42c6d9['data'][_0x3ee2c5(0x113)]}),_0x2bdefa=Date[_0x3ee2c5(0x182)]()-_0x3df998;logMcpStderr(_0x3ee2c5(0x15a)+_0x2bdefa+_0x3ee2c5(0x1a2)+_0x92f285[_0x3ee2c5(0x15b)]);const _0x2083fe=formatResult(_0x92f285);return{'content':[{'type':'text','text':_0x2083fe}]};}catch(_0x2b4259){const _0x12a75b=handleMorphAPIError(_0x2b4259);if(_0x12a75b)return _0x12a75b;const _0x15fb66=Date[_0x3ee2c5(0x182)]()-_0x3df998,_0x55a2b5=_0x2b4259 instanceof Error?_0x2b4259[_0x3ee2c5(0xa1)]:String(_0x2b4259);return logMcpStderr(_0x3ee2c5(0x9a)+_0x15fb66+_0x3ee2c5(0xde),_0x55a2b5),reportMorphError({'error_message':_0x55a2b5,'error_type':_0x2b4259 instanceof Error?_0x2b4259['constructor'][_0x3ee2c5(0xae)]:'UnknownError','context':{'tool':_0x3ee2c5(0x177),'github_url':_0x1f7fcf,'search_string':_0x42c6d9[_0x3ee2c5(0x17f)]['search_string'],'branch':_0x42c6d9[_0x3ee2c5(0x17f)][_0x3ee2c5(0x113)]},'stack_trace':_0x2b4259 instanceof Error?_0x2b4259[_0x3ee2c5(0xfb)]:undefined,'source':_0x3ee2c5(0x193),'tool':_0x3ee2c5(0x177),'latency_ms':_0x15fb66})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':_0x3ee2c5(0xc0),'text':'GitHub\x20search\x20failed:\x20'+_0x55a2b5}],'isError':![]};}}default:throw new Error(_0x3ee2c5(0x14c)+_0x2f0d2e);}}catch(_0x50e982){const _0x4918cd=_0x50e982 instanceof Error?_0x50e982[_0x3ee2c5(0xa1)]:String(_0x50e982);return reportMorphError({'error_message':_0x4918cd,'error_type':_0x50e982 instanceof Error?_0x50e982[_0x3ee2c5(0x14d)][_0x3ee2c5(0xae)]:_0x3ee2c5(0xb5),'context':{'tool':_0x2f0d2e,'arguments':_0x3cada3?JSON['stringify'](_0x3cada3)[_0x3ee2c5(0x91)](0x0,0x1f4):undefined,'mcp_server_version':_0x3ee2c5(0xa3)},'stack_trace':_0x50e982 instanceof Error?_0x50e982[_0x3ee2c5(0xfb)]:undefined,'source':_0x3ee2c5(0x193)})[_0x3ee2c5(0x9d)](()=>{}),{'content':[{'type':_0x3ee2c5(0xc0),'text':'Error:\x20'+_0x4918cd}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x33aa1f){const _0x239d9e=a0_0x28086a,_0x2e67fe=await getValidRootDirectories(_0x33aa1f);if(_0x2e67fe[_0x239d9e(0x137)]>0x0)allowedDirectories=[..._0x2e67fe],logMcpStderr(_0x239d9e(0xd6)+_0x2e67fe[_0x239d9e(0x137)]+_0x239d9e(0x16a));else{logMcpStderr(_0x239d9e(0x10c));if(ENABLE_WORKSPACE_MODE)try{const _0x1a4f03=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1a4f03&&(allowedDirectories=[_0x1a4f03],logMcpStderr(_0x239d9e(0xf3)+_0x1a4f03));}catch(_0x2201db){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x2201db);}}}server[a0_0x28086a(0x86)](RootsListChangedNotificationSchema,async()=>{const _0x5ef497=a0_0x28086a;try{const _0x503b3a=await server['listRoots']();_0x503b3a&&'roots'in _0x503b3a&&await updateAllowedDirectoriesFromRoots(_0x503b3a[_0x5ef497(0xb7)]);}catch(_0x5517b8){logMcpStderr(_0x5ef497(0x7a),_0x5517b8 instanceof Error?_0x5517b8['message']:String(_0x5517b8));}}),server[a0_0x28086a(0xbc)]=async()=>{const _0x2c45af=a0_0x28086a,_0x54e14a=server[_0x2c45af(0x196)]();if(_0x54e14a?.[_0x2c45af(0xb7)])try{const _0x347a9f=await server[_0x2c45af(0xba)]();_0x347a9f&&_0x2c45af(0xb7)in _0x347a9f?await updateAllowedDirectoriesFromRoots(_0x347a9f[_0x2c45af(0xb7)]):logMcpStderr(_0x2c45af(0x7d));}catch(_0x1c352b){logMcpStderr(_0x2c45af(0x11c),_0x1c352b instanceof Error?_0x1c352b['message']:String(_0x1c352b));}else{if(allowedDirectories[_0x2c45af(0x137)]>0x0)logMcpStderr(_0x2c45af(0xd8),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x2c45af(0xd7));else throw new Error(_0x2c45af(0x80));}}};async function runServer(){const _0x2ed625=a0_0x28086a,_0x36938a=new StdioServerTransport();await server[_0x2ed625(0x187)](_0x36938a),logMcpStderr(_0x2ed625(0x19c)),allowedDirectories[_0x2ed625(0x137)]===0x0&&logMcpStderr(_0x2ed625(0xf9));}runServer()['catch'](_0x47bf87=>{const _0x1454b9=a0_0x28086a;logMcpStderr(_0x1454b9(0xc3),_0x47bf87),process[_0x1454b9(0xe7)](0x1);});

@@ -1,1 +0,1 @@

var a1_0x200d05=a1_0x5337;(function(_0xe4d882,_0x48cbe0){var _0x1458db=a1_0x5337,_0x262525=_0xe4d882();while(!![]){try{var _0x28c09b=-parseInt(_0x1458db(0x8d))/0x1*(-parseInt(_0x1458db(0x88))/0x2)+-parseInt(_0x1458db(0x8c))/0x3+-parseInt(_0x1458db(0x8e))/0x4*(-parseInt(_0x1458db(0x99))/0x5)+parseInt(_0x1458db(0x91))/0x6*(parseInt(_0x1458db(0x93))/0x7)+parseInt(_0x1458db(0x92))/0x8*(parseInt(_0x1458db(0x8b))/0x9)+-parseInt(_0x1458db(0x96))/0xa+parseInt(_0x1458db(0x95))/0xb;if(_0x28c09b===_0x48cbe0)break;else _0x262525['push'](_0x262525['shift']());}catch(_0x2a6463){_0x262525['push'](_0x262525['shift']());}}}(a1_0x5757,0xe2ff1));import a1_0x10e341 from'os';import{logger}from'./logger.js';function a1_0x5757(){var _0x39d2ed=['2TpvqzK','20rsWWnH','Windows','error','9567438aMkWca','334816crPDAG','7BtUtso','win32','322729HLTsEN','12051740nsHZkW','info','map','424465KJTAFU','21006srbSXK','platform','darwin','342hfaZmC','4574424cCQAHM'];a1_0x5757=function(){return _0x39d2ed;};return a1_0x5757();}export function getOperatingSystemType(_0x37fb7b=a1_0x10e341[a1_0x200d05(0x89)]()){var _0x3b085a=a1_0x200d05;switch(_0x37fb7b){case _0x3b085a(0x8a):return'macOS';case _0x3b085a(0x94):return _0x3b085a(0x8f);case'linux':return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0x287f54,_0x146ce9=a1_0x10e341[a1_0x200d05(0x89)]()){return'[os='+getOperatingSystemType(_0x146ce9)+']\x20'+_0x287f54;}function a1_0x5337(_0x57840d,_0x2d5485){_0x57840d=_0x57840d-0x88;var _0x5757a1=a1_0x5757();var _0x533718=_0x5757a1[_0x57840d];return _0x533718;}export function logMcpStderr(_0x1188fd,..._0x604ba6){var _0x3aeba9=a1_0x200d05;console[_0x3aeba9(0x90)](formatMcpLogMessage(_0x1188fd),..._0x604ba6),logger[_0x3aeba9(0x97)]('MCP',_0x1188fd,_0x604ba6['length']?{'args':_0x604ba6[_0x3aeba9(0x98)](_0x1e7111=>String(_0x1e7111))}:undefined);}
function a1_0x344b(){var _0x49305d=['2043776cTfxZZ','1630008IAbhAV','[os=','8403550oDreHw','5xQPJtQ','22UJZVXF','67649EpaSZk','error','linux','3650598cAFoup','6108448CwWafp','Unknown','9KCuIOW','596756bawTcR','info','macOS','map','Linux','length','platform','win32'];a1_0x344b=function(){return _0x49305d;};return a1_0x344b();}function a1_0x50c0(_0x4e5166,_0x4ced96){_0x4e5166=_0x4e5166-0x78;var _0x344bc1=a1_0x344b();var _0x50c0fe=_0x344bc1[_0x4e5166];return _0x50c0fe;}var a1_0x1ae033=a1_0x50c0;(function(_0xdafd7f,_0x3ce222){var _0x2e0b1b=a1_0x50c0,_0x5cb8df=_0xdafd7f();while(!![]){try{var _0x5258f6=parseInt(_0x2e0b1b(0x7c))/0x1*(parseInt(_0x2e0b1b(0x7b))/0x2)+parseInt(_0x2e0b1b(0x8c))/0x3+parseInt(_0x2e0b1b(0x83))/0x4*(parseInt(_0x2e0b1b(0x7a))/0x5)+-parseInt(_0x2e0b1b(0x7f))/0x6+-parseInt(_0x2e0b1b(0x8b))/0x7+parseInt(_0x2e0b1b(0x80))/0x8+parseInt(_0x2e0b1b(0x82))/0x9*(-parseInt(_0x2e0b1b(0x79))/0xa);if(_0x5258f6===_0x3ce222)break;else _0x5cb8df['push'](_0x5cb8df['shift']());}catch(_0x3d123b){_0x5cb8df['push'](_0x5cb8df['shift']());}}}(a1_0x344b,0x702c8));import a1_0xe4ff61 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x2d3f37=a1_0xe4ff61['platform']()){var _0x5b3adb=a1_0x50c0;switch(_0x2d3f37){case'darwin':return _0x5b3adb(0x85);case _0x5b3adb(0x8a):return'Windows';case _0x5b3adb(0x7e):return _0x5b3adb(0x87);default:return _0x5b3adb(0x81);}}export function formatMcpLogMessage(_0x17a29d,_0x520cad=a1_0xe4ff61[a1_0x1ae033(0x89)]()){var _0x1b95c4=a1_0x1ae033;return _0x1b95c4(0x78)+getOperatingSystemType(_0x520cad)+']\x20'+_0x17a29d;}export function logMcpStderr(_0x443705,..._0x3b8348){var _0x294268=a1_0x1ae033;console[_0x294268(0x7d)](formatMcpLogMessage(_0x443705),..._0x3b8348),logger[_0x294268(0x84)]('MCP',_0x443705,_0x3b8348[_0x294268(0x88)]?{'args':_0x3b8348[_0x294268(0x86)](_0xabad05=>String(_0xabad05))}:undefined);}

@@ -1,1 +0,1 @@

const a2_0x5eb223=a2_0x1c83;function a2_0x1c83(_0x21bba4,_0x4c5079){_0x21bba4=_0x21bba4-0x13a;const _0x55d9cc=a2_0x55d9();let _0x1c8366=_0x55d9cc[_0x21bba4];return _0x1c8366;}(function(_0x5e4df3,_0xd9ca69){const _0x3d13fb=a2_0x1c83,_0x284ff4=_0x5e4df3();while(!![]){try{const _0x13221a=-parseInt(_0x3d13fb(0x147))/0x1*(parseInt(_0x3d13fb(0x150))/0x2)+parseInt(_0x3d13fb(0x146))/0x3+parseInt(_0x3d13fb(0x149))/0x4*(parseInt(_0x3d13fb(0x143))/0x5)+parseInt(_0x3d13fb(0x13e))/0x6*(parseInt(_0x3d13fb(0x141))/0x7)+-parseInt(_0x3d13fb(0x14a))/0x8+parseInt(_0x3d13fb(0x153))/0x9*(parseInt(_0x3d13fb(0x142))/0xa)+-parseInt(_0x3d13fb(0x140))/0xb;if(_0x13221a===_0xd9ca69)break;else _0x284ff4['push'](_0x284ff4['shift']());}catch(_0x3b4f50){_0x284ff4['push'](_0x284ff4['shift']());}}}(a2_0x55d9,0xa19ba));import{createWriteStream}from'fs';class MorphLogger{[a2_0x5eb223(0x14b)];['fileStream'];constructor(){const _0x2f81b8=a2_0x5eb223;this[_0x2f81b8(0x14b)]=process[_0x2f81b8(0x13c)][_0x2f81b8(0x154)]==='1'||!!process[_0x2f81b8(0x13c)][_0x2f81b8(0x13a)];const _0x12c7fe=process[_0x2f81b8(0x13c)][_0x2f81b8(0x13a)];this[_0x2f81b8(0x14c)]=_0x12c7fe?createWriteStream(_0x12c7fe,{'flags':'a'}):null;}[a2_0x5eb223(0x14f)](_0x5a0cc6,_0x124958,_0x341d1e){const _0x3f89ee=a2_0x5eb223;this[_0x3f89ee(0x152)](_0x3f89ee(0x14f),_0x5a0cc6,_0x124958,_0x341d1e);}[a2_0x5eb223(0x148)](_0x12d86f,_0x229f6c,_0x300602){const _0x3e1deb=a2_0x5eb223;this[_0x3e1deb(0x152)](_0x3e1deb(0x148),_0x12d86f,_0x229f6c,_0x300602);}[a2_0x5eb223(0x13d)](_0x2f3ae8,_0x22f1ca,_0x41ff3c){const _0xd349c=a2_0x5eb223;this[_0xd349c(0x152)](_0xd349c(0x13d),_0x2f3ae8,_0x22f1ca,_0x41ff3c);}[a2_0x5eb223(0x151)](_0x4c9638,_0xd6a138,_0x15098f){const _0x1b61c6=a2_0x5eb223;this['_log'](_0x1b61c6(0x151),_0x4c9638,_0xd6a138,_0x15098f);}[a2_0x5eb223(0x13f)](){const _0x3b271d=a2_0x5eb223;this[_0x3b271d(0x14b)]=!![];}get[a2_0x5eb223(0x14e)](){const _0x39241c=a2_0x5eb223;return this[_0x39241c(0x14b)];}['_log'](_0x2a7b41,_0xeb364a,_0x3a3c4b,_0x13c9ed){const _0xfc757a=a2_0x5eb223;if(_0x2a7b41!==_0xfc757a(0x151)&&!this['enabled'])return;const _0x56aced=new Date()[_0xfc757a(0x145)](),_0x540b54='['+_0x56aced+_0xfc757a(0x144)+_0x2a7b41[_0xfc757a(0x13b)]()+_0xfc757a(0x144)+_0xeb364a+']';console[_0xfc757a(0x151)](_0x13c9ed?_0x540b54+'\x20'+_0x3a3c4b+'\x20'+JSON['stringify'](_0x13c9ed):_0x540b54+'\x20'+_0x3a3c4b),this[_0xfc757a(0x14c)]?.['write'](JSON[_0xfc757a(0x14d)]({'ts':_0x56aced,'level':_0x2a7b41,'component':_0xeb364a,'msg':_0x3a3c4b,..._0x13c9ed&&{'data':_0x13c9ed}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x55d9(){const _0x251fa2=['toUpperCase','env','warn','12414ichnuc','enable','12362691AcWlXr','4319gLfxmd','2368150qwOGcT','70KfmGfM',']\x20[','toISOString','1480551SamCcX','19560KnxMjd','info','166636EFxvaY','4310752xDuIgq','enabled','fileStream','stringify','isEnabled','debug','124gieDiR','error','_log','45ckSGzR','MORPH_DEBUG','MORPH_LOG_FILE'];a2_0x55d9=function(){return _0x251fa2;};return a2_0x55d9();}
const a2_0x579cf6=a2_0x27e0;function a2_0x27e0(_0x3c5479,_0x4873f2){_0x3c5479=_0x3c5479-0x1bd;const _0x421736=a2_0x4217();let _0x27e09d=_0x421736[_0x3c5479];return _0x27e09d;}(function(_0x13198b,_0xa47f87){const _0x4c4dff=a2_0x27e0,_0x36148e=_0x13198b();while(!![]){try{const _0x369203=-parseInt(_0x4c4dff(0x1cc))/0x1*(-parseInt(_0x4c4dff(0x1c5))/0x2)+-parseInt(_0x4c4dff(0x1ce))/0x3+-parseInt(_0x4c4dff(0x1bf))/0x4+parseInt(_0x4c4dff(0x1cb))/0x5*(-parseInt(_0x4c4dff(0x1ca))/0x6)+parseInt(_0x4c4dff(0x1bd))/0x7*(-parseInt(_0x4c4dff(0x1d0))/0x8)+parseInt(_0x4c4dff(0x1d6))/0x9+-parseInt(_0x4c4dff(0x1d3))/0xa*(-parseInt(_0x4c4dff(0x1d1))/0xb);if(_0x369203===_0xa47f87)break;else _0x36148e['push'](_0x36148e['shift']());}catch(_0x8e302b){_0x36148e['push'](_0x36148e['shift']());}}}(a2_0x4217,0x7e3c3));function a2_0x4217(){const _0xe0fe75=['7xgwskN','info','3396132VlxcPW','debug','isEnabled','fileStream','toISOString','stringify','85978szCJKk','_log','enabled','write','MORPH_DEBUG','6kkKrxc','1804470PHIlXR','2cXqLJE','enable','2571411axurpR','warn','1176248BlrgHu','110yRzOeE','error','1845530xlefDw','env','toUpperCase','7196814ksCrjK'];a2_0x4217=function(){return _0xe0fe75;};return a2_0x4217();}import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x1d6834=a2_0x27e0;this['enabled']=process['env'][_0x1d6834(0x1c9)]==='1'||!!process[_0x1d6834(0x1d4)]['MORPH_LOG_FILE'];const _0x118a42=process[_0x1d6834(0x1d4)]['MORPH_LOG_FILE'];this[_0x1d6834(0x1c2)]=_0x118a42?createWriteStream(_0x118a42,{'flags':'a'}):null;}[a2_0x579cf6(0x1c0)](_0x15b846,_0x2590e9,_0x5dcd8b){const _0x130d1d=a2_0x579cf6;this[_0x130d1d(0x1c6)](_0x130d1d(0x1c0),_0x15b846,_0x2590e9,_0x5dcd8b);}[a2_0x579cf6(0x1be)](_0x53f7e5,_0x422b2b,_0x4ae132){const _0x5aa274=a2_0x579cf6;this[_0x5aa274(0x1c6)](_0x5aa274(0x1be),_0x53f7e5,_0x422b2b,_0x4ae132);}[a2_0x579cf6(0x1cf)](_0x267cc6,_0x2af3cc,_0x1d54fb){const _0x482c93=a2_0x579cf6;this[_0x482c93(0x1c6)]('warn',_0x267cc6,_0x2af3cc,_0x1d54fb);}[a2_0x579cf6(0x1d2)](_0x4c9ad8,_0x86c6b,_0x5ccc60){const _0x883a17=a2_0x579cf6;this[_0x883a17(0x1c6)]('error',_0x4c9ad8,_0x86c6b,_0x5ccc60);}[a2_0x579cf6(0x1cd)](){this['enabled']=!![];}get[a2_0x579cf6(0x1c1)](){const _0x6440d6=a2_0x579cf6;return this[_0x6440d6(0x1c7)];}[a2_0x579cf6(0x1c6)](_0x53a44d,_0x37b9f1,_0x2611fe,_0x30d371){const _0x382192=a2_0x579cf6;if(_0x53a44d!==_0x382192(0x1d2)&&!this[_0x382192(0x1c7)])return;const _0x171228=new Date()[_0x382192(0x1c3)](),_0x4388bc='['+_0x171228+']\x20['+_0x53a44d[_0x382192(0x1d5)]()+']\x20['+_0x37b9f1+']';console['error'](_0x30d371?_0x4388bc+'\x20'+_0x2611fe+'\x20'+JSON[_0x382192(0x1c4)](_0x30d371):_0x4388bc+'\x20'+_0x2611fe),this['fileStream']?.[_0x382192(0x1c8)](JSON['stringify']({'ts':_0x171228,'level':_0x53a44d,'component':_0x37b9f1,'msg':_0x2611fe,..._0x30d371&&{'data':_0x30d371}})+'\x0a');}}export const logger=new MorphLogger();

@@ -1,1 +0,1 @@

(function(_0x25d367,_0x371644){const _0xa762cb=a3_0x434d,_0x46de20=_0x25d367();while(!![]){try{const _0x8478f2=-parseInt(_0xa762cb(0x1a1))/0x1+parseInt(_0xa762cb(0x1b1))/0x2+parseInt(_0xa762cb(0x1b2))/0x3+-parseInt(_0xa762cb(0x1ac))/0x4*(-parseInt(_0xa762cb(0x1b0))/0x5)+parseInt(_0xa762cb(0x1ad))/0x6*(parseInt(_0xa762cb(0x1af))/0x7)+-parseInt(_0xa762cb(0x1a3))/0x8+parseInt(_0xa762cb(0x1a7))/0x9;if(_0x8478f2===_0x371644)break;else _0x46de20['push'](_0x46de20['shift']());}catch(_0x41f09d){_0x46de20['push'](_0x46de20['shift']());}}}(a3_0x396e,0x424e0));import a3_0x45f54f from'path';function a3_0x396e(){const _0x1f1510=['1023280fVHAvJ','187682WQtwIz','210525iiOIsT','trim','charAt','105865UYBHIT','replace','4256808LDIuhv','slice','toUpperCase','test','323334SJefCl','match','startsWith','/mnt/','substring','8ICvBpx','48iqNVwa','homedir','262759LGVuEU'];a3_0x396e=function(){return _0x1f1510;};return a3_0x396e();}import a3_0xc4cd2f from'os';export function convertToWindowsPath(_0x2edad7){const _0x3987d7=a3_0x434d;if(_0x2edad7[_0x3987d7(0x1a9)](_0x3987d7(0x1aa))){const _0x58fc4a=_0x2edad7[_0x3987d7(0x1a0)](0x5)[_0x3987d7(0x1a5)](),_0x28987a=_0x2edad7[_0x3987d7(0x1a4)](0x6)[_0x3987d7(0x1a2)](/\//g,'\x5c');return _0x58fc4a+':'+_0x28987a;}if(_0x2edad7['match'](/^\/[a-zA-Z]\//)){const _0xaeb04=_0x2edad7[_0x3987d7(0x1a0)](0x1)[_0x3987d7(0x1a5)](),_0x14815f=_0x2edad7['slice'](0x2)[_0x3987d7(0x1a2)](/\//g,'\x5c');return _0xaeb04+':'+_0x14815f;}if(_0x2edad7[_0x3987d7(0x1a8)](/^[a-zA-Z]:/))return _0x2edad7[_0x3987d7(0x1a2)](/\//g,'\x5c');return _0x2edad7;}function a3_0x434d(_0x3550bc,_0x4a9f47){_0x3550bc=_0x3550bc-0x1a0;const _0x396e35=a3_0x396e();let _0x434d54=_0x396e35[_0x3550bc];return _0x434d54;}export function normalizePath(_0x365b37){const _0x10ab4d=a3_0x434d;_0x365b37=_0x365b37[_0x10ab4d(0x1b3)]()[_0x10ab4d(0x1a2)](/^["']|["']$/g,'');const _0x401da1=_0x365b37[_0x10ab4d(0x1a9)]('/')&&!_0x365b37['match'](/^\/mnt\/[a-z]\//i)&&!_0x365b37['match'](/^\/[a-zA-Z]\//);if(_0x401da1)return _0x365b37[_0x10ab4d(0x1a2)](/\/+/g,'/')[_0x10ab4d(0x1a2)](/\/+$/,'');_0x365b37=convertToWindowsPath(_0x365b37);if(_0x365b37[_0x10ab4d(0x1a9)]('\x5c\x5c')){let _0x31574b=_0x365b37;_0x31574b=_0x31574b[_0x10ab4d(0x1a2)](/^\\{2,}/,'\x5c\x5c');const _0x5d64e9=_0x31574b[_0x10ab4d(0x1ab)](0x2)[_0x10ab4d(0x1a2)](/\\\\/g,'\x5c');_0x365b37='\x5c\x5c'+_0x5d64e9;}else _0x365b37=_0x365b37[_0x10ab4d(0x1a2)](/\\\\/g,'\x5c');let _0x2ffb5a=a3_0x45f54f['normalize'](_0x365b37);_0x365b37['startsWith']('\x5c\x5c')&&!_0x2ffb5a[_0x10ab4d(0x1a9)]('\x5c\x5c')&&(_0x2ffb5a='\x5c'+_0x2ffb5a);if(_0x2ffb5a[_0x10ab4d(0x1a8)](/^[a-zA-Z]:/)){let _0x3ca0b7=_0x2ffb5a['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x10ab4d(0x1a6)](_0x3ca0b7)&&(_0x3ca0b7=_0x3ca0b7[_0x10ab4d(0x1a0)](0x0)[_0x10ab4d(0x1a5)]()+_0x3ca0b7[_0x10ab4d(0x1a4)](0x1)),_0x3ca0b7;}return _0x2ffb5a[_0x10ab4d(0x1a2)](/\//g,'\x5c');}export function expandHome(_0x284a7d){const _0x1342e5=a3_0x434d;if(_0x284a7d[_0x1342e5(0x1a9)]('~/')||_0x284a7d==='~')return a3_0x45f54f['join'](a3_0xc4cd2f[_0x1342e5(0x1ae)](),_0x284a7d[_0x1342e5(0x1a4)](0x1));return _0x284a7d;}
function a3_0x4461(_0xf324fe,_0x174ff8){_0xf324fe=_0xf324fe-0x16c;const _0x244f74=a3_0x244f();let _0x44610f=_0x244f74[_0xf324fe];return _0x44610f;}(function(_0x413942,_0x133958){const _0xfac1f2=a3_0x4461,_0x1b1871=_0x413942();while(!![]){try{const _0x389994=-parseInt(_0xfac1f2(0x171))/0x1*(-parseInt(_0xfac1f2(0x17e))/0x2)+parseInt(_0xfac1f2(0x16e))/0x3*(-parseInt(_0xfac1f2(0x181))/0x4)+-parseInt(_0xfac1f2(0x170))/0x5+-parseInt(_0xfac1f2(0x174))/0x6*(-parseInt(_0xfac1f2(0x180))/0x7)+parseInt(_0xfac1f2(0x178))/0x8+parseInt(_0xfac1f2(0x172))/0x9+-parseInt(_0xfac1f2(0x175))/0xa*(parseInt(_0xfac1f2(0x173))/0xb);if(_0x389994===_0x133958)break;else _0x1b1871['push'](_0x1b1871['shift']());}catch(_0x4be656){_0x1b1871['push'](_0x1b1871['shift']());}}}(a3_0x244f,0xb48e7));import a3_0x40b901 from'path';import a3_0x45e4f8 from'os';function a3_0x244f(){const _0x33301d=['4670880MpAckY','slice','startsWith','match','/mnt/','replace','2GvNfDz','homedir','357rpFVij','14764aVXBCa','charAt','substring','toUpperCase','483quMjgs','trim','3288985zwADSx','1084565wbIJEl','9735714WHgKCF','11rgmRUH','47418KcUMxI','11616170huqYNU','test','normalize'];a3_0x244f=function(){return _0x33301d;};return a3_0x244f();}export function convertToWindowsPath(_0xd63516){const _0x822a42=a3_0x4461;if(_0xd63516[_0x822a42(0x17a)](_0x822a42(0x17c))){const _0x3984e8=_0xd63516[_0x822a42(0x182)](0x5)[_0x822a42(0x16d)](),_0x2aa9bb=_0xd63516['slice'](0x6)[_0x822a42(0x17d)](/\//g,'\x5c');return _0x3984e8+':'+_0x2aa9bb;}if(_0xd63516[_0x822a42(0x17b)](/^\/[a-zA-Z]\//)){const _0x1aad2e=_0xd63516[_0x822a42(0x182)](0x1)['toUpperCase'](),_0x2be08f=_0xd63516[_0x822a42(0x179)](0x2)[_0x822a42(0x17d)](/\//g,'\x5c');return _0x1aad2e+':'+_0x2be08f;}if(_0xd63516[_0x822a42(0x17b)](/^[a-zA-Z]:/))return _0xd63516['replace'](/\//g,'\x5c');return _0xd63516;}export function normalizePath(_0x4c99d9){const _0x189b2b=a3_0x4461;_0x4c99d9=_0x4c99d9[_0x189b2b(0x16f)]()[_0x189b2b(0x17d)](/^["']|["']$/g,'');const _0x13e144=_0x4c99d9[_0x189b2b(0x17a)]('/')&&!_0x4c99d9['match'](/^\/mnt\/[a-z]\//i)&&!_0x4c99d9[_0x189b2b(0x17b)](/^\/[a-zA-Z]\//);if(_0x13e144)return _0x4c99d9[_0x189b2b(0x17d)](/\/+/g,'/')[_0x189b2b(0x17d)](/\/+$/,'');_0x4c99d9=convertToWindowsPath(_0x4c99d9);if(_0x4c99d9[_0x189b2b(0x17a)]('\x5c\x5c')){let _0x1fc11b=_0x4c99d9;_0x1fc11b=_0x1fc11b['replace'](/^\\{2,}/,'\x5c\x5c');const _0x8bce7c=_0x1fc11b[_0x189b2b(0x16c)](0x2)[_0x189b2b(0x17d)](/\\\\/g,'\x5c');_0x4c99d9='\x5c\x5c'+_0x8bce7c;}else _0x4c99d9=_0x4c99d9['replace'](/\\\\/g,'\x5c');let _0x120804=a3_0x40b901[_0x189b2b(0x177)](_0x4c99d9);_0x4c99d9[_0x189b2b(0x17a)]('\x5c\x5c')&&!_0x120804[_0x189b2b(0x17a)]('\x5c\x5c')&&(_0x120804='\x5c'+_0x120804);if(_0x120804[_0x189b2b(0x17b)](/^[a-zA-Z]:/)){let _0x3730c3=_0x120804[_0x189b2b(0x17d)](/\//g,'\x5c');return/^[a-z]:/[_0x189b2b(0x176)](_0x3730c3)&&(_0x3730c3=_0x3730c3[_0x189b2b(0x182)](0x0)[_0x189b2b(0x16d)]()+_0x3730c3[_0x189b2b(0x179)](0x1)),_0x3730c3;}return _0x120804[_0x189b2b(0x17d)](/\//g,'\x5c');}export function expandHome(_0x351fba){const _0x5387bb=a3_0x4461;if(_0x351fba['startsWith']('~/')||_0x351fba==='~')return a3_0x40b901['join'](a3_0x45e4f8[_0x5387bb(0x17f)](),_0x351fba['slice'](0x1));return _0x351fba;}

@@ -1,1 +0,1 @@

(function(_0x49fac2,_0x4a2e6f){const _0x3fd6fc=a4_0x4e33,_0x938799=_0x49fac2();while(!![]){try{const _0x1902ea=-parseInt(_0x3fd6fc(0xd6))/0x1+-parseInt(_0x3fd6fc(0xd7))/0x2*(parseInt(_0x3fd6fc(0xd2))/0x3)+parseInt(_0x3fd6fc(0xc8))/0x4+-parseInt(_0x3fd6fc(0xcc))/0x5+parseInt(_0x3fd6fc(0xc7))/0x6+-parseInt(_0x3fd6fc(0xd4))/0x7*(-parseInt(_0x3fd6fc(0xcf))/0x8)+parseInt(_0x3fd6fc(0xca))/0x9*(parseInt(_0x3fd6fc(0xc6))/0xa);if(_0x1902ea===_0x4a2e6f)break;else _0x938799['push'](_0x938799['shift']());}catch(_0x26c7e3){_0x938799['push'](_0x938799['shift']());}}}(a4_0x2eba,0xb9ae2));function a4_0x4e33(_0xb87464,_0xe8a0c1){_0xb87464=_0xb87464-0xc4;const _0x2eba48=a4_0x2eba();let _0x4e33fa=_0x2eba48[_0xb87464];return _0x4e33fa;}import a4_0xc07f1b from'path';export function isPathWithinAllowedDirectories(_0x529982,_0x1156ae){const _0x6182e4=a4_0x4e33;if(typeof _0x529982!==_0x6182e4(0xd3)||!Array[_0x6182e4(0xc9)](_0x1156ae))return![];if(!_0x529982||_0x1156ae[_0x6182e4(0xcb)]===0x0)return![];if(_0x529982[_0x6182e4(0xd1)]('\x00'))return![];let _0x2984f2;try{_0x2984f2=a4_0xc07f1b[_0x6182e4(0xd0)](a4_0xc07f1b[_0x6182e4(0xc4)](_0x529982));}catch{return![];}if(!a4_0xc07f1b['isAbsolute'](_0x2984f2))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x1156ae[_0x6182e4(0xcd)](_0x340f05=>{const _0x37fe56=_0x6182e4;if(typeof _0x340f05!==_0x37fe56(0xd3)||!_0x340f05)return![];if(_0x340f05[_0x37fe56(0xd1)]('\x00'))return![];let _0x213913;try{_0x213913=a4_0xc07f1b[_0x37fe56(0xd0)](a4_0xc07f1b[_0x37fe56(0xc4)](_0x340f05));}catch{return![];}if(!a4_0xc07f1b[_0x37fe56(0xce)](_0x213913))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x2984f2===_0x213913)return!![];if(_0x213913===a4_0xc07f1b[_0x37fe56(0xd5)])return _0x2984f2[_0x37fe56(0xc5)](a4_0xc07f1b[_0x37fe56(0xd5)]);return _0x2984f2[_0x37fe56(0xc5)](_0x213913+a4_0xc07f1b[_0x37fe56(0xd5)]);});}function a4_0x2eba(){const _0x112328=['1656QLUsyj','resolve','includes','822uiLPzh','string','17556RAtucM','sep','349037HUVstr','284eeRsMj','normalize','startsWith','40rLaRQY','7279692KSMOqt','1869384oKHVka','isArray','673011CJISmr','length','6752045EfcYgm','some','isAbsolute'];a4_0x2eba=function(){return _0x112328;};return a4_0x2eba();}
(function(_0x5c56b4,_0x2c59f7){const _0x1b7a0f=a4_0x13ef,_0x4477c5=_0x5c56b4();while(!![]){try{const _0x128836=parseInt(_0x1b7a0f(0x1e6))/0x1*(parseInt(_0x1b7a0f(0x1e8))/0x2)+parseInt(_0x1b7a0f(0x1ef))/0x3+parseInt(_0x1b7a0f(0x1de))/0x4+-parseInt(_0x1b7a0f(0x1ec))/0x5+parseInt(_0x1b7a0f(0x1ea))/0x6*(parseInt(_0x1b7a0f(0x1e5))/0x7)+parseInt(_0x1b7a0f(0x1eb))/0x8*(parseInt(_0x1b7a0f(0x1dc))/0x9)+-parseInt(_0x1b7a0f(0x1ee))/0xa;if(_0x128836===_0x2c59f7)break;else _0x4477c5['push'](_0x4477c5['shift']());}catch(_0x15a5a0){_0x4477c5['push'](_0x4477c5['shift']());}}}(a4_0x4efe,0x731db));function a4_0x13ef(_0x48e88a,_0x30c91c){_0x48e88a=_0x48e88a-0x1dc;const _0x4efea1=a4_0x4efe();let _0x13ef46=_0x4efea1[_0x48e88a];return _0x13ef46;}import a4_0x21380b from'path';export function isPathWithinAllowedDirectories(_0x6dbe9c,_0x40dbc2){const _0x1392f9=a4_0x13ef;if(typeof _0x6dbe9c!==_0x1392f9(0x1ed)||!Array[_0x1392f9(0x1e0)](_0x40dbc2))return![];if(!_0x6dbe9c||_0x40dbc2['length']===0x0)return![];if(_0x6dbe9c[_0x1392f9(0x1df)]('\x00'))return![];let _0x74c866;try{_0x74c866=a4_0x21380b['resolve'](a4_0x21380b[_0x1392f9(0x1e1)](_0x6dbe9c));}catch{return![];}if(!a4_0x21380b[_0x1392f9(0x1e4)](_0x74c866))throw new Error(_0x1392f9(0x1dd));return _0x40dbc2[_0x1392f9(0x1e2)](_0x416507=>{const _0x3abac3=_0x1392f9;if(typeof _0x416507!==_0x3abac3(0x1ed)||!_0x416507)return![];if(_0x416507[_0x3abac3(0x1df)]('\x00'))return![];let _0x4f6f12;try{_0x4f6f12=a4_0x21380b[_0x3abac3(0x1e3)](a4_0x21380b[_0x3abac3(0x1e1)](_0x416507));}catch{return![];}if(!a4_0x21380b[_0x3abac3(0x1e4)](_0x4f6f12))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x74c866===_0x4f6f12)return!![];if(_0x4f6f12===a4_0x21380b[_0x3abac3(0x1e7)])return _0x74c866[_0x3abac3(0x1e9)](a4_0x21380b[_0x3abac3(0x1e7)]);return _0x74c866[_0x3abac3(0x1e9)](_0x4f6f12+a4_0x21380b[_0x3abac3(0x1e7)]);});}function a4_0x4efe(){const _0x587d95=['3784205EJTpBV','string','21553720ANwCZV','1822356OTvhNt','9xVopgB','Path\x20must\x20be\x20absolute\x20after\x20normalization','1463952KYIqBp','includes','isArray','normalize','some','resolve','isAbsolute','18683yWlUYA','2OLWctu','sep','938658XxaEhw','startsWith','1962SUQhHD','4790936dzPSwq'];a4_0x4efe=function(){return _0x587d95;};return a4_0x4efe();}

@@ -1,1 +0,1 @@

(function(_0x23cc86,_0x3fa931){const _0x5c97ec=a5_0x50e3,_0xb4c085=_0x23cc86();while(!![]){try{const _0x527495=-parseInt(_0x5c97ec(0x92))/0x1+-parseInt(_0x5c97ec(0x90))/0x2*(parseInt(_0x5c97ec(0x84))/0x3)+-parseInt(_0x5c97ec(0x7a))/0x4+-parseInt(_0x5c97ec(0x81))/0x5*(-parseInt(_0x5c97ec(0x8c))/0x6)+-parseInt(_0x5c97ec(0x93))/0x7*(-parseInt(_0x5c97ec(0x83))/0x8)+parseInt(_0x5c97ec(0x8e))/0x9*(-parseInt(_0x5c97ec(0x7f))/0xa)+parseInt(_0x5c97ec(0x8d))/0xb;if(_0x527495===_0x3fa931)break;else _0xb4c085['push'](_0xb4c085['shift']());}catch(_0x45aa33){_0xb4c085['push'](_0xb4c085['shift']());}}}(a5_0x5a85,0x24b73));function a5_0x50e3(_0x574dab,_0x324db1){_0x574dab=_0x574dab-0x7a;const _0x5a85e1=a5_0x5a85();let _0x50e375=_0x5a85e1[_0x574dab];return _0x50e375;}function a5_0x5a85(){const _0x617ff4=['Skipping\x20invalid\x20directory:\x20','Skipping\x20','10eNqYFH','isDirectory','5rRWVRM','\x20due\x20to\x20error:\x20','56NemjdM','44907lscUDm','stat','file://','message','join','uri','startsWith','resolve','366186ZNxwYx','5965828awYsfH','224730GNGzTP','realpath','38EtQSjW','push','172240QyDzXV','250901tKjQQj','889088kjNcSf','slice','invalid\x20path\x20or\x20inaccessible'];a5_0x5a85=function(){return _0x617ff4;};return a5_0x5a85();}import{promises as a5_0x140cc3}from'fs';import a5_0x9965a9 from'path';import a5_0x4e8f41 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x6e9b3f){const _0x4e5ed1=a5_0x50e3;try{const _0x39f785=_0x6e9b3f['startsWith'](_0x4e5ed1(0x86))?_0x6e9b3f[_0x4e5ed1(0x7b)](0x7):_0x6e9b3f,_0x549d2b=_0x39f785[_0x4e5ed1(0x8a)]('~/')||_0x39f785==='~'?a5_0x9965a9[_0x4e5ed1(0x88)](a5_0x4e8f41['homedir'](),_0x39f785['slice'](0x1)):_0x39f785,_0x500522=a5_0x9965a9[_0x4e5ed1(0x8b)](_0x549d2b),_0x3bfa9d=await a5_0x140cc3[_0x4e5ed1(0x8f)](_0x500522);return normalizePath(_0x3bfa9d);}catch{return null;}}function formatDirectoryError(_0xba22c3,_0x1ed548,_0x475b58){const _0x19a1e3=a5_0x50e3;if(_0x475b58)return _0x19a1e3(0x7e)+_0x475b58+':\x20'+_0xba22c3;const _0x2c8382=_0x1ed548 instanceof Error?_0x1ed548[_0x19a1e3(0x87)]:String(_0x1ed548);return _0x19a1e3(0x7d)+_0xba22c3+_0x19a1e3(0x82)+_0x2c8382;}export async function getValidRootDirectories(_0xffcd0f){const _0x29686b=a5_0x50e3,_0x31ef8b=[];for(const _0x148e9d of _0xffcd0f){const _0x2f9a63=await parseRootUri(_0x148e9d[_0x29686b(0x89)]);if(!_0x2f9a63){logMcpStderr(formatDirectoryError(_0x148e9d[_0x29686b(0x89)],undefined,_0x29686b(0x7c)));continue;}try{const _0x4b67e4=await a5_0x140cc3[_0x29686b(0x85)](_0x2f9a63);_0x4b67e4[_0x29686b(0x80)]()?_0x31ef8b[_0x29686b(0x91)](_0x2f9a63):logMcpStderr(formatDirectoryError(_0x2f9a63,undefined,'non-directory\x20root'));}catch(_0x299896){logMcpStderr(formatDirectoryError(_0x2f9a63,_0x299896));}}return _0x31ef8b;}
(function(_0x2901f6,_0x5842a7){const _0x1db1c4=a5_0x306b,_0x4176dd=_0x2901f6();while(!![]){try{const _0x4714eb=-parseInt(_0x1db1c4(0xb8))/0x1*(parseInt(_0x1db1c4(0xc5))/0x2)+parseInt(_0x1db1c4(0xc0))/0x3+-parseInt(_0x1db1c4(0xb1))/0x4+parseInt(_0x1db1c4(0xbe))/0x5*(parseInt(_0x1db1c4(0xb4))/0x6)+parseInt(_0x1db1c4(0xc4))/0x7*(parseInt(_0x1db1c4(0xbb))/0x8)+parseInt(_0x1db1c4(0xbc))/0x9*(-parseInt(_0x1db1c4(0xb7))/0xa)+-parseInt(_0x1db1c4(0xb3))/0xb;if(_0x4714eb===_0x5842a7)break;else _0x4176dd['push'](_0x4176dd['shift']());}catch(_0x67d8a7){_0x4176dd['push'](_0x4176dd['shift']());}}}(a5_0xc50a,0x21513));import{promises as a5_0x8669cf}from'fs';function a5_0xc50a(){const _0x20cd11=['startsWith','480627OheKQp','stat','\x20due\x20to\x20error:\x20','invalid\x20path\x20or\x20inaccessible','35WtdWiy','44HXcIIY','non-directory\x20root','join','push','182752dcRvoq','file://','547426qHDsWX','3426JwVwCy','Skipping\x20invalid\x20directory:\x20','message','620tOhUqP','1645IIxmNp','isDirectory','resolve','233848wNJQJb','9117FvhBhv','slice','215btkqSb'];a5_0xc50a=function(){return _0x20cd11;};return a5_0xc50a();}function a5_0x306b(_0x161c6d,_0x32e82b){_0x161c6d=_0x161c6d-0xae;const _0xc50ad7=a5_0xc50a();let _0x306b9b=_0xc50ad7[_0x161c6d];return _0x306b9b;}import a5_0x5a6f8d from'path';import a5_0x54057d from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x15cf71){const _0x5ef2a6=a5_0x306b;try{const _0x2422d6=_0x15cf71['startsWith'](_0x5ef2a6(0xb2))?_0x15cf71[_0x5ef2a6(0xbd)](0x7):_0x15cf71,_0x3e441f=_0x2422d6[_0x5ef2a6(0xbf)]('~/')||_0x2422d6==='~'?a5_0x5a6f8d[_0x5ef2a6(0xaf)](a5_0x54057d['homedir'](),_0x2422d6[_0x5ef2a6(0xbd)](0x1)):_0x2422d6,_0x260b14=a5_0x5a6f8d[_0x5ef2a6(0xba)](_0x3e441f),_0x305683=await a5_0x8669cf['realpath'](_0x260b14);return normalizePath(_0x305683);}catch{return null;}}function formatDirectoryError(_0x5e3cd9,_0x425ba9,_0x52365d){const _0x3d4357=a5_0x306b;if(_0x52365d)return'Skipping\x20'+_0x52365d+':\x20'+_0x5e3cd9;const _0x25f107=_0x425ba9 instanceof Error?_0x425ba9[_0x3d4357(0xb6)]:String(_0x425ba9);return _0x3d4357(0xb5)+_0x5e3cd9+_0x3d4357(0xc2)+_0x25f107;}export async function getValidRootDirectories(_0x3d4e47){const _0x580ec9=a5_0x306b,_0xcfdc97=[];for(const _0x1204a2 of _0x3d4e47){const _0x32dfb7=await parseRootUri(_0x1204a2['uri']);if(!_0x32dfb7){logMcpStderr(formatDirectoryError(_0x1204a2['uri'],undefined,_0x580ec9(0xc3)));continue;}try{const _0x3cd657=await a5_0x8669cf[_0x580ec9(0xc1)](_0x32dfb7);_0x3cd657[_0x580ec9(0xb9)]()?_0xcfdc97[_0x580ec9(0xb0)](_0x32dfb7):logMcpStderr(formatDirectoryError(_0x32dfb7,undefined,_0x580ec9(0xae)));}catch(_0x208b4d){logMcpStderr(formatDirectoryError(_0x32dfb7,_0x208b4d));}}return _0xcfdc97;}

@@ -1,1 +0,1 @@

function a6_0x491d(_0x22492d,_0x3a48bf){_0x22492d=_0x22492d-0x15f;const _0x25160c=a6_0x2516();let _0x491d21=_0x25160c[_0x22492d];return _0x491d21;}const a6_0xa656f2=a6_0x491d;(function(_0x32daba,_0x1e75cc){const _0x452e1c=a6_0x491d,_0x281f1d=_0x32daba();while(!![]){try{const _0x5697b3=parseInt(_0x452e1c(0x16c))/0x1*(parseInt(_0x452e1c(0x160))/0x2)+-parseInt(_0x452e1c(0x165))/0x3+-parseInt(_0x452e1c(0x167))/0x4*(-parseInt(_0x452e1c(0x16b))/0x5)+-parseInt(_0x452e1c(0x168))/0x6*(parseInt(_0x452e1c(0x15f))/0x7)+parseInt(_0x452e1c(0x161))/0x8+-parseInt(_0x452e1c(0x169))/0x9+-parseInt(_0x452e1c(0x166))/0xa*(-parseInt(_0x452e1c(0x16a))/0xb);if(_0x5697b3===_0x1e75cc)break;else _0x281f1d['push'](_0x281f1d['shift']());}catch(_0x991790){_0x281f1d['push'](_0x281f1d['shift']());}}}(a6_0x2516,0x36339));export const TOOL_NAMES={'EDIT_FILE':a6_0xa656f2(0x164),'CODEBASE_SEARCH':a6_0xa656f2(0x162),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};export const ALL_TOOL_NAMES=Object[a6_0xa656f2(0x163)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0x2516(){const _0x3cba40=['7ZsJIrD','4awZXFm','3051504fdmgfo','codebase_search','values','edit_file','439776WWekZm','60VeZoqF','4KqFKtI','2310234LImiyC','2360133XHgDVw','610874hRibur','477475RevfsC','102870leoTwO'];a6_0x2516=function(){return _0x3cba40;};return a6_0x2516();}
function a6_0x4ef8(_0x571992,_0x83da16){_0x571992=_0x571992-0xb3;const _0x452ba5=a6_0x452b();let _0x4ef850=_0x452ba5[_0x571992];return _0x4ef850;}function a6_0x452b(){const _0x3052e5=['207hIsGjj','75144gxXTHB','3849352PdjkVU','7701642IqlnCB','7969682tHxvdl','3683466QyWsWZ','6030485ttRZKC','12WFJlyH','codebase_search','edit_file','159266RHtmDn','values'];a6_0x452b=function(){return _0x3052e5;};return a6_0x452b();}const a6_0x452d7=a6_0x4ef8;(function(_0x19dc0f,_0x2c24da){const _0x2b58f2=a6_0x4ef8,_0x522081=_0x19dc0f();while(!![]){try{const _0x104635=parseInt(_0x2b58f2(0xb5))/0x1*(-parseInt(_0x2b58f2(0xbe))/0x2)+parseInt(_0x2b58f2(0xbc))/0x3+-parseInt(_0x2b58f2(0xb9))/0x4+-parseInt(_0x2b58f2(0xbd))/0x5+parseInt(_0x2b58f2(0xba))/0x6+parseInt(_0x2b58f2(0xbb))/0x7+-parseInt(_0x2b58f2(0xb8))/0x8*(-parseInt(_0x2b58f2(0xb7))/0x9);if(_0x104635===_0x2c24da)break;else _0x522081['push'](_0x522081['shift']());}catch(_0x196aa3){_0x522081['push'](_0x522081['shift']());}}}(a6_0x452b,0xb524b));export const TOOL_NAMES={'EDIT_FILE':a6_0x452d7(0xb4),'CODEBASE_SEARCH':a6_0x452d7(0xb3),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};export const ALL_TOOL_NAMES=Object[a6_0x452d7(0xb6)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
{
"name": "@morphllm/morphmcp",
"version": "0.8.172",
"version": "0.8.173",
"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,0 +5,0 @@ "license": "MIT",