@morphllm/morphmcp 0.8.217 → 0.8.219

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_0x80080d=a0_0x3e92;(function(_0x2b7f59,_0x3efe96){const _0x50aa55=a0_0x3e92,_0x3d0467=_0x2b7f59();while(!![]){try{const _0x1a65cb=-parseInt(_0x50aa55(0x12f))/0x1+-parseInt(_0x50aa55(0x149))/0x2*(parseInt(_0x50aa55(0x1b5))/0x3)+-parseInt(_0x50aa55(0x12e))/0x4*(parseInt(_0x50aa55(0x212))/0x5)+-parseInt(_0x50aa55(0x1be))/0x6+-parseInt(_0x50aa55(0x169))/0x7*(parseInt(_0x50aa55(0x18d))/0x8)+-parseInt(_0x50aa55(0x122))/0x9*(parseInt(_0x50aa55(0x1e9))/0xa)+-parseInt(_0x50aa55(0x1ec))/0xb*(-parseInt(_0x50aa55(0x15c))/0xc);if(_0x1a65cb===_0x3efe96)break;else _0x3d0467['push'](_0x3d0467['shift']());}catch(_0x1ff015){_0x3d0467['push'](_0x3d0467['shift']());}}}(a0_0x141f,0xce907));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_0x4e6f41 from'fs/promises';import a0_0x39ae41 from'path';import a0_0x50a395 from'os';import{createRequire}from'module';import{z}from'zod';function a0_0x3e92(_0x595e2a,_0x581468){_0x595e2a=_0x595e2a-0xfb;const _0x141f5e=a0_0x141f();let _0x3e921d=_0x141f5e[_0x595e2a];return _0x3e921d;}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_0x337660 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES,resolveToolFilter}from'./tool-definitions.js';function fixPathRepetition(_0x355048){const _0x4b20a4=a0_0x3e92,_0x4c341c=_0x355048['split'](a0_0x39ae41[_0x4b20a4(0x12b)])[_0x4b20a4(0x142)](Boolean);if(_0x4c341c['length']<0x2)return null;for(let _0x37d099=Math[_0x4b20a4(0x21c)](_0x4c341c[_0x4b20a4(0x17c)]/0x2);_0x37d099>=0x1;_0x37d099--){for(let _0x5146d9=0x0;_0x5146d9<=_0x4c341c[_0x4b20a4(0x17c)]-0x2*_0x37d099;_0x5146d9++){const _0x316379=_0x4c341c[_0x4b20a4(0x146)](_0x5146d9,_0x5146d9+_0x37d099),_0x4fecc0=_0x4c341c[_0x4b20a4(0x146)](_0x5146d9+_0x37d099,_0x5146d9+0x2*_0x37d099);if(_0x316379[_0x4b20a4(0x173)]((_0x1d03a9,_0x6d3475)=>_0x1d03a9===_0x4fecc0[_0x6d3475])){const _0x32ea46=[..._0x4c341c[_0x4b20a4(0x146)](0x0,_0x5146d9),..._0x4c341c[_0x4b20a4(0x146)](_0x5146d9+_0x37d099)];return a0_0x39ae41['sep']+_0x32ea46[_0x4b20a4(0x210)](a0_0x39ae41[_0x4b20a4(0x12b)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1aed4a=a0_0x3e92;try{const _0x39f49f=require('../package.json');return _0x39f49f[_0x1aed4a(0x118)]??_0x1aed4a(0x177);}catch(_0x18242c){return logMcpStderr(_0x1aed4a(0x176),_0x18242c),_0x1aed4a(0x177);}}function printHelp(){const _0x2a5e61=a0_0x3e92;console[_0x2a5e61(0x203)](_0x2a5e61(0x1ee)+getPackageVersion()),console[_0x2a5e61(0x203)](_0x2a5e61(0x20a)),console[_0x2a5e61(0x203)](_0x2a5e61(0x1cc)),console['log']('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console[_0x2a5e61(0x203)]('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x2a5e61(0x203)](_0x2a5e61(0x21f)),console[_0x2a5e61(0x203)](_0x2a5e61(0x1ae)),console[_0x2a5e61(0x203)](_0x2a5e61(0x14d)),console['log'](_0x2a5e61(0x1f8));}const cliArgs=process[a0_0x80080d(0x107)][a0_0x80080d(0x146)](0x2),VERSION_FLAGS=new Set([a0_0x80080d(0x1f9),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);function a0_0x141f(){const _0x1e505a=['tool_call_error','2967414YjogaW','FileReadError','min','match','https://morphllm.com/api/error-report','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','SubToolError','role','isArray','pyproject.toml','default','Preview\x20changes\x20without\x20applying\x20them.','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','.\x20Changes:\x20','\x0aOptions:',',\x20modified\x20','`\x20in\x20`','enum','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','MORPH_API_URL','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Workspace\x20mode\x20enabled:\x20Using\x20','WORKSPACE_ROOT','optional','string','MCP','normalize','Unknown\x20error','Tool\x20\x22','Fallback:\x20Using\x20workspace\x20root\x20','listRoots','parse','catch','tsconfig.json','setNotificationHandler','RipgrepNotAvailable','path','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','path_validation_resolved','new_string','terminationReason','content','Cargo.toml','5486870DIipkK','lines','read\x20','2629XbTIDb','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','@morphllm/morphmcp\x20','tool','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','unknown\x20error','tool_calls','[could\x20not\x20read\x20file:\x20','startsWith','file_path','readFile','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','--version','[github_codebase_search]\x20Failed\x20in\x20','Example\x20format:\x0a','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','success','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Parameters:\x0a','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','status','stat','log','UnknownError','PWD','read','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','completionId','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','File\x20read\x20error:','params','context','Error:\x20','join','annotations','1340eKyDhj','filePath','ReadError','dirname','.\x20Path:\x20','GitHub\x20search\x20failed:\x20','glob\x20\x27','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','\x0a</file>','roots','floor','<file\x20path=\x22','metadata','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','access','stack','substring','boolean','utf-8','instruction','-\x20Glob\x20search\x20`','morph-v3-fast','\x20as\x20allowed\x20directory','messages','array','all','TimeoutError','package.json','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','argv','Morph\x20Edit\x20Preview','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','data','toLowerCase','error','instructions','code_edit','describe','ToolException','WarpGrep\x20sub-tool\x20errors:\x20','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','resolve','includes','--api-key=','Relevant\x20context\x20found:','\x22.\x20Known\x20tools:\x20','version','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','node_modules','compaction_failed','name','safeParse','realpath','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','9XqgiBI','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','message','source','finish','EDIT_FILE','Bearer\x20','basename','linesModified','sep','command','assistant','6100hToWfL','1546513DPvkdX','response','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','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.','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','.git','post','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','env','API\x20error\x20(auth/rate-limit)','ENABLE_WORKSPACE_MODE','api-key','mcp-filesystem','\x20(new\x20file)','Max\x20results\x20to\x20return','etimedout','application/json','changes','file','filter','files','timed\x20out','title','slice','0.2.0','now','4aZDGAb','warp_grep_complete','\x22>\x0a','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','\x20\x20morph-mcp','split','Tool\x20','search_type','indexOf','false','constructor','errors','warp_grep_start','edit_file','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','function','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','push','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','308868YQcYYY','debug','file_read_complete','tool_call_id','connect','terminated','morph-v3-large','linesRemoved','\x20-\x20','isDirectory','search_string','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','[github_codebase_search]\x20Done\x20in\x20','75481fhAfcA','runWarpGrep_call','Warning:\x20','.cursor','morph-mcp','object','\x0a...\x20(truncated,\x20total:\x20','disabled','codebase_search','path_validation_failed','every','-\x20Grepped\x20\x27','has','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','unknown','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','BinaryFile','glob',',\x20removed\x20','length','MORPH_API_KEY','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','file_read_failed','morph-warp-grep-v2.1','Parent\x20directory\x20does\x20not\x20exist:\x20','-\x20Listed\x20directory\x20`','github_codebase_search','description','number','SymlinkError','-\x20Read\x20file\x20`','list_directory','linesAdded','arguments','Repository\x20identifier','1048WvXjQT','text','Disabled\x20tools:\x20','timings','branch','sk-','\x20valid\x20directories','FileNotFound','\x22>\x0aError\x20reading\x20file:\x20','toISOString','--api-key','tool_call_complete','exit','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Invalid\x20arguments:\x20','repo_path','Morph\x20FastApply\x20failed\x20without\x20error\x20message','**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','payload','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','oninitialized','ENOENT','turns','❌\x20Morph\x20Edit\x20Failed:\x20','\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS','Error\x20running\x20fast\x20context\x20search:\x20','grep','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.','pattern','map','\x20error(s)','GITHUB_CODEBASE_SEARCH','Failed\x20to\x20read\x20file:\x20','\x0aExamples:','Specific\x20commit\x20hash\x20to\x20search','grep_search','dryRun','target_file','code','some','1341738xLsxvf','completed','Unknown\x20tool:\x20','CODEBASE_SEARCH','MORPH_WARP_GREP_TIMEOUT','Failed\x20to\x20request\x20roots\x20from\x20client:','completed_with_file_errors','RipgrepError'];a0_0x141f=function(){return _0x1e505a;};return a0_0x141f();}cliArgs['some'](_0x584e1c=>VERSION_FLAGS[a0_0x80080d(0x175)](_0x584e1c))&&(console[a0_0x80080d(0x203)](a0_0x80080d(0x1ee)+getPackageVersion()),process[a0_0x80080d(0x199)](0x0));cliArgs[a0_0x80080d(0x1b4)](_0x156057=>HELP_FLAGS['has'](_0x156057))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x18d684){const _0x226c9c=a0_0x80080d;for(let _0x5db3ab=0x0;_0x5db3ab<cliArgs[_0x226c9c(0x17c)];_0x5db3ab++){const _0x356c8c=cliArgs[_0x5db3ab];if(_0x356c8c[_0x226c9c(0x1f4)]('--'+_0x18d684+'='))return _0x356c8c[_0x226c9c(0x146)](('--'+_0x18d684+'=')['length']);if(_0x356c8c==='--'+_0x18d684&&_0x5db3ab+0x1<cliArgs[_0x226c9c(0x17c)])return cliArgs[_0x5db3ab+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x80080d(0x175)](arg))continue;if(arg[a0_0x80080d(0x1f4)](a0_0x80080d(0x115)))continue;if(arg===a0_0x80080d(0x197)){i++;continue;}args[a0_0x80080d(0x15a)](arg);}const WORKSPACE_ROOT=process[a0_0x80080d(0x137)][a0_0x80080d(0x1d4)]||process['env'][a0_0x80080d(0x205)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x80080d(0x137)][a0_0x80080d(0x139)]!=='false',MORPH_API_KEY=getCliArg(a0_0x80080d(0x13a))??process[a0_0x80080d(0x137)][a0_0x80080d(0x17d)],MORPH_API_URL=process[a0_0x80080d(0x137)][a0_0x80080d(0x1d1)],MORPH_LARGE_APPLY=process['env']['MORPH_LARGE_APPLY']!==a0_0x80080d(0x152),MORPH_WARP_GREP_TIMEOUT=process[a0_0x80080d(0x137)][a0_0x80080d(0x1b9)]?parseInt(process[a0_0x80080d(0x137)][a0_0x80080d(0x1b9)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),TOOL_FILTER=resolveToolFilter(process['env']),DISABLED_TOOLS=TOOL_FILTER[a0_0x80080d(0x170)];for(const tool of TOOL_FILTER[a0_0x80080d(0x177)]){console['error']('Warning:\x20ENABLED_TOOLS/DISABLED_TOOLS\x20names\x20unknown\x20tool\x20\x22'+tool+a0_0x80080d(0x117)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}DISABLED_TOOLS['size']>0x0&&console[a0_0x80080d(0x10c)](a0_0x80080d(0x18f)+[...DISABLED_TOOLS][a0_0x80080d(0x210)](',\x20'));MORPH_API_KEY&&!MORPH_API_KEY[a0_0x80080d(0x1f4)](a0_0x80080d(0x192))&&!MORPH_API_KEY[a0_0x80080d(0x1f4)]('morph-')&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x4d4945){const _0x2fe166=a0_0x80080d;try{await a0_0x337660[_0x2fe166(0x135)](_0x2fe166(0x1c2),{..._0x4d4945,'timestamp':new Date()[_0x2fe166(0x196)](),'source':_0x4d4945['source']||_0x2fe166(0x13b),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x4d4945[_0x2fe166(0x20e)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x2fe166(0x13f),'Authorization':_0x2fe166(0x128)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x642b78,_0x488754){const _0x50abeb=a0_0x80080d;if(_0x642b78&&typeof _0x642b78==='object'&&_0x50abeb(0x201)in _0x642b78)return _0x642b78[_0x50abeb(0x201)];if(_0x642b78&&typeof _0x642b78==='object'&&_0x50abeb(0x130)in _0x642b78)return _0x642b78['response']?.[_0x50abeb(0x201)];const _0x39e92c=_0x488754[_0x50abeb(0x1c1)](/\b(401|429)\b/);return _0x39e92c?parseInt(_0x39e92c[0x1],0xa):null;}function handleMorphAPIError(_0x580bac){const _0x2334dc=a0_0x80080d,_0x2b50fa=_0x580bac instanceof Error?_0x580bac[_0x2334dc(0x124)]:String(_0x580bac),_0x2c5bb0=extractStatusCode(_0x580bac,_0x2b50fa);switch(_0x2c5bb0){case 0x191:return{'content':[{'type':_0x2334dc(0x18e),'text':_0x2334dc(0x132)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x2334dc(0x18e),'text':_0x2334dc(0x11f)}],'isError':!![]};default:return null;}}args[a0_0x80080d(0x17c)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x80080d(0x106)),logMcpStderr(a0_0x80080d(0x131)),logMcpStderr(a0_0x80080d(0x167)),logMcpStderr(a0_0x80080d(0x120)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x80080d(0x112)));function normalizePath(_0x40fa62){const _0x4c59ae=a0_0x80080d;return a0_0x39ae41[_0x4c59ae(0x1d8)](_0x40fa62);}function expandHome(_0x53b107){const _0x12c91b=a0_0x80080d;if(_0x53b107[_0x12c91b(0x1f4)]('~/')||_0x53b107==='~')return a0_0x39ae41[_0x12c91b(0x210)](a0_0x50a395['homedir'](),_0x53b107[_0x12c91b(0x146)](0x1));return _0x53b107;}let allowedDirectories=await Promise[a0_0x80080d(0x103)](args[a0_0x80080d(0x1aa)](async _0x166c67=>{const _0x5be14b=a0_0x80080d,_0x12ff96=expandHome(_0x166c67),_0x149a2f=a0_0x39ae41[_0x5be14b(0x113)](_0x12ff96);try{const _0x20fa26=await a0_0x4e6f41['realpath'](_0x149a2f);return normalizePath(_0x20fa26);}catch(_0x621780){return normalizePath(_0x149a2f);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x80080d(0x17c)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x80080d(0x15a)](workspaceDir),logMcpStderr(a0_0x80080d(0x1d3)+workspaceDir+a0_0x80080d(0x100)));}catch(a0_0x42912e){logMcpStderr(a0_0x80080d(0x1ca)+a0_0x42912e);}async function detectWorkspaceRoot(_0x3eea35){const _0x1c0940=a0_0x80080d;let _0x2a7272=a0_0x39ae41[_0x1c0940(0x113)](_0x3eea35);const _0x29ae0d=[_0x1c0940(0x134),'.vscode',_0x1c0940(0x105),_0x1c0940(0x1e8),_0x1c0940(0x1c7),'go.mod',_0x1c0940(0x16c),_0x1c0940(0x1df),'composer.json'];while(_0x2a7272!==a0_0x39ae41[_0x1c0940(0x215)](_0x2a7272)){for(const _0x49c01c of _0x29ae0d){const _0x365569=a0_0x39ae41[_0x1c0940(0x210)](_0x2a7272,_0x49c01c);try{return await a0_0x4e6f41[_0x1c0940(0x220)](_0x365569),normalizePath(_0x2a7272);}catch{}}_0x2a7272=a0_0x39ae41[_0x1c0940(0x215)](_0x2a7272);}return normalizePath(_0x3eea35);}await Promise[a0_0x80080d(0x103)](args[a0_0x80080d(0x1aa)](async _0x5c7b10=>{const _0x4497b8=a0_0x80080d;try{const _0x2c174a=await a0_0x4e6f41[_0x4497b8(0x202)](expandHome(_0x5c7b10));!_0x2c174a[_0x4497b8(0x165)]()&&(logMcpStderr(_0x4497b8(0x20f)+_0x5c7b10+'\x20is\x20not\x20a\x20directory'),process['exit'](0x1));}catch(_0x1f7eda){logMcpStderr('Error\x20accessing\x20directory\x20'+_0x5c7b10+':',_0x1f7eda),process['exit'](0x1);}}));async function validatePath(_0x8c306d){const _0x50e75a=a0_0x80080d,_0x26224e=expandHome(_0x8c306d),_0x13a580=a0_0x39ae41[_0x50e75a(0x113)](_0x26224e);logger[_0x50e75a(0x15d)]('MCP','path_validation_start',{'raw_path':_0x8c306d,'absolute':_0x13a580});try{const _0x8bf115=await a0_0x4e6f41[_0x50e75a(0x11e)](_0x13a580);return logger[_0x50e75a(0x15d)]('MCP','path_validation_resolved',{'resolved':_0x8bf115,'symlink':_0x8bf115!==_0x13a580}),_0x8bf115;}catch(_0x4ded69){if(_0x4ded69[_0x50e75a(0x1b3)]===_0x50e75a(0x1a2)){const _0x2a88a6=a0_0x39ae41[_0x50e75a(0x215)](_0x13a580);try{const _0x2f401f=await a0_0x4e6f41[_0x50e75a(0x11e)](_0x2a88a6),_0x5351cf=a0_0x39ae41['join'](_0x2f401f,a0_0x39ae41[_0x50e75a(0x129)](_0x13a580));return logger[_0x50e75a(0x15d)](_0x50e75a(0x1d7),_0x50e75a(0x1e4),{'resolved':_0x5351cf,'new_file':!![]}),_0x5351cf;}catch{logger[_0x50e75a(0x10c)](_0x50e75a(0x1d7),_0x50e75a(0x172),{'raw_path':_0x8c306d,'error':_0x50e75a(0x182)+_0x2a88a6});throw new Error(_0x50e75a(0x182)+_0x2a88a6);}}logger[_0x50e75a(0x10c)]('MCP',_0x50e75a(0x172),{'raw_path':_0x8c306d,'error':_0x4ded69[_0x50e75a(0x124)]});throw _0x4ded69;}}const MorphEditFileArgsSchema=z[a0_0x80080d(0x16e)]({'path':z[a0_0x80080d(0x1d6)](),'code_edit':z[a0_0x80080d(0x1d6)]()[a0_0x80080d(0x10f)](a0_0x80080d(0x17f)),'instruction':z['string']()[a0_0x80080d(0x10f)](a0_0x80080d(0x119)),'dryRun':z[a0_0x80080d(0xfb)]()[a0_0x80080d(0x1c8)](![])[a0_0x80080d(0x10f)](a0_0x80080d(0x1c9))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x80080d(0x1a8),WarpGrepArgsSchema=z['object']({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x80080d(0x1d6)]()[a0_0x80080d(0x10f)](a0_0x80080d(0x200)),'search_type':z[a0_0x80080d(0x1cf)]([a0_0x80080d(0x1c8),a0_0x80080d(0x11a)])[a0_0x80080d(0x1d5)]()['describe'](a0_0x80080d(0x1d2))}),WarpGrepGitHubArgsSchema=z[a0_0x80080d(0x16e)]({'search_string':z[a0_0x80080d(0x1d6)]()[a0_0x80080d(0x10f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()[a0_0x80080d(0x1d5)]()['describe']('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.'),'owner_repo':z['string']()[a0_0x80080d(0x1d5)]()[a0_0x80080d(0x10f)](a0_0x80080d(0x1f0)),'branch':z[a0_0x80080d(0x1d6)]()[a0_0x80080d(0x1d5)]()['describe'](a0_0x80080d(0x1ed))}),CodebaseSearchArgsSchema=z[a0_0x80080d(0x16e)]({'query':z[a0_0x80080d(0x1d6)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x80080d(0x1d6)]()['describe'](a0_0x80080d(0x18c)),'branch':z['string']()['optional']()['describe'](a0_0x80080d(0x19a)),'commitHash':z[a0_0x80080d(0x1d6)]()[a0_0x80080d(0x1d5)]()[a0_0x80080d(0x10f)](a0_0x80080d(0x1af)),'targetDirectories':z[a0_0x80080d(0x102)](z[a0_0x80080d(0x1d6)]())[a0_0x80080d(0x1c8)]([])[a0_0x80080d(0x10f)](a0_0x80080d(0x17e)),'limit':z[a0_0x80080d(0x186)]()[a0_0x80080d(0x1d5)]()['default'](0xa)[a0_0x80080d(0x10f)](a0_0x80080d(0x13d))}),server=new Server({'name':a0_0x80080d(0x16d),'version':a0_0x80080d(0x147)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0xdfd3f0=a0_0x80080d,_0xa2191=[{'name':TOOL_NAMES[_0xdfd3f0(0x127)],'description':_0xdfd3f0(0x19e)+'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'+_0xdfd3f0(0x1ff)+_0xdfd3f0(0x1e3)+_0xdfd3f0(0x1c3)+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+_0xdfd3f0(0x14c)+_0xdfd3f0(0x1fb)+_0xdfd3f0(0x157)+'Rules:\x0a'+_0xdfd3f0(0x207)+'-\x20Preserve\x20exact\x20indentation\x0a'+_0xdfd3f0(0x109)+'-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':![]},'requiresApiKey':!![]},{'name':TOOL_NAMES[_0xdfd3f0(0x1b8)],'description':'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'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0xdfd3f0(0x15b)+_0xdfd3f0(0x1fc)+'','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':!![]}],_0x59b52b=_0xa2191[_0xdfd3f0(0x142)](_0xf0cb69=>{const _0x286572=_0xdfd3f0;if(DISABLED_TOOLS['has'](_0xf0cb69['name']))return console[_0x286572(0x10c)](_0x286572(0x14f)+_0xf0cb69[_0x286572(0x11c)]+_0x286572(0x1a5)),![];if('requiresApiKey'in _0xf0cb69&&_0xf0cb69['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x286572(0x16b)+_0xf0cb69[_0x286572(0x11c)]+_0x286572(0x219)),![];return!![];});return{'tools':_0x59b52b['map'](_0x583304=>({'name':_0x583304['name'],...'title'in _0x583304&&_0x583304[_0xdfd3f0(0x145)]?{'title':_0x583304[_0xdfd3f0(0x145)]}:{},'description':_0x583304[_0xdfd3f0(0x185)],'inputSchema':_0x583304['inputSchema'],..._0xdfd3f0(0x211)in _0x583304&&_0x583304[_0xdfd3f0(0x211)]?{'annotations':_0x583304[_0xdfd3f0(0x211)]}:{}}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x245a2b=>{const _0x97bc15=a0_0x80080d,{name:_0x321354,arguments:_0x419369}=_0x245a2b[_0x97bc15(0x20d)],_0x4a5140=Date[_0x97bc15(0x148)]();logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),'tool_call_received',{'tool':_0x321354,'args':_0x321354==='edit_file'?{'path':_0x419369?.['path'],'instruction':_0x419369?.[_0x97bc15(0xfd)]||_0x419369?.[_0x97bc15(0x10d)],'dryRun':_0x419369?.[_0x97bc15(0x1b1)]}:_0x419369});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x209)}],'isError':!![]};if(!MORPH_API_KEY[_0x97bc15(0x1f4)](_0x97bc15(0x192))&&!MORPH_API_KEY['startsWith']('morph-'))return{'content':[{'type':'text','text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x321354))return{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x1da)+_0x321354+'\x22\x20is\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x321354){case TOOL_NAMES[_0x97bc15(0x127)]:{let _0x4c6f33=_0x419369;if(_0x4c6f33&&typeof _0x4c6f33===_0x97bc15(0x16e)){if(!('path'in _0x4c6f33)){const _0x4e5c31=_0x4c6f33[_0x97bc15(0x1b2)]??_0x4c6f33[_0x97bc15(0x213)]??_0x4c6f33['target_filepath']??_0x4c6f33[_0x97bc15(0x1f5)]??_0x4c6f33[_0x97bc15(0x141)];if(_0x4e5c31)_0x4c6f33={..._0x4c6f33,'path':_0x4e5c31};}_0x97bc15(0x10d)in _0x4c6f33&&!(_0x97bc15(0xfd)in _0x4c6f33)&&(_0x4c6f33={..._0x4c6f33,'instruction':_0x4c6f33[_0x97bc15(0x10d)]});if(!(_0x97bc15(0x10e)in _0x4c6f33)){const _0x409e1c=_0x4c6f33[_0x97bc15(0x1b3)]??_0x4c6f33[_0x97bc15(0x1e5)]??_0x4c6f33[_0x97bc15(0x1e7)]??_0x4c6f33['edit'];if(_0x409e1c)_0x4c6f33={..._0x4c6f33,'code_edit':_0x409e1c};}}const _0x3604bc=MorphEditFileArgsSchema[_0x97bc15(0x11d)](_0x4c6f33);if(!_0x3604bc[_0x97bc15(0x1fd)])throw new Error(_0x97bc15(0x1a0)+_0x3604bc[_0x97bc15(0x10c)]);const _0x1d50c9=await validatePath(_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1e2)]);let _0x199329=null,_0xfdebf=!![],_0x2472bf=null;try{_0x199329=await a0_0x4e6f41[_0x97bc15(0x1f6)](_0x1d50c9,_0x97bc15(0xfc)),logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),'file_read_complete',{'path':_0x1d50c9,'size_bytes':_0x199329[_0x97bc15(0x17c)]});}catch(_0x1f47a6){const _0x50e454=_0x1f47a6['code'];_0x50e454===_0x97bc15(0x1a2)?(_0xfdebf=![],_0x199329='',logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),_0x97bc15(0x15e),{'path':_0x1d50c9,'exists':![]})):(_0x2472bf=_0x97bc15(0x1ad)+(_0x50e454||_0x97bc15(0x177))+_0x97bc15(0x164)+(_0x1f47a6 instanceof Error?_0x1f47a6[_0x97bc15(0x124)]:String(_0x1f47a6)),logger[_0x97bc15(0x10c)](_0x97bc15(0x1d7),_0x97bc15(0x180),{'path':_0x1d50c9,'error':_0x2472bf}),logMcpStderr(_0x97bc15(0x16b)+_0x2472bf));}let _0x483252;try{const _0x465903=MORPH_API_KEY;if(!_0x465903)throw new Error(_0x97bc15(0x20b));const _0x56099d=a0_0x39ae41[_0x97bc15(0x215)](_0x1d50c9),_0x5aa681=a0_0x39ae41[_0x97bc15(0x129)](_0x1d50c9);logger[_0x97bc15(0x15d)]('MCP','api_request_start',{'model':_0x97bc15(0xff),'path':_0x3604bc[_0x97bc15(0x10a)]['path'],'instruction_len':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0xfd)][_0x97bc15(0x17c)],'code_edit_len':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x10e)][_0x97bc15(0x17c)],'original_code_len':_0x199329?.[_0x97bc15(0x17c)]??0x0,'dry_run':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1b1)]});const _0x1d0142=Date[_0x97bc15(0x148)](),_0x9de7c7=await executeEditFile({'target_filepath':_0x5aa681,'code_edit':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x10e)],'instruction':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0xfd)]},{'morphApiKey':_0x465903,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x56099d,'autoWrite':!_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1b1)],'generateUdiff':![],'debug':![]}),_0x869860=Date['now']()-_0x1d0142;_0x483252=_0x9de7c7[_0x97bc15(0x208)];if(!_0x9de7c7['success'])throw new Error(_0x9de7c7['error']||_0x97bc15(0x19d));const _0x428a09=_0x9de7c7[_0x97bc15(0x140)],_0x2e0bda='added\x20'+_0x428a09[_0x97bc15(0x18a)]+_0x97bc15(0x17b)+_0x428a09[_0x97bc15(0x163)]+_0x97bc15(0x1cd)+_0x428a09['linesModified'];logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),_0x97bc15(0x198),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x97bc15(0x148)]()-_0x4a5140,'edit_latency_ms':_0x869860,'changes':{'added':_0x428a09[_0x97bc15(0x18a)],'removed':_0x428a09[_0x97bc15(0x163)],'modified':_0x428a09[_0x97bc15(0x12a)]},'completion_id':_0x483252});if(_0x3604bc['data'][_0x97bc15(0x1b1)])return{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x108)+(_0xfdebf?'':_0x97bc15(0x13c))+':\x20'+_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0xfd)]+_0x97bc15(0x1cb)+_0x2e0bda+_0x97bc15(0x216)+_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1e2)]+'.'}]};return{'content':[{'type':_0x97bc15(0x18e),'text':'Morph\x20Edit\x20'+(_0xfdebf?'Applied':'Created\x20File')+':\x20'+_0x3604bc[_0x97bc15(0x10a)]['instruction']+_0x97bc15(0x1cb)+_0x2e0bda+_0x97bc15(0x216)+_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1e2)]+'.'}]};}catch(_0x7e8d91){const _0x222665=handleMorphAPIError(_0x7e8d91);if(_0x222665)return logger[_0x97bc15(0x10c)]('MCP','tool_call_error',{'tool':_0x97bc15(0x156),'error':_0x97bc15(0x138),'latency_ms':Date[_0x97bc15(0x148)]()-_0x4a5140}),_0x222665;const _0x5255a4=_0x7e8d91 instanceof Error?_0x7e8d91['message']:String(_0x7e8d91);return logger[_0x97bc15(0x10c)]('MCP',_0x97bc15(0x1bd),{'tool':_0x97bc15(0x156),'error':_0x5255a4,'path':_0x3604bc['data'][_0x97bc15(0x1e2)],'validated_path':_0x1d50c9,'latency_ms':Date[_0x97bc15(0x148)]()-_0x4a5140,'stack':_0x7e8d91 instanceof Error?_0x7e8d91['stack']:undefined}),reportMorphError({'error_message':_0x5255a4,'error_type':_0x7e8d91 instanceof Error?_0x7e8d91['constructor'][_0x97bc15(0x11c)]:_0x97bc15(0x204),'context':{'tool':_0x97bc15(0x156),'completion_id':_0x483252,'file_path':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1e2)],'validated_path':_0x1d50c9,'instruction':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0xfd)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x97bc15(0xff),'dry_run':_0x3604bc[_0x97bc15(0x10a)]['dryRun'],'file_exists':_0xfdebf,'file_read_error':_0x2472bf,'file_readable':_0x199329!==null,'request_content':{'path':_0x3604bc['data']['path'],'code_edit':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x10e)],'instruction':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0xfd)],'original_code':_0x199329!==null?_0x199329[_0x97bc15(0x17c)]>0xc350?_0x199329[_0x97bc15(0x222)](0x0,0xc350)+_0x97bc15(0x16f)+_0x199329[_0x97bc15(0x17c)]+'\x20chars)':_0x199329:_0x97bc15(0x1f3)+(_0x2472bf||_0x97bc15(0x1f1))+']','original_code_length':_0x199329?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x97bc15(0x162):_0x97bc15(0xff),'dry_run':_0x3604bc[_0x97bc15(0x10a)][_0x97bc15(0x1b1)]}},'stack_trace':_0x7e8d91 instanceof Error?_0x7e8d91[_0x97bc15(0x221)]:undefined,'source':_0x97bc15(0x13b)})[_0x97bc15(0x1de)](()=>{}),{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x1a4)+_0x5255a4}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x315a77=WarpGrepArgsSchema[_0x97bc15(0x11d)](_0x419369);if(!_0x315a77[_0x97bc15(0x1fd)])return{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x19b)+_0x315a77[_0x97bc15(0x10c)]}],'isError':!![]};const _0x4ab666=_0x197f29=>{const _0xc24f58=_0x97bc15,_0x2dd2c1=[];for(const _0x2258bd of _0x197f29||[]){if(_0x2258bd['role']===_0xc24f58(0x12d)&&Array[_0xc24f58(0x1c6)](_0x2258bd[_0xc24f58(0x1f2)]))for(const _0x3021ce of _0x2258bd[_0xc24f58(0x1f2)]){try{const _0x427866=_0x3021ce['function']?.['name'],_0x25c76e=JSON[_0xc24f58(0x1dd)](_0x3021ce[_0xc24f58(0x158)]?.['arguments']||'{}');if(_0x427866===_0xc24f58(0x1b0))_0x2dd2c1[_0xc24f58(0x15a)]('grep\x20\x27'+_0x25c76e[_0xc24f58(0x1a9)]+'\x27\x20'+(_0x25c76e['path']||'.'));else{if(_0x427866===_0xc24f58(0x206))_0x2dd2c1[_0xc24f58(0x15a)](_0xc24f58(0x1eb)+_0x25c76e[_0xc24f58(0x1e2)]);else{if(_0x427866===_0xc24f58(0x189))_0x2dd2c1[_0xc24f58(0x15a)]('list_directory\x20'+(_0x25c76e[_0xc24f58(0x12c)]||'.'));else{if(_0x427866===_0xc24f58(0x17a))_0x2dd2c1[_0xc24f58(0x15a)](_0xc24f58(0x218)+_0x25c76e[_0xc24f58(0x1a9)]+'\x27\x20'+(_0x25c76e[_0xc24f58(0x1e2)]||'.'));else _0x427866===_0xc24f58(0x126)&&_0x2dd2c1[_0xc24f58(0x15a)](_0xc24f58(0x126));}}}}catch{}}}return _0x2dd2c1;},_0x2e7b81=_0x580cd0=>{const _0x152260=_0x97bc15,_0x50f61e=[];if(!_0x580cd0||!Array[_0x152260(0x1c6)](_0x580cd0))return _0x50f61e;const _0x4b55eb=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x152260(0x194),'tool':_0x152260(0x206)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':'read'},{'pattern':/\[READ ERROR\]/,'error_type':_0x152260(0x214),'tool':_0x152260(0x206)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x152260(0x179),'tool':_0x152260(0x206)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x152260(0x1bc),'tool':_0x152260(0x1a7)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x152260(0x1e1),'tool':_0x152260(0x1a7)},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x152260(0x206)},{'pattern':/\[SYMLINK\]/,'error_type':_0x152260(0x187),'tool':_0x152260(0x206)},{'pattern':/not a text file/,'error_type':_0x152260(0x179),'tool':_0x152260(0x206)},{'pattern':/symbolic link/,'error_type':_0x152260(0x187),'tool':_0x152260(0x206)},{'pattern':/Error reading file:/,'error_type':_0x152260(0x214),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x152260(0x110),'tool':_0x152260(0x177)}];let _0x38ea97=0x0;for(const _0x415a23 of _0x580cd0){_0x415a23[_0x152260(0x1c5)]===_0x152260(0x12d)&&Array[_0x152260(0x1c6)](_0x415a23['tool_calls'])&&_0x38ea97++;const _0x3fb9a9=_0x415a23['content'];if((_0x415a23[_0x152260(0x1c5)]===_0x152260(0x1ef)||_0x415a23['role']==='user')&&_0x3fb9a9&&typeof _0x3fb9a9===_0x152260(0x1d6))for(const {pattern:_0x1ebb8b,error_type:_0x4cc88c,tool:_0x4ea11a}of _0x4b55eb){const _0x3526fb=_0x3fb9a9[_0x152260(0x1c1)](new RegExp(_0x1ebb8b[_0x152260(0x125)],'g'));if(_0x3526fb)for(const _0x3b6163 of _0x3526fb){const _0x22af2d=_0x3fb9a9[_0x152260(0x151)](_0x3b6163),_0x469d83=_0x3fb9a9[_0x152260(0x222)](_0x22af2d,Math[_0x152260(0x1c0)](_0x22af2d+0xc8,_0x3fb9a9[_0x152260(0x17c)]));_0x50f61e[_0x152260(0x15a)]({'tool':_0x4ea11a,'error_type':_0x4cc88c,'error_message':_0x469d83[_0x152260(0x14e)]('\x0a')[0x0],'turn':_0x38ea97});}}}return _0x50f61e;};try{const _0x1d5a8e=a0_0x39ae41[_0x97bc15(0x113)](_0x315a77[_0x97bc15(0x10a)]['repo_path']),_0x29e278=_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x150)],_0x39b2d4=_0x29e278===_0x97bc15(0x11a)?{'allowNames':[_0x97bc15(0x11a)]}:undefined,_0x3a834f=new LocalRipgrepProvider(_0x1d5a8e,undefined,_0x39b2d4);logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),'provider_created',{'type':'LocalRipgrepProvider','repo_root':_0x1d5a8e,'search_type':_0x29e278||_0x97bc15(0x1c8)}),logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),_0x97bc15(0x155),{'query':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x166)],'repo_root':_0x1d5a8e,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x160e4c=Date[_0x97bc15(0x148)](),_0x56da8c=await runWarpGrep({'searchTerm':_0x315a77['data'][_0x97bc15(0x166)],'repoRoot':_0x1d5a8e,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x3a834f,'search_type':_0x29e278}),_0x28be6c=Date[_0x97bc15(0x148)]()-_0x160e4c,_0x426f63=_0x56da8c['finish']?.[_0x97bc15(0x21e)]?.[_0x97bc15(0x143)]?.['length']??0x0;logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),_0x97bc15(0x14a),{'termination':_0x56da8c[_0x97bc15(0x1e6)],'turns':_0x56da8c['timings']?.[_0x97bc15(0x1a3)]??0x0,'files_found':_0x426f63,'latency_ms':_0x28be6c});const _0x2b921c=_0x2e7b81(_0x56da8c['messages']);_0x2b921c['length']>0x0&&reportMorphError({'error_message':_0x97bc15(0x111)+_0x2b921c[_0x97bc15(0x17c)]+_0x97bc15(0x1ab),'error_type':_0x97bc15(0x1c4),'level':'warn','tool':_0x97bc15(0x171),'context':{'repo_path':_0x315a77[_0x97bc15(0x10a)]['repo_path'],'query':_0x315a77['data'][_0x97bc15(0x166)],'model':_0x97bc15(0x181),'termination_reason':_0x56da8c['terminationReason'],'sub_tool_errors':_0x2b921c,'timings':_0x56da8c[_0x97bc15(0x190)],'tool_calls':_0x4ab666(_0x56da8c['messages']),'messages':_0x56da8c[_0x97bc15(0x101)]?.['map'](_0x5ba64b=>({'role':_0x5ba64b[_0x97bc15(0x1c5)],'content':_0x5ba64b[_0x97bc15(0x1e7)],..._0x5ba64b['tool_calls']?{'tool_calls':_0x5ba64b[_0x97bc15(0x1f2)][_0x97bc15(0x17c)]}:{},..._0x5ba64b[_0x97bc15(0x15f)]?{'tool_call_id':_0x5ba64b[_0x97bc15(0x15f)]}:{}}))},'source':_0x97bc15(0x13b)})[_0x97bc15(0x1de)](()=>{});let _0x2c20e2='';if(_0x56da8c[_0x97bc15(0x1e6)]===_0x97bc15(0x1b6)&&_0x56da8c[_0x97bc15(0x126)]?.[_0x97bc15(0x21e)]?.['files']){const _0x505f98=_0x56da8c[_0x97bc15(0x126)][_0x97bc15(0x21e)][_0x97bc15(0x143)];if(_0x505f98[_0x97bc15(0x17c)]===0x0)return _0x2c20e2=_0x56da8c[_0x97bc15(0x126)][_0x97bc15(0x19f)]||_0x97bc15(0x1d0),{'content':[{'type':_0x97bc15(0x18e),'text':_0x2c20e2}]};const _0x479615=[],_0x2f1687=[_0x97bc15(0x178)];for(const _0x55d95d of _0x56da8c['messages']){if(_0x55d95d[_0x97bc15(0x1c5)]===_0x97bc15(0x12d)&&Array[_0x97bc15(0x1c6)](_0x55d95d[_0x97bc15(0x1f2)]))for(const _0x14a317 of _0x55d95d[_0x97bc15(0x1f2)]){try{const _0x12c418=_0x14a317[_0x97bc15(0x158)]?.[_0x97bc15(0x11c)],_0x2baf68=JSON[_0x97bc15(0x1dd)](_0x14a317['function']?.[_0x97bc15(0x18b)]||'{}');if(_0x12c418===_0x97bc15(0x1b0))_0x2f1687[_0x97bc15(0x15a)](_0x97bc15(0x174)+_0x2baf68[_0x97bc15(0x1a9)]+'\x27\x20in\x20`'+(_0x2baf68['path']||'.')+'`');else{if(_0x12c418===_0x97bc15(0x206))_0x2f1687[_0x97bc15(0x15a)](_0x97bc15(0x188)+_0x2baf68[_0x97bc15(0x1e2)]+'`');else{if(_0x12c418===_0x97bc15(0x189))_0x2f1687[_0x97bc15(0x15a)](_0x97bc15(0x183)+(_0x2baf68[_0x97bc15(0x12c)]||'.')+'`');else _0x12c418===_0x97bc15(0x17a)&&_0x2f1687['push'](_0x97bc15(0xfe)+_0x2baf68[_0x97bc15(0x1a9)]+_0x97bc15(0x1ce)+(_0x2baf68[_0x97bc15(0x1e2)]||'.')+'`');}}}catch{}}}_0x479615[_0x97bc15(0x15a)](_0x2f1687[_0x97bc15(0x210)]('\x0a'));const _0x51f035=['',_0x97bc15(0x116)];for(const _0x18712d of _0x505f98){if(_0x18712d[_0x97bc15(0x1ea)]==='*')_0x51f035[_0x97bc15(0x15a)]('-\x20'+_0x18712d['path']+':*');else{if(Array['isArray'](_0x18712d[_0x97bc15(0x1ea)])){const _0xc46157=_0x18712d[_0x97bc15(0x1ea)][_0x97bc15(0x1aa)](([_0x4ef581,_0x1127f1])=>{if(_0x4ef581===_0x1127f1)return''+_0x4ef581;return _0x4ef581+'-'+_0x1127f1;});_0x51f035['push']('-\x20'+_0x18712d[_0x97bc15(0x1e2)]+':'+_0xc46157['join'](','));}else _0x51f035[_0x97bc15(0x15a)]('-\x20'+_0x18712d[_0x97bc15(0x1e2)]+':*');}}_0x51f035['push'](''),_0x479615['push'](_0x51f035[_0x97bc15(0x210)]('\x0a')),_0x479615['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x56164f=[],_0x2a8a34=[];for(const _0x4b5756 of _0x505f98){let _0xcb3fff=a0_0x39ae41['resolve'](_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)],_0x4b5756['path']),_0x4745d0=null,_0x55b265=null;try{_0x4745d0=await a0_0x4e6f41[_0x97bc15(0x1f6)](_0xcb3fff,{'encoding':_0x97bc15(0xfc)});}catch(_0x39d0a5){const _0x413eb2=fixPathRepetition(_0xcb3fff);if(_0x413eb2)try{_0x4745d0=await a0_0x4e6f41[_0x97bc15(0x1f6)](_0x413eb2,{'encoding':_0x97bc15(0xfc)}),_0xcb3fff=_0x413eb2;}catch{_0x55b265=_0x39d0a5 instanceof Error?_0x39d0a5:new Error(String(_0x39d0a5));}else _0x55b265=_0x39d0a5 instanceof Error?_0x39d0a5:new Error(String(_0x39d0a5));}if(_0x4745d0!==null){const _0xb17c99=_0x4745d0[_0x97bc15(0x14e)](/\r?\n/),_0xab1e13=[];if(_0x4b5756['lines']==='*'||!Array['isArray'](_0x4b5756['lines']))for(let _0x5ed22a=0x1;_0x5ed22a<=_0xb17c99['length'];_0x5ed22a++){const _0x2dcf9d=_0xb17c99[_0x5ed22a-0x1];_0xab1e13['push'](_0x5ed22a+'|\x20'+_0x2dcf9d);}else for(const [_0x568976,_0x553db7]of _0x4b5756[_0x97bc15(0x1ea)]){_0xab1e13[_0x97bc15(0x17c)]>0x0&&_0xab1e13[_0x97bc15(0x15a)]('');for(let _0x40d85f=_0x568976;_0x40d85f<=_0x553db7&&_0x40d85f<=_0xb17c99[_0x97bc15(0x17c)];_0x40d85f++){const _0x4621ff=_0xb17c99[_0x40d85f-0x1];_0xab1e13['push'](_0x40d85f+'|\x20'+_0x4621ff);}}_0x2a8a34[_0x97bc15(0x15a)]({'path':_0x4b5756[_0x97bc15(0x1e2)],'content':_0xab1e13['join']('\x0a')});}else _0x56164f[_0x97bc15(0x15a)](_0x97bc15(0x21d)+_0x4b5756[_0x97bc15(0x1e2)]+_0x97bc15(0x195)+(_0x55b265?.['message']||_0x97bc15(0x1d9))+_0x97bc15(0x21a));}try{const _0x9f1673=await compactFileContexts(_0x2a8a34,_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x166)],MORPH_API_KEY,MORPH_API_URL);for(const _0x1acdf3 of _0x9f1673){_0x56164f[_0x97bc15(0x15a)](_0x97bc15(0x21d)+_0x1acdf3[_0x97bc15(0x1e2)]+_0x97bc15(0x14b)+_0x1acdf3[_0x97bc15(0x1e7)]+_0x97bc15(0x21a));}}catch(_0x544f48){logger['warn'](_0x97bc15(0x1d7),_0x97bc15(0x11b),{'error':_0x544f48 instanceof Error?_0x544f48['message']:String(_0x544f48),'files_count':_0x2a8a34[_0x97bc15(0x17c)]});for(const _0x12b2fd of _0x2a8a34){_0x56164f[_0x97bc15(0x15a)](_0x97bc15(0x21d)+_0x12b2fd[_0x97bc15(0x1e2)]+_0x97bc15(0x14b)+_0x12b2fd[_0x97bc15(0x1e7)]+_0x97bc15(0x21a));}}_0x479615['push'](_0x56164f[_0x97bc15(0x210)]('\x0a\x0a')),_0x2c20e2=_0x479615['join']('\x0a');const _0x20f5d5=_0x56da8c['errors']?.['filter'](_0x176f06=>_0x176f06[_0x97bc15(0x124)]?.['startsWith'](_0x97bc15(0x20c)))||[];if(_0x20f5d5[_0x97bc15(0x17c)]>0x0){const _0x446e1a=_0x20f5d5[_0x97bc15(0x1aa)](_0x493e11=>_0x493e11['message'])['join'](';\x20');reportMorphError({'error_message':_0x446e1a,'error_type':_0x97bc15(0x1bf),'context':{'tool':_0x97bc15(0x171),'repo_path':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)],'query':_0x315a77[_0x97bc15(0x10a)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x97bc15(0x1bb),'error_count':_0x20f5d5['length'],'is_timeout':![],'timings':_0x56da8c[_0x97bc15(0x190)],'files_attempted':_0x505f98[_0x97bc15(0x1aa)](_0x3fd6ce=>({'path':_0x3fd6ce[_0x97bc15(0x1e2)],'lines':_0x3fd6ce[_0x97bc15(0x1ea)]})),'tool_calls':_0x4ab666(_0x56da8c[_0x97bc15(0x101)]),'messages':_0x56da8c['messages']?.[_0x97bc15(0x1aa)](_0x50a0e2=>({'role':_0x50a0e2[_0x97bc15(0x1c5)],'content':_0x50a0e2[_0x97bc15(0x1e7)],..._0x50a0e2['tool_calls']?{'tool_calls':_0x50a0e2[_0x97bc15(0x1f2)][_0x97bc15(0x17c)]}:{},..._0x50a0e2[_0x97bc15(0x15f)]?{'tool_call_id':_0x50a0e2['tool_call_id']}:{}})),'request_content':{'query':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x166)],'repo_path':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)],'repoRoot':a0_0x39ae41[_0x97bc15(0x113)](_0x315a77[_0x97bc15(0x10a)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'source':'mcp-filesystem'})[_0x97bc15(0x1de)](()=>{});}}else{if(_0x56da8c[_0x97bc15(0x1e6)]===_0x97bc15(0x161)&&_0x56da8c[_0x97bc15(0x154)][_0x97bc15(0x17c)]>0x0){const _0x33ba99=_0x56da8c[_0x97bc15(0x154)][_0x97bc15(0x1aa)](_0x4249de=>_0x4249de['message'])[_0x97bc15(0x210)](';\x20');_0x2c20e2=_0x97bc15(0x20f)+_0x33ba99;const _0x28ca9e=_0x33ba99[_0x97bc15(0x10b)]()[_0x97bc15(0x114)]('timeout')||_0x33ba99[_0x97bc15(0x10b)]()[_0x97bc15(0x114)](_0x97bc15(0x144))||_0x33ba99[_0x97bc15(0x10b)]()[_0x97bc15(0x114)](_0x97bc15(0x13e)),_0x15b41c=_0x56da8c['finish']?.[_0x97bc15(0x21e)]?.['files'],_0x48064b=_0x56da8c[_0x97bc15(0x154)][0x0];reportMorphError({'error_message':_0x33ba99,'error_type':_0x28ca9e?_0x97bc15(0x104):_0x48064b?.['constructor']?.[_0x97bc15(0x11c)]||'WarpGrepError','context':{'tool':_0x97bc15(0x171),'repo_path':_0x315a77[_0x97bc15(0x10a)]['repo_path'],'query':_0x315a77[_0x97bc15(0x10a)]['search_string'],'model':_0x97bc15(0x181),'termination_reason':_0x56da8c['terminationReason'],'error_count':_0x56da8c[_0x97bc15(0x154)][_0x97bc15(0x17c)],'is_timeout':_0x28ca9e,'timings':_0x56da8c['timings'],'files_attempted':_0x15b41c?.['map'](_0x575f6e=>({'path':_0x575f6e[_0x97bc15(0x1e2)],'lines':_0x575f6e[_0x97bc15(0x1ea)]})),'tool_calls':_0x4ab666(_0x56da8c[_0x97bc15(0x101)]),'messages':_0x56da8c[_0x97bc15(0x101)]?.[_0x97bc15(0x1aa)](_0x134fa2=>({'role':_0x134fa2[_0x97bc15(0x1c5)],'content':_0x134fa2[_0x97bc15(0x1e7)],..._0x134fa2['tool_calls']?{'tool_calls':_0x134fa2[_0x97bc15(0x1f2)]['length']}:{},..._0x134fa2['tool_call_id']?{'tool_call_id':_0x134fa2['tool_call_id']}:{}})),'request_content':{'query':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x166)],'repo_path':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)],'repoRoot':a0_0x39ae41[_0x97bc15(0x113)](_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)]),'model':_0x97bc15(0x181)}},'stack_trace':_0x48064b?.['stack']||undefined,'source':'mcp-filesystem'})[_0x97bc15(0x1de)](()=>{});}else _0x2c20e2='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x2c20e2}]};}catch(_0x394c95){const _0xdff22=handleMorphAPIError(_0x394c95);if(_0xdff22)return logger[_0x97bc15(0x10c)](_0x97bc15(0x1d7),_0x97bc15(0x1bd),{'tool':'codebase_search','error':_0x97bc15(0x138),'latency_ms':Date['now']()-_0x4a5140}),_0xdff22;const _0x61befa=_0x394c95 instanceof Error?_0x394c95[_0x97bc15(0x124)]:String(_0x394c95);logger['error'](_0x97bc15(0x1d7),'tool_call_error',{'tool':_0x97bc15(0x171),'error':_0x61befa,'repo_path':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)],'query':_0x315a77['data']['search_string'],'latency_ms':Date[_0x97bc15(0x148)]()-_0x4a5140});const _0x507d8d=_0x61befa['toLowerCase']()[_0x97bc15(0x114)]('timeout')||_0x61befa[_0x97bc15(0x10b)]()['includes'](_0x97bc15(0x144))||_0x61befa[_0x97bc15(0x10b)]()[_0x97bc15(0x114)](_0x97bc15(0x13e))||_0x394c95 instanceof Error&&_0x394c95[_0x97bc15(0x11c)]===_0x97bc15(0x104);return reportMorphError({'error_message':_0x61befa,'error_type':_0x507d8d?'TimeoutError':_0x394c95 instanceof Error?_0x394c95[_0x97bc15(0x153)]['name']:'UnknownError','context':{'tool':_0x97bc15(0x171),'repo_path':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)],'query':_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x166)],'model':_0x97bc15(0x181),'is_timeout':_0x507d8d,'exception_phase':_0x97bc15(0x16a),'request_content':{'query':_0x315a77[_0x97bc15(0x10a)]['search_string'],'repo_path':_0x315a77['data']['repo_path'],'repoRoot':a0_0x39ae41[_0x97bc15(0x113)](_0x315a77[_0x97bc15(0x10a)][_0x97bc15(0x19c)]),'model':_0x97bc15(0x181)}},'stack_trace':_0x394c95 instanceof Error?_0x394c95[_0x97bc15(0x221)]:undefined,'source':_0x97bc15(0x13b)})[_0x97bc15(0x1de)](()=>{}),{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x1a6)+_0x61befa}],'isError':![]};}}case TOOL_NAMES[_0x97bc15(0x1ac)]:{const _0x2adbea=WarpGrepGitHubArgsSchema['safeParse'](_0x419369);if(!_0x2adbea['success'])return{'content':[{'type':_0x97bc15(0x18e),'text':'Invalid\x20arguments:\x20'+_0x2adbea[_0x97bc15(0x10c)]}],'isError':!![]};const _0x4a43ce=_0x2adbea['data']['github_url']||_0x2adbea[_0x97bc15(0x10a)]['owner_repo'];if(!_0x4a43ce)return{'content':[{'type':'text','text':_0x97bc15(0x123)}],'isError':!![]};const _0x16adf6=MORPH_API_KEY;if(!_0x16adf6)throw new Error(_0x97bc15(0x20b));const _0x11ff38=Date['now']();logger[_0x97bc15(0x15d)](_0x97bc15(0x1d7),'github_search_start',{'identifier':_0x4a43ce,'query':_0x2adbea[_0x97bc15(0x10a)][_0x97bc15(0x166)],'branch':_0x2adbea['data'][_0x97bc15(0x191)]});try{const _0x34a6c0=new WarpGrepClient({'morphApiKey':_0x16adf6,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3541d1=await _0x34a6c0['searchGitHub']({'searchTerm':_0x2adbea[_0x97bc15(0x10a)]['search_string'],'github':_0x4a43ce,'branch':_0x2adbea[_0x97bc15(0x10a)][_0x97bc15(0x191)]}),_0x5bd56d=Date['now']()-_0x11ff38;logMcpStderr(_0x97bc15(0x168)+_0x5bd56d+'ms.\x20Success:\x20'+_0x3541d1['success']);const _0x12c71b=formatResult(_0x3541d1);return{'content':[{'type':'text','text':_0x12c71b}]};}catch(_0x3ae4e3){const _0x2d5ffd=handleMorphAPIError(_0x3ae4e3);if(_0x2d5ffd)return _0x2d5ffd;const _0x488e20=Date[_0x97bc15(0x148)]()-_0x11ff38,_0x317833=_0x3ae4e3 instanceof Error?_0x3ae4e3[_0x97bc15(0x124)]:String(_0x3ae4e3);return logMcpStderr(_0x97bc15(0x1fa)+_0x488e20+'ms:',_0x317833),reportMorphError({'error_message':_0x317833,'error_type':_0x3ae4e3 instanceof Error?_0x3ae4e3[_0x97bc15(0x153)][_0x97bc15(0x11c)]:_0x97bc15(0x204),'context':{'tool':'github_codebase_search','github_url':_0x4a43ce,'search_string':_0x2adbea[_0x97bc15(0x10a)][_0x97bc15(0x166)],'branch':_0x2adbea['data']['branch']},'stack_trace':_0x3ae4e3 instanceof Error?_0x3ae4e3[_0x97bc15(0x221)]:undefined,'source':_0x97bc15(0x13b),'tool':_0x97bc15(0x184),'latency_ms':_0x488e20})[_0x97bc15(0x1de)](()=>{}),{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x217)+_0x317833}],'isError':![]};}}default:throw new Error(_0x97bc15(0x1b7)+_0x321354);}}catch(_0x51dd2f){const _0x251b2b=_0x51dd2f instanceof Error?_0x51dd2f[_0x97bc15(0x124)]:String(_0x51dd2f);return reportMorphError({'error_message':_0x251b2b,'error_type':_0x51dd2f instanceof Error?_0x51dd2f[_0x97bc15(0x153)]['name']:'UnknownError','context':{'tool':_0x321354,'arguments':_0x419369?JSON['stringify'](_0x419369)[_0x97bc15(0x222)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x51dd2f instanceof Error?_0x51dd2f[_0x97bc15(0x221)]:undefined,'source':'mcp-filesystem'})[_0x97bc15(0x1de)](()=>{}),{'content':[{'type':_0x97bc15(0x18e),'text':_0x97bc15(0x20f)+_0x251b2b}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4aa3a9){const _0x4a7618=a0_0x80080d,_0x98cfdd=await getValidRootDirectories(_0x4aa3a9);if(_0x98cfdd[_0x4a7618(0x17c)]>0x0)allowedDirectories=[..._0x98cfdd],logMcpStderr(_0x4a7618(0x159)+_0x98cfdd[_0x4a7618(0x17c)]+_0x4a7618(0x193));else{logMcpStderr(_0x4a7618(0x121));if(ENABLE_WORKSPACE_MODE)try{const _0x1cfe5f=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1cfe5f&&(allowedDirectories=[_0x1cfe5f],logMcpStderr(_0x4a7618(0x1db)+_0x1cfe5f));}catch(_0x42857b){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x42857b);}}}server[a0_0x80080d(0x1e0)](RootsListChangedNotificationSchema,async()=>{const _0x199cfb=a0_0x80080d;try{const _0x45ae6c=await server['listRoots']();_0x45ae6c&&_0x199cfb(0x21b)in _0x45ae6c&&await updateAllowedDirectoriesFromRoots(_0x45ae6c['roots']);}catch(_0x642276){logMcpStderr(_0x199cfb(0x1ba),_0x642276 instanceof Error?_0x642276['message']:String(_0x642276));}}),server[a0_0x80080d(0x1a1)]=async()=>{const _0x31f264=a0_0x80080d,_0x2c3aab=server['getClientCapabilities']();if(_0x2c3aab?.[_0x31f264(0x21b)])try{const _0x4f9693=await server[_0x31f264(0x1dc)]();_0x4f9693&&'roots'in _0x4f9693?await updateAllowedDirectoriesFromRoots(_0x4f9693['roots']):logMcpStderr(_0x31f264(0x1f7));}catch(_0x160ecc){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x160ecc instanceof Error?_0x160ecc[_0x31f264(0x124)]:String(_0x160ecc));}else{if(allowedDirectories[_0x31f264(0x17c)]>0x0)logMcpStderr(_0x31f264(0x133),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x31f264(0x136));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 _0x5d9a24=a0_0x80080d,_0x3c664e=new StdioServerTransport();await server[_0x5d9a24(0x160)](_0x3c664e),logMcpStderr(_0x5d9a24(0x1fe)),allowedDirectories[_0x5d9a24(0x17c)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x1a35e8=>{const _0xf777fd=a0_0x80080d;logMcpStderr('Fatal\x20error\x20running\x20server:',_0x1a35e8),process[_0xf777fd(0x199)](0x1);});
2
+ const a0_0x5e6917=a0_0x51b7;(function(_0x4bde6e,_0x42c89d){const _0x1edea4=a0_0x51b7,_0x47e182=_0x4bde6e();while(!![]){try{const _0x5d4279=parseInt(_0x1edea4(0x19c))/0x1*(parseInt(_0x1edea4(0x130))/0x2)+-parseInt(_0x1edea4(0x18d))/0x3+parseInt(_0x1edea4(0x12a))/0x4*(parseInt(_0x1edea4(0x1b1))/0x5)+-parseInt(_0x1edea4(0x11f))/0x6+-parseInt(_0x1edea4(0x1d8))/0x7*(-parseInt(_0x1edea4(0x120))/0x8)+-parseInt(_0x1edea4(0x13d))/0x9*(-parseInt(_0x1edea4(0x127))/0xa)+parseInt(_0x1edea4(0xd3))/0xb;if(_0x5d4279===_0x42c89d)break;else _0x47e182['push'](_0x47e182['shift']());}catch(_0x9e7c9){_0x47e182['push'](_0x47e182['shift']());}}}(a0_0x5a0d,0x50a81));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_0x55e678 from'fs/promises';import a0_0x3df761 from'path';import a0_0x42d180 from'os';import{createRequire}from'module';function a0_0x51b7(_0x4c62de,_0xd6d5c7){_0x4c62de=_0x4c62de-0xc5;const _0x5a0dc3=a0_0x5a0d();let _0x51b7dd=_0x5a0dc3[_0x4c62de];return _0x51b7dd;}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_0x174bef from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES,resolveToolFilter}from'./tool-definitions.js';function fixPathRepetition(_0x5dd65d){const _0x364168=a0_0x51b7,_0x4f9e6f=_0x5dd65d[_0x364168(0x10a)](a0_0x3df761[_0x364168(0xf6)])[_0x364168(0x177)](Boolean);if(_0x4f9e6f[_0x364168(0x1be)]<0x2)return null;for(let _0x406384=Math['floor'](_0x4f9e6f[_0x364168(0x1be)]/0x2);_0x406384>=0x1;_0x406384--){for(let _0xb51ae2=0x0;_0xb51ae2<=_0x4f9e6f[_0x364168(0x1be)]-0x2*_0x406384;_0xb51ae2++){const _0x4056dd=_0x4f9e6f[_0x364168(0x192)](_0xb51ae2,_0xb51ae2+_0x406384),_0x2143c5=_0x4f9e6f[_0x364168(0x192)](_0xb51ae2+_0x406384,_0xb51ae2+0x2*_0x406384);if(_0x4056dd[_0x364168(0x198)]((_0x245e80,_0x12cc82)=>_0x245e80===_0x2143c5[_0x12cc82])){const _0x31ee4a=[..._0x4f9e6f[_0x364168(0x192)](0x0,_0xb51ae2),..._0x4f9e6f[_0x364168(0x192)](_0xb51ae2+_0x406384)];return a0_0x3df761[_0x364168(0xf6)]+_0x31ee4a['join'](a0_0x3df761['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0xc06c8f=a0_0x51b7;try{const _0x34c2ba=require(_0xc06c8f(0x12e));return _0x34c2ba['version']??_0xc06c8f(0x176);}catch(_0x5f08f7){return logMcpStderr(_0xc06c8f(0x1d9),_0x5f08f7),_0xc06c8f(0x176);}}function printHelp(){const _0x2d529d=a0_0x51b7;console[_0x2d529d(0x111)](_0x2d529d(0x11b)+getPackageVersion()),console[_0x2d529d(0x111)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x2d529d(0x111)](_0x2d529d(0xd0)),console[_0x2d529d(0x111)](_0x2d529d(0x1f1)),console[_0x2d529d(0x111)](_0x2d529d(0x1af)),console[_0x2d529d(0x111)](_0x2d529d(0x15f)),console['log'](_0x2d529d(0x169)),console[_0x2d529d(0x111)]('\x20\x20morph-mcp'),console[_0x2d529d(0x111)](_0x2d529d(0x142));}const cliArgs=process[a0_0x5e6917(0x147)][a0_0x5e6917(0x192)](0x2),VERSION_FLAGS=new Set([a0_0x5e6917(0x12d),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x5e6917(0x191)](_0x9f17d3=>VERSION_FLAGS[a0_0x5e6917(0x13a)](_0x9f17d3))&&(console[a0_0x5e6917(0x111)](a0_0x5e6917(0x11b)+getPackageVersion()),process[a0_0x5e6917(0x15a)](0x0));cliArgs[a0_0x5e6917(0x191)](_0x3fe20e=>HELP_FLAGS['has'](_0x3fe20e))&&(printHelp(),process[a0_0x5e6917(0x15a)](0x0));function getCliArg(_0x17bf20){const _0x4acb9c=a0_0x5e6917;for(let _0x209ea7=0x0;_0x209ea7<cliArgs[_0x4acb9c(0x1be)];_0x209ea7++){const _0x30c065=cliArgs[_0x209ea7];if(_0x30c065[_0x4acb9c(0x124)]('--'+_0x17bf20+'='))return _0x30c065[_0x4acb9c(0x192)](('--'+_0x17bf20+'=')[_0x4acb9c(0x1be)]);if(_0x30c065==='--'+_0x17bf20&&_0x209ea7+0x1<cliArgs[_0x4acb9c(0x1be)])return cliArgs[_0x209ea7+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5e6917(0x1be)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x5e6917(0x13a)](arg))continue;if(arg[a0_0x5e6917(0x124)]('--api-key='))continue;if(arg===a0_0x5e6917(0x131)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x5e6917(0x1cb)][a0_0x5e6917(0x17e)]||process['env'][a0_0x5e6917(0x10d)]||process[a0_0x5e6917(0xd8)](),ENABLE_WORKSPACE_MODE=process[a0_0x5e6917(0x1cb)][a0_0x5e6917(0x1a4)]!=='false',MORPH_API_KEY=getCliArg(a0_0x5e6917(0x1db))??process[a0_0x5e6917(0x1cb)][a0_0x5e6917(0xfd)],MORPH_API_URL=process[a0_0x5e6917(0x1cb)][a0_0x5e6917(0x1d1)],MORPH_LARGE_APPLY=process[a0_0x5e6917(0x1cb)][a0_0x5e6917(0x196)]!==a0_0x5e6917(0x132),MORPH_WARP_GREP_TIMEOUT=process[a0_0x5e6917(0x1cb)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x5e6917(0x1cb)][a0_0x5e6917(0x18f)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),TOOL_FILTER=resolveToolFilter(process['env']),DISABLED_TOOLS=TOOL_FILTER['disabled'];for(const tool of TOOL_FILTER['unknown']){console[a0_0x5e6917(0xcf)](a0_0x5e6917(0x14d)+tool+a0_0x5e6917(0x1f0)+[...KNOWN_TOOL_NAMES][a0_0x5e6917(0x18e)](',\x20'));}DISABLED_TOOLS[a0_0x5e6917(0x19f)]>0x0&&console[a0_0x5e6917(0xcf)](a0_0x5e6917(0x1c1)+[...DISABLED_TOOLS][a0_0x5e6917(0x18e)](',\x20'));MORPH_API_KEY&&!MORPH_API_KEY[a0_0x5e6917(0x124)](a0_0x5e6917(0x1ac))&&!MORPH_API_KEY[a0_0x5e6917(0x124)](a0_0x5e6917(0x193))&&logMcpStderr(a0_0x5e6917(0x1c4));async function reportMorphError(_0x32ca7c){const _0x1194b4=a0_0x5e6917;try{await a0_0x174bef[_0x1194b4(0xdd)](_0x1194b4(0x119),{..._0x32ca7c,'timestamp':new Date()[_0x1194b4(0x1a0)](),'source':_0x32ca7c[_0x1194b4(0xcd)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x32ca7c['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x1194b4(0x178),'Authorization':_0x1194b4(0x162)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x120be2,_0x261e71){const _0x4774bf=a0_0x5e6917;if(_0x120be2&&typeof _0x120be2==='object'&&_0x4774bf(0x1aa)in _0x120be2)return _0x120be2[_0x4774bf(0x1aa)];if(_0x120be2&&typeof _0x120be2===_0x4774bf(0x1a3)&&_0x4774bf(0xf4)in _0x120be2)return _0x120be2[_0x4774bf(0xf4)]?.[_0x4774bf(0x1aa)];const _0x48db9e=_0x261e71[_0x4774bf(0x183)](/\b(401|429)\b/);return _0x48db9e?parseInt(_0x48db9e[0x1],0xa):null;}function handleMorphAPIError(_0x38380a){const _0x49ddf6=a0_0x5e6917,_0x68e38e=_0x38380a instanceof Error?_0x38380a['message']:String(_0x38380a),_0x4e2962=extractStatusCode(_0x38380a,_0x68e38e);switch(_0x4e2962){case 0x191:return{'content':[{'type':_0x49ddf6(0xf8),'text':_0x49ddf6(0xed)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x49ddf6(0xf8),'text':_0x49ddf6(0x1cf)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5e6917(0xd4)),logMcpStderr(a0_0x5e6917(0x1ae)),logMcpStderr(a0_0x5e6917(0x152)),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_0x5e6917(0x1c3)));function normalizePath(_0x2e18ca){const _0xf928d9=a0_0x5e6917;return a0_0x3df761[_0xf928d9(0x16b)](_0x2e18ca);}function expandHome(_0xe26b3e){const _0x24a9c5=a0_0x5e6917;if(_0xe26b3e[_0x24a9c5(0x124)]('~/')||_0xe26b3e==='~')return a0_0x3df761[_0x24a9c5(0x18e)](a0_0x42d180[_0x24a9c5(0x1eb)](),_0xe26b3e[_0x24a9c5(0x192)](0x1));return _0xe26b3e;}let allowedDirectories=await Promise[a0_0x5e6917(0x164)](args[a0_0x5e6917(0x1ad)](async _0x28d8c3=>{const _0x2d3f4a=a0_0x5e6917,_0x37e031=expandHome(_0x28d8c3),_0x1138bb=a0_0x3df761[_0x2d3f4a(0x117)](_0x37e031);try{const _0x30cc9c=await a0_0x55e678['realpath'](_0x1138bb);return normalizePath(_0x30cc9c);}catch(_0x7c602b){return normalizePath(_0x1138bb);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x5e6917(0x1be)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x5e6917(0x143)](workspaceDir),logMcpStderr(a0_0x5e6917(0x10f)+workspaceDir+a0_0x5e6917(0x112)));}catch(a0_0x30ed4b){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x30ed4b);}async function detectWorkspaceRoot(_0x2ec8dd){const _0x4bbf1f=a0_0x5e6917;let _0x3e3b83=a0_0x3df761[_0x4bbf1f(0x117)](_0x2ec8dd);const _0x2c3887=[_0x4bbf1f(0xc7),'.vscode',_0x4bbf1f(0x126),_0x4bbf1f(0x115),_0x4bbf1f(0x116),_0x4bbf1f(0x182),'.cursor','tsconfig.json',_0x4bbf1f(0x1b9)];while(_0x3e3b83!==a0_0x3df761['dirname'](_0x3e3b83)){for(const _0x35b935 of _0x2c3887){const _0x1346d2=a0_0x3df761[_0x4bbf1f(0x18e)](_0x3e3b83,_0x35b935);try{return await a0_0x55e678[_0x4bbf1f(0xee)](_0x1346d2),normalizePath(_0x3e3b83);}catch{}}_0x3e3b83=a0_0x3df761[_0x4bbf1f(0x1c8)](_0x3e3b83);}return normalizePath(_0x2ec8dd);}await Promise[a0_0x5e6917(0x164)](args['map'](async _0x5c0c80=>{const _0x57b7f0=a0_0x5e6917;try{const _0x1ea38f=await a0_0x55e678[_0x57b7f0(0x1c5)](expandHome(_0x5c0c80));!_0x1ea38f['isDirectory']()&&(logMcpStderr('Error:\x20'+_0x5c0c80+_0x57b7f0(0xef)),process[_0x57b7f0(0x15a)](0x1));}catch(_0x2d8a42){logMcpStderr(_0x57b7f0(0x1e8)+_0x5c0c80+':',_0x2d8a42),process['exit'](0x1);}}));async function validatePath(_0x4508b5){const _0x36f56f=a0_0x5e6917,_0x1f9711=expandHome(_0x4508b5),_0x43a54c=a0_0x3df761[_0x36f56f(0x117)](_0x1f9711);logger[_0x36f56f(0x136)]('MCP',_0x36f56f(0x128),{'raw_path':_0x4508b5,'absolute':_0x43a54c});try{const _0x4666c7=await a0_0x55e678[_0x36f56f(0x1b7)](_0x43a54c);return logger[_0x36f56f(0x136)]('MCP',_0x36f56f(0xe3),{'resolved':_0x4666c7,'symlink':_0x4666c7!==_0x43a54c}),_0x4666c7;}catch(_0x208b61){if(_0x208b61[_0x36f56f(0xe7)]===_0x36f56f(0xe9)){const _0x53921b=a0_0x3df761[_0x36f56f(0x1c8)](_0x43a54c);try{const _0x5cbe85=await a0_0x55e678['realpath'](_0x53921b),_0x34cd17=a0_0x3df761[_0x36f56f(0x18e)](_0x5cbe85,a0_0x3df761[_0x36f56f(0x1ed)](_0x43a54c));return logger['debug'](_0x36f56f(0x185),'path_validation_resolved',{'resolved':_0x34cd17,'new_file':!![]}),_0x34cd17;}catch{logger['error']('MCP',_0x36f56f(0x1e5),{'raw_path':_0x4508b5,'error':_0x36f56f(0x17d)+_0x53921b});throw new Error(_0x36f56f(0x17d)+_0x53921b);}}logger[_0x36f56f(0xcf)](_0x36f56f(0x185),_0x36f56f(0x1e5),{'raw_path':_0x4508b5,'error':_0x208b61['message']});throw _0x208b61;}}const MorphEditFileArgsSchema=z[a0_0x5e6917(0x1a3)]({'path':z[a0_0x5e6917(0xe1)](),'code_edit':z[a0_0x5e6917(0xe1)]()[a0_0x5e6917(0x14a)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x5e6917(0xe1)]()[a0_0x5e6917(0x14a)](a0_0x5e6917(0x1e2)),'dryRun':z[a0_0x5e6917(0xd2)]()[a0_0x5e6917(0x1f2)](![])[a0_0x5e6917(0x14a)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5e6917(0x1d3),WarpGrepArgsSchema=z[a0_0x5e6917(0x1a3)]({'search_string':z[a0_0x5e6917(0xe1)]()[a0_0x5e6917(0x14a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x5e6917(0xe1)]()['describe'](a0_0x5e6917(0x190)),'search_type':z[a0_0x5e6917(0x19b)](['default','node_modules'])[a0_0x5e6917(0x146)]()[a0_0x5e6917(0x14a)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z[a0_0x5e6917(0x1a3)]({'search_string':z[a0_0x5e6917(0xe1)]()[a0_0x5e6917(0x14a)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x5e6917(0xe1)]()[a0_0x5e6917(0x146)]()[a0_0x5e6917(0x14a)](a0_0x5e6917(0x175)),'owner_repo':z[a0_0x5e6917(0xe1)]()[a0_0x5e6917(0x146)]()[a0_0x5e6917(0x14a)](a0_0x5e6917(0xc6)),'branch':z['string']()['optional']()[a0_0x5e6917(0x14a)](a0_0x5e6917(0x180))}),server=new Server({'name':a0_0x5e6917(0xdb),'version':'0.2.0'},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x19f578=a0_0x5e6917,_0xd6a895=[{'name':TOOL_NAMES[_0x19f578(0x1c0)],'description':_0x19f578(0x1d2)+_0x19f578(0xff)+'Parameters:\x0a'+_0x19f578(0x17b)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+_0x19f578(0x14b)+_0x19f578(0x1ab)+_0x19f578(0x17f)+_0x19f578(0x1b4)+_0x19f578(0x18a)+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+'-\x20Preserve\x20exact\x20indentation\x0a'+_0x19f578(0x197)+_0x19f578(0xd6),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':![]},'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x19f578(0x145)],'description':_0x19f578(0x135)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x19f578(0x186)+_0x19f578(0xe2)+'','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':!![]}],_0x7e196c=_0xd6a895[_0x19f578(0x177)](_0x488109=>{const _0x7cc2d8=_0x19f578;if(DISABLED_TOOLS[_0x7cc2d8(0x13a)](_0x488109['name']))return console['error'](_0x7cc2d8(0x102)+_0x488109[_0x7cc2d8(0x140)]+_0x7cc2d8(0x13c)),![];if(_0x7cc2d8(0xcc)in _0x488109&&_0x488109['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x7cc2d8(0x1bf)+_0x488109['name']+_0x7cc2d8(0x1ee)),![];return!![];});return{'tools':_0x7e196c[_0x19f578(0x1ad)](_0x242ad1=>({'name':_0x242ad1[_0x19f578(0x140)],...'title'in _0x242ad1&&_0x242ad1[_0x19f578(0x1bd)]?{'title':_0x242ad1[_0x19f578(0x1bd)]}:{},'description':_0x242ad1[_0x19f578(0x161)],'inputSchema':_0x242ad1['inputSchema'],..._0x19f578(0x1d5)in _0x242ad1&&_0x242ad1[_0x19f578(0x1d5)]?{'annotations':_0x242ad1['annotations']}:{}}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x6c6690=>{const _0x450bfd=a0_0x5e6917,{name:_0x10d8c0,arguments:_0x4c1243}=_0x6c6690[_0x450bfd(0x1f3)],_0xfeb46f=Date[_0x450bfd(0x1b6)]();logger[_0x450bfd(0x136)]('MCP',_0x450bfd(0x1c9),{'tool':_0x10d8c0,'args':_0x10d8c0===_0x450bfd(0x12c)?{'path':_0x4c1243?.[_0x450bfd(0x12f)],'instruction':_0x4c1243?.['instruction']||_0x4c1243?.[_0x450bfd(0x171)],'dryRun':_0x4c1243?.[_0x450bfd(0x16d)]}:_0x4c1243});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x450bfd(0xf8),'text':_0x450bfd(0x1e1)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x450bfd(0x1ac))&&!MORPH_API_KEY[_0x450bfd(0x124)](_0x450bfd(0x193)))return{'content':[{'type':'text','text':_0x450bfd(0x118)}],'isError':!![]};if(DISABLED_TOOLS[_0x450bfd(0x13a)](_0x10d8c0))return{'content':[{'type':'text','text':_0x450bfd(0x158)+_0x10d8c0+_0x450bfd(0x1b3)}],'isError':![]};switch(_0x10d8c0){case TOOL_NAMES['EDIT_FILE']:{let _0x1a5bd3=_0x4c1243;if(_0x1a5bd3&&typeof _0x1a5bd3===_0x450bfd(0x1a3)){if(!(_0x450bfd(0x12f)in _0x1a5bd3)){const _0x1bfbba=_0x1a5bd3[_0x450bfd(0x18c)]??_0x1a5bd3[_0x450bfd(0xe5)]??_0x1a5bd3[_0x450bfd(0x125)]??_0x1a5bd3[_0x450bfd(0x19a)]??_0x1a5bd3[_0x450bfd(0x153)];if(_0x1bfbba)_0x1a5bd3={..._0x1a5bd3,'path':_0x1bfbba};}'instructions'in _0x1a5bd3&&!(_0x450bfd(0x179)in _0x1a5bd3)&&(_0x1a5bd3={..._0x1a5bd3,'instruction':_0x1a5bd3[_0x450bfd(0x171)]});if(!(_0x450bfd(0x12b)in _0x1a5bd3)){const _0x602f50=_0x1a5bd3['code']??_0x1a5bd3[_0x450bfd(0xf2)]??_0x1a5bd3[_0x450bfd(0xe8)]??_0x1a5bd3[_0x450bfd(0x1ba)];if(_0x602f50)_0x1a5bd3={..._0x1a5bd3,'code_edit':_0x602f50};}}const _0x1087ca=MorphEditFileArgsSchema['safeParse'](_0x1a5bd3);if(!_0x1087ca['success'])throw new Error(_0x450bfd(0x16c)+_0x1087ca[_0x450bfd(0xcf)]);const _0x427515=await validatePath(_0x1087ca[_0x450bfd(0x1a7)]['path']);let _0x4f3f23=null,_0x394a72=!![],_0xd1a4a7=null;try{_0x4f3f23=await a0_0x55e678['readFile'](_0x427515,_0x450bfd(0x101)),logger['debug'](_0x450bfd(0x185),_0x450bfd(0x195),{'path':_0x427515,'size_bytes':_0x4f3f23[_0x450bfd(0x1be)]});}catch(_0x576c1d){const _0x568d7e=_0x576c1d[_0x450bfd(0xe7)];_0x568d7e===_0x450bfd(0xe9)?(_0x394a72=![],_0x4f3f23='',logger[_0x450bfd(0x136)](_0x450bfd(0x185),_0x450bfd(0x195),{'path':_0x427515,'exists':![]})):(_0xd1a4a7=_0x450bfd(0x1cd)+(_0x568d7e||'unknown')+'\x20-\x20'+(_0x576c1d instanceof Error?_0x576c1d[_0x450bfd(0x159)]:String(_0x576c1d)),logger['error']('MCP',_0x450bfd(0x1e0),{'path':_0x427515,'error':_0xd1a4a7}),logMcpStderr('Warning:\x20'+_0xd1a4a7));}let _0x4ae900;try{const _0x2ac62f=MORPH_API_KEY;if(!_0x2ac62f)throw new Error(_0x450bfd(0x10b));const _0x5dd789=a0_0x3df761[_0x450bfd(0x1c8)](_0x427515),_0x1cc9fc=a0_0x3df761[_0x450bfd(0x1ed)](_0x427515);logger[_0x450bfd(0x136)](_0x450bfd(0x185),'api_request_start',{'model':_0x450bfd(0x1b8),'path':_0x1087ca[_0x450bfd(0x1a7)]['path'],'instruction_len':_0x1087ca[_0x450bfd(0x1a7)]['instruction'][_0x450bfd(0x1be)],'code_edit_len':_0x1087ca[_0x450bfd(0x1a7)]['code_edit'][_0x450bfd(0x1be)],'original_code_len':_0x4f3f23?.['length']??0x0,'dry_run':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x16d)]});const _0x3dffb2=Date['now'](),_0x38b6a8=await executeEditFile({'target_filepath':_0x1cc9fc,'code_edit':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x12b)],'instruction':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x179)]},{'morphApiKey':_0x2ac62f,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x5dd789,'autoWrite':!_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x16d)],'generateUdiff':![],'debug':![]}),_0x4473a9=Date[_0x450bfd(0x1b6)]()-_0x3dffb2;_0x4ae900=_0x38b6a8[_0x450bfd(0x1a2)];if(!_0x38b6a8[_0x450bfd(0x14f)])throw new Error(_0x38b6a8[_0x450bfd(0xcf)]||_0x450bfd(0x154));const _0x24f7f4=_0x38b6a8[_0x450bfd(0x107)],_0x9ecbdf=_0x450bfd(0x1a6)+_0x24f7f4['linesAdded']+',\x20removed\x20'+_0x24f7f4[_0x450bfd(0x106)]+_0x450bfd(0x16e)+_0x24f7f4[_0x450bfd(0x137)];logger['debug']('MCP',_0x450bfd(0x1ec),{'tool':_0x450bfd(0x12c),'success':!![],'latency_ms':Date[_0x450bfd(0x1b6)]()-_0xfeb46f,'edit_latency_ms':_0x4473a9,'changes':{'added':_0x24f7f4[_0x450bfd(0x138)],'removed':_0x24f7f4[_0x450bfd(0x106)],'modified':_0x24f7f4[_0x450bfd(0x137)]},'completion_id':_0x4ae900});if(_0x1087ca['data'][_0x450bfd(0x16d)])return{'content':[{'type':_0x450bfd(0xf8),'text':_0x450bfd(0xf9)+(_0x394a72?'':_0x450bfd(0x1df))+':\x20'+_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x179)]+'.\x20Changes:\x20'+_0x9ecbdf+_0x450bfd(0xe4)+_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x12f)]+'.'}]};return{'content':[{'type':_0x450bfd(0xf8),'text':_0x450bfd(0x166)+(_0x394a72?'Applied':_0x450bfd(0x188))+':\x20'+_0x1087ca['data'][_0x450bfd(0x179)]+_0x450bfd(0x17c)+_0x9ecbdf+'.\x20Path:\x20'+_0x1087ca['data'][_0x450bfd(0x12f)]+'.'}]};}catch(_0x24e264){const _0x34fbc5=handleMorphAPIError(_0x24e264);if(_0x34fbc5)return logger[_0x450bfd(0xcf)](_0x450bfd(0x185),_0x450bfd(0x165),{'tool':_0x450bfd(0x12c),'error':_0x450bfd(0xc9),'latency_ms':Date[_0x450bfd(0x1b6)]()-_0xfeb46f}),_0x34fbc5;const _0x4a80f0=_0x24e264 instanceof Error?_0x24e264['message']:String(_0x24e264);return logger[_0x450bfd(0xcf)](_0x450bfd(0x185),_0x450bfd(0x165),{'tool':_0x450bfd(0x12c),'error':_0x4a80f0,'path':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x12f)],'validated_path':_0x427515,'latency_ms':Date[_0x450bfd(0x1b6)]()-_0xfeb46f,'stack':_0x24e264 instanceof Error?_0x24e264[_0x450bfd(0x199)]:undefined}),reportMorphError({'error_message':_0x4a80f0,'error_type':_0x24e264 instanceof Error?_0x24e264['constructor'][_0x450bfd(0x140)]:_0x450bfd(0xd9),'context':{'tool':_0x450bfd(0x12c),'completion_id':_0x4ae900,'file_path':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x12f)],'validated_path':_0x427515,'instruction':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x179)],'model':MORPH_LARGE_APPLY?_0x450bfd(0x150):_0x450bfd(0x1b8),'dry_run':_0x1087ca[_0x450bfd(0x1a7)]['dryRun'],'file_exists':_0x394a72,'file_read_error':_0xd1a4a7,'file_readable':_0x4f3f23!==null,'request_content':{'path':_0x1087ca['data'][_0x450bfd(0x12f)],'code_edit':_0x1087ca['data'][_0x450bfd(0x12b)],'instruction':_0x1087ca[_0x450bfd(0x1a7)]['instruction'],'original_code':_0x4f3f23!==null?_0x4f3f23[_0x450bfd(0x1be)]>0xc350?_0x4f3f23[_0x450bfd(0x13f)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x4f3f23[_0x450bfd(0x1be)]+_0x450bfd(0x187):_0x4f3f23:_0x450bfd(0xdf)+(_0xd1a4a7||_0x450bfd(0x1ef))+']','original_code_length':_0x4f3f23?.[_0x450bfd(0x1be)]??0x0,'model':MORPH_LARGE_APPLY?_0x450bfd(0x150):_0x450bfd(0x1b8),'dry_run':_0x1087ca[_0x450bfd(0x1a7)][_0x450bfd(0x16d)]}},'stack_trace':_0x24e264 instanceof Error?_0x24e264[_0x450bfd(0x199)]:undefined,'source':_0x450bfd(0x11d)})[_0x450bfd(0x1c6)](()=>{}),{'content':[{'type':'text','text':_0x450bfd(0x114)+_0x4a80f0}],'isError':!![]};}}case TOOL_NAMES[_0x450bfd(0x145)]:{const _0x332015=WarpGrepArgsSchema[_0x450bfd(0x156)](_0x4c1243);if(!_0x332015[_0x450bfd(0x14f)])return{'content':[{'type':'text','text':_0x450bfd(0x1bb)+_0x332015[_0x450bfd(0xcf)]}],'isError':!![]};const _0x5e74ea=_0x28fb39=>{const _0x13f6a2=_0x450bfd,_0x5e1353=[];for(const _0x13cc28 of _0x28fb39||[]){if(_0x13cc28['role']===_0x13f6a2(0x148)&&Array[_0x13f6a2(0x1a5)](_0x13cc28['tool_calls']))for(const _0x429698 of _0x13cc28['tool_calls']){try{const _0x29d6f3=_0x429698[_0x13f6a2(0x194)]?.[_0x13f6a2(0x140)],_0x241898=JSON[_0x13f6a2(0xf3)](_0x429698[_0x13f6a2(0x194)]?.[_0x13f6a2(0x160)]||'{}');if(_0x29d6f3===_0x13f6a2(0x11c))_0x5e1353[_0x13f6a2(0x143)](_0x13f6a2(0x123)+_0x241898[_0x13f6a2(0x1cc)]+'\x27\x20'+(_0x241898[_0x13f6a2(0x12f)]||'.'));else{if(_0x29d6f3===_0x13f6a2(0x122))_0x5e1353['push'](_0x13f6a2(0x141)+_0x241898[_0x13f6a2(0x12f)]);else{if(_0x29d6f3===_0x13f6a2(0x113))_0x5e1353['push'](_0x13f6a2(0x155)+(_0x241898[_0x13f6a2(0x15b)]||'.'));else{if(_0x29d6f3===_0x13f6a2(0xf5))_0x5e1353['push'](_0x13f6a2(0x1d6)+_0x241898[_0x13f6a2(0x1cc)]+'\x27\x20'+(_0x241898[_0x13f6a2(0x12f)]||'.'));else _0x29d6f3===_0x13f6a2(0x14e)&&_0x5e1353['push']('finish');}}}}catch{}}}return _0x5e1353;},_0x1a2541=_0x33be12=>{const _0x1b1bd5=_0x450bfd,_0x5a3895=[];if(!_0x33be12||!Array[_0x1b1bd5(0x1a5)](_0x33be12))return _0x5a3895;const _0x361828=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1b1bd5(0x110),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1b1bd5(0x1ea),'tool':_0x1b1bd5(0x122)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x1b1bd5(0x122)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1b1bd5(0xfc),'tool':_0x1b1bd5(0x1e9)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x1b1bd5(0x1e9)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1b1bd5(0x16a),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x1b1bd5(0x1dc),'tool':_0x1b1bd5(0x122)},{'pattern':/not a text file/,'error_type':_0x1b1bd5(0x16a),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x1b1bd5(0x1dc),'tool':'read'},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x1b1bd5(0x122)},{'pattern':/status="error"/,'error_type':_0x1b1bd5(0x168),'tool':_0x1b1bd5(0x176)}];let _0x5c2e19=0x0;for(const _0x571d0b of _0x33be12){_0x571d0b[_0x1b1bd5(0xc8)]==='assistant'&&Array[_0x1b1bd5(0x1a5)](_0x571d0b['tool_calls'])&&_0x5c2e19++;const _0x499bf5=_0x571d0b[_0x1b1bd5(0xe8)];if((_0x571d0b['role']===_0x1b1bd5(0xeb)||_0x571d0b[_0x1b1bd5(0xc8)]===_0x1b1bd5(0x144))&&_0x499bf5&&typeof _0x499bf5===_0x1b1bd5(0xe1))for(const {pattern:_0xe412c9,error_type:_0x126c0f,tool:_0x5e327c}of _0x361828){const _0xe31515=_0x499bf5[_0x1b1bd5(0x183)](new RegExp(_0xe412c9[_0x1b1bd5(0xcd)],'g'));if(_0xe31515)for(const _0x4db241 of _0xe31515){const _0x12eea6=_0x499bf5[_0x1b1bd5(0xfa)](_0x4db241),_0x55412c=_0x499bf5['substring'](_0x12eea6,Math[_0x1b1bd5(0x170)](_0x12eea6+0xc8,_0x499bf5[_0x1b1bd5(0x1be)]));_0x5a3895[_0x1b1bd5(0x143)]({'tool':_0x5e327c,'error_type':_0x126c0f,'error_message':_0x55412c[_0x1b1bd5(0x10a)]('\x0a')[0x0],'turn':_0x5c2e19});}}}return _0x5a3895;};try{const _0x357b9a=a0_0x3df761['resolve'](_0x332015[_0x450bfd(0x1a7)]['repo_path']),_0x2b1b42=_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x103)],_0x2de7f5=_0x2b1b42===_0x450bfd(0x18b)?{'allowNames':[_0x450bfd(0x18b)]}:undefined,_0x15206c=new LocalRipgrepProvider(_0x357b9a,undefined,_0x2de7f5);logger[_0x450bfd(0x136)](_0x450bfd(0x185),_0x450bfd(0xda),{'type':'LocalRipgrepProvider','repo_root':_0x357b9a,'search_type':_0x2b1b42||'default'}),logger['debug'](_0x450bfd(0x185),'warp_grep_start',{'query':_0x332015[_0x450bfd(0x1a7)]['search_string'],'repo_root':_0x357b9a,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x400501=Date['now'](),_0x2fc2ae=await runWarpGrep({'searchTerm':_0x332015['data'][_0x450bfd(0x1c7)],'repoRoot':_0x357b9a,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x15206c,'search_type':_0x2b1b42}),_0x276a9d=Date[_0x450bfd(0x1b6)]()-_0x400501,_0x5710ce=_0x2fc2ae[_0x450bfd(0x14e)]?.[_0x450bfd(0xfe)]?.['files']?.[_0x450bfd(0x1be)]??0x0;logger['debug'](_0x450bfd(0x185),_0x450bfd(0x1e6),{'termination':_0x2fc2ae[_0x450bfd(0x1e3)],'turns':_0x2fc2ae['timings']?.[_0x450bfd(0x13b)]??0x0,'files_found':_0x5710ce,'latency_ms':_0x276a9d});const _0x4674ee=_0x1a2541(_0x2fc2ae[_0x450bfd(0xfb)]);_0x4674ee[_0x450bfd(0x1be)]>0x0&&reportMorphError({'error_message':_0x450bfd(0x173)+_0x4674ee['length']+_0x450bfd(0x181),'error_type':_0x450bfd(0x1d7),'level':_0x450bfd(0x1de),'tool':_0x450bfd(0xd5),'context':{'repo_path':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],'query':_0x332015[_0x450bfd(0x1a7)]['search_string'],'model':_0x450bfd(0x10e),'termination_reason':_0x2fc2ae[_0x450bfd(0x1e3)],'sub_tool_errors':_0x4674ee,'timings':_0x2fc2ae['timings'],'tool_calls':_0x5e74ea(_0x2fc2ae[_0x450bfd(0xfb)]),'messages':_0x2fc2ae['messages']?.[_0x450bfd(0x1ad)](_0x59ea73=>({'role':_0x59ea73[_0x450bfd(0xc8)],'content':_0x59ea73[_0x450bfd(0xe8)],..._0x59ea73[_0x450bfd(0x11e)]?{'tool_calls':_0x59ea73['tool_calls'][_0x450bfd(0x1be)]}:{},..._0x59ea73[_0x450bfd(0xde)]?{'tool_call_id':_0x59ea73[_0x450bfd(0xde)]}:{}}))},'source':'mcp-filesystem'})['catch'](()=>{});let _0x2c396b='';if(_0x2fc2ae['terminationReason']===_0x450bfd(0x15d)&&_0x2fc2ae[_0x450bfd(0x14e)]?.[_0x450bfd(0xfe)]?.['files']){const _0x581f2f=_0x2fc2ae[_0x450bfd(0x14e)]['metadata'][_0x450bfd(0x149)];if(_0x581f2f[_0x450bfd(0x1be)]===0x0)return _0x2c396b=_0x2fc2ae['finish'][_0x450bfd(0x15e)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':'text','text':_0x2c396b}]};const _0x191f48=[],_0x2b7554=[_0x450bfd(0x1ca)];for(const _0x50e9de of _0x2fc2ae[_0x450bfd(0xfb)]){if(_0x50e9de[_0x450bfd(0xc8)]===_0x450bfd(0x148)&&Array['isArray'](_0x50e9de[_0x450bfd(0x11e)]))for(const _0x2d8efe of _0x50e9de[_0x450bfd(0x11e)]){try{const _0x32a430=_0x2d8efe['function']?.[_0x450bfd(0x140)],_0x6fc04b=JSON[_0x450bfd(0xf3)](_0x2d8efe[_0x450bfd(0x194)]?.[_0x450bfd(0x160)]||'{}');if(_0x32a430==='grep_search')_0x2b7554['push'](_0x450bfd(0x10c)+_0x6fc04b[_0x450bfd(0x1cc)]+'\x27\x20in\x20`'+(_0x6fc04b[_0x450bfd(0x12f)]||'.')+'`');else{if(_0x32a430===_0x450bfd(0x122))_0x2b7554[_0x450bfd(0x143)](_0x450bfd(0x104)+_0x6fc04b['path']+'`');else{if(_0x32a430===_0x450bfd(0x113))_0x2b7554[_0x450bfd(0x143)]('-\x20Listed\x20directory\x20`'+(_0x6fc04b[_0x450bfd(0x15b)]||'.')+'`');else _0x32a430===_0x450bfd(0xf5)&&_0x2b7554['push'](_0x450bfd(0x1e7)+_0x6fc04b[_0x450bfd(0x1cc)]+'`\x20in\x20`'+(_0x6fc04b['path']||'.')+'`');}}}catch{}}}_0x191f48[_0x450bfd(0x143)](_0x2b7554['join']('\x0a'));const _0x1a0f5d=['',_0x450bfd(0x189)];for(const _0x18f126 of _0x581f2f){if(_0x18f126[_0x450bfd(0xce)]==='*')_0x1a0f5d[_0x450bfd(0x143)]('-\x20'+_0x18f126[_0x450bfd(0x12f)]+':*');else{if(Array['isArray'](_0x18f126[_0x450bfd(0xce)])){const _0x1d0020=_0x18f126[_0x450bfd(0xce)][_0x450bfd(0x1ad)](([_0x2e6e5a,_0x4e7394])=>{if(_0x2e6e5a===_0x4e7394)return''+_0x2e6e5a;return _0x2e6e5a+'-'+_0x4e7394;});_0x1a0f5d[_0x450bfd(0x143)]('-\x20'+_0x18f126[_0x450bfd(0x12f)]+':'+_0x1d0020[_0x450bfd(0x18e)](','));}else _0x1a0f5d[_0x450bfd(0x143)]('-\x20'+_0x18f126[_0x450bfd(0x12f)]+':*');}}_0x1a0f5d[_0x450bfd(0x143)](''),_0x191f48[_0x450bfd(0x143)](_0x1a0f5d['join']('\x0a')),_0x191f48[_0x450bfd(0x143)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x3b4c36=[],_0x18309e=[];for(const _0x57c082 of _0x581f2f){let _0x1a5b93=a0_0x3df761['resolve'](_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],_0x57c082[_0x450bfd(0x12f)]),_0x233aa8=null,_0x5e0fd1=null;try{_0x233aa8=await a0_0x55e678[_0x450bfd(0xca)](_0x1a5b93,{'encoding':_0x450bfd(0x101)});}catch(_0x2651b0){const _0x3ef54c=fixPathRepetition(_0x1a5b93);if(_0x3ef54c)try{_0x233aa8=await a0_0x55e678[_0x450bfd(0xca)](_0x3ef54c,{'encoding':_0x450bfd(0x101)}),_0x1a5b93=_0x3ef54c;}catch{_0x5e0fd1=_0x2651b0 instanceof Error?_0x2651b0:new Error(String(_0x2651b0));}else _0x5e0fd1=_0x2651b0 instanceof Error?_0x2651b0:new Error(String(_0x2651b0));}if(_0x233aa8!==null){const _0x1063cf=_0x233aa8[_0x450bfd(0x10a)](/\r?\n/),_0x5045e7=[];if(_0x57c082[_0x450bfd(0xce)]==='*'||!Array['isArray'](_0x57c082[_0x450bfd(0xce)]))for(let _0x1ea553=0x1;_0x1ea553<=_0x1063cf[_0x450bfd(0x1be)];_0x1ea553++){const _0x3186c1=_0x1063cf[_0x1ea553-0x1];_0x5045e7[_0x450bfd(0x143)](_0x1ea553+'|\x20'+_0x3186c1);}else for(const [_0x252545,_0x5e02e0]of _0x57c082[_0x450bfd(0xce)]){_0x5045e7[_0x450bfd(0x1be)]>0x0&&_0x5045e7[_0x450bfd(0x143)]('');for(let _0x41611d=_0x252545;_0x41611d<=_0x5e02e0&&_0x41611d<=_0x1063cf[_0x450bfd(0x1be)];_0x41611d++){const _0xfe2ad7=_0x1063cf[_0x41611d-0x1];_0x5045e7[_0x450bfd(0x143)](_0x41611d+'|\x20'+_0xfe2ad7);}}_0x18309e[_0x450bfd(0x143)]({'path':_0x57c082[_0x450bfd(0x12f)],'content':_0x5045e7[_0x450bfd(0x18e)]('\x0a')});}else _0x3b4c36[_0x450bfd(0x143)](_0x450bfd(0x19d)+_0x57c082[_0x450bfd(0x12f)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x5e0fd1?.[_0x450bfd(0x159)]||_0x450bfd(0x1da))+_0x450bfd(0xdc));}try{const _0x52be42=await compactFileContexts(_0x18309e,_0x332015['data']['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x2b332d of _0x52be42){_0x3b4c36[_0x450bfd(0x143)](_0x450bfd(0x19d)+_0x2b332d[_0x450bfd(0x12f)]+'\x22>\x0a'+_0x2b332d['content']+_0x450bfd(0xdc));}}catch(_0x5032f8){logger[_0x450bfd(0x1de)](_0x450bfd(0x185),_0x450bfd(0xe6),{'error':_0x5032f8 instanceof Error?_0x5032f8['message']:String(_0x5032f8),'files_count':_0x18309e[_0x450bfd(0x1be)]});for(const _0x2664e8 of _0x18309e){_0x3b4c36[_0x450bfd(0x143)](_0x450bfd(0x19d)+_0x2664e8[_0x450bfd(0x12f)]+_0x450bfd(0x1c2)+_0x2664e8[_0x450bfd(0xe8)]+_0x450bfd(0xdc));}}_0x191f48[_0x450bfd(0x143)](_0x3b4c36[_0x450bfd(0x18e)]('\x0a\x0a')),_0x2c396b=_0x191f48[_0x450bfd(0x18e)]('\x0a');const _0x11d67b=_0x2fc2ae[_0x450bfd(0x1a9)]?.['filter'](_0x3e4978=>_0x3e4978[_0x450bfd(0x159)]?.[_0x450bfd(0x124)](_0x450bfd(0x1b5)))||[];if(_0x11d67b['length']>0x0){const _0x175392=_0x11d67b['map'](_0x37fb53=>_0x37fb53[_0x450bfd(0x159)])[_0x450bfd(0x18e)](';\x20');reportMorphError({'error_message':_0x175392,'error_type':_0x450bfd(0x13e),'context':{'tool':_0x450bfd(0xd5),'repo_path':_0x332015[_0x450bfd(0x1a7)]['repo_path'],'query':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x1c7)],'model':_0x450bfd(0x10e),'termination_reason':_0x450bfd(0x1dd),'error_count':_0x11d67b[_0x450bfd(0x1be)],'is_timeout':![],'timings':_0x2fc2ae[_0x450bfd(0x184)],'files_attempted':_0x581f2f['map'](_0x3bbd29=>({'path':_0x3bbd29[_0x450bfd(0x12f)],'lines':_0x3bbd29['lines']})),'tool_calls':_0x5e74ea(_0x2fc2ae['messages']),'messages':_0x2fc2ae[_0x450bfd(0xfb)]?.[_0x450bfd(0x1ad)](_0x468762=>({'role':_0x468762[_0x450bfd(0xc8)],'content':_0x468762[_0x450bfd(0xe8)],..._0x468762[_0x450bfd(0x11e)]?{'tool_calls':_0x468762[_0x450bfd(0x11e)][_0x450bfd(0x1be)]}:{},..._0x468762[_0x450bfd(0xde)]?{'tool_call_id':_0x468762[_0x450bfd(0xde)]}:{}})),'request_content':{'query':_0x332015[_0x450bfd(0x1a7)]['search_string'],'repo_path':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],'repoRoot':a0_0x3df761[_0x450bfd(0x117)](_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)]),'model':_0x450bfd(0x10e)}},'source':_0x450bfd(0x11d)})[_0x450bfd(0x1c6)](()=>{});}}else{if(_0x2fc2ae[_0x450bfd(0x1e3)]===_0x450bfd(0x109)&&_0x2fc2ae['errors'][_0x450bfd(0x1be)]>0x0){const _0x182865=_0x2fc2ae[_0x450bfd(0x1a9)][_0x450bfd(0x1ad)](_0x38aa6a=>_0x38aa6a['message'])[_0x450bfd(0x18e)](';\x20');_0x2c396b=_0x450bfd(0x11a)+_0x182865;const _0xf2159f=_0x182865[_0x450bfd(0x15c)]()[_0x450bfd(0x134)](_0x450bfd(0x108))||_0x182865[_0x450bfd(0x15c)]()['includes']('timed\x20out')||_0x182865[_0x450bfd(0x15c)]()[_0x450bfd(0x134)](_0x450bfd(0x172)),_0x3312a2=_0x2fc2ae[_0x450bfd(0x14e)]?.[_0x450bfd(0xfe)]?.[_0x450bfd(0x149)],_0x4fcd3b=_0x2fc2ae[_0x450bfd(0x1a9)][0x0];reportMorphError({'error_message':_0x182865,'error_type':_0xf2159f?'TimeoutError':_0x4fcd3b?.[_0x450bfd(0x151)]?.[_0x450bfd(0x140)]||'WarpGrepError','context':{'tool':_0x450bfd(0xd5),'repo_path':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],'query':_0x332015['data'][_0x450bfd(0x1c7)],'model':_0x450bfd(0x10e),'termination_reason':_0x2fc2ae[_0x450bfd(0x1e3)],'error_count':_0x2fc2ae[_0x450bfd(0x1a9)][_0x450bfd(0x1be)],'is_timeout':_0xf2159f,'timings':_0x2fc2ae[_0x450bfd(0x184)],'files_attempted':_0x3312a2?.['map'](_0x3e9cde=>({'path':_0x3e9cde[_0x450bfd(0x12f)],'lines':_0x3e9cde['lines']})),'tool_calls':_0x5e74ea(_0x2fc2ae[_0x450bfd(0xfb)]),'messages':_0x2fc2ae['messages']?.['map'](_0x963656=>({'role':_0x963656[_0x450bfd(0xc8)],'content':_0x963656['content'],..._0x963656[_0x450bfd(0x11e)]?{'tool_calls':_0x963656[_0x450bfd(0x11e)][_0x450bfd(0x1be)]}:{},..._0x963656[_0x450bfd(0xde)]?{'tool_call_id':_0x963656[_0x450bfd(0xde)]}:{}})),'request_content':{'query':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x1c7)],'repo_path':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],'repoRoot':a0_0x3df761[_0x450bfd(0x117)](_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)]),'model':_0x450bfd(0x10e)}},'stack_trace':_0x4fcd3b?.['stack']||undefined,'source':'mcp-filesystem'})[_0x450bfd(0x1c6)](()=>{});}else _0x2c396b=_0x450bfd(0xd7);}return{'content':[{'type':_0x450bfd(0xf8),'text':_0x2c396b}]};}catch(_0x3156b4){const _0x2f0edb=handleMorphAPIError(_0x3156b4);if(_0x2f0edb)return logger[_0x450bfd(0xcf)](_0x450bfd(0x185),_0x450bfd(0x165),{'tool':_0x450bfd(0xd5),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date['now']()-_0xfeb46f}),_0x2f0edb;const _0x3f6f80=_0x3156b4 instanceof Error?_0x3156b4[_0x450bfd(0x159)]:String(_0x3156b4);logger[_0x450bfd(0xcf)](_0x450bfd(0x185),_0x450bfd(0x165),{'tool':'codebase_search','error':_0x3f6f80,'repo_path':_0x332015['data'][_0x450bfd(0x100)],'query':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x1c7)],'latency_ms':Date['now']()-_0xfeb46f});const _0x16570e=_0x3f6f80[_0x450bfd(0x15c)]()[_0x450bfd(0x134)](_0x450bfd(0x108))||_0x3f6f80[_0x450bfd(0x15c)]()['includes'](_0x450bfd(0x1b2))||_0x3f6f80[_0x450bfd(0x15c)]()[_0x450bfd(0x134)]('etimedout')||_0x3156b4 instanceof Error&&_0x3156b4[_0x450bfd(0x140)]==='TimeoutError';return reportMorphError({'error_message':_0x3f6f80,'error_type':_0x16570e?_0x450bfd(0x121):_0x3156b4 instanceof Error?_0x3156b4['constructor'][_0x450bfd(0x140)]:'UnknownError','context':{'tool':_0x450bfd(0xd5),'repo_path':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],'query':_0x332015['data'][_0x450bfd(0x1c7)],'model':_0x450bfd(0x10e),'is_timeout':_0x16570e,'exception_phase':_0x450bfd(0x1d4),'request_content':{'query':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x1c7)],'repo_path':_0x332015[_0x450bfd(0x1a7)][_0x450bfd(0x100)],'repoRoot':a0_0x3df761[_0x450bfd(0x117)](_0x332015['data']['repo_path']),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x3156b4 instanceof Error?_0x3156b4[_0x450bfd(0x199)]:undefined,'source':_0x450bfd(0x11d)})[_0x450bfd(0x1c6)](()=>{}),{'content':[{'type':_0x450bfd(0xf8),'text':_0x450bfd(0x1e4)+_0x3f6f80}],'isError':![]};}}case TOOL_NAMES[_0x450bfd(0x163)]:{const _0x5509f9=WarpGrepGitHubArgsSchema['safeParse'](_0x4c1243);if(!_0x5509f9[_0x450bfd(0x14f)])return{'content':[{'type':_0x450bfd(0xf8),'text':_0x450bfd(0x1bb)+_0x5509f9[_0x450bfd(0xcf)]}],'isError':!![]};const _0x4db02b=_0x5509f9[_0x450bfd(0x1a7)][_0x450bfd(0x1d0)]||_0x5509f9['data'][_0x450bfd(0x133)];if(!_0x4db02b)return{'content':[{'type':'text','text':_0x450bfd(0x1a1)}],'isError':!![]};const _0x33557c=MORPH_API_KEY;if(!_0x33557c)throw new Error(_0x450bfd(0x10b));const _0x5ae81b=Date[_0x450bfd(0x1b6)]();logger[_0x450bfd(0x136)](_0x450bfd(0x185),_0x450bfd(0x16f),{'identifier':_0x4db02b,'query':_0x5509f9['data'][_0x450bfd(0x1c7)],'branch':_0x5509f9[_0x450bfd(0x1a7)][_0x450bfd(0xec)]});try{const _0x472403=new WarpGrepClient({'morphApiKey':_0x33557c,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x48d347=await _0x472403['searchGitHub']({'searchTerm':_0x5509f9[_0x450bfd(0x1a7)][_0x450bfd(0x1c7)],'github':_0x4db02b,'branch':_0x5509f9['data'][_0x450bfd(0xec)]}),_0x3fde9e=Date[_0x450bfd(0x1b6)]()-_0x5ae81b;logMcpStderr(_0x450bfd(0x1ce)+_0x3fde9e+_0x450bfd(0xf1)+_0x48d347[_0x450bfd(0x14f)]);const _0x1b3d9a=formatResult(_0x48d347);return{'content':[{'type':_0x450bfd(0xf8),'text':_0x1b3d9a}]};}catch(_0x2c78aa){const _0x221015=handleMorphAPIError(_0x2c78aa);if(_0x221015)return _0x221015;const _0x24c850=Date['now']()-_0x5ae81b,_0xf49626=_0x2c78aa instanceof Error?_0x2c78aa[_0x450bfd(0x159)]:String(_0x2c78aa);return logMcpStderr(_0x450bfd(0xc5)+_0x24c850+_0x450bfd(0x1bc),_0xf49626),reportMorphError({'error_message':_0xf49626,'error_type':_0x2c78aa instanceof Error?_0x2c78aa[_0x450bfd(0x151)][_0x450bfd(0x140)]:_0x450bfd(0xd9),'context':{'tool':'github_codebase_search','github_url':_0x4db02b,'search_string':_0x5509f9[_0x450bfd(0x1a7)][_0x450bfd(0x1c7)],'branch':_0x5509f9['data'][_0x450bfd(0xec)]},'stack_trace':_0x2c78aa instanceof Error?_0x2c78aa[_0x450bfd(0x199)]:undefined,'source':_0x450bfd(0x11d),'tool':_0x450bfd(0x167),'latency_ms':_0x24c850})['catch'](()=>{}),{'content':[{'type':_0x450bfd(0xf8),'text':_0x450bfd(0xe0)+_0xf49626}],'isError':![]};}}default:throw new Error(_0x450bfd(0xf7)+_0x10d8c0);}}catch(_0x261228){const _0x10de43=_0x261228 instanceof Error?_0x261228[_0x450bfd(0x159)]:String(_0x261228);return reportMorphError({'error_message':_0x10de43,'error_type':_0x261228 instanceof Error?_0x261228[_0x450bfd(0x151)][_0x450bfd(0x140)]:_0x450bfd(0xd9),'context':{'tool':_0x10d8c0,'arguments':_0x4c1243?JSON[_0x450bfd(0x129)](_0x4c1243)[_0x450bfd(0x13f)](0x0,0x1f4):undefined,'mcp_server_version':_0x450bfd(0x174)},'stack_trace':_0x261228 instanceof Error?_0x261228[_0x450bfd(0x199)]:undefined,'source':_0x450bfd(0x11d)})['catch'](()=>{}),{'content':[{'type':'text','text':_0x450bfd(0x11a)+_0x10de43}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0xe5214e){const _0x39ae37=a0_0x5e6917,_0x497da8=await getValidRootDirectories(_0xe5214e);if(_0x497da8['length']>0x0)allowedDirectories=[..._0x497da8],logMcpStderr(_0x39ae37(0x1a8)+_0x497da8['length']+_0x39ae37(0x17a));else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x52f3fa=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x52f3fa&&(allowedDirectories=[_0x52f3fa],logMcpStderr(_0x39ae37(0x1b0)+_0x52f3fa));}catch(_0x51a7a6){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x51a7a6);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0xd3aa20=a0_0x5e6917;try{const _0x23091b=await server[_0xd3aa20(0xea)]();_0x23091b&&_0xd3aa20(0x14c)in _0x23091b&&await updateAllowedDirectoriesFromRoots(_0x23091b['roots']);}catch(_0x131991){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x131991 instanceof Error?_0x131991['message']:String(_0x131991));}}),server['oninitialized']=async()=>{const _0x3c3d27=a0_0x5e6917,_0x464cfe=server[_0x3c3d27(0x19e)]();if(_0x464cfe?.[_0x3c3d27(0x14c)])try{const _0x23d596=await server[_0x3c3d27(0xea)]();_0x23d596&&'roots'in _0x23d596?await updateAllowedDirectoriesFromRoots(_0x23d596[_0x3c3d27(0x14c)]):logMcpStderr(_0x3c3d27(0xd1));}catch(_0x10a549){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x10a549 instanceof Error?_0x10a549[_0x3c3d27(0x159)]:String(_0x10a549));}else{if(allowedDirectories[_0x3c3d27(0x1be)]>0x0)logMcpStderr(_0x3c3d27(0xcb),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x3c3d27(0x139));}}};function a0_0x5a0d(){const _0x4b0b74=['all','tool_call_error','Morph\x20Edit\x20','github_codebase_search','ToolException','\x0aExamples:','BinaryFile','normalize','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','dryRun',',\x20modified\x20','github_search_start','min','instructions','etimedout','WarpGrep\x20sub-tool\x20errors:\x20','0.2.0','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.','unknown','filter','application/json','instruction','\x20valid\x20directories','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','.\x20Changes:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','WORKSPACE_ROOT','Example\x20format:\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x20error(s)','go.mod','match','timings','MCP','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x20chars)','Created\x20File','Relevant\x20context\x20found:','Rules:\x0a','node_modules','target_file','1178871NSVjBr','join','MORPH_WARP_GREP_TIMEOUT','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','some','slice','morph-','function','file_read_complete','MORPH_LARGE_APPLY','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','every','stack','file_path','enum','1IHNXSH','<file\x20path=\x22','getClientCapabilities','size','toISOString','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','completionId','object','ENABLE_WORKSPACE_MODE','isArray','added\x20','data','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','errors','status','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','sk-','map','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Fallback:\x20Using\x20workspace\x20root\x20','1524430UsNQyo','timed\x20out','\x22\x20is\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','File\x20read\x20error:','now','realpath','morph-v3-fast','composer.json','edit','Invalid\x20arguments:\x20','ms:','title','length','Warning:\x20','EDIT_FILE','Disabled\x20tools:\x20','\x22>\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','stat','catch','search_string','dirname','tool_call_received','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','env','pattern','Failed\x20to\x20read\x20file:\x20','[github_codebase_search]\x20Done\x20in\x20','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','github_url','MORPH_API_URL','**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','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.','runWarpGrep_call','annotations','glob\x20\x27','SubToolError','63gEpyUQ','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Unknown\x20error','api-key','SymlinkError','completed_with_file_errors','warn','\x20(new\x20file)','file_read_failed','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','terminationReason','Error\x20running\x20fast\x20context\x20search:\x20','path_validation_failed','warp_grep_complete','-\x20Glob\x20search\x20`','Error\x20accessing\x20directory\x20','grep','PathError','homedir','tool_call_complete','basename','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','unknown\x20error','\x22.\x20Known\x20tools:\x20','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','default','params','[github_codebase_search]\x20Failed\x20in\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','.git','role','API\x20error\x20(auth/rate-limit)','readFile','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','requiresApiKey','source','lines','error','\x0aOptions:','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','boolean','3502950bLuSVP','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','codebase_search','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','cwd','UnknownError','provider_created','morph-mcp','\x0a</file>','post','tool_call_id','[could\x20not\x20read\x20file:\x20','GitHub\x20search\x20failed:\x20','string','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','path_validation_resolved','.\x20Path:\x20','filePath','compaction_failed','code','content','ENOENT','listRoots','tool','branch','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.','access','\x20is\x20not\x20a\x20directory','connect','ms.\x20Success:\x20','new_string','parse','response','glob','sep','Unknown\x20tool:\x20','text','Morph\x20Edit\x20Preview','indexOf','messages','RipgrepError','MORPH_API_KEY','metadata','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','repo_path','utf-8','Tool\x20','search_type','-\x20Read\x20file\x20`','Fatal\x20error\x20running\x20server:','linesRemoved','changes','timeout','terminated','split','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','-\x20Grepped\x20\x27','PWD','morph-warp-grep-v2.1','Workspace\x20mode\x20enabled:\x20Using\x20','FileNotFound','log','\x20as\x20allowed\x20directory','list_directory','❌\x20Morph\x20Edit\x20Failed:\x20','Cargo.toml','pyproject.toml','resolve','Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.','https://morphllm.com/api/error-report','Error:\x20','@morphllm/morphmcp\x20','grep_search','mcp-filesystem','tool_calls','2985354uzZVvC','152088dpoehL','TimeoutError','read','grep\x20\x27','startsWith','target_filepath','package.json','766970wVWdxf','path_validation_start','stringify','4fVhFpa','code_edit','edit_file','--version','../package.json','path','699506RnZNWD','--api-key','false','owner_repo','includes','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','debug','linesModified','linesAdded','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.','has','turns','\x20disabled\x20via\x20ENABLED_TOOLS/DISABLED_TOOLS','9ENKPMY','FileReadError','substring','name','read\x20','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','push','user','CODEBASE_SEARCH','optional','argv','assistant','files','describe','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','roots','Warning:\x20ENABLED_TOOLS/DISABLED_TOOLS\x20names\x20unknown\x20tool\x20\x22','finish','success','morph-v3-large','constructor','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','file','Morph\x20FastApply\x20failed\x20without\x20error\x20message','list_directory\x20','safeParse','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Tool\x20\x22','message','exit','command','toLowerCase','completed','payload','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','arguments','description','Bearer\x20','GITHUB_CODEBASE_SEARCH'];a0_0x5a0d=function(){return _0x4b0b74;};return a0_0x5a0d();}async function runServer(){const _0x112f1f=a0_0x5e6917,_0x56d175=new StdioServerTransport();await server[_0x112f1f(0xf0)](_0x56d175),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories['length']===0x0&&logMcpStderr(_0x112f1f(0x157));}runServer()[a0_0x5e6917(0x1c6)](_0x511a15=>{const _0x31502b=a0_0x5e6917;logMcpStderr(_0x31502b(0x105),_0x511a15),process[_0x31502b(0x15a)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x2243e4=a1_0x3a54;(function(_0x3e8f99,_0x5323d0){var _0x185823=a1_0x3a54,_0x31c708=_0x3e8f99();while(!![]){try{var _0x2a82c4=parseInt(_0x185823(0x1a2))/0x1*(-parseInt(_0x185823(0x19d))/0x2)+parseInt(_0x185823(0x1ac))/0x3*(-parseInt(_0x185823(0x19b))/0x4)+parseInt(_0x185823(0x1a0))/0x5*(-parseInt(_0x185823(0x1aa))/0x6)+parseInt(_0x185823(0x1a9))/0x7*(-parseInt(_0x185823(0x1a1))/0x8)+parseInt(_0x185823(0x195))/0x9+-parseInt(_0x185823(0x1a4))/0xa+parseInt(_0x185823(0x199))/0xb;if(_0x2a82c4===_0x5323d0)break;else _0x31c708['push'](_0x31c708['shift']());}catch(_0x3aa4ba){_0x31c708['push'](_0x31c708['shift']());}}}(a1_0x7681,0x1ee5c));function a1_0x7681(){var _0x5291a4=['map','Unknown','390315AsBOcK','8IahwKd','2DBsfnK','length','956560HNayuQ','Windows','[os=','info','error','1239245KsfSuf','6cpihai','linux','3wnPxaB','2193822wTdaRZ','platform','macOS','darwin','5316201hMVzqa','win32','310892lDKTMQ','MCP','172016asLkSp'];a1_0x7681=function(){return _0x5291a4;};return a1_0x7681();}import a1_0x5a2504 from'os';function a1_0x3a54(_0x3d617e,_0x64be2a){_0x3d617e=_0x3d617e-0x195;var _0x76818d=a1_0x7681();var _0x3a54e4=_0x76818d[_0x3d617e];return _0x3a54e4;}import{logger}from'./logger.js';export function getOperatingSystemType(_0x3e7b32=a1_0x5a2504['platform']()){var _0x213d48=a1_0x3a54;switch(_0x3e7b32){case _0x213d48(0x198):return _0x213d48(0x197);case _0x213d48(0x19a):return _0x213d48(0x1a5);case _0x213d48(0x1ab):return'Linux';default:return _0x213d48(0x19f);}}export function formatMcpLogMessage(_0x2a9730,_0x3f30b7=a1_0x5a2504[a1_0x2243e4(0x196)]()){var _0x2cda3c=a1_0x2243e4;return _0x2cda3c(0x1a6)+getOperatingSystemType(_0x3f30b7)+']\x20'+_0x2a9730;}export function logMcpStderr(_0xc606bf,..._0x38410c){var _0x5ecf31=a1_0x2243e4;console[_0x5ecf31(0x1a8)](formatMcpLogMessage(_0xc606bf),..._0x38410c),logger[_0x5ecf31(0x1a7)](_0x5ecf31(0x19c),_0xc606bf,_0x38410c[_0x5ecf31(0x1a3)]?{'args':_0x38410c[_0x5ecf31(0x19e)](_0x4263a5=>String(_0x4263a5))}:undefined);}
1
+ function a1_0x4f6d(_0x1da72d,_0xda9cd0){_0x1da72d=_0x1da72d-0x191;var _0x5ab73c=a1_0x5ab7();var _0x4f6df4=_0x5ab73c[_0x1da72d];return _0x4f6df4;}var a1_0x1e52d5=a1_0x4f6d;(function(_0x5e6eaf,_0x573cff){var _0x3b9e88=a1_0x4f6d,_0x25e7c0=_0x5e6eaf();while(!![]){try{var _0x101769=-parseInt(_0x3b9e88(0x195))/0x1*(parseInt(_0x3b9e88(0x1a5))/0x2)+parseInt(_0x3b9e88(0x19a))/0x3*(-parseInt(_0x3b9e88(0x19f))/0x4)+parseInt(_0x3b9e88(0x199))/0x5*(parseInt(_0x3b9e88(0x193))/0x6)+-parseInt(_0x3b9e88(0x1a1))/0x7+parseInt(_0x3b9e88(0x191))/0x8*(-parseInt(_0x3b9e88(0x192))/0x9)+parseInt(_0x3b9e88(0x1a3))/0xa+-parseInt(_0x3b9e88(0x196))/0xb*(-parseInt(_0x3b9e88(0x1a2))/0xc);if(_0x101769===_0x573cff)break;else _0x25e7c0['push'](_0x25e7c0['shift']());}catch(_0x748a03){_0x25e7c0['push'](_0x25e7c0['shift']());}}}(a1_0x5ab7,0x647cf));import a1_0x5b08c4 from'os';import{logger}from'./logger.js';function a1_0x5ab7(){var _0x6b39de=['macOS','18861dSIzqX','77AEPVIx','Unknown','[os=','15uYWSDh','1875921uLPMLY','map','platform','error','linux','4AFwPAq','Windows','3957303anYafs','2662512iCdOFg','390200cKbCZF','MCP','66ujDDmh','104136vSPtvT','27hituDK','1343094frVdAg'];a1_0x5ab7=function(){return _0x6b39de;};return a1_0x5ab7();}export function getOperatingSystemType(_0x30428d=a1_0x5b08c4[a1_0x1e52d5(0x19c)]()){var _0x4d2fc7=a1_0x1e52d5;switch(_0x30428d){case'darwin':return _0x4d2fc7(0x194);case'win32':return _0x4d2fc7(0x1a0);case _0x4d2fc7(0x19e):return'Linux';default:return _0x4d2fc7(0x197);}}export function formatMcpLogMessage(_0x132783,_0x1fd053=a1_0x5b08c4['platform']()){var _0x525636=a1_0x1e52d5;return _0x525636(0x198)+getOperatingSystemType(_0x1fd053)+']\x20'+_0x132783;}export function logMcpStderr(_0x40f066,..._0x129d3f){var _0x2566e3=a1_0x1e52d5;console[_0x2566e3(0x19d)](formatMcpLogMessage(_0x40f066),..._0x129d3f),logger['info'](_0x2566e3(0x1a4),_0x40f066,_0x129d3f['length']?{'args':_0x129d3f[_0x2566e3(0x19b)](_0x39bcd6=>String(_0x39bcd6))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- function a2_0x3a5a(){const _0x5877e8=['358443KnTpip','_log','enable','stringify','debug','write','2248ufDVjr','info','42rSrKXx','error',']\x20[','40139oUTdzu','8mVugjn','3568896RTcqMn','fileStream','1601390iuxdpp','isEnabled','382300VMISjG','1881TLPHUT','4940NyEycU','toUpperCase','370ZDPaNW','env','enabled','warn','MORPH_LOG_FILE'];a2_0x3a5a=function(){return _0x5877e8;};return a2_0x3a5a();}const a2_0x244e69=a2_0x4ece;(function(_0x536b26,_0x3dca4c){const _0x30c0cc=a2_0x4ece,_0x2a92c5=_0x536b26();while(!![]){try{const _0xf89b61=parseInt(_0x30c0cc(0x1d4))/0x1+parseInt(_0x30c0cc(0x1e5))/0x2+parseInt(_0x30c0cc(0x1e6))/0x3*(-parseInt(_0x30c0cc(0x1da))/0x4)+-parseInt(_0x30c0cc(0x1e7))/0x5*(-parseInt(_0x30c0cc(0x1dc))/0x6)+-parseInt(_0x30c0cc(0x1e3))/0x7*(parseInt(_0x30c0cc(0x1e0))/0x8)+parseInt(_0x30c0cc(0x1e1))/0x9+parseInt(_0x30c0cc(0x1e9))/0xa*(-parseInt(_0x30c0cc(0x1df))/0xb);if(_0xf89b61===_0x3dca4c)break;else _0x2a92c5['push'](_0x2a92c5['shift']());}catch(_0x58b1ae){_0x2a92c5['push'](_0x2a92c5['shift']());}}}(a2_0x3a5a,0x39d60));function a2_0x4ece(_0x112c55,_0x277016){_0x112c55=_0x112c55-0x1d2;const _0x3a5aca=a2_0x3a5a();let _0x4ecea8=_0x3a5aca[_0x112c55];return _0x4ecea8;}import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x1f3f4d=a2_0x4ece;this[_0x1f3f4d(0x1eb)]=process[_0x1f3f4d(0x1ea)]['MORPH_DEBUG']==='1'||!!process[_0x1f3f4d(0x1ea)][_0x1f3f4d(0x1d3)];const _0xc3c462=process[_0x1f3f4d(0x1ea)][_0x1f3f4d(0x1d3)];this[_0x1f3f4d(0x1e2)]=_0xc3c462?createWriteStream(_0xc3c462,{'flags':'a'}):null;}[a2_0x244e69(0x1d8)](_0x41c195,_0x1b9b99,_0x490545){const _0x45d99b=a2_0x244e69;this[_0x45d99b(0x1d5)](_0x45d99b(0x1d8),_0x41c195,_0x1b9b99,_0x490545);}[a2_0x244e69(0x1db)](_0x4d186a,_0x8b429e,_0x4788cf){const _0x3bd46a=a2_0x244e69;this['_log'](_0x3bd46a(0x1db),_0x4d186a,_0x8b429e,_0x4788cf);}[a2_0x244e69(0x1d2)](_0x591af6,_0x2e9c5e,_0x4ba913){this['_log']('warn',_0x591af6,_0x2e9c5e,_0x4ba913);}[a2_0x244e69(0x1dd)](_0x13f902,_0xde5fbe,_0x3762bb){const _0x2b406d=a2_0x244e69;this[_0x2b406d(0x1d5)](_0x2b406d(0x1dd),_0x13f902,_0xde5fbe,_0x3762bb);}[a2_0x244e69(0x1d6)](){const _0x59f7cf=a2_0x244e69;this[_0x59f7cf(0x1eb)]=!![];}get[a2_0x244e69(0x1e4)](){return this['enabled'];}['_log'](_0x3c664f,_0xc3d54b,_0x282c8b,_0x427730){const _0x4a125d=a2_0x244e69;if(_0x3c664f!==_0x4a125d(0x1dd)&&!this['enabled'])return;const _0x1658e1=new Date()['toISOString'](),_0x5101cd='['+_0x1658e1+_0x4a125d(0x1de)+_0x3c664f[_0x4a125d(0x1e8)]()+_0x4a125d(0x1de)+_0xc3d54b+']';console[_0x4a125d(0x1dd)](_0x427730?_0x5101cd+'\x20'+_0x282c8b+'\x20'+JSON['stringify'](_0x427730):_0x5101cd+'\x20'+_0x282c8b),this['fileStream']?.[_0x4a125d(0x1d9)](JSON[_0x4a125d(0x1d7)]({'ts':_0x1658e1,'level':_0x3c664f,'component':_0xc3d54b,'msg':_0x282c8b,..._0x427730&&{'data':_0x427730}})+'\x0a');}}export const logger=new MorphLogger();
1
+ function a2_0x5886(_0x4d0af1,_0x258ad4){_0x4d0af1=_0x4d0af1-0x136;const _0x5a45cd=a2_0x5a45();let _0x588679=_0x5a45cd[_0x4d0af1];return _0x588679;}const a2_0xd3f70d=a2_0x5886;(function(_0x532d4c,_0x136009){const _0x4e62ea=a2_0x5886,_0x6a1510=_0x532d4c();while(!![]){try{const _0x1db9ba=-parseInt(_0x4e62ea(0x136))/0x1+parseInt(_0x4e62ea(0x140))/0x2+-parseInt(_0x4e62ea(0x14a))/0x3+parseInt(_0x4e62ea(0x144))/0x4+-parseInt(_0x4e62ea(0x149))/0x5+-parseInt(_0x4e62ea(0x13d))/0x6+-parseInt(_0x4e62ea(0x13a))/0x7*(-parseInt(_0x4e62ea(0x13e))/0x8);if(_0x1db9ba===_0x136009)break;else _0x6a1510['push'](_0x6a1510['shift']());}catch(_0x3767c8){_0x6a1510['push'](_0x6a1510['shift']());}}}(a2_0x5a45,0x708b5));import{createWriteStream}from'fs';class MorphLogger{[a2_0xd3f70d(0x143)];['fileStream'];constructor(){const _0x128c8e=a2_0xd3f70d;this[_0x128c8e(0x143)]=process[_0x128c8e(0x137)][_0x128c8e(0x13b)]==='1'||!!process['env']['MORPH_LOG_FILE'];const _0x23cfe1=process[_0x128c8e(0x137)]['MORPH_LOG_FILE'];this['fileStream']=_0x23cfe1?createWriteStream(_0x23cfe1,{'flags':'a'}):null;}[a2_0xd3f70d(0x13f)](_0x49ff19,_0x41c0d9,_0x2b0741){const _0x3c3daa=a2_0xd3f70d;this['_log'](_0x3c3daa(0x13f),_0x49ff19,_0x41c0d9,_0x2b0741);}['info'](_0x234d02,_0x1c2339,_0x2cb584){const _0x742ca9=a2_0xd3f70d;this['_log'](_0x742ca9(0x146),_0x234d02,_0x1c2339,_0x2cb584);}['warn'](_0x69d047,_0x29bb41,_0x36f2f2){const _0x3e19c3=a2_0xd3f70d;this[_0x3e19c3(0x141)](_0x3e19c3(0x142),_0x69d047,_0x29bb41,_0x36f2f2);}[a2_0xd3f70d(0x147)](_0x4f4621,_0x3ae906,_0x29b640){const _0x25bcf9=a2_0xd3f70d;this[_0x25bcf9(0x141)](_0x25bcf9(0x147),_0x4f4621,_0x3ae906,_0x29b640);}['enable'](){const _0x27b7dd=a2_0xd3f70d;this[_0x27b7dd(0x143)]=!![];}get[a2_0xd3f70d(0x138)](){const _0x4ac9eb=a2_0xd3f70d;return this[_0x4ac9eb(0x143)];}['_log'](_0x13e761,_0x212fda,_0x14e0a0,_0x391ed7){const _0x533668=a2_0xd3f70d;if(_0x13e761!=='error'&&!this['enabled'])return;const _0x23db37=new Date()[_0x533668(0x145)](),_0x1b9d75='['+_0x23db37+_0x533668(0x148)+_0x13e761[_0x533668(0x139)]()+']\x20['+_0x212fda+']';console[_0x533668(0x147)](_0x391ed7?_0x1b9d75+'\x20'+_0x14e0a0+'\x20'+JSON[_0x533668(0x13c)](_0x391ed7):_0x1b9d75+'\x20'+_0x14e0a0),this[_0x533668(0x14b)]?.['write'](JSON['stringify']({'ts':_0x23db37,'level':_0x13e761,'component':_0x212fda,'msg':_0x14e0a0,..._0x391ed7&&{'data':_0x391ed7}})+'\x0a');}}function a2_0x5a45(){const _0x23b68e=[']\x20[','2124190eVVWIw','2194398eKSPlY','fileStream','449341dLLcTF','env','isEnabled','toUpperCase','49CxUaFJ','MORPH_DEBUG','stringify','2050824FYMFFv','1663912qViyeQ','debug','985428srrAkJ','_log','warn','enabled','1839172hYvheL','toISOString','info','error'];a2_0x5a45=function(){return _0x23b68e;};return a2_0x5a45();}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- function a3_0x2f97(){const _0x147527=['/mnt/','join','10518306bfTvQY','test','replace','3377032mpSVYc','5pioBSZ','normalize','charAt','trim','slice','match','4Nsuicu','511023Glgqxj','23881230jcgKmV','4070034siGUmq','328741MjsURY','substring','toUpperCase','startsWith','136ixCQtA','6964HUPjdC'];a3_0x2f97=function(){return _0x147527;};return a3_0x2f97();}function a3_0x2321(_0x2e62d4,_0x2381ab){_0x2e62d4=_0x2e62d4-0xa2;const _0x2f97c7=a3_0x2f97();let _0x232130=_0x2f97c7[_0x2e62d4];return _0x232130;}(function(_0x2547ad,_0x44ccf8){const _0x171fff=a3_0x2321,_0x3f2dbd=_0x2547ad();while(!![]){try{const _0xdd6628=-parseInt(_0x171fff(0xa9))/0x1*(-parseInt(_0x171fff(0xaa))/0x2)+-parseInt(_0x171fff(0xa2))/0x3*(parseInt(_0x171fff(0xb7))/0x4)+-parseInt(_0x171fff(0xb1))/0x5*(parseInt(_0x171fff(0xad))/0x6)+-parseInt(_0x171fff(0xa5))/0x7+-parseInt(_0x171fff(0xb0))/0x8+parseInt(_0x171fff(0xa4))/0x9+parseInt(_0x171fff(0xa3))/0xa;if(_0xdd6628===_0x44ccf8)break;else _0x3f2dbd['push'](_0x3f2dbd['shift']());}catch(_0x54b543){_0x3f2dbd['push'](_0x3f2dbd['shift']());}}}(a3_0x2f97,0xe0f49));import a3_0x386d7e from'path';import a3_0x31e2ef from'os';export function convertToWindowsPath(_0x410c02){const _0x5c49e8=a3_0x2321;if(_0x410c02[_0x5c49e8(0xa8)](_0x5c49e8(0xab))){const _0xb1af0b=_0x410c02[_0x5c49e8(0xb3)](0x5)['toUpperCase'](),_0x22aab6=_0x410c02[_0x5c49e8(0xb5)](0x6)[_0x5c49e8(0xaf)](/\//g,'\x5c');return _0xb1af0b+':'+_0x22aab6;}if(_0x410c02[_0x5c49e8(0xb6)](/^\/[a-zA-Z]\//)){const _0x4d728d=_0x410c02[_0x5c49e8(0xb3)](0x1)['toUpperCase'](),_0x355898=_0x410c02['slice'](0x2)[_0x5c49e8(0xaf)](/\//g,'\x5c');return _0x4d728d+':'+_0x355898;}if(_0x410c02['match'](/^[a-zA-Z]:/))return _0x410c02['replace'](/\//g,'\x5c');return _0x410c02;}export function normalizePath(_0x232cf5){const _0x503a6a=a3_0x2321;_0x232cf5=_0x232cf5[_0x503a6a(0xb4)]()[_0x503a6a(0xaf)](/^["']|["']$/g,'');const _0x3888c4=_0x232cf5['startsWith']('/')&&!_0x232cf5['match'](/^\/mnt\/[a-z]\//i)&&!_0x232cf5['match'](/^\/[a-zA-Z]\//);if(_0x3888c4)return _0x232cf5[_0x503a6a(0xaf)](/\/+/g,'/')['replace'](/\/+$/,'');_0x232cf5=convertToWindowsPath(_0x232cf5);if(_0x232cf5[_0x503a6a(0xa8)]('\x5c\x5c')){let _0x4b75f3=_0x232cf5;_0x4b75f3=_0x4b75f3[_0x503a6a(0xaf)](/^\\{2,}/,'\x5c\x5c');const _0x5ef80b=_0x4b75f3[_0x503a6a(0xa6)](0x2)[_0x503a6a(0xaf)](/\\\\/g,'\x5c');_0x232cf5='\x5c\x5c'+_0x5ef80b;}else _0x232cf5=_0x232cf5['replace'](/\\\\/g,'\x5c');let _0x200814=a3_0x386d7e[_0x503a6a(0xb2)](_0x232cf5);_0x232cf5[_0x503a6a(0xa8)]('\x5c\x5c')&&!_0x200814[_0x503a6a(0xa8)]('\x5c\x5c')&&(_0x200814='\x5c'+_0x200814);if(_0x200814[_0x503a6a(0xb6)](/^[a-zA-Z]:/)){let _0x3b557b=_0x200814[_0x503a6a(0xaf)](/\//g,'\x5c');return/^[a-z]:/[_0x503a6a(0xae)](_0x3b557b)&&(_0x3b557b=_0x3b557b[_0x503a6a(0xb3)](0x0)[_0x503a6a(0xa7)]()+_0x3b557b[_0x503a6a(0xb5)](0x1)),_0x3b557b;}return _0x200814[_0x503a6a(0xaf)](/\//g,'\x5c');}export function expandHome(_0x3a9a50){const _0x44aa44=a3_0x2321;if(_0x3a9a50['startsWith']('~/')||_0x3a9a50==='~')return a3_0x386d7e[_0x44aa44(0xac)](a3_0x31e2ef['homedir'](),_0x3a9a50[_0x44aa44(0xb5)](0x1));return _0x3a9a50;}
1
+ (function(_0x3ebfda,_0x39f7c2){const _0x344bf7=a3_0x5eab,_0x52dd5e=_0x3ebfda();while(!![]){try{const _0x3fe4fd=parseInt(_0x344bf7(0xc3))/0x1*(parseInt(_0x344bf7(0xb3))/0x2)+-parseInt(_0x344bf7(0xbf))/0x3*(parseInt(_0x344bf7(0xc6))/0x4)+parseInt(_0x344bf7(0xb6))/0x5*(-parseInt(_0x344bf7(0xbb))/0x6)+parseInt(_0x344bf7(0xc1))/0x7+parseInt(_0x344bf7(0xb5))/0x8+parseInt(_0x344bf7(0xc0))/0x9*(-parseInt(_0x344bf7(0xbe))/0xa)+parseInt(_0x344bf7(0xb7))/0xb*(parseInt(_0x344bf7(0xbc))/0xc);if(_0x3fe4fd===_0x39f7c2)break;else _0x52dd5e['push'](_0x52dd5e['shift']());}catch(_0x54a9a2){_0x52dd5e['push'](_0x52dd5e['shift']());}}}(a3_0x1944,0x622b6));import a3_0x12c5ae from'path';import a3_0x4b4dac from'os';function a3_0x5eab(_0x3dedaa,_0x46548e){_0x3dedaa=_0x3dedaa-0xb3;const _0x1944ca=a3_0x1944();let _0x5eabe7=_0x1944ca[_0x3dedaa];return _0x5eabe7;}function a3_0x1944(){const _0x2de62e=['1698PDCTLt','charAt','3144064deEchZ','2431535KgvInd','1548327JkzqTH','startsWith','normalize','substring','6VyFOoL','36tlrljY','test','8830lADrNw','33CJmmZM','3681wZOkBq','3333288JlXmfT','match','843GrFzKj','toUpperCase','replace','275496SLbslh','slice'];a3_0x1944=function(){return _0x2de62e;};return a3_0x1944();}export function convertToWindowsPath(_0x52d394){const _0x531888=a3_0x5eab;if(_0x52d394['startsWith']('/mnt/')){const _0x39a754=_0x52d394[_0x531888(0xb4)](0x5)[_0x531888(0xc4)](),_0x5de549=_0x52d394[_0x531888(0xc7)](0x6)[_0x531888(0xc5)](/\//g,'\x5c');return _0x39a754+':'+_0x5de549;}if(_0x52d394[_0x531888(0xc2)](/^\/[a-zA-Z]\//)){const _0x479856=_0x52d394[_0x531888(0xb4)](0x1)[_0x531888(0xc4)](),_0x124541=_0x52d394[_0x531888(0xc7)](0x2)[_0x531888(0xc5)](/\//g,'\x5c');return _0x479856+':'+_0x124541;}if(_0x52d394[_0x531888(0xc2)](/^[a-zA-Z]:/))return _0x52d394[_0x531888(0xc5)](/\//g,'\x5c');return _0x52d394;}export function normalizePath(_0x1b69d4){const _0x295c15=a3_0x5eab;_0x1b69d4=_0x1b69d4['trim']()[_0x295c15(0xc5)](/^["']|["']$/g,'');const _0x19a4de=_0x1b69d4[_0x295c15(0xb8)]('/')&&!_0x1b69d4[_0x295c15(0xc2)](/^\/mnt\/[a-z]\//i)&&!_0x1b69d4[_0x295c15(0xc2)](/^\/[a-zA-Z]\//);if(_0x19a4de)return _0x1b69d4[_0x295c15(0xc5)](/\/+/g,'/')[_0x295c15(0xc5)](/\/+$/,'');_0x1b69d4=convertToWindowsPath(_0x1b69d4);if(_0x1b69d4['startsWith']('\x5c\x5c')){let _0x18a9f2=_0x1b69d4;_0x18a9f2=_0x18a9f2['replace'](/^\\{2,}/,'\x5c\x5c');const _0x111ec0=_0x18a9f2[_0x295c15(0xba)](0x2)[_0x295c15(0xc5)](/\\\\/g,'\x5c');_0x1b69d4='\x5c\x5c'+_0x111ec0;}else _0x1b69d4=_0x1b69d4[_0x295c15(0xc5)](/\\\\/g,'\x5c');let _0xbf03c2=a3_0x12c5ae[_0x295c15(0xb9)](_0x1b69d4);_0x1b69d4[_0x295c15(0xb8)]('\x5c\x5c')&&!_0xbf03c2[_0x295c15(0xb8)]('\x5c\x5c')&&(_0xbf03c2='\x5c'+_0xbf03c2);if(_0xbf03c2[_0x295c15(0xc2)](/^[a-zA-Z]:/)){let _0x5648e8=_0xbf03c2[_0x295c15(0xc5)](/\//g,'\x5c');return/^[a-z]:/[_0x295c15(0xbd)](_0x5648e8)&&(_0x5648e8=_0x5648e8[_0x295c15(0xb4)](0x0)[_0x295c15(0xc4)]()+_0x5648e8['slice'](0x1)),_0x5648e8;}return _0xbf03c2[_0x295c15(0xc5)](/\//g,'\x5c');}export function expandHome(_0x22de7e){const _0x4cdc05=a3_0x5eab;if(_0x22de7e['startsWith']('~/')||_0x22de7e==='~')return a3_0x12c5ae['join'](a3_0x4b4dac['homedir'](),_0x22de7e[_0x4cdc05(0xc7)](0x1));return _0x22de7e;}
@@ -1 +1 @@
1
- function a4_0x142d(_0x4f2f0b,_0x4015dd){_0x4f2f0b=_0x4f2f0b-0x126;const _0x228ae8=a4_0x228a();let _0x142d2d=_0x228ae8[_0x4f2f0b];return _0x142d2d;}(function(_0x449b07,_0x48544d){const _0x31fb9f=a4_0x142d,_0x508be9=_0x449b07();while(!![]){try{const _0x111ddd=-parseInt(_0x31fb9f(0x138))/0x1+parseInt(_0x31fb9f(0x131))/0x2*(-parseInt(_0x31fb9f(0x129))/0x3)+-parseInt(_0x31fb9f(0x127))/0x4+parseInt(_0x31fb9f(0x12a))/0x5*(-parseInt(_0x31fb9f(0x130))/0x6)+parseInt(_0x31fb9f(0x12b))/0x7*(-parseInt(_0x31fb9f(0x139))/0x8)+parseInt(_0x31fb9f(0x128))/0x9*(parseInt(_0x31fb9f(0x126))/0xa)+parseInt(_0x31fb9f(0x12c))/0xb;if(_0x111ddd===_0x48544d)break;else _0x508be9['push'](_0x508be9['shift']());}catch(_0x3e0704){_0x508be9['push'](_0x508be9['shift']());}}}(a4_0x228a,0xec082));import a4_0x35220b from'path';export function isPathWithinAllowedDirectories(_0x4e823c,_0xe9b23d){const _0x251c21=a4_0x142d;if(typeof _0x4e823c!==_0x251c21(0x12d)||!Array['isArray'](_0xe9b23d))return![];if(!_0x4e823c||_0xe9b23d['length']===0x0)return![];if(_0x4e823c['includes']('\x00'))return![];let _0x5ab9e3;try{_0x5ab9e3=a4_0x35220b[_0x251c21(0x136)](a4_0x35220b[_0x251c21(0x135)](_0x4e823c));}catch{return![];}if(!a4_0x35220b[_0x251c21(0x13a)](_0x5ab9e3))throw new Error(_0x251c21(0x137));return _0xe9b23d[_0x251c21(0x12f)](_0x4f8ade=>{const _0x5241ae=_0x251c21;if(typeof _0x4f8ade!==_0x5241ae(0x12d)||!_0x4f8ade)return![];if(_0x4f8ade[_0x5241ae(0x12e)]('\x00'))return![];let _0x3b1278;try{_0x3b1278=a4_0x35220b[_0x5241ae(0x136)](a4_0x35220b['normalize'](_0x4f8ade));}catch{return![];}if(!a4_0x35220b[_0x5241ae(0x13a)](_0x3b1278))throw new Error(_0x5241ae(0x134));if(_0x5ab9e3===_0x3b1278)return!![];if(_0x3b1278===a4_0x35220b[_0x5241ae(0x132)])return _0x5ab9e3[_0x5241ae(0x133)](a4_0x35220b[_0x5241ae(0x132)]);return _0x5ab9e3[_0x5241ae(0x133)](_0x3b1278+a4_0x35220b[_0x5241ae(0x132)]);});}function a4_0x228a(){const _0x3c8cb4=['1850WaeYKM','3330068gSsAWq','52432831xnbZBV','string','includes','some','17868aSZFJw','2hfUOPY','sep','startsWith','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','normalize','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','820695JvAMyq','24zFzJvq','isAbsolute','49190uuGWbP','1896416Nqltdp','2241AnuXwQ','3602505QNhubL'];a4_0x228a=function(){return _0x3c8cb4;};return a4_0x228a();}
1
+ function a4_0x5052(_0x11ce1b,_0x78ab79){_0x11ce1b=_0x11ce1b-0x183;const _0x2ca1fa=a4_0x2ca1();let _0x5052c7=_0x2ca1fa[_0x11ce1b];return _0x5052c7;}(function(_0x3cc984,_0xa824a5){const _0x4018a1=a4_0x5052,_0x2cf672=_0x3cc984();while(!![]){try{const _0x14fe0e=-parseInt(_0x4018a1(0x196))/0x1+parseInt(_0x4018a1(0x193))/0x2+-parseInt(_0x4018a1(0x198))/0x3*(parseInt(_0x4018a1(0x18c))/0x4)+-parseInt(_0x4018a1(0x188))/0x5*(parseInt(_0x4018a1(0x18e))/0x6)+parseInt(_0x4018a1(0x195))/0x7*(-parseInt(_0x4018a1(0x191))/0x8)+-parseInt(_0x4018a1(0x183))/0x9*(parseInt(_0x4018a1(0x189))/0xa)+parseInt(_0x4018a1(0x199))/0xb*(parseInt(_0x4018a1(0x187))/0xc);if(_0x14fe0e===_0xa824a5)break;else _0x2cf672['push'](_0x2cf672['shift']());}catch(_0xabb3cd){_0x2cf672['push'](_0x2cf672['shift']());}}}(a4_0x2ca1,0xf3cc6));import a4_0x236b5d from'path';function a4_0x2ca1(){const _0x51b109=['87094ZCUGdF','1512377xGDRYj','length','1695EhZFxW','3960836kCdElu','945JhUYeA','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','sep','includes','204iLatTL','2010185PDnayq','10100JZWUdK','isAbsolute','string','2660mwyySD','some','24qTneMp','startsWith','normalize','1104NsKURo','isArray','393204gOTIOr','resolve'];a4_0x2ca1=function(){return _0x51b109;};return a4_0x2ca1();}export function isPathWithinAllowedDirectories(_0x2793c1,_0x4e83a9){const _0x31ff58=a4_0x5052;if(typeof _0x2793c1!==_0x31ff58(0x18b)||!Array[_0x31ff58(0x192)](_0x4e83a9))return![];if(!_0x2793c1||_0x4e83a9[_0x31ff58(0x197)]===0x0)return![];if(_0x2793c1[_0x31ff58(0x186)]('\x00'))return![];let _0x1fac2e;try{_0x1fac2e=a4_0x236b5d[_0x31ff58(0x194)](a4_0x236b5d['normalize'](_0x2793c1));}catch{return![];}if(!a4_0x236b5d[_0x31ff58(0x18a)](_0x1fac2e))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x4e83a9[_0x31ff58(0x18d)](_0x16e70a=>{const _0x56b492=_0x31ff58;if(typeof _0x16e70a!==_0x56b492(0x18b)||!_0x16e70a)return![];if(_0x16e70a[_0x56b492(0x186)]('\x00'))return![];let _0x5cb105;try{_0x5cb105=a4_0x236b5d['resolve'](a4_0x236b5d[_0x56b492(0x190)](_0x16e70a));}catch{return![];}if(!a4_0x236b5d[_0x56b492(0x18a)](_0x5cb105))throw new Error(_0x56b492(0x184));if(_0x1fac2e===_0x5cb105)return!![];if(_0x5cb105===a4_0x236b5d[_0x56b492(0x185)])return _0x1fac2e[_0x56b492(0x18f)](a4_0x236b5d[_0x56b492(0x185)]);return _0x1fac2e[_0x56b492(0x18f)](_0x5cb105+a4_0x236b5d[_0x56b492(0x185)]);});}
@@ -1 +1 @@
1
- function a5_0x3d51(){const _0x650377=['1120bsTwNe','stat','30bTKCPE','1928KSHIIV','resolve','realpath','non-directory\x20root','4993362MaHDUY','file://','isDirectory','Skipping\x20invalid\x20directory:\x20','1152wFNwga','invalid\x20path\x20or\x20inaccessible','Skipping\x20','4149PQImvo','1773360cwLAun','508764eaRiyl','push','message','8416156itFKSx','join','uri','\x20due\x20to\x20error:\x20','slice','6WAPZdj','startsWith','homedir','3323595dCGHJV'];a5_0x3d51=function(){return _0x650377;};return a5_0x3d51();}(function(_0x16c475,_0x5ca9fc){const _0x2816fa=a5_0x40ba,_0x21f650=_0x16c475();while(!![]){try{const _0xdedbd3=parseInt(_0x2816fa(0xce))/0x1*(-parseInt(_0x2816fa(0xd9))/0x2)+parseInt(_0x2816fa(0xd0))/0x3*(-parseInt(_0x2816fa(0xde))/0x4)+parseInt(_0x2816fa(0xcd))/0x5*(parseInt(_0x2816fa(0xca))/0x6)+parseInt(_0x2816fa(0xe1))/0x7+-parseInt(_0x2816fa(0xd1))/0x8*(-parseInt(_0x2816fa(0xdc))/0x9)+parseInt(_0x2816fa(0xdd))/0xa+parseInt(_0x2816fa(0xd5))/0xb;if(_0xdedbd3===_0x5ca9fc)break;else _0x21f650['push'](_0x21f650['shift']());}catch(_0x2124f5){_0x21f650['push'](_0x21f650['shift']());}}}(a5_0x3d51,0xa9098));function a5_0x40ba(_0x4b2b5f,_0x5294b2){_0x4b2b5f=_0x4b2b5f-0xc6;const _0x3d51c3=a5_0x3d51();let _0x40ba91=_0x3d51c3[_0x4b2b5f];return _0x40ba91;}import{promises as a5_0x468c94}from'fs';import a5_0x4fe4aa from'path';import a5_0x12c065 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x4edd58){const _0x9541af=a5_0x40ba;try{const _0x4e352c=_0x4edd58[_0x9541af(0xcb)](_0x9541af(0xd6))?_0x4edd58[_0x9541af(0xc9)](0x7):_0x4edd58,_0x23fd6a=_0x4e352c[_0x9541af(0xcb)]('~/')||_0x4e352c==='~'?a5_0x4fe4aa[_0x9541af(0xc6)](a5_0x12c065[_0x9541af(0xcc)](),_0x4e352c[_0x9541af(0xc9)](0x1)):_0x4e352c,_0xc4e9b3=a5_0x4fe4aa[_0x9541af(0xd2)](_0x23fd6a),_0x510782=await a5_0x468c94[_0x9541af(0xd3)](_0xc4e9b3);return normalizePath(_0x510782);}catch{return null;}}function formatDirectoryError(_0x5bfef0,_0x4cf199,_0x104b3c){const _0x425501=a5_0x40ba;if(_0x104b3c)return _0x425501(0xdb)+_0x104b3c+':\x20'+_0x5bfef0;const _0x53c329=_0x4cf199 instanceof Error?_0x4cf199[_0x425501(0xe0)]:String(_0x4cf199);return _0x425501(0xd8)+_0x5bfef0+_0x425501(0xc8)+_0x53c329;}export async function getValidRootDirectories(_0x387739){const _0x4c0c98=a5_0x40ba,_0xfd26f1=[];for(const _0x27a8d4 of _0x387739){const _0x1af45a=await parseRootUri(_0x27a8d4[_0x4c0c98(0xc7)]);if(!_0x1af45a){logMcpStderr(formatDirectoryError(_0x27a8d4['uri'],undefined,_0x4c0c98(0xda)));continue;}try{const _0x28d5d3=await a5_0x468c94[_0x4c0c98(0xcf)](_0x1af45a);_0x28d5d3[_0x4c0c98(0xd7)]()?_0xfd26f1[_0x4c0c98(0xdf)](_0x1af45a):logMcpStderr(formatDirectoryError(_0x1af45a,undefined,_0x4c0c98(0xd4)));}catch(_0x441e95){logMcpStderr(formatDirectoryError(_0x1af45a,_0x441e95));}}return _0xfd26f1;}
1
+ (function(_0x281f24,_0x4de25a){const _0x5ac154=a5_0x23d3,_0x23460d=_0x281f24();while(!![]){try{const _0x56e449=-parseInt(_0x5ac154(0x79))/0x1*(-parseInt(_0x5ac154(0x75))/0x2)+parseInt(_0x5ac154(0x71))/0x3+-parseInt(_0x5ac154(0x77))/0x4*(parseInt(_0x5ac154(0x70))/0x5)+parseInt(_0x5ac154(0x6a))/0x6+parseInt(_0x5ac154(0x74))/0x7+-parseInt(_0x5ac154(0x6c))/0x8+-parseInt(_0x5ac154(0x73))/0x9*(-parseInt(_0x5ac154(0x7b))/0xa);if(_0x56e449===_0x4de25a)break;else _0x23460d['push'](_0x23460d['shift']());}catch(_0x3d52e5){_0x23460d['push'](_0x23460d['shift']());}}}(a5_0x5697,0xc147a));import{promises as a5_0x48aec5}from'fs';import a5_0x35db07 from'path';import a5_0x53e61a from'os';import{normalizePath}from'./path-utils.js';function a5_0x23d3(_0x5d2d3d,_0x391056){_0x5d2d3d=_0x5d2d3d-0x65;const _0x569766=a5_0x5697();let _0x23d33d=_0x569766[_0x5d2d3d];return _0x23d33d;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x2ea0ef){const _0x562c20=a5_0x23d3;try{const _0x216362=_0x2ea0ef[_0x562c20(0x6f)]('file://')?_0x2ea0ef[_0x562c20(0x66)](0x7):_0x2ea0ef,_0x159334=_0x216362[_0x562c20(0x6f)]('~/')||_0x216362==='~'?a5_0x35db07[_0x562c20(0x6e)](a5_0x53e61a['homedir'](),_0x216362[_0x562c20(0x66)](0x1)):_0x216362,_0x52535c=a5_0x35db07[_0x562c20(0x6b)](_0x159334),_0x4dba90=await a5_0x48aec5[_0x562c20(0x67)](_0x52535c);return normalizePath(_0x4dba90);}catch{return null;}}function a5_0x5697(){const _0x51804e=['\x20due\x20to\x20error:\x20','27130ElvCJJ','Skipping\x20','slice','realpath','Skipping\x20invalid\x20directory:\x20','message','899604cCgOlo','resolve','1152304aMbRcF','isDirectory','join','startsWith','5CJqabX','3001413GHTSch','invalid\x20path\x20or\x20inaccessible','45GAzace','7511602MVHBwr','162xROghZ','uri','5783068DuEWvx','push','1783LRWXri'];a5_0x5697=function(){return _0x51804e;};return a5_0x5697();}function formatDirectoryError(_0x1672e9,_0x3b700d,_0x25eb8a){const _0x3acc4b=a5_0x23d3;if(_0x25eb8a)return _0x3acc4b(0x65)+_0x25eb8a+':\x20'+_0x1672e9;const _0x55b3d4=_0x3b700d instanceof Error?_0x3b700d[_0x3acc4b(0x69)]:String(_0x3b700d);return _0x3acc4b(0x68)+_0x1672e9+_0x3acc4b(0x7a)+_0x55b3d4;}export async function getValidRootDirectories(_0x39a00a){const _0x4d448a=a5_0x23d3,_0x377b44=[];for(const _0x4749ee of _0x39a00a){const _0x4bcdb2=await parseRootUri(_0x4749ee[_0x4d448a(0x76)]);if(!_0x4bcdb2){logMcpStderr(formatDirectoryError(_0x4749ee[_0x4d448a(0x76)],undefined,_0x4d448a(0x72)));continue;}try{const _0x3ce586=await a5_0x48aec5['stat'](_0x4bcdb2);_0x3ce586[_0x4d448a(0x6d)]()?_0x377b44[_0x4d448a(0x78)](_0x4bcdb2):logMcpStderr(formatDirectoryError(_0x4bcdb2,undefined,'non-directory\x20root'));}catch(_0x4d533d){logMcpStderr(formatDirectoryError(_0x4bcdb2,_0x4d533d));}}return _0x377b44;}
@@ -1 +1 @@
1
- function a6_0x341e(_0xe53c0d,_0x5c4687){_0xe53c0d=_0xe53c0d-0x1e7;const _0x3409a3=a6_0x3409();let _0x341e03=_0x3409a3[_0xe53c0d];return _0x341e03;}function a6_0x3409(){const _0x1cb473=['3VRZsqz','filter','1013288VyEXcv','1461964myjNFO','DISABLED_TOOLS','edit_file','toLowerCase','9uXkeAk','trim','map','17251oCxImA','values','github_codebase_search','908658tKIYCZ','ENABLED_TOOLS','2078252UksVOU','11623510rWkSsw','40lszyVb','all','has','CODEBASE_SEARCH','add','916485oVDaLp'];a6_0x3409=function(){return _0x1cb473;};return a6_0x3409();}const a6_0x20c2cf=a6_0x341e;(function(_0x261a01,_0x1818f5){const _0x1ee0a2=a6_0x341e,_0x26b395=_0x261a01();while(!![]){try{const _0x2a32c9=parseInt(_0x1ee0a2(0x1f6))/0x1*(parseInt(_0x1ee0a2(0x1fd))/0x2)+parseInt(_0x1ee0a2(0x1ec))/0x3*(-parseInt(_0x1ee0a2(0x1fb))/0x4)+-parseInt(_0x1ee0a2(0x1eb))/0x5+-parseInt(_0x1ee0a2(0x1f9))/0x6+-parseInt(_0x1ee0a2(0x1ef))/0x7+parseInt(_0x1ee0a2(0x1ee))/0x8+-parseInt(_0x1ee0a2(0x1f3))/0x9*(-parseInt(_0x1ee0a2(0x1fc))/0xa);if(_0x2a32c9===_0x1818f5)break;else _0x26b395['push'](_0x26b395['shift']());}catch(_0x3dcc41){_0x26b395['push'](_0x26b395['shift']());}}}(a6_0x3409,0x8b5fd));export const TOOL_NAMES={'EDIT_FILE':a6_0x20c2cf(0x1f1),'CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x20c2cf(0x1f8)};export const ALL_TOOL_NAMES=Object[a6_0x20c2cf(0x1f7)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);export const LEGACY_TOOL_ALIASES={'warpgrep_codebase_search':TOOL_NAMES[a6_0x20c2cf(0x1e9)],'warpgrep_github_search':TOOL_NAMES['GITHUB_CODEBASE_SEARCH']};function parseToolList(_0x252ae7){const _0x34d896=a6_0x20c2cf;if(!_0x252ae7)return[];return _0x252ae7['split'](',')[_0x34d896(0x1f5)](_0x22dafa=>_0x22dafa[_0x34d896(0x1f4)]())[_0x34d896(0x1ed)](_0x4ca6ed=>_0x4ca6ed['length']>0x0)[_0x34d896(0x1f5)](_0x4a4824=>LEGACY_TOOL_ALIASES[_0x4a4824]??_0x4a4824);}export function resolveToolFilter(_0x49466f){const _0x105928=a6_0x20c2cf,_0x69c0db=_0x49466f[_0x105928(0x1fa)]?.['trim'](),_0x15011b=_0x69c0db&&_0x69c0db[_0x105928(0x1f2)]()!==_0x105928(0x1e7)?parseToolList(_0x69c0db):undefined,_0x3a64d7=parseToolList(_0x49466f[_0x105928(0x1f0)]),_0x2e6d7f=[..._0x15011b??[],..._0x3a64d7][_0x105928(0x1ed)](_0x5d1cfd=>!KNOWN_TOOL_NAMES[_0x105928(0x1e8)](_0x5d1cfd)),_0x44229a=new Set(_0x3a64d7);if(_0x15011b){const _0x6179e5=new Set(_0x15011b);for(const _0x24f00b of ALL_TOOL_NAMES)if(!_0x6179e5['has'](_0x24f00b))_0x44229a[_0x105928(0x1ea)](_0x24f00b);}return{'disabled':_0x44229a,'unknown':_0x2e6d7f};}
1
+ const a6_0x1233fc=a6_0x26cc;(function(_0x3aa628,_0xc54212){const _0x312e9c=a6_0x26cc,_0x5f23dc=_0x3aa628();while(!![]){try{const _0x302358=parseInt(_0x312e9c(0x143))/0x1*(parseInt(_0x312e9c(0x135))/0x2)+parseInt(_0x312e9c(0x13f))/0x3*(parseInt(_0x312e9c(0x141))/0x4)+-parseInt(_0x312e9c(0x139))/0x5+-parseInt(_0x312e9c(0x142))/0x6*(-parseInt(_0x312e9c(0x145))/0x7)+-parseInt(_0x312e9c(0x13e))/0x8+-parseInt(_0x312e9c(0x140))/0x9+-parseInt(_0x312e9c(0x13a))/0xa*(-parseInt(_0x312e9c(0x133))/0xb);if(_0x302358===_0xc54212)break;else _0x5f23dc['push'](_0x5f23dc['shift']());}catch(_0x31278b){_0x5f23dc['push'](_0x5f23dc['shift']());}}}(a6_0x5e8b,0xae3f0));export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x1233fc(0x134)};function a6_0x5e8b(){const _0xc3f7d9=['values','has','671pSHTBy','github_codebase_search','2ZjedqL','trim','GITHUB_CODEBASE_SEARCH','map','5350290ZimcDv','181030wCsQsW','ENABLED_TOOLS','filter','length','2725584KBoiPr','6xRzCxe','2946060hPoSvr','31780DTbpfZ','7279176gsGdvo','118439GRdzdK','toLowerCase','7IEXEBw'];a6_0x5e8b=function(){return _0xc3f7d9;};return a6_0x5e8b();}export const ALL_TOOL_NAMES=Object[a6_0x1233fc(0x131)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);export const LEGACY_TOOL_ALIASES={'warpgrep_codebase_search':TOOL_NAMES['CODEBASE_SEARCH'],'warpgrep_github_search':TOOL_NAMES[a6_0x1233fc(0x137)]};function parseToolList(_0x575e2c){const _0x39d9f2=a6_0x1233fc;if(!_0x575e2c)return[];return _0x575e2c['split'](',')['map'](_0x18dd44=>_0x18dd44[_0x39d9f2(0x136)]())[_0x39d9f2(0x13c)](_0x19ea1c=>_0x19ea1c[_0x39d9f2(0x13d)]>0x0)[_0x39d9f2(0x138)](_0x4d2a7c=>LEGACY_TOOL_ALIASES[_0x4d2a7c]??_0x4d2a7c);}function a6_0x26cc(_0x3b88a9,_0x28594e){_0x3b88a9=_0x3b88a9-0x131;const _0x5e8bab=a6_0x5e8b();let _0x26cc29=_0x5e8bab[_0x3b88a9];return _0x26cc29;}export function resolveToolFilter(_0x549a45){const _0x37b035=a6_0x1233fc,_0xe7dcdd=_0x549a45[_0x37b035(0x13b)]?.[_0x37b035(0x136)](),_0x1ddffc=_0xe7dcdd&&_0xe7dcdd[_0x37b035(0x144)]()!=='all'?parseToolList(_0xe7dcdd):undefined,_0x29252a=parseToolList(_0x549a45['DISABLED_TOOLS']),_0x3100e3=[..._0x1ddffc??[],..._0x29252a]['filter'](_0xf54a8b=>!KNOWN_TOOL_NAMES[_0x37b035(0x132)](_0xf54a8b)),_0x30286f=new Set(_0x29252a);if(_0x1ddffc){const _0x3083a8=new Set(_0x1ddffc);for(const _0x51d2d9 of ALL_TOOL_NAMES)if(!_0x3083a8[_0x37b035(0x132)](_0x51d2d9))_0x30286f['add'](_0x51d2d9);}return{'disabled':_0x30286f,'unknown':_0x3100e3};}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.217",
3
+ "version": "0.8.219",
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.199",
38
+ "@morphllm/morphsdk": "0.2.200",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",