@morphllm/morphmcp 0.8.185 → 0.8.187

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_0x35c683=a0_0x2a96;(function(_0x451925,_0x280bd9){const _0x23f1ac=a0_0x2a96,_0x111cb1=_0x451925();while(!![]){try{const _0x112bf4=-parseInt(_0x23f1ac(0x106))/0x1+-parseInt(_0x23f1ac(0x129))/0x2+parseInt(_0x23f1ac(0xe3))/0x3+parseInt(_0x23f1ac(0xbd))/0x4+parseInt(_0x23f1ac(0xfd))/0x5+-parseInt(_0x23f1ac(0x11c))/0x6*(parseInt(_0x23f1ac(0x92))/0x7)+-parseInt(_0x23f1ac(0xa3))/0x8;if(_0x112bf4===_0x280bd9)break;else _0x111cb1['push'](_0x111cb1['shift']());}catch(_0x5ebec9){_0x111cb1['push'](_0x111cb1['shift']());}}}(a0_0x2da1,0x4ce63));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_0x4c1682 from'fs/promises';import a0_0xc22154 from'path';import a0_0x44e459 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';function a0_0x2da1(){const _0x515999=['1205067ETTmLJ','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','list_directory\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','roots','Morph\x20Edit\x20Preview','node_modules','\x0a</file>','.\x20Changes:\x20','Applied','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','data','setNotificationHandler','tool_calls','optional','timeout','source','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','api-key','WarpGrep\x20sub-tool\x20errors:\x20','describe','linesRemoved','name','Rules:\x0a','warn','Error:\x20','2720160SVOCGE','messages','parse','code','application/json','codebase_search','instruction','filePath','https://morphllm.com/api/error-report','476741SvwUdS','\x0a...\x20(truncated,\x20total:\x20','pattern','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','FileNotFound','-\x20Grepped\x20\x27','isArray','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','getClientCapabilities','edit_file','now','unknown','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','<file\x20path=\x22','\x20error(s)','tool','normalize','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','grep','MORPH_LARGE_APPLY','137490gVLGkZ','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','target_file','Parent\x20directory\x20does\x20not\x20exist:\x20','terminated','env','grep_search','[github_codebase_search]\x20Failed\x20in\x20','MCP','morph-v3-large','join','\x20-\x20','unknown\x20error','375308WkAiIq','package.json','new_string','\x20\x20morph-mcp','etimedout','API\x20error\x20(auth/rate-limit)','success','post','Failed\x20to\x20read\x20file:\x20','\x0aExamples:','trim','WarpGrepError','argv','turns','warp_grep_complete','setRequestHandler','Invalid\x20arguments:\x20','utf-8','`\x20in\x20`','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','Created\x20File','metadata','completionId','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','file_read_failed','push','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','MORPH_API_KEY','catch','exit','all','Relevant\x20context\x20found:','listRoots','context','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.','message','version','morph-warp-grep-v2.1','linesAdded','response','files','stack','Warning:\x20','LocalRipgrepProvider','target_filepath','enum','tool_call_id','has','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','tsconfig.json','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.','Parameters:\x0a','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','GITHUB_CODEBASE_SEARCH','\x20as\x20allowed\x20directory','UnknownError','\x20disabled\x20via\x20DISABLED_TOOLS','string','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','morph-','text','cwd','Failed\x20to\x20request\x20roots\x20from\x20client:','Unknown\x20tool:\x20','file_path','timed\x20out','morph-v3-fast','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','search_string','**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','Fatal\x20error\x20running\x20server:','map','provider_created','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','indexOf','\x22>\x0a','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','function','finish','@morphllm/morphmcp\x20','terminationReason','github_url','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Cargo.toml','list_directory','sep','Repository\x20identifier','oninitialized','morph-mcp','go.mod','path_validation_failed','params','runWarpGrep_call','readFile','constructor','added\x20','ms.\x20Success:\x20','every','homedir','false','Workspace\x20mode\x20enabled:\x20Using\x20','includes','Example\x20format:\x0a','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','changes','read\x20','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','min','owner_repo','match','FileReadError','grep\x20\x27','size','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','errors','BinaryFile','Tool\x20','glob','read','content','file_read_complete','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','--help','array','Warning:\x20Workspace\x20fallback\x20failed:\x20','glob\x20\x27','-\x20Read\x20file\x20`','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','\x22>\x0aError\x20reading\x20file:\x20','timings','DISABLED_TOOLS','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','.\x20Path:\x20','sk-','Here\x20is\x20the\x20content\x20of\x20files:\x0a','91YuiFwR','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','pyproject.toml','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.','dirname','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','resolve','0.2.0','Error\x20accessing\x20directory\x20','toLowerCase','linesModified','❌\x20Morph\x20Edit\x20Failed:\x20','\x20is\x20not\x20a\x20directory','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Unknown\x20error','some','ReadError','23824KpZoug','repo_path',',\x20removed\x20','floor','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','length','RipgrepNotAvailable','mcp-filesystem','github_search_start','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','EDIT_FILE','lines','filter','CODEBASE_SEARCH','safeParse','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','.cursor','basename','role','tool_call_error','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','GitHub\x20search\x20failed:\x20','branch','\x22.\x20Known\x20tools:\x20','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','ms:','1338104ZvqJVI','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','status','-\x20Preserve\x20exact\x20indentation\x0a','realpath','command','PWD','Disabled\x20tools:\x20','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','connect','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','\x20chars)','Specific\x20commit\x20hash\x20to\x20search','code_edit','ENABLE_WORKSPACE_MODE','path','edit','slice','startsWith','object','debug','-\x20Listed\x20directory\x20`','error','\x0aOptions:','TimeoutError','split','\x20(new\x20file)','dryRun','Morph\x20Edit\x20','completed_with_file_errors','assistant','log','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','default','SymlinkError','isDirectory','File\x20read\x20error:','instructions'];a0_0x2da1=function(){return _0x515999;};return a0_0x2da1();}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0xffc5fc from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function a0_0x2a96(_0x23892f,_0x3f3a3d){_0x23892f=_0x23892f-0x8c;const _0x2da193=a0_0x2da1();let _0x2a96cc=_0x2da193[_0x23892f];return _0x2a96cc;}function fixPathRepetition(_0x4d3cd5){const _0x3b5290=a0_0x2a96,_0x4e15d4=_0x4d3cd5['split'](a0_0xc22154[_0x3b5290(0x17f)])['filter'](Boolean);if(_0x4e15d4[_0x3b5290(0xa8)]<0x2)return null;for(let _0x1e1d9e=Math[_0x3b5290(0xa6)](_0x4e15d4[_0x3b5290(0xa8)]/0x2);_0x1e1d9e>=0x1;_0x1e1d9e--){for(let _0x327082=0x0;_0x327082<=_0x4e15d4[_0x3b5290(0xa8)]-0x2*_0x1e1d9e;_0x327082++){const _0x583351=_0x4e15d4[_0x3b5290(0xce)](_0x327082,_0x327082+_0x1e1d9e),_0x1a649a=_0x4e15d4[_0x3b5290(0xce)](_0x327082+_0x1e1d9e,_0x327082+0x2*_0x1e1d9e);if(_0x583351[_0x3b5290(0x18b)]((_0x9fd856,_0x3a891c)=>_0x9fd856===_0x1a649a[_0x3a891c])){const _0x1ef36b=[..._0x4e15d4[_0x3b5290(0xce)](0x0,_0x327082),..._0x4e15d4[_0x3b5290(0xce)](_0x327082+_0x1e1d9e)];return a0_0xc22154[_0x3b5290(0x17f)]+_0x1ef36b[_0x3b5290(0x126)](a0_0xc22154['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x3b66d5=a0_0x2a96;try{const _0x5b8ce6=require('../package.json');return _0x5b8ce6[_0x3b66d5(0x14d)]??_0x3b66d5(0x112);}catch(_0x17ddc6){return logMcpStderr(_0x3b66d5(0x15d),_0x17ddc6),_0x3b66d5(0x112);}}function printHelp(){const _0x557b7e=a0_0x2a96;console[_0x557b7e(0xdc)](_0x557b7e(0x179)+getPackageVersion()),console['log'](_0x557b7e(0x93)),console[_0x557b7e(0xdc)](_0x557b7e(0xd4)),console[_0x557b7e(0xdc)]('\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)'),console['log']('\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit'),console[_0x557b7e(0xdc)](_0x557b7e(0xe6)),console[_0x557b7e(0xdc)](_0x557b7e(0x132)),console[_0x557b7e(0xdc)](_0x557b7e(0x12c)),console[_0x557b7e(0xdc)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x35c683(0x135)][a0_0x35c683(0xce)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x35c683(0x1a4),'-h']);cliArgs['some'](_0x5057dc=>VERSION_FLAGS[a0_0x35c683(0x158)](_0x5057dc))&&(console[a0_0x35c683(0xdc)](a0_0x35c683(0x179)+getPackageVersion()),process[a0_0x35c683(0x146)](0x0));cliArgs[a0_0x35c683(0xa1)](_0x3222f5=>HELP_FLAGS[a0_0x35c683(0x158)](_0x3222f5))&&(printHelp(),process[a0_0x35c683(0x146)](0x0));function getCliArg(_0x46694e){const _0xb8ced5=a0_0x35c683;for(let _0x6294eb=0x0;_0x6294eb<cliArgs[_0xb8ced5(0xa8)];_0x6294eb++){const _0x294f11=cliArgs[_0x6294eb];if(_0x294f11[_0xb8ced5(0xcf)]('--'+_0x46694e+'='))return _0x294f11['slice'](('--'+_0x46694e+'=')[_0xb8ced5(0xa8)]);if(_0x294f11==='--'+_0x46694e&&_0x6294eb+0x1<cliArgs[_0xb8ced5(0xa8)])return cliArgs[_0x6294eb+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x35c683(0xa8)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x35c683(0x158)](arg)||HELP_FLAGS[a0_0x35c683(0x158)](arg))continue;if(arg[a0_0x35c683(0xcf)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x35c683(0x142)](arg);}const WORKSPACE_ROOT=process[a0_0x35c683(0x121)]['WORKSPACE_ROOT']||process[a0_0x35c683(0x121)][a0_0x35c683(0xc3)]||process[a0_0x35c683(0x167)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x35c683(0xcb)]!==a0_0x35c683(0x18d),MORPH_API_KEY=getCliArg(a0_0x35c683(0xf5))??process[a0_0x35c683(0x121)][a0_0x35c683(0x144)],MORPH_API_URL=process[a0_0x35c683(0x121)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x35c683(0x121)][a0_0x35c683(0x11b)]!==a0_0x35c683(0x18d),MORPH_WARP_GREP_TIMEOUT=process[a0_0x35c683(0x121)]['MORPH_WARP_GREP_TIMEOUT']?parseInt(process[a0_0x35c683(0x121)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x35c683(0x121)]['DISABLED_TOOLS']?new Set(process[a0_0x35c683(0x121)][a0_0x35c683(0x8d)][a0_0x35c683(0xd6)](',')[a0_0x35c683(0x171)](_0x3ac530=>_0x3ac530[a0_0x35c683(0x133)]())['filter'](_0x2ba7cc=>_0x2ba7cc[a0_0x35c683(0xa8)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x35c683(0x19a)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x35c683(0x158)](tool)&&console['error']('Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22'+tool+a0_0x35c683(0xba)+[...KNOWN_TOOL_NAMES][a0_0x35c683(0x126)](',\x20'));}console[a0_0x35c683(0xd3)](a0_0x35c683(0xc4)+[...DISABLED_TOOLS][a0_0x35c683(0x126)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x35c683(0xcf)](a0_0x35c683(0x90))&&!MORPH_API_KEY[a0_0x35c683(0xcf)](a0_0x35c683(0x165))&&logMcpStderr(a0_0x35c683(0xed));async function reportMorphError(_0x454181){const _0x5b2f46=a0_0x35c683;try{await a0_0xffc5fc[_0x5b2f46(0x130)](_0x5b2f46(0x105),{..._0x454181,'timestamp':new Date()['toISOString'](),'source':_0x454181['source']||_0x5b2f46(0xaa),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x454181[_0x5b2f46(0x14a)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x5b2f46(0x101),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1d0930,_0x4eaf85){const _0x591947=a0_0x35c683;if(_0x1d0930&&typeof _0x1d0930===_0x591947(0xd0)&&'status'in _0x1d0930)return _0x1d0930['status'];if(_0x1d0930&&typeof _0x1d0930===_0x591947(0xd0)&&_0x591947(0x150)in _0x1d0930)return _0x1d0930[_0x591947(0x150)]?.[_0x591947(0xbf)];const _0x2e6c1d=_0x4eaf85[_0x591947(0x197)](/\b(401|429)\b/);return _0x2e6c1d?parseInt(_0x2e6c1d[0x1],0xa):null;}function handleMorphAPIError(_0x3654ff){const _0x124770=a0_0x35c683,_0x39e272=_0x3654ff instanceof Error?_0x3654ff[_0x124770(0x14c)]:String(_0x3654ff),_0x247c19=extractStatusCode(_0x3654ff,_0x39e272);switch(_0x247c19){case 0x191:return{'content':[{'type':'text','text':_0x124770(0x15b)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x124770(0x166),'text':_0x124770(0xbe)}],'isError':!![]};default:return null;}}args[a0_0x35c683(0xa8)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x35c683(0xc5)),logMcpStderr(a0_0x35c683(0xe4)),logMcpStderr(a0_0x35c683(0x159)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x35c683(0x17c)),logMcpStderr(a0_0x35c683(0xf4)));function normalizePath(_0x551ab9){const _0xedcca1=a0_0x35c683;return a0_0xc22154[_0xedcca1(0x117)](_0x551ab9);}function expandHome(_0x91538e){const _0x31cc20=a0_0x35c683;if(_0x91538e[_0x31cc20(0xcf)]('~/')||_0x91538e==='~')return a0_0xc22154[_0x31cc20(0x126)](a0_0x44e459[_0x31cc20(0x18c)](),_0x91538e[_0x31cc20(0xce)](0x1));return _0x91538e;}let allowedDirectories=await Promise['all'](args[a0_0x35c683(0x171)](async _0xbc9c90=>{const _0x801e6c=a0_0x35c683,_0x3c8631=expandHome(_0xbc9c90),_0x30d215=a0_0xc22154[_0x801e6c(0x98)](_0x3c8631);try{const _0x54b273=await a0_0x4c1682[_0x801e6c(0xc1)](_0x30d215);return normalizePath(_0x54b273);}catch(_0x1ad87d){return normalizePath(_0x30d215);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x35c683(0x142)](workspaceDir),logMcpStderr(a0_0x35c683(0x18e)+workspaceDir+a0_0x35c683(0x160)));}catch(a0_0x5e7259){logMcpStderr(a0_0x35c683(0x97)+a0_0x5e7259);}async function detectWorkspaceRoot(_0x11e21d){const _0x49afe3=a0_0x35c683;let _0x4df3a5=a0_0xc22154[_0x49afe3(0x98)](_0x11e21d);const _0x27754a=['.git','.vscode',_0x49afe3(0x12a),_0x49afe3(0x17d),_0x49afe3(0x94),_0x49afe3(0x183),_0x49afe3(0xb3),_0x49afe3(0x15a),'composer.json'];while(_0x4df3a5!==a0_0xc22154[_0x49afe3(0x96)](_0x4df3a5)){for(const _0x3e7082 of _0x27754a){const _0xe38176=a0_0xc22154[_0x49afe3(0x126)](_0x4df3a5,_0x3e7082);try{return await a0_0x4c1682['access'](_0xe38176),normalizePath(_0x4df3a5);}catch{}}_0x4df3a5=a0_0xc22154[_0x49afe3(0x96)](_0x4df3a5);}return normalizePath(_0x11e21d);}await Promise[a0_0x35c683(0x147)](args[a0_0x35c683(0x171)](async _0x532324=>{const _0x2c7108=a0_0x35c683;try{const _0x107dcb=await a0_0x4c1682['stat'](expandHome(_0x532324));!_0x107dcb[_0x2c7108(0xe0)]()&&(logMcpStderr(_0x2c7108(0xfc)+_0x532324+_0x2c7108(0x9e)),process[_0x2c7108(0x146)](0x1));}catch(_0x46c054){logMcpStderr(_0x2c7108(0x9a)+_0x532324+':',_0x46c054),process[_0x2c7108(0x146)](0x1);}}));async function validatePath(_0x6d1fe5){const _0x1274a1=a0_0x35c683,_0x3e1d26=expandHome(_0x6d1fe5),_0x4157a7=a0_0xc22154['resolve'](_0x3e1d26);logger[_0x1274a1(0xd1)](_0x1274a1(0x124),'path_validation_start',{'raw_path':_0x6d1fe5,'absolute':_0x4157a7});try{const _0x33c3ca=await a0_0x4c1682[_0x1274a1(0xc1)](_0x4157a7);return logger[_0x1274a1(0xd1)](_0x1274a1(0x124),'path_validation_resolved',{'resolved':_0x33c3ca,'symlink':_0x33c3ca!==_0x4157a7}),_0x33c3ca;}catch(_0x455743){if(_0x455743[_0x1274a1(0x100)]==='ENOENT'){const _0x1761f6=a0_0xc22154[_0x1274a1(0x96)](_0x4157a7);try{const _0x1666b8=await a0_0x4c1682[_0x1274a1(0xc1)](_0x1761f6),_0x119896=a0_0xc22154[_0x1274a1(0x126)](_0x1666b8,a0_0xc22154[_0x1274a1(0xb4)](_0x4157a7));return logger['debug'](_0x1274a1(0x124),'path_validation_resolved',{'resolved':_0x119896,'new_file':!![]}),_0x119896;}catch{logger[_0x1274a1(0xd3)](_0x1274a1(0x124),'path_validation_failed',{'raw_path':_0x6d1fe5,'error':_0x1274a1(0x11f)+_0x1761f6});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x1761f6);}}logger[_0x1274a1(0xd3)](_0x1274a1(0x124),_0x1274a1(0x184),{'raw_path':_0x6d1fe5,'error':_0x455743[_0x1274a1(0x14c)]});throw _0x455743;}}const MorphEditFileArgsSchema=z[a0_0x35c683(0xd0)]({'path':z[a0_0x35c683(0x163)](),'code_edit':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0xdd)),'instruction':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x173)),'dryRun':z['boolean']()[a0_0x35c683(0xde)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x35c683(0x14b),WarpGrepArgsSchema=z[a0_0x35c683(0xd0)]({'search_string':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x194)),'search_type':z[a0_0x35c683(0x156)]([a0_0x35c683(0xde),a0_0x35c683(0xe9)])[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0xa7))}),WarpGrepGitHubArgsSchema=z[a0_0x35c683(0xd0)]({'search_string':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x176)),'owner_repo':z['string']()[a0_0x35c683(0xf1)]()['describe']('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()['describe']('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x35c683(0xd0)]({'query':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x180)),'branch':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0x10d)),'commitHash':z[a0_0x35c683(0x163)]()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xf7)](a0_0x35c683(0xc9)),'targetDirectories':z[a0_0x35c683(0x1a5)](z[a0_0x35c683(0x163)]())['default']([])[a0_0x35c683(0xf7)]('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x35c683(0xf1)]()[a0_0x35c683(0xde)](0xa)[a0_0x35c683(0xf7)]('Max\x20results\x20to\x20return')}),server=new Server({'name':a0_0x35c683(0x182),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x35c683(0x138)](ListToolsRequestSchema,async()=>{const _0x1f5841=a0_0x35c683,_0x4b26a3=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x1f5841(0x16f)+_0x1f5841(0x15c)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x1f5841(0xbb)+_0x1f5841(0x109)+_0x1f5841(0x1a3)+_0x1f5841(0x190)+'//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a'+_0x1f5841(0xfa)+_0x1f5841(0x118)+_0x1f5841(0xc0)+_0x1f5841(0x119)+_0x1f5841(0xac),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x1f5841(0xb0)],'description':_0x1f5841(0x11d)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x1f5841(0x13c)+_0x1f5841(0x143)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x49e866=_0x4b26a3[_0x1f5841(0xaf)](_0x2dd1d3=>{const _0x5824c6=_0x1f5841;if(DISABLED_TOOLS[_0x5824c6(0x158)](_0x2dd1d3[_0x5824c6(0xf9)]))return console[_0x5824c6(0xd3)](_0x5824c6(0x19e)+_0x2dd1d3[_0x5824c6(0xf9)]+_0x5824c6(0x162)),![];if('requiresApiKey'in _0x2dd1d3&&_0x2dd1d3['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x5824c6(0x153)+_0x2dd1d3[_0x5824c6(0xf9)]+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x49e866[_0x1f5841(0x171)](_0x28e456=>({'name':_0x28e456[_0x1f5841(0xf9)],'description':_0x28e456['description'],'inputSchema':_0x28e456['inputSchema']}))};}),server[a0_0x35c683(0x138)](CallToolRequestSchema,async _0x320ac6=>{const _0x205f40=a0_0x35c683,{name:_0x243636,arguments:_0x1cbe99}=_0x320ac6[_0x205f40(0x185)],_0x16db6d=Date['now']();logger[_0x205f40(0xd1)]('MCP','tool_call_received',{'tool':_0x243636,'args':_0x243636===_0x205f40(0x110)?{'path':_0x1cbe99?.[_0x205f40(0xcc)],'instruction':_0x1cbe99?.[_0x205f40(0x103)]||_0x1cbe99?.[_0x205f40(0xe2)],'dryRun':_0x1cbe99?.[_0x205f40(0xd8)]}:_0x1cbe99});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x113)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x205f40(0x90))&&!MORPH_API_KEY[_0x205f40(0xcf)](_0x205f40(0x165)))return{'content':[{'type':_0x205f40(0x166),'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[_0x205f40(0x158)](_0x243636))return{'content':[{'type':_0x205f40(0x166),'text':'Tool\x20\x22'+_0x243636+_0x205f40(0x140)}],'isError':![]};switch(_0x243636){case TOOL_NAMES[_0x205f40(0xad)]:{let _0x349281=_0x1cbe99;if(_0x349281&&typeof _0x349281===_0x205f40(0xd0)){if(!('path'in _0x349281)){const _0x37c408=_0x349281[_0x205f40(0x11e)]??_0x349281[_0x205f40(0x104)]??_0x349281[_0x205f40(0x155)]??_0x349281[_0x205f40(0x16a)]??_0x349281['file'];if(_0x37c408)_0x349281={..._0x349281,'path':_0x37c408};}_0x205f40(0xe2)in _0x349281&&!('instruction'in _0x349281)&&(_0x349281={..._0x349281,'instruction':_0x349281[_0x205f40(0xe2)]});if(!(_0x205f40(0xca)in _0x349281)){const _0x5848e6=_0x349281[_0x205f40(0x100)]??_0x349281[_0x205f40(0x12b)]??_0x349281[_0x205f40(0x1a1)]??_0x349281[_0x205f40(0xcd)];if(_0x5848e6)_0x349281={..._0x349281,'code_edit':_0x5848e6};}}const _0x29d834=MorphEditFileArgsSchema[_0x205f40(0xb1)](_0x349281);if(!_0x29d834['success'])throw new Error(_0x205f40(0x15e)+_0x29d834[_0x205f40(0xd3)]);const _0x271a56=await validatePath(_0x29d834[_0x205f40(0xee)][_0x205f40(0xcc)]);let _0x441132=null,_0x42500a=!![],_0x48847d=null;try{_0x441132=await a0_0x4c1682['readFile'](_0x271a56,_0x205f40(0x13a)),logger['debug']('MCP',_0x205f40(0x1a2),{'path':_0x271a56,'size_bytes':_0x441132[_0x205f40(0xa8)]});}catch(_0x99302e){const _0x1a54c0=_0x99302e['code'];_0x1a54c0==='ENOENT'?(_0x42500a=![],_0x441132='',logger[_0x205f40(0xd1)](_0x205f40(0x124),_0x205f40(0x1a2),{'path':_0x271a56,'exists':![]})):(_0x48847d=_0x205f40(0x131)+(_0x1a54c0||'unknown')+_0x205f40(0x127)+(_0x99302e instanceof Error?_0x99302e[_0x205f40(0x14c)]:String(_0x99302e)),logger[_0x205f40(0xd3)](_0x205f40(0x124),_0x205f40(0x141),{'path':_0x271a56,'error':_0x48847d}),logMcpStderr(_0x205f40(0x153)+_0x48847d));}let _0xbaa3b2;try{const _0xc276aa=MORPH_API_KEY;if(!_0xc276aa)throw new Error(_0x205f40(0x9f));const _0x24aa56=a0_0xc22154['dirname'](_0x271a56),_0x446ff8=a0_0xc22154[_0x205f40(0xb4)](_0x271a56);logger[_0x205f40(0xd1)](_0x205f40(0x124),'api_request_start',{'model':_0x205f40(0x16c),'path':_0x29d834['data'][_0x205f40(0xcc)],'instruction_len':_0x29d834[_0x205f40(0xee)]['instruction'][_0x205f40(0xa8)],'code_edit_len':_0x29d834[_0x205f40(0xee)][_0x205f40(0xca)][_0x205f40(0xa8)],'original_code_len':_0x441132?.[_0x205f40(0xa8)]??0x0,'dry_run':_0x29d834[_0x205f40(0xee)]['dryRun']});const _0x4c1b6a=Date['now'](),_0x2999c2=await executeEditFile({'target_filepath':_0x446ff8,'code_edit':_0x29d834[_0x205f40(0xee)][_0x205f40(0xca)],'instruction':_0x29d834[_0x205f40(0xee)][_0x205f40(0x103)]},{'morphApiKey':_0xc276aa,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x24aa56,'autoWrite':!_0x29d834[_0x205f40(0xee)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x4506ce=Date[_0x205f40(0x111)]()-_0x4c1b6a;_0xbaa3b2=_0x2999c2[_0x205f40(0x13f)];if(!_0x2999c2[_0x205f40(0x12f)])throw new Error(_0x2999c2['error']||'Morph\x20FastApply\x20failed\x20without\x20error\x20message');const _0xe2d6db=_0x2999c2[_0x205f40(0x192)],_0x379e1c=_0x205f40(0x189)+_0xe2d6db['linesAdded']+_0x205f40(0xa5)+_0xe2d6db[_0x205f40(0xf8)]+',\x20modified\x20'+_0xe2d6db[_0x205f40(0x9c)];logger[_0x205f40(0xd1)]('MCP','tool_call_complete',{'tool':_0x205f40(0x110),'success':!![],'latency_ms':Date[_0x205f40(0x111)]()-_0x16db6d,'edit_latency_ms':_0x4506ce,'changes':{'added':_0xe2d6db[_0x205f40(0x14f)],'removed':_0xe2d6db[_0x205f40(0xf8)],'modified':_0xe2d6db[_0x205f40(0x9c)]},'completion_id':_0xbaa3b2});if(_0x29d834[_0x205f40(0xee)][_0x205f40(0xd8)])return{'content':[{'type':'text','text':_0x205f40(0xe8)+(_0x42500a?'':_0x205f40(0xd7))+':\x20'+_0x29d834[_0x205f40(0xee)][_0x205f40(0x103)]+'.\x20Changes:\x20'+_0x379e1c+_0x205f40(0x8f)+_0x29d834[_0x205f40(0xee)]['path']+'.'}]};return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0xd9)+(_0x42500a?_0x205f40(0xec):_0x205f40(0x13d))+':\x20'+_0x29d834['data'][_0x205f40(0x103)]+_0x205f40(0xeb)+_0x379e1c+_0x205f40(0x8f)+_0x29d834[_0x205f40(0xee)]['path']+'.'}]};}catch(_0x56b238){const _0x587914=handleMorphAPIError(_0x56b238);if(_0x587914)return logger['error'](_0x205f40(0x124),_0x205f40(0xb6),{'tool':'edit_file','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date['now']()-_0x16db6d}),_0x587914;const _0x2b1756=_0x56b238 instanceof Error?_0x56b238['message']:String(_0x56b238);return logger[_0x205f40(0xd3)](_0x205f40(0x124),_0x205f40(0xb6),{'tool':_0x205f40(0x110),'error':_0x2b1756,'path':_0x29d834[_0x205f40(0xee)][_0x205f40(0xcc)],'validated_path':_0x271a56,'latency_ms':Date['now']()-_0x16db6d,'stack':_0x56b238 instanceof Error?_0x56b238[_0x205f40(0x152)]:undefined}),reportMorphError({'error_message':_0x2b1756,'error_type':_0x56b238 instanceof Error?_0x56b238[_0x205f40(0x188)][_0x205f40(0xf9)]:_0x205f40(0x161),'context':{'tool':_0x205f40(0x110),'completion_id':_0xbaa3b2,'file_path':_0x29d834[_0x205f40(0xee)]['path'],'validated_path':_0x271a56,'instruction':_0x29d834[_0x205f40(0xee)][_0x205f40(0x103)],'model':MORPH_LARGE_APPLY?_0x205f40(0x125):'morph-v3-fast','dry_run':_0x29d834[_0x205f40(0xee)][_0x205f40(0xd8)],'file_exists':_0x42500a,'file_read_error':_0x48847d,'file_readable':_0x441132!==null,'request_content':{'path':_0x29d834['data'][_0x205f40(0xcc)],'code_edit':_0x29d834[_0x205f40(0xee)][_0x205f40(0xca)],'instruction':_0x29d834[_0x205f40(0xee)]['instruction'],'original_code':_0x441132!==null?_0x441132[_0x205f40(0xa8)]>0xc350?_0x441132['substring'](0x0,0xc350)+_0x205f40(0x107)+_0x441132[_0x205f40(0xa8)]+_0x205f40(0xc8):_0x441132:'[could\x20not\x20read\x20file:\x20'+(_0x48847d||_0x205f40(0x128))+']','original_code_length':_0x441132?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x205f40(0x125):_0x205f40(0x16c),'dry_run':_0x29d834[_0x205f40(0xee)][_0x205f40(0xd8)]}},'stack_trace':_0x56b238 instanceof Error?_0x56b238[_0x205f40(0x152)]:undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x9d)+_0x2b1756}],'isError':!![]};}}case TOOL_NAMES[_0x205f40(0xb0)]:{const _0x47fb36=WarpGrepArgsSchema[_0x205f40(0xb1)](_0x1cbe99);if(!_0x47fb36['success'])return{'content':[{'type':_0x205f40(0x166),'text':'Invalid\x20arguments:\x20'+_0x47fb36[_0x205f40(0xd3)]}],'isError':!![]};const _0xd5874c=_0x420e64=>{const _0x3d2e67=_0x205f40,_0x3d9de9=[];for(const _0x1b393e of _0x420e64||[]){if(_0x1b393e[_0x3d2e67(0xb5)]==='assistant'&&Array[_0x3d2e67(0x10c)](_0x1b393e[_0x3d2e67(0xf0)]))for(const _0x1e3534 of _0x1b393e[_0x3d2e67(0xf0)]){try{const _0x5131d0=_0x1e3534[_0x3d2e67(0x177)]?.[_0x3d2e67(0xf9)],_0x5c8df5=JSON[_0x3d2e67(0xff)](_0x1e3534[_0x3d2e67(0x177)]?.['arguments']||'{}');if(_0x5131d0===_0x3d2e67(0x122))_0x3d9de9['push'](_0x3d2e67(0x199)+_0x5c8df5[_0x3d2e67(0x108)]+'\x27\x20'+(_0x5c8df5[_0x3d2e67(0xcc)]||'.'));else{if(_0x5131d0===_0x3d2e67(0x1a0))_0x3d9de9[_0x3d2e67(0x142)](_0x3d2e67(0x193)+_0x5c8df5[_0x3d2e67(0xcc)]);else{if(_0x5131d0===_0x3d2e67(0x17e))_0x3d9de9[_0x3d2e67(0x142)](_0x3d2e67(0xe5)+(_0x5c8df5['command']||'.'));else{if(_0x5131d0===_0x3d2e67(0x19f))_0x3d9de9[_0x3d2e67(0x142)](_0x3d2e67(0x1a7)+_0x5c8df5[_0x3d2e67(0x108)]+'\x27\x20'+(_0x5c8df5[_0x3d2e67(0xcc)]||'.'));else _0x5131d0===_0x3d2e67(0x178)&&_0x3d9de9[_0x3d2e67(0x142)]('finish');}}}}catch{}}}return _0x3d9de9;},_0x5a1b95=_0x1d42df=>{const _0x59e437=_0x205f40,_0x3f8a77=[];if(!_0x1d42df||!Array[_0x59e437(0x10c)](_0x1d42df))return _0x3f8a77;const _0xe3abda=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x59e437(0x10a),'tool':_0x59e437(0x1a0)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x59e437(0x1a0)},{'pattern':/\[READ ERROR\]/,'error_type':_0x59e437(0xa2),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x59e437(0x19d),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x59e437(0x11a)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x59e437(0xa9),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x59e437(0x19d),'tool':_0x59e437(0x1a0)},{'pattern':/\[SYMLINK\]/,'error_type':_0x59e437(0xdf),'tool':_0x59e437(0x1a0)},{'pattern':/not a text file/,'error_type':_0x59e437(0x19d),'tool':_0x59e437(0x1a0)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x59e437(0x1a0)},{'pattern':/Error reading file:/,'error_type':_0x59e437(0xa2),'tool':_0x59e437(0x1a0)},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x3df4c1=0x0;for(const _0x5a4805 of _0x1d42df){_0x5a4805[_0x59e437(0xb5)]===_0x59e437(0xdb)&&Array['isArray'](_0x5a4805[_0x59e437(0xf0)])&&_0x3df4c1++;const _0x20e93e=_0x5a4805['content'];if((_0x5a4805[_0x59e437(0xb5)]===_0x59e437(0x116)||_0x5a4805[_0x59e437(0xb5)]==='user')&&_0x20e93e&&typeof _0x20e93e===_0x59e437(0x163))for(const {pattern:_0x3b94dc,error_type:_0x2e3e12,tool:_0x4d7871}of _0xe3abda){const _0x4c7244=_0x20e93e[_0x59e437(0x197)](new RegExp(_0x3b94dc[_0x59e437(0xf3)],'g'));if(_0x4c7244)for(const _0xbb564e of _0x4c7244){const _0x129c90=_0x20e93e[_0x59e437(0x174)](_0xbb564e),_0x11db85=_0x20e93e['substring'](_0x129c90,Math[_0x59e437(0x195)](_0x129c90+0xc8,_0x20e93e[_0x59e437(0xa8)]));_0x3f8a77[_0x59e437(0x142)]({'tool':_0x4d7871,'error_type':_0x2e3e12,'error_message':_0x11db85['split']('\x0a')[0x0],'turn':_0x3df4c1});}}}return _0x3f8a77;};try{const _0x2e0e73=a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)]),_0x323f76=_0x47fb36['data']['search_type'],_0x457ea4=_0x323f76===_0x205f40(0xe9)?{'allowNames':['node_modules']}:undefined,_0x4b4622=new LocalRipgrepProvider(_0x2e0e73,undefined,_0x457ea4);logger[_0x205f40(0xd1)](_0x205f40(0x124),_0x205f40(0x172),{'type':_0x205f40(0x154),'repo_root':_0x2e0e73,'search_type':_0x323f76||_0x205f40(0xde)}),logger[_0x205f40(0xd1)](_0x205f40(0x124),'warp_grep_start',{'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repo_root':_0x2e0e73,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1f9b88=Date[_0x205f40(0x111)](),_0x1e9c08=await runWarpGrep({'searchTerm':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repoRoot':_0x2e0e73,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4b4622,'search_type':_0x323f76}),_0x1f8205=Date[_0x205f40(0x111)]()-_0x1f9b88,_0x3f1398=_0x1e9c08[_0x205f40(0x178)]?.[_0x205f40(0x13e)]?.[_0x205f40(0x151)]?.[_0x205f40(0xa8)]??0x0;logger['debug']('MCP',_0x205f40(0x137),{'termination':_0x1e9c08['terminationReason'],'turns':_0x1e9c08[_0x205f40(0x8c)]?.[_0x205f40(0x136)]??0x0,'files_found':_0x3f1398,'latency_ms':_0x1f8205});const _0x4c2fd8=_0x5a1b95(_0x1e9c08[_0x205f40(0xfe)]);_0x4c2fd8[_0x205f40(0xa8)]>0x0&&reportMorphError({'error_message':_0x205f40(0xf6)+_0x4c2fd8['length']+_0x205f40(0x115),'error_type':'SubToolError','level':_0x205f40(0xfb),'tool':_0x205f40(0x102),'context':{'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'query':_0x47fb36[_0x205f40(0xee)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x1e9c08[_0x205f40(0x17a)],'sub_tool_errors':_0x4c2fd8,'timings':_0x1e9c08[_0x205f40(0x8c)],'tool_calls':_0xd5874c(_0x1e9c08[_0x205f40(0xfe)]),'messages':_0x1e9c08[_0x205f40(0xfe)]?.[_0x205f40(0x171)](_0x4660a4=>({'role':_0x4660a4['role'],'content':_0x4660a4[_0x205f40(0x1a1)],..._0x4660a4[_0x205f40(0xf0)]?{'tool_calls':_0x4660a4['tool_calls']['length']}:{},..._0x4660a4[_0x205f40(0x157)]?{'tool_call_id':_0x4660a4['tool_call_id']}:{}}))},'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{});let _0x2fa726='';if(_0x1e9c08[_0x205f40(0x17a)]==='completed'&&_0x1e9c08[_0x205f40(0x178)]?.[_0x205f40(0x13e)]?.['files']){const _0x5ec049=_0x1e9c08[_0x205f40(0x178)][_0x205f40(0x13e)]['files'];if(_0x5ec049[_0x205f40(0xa8)]===0x0)return _0x2fa726=_0x1e9c08['finish']['payload']||_0x205f40(0x1a9),{'content':[{'type':_0x205f40(0x166),'text':_0x2fa726}]};const _0xb6e96f=[],_0x211b95=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x311043 of _0x1e9c08['messages']){if(_0x311043[_0x205f40(0xb5)]===_0x205f40(0xdb)&&Array[_0x205f40(0x10c)](_0x311043[_0x205f40(0xf0)]))for(const _0x3b0d47 of _0x311043[_0x205f40(0xf0)]){try{const _0x5a9373=_0x3b0d47[_0x205f40(0x177)]?.[_0x205f40(0xf9)],_0x1ff7fa=JSON[_0x205f40(0xff)](_0x3b0d47[_0x205f40(0x177)]?.['arguments']||'{}');if(_0x5a9373===_0x205f40(0x122))_0x211b95['push'](_0x205f40(0x10b)+_0x1ff7fa[_0x205f40(0x108)]+'\x27\x20in\x20`'+(_0x1ff7fa[_0x205f40(0xcc)]||'.')+'`');else{if(_0x5a9373===_0x205f40(0x1a0))_0x211b95['push'](_0x205f40(0x1a8)+_0x1ff7fa[_0x205f40(0xcc)]+'`');else{if(_0x5a9373===_0x205f40(0x17e))_0x211b95['push'](_0x205f40(0xd2)+(_0x1ff7fa[_0x205f40(0xc2)]||'.')+'`');else _0x5a9373===_0x205f40(0x19f)&&_0x211b95[_0x205f40(0x142)]('-\x20Glob\x20search\x20`'+_0x1ff7fa[_0x205f40(0x108)]+_0x205f40(0x13b)+(_0x1ff7fa[_0x205f40(0xcc)]||'.')+'`');}}}catch{}}}_0xb6e96f[_0x205f40(0x142)](_0x211b95[_0x205f40(0x126)]('\x0a'));const _0x2933b0=['',_0x205f40(0x148)];for(const _0x48648c of _0x5ec049){if(_0x48648c[_0x205f40(0xae)]==='*')_0x2933b0[_0x205f40(0x142)]('-\x20'+_0x48648c[_0x205f40(0xcc)]+':*');else{if(Array[_0x205f40(0x10c)](_0x48648c[_0x205f40(0xae)])){const _0xb1d473=_0x48648c[_0x205f40(0xae)][_0x205f40(0x171)](([_0x1fddaa,_0x2c8cef])=>{if(_0x1fddaa===_0x2c8cef)return''+_0x1fddaa;return _0x1fddaa+'-'+_0x2c8cef;});_0x2933b0[_0x205f40(0x142)]('-\x20'+_0x48648c[_0x205f40(0xcc)]+':'+_0xb1d473[_0x205f40(0x126)](','));}else _0x2933b0['push']('-\x20'+_0x48648c[_0x205f40(0xcc)]+':*');}}_0x2933b0[_0x205f40(0x142)](''),_0xb6e96f[_0x205f40(0x142)](_0x2933b0[_0x205f40(0x126)]('\x0a')),_0xb6e96f[_0x205f40(0x142)](_0x205f40(0x91));const _0x228d2d=[],_0x2e170a=[];for(const _0xd7bb26 of _0x5ec049){let _0x3e9232=a0_0xc22154[_0x205f40(0x98)](_0x47fb36['data']['repo_path'],_0xd7bb26[_0x205f40(0xcc)]),_0x234402=null,_0x3c5033=null;try{_0x234402=await a0_0x4c1682[_0x205f40(0x187)](_0x3e9232,{'encoding':_0x205f40(0x13a)});}catch(_0x3569b0){const _0x65358a=fixPathRepetition(_0x3e9232);if(_0x65358a)try{_0x234402=await a0_0x4c1682[_0x205f40(0x187)](_0x65358a,{'encoding':_0x205f40(0x13a)}),_0x3e9232=_0x65358a;}catch{_0x3c5033=_0x3569b0 instanceof Error?_0x3569b0:new Error(String(_0x3569b0));}else _0x3c5033=_0x3569b0 instanceof Error?_0x3569b0:new Error(String(_0x3569b0));}if(_0x234402!==null){const _0x3fef55=_0x234402[_0x205f40(0xd6)](/\r?\n/),_0x2ed25e=[];if(_0xd7bb26[_0x205f40(0xae)]==='*'||!Array['isArray'](_0xd7bb26[_0x205f40(0xae)]))for(let _0x18c8d4=0x1;_0x18c8d4<=_0x3fef55['length'];_0x18c8d4++){const _0xce2438=_0x3fef55[_0x18c8d4-0x1];_0x2ed25e[_0x205f40(0x142)](_0x18c8d4+'|\x20'+_0xce2438);}else for(const [_0x3b960c,_0x344d37]of _0xd7bb26[_0x205f40(0xae)]){_0x2ed25e['length']>0x0&&_0x2ed25e[_0x205f40(0x142)]('');for(let _0x59b90f=_0x3b960c;_0x59b90f<=_0x344d37&&_0x59b90f<=_0x3fef55[_0x205f40(0xa8)];_0x59b90f++){const _0x13f222=_0x3fef55[_0x59b90f-0x1];_0x2ed25e[_0x205f40(0x142)](_0x59b90f+'|\x20'+_0x13f222);}}_0x2e170a[_0x205f40(0x142)]({'path':_0xd7bb26['path'],'content':_0x2ed25e[_0x205f40(0x126)]('\x0a')});}else _0x228d2d[_0x205f40(0x142)](_0x205f40(0x114)+_0xd7bb26[_0x205f40(0xcc)]+_0x205f40(0x1aa)+(_0x3c5033?.[_0x205f40(0x14c)]||_0x205f40(0xa0))+_0x205f40(0xea));}try{const _0x15c090=await compactFileContexts(_0x2e170a,_0x47fb36['data'][_0x205f40(0x16e)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3613b7 of _0x15c090){_0x228d2d[_0x205f40(0x142)](_0x205f40(0x114)+_0x3613b7[_0x205f40(0xcc)]+_0x205f40(0x175)+_0x3613b7[_0x205f40(0x1a1)]+_0x205f40(0xea));}}catch(_0x3e7c65){logger[_0x205f40(0xfb)](_0x205f40(0x124),'compaction_failed',{'error':_0x3e7c65 instanceof Error?_0x3e7c65[_0x205f40(0x14c)]:String(_0x3e7c65),'files_count':_0x2e170a[_0x205f40(0xa8)]});for(const _0x43cd25 of _0x2e170a){_0x228d2d[_0x205f40(0x142)]('<file\x20path=\x22'+_0x43cd25[_0x205f40(0xcc)]+_0x205f40(0x175)+_0x43cd25[_0x205f40(0x1a1)]+_0x205f40(0xea));}}_0xb6e96f[_0x205f40(0x142)](_0x228d2d['join']('\x0a\x0a')),_0x2fa726=_0xb6e96f[_0x205f40(0x126)]('\x0a');const _0x1a2f9e=_0x1e9c08[_0x205f40(0x19c)]?.[_0x205f40(0xaf)](_0x2df4af=>_0x2df4af[_0x205f40(0x14c)]?.['startsWith'](_0x205f40(0xe1)))||[];if(_0x1a2f9e['length']>0x0){const _0x3df723=_0x1a2f9e['map'](_0x5f0d19=>_0x5f0d19[_0x205f40(0x14c)])[_0x205f40(0x126)](';\x20');reportMorphError({'error_message':_0x3df723,'error_type':_0x205f40(0x198),'context':{'tool':_0x205f40(0x102),'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'model':_0x205f40(0x14e),'termination_reason':_0x205f40(0xda),'error_count':_0x1a2f9e[_0x205f40(0xa8)],'is_timeout':![],'timings':_0x1e9c08[_0x205f40(0x8c)],'files_attempted':_0x5ec049[_0x205f40(0x171)](_0x3bdcc4=>({'path':_0x3bdcc4['path'],'lines':_0x3bdcc4[_0x205f40(0xae)]})),'tool_calls':_0xd5874c(_0x1e9c08[_0x205f40(0xfe)]),'messages':_0x1e9c08[_0x205f40(0xfe)]?.[_0x205f40(0x171)](_0x181915=>({'role':_0x181915[_0x205f40(0xb5)],'content':_0x181915[_0x205f40(0x1a1)],..._0x181915[_0x205f40(0xf0)]?{'tool_calls':_0x181915[_0x205f40(0xf0)][_0x205f40(0xa8)]}:{},..._0x181915['tool_call_id']?{'tool_call_id':_0x181915[_0x205f40(0x157)]}:{}})),'request_content':{'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'repoRoot':a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'source':_0x205f40(0xaa)})['catch'](()=>{});}}else{if(_0x1e9c08[_0x205f40(0x17a)]===_0x205f40(0x120)&&_0x1e9c08[_0x205f40(0x19c)][_0x205f40(0xa8)]>0x0){const _0x12467a=_0x1e9c08[_0x205f40(0x19c)]['map'](_0xc43bb2=>_0xc43bb2[_0x205f40(0x14c)])[_0x205f40(0x126)](';\x20');_0x2fa726=_0x205f40(0xfc)+_0x12467a;const _0x401d9b=_0x12467a['toLowerCase']()[_0x205f40(0x18f)](_0x205f40(0xf2))||_0x12467a[_0x205f40(0x9b)]()[_0x205f40(0x18f)]('timed\x20out')||_0x12467a['toLowerCase']()[_0x205f40(0x18f)](_0x205f40(0x12d)),_0x17adbd=_0x1e9c08[_0x205f40(0x178)]?.['metadata']?.['files'],_0x548e3e=_0x1e9c08[_0x205f40(0x19c)][0x0];reportMorphError({'error_message':_0x12467a,'error_type':_0x401d9b?_0x205f40(0xd5):_0x548e3e?.[_0x205f40(0x188)]?.[_0x205f40(0xf9)]||_0x205f40(0x134),'context':{'tool':_0x205f40(0x102),'repo_path':_0x47fb36[_0x205f40(0xee)]['repo_path'],'query':_0x47fb36['data'][_0x205f40(0x16e)],'model':_0x205f40(0x14e),'termination_reason':_0x1e9c08[_0x205f40(0x17a)],'error_count':_0x1e9c08['errors'][_0x205f40(0xa8)],'is_timeout':_0x401d9b,'timings':_0x1e9c08[_0x205f40(0x8c)],'files_attempted':_0x17adbd?.[_0x205f40(0x171)](_0x11353f=>({'path':_0x11353f[_0x205f40(0xcc)],'lines':_0x11353f[_0x205f40(0xae)]})),'tool_calls':_0xd5874c(_0x1e9c08[_0x205f40(0xfe)]),'messages':_0x1e9c08['messages']?.[_0x205f40(0x171)](_0x3d5553=>({'role':_0x3d5553['role'],'content':_0x3d5553[_0x205f40(0x1a1)],..._0x3d5553[_0x205f40(0xf0)]?{'tool_calls':_0x3d5553['tool_calls'][_0x205f40(0xa8)]}:{},..._0x3d5553[_0x205f40(0x157)]?{'tool_call_id':_0x3d5553[_0x205f40(0x157)]}:{}})),'request_content':{'query':_0x47fb36['data'][_0x205f40(0x16e)],'repo_path':_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)],'repoRoot':a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)]),'model':_0x205f40(0x14e)}},'stack_trace':_0x548e3e?.['stack']||undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{});}else _0x2fa726=_0x205f40(0x191);}return{'content':[{'type':_0x205f40(0x166),'text':_0x2fa726}]};}catch(_0x352c0e){const _0x5ea769=handleMorphAPIError(_0x352c0e);if(_0x5ea769)return logger['error']('MCP',_0x205f40(0xb6),{'tool':_0x205f40(0x102),'error':_0x205f40(0x12e),'latency_ms':Date[_0x205f40(0x111)]()-_0x16db6d}),_0x5ea769;const _0x51955f=_0x352c0e instanceof Error?_0x352c0e[_0x205f40(0x14c)]:String(_0x352c0e);logger['error'](_0x205f40(0x124),_0x205f40(0xb6),{'tool':_0x205f40(0x102),'error':_0x51955f,'repo_path':_0x47fb36['data'][_0x205f40(0xa4)],'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'latency_ms':Date[_0x205f40(0x111)]()-_0x16db6d});const _0x35ae96=_0x51955f['toLowerCase']()[_0x205f40(0x18f)](_0x205f40(0xf2))||_0x51955f[_0x205f40(0x9b)]()[_0x205f40(0x18f)](_0x205f40(0x16b))||_0x51955f[_0x205f40(0x9b)]()['includes'](_0x205f40(0x12d))||_0x352c0e instanceof Error&&_0x352c0e[_0x205f40(0xf9)]===_0x205f40(0xd5);return reportMorphError({'error_message':_0x51955f,'error_type':_0x35ae96?_0x205f40(0xd5):_0x352c0e instanceof Error?_0x352c0e[_0x205f40(0x188)][_0x205f40(0xf9)]:_0x205f40(0x161),'context':{'tool':'codebase_search','repo_path':_0x47fb36['data']['repo_path'],'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'model':'morph-warp-grep-v2.1','is_timeout':_0x35ae96,'exception_phase':_0x205f40(0x186),'request_content':{'query':_0x47fb36[_0x205f40(0xee)][_0x205f40(0x16e)],'repo_path':_0x47fb36[_0x205f40(0xee)]['repo_path'],'repoRoot':a0_0xc22154[_0x205f40(0x98)](_0x47fb36[_0x205f40(0xee)][_0x205f40(0xa4)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x352c0e instanceof Error?_0x352c0e[_0x205f40(0x152)]:undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x51955f}],'isError':![]};}}case TOOL_NAMES[_0x205f40(0x15f)]:{const _0x334992=WarpGrepGitHubArgsSchema[_0x205f40(0xb1)](_0x1cbe99);if(!_0x334992['success'])return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x139)+_0x334992[_0x205f40(0xd3)]}],'isError':!![]};const _0xe2198f=_0x334992[_0x205f40(0xee)][_0x205f40(0x17b)]||_0x334992[_0x205f40(0xee)][_0x205f40(0x196)];if(!_0xe2198f)return{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0x16d)}],'isError':!![]};const _0x14c3cf=MORPH_API_KEY;if(!_0x14c3cf)throw new Error(_0x205f40(0x9f));const _0x57f4b2=Date[_0x205f40(0x111)]();logger[_0x205f40(0xd1)](_0x205f40(0x124),_0x205f40(0xab),{'identifier':_0xe2198f,'query':_0x334992[_0x205f40(0xee)][_0x205f40(0x16e)],'branch':_0x334992['data'][_0x205f40(0xb9)]});try{const _0x126017=new WarpGrepClient({'morphApiKey':_0x14c3cf,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x179a72=await _0x126017['searchGitHub']({'searchTerm':_0x334992[_0x205f40(0xee)][_0x205f40(0x16e)],'github':_0xe2198f,'branch':_0x334992[_0x205f40(0xee)][_0x205f40(0xb9)]}),_0x74e2a1=Date['now']()-_0x57f4b2;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x74e2a1+_0x205f40(0x18a)+_0x179a72[_0x205f40(0x12f)]);const _0x4858f7=formatResult(_0x179a72);return{'content':[{'type':'text','text':_0x4858f7}]};}catch(_0x3b769f){const _0x396d28=handleMorphAPIError(_0x3b769f);if(_0x396d28)return _0x396d28;const _0x44736e=Date['now']()-_0x57f4b2,_0x4e6bbe=_0x3b769f instanceof Error?_0x3b769f[_0x205f40(0x14c)]:String(_0x3b769f);return logMcpStderr(_0x205f40(0x123)+_0x44736e+_0x205f40(0xbc),_0x4e6bbe),reportMorphError({'error_message':_0x4e6bbe,'error_type':_0x3b769f instanceof Error?_0x3b769f[_0x205f40(0x188)]['name']:_0x205f40(0x161),'context':{'tool':'github_codebase_search','github_url':_0xe2198f,'search_string':_0x334992['data']['search_string'],'branch':_0x334992[_0x205f40(0xee)]['branch']},'stack_trace':_0x3b769f instanceof Error?_0x3b769f['stack']:undefined,'source':_0x205f40(0xaa),'tool':'github_codebase_search','latency_ms':_0x44736e})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0xb8)+_0x4e6bbe}],'isError':![]};}}default:throw new Error(_0x205f40(0x169)+_0x243636);}}catch(_0x1d13fe){const _0x1a1922=_0x1d13fe instanceof Error?_0x1d13fe[_0x205f40(0x14c)]:String(_0x1d13fe);return reportMorphError({'error_message':_0x1a1922,'error_type':_0x1d13fe instanceof Error?_0x1d13fe[_0x205f40(0x188)][_0x205f40(0xf9)]:_0x205f40(0x161),'context':{'tool':_0x243636,'arguments':_0x1cbe99?JSON['stringify'](_0x1cbe99)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x205f40(0x99)},'stack_trace':_0x1d13fe instanceof Error?_0x1d13fe[_0x205f40(0x152)]:undefined,'source':_0x205f40(0xaa)})[_0x205f40(0x145)](()=>{}),{'content':[{'type':_0x205f40(0x166),'text':_0x205f40(0xfc)+_0x1a1922}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3b71eb){const _0x4a367f=a0_0x35c683,_0x33820e=await getValidRootDirectories(_0x3b71eb);if(_0x33820e[_0x4a367f(0xa8)]>0x0)allowedDirectories=[..._0x33820e],logMcpStderr(_0x4a367f(0x164)+_0x33820e['length']+'\x20valid\x20directories');else{logMcpStderr('No\x20valid\x20root\x20directories\x20provided\x20by\x20client');if(ENABLE_WORKSPACE_MODE)try{const _0x2b7bcd=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x2b7bcd&&(allowedDirectories=[_0x2b7bcd],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x2b7bcd));}catch(_0x1ceeb1){logMcpStderr(_0x4a367f(0x1a6)+_0x1ceeb1);}}}server[a0_0x35c683(0xef)](RootsListChangedNotificationSchema,async()=>{const _0x55bdfe=a0_0x35c683;try{const _0x1b1916=await server[_0x55bdfe(0x149)]();_0x1b1916&&'roots'in _0x1b1916&&await updateAllowedDirectoriesFromRoots(_0x1b1916[_0x55bdfe(0xe7)]);}catch(_0x40b5b5){logMcpStderr(_0x55bdfe(0x168),_0x40b5b5 instanceof Error?_0x40b5b5[_0x55bdfe(0x14c)]:String(_0x40b5b5));}}),server[a0_0x35c683(0x181)]=async()=>{const _0x5adac1=a0_0x35c683,_0x3deb55=server[_0x5adac1(0x10f)]();if(_0x3deb55?.[_0x5adac1(0xe7)])try{const _0x4ec39f=await server[_0x5adac1(0x149)]();_0x4ec39f&&_0x5adac1(0xe7)in _0x4ec39f?await updateAllowedDirectoriesFromRoots(_0x4ec39f[_0x5adac1(0xe7)]):logMcpStderr(_0x5adac1(0xb7));}catch(_0x1449e7){logMcpStderr(_0x5adac1(0xb2),_0x1449e7 instanceof Error?_0x1449e7[_0x5adac1(0x14c)]:String(_0x1449e7));}else{if(allowedDirectories[_0x5adac1(0xa8)]>0x0)logMcpStderr(_0x5adac1(0x8e),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5adac1(0x19b));else throw new Error(_0x5adac1(0x95));}}};async function runServer(){const _0x2d3a88=a0_0x35c683,_0x1469c5=new StdioServerTransport();await server[_0x2d3a88(0xc6)](_0x1469c5),logMcpStderr(_0x2d3a88(0xc7)),allowedDirectories['length']===0x0&&logMcpStderr(_0x2d3a88(0x10e));}runServer()[a0_0x35c683(0x145)](_0x128ef5=>{const _0x5d64a1=a0_0x35c683;logMcpStderr(_0x5d64a1(0x170),_0x128ef5),process[_0x5d64a1(0x146)](0x1);});
2
+ const a0_0x3e026d=a0_0x3579;(function(_0x361e28,_0x44e5f3){const _0x4cb00e=a0_0x3579,_0x5cf58a=_0x361e28();while(!![]){try{const _0x3bf7d8=-parseInt(_0x4cb00e(0x1e0))/0x1*(parseInt(_0x4cb00e(0x18c))/0x2)+parseInt(_0x4cb00e(0x1d6))/0x3*(parseInt(_0x4cb00e(0x103))/0x4)+parseInt(_0x4cb00e(0x16e))/0x5*(-parseInt(_0x4cb00e(0x11d))/0x6)+-parseInt(_0x4cb00e(0x12c))/0x7+parseInt(_0x4cb00e(0x1a6))/0x8*(parseInt(_0x4cb00e(0x1e5))/0x9)+parseInt(_0x4cb00e(0xe7))/0xa+parseInt(_0x4cb00e(0x18a))/0xb;if(_0x3bf7d8===_0x44e5f3)break;else _0x5cf58a['push'](_0x5cf58a['shift']());}catch(_0x9893f){_0x5cf58a['push'](_0x5cf58a['shift']());}}}(a0_0xf1bd,0xcd78f));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';function a0_0x3579(_0x4085db,_0x5150e0){_0x4085db=_0x4085db-0xd9;const _0xf1bd68=a0_0xf1bd();let _0x3579bd=_0xf1bd68[_0x4085db];return _0x3579bd;}import a0_0x25800f from'fs/promises';import a0_0x5748e1 from'path';function a0_0xf1bd(){const _0x5b6d35=['DISABLED_TOOLS','ENABLE_WORKSPACE_MODE','join','role','RipgrepNotAvailable','new_string','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','file_read_complete','assistant','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','object','Workspace\x20mode\x20enabled:\x20Using\x20','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','string','8093975IGARkg','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','path_validation_start','user','error','MORPH_LARGE_APPLY','readFile','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','getClientCapabilities','MCP','status','every','pyproject.toml','Unknown\x20tool:\x20','parse','Here\x20is\x20the\x20content\x20of\x20files:\x0a','Relevant\x20context\x20found:','0.2.0','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','morph-warp-grep-v2.1','github_codebase_search','\x20-\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','some','grep_search','name','messages','8123170Johgpf','FileReadError','222460gdbrXL','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','warn','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.','API\x20error\x20(auth/rate-limit)','github_search_start','file_path','content','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','morph-v3-fast','debug','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','optional','.git','log','isArray','catch','\x22>\x0a','composer.json','GitHub\x20search\x20failed:\x20','sep','path','substring','.cursor','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','MORPH_API_URL','8AJuysj','split','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','message','.vscode','filter','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','etimedout','grep\x20\x27','[github_codebase_search]\x20Done\x20in\x20','Warning:\x20Workspace\x20fallback\x20failed:\x20','glob','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','false','stringify','payload',',\x20removed\x20',',\x20modified\x20','list_directory\x20','\x0aOptions:','\x20is\x20not\x20a\x20directory','Unknown\x20error','setRequestHandler','FileNotFound','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','search_type','\x20as\x20allowed\x20directory','describe','startsWith','Failed\x20to\x20request\x20roots\x20from\x20client:','Morph\x20Edit\x20Preview','map','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x0aExamples:','listRoots','EDIT_FILE','linesModified','tool_call_received','../package.json','-\x20Preserve\x20exact\x20indentation\x0a','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Error\x20running\x20fast\x20context\x20search:\x20','timeout','morph-v3-large','resolve','toISOString','-\x20Grepped\x20\x27','node_modules','255RRZOPY','added\x20','MORPH_API_KEY','cwd','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','RipgrepError','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','success','provider_created','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','5deSVTi','has','@morphllm/morphmcp\x20','ms.\x20Success:\x20','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','9113049wLKGfH','boolean','instruction','compaction_failed','-\x20Glob\x20search\x20`','ReadError','codebase_search','Disabled\x20tools:\x20','file','package.json','tool_call_complete','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','Morph\x20FastApply\x20failed\x20without\x20error\x20message','requiresApiKey','turns','WarpGrep\x20sub-tool\x20errors:\x20','PWD','SymlinkError','branch','\x27\x20in\x20`','pattern','instructions','array','<file\x20path=\x22','command','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.','function','now','text','.\x20Path:\x20','mcp-filesystem','repo_path','path_validation_resolved','path_validation_failed','Max\x20results\x20to\x20return','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','api-key','includes','lines','push','.\x20Changes:\x20','Cargo.toml','4783830VOcxZe','ENOENT','realpath','timed\x20out','tool_calls','go.mod','version','dryRun','env','\x20disabled\x20via\x20DISABLED_TOOLS','params','unknown','Preview\x20changes\x20without\x20applying\x20them.','stat','sk-','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','tool','homedir','read','tool_call_id','arguments','files','application/json','description','Invalid\x20arguments:\x20','completed_with_file_errors','code','MORPH_WARP_GREP_TIMEOUT','59676gAjqXF','indexOf','\x0a...\x20(truncated,\x20total:\x20','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','Fallback:\x20Using\x20workspace\x20root\x20','utf-8','filePath','errors','read\x20','length','tool_call_error','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','unknown\x20error','oninitialized','response','linesAdded','source','Error:\x20','BinaryFile','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','search_string','Tool\x20','[github_codebase_search]\x20Failed\x20in\x20','context','[could\x20not\x20read\x20file:\x20','github_url','6ZJXztj','constructor','searchGitHub','code_edit','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','-\x20Read\x20file\x20`','exit','dirname','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','slice','grep','Morph\x20Edit\x20','https://morphllm.com/api/error-report','number','data','3366783wbSicL','list_directory','enum','TimeoutError','`\x20in\x20`','Error\x20accessing\x20directory\x20','morph-','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','SubToolError','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','roots','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.','CODEBASE_SEARCH','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Parameters:\x0a','WarpGrepError','LocalRipgrepProvider','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','finish','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','\x0a</file>','ToolException','size','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','\x20(new\x20file)','default','Bearer\x20','safeParse','all','file_read_failed','toLowerCase','metadata','stack','linesRemoved','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','timings','\x20valid\x20directories','❌\x20Morph\x20Edit\x20Failed:\x20','Parent\x20directory\x20does\x20not\x20exist:\x20','terminationReason','glob\x20\x27','basename','UnknownError','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','edit_file','Warning:\x20','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Created\x20File','PathError','\x20error(s)','setNotificationHandler','Fatal\x20error\x20running\x20server:'];a0_0xf1bd=function(){return _0x5b6d35;};return a0_0xf1bd();}import a0_0x4003c7 from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x1840de from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x5552c4){const _0x472176=a0_0x3579,_0x347efb=_0x5552c4[_0x472176(0x1a7)](a0_0x5748e1['sep'])[_0x472176(0x1ab)](Boolean);if(_0x347efb[_0x472176(0x10c)]<0x2)return null;for(let _0x7128bf=Math['floor'](_0x347efb['length']/0x2);_0x7128bf>=0x1;_0x7128bf--){for(let _0x5e757c=0x0;_0x5e757c<=_0x347efb[_0x472176(0x10c)]-0x2*_0x7128bf;_0x5e757c++){const _0x5c2c9c=_0x347efb[_0x472176(0x126)](_0x5e757c,_0x5e757c+_0x7128bf),_0x11d00d=_0x347efb['slice'](_0x5e757c+_0x7128bf,_0x5e757c+0x2*_0x7128bf);if(_0x5c2c9c[_0x472176(0x179)]((_0x216d12,_0x283caf)=>_0x216d12===_0x11d00d[_0x283caf])){const _0x305bf7=[..._0x347efb['slice'](0x0,_0x5e757c),..._0x347efb[_0x472176(0x126)](_0x5e757c+_0x7128bf)];return a0_0x5748e1[_0x472176(0x1a0)]+_0x305bf7['join'](a0_0x5748e1[_0x472176(0x1a0)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x449866=a0_0x3579;try{const _0x117c91=require(_0x449866(0x1cc));return _0x117c91[_0x449866(0xed)]??_0x449866(0xf2);}catch(_0x538896){return logMcpStderr(_0x449866(0x175),_0x538896),'unknown';}}function printHelp(){const _0x3b3d1f=a0_0x3579;console[_0x3b3d1f(0x19a)](_0x3b3d1f(0x1e2)+getPackageVersion()),console[_0x3b3d1f(0x19a)](_0x3b3d1f(0x15a)),console[_0x3b3d1f(0x19a)](_0x3b3d1f(0x1b9)),console[_0x3b3d1f(0x19a)](_0x3b3d1f(0x135)),console[_0x3b3d1f(0x19a)](_0x3b3d1f(0x139)),console['log'](_0x3b3d1f(0x184)),console['log'](_0x3b3d1f(0x1c7)),console['log']('\x20\x20morph-mcp'),console[_0x3b3d1f(0x19a)](_0x3b3d1f(0x13f));}const cliArgs=process['argv'][a0_0x3e026d(0x126)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs['some'](_0x4ae0ed=>VERSION_FLAGS['has'](_0x4ae0ed))&&(console[a0_0x3e026d(0x19a)](a0_0x3e026d(0x1e2)+getPackageVersion()),process[a0_0x3e026d(0x123)](0x0));cliArgs[a0_0x3e026d(0x186)](_0x373f62=>HELP_FLAGS[a0_0x3e026d(0x1e1)](_0x373f62))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x1495f9){const _0x23ad23=a0_0x3e026d;for(let _0x4ec7a4=0x0;_0x4ec7a4<cliArgs[_0x23ad23(0x10c)];_0x4ec7a4++){const _0x55e4b0=cliArgs[_0x4ec7a4];if(_0x55e4b0[_0x23ad23(0x1c2)]('--'+_0x1495f9+'='))return _0x55e4b0[_0x23ad23(0x126)](('--'+_0x1495f9+'=')[_0x23ad23(0x10c)]);if(_0x55e4b0==='--'+_0x1495f9&&_0x4ec7a4+0x1<cliArgs[_0x23ad23(0x10c)])return cliArgs[_0x4ec7a4+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x3e026d(0x10c)];i++){const arg=cliArgs[i];if(VERSION_FLAGS['has'](arg)||HELP_FLAGS[a0_0x3e026d(0x1e1)](arg))continue;if(arg[a0_0x3e026d(0x1c2)]('--api-key='))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x3e026d(0xe4)](arg);}const WORKSPACE_ROOT=process[a0_0x3e026d(0xef)]['WORKSPACE_ROOT']||process[a0_0x3e026d(0xef)][a0_0x3e026d(0x1f5)]||process[a0_0x3e026d(0x1d9)](),ENABLE_WORKSPACE_MODE=process[a0_0x3e026d(0xef)][a0_0x3e026d(0x161)]!==a0_0x3e026d(0x1b3),MORPH_API_KEY=getCliArg(a0_0x3e026d(0xe1))??process[a0_0x3e026d(0xef)][a0_0x3e026d(0x1d8)],MORPH_API_URL=process['env'][a0_0x3e026d(0x1a5)],MORPH_LARGE_APPLY=process[a0_0x3e026d(0xef)][a0_0x3e026d(0x173)]!==a0_0x3e026d(0x1b3),MORPH_WARP_GREP_TIMEOUT=process[a0_0x3e026d(0xef)][a0_0x3e026d(0x102)]?parseInt(process[a0_0x3e026d(0xef)][a0_0x3e026d(0x102)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x3e026d(0xef)][a0_0x3e026d(0x160)]?new Set(process[a0_0x3e026d(0xef)][a0_0x3e026d(0x160)][a0_0x3e026d(0x1a7)](',')['map'](_0x3b7aec=>_0x3b7aec['trim']())[a0_0x3e026d(0x1ab)](_0x4f1b46=>_0x4f1b46[a0_0x3e026d(0x10c)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x3e026d(0x142)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console['error'](a0_0x3e026d(0x1df)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x3e026d(0x172)](a0_0x3e026d(0x1ec)+[...DISABLED_TOOLS][a0_0x3e026d(0x162)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x3e026d(0x1c2)](a0_0x3e026d(0xf5))&&!MORPH_API_KEY['startsWith'](a0_0x3e026d(0x132))&&logMcpStderr(a0_0x3e026d(0xe0));async function reportMorphError(_0x137b25){const _0x4c09f0=a0_0x3e026d;try{await a0_0x1840de['post'](_0x4c09f0(0x129),{..._0x137b25,'timestamp':new Date()[_0x4c09f0(0x1d3)](),'source':_0x137b25[_0x4c09f0(0x113)]||_0x4c09f0(0xdb),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x137b25[_0x4c09f0(0x11a)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x4c09f0(0xfd),'Authorization':_0x4c09f0(0x146)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1a1477,_0x337a17){const _0x2a358f=a0_0x3e026d;if(_0x1a1477&&typeof _0x1a1477===_0x2a358f(0x16a)&&_0x2a358f(0x178)in _0x1a1477)return _0x1a1477['status'];if(_0x1a1477&&typeof _0x1a1477==='object'&&_0x2a358f(0x111)in _0x1a1477)return _0x1a1477[_0x2a358f(0x111)]?.[_0x2a358f(0x178)];const _0x7cf7e7=_0x337a17['match'](/\b(401|429)\b/);return _0x7cf7e7?parseInt(_0x7cf7e7[0x1],0xa):null;}function handleMorphAPIError(_0x1042ee){const _0x39c68d=a0_0x3e026d,_0x358b8a=_0x1042ee instanceof Error?_0x1042ee[_0x39c68d(0x1a9)]:String(_0x1042ee),_0x3a13da=extractStatusCode(_0x1042ee,_0x358b8a);switch(_0x3a13da){case 0x191:return{'content':[{'type':_0x39c68d(0xd9),'text':_0x39c68d(0x1fe)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x39c68d(0xd9),'text':_0x39c68d(0x180)}],'isError':!![]};default:return null;}}args[a0_0x3e026d(0x10c)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr('Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]'),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x3e026d(0x1ce)),logMcpStderr(a0_0x3e026d(0x1dc)));function normalizePath(_0x221bdd){return a0_0x5748e1['normalize'](_0x221bdd);}function expandHome(_0x3f1e48){const _0x400a5d=a0_0x3e026d;if(_0x3f1e48[_0x400a5d(0x1c2)]('~/')||_0x3f1e48==='~')return a0_0x5748e1['join'](a0_0x4003c7[_0x400a5d(0xf8)](),_0x3f1e48['slice'](0x1));return _0x3f1e48;}let allowedDirectories=await Promise['all'](args[a0_0x3e026d(0x1c5)](async _0x59b1ce=>{const _0x290c5a=a0_0x3e026d,_0x2062d7=expandHome(_0x59b1ce),_0x1d9602=a0_0x5748e1['resolve'](_0x2062d7);try{const _0x3550e2=await a0_0x25800f[_0x290c5a(0xe9)](_0x1d9602);return normalizePath(_0x3550e2);}catch(_0x4881ab){return normalizePath(_0x1d9602);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x3e026d(0x10c)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x3e026d(0x16b)+workspaceDir+a0_0x3e026d(0x1c0)));}catch(a0_0x597f57){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x597f57);}async function detectWorkspaceRoot(_0x733549){const _0xb2735d=a0_0x3e026d;let _0xeb4337=a0_0x5748e1['resolve'](_0x733549);const _0x381734=[_0xb2735d(0x199),_0xb2735d(0x1aa),_0xb2735d(0x1ee),_0xb2735d(0xe6),_0xb2735d(0x17a),_0xb2735d(0xec),_0xb2735d(0x1a3),'tsconfig.json',_0xb2735d(0x19e)];while(_0xeb4337!==a0_0x5748e1[_0xb2735d(0x124)](_0xeb4337)){for(const _0xb891c8 of _0x381734){const _0x1c27e5=a0_0x5748e1[_0xb2735d(0x162)](_0xeb4337,_0xb891c8);try{return await a0_0x25800f['access'](_0x1c27e5),normalizePath(_0xeb4337);}catch{}}_0xeb4337=a0_0x5748e1[_0xb2735d(0x124)](_0xeb4337);}return normalizePath(_0x733549);}await Promise[a0_0x3e026d(0x148)](args[a0_0x3e026d(0x1c5)](async _0x52fdf7=>{const _0x23d92b=a0_0x3e026d;try{const _0x57c99a=await a0_0x25800f[_0x23d92b(0xf4)](expandHome(_0x52fdf7));!_0x57c99a['isDirectory']()&&(logMcpStderr(_0x23d92b(0x114)+_0x52fdf7+_0x23d92b(0x1ba)),process[_0x23d92b(0x123)](0x1));}catch(_0xf2539a){logMcpStderr(_0x23d92b(0x131)+_0x52fdf7+':',_0xf2539a),process['exit'](0x1);}}));async function validatePath(_0x14976b){const _0x5115d9=a0_0x3e026d,_0x4dbeaf=expandHome(_0x14976b),_0x590c0d=a0_0x5748e1['resolve'](_0x4dbeaf);logger[_0x5115d9(0x196)](_0x5115d9(0x177),_0x5115d9(0x170),{'raw_path':_0x14976b,'absolute':_0x590c0d});try{const _0x276656=await a0_0x25800f[_0x5115d9(0xe9)](_0x590c0d);return logger[_0x5115d9(0x196)](_0x5115d9(0x177),'path_validation_resolved',{'resolved':_0x276656,'symlink':_0x276656!==_0x590c0d}),_0x276656;}catch(_0x16f078){if(_0x16f078[_0x5115d9(0x101)]===_0x5115d9(0xe8)){const _0xff7f82=a0_0x5748e1['dirname'](_0x590c0d);try{const _0x2a305d=await a0_0x25800f[_0x5115d9(0xe9)](_0xff7f82),_0x6df898=a0_0x5748e1[_0x5115d9(0x162)](_0x2a305d,a0_0x5748e1[_0x5115d9(0x155)](_0x590c0d));return logger[_0x5115d9(0x196)](_0x5115d9(0x177),_0x5115d9(0xdd),{'resolved':_0x6df898,'new_file':!![]}),_0x6df898;}catch{logger[_0x5115d9(0x172)]('MCP',_0x5115d9(0xde),{'raw_path':_0x14976b,'error':_0x5115d9(0x152)+_0xff7f82});throw new Error(_0x5115d9(0x152)+_0xff7f82);}}logger['error'](_0x5115d9(0x177),'path_validation_failed',{'raw_path':_0x14976b,'error':_0x16f078[_0x5115d9(0x1a9)]});throw _0x16f078;}}const MorphEditFileArgsSchema=z[a0_0x3e026d(0x16a)]({'path':z[a0_0x3e026d(0x16d)](),'code_edit':z[a0_0x3e026d(0x16d)]()[a0_0x3e026d(0x1c1)](a0_0x3e026d(0x169)),'instruction':z[a0_0x3e026d(0x16d)]()[a0_0x3e026d(0x1c1)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0x3e026d(0x1e6)]()[a0_0x3e026d(0x145)](![])[a0_0x3e026d(0x1c1)](a0_0x3e026d(0xf3))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z[a0_0x3e026d(0x16a)]({'search_string':z[a0_0x3e026d(0x16d)]()[a0_0x3e026d(0x1c1)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x3e026d(0x16d)]()[a0_0x3e026d(0x1c1)](a0_0x3e026d(0x1a4)),'search_type':z[a0_0x3e026d(0x12e)]([a0_0x3e026d(0x145),a0_0x3e026d(0x1d5)])[a0_0x3e026d(0x198)]()['describe'](a0_0x3e026d(0x13d))}),WarpGrepGitHubArgsSchema=z[a0_0x3e026d(0x16a)]({'search_string':z[a0_0x3e026d(0x16d)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x3e026d(0x16d)]()[a0_0x3e026d(0x198)]()[a0_0x3e026d(0x1c1)]('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_0x3e026d(0x198)]()[a0_0x3e026d(0x1c1)](a0_0x3e026d(0x14e)),'branch':z['string']()[a0_0x3e026d(0x198)]()[a0_0x3e026d(0x1c1)](a0_0x3e026d(0xf6))}),CodebaseSearchArgsSchema=z[a0_0x3e026d(0x16a)]({'query':z[a0_0x3e026d(0x16d)]()[a0_0x3e026d(0x1c1)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x3e026d(0x16d)]()['describe']('Repository\x20identifier'),'branch':z[a0_0x3e026d(0x16d)]()['optional']()['describe'](a0_0x3e026d(0x16c)),'commitHash':z['string']()['optional']()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x3e026d(0x1fb)](z[a0_0x3e026d(0x16d)]())[a0_0x3e026d(0x145)]([])[a0_0x3e026d(0x1c1)](a0_0x3e026d(0x16f)),'limit':z[a0_0x3e026d(0x12a)]()[a0_0x3e026d(0x198)]()[a0_0x3e026d(0x145)](0xa)[a0_0x3e026d(0x1c1)](a0_0x3e026d(0xdf))}),server=new Server({'name':'morph-mcp','version':a0_0x3e026d(0x17f)},{'capabilities':{'tools':{}}});server[a0_0x3e026d(0x1bc)](ListToolsRequestSchema,async()=>{const _0x48906f=a0_0x3e026d,_0x5774c4=[{'name':TOOL_NAMES[_0x48906f(0x1c9)],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a'+_0x48906f(0x13a)+_0x48906f(0x106)+_0x48906f(0x185)+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+_0x48906f(0x194)+'Example\x20format:\x0a'+_0x48906f(0x121)+'Rules:\x0a'+_0x48906f(0x1a8)+_0x48906f(0x1cd)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x48906f(0x10e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x48906f(0x138)],'description':_0x48906f(0x1f0)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x48906f(0x1ac)+_0x48906f(0x157)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3f3979=_0x5774c4[_0x48906f(0x1ab)](_0x41769d=>{const _0x34eeee=_0x48906f;if(DISABLED_TOOLS[_0x34eeee(0x1e1)](_0x41769d[_0x34eeee(0x188)]))return console[_0x34eeee(0x172)](_0x34eeee(0x118)+_0x41769d['name']+_0x34eeee(0xf0)),![];if(_0x34eeee(0x1f2)in _0x41769d&&_0x41769d[_0x34eeee(0x1f2)]&&!MORPH_API_KEY)return logMcpStderr(_0x34eeee(0x159)+_0x41769d['name']+_0x34eeee(0x1da)),![];return!![];});return{'tools':_0x3f3979['map'](_0x2dee15=>({'name':_0x2dee15[_0x48906f(0x188)],'description':_0x2dee15[_0x48906f(0xfe)],'inputSchema':_0x2dee15['inputSchema']}))};}),server[a0_0x3e026d(0x1bc)](CallToolRequestSchema,async _0x16aaa8=>{const _0x14b0d9=a0_0x3e026d,{name:_0x16603f,arguments:_0x1888ae}=_0x16aaa8[_0x14b0d9(0xf1)],_0x341237=Date[_0x14b0d9(0x200)]();logger[_0x14b0d9(0x196)]('MCP',_0x14b0d9(0x1cb),{'tool':_0x16603f,'args':_0x16603f===_0x14b0d9(0x158)?{'path':_0x1888ae?.[_0x14b0d9(0x1a1)],'instruction':_0x1888ae?.[_0x14b0d9(0x1e7)]||_0x1888ae?.[_0x14b0d9(0x1fa)],'dryRun':_0x1888ae?.[_0x14b0d9(0xee)]}:_0x1888ae});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x14b0d9(0xd9),'text':'No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.'}],'isError':!![]};if(!MORPH_API_KEY[_0x14b0d9(0x1c2)]('sk-')&&!MORPH_API_KEY['startsWith'](_0x14b0d9(0x132)))return{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0x137)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x16603f))return{'content':[{'type':_0x14b0d9(0xd9),'text':'Tool\x20\x22'+_0x16603f+_0x14b0d9(0x1e4)}],'isError':![]};switch(_0x16603f){case TOOL_NAMES[_0x14b0d9(0x1c9)]:{let _0x1c75f5=_0x1888ae;if(_0x1c75f5&&typeof _0x1c75f5==='object'){if(!('path'in _0x1c75f5)){const _0x2d688c=_0x1c75f5['target_file']??_0x1c75f5[_0x14b0d9(0x109)]??_0x1c75f5['target_filepath']??_0x1c75f5[_0x14b0d9(0x192)]??_0x1c75f5[_0x14b0d9(0x1ed)];if(_0x2d688c)_0x1c75f5={..._0x1c75f5,'path':_0x2d688c};}'instructions'in _0x1c75f5&&!(_0x14b0d9(0x1e7)in _0x1c75f5)&&(_0x1c75f5={..._0x1c75f5,'instruction':_0x1c75f5[_0x14b0d9(0x1fa)]});if(!(_0x14b0d9(0x120)in _0x1c75f5)){const _0x59457f=_0x1c75f5[_0x14b0d9(0x101)]??_0x1c75f5[_0x14b0d9(0x165)]??_0x1c75f5[_0x14b0d9(0x193)]??_0x1c75f5['edit'];if(_0x59457f)_0x1c75f5={..._0x1c75f5,'code_edit':_0x59457f};}}const _0x122f22=MorphEditFileArgsSchema['safeParse'](_0x1c75f5);if(!_0x122f22[_0x14b0d9(0x1dd)])throw new Error(_0x14b0d9(0x1c6)+_0x122f22[_0x14b0d9(0x172)]);const _0x3a7301=await validatePath(_0x122f22['data'][_0x14b0d9(0x1a1)]);let _0x592f59=null,_0x148f34=!![],_0x34911c=null;try{_0x592f59=await a0_0x25800f[_0x14b0d9(0x174)](_0x3a7301,_0x14b0d9(0x108)),logger['debug'](_0x14b0d9(0x177),_0x14b0d9(0x167),{'path':_0x3a7301,'size_bytes':_0x592f59['length']});}catch(_0x2e84cf){const _0x4cf8fa=_0x2e84cf['code'];_0x4cf8fa===_0x14b0d9(0xe8)?(_0x148f34=![],_0x592f59='',logger['debug'](_0x14b0d9(0x177),'file_read_complete',{'path':_0x3a7301,'exists':![]})):(_0x34911c='Failed\x20to\x20read\x20file:\x20'+(_0x4cf8fa||'unknown')+_0x14b0d9(0x183)+(_0x2e84cf instanceof Error?_0x2e84cf[_0x14b0d9(0x1a9)]:String(_0x2e84cf)),logger[_0x14b0d9(0x172)](_0x14b0d9(0x177),_0x14b0d9(0x149),{'path':_0x3a7301,'error':_0x34911c}),logMcpStderr('Warning:\x20'+_0x34911c));}let _0x7a42a0;try{const _0x71b95c=MORPH_API_KEY;if(!_0x71b95c)throw new Error(_0x14b0d9(0x18d));const _0x41c91f=a0_0x5748e1[_0x14b0d9(0x124)](_0x3a7301),_0x340ad4=a0_0x5748e1[_0x14b0d9(0x155)](_0x3a7301);logger[_0x14b0d9(0x196)](_0x14b0d9(0x177),'api_request_start',{'model':_0x14b0d9(0x195),'path':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x1a1)],'instruction_len':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x1e7)][_0x14b0d9(0x10c)],'code_edit_len':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x120)][_0x14b0d9(0x10c)],'original_code_len':_0x592f59?.[_0x14b0d9(0x10c)]??0x0,'dry_run':_0x122f22['data'][_0x14b0d9(0xee)]});const _0x121395=Date['now'](),_0xe42830=await executeEditFile({'target_filepath':_0x340ad4,'code_edit':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x120)],'instruction':_0x122f22[_0x14b0d9(0x12b)]['instruction']},{'morphApiKey':_0x71b95c,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x41c91f,'autoWrite':!_0x122f22['data']['dryRun'],'generateUdiff':![],'debug':![]}),_0x4dd9d1=Date['now']()-_0x121395;_0x7a42a0=_0xe42830['completionId'];if(!_0xe42830['success'])throw new Error(_0xe42830['error']||_0x14b0d9(0x1f1));const _0xdf137f=_0xe42830['changes'],_0x1d6689=_0x14b0d9(0x1d7)+_0xdf137f[_0x14b0d9(0x112)]+_0x14b0d9(0x1b6)+_0xdf137f['linesRemoved']+_0x14b0d9(0x1b7)+_0xdf137f[_0x14b0d9(0x1ca)];logger[_0x14b0d9(0x196)](_0x14b0d9(0x177),_0x14b0d9(0x1ef),{'tool':_0x14b0d9(0x158),'success':!![],'latency_ms':Date[_0x14b0d9(0x200)]()-_0x341237,'edit_latency_ms':_0x4dd9d1,'changes':{'added':_0xdf137f[_0x14b0d9(0x112)],'removed':_0xdf137f[_0x14b0d9(0x14d)],'modified':_0xdf137f[_0x14b0d9(0x1ca)]},'completion_id':_0x7a42a0});if(_0x122f22[_0x14b0d9(0x12b)]['dryRun'])return{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0x1c4)+(_0x148f34?'':_0x14b0d9(0x144))+':\x20'+_0x122f22['data']['instruction']+'.\x20Changes:\x20'+_0x1d6689+'.\x20Path:\x20'+_0x122f22[_0x14b0d9(0x12b)]['path']+'.'}]};return{'content':[{'type':'text','text':_0x14b0d9(0x128)+(_0x148f34?'Applied':_0x14b0d9(0x15b))+':\x20'+_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x1e7)]+_0x14b0d9(0xe5)+_0x1d6689+_0x14b0d9(0xda)+_0x122f22[_0x14b0d9(0x12b)]['path']+'.'}]};}catch(_0x1a927d){const _0x1337d5=handleMorphAPIError(_0x1a927d);if(_0x1337d5)return logger[_0x14b0d9(0x172)](_0x14b0d9(0x177),_0x14b0d9(0x10d),{'tool':'edit_file','error':_0x14b0d9(0x190),'latency_ms':Date[_0x14b0d9(0x200)]()-_0x341237}),_0x1337d5;const _0x20daf7=_0x1a927d instanceof Error?_0x1a927d[_0x14b0d9(0x1a9)]:String(_0x1a927d);return logger[_0x14b0d9(0x172)](_0x14b0d9(0x177),_0x14b0d9(0x10d),{'tool':'edit_file','error':_0x20daf7,'path':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x1a1)],'validated_path':_0x3a7301,'latency_ms':Date[_0x14b0d9(0x200)]()-_0x341237,'stack':_0x1a927d instanceof Error?_0x1a927d['stack']:undefined}),reportMorphError({'error_message':_0x20daf7,'error_type':_0x1a927d instanceof Error?_0x1a927d[_0x14b0d9(0x11e)][_0x14b0d9(0x188)]:_0x14b0d9(0x156),'context':{'tool':_0x14b0d9(0x158),'completion_id':_0x7a42a0,'file_path':_0x122f22[_0x14b0d9(0x12b)]['path'],'validated_path':_0x3a7301,'instruction':_0x122f22['data'][_0x14b0d9(0x1e7)],'model':MORPH_LARGE_APPLY?_0x14b0d9(0x1d1):_0x14b0d9(0x195),'dry_run':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0xee)],'file_exists':_0x148f34,'file_read_error':_0x34911c,'file_readable':_0x592f59!==null,'request_content':{'path':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x1a1)],'code_edit':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x120)],'instruction':_0x122f22[_0x14b0d9(0x12b)][_0x14b0d9(0x1e7)],'original_code':_0x592f59!==null?_0x592f59[_0x14b0d9(0x10c)]>0xc350?_0x592f59['substring'](0x0,0xc350)+_0x14b0d9(0x105)+_0x592f59['length']+'\x20chars)':_0x592f59:_0x14b0d9(0x11b)+(_0x34911c||_0x14b0d9(0x10f))+']','original_code_length':_0x592f59?.[_0x14b0d9(0x10c)]??0x0,'model':MORPH_LARGE_APPLY?_0x14b0d9(0x1d1):_0x14b0d9(0x195),'dry_run':_0x122f22['data'][_0x14b0d9(0xee)]}},'stack_trace':_0x1a927d instanceof Error?_0x1a927d[_0x14b0d9(0x14c)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0x151)+_0x20daf7}],'isError':!![]};}}case TOOL_NAMES[_0x14b0d9(0x138)]:{const _0x38c771=WarpGrepArgsSchema[_0x14b0d9(0x147)](_0x1888ae);if(!_0x38c771[_0x14b0d9(0x1dd)])return{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0xff)+_0x38c771[_0x14b0d9(0x172)]}],'isError':!![]};const _0x300a94=_0x522c4b=>{const _0x4467e4=_0x14b0d9,_0xb9ab76=[];for(const _0x2630ec of _0x522c4b||[]){if(_0x2630ec[_0x4467e4(0x163)]===_0x4467e4(0x168)&&Array[_0x4467e4(0x19b)](_0x2630ec['tool_calls']))for(const _0x134ab1 of _0x2630ec['tool_calls']){try{const _0x461b1a=_0x134ab1[_0x4467e4(0x1ff)]?.[_0x4467e4(0x188)],_0x50cd2d=JSON['parse'](_0x134ab1['function']?.['arguments']||'{}');if(_0x461b1a===_0x4467e4(0x187))_0xb9ab76['push'](_0x4467e4(0x1ae)+_0x50cd2d[_0x4467e4(0x1f9)]+'\x27\x20'+(_0x50cd2d[_0x4467e4(0x1a1)]||'.'));else{if(_0x461b1a===_0x4467e4(0xf9))_0xb9ab76[_0x4467e4(0xe4)](_0x4467e4(0x10b)+_0x50cd2d['path']);else{if(_0x461b1a==='list_directory')_0xb9ab76[_0x4467e4(0xe4)](_0x4467e4(0x1b8)+(_0x50cd2d[_0x4467e4(0x1fd)]||'.'));else{if(_0x461b1a===_0x4467e4(0x1b1))_0xb9ab76['push'](_0x4467e4(0x154)+_0x50cd2d[_0x4467e4(0x1f9)]+'\x27\x20'+(_0x50cd2d[_0x4467e4(0x1a1)]||'.'));else _0x461b1a===_0x4467e4(0x13e)&&_0xb9ab76[_0x4467e4(0xe4)](_0x4467e4(0x13e));}}}}catch{}}}return _0xb9ab76;},_0x42a8cd=_0x5c0123=>{const _0x1249e6=_0x14b0d9,_0x1fe563=[];if(!_0x5c0123||!Array['isArray'](_0x5c0123))return _0x1fe563;const _0x4710ef=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x1249e6(0x1bd),'tool':_0x1249e6(0xf9)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x1249e6(0x15c),'tool':_0x1249e6(0xf9)},{'pattern':/\[READ ERROR\]/,'error_type':_0x1249e6(0x1ea),'tool':_0x1249e6(0xf9)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x1249e6(0x115),'tool':_0x1249e6(0xf9)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x1249e6(0x1db),'tool':_0x1249e6(0x127)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x1249e6(0x164),'tool':_0x1249e6(0x127)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x1249e6(0x115),'tool':_0x1249e6(0xf9)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x1249e6(0xf9)},{'pattern':/not a text file/,'error_type':_0x1249e6(0x115),'tool':'read'},{'pattern':/symbolic link/,'error_type':_0x1249e6(0x1f6),'tool':'read'},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x1249e6(0xf9)},{'pattern':/status="error"/,'error_type':_0x1249e6(0x141),'tool':_0x1249e6(0xf2)}];let _0x27dfaf=0x0;for(const _0xde8bde of _0x5c0123){_0xde8bde[_0x1249e6(0x163)]===_0x1249e6(0x168)&&Array['isArray'](_0xde8bde['tool_calls'])&&_0x27dfaf++;const _0x22dfa7=_0xde8bde[_0x1249e6(0x193)];if((_0xde8bde[_0x1249e6(0x163)]===_0x1249e6(0xf7)||_0xde8bde[_0x1249e6(0x163)]===_0x1249e6(0x171))&&_0x22dfa7&&typeof _0x22dfa7===_0x1249e6(0x16d))for(const {pattern:_0x262d84,error_type:_0x3d3fae,tool:_0x1428aa}of _0x4710ef){const _0x312d56=_0x22dfa7['match'](new RegExp(_0x262d84[_0x1249e6(0x113)],'g'));if(_0x312d56)for(const _0x591b28 of _0x312d56){const _0xb49356=_0x22dfa7[_0x1249e6(0x104)](_0x591b28),_0x3d6832=_0x22dfa7[_0x1249e6(0x1a2)](_0xb49356,Math['min'](_0xb49356+0xc8,_0x22dfa7['length']));_0x1fe563[_0x1249e6(0xe4)]({'tool':_0x1428aa,'error_type':_0x3d3fae,'error_message':_0x3d6832[_0x1249e6(0x1a7)]('\x0a')[0x0],'turn':_0x27dfaf});}}}return _0x1fe563;};try{const _0x5d62a7=a0_0x5748e1[_0x14b0d9(0x1d2)](_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)]),_0x417c25=_0x38c771['data'][_0x14b0d9(0x1bf)],_0x1ebe4d=_0x417c25===_0x14b0d9(0x1d5)?{'allowNames':[_0x14b0d9(0x1d5)]}:undefined,_0x524007=new LocalRipgrepProvider(_0x5d62a7,undefined,_0x1ebe4d);logger[_0x14b0d9(0x196)]('MCP',_0x14b0d9(0x1de),{'type':_0x14b0d9(0x13c),'repo_root':_0x5d62a7,'search_type':_0x417c25||_0x14b0d9(0x145)}),logger[_0x14b0d9(0x196)](_0x14b0d9(0x177),'warp_grep_start',{'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'repo_root':_0x5d62a7,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x3d8956=Date[_0x14b0d9(0x200)](),_0x5310c3=await runWarpGrep({'searchTerm':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'repoRoot':_0x5d62a7,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x524007,'search_type':_0x417c25}),_0x50ec21=Date['now']()-_0x3d8956,_0x548019=_0x5310c3[_0x14b0d9(0x13e)]?.[_0x14b0d9(0x14b)]?.['files']?.['length']??0x0;logger['debug'](_0x14b0d9(0x177),'warp_grep_complete',{'termination':_0x5310c3[_0x14b0d9(0x153)],'turns':_0x5310c3[_0x14b0d9(0x14f)]?.[_0x14b0d9(0x1f3)]??0x0,'files_found':_0x548019,'latency_ms':_0x50ec21});const _0x2d0523=_0x42a8cd(_0x5310c3[_0x14b0d9(0x189)]);_0x2d0523['length']>0x0&&reportMorphError({'error_message':_0x14b0d9(0x1f4)+_0x2d0523[_0x14b0d9(0x10c)]+_0x14b0d9(0x15d),'error_type':_0x14b0d9(0x134),'level':_0x14b0d9(0x18e),'tool':'codebase_search','context':{'repo_path':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'model':'morph-warp-grep-v2.1','termination_reason':_0x5310c3[_0x14b0d9(0x153)],'sub_tool_errors':_0x2d0523,'timings':_0x5310c3['timings'],'tool_calls':_0x300a94(_0x5310c3[_0x14b0d9(0x189)]),'messages':_0x5310c3[_0x14b0d9(0x189)]?.[_0x14b0d9(0x1c5)](_0x5a1434=>({'role':_0x5a1434[_0x14b0d9(0x163)],'content':_0x5a1434['content'],..._0x5a1434[_0x14b0d9(0xeb)]?{'tool_calls':_0x5a1434[_0x14b0d9(0xeb)]['length']}:{},..._0x5a1434[_0x14b0d9(0xfa)]?{'tool_call_id':_0x5a1434[_0x14b0d9(0xfa)]}:{}}))},'source':'mcp-filesystem'})['catch'](()=>{});let _0x2330a6='';if(_0x5310c3['terminationReason']==='completed'&&_0x5310c3['finish']?.[_0x14b0d9(0x14b)]?.[_0x14b0d9(0xfc)]){const _0x50f4f0=_0x5310c3[_0x14b0d9(0x13e)][_0x14b0d9(0x14b)][_0x14b0d9(0xfc)];if(_0x50f4f0[_0x14b0d9(0x10c)]===0x0)return _0x2330a6=_0x5310c3[_0x14b0d9(0x13e)][_0x14b0d9(0x1b5)]||_0x14b0d9(0x166),{'content':[{'type':_0x14b0d9(0xd9),'text':_0x2330a6}]};const _0x1f2093=[],_0x37a7a6=[_0x14b0d9(0x197)];for(const _0x22c7ca of _0x5310c3[_0x14b0d9(0x189)]){if(_0x22c7ca[_0x14b0d9(0x163)]===_0x14b0d9(0x168)&&Array[_0x14b0d9(0x19b)](_0x22c7ca[_0x14b0d9(0xeb)]))for(const _0x3ce1b3 of _0x22c7ca[_0x14b0d9(0xeb)]){try{const _0x4949ae=_0x3ce1b3[_0x14b0d9(0x1ff)]?.['name'],_0x3e7bd9=JSON[_0x14b0d9(0x17c)](_0x3ce1b3[_0x14b0d9(0x1ff)]?.[_0x14b0d9(0xfb)]||'{}');if(_0x4949ae===_0x14b0d9(0x187))_0x37a7a6['push'](_0x14b0d9(0x1d4)+_0x3e7bd9['pattern']+_0x14b0d9(0x1f8)+(_0x3e7bd9['path']||'.')+'`');else{if(_0x4949ae===_0x14b0d9(0xf9))_0x37a7a6[_0x14b0d9(0xe4)](_0x14b0d9(0x122)+_0x3e7bd9[_0x14b0d9(0x1a1)]+'`');else{if(_0x4949ae===_0x14b0d9(0x12d))_0x37a7a6[_0x14b0d9(0xe4)]('-\x20Listed\x20directory\x20`'+(_0x3e7bd9['command']||'.')+'`');else _0x4949ae===_0x14b0d9(0x1b1)&&_0x37a7a6[_0x14b0d9(0xe4)](_0x14b0d9(0x1e9)+_0x3e7bd9[_0x14b0d9(0x1f9)]+_0x14b0d9(0x130)+(_0x3e7bd9[_0x14b0d9(0x1a1)]||'.')+'`');}}}catch{}}}_0x1f2093['push'](_0x37a7a6['join']('\x0a'));const _0x2df97a=['',_0x14b0d9(0x17e)];for(const _0x300eb7 of _0x50f4f0){if(_0x300eb7[_0x14b0d9(0xe3)]==='*')_0x2df97a[_0x14b0d9(0xe4)]('-\x20'+_0x300eb7[_0x14b0d9(0x1a1)]+':*');else{if(Array[_0x14b0d9(0x19b)](_0x300eb7[_0x14b0d9(0xe3)])){const _0x3182d8=_0x300eb7[_0x14b0d9(0xe3)][_0x14b0d9(0x1c5)](([_0x110539,_0x173cca])=>{if(_0x110539===_0x173cca)return''+_0x110539;return _0x110539+'-'+_0x173cca;});_0x2df97a[_0x14b0d9(0xe4)]('-\x20'+_0x300eb7[_0x14b0d9(0x1a1)]+':'+_0x3182d8['join'](','));}else _0x2df97a['push']('-\x20'+_0x300eb7['path']+':*');}}_0x2df97a[_0x14b0d9(0xe4)](''),_0x1f2093['push'](_0x2df97a[_0x14b0d9(0x162)]('\x0a')),_0x1f2093[_0x14b0d9(0xe4)](_0x14b0d9(0x17d));const _0x1426f2=[],_0x94cf32=[];for(const _0x6e82f of _0x50f4f0){let _0x24b09d=a0_0x5748e1[_0x14b0d9(0x1d2)](_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],_0x6e82f[_0x14b0d9(0x1a1)]),_0x462970=null,_0x981736=null;try{_0x462970=await a0_0x25800f[_0x14b0d9(0x174)](_0x24b09d,{'encoding':'utf-8'});}catch(_0x480cda){const _0x5e3736=fixPathRepetition(_0x24b09d);if(_0x5e3736)try{_0x462970=await a0_0x25800f[_0x14b0d9(0x174)](_0x5e3736,{'encoding':_0x14b0d9(0x108)}),_0x24b09d=_0x5e3736;}catch{_0x981736=_0x480cda instanceof Error?_0x480cda:new Error(String(_0x480cda));}else _0x981736=_0x480cda instanceof Error?_0x480cda:new Error(String(_0x480cda));}if(_0x462970!==null){const _0x5c007d=_0x462970[_0x14b0d9(0x1a7)](/\r?\n/),_0x2df880=[];if(_0x6e82f[_0x14b0d9(0xe3)]==='*'||!Array['isArray'](_0x6e82f[_0x14b0d9(0xe3)]))for(let _0x294a53=0x1;_0x294a53<=_0x5c007d[_0x14b0d9(0x10c)];_0x294a53++){const _0x109e4e=_0x5c007d[_0x294a53-0x1];_0x2df880[_0x14b0d9(0xe4)](_0x294a53+'|\x20'+_0x109e4e);}else for(const [_0x596dc0,_0x309c0e]of _0x6e82f[_0x14b0d9(0xe3)]){_0x2df880[_0x14b0d9(0x10c)]>0x0&&_0x2df880[_0x14b0d9(0xe4)]('');for(let _0x13d5f2=_0x596dc0;_0x13d5f2<=_0x309c0e&&_0x13d5f2<=_0x5c007d[_0x14b0d9(0x10c)];_0x13d5f2++){const _0xd5aa1a=_0x5c007d[_0x13d5f2-0x1];_0x2df880[_0x14b0d9(0xe4)](_0x13d5f2+'|\x20'+_0xd5aa1a);}}_0x94cf32['push']({'path':_0x6e82f[_0x14b0d9(0x1a1)],'content':_0x2df880['join']('\x0a')});}else _0x1426f2[_0x14b0d9(0xe4)](_0x14b0d9(0x1fc)+_0x6e82f[_0x14b0d9(0x1a1)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x981736?.[_0x14b0d9(0x1a9)]||_0x14b0d9(0x1bb))+_0x14b0d9(0x140));}try{const _0x5603ea=await compactFileContexts(_0x94cf32,_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],MORPH_API_KEY,MORPH_API_URL);for(const _0x456eee of _0x5603ea){_0x1426f2[_0x14b0d9(0xe4)](_0x14b0d9(0x1fc)+_0x456eee[_0x14b0d9(0x1a1)]+_0x14b0d9(0x19d)+_0x456eee['content']+'\x0a</file>');}}catch(_0x268265){logger[_0x14b0d9(0x18e)]('MCP',_0x14b0d9(0x1e8),{'error':_0x268265 instanceof Error?_0x268265[_0x14b0d9(0x1a9)]:String(_0x268265),'files_count':_0x94cf32[_0x14b0d9(0x10c)]});for(const _0x26b00e of _0x94cf32){_0x1426f2[_0x14b0d9(0xe4)]('<file\x20path=\x22'+_0x26b00e[_0x14b0d9(0x1a1)]+_0x14b0d9(0x19d)+_0x26b00e[_0x14b0d9(0x193)]+_0x14b0d9(0x140));}}_0x1f2093[_0x14b0d9(0xe4)](_0x1426f2[_0x14b0d9(0x162)]('\x0a\x0a')),_0x2330a6=_0x1f2093[_0x14b0d9(0x162)]('\x0a');const _0x457d95=_0x5310c3[_0x14b0d9(0x10a)]?.['filter'](_0x165080=>_0x165080[_0x14b0d9(0x1a9)]?.[_0x14b0d9(0x1c2)]('File\x20read\x20error:'))||[];if(_0x457d95[_0x14b0d9(0x10c)]>0x0){const _0x4e5eaa=_0x457d95['map'](_0x310ce1=>_0x310ce1['message'])['join'](';\x20');reportMorphError({'error_message':_0x4e5eaa,'error_type':_0x14b0d9(0x18b),'context':{'tool':_0x14b0d9(0x1eb),'repo_path':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'model':'morph-warp-grep-v2.1','termination_reason':_0x14b0d9(0x100),'error_count':_0x457d95['length'],'is_timeout':![],'timings':_0x5310c3[_0x14b0d9(0x14f)],'files_attempted':_0x50f4f0[_0x14b0d9(0x1c5)](_0x1d70d3=>({'path':_0x1d70d3[_0x14b0d9(0x1a1)],'lines':_0x1d70d3['lines']})),'tool_calls':_0x300a94(_0x5310c3['messages']),'messages':_0x5310c3[_0x14b0d9(0x189)]?.[_0x14b0d9(0x1c5)](_0x57ad9f=>({'role':_0x57ad9f[_0x14b0d9(0x163)],'content':_0x57ad9f['content'],..._0x57ad9f[_0x14b0d9(0xeb)]?{'tool_calls':_0x57ad9f[_0x14b0d9(0xeb)][_0x14b0d9(0x10c)]}:{},..._0x57ad9f[_0x14b0d9(0xfa)]?{'tool_call_id':_0x57ad9f['tool_call_id']}:{}})),'request_content':{'query':_0x38c771['data'][_0x14b0d9(0x117)],'repo_path':_0x38c771[_0x14b0d9(0x12b)]['repo_path'],'repoRoot':a0_0x5748e1[_0x14b0d9(0x1d2)](_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)]),'model':_0x14b0d9(0x181)}},'source':_0x14b0d9(0xdb)})[_0x14b0d9(0x19c)](()=>{});}}else{if(_0x5310c3[_0x14b0d9(0x153)]==='terminated'&&_0x5310c3[_0x14b0d9(0x10a)]['length']>0x0){const _0x490a19=_0x5310c3[_0x14b0d9(0x10a)][_0x14b0d9(0x1c5)](_0x197686=>_0x197686[_0x14b0d9(0x1a9)])[_0x14b0d9(0x162)](';\x20');_0x2330a6=_0x14b0d9(0x114)+_0x490a19;const _0x4906eb=_0x490a19[_0x14b0d9(0x14a)]()[_0x14b0d9(0xe2)](_0x14b0d9(0x1d0))||_0x490a19[_0x14b0d9(0x14a)]()[_0x14b0d9(0xe2)]('timed\x20out')||_0x490a19[_0x14b0d9(0x14a)]()[_0x14b0d9(0xe2)](_0x14b0d9(0x1ad)),_0x9dc4de=_0x5310c3[_0x14b0d9(0x13e)]?.['metadata']?.[_0x14b0d9(0xfc)],_0x27a02d=_0x5310c3['errors'][0x0];reportMorphError({'error_message':_0x490a19,'error_type':_0x4906eb?'TimeoutError':_0x27a02d?.['constructor']?.[_0x14b0d9(0x188)]||_0x14b0d9(0x13b),'context':{'tool':'codebase_search','repo_path':_0x38c771[_0x14b0d9(0x12b)]['repo_path'],'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'model':_0x14b0d9(0x181),'termination_reason':_0x5310c3[_0x14b0d9(0x153)],'error_count':_0x5310c3[_0x14b0d9(0x10a)]['length'],'is_timeout':_0x4906eb,'timings':_0x5310c3[_0x14b0d9(0x14f)],'files_attempted':_0x9dc4de?.['map'](_0x561bfc=>({'path':_0x561bfc[_0x14b0d9(0x1a1)],'lines':_0x561bfc['lines']})),'tool_calls':_0x300a94(_0x5310c3[_0x14b0d9(0x189)]),'messages':_0x5310c3[_0x14b0d9(0x189)]?.[_0x14b0d9(0x1c5)](_0x3afb31=>({'role':_0x3afb31[_0x14b0d9(0x163)],'content':_0x3afb31[_0x14b0d9(0x193)],..._0x3afb31[_0x14b0d9(0xeb)]?{'tool_calls':_0x3afb31['tool_calls']['length']}:{},..._0x3afb31[_0x14b0d9(0xfa)]?{'tool_call_id':_0x3afb31[_0x14b0d9(0xfa)]}:{}})),'request_content':{'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'repo_path':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],'repoRoot':a0_0x5748e1[_0x14b0d9(0x1d2)](_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x27a02d?.[_0x14b0d9(0x14c)]||undefined,'source':'mcp-filesystem'})[_0x14b0d9(0x19c)](()=>{});}else _0x2330a6='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x14b0d9(0xd9),'text':_0x2330a6}]};}catch(_0x224734){const _0x3a9684=handleMorphAPIError(_0x224734);if(_0x3a9684)return logger[_0x14b0d9(0x172)](_0x14b0d9(0x177),_0x14b0d9(0x10d),{'tool':_0x14b0d9(0x1eb),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x14b0d9(0x200)]()-_0x341237}),_0x3a9684;const _0x5f1819=_0x224734 instanceof Error?_0x224734['message']:String(_0x224734);logger[_0x14b0d9(0x172)](_0x14b0d9(0x177),_0x14b0d9(0x10d),{'tool':_0x14b0d9(0x1eb),'error':_0x5f1819,'repo_path':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'latency_ms':Date[_0x14b0d9(0x200)]()-_0x341237});const _0x52323d=_0x5f1819[_0x14b0d9(0x14a)]()['includes'](_0x14b0d9(0x1d0))||_0x5f1819[_0x14b0d9(0x14a)]()[_0x14b0d9(0xe2)](_0x14b0d9(0xea))||_0x5f1819['toLowerCase']()[_0x14b0d9(0xe2)](_0x14b0d9(0x1ad))||_0x224734 instanceof Error&&_0x224734['name']===_0x14b0d9(0x12f);return reportMorphError({'error_message':_0x5f1819,'error_type':_0x52323d?_0x14b0d9(0x12f):_0x224734 instanceof Error?_0x224734[_0x14b0d9(0x11e)][_0x14b0d9(0x188)]:_0x14b0d9(0x156),'context':{'tool':'codebase_search','repo_path':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'model':_0x14b0d9(0x181),'is_timeout':_0x52323d,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'repo_path':_0x38c771[_0x14b0d9(0x12b)][_0x14b0d9(0xdc)],'repoRoot':a0_0x5748e1[_0x14b0d9(0x1d2)](_0x38c771[_0x14b0d9(0x12b)]['repo_path']),'model':_0x14b0d9(0x181)}},'stack_trace':_0x224734 instanceof Error?_0x224734[_0x14b0d9(0x14c)]:undefined,'source':_0x14b0d9(0xdb)})[_0x14b0d9(0x19c)](()=>{}),{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0x1cf)+_0x5f1819}],'isError':![]};}}case TOOL_NAMES['GITHUB_CODEBASE_SEARCH']:{const _0x180938=WarpGrepGitHubArgsSchema[_0x14b0d9(0x147)](_0x1888ae);if(!_0x180938[_0x14b0d9(0x1dd)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x180938[_0x14b0d9(0x172)]}],'isError':!![]};const _0x300827=_0x180938[_0x14b0d9(0x12b)][_0x14b0d9(0x11c)]||_0x180938['data']['owner_repo'];if(!_0x300827)return{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0x1be)}],'isError':!![]};const _0x3d6d95=MORPH_API_KEY;if(!_0x3d6d95)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x4545a7=Date['now']();logger['debug'](_0x14b0d9(0x177),_0x14b0d9(0x191),{'identifier':_0x300827,'query':_0x180938[_0x14b0d9(0x12b)]['search_string'],'branch':_0x180938[_0x14b0d9(0x12b)]['branch']});try{const _0x3f8bf8=new WarpGrepClient({'morphApiKey':_0x3d6d95,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x132168=await _0x3f8bf8[_0x14b0d9(0x11f)]({'searchTerm':_0x180938[_0x14b0d9(0x12b)]['search_string'],'github':_0x300827,'branch':_0x180938[_0x14b0d9(0x12b)]['branch']}),_0x22ef68=Date['now']()-_0x4545a7;logMcpStderr(_0x14b0d9(0x1af)+_0x22ef68+_0x14b0d9(0x1e3)+_0x132168['success']);const _0x4c7546=formatResult(_0x132168);return{'content':[{'type':_0x14b0d9(0xd9),'text':_0x4c7546}]};}catch(_0x2c2960){const _0x3923af=handleMorphAPIError(_0x2c2960);if(_0x3923af)return _0x3923af;const _0x2cec4b=Date[_0x14b0d9(0x200)]()-_0x4545a7,_0x1eadb3=_0x2c2960 instanceof Error?_0x2c2960[_0x14b0d9(0x1a9)]:String(_0x2c2960);return logMcpStderr(_0x14b0d9(0x119)+_0x2cec4b+'ms:',_0x1eadb3),reportMorphError({'error_message':_0x1eadb3,'error_type':_0x2c2960 instanceof Error?_0x2c2960[_0x14b0d9(0x11e)][_0x14b0d9(0x188)]:'UnknownError','context':{'tool':_0x14b0d9(0x182),'github_url':_0x300827,'search_string':_0x180938[_0x14b0d9(0x12b)][_0x14b0d9(0x117)],'branch':_0x180938[_0x14b0d9(0x12b)][_0x14b0d9(0x1f7)]},'stack_trace':_0x2c2960 instanceof Error?_0x2c2960['stack']:undefined,'source':_0x14b0d9(0xdb),'tool':'github_codebase_search','latency_ms':_0x2cec4b})[_0x14b0d9(0x19c)](()=>{}),{'content':[{'type':_0x14b0d9(0xd9),'text':_0x14b0d9(0x19f)+_0x1eadb3}],'isError':![]};}}default:throw new Error(_0x14b0d9(0x17b)+_0x16603f);}}catch(_0x4d0735){const _0x16f040=_0x4d0735 instanceof Error?_0x4d0735[_0x14b0d9(0x1a9)]:String(_0x4d0735);return reportMorphError({'error_message':_0x16f040,'error_type':_0x4d0735 instanceof Error?_0x4d0735[_0x14b0d9(0x11e)][_0x14b0d9(0x188)]:_0x14b0d9(0x156),'context':{'tool':_0x16603f,'arguments':_0x1888ae?JSON[_0x14b0d9(0x1b4)](_0x1888ae)[_0x14b0d9(0x1a2)](0x0,0x1f4):undefined,'mcp_server_version':_0x14b0d9(0x17f)},'stack_trace':_0x4d0735 instanceof Error?_0x4d0735[_0x14b0d9(0x14c)]:undefined,'source':_0x14b0d9(0xdb)})[_0x14b0d9(0x19c)](()=>{}),{'content':[{'type':_0x14b0d9(0xd9),'text':'Error:\x20'+_0x16f040}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0xeff3ad){const _0x181a2c=a0_0x3e026d,_0x1f4997=await getValidRootDirectories(_0xeff3ad);if(_0x1f4997[_0x181a2c(0x10c)]>0x0)allowedDirectories=[..._0x1f4997],logMcpStderr(_0x181a2c(0x1b2)+_0x1f4997[_0x181a2c(0x10c)]+_0x181a2c(0x150));else{logMcpStderr(_0x181a2c(0x125));if(ENABLE_WORKSPACE_MODE)try{const _0x566d26=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x566d26&&(allowedDirectories=[_0x566d26],logMcpStderr(_0x181a2c(0x107)+_0x566d26));}catch(_0x5d1034){logMcpStderr(_0x181a2c(0x1b0)+_0x5d1034);}}}server[a0_0x3e026d(0x15e)](RootsListChangedNotificationSchema,async()=>{const _0x56a2a0=a0_0x3e026d;try{const _0x589af8=await server[_0x56a2a0(0x1c8)]();_0x589af8&&_0x56a2a0(0x136)in _0x589af8&&await updateAllowedDirectoriesFromRoots(_0x589af8[_0x56a2a0(0x136)]);}catch(_0x5731f1){logMcpStderr(_0x56a2a0(0x1c3),_0x5731f1 instanceof Error?_0x5731f1['message']:String(_0x5731f1));}}),server[a0_0x3e026d(0x110)]=async()=>{const _0x5a94e1=a0_0x3e026d,_0x5e14ca=server[_0x5a94e1(0x176)]();if(_0x5e14ca?.[_0x5a94e1(0x136)])try{const _0x3bc3d2=await server[_0x5a94e1(0x1c8)]();_0x3bc3d2&&_0x5a94e1(0x136)in _0x3bc3d2?await updateAllowedDirectoriesFromRoots(_0x3bc3d2[_0x5a94e1(0x136)]):logMcpStderr(_0x5a94e1(0x133));}catch(_0x4b023a){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x4b023a instanceof Error?_0x4b023a[_0x5a94e1(0x1a9)]:String(_0x4b023a));}else{if(allowedDirectories[_0x5a94e1(0x10c)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5a94e1(0x116));else throw new Error(_0x5a94e1(0x18f));}}};async function runServer(){const _0x27e674=a0_0x3e026d,_0x172f32=new StdioServerTransport();await server['connect'](_0x172f32),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x27e674(0x10c)]===0x0&&logMcpStderr(_0x27e674(0x143));}runServer()['catch'](_0x24abdb=>{const _0x29e136=a0_0x3e026d;logMcpStderr(_0x29e136(0x15f),_0x24abdb),process['exit'](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x9e9d41=a1_0x42f8;(function(_0x77aeda,_0x52d16c){var _0x1758ea=a1_0x42f8,_0xc79968=_0x77aeda();while(!![]){try{var _0xb7e542=-parseInt(_0x1758ea(0xc5))/0x1+parseInt(_0x1758ea(0xba))/0x2+parseInt(_0x1758ea(0xca))/0x3*(-parseInt(_0x1758ea(0xc4))/0x4)+-parseInt(_0x1758ea(0xbf))/0x5*(-parseInt(_0x1758ea(0xcc))/0x6)+-parseInt(_0x1758ea(0xbe))/0x7+-parseInt(_0x1758ea(0xc6))/0x8*(parseInt(_0x1758ea(0xc1))/0x9)+parseInt(_0x1758ea(0xbb))/0xa;if(_0xb7e542===_0x52d16c)break;else _0xc79968['push'](_0xc79968['shift']());}catch(_0x27b912){_0xc79968['push'](_0xc79968['shift']());}}}(a1_0x4713,0xe6986));import a1_0x2e45e6 from'os';function a1_0x4713(){var _0x416c83=['290322TaLFFd','darwin','2526HzchDS','1949290oICVLb','16661040VQAVeC','error','platform','4785543zHvoux','18415EsDBQK','Windows','45Uqpaen','info','macOS','60wkTlbE','75380CcVFSW','1657816khRehB','map','[os=','Linux'];a1_0x4713=function(){return _0x416c83;};return a1_0x4713();}import{logger}from'./logger.js';export function getOperatingSystemType(_0x25c5c5=a1_0x2e45e6[a1_0x9e9d41(0xbd)]()){var _0x5d7ecb=a1_0x9e9d41;switch(_0x25c5c5){case _0x5d7ecb(0xcb):return _0x5d7ecb(0xc3);case'win32':return _0x5d7ecb(0xc0);case'linux':return _0x5d7ecb(0xc9);default:return'Unknown';}}function a1_0x42f8(_0x496579,_0x1dbab7){_0x496579=_0x496579-0xba;var _0x4713d4=a1_0x4713();var _0x42f840=_0x4713d4[_0x496579];return _0x42f840;}export function formatMcpLogMessage(_0x27f14a,_0x410df7=a1_0x2e45e6[a1_0x9e9d41(0xbd)]()){var _0x1e7539=a1_0x9e9d41;return _0x1e7539(0xc8)+getOperatingSystemType(_0x410df7)+']\x20'+_0x27f14a;}export function logMcpStderr(_0x18f309,..._0x4781f6){var _0x313f80=a1_0x9e9d41;console[_0x313f80(0xbc)](formatMcpLogMessage(_0x18f309),..._0x4781f6),logger[_0x313f80(0xc2)]('MCP',_0x18f309,_0x4781f6['length']?{'args':_0x4781f6[_0x313f80(0xc7)](_0x36b987=>String(_0x36b987))}:undefined);}
1
+ var a1_0x5928fc=a1_0x4191;(function(_0x84eb1a,_0x3c8eea){var _0x9fc241=a1_0x4191,_0x593ca6=_0x84eb1a();while(!![]){try{var _0xfa2048=-parseInt(_0x9fc241(0x8a))/0x1*(parseInt(_0x9fc241(0x88))/0x2)+parseInt(_0x9fc241(0x92))/0x3*(parseInt(_0x9fc241(0x95))/0x4)+parseInt(_0x9fc241(0x8d))/0x5+-parseInt(_0x9fc241(0x82))/0x6*(parseInt(_0x9fc241(0x80))/0x7)+-parseInt(_0x9fc241(0x89))/0x8+-parseInt(_0x9fc241(0x84))/0x9*(parseInt(_0x9fc241(0x94))/0xa)+-parseInt(_0x9fc241(0x90))/0xb*(-parseInt(_0x9fc241(0x93))/0xc);if(_0xfa2048===_0x3c8eea)break;else _0x593ca6['push'](_0x593ca6['shift']());}catch(_0x3a9ae0){_0x593ca6['push'](_0x593ca6['shift']());}}}(a1_0x3a4f,0x5d8a7));import a1_0x1df2d2 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x471439=a1_0x1df2d2[a1_0x5928fc(0x7f)]()){var _0x4bbd19=a1_0x5928fc;switch(_0x471439){case _0x4bbd19(0x87):return _0x4bbd19(0x8f);case _0x4bbd19(0x83):return _0x4bbd19(0x8b);case'linux':return'Linux';default:return _0x4bbd19(0x85);}}export function formatMcpLogMessage(_0x316196,_0x1fb19a=a1_0x1df2d2['platform']()){var _0xd48168=a1_0x5928fc;return _0xd48168(0x81)+getOperatingSystemType(_0x1fb19a)+']\x20'+_0x316196;}function a1_0x4191(_0x35f5ac,_0x5a4584){_0x35f5ac=_0x35f5ac-0x7f;var _0x3a4f0e=a1_0x3a4f();var _0x41911c=_0x3a4f0e[_0x35f5ac];return _0x41911c;}export function logMcpStderr(_0x3795a8,..._0x39f182){var _0x1bfeb2=a1_0x5928fc;console[_0x1bfeb2(0x8e)](formatMcpLogMessage(_0x3795a8),..._0x39f182),logger[_0x1bfeb2(0x91)](_0x1bfeb2(0x8c),_0x3795a8,_0x39f182['length']?{'args':_0x39f182[_0x1bfeb2(0x86)](_0x4ab90f=>String(_0x4ab90f))}:undefined);}function a1_0x3a4f(){var _0x3c46db=['1967084SZyyBX','[os=','12ewdDfo','win32','14031TYJwbz','Unknown','map','darwin','24350uuxEdg','5861448pBilsQ','51nbFbRa','Windows','MCP','1264665gCrRmE','error','macOS','55kGhXBi','info','389394ilbscV','4329960yxGIKl','1780VsxBuC','16qeazDY','platform'];a1_0x3a4f=function(){return _0x3c46db;};return a1_0x3a4f();}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0x215def=a2_0x3426;(function(_0x3f0f0a,_0x2a31de){const _0x29f835=a2_0x3426,_0x4bde9b=_0x3f0f0a();while(!![]){try{const _0x344b7e=-parseInt(_0x29f835(0x118))/0x1*(-parseInt(_0x29f835(0x110))/0x2)+-parseInt(_0x29f835(0x111))/0x3*(parseInt(_0x29f835(0x11a))/0x4)+parseInt(_0x29f835(0x10c))/0x5*(parseInt(_0x29f835(0x10e))/0x6)+-parseInt(_0x29f835(0x124))/0x7*(parseInt(_0x29f835(0x113))/0x8)+-parseInt(_0x29f835(0x127))/0x9*(-parseInt(_0x29f835(0x119))/0xa)+parseInt(_0x29f835(0x11e))/0xb+-parseInt(_0x29f835(0x125))/0xc;if(_0x344b7e===_0x2a31de)break;else _0x4bde9b['push'](_0x4bde9b['shift']());}catch(_0x59a12a){_0x4bde9b['push'](_0x4bde9b['shift']());}}}(a2_0x1c52,0x550ff));import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x7f90e1=a2_0x3426;this[_0x7f90e1(0x123)]=process[_0x7f90e1(0x117)][_0x7f90e1(0x112)]==='1'||!!process[_0x7f90e1(0x117)][_0x7f90e1(0x10f)];const _0x2fd895=process[_0x7f90e1(0x117)][_0x7f90e1(0x10f)];this[_0x7f90e1(0x126)]=_0x2fd895?createWriteStream(_0x2fd895,{'flags':'a'}):null;}['debug'](_0x3dc8a9,_0x2d818c,_0x1f539c){const _0x32082f=a2_0x3426;this['_log'](_0x32082f(0x121),_0x3dc8a9,_0x2d818c,_0x1f539c);}['info'](_0x606037,_0x133118,_0x11b595){const _0x999264=a2_0x3426;this[_0x999264(0x10d)](_0x999264(0x120),_0x606037,_0x133118,_0x11b595);}['warn'](_0x2445e6,_0x5af8b0,_0x43dea3){const _0x1cd0a2=a2_0x3426;this[_0x1cd0a2(0x10d)](_0x1cd0a2(0x114),_0x2445e6,_0x5af8b0,_0x43dea3);}[a2_0x215def(0x122)](_0x8b7b53,_0x4712f3,_0x539ef0){const _0x487cff=a2_0x215def;this['_log'](_0x487cff(0x122),_0x8b7b53,_0x4712f3,_0x539ef0);}[a2_0x215def(0x115)](){const _0x587d3d=a2_0x215def;this[_0x587d3d(0x123)]=!![];}get[a2_0x215def(0x128)](){const _0x46693f=a2_0x215def;return this[_0x46693f(0x123)];}[a2_0x215def(0x10d)](_0x4da416,_0x457244,_0x1fa665,_0x288bb8){const _0x24f44b=a2_0x215def;if(_0x4da416!==_0x24f44b(0x122)&&!this[_0x24f44b(0x123)])return;const _0x4a5958=new Date()[_0x24f44b(0x11b)](),_0x58ed0c='['+_0x4a5958+']\x20['+_0x4da416[_0x24f44b(0x11f)]()+_0x24f44b(0x116)+_0x457244+']';console[_0x24f44b(0x122)](_0x288bb8?_0x58ed0c+'\x20'+_0x1fa665+'\x20'+JSON[_0x24f44b(0x11d)](_0x288bb8):_0x58ed0c+'\x20'+_0x1fa665),this[_0x24f44b(0x126)]?.[_0x24f44b(0x11c)](JSON[_0x24f44b(0x11d)]({'ts':_0x4a5958,'level':_0x4da416,'component':_0x457244,'msg':_0x1fa665,..._0x288bb8&&{'data':_0x288bb8}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x3426(_0x2a6b64,_0x4a409a){_0x2a6b64=_0x2a6b64-0x10c;const _0x1c52b2=a2_0x1c52();let _0x34267f=_0x1c52b2[_0x2a6b64];return _0x34267f;}function a2_0x1c52(){const _0x39d24e=['335868rhjDCZ','toISOString','write','stringify','6080734VMIuvP','toUpperCase','info','debug','error','enabled','7791MyFbcW','12575436ybCrQj','fileStream','1394397UpMQHL','isEnabled','490MdWhao','_log','14646ManxDQ','MORPH_LOG_FILE','102PHPybF','6WaHlos','MORPH_DEBUG','600JdaMBA','warn','enable',']\x20[','env','7666egnnlx','30OkkKTx'];a2_0x1c52=function(){return _0x39d24e;};return a2_0x1c52();}
1
+ const a2_0x32d86a=a2_0x3233;function a2_0x3233(_0x43dc57,_0x1892d3){_0x43dc57=_0x43dc57-0x1ce;const _0x11880e=a2_0x1188();let _0x3233c8=_0x11880e[_0x43dc57];return _0x3233c8;}(function(_0x302dac,_0x5368a9){const _0xd93d85=a2_0x3233,_0x3d75a8=_0x302dac();while(!![]){try{const _0x2482bc=parseInt(_0xd93d85(0x1d0))/0x1*(parseInt(_0xd93d85(0x1cf))/0x2)+-parseInt(_0xd93d85(0x1da))/0x3+parseInt(_0xd93d85(0x1d2))/0x4*(-parseInt(_0xd93d85(0x1d9))/0x5)+parseInt(_0xd93d85(0x1d5))/0x6*(parseInt(_0xd93d85(0x1dd))/0x7)+-parseInt(_0xd93d85(0x1e7))/0x8*(-parseInt(_0xd93d85(0x1e4))/0x9)+parseInt(_0xd93d85(0x1e0))/0xa*(-parseInt(_0xd93d85(0x1e8))/0xb)+-parseInt(_0xd93d85(0x1ce))/0xc*(-parseInt(_0xd93d85(0x1e1))/0xd);if(_0x2482bc===_0x5368a9)break;else _0x3d75a8['push'](_0x3d75a8['shift']());}catch(_0x2cbdbb){_0x3d75a8['push'](_0x3d75a8['shift']());}}}(a2_0x1188,0x39222));import{createWriteStream}from'fs';class MorphLogger{[a2_0x32d86a(0x1d8)];[a2_0x32d86a(0x1e6)];constructor(){const _0x1265ee=a2_0x32d86a;this['enabled']=process[_0x1265ee(0x1d3)][_0x1265ee(0x1e5)]==='1'||!!process[_0x1265ee(0x1d3)]['MORPH_LOG_FILE'];const _0x3781f1=process[_0x1265ee(0x1d3)]['MORPH_LOG_FILE'];this[_0x1265ee(0x1e6)]=_0x3781f1?createWriteStream(_0x3781f1,{'flags':'a'}):null;}[a2_0x32d86a(0x1d6)](_0x5cee9c,_0x211675,_0x24a3d3){this['_log']('debug',_0x5cee9c,_0x211675,_0x24a3d3);}[a2_0x32d86a(0x1db)](_0x541290,_0x5a72d1,_0x472a3a){const _0x414c14=a2_0x32d86a;this[_0x414c14(0x1d7)]('info',_0x541290,_0x5a72d1,_0x472a3a);}[a2_0x32d86a(0x1df)](_0x5d3a5d,_0x16f3ec,_0x2806b9){const _0x18bd34=a2_0x32d86a;this[_0x18bd34(0x1d7)](_0x18bd34(0x1df),_0x5d3a5d,_0x16f3ec,_0x2806b9);}[a2_0x32d86a(0x1e2)](_0x38cbe6,_0x590c7e,_0x290208){const _0x36ac5d=a2_0x32d86a;this[_0x36ac5d(0x1d7)](_0x36ac5d(0x1e2),_0x38cbe6,_0x590c7e,_0x290208);}[a2_0x32d86a(0x1dc)](){const _0x14db03=a2_0x32d86a;this[_0x14db03(0x1d8)]=!![];}get['isEnabled'](){const _0x171419=a2_0x32d86a;return this[_0x171419(0x1d8)];}[a2_0x32d86a(0x1d7)](_0x2dd60e,_0x9ff246,_0x2aaa11,_0x34da7d){const _0x50a539=a2_0x32d86a;if(_0x2dd60e!==_0x50a539(0x1e2)&&!this[_0x50a539(0x1d8)])return;const _0x293cd6=new Date()[_0x50a539(0x1d4)](),_0x3de495='['+_0x293cd6+']\x20['+_0x2dd60e['toUpperCase']()+_0x50a539(0x1e3)+_0x9ff246+']';console[_0x50a539(0x1e2)](_0x34da7d?_0x3de495+'\x20'+_0x2aaa11+'\x20'+JSON[_0x50a539(0x1de)](_0x34da7d):_0x3de495+'\x20'+_0x2aaa11),this['fileStream']?.[_0x50a539(0x1d1)](JSON['stringify']({'ts':_0x293cd6,'level':_0x2dd60e,'component':_0x9ff246,'msg':_0x2aaa11,..._0x34da7d&&{'data':_0x34da7d}})+'\x0a');}}export const logger=new MorphLogger();function a2_0x1188(){const _0x27f7f2=[']\x20[','9sRXIcj','MORPH_DEBUG','fileStream','672936doIPzL','889284zzanVk','140484JuaupT','18OUUELY','31339YYdLkC','write','216OkOBFq','env','toISOString','166326kybCBq','debug','_log','enabled','26385EcpYoh','846015uvOknh','info','enable','77NbwyPn','stringify','warn','10iaMhnH','234nSKGQv','error'];a2_0x1188=function(){return _0x27f7f2;};return a2_0x1188();}
@@ -1 +1 @@
1
- function a3_0x277e(){const _0x3fb94f=['208WtarPq','test','2aCooOp','toUpperCase','3ppBcBE','6399107RIOJNz','replace','567765TyHNSz','/mnt/','join','2407391pClvig','241373ILnKRR','startsWith','trim','substring','normalize','charAt','match','6SxDlDU','32688eZimMX','2438780CNZRUk','slice','134308XUfAtX'];a3_0x277e=function(){return _0x3fb94f;};return a3_0x277e();}(function(_0x39f75c,_0x492b72){const _0x1878ab=a3_0x46fc,_0x1c32ca=_0x39f75c();while(!![]){try{const _0x1054aa=parseInt(_0x1878ab(0x135))/0x1*(parseInt(_0x1878ab(0x12c))/0x2)+parseInt(_0x1878ab(0x12e))/0x3*(-parseInt(_0x1878ab(0x129))/0x4)+-parseInt(_0x1878ab(0x131))/0x5+parseInt(_0x1878ab(0x13c))/0x6*(parseInt(_0x1878ab(0x134))/0x7)+parseInt(_0x1878ab(0x12a))/0x8*(parseInt(_0x1878ab(0x13d))/0x9)+parseInt(_0x1878ab(0x127))/0xa+-parseInt(_0x1878ab(0x12f))/0xb;if(_0x1054aa===_0x492b72)break;else _0x1c32ca['push'](_0x1c32ca['shift']());}catch(_0x386873){_0x1c32ca['push'](_0x1c32ca['shift']());}}}(a3_0x277e,0x2f8a9));import a3_0x11ab78 from'path';import a3_0x157bc5 from'os';export function convertToWindowsPath(_0x4e34f5){const _0x3adfa7=a3_0x46fc;if(_0x4e34f5[_0x3adfa7(0x136)](_0x3adfa7(0x132))){const _0x4c686e=_0x4e34f5[_0x3adfa7(0x13a)](0x5)['toUpperCase'](),_0x152cae=_0x4e34f5[_0x3adfa7(0x128)](0x6)[_0x3adfa7(0x130)](/\//g,'\x5c');return _0x4c686e+':'+_0x152cae;}if(_0x4e34f5[_0x3adfa7(0x13b)](/^\/[a-zA-Z]\//)){const _0x5bae41=_0x4e34f5[_0x3adfa7(0x13a)](0x1)[_0x3adfa7(0x12d)](),_0x4aaa5c=_0x4e34f5[_0x3adfa7(0x128)](0x2)[_0x3adfa7(0x130)](/\//g,'\x5c');return _0x5bae41+':'+_0x4aaa5c;}if(_0x4e34f5[_0x3adfa7(0x13b)](/^[a-zA-Z]:/))return _0x4e34f5[_0x3adfa7(0x130)](/\//g,'\x5c');return _0x4e34f5;}export function normalizePath(_0x14dbad){const _0x1659b4=a3_0x46fc;_0x14dbad=_0x14dbad[_0x1659b4(0x137)]()[_0x1659b4(0x130)](/^["']|["']$/g,'');const _0x2e637f=_0x14dbad[_0x1659b4(0x136)]('/')&&!_0x14dbad[_0x1659b4(0x13b)](/^\/mnt\/[a-z]\//i)&&!_0x14dbad[_0x1659b4(0x13b)](/^\/[a-zA-Z]\//);if(_0x2e637f)return _0x14dbad[_0x1659b4(0x130)](/\/+/g,'/')[_0x1659b4(0x130)](/\/+$/,'');_0x14dbad=convertToWindowsPath(_0x14dbad);if(_0x14dbad[_0x1659b4(0x136)]('\x5c\x5c')){let _0x13fd94=_0x14dbad;_0x13fd94=_0x13fd94['replace'](/^\\{2,}/,'\x5c\x5c');const _0x1d613a=_0x13fd94[_0x1659b4(0x138)](0x2)['replace'](/\\\\/g,'\x5c');_0x14dbad='\x5c\x5c'+_0x1d613a;}else _0x14dbad=_0x14dbad['replace'](/\\\\/g,'\x5c');let _0x3f0b35=a3_0x11ab78[_0x1659b4(0x139)](_0x14dbad);_0x14dbad[_0x1659b4(0x136)]('\x5c\x5c')&&!_0x3f0b35['startsWith']('\x5c\x5c')&&(_0x3f0b35='\x5c'+_0x3f0b35);if(_0x3f0b35['match'](/^[a-zA-Z]:/)){let _0x219212=_0x3f0b35[_0x1659b4(0x130)](/\//g,'\x5c');return/^[a-z]:/[_0x1659b4(0x12b)](_0x219212)&&(_0x219212=_0x219212[_0x1659b4(0x13a)](0x0)[_0x1659b4(0x12d)]()+_0x219212[_0x1659b4(0x128)](0x1)),_0x219212;}return _0x3f0b35[_0x1659b4(0x130)](/\//g,'\x5c');}function a3_0x46fc(_0x5da4e0,_0x3eefa0){_0x5da4e0=_0x5da4e0-0x127;const _0x277ed3=a3_0x277e();let _0x46fcef=_0x277ed3[_0x5da4e0];return _0x46fcef;}export function expandHome(_0x2b0ac4){const _0x107c43=a3_0x46fc;if(_0x2b0ac4[_0x107c43(0x136)]('~/')||_0x2b0ac4==='~')return a3_0x11ab78[_0x107c43(0x133)](a3_0x157bc5['homedir'](),_0x2b0ac4[_0x107c43(0x128)](0x1));return _0x2b0ac4;}
1
+ (function(_0x245080,_0x23ee0d){const _0x39d0a8=a3_0xe559,_0x4fc7c2=_0x245080();while(!![]){try{const _0x1ffd87=-parseInt(_0x39d0a8(0xdf))/0x1+-parseInt(_0x39d0a8(0xe0))/0x2*(parseInt(_0x39d0a8(0xd3))/0x3)+parseInt(_0x39d0a8(0xd7))/0x4+-parseInt(_0x39d0a8(0xd6))/0x5*(-parseInt(_0x39d0a8(0xcf))/0x6)+-parseInt(_0x39d0a8(0xd2))/0x7*(parseInt(_0x39d0a8(0xd1))/0x8)+parseInt(_0x39d0a8(0xdd))/0x9+parseInt(_0x39d0a8(0xda))/0xa;if(_0x1ffd87===_0x23ee0d)break;else _0x4fc7c2['push'](_0x4fc7c2['shift']());}catch(_0x220200){_0x4fc7c2['push'](_0x4fc7c2['shift']());}}}(a3_0x21be,0x3475b));import a3_0x44e071 from'path';import a3_0x406ec4 from'os';export function convertToWindowsPath(_0xd29d5){const _0xc1ac82=a3_0xe559;if(_0xd29d5[_0xc1ac82(0xe1)](_0xc1ac82(0xd0))){const _0xcc8399=_0xd29d5[_0xc1ac82(0xd4)](0x5)[_0xc1ac82(0xde)](),_0x280eca=_0xd29d5['slice'](0x6)[_0xc1ac82(0xd8)](/\//g,'\x5c');return _0xcc8399+':'+_0x280eca;}if(_0xd29d5[_0xc1ac82(0xcd)](/^\/[a-zA-Z]\//)){const _0x44c09e=_0xd29d5[_0xc1ac82(0xd4)](0x1)[_0xc1ac82(0xde)](),_0x5a7fc0=_0xd29d5[_0xc1ac82(0xd5)](0x2)['replace'](/\//g,'\x5c');return _0x44c09e+':'+_0x5a7fc0;}if(_0xd29d5[_0xc1ac82(0xcd)](/^[a-zA-Z]:/))return _0xd29d5['replace'](/\//g,'\x5c');return _0xd29d5;}function a3_0xe559(_0x10f03b,_0xd2cd95){_0x10f03b=_0x10f03b-0xcd;const _0x21be9c=a3_0x21be();let _0xe559b=_0x21be9c[_0x10f03b];return _0xe559b;}export function normalizePath(_0x1e0948){const _0x5efdff=a3_0xe559;_0x1e0948=_0x1e0948[_0x5efdff(0xce)]()[_0x5efdff(0xd8)](/^["']|["']$/g,'');const _0xfe3333=_0x1e0948[_0x5efdff(0xe1)]('/')&&!_0x1e0948[_0x5efdff(0xcd)](/^\/mnt\/[a-z]\//i)&&!_0x1e0948[_0x5efdff(0xcd)](/^\/[a-zA-Z]\//);if(_0xfe3333)return _0x1e0948[_0x5efdff(0xd8)](/\/+/g,'/')['replace'](/\/+$/,'');_0x1e0948=convertToWindowsPath(_0x1e0948);if(_0x1e0948[_0x5efdff(0xe1)]('\x5c\x5c')){let _0x46d7a8=_0x1e0948;_0x46d7a8=_0x46d7a8[_0x5efdff(0xd8)](/^\\{2,}/,'\x5c\x5c');const _0xa9a150=_0x46d7a8['substring'](0x2)[_0x5efdff(0xd8)](/\\\\/g,'\x5c');_0x1e0948='\x5c\x5c'+_0xa9a150;}else _0x1e0948=_0x1e0948[_0x5efdff(0xd8)](/\\\\/g,'\x5c');let _0x5e22f9=a3_0x44e071[_0x5efdff(0xdb)](_0x1e0948);_0x1e0948[_0x5efdff(0xe1)]('\x5c\x5c')&&!_0x5e22f9[_0x5efdff(0xe1)]('\x5c\x5c')&&(_0x5e22f9='\x5c'+_0x5e22f9);if(_0x5e22f9[_0x5efdff(0xcd)](/^[a-zA-Z]:/)){let _0x400ca5=_0x5e22f9[_0x5efdff(0xd8)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x400ca5)&&(_0x400ca5=_0x400ca5[_0x5efdff(0xd4)](0x0)[_0x5efdff(0xde)]()+_0x400ca5[_0x5efdff(0xd5)](0x1)),_0x400ca5;}return _0x5e22f9[_0x5efdff(0xd8)](/\//g,'\x5c');}function a3_0x21be(){const _0x19794b=['/mnt/','1407048LEmDTl','14vksIgE','75UNziGq','charAt','slice','365amPtLb','263032FTATKX','replace','join','4288630hkqiaT','normalize','homedir','3717711otrKAo','toUpperCase','76100jkBqTi','27294EvRDjp','startsWith','match','trim','6264NIKITk'];a3_0x21be=function(){return _0x19794b;};return a3_0x21be();}export function expandHome(_0x1e94a0){const _0x3261ab=a3_0xe559;if(_0x1e94a0[_0x3261ab(0xe1)]('~/')||_0x1e94a0==='~')return a3_0x44e071[_0x3261ab(0xd9)](a3_0x406ec4[_0x3261ab(0xdc)](),_0x1e94a0['slice'](0x1));return _0x1e94a0;}
@@ -1 +1 @@
1
- (function(_0x12f0ef,_0x5e2829){const _0x117072=a4_0x543f,_0x3ef89c=_0x12f0ef();while(!![]){try{const _0x5b6848=-parseInt(_0x117072(0xf3))/0x1+parseInt(_0x117072(0xf9))/0x2+parseInt(_0x117072(0xf6))/0x3*(parseInt(_0x117072(0xfe))/0x4)+parseInt(_0x117072(0xf4))/0x5+parseInt(_0x117072(0xf0))/0x6+parseInt(_0x117072(0xfc))/0x7+-parseInt(_0x117072(0x100))/0x8*(parseInt(_0x117072(0xfa))/0x9);if(_0x5b6848===_0x5e2829)break;else _0x3ef89c['push'](_0x3ef89c['shift']());}catch(_0x2df95e){_0x3ef89c['push'](_0x3ef89c['shift']());}}}(a4_0x1786,0x77704));import a4_0x5dcf24 from'path';function a4_0x1786(){const _0x268613=['2745030wrayGq','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','297537BGfaFQ','3229285FCdqNQ','normalize','3YrLCgP','some','isAbsolute','567948vMDpOi','9XHIPzD','includes','937125yaevbs','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1994444PCHNux','length','9864520orzWNX','startsWith','sep','isArray','string'];a4_0x1786=function(){return _0x268613;};return a4_0x1786();}function a4_0x543f(_0x325915,_0x13befd){_0x325915=_0x325915-0xed;const _0x1786b7=a4_0x1786();let _0x543fe3=_0x1786b7[_0x325915];return _0x543fe3;}export function isPathWithinAllowedDirectories(_0x3419b3,_0x4b8497){const _0x141e66=a4_0x543f;if(typeof _0x3419b3!==_0x141e66(0xef)||!Array[_0x141e66(0xee)](_0x4b8497))return![];if(!_0x3419b3||_0x4b8497[_0x141e66(0xff)]===0x0)return![];if(_0x3419b3[_0x141e66(0xfb)]('\x00'))return![];let _0x357e4e;try{_0x357e4e=a4_0x5dcf24[_0x141e66(0xf1)](a4_0x5dcf24[_0x141e66(0xf5)](_0x3419b3));}catch{return![];}if(!a4_0x5dcf24[_0x141e66(0xf8)](_0x357e4e))throw new Error(_0x141e66(0xf2));return _0x4b8497[_0x141e66(0xf7)](_0x4ea803=>{const _0x50816c=_0x141e66;if(typeof _0x4ea803!==_0x50816c(0xef)||!_0x4ea803)return![];if(_0x4ea803[_0x50816c(0xfb)]('\x00'))return![];let _0x28b74b;try{_0x28b74b=a4_0x5dcf24[_0x50816c(0xf1)](a4_0x5dcf24[_0x50816c(0xf5)](_0x4ea803));}catch{return![];}if(!a4_0x5dcf24[_0x50816c(0xf8)](_0x28b74b))throw new Error(_0x50816c(0xfd));if(_0x357e4e===_0x28b74b)return!![];if(_0x28b74b===a4_0x5dcf24[_0x50816c(0xed)])return _0x357e4e[_0x50816c(0x101)](a4_0x5dcf24[_0x50816c(0xed)]);return _0x357e4e[_0x50816c(0x101)](_0x28b74b+a4_0x5dcf24['sep']);});}
1
+ function a4_0x3a06(_0x245e0d,_0x2b8931){_0x245e0d=_0x245e0d-0x9a;const _0x1d07ac=a4_0x1d07();let _0x3a066d=_0x1d07ac[_0x245e0d];return _0x3a066d;}function a4_0x1d07(){const _0x511f0b=['sep','72fLSaCh','resolve','25Hxzedn','some','normalize','3524889tKNcUj','isAbsolute','includes','23352714szoYkg','1165464dWspQM','10XkRfeo','1095672UimZVX','startsWith','string','7402nMqzQH','1481585wokbfE','77UkLcrm','232371JbYIxC'];a4_0x1d07=function(){return _0x511f0b;};return a4_0x1d07();}(function(_0x76e786,_0x1e6fb1){const _0x4c48fa=a4_0x3a06,_0x320354=_0x76e786();while(!![]){try{const _0xcc55de=-parseInt(_0x4c48fa(0xaa))/0x1*(-parseInt(_0x4c48fa(0xa8))/0x2)+parseInt(_0x4c48fa(0x9f))/0x3+parseInt(_0x4c48fa(0xa5))/0x4+parseInt(_0x4c48fa(0x9c))/0x5*(-parseInt(_0x4c48fa(0xa3))/0x6)+parseInt(_0x4c48fa(0xa9))/0x7*(-parseInt(_0x4c48fa(0x9a))/0x8)+-parseInt(_0x4c48fa(0xab))/0x9*(parseInt(_0x4c48fa(0xa4))/0xa)+parseInt(_0x4c48fa(0xa2))/0xb;if(_0xcc55de===_0x1e6fb1)break;else _0x320354['push'](_0x320354['shift']());}catch(_0x51a32d){_0x320354['push'](_0x320354['shift']());}}}(a4_0x1d07,0xe9212));import a4_0x50e958 from'path';export function isPathWithinAllowedDirectories(_0x11230a,_0x598591){const _0x1daa9f=a4_0x3a06;if(typeof _0x11230a!==_0x1daa9f(0xa7)||!Array['isArray'](_0x598591))return![];if(!_0x11230a||_0x598591['length']===0x0)return![];if(_0x11230a[_0x1daa9f(0xa1)]('\x00'))return![];let _0xa1143;try{_0xa1143=a4_0x50e958['resolve'](a4_0x50e958[_0x1daa9f(0x9e)](_0x11230a));}catch{return![];}if(!a4_0x50e958[_0x1daa9f(0xa0)](_0xa1143))throw new Error('Path\x20must\x20be\x20absolute\x20after\x20normalization');return _0x598591[_0x1daa9f(0x9d)](_0x1496ff=>{const _0x571704=_0x1daa9f;if(typeof _0x1496ff!==_0x571704(0xa7)||!_0x1496ff)return![];if(_0x1496ff['includes']('\x00'))return![];let _0x278239;try{_0x278239=a4_0x50e958[_0x571704(0x9b)](a4_0x50e958['normalize'](_0x1496ff));}catch{return![];}if(!a4_0x50e958[_0x571704(0xa0)](_0x278239))throw new Error('Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization');if(_0xa1143===_0x278239)return!![];if(_0x278239===a4_0x50e958['sep'])return _0xa1143[_0x571704(0xa6)](a4_0x50e958[_0x571704(0xac)]);return _0xa1143[_0x571704(0xa6)](_0x278239+a4_0x50e958[_0x571704(0xac)]);});}
@@ -1 +1 @@
1
- (function(_0x23c647,_0x31536c){const _0x4eb347=a5_0x5f53,_0x4847f4=_0x23c647();while(!![]){try{const _0x2568bf=parseInt(_0x4eb347(0x150))/0x1+-parseInt(_0x4eb347(0x144))/0x2+-parseInt(_0x4eb347(0x13b))/0x3*(-parseInt(_0x4eb347(0x140))/0x4)+-parseInt(_0x4eb347(0x13e))/0x5+-parseInt(_0x4eb347(0x14c))/0x6+parseInt(_0x4eb347(0x14b))/0x7+-parseInt(_0x4eb347(0x145))/0x8*(-parseInt(_0x4eb347(0x146))/0x9);if(_0x2568bf===_0x31536c)break;else _0x4847f4['push'](_0x4847f4['shift']());}catch(_0x28ed4f){_0x4847f4['push'](_0x4847f4['shift']());}}}(a5_0x50bb,0xc594e));import{promises as a5_0x141678}from'fs';import a5_0xa03332 from'path';import a5_0xcb3c21 from'os';function a5_0x5f53(_0x500309,_0x118d81){_0x500309=_0x500309-0x13b;const _0x50bbce=a5_0x50bb();let _0x5f53f6=_0x50bbce[_0x500309];return _0x5f53f6;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x407a50){const _0xea8950=a5_0x5f53;try{const _0x5095b4=_0x407a50[_0xea8950(0x13f)](_0xea8950(0x141))?_0x407a50[_0xea8950(0x14a)](0x7):_0x407a50,_0x36d311=_0x5095b4[_0xea8950(0x13f)]('~/')||_0x5095b4==='~'?a5_0xa03332[_0xea8950(0x14f)](a5_0xcb3c21[_0xea8950(0x151)](),_0x5095b4[_0xea8950(0x14a)](0x1)):_0x5095b4,_0x227b5e=a5_0xa03332[_0xea8950(0x149)](_0x36d311),_0x262c40=await a5_0x141678['realpath'](_0x227b5e);return normalizePath(_0x262c40);}catch{return null;}}function formatDirectoryError(_0xc290f1,_0x1142a7,_0x53461f){const _0x419ca7=a5_0x5f53;if(_0x53461f)return _0x419ca7(0x143)+_0x53461f+':\x20'+_0xc290f1;const _0x1bd426=_0x1142a7 instanceof Error?_0x1142a7[_0x419ca7(0x14d)]:String(_0x1142a7);return _0x419ca7(0x142)+_0xc290f1+'\x20due\x20to\x20error:\x20'+_0x1bd426;}export async function getValidRootDirectories(_0x2fbefc){const _0x4e6e3e=a5_0x5f53,_0x514388=[];for(const _0x3397c7 of _0x2fbefc){const _0x4303ed=await parseRootUri(_0x3397c7[_0x4e6e3e(0x148)]);if(!_0x4303ed){logMcpStderr(formatDirectoryError(_0x3397c7[_0x4e6e3e(0x148)],undefined,_0x4e6e3e(0x13d)));continue;}try{const _0x453fd0=await a5_0x141678[_0x4e6e3e(0x13c)](_0x4303ed);_0x453fd0[_0x4e6e3e(0x14e)]()?_0x514388[_0x4e6e3e(0x147)](_0x4303ed):logMcpStderr(formatDirectoryError(_0x4303ed,undefined,'non-directory\x20root'));}catch(_0x594c0e){logMcpStderr(formatDirectoryError(_0x4303ed,_0x594c0e));}}return _0x514388;}function a5_0x50bb(){const _0xfce959=['file://','Skipping\x20invalid\x20directory:\x20','Skipping\x20','2849466lnnxeR','56gyeNfw','1822977xorLiT','push','uri','resolve','slice','6149724cOccKZ','2367708uSafsQ','message','isDirectory','join','656314MMQtOu','homedir','751149bRwGdH','stat','invalid\x20path\x20or\x20inaccessible','2872275vJgWTC','startsWith','4VTVpkP'];a5_0x50bb=function(){return _0xfce959;};return a5_0x50bb();}
1
+ (function(_0x8cbe4a,_0x4dcaad){const _0x4dc06c=a5_0x3393,_0x29f7ba=_0x8cbe4a();while(!![]){try{const _0x515b7f=-parseInt(_0x4dc06c(0x1a5))/0x1+parseInt(_0x4dc06c(0x196))/0x2*(-parseInt(_0x4dc06c(0x198))/0x3)+parseInt(_0x4dc06c(0x18c))/0x4*(parseInt(_0x4dc06c(0x194))/0x5)+parseInt(_0x4dc06c(0x18d))/0x6*(parseInt(_0x4dc06c(0x193))/0x7)+parseInt(_0x4dc06c(0x1a3))/0x8*(-parseInt(_0x4dc06c(0x18f))/0x9)+-parseInt(_0x4dc06c(0x19e))/0xa*(parseInt(_0x4dc06c(0x19f))/0xb)+parseInt(_0x4dc06c(0x1a4))/0xc*(parseInt(_0x4dc06c(0x18b))/0xd);if(_0x515b7f===_0x4dcaad)break;else _0x29f7ba['push'](_0x29f7ba['shift']());}catch(_0x6d1297){_0x29f7ba['push'](_0x29f7ba['shift']());}}}(a5_0x4705,0x86577));import{promises as a5_0x24b099}from'fs';function a5_0x4705(){const _0x27caaa=['28688PgVfnV','324192XRaGmh','468417TFbPBa','push','260NuWGzH','8940weOmAz','200418WVYnYA','Skipping\x20invalid\x20directory:\x20','819DgugpP','uri','invalid\x20path\x20or\x20inaccessible','slice','217kwhsre','2065niEiQX','stat','793874BkzWdD','message','3zATABr','isDirectory','resolve','startsWith','file://','Skipping\x20','3250mPUsQE','25619xutzUX','realpath','\x20due\x20to\x20error:\x20','homedir'];a5_0x4705=function(){return _0x27caaa;};return a5_0x4705();}import a5_0x6e1e22 from'path';import a5_0x58192c from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';function a5_0x3393(_0x1cb7ac,_0x8fbc16){_0x1cb7ac=_0x1cb7ac-0x18a;const _0x4705b2=a5_0x4705();let _0x339380=_0x4705b2[_0x1cb7ac];return _0x339380;}async function parseRootUri(_0x9dda97){const _0xf89cf9=a5_0x3393;try{const _0x1b0ba9=_0x9dda97[_0xf89cf9(0x19b)](_0xf89cf9(0x19c))?_0x9dda97[_0xf89cf9(0x192)](0x7):_0x9dda97,_0x4b9ad7=_0x1b0ba9[_0xf89cf9(0x19b)]('~/')||_0x1b0ba9==='~'?a5_0x6e1e22['join'](a5_0x58192c[_0xf89cf9(0x1a2)](),_0x1b0ba9[_0xf89cf9(0x192)](0x1)):_0x1b0ba9,_0x2c0c4f=a5_0x6e1e22[_0xf89cf9(0x19a)](_0x4b9ad7),_0x1a90c4=await a5_0x24b099[_0xf89cf9(0x1a0)](_0x2c0c4f);return normalizePath(_0x1a90c4);}catch{return null;}}function formatDirectoryError(_0x2e29f4,_0x13368f,_0x284c8b){const _0x25eb08=a5_0x3393;if(_0x284c8b)return _0x25eb08(0x19d)+_0x284c8b+':\x20'+_0x2e29f4;const _0x50aeca=_0x13368f instanceof Error?_0x13368f[_0x25eb08(0x197)]:String(_0x13368f);return _0x25eb08(0x18e)+_0x2e29f4+_0x25eb08(0x1a1)+_0x50aeca;}export async function getValidRootDirectories(_0x559295){const _0x5ce022=a5_0x3393,_0x5ebb83=[];for(const _0x3b5f24 of _0x559295){const _0x5c3507=await parseRootUri(_0x3b5f24[_0x5ce022(0x190)]);if(!_0x5c3507){logMcpStderr(formatDirectoryError(_0x3b5f24[_0x5ce022(0x190)],undefined,_0x5ce022(0x191)));continue;}try{const _0x483eb5=await a5_0x24b099[_0x5ce022(0x195)](_0x5c3507);_0x483eb5[_0x5ce022(0x199)]()?_0x5ebb83[_0x5ce022(0x18a)](_0x5c3507):logMcpStderr(formatDirectoryError(_0x5c3507,undefined,'non-directory\x20root'));}catch(_0x34cf2f){logMcpStderr(formatDirectoryError(_0x5c3507,_0x34cf2f));}}return _0x5ebb83;}
@@ -1 +1 @@
1
- const a6_0x447336=a6_0xeca3;(function(_0x349986,_0x216409){const _0x47c238=a6_0xeca3,_0x5ebc90=_0x349986();while(!![]){try{const _0x3f2bcc=parseInt(_0x47c238(0xc8))/0x1+-parseInt(_0x47c238(0xc7))/0x2*(-parseInt(_0x47c238(0xce))/0x3)+-parseInt(_0x47c238(0xc6))/0x4*(parseInt(_0x47c238(0xc5))/0x5)+parseInt(_0x47c238(0xd1))/0x6*(-parseInt(_0x47c238(0xcb))/0x7)+-parseInt(_0x47c238(0xc4))/0x8*(parseInt(_0x47c238(0xcf))/0x9)+-parseInt(_0x47c238(0xc9))/0xa*(parseInt(_0x47c238(0xcc))/0xb)+parseInt(_0x47c238(0xca))/0xc;if(_0x3f2bcc===_0x216409)break;else _0x5ebc90['push'](_0x5ebc90['shift']());}catch(_0x525750){_0x5ebc90['push'](_0x5ebc90['shift']());}}}(a6_0xc5eb,0x58dcf));export const TOOL_NAMES={'EDIT_FILE':a6_0x447336(0xd2),'CODEBASE_SEARCH':a6_0x447336(0xcd),'GITHUB_CODEBASE_SEARCH':a6_0x447336(0xd0)};function a6_0xeca3(_0x531dfc,_0x4afbe4){_0x531dfc=_0x531dfc-0xc4;const _0xc5ebe9=a6_0xc5eb();let _0xeca30a=_0xc5ebe9[_0x531dfc];return _0xeca30a;}export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0xc5eb(){const _0x315682=['429411KCtRUq','63ecLXgw','github_codebase_search','12SiHJmI','edit_file','649432hcDNuk','5fHtoNe','49924lPRfnB','10igoZgi','707231TxVyIH','2011930pTKkpV','4093608aYzYTC','2163490RoAopr','11ZkPdgT','codebase_search'];a6_0xc5eb=function(){return _0x315682;};return a6_0xc5eb();}
1
+ const a6_0x22315d=a6_0x2e4f;(function(_0x4a0cf8,_0x12ec71){const _0x2bc1f0=a6_0x2e4f,_0x6c2eb=_0x4a0cf8();while(!![]){try{const _0xe94340=-parseInt(_0x2bc1f0(0x168))/0x1*(parseInt(_0x2bc1f0(0x169))/0x2)+parseInt(_0x2bc1f0(0x163))/0x3*(-parseInt(_0x2bc1f0(0x164))/0x4)+parseInt(_0x2bc1f0(0x15f))/0x5+parseInt(_0x2bc1f0(0x15e))/0x6*(-parseInt(_0x2bc1f0(0x162))/0x7)+-parseInt(_0x2bc1f0(0x16a))/0x8*(parseInt(_0x2bc1f0(0x160))/0x9)+parseInt(_0x2bc1f0(0x161))/0xa+parseInt(_0x2bc1f0(0x15d))/0xb;if(_0xe94340===_0x12ec71)break;else _0x6c2eb['push'](_0x6c2eb['shift']());}catch(_0x884b83){_0x6c2eb['push'](_0x6c2eb['shift']());}}}(a6_0x42d4,0xefb67));export const TOOL_NAMES={'EDIT_FILE':a6_0x22315d(0x15c),'CODEBASE_SEARCH':a6_0x22315d(0x165),'GITHUB_CODEBASE_SEARCH':a6_0x22315d(0x167)};export const ALL_TOOL_NAMES=Object[a6_0x22315d(0x166)](TOOL_NAMES);function a6_0x2e4f(_0x2ff1f4,_0x1fb46c){_0x2ff1f4=_0x2ff1f4-0x15c;const _0x42d442=a6_0x42d4();let _0x2e4f3c=_0x42d442[_0x2ff1f4];return _0x2e4f3c;}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0x42d4(){const _0x47201e=['github_codebase_search','35SMwMDx','108466xfLVRy','1504dcVuKV','edit_file','54039623nSNJSR','7685796HINlVd','764745gzVPOQ','22122WAyoUx','5242830PPsqqV','7JwhRNz','9LdlwbE','1289116AljAGt','codebase_search','values'];a6_0x42d4=function(){return _0x47201e;};return a6_0x42d4();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.185",
3
+ "version": "0.8.187",
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.175",
38
+ "@morphllm/morphsdk": "0.2.177",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",