@morphllm/morphmcp 0.8.216 → 0.8.218

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x2e0658=a0_0x2d0d;(function(_0x4299b5,_0x40d082){const _0x4fdd8e=a0_0x2d0d,_0x475476=_0x4299b5();while(!![]){try{const _0x6ebabb=parseInt(_0x4fdd8e(0x22d))/0x1+parseInt(_0x4fdd8e(0x193))/0x2+-parseInt(_0x4fdd8e(0x1ec))/0x3*(-parseInt(_0x4fdd8e(0x162))/0x4)+-parseInt(_0x4fdd8e(0x130))/0x5*(parseInt(_0x4fdd8e(0x227))/0x6)+-parseInt(_0x4fdd8e(0x1ac))/0x7*(parseInt(_0x4fdd8e(0x15c))/0x8)+-parseInt(_0x4fdd8e(0x139))/0x9+-parseInt(_0x4fdd8e(0x1fd))/0xa*(-parseInt(_0x4fdd8e(0x1ed))/0xb);if(_0x6ebabb===_0x40d082)break;else _0x475476['push'](_0x475476['shift']());}catch(_0x4982b2){_0x475476['push'](_0x475476['shift']());}}}(a0_0x56da,0x9d2d6));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_0x2398e1 from'fs/promises';import a0_0x5d8d1f from'path';import a0_0x147f88 from'os';import{createRequire}from'module';function a0_0x2d0d(_0x54598b,_0x327546){_0x54598b=_0x54598b-0x106;const _0x56da03=a0_0x56da();let _0x2d0d8c=_0x56da03[_0x54598b];return _0x2d0d8c;}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_0x1ff3a1 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES,resolveToolFilter}from'./tool-definitions.js';function fixPathRepetition(_0xa43b75){const _0x1c053e=a0_0x2d0d,_0x2f0094=_0xa43b75[_0x1c053e(0x1d4)](a0_0x5d8d1f[_0x1c053e(0x116)])[_0x1c053e(0x209)](Boolean);if(_0x2f0094[_0x1c053e(0x1ef)]<0x2)return null;for(let _0x4701eb=Math[_0x1c053e(0x164)](_0x2f0094[_0x1c053e(0x1ef)]/0x2);_0x4701eb>=0x1;_0x4701eb--){for(let _0x4afeaf=0x0;_0x4afeaf<=_0x2f0094[_0x1c053e(0x1ef)]-0x2*_0x4701eb;_0x4afeaf++){const _0x813f6e=_0x2f0094[_0x1c053e(0x17a)](_0x4afeaf,_0x4afeaf+_0x4701eb),_0x39fe2e=_0x2f0094[_0x1c053e(0x17a)](_0x4afeaf+_0x4701eb,_0x4afeaf+0x2*_0x4701eb);if(_0x813f6e[_0x1c053e(0x110)]((_0x4eafbb,_0x2b1765)=>_0x4eafbb===_0x39fe2e[_0x2b1765])){const _0x210683=[..._0x2f0094[_0x1c053e(0x17a)](0x0,_0x4afeaf),..._0x2f0094[_0x1c053e(0x17a)](_0x4afeaf+_0x4701eb)];return a0_0x5d8d1f[_0x1c053e(0x116)]+_0x210683[_0x1c053e(0x1fc)](a0_0x5d8d1f[_0x1c053e(0x116)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x42fa9b=a0_0x2d0d;try{const _0x54a78d=require(_0x42fa9b(0x223));return _0x54a78d['version']??_0x42fa9b(0x117);}catch(_0x2bf7af){return logMcpStderr(_0x42fa9b(0x186),_0x2bf7af),_0x42fa9b(0x117);}}function printHelp(){const _0x4507ec=a0_0x2d0d;console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x4507ec(0x1c3)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console['log'](_0x4507ec(0x21b)),console[_0x4507ec(0x1c3)](_0x4507ec(0x1dd)),console[_0x4507ec(0x1c3)](_0x4507ec(0x148)),console[_0x4507ec(0x1c3)](_0x4507ec(0x12c)),console['log'](_0x4507ec(0x16f)),console['log'](_0x4507ec(0x156)),console[_0x4507ec(0x1c3)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x2e0658(0x189)][a0_0x2e0658(0x17a)](0x2),VERSION_FLAGS=new Set([a0_0x2e0658(0x1db),'-v','-V']),HELP_FLAGS=new Set([a0_0x2e0658(0x1e5),'-h']);cliArgs[a0_0x2e0658(0x1bb)](_0x2e0bbb=>VERSION_FLAGS[a0_0x2e0658(0x22e)](_0x2e0bbb))&&(console[a0_0x2e0658(0x1c3)](a0_0x2e0658(0x18d)+getPackageVersion()),process[a0_0x2e0658(0x108)](0x0));cliArgs['some'](_0x499698=>HELP_FLAGS[a0_0x2e0658(0x22e)](_0x499698))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x27cef2){const _0x2d7e88=a0_0x2e0658;for(let _0x3537d6=0x0;_0x3537d6<cliArgs[_0x2d7e88(0x1ef)];_0x3537d6++){const _0x5a67fc=cliArgs[_0x3537d6];if(_0x5a67fc[_0x2d7e88(0x1f6)]('--'+_0x27cef2+'='))return _0x5a67fc[_0x2d7e88(0x17a)](('--'+_0x27cef2+'=')[_0x2d7e88(0x1ef)]);if(_0x5a67fc==='--'+_0x27cef2&&_0x3537d6+0x1<cliArgs['length'])return cliArgs[_0x3537d6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x2e0658(0x1ef)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x2e0658(0x22e)](arg)||HELP_FLAGS['has'](arg))continue;if(arg[a0_0x2e0658(0x1f6)](a0_0x2e0658(0x1c9)))continue;if(arg===a0_0x2e0658(0x1aa)){i++;continue;}args[a0_0x2e0658(0x16d)](arg);}const WORKSPACE_ROOT=process[a0_0x2e0658(0x1cf)][a0_0x2e0658(0x17c)]||process['env'][a0_0x2e0658(0x216)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x2e0658(0x1cf)][a0_0x2e0658(0x1f9)]!==a0_0x2e0658(0x208),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x2e0658(0x1cf)][a0_0x2e0658(0x16e)],MORPH_API_URL=process[a0_0x2e0658(0x1cf)][a0_0x2e0658(0x151)],MORPH_LARGE_APPLY=process[a0_0x2e0658(0x1cf)][a0_0x2e0658(0x185)]!==a0_0x2e0658(0x208),MORPH_WARP_GREP_TIMEOUT=process[a0_0x2e0658(0x1cf)][a0_0x2e0658(0x218)]?parseInt(process[a0_0x2e0658(0x1cf)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),TOOL_FILTER=resolveToolFilter(process[a0_0x2e0658(0x1cf)]),DISABLED_TOOLS=TOOL_FILTER[a0_0x2e0658(0x1ff)];for(const tool of TOOL_FILTER['unknown']){console[a0_0x2e0658(0x12a)](a0_0x2e0658(0x182)+tool+a0_0x2e0658(0x134)+[...KNOWN_TOOL_NAMES][a0_0x2e0658(0x1fc)](',\x20'));}DISABLED_TOOLS[a0_0x2e0658(0x1c7)]>0x0&&console[a0_0x2e0658(0x12a)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x2e0658(0x1fc)](',\x20'));MORPH_API_KEY&&!MORPH_API_KEY[a0_0x2e0658(0x1f6)](a0_0x2e0658(0x220))&&!MORPH_API_KEY[a0_0x2e0658(0x1f6)]('morph-')&&logMcpStderr(a0_0x2e0658(0x126));async function reportMorphError(_0x33a5a6){const _0x222901=a0_0x2e0658;try{await a0_0x1ff3a1[_0x222901(0x1e2)](_0x222901(0x15f),{..._0x33a5a6,'timestamp':new Date()['toISOString'](),'source':_0x33a5a6[_0x222901(0x145)]||_0x222901(0x194),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x33a5a6[_0x222901(0x146)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x222901(0x1a1)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1ba53c,_0x455b5d){const _0x2674ae=a0_0x2e0658;if(_0x1ba53c&&typeof _0x1ba53c==='object'&&_0x2674ae(0x21e)in _0x1ba53c)return _0x1ba53c[_0x2674ae(0x21e)];if(_0x1ba53c&&typeof _0x1ba53c===_0x2674ae(0x118)&&'response'in _0x1ba53c)return _0x1ba53c[_0x2674ae(0x167)]?.[_0x2674ae(0x21e)];const _0x2572da=_0x455b5d[_0x2674ae(0x157)](/\b(401|429)\b/);return _0x2572da?parseInt(_0x2572da[0x1],0xa):null;}function handleMorphAPIError(_0x58893e){const _0x366eec=a0_0x2e0658,_0xce6b68=_0x58893e instanceof Error?_0x58893e[_0x366eec(0x230)]:String(_0x58893e),_0x363572=extractStatusCode(_0x58893e,_0xce6b68);switch(_0x363572){case 0x191:return{'content':[{'type':_0x366eec(0x16a),'text':'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.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x366eec(0x16a),'text':_0x366eec(0x233)}],'isError':!![]};default:return null;}}args[a0_0x2e0658(0x1ef)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x2e0658(0x22f)),logMcpStderr(a0_0x2e0658(0x19d)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),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(a0_0x2e0658(0x1f0)));function normalizePath(_0x448440){const _0x265c07=a0_0x2e0658;return a0_0x5d8d1f[_0x265c07(0x16c)](_0x448440);}function expandHome(_0x5336af){const _0x2c27fd=a0_0x2e0658;if(_0x5336af[_0x2c27fd(0x1f6)]('~/')||_0x5336af==='~')return a0_0x5d8d1f[_0x2c27fd(0x1fc)](a0_0x147f88[_0x2c27fd(0x197)](),_0x5336af[_0x2c27fd(0x17a)](0x1));return _0x5336af;}let allowedDirectories=await Promise[a0_0x2e0658(0x1d9)](args[a0_0x2e0658(0x234)](async _0x432ffb=>{const _0xf57234=a0_0x2e0658,_0x29237b=expandHome(_0x432ffb),_0x53020f=a0_0x5d8d1f[_0xf57234(0x155)](_0x29237b);try{const _0x3f0f2f=await a0_0x2398e1[_0xf57234(0x18e)](_0x53020f);return normalizePath(_0x3f0f2f);}catch(_0x39cf27){return normalizePath(_0x53020f);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x2e0658(0x1ef)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x2e0658(0x16d)](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x2e0658(0x1b7)));}catch(a0_0x22aced){logMcpStderr(a0_0x2e0658(0x11f)+a0_0x22aced);}async function detectWorkspaceRoot(_0x30e0b6){const _0x4826ff=a0_0x2e0658;let _0x1a7455=a0_0x5d8d1f[_0x4826ff(0x155)](_0x30e0b6);const _0xcd234c=[_0x4826ff(0x1dc),_0x4826ff(0x18a),'package.json',_0x4826ff(0x1f5),_0x4826ff(0x1d2),_0x4826ff(0x160),'.cursor',_0x4826ff(0x1cc),'composer.json'];while(_0x1a7455!==a0_0x5d8d1f[_0x4826ff(0x22b)](_0x1a7455)){for(const _0x44b6e6 of _0xcd234c){const _0x3df744=a0_0x5d8d1f[_0x4826ff(0x1fc)](_0x1a7455,_0x44b6e6);try{return await a0_0x2398e1[_0x4826ff(0x136)](_0x3df744),normalizePath(_0x1a7455);}catch{}}_0x1a7455=a0_0x5d8d1f[_0x4826ff(0x22b)](_0x1a7455);}return normalizePath(_0x30e0b6);}await Promise[a0_0x2e0658(0x1d9)](args[a0_0x2e0658(0x234)](async _0x20b989=>{const _0xe3f119=a0_0x2e0658;try{const _0x40b630=await a0_0x2398e1['stat'](expandHome(_0x20b989));!_0x40b630[_0xe3f119(0x10b)]()&&(logMcpStderr(_0xe3f119(0x178)+_0x20b989+_0xe3f119(0x111)),process[_0xe3f119(0x108)](0x1));}catch(_0x57cde9){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x20b989+':',_0x57cde9),process[_0xe3f119(0x108)](0x1);}}));async function validatePath(_0x538c50){const _0x9b03f7=a0_0x2e0658,_0x470577=expandHome(_0x538c50),_0x5181bc=a0_0x5d8d1f[_0x9b03f7(0x155)](_0x470577);logger[_0x9b03f7(0x1d5)](_0x9b03f7(0x210),_0x9b03f7(0x1a5),{'raw_path':_0x538c50,'absolute':_0x5181bc});try{const _0x1e5f19=await a0_0x2398e1[_0x9b03f7(0x18e)](_0x5181bc);return logger[_0x9b03f7(0x1d5)](_0x9b03f7(0x210),'path_validation_resolved',{'resolved':_0x1e5f19,'symlink':_0x1e5f19!==_0x5181bc}),_0x1e5f19;}catch(_0xb7e609){if(_0xb7e609[_0x9b03f7(0x1fe)]===_0x9b03f7(0x1e4)){const _0xa8aadf=a0_0x5d8d1f[_0x9b03f7(0x22b)](_0x5181bc);try{const _0x2e16df=await a0_0x2398e1[_0x9b03f7(0x18e)](_0xa8aadf),_0xdc4956=a0_0x5d8d1f['join'](_0x2e16df,a0_0x5d8d1f[_0x9b03f7(0x161)](_0x5181bc));return logger['debug'](_0x9b03f7(0x210),'path_validation_resolved',{'resolved':_0xdc4956,'new_file':!![]}),_0xdc4956;}catch{logger[_0x9b03f7(0x12a)]('MCP',_0x9b03f7(0x207),{'raw_path':_0x538c50,'error':_0x9b03f7(0x132)+_0xa8aadf});throw new Error(_0x9b03f7(0x132)+_0xa8aadf);}}logger[_0x9b03f7(0x12a)](_0x9b03f7(0x210),_0x9b03f7(0x207),{'raw_path':_0x538c50,'error':_0xb7e609[_0x9b03f7(0x230)]});throw _0xb7e609;}}const MorphEditFileArgsSchema=z['object']({'path':z['string'](),'code_edit':z[a0_0x2e0658(0x1c0)]()[a0_0x2e0658(0x150)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x2e0658(0x1c0)]()['describe'](a0_0x2e0658(0x114)),'dryRun':z[a0_0x2e0658(0x21a)]()[a0_0x2e0658(0x1e7)](![])[a0_0x2e0658(0x150)](a0_0x2e0658(0x20c))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x2e0658(0x18c),WarpGrepArgsSchema=z[a0_0x2e0658(0x118)]({'search_string':z[a0_0x2e0658(0x1c0)]()[a0_0x2e0658(0x150)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()['describe'](a0_0x2e0658(0x1de)),'search_type':z[a0_0x2e0658(0x219)]([a0_0x2e0658(0x1e7),a0_0x2e0658(0x10f)])[a0_0x2e0658(0x21f)]()[a0_0x2e0658(0x150)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x2e0658(0x118)]({'search_string':z['string']()[a0_0x2e0658(0x150)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x2e0658(0x1c0)]()[a0_0x2e0658(0x21f)]()['describe'](a0_0x2e0658(0x1c8)),'owner_repo':z['string']()[a0_0x2e0658(0x21f)]()[a0_0x2e0658(0x150)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z['string']()[a0_0x2e0658(0x21f)]()['describe'](a0_0x2e0658(0x12d))}),CodebaseSearchArgsSchema=z[a0_0x2e0658(0x118)]({'query':z[a0_0x2e0658(0x1c0)]()[a0_0x2e0658(0x150)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x2e0658(0x1c0)]()[a0_0x2e0658(0x150)](a0_0x2e0658(0x165)),'branch':z[a0_0x2e0658(0x1c0)]()['optional']()[a0_0x2e0658(0x150)](a0_0x2e0658(0x217)),'commitHash':z['string']()[a0_0x2e0658(0x21f)]()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x2e0658(0x143)](z[a0_0x2e0658(0x1c0)]())['default']([])[a0_0x2e0658(0x150)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()['optional']()[a0_0x2e0658(0x1e7)](0xa)['describe'](a0_0x2e0658(0x120))}),server=new Server({'name':'morph-mcp','version':a0_0x2e0658(0x13f)},{'capabilities':{'tools':{}}});function a0_0x56da(){const _0xa82cf8=['lines','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','Failed\x20to\x20request\x20roots\x20from\x20client:','indexOf','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','error','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','read','github_codebase_search','100515liNYgv','connect','Parent\x20directory\x20does\x20not\x20exist:\x20','role','\x22.\x20Known\x20tools:\x20','Tool\x20','access','isArray','command','4061475lUObZB',',\x20removed\x20','Applied','[could\x20not\x20read\x20file:\x20','readFile','timings','0.2.0','instruction','searchGitHub','TimeoutError','array','content','source','context','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','\x20(new\x20file)','user','Here\x20is\x20the\x20content\x20of\x20files:\x0a','-\x20Listed\x20directory\x20`','linesAdded','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','-\x20Glob\x20search\x20`','describe','MORPH_API_URL','stringify','morph-v3-large','grep_search','resolve','\x20\x20morph-mcp','match','includes','ms.\x20Success:\x20','stack','grep\x20\x27','109616nbqdaS','metadata','`\x20in\x20`','https://morphllm.com/api/error-report','go.mod','basename','4wtXZJz','Warning:\x20','floor','Repository\x20identifier','CODEBASE_SEARCH','response','EDIT_FILE','function','text','Error\x20running\x20fast\x20context\x20search:\x20','normalize','push','MORPH_API_KEY','\x0aExamples:','search_string','Unknown\x20tool:\x20','timeout','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.','branch','path','warn','ReadError','Error:\x20','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','slice','listRoots','WORKSPACE_ROOT','filePath','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.','payload','\x20valid\x20directories','roots','Warning:\x20ENABLED_TOOLS/DISABLED_TOOLS\x20names\x20unknown\x20tool\x20\x22','Invalid\x20arguments:\x20','.\x20Path:\x20','MORPH_LARGE_APPLY','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','tool_call_error','target_file','argv','.vscode','Warning:\x20Workspace\x20fallback\x20failed:\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.','@morphllm/morphmcp\x20','realpath','linesRemoved','finish','BinaryFile','UnknownError','35584qOaTzK','mcp-filesystem','Parameters:\x0a','code_edit','homedir','added\x20','changes','❌\x20Morph\x20Edit\x20Failed:\x20','Tool\x20\x22','runWarpGrep_call','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','linesModified','morph-','Bearer\x20','.\x20Changes:\x20','RipgrepNotAvailable','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','path_validation_start','file_read_complete','dryRun','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','assistant','--api-key','-\x20Grepped\x20\x27','644SlVqJk','compaction_failed','\x0a</file>','completed','Morph\x20Edit\x20','files','ms:','parse','getClientCapabilities','edit','title','\x20as\x20allowed\x20directory','API\x20error\x20(auth/rate-limit)','completionId','\x22>\x0a','some','completed_with_file_errors','GITHUB_CODEBASE_SEARCH','toLowerCase','Created\x20File','string','tool_call_complete','LocalRipgrepProvider','log','pattern','tool_call_received','arguments','size','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.','--api-key=','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','codebase_search','tsconfig.json',',\x20modified\x20','utf-8','env','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','pyproject.toml','github_url','split','debug','data','WarpGrep\x20sub-tool\x20errors:\x20','glob','all','catch','--version','.git','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','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','<file\x20path=\x22','-\x20Preserve\x20exact\x20indentation\x0a','FileReadError','post','terminationReason','ENOENT','--help','errors','default','Example\x20format:\x0a','target_filepath','WarpGrepError','Rules:\x0a','965235eCsrGu','15115133nyroaA','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','length','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','repo_path','morph-v3-fast','SymlinkError','\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS','Cargo.toml','startsWith','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','file','ENABLE_WORKSPACE_MODE','edit_file','safeParse','join','10eNXUYj','code','disabled','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','search_type','Failed\x20to\x20read\x20file:\x20','\x20-\x20','messages','list_directory\x20','[github_codebase_search]\x20Failed\x20in\x20','path_validation_failed','false','filter','etimedout','oninitialized','Preview\x20changes\x20without\x20applying\x20them.','tool_call_id','name','setRequestHandler','MCP','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','github_search_start','-\x20Read\x20file\x20`','params','Relevant\x20context\x20found:','PWD','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','MORPH_WARP_GREP_TIMEOUT','enum','boolean','\x0aOptions:','\x20error(s)','\x22>\x0aError\x20reading\x20file:\x20','status','optional','sk-','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','provider_created','../package.json','substring','annotations','constructor','186KnxiUz','now','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','dirname','grep','1265210IvaSgc','has','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','message','Fatal\x20error\x20running\x20server:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','map','instructions','Morph\x20Edit\x20Preview','exit','[github_codebase_search]\x20Done\x20in\x20','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','isDirectory','Unknown\x20error','tool_calls','success','node_modules','every','\x20is\x20not\x20a\x20directory','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','sep','unknown','object','RipgrepError','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','requiresApiKey','FileNotFound','GitHub\x20search\x20failed:\x20','\x0a...\x20(truncated,\x20total:\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Max\x20results\x20to\x20return','morph-warp-grep-v2.1','Morph\x20FastApply\x20failed\x20without\x20error\x20message','SubToolError','list_directory'];a0_0x56da=function(){return _0xa82cf8;};return a0_0x56da();}server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x125335=a0_0x2e0658,_0x30ff22=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x125335(0x1d1)+_0x125335(0x1ca)+_0x125335(0x195)+_0x125335(0x1a8)+_0x125335(0x1f7)+_0x125335(0x113)+_0x125335(0x129)+_0x125335(0x1e8)+_0x125335(0x211)+_0x125335(0x1eb)+_0x125335(0x112)+_0x125335(0x1e0)+_0x125335(0x12b)+_0x125335(0x115),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':![]},'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x125335(0x166)],'description':_0x125335(0x221)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x125335(0x10a)+_0x125335(0x11a)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'requiresApiKey':!![]}],_0x5619f3=_0x30ff22['filter'](_0x406e9b=>{const _0x3f2126=_0x125335;if(DISABLED_TOOLS[_0x3f2126(0x22e)](_0x406e9b['name']))return console[_0x3f2126(0x12a)](_0x3f2126(0x135)+_0x406e9b['name']+_0x3f2126(0x1f4)),![];if('requiresApiKey'in _0x406e9b&&_0x406e9b[_0x3f2126(0x11b)]&&!MORPH_API_KEY)return logMcpStderr(_0x3f2126(0x163)+_0x406e9b[_0x3f2126(0x20e)]+_0x3f2126(0x14e)),![];return!![];});return{'tools':_0x5619f3[_0x125335(0x234)](_0x20cca7=>({'name':_0x20cca7[_0x125335(0x20e)],..._0x125335(0x1b6)in _0x20cca7&&_0x20cca7[_0x125335(0x1b6)]?{'title':_0x20cca7['title']}:{},'description':_0x20cca7['description'],'inputSchema':_0x20cca7['inputSchema'],..._0x125335(0x225)in _0x20cca7&&_0x20cca7[_0x125335(0x225)]?{'annotations':_0x20cca7[_0x125335(0x225)]}:{}}))};}),server[a0_0x2e0658(0x20f)](CallToolRequestSchema,async _0x55ed60=>{const _0x40091d=a0_0x2e0658,{name:_0x56afc5,arguments:_0x2feda4}=_0x55ed60[_0x40091d(0x214)],_0x319e03=Date['now']();logger['debug'](_0x40091d(0x210),_0x40091d(0x1c5),{'tool':_0x56afc5,'args':_0x56afc5===_0x40091d(0x1fa)?{'path':_0x2feda4?.['path'],'instruction':_0x2feda4?.[_0x40091d(0x140)]||_0x2feda4?.['instructions'],'dryRun':_0x2feda4?.[_0x40091d(0x1a7)]}:_0x2feda4});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x200)}],'isError':!![]};if(!MORPH_API_KEY[_0x40091d(0x1f6)](_0x40091d(0x220))&&!MORPH_API_KEY[_0x40091d(0x1f6)](_0x40091d(0x1a0)))return{'content':[{'type':'text','text':_0x40091d(0x17e)}],'isError':!![]};if(DISABLED_TOOLS[_0x40091d(0x22e)](_0x56afc5))return{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x19b)+_0x56afc5+'\x22\x20is\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x56afc5){case TOOL_NAMES[_0x40091d(0x168)]:{let _0x36ce0a=_0x2feda4;if(_0x36ce0a&&typeof _0x36ce0a==='object'){if(!('path'in _0x36ce0a)){const _0x3c3f67=_0x36ce0a[_0x40091d(0x188)]??_0x36ce0a[_0x40091d(0x17d)]??_0x36ce0a[_0x40091d(0x1e9)]??_0x36ce0a['file_path']??_0x36ce0a[_0x40091d(0x1f8)];if(_0x3c3f67)_0x36ce0a={..._0x36ce0a,'path':_0x3c3f67};}_0x40091d(0x106)in _0x36ce0a&&!(_0x40091d(0x140)in _0x36ce0a)&&(_0x36ce0a={..._0x36ce0a,'instruction':_0x36ce0a['instructions']});if(!('code_edit'in _0x36ce0a)){const _0x3f1932=_0x36ce0a[_0x40091d(0x1fe)]??_0x36ce0a['new_string']??_0x36ce0a['content']??_0x36ce0a[_0x40091d(0x1b5)];if(_0x3f1932)_0x36ce0a={..._0x36ce0a,'code_edit':_0x3f1932};}}const _0xdc8203=MorphEditFileArgsSchema[_0x40091d(0x1fb)](_0x36ce0a);if(!_0xdc8203[_0x40091d(0x10e)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0xdc8203[_0x40091d(0x12a)]);const _0x3101d3=await validatePath(_0xdc8203[_0x40091d(0x1d6)]['path']);let _0x482516=null,_0xb17b0d=!![],_0x547fa8=null;try{_0x482516=await a0_0x2398e1[_0x40091d(0x13d)](_0x3101d3,_0x40091d(0x1ce)),logger[_0x40091d(0x1d5)]('MCP','file_read_complete',{'path':_0x3101d3,'size_bytes':_0x482516[_0x40091d(0x1ef)]});}catch(_0x4e53d2){const _0x36ba08=_0x4e53d2[_0x40091d(0x1fe)];_0x36ba08===_0x40091d(0x1e4)?(_0xb17b0d=![],_0x482516='',logger[_0x40091d(0x1d5)](_0x40091d(0x210),_0x40091d(0x1a6),{'path':_0x3101d3,'exists':![]})):(_0x547fa8=_0x40091d(0x202)+(_0x36ba08||_0x40091d(0x117))+_0x40091d(0x203)+(_0x4e53d2 instanceof Error?_0x4e53d2[_0x40091d(0x230)]:String(_0x4e53d2)),logger[_0x40091d(0x12a)](_0x40091d(0x210),'file_read_failed',{'path':_0x3101d3,'error':_0x547fa8}),logMcpStderr(_0x40091d(0x163)+_0x547fa8));}let _0x332456;try{const _0x2f9148=MORPH_API_KEY;if(!_0x2f9148)throw new Error(_0x40091d(0x1a4));const _0x8674cf=a0_0x5d8d1f[_0x40091d(0x22b)](_0x3101d3),_0x2674fc=a0_0x5d8d1f[_0x40091d(0x161)](_0x3101d3);logger['debug'](_0x40091d(0x210),'api_request_start',{'model':_0x40091d(0x1f2),'path':_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x175)],'instruction_len':_0xdc8203['data']['instruction'][_0x40091d(0x1ef)],'code_edit_len':_0xdc8203['data'][_0x40091d(0x196)][_0x40091d(0x1ef)],'original_code_len':_0x482516?.['length']??0x0,'dry_run':_0xdc8203['data']['dryRun']});const _0x526943=Date[_0x40091d(0x228)](),_0x3e6358=await executeEditFile({'target_filepath':_0x2674fc,'code_edit':_0xdc8203['data'][_0x40091d(0x196)],'instruction':_0xdc8203['data'][_0x40091d(0x140)]},{'morphApiKey':_0x2f9148,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x8674cf,'autoWrite':!_0xdc8203['data'][_0x40091d(0x1a7)],'generateUdiff':![],'debug':![]}),_0x2d1708=Date[_0x40091d(0x228)]()-_0x526943;_0x332456=_0x3e6358[_0x40091d(0x1b9)];if(!_0x3e6358['success'])throw new Error(_0x3e6358[_0x40091d(0x12a)]||_0x40091d(0x122));const _0x12af65=_0x3e6358[_0x40091d(0x199)],_0x4dda70=_0x40091d(0x198)+_0x12af65[_0x40091d(0x14d)]+_0x40091d(0x13a)+_0x12af65[_0x40091d(0x18f)]+_0x40091d(0x1cd)+_0x12af65[_0x40091d(0x19f)];logger[_0x40091d(0x1d5)](_0x40091d(0x210),_0x40091d(0x1c1),{'tool':_0x40091d(0x1fa),'success':!![],'latency_ms':Date[_0x40091d(0x228)]()-_0x319e03,'edit_latency_ms':_0x2d1708,'changes':{'added':_0x12af65[_0x40091d(0x14d)],'removed':_0x12af65[_0x40091d(0x18f)],'modified':_0x12af65['linesModified']},'completion_id':_0x332456});if(_0xdc8203['data'][_0x40091d(0x1a7)])return{'content':[{'type':'text','text':_0x40091d(0x107)+(_0xb17b0d?'':_0x40091d(0x149))+':\x20'+_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x140)]+_0x40091d(0x1a2)+_0x4dda70+_0x40091d(0x184)+_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x175)]+'.'}]};return{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x1b0)+(_0xb17b0d?_0x40091d(0x13b):_0x40091d(0x1bf))+':\x20'+_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x140)]+_0x40091d(0x1a2)+_0x4dda70+_0x40091d(0x184)+_0xdc8203[_0x40091d(0x1d6)]['path']+'.'}]};}catch(_0x4f66c8){const _0x56266f=handleMorphAPIError(_0x4f66c8);if(_0x56266f)return logger[_0x40091d(0x12a)]('MCP',_0x40091d(0x187),{'tool':'edit_file','error':_0x40091d(0x1b8),'latency_ms':Date[_0x40091d(0x228)]()-_0x319e03}),_0x56266f;const _0x8743d=_0x4f66c8 instanceof Error?_0x4f66c8[_0x40091d(0x230)]:String(_0x4f66c8);return logger[_0x40091d(0x12a)](_0x40091d(0x210),'tool_call_error',{'tool':'edit_file','error':_0x8743d,'path':_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x175)],'validated_path':_0x3101d3,'latency_ms':Date[_0x40091d(0x228)]()-_0x319e03,'stack':_0x4f66c8 instanceof Error?_0x4f66c8[_0x40091d(0x15a)]:undefined}),reportMorphError({'error_message':_0x8743d,'error_type':_0x4f66c8 instanceof Error?_0x4f66c8['constructor']['name']:_0x40091d(0x192),'context':{'tool':_0x40091d(0x1fa),'completion_id':_0x332456,'file_path':_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x175)],'validated_path':_0x3101d3,'instruction':_0xdc8203[_0x40091d(0x1d6)]['instruction'],'model':MORPH_LARGE_APPLY?_0x40091d(0x153):_0x40091d(0x1f2),'dry_run':_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x1a7)],'file_exists':_0xb17b0d,'file_read_error':_0x547fa8,'file_readable':_0x482516!==null,'request_content':{'path':_0xdc8203[_0x40091d(0x1d6)]['path'],'code_edit':_0xdc8203['data'][_0x40091d(0x196)],'instruction':_0xdc8203['data'][_0x40091d(0x140)],'original_code':_0x482516!==null?_0x482516['length']>0xc350?_0x482516[_0x40091d(0x224)](0x0,0xc350)+_0x40091d(0x11e)+_0x482516[_0x40091d(0x1ef)]+'\x20chars)':_0x482516:_0x40091d(0x13c)+(_0x547fa8||'unknown\x20error')+']','original_code_length':_0x482516?.[_0x40091d(0x1ef)]??0x0,'model':MORPH_LARGE_APPLY?_0x40091d(0x153):_0x40091d(0x1f2),'dry_run':_0xdc8203[_0x40091d(0x1d6)][_0x40091d(0x1a7)]}},'stack_trace':_0x4f66c8 instanceof Error?_0x4f66c8[_0x40091d(0x15a)]:undefined,'source':_0x40091d(0x194)})[_0x40091d(0x1da)](()=>{}),{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x19a)+_0x8743d}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x12c62e=WarpGrepArgsSchema['safeParse'](_0x2feda4);if(!_0x12c62e[_0x40091d(0x10e)])return{'content':[{'type':'text','text':_0x40091d(0x183)+_0x12c62e[_0x40091d(0x12a)]}],'isError':!![]};const _0x5a430c=_0x23a6e4=>{const _0x3839b6=_0x40091d,_0x4d379a=[];for(const _0x4cf284 of _0x23a6e4||[]){if(_0x4cf284[_0x3839b6(0x133)]==='assistant'&&Array[_0x3839b6(0x137)](_0x4cf284[_0x3839b6(0x10d)]))for(const _0xc30159 of _0x4cf284[_0x3839b6(0x10d)]){try{const _0x376f38=_0xc30159[_0x3839b6(0x169)]?.[_0x3839b6(0x20e)],_0xb96f0e=JSON[_0x3839b6(0x1b3)](_0xc30159[_0x3839b6(0x169)]?.[_0x3839b6(0x1c6)]||'{}');if(_0x376f38===_0x3839b6(0x154))_0x4d379a['push'](_0x3839b6(0x15b)+_0xb96f0e[_0x3839b6(0x1c4)]+'\x27\x20'+(_0xb96f0e['path']||'.'));else{if(_0x376f38===_0x3839b6(0x12e))_0x4d379a['push']('read\x20'+_0xb96f0e[_0x3839b6(0x175)]);else{if(_0x376f38===_0x3839b6(0x124))_0x4d379a[_0x3839b6(0x16d)](_0x3839b6(0x205)+(_0xb96f0e[_0x3839b6(0x138)]||'.'));else{if(_0x376f38===_0x3839b6(0x1d8))_0x4d379a[_0x3839b6(0x16d)]('glob\x20\x27'+_0xb96f0e[_0x3839b6(0x1c4)]+'\x27\x20'+(_0xb96f0e['path']||'.'));else _0x376f38===_0x3839b6(0x190)&&_0x4d379a[_0x3839b6(0x16d)](_0x3839b6(0x190));}}}}catch{}}}return _0x4d379a;},_0x1552ad=_0x41cd04=>{const _0x4f00de=_0x40091d,_0x315dc3=[];if(!_0x41cd04||!Array['isArray'](_0x41cd04))return _0x315dc3;const _0x239014=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x4f00de(0x11c),'tool':_0x4f00de(0x12e)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x4f00de(0x12e)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x4f00de(0x12e)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x4f00de(0x191),'tool':_0x4f00de(0x12e)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x4f00de(0x119),'tool':_0x4f00de(0x22c)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x4f00de(0x1a3),'tool':_0x4f00de(0x22c)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x4f00de(0x191),'tool':_0x4f00de(0x12e)},{'pattern':/\[SYMLINK\]/,'error_type':_0x4f00de(0x1f3),'tool':_0x4f00de(0x12e)},{'pattern':/not a text file/,'error_type':_0x4f00de(0x191),'tool':_0x4f00de(0x12e)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x4f00de(0x12e)},{'pattern':/Error reading file:/,'error_type':_0x4f00de(0x177),'tool':_0x4f00de(0x12e)},{'pattern':/status="error"/,'error_type':'ToolException','tool':_0x4f00de(0x117)}];let _0x2ac748=0x0;for(const _0x4fbb06 of _0x41cd04){_0x4fbb06[_0x4f00de(0x133)]===_0x4f00de(0x1a9)&&Array['isArray'](_0x4fbb06[_0x4f00de(0x10d)])&&_0x2ac748++;const _0x5a7af=_0x4fbb06[_0x4f00de(0x144)];if((_0x4fbb06[_0x4f00de(0x133)]==='tool'||_0x4fbb06[_0x4f00de(0x133)]===_0x4f00de(0x14a))&&_0x5a7af&&typeof _0x5a7af===_0x4f00de(0x1c0))for(const {pattern:_0x1f211f,error_type:_0x4974ef,tool:_0x327e9e}of _0x239014){const _0x3a3072=_0x5a7af[_0x4f00de(0x157)](new RegExp(_0x1f211f[_0x4f00de(0x145)],'g'));if(_0x3a3072)for(const _0x17f289 of _0x3a3072){const _0x246f05=_0x5a7af[_0x4f00de(0x128)](_0x17f289),_0x2088b8=_0x5a7af['substring'](_0x246f05,Math['min'](_0x246f05+0xc8,_0x5a7af['length']));_0x315dc3[_0x4f00de(0x16d)]({'tool':_0x327e9e,'error_type':_0x4974ef,'error_message':_0x2088b8[_0x4f00de(0x1d4)]('\x0a')[0x0],'turn':_0x2ac748});}}}return _0x315dc3;};try{const _0x6c79=a0_0x5d8d1f[_0x40091d(0x155)](_0x12c62e['data'][_0x40091d(0x1f1)]),_0x22f47a=_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x201)],_0x3646c2=_0x22f47a===_0x40091d(0x10f)?{'allowNames':[_0x40091d(0x10f)]}:undefined,_0x5cbfee=new LocalRipgrepProvider(_0x6c79,undefined,_0x3646c2);logger['debug'](_0x40091d(0x210),_0x40091d(0x222),{'type':_0x40091d(0x1c2),'repo_root':_0x6c79,'search_type':_0x22f47a||_0x40091d(0x1e7)}),logger[_0x40091d(0x1d5)]('MCP','warp_grep_start',{'query':_0x12c62e[_0x40091d(0x1d6)]['search_string'],'repo_root':_0x6c79,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x416de7=Date[_0x40091d(0x228)](),_0x3e8d90=await runWarpGrep({'searchTerm':_0x12c62e['data'][_0x40091d(0x170)],'repoRoot':_0x6c79,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x5cbfee,'search_type':_0x22f47a}),_0x303c7f=Date[_0x40091d(0x228)]()-_0x416de7,_0x133c17=_0x3e8d90[_0x40091d(0x190)]?.[_0x40091d(0x15d)]?.[_0x40091d(0x1b1)]?.['length']??0x0;logger[_0x40091d(0x1d5)](_0x40091d(0x210),'warp_grep_complete',{'termination':_0x3e8d90[_0x40091d(0x1e3)],'turns':_0x3e8d90[_0x40091d(0x13e)]?.['turns']??0x0,'files_found':_0x133c17,'latency_ms':_0x303c7f});const _0x5b3aa6=_0x1552ad(_0x3e8d90[_0x40091d(0x204)]);_0x5b3aa6[_0x40091d(0x1ef)]>0x0&&reportMorphError({'error_message':_0x40091d(0x1d7)+_0x5b3aa6[_0x40091d(0x1ef)]+_0x40091d(0x21c),'error_type':_0x40091d(0x123),'level':'warn','tool':_0x40091d(0x1cb),'context':{'repo_path':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x1f1)],'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'model':_0x40091d(0x121),'termination_reason':_0x3e8d90[_0x40091d(0x1e3)],'sub_tool_errors':_0x5b3aa6,'timings':_0x3e8d90[_0x40091d(0x13e)],'tool_calls':_0x5a430c(_0x3e8d90[_0x40091d(0x204)]),'messages':_0x3e8d90[_0x40091d(0x204)]?.[_0x40091d(0x234)](_0x4d119b=>({'role':_0x4d119b['role'],'content':_0x4d119b['content'],..._0x4d119b[_0x40091d(0x10d)]?{'tool_calls':_0x4d119b['tool_calls'][_0x40091d(0x1ef)]}:{},..._0x4d119b[_0x40091d(0x20d)]?{'tool_call_id':_0x4d119b[_0x40091d(0x20d)]}:{}}))},'source':_0x40091d(0x194)})[_0x40091d(0x1da)](()=>{});let _0x8ee7ef='';if(_0x3e8d90[_0x40091d(0x1e3)]===_0x40091d(0x1af)&&_0x3e8d90[_0x40091d(0x190)]?.[_0x40091d(0x15d)]?.[_0x40091d(0x1b1)]){const _0x23f374=_0x3e8d90[_0x40091d(0x190)][_0x40091d(0x15d)][_0x40091d(0x1b1)];if(_0x23f374[_0x40091d(0x1ef)]===0x0)return _0x8ee7ef=_0x3e8d90[_0x40091d(0x190)][_0x40091d(0x17f)]||_0x40091d(0x19e),{'content':[{'type':_0x40091d(0x16a),'text':_0x8ee7ef}]};const _0x33d84f=[],_0x356518=[_0x40091d(0x232)];for(const _0x1f1af4 of _0x3e8d90[_0x40091d(0x204)]){if(_0x1f1af4[_0x40091d(0x133)]===_0x40091d(0x1a9)&&Array['isArray'](_0x1f1af4[_0x40091d(0x10d)]))for(const _0xa507a5 of _0x1f1af4[_0x40091d(0x10d)]){try{const _0x15ce42=_0xa507a5[_0x40091d(0x169)]?.[_0x40091d(0x20e)],_0x80e7fe=JSON[_0x40091d(0x1b3)](_0xa507a5[_0x40091d(0x169)]?.[_0x40091d(0x1c6)]||'{}');if(_0x15ce42===_0x40091d(0x154))_0x356518[_0x40091d(0x16d)](_0x40091d(0x1ab)+_0x80e7fe[_0x40091d(0x1c4)]+'\x27\x20in\x20`'+(_0x80e7fe[_0x40091d(0x175)]||'.')+'`');else{if(_0x15ce42===_0x40091d(0x12e))_0x356518[_0x40091d(0x16d)](_0x40091d(0x213)+_0x80e7fe[_0x40091d(0x175)]+'`');else{if(_0x15ce42===_0x40091d(0x124))_0x356518[_0x40091d(0x16d)](_0x40091d(0x14c)+(_0x80e7fe[_0x40091d(0x138)]||'.')+'`');else _0x15ce42===_0x40091d(0x1d8)&&_0x356518[_0x40091d(0x16d)](_0x40091d(0x14f)+_0x80e7fe['pattern']+_0x40091d(0x15e)+(_0x80e7fe['path']||'.')+'`');}}}catch{}}}_0x33d84f[_0x40091d(0x16d)](_0x356518[_0x40091d(0x1fc)]('\x0a'));const _0x5134cd=['',_0x40091d(0x215)];for(const _0x4f60d4 of _0x23f374){if(_0x4f60d4['lines']==='*')_0x5134cd['push']('-\x20'+_0x4f60d4['path']+':*');else{if(Array['isArray'](_0x4f60d4[_0x40091d(0x125)])){const _0x4996dd=_0x4f60d4[_0x40091d(0x125)][_0x40091d(0x234)](([_0x1d33ef,_0x4fc7c6])=>{if(_0x1d33ef===_0x4fc7c6)return''+_0x1d33ef;return _0x1d33ef+'-'+_0x4fc7c6;});_0x5134cd[_0x40091d(0x16d)]('-\x20'+_0x4f60d4['path']+':'+_0x4996dd[_0x40091d(0x1fc)](','));}else _0x5134cd[_0x40091d(0x16d)]('-\x20'+_0x4f60d4[_0x40091d(0x175)]+':*');}}_0x5134cd['push'](''),_0x33d84f[_0x40091d(0x16d)](_0x5134cd[_0x40091d(0x1fc)]('\x0a')),_0x33d84f['push'](_0x40091d(0x14b));const _0x4bc325=[],_0x176a3f=[];for(const _0x31b4be of _0x23f374){let _0x465cb7=a0_0x5d8d1f[_0x40091d(0x155)](_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x1f1)],_0x31b4be['path']),_0x5ae824=null,_0x22177a=null;try{_0x5ae824=await a0_0x2398e1[_0x40091d(0x13d)](_0x465cb7,{'encoding':_0x40091d(0x1ce)});}catch(_0x37325c){const _0x555aa3=fixPathRepetition(_0x465cb7);if(_0x555aa3)try{_0x5ae824=await a0_0x2398e1[_0x40091d(0x13d)](_0x555aa3,{'encoding':'utf-8'}),_0x465cb7=_0x555aa3;}catch{_0x22177a=_0x37325c instanceof Error?_0x37325c:new Error(String(_0x37325c));}else _0x22177a=_0x37325c instanceof Error?_0x37325c:new Error(String(_0x37325c));}if(_0x5ae824!==null){const _0x138cf5=_0x5ae824[_0x40091d(0x1d4)](/\r?\n/),_0x1d158c=[];if(_0x31b4be[_0x40091d(0x125)]==='*'||!Array['isArray'](_0x31b4be['lines']))for(let _0x145e28=0x1;_0x145e28<=_0x138cf5[_0x40091d(0x1ef)];_0x145e28++){const _0x16924d=_0x138cf5[_0x145e28-0x1];_0x1d158c[_0x40091d(0x16d)](_0x145e28+'|\x20'+_0x16924d);}else for(const [_0x2afa37,_0x19a7f6]of _0x31b4be[_0x40091d(0x125)]){_0x1d158c[_0x40091d(0x1ef)]>0x0&&_0x1d158c[_0x40091d(0x16d)]('');for(let _0x65fc8a=_0x2afa37;_0x65fc8a<=_0x19a7f6&&_0x65fc8a<=_0x138cf5[_0x40091d(0x1ef)];_0x65fc8a++){const _0x2964c3=_0x138cf5[_0x65fc8a-0x1];_0x1d158c[_0x40091d(0x16d)](_0x65fc8a+'|\x20'+_0x2964c3);}}_0x176a3f[_0x40091d(0x16d)]({'path':_0x31b4be[_0x40091d(0x175)],'content':_0x1d158c['join']('\x0a')});}else _0x4bc325[_0x40091d(0x16d)](_0x40091d(0x1df)+_0x31b4be[_0x40091d(0x175)]+_0x40091d(0x21d)+(_0x22177a?.[_0x40091d(0x230)]||_0x40091d(0x10c))+_0x40091d(0x1ae));}try{const _0x16b3c2=await compactFileContexts(_0x176a3f,_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],MORPH_API_KEY,MORPH_API_URL);for(const _0xa4f9ec of _0x16b3c2){_0x4bc325[_0x40091d(0x16d)]('<file\x20path=\x22'+_0xa4f9ec[_0x40091d(0x175)]+_0x40091d(0x1ba)+_0xa4f9ec['content']+'\x0a</file>');}}catch(_0x20bc9d){logger[_0x40091d(0x176)](_0x40091d(0x210),_0x40091d(0x1ad),{'error':_0x20bc9d instanceof Error?_0x20bc9d['message']:String(_0x20bc9d),'files_count':_0x176a3f[_0x40091d(0x1ef)]});for(const _0x1d660d of _0x176a3f){_0x4bc325[_0x40091d(0x16d)](_0x40091d(0x1df)+_0x1d660d[_0x40091d(0x175)]+_0x40091d(0x1ba)+_0x1d660d[_0x40091d(0x144)]+'\x0a</file>');}}_0x33d84f[_0x40091d(0x16d)](_0x4bc325[_0x40091d(0x1fc)]('\x0a\x0a')),_0x8ee7ef=_0x33d84f[_0x40091d(0x1fc)]('\x0a');const _0x2fca54=_0x3e8d90[_0x40091d(0x1e6)]?.[_0x40091d(0x209)](_0x1321dd=>_0x1321dd[_0x40091d(0x230)]?.[_0x40091d(0x1f6)]('File\x20read\x20error:'))||[];if(_0x2fca54[_0x40091d(0x1ef)]>0x0){const _0x5274f9=_0x2fca54[_0x40091d(0x234)](_0x52fc4d=>_0x52fc4d['message'])['join'](';\x20');reportMorphError({'error_message':_0x5274f9,'error_type':_0x40091d(0x1e1),'context':{'tool':_0x40091d(0x1cb),'repo_path':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x1f1)],'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'model':_0x40091d(0x121),'termination_reason':_0x40091d(0x1bc),'error_count':_0x2fca54[_0x40091d(0x1ef)],'is_timeout':![],'timings':_0x3e8d90[_0x40091d(0x13e)],'files_attempted':_0x23f374[_0x40091d(0x234)](_0x4fcd64=>({'path':_0x4fcd64['path'],'lines':_0x4fcd64['lines']})),'tool_calls':_0x5a430c(_0x3e8d90[_0x40091d(0x204)]),'messages':_0x3e8d90[_0x40091d(0x204)]?.[_0x40091d(0x234)](_0x1890d2=>({'role':_0x1890d2[_0x40091d(0x133)],'content':_0x1890d2[_0x40091d(0x144)],..._0x1890d2[_0x40091d(0x10d)]?{'tool_calls':_0x1890d2[_0x40091d(0x10d)][_0x40091d(0x1ef)]}:{},..._0x1890d2[_0x40091d(0x20d)]?{'tool_call_id':_0x1890d2[_0x40091d(0x20d)]}:{}})),'request_content':{'query':_0x12c62e[_0x40091d(0x1d6)]['search_string'],'repo_path':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x1f1)],'repoRoot':a0_0x5d8d1f[_0x40091d(0x155)](_0x12c62e['data'][_0x40091d(0x1f1)]),'model':_0x40091d(0x121)}},'source':_0x40091d(0x194)})[_0x40091d(0x1da)](()=>{});}}else{if(_0x3e8d90[_0x40091d(0x1e3)]==='terminated'&&_0x3e8d90[_0x40091d(0x1e6)][_0x40091d(0x1ef)]>0x0){const _0x219596=_0x3e8d90[_0x40091d(0x1e6)][_0x40091d(0x234)](_0x3cc2b8=>_0x3cc2b8[_0x40091d(0x230)])[_0x40091d(0x1fc)](';\x20');_0x8ee7ef=_0x40091d(0x178)+_0x219596;const _0x2445b3=_0x219596[_0x40091d(0x1be)]()[_0x40091d(0x158)]('timeout')||_0x219596[_0x40091d(0x1be)]()[_0x40091d(0x158)]('timed\x20out')||_0x219596[_0x40091d(0x1be)]()[_0x40091d(0x158)]('etimedout'),_0x4b97a8=_0x3e8d90[_0x40091d(0x190)]?.[_0x40091d(0x15d)]?.['files'],_0x2af683=_0x3e8d90[_0x40091d(0x1e6)][0x0];reportMorphError({'error_message':_0x219596,'error_type':_0x2445b3?'TimeoutError':_0x2af683?.[_0x40091d(0x226)]?.[_0x40091d(0x20e)]||_0x40091d(0x1ea),'context':{'tool':_0x40091d(0x1cb),'repo_path':_0x12c62e[_0x40091d(0x1d6)]['repo_path'],'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'model':_0x40091d(0x121),'termination_reason':_0x3e8d90['terminationReason'],'error_count':_0x3e8d90[_0x40091d(0x1e6)][_0x40091d(0x1ef)],'is_timeout':_0x2445b3,'timings':_0x3e8d90[_0x40091d(0x13e)],'files_attempted':_0x4b97a8?.[_0x40091d(0x234)](_0x8938d9=>({'path':_0x8938d9[_0x40091d(0x175)],'lines':_0x8938d9[_0x40091d(0x125)]})),'tool_calls':_0x5a430c(_0x3e8d90[_0x40091d(0x204)]),'messages':_0x3e8d90[_0x40091d(0x204)]?.[_0x40091d(0x234)](_0x2f8c60=>({'role':_0x2f8c60[_0x40091d(0x133)],'content':_0x2f8c60[_0x40091d(0x144)],..._0x2f8c60['tool_calls']?{'tool_calls':_0x2f8c60['tool_calls'][_0x40091d(0x1ef)]}:{},..._0x2f8c60[_0x40091d(0x20d)]?{'tool_call_id':_0x2f8c60[_0x40091d(0x20d)]}:{}})),'request_content':{'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'repo_path':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x1f1)],'repoRoot':a0_0x5d8d1f[_0x40091d(0x155)](_0x12c62e['data'][_0x40091d(0x1f1)]),'model':_0x40091d(0x121)}},'stack_trace':_0x2af683?.['stack']||undefined,'source':_0x40091d(0x194)})[_0x40091d(0x1da)](()=>{});}else _0x8ee7ef='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x8ee7ef}]};}catch(_0x1e2a45){const _0x1380e1=handleMorphAPIError(_0x1e2a45);if(_0x1380e1)return logger[_0x40091d(0x12a)](_0x40091d(0x210),_0x40091d(0x187),{'tool':_0x40091d(0x1cb),'error':_0x40091d(0x1b8),'latency_ms':Date[_0x40091d(0x228)]()-_0x319e03}),_0x1380e1;const _0x25ccd3=_0x1e2a45 instanceof Error?_0x1e2a45['message']:String(_0x1e2a45);logger['error'](_0x40091d(0x210),_0x40091d(0x187),{'tool':_0x40091d(0x1cb),'error':_0x25ccd3,'repo_path':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x1f1)],'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'latency_ms':Date['now']()-_0x319e03});const _0x27d30a=_0x25ccd3[_0x40091d(0x1be)]()[_0x40091d(0x158)](_0x40091d(0x172))||_0x25ccd3['toLowerCase']()['includes']('timed\x20out')||_0x25ccd3['toLowerCase']()['includes'](_0x40091d(0x20a))||_0x1e2a45 instanceof Error&&_0x1e2a45['name']===_0x40091d(0x142);return reportMorphError({'error_message':_0x25ccd3,'error_type':_0x27d30a?_0x40091d(0x142):_0x1e2a45 instanceof Error?_0x1e2a45[_0x40091d(0x226)][_0x40091d(0x20e)]:_0x40091d(0x192),'context':{'tool':_0x40091d(0x1cb),'repo_path':_0x12c62e['data'][_0x40091d(0x1f1)],'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'model':_0x40091d(0x121),'is_timeout':_0x27d30a,'exception_phase':_0x40091d(0x19c),'request_content':{'query':_0x12c62e[_0x40091d(0x1d6)][_0x40091d(0x170)],'repo_path':_0x12c62e['data']['repo_path'],'repoRoot':a0_0x5d8d1f[_0x40091d(0x155)](_0x12c62e['data']['repo_path']),'model':_0x40091d(0x121)}},'stack_trace':_0x1e2a45 instanceof Error?_0x1e2a45[_0x40091d(0x15a)]:undefined,'source':_0x40091d(0x194)})[_0x40091d(0x1da)](()=>{}),{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x16b)+_0x25ccd3}],'isError':![]};}}case TOOL_NAMES[_0x40091d(0x1bd)]:{const _0x3398df=WarpGrepGitHubArgsSchema['safeParse'](_0x2feda4);if(!_0x3398df[_0x40091d(0x10e)])return{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x183)+_0x3398df[_0x40091d(0x12a)]}],'isError':!![]};const _0x5eb232=_0x3398df[_0x40091d(0x1d6)][_0x40091d(0x1d3)]||_0x3398df[_0x40091d(0x1d6)]['owner_repo'];if(!_0x5eb232)return{'content':[{'type':_0x40091d(0x16a),'text':_0x40091d(0x229)}],'isError':!![]};const _0x34a34a=MORPH_API_KEY;if(!_0x34a34a)throw new Error(_0x40091d(0x1a4));const _0x2d172e=Date['now']();logger[_0x40091d(0x1d5)](_0x40091d(0x210),_0x40091d(0x212),{'identifier':_0x5eb232,'query':_0x3398df[_0x40091d(0x1d6)]['search_string'],'branch':_0x3398df['data'][_0x40091d(0x174)]});try{const _0x7bce92=new WarpGrepClient({'morphApiKey':_0x34a34a,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x307a67=await _0x7bce92[_0x40091d(0x141)]({'searchTerm':_0x3398df[_0x40091d(0x1d6)][_0x40091d(0x170)],'github':_0x5eb232,'branch':_0x3398df[_0x40091d(0x1d6)][_0x40091d(0x174)]}),_0x8c965a=Date[_0x40091d(0x228)]()-_0x2d172e;logMcpStderr(_0x40091d(0x109)+_0x8c965a+_0x40091d(0x159)+_0x307a67[_0x40091d(0x10e)]);const _0x1d471a=formatResult(_0x307a67);return{'content':[{'type':_0x40091d(0x16a),'text':_0x1d471a}]};}catch(_0x361a55){const _0x2a46d9=handleMorphAPIError(_0x361a55);if(_0x2a46d9)return _0x2a46d9;const _0x2c4cef=Date[_0x40091d(0x228)]()-_0x2d172e,_0x5b6368=_0x361a55 instanceof Error?_0x361a55[_0x40091d(0x230)]:String(_0x361a55);return logMcpStderr(_0x40091d(0x206)+_0x2c4cef+_0x40091d(0x1b2),_0x5b6368),reportMorphError({'error_message':_0x5b6368,'error_type':_0x361a55 instanceof Error?_0x361a55[_0x40091d(0x226)][_0x40091d(0x20e)]:_0x40091d(0x192),'context':{'tool':_0x40091d(0x12f),'github_url':_0x5eb232,'search_string':_0x3398df[_0x40091d(0x1d6)][_0x40091d(0x170)],'branch':_0x3398df['data'][_0x40091d(0x174)]},'stack_trace':_0x361a55 instanceof Error?_0x361a55['stack']:undefined,'source':_0x40091d(0x194),'tool':_0x40091d(0x12f),'latency_ms':_0x2c4cef})[_0x40091d(0x1da)](()=>{}),{'content':[{'type':'text','text':_0x40091d(0x11d)+_0x5b6368}],'isError':![]};}}default:throw new Error(_0x40091d(0x171)+_0x56afc5);}}catch(_0x51d873){const _0x46235e=_0x51d873 instanceof Error?_0x51d873[_0x40091d(0x230)]:String(_0x51d873);return reportMorphError({'error_message':_0x46235e,'error_type':_0x51d873 instanceof Error?_0x51d873['constructor'][_0x40091d(0x20e)]:_0x40091d(0x192),'context':{'tool':_0x56afc5,'arguments':_0x2feda4?JSON[_0x40091d(0x152)](_0x2feda4)[_0x40091d(0x224)](0x0,0x1f4):undefined,'mcp_server_version':_0x40091d(0x13f)},'stack_trace':_0x51d873 instanceof Error?_0x51d873[_0x40091d(0x15a)]:undefined,'source':'mcp-filesystem'})[_0x40091d(0x1da)](()=>{}),{'content':[{'type':'text','text':_0x40091d(0x178)+_0x46235e}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x31aa2){const _0x2f6409=a0_0x2e0658,_0x3624b1=await getValidRootDirectories(_0x31aa2);if(_0x3624b1[_0x2f6409(0x1ef)]>0x0)allowedDirectories=[..._0x3624b1],logMcpStderr(_0x2f6409(0x22a)+_0x3624b1[_0x2f6409(0x1ef)]+_0x2f6409(0x180));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x4e3709=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4e3709&&(allowedDirectories=[_0x4e3709],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4e3709));}catch(_0x4689ba){logMcpStderr(_0x2f6409(0x18b)+_0x4689ba);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x504c3c=a0_0x2e0658;try{const _0x30d96c=await server[_0x504c3c(0x17b)]();_0x30d96c&&'roots'in _0x30d96c&&await updateAllowedDirectoriesFromRoots(_0x30d96c[_0x504c3c(0x181)]);}catch(_0x235e13){logMcpStderr(_0x504c3c(0x127),_0x235e13 instanceof Error?_0x235e13['message']:String(_0x235e13));}}),server[a0_0x2e0658(0x20b)]=async()=>{const _0x5a424b=a0_0x2e0658,_0x542639=server[_0x5a424b(0x1b4)]();if(_0x542639?.[_0x5a424b(0x181)])try{const _0x1a8dac=await server[_0x5a424b(0x17b)]();_0x1a8dac&&_0x5a424b(0x181)in _0x1a8dac?await updateAllowedDirectoriesFromRoots(_0x1a8dac[_0x5a424b(0x181)]):logMcpStderr(_0x5a424b(0x179));}catch(_0x2a7d2c){logMcpStderr(_0x5a424b(0x1d0),_0x2a7d2c instanceof Error?_0x2a7d2c[_0x5a424b(0x230)]:String(_0x2a7d2c));}else{if(allowedDirectories[_0x5a424b(0x1ef)]>0x0)logMcpStderr(_0x5a424b(0x1ee),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x5a424b(0x173));}}};async function runServer(){const _0x53a08a=a0_0x2e0658,_0x5d684b=new StdioServerTransport();await server[_0x53a08a(0x131)](_0x5d684b),logMcpStderr(_0x53a08a(0x147)),allowedDirectories[_0x53a08a(0x1ef)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()[a0_0x2e0658(0x1da)](_0x3ddaa7=>{const _0x3901b7=a0_0x2e0658;logMcpStderr(_0x3901b7(0x231),_0x3ddaa7),process[_0x3901b7(0x108)](0x1);});
2
+ const a0_0x1d9c46=a0_0x2c14;function a0_0x2c14(_0x475594,_0x16a119){_0x475594=_0x475594-0xb8;const _0x507c0f=a0_0x507c();let _0x2c1470=_0x507c0f[_0x475594];return _0x2c1470;}(function(_0xc4348a,_0x586cc2){const _0x56d49f=a0_0x2c14,_0x5f0e58=_0xc4348a();while(!![]){try{const _0x3c4638=parseInt(_0x56d49f(0xe7))/0x1+parseInt(_0x56d49f(0x151))/0x2*(parseInt(_0x56d49f(0x180))/0x3)+parseInt(_0x56d49f(0xd0))/0x4*(-parseInt(_0x56d49f(0x119))/0x5)+-parseInt(_0x56d49f(0x197))/0x6+-parseInt(_0x56d49f(0xf4))/0x7+-parseInt(_0x56d49f(0x1c2))/0x8+-parseInt(_0x56d49f(0x163))/0x9*(-parseInt(_0x56d49f(0x1d7))/0xa);if(_0x3c4638===_0x586cc2)break;else _0x5f0e58['push'](_0x5f0e58['shift']());}catch(_0x3c21ef){_0x5f0e58['push'](_0x5f0e58['shift']());}}}(a0_0x507c,0x70166));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_0x28e2dc from'fs/promises';import a0_0x35f3fc from'path';import a0_0x32368f from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';function a0_0x507c(){const _0x438011=['MCP','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','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.','Tool\x20','command','Parameters:\x0a','utf-8','-\x20Read\x20file\x20`','TimeoutError','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.','isArray','ENABLE_WORKSPACE_MODE','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','owner_repo','EDIT_FILE','read',',\x20modified\x20','read\x20','list_directory','.cursor','path_validation_resolved','match','requiresApiKey','MORPH_API_KEY','slice','`\x20in\x20`','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','cwd','WarpGrepError','map','timed\x20out','false','compaction_failed','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','dirname','status','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','MORPH_API_URL','4472448grEkvW','warn','[could\x20not\x20read\x20file:\x20','WORKSPACE_ROOT','floor','\x0aOptions:','Warning:\x20ENABLED_TOOLS/DISABLED_TOOLS\x20names\x20unknown\x20tool\x20\x22','messages','assistant','Rules:\x0a','Created\x20File','parse','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','catch','WarpGrep\x20sub-tool\x20errors:\x20','instructions','\x22.\x20Known\x20tools:\x20','morph-mcp','join','PWD','@morphllm/morphmcp\x20','9530gKEhYz','Tool\x20\x22','env','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','file_read_complete','describe','stack','startsWith','github_search_start','min','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','path_validation_failed','glob\x20\x27','file_path','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','has','some','indexOf','RipgrepNotAvailable','role','constructor','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.','isDirectory','Workspace\x20mode\x20enabled:\x20Using\x20','turns','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','\x27\x20in\x20`','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','enum','--api-key=','morph-v3-large','linesModified','lines','5716XfbTyy','context','unknown\x20error','edit_file','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','.\x20Path:\x20','listRoots','all','boolean','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','grep','function','linesRemoved','\x20valid\x20directories','linesAdded','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','timeout','github_url','Morph\x20Edit\x20','path_validation_start','MORPH_LARGE_APPLY','morph-warp-grep-v2.1','163999xBlTkL','object','basename','SymlinkError','Error\x20accessing\x20directory\x20','codebase_search','setNotificationHandler','glob','stat','instruction','ENOENT','ms.\x20Success:\x20','0.2.0','6204401JRkHUT','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','FileReadError','--api-key','-\x20Glob\x20search\x20`','split','message','normalize','Fatal\x20error\x20running\x20server:','now','pattern','[github_codebase_search]\x20Failed\x20in\x20','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','access','[github_codebase_search]\x20Done\x20in\x20','grep_search','filePath','repo_path','Parent\x20directory\x20does\x20not\x20exist:\x20','warp_grep_complete','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','files','\x0a</file>','safeParse','ReadError','package.json','Example\x20format:\x0a','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','tool_call_id','added\x20','Fallback:\x20Using\x20workspace\x20root\x20','toLowerCase','tool_calls','Cargo.toml','annotations','readFile','post','1670JLGbuq','provider_created','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','roots','-\x20Preserve\x20exact\x20indentation\x0a','target_filepath','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','code_edit','--help','homedir','response','mcp-filesystem','Failed\x20to\x20request\x20roots\x20from\x20client:','\x20-\x20','sep','Disabled\x20tools:\x20','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','\x20(new\x20file)','oninitialized','RipgrepError','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','api-key','description','sk-','text','list_directory\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','metadata','log','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','edit','arguments','exit','file_read_failed','length','Morph\x20Edit\x20Preview','tool','resolve','code','unknown','errors','\x0a...\x20(truncated,\x20total:\x20','completed_with_file_errors','morph-v3-fast','-\x20Listed\x20directory\x20`','Warning:\x20Workspace\x20fallback\x20failed:\x20','GitHub\x20search\x20failed:\x20','\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS','GITHUB_CODEBASE_SEARCH','searchGitHub','search_string','path','Applied','success','https://morphllm.com/api/error-report','target_file','2OMxXCv','title','ToolException','.\x20Changes:\x20','content','debug','data','source','UnknownError','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','Preview\x20changes\x20without\x20applying\x20them.','default','user','runWarpGrep_call','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','BinaryFile','includes','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','27414sCBgOE','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','tsconfig.json','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','every','Bearer\x20','optional','PathError','\x22>\x0a','branch','node_modules','name','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','MORPH_WARP_GREP_TIMEOUT','morph-','\x20error(s)','timings','CODEBASE_SEARCH','new_string','Relevant\x20context\x20found:','Error\x20running\x20fast\x20context\x20search:\x20','FileNotFound','finish','\x22>\x0aError\x20reading\x20file:\x20','\x20\x20morph-mcp','substring','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','.git','53589vUMaiB','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','error','Warning:\x20','Error:\x20','<file\x20path=\x22','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','api_request_start','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','search_type','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','string','tool_call_error','etimedout','filter','API\x20error\x20(auth/rate-limit)','completed','realpath','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','terminationReason','push','stringify','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','4217430RMWdqj','.vscode','dryRun','SubToolError','\x20is\x20not\x20a\x20directory'];a0_0x507c=function(){return _0x438011;};return a0_0x507c();}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_0xe5763e from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES,resolveToolFilter}from'./tool-definitions.js';function fixPathRepetition(_0x564eeb){const _0x546cdf=a0_0x2c14,_0x3d8461=_0x564eeb[_0x546cdf(0xf9)](a0_0x35f3fc[_0x546cdf(0x127)])[_0x546cdf(0x18e)](Boolean);if(_0x3d8461[_0x546cdf(0x13b)]<0x2)return null;for(let _0x1988d0=Math[_0x546cdf(0x1c6)](_0x3d8461[_0x546cdf(0x13b)]/0x2);_0x1988d0>=0x1;_0x1988d0--){for(let _0x4063f8=0x0;_0x4063f8<=_0x3d8461['length']-0x2*_0x1988d0;_0x4063f8++){const _0x25d437=_0x3d8461[_0x546cdf(0x1b4)](_0x4063f8,_0x4063f8+_0x1988d0),_0x530029=_0x3d8461[_0x546cdf(0x1b4)](_0x4063f8+_0x1988d0,_0x4063f8+0x2*_0x1988d0);if(_0x25d437[_0x546cdf(0x167)]((_0x7b3e5d,_0x3adaa3)=>_0x7b3e5d===_0x530029[_0x3adaa3])){const _0x614de8=[..._0x3d8461['slice'](0x0,_0x4063f8),..._0x3d8461[_0x546cdf(0x1b4)](_0x4063f8+_0x1988d0)];return a0_0x35f3fc[_0x546cdf(0x127)]+_0x614de8[_0x546cdf(0x1d4)](a0_0x35f3fc['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x22bb29=a0_0x2c14;try{const _0x543439=require('../package.json');return _0x543439['version']??_0x22bb29(0x140);}catch(_0x235c68){return logMcpStderr(_0x22bb29(0x1db),_0x235c68),_0x22bb29(0x140);}}function printHelp(){const _0x1edc3e=a0_0x2c14;console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x1edc3e(0x135)](_0x1edc3e(0x133)),console[_0x1edc3e(0x135)](_0x1edc3e(0x1c7)),console[_0x1edc3e(0x135)](_0x1edc3e(0x1da)),console[_0x1edc3e(0x135)](_0x1edc3e(0x1ce)),console[_0x1edc3e(0x135)](_0x1edc3e(0x188)),console['log']('\x0aExamples:'),console['log'](_0x1edc3e(0x17b)),console[_0x1edc3e(0x135)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0x1d9c46(0x1b4)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x1d9c46(0x121),'-h']);cliArgs[a0_0x1d9c46(0xbf)](_0xab262b=>VERSION_FLAGS[a0_0x1d9c46(0xbe)](_0xab262b))&&(console['log'](a0_0x1d9c46(0x1d6)+getPackageVersion()),process[a0_0x1d9c46(0x139)](0x0));cliArgs['some'](_0x2e4510=>HELP_FLAGS[a0_0x1d9c46(0xbe)](_0x2e4510))&&(printHelp(),process[a0_0x1d9c46(0x139)](0x0));function getCliArg(_0x73f175){const _0x1408be=a0_0x1d9c46;for(let _0x566662=0x0;_0x566662<cliArgs[_0x1408be(0x13b)];_0x566662++){const _0x5ab7b5=cliArgs[_0x566662];if(_0x5ab7b5[_0x1408be(0x1df)]('--'+_0x73f175+'='))return _0x5ab7b5[_0x1408be(0x1b4)](('--'+_0x73f175+'=')[_0x1408be(0x13b)]);if(_0x5ab7b5==='--'+_0x73f175&&_0x566662+0x1<cliArgs[_0x1408be(0x13b)])return cliArgs[_0x566662+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x1d9c46(0x13b)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x1d9c46(0xbe)](arg)||HELP_FLAGS[a0_0x1d9c46(0xbe)](arg))continue;if(arg['startsWith'](a0_0x1d9c46(0xcc)))continue;if(arg===a0_0x1d9c46(0xf7)){i++;continue;}args[a0_0x1d9c46(0x194)](arg);}const WORKSPACE_ROOT=process[a0_0x1d9c46(0x1d9)][a0_0x1d9c46(0x1c5)]||process['env'][a0_0x1d9c46(0x1d5)]||process[a0_0x1d9c46(0x1b7)](),ENABLE_WORKSPACE_MODE=process[a0_0x1d9c46(0x1d9)][a0_0x1d9c46(0x1a7)]!=='false',MORPH_API_KEY=getCliArg(a0_0x1d9c46(0x12e))??process[a0_0x1d9c46(0x1d9)][a0_0x1d9c46(0x1b3)],MORPH_API_URL=process['env'][a0_0x1d9c46(0x1c1)],MORPH_LARGE_APPLY=process[a0_0x1d9c46(0x1d9)][a0_0x1d9c46(0xe5)]!==a0_0x1d9c46(0x1bb),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x1d9c46(0x170)]?parseInt(process[a0_0x1d9c46(0x1d9)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),TOOL_FILTER=resolveToolFilter(process[a0_0x1d9c46(0x1d9)]),DISABLED_TOOLS=TOOL_FILTER['disabled'];for(const tool of TOOL_FILTER[a0_0x1d9c46(0x140)]){console['error'](a0_0x1d9c46(0x1c8)+tool+a0_0x1d9c46(0x1d2)+[...KNOWN_TOOL_NAMES][a0_0x1d9c46(0x1d4)](',\x20'));}DISABLED_TOOLS['size']>0x0&&console['error'](a0_0x1d9c46(0x128)+[...DISABLED_TOOLS][a0_0x1d9c46(0x1d4)](',\x20'));MORPH_API_KEY&&!MORPH_API_KEY[a0_0x1d9c46(0x1df)](a0_0x1d9c46(0x130))&&!MORPH_API_KEY[a0_0x1d9c46(0x1df)](a0_0x1d9c46(0x171))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x8af8c1){const _0x434e02=a0_0x1d9c46;try{await a0_0xe5763e[_0x434e02(0x118)](_0x434e02(0x14f),{..._0x8af8c1,'timestamp':new Date()['toISOString'](),'source':_0x8af8c1[_0x434e02(0x158)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x8af8c1[_0x434e02(0xd1)]}},{'timeout':0x1388,'headers':{'Content-Type':'application/json','Authorization':_0x434e02(0x168)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x27cb31,_0x5b47ce){const _0x49395b=a0_0x1d9c46;if(_0x27cb31&&typeof _0x27cb31===_0x49395b(0xe8)&&_0x49395b(0x1bf)in _0x27cb31)return _0x27cb31[_0x49395b(0x1bf)];if(_0x27cb31&&typeof _0x27cb31==='object'&&'response'in _0x27cb31)return _0x27cb31[_0x49395b(0x123)]?.[_0x49395b(0x1bf)];const _0x4db37f=_0x5b47ce[_0x49395b(0x1b1)](/\b(401|429)\b/);return _0x4db37f?parseInt(_0x4db37f[0x1],0xa):null;}function handleMorphAPIError(_0x967dd){const _0x2f7550=a0_0x1d9c46,_0x3fed5c=_0x967dd instanceof Error?_0x967dd['message']:String(_0x967dd),_0x117125=extractStatusCode(_0x967dd,_0x3fed5c);switch(_0x117125){case 0x191:return{'content':[{'type':_0x2f7550(0x131),'text':'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.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x2f7550(0x131),'text':'Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.'}],'isError':!![]};default:return null;}}args[a0_0x1d9c46(0x13b)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x1d9c46(0xc8)),logMcpStderr(a0_0x1d9c46(0x166)),logMcpStderr(a0_0x1d9c46(0x186)),logMcpStderr(a0_0x1d9c46(0x17e)),logMcpStderr(a0_0x1d9c46(0xdf)),logMcpStderr(a0_0x1d9c46(0x18a)));function normalizePath(_0xaf3c2f){const _0x1caa55=a0_0x1d9c46;return a0_0x35f3fc[_0x1caa55(0xfb)](_0xaf3c2f);}function expandHome(_0xfa8da9){const _0x282313=a0_0x1d9c46;if(_0xfa8da9[_0x282313(0x1df)]('~/')||_0xfa8da9==='~')return a0_0x35f3fc[_0x282313(0x1d4)](a0_0x32368f[_0x282313(0x122)](),_0xfa8da9[_0x282313(0x1b4)](0x1));return _0xfa8da9;}let allowedDirectories=await Promise[a0_0x1d9c46(0xd7)](args[a0_0x1d9c46(0x1b9)](async _0x48f752=>{const _0x414e3a=a0_0x1d9c46,_0x43adc5=expandHome(_0x48f752),_0x5adc86=a0_0x35f3fc[_0x414e3a(0x13e)](_0x43adc5);try{const _0x480879=await a0_0x28e2dc['realpath'](_0x5adc86);return normalizePath(_0x480879);}catch(_0x272ff6){return normalizePath(_0x5adc86);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x1d9c46(0x194)](workspaceDir),logMcpStderr(a0_0x1d9c46(0xc6)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x49516a){logMcpStderr(a0_0x1d9c46(0x10f)+a0_0x49516a);}async function detectWorkspaceRoot(_0x2f1900){const _0x3a4419=a0_0x1d9c46;let _0x436f6c=a0_0x35f3fc[_0x3a4419(0x13e)](_0x2f1900);const _0x3e4e82=[_0x3a4419(0x17f),_0x3a4419(0x198),_0x3a4419(0x10d),_0x3a4419(0x115),'pyproject.toml','go.mod',_0x3a4419(0x1af),_0x3a4419(0x165),'composer.json'];while(_0x436f6c!==a0_0x35f3fc['dirname'](_0x436f6c)){for(const _0x4feb1f of _0x3e4e82){const _0xe90149=a0_0x35f3fc[_0x3a4419(0x1d4)](_0x436f6c,_0x4feb1f);try{return await a0_0x28e2dc[_0x3a4419(0x101)](_0xe90149),normalizePath(_0x436f6c);}catch{}}_0x436f6c=a0_0x35f3fc[_0x3a4419(0x1be)](_0x436f6c);}return normalizePath(_0x2f1900);}await Promise[a0_0x1d9c46(0xd7)](args[a0_0x1d9c46(0x1b9)](async _0x2bb716=>{const _0x320310=a0_0x1d9c46;try{const _0x4a69fe=await a0_0x28e2dc[_0x320310(0xef)](expandHome(_0x2bb716));!_0x4a69fe[_0x320310(0xc5)]()&&(logMcpStderr(_0x320310(0x184)+_0x2bb716+_0x320310(0x19b)),process[_0x320310(0x139)](0x1));}catch(_0x476232){logMcpStderr(_0x320310(0xeb)+_0x2bb716+':',_0x476232),process[_0x320310(0x139)](0x1);}}));async function validatePath(_0x224140){const _0x499e5e=a0_0x1d9c46,_0x699999=expandHome(_0x224140),_0x10917d=a0_0x35f3fc[_0x499e5e(0x13e)](_0x699999);logger[_0x499e5e(0x156)]('MCP',_0x499e5e(0xe4),{'raw_path':_0x224140,'absolute':_0x10917d});try{const _0x11c061=await a0_0x28e2dc['realpath'](_0x10917d);return logger[_0x499e5e(0x156)](_0x499e5e(0x19c),_0x499e5e(0x1b0),{'resolved':_0x11c061,'symlink':_0x11c061!==_0x10917d}),_0x11c061;}catch(_0x2152c2){if(_0x2152c2[_0x499e5e(0x13f)]===_0x499e5e(0xf1)){const _0x5e78b0=a0_0x35f3fc[_0x499e5e(0x1be)](_0x10917d);try{const _0x3d5aaf=await a0_0x28e2dc[_0x499e5e(0x191)](_0x5e78b0),_0x324c84=a0_0x35f3fc['join'](_0x3d5aaf,a0_0x35f3fc[_0x499e5e(0xe9)](_0x10917d));return logger[_0x499e5e(0x156)](_0x499e5e(0x19c),_0x499e5e(0x1b0),{'resolved':_0x324c84,'new_file':!![]}),_0x324c84;}catch{logger[_0x499e5e(0x182)]('MCP',_0x499e5e(0xb9),{'raw_path':_0x224140,'error':_0x499e5e(0x106)+_0x5e78b0});throw new Error(_0x499e5e(0x106)+_0x5e78b0);}}logger[_0x499e5e(0x182)](_0x499e5e(0x19c),_0x499e5e(0xb9),{'raw_path':_0x224140,'error':_0x2152c2[_0x499e5e(0xfa)]});throw _0x2152c2;}}const MorphEditFileArgsSchema=z[a0_0x1d9c46(0xe8)]({'path':z[a0_0x1d9c46(0x18b)](),'code_edit':z[a0_0x1d9c46(0x18b)]()[a0_0x1d9c46(0x1dd)](a0_0x1d9c46(0x1b6)),'instruction':z['string']()[a0_0x1d9c46(0x1dd)](a0_0x1d9c46(0x108)),'dryRun':z[a0_0x1d9c46(0xd8)]()[a0_0x1d9c46(0x15c)](![])[a0_0x1d9c46(0x1dd)](a0_0x1d9c46(0x15b))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x1d9c46(0xc4),WarpGrepArgsSchema=z[a0_0x1d9c46(0xe8)]({'search_string':z[a0_0x1d9c46(0x18b)]()[a0_0x1d9c46(0x1dd)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x1d9c46(0x18b)]()[a0_0x1d9c46(0x1dd)](a0_0x1d9c46(0x164)),'search_type':z[a0_0x1d9c46(0xcb)]([a0_0x1d9c46(0x15c),'node_modules'])[a0_0x1d9c46(0x169)]()[a0_0x1d9c46(0x1dd)](a0_0x1d9c46(0xe0))}),WarpGrepGitHubArgsSchema=z[a0_0x1d9c46(0xe8)]({'search_string':z['string']()[a0_0x1d9c46(0x1dd)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()[a0_0x1d9c46(0x1dd)](a0_0x1d9c46(0x19e)),'owner_repo':z[a0_0x1d9c46(0x18b)]()[a0_0x1d9c46(0x169)]()['describe'](a0_0x1d9c46(0xb8)),'branch':z['string']()[a0_0x1d9c46(0x169)]()['describe'](a0_0x1d9c46(0x17d))}),server=new Server({'name':a0_0x1d9c46(0x1d3),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0xfcdf9a=a0_0x1d9c46,_0x204f4f=[{'name':TOOL_NAMES['EDIT_FILE'],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a'+_0xfcdf9a(0xbc)+_0xfcdf9a(0x1a1)+_0xfcdf9a(0xca)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+_0xfcdf9a(0x162)+_0xfcdf9a(0xf5)+_0xfcdf9a(0x10e)+_0xfcdf9a(0xbd)+_0xfcdf9a(0x1cb)+_0xfcdf9a(0x11f)+_0xfcdf9a(0x11d)+_0xfcdf9a(0x15a)+_0xfcdf9a(0x136),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':![]},'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':_0xfcdf9a(0x11b)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0xfcdf9a(0x15f)+_0xfcdf9a(0xd9)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'requiresApiKey':!![]}],_0x5b3d8f=_0x204f4f[_0xfcdf9a(0x18e)](_0x117950=>{const _0x416d13=_0xfcdf9a;if(DISABLED_TOOLS[_0x416d13(0xbe)](_0x117950[_0x416d13(0x16e)]))return console['error'](_0x416d13(0x19f)+_0x117950[_0x416d13(0x16e)]+_0x416d13(0x148)),![];if(_0x416d13(0x1b2)in _0x117950&&_0x117950[_0x416d13(0x1b2)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x117950[_0x416d13(0x16e)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x5b3d8f[_0xfcdf9a(0x1b9)](_0x396687=>({'name':_0x396687['name'],..._0xfcdf9a(0x152)in _0x396687&&_0x396687[_0xfcdf9a(0x152)]?{'title':_0x396687[_0xfcdf9a(0x152)]}:{},'description':_0x396687[_0xfcdf9a(0x12f)],'inputSchema':_0x396687['inputSchema'],..._0xfcdf9a(0x116)in _0x396687&&_0x396687[_0xfcdf9a(0x116)]?{'annotations':_0x396687['annotations']}:{}}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x442046=>{const _0x5c21bd=a0_0x1d9c46,{name:_0x4fd9fb,arguments:_0xdcd00e}=_0x442046['params'],_0x2227e5=Date[_0x5c21bd(0xfd)]();logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),'tool_call_received',{'tool':_0x4fd9fb,'args':_0x4fd9fb===_0x5c21bd(0xd3)?{'path':_0xdcd00e?.[_0x5c21bd(0x14c)],'instruction':_0xdcd00e?.[_0x5c21bd(0xf0)]||_0xdcd00e?.[_0x5c21bd(0x1d1)],'dryRun':_0xdcd00e?.['dryRun']}:_0xdcd00e});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x192)}],'isError':!![]};if(!MORPH_API_KEY[_0x5c21bd(0x1df)]('sk-')&&!MORPH_API_KEY[_0x5c21bd(0x1df)](_0x5c21bd(0x171)))return{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x1a5)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x4fd9fb))return{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x1d8)+_0x4fd9fb+'\x22\x20is\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x4fd9fb){case TOOL_NAMES[_0x5c21bd(0x1aa)]:{let _0x32d9f1=_0xdcd00e;if(_0x32d9f1&&typeof _0x32d9f1===_0x5c21bd(0xe8)){if(!(_0x5c21bd(0x14c)in _0x32d9f1)){const _0x14cea7=_0x32d9f1[_0x5c21bd(0x150)]??_0x32d9f1[_0x5c21bd(0x104)]??_0x32d9f1[_0x5c21bd(0x11e)]??_0x32d9f1[_0x5c21bd(0xbb)]??_0x32d9f1['file'];if(_0x14cea7)_0x32d9f1={..._0x32d9f1,'path':_0x14cea7};}_0x5c21bd(0x1d1)in _0x32d9f1&&!('instruction'in _0x32d9f1)&&(_0x32d9f1={..._0x32d9f1,'instruction':_0x32d9f1[_0x5c21bd(0x1d1)]});if(!(_0x5c21bd(0x120)in _0x32d9f1)){const _0xb612d7=_0x32d9f1[_0x5c21bd(0x13f)]??_0x32d9f1[_0x5c21bd(0x175)]??_0x32d9f1[_0x5c21bd(0x155)]??_0x32d9f1[_0x5c21bd(0x137)];if(_0xb612d7)_0x32d9f1={..._0x32d9f1,'code_edit':_0xb612d7};}}const _0x4cbd86=MorphEditFileArgsSchema[_0x5c21bd(0x10b)](_0x32d9f1);if(!_0x4cbd86[_0x5c21bd(0x14e)])throw new Error(_0x5c21bd(0x181)+_0x4cbd86[_0x5c21bd(0x182)]);const _0x50c989=await validatePath(_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x14c)]);let _0x27b8ff=null,_0x3d9011=!![],_0x5321d2=null;try{_0x27b8ff=await a0_0x28e2dc['readFile'](_0x50c989,'utf-8'),logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),'file_read_complete',{'path':_0x50c989,'size_bytes':_0x27b8ff[_0x5c21bd(0x13b)]});}catch(_0x3b16cb){const _0x3a6110=_0x3b16cb[_0x5c21bd(0x13f)];_0x3a6110===_0x5c21bd(0xf1)?(_0x3d9011=![],_0x27b8ff='',logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),_0x5c21bd(0x1dc),{'path':_0x50c989,'exists':![]})):(_0x5321d2='Failed\x20to\x20read\x20file:\x20'+(_0x3a6110||_0x5c21bd(0x140))+_0x5c21bd(0x126)+(_0x3b16cb instanceof Error?_0x3b16cb[_0x5c21bd(0xfa)]:String(_0x3b16cb)),logger[_0x5c21bd(0x182)](_0x5c21bd(0x19c),_0x5c21bd(0x13a),{'path':_0x50c989,'error':_0x5321d2}),logMcpStderr(_0x5c21bd(0x183)+_0x5321d2));}let _0x3cd2d5;try{const _0x1bf31e=MORPH_API_KEY;if(!_0x1bf31e)throw new Error(_0x5c21bd(0x1bd));const _0x1e2f19=a0_0x35f3fc[_0x5c21bd(0x1be)](_0x50c989),_0x5c8fcd=a0_0x35f3fc[_0x5c21bd(0xe9)](_0x50c989);logger[_0x5c21bd(0x156)]('MCP',_0x5c21bd(0x187),{'model':_0x5c21bd(0x144),'path':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x14c)],'instruction_len':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0xf0)][_0x5c21bd(0x13b)],'code_edit_len':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x120)]['length'],'original_code_len':_0x27b8ff?.[_0x5c21bd(0x13b)]??0x0,'dry_run':_0x4cbd86['data']['dryRun']});const _0x125f82=Date[_0x5c21bd(0xfd)](),_0x4a402f=await executeEditFile({'target_filepath':_0x5c8fcd,'code_edit':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x120)],'instruction':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0xf0)]},{'morphApiKey':_0x1bf31e,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x1e2f19,'autoWrite':!_0x4cbd86[_0x5c21bd(0x157)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x221354=Date[_0x5c21bd(0xfd)]()-_0x125f82;_0x3cd2d5=_0x4a402f['completionId'];if(!_0x4a402f['success'])throw new Error(_0x4a402f[_0x5c21bd(0x182)]||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0x479403=_0x4a402f['changes'],_0x30f9e4=_0x5c21bd(0x111)+_0x479403['linesAdded']+',\x20removed\x20'+_0x479403[_0x5c21bd(0xdc)]+_0x5c21bd(0x1ac)+_0x479403[_0x5c21bd(0xce)];logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),'tool_call_complete',{'tool':_0x5c21bd(0xd3),'success':!![],'latency_ms':Date[_0x5c21bd(0xfd)]()-_0x2227e5,'edit_latency_ms':_0x221354,'changes':{'added':_0x479403[_0x5c21bd(0xde)],'removed':_0x479403[_0x5c21bd(0xdc)],'modified':_0x479403['linesModified']},'completion_id':_0x3cd2d5});if(_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x199)])return{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x13c)+(_0x3d9011?'':_0x5c21bd(0x12a))+':\x20'+_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0xf0)]+_0x5c21bd(0x154)+_0x30f9e4+'.\x20Path:\x20'+_0x4cbd86['data'][_0x5c21bd(0x14c)]+'.'}]};return{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0xe3)+(_0x3d9011?_0x5c21bd(0x14d):_0x5c21bd(0x1cc))+':\x20'+_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0xf0)]+_0x5c21bd(0x154)+_0x30f9e4+_0x5c21bd(0xd5)+_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x14c)]+'.'}]};}catch(_0x1ba89e){const _0x214685=handleMorphAPIError(_0x1ba89e);if(_0x214685)return logger['error'](_0x5c21bd(0x19c),_0x5c21bd(0x18c),{'tool':_0x5c21bd(0xd3),'error':_0x5c21bd(0x18f),'latency_ms':Date[_0x5c21bd(0xfd)]()-_0x2227e5}),_0x214685;const _0x2e09ed=_0x1ba89e instanceof Error?_0x1ba89e[_0x5c21bd(0xfa)]:String(_0x1ba89e);return logger[_0x5c21bd(0x182)]('MCP',_0x5c21bd(0x18c),{'tool':'edit_file','error':_0x2e09ed,'path':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x14c)],'validated_path':_0x50c989,'latency_ms':Date[_0x5c21bd(0xfd)]()-_0x2227e5,'stack':_0x1ba89e instanceof Error?_0x1ba89e[_0x5c21bd(0x1de)]:undefined}),reportMorphError({'error_message':_0x2e09ed,'error_type':_0x1ba89e instanceof Error?_0x1ba89e[_0x5c21bd(0xc3)][_0x5c21bd(0x16e)]:'UnknownError','context':{'tool':_0x5c21bd(0xd3),'completion_id':_0x3cd2d5,'file_path':_0x4cbd86['data'][_0x5c21bd(0x14c)],'validated_path':_0x50c989,'instruction':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0xf0)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x5c21bd(0x144),'dry_run':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x199)],'file_exists':_0x3d9011,'file_read_error':_0x5321d2,'file_readable':_0x27b8ff!==null,'request_content':{'path':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x14c)],'code_edit':_0x4cbd86['data'][_0x5c21bd(0x120)],'instruction':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0xf0)],'original_code':_0x27b8ff!==null?_0x27b8ff[_0x5c21bd(0x13b)]>0xc350?_0x27b8ff['substring'](0x0,0xc350)+_0x5c21bd(0x142)+_0x27b8ff['length']+'\x20chars)':_0x27b8ff:_0x5c21bd(0x1c4)+(_0x5321d2||_0x5c21bd(0xd2))+']','original_code_length':_0x27b8ff?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x5c21bd(0xcd):_0x5c21bd(0x144),'dry_run':_0x4cbd86[_0x5c21bd(0x157)][_0x5c21bd(0x199)]}},'stack_trace':_0x1ba89e instanceof Error?_0x1ba89e[_0x5c21bd(0x1de)]:undefined,'source':'mcp-filesystem'})[_0x5c21bd(0x1cf)](()=>{}),{'content':[{'type':'text','text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x2e09ed}],'isError':!![]};}}case TOOL_NAMES[_0x5c21bd(0x174)]:{const _0x269ab1=WarpGrepArgsSchema[_0x5c21bd(0x10b)](_0xdcd00e);if(!_0x269ab1[_0x5c21bd(0x14e)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x269ab1[_0x5c21bd(0x182)]}],'isError':!![]};const _0x1108a2=_0x2d6861=>{const _0x590b0b=_0x5c21bd,_0x49822a=[];for(const _0x2cd8ea of _0x2d6861||[]){if(_0x2cd8ea[_0x590b0b(0xc2)]===_0x590b0b(0x1ca)&&Array[_0x590b0b(0x1a6)](_0x2cd8ea[_0x590b0b(0x114)]))for(const _0x27ffcb of _0x2cd8ea[_0x590b0b(0x114)]){try{const _0x5d00d6=_0x27ffcb['function']?.[_0x590b0b(0x16e)],_0x1dc051=JSON[_0x590b0b(0x1cd)](_0x27ffcb[_0x590b0b(0xdb)]?.[_0x590b0b(0x138)]||'{}');if(_0x5d00d6===_0x590b0b(0x103))_0x49822a[_0x590b0b(0x194)]('grep\x20\x27'+_0x1dc051[_0x590b0b(0xfe)]+'\x27\x20'+(_0x1dc051['path']||'.'));else{if(_0x5d00d6===_0x590b0b(0x1ab))_0x49822a[_0x590b0b(0x194)](_0x590b0b(0x1ad)+_0x1dc051[_0x590b0b(0x14c)]);else{if(_0x5d00d6===_0x590b0b(0x1ae))_0x49822a[_0x590b0b(0x194)](_0x590b0b(0x132)+(_0x1dc051[_0x590b0b(0x1a0)]||'.'));else{if(_0x5d00d6===_0x590b0b(0xee))_0x49822a['push'](_0x590b0b(0xba)+_0x1dc051[_0x590b0b(0xfe)]+'\x27\x20'+(_0x1dc051[_0x590b0b(0x14c)]||'.'));else _0x5d00d6===_0x590b0b(0x179)&&_0x49822a['push'](_0x590b0b(0x179));}}}}catch{}}}return _0x49822a;},_0xa4fc92=_0x79a9f4=>{const _0x1a4d9c=_0x5c21bd,_0x379470=[];if(!_0x79a9f4||!Array[_0x1a4d9c(0x1a6)](_0x79a9f4))return _0x379470;const _0xd3598e=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1a4d9c(0x178),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1a4d9c(0x16a),'tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x1a4d9c(0x10c),'tool':_0x1a4d9c(0x1ab)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1a4d9c(0x160),'tool':_0x1a4d9c(0x1ab)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1a4d9c(0x12c),'tool':_0x1a4d9c(0xda)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1a4d9c(0xc1),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1a4d9c(0x160),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x1a4d9c(0xea),'tool':_0x1a4d9c(0x1ab)},{'pattern':/not a text file/,'error_type':_0x1a4d9c(0x160),'tool':_0x1a4d9c(0x1ab)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x1a4d9c(0x1ab)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x1a4d9c(0x1ab)},{'pattern':/status="error"/,'error_type':_0x1a4d9c(0x153),'tool':_0x1a4d9c(0x140)}];let _0x44935f=0x0;for(const _0x140830 of _0x79a9f4){_0x140830[_0x1a4d9c(0xc2)]===_0x1a4d9c(0x1ca)&&Array[_0x1a4d9c(0x1a6)](_0x140830['tool_calls'])&&_0x44935f++;const _0x165915=_0x140830[_0x1a4d9c(0x155)];if((_0x140830[_0x1a4d9c(0xc2)]===_0x1a4d9c(0x13d)||_0x140830[_0x1a4d9c(0xc2)]===_0x1a4d9c(0x15d))&&_0x165915&&typeof _0x165915==='string')for(const {pattern:_0x563669,error_type:_0x26e0b5,tool:_0x36857a}of _0xd3598e){const _0x404730=_0x165915[_0x1a4d9c(0x1b1)](new RegExp(_0x563669['source'],'g'));if(_0x404730)for(const _0x19f62c of _0x404730){const _0x155ba9=_0x165915[_0x1a4d9c(0xc0)](_0x19f62c),_0x11e133=_0x165915['substring'](_0x155ba9,Math[_0x1a4d9c(0x1e1)](_0x155ba9+0xc8,_0x165915[_0x1a4d9c(0x13b)]));_0x379470[_0x1a4d9c(0x194)]({'tool':_0x36857a,'error_type':_0x26e0b5,'error_message':_0x11e133['split']('\x0a')[0x0],'turn':_0x44935f});}}}return _0x379470;};try{const _0x3eba0a=a0_0x35f3fc['resolve'](_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)]),_0x4dac1c=_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x189)],_0x173f63=_0x4dac1c===_0x5c21bd(0x16d)?{'allowNames':['node_modules']}:undefined,_0x259691=new LocalRipgrepProvider(_0x3eba0a,undefined,_0x173f63);logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),_0x5c21bd(0x11a),{'type':'LocalRipgrepProvider','repo_root':_0x3eba0a,'search_type':_0x4dac1c||_0x5c21bd(0x15c)}),logger[_0x5c21bd(0x156)]('MCP','warp_grep_start',{'query':_0x269ab1['data'][_0x5c21bd(0x14b)],'repo_root':_0x3eba0a,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x24b6fb=Date['now'](),_0x29d4f3=await runWarpGrep({'searchTerm':_0x269ab1['data'][_0x5c21bd(0x14b)],'repoRoot':_0x3eba0a,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x259691,'search_type':_0x4dac1c}),_0x2db43f=Date[_0x5c21bd(0xfd)]()-_0x24b6fb,_0x12d58a=_0x29d4f3[_0x5c21bd(0x179)]?.['metadata']?.['files']?.[_0x5c21bd(0x13b)]??0x0;logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),_0x5c21bd(0x107),{'termination':_0x29d4f3[_0x5c21bd(0x193)],'turns':_0x29d4f3['timings']?.[_0x5c21bd(0xc7)]??0x0,'files_found':_0x12d58a,'latency_ms':_0x2db43f});const _0x3fc8e4=_0xa4fc92(_0x29d4f3[_0x5c21bd(0x1c9)]);_0x3fc8e4[_0x5c21bd(0x13b)]>0x0&&reportMorphError({'error_message':_0x5c21bd(0x1d0)+_0x3fc8e4[_0x5c21bd(0x13b)]+_0x5c21bd(0x172),'error_type':_0x5c21bd(0x19a),'level':'warn','tool':_0x5c21bd(0xec),'context':{'repo_path':_0x269ab1['data'][_0x5c21bd(0x105)],'query':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'model':_0x5c21bd(0xe6),'termination_reason':_0x29d4f3[_0x5c21bd(0x193)],'sub_tool_errors':_0x3fc8e4,'timings':_0x29d4f3[_0x5c21bd(0x173)],'tool_calls':_0x1108a2(_0x29d4f3[_0x5c21bd(0x1c9)]),'messages':_0x29d4f3[_0x5c21bd(0x1c9)]?.['map'](_0x26d619=>({'role':_0x26d619[_0x5c21bd(0xc2)],'content':_0x26d619[_0x5c21bd(0x155)],..._0x26d619[_0x5c21bd(0x114)]?{'tool_calls':_0x26d619[_0x5c21bd(0x114)][_0x5c21bd(0x13b)]}:{},..._0x26d619[_0x5c21bd(0x110)]?{'tool_call_id':_0x26d619[_0x5c21bd(0x110)]}:{}}))},'source':_0x5c21bd(0x124)})[_0x5c21bd(0x1cf)](()=>{});let _0x2aac23='';if(_0x29d4f3[_0x5c21bd(0x193)]===_0x5c21bd(0x190)&&_0x29d4f3[_0x5c21bd(0x179)]?.[_0x5c21bd(0x134)]?.[_0x5c21bd(0x109)]){const _0xb31a5f=_0x29d4f3['finish'][_0x5c21bd(0x134)][_0x5c21bd(0x109)];if(_0xb31a5f['length']===0x0)return _0x2aac23=_0x29d4f3['finish']['payload']||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x5c21bd(0x131),'text':_0x2aac23}]};const _0x3dcb63=[],_0x1ca1a3=[_0x5c21bd(0x19d)];for(const _0x3e74fb of _0x29d4f3[_0x5c21bd(0x1c9)]){if(_0x3e74fb['role']===_0x5c21bd(0x1ca)&&Array[_0x5c21bd(0x1a6)](_0x3e74fb[_0x5c21bd(0x114)]))for(const _0x1addb5 of _0x3e74fb[_0x5c21bd(0x114)]){try{const _0x17e11b=_0x1addb5[_0x5c21bd(0xdb)]?.['name'],_0x58ea62=JSON[_0x5c21bd(0x1cd)](_0x1addb5['function']?.[_0x5c21bd(0x138)]||'{}');if(_0x17e11b==='grep_search')_0x1ca1a3['push']('-\x20Grepped\x20\x27'+_0x58ea62['pattern']+_0x5c21bd(0xc9)+(_0x58ea62['path']||'.')+'`');else{if(_0x17e11b===_0x5c21bd(0x1ab))_0x1ca1a3[_0x5c21bd(0x194)](_0x5c21bd(0x1a3)+_0x58ea62['path']+'`');else{if(_0x17e11b==='list_directory')_0x1ca1a3[_0x5c21bd(0x194)](_0x5c21bd(0x145)+(_0x58ea62[_0x5c21bd(0x1a0)]||'.')+'`');else _0x17e11b===_0x5c21bd(0xee)&&_0x1ca1a3['push'](_0x5c21bd(0xf8)+_0x58ea62['pattern']+_0x5c21bd(0x1b5)+(_0x58ea62['path']||'.')+'`');}}}catch{}}}_0x3dcb63['push'](_0x1ca1a3['join']('\x0a'));const _0x4e9889=['',_0x5c21bd(0x176)];for(const _0x26b545 of _0xb31a5f){if(_0x26b545[_0x5c21bd(0xcf)]==='*')_0x4e9889[_0x5c21bd(0x194)]('-\x20'+_0x26b545[_0x5c21bd(0x14c)]+':*');else{if(Array[_0x5c21bd(0x1a6)](_0x26b545[_0x5c21bd(0xcf)])){const _0x2e10db=_0x26b545[_0x5c21bd(0xcf)][_0x5c21bd(0x1b9)](([_0x5c5971,_0xe2f4e0])=>{if(_0x5c5971===_0xe2f4e0)return''+_0x5c5971;return _0x5c5971+'-'+_0xe2f4e0;});_0x4e9889[_0x5c21bd(0x194)]('-\x20'+_0x26b545['path']+':'+_0x2e10db[_0x5c21bd(0x1d4)](','));}else _0x4e9889[_0x5c21bd(0x194)]('-\x20'+_0x26b545['path']+':*');}}_0x4e9889[_0x5c21bd(0x194)](''),_0x3dcb63['push'](_0x4e9889[_0x5c21bd(0x1d4)]('\x0a')),_0x3dcb63[_0x5c21bd(0x194)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x4be5bd=[],_0x381bb5=[];for(const _0x2a6e95 of _0xb31a5f){let _0x4cbc93=a0_0x35f3fc['resolve'](_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)],_0x2a6e95['path']),_0x4c31c7=null,_0x11a0b0=null;try{_0x4c31c7=await a0_0x28e2dc[_0x5c21bd(0x117)](_0x4cbc93,{'encoding':'utf-8'});}catch(_0x23292c){const _0x48c821=fixPathRepetition(_0x4cbc93);if(_0x48c821)try{_0x4c31c7=await a0_0x28e2dc['readFile'](_0x48c821,{'encoding':_0x5c21bd(0x1a2)}),_0x4cbc93=_0x48c821;}catch{_0x11a0b0=_0x23292c instanceof Error?_0x23292c:new Error(String(_0x23292c));}else _0x11a0b0=_0x23292c instanceof Error?_0x23292c:new Error(String(_0x23292c));}if(_0x4c31c7!==null){const _0x206f10=_0x4c31c7['split'](/\r?\n/),_0x1ee75f=[];if(_0x2a6e95[_0x5c21bd(0xcf)]==='*'||!Array[_0x5c21bd(0x1a6)](_0x2a6e95[_0x5c21bd(0xcf)]))for(let _0x16e936=0x1;_0x16e936<=_0x206f10[_0x5c21bd(0x13b)];_0x16e936++){const _0x1abbbe=_0x206f10[_0x16e936-0x1];_0x1ee75f[_0x5c21bd(0x194)](_0x16e936+'|\x20'+_0x1abbbe);}else for(const [_0x556410,_0x4b9df0]of _0x2a6e95[_0x5c21bd(0xcf)]){_0x1ee75f[_0x5c21bd(0x13b)]>0x0&&_0x1ee75f['push']('');for(let _0x50826e=_0x556410;_0x50826e<=_0x4b9df0&&_0x50826e<=_0x206f10[_0x5c21bd(0x13b)];_0x50826e++){const _0x5215e2=_0x206f10[_0x50826e-0x1];_0x1ee75f[_0x5c21bd(0x194)](_0x50826e+'|\x20'+_0x5215e2);}}_0x381bb5[_0x5c21bd(0x194)]({'path':_0x2a6e95[_0x5c21bd(0x14c)],'content':_0x1ee75f[_0x5c21bd(0x1d4)]('\x0a')});}else _0x4be5bd['push'](_0x5c21bd(0x185)+_0x2a6e95[_0x5c21bd(0x14c)]+_0x5c21bd(0x17a)+(_0x11a0b0?.[_0x5c21bd(0xfa)]||'Unknown\x20error')+_0x5c21bd(0x10a));}try{const _0x425a93=await compactFileContexts(_0x381bb5,_0x269ab1['data'][_0x5c21bd(0x14b)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3d918a of _0x425a93){_0x4be5bd[_0x5c21bd(0x194)]('<file\x20path=\x22'+_0x3d918a[_0x5c21bd(0x14c)]+_0x5c21bd(0x16b)+_0x3d918a[_0x5c21bd(0x155)]+'\x0a</file>');}}catch(_0x1aec49){logger[_0x5c21bd(0x1c3)](_0x5c21bd(0x19c),_0x5c21bd(0x1bc),{'error':_0x1aec49 instanceof Error?_0x1aec49[_0x5c21bd(0xfa)]:String(_0x1aec49),'files_count':_0x381bb5[_0x5c21bd(0x13b)]});for(const _0x42acd5 of _0x381bb5){_0x4be5bd['push']('<file\x20path=\x22'+_0x42acd5[_0x5c21bd(0x14c)]+_0x5c21bd(0x16b)+_0x42acd5[_0x5c21bd(0x155)]+_0x5c21bd(0x10a));}}_0x3dcb63[_0x5c21bd(0x194)](_0x4be5bd['join']('\x0a\x0a')),_0x2aac23=_0x3dcb63[_0x5c21bd(0x1d4)]('\x0a');const _0x1626dc=_0x29d4f3['errors']?.[_0x5c21bd(0x18e)](_0x21d05d=>_0x21d05d[_0x5c21bd(0xfa)]?.['startsWith']('File\x20read\x20error:'))||[];if(_0x1626dc[_0x5c21bd(0x13b)]>0x0){const _0x151409=_0x1626dc[_0x5c21bd(0x1b9)](_0x1c27a9=>_0x1c27a9[_0x5c21bd(0xfa)])[_0x5c21bd(0x1d4)](';\x20');reportMorphError({'error_message':_0x151409,'error_type':_0x5c21bd(0xf6),'context':{'tool':_0x5c21bd(0xec),'repo_path':_0x269ab1[_0x5c21bd(0x157)]['repo_path'],'query':_0x269ab1['data']['search_string'],'model':_0x5c21bd(0xe6),'termination_reason':_0x5c21bd(0x143),'error_count':_0x1626dc['length'],'is_timeout':![],'timings':_0x29d4f3[_0x5c21bd(0x173)],'files_attempted':_0xb31a5f[_0x5c21bd(0x1b9)](_0x311f62=>({'path':_0x311f62[_0x5c21bd(0x14c)],'lines':_0x311f62[_0x5c21bd(0xcf)]})),'tool_calls':_0x1108a2(_0x29d4f3['messages']),'messages':_0x29d4f3[_0x5c21bd(0x1c9)]?.[_0x5c21bd(0x1b9)](_0x5d0975=>({'role':_0x5d0975['role'],'content':_0x5d0975[_0x5c21bd(0x155)],..._0x5d0975[_0x5c21bd(0x114)]?{'tool_calls':_0x5d0975['tool_calls'][_0x5c21bd(0x13b)]}:{},..._0x5d0975['tool_call_id']?{'tool_call_id':_0x5d0975[_0x5c21bd(0x110)]}:{}})),'request_content':{'query':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'repo_path':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)],'repoRoot':a0_0x35f3fc['resolve'](_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)]),'model':'morph-warp-grep-v2.1'}},'source':_0x5c21bd(0x124)})['catch'](()=>{});}}else{if(_0x29d4f3['terminationReason']==='terminated'&&_0x29d4f3[_0x5c21bd(0x141)][_0x5c21bd(0x13b)]>0x0){const _0x3426f7=_0x29d4f3['errors'][_0x5c21bd(0x1b9)](_0x610917=>_0x610917[_0x5c21bd(0xfa)])[_0x5c21bd(0x1d4)](';\x20');_0x2aac23=_0x5c21bd(0x184)+_0x3426f7;const _0x12f701=_0x3426f7[_0x5c21bd(0x113)]()[_0x5c21bd(0x161)](_0x5c21bd(0xe1))||_0x3426f7[_0x5c21bd(0x113)]()[_0x5c21bd(0x161)]('timed\x20out')||_0x3426f7[_0x5c21bd(0x113)]()[_0x5c21bd(0x161)](_0x5c21bd(0x18d)),_0x1b370e=_0x29d4f3['finish']?.[_0x5c21bd(0x134)]?.[_0x5c21bd(0x109)],_0x897778=_0x29d4f3[_0x5c21bd(0x141)][0x0];reportMorphError({'error_message':_0x3426f7,'error_type':_0x12f701?_0x5c21bd(0x1a4):_0x897778?.[_0x5c21bd(0xc3)]?.[_0x5c21bd(0x16e)]||_0x5c21bd(0x1b8),'context':{'tool':_0x5c21bd(0xec),'repo_path':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)],'query':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'model':_0x5c21bd(0xe6),'termination_reason':_0x29d4f3['terminationReason'],'error_count':_0x29d4f3[_0x5c21bd(0x141)][_0x5c21bd(0x13b)],'is_timeout':_0x12f701,'timings':_0x29d4f3[_0x5c21bd(0x173)],'files_attempted':_0x1b370e?.[_0x5c21bd(0x1b9)](_0x572919=>({'path':_0x572919[_0x5c21bd(0x14c)],'lines':_0x572919[_0x5c21bd(0xcf)]})),'tool_calls':_0x1108a2(_0x29d4f3['messages']),'messages':_0x29d4f3[_0x5c21bd(0x1c9)]?.[_0x5c21bd(0x1b9)](_0x3d74b9=>({'role':_0x3d74b9[_0x5c21bd(0xc2)],'content':_0x3d74b9[_0x5c21bd(0x155)],..._0x3d74b9[_0x5c21bd(0x114)]?{'tool_calls':_0x3d74b9[_0x5c21bd(0x114)][_0x5c21bd(0x13b)]}:{},..._0x3d74b9[_0x5c21bd(0x110)]?{'tool_call_id':_0x3d74b9[_0x5c21bd(0x110)]}:{}})),'request_content':{'query':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'repo_path':_0x269ab1['data'][_0x5c21bd(0x105)],'repoRoot':a0_0x35f3fc['resolve'](_0x269ab1[_0x5c21bd(0x157)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x897778?.[_0x5c21bd(0x1de)]||undefined,'source':_0x5c21bd(0x124)})[_0x5c21bd(0x1cf)](()=>{});}else _0x2aac23=_0x5c21bd(0x16f);}return{'content':[{'type':_0x5c21bd(0x131),'text':_0x2aac23}]};}catch(_0x3ee3ba){const _0x2758c6=handleMorphAPIError(_0x3ee3ba);if(_0x2758c6)return logger[_0x5c21bd(0x182)](_0x5c21bd(0x19c),_0x5c21bd(0x18c),{'tool':_0x5c21bd(0xec),'error':_0x5c21bd(0x18f),'latency_ms':Date[_0x5c21bd(0xfd)]()-_0x2227e5}),_0x2758c6;const _0x133192=_0x3ee3ba instanceof Error?_0x3ee3ba['message']:String(_0x3ee3ba);logger[_0x5c21bd(0x182)]('MCP',_0x5c21bd(0x18c),{'tool':_0x5c21bd(0xec),'error':_0x133192,'repo_path':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)],'query':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'latency_ms':Date[_0x5c21bd(0xfd)]()-_0x2227e5});const _0x5b98b3=_0x133192[_0x5c21bd(0x113)]()[_0x5c21bd(0x161)](_0x5c21bd(0xe1))||_0x133192[_0x5c21bd(0x113)]()[_0x5c21bd(0x161)](_0x5c21bd(0x1ba))||_0x133192[_0x5c21bd(0x113)]()[_0x5c21bd(0x161)](_0x5c21bd(0x18d))||_0x3ee3ba instanceof Error&&_0x3ee3ba[_0x5c21bd(0x16e)]===_0x5c21bd(0x1a4);return reportMorphError({'error_message':_0x133192,'error_type':_0x5b98b3?'TimeoutError':_0x3ee3ba instanceof Error?_0x3ee3ba[_0x5c21bd(0xc3)]['name']:_0x5c21bd(0x159),'context':{'tool':_0x5c21bd(0xec),'repo_path':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)],'query':_0x269ab1[_0x5c21bd(0x157)]['search_string'],'model':_0x5c21bd(0xe6),'is_timeout':_0x5b98b3,'exception_phase':_0x5c21bd(0x15e),'request_content':{'query':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'repo_path':_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)],'repoRoot':a0_0x35f3fc[_0x5c21bd(0x13e)](_0x269ab1[_0x5c21bd(0x157)][_0x5c21bd(0x105)]),'model':_0x5c21bd(0xe6)}},'stack_trace':_0x3ee3ba instanceof Error?_0x3ee3ba['stack']:undefined,'source':_0x5c21bd(0x124)})[_0x5c21bd(0x1cf)](()=>{}),{'content':[{'type':'text','text':_0x5c21bd(0x177)+_0x133192}],'isError':![]};}}case TOOL_NAMES[_0x5c21bd(0x149)]:{const _0x1b2bec=WarpGrepGitHubArgsSchema[_0x5c21bd(0x10b)](_0xdcd00e);if(!_0x1b2bec['success'])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x1b2bec['error']}],'isError':!![]};const _0x2a3d0f=_0x1b2bec[_0x5c21bd(0x157)][_0x5c21bd(0xe2)]||_0x1b2bec['data'][_0x5c21bd(0x1a9)];if(!_0x2a3d0f)return{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x129)}],'isError':!![]};const _0x5ac0d5=MORPH_API_KEY;if(!_0x5ac0d5)throw new Error(_0x5c21bd(0x1bd));const _0x271cd4=Date[_0x5c21bd(0xfd)]();logger[_0x5c21bd(0x156)](_0x5c21bd(0x19c),_0x5c21bd(0x1e0),{'identifier':_0x2a3d0f,'query':_0x1b2bec['data']['search_string'],'branch':_0x1b2bec[_0x5c21bd(0x157)][_0x5c21bd(0x16c)]});try{const _0x123002=new WarpGrepClient({'morphApiKey':_0x5ac0d5,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x1ba6de=await _0x123002[_0x5c21bd(0x14a)]({'searchTerm':_0x1b2bec['data'][_0x5c21bd(0x14b)],'github':_0x2a3d0f,'branch':_0x1b2bec['data'][_0x5c21bd(0x16c)]}),_0x4effd3=Date[_0x5c21bd(0xfd)]()-_0x271cd4;logMcpStderr(_0x5c21bd(0x102)+_0x4effd3+_0x5c21bd(0xf2)+_0x1ba6de[_0x5c21bd(0x14e)]);const _0xb81194=formatResult(_0x1ba6de);return{'content':[{'type':_0x5c21bd(0x131),'text':_0xb81194}]};}catch(_0x1b6684){const _0x23369c=handleMorphAPIError(_0x1b6684);if(_0x23369c)return _0x23369c;const _0x3c98d3=Date[_0x5c21bd(0xfd)]()-_0x271cd4,_0x16fe20=_0x1b6684 instanceof Error?_0x1b6684[_0x5c21bd(0xfa)]:String(_0x1b6684);return logMcpStderr(_0x5c21bd(0xff)+_0x3c98d3+'ms:',_0x16fe20),reportMorphError({'error_message':_0x16fe20,'error_type':_0x1b6684 instanceof Error?_0x1b6684[_0x5c21bd(0xc3)][_0x5c21bd(0x16e)]:_0x5c21bd(0x159),'context':{'tool':'github_codebase_search','github_url':_0x2a3d0f,'search_string':_0x1b2bec[_0x5c21bd(0x157)][_0x5c21bd(0x14b)],'branch':_0x1b2bec[_0x5c21bd(0x157)][_0x5c21bd(0x16c)]},'stack_trace':_0x1b6684 instanceof Error?_0x1b6684[_0x5c21bd(0x1de)]:undefined,'source':_0x5c21bd(0x124),'tool':'github_codebase_search','latency_ms':_0x3c98d3})[_0x5c21bd(0x1cf)](()=>{}),{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x147)+_0x16fe20}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x4fd9fb);}}catch(_0x492738){const _0x549b1d=_0x492738 instanceof Error?_0x492738[_0x5c21bd(0xfa)]:String(_0x492738);return reportMorphError({'error_message':_0x549b1d,'error_type':_0x492738 instanceof Error?_0x492738[_0x5c21bd(0xc3)][_0x5c21bd(0x16e)]:_0x5c21bd(0x159),'context':{'tool':_0x4fd9fb,'arguments':_0xdcd00e?JSON[_0x5c21bd(0x195)](_0xdcd00e)[_0x5c21bd(0x17c)](0x0,0x1f4):undefined,'mcp_server_version':_0x5c21bd(0xf3)},'stack_trace':_0x492738 instanceof Error?_0x492738['stack']:undefined,'source':_0x5c21bd(0x124)})[_0x5c21bd(0x1cf)](()=>{}),{'content':[{'type':_0x5c21bd(0x131),'text':_0x5c21bd(0x184)+_0x549b1d}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x2b347c){const _0x28c2a7=a0_0x1d9c46,_0x270ff2=await getValidRootDirectories(_0x2b347c);if(_0x270ff2[_0x28c2a7(0x13b)]>0x0)allowedDirectories=[..._0x270ff2],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x270ff2['length']+_0x28c2a7(0xdd));else{logMcpStderr(_0x28c2a7(0x1a8));if(ENABLE_WORKSPACE_MODE)try{const _0x477284=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x477284&&(allowedDirectories=[_0x477284],logMcpStderr(_0x28c2a7(0x112)+_0x477284));}catch(_0x1017f1){logMcpStderr(_0x28c2a7(0x146)+_0x1017f1);}}}server[a0_0x1d9c46(0xed)](RootsListChangedNotificationSchema,async()=>{const _0x595177=a0_0x1d9c46;try{const _0x15554e=await server[_0x595177(0xd6)]();_0x15554e&&_0x595177(0x11c)in _0x15554e&&await updateAllowedDirectoriesFromRoots(_0x15554e[_0x595177(0x11c)]);}catch(_0x1349f0){logMcpStderr(_0x595177(0x125),_0x1349f0 instanceof Error?_0x1349f0[_0x595177(0xfa)]:String(_0x1349f0));}}),server[a0_0x1d9c46(0x12b)]=async()=>{const _0x341aeb=a0_0x1d9c46,_0x46864=server['getClientCapabilities']();if(_0x46864?.[_0x341aeb(0x11c)])try{const _0x262891=await server[_0x341aeb(0xd6)]();_0x262891&&_0x341aeb(0x11c)in _0x262891?await updateAllowedDirectoriesFromRoots(_0x262891['roots']):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x465858){logMcpStderr(_0x341aeb(0x100),_0x465858 instanceof Error?_0x465858[_0x341aeb(0xfa)]:String(_0x465858));}else{if(allowedDirectories[_0x341aeb(0x13b)]>0x0)logMcpStderr(_0x341aeb(0xd4),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x341aeb(0x196));else throw new Error('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.');}}};async function runServer(){const _0x3d92dc=a0_0x1d9c46,_0x24ee36=new StdioServerTransport();await server['connect'](_0x24ee36),logMcpStderr(_0x3d92dc(0x12d)),allowedDirectories[_0x3d92dc(0x13b)]===0x0&&logMcpStderr(_0x3d92dc(0x1c0));}runServer()[a0_0x1d9c46(0x1cf)](_0x4e0a39=>{const _0x40e2ea=a0_0x1d9c46;logMcpStderr(_0x40e2ea(0xfc),_0x4e0a39),process[_0x40e2ea(0x139)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- function a1_0x1588(_0x4bcb97,_0x16196c){_0x4bcb97=_0x4bcb97-0x109;var _0x596c4f=a1_0x596c();var _0x158820=_0x596c4f[_0x4bcb97];return _0x158820;}var a1_0x29a2fc=a1_0x1588;(function(_0x4b15cf,_0x20c915){var _0x51a34d=a1_0x1588,_0x1af435=_0x4b15cf();while(!![]){try{var _0x3040c7=-parseInt(_0x51a34d(0x10b))/0x1*(-parseInt(_0x51a34d(0x10d))/0x2)+-parseInt(_0x51a34d(0x116))/0x3+-parseInt(_0x51a34d(0x118))/0x4+parseInt(_0x51a34d(0x115))/0x5+parseInt(_0x51a34d(0x10a))/0x6+-parseInt(_0x51a34d(0x110))/0x7*(parseInt(_0x51a34d(0x111))/0x8)+-parseInt(_0x51a34d(0x117))/0x9*(-parseInt(_0x51a34d(0x114))/0xa);if(_0x3040c7===_0x20c915)break;else _0x1af435['push'](_0x1af435['shift']());}catch(_0x53e7f0){_0x1af435['push'](_0x1af435['shift']());}}}(a1_0x596c,0xdf716));import a1_0x46af0a from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x30640b=a1_0x46af0a[a1_0x29a2fc(0x10f)]()){var _0x1d757d=a1_0x29a2fc;switch(_0x30640b){case _0x1d757d(0x113):return _0x1d757d(0x10c);case'win32':return _0x1d757d(0x119);case'linux':return'Linux';default:return _0x1d757d(0x11a);}}function a1_0x596c(){var _0x357ee7=['1098482aPtszv','info','platform','354998BQyLxW','88pJNKuq','error','darwin','10DGgNpm','3862900xeXfzQ','3936441eHKrcn','3281697HKtaRs','788676RPGBhA','Windows','Unknown','[os=','MCP','4480182wjqDtk','2pWAQSz','macOS'];a1_0x596c=function(){return _0x357ee7;};return a1_0x596c();}export function formatMcpLogMessage(_0x58f037,_0x2d63c6=a1_0x46af0a['platform']()){var _0x23c3bf=a1_0x29a2fc;return _0x23c3bf(0x11b)+getOperatingSystemType(_0x2d63c6)+']\x20'+_0x58f037;}export function logMcpStderr(_0x373bb5,..._0x1e4315){var _0x40bf66=a1_0x29a2fc;console[_0x40bf66(0x112)](formatMcpLogMessage(_0x373bb5),..._0x1e4315),logger[_0x40bf66(0x10e)](_0x40bf66(0x109),_0x373bb5,_0x1e4315['length']?{'args':_0x1e4315['map'](_0xee13f5=>String(_0xee13f5))}:undefined);}
1
+ var a1_0x3062df=a1_0x5bc8;(function(_0x16df18,_0x3defbc){var _0x451d1e=a1_0x5bc8,_0x48ab01=_0x16df18();while(!![]){try{var _0x206cb4=parseInt(_0x451d1e(0x193))/0x1*(-parseInt(_0x451d1e(0x1a5))/0x2)+parseInt(_0x451d1e(0x1a4))/0x3+-parseInt(_0x451d1e(0x198))/0x4*(parseInt(_0x451d1e(0x1a3))/0x5)+parseInt(_0x451d1e(0x1a1))/0x6+parseInt(_0x451d1e(0x19d))/0x7+-parseInt(_0x451d1e(0x192))/0x8*(parseInt(_0x451d1e(0x199))/0x9)+-parseInt(_0x451d1e(0x19f))/0xa*(-parseInt(_0x451d1e(0x19a))/0xb);if(_0x206cb4===_0x3defbc)break;else _0x48ab01['push'](_0x48ab01['shift']());}catch(_0x557988){_0x48ab01['push'](_0x48ab01['shift']());}}}(a1_0x270e,0xcbb8b));function a1_0x270e(){var _0x560143=['338481VziMKL','44OzdOUH','Windows','[os=','298508wrzrpJ','Unknown','5056180BtMSmr','platform','2480598oCLCJn','info','2764495xBcZFt','357903tGnElI','148MwTBVk','map','Linux','56XsfvyQ','5329gqZMoN','darwin','macOS','error','linux','8vBuCpB'];a1_0x270e=function(){return _0x560143;};return a1_0x270e();}import a1_0x19e75e from'os';import{logger}from'./logger.js';function a1_0x5bc8(_0x2819c0,_0x1ca3c4){_0x2819c0=_0x2819c0-0x190;var _0x270ee1=a1_0x270e();var _0x5bc879=_0x270ee1[_0x2819c0];return _0x5bc879;}export function getOperatingSystemType(_0x170b77=a1_0x19e75e[a1_0x3062df(0x1a0)]()){var _0x575b78=a1_0x3062df;switch(_0x170b77){case _0x575b78(0x194):return _0x575b78(0x195);case'win32':return _0x575b78(0x19b);case _0x575b78(0x197):return _0x575b78(0x191);default:return _0x575b78(0x19e);}}export function formatMcpLogMessage(_0x237551,_0x1f2c58=a1_0x19e75e['platform']()){var _0x14b91f=a1_0x3062df;return _0x14b91f(0x19c)+getOperatingSystemType(_0x1f2c58)+']\x20'+_0x237551;}export function logMcpStderr(_0x236161,..._0x245089){var _0x371367=a1_0x3062df;console[_0x371367(0x196)](formatMcpLogMessage(_0x236161),..._0x245089),logger[_0x371367(0x1a2)]('MCP',_0x236161,_0x245089['length']?{'args':_0x245089[_0x371367(0x190)](_0xed0a7d=>String(_0xed0a7d))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- function a2_0x3bcd(_0x494124,_0x42b54c){_0x494124=_0x494124-0x79;const _0x3e3676=a2_0x3e36();let _0x3bcd0b=_0x3e3676[_0x494124];return _0x3bcd0b;}const a2_0x48d925=a2_0x3bcd;(function(_0x34a739,_0x54d7f6){const _0xe235ad=a2_0x3bcd,_0x18ccff=_0x34a739();while(!![]){try{const _0xb62537=parseInt(_0xe235ad(0x85))/0x1+-parseInt(_0xe235ad(0x84))/0x2*(-parseInt(_0xe235ad(0x7a))/0x3)+parseInt(_0xe235ad(0x89))/0x4+parseInt(_0xe235ad(0x91))/0x5*(-parseInt(_0xe235ad(0x7b))/0x6)+-parseInt(_0xe235ad(0x80))/0x7+parseInt(_0xe235ad(0x8e))/0x8+-parseInt(_0xe235ad(0x81))/0x9*(parseInt(_0xe235ad(0x87))/0xa);if(_0xb62537===_0x54d7f6)break;else _0x18ccff['push'](_0x18ccff['shift']());}catch(_0x2aa6c0){_0x18ccff['push'](_0x18ccff['shift']());}}}(a2_0x3e36,0x4dcf8));import{createWriteStream}from'fs';class MorphLogger{[a2_0x48d925(0x90)];['fileStream'];constructor(){const _0x4f1451=a2_0x48d925;this[_0x4f1451(0x90)]=process[_0x4f1451(0x86)][_0x4f1451(0x8a)]==='1'||!!process['env'][_0x4f1451(0x79)];const _0x33bb0c=process[_0x4f1451(0x86)][_0x4f1451(0x79)];this['fileStream']=_0x33bb0c?createWriteStream(_0x33bb0c,{'flags':'a'}):null;}[a2_0x48d925(0x7e)](_0x58c917,_0x57a760,_0x64c564){const _0x19df6d=a2_0x48d925;this[_0x19df6d(0x8b)](_0x19df6d(0x7e),_0x58c917,_0x57a760,_0x64c564);}[a2_0x48d925(0x8c)](_0x51ab7a,_0x1963aa,_0x507bc8){const _0x5bf7f4=a2_0x48d925;this[_0x5bf7f4(0x8b)]('info',_0x51ab7a,_0x1963aa,_0x507bc8);}[a2_0x48d925(0x7f)](_0x589db1,_0xd9c19d,_0x5c1242){const _0x62d642=a2_0x48d925;this[_0x62d642(0x8b)](_0x62d642(0x7f),_0x589db1,_0xd9c19d,_0x5c1242);}['error'](_0x1254e7,_0x32411d,_0x32a020){const _0x3fde0e=a2_0x48d925;this[_0x3fde0e(0x8b)](_0x3fde0e(0x8f),_0x1254e7,_0x32411d,_0x32a020);}[a2_0x48d925(0x7d)](){const _0x40df4a=a2_0x48d925;this[_0x40df4a(0x90)]=!![];}get[a2_0x48d925(0x82)](){const _0x33aa86=a2_0x48d925;return this[_0x33aa86(0x90)];}[a2_0x48d925(0x8b)](_0x463906,_0x2874af,_0x272572,_0x511cdd){const _0x4e77d2=a2_0x48d925;if(_0x463906!==_0x4e77d2(0x8f)&&!this[_0x4e77d2(0x90)])return;const _0x8d9e68=new Date()[_0x4e77d2(0x7c)](),_0xe0ab77='['+_0x8d9e68+']\x20['+_0x463906['toUpperCase']()+_0x4e77d2(0x83)+_0x2874af+']';console['error'](_0x511cdd?_0xe0ab77+'\x20'+_0x272572+'\x20'+JSON[_0x4e77d2(0x8d)](_0x511cdd):_0xe0ab77+'\x20'+_0x272572),this['fileStream']?.[_0x4e77d2(0x88)](JSON['stringify']({'ts':_0x8d9e68,'level':_0x463906,'component':_0x2874af,'msg':_0x272572,..._0x511cdd&&{'data':_0x511cdd}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x3e36(){const _0x436e25=['9FfLAKK','isEnabled',']\x20[','725646cDGGYA','369178mHMRfS','env','2789870JqRkYE','write','2190352TdhdKt','MORPH_DEBUG','_log','info','stringify','77216tsAkWb','error','enabled','1245uOvcoh','MORPH_LOG_FILE','3SXfjpX','7974QUnLcy','toISOString','enable','debug','warn','2524347GuSFLP'];a2_0x3e36=function(){return _0x436e25;};return a2_0x3e36();}
1
+ function a2_0x491f(){const _0x1172b3=['enabled','fileStream','1018tmvtMr','info',']\x20[','159272OYuzNR','697338ZHecQs','3042990hJCiPB','warn','stringify','debug','env','toUpperCase','11963jBEssm','840ByySmF','993096VOtMsm','MORPH_DEBUG','797088GtysWv','MORPH_LOG_FILE','10oQwquy','error','isEnabled','_log'];a2_0x491f=function(){return _0x1172b3;};return a2_0x491f();}const a2_0xafdc6=a2_0x4f65;(function(_0x5d2747,_0x302fbc){const _0x5377ae=a2_0x4f65,_0x2cc59f=_0x5d2747();while(!![]){try{const _0x208a5c=parseInt(_0x5377ae(0x13e))/0x1+parseInt(_0x5377ae(0x13b))/0x2+-parseInt(_0x5377ae(0x133))/0x3+parseInt(_0x5377ae(0x148))/0x4+parseInt(_0x5377ae(0x135))/0x5*(parseInt(_0x5377ae(0x13f))/0x6)+-parseInt(_0x5377ae(0x146))/0x7*(-parseInt(_0x5377ae(0x147))/0x8)+-parseInt(_0x5377ae(0x140))/0x9;if(_0x208a5c===_0x302fbc)break;else _0x2cc59f['push'](_0x2cc59f['shift']());}catch(_0xc763e4){_0x2cc59f['push'](_0x2cc59f['shift']());}}}(a2_0x491f,0x34c4c));import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0xafdc6(0x13a)];constructor(){const _0x5e9773=a2_0xafdc6;this[_0x5e9773(0x139)]=process[_0x5e9773(0x144)][_0x5e9773(0x132)]==='1'||!!process[_0x5e9773(0x144)][_0x5e9773(0x134)];const _0x3b3624=process[_0x5e9773(0x144)][_0x5e9773(0x134)];this['fileStream']=_0x3b3624?createWriteStream(_0x3b3624,{'flags':'a'}):null;}['debug'](_0x40e0c4,_0x39aa2e,_0x530237){const _0x1e9c10=a2_0xafdc6;this[_0x1e9c10(0x138)](_0x1e9c10(0x143),_0x40e0c4,_0x39aa2e,_0x530237);}[a2_0xafdc6(0x13c)](_0x4a1a15,_0x446677,_0x2b5fb3){const _0x5a2c94=a2_0xafdc6;this[_0x5a2c94(0x138)](_0x5a2c94(0x13c),_0x4a1a15,_0x446677,_0x2b5fb3);}['warn'](_0x3120fb,_0x1eef5b,_0xadeef9){const _0xdeab33=a2_0xafdc6;this[_0xdeab33(0x138)](_0xdeab33(0x141),_0x3120fb,_0x1eef5b,_0xadeef9);}[a2_0xafdc6(0x136)](_0x25ed93,_0x24f6a2,_0x7c0915){const _0x49ff5c=a2_0xafdc6;this[_0x49ff5c(0x138)](_0x49ff5c(0x136),_0x25ed93,_0x24f6a2,_0x7c0915);}['enable'](){const _0x443003=a2_0xafdc6;this[_0x443003(0x139)]=!![];}get[a2_0xafdc6(0x137)](){const _0x38d148=a2_0xafdc6;return this[_0x38d148(0x139)];}[a2_0xafdc6(0x138)](_0x4d8045,_0x1bf12e,_0x293d6a,_0x3d74b6){const _0x34daa6=a2_0xafdc6;if(_0x4d8045!==_0x34daa6(0x136)&&!this[_0x34daa6(0x139)])return;const _0x42937c=new Date()['toISOString'](),_0x8409b2='['+_0x42937c+_0x34daa6(0x13d)+_0x4d8045[_0x34daa6(0x145)]()+_0x34daa6(0x13d)+_0x1bf12e+']';console[_0x34daa6(0x136)](_0x3d74b6?_0x8409b2+'\x20'+_0x293d6a+'\x20'+JSON[_0x34daa6(0x142)](_0x3d74b6):_0x8409b2+'\x20'+_0x293d6a),this['fileStream']?.['write'](JSON[_0x34daa6(0x142)]({'ts':_0x42937c,'level':_0x4d8045,'component':_0x1bf12e,'msg':_0x293d6a,..._0x3d74b6&&{'data':_0x3d74b6}})+'\x0a');}}function a2_0x4f65(_0x2fae19,_0x3efc80){_0x2fae19=_0x2fae19-0x132;const _0x491fea=a2_0x491f();let _0x4f65ce=_0x491fea[_0x2fae19];return _0x4f65ce;}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0x213723,_0x560af1){const _0xa56e45=a3_0x3c1b,_0xfa5e24=_0x213723();while(!![]){try{const _0x255a4e=parseInt(_0xa56e45(0xe6))/0x1*(parseInt(_0xa56e45(0xdc))/0x2)+parseInt(_0xa56e45(0xd6))/0x3*(parseInt(_0xa56e45(0xd3))/0x4)+parseInt(_0xa56e45(0xd8))/0x5+parseInt(_0xa56e45(0xe7))/0x6+parseInt(_0xa56e45(0xe3))/0x7*(parseInt(_0xa56e45(0xd5))/0x8)+parseInt(_0xa56e45(0xd7))/0x9*(-parseInt(_0xa56e45(0xe0))/0xa)+parseInt(_0xa56e45(0xdf))/0xb*(-parseInt(_0xa56e45(0xda))/0xc);if(_0x255a4e===_0x560af1)break;else _0xfa5e24['push'](_0xfa5e24['shift']());}catch(_0x491934){_0xfa5e24['push'](_0xfa5e24['shift']());}}}(a3_0x12fe,0x3ee58));import a3_0x409343 from'path';import a3_0x56c1f0 from'os';function a3_0x3c1b(_0x450cd7,_0x3d01ad){_0x450cd7=_0x450cd7-0xd3;const _0x12fe85=a3_0x12fe();let _0x3c1b93=_0x12fe85[_0x450cd7];return _0x3c1b93;}export function convertToWindowsPath(_0x2c1b26){const _0x5b98ae=a3_0x3c1b;if(_0x2c1b26[_0x5b98ae(0xde)]('/mnt/')){const _0x4592aa=_0x2c1b26[_0x5b98ae(0xd9)](0x5)[_0x5b98ae(0xe5)](),_0x1098d5=_0x2c1b26[_0x5b98ae(0xdb)](0x6)[_0x5b98ae(0xe1)](/\//g,'\x5c');return _0x4592aa+':'+_0x1098d5;}if(_0x2c1b26[_0x5b98ae(0xe4)](/^\/[a-zA-Z]\//)){const _0x161586=_0x2c1b26[_0x5b98ae(0xd9)](0x1)[_0x5b98ae(0xe5)](),_0x44c08c=_0x2c1b26[_0x5b98ae(0xdb)](0x2)['replace'](/\//g,'\x5c');return _0x161586+':'+_0x44c08c;}if(_0x2c1b26[_0x5b98ae(0xe4)](/^[a-zA-Z]:/))return _0x2c1b26[_0x5b98ae(0xe1)](/\//g,'\x5c');return _0x2c1b26;}export function normalizePath(_0x57d623){const _0x574b21=a3_0x3c1b;_0x57d623=_0x57d623[_0x574b21(0xe9)]()[_0x574b21(0xe1)](/^["']|["']$/g,'');const _0x57501b=_0x57d623['startsWith']('/')&&!_0x57d623[_0x574b21(0xe4)](/^\/mnt\/[a-z]\//i)&&!_0x57d623[_0x574b21(0xe4)](/^\/[a-zA-Z]\//);if(_0x57501b)return _0x57d623['replace'](/\/+/g,'/')['replace'](/\/+$/,'');_0x57d623=convertToWindowsPath(_0x57d623);if(_0x57d623[_0x574b21(0xde)]('\x5c\x5c')){let _0x2437c3=_0x57d623;_0x2437c3=_0x2437c3[_0x574b21(0xe1)](/^\\{2,}/,'\x5c\x5c');const _0x1ee6ac=_0x2437c3[_0x574b21(0xdd)](0x2)[_0x574b21(0xe1)](/\\\\/g,'\x5c');_0x57d623='\x5c\x5c'+_0x1ee6ac;}else _0x57d623=_0x57d623[_0x574b21(0xe1)](/\\\\/g,'\x5c');let _0x1db0c1=a3_0x409343[_0x574b21(0xe2)](_0x57d623);_0x57d623['startsWith']('\x5c\x5c')&&!_0x1db0c1[_0x574b21(0xde)]('\x5c\x5c')&&(_0x1db0c1='\x5c'+_0x1db0c1);if(_0x1db0c1[_0x574b21(0xe4)](/^[a-zA-Z]:/)){let _0x107e5b=_0x1db0c1[_0x574b21(0xe1)](/\//g,'\x5c');return/^[a-z]:/[_0x574b21(0xd4)](_0x107e5b)&&(_0x107e5b=_0x107e5b[_0x574b21(0xd9)](0x0)[_0x574b21(0xe5)]()+_0x107e5b[_0x574b21(0xdb)](0x1)),_0x107e5b;}return _0x1db0c1['replace'](/\//g,'\x5c');}export function expandHome(_0x233b01){const _0x391f88=a3_0x3c1b;if(_0x233b01['startsWith']('~/')||_0x233b01==='~')return a3_0x409343[_0x391f88(0xe8)](a3_0x56c1f0['homedir'](),_0x233b01[_0x391f88(0xdb)](0x1));return _0x233b01;}function a3_0x12fe(){const _0x2c157d=['88GUKBMe','940629owlpnK','2673621LFydfg','990430WkgcGA','charAt','12nzVDeo','slice','22QFJXLX','substring','startsWith','10893751NLJhJw','10yKAizc','replace','normalize','91063wQnlPo','match','toUpperCase','45517OPbdnH','2337714hivOYp','join','trim','4dIFmBW','test'];a3_0x12fe=function(){return _0x2c157d;};return a3_0x12fe();}
1
+ function a3_0x5431(_0xdd19a,_0x55f1b0){_0xdd19a=_0xdd19a-0xe0;const _0x3a56cc=a3_0x3a56();let _0x5431ab=_0x3a56cc[_0xdd19a];return _0x5431ab;}(function(_0x612587,_0x9f795f){const _0x301c13=a3_0x5431,_0x40b3e3=_0x612587();while(!![]){try{const _0x3965fa=parseInt(_0x301c13(0xf0))/0x1*(-parseInt(_0x301c13(0xe9))/0x2)+-parseInt(_0x301c13(0xef))/0x3+-parseInt(_0x301c13(0xf1))/0x4+-parseInt(_0x301c13(0xe4))/0x5+parseInt(_0x301c13(0xf3))/0x6*(parseInt(_0x301c13(0xed))/0x7)+-parseInt(_0x301c13(0xeb))/0x8*(parseInt(_0x301c13(0xea))/0x9)+parseInt(_0x301c13(0xe8))/0xa;if(_0x3965fa===_0x9f795f)break;else _0x40b3e3['push'](_0x40b3e3['shift']());}catch(_0x75c64c){_0x40b3e3['push'](_0x40b3e3['shift']());}}}(a3_0x3a56,0xabdf6));import a3_0x3b5d97 from'path';import a3_0xf5a8fb from'os';export function convertToWindowsPath(_0x2649e6){const _0x2b67d8=a3_0x5431;if(_0x2649e6['startsWith']('/mnt/')){const _0x392ac7=_0x2649e6[_0x2b67d8(0xe5)](0x5)['toUpperCase'](),_0x5c7312=_0x2649e6[_0x2b67d8(0xf5)](0x6)['replace'](/\//g,'\x5c');return _0x392ac7+':'+_0x5c7312;}if(_0x2649e6[_0x2b67d8(0xe0)](/^\/[a-zA-Z]\//)){const _0x2eb592=_0x2649e6[_0x2b67d8(0xe5)](0x1)[_0x2b67d8(0xe3)](),_0x5ed482=_0x2649e6['slice'](0x2)['replace'](/\//g,'\x5c');return _0x2eb592+':'+_0x5ed482;}if(_0x2649e6[_0x2b67d8(0xe0)](/^[a-zA-Z]:/))return _0x2649e6[_0x2b67d8(0xee)](/\//g,'\x5c');return _0x2649e6;}export function normalizePath(_0x22bba4){const _0x2ef8d7=a3_0x5431;_0x22bba4=_0x22bba4[_0x2ef8d7(0xf4)]()[_0x2ef8d7(0xee)](/^["']|["']$/g,'');const _0x391516=_0x22bba4[_0x2ef8d7(0xf2)]('/')&&!_0x22bba4[_0x2ef8d7(0xe0)](/^\/mnt\/[a-z]\//i)&&!_0x22bba4['match'](/^\/[a-zA-Z]\//);if(_0x391516)return _0x22bba4[_0x2ef8d7(0xee)](/\/+/g,'/')[_0x2ef8d7(0xee)](/\/+$/,'');_0x22bba4=convertToWindowsPath(_0x22bba4);if(_0x22bba4[_0x2ef8d7(0xf2)]('\x5c\x5c')){let _0x1801f4=_0x22bba4;_0x1801f4=_0x1801f4['replace'](/^\\{2,}/,'\x5c\x5c');const _0x30ac8a=_0x1801f4[_0x2ef8d7(0xe7)](0x2)[_0x2ef8d7(0xee)](/\\\\/g,'\x5c');_0x22bba4='\x5c\x5c'+_0x30ac8a;}else _0x22bba4=_0x22bba4[_0x2ef8d7(0xee)](/\\\\/g,'\x5c');let _0x1e708d=a3_0x3b5d97[_0x2ef8d7(0xe6)](_0x22bba4);_0x22bba4[_0x2ef8d7(0xf2)]('\x5c\x5c')&&!_0x1e708d['startsWith']('\x5c\x5c')&&(_0x1e708d='\x5c'+_0x1e708d);if(_0x1e708d[_0x2ef8d7(0xe0)](/^[a-zA-Z]:/)){let _0x5e2437=_0x1e708d[_0x2ef8d7(0xee)](/\//g,'\x5c');return/^[a-z]:/[_0x2ef8d7(0xe2)](_0x5e2437)&&(_0x5e2437=_0x5e2437[_0x2ef8d7(0xe5)](0x0)[_0x2ef8d7(0xe3)]()+_0x5e2437[_0x2ef8d7(0xf5)](0x1)),_0x5e2437;}return _0x1e708d['replace'](/\//g,'\x5c');}export function expandHome(_0x5aef42){const _0x429440=a3_0x5431;if(_0x5aef42['startsWith']('~/')||_0x5aef42==='~')return a3_0x3b5d97[_0x429440(0xec)](a3_0xf5a8fb[_0x429440(0xe1)](),_0x5aef42[_0x429440(0xf5)](0x1));return _0x5aef42;}function a3_0x3a56(){const _0x14925a=['4473528GNruwh','join','49lBjrCZ','replace','2633511lmScyn','1vQRDpq','4676924euzPEr','startsWith','117570BHcoli','trim','slice','match','homedir','test','toUpperCase','1313165dxlvVH','charAt','normalize','substring','39578080xQPmlg','1044182fvLGaV','9ItoJee'];a3_0x3a56=function(){return _0x14925a;};return a3_0x3a56();}
@@ -1 +1 @@
1
- function a4_0x45e4(_0x78f0d3,_0x589a9c){_0x78f0d3=_0x78f0d3-0x125;const _0xb45654=a4_0xb456();let _0x45e4b3=_0xb45654[_0x78f0d3];return _0x45e4b3;}function a4_0xb456(){const _0x33d289=['287436FRvbJc','isAbsolute','9ZGJPhP','Path\x20must\x20be\x20absolute\x20after\x20normalization','string','resolve','isArray','3xqfRmA','length','startsWith','2126032GCVjFU','6589842wiTJlL','1113019dPjRGN','6028872ipVXZG','sep','normalize','5010720UDqWql','27741712nWjKkL','some'];a4_0xb456=function(){return _0x33d289;};return a4_0xb456();}(function(_0x1bcb96,_0x1b8190){const _0x8e1fd8=a4_0x45e4,_0x43ba46=_0x1bcb96();while(!![]){try{const _0x4fc3a1=parseInt(_0x8e1fd8(0x136))/0x1+-parseInt(_0x8e1fd8(0x134))/0x2+parseInt(_0x8e1fd8(0x131))/0x3*(parseInt(_0x8e1fd8(0x12a))/0x4)+-parseInt(_0x8e1fd8(0x127))/0x5+-parseInt(_0x8e1fd8(0x137))/0x6+-parseInt(_0x8e1fd8(0x135))/0x7+parseInt(_0x8e1fd8(0x128))/0x8*(parseInt(_0x8e1fd8(0x12c))/0x9);if(_0x4fc3a1===_0x1b8190)break;else _0x43ba46['push'](_0x43ba46['shift']());}catch(_0x525f62){_0x43ba46['push'](_0x43ba46['shift']());}}}(a4_0xb456,0x9c8be));import a4_0x55b342 from'path';export function isPathWithinAllowedDirectories(_0x20e440,_0x52919d){const _0x2abd02=a4_0x45e4;if(typeof _0x20e440!=='string'||!Array[_0x2abd02(0x130)](_0x52919d))return![];if(!_0x20e440||_0x52919d[_0x2abd02(0x132)]===0x0)return![];if(_0x20e440['includes']('\x00'))return![];let _0x2089ad;try{_0x2089ad=a4_0x55b342['resolve'](a4_0x55b342[_0x2abd02(0x126)](_0x20e440));}catch{return![];}if(!a4_0x55b342[_0x2abd02(0x12b)](_0x2089ad))throw new Error(_0x2abd02(0x12d));return _0x52919d[_0x2abd02(0x129)](_0x45dfa0=>{const _0x234e35=_0x2abd02;if(typeof _0x45dfa0!==_0x234e35(0x12e)||!_0x45dfa0)return![];if(_0x45dfa0['includes']('\x00'))return![];let _0x411129;try{_0x411129=a4_0x55b342[_0x234e35(0x12f)](a4_0x55b342[_0x234e35(0x126)](_0x45dfa0));}catch{return![];}if(!a4_0x55b342[_0x234e35(0x12b)](_0x411129))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0x2089ad===_0x411129)return!![];if(_0x411129===a4_0x55b342[_0x234e35(0x125)])return _0x2089ad['startsWith'](a4_0x55b342[_0x234e35(0x125)]);return _0x2089ad[_0x234e35(0x133)](_0x411129+a4_0x55b342['sep']);});}
1
+ (function(_0x4a1a22,_0xe1afa3){const _0x32e5fa=a4_0x2b7b,_0x394fa6=_0x4a1a22();while(!![]){try{const _0x3af195=parseInt(_0x32e5fa(0x126))/0x1*(-parseInt(_0x32e5fa(0x128))/0x2)+parseInt(_0x32e5fa(0x122))/0x3*(parseInt(_0x32e5fa(0x120))/0x4)+-parseInt(_0x32e5fa(0x12c))/0x5*(parseInt(_0x32e5fa(0x11e))/0x6)+parseInt(_0x32e5fa(0x12f))/0x7*(parseInt(_0x32e5fa(0x12e))/0x8)+parseInt(_0x32e5fa(0x11c))/0x9*(parseInt(_0x32e5fa(0x129))/0xa)+-parseInt(_0x32e5fa(0x130))/0xb+-parseInt(_0x32e5fa(0x124))/0xc*(-parseInt(_0x32e5fa(0x12d))/0xd);if(_0x3af195===_0xe1afa3)break;else _0x394fa6['push'](_0x394fa6['shift']());}catch(_0x2b8383){_0x394fa6['push'](_0x394fa6['shift']());}}}(a4_0x3083,0xba957));function a4_0x2b7b(_0xce050b,_0x5c1585){_0xce050b=_0xce050b-0x11c;const _0x30832a=a4_0x3083();let _0x2b7b95=_0x30832a[_0xce050b];return _0x2b7b95;}import a4_0x7fd112 from'path';export function isPathWithinAllowedDirectories(_0x3a4fb5,_0x4fd949){const _0x3b6216=a4_0x2b7b;if(typeof _0x3a4fb5!==_0x3b6216(0x12a)||!Array[_0x3b6216(0x123)](_0x4fd949))return![];if(!_0x3a4fb5||_0x4fd949[_0x3b6216(0x12b)]===0x0)return![];if(_0x3a4fb5[_0x3b6216(0x133)]('\x00'))return![];let _0x1d8de1;try{_0x1d8de1=a4_0x7fd112['resolve'](a4_0x7fd112[_0x3b6216(0x121)](_0x3a4fb5));}catch{return![];}if(!a4_0x7fd112[_0x3b6216(0x127)](_0x1d8de1))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x4fd949[_0x3b6216(0x11f)](_0x223c1f=>{const _0xb670d3=_0x3b6216;if(typeof _0x223c1f!==_0xb670d3(0x12a)||!_0x223c1f)return![];if(_0x223c1f[_0xb670d3(0x133)]('\x00'))return![];let _0x14502b;try{_0x14502b=a4_0x7fd112[_0xb670d3(0x11d)](a4_0x7fd112[_0xb670d3(0x121)](_0x223c1f));}catch{return![];}if(!a4_0x7fd112['isAbsolute'](_0x14502b))throw new Error(_0xb670d3(0x125));if(_0x1d8de1===_0x14502b)return!![];if(_0x14502b===a4_0x7fd112[_0xb670d3(0x132)])return _0x1d8de1['startsWith'](a4_0x7fd112[_0xb670d3(0x132)]);return _0x1d8de1[_0xb670d3(0x131)](_0x14502b+a4_0x7fd112['sep']);});}function a4_0x3083(){const _0x5ca535=['621941ggiHWK','isAbsolute','2ndHKkw','2721450PiDKqD','string','length','165aSBXRn','143JACVEa','4335352KuUHrj','7eVqUgc','15044502zipIxM','startsWith','sep','includes','36NLiVrJ','resolve','144714jIblyJ','some','217204MIMJRZ','normalize','57VVIqbE','isArray','968268GuckFh','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization'];a4_0x3083=function(){return _0x5ca535;};return a4_0x3083();}
@@ -1 +1 @@
1
- (function(_0x52f33a,_0x39d033){const _0x51c638=a5_0x26a6,_0x3ae6ef=_0x52f33a();while(!![]){try{const _0x60cbaa=parseInt(_0x51c638(0x13d))/0x1+-parseInt(_0x51c638(0x13b))/0x2*(-parseInt(_0x51c638(0x135))/0x3)+-parseInt(_0x51c638(0x13a))/0x4+-parseInt(_0x51c638(0x144))/0x5+-parseInt(_0x51c638(0x130))/0x6+parseInt(_0x51c638(0x147))/0x7+parseInt(_0x51c638(0x143))/0x8;if(_0x60cbaa===_0x39d033)break;else _0x3ae6ef['push'](_0x3ae6ef['shift']());}catch(_0x15a96d){_0x3ae6ef['push'](_0x3ae6ef['shift']());}}}(a5_0x600d,0xd2216));function a5_0x600d(){const _0x3ed991=['push','realpath','isDirectory','976992AzWBzu','2lLupLL','non-directory\x20root','951865Mdyove','message','Skipping\x20invalid\x20directory:\x20','homedir','startsWith','Skipping\x20','5378336GUoOdG','5408840jNbPUv','resolve','invalid\x20path\x20or\x20inaccessible','4949364ygOlnU','1321692Wtisdt','\x20due\x20to\x20error:\x20','slice','stat','file://','227349wIwFzh','uri'];a5_0x600d=function(){return _0x3ed991;};return a5_0x600d();}import{promises as a5_0x60b547}from'fs';import a5_0x158b84 from'path';import a5_0xba905f from'os';function a5_0x26a6(_0x4b3406,_0x3778c3){_0x4b3406=_0x4b3406-0x130;const _0x600d91=a5_0x600d();let _0x26a65d=_0x600d91[_0x4b3406];return _0x26a65d;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0xe4bbc3){const _0x291bdd=a5_0x26a6;try{const _0x4cc064=_0xe4bbc3[_0x291bdd(0x141)](_0x291bdd(0x134))?_0xe4bbc3[_0x291bdd(0x132)](0x7):_0xe4bbc3,_0x5f264c=_0x4cc064['startsWith']('~/')||_0x4cc064==='~'?a5_0x158b84['join'](a5_0xba905f[_0x291bdd(0x140)](),_0x4cc064['slice'](0x1)):_0x4cc064,_0x464221=a5_0x158b84[_0x291bdd(0x145)](_0x5f264c),_0x10cbde=await a5_0x60b547[_0x291bdd(0x138)](_0x464221);return normalizePath(_0x10cbde);}catch{return null;}}function formatDirectoryError(_0x4aeff0,_0x1c09e7,_0x1fe60b){const _0xd576b5=a5_0x26a6;if(_0x1fe60b)return _0xd576b5(0x142)+_0x1fe60b+':\x20'+_0x4aeff0;const _0xe21b69=_0x1c09e7 instanceof Error?_0x1c09e7[_0xd576b5(0x13e)]:String(_0x1c09e7);return _0xd576b5(0x13f)+_0x4aeff0+_0xd576b5(0x131)+_0xe21b69;}export async function getValidRootDirectories(_0x18d850){const _0x30c4db=a5_0x26a6,_0x2415cc=[];for(const _0x544093 of _0x18d850){const _0x21870c=await parseRootUri(_0x544093[_0x30c4db(0x136)]);if(!_0x21870c){logMcpStderr(formatDirectoryError(_0x544093[_0x30c4db(0x136)],undefined,_0x30c4db(0x146)));continue;}try{const _0x296449=await a5_0x60b547[_0x30c4db(0x133)](_0x21870c);_0x296449[_0x30c4db(0x139)]()?_0x2415cc[_0x30c4db(0x137)](_0x21870c):logMcpStderr(formatDirectoryError(_0x21870c,undefined,_0x30c4db(0x13c)));}catch(_0x1831f6){logMcpStderr(formatDirectoryError(_0x21870c,_0x1831f6));}}return _0x2415cc;}
1
+ function a5_0x48fa(_0x1fb3e8,_0x3143a2){_0x1fb3e8=_0x1fb3e8-0x9a;const _0x61fda9=a5_0x61fd();let _0x48fa3f=_0x61fda9[_0x1fb3e8];return _0x48fa3f;}(function(_0x325da5,_0x5484ed){const _0x128f9d=a5_0x48fa,_0x3f834c=_0x325da5();while(!![]){try{const _0x1953c7=-parseInt(_0x128f9d(0xa2))/0x1*(-parseInt(_0x128f9d(0xae))/0x2)+parseInt(_0x128f9d(0xab))/0x3+-parseInt(_0x128f9d(0xb0))/0x4+parseInt(_0x128f9d(0xa3))/0x5+-parseInt(_0x128f9d(0xa7))/0x6*(-parseInt(_0x128f9d(0xb1))/0x7)+-parseInt(_0x128f9d(0xa0))/0x8*(-parseInt(_0x128f9d(0xa1))/0x9)+-parseInt(_0x128f9d(0xac))/0xa*(parseInt(_0x128f9d(0xaa))/0xb);if(_0x1953c7===_0x5484ed)break;else _0x3f834c['push'](_0x3f834c['shift']());}catch(_0x36fd9e){_0x3f834c['push'](_0x3f834c['shift']());}}}(a5_0x61fd,0x1b89b));import{promises as a5_0x3f64ab}from'fs';import a5_0x1587a9 from'path';import a5_0x2b4291 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x3e3d42){const _0x23feb5=a5_0x48fa;try{const _0x335bb5=_0x3e3d42['startsWith'](_0x23feb5(0x9e))?_0x3e3d42[_0x23feb5(0x9d)](0x7):_0x3e3d42,_0x1148ea=_0x335bb5['startsWith']('~/')||_0x335bb5==='~'?a5_0x1587a9[_0x23feb5(0xa6)](a5_0x2b4291[_0x23feb5(0xa9)](),_0x335bb5[_0x23feb5(0x9d)](0x1)):_0x335bb5,_0x5dd67e=a5_0x1587a9['resolve'](_0x1148ea),_0x7c23aa=await a5_0x3f64ab[_0x23feb5(0x9b)](_0x5dd67e);return normalizePath(_0x7c23aa);}catch{return null;}}function formatDirectoryError(_0x2dd970,_0x59f5ad,_0x108e8e){const _0x451381=a5_0x48fa;if(_0x108e8e)return _0x451381(0xaf)+_0x108e8e+':\x20'+_0x2dd970;const _0x754e00=_0x59f5ad instanceof Error?_0x59f5ad[_0x451381(0x9c)]:String(_0x59f5ad);return _0x451381(0xa4)+_0x2dd970+_0x451381(0xad)+_0x754e00;}export async function getValidRootDirectories(_0x4dd033){const _0x27b825=a5_0x48fa,_0x5146dd=[];for(const _0x3607ac of _0x4dd033){const _0x220390=await parseRootUri(_0x3607ac[_0x27b825(0xb2)]);if(!_0x220390){logMcpStderr(formatDirectoryError(_0x3607ac[_0x27b825(0xb2)],undefined,_0x27b825(0xa8)));continue;}try{const _0x5d0fc4=await a5_0x3f64ab[_0x27b825(0x9a)](_0x220390);_0x5d0fc4[_0x27b825(0xa5)]()?_0x5146dd['push'](_0x220390):logMcpStderr(formatDirectoryError(_0x220390,undefined,_0x27b825(0x9f)));}catch(_0x11d850){logMcpStderr(formatDirectoryError(_0x220390,_0x11d850));}}return _0x5146dd;}function a5_0x61fd(){const _0x5c1ab1=['stat','realpath','message','slice','file://','non-directory\x20root','8IsexPa','1653885TKBPIT','9829UEtTNB','826860aRHHOv','Skipping\x20invalid\x20directory:\x20','isDirectory','join','1902SggPkr','invalid\x20path\x20or\x20inaccessible','homedir','1705rYdfSQ','372855RziXUq','24770KqYoxZ','\x20due\x20to\x20error:\x20','2dyQXPY','Skipping\x20','738584TictFc','4375GWLJgy','uri'];a5_0x61fd=function(){return _0x5c1ab1;};return a5_0x61fd();}
@@ -1 +1 @@
1
- function a6_0x28c2(){const _0x5702bd=['11xUxLOQ','490042XkiQXS','trim','1591680dQUheH','95kZjXOp','5118930GUywmW','github_codebase_search','edit_file','has','1612pZdOHx','filter','2249668kYJBvK','toLowerCase','ENABLED_TOOLS','5sPbsPF','DISABLED_TOOLS','2087076COFsbP','split','all','map','length','1622412gjYiDw','3lhaHOs'];a6_0x28c2=function(){return _0x5702bd;};return a6_0x28c2();}const a6_0x3373ec=a6_0x15a2;(function(_0x183eed,_0xecc9c1){const _0x3a7770=a6_0x15a2,_0x219ecf=_0x183eed();while(!![]){try{const _0x780e19=parseInt(_0x3a7770(0x1e6))/0x1*(-parseInt(_0x3a7770(0x1eb))/0x2)+-parseInt(_0x3a7770(0x1e1))/0x3*(-parseInt(_0x3a7770(0x1d6))/0x4)+parseInt(_0x3a7770(0x1d9))/0x5*(parseInt(_0x3a7770(0x1db))/0x6)+parseInt(_0x3a7770(0x1e3))/0x7+-parseInt(_0x3a7770(0x1e5))/0x8+parseInt(_0x3a7770(0x1e0))/0x9+parseInt(_0x3a7770(0x1e7))/0xa*(-parseInt(_0x3a7770(0x1e2))/0xb);if(_0x780e19===_0xecc9c1)break;else _0x219ecf['push'](_0x219ecf['shift']());}catch(_0x5d7aa5){_0x219ecf['push'](_0x219ecf['shift']());}}}(a6_0x28c2,0x5b17a));export const TOOL_NAMES={'EDIT_FILE':a6_0x3373ec(0x1e9),'CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x3373ec(0x1e8)};export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0x15a2(_0x163648,_0x3b8061){_0x163648=_0x163648-0x1d6;const _0x28c21e=a6_0x28c2();let _0x15a292=_0x28c21e[_0x163648];return _0x15a292;}export const LEGACY_TOOL_ALIASES={'warpgrep_codebase_search':TOOL_NAMES['CODEBASE_SEARCH'],'warpgrep_github_search':TOOL_NAMES['GITHUB_CODEBASE_SEARCH']};function parseToolList(_0x45dcc1){const _0x5771e1=a6_0x3373ec;if(!_0x45dcc1)return[];return _0x45dcc1[_0x5771e1(0x1dc)](',')['map'](_0x492b83=>_0x492b83[_0x5771e1(0x1e4)]())[_0x5771e1(0x1ec)](_0x4b6ce5=>_0x4b6ce5[_0x5771e1(0x1df)]>0x0)[_0x5771e1(0x1de)](_0x14ed6d=>LEGACY_TOOL_ALIASES[_0x14ed6d]??_0x14ed6d);}export function resolveToolFilter(_0x3b5bb6){const _0x3cfba3=a6_0x3373ec,_0x30422b=_0x3b5bb6[_0x3cfba3(0x1d8)]?.['trim'](),_0x3f63ec=_0x30422b&&_0x30422b[_0x3cfba3(0x1d7)]()!==_0x3cfba3(0x1dd)?parseToolList(_0x30422b):undefined,_0x373baa=parseToolList(_0x3b5bb6[_0x3cfba3(0x1da)]),_0x29d403=[..._0x3f63ec??[],..._0x373baa][_0x3cfba3(0x1ec)](_0x468b63=>!KNOWN_TOOL_NAMES[_0x3cfba3(0x1ea)](_0x468b63)),_0x15ef3f=new Set(_0x373baa);if(_0x3f63ec){const _0x344778=new Set(_0x3f63ec);for(const _0x50f01d of ALL_TOOL_NAMES)if(!_0x344778[_0x3cfba3(0x1ea)](_0x50f01d))_0x15ef3f['add'](_0x50f01d);}return{'disabled':_0x15ef3f,'unknown':_0x29d403};}
1
+ const a6_0x329216=a6_0x2d61;(function(_0x38cd8a,_0x22674d){const _0x3ae3e4=a6_0x2d61,_0x255195=_0x38cd8a();while(!![]){try{const _0x2f66a6=-parseInt(_0x3ae3e4(0x88))/0x1*(-parseInt(_0x3ae3e4(0x83))/0x2)+parseInt(_0x3ae3e4(0x79))/0x3+-parseInt(_0x3ae3e4(0x7d))/0x4+-parseInt(_0x3ae3e4(0x7e))/0x5+-parseInt(_0x3ae3e4(0x7b))/0x6+parseInt(_0x3ae3e4(0x7c))/0x7+parseInt(_0x3ae3e4(0x77))/0x8*(parseInt(_0x3ae3e4(0x82))/0x9);if(_0x2f66a6===_0x22674d)break;else _0x255195['push'](_0x255195['shift']());}catch(_0x5897f1){_0x255195['push'](_0x255195['shift']());}}}(a6_0x2953,0xb9dc6));export const TOOL_NAMES={'EDIT_FILE':a6_0x329216(0x8a),'CODEBASE_SEARCH':a6_0x329216(0x84),'GITHUB_CODEBASE_SEARCH':a6_0x329216(0x78)};export const ALL_TOOL_NAMES=Object[a6_0x329216(0x89)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);export const LEGACY_TOOL_ALIASES={'warpgrep_codebase_search':TOOL_NAMES[a6_0x329216(0x7a)],'warpgrep_github_search':TOOL_NAMES[a6_0x329216(0x80)]};function parseToolList(_0x2842a3){const _0x5903a9=a6_0x329216;if(!_0x2842a3)return[];return _0x2842a3[_0x5903a9(0x85)](',')[_0x5903a9(0x75)](_0x15b2db=>_0x15b2db['trim']())[_0x5903a9(0x86)](_0x11e4cd=>_0x11e4cd[_0x5903a9(0x87)]>0x0)[_0x5903a9(0x75)](_0x4fb23e=>LEGACY_TOOL_ALIASES[_0x4fb23e]??_0x4fb23e);}function a6_0x2d61(_0x51ec42,_0x2c08c9){_0x51ec42=_0x51ec42-0x75;const _0x2953e1=a6_0x2953();let _0x2d61c3=_0x2953e1[_0x51ec42];return _0x2d61c3;}function a6_0x2953(){const _0x4c1c5a=['codebase_search','split','filter','length','391SxiHzk','values','edit_file','all','toLowerCase','add','map','has','20298584bdMcND','github_codebase_search','2825349xfYqsj','CODEBASE_SEARCH','6878490FSVaEy','5547682UStAtr','6030492DhQkms','5806440IXkhJV','ENABLED_TOOLS','GITHUB_CODEBASE_SEARCH','trim','9usAfsd','1560SMSnuy'];a6_0x2953=function(){return _0x4c1c5a;};return a6_0x2953();}export function resolveToolFilter(_0x49dd2f){const _0x1d693d=a6_0x329216,_0x1c4c8b=_0x49dd2f[_0x1d693d(0x7f)]?.[_0x1d693d(0x81)](),_0x183ea2=_0x1c4c8b&&_0x1c4c8b[_0x1d693d(0x8c)]()!==_0x1d693d(0x8b)?parseToolList(_0x1c4c8b):undefined,_0x6ebb2c=parseToolList(_0x49dd2f['DISABLED_TOOLS']),_0x18bb48=[..._0x183ea2??[],..._0x6ebb2c][_0x1d693d(0x86)](_0x4edaeb=>!KNOWN_TOOL_NAMES[_0x1d693d(0x76)](_0x4edaeb)),_0x174f5a=new Set(_0x6ebb2c);if(_0x183ea2){const _0x3d5317=new Set(_0x183ea2);for(const _0x564030 of ALL_TOOL_NAMES)if(!_0x3d5317[_0x1d693d(0x76)](_0x564030))_0x174f5a[_0x1d693d(0x8d)](_0x564030);}return{'disabled':_0x174f5a,'unknown':_0x18bb48};}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.216",
3
+ "version": "0.8.218",
4
4
  "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@google/generative-ai": "^0.21.0",
37
37
  "@modelcontextprotocol/sdk": "^1.12.3",
38
- "@morphllm/morphsdk": "0.2.198",
38
+ "@morphllm/morphsdk": "0.2.199",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",