@morphllm/morphmcp 0.8.169 → 0.8.170

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
- function a0_0x5a7c(){const _0x3757f8=['File\x20read\x20error:','number','Error:\x20','requiresApiKey','grep\x20\x27','go.mod','Relevant\x20context\x20found:','array','Disabled\x20tools:\x20','name','Here\x20is\x20the\x20content\x20of\x20files:\x0a','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','[github_codebase_search]\x20Done\x20in\x20','filter','[could\x20not\x20read\x20file:\x20','path_validation_start','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','composer.json','TimeoutError','<file\x20path=\x22','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','setRequestHandler','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','instruction','morph-warp-grep-v2.1','sep','package.json','all','MORPH_API_URL','SymlinkError','indexOf','glob','tool_call_id','boolean','❌\x20Morph\x20Edit\x20Failed:\x20','10PZOQRF','text','completed','assistant','branch','searchGitHub','Failed\x20to\x20read\x20file:\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','sk-','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','.\x20Path:\x20','errors','status','length','resolve','Invalid\x20arguments:\x20','setNotificationHandler','slice','Morph\x20Edit\x20','Cargo.toml','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','version','list_directory\x20','file_read_failed','ReadError','role','PathError','repo_path','@morphllm/morphmcp\x20','response','WarpGrepError','path_validation_failed','etimedout','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','content','terminated','lines','has','\x20-\x20','readFile','mcp-filesystem','finish','pattern','RipgrepError','path','https://morphllm.com/api/error-report','Parent\x20directory\x20does\x20not\x20exist:\x20','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','16651iWdXbN','file_read_complete','user','payload','\x20is\x20not\x20a\x20directory','exit','size','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','Unknown\x20error','github_url','message','map','634802jduTPQ','morph-mcp','WORKSPACE_ROOT','every','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','UnknownError','getClientCapabilities','Max\x20results\x20to\x20return','grep_search','runWarpGrep_call','access','grep','ToolException','linesRemoved','error','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','match','\x22>\x0a','describe','Error\x20accessing\x20directory\x20','roots','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','constructor','MCP','object','codebase_search','\x0a...\x20(truncated,\x20total:\x20','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.','metadata','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.','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','timed\x20out','DISABLED_TOOLS','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.','tool_call_complete','BinaryFile','2096315ZILLrq','\x20disabled\x20via\x20DISABLED_TOOLS','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','Created\x20File','string','Benefits:\x0a','tool_call_error','data','Workspace\x20mode\x20enabled:\x20Using\x20','ENABLE_WORKSPACE_MODE','\x20(new\x20file)','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','8sKZygq','default','toLowerCase','safeParse','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','stack','timeout','Fallback:\x20Using\x20workspace\x20root\x20','\x20chars)','some','tsconfig.json','10260315cOnRtV','184713AEaEgg','PWD','floor','Fatal\x20error\x20running\x20server:','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','trim','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','glob\x20\x27','For\x20deletions:\x0a','Morph\x20Edit\x20Preview','toISOString','compaction_failed','warp_grep_start','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x22.\x20Known\x20tools:\x20','join','now','FileReadError','\x0aExamples:','arguments','turns','optional','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','ENOENT','linesAdded','Tool\x20\x22','\x0a</file>','pyproject.toml','node_modules','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','basename','41767902TAwKbj','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.','timings','listRoots','connect','completionId','false','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','API\x20error\x20(auth/rate-limit)','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','tool','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','owner_repo','stringify','Warning:\x20','-\x20Grepped\x20\x27','params','morph-v3-fast','description','env','EDIT_FILE','warn','api_request_start','changes','morph-v3-large','messages','code_edit','read','debug','instructions','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','unknown','terminationReason','Morph\x20FastApply\x20failed\x20without\x20error\x20message','110IYrWjt','.vscode','dirname','split','GITHUB_CODEBASE_SEARCH','Applied','\x22>\x0aError\x20reading\x20file:\x20','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','ms.\x20Success:\x20','function','Rules:\x0a','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','tool_call_received','startsWith','--api-key=','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','cwd','LocalRipgrepProvider','.\x20Changes:\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','inputSchema',',\x20modified\x20','Bearer\x20','context','log','post','normalize','Failed\x20to\x20request\x20roots\x20from\x20client:','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','4548642NFGbLy','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','search_type','Tool\x20','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','realpath','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','parse','catch','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','application/json','CODEBASE_SEARCH','substring','MORPH_WARP_GREP_TIMEOUT','utf-8','\x0aOptions:','edit_file','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','FileNotFound','\x27\x20in\x20`','GitHub\x20search\x20failed:\x20','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','github_codebase_search','code','isDirectory','homedir','Error\x20running\x20fast\x20context\x20search:\x20','-\x20Glob\x20search\x20`','push','stat','72mMZUbU','path_validation_resolved','files','includes','warp_grep_complete','source','added\x20','dryRun','--version','success','tool_calls','min','isArray','oninitialized','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','--api-key','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','search_string','--help','SubToolError','Unknown\x20tool:\x20'];a0_0x5a7c=function(){return _0x3757f8;};return a0_0x5a7c();}const a0_0x355cc9=a0_0x4f95;(function(_0x3382a7,_0x29b395){const _0x17f702=a0_0x4f95,_0x4d088c=_0x3382a7();while(!![]){try{const _0xbe40f4=-parseInt(_0x17f702(0x283))/0x1*(-parseInt(_0x17f702(0x1dd))/0x2)+-parseInt(_0x17f702(0x19c))/0x3*(-parseInt(_0x17f702(0x21a))/0x4)+parseInt(_0x17f702(0x183))/0x5+parseInt(_0x17f702(0x1fa))/0x6+parseInt(_0x17f702(0x28f))/0x7*(parseInt(_0x17f702(0x190))/0x8)+-parseInt(_0x17f702(0x19b))/0x9*(-parseInt(_0x17f702(0x253))/0xa)+-parseInt(_0x17f702(0x1bb))/0xb;if(_0xbe40f4===_0x29b395)break;else _0x4d088c['push'](_0x4d088c['shift']());}catch(_0xdd462d){_0x4d088c['push'](_0x4d088c['shift']());}}}(a0_0x5a7c,0x9b0d4));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_0xb2718a from'fs/promises';import a0_0x5d6800 from'path';import a0_0x10ca96 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_0x2097e4 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x415f25){const _0x43fc68=a0_0x4f95,_0x265646=_0x415f25[_0x43fc68(0x1e0)](a0_0x5d6800[_0x43fc68(0x249)])['filter'](Boolean);if(_0x265646['length']<0x2)return null;for(let _0x3d6335=Math[_0x43fc68(0x19e)](_0x265646[_0x43fc68(0x260)]/0x2);_0x3d6335>=0x1;_0x3d6335--){for(let _0x3968ff=0x0;_0x3968ff<=_0x265646[_0x43fc68(0x260)]-0x2*_0x3d6335;_0x3968ff++){const _0x408ec6=_0x265646[_0x43fc68(0x264)](_0x3968ff,_0x3968ff+_0x3d6335),_0x3d53a8=_0x265646[_0x43fc68(0x264)](_0x3968ff+_0x3d6335,_0x3968ff+0x2*_0x3d6335);if(_0x408ec6[_0x43fc68(0x292)]((_0x3ee57a,_0x1be45a)=>_0x3ee57a===_0x3d53a8[_0x1be45a])){const _0x1a35b1=[..._0x265646['slice'](0x0,_0x3968ff),..._0x265646[_0x43fc68(0x264)](_0x3968ff+_0x3d6335)];return a0_0x5d6800[_0x43fc68(0x249)]+_0x1a35b1['join'](a0_0x5d6800[_0x43fc68(0x249)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x22d5ae=a0_0x4f95;try{const _0x188ee0=require('../package.json');return _0x188ee0[_0x22d5ae(0x268)]??_0x22d5ae(0x1da);}catch(_0x1b04d2){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0x1b04d2),_0x22d5ae(0x1da);}}function printHelp(){const _0xe2af85=a0_0x4f95;console['log'](_0xe2af85(0x26f)+getPackageVersion()),console[_0xe2af85(0x1f5)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0xe2af85(0x1f5)](_0xe2af85(0x20b)),console[_0xe2af85(0x1f5)](_0xe2af85(0x22b)),console[_0xe2af85(0x1f5)](_0xe2af85(0x1d9)),console[_0xe2af85(0x1f5)](_0xe2af85(0x1a0)),console['log'](_0xe2af85(0x1ae)),console['log']('\x20\x20morph-mcp'),console[_0xe2af85(0x1f5)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0x355cc9(0x264)](0x2),VERSION_FLAGS=new Set([a0_0x355cc9(0x222),'-v','-V']),HELP_FLAGS=new Set([a0_0x355cc9(0x22d),'-h']);cliArgs[a0_0x355cc9(0x199)](_0x2ffe21=>VERSION_FLAGS[a0_0x355cc9(0x278)](_0x2ffe21))&&(console[a0_0x355cc9(0x1f5)](a0_0x355cc9(0x26f)+getPackageVersion()),process[a0_0x355cc9(0x288)](0x0));cliArgs[a0_0x355cc9(0x199)](_0x5de7c3=>HELP_FLAGS[a0_0x355cc9(0x278)](_0x5de7c3))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x42d3bd){const _0x252eb3=a0_0x355cc9;for(let _0x22edb1=0x0;_0x22edb1<cliArgs[_0x252eb3(0x260)];_0x22edb1++){const _0x456e96=cliArgs[_0x22edb1];if(_0x456e96[_0x252eb3(0x1ea)]('--'+_0x42d3bd+'='))return _0x456e96['slice'](('--'+_0x42d3bd+'=')[_0x252eb3(0x260)]);if(_0x456e96==='--'+_0x42d3bd&&_0x22edb1+0x1<cliArgs[_0x252eb3(0x260)])return cliArgs[_0x22edb1+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x355cc9(0x278)](arg)||HELP_FLAGS[a0_0x355cc9(0x278)](arg))continue;if(arg['startsWith'](a0_0x355cc9(0x1eb)))continue;if(arg===a0_0x355cc9(0x229)){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process[a0_0x355cc9(0x1ce)][a0_0x355cc9(0x291)]||process[a0_0x355cc9(0x1ce)][a0_0x355cc9(0x19d)]||process[a0_0x355cc9(0x1ed)](),ENABLE_WORKSPACE_MODE=process['env'][a0_0x355cc9(0x18c)]!==a0_0x355cc9(0x1c1),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x355cc9(0x1ce)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x355cc9(0x1ce)][a0_0x355cc9(0x24c)],MORPH_LARGE_APPLY=process[a0_0x355cc9(0x1ce)]['MORPH_LARGE_APPLY']!==a0_0x355cc9(0x1c1),MORPH_WARP_GREP_TIMEOUT=process[a0_0x355cc9(0x1ce)][a0_0x355cc9(0x209)]?parseInt(process[a0_0x355cc9(0x1ce)][a0_0x355cc9(0x209)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x355cc9(0x1ce)][a0_0x355cc9(0x17f)]?new Set(process[a0_0x355cc9(0x1ce)]['DISABLED_TOOLS']['split'](',')[a0_0x355cc9(0x28e)](_0x5c9d65=>_0x5c9d65[a0_0x355cc9(0x1a1)]())[a0_0x355cc9(0x23d)](_0x46c6c0=>_0x46c6c0[a0_0x355cc9(0x260)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x355cc9(0x289)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console['error'](a0_0x355cc9(0x274)+tool+a0_0x355cc9(0x1aa)+[...KNOWN_TOOL_NAMES][a0_0x355cc9(0x1ab)](',\x20'));}console[a0_0x355cc9(0x16c)](a0_0x355cc9(0x238)+[...DISABLED_TOOLS][a0_0x355cc9(0x1ab)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x355cc9(0x1ea)]('sk-')&&!MORPH_API_KEY[a0_0x355cc9(0x1ea)]('morph-')&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x22daf5){const _0x3a4847=a0_0x355cc9;try{await a0_0x2097e4[_0x3a4847(0x1f6)](_0x3a4847(0x280),{..._0x22daf5,'timestamp':new Date()[_0x3a4847(0x1a6)](),'source':_0x22daf5[_0x3a4847(0x21f)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x22daf5[_0x3a4847(0x1f4)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x3a4847(0x206),'Authorization':_0x3a4847(0x1f3)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1fd9a7,_0x5414f3){const _0x4ce305=a0_0x355cc9;if(_0x1fd9a7&&typeof _0x1fd9a7===_0x4ce305(0x176)&&'status'in _0x1fd9a7)return _0x1fd9a7[_0x4ce305(0x25f)];if(_0x1fd9a7&&typeof _0x1fd9a7===_0x4ce305(0x176)&&_0x4ce305(0x270)in _0x1fd9a7)return _0x1fd9a7[_0x4ce305(0x270)]?.['status'];const _0x5998dd=_0x5414f3[_0x4ce305(0x16e)](/\b(401|429)\b/);return _0x5998dd?parseInt(_0x5998dd[0x1],0xa):null;}function handleMorphAPIError(_0x13ddc1){const _0x58518b=a0_0x355cc9,_0x282ed8=_0x13ddc1 instanceof Error?_0x13ddc1[_0x58518b(0x28d)]:String(_0x13ddc1),_0x1b3481=extractStatusCode(_0x13ddc1,_0x282ed8);switch(_0x1b3481){case 0x191:return{'content':[{'type':_0x58518b(0x254),'text':'Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.'}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x58518b(0x254),'text':_0x58518b(0x1b2)}],'isError':!![]};default:return null;}}args[a0_0x355cc9(0x260)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x355cc9(0x1ec)),logMcpStderr(a0_0x355cc9(0x211)),logMcpStderr(a0_0x355cc9(0x1a2)),logMcpStderr(a0_0x355cc9(0x194)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr('At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.'));function normalizePath(_0x43cac0){const _0x5a3b23=a0_0x355cc9;return a0_0x5d6800[_0x5a3b23(0x1f7)](_0x43cac0);}function expandHome(_0x2690d9){const _0x96d711=a0_0x355cc9;if(_0x2690d9['startsWith']('~/')||_0x2690d9==='~')return a0_0x5d6800[_0x96d711(0x1ab)](a0_0x10ca96[_0x96d711(0x215)](),_0x2690d9[_0x96d711(0x264)](0x1));return _0x2690d9;}let allowedDirectories=await Promise[a0_0x355cc9(0x24b)](args[a0_0x355cc9(0x28e)](async _0x252924=>{const _0x45da49=a0_0x355cc9,_0x4192c8=expandHome(_0x252924),_0x4a42c0=a0_0x5d6800[_0x45da49(0x261)](_0x4192c8);try{const _0x26af99=await a0_0xb2718a[_0x45da49(0x201)](_0x4a42c0);return normalizePath(_0x26af99);}catch(_0x3e6ac1){return normalizePath(_0x4a42c0);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x355cc9(0x218)](workspaceDir),logMcpStderr(a0_0x355cc9(0x18b)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x32a608){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x32a608);}async function detectWorkspaceRoot(_0x32c21d){const _0x23d736=a0_0x355cc9;let _0x36cfd6=a0_0x5d6800[_0x23d736(0x261)](_0x32c21d);const _0x4c0c61=['.git',_0x23d736(0x1de),_0x23d736(0x24a),_0x23d736(0x266),_0x23d736(0x1b7),_0x23d736(0x235),'.cursor',_0x23d736(0x19a),_0x23d736(0x241)];while(_0x36cfd6!==a0_0x5d6800[_0x23d736(0x1df)](_0x36cfd6)){for(const _0x5d545e of _0x4c0c61){const _0x436652=a0_0x5d6800[_0x23d736(0x1ab)](_0x36cfd6,_0x5d545e);try{return await a0_0xb2718a[_0x23d736(0x29a)](_0x436652),normalizePath(_0x36cfd6);}catch{}}_0x36cfd6=a0_0x5d6800[_0x23d736(0x1df)](_0x36cfd6);}return normalizePath(_0x32c21d);}await Promise[a0_0x355cc9(0x24b)](args['map'](async _0x274b2a=>{const _0x10fc96=a0_0x355cc9;try{const _0x56d26f=await a0_0xb2718a[_0x10fc96(0x219)](expandHome(_0x274b2a));!_0x56d26f[_0x10fc96(0x214)]()&&(logMcpStderr(_0x10fc96(0x232)+_0x274b2a+_0x10fc96(0x287)),process[_0x10fc96(0x288)](0x1));}catch(_0x949af9){logMcpStderr(_0x10fc96(0x171)+_0x274b2a+':',_0x949af9),process[_0x10fc96(0x288)](0x1);}}));async function validatePath(_0x29b95b){const _0x10b2d2=a0_0x355cc9,_0x2fdbdf=expandHome(_0x29b95b),_0xa77bc9=a0_0x5d6800[_0x10b2d2(0x261)](_0x2fdbdf);logger[_0x10b2d2(0x1d7)](_0x10b2d2(0x175),_0x10b2d2(0x23f),{'raw_path':_0x29b95b,'absolute':_0xa77bc9});try{const _0x5127a3=await a0_0xb2718a['realpath'](_0xa77bc9);return logger[_0x10b2d2(0x1d7)](_0x10b2d2(0x175),'path_validation_resolved',{'resolved':_0x5127a3,'symlink':_0x5127a3!==_0xa77bc9}),_0x5127a3;}catch(_0xb22d25){if(_0xb22d25['code']===_0x10b2d2(0x1b3)){const _0x54bc35=a0_0x5d6800[_0x10b2d2(0x1df)](_0xa77bc9);try{const _0x2c0883=await a0_0xb2718a['realpath'](_0x54bc35),_0x9157b9=a0_0x5d6800[_0x10b2d2(0x1ab)](_0x2c0883,a0_0x5d6800['basename'](_0xa77bc9));return logger[_0x10b2d2(0x1d7)](_0x10b2d2(0x175),_0x10b2d2(0x21b),{'resolved':_0x9157b9,'new_file':!![]}),_0x9157b9;}catch{logger[_0x10b2d2(0x16c)](_0x10b2d2(0x175),_0x10b2d2(0x272),{'raw_path':_0x29b95b,'error':_0x10b2d2(0x281)+_0x54bc35});throw new Error(_0x10b2d2(0x281)+_0x54bc35);}}logger[_0x10b2d2(0x16c)](_0x10b2d2(0x175),_0x10b2d2(0x272),{'raw_path':_0x29b95b,'error':_0xb22d25['message']});throw _0xb22d25;}}const MorphEditFileArgsSchema=z[a0_0x355cc9(0x176)]({'path':z[a0_0x355cc9(0x187)](),'code_edit':z[a0_0x355cc9(0x187)]()[a0_0x355cc9(0x170)](a0_0x355cc9(0x240)),'instruction':z[a0_0x355cc9(0x187)]()['describe'](a0_0x355cc9(0x25a)),'dryRun':z[a0_0x355cc9(0x251)]()['default'](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x355cc9(0x1bc),WarpGrepArgsSchema=z[a0_0x355cc9(0x176)]({'search_string':z['string']()[a0_0x355cc9(0x170)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z['string']()['describe'](a0_0x355cc9(0x246)),'search_type':z['enum']([a0_0x355cc9(0x191),a0_0x355cc9(0x1b8)])[a0_0x355cc9(0x1b1)]()[a0_0x355cc9(0x170)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z[a0_0x355cc9(0x187)]()[a0_0x355cc9(0x170)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()['describe'](a0_0x355cc9(0x179)),'owner_repo':z[a0_0x355cc9(0x187)]()[a0_0x355cc9(0x1b1)]()[a0_0x355cc9(0x170)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x355cc9(0x187)]()['optional']()[a0_0x355cc9(0x170)]('Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)')}),CodebaseSearchArgsSchema=z[a0_0x355cc9(0x176)]({'query':z[a0_0x355cc9(0x187)]()[a0_0x355cc9(0x170)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x355cc9(0x170)]('Repository\x20identifier'),'branch':z[a0_0x355cc9(0x187)]()['optional']()[a0_0x355cc9(0x170)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x355cc9(0x187)]()['optional']()[a0_0x355cc9(0x170)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x355cc9(0x237)](z['string']())[a0_0x355cc9(0x191)]([])[a0_0x355cc9(0x170)](a0_0x355cc9(0x18e)),'limit':z[a0_0x355cc9(0x231)]()[a0_0x355cc9(0x1b1)]()[a0_0x355cc9(0x191)](0xa)[a0_0x355cc9(0x170)](a0_0x355cc9(0x297))}),server=new Server({'name':a0_0x355cc9(0x290),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x355cc9(0x245)](ListToolsRequestSchema,async()=>{const _0x2beb01=a0_0x355cc9,_0x41f653=[{'name':TOOL_NAMES[_0x2beb01(0x1cf)],'description':_0x2beb01(0x267)+_0x2beb01(0x185)+_0x2beb01(0x22a)+_0x2beb01(0x205)+_0x2beb01(0x188)+_0x2beb01(0x1b9)+_0x2beb01(0x1e8)+_0x2beb01(0x18f)+_0x2beb01(0x1fc)+_0x2beb01(0x282)+_0x2beb01(0x1c6)+_0x2beb01(0x293)+_0x2beb01(0x1a4)+_0x2beb01(0x200)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x2beb01(0x1e7)+_0x2beb01(0x202)+_0x2beb01(0x244)+'-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a'+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+_0x2beb01(0x1f0)+_0x2beb01(0x1fb)+_0x2beb01(0x1f9),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x2beb01(0x207)],'description':_0x2beb01(0x23b)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x2beb01(0x1a9)+_0x2beb01(0x25c)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x1f2895=_0x41f653['filter'](_0x4becc3=>{const _0x3d0377=_0x2beb01;if(DISABLED_TOOLS[_0x3d0377(0x278)](_0x4becc3[_0x3d0377(0x239)]))return console['error'](_0x3d0377(0x1fe)+_0x4becc3['name']+_0x3d0377(0x184)),![];if(_0x3d0377(0x233)in _0x4becc3&&_0x4becc3[_0x3d0377(0x233)]&&!MORPH_API_KEY)return logMcpStderr(_0x3d0377(0x1c9)+_0x4becc3['name']+'\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config'),![];return!![];});return{'tools':_0x1f2895[_0x2beb01(0x28e)](_0x52f12c=>({'name':_0x52f12c[_0x2beb01(0x239)],'description':_0x52f12c[_0x2beb01(0x1cd)],'inputSchema':_0x52f12c[_0x2beb01(0x1f1)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0xdcd80b=>{const _0x9bc4f=a0_0x355cc9,{name:_0x1ab2bd,arguments:_0x235774}=_0xdcd80b[_0x9bc4f(0x1cb)],_0x35f718=Date[_0x9bc4f(0x1ac)]();logger[_0x9bc4f(0x1d7)](_0x9bc4f(0x175),_0x9bc4f(0x1e9),{'tool':_0x1ab2bd,'args':_0x1ab2bd===_0x9bc4f(0x20c)?{'path':_0x235774?.['path'],'instruction':_0x235774?.[_0x9bc4f(0x247)]||_0x235774?.[_0x9bc4f(0x1d8)],'dryRun':_0x235774?.[_0x9bc4f(0x221)]}:_0x235774});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x228)}],'isError':!![]};if(!MORPH_API_KEY[_0x9bc4f(0x1ea)](_0x9bc4f(0x25b))&&!MORPH_API_KEY[_0x9bc4f(0x1ea)]('morph-'))return{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x17b)}],'isError':!![]};if(DISABLED_TOOLS[_0x9bc4f(0x278)](_0x1ab2bd))return{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x1b5)+_0x1ab2bd+_0x9bc4f(0x17c)}],'isError':![]};switch(_0x1ab2bd){case TOOL_NAMES[_0x9bc4f(0x1cf)]:{const _0x3ee0dd=_0x235774&&typeof _0x235774===_0x9bc4f(0x176)&&'instructions'in _0x235774&&!('instruction'in _0x235774)?{..._0x235774,'instruction':_0x235774[_0x9bc4f(0x1d8)],'instructions':undefined}:_0x235774,_0x4a4d9b=MorphEditFileArgsSchema[_0x9bc4f(0x193)](_0x3ee0dd);if(!_0x4a4d9b[_0x9bc4f(0x223)])throw new Error(_0x9bc4f(0x1c4)+_0x4a4d9b[_0x9bc4f(0x16c)]);const _0x1bc15f=await validatePath(_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x27f)]);let _0x7f6fb1=null,_0x5ac1d5=!![],_0x5a35ad=null;try{_0x7f6fb1=await a0_0xb2718a[_0x9bc4f(0x27a)](_0x1bc15f,'utf-8'),logger[_0x9bc4f(0x1d7)]('MCP',_0x9bc4f(0x284),{'path':_0x1bc15f,'size_bytes':_0x7f6fb1[_0x9bc4f(0x260)]});}catch(_0x48173d){const _0x69ed00=_0x48173d[_0x9bc4f(0x213)];_0x69ed00==='ENOENT'?(_0x5ac1d5=![],_0x7f6fb1='',logger[_0x9bc4f(0x1d7)](_0x9bc4f(0x175),'file_read_complete',{'path':_0x1bc15f,'exists':![]})):(_0x5a35ad=_0x9bc4f(0x259)+(_0x69ed00||_0x9bc4f(0x1da))+_0x9bc4f(0x279)+(_0x48173d instanceof Error?_0x48173d[_0x9bc4f(0x28d)]:String(_0x48173d)),logger[_0x9bc4f(0x16c)](_0x9bc4f(0x175),_0x9bc4f(0x26a),{'path':_0x1bc15f,'error':_0x5a35ad}),logMcpStderr(_0x9bc4f(0x1c9)+_0x5a35ad));}let _0xf9f0d0;try{const _0x2b04ce=MORPH_API_KEY;if(!_0x2b04ce)throw new Error(_0x9bc4f(0x294));const _0x4318de=a0_0x5d6800['dirname'](_0x1bc15f),_0x35dba7=a0_0x5d6800[_0x9bc4f(0x1ba)](_0x1bc15f);logger[_0x9bc4f(0x1d7)](_0x9bc4f(0x175),_0x9bc4f(0x1d1),{'model':_0x9bc4f(0x1cc),'path':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x27f)],'instruction_len':_0x4a4d9b[_0x9bc4f(0x18a)]['instruction'][_0x9bc4f(0x260)],'code_edit_len':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x1d5)][_0x9bc4f(0x260)],'original_code_len':_0x7f6fb1?.[_0x9bc4f(0x260)]??0x0,'dry_run':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x221)]});const _0x124f62=Date[_0x9bc4f(0x1ac)](),_0x29a44f=await executeEditFile({'target_filepath':_0x35dba7,'code_edit':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x1d5)],'instruction':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x247)]},{'morphApiKey':_0x2b04ce,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x4318de,'autoWrite':!_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x221)],'generateUdiff':![],'debug':![]}),_0x375559=Date[_0x9bc4f(0x1ac)]()-_0x124f62;_0xf9f0d0=_0x29a44f[_0x9bc4f(0x1c0)];if(!_0x29a44f[_0x9bc4f(0x223)])throw new Error(_0x29a44f[_0x9bc4f(0x16c)]||_0x9bc4f(0x1dc));const _0xee12bb=_0x29a44f[_0x9bc4f(0x1d2)],_0x4784cb=_0x9bc4f(0x220)+_0xee12bb[_0x9bc4f(0x1b4)]+',\x20removed\x20'+_0xee12bb[_0x9bc4f(0x16b)]+_0x9bc4f(0x1f2)+_0xee12bb['linesModified'];logger[_0x9bc4f(0x1d7)](_0x9bc4f(0x175),_0x9bc4f(0x181),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x9bc4f(0x1ac)]()-_0x35f718,'edit_latency_ms':_0x375559,'changes':{'added':_0xee12bb[_0x9bc4f(0x1b4)],'removed':_0xee12bb[_0x9bc4f(0x16b)],'modified':_0xee12bb['linesModified']},'completion_id':_0xf9f0d0});if(_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x221)])return{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x1a5)+(_0x5ac1d5?'':_0x9bc4f(0x18d))+':\x20'+_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x247)]+_0x9bc4f(0x1ef)+_0x4784cb+_0x9bc4f(0x25d)+_0x4a4d9b['data'][_0x9bc4f(0x27f)]+'.'}]};return{'content':[{'type':'text','text':_0x9bc4f(0x265)+(_0x5ac1d5?_0x9bc4f(0x1e2):_0x9bc4f(0x186))+':\x20'+_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x247)]+_0x9bc4f(0x1ef)+_0x4784cb+_0x9bc4f(0x25d)+_0x4a4d9b[_0x9bc4f(0x18a)]['path']+'.'}]};}catch(_0x4eda4f){const _0x4d65b0=handleMorphAPIError(_0x4eda4f);if(_0x4d65b0)return logger[_0x9bc4f(0x16c)](_0x9bc4f(0x175),_0x9bc4f(0x189),{'tool':_0x9bc4f(0x20c),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x9bc4f(0x1ac)]()-_0x35f718}),_0x4d65b0;const _0xa28a5a=_0x4eda4f instanceof Error?_0x4eda4f[_0x9bc4f(0x28d)]:String(_0x4eda4f);return logger[_0x9bc4f(0x16c)](_0x9bc4f(0x175),_0x9bc4f(0x189),{'tool':'edit_file','error':_0xa28a5a,'path':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x27f)],'validated_path':_0x1bc15f,'latency_ms':Date[_0x9bc4f(0x1ac)]()-_0x35f718,'stack':_0x4eda4f instanceof Error?_0x4eda4f[_0x9bc4f(0x195)]:undefined}),reportMorphError({'error_message':_0xa28a5a,'error_type':_0x4eda4f instanceof Error?_0x4eda4f[_0x9bc4f(0x174)][_0x9bc4f(0x239)]:_0x9bc4f(0x295),'context':{'tool':'edit_file','completion_id':_0xf9f0d0,'file_path':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x27f)],'validated_path':_0x1bc15f,'instruction':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x247)],'model':MORPH_LARGE_APPLY?_0x9bc4f(0x1d3):_0x9bc4f(0x1cc),'dry_run':_0x4a4d9b['data'][_0x9bc4f(0x221)],'file_exists':_0x5ac1d5,'file_read_error':_0x5a35ad,'file_readable':_0x7f6fb1!==null,'request_content':{'path':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x27f)],'code_edit':_0x4a4d9b[_0x9bc4f(0x18a)][_0x9bc4f(0x1d5)],'instruction':_0x4a4d9b['data'][_0x9bc4f(0x247)],'original_code':_0x7f6fb1!==null?_0x7f6fb1[_0x9bc4f(0x260)]>0xc350?_0x7f6fb1['substring'](0x0,0xc350)+_0x9bc4f(0x178)+_0x7f6fb1['length']+_0x9bc4f(0x198):_0x7f6fb1:_0x9bc4f(0x23e)+(_0x5a35ad||'unknown\x20error')+']','original_code_length':_0x7f6fb1?.[_0x9bc4f(0x260)]??0x0,'model':MORPH_LARGE_APPLY?_0x9bc4f(0x1d3):_0x9bc4f(0x1cc),'dry_run':_0x4a4d9b[_0x9bc4f(0x18a)]['dryRun']}},'stack_trace':_0x4eda4f instanceof Error?_0x4eda4f['stack']:undefined,'source':'mcp-filesystem'})[_0x9bc4f(0x204)](()=>{}),{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x252)+_0xa28a5a}],'isError':!![]};}}case TOOL_NAMES[_0x9bc4f(0x207)]:{const _0x173949=WarpGrepArgsSchema[_0x9bc4f(0x193)](_0x235774);if(!_0x173949[_0x9bc4f(0x223)])return{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x262)+_0x173949[_0x9bc4f(0x16c)]}],'isError':!![]};const _0xa554a7=_0x26f0e6=>{const _0x1f64bd=_0x9bc4f,_0x4b03e3=[];for(const _0x418fac of _0x26f0e6||[]){if(_0x418fac['role']===_0x1f64bd(0x256)&&Array[_0x1f64bd(0x226)](_0x418fac['tool_calls']))for(const _0x3059dc of _0x418fac[_0x1f64bd(0x224)]){try{const _0x317b3a=_0x3059dc[_0x1f64bd(0x1e6)]?.[_0x1f64bd(0x239)],_0x342825=JSON[_0x1f64bd(0x203)](_0x3059dc[_0x1f64bd(0x1e6)]?.[_0x1f64bd(0x1af)]||'{}');if(_0x317b3a===_0x1f64bd(0x298))_0x4b03e3['push'](_0x1f64bd(0x234)+_0x342825['pattern']+'\x27\x20'+(_0x342825[_0x1f64bd(0x27f)]||'.'));else{if(_0x317b3a==='read')_0x4b03e3[_0x1f64bd(0x218)]('read\x20'+_0x342825[_0x1f64bd(0x27f)]);else{if(_0x317b3a==='list_directory')_0x4b03e3['push'](_0x1f64bd(0x269)+(_0x342825['command']||'.'));else{if(_0x317b3a===_0x1f64bd(0x24f))_0x4b03e3[_0x1f64bd(0x218)](_0x1f64bd(0x1a3)+_0x342825[_0x1f64bd(0x27d)]+'\x27\x20'+(_0x342825[_0x1f64bd(0x27f)]||'.'));else _0x317b3a===_0x1f64bd(0x27c)&&_0x4b03e3['push'](_0x1f64bd(0x27c));}}}}catch{}}}return _0x4b03e3;},_0x6dccc=_0x459f7c=>{const _0x2f1210=_0x9bc4f,_0x2e28d8=[];if(!_0x459f7c||!Array[_0x2f1210(0x226)](_0x459f7c))return _0x2e28d8;const _0x2a196d=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2f1210(0x20e),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x2f1210(0x26d),'tool':_0x2f1210(0x1d6)},{'pattern':/\[READ ERROR\]/,'error_type':_0x2f1210(0x26b),'tool':_0x2f1210(0x1d6)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2f1210(0x182),'tool':_0x2f1210(0x1d6)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2f1210(0x27e),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x2f1210(0x169)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2f1210(0x182),'tool':_0x2f1210(0x1d6)},{'pattern':/\[SYMLINK\]/,'error_type':_0x2f1210(0x24d),'tool':_0x2f1210(0x1d6)},{'pattern':/not a text file/,'error_type':_0x2f1210(0x182),'tool':_0x2f1210(0x1d6)},{'pattern':/symbolic link/,'error_type':_0x2f1210(0x24d),'tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x2f1210(0x26b),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x2f1210(0x16a),'tool':_0x2f1210(0x1da)}];let _0x3b0c28=0x0;for(const _0x5e0c96 of _0x459f7c){_0x5e0c96[_0x2f1210(0x26c)]==='assistant'&&Array[_0x2f1210(0x226)](_0x5e0c96[_0x2f1210(0x224)])&&_0x3b0c28++;const _0xeaee01=_0x5e0c96[_0x2f1210(0x275)];if((_0x5e0c96[_0x2f1210(0x26c)]===_0x2f1210(0x1c5)||_0x5e0c96[_0x2f1210(0x26c)]===_0x2f1210(0x285))&&_0xeaee01&&typeof _0xeaee01===_0x2f1210(0x187))for(const {pattern:_0x4e66a7,error_type:_0x462f58,tool:_0x1d35e6}of _0x2a196d){const _0x121a1f=_0xeaee01[_0x2f1210(0x16e)](new RegExp(_0x4e66a7[_0x2f1210(0x21f)],'g'));if(_0x121a1f)for(const _0x599422 of _0x121a1f){const _0x338a22=_0xeaee01[_0x2f1210(0x24e)](_0x599422),_0x56bc77=_0xeaee01[_0x2f1210(0x208)](_0x338a22,Math[_0x2f1210(0x225)](_0x338a22+0xc8,_0xeaee01[_0x2f1210(0x260)]));_0x2e28d8['push']({'tool':_0x1d35e6,'error_type':_0x462f58,'error_message':_0x56bc77['split']('\x0a')[0x0],'turn':_0x3b0c28});}}}return _0x2e28d8;};try{const _0xb85a78=a0_0x5d6800['resolve'](_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x26e)]),_0xbd58a3=_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x1fd)],_0x43e3fd=_0xbd58a3==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x154ab4=new LocalRipgrepProvider(_0xb85a78,undefined,_0x43e3fd);logger['debug'](_0x9bc4f(0x175),'provider_created',{'type':_0x9bc4f(0x1ee),'repo_root':_0xb85a78,'search_type':_0xbd58a3||'default'}),logger[_0x9bc4f(0x1d7)](_0x9bc4f(0x175),_0x9bc4f(0x1a8),{'query':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],'repo_root':_0xb85a78,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0xded20f=Date['now'](),_0x5c36ed=await runWarpGrep({'searchTerm':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],'repoRoot':_0xb85a78,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x154ab4,'search_type':_0xbd58a3}),_0x5eb79e=Date[_0x9bc4f(0x1ac)]()-_0xded20f,_0x327c4f=_0x5c36ed[_0x9bc4f(0x27c)]?.[_0x9bc4f(0x17a)]?.[_0x9bc4f(0x21c)]?.[_0x9bc4f(0x260)]??0x0;logger[_0x9bc4f(0x1d7)]('MCP',_0x9bc4f(0x21e),{'termination':_0x5c36ed['terminationReason'],'turns':_0x5c36ed[_0x9bc4f(0x1bd)]?.[_0x9bc4f(0x1b0)]??0x0,'files_found':_0x327c4f,'latency_ms':_0x5eb79e});const _0x21adf3=_0x6dccc(_0x5c36ed[_0x9bc4f(0x1d4)]);_0x21adf3['length']>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x21adf3[_0x9bc4f(0x260)]+'\x20error(s)','error_type':_0x9bc4f(0x22e),'level':_0x9bc4f(0x1d0),'tool':_0x9bc4f(0x177),'context':{'repo_path':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x26e)],'query':_0x173949['data']['search_string'],'model':_0x9bc4f(0x248),'termination_reason':_0x5c36ed['terminationReason'],'sub_tool_errors':_0x21adf3,'timings':_0x5c36ed[_0x9bc4f(0x1bd)],'tool_calls':_0xa554a7(_0x5c36ed[_0x9bc4f(0x1d4)]),'messages':_0x5c36ed[_0x9bc4f(0x1d4)]?.[_0x9bc4f(0x28e)](_0x33aa26=>({'role':_0x33aa26[_0x9bc4f(0x26c)],'content':_0x33aa26[_0x9bc4f(0x275)],..._0x33aa26[_0x9bc4f(0x224)]?{'tool_calls':_0x33aa26[_0x9bc4f(0x224)][_0x9bc4f(0x260)]}:{},..._0x33aa26[_0x9bc4f(0x250)]?{'tool_call_id':_0x33aa26[_0x9bc4f(0x250)]}:{}}))},'source':'mcp-filesystem'})['catch'](()=>{});let _0x34d829='';if(_0x5c36ed[_0x9bc4f(0x1db)]===_0x9bc4f(0x255)&&_0x5c36ed[_0x9bc4f(0x27c)]?.[_0x9bc4f(0x17a)]?.['files']){const _0x44788a=_0x5c36ed[_0x9bc4f(0x27c)][_0x9bc4f(0x17a)]['files'];if(_0x44788a['length']===0x0)return _0x34d829=_0x5c36ed['finish'][_0x9bc4f(0x286)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x9bc4f(0x254),'text':_0x34d829}]};const _0x4b7f10=[],_0x244a5c=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x39059d of _0x5c36ed['messages']){if(_0x39059d[_0x9bc4f(0x26c)]===_0x9bc4f(0x256)&&Array[_0x9bc4f(0x226)](_0x39059d[_0x9bc4f(0x224)]))for(const _0x3159b of _0x39059d[_0x9bc4f(0x224)]){try{const _0x333e86=_0x3159b[_0x9bc4f(0x1e6)]?.['name'],_0x33fd12=JSON[_0x9bc4f(0x203)](_0x3159b['function']?.[_0x9bc4f(0x1af)]||'{}');if(_0x333e86==='grep_search')_0x244a5c[_0x9bc4f(0x218)](_0x9bc4f(0x1ca)+_0x33fd12['pattern']+_0x9bc4f(0x20f)+(_0x33fd12[_0x9bc4f(0x27f)]||'.')+'`');else{if(_0x333e86===_0x9bc4f(0x1d6))_0x244a5c['push']('-\x20Read\x20file\x20`'+_0x33fd12[_0x9bc4f(0x27f)]+'`');else{if(_0x333e86==='list_directory')_0x244a5c[_0x9bc4f(0x218)]('-\x20Listed\x20directory\x20`'+(_0x33fd12['command']||'.')+'`');else _0x333e86===_0x9bc4f(0x24f)&&_0x244a5c[_0x9bc4f(0x218)](_0x9bc4f(0x217)+_0x33fd12['pattern']+'`\x20in\x20`'+(_0x33fd12[_0x9bc4f(0x27f)]||'.')+'`');}}}catch{}}}_0x4b7f10[_0x9bc4f(0x218)](_0x244a5c[_0x9bc4f(0x1ab)]('\x0a'));const _0x268e32=['',_0x9bc4f(0x236)];for(const _0x2820e0 of _0x44788a){if(_0x2820e0[_0x9bc4f(0x277)]==='*')_0x268e32[_0x9bc4f(0x218)]('-\x20'+_0x2820e0[_0x9bc4f(0x27f)]+':*');else{if(Array[_0x9bc4f(0x226)](_0x2820e0[_0x9bc4f(0x277)])){const _0x14c627=_0x2820e0[_0x9bc4f(0x277)][_0x9bc4f(0x28e)](([_0x3f4dd4,_0x585dda])=>{if(_0x3f4dd4===_0x585dda)return''+_0x3f4dd4;return _0x3f4dd4+'-'+_0x585dda;});_0x268e32['push']('-\x20'+_0x2820e0[_0x9bc4f(0x27f)]+':'+_0x14c627[_0x9bc4f(0x1ab)](','));}else _0x268e32[_0x9bc4f(0x218)]('-\x20'+_0x2820e0['path']+':*');}}_0x268e32['push'](''),_0x4b7f10['push'](_0x268e32[_0x9bc4f(0x1ab)]('\x0a')),_0x4b7f10[_0x9bc4f(0x218)](_0x9bc4f(0x23a));const _0x365ebd=[],_0x3b292e=[];for(const _0x40bf80 of _0x44788a){let _0x59e673=a0_0x5d6800[_0x9bc4f(0x261)](_0x173949[_0x9bc4f(0x18a)]['repo_path'],_0x40bf80[_0x9bc4f(0x27f)]),_0x3fa6de=null,_0x1538f8=null;try{_0x3fa6de=await a0_0xb2718a[_0x9bc4f(0x27a)](_0x59e673,{'encoding':_0x9bc4f(0x20a)});}catch(_0x5cc43f){const _0x37f59d=fixPathRepetition(_0x59e673);if(_0x37f59d)try{_0x3fa6de=await a0_0xb2718a['readFile'](_0x37f59d,{'encoding':_0x9bc4f(0x20a)}),_0x59e673=_0x37f59d;}catch{_0x1538f8=_0x5cc43f instanceof Error?_0x5cc43f:new Error(String(_0x5cc43f));}else _0x1538f8=_0x5cc43f instanceof Error?_0x5cc43f:new Error(String(_0x5cc43f));}if(_0x3fa6de!==null){const _0x4ace66=_0x3fa6de['split'](/\r?\n/),_0x20206e=[];if(_0x40bf80[_0x9bc4f(0x277)]==='*'||!Array[_0x9bc4f(0x226)](_0x40bf80[_0x9bc4f(0x277)]))for(let _0x4d7067=0x1;_0x4d7067<=_0x4ace66[_0x9bc4f(0x260)];_0x4d7067++){const _0x1f0514=_0x4ace66[_0x4d7067-0x1];_0x20206e[_0x9bc4f(0x218)](_0x4d7067+'|\x20'+_0x1f0514);}else for(const [_0x3f41c4,_0x4602b8]of _0x40bf80[_0x9bc4f(0x277)]){_0x20206e[_0x9bc4f(0x260)]>0x0&&_0x20206e[_0x9bc4f(0x218)]('');for(let _0x4b87c2=_0x3f41c4;_0x4b87c2<=_0x4602b8&&_0x4b87c2<=_0x4ace66[_0x9bc4f(0x260)];_0x4b87c2++){const _0x5113e7=_0x4ace66[_0x4b87c2-0x1];_0x20206e[_0x9bc4f(0x218)](_0x4b87c2+'|\x20'+_0x5113e7);}}_0x3b292e[_0x9bc4f(0x218)]({'path':_0x40bf80[_0x9bc4f(0x27f)],'content':_0x20206e['join']('\x0a')});}else _0x365ebd[_0x9bc4f(0x218)]('<file\x20path=\x22'+_0x40bf80[_0x9bc4f(0x27f)]+_0x9bc4f(0x1e3)+(_0x1538f8?.[_0x9bc4f(0x28d)]||_0x9bc4f(0x28b))+_0x9bc4f(0x1b6));}try{const _0x132cac=await compactFileContexts(_0x3b292e,_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],MORPH_API_KEY,MORPH_API_URL);for(const _0x44aa86 of _0x132cac){_0x365ebd[_0x9bc4f(0x218)](_0x9bc4f(0x243)+_0x44aa86[_0x9bc4f(0x27f)]+_0x9bc4f(0x16f)+_0x44aa86['content']+'\x0a</file>');}}catch(_0x5ee5f0){logger[_0x9bc4f(0x1d0)](_0x9bc4f(0x175),_0x9bc4f(0x1a7),{'error':_0x5ee5f0 instanceof Error?_0x5ee5f0[_0x9bc4f(0x28d)]:String(_0x5ee5f0),'files_count':_0x3b292e[_0x9bc4f(0x260)]});for(const _0x2eda76 of _0x3b292e){_0x365ebd[_0x9bc4f(0x218)]('<file\x20path=\x22'+_0x2eda76[_0x9bc4f(0x27f)]+_0x9bc4f(0x16f)+_0x2eda76[_0x9bc4f(0x275)]+_0x9bc4f(0x1b6));}}_0x4b7f10[_0x9bc4f(0x218)](_0x365ebd['join']('\x0a\x0a')),_0x34d829=_0x4b7f10[_0x9bc4f(0x1ab)]('\x0a');const _0x4a9d78=_0x5c36ed[_0x9bc4f(0x25e)]?.['filter'](_0xaa1b0e=>_0xaa1b0e[_0x9bc4f(0x28d)]?.[_0x9bc4f(0x1ea)](_0x9bc4f(0x230)))||[];if(_0x4a9d78['length']>0x0){const _0x313600=_0x4a9d78[_0x9bc4f(0x28e)](_0x488c13=>_0x488c13[_0x9bc4f(0x28d)])[_0x9bc4f(0x1ab)](';\x20');reportMorphError({'error_message':_0x313600,'error_type':_0x9bc4f(0x1ad),'context':{'tool':_0x9bc4f(0x177),'repo_path':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x26e)],'query':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],'model':'morph-warp-grep-v2.1','termination_reason':'completed_with_file_errors','error_count':_0x4a9d78[_0x9bc4f(0x260)],'is_timeout':![],'timings':_0x5c36ed['timings'],'files_attempted':_0x44788a['map'](_0x4c1cc3=>({'path':_0x4c1cc3[_0x9bc4f(0x27f)],'lines':_0x4c1cc3['lines']})),'tool_calls':_0xa554a7(_0x5c36ed[_0x9bc4f(0x1d4)]),'messages':_0x5c36ed[_0x9bc4f(0x1d4)]?.['map'](_0x174bd4=>({'role':_0x174bd4[_0x9bc4f(0x26c)],'content':_0x174bd4[_0x9bc4f(0x275)],..._0x174bd4[_0x9bc4f(0x224)]?{'tool_calls':_0x174bd4[_0x9bc4f(0x224)][_0x9bc4f(0x260)]}:{},..._0x174bd4[_0x9bc4f(0x250)]?{'tool_call_id':_0x174bd4['tool_call_id']}:{}})),'request_content':{'query':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],'repo_path':_0x173949['data'][_0x9bc4f(0x26e)],'repoRoot':a0_0x5d6800[_0x9bc4f(0x261)](_0x173949['data']['repo_path']),'model':_0x9bc4f(0x248)}},'source':_0x9bc4f(0x27b)})['catch'](()=>{});}}else{if(_0x5c36ed[_0x9bc4f(0x1db)]===_0x9bc4f(0x276)&&_0x5c36ed[_0x9bc4f(0x25e)]['length']>0x0){const _0x512d1e=_0x5c36ed['errors'][_0x9bc4f(0x28e)](_0x5366a6=>_0x5366a6[_0x9bc4f(0x28d)])['join'](';\x20');_0x34d829='Error:\x20'+_0x512d1e;const _0xa99728=_0x512d1e[_0x9bc4f(0x192)]()[_0x9bc4f(0x21d)](_0x9bc4f(0x196))||_0x512d1e['toLowerCase']()[_0x9bc4f(0x21d)](_0x9bc4f(0x17e))||_0x512d1e[_0x9bc4f(0x192)]()[_0x9bc4f(0x21d)](_0x9bc4f(0x273)),_0x1d612b=_0x5c36ed[_0x9bc4f(0x27c)]?.[_0x9bc4f(0x17a)]?.[_0x9bc4f(0x21c)],_0x2a4b70=_0x5c36ed[_0x9bc4f(0x25e)][0x0];reportMorphError({'error_message':_0x512d1e,'error_type':_0xa99728?_0x9bc4f(0x242):_0x2a4b70?.[_0x9bc4f(0x174)]?.['name']||_0x9bc4f(0x271),'context':{'tool':'codebase_search','repo_path':_0x173949['data'][_0x9bc4f(0x26e)],'query':_0x173949[_0x9bc4f(0x18a)]['search_string'],'model':_0x9bc4f(0x248),'termination_reason':_0x5c36ed[_0x9bc4f(0x1db)],'error_count':_0x5c36ed[_0x9bc4f(0x25e)][_0x9bc4f(0x260)],'is_timeout':_0xa99728,'timings':_0x5c36ed['timings'],'files_attempted':_0x1d612b?.[_0x9bc4f(0x28e)](_0x4ea32b=>({'path':_0x4ea32b[_0x9bc4f(0x27f)],'lines':_0x4ea32b['lines']})),'tool_calls':_0xa554a7(_0x5c36ed['messages']),'messages':_0x5c36ed[_0x9bc4f(0x1d4)]?.[_0x9bc4f(0x28e)](_0x47b501=>({'role':_0x47b501['role'],'content':_0x47b501[_0x9bc4f(0x275)],..._0x47b501['tool_calls']?{'tool_calls':_0x47b501[_0x9bc4f(0x224)][_0x9bc4f(0x260)]}:{},..._0x47b501[_0x9bc4f(0x250)]?{'tool_call_id':_0x47b501[_0x9bc4f(0x250)]}:{}})),'request_content':{'query':_0x173949[_0x9bc4f(0x18a)]['search_string'],'repo_path':_0x173949['data'][_0x9bc4f(0x26e)],'repoRoot':a0_0x5d6800['resolve'](_0x173949['data'][_0x9bc4f(0x26e)]),'model':_0x9bc4f(0x248)}},'stack_trace':_0x2a4b70?.[_0x9bc4f(0x195)]||undefined,'source':_0x9bc4f(0x27b)})[_0x9bc4f(0x204)](()=>{});}else _0x34d829=_0x9bc4f(0x17d);}return{'content':[{'type':_0x9bc4f(0x254),'text':_0x34d829}]};}catch(_0x2cd5b3){const _0x4b2f1b=handleMorphAPIError(_0x2cd5b3);if(_0x4b2f1b)return logger['error']('MCP',_0x9bc4f(0x189),{'tool':_0x9bc4f(0x177),'error':_0x9bc4f(0x1c3),'latency_ms':Date[_0x9bc4f(0x1ac)]()-_0x35f718}),_0x4b2f1b;const _0xafb5fc=_0x2cd5b3 instanceof Error?_0x2cd5b3[_0x9bc4f(0x28d)]:String(_0x2cd5b3);logger[_0x9bc4f(0x16c)](_0x9bc4f(0x175),_0x9bc4f(0x189),{'tool':_0x9bc4f(0x177),'error':_0xafb5fc,'repo_path':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x26e)],'query':_0x173949[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],'latency_ms':Date[_0x9bc4f(0x1ac)]()-_0x35f718});const _0x33b3c4=_0xafb5fc[_0x9bc4f(0x192)]()[_0x9bc4f(0x21d)](_0x9bc4f(0x196))||_0xafb5fc['toLowerCase']()[_0x9bc4f(0x21d)](_0x9bc4f(0x17e))||_0xafb5fc['toLowerCase']()[_0x9bc4f(0x21d)]('etimedout')||_0x2cd5b3 instanceof Error&&_0x2cd5b3[_0x9bc4f(0x239)]===_0x9bc4f(0x242);return reportMorphError({'error_message':_0xafb5fc,'error_type':_0x33b3c4?'TimeoutError':_0x2cd5b3 instanceof Error?_0x2cd5b3['constructor'][_0x9bc4f(0x239)]:_0x9bc4f(0x295),'context':{'tool':_0x9bc4f(0x177),'repo_path':_0x173949[_0x9bc4f(0x18a)]['repo_path'],'query':_0x173949['data']['search_string'],'model':_0x9bc4f(0x248),'is_timeout':_0x33b3c4,'exception_phase':_0x9bc4f(0x299),'request_content':{'query':_0x173949['data'][_0x9bc4f(0x22c)],'repo_path':_0x173949['data'][_0x9bc4f(0x26e)],'repoRoot':a0_0x5d6800[_0x9bc4f(0x261)](_0x173949[_0x9bc4f(0x18a)]['repo_path']),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x2cd5b3 instanceof Error?_0x2cd5b3['stack']:undefined,'source':'mcp-filesystem'})[_0x9bc4f(0x204)](()=>{}),{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x216)+_0xafb5fc}],'isError':![]};}}case TOOL_NAMES[_0x9bc4f(0x1e1)]:{const _0x533773=WarpGrepGitHubArgsSchema['safeParse'](_0x235774);if(!_0x533773[_0x9bc4f(0x223)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x533773[_0x9bc4f(0x16c)]}],'isError':!![]};const _0x22a5a1=_0x533773[_0x9bc4f(0x18a)][_0x9bc4f(0x28c)]||_0x533773[_0x9bc4f(0x18a)][_0x9bc4f(0x1c7)];if(!_0x22a5a1)return{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x173)}],'isError':!![]};const _0x717c3=MORPH_API_KEY;if(!_0x717c3)throw new Error(_0x9bc4f(0x294));const _0x2ae458=Date[_0x9bc4f(0x1ac)]();logger[_0x9bc4f(0x1d7)](_0x9bc4f(0x175),'github_search_start',{'identifier':_0x22a5a1,'query':_0x533773[_0x9bc4f(0x18a)]['search_string'],'branch':_0x533773['data'][_0x9bc4f(0x257)]});try{const _0x48f091=new WarpGrepClient({'morphApiKey':_0x717c3,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x5813cf=await _0x48f091[_0x9bc4f(0x258)]({'searchTerm':_0x533773[_0x9bc4f(0x18a)][_0x9bc4f(0x22c)],'github':_0x22a5a1,'branch':_0x533773[_0x9bc4f(0x18a)][_0x9bc4f(0x257)]}),_0xe2a8c3=Date[_0x9bc4f(0x1ac)]()-_0x2ae458;logMcpStderr(_0x9bc4f(0x23c)+_0xe2a8c3+_0x9bc4f(0x1e5)+_0x5813cf[_0x9bc4f(0x223)]);const _0x4eabf8=formatResult(_0x5813cf);return{'content':[{'type':_0x9bc4f(0x254),'text':_0x4eabf8}]};}catch(_0x936b6){const _0x5a74ec=handleMorphAPIError(_0x936b6);if(_0x5a74ec)return _0x5a74ec;const _0x4df58c=Date[_0x9bc4f(0x1ac)]()-_0x2ae458,_0x27df98=_0x936b6 instanceof Error?_0x936b6[_0x9bc4f(0x28d)]:String(_0x936b6);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x4df58c+'ms:',_0x27df98),reportMorphError({'error_message':_0x27df98,'error_type':_0x936b6 instanceof Error?_0x936b6['constructor']['name']:_0x9bc4f(0x295),'context':{'tool':_0x9bc4f(0x212),'github_url':_0x22a5a1,'search_string':_0x533773['data'][_0x9bc4f(0x22c)],'branch':_0x533773[_0x9bc4f(0x18a)][_0x9bc4f(0x257)]},'stack_trace':_0x936b6 instanceof Error?_0x936b6[_0x9bc4f(0x195)]:undefined,'source':_0x9bc4f(0x27b),'tool':'github_codebase_search','latency_ms':_0x4df58c})['catch'](()=>{}),{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x210)+_0x27df98}],'isError':![]};}}default:throw new Error(_0x9bc4f(0x22f)+_0x1ab2bd);}}catch(_0xe8aec6){const _0x2f3ba5=_0xe8aec6 instanceof Error?_0xe8aec6[_0x9bc4f(0x28d)]:String(_0xe8aec6);return reportMorphError({'error_message':_0x2f3ba5,'error_type':_0xe8aec6 instanceof Error?_0xe8aec6[_0x9bc4f(0x174)][_0x9bc4f(0x239)]:_0x9bc4f(0x295),'context':{'tool':_0x1ab2bd,'arguments':_0x235774?JSON[_0x9bc4f(0x1c8)](_0x235774)[_0x9bc4f(0x208)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0xe8aec6 instanceof Error?_0xe8aec6['stack']:undefined,'source':'mcp-filesystem'})[_0x9bc4f(0x204)](()=>{}),{'content':[{'type':_0x9bc4f(0x254),'text':_0x9bc4f(0x232)+_0x2f3ba5}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5eb97f){const _0x2b5c4f=a0_0x355cc9,_0x30c8a5=await getValidRootDirectories(_0x5eb97f);if(_0x30c8a5[_0x2b5c4f(0x260)]>0x0)allowedDirectories=[..._0x30c8a5],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x30c8a5[_0x2b5c4f(0x260)]+'\x20valid\x20directories');else{logMcpStderr(_0x2b5c4f(0x1c2));if(ENABLE_WORKSPACE_MODE)try{const _0x1e0fc7=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1e0fc7&&(allowedDirectories=[_0x1e0fc7],logMcpStderr(_0x2b5c4f(0x197)+_0x1e0fc7));}catch(_0x51a97){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x51a97);}}}function a0_0x4f95(_0x1ad99b,_0x335894){_0x1ad99b=_0x1ad99b-0x169;const _0x5a7c63=a0_0x5a7c();let _0x4f9552=_0x5a7c63[_0x1ad99b];return _0x4f9552;}server[a0_0x355cc9(0x263)](RootsListChangedNotificationSchema,async()=>{const _0x4d9eb3=a0_0x355cc9;try{const _0x3452c3=await server[_0x4d9eb3(0x1be)]();_0x3452c3&&'roots'in _0x3452c3&&await updateAllowedDirectoriesFromRoots(_0x3452c3[_0x4d9eb3(0x172)]);}catch(_0x43c3a6){logMcpStderr(_0x4d9eb3(0x1f8),_0x43c3a6 instanceof Error?_0x43c3a6['message']:String(_0x43c3a6));}}),server[a0_0x355cc9(0x227)]=async()=>{const _0x321c02=a0_0x355cc9,_0x192e51=server[_0x321c02(0x296)]();if(_0x192e51?.['roots'])try{const _0x2ff6b0=await server[_0x321c02(0x1be)]();_0x2ff6b0&&_0x321c02(0x172)in _0x2ff6b0?await updateAllowedDirectoriesFromRoots(_0x2ff6b0[_0x321c02(0x172)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x4d4dbe){logMcpStderr(_0x321c02(0x16d),_0x4d4dbe instanceof Error?_0x4d4dbe[_0x321c02(0x28d)]:String(_0x4d4dbe));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x321c02(0x20d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x321c02(0x1ff));else throw new Error(_0x321c02(0x180));}}};async function runServer(){const _0xc56fdc=a0_0x355cc9,_0x55227a=new StdioServerTransport();await server[_0xc56fdc(0x1bf)](_0x55227a),logMcpStderr(_0xc56fdc(0x1e4)),allowedDirectories[_0xc56fdc(0x260)]===0x0&&logMcpStderr(_0xc56fdc(0x28a));}runServer()[a0_0x355cc9(0x204)](_0x3c1a59=>{const _0x599ce6=a0_0x355cc9;logMcpStderr(_0x599ce6(0x19f),_0x3c1a59),process[_0x599ce6(0x288)](0x1);});
2
+ const a0_0x5c9100=a0_0x8fc5;(function(_0x580653,_0x310127){const _0x3bb34e=a0_0x8fc5,_0x35e849=_0x580653();while(!![]){try{const _0x43b5b7=-parseInt(_0x3bb34e(0x1c2))/0x1+parseInt(_0x3bb34e(0x176))/0x2+-parseInt(_0x3bb34e(0x1ca))/0x3+-parseInt(_0x3bb34e(0x209))/0x4*(parseInt(_0x3bb34e(0x24e))/0x5)+parseInt(_0x3bb34e(0x1fa))/0x6*(parseInt(_0x3bb34e(0x1d6))/0x7)+-parseInt(_0x3bb34e(0x1e3))/0x8+parseInt(_0x3bb34e(0x183))/0x9;if(_0x43b5b7===_0x310127)break;else _0x35e849['push'](_0x35e849['shift']());}catch(_0x1658d4){_0x35e849['push'](_0x35e849['shift']());}}}(a0_0xfb7a,0x9f4a7));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_0x17617d from'fs/promises';import a0_0x1b597d from'path';import a0_0x5e54ab 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_0x559a07 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x51e861){const _0x2225dd=a0_0x8fc5,_0x4e46da=_0x51e861[_0x2225dd(0x132)](a0_0x1b597d[_0x2225dd(0x150)])['filter'](Boolean);if(_0x4e46da[_0x2225dd(0x22a)]<0x2)return null;for(let _0x1bd55a=Math[_0x2225dd(0x20b)](_0x4e46da['length']/0x2);_0x1bd55a>=0x1;_0x1bd55a--){for(let _0x29a589=0x0;_0x29a589<=_0x4e46da[_0x2225dd(0x22a)]-0x2*_0x1bd55a;_0x29a589++){const _0x4cf758=_0x4e46da[_0x2225dd(0x1be)](_0x29a589,_0x29a589+_0x1bd55a),_0xcb71e2=_0x4e46da[_0x2225dd(0x1be)](_0x29a589+_0x1bd55a,_0x29a589+0x2*_0x1bd55a);if(_0x4cf758[_0x2225dd(0x17c)]((_0x699fb0,_0x51fff4)=>_0x699fb0===_0xcb71e2[_0x51fff4])){const _0x2791c1=[..._0x4e46da['slice'](0x0,_0x29a589),..._0x4e46da['slice'](_0x29a589+_0x1bd55a)];return a0_0x1b597d[_0x2225dd(0x150)]+_0x2791c1[_0x2225dd(0x222)](a0_0x1b597d['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x2204ea=a0_0x8fc5;try{const _0x1496b9=require('../package.json');return _0x1496b9[_0x2204ea(0x180)]??_0x2204ea(0x1a0);}catch(_0x4e983f){return logMcpStderr(_0x2204ea(0x157),_0x4e983f),_0x2204ea(0x1a0);}}function printHelp(){const _0x1bd803=a0_0x8fc5;console[_0x1bd803(0x1f5)](_0x1bd803(0x244)+getPackageVersion()),console['log'](_0x1bd803(0x1b4)),console[_0x1bd803(0x1f5)](_0x1bd803(0x1bf)),console[_0x1bd803(0x1f5)](_0x1bd803(0x1ef)),console[_0x1bd803(0x1f5)](_0x1bd803(0x1ad)),console[_0x1bd803(0x1f5)](_0x1bd803(0x174)),console[_0x1bd803(0x1f5)](_0x1bd803(0x12a)),console[_0x1bd803(0x1f5)](_0x1bd803(0x1f6)),console[_0x1bd803(0x1f5)](_0x1bd803(0x224));}const cliArgs=process[a0_0x5c9100(0x1df)][a0_0x5c9100(0x1be)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x5c9100(0x1db),'-h']);cliArgs[a0_0x5c9100(0x21f)](_0x3b31bd=>VERSION_FLAGS[a0_0x5c9100(0x178)](_0x3b31bd))&&(console[a0_0x5c9100(0x1f5)](a0_0x5c9100(0x244)+getPackageVersion()),process[a0_0x5c9100(0x149)](0x0));cliArgs[a0_0x5c9100(0x21f)](_0x1a0955=>HELP_FLAGS[a0_0x5c9100(0x178)](_0x1a0955))&&(printHelp(),process[a0_0x5c9100(0x149)](0x0));function getCliArg(_0x17ec8b){const _0x3c8307=a0_0x5c9100;for(let _0x49e029=0x0;_0x49e029<cliArgs['length'];_0x49e029++){const _0x3d8d6f=cliArgs[_0x49e029];if(_0x3d8d6f[_0x3c8307(0x23a)]('--'+_0x17ec8b+'='))return _0x3d8d6f[_0x3c8307(0x1be)](('--'+_0x17ec8b+'=')[_0x3c8307(0x22a)]);if(_0x3d8d6f==='--'+_0x17ec8b&&_0x49e029+0x1<cliArgs[_0x3c8307(0x22a)])return cliArgs[_0x49e029+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x5c9100(0x22a)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x5c9100(0x178)](arg)||HELP_FLAGS[a0_0x5c9100(0x178)](arg))continue;if(arg['startsWith'](a0_0x5c9100(0x21b)))continue;if(arg===a0_0x5c9100(0x186)){i++;continue;}args[a0_0x5c9100(0x1bb)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x5c9100(0x1e8)]||process['env'][a0_0x5c9100(0x1da)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x5c9100(0x1c7)]['ENABLE_WORKSPACE_MODE']!=='false',MORPH_API_KEY=getCliArg('api-key')??process['env']['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x5c9100(0x1c7)][a0_0x5c9100(0x14a)],MORPH_LARGE_APPLY=process[a0_0x5c9100(0x1c7)][a0_0x5c9100(0x1ee)]!==a0_0x5c9100(0x24a),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x5c9100(0x1c3)]?parseInt(process['env'][a0_0x5c9100(0x1c3)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x5c9100(0x1c7)][a0_0x5c9100(0x140)]?new Set(process[a0_0x5c9100(0x1c7)][a0_0x5c9100(0x140)]['split'](',')[a0_0x5c9100(0x215)](_0x662758=>_0x662758['trim']())['filter'](_0x40d56c=>_0x40d56c[a0_0x5c9100(0x22a)]>0x0)):DEFAULT_DISABLED_TOOLS;function a0_0xfb7a(){const _0x12082a=['\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','completed_with_file_errors','WarpGrepError','errors','\x20-\x20','metadata','parse','push','grep','Unknown\x20tool:\x20','slice','\x0aOptions:','describe','File\x20read\x20error:','736827EjQPPl','MORPH_WARP_GREP_TIMEOUT','instruction','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','finish','env','files','error','2246532ByHolO','message','debug','Disabled\x20tools:\x20','ReadError','morph-',',\x20removed\x20','Fatal\x20error\x20running\x20server:','lines','safeParse','grep_search','Failed\x20to\x20request\x20roots\x20from\x20client:','35LybPtG','Error\x20accessing\x20directory\x20','\x22.\x20Known\x20tools:\x20','CODEBASE_SEARCH','PWD','--help','0.2.0','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','argv','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','FileNotFound','codebase_search','5851408JWaxJy','response','\x20error(s)','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','ms.\x20Success:\x20','WORKSPACE_ROOT','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','github_url','description','Warning:\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','MORPH_LARGE_APPLY','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','all','\x22>\x0aError\x20reading\x20file:\x20','linesAdded','tool_calls','\x20chars)','log','\x20\x20morph-mcp','content','Morph\x20Edit\x20','setRequestHandler','223206dCYdiM','SubToolError','toLowerCase','UnknownError','Preview\x20changes\x20without\x20applying\x20them.',',\x20modified\x20','path_validation_failed','grep\x20\x27','setNotificationHandler','MCP','realpath','morph-mcp','LocalRipgrepProvider','-\x20Listed\x20directory\x20`','-\x20Grepped\x20\x27','4CgAftd','path_validation_resolved','floor','Error:\x20','post','list_directory\x20','name','file_read_failed','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','<file\x20path=\x22','completed','Max\x20results\x20to\x20return','map','listRoots','search_string','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.','.git','inputSchema','--api-key=','RipgrepError','file_read_complete','messages','some','dirname','payload','join','warn','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','data','sk-','warp_grep_start','default','github_codebase_search','length','EDIT_FILE','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','enum','GITHUB_CODEBASE_SEARCH','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','path','array','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','package.json','turns','node_modules','getClientCapabilities','tool','\x27\x20in\x20`','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','startsWith','isArray','.\x20Changes:\x20','\x20is\x20not\x20a\x20directory','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','stack','morph-v3-large','compaction_failed','resolve','@morphllm/morphmcp\x20','read','warp_grep_complete','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Here\x20is\x20the\x20content\x20of\x20files:\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','false','Tool\x20','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\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.','1300495QCNLXw','github_search_start','match','toISOString','TimeoutError','indexOf','oninitialized','code','ms:','timeout','Unknown\x20error','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','\x0aExamples:','tool_call_id','requiresApiKey','provider_created','searchGitHub','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','timed\x20out','includes','split','API\x20error\x20(auth/rate-limit)','composer.json','string','Bearer\x20','glob','list_directory','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','Warning:\x20Workspace\x20fallback\x20failed:\x20','pattern','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','Failed\x20to\x20read\x20file:\x20','Authentication\x20failed:\x20Your\x20Morph\x20API\x20key\x20is\x20invalid\x20or\x20has\x20been\x20revoked.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key,\x20then\x20update\x20your\x20MCP\x20configuration.','DISABLED_TOOLS','object','Invalid\x20arguments:\x20','morph-v3-fast','dryRun','constructor','morph-warp-grep-v2.1','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','filter','exit','MORPH_API_URL','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','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','Parent\x20directory\x20does\x20not\x20exist:\x20','unknown\x20error','Repository\x20identifier','sep','[could\x20not\x20read\x20file:\x20','substring','.vscode','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','runWarpGrep_call','BinaryFile','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','added\x20','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','path_validation_start','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','tool_call_complete','roots','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','tool_call_error','ENOENT','branch','number','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','PathError','role','now','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','Error\x20running\x20fast\x20context\x20search:\x20','Workspace\x20mode\x20enabled:\x20Using\x20','changes','text','context','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.','application/json','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','-\x20Read\x20file\x20`','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','WarpGrep\x20sub-tool\x20errors:\x20','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','-\x20Glob\x20search\x20`','488270ppQZRC','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','has','status','tool_call_received','command','every','success','utf-8','Rules:\x0a','version','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','\x0a</file>','24295599pVXmBE','timings','Morph\x20Edit\x20Preview','--api-key','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','linesModified','-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a','connect','instructions','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','api_request_start','normalize','Cargo.toml','terminationReason','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','edit_file','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.','function','boolean','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','.\x20Path:\x20','repo_path','catch','linesRemoved','code_edit','Created\x20File','\x20valid\x20directories','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','[github_codebase_search]\x20Failed\x20in\x20','unknown','For\x20deletions:\x0a','❌\x20Morph\x20Edit\x20Failed:\x20','source','optional','ToolException','SymlinkError','\x0a...\x20(truncated,\x20total:\x20','basename','assistant','min','read\x20','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','Relevant\x20context\x20found:','\x22>\x0a','completionId','etimedout','mcp-filesystem','readFile'];a0_0xfb7a=function(){return _0x12082a;};return a0_0xfb7a();}if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x5c9100(0x178)](tool)&&console[a0_0x5c9100(0x1c9)](a0_0x5c9100(0x147)+tool+a0_0x5c9100(0x1d8)+[...KNOWN_TOOL_NAMES][a0_0x5c9100(0x222)](',\x20'));}console[a0_0x5c9100(0x1c9)](a0_0x5c9100(0x1cd)+[...DISABLED_TOOLS][a0_0x5c9100(0x222)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x5c9100(0x23a)]('sk-')&&!MORPH_API_KEY['startsWith']('morph-')&&logMcpStderr(a0_0x5c9100(0x1de));async function reportMorphError(_0x113893){const _0x1d0b41=a0_0x5c9100;try{await a0_0x559a07[_0x1d0b41(0x20d)]('https://morphllm.com/api/error-report',{..._0x113893,'timestamp':new Date()[_0x1d0b41(0x251)](),'source':_0x113893[_0x1d0b41(0x1a3)]||_0x1d0b41(0x1b2),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x113893[_0x1d0b41(0x16d)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x1d0b41(0x16f),'Authorization':_0x1d0b41(0x136)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x13d8b8,_0xffd708){const _0x3c35fb=a0_0x5c9100;if(_0x13d8b8&&typeof _0x13d8b8==='object'&&_0x3c35fb(0x179)in _0x13d8b8)return _0x13d8b8[_0x3c35fb(0x179)];if(_0x13d8b8&&typeof _0x13d8b8===_0x3c35fb(0x141)&&_0x3c35fb(0x1e4)in _0x13d8b8)return _0x13d8b8[_0x3c35fb(0x1e4)]?.[_0x3c35fb(0x179)];const _0x539cce=_0xffd708['match'](/\b(401|429)\b/);return _0x539cce?parseInt(_0x539cce[0x1],0xa):null;}function handleMorphAPIError(_0x411295){const _0x2de534=a0_0x5c9100,_0x50936c=_0x411295 instanceof Error?_0x411295[_0x2de534(0x1cb)]:String(_0x411295),_0xde2236=extractStatusCode(_0x411295,_0x50936c);switch(_0xde2236){case 0x191:return{'content':[{'type':'text','text':_0x2de534(0x13f)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x2de534(0x16c),'text':'Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.'}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x5c9100(0x1e9)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr(a0_0x5c9100(0x232)),logMcpStderr(a0_0x5c9100(0x164)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x5c9100(0x249)));function a0_0x8fc5(_0x38bc7b,_0x202c6a){_0x38bc7b=_0x38bc7b-0x123;const _0xfb7a4f=a0_0xfb7a();let _0x8fc508=_0xfb7a4f[_0x38bc7b];return _0x8fc508;}function normalizePath(_0x119ba6){const _0x4e6c2c=a0_0x5c9100;return a0_0x1b597d[_0x4e6c2c(0x18e)](_0x119ba6);}function expandHome(_0x3da590){const _0x446b7d=a0_0x5c9100;if(_0x3da590[_0x446b7d(0x23a)]('~/')||_0x3da590==='~')return a0_0x1b597d[_0x446b7d(0x222)](a0_0x5e54ab['homedir'](),_0x3da590['slice'](0x1));return _0x3da590;}let allowedDirectories=await Promise[a0_0x5c9100(0x1f0)](args['map'](async _0x548516=>{const _0x487d2d=a0_0x5c9100,_0x8972d8=expandHome(_0x548516),_0x25877f=a0_0x1b597d[_0x487d2d(0x243)](_0x8972d8);try{const _0x3cb41f=await a0_0x17617d[_0x487d2d(0x204)](_0x25877f);return normalizePath(_0x3cb41f);}catch(_0x4f4c57){return normalizePath(_0x25877f);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x5c9100(0x22a)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x5c9100(0x1bb)](workspaceDir),logMcpStderr(a0_0x5c9100(0x16a)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x5a5cba){logMcpStderr(a0_0x5c9100(0x23f)+a0_0x5a5cba);}async function detectWorkspaceRoot(_0x42aaba){const _0xf2cfdc=a0_0x5c9100;let _0x751e7c=a0_0x1b597d[_0xf2cfdc(0x243)](_0x42aaba);const _0xdec7d4=[_0xf2cfdc(0x219),_0xf2cfdc(0x153),_0xf2cfdc(0x233),_0xf2cfdc(0x18f),'pyproject.toml','go.mod','.cursor','tsconfig.json',_0xf2cfdc(0x134)];while(_0x751e7c!==a0_0x1b597d[_0xf2cfdc(0x220)](_0x751e7c)){for(const _0x234f7e of _0xdec7d4){const _0x2f1ea1=a0_0x1b597d[_0xf2cfdc(0x222)](_0x751e7c,_0x234f7e);try{return await a0_0x17617d['access'](_0x2f1ea1),normalizePath(_0x751e7c);}catch{}}_0x751e7c=a0_0x1b597d[_0xf2cfdc(0x220)](_0x751e7c);}return normalizePath(_0x42aaba);}await Promise[a0_0x5c9100(0x1f0)](args['map'](async _0x43b716=>{const _0x27e7ff=a0_0x5c9100;try{const _0x1e6ad0=await a0_0x17617d['stat'](expandHome(_0x43b716));!_0x1e6ad0['isDirectory']()&&(logMcpStderr(_0x27e7ff(0x20c)+_0x43b716+_0x27e7ff(0x23d)),process[_0x27e7ff(0x149)](0x1));}catch(_0x566c32){logMcpStderr(_0x27e7ff(0x1d7)+_0x43b716+':',_0x566c32),process['exit'](0x1);}}));async function validatePath(_0x30fa8a){const _0x43baba=a0_0x5c9100,_0x3d6367=expandHome(_0x30fa8a),_0x4d85a1=a0_0x1b597d[_0x43baba(0x243)](_0x3d6367);logger[_0x43baba(0x1cc)](_0x43baba(0x203),_0x43baba(0x15b),{'raw_path':_0x30fa8a,'absolute':_0x4d85a1});try{const _0x59d5e9=await a0_0x17617d[_0x43baba(0x204)](_0x4d85a1);return logger[_0x43baba(0x1cc)]('MCP',_0x43baba(0x20a),{'resolved':_0x59d5e9,'symlink':_0x59d5e9!==_0x4d85a1}),_0x59d5e9;}catch(_0x37ab66){if(_0x37ab66[_0x43baba(0x125)]==='ENOENT'){const _0x2fc71d=a0_0x1b597d['dirname'](_0x4d85a1);try{const _0x3375a9=await a0_0x17617d[_0x43baba(0x204)](_0x2fc71d),_0x3091e8=a0_0x1b597d[_0x43baba(0x222)](_0x3375a9,a0_0x1b597d['basename'](_0x4d85a1));return logger[_0x43baba(0x1cc)](_0x43baba(0x203),'path_validation_resolved',{'resolved':_0x3091e8,'new_file':!![]}),_0x3091e8;}catch{logger['error'](_0x43baba(0x203),_0x43baba(0x200),{'raw_path':_0x30fa8a,'error':_0x43baba(0x14d)+_0x2fc71d});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x2fc71d);}}logger[_0x43baba(0x1c9)](_0x43baba(0x203),'path_validation_failed',{'raw_path':_0x30fa8a,'error':_0x37ab66['message']});throw _0x37ab66;}}const MorphEditFileArgsSchema=z[a0_0x5c9100(0x141)]({'path':z['string'](),'code_edit':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1c0)]('Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.'),'instruction':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1c0)]('A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.'),'dryRun':z[a0_0x5c9100(0x195)]()['default'](![])[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x1fe))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x5c9100(0x193),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1c0)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x22c)),'search_type':z[a0_0x5c9100(0x22d)](['default','node_modules'])['optional']()[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x191))}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()[a0_0x5c9100(0x1c0)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1a4)]()[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x24d)),'owner_repo':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1a4)]()[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x196)),'branch':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1a4)]()[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x1ed))}),CodebaseSearchArgsSchema=z[a0_0x5c9100(0x141)]({'query':z[a0_0x5c9100(0x135)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1c0)](a0_0x5c9100(0x14f)),'branch':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1a4)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x5c9100(0x135)]()[a0_0x5c9100(0x1a4)]()[a0_0x5c9100(0x1c0)]('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x5c9100(0x231)](z['string']())['default']([])['describe'](a0_0x5c9100(0x1dd)),'limit':z[a0_0x5c9100(0x163)]()[a0_0x5c9100(0x1a4)]()[a0_0x5c9100(0x228)](0xa)['describe'](a0_0x5c9100(0x214))}),server=new Server({'name':a0_0x5c9100(0x205),'version':a0_0x5c9100(0x1dc)},{'capabilities':{'tools':{}}});server[a0_0x5c9100(0x1f9)](ListToolsRequestSchema,async()=>{const _0x43c298=a0_0x5c9100,_0x2ef1ac=[{'name':TOOL_NAMES[_0x43c298(0x22b)],'description':_0x43c298(0x1c5)+_0x43c298(0x13d)+_0x43c298(0x19e)+'IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a'+'Benefits:\x0a'+_0x43c298(0x13c)+_0x43c298(0x158)+_0x43c298(0x168)+_0x43c298(0x1e6)+_0x43c298(0x239)+_0x43c298(0x187)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x43c298(0x1a1)+_0x43c298(0x15c)+_0x43c298(0x18c)+_0x43c298(0x17f)+_0x43c298(0x24c)+_0x43c298(0x189)+_0x43c298(0x14b)+_0x43c298(0x170)+_0x43c298(0x22f)+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x43c298(0x181),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x43c298(0x1d9)],'description':_0x43c298(0x14c)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x43c298(0x177)+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0xc815f0=_0x2ef1ac[_0x43c298(0x148)](_0x5389d1=>{const _0x3bce9f=_0x43c298;if(DISABLED_TOOLS[_0x3bce9f(0x178)](_0x5389d1[_0x3bce9f(0x20f)]))return console[_0x3bce9f(0x1c9)](_0x3bce9f(0x24b)+_0x5389d1[_0x3bce9f(0x20f)]+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if(_0x3bce9f(0x12c)in _0x5389d1&&_0x5389d1[_0x3bce9f(0x12c)]&&!MORPH_API_KEY)return logMcpStderr(_0x3bce9f(0x1ec)+_0x5389d1[_0x3bce9f(0x20f)]+_0x3bce9f(0x15a)),![];return!![];});return{'tools':_0xc815f0[_0x43c298(0x215)](_0x357ce9=>({'name':_0x357ce9[_0x43c298(0x20f)],'description':_0x357ce9[_0x43c298(0x1eb)],'inputSchema':_0x357ce9[_0x43c298(0x21a)]}))};}),server[a0_0x5c9100(0x1f9)](CallToolRequestSchema,async _0x1f3433=>{const _0x5dda0c=a0_0x5c9100,{name:_0xde66b7,arguments:_0x51f0de}=_0x1f3433['params'],_0x22e089=Date['now']();logger[_0x5dda0c(0x1cc)](_0x5dda0c(0x203),_0x5dda0c(0x17a),{'tool':_0xde66b7,'args':_0xde66b7==='edit_file'?{'path':_0x51f0de?.[_0x5dda0c(0x230)],'instruction':_0x51f0de?.[_0x5dda0c(0x1c4)]||_0x51f0de?.[_0x5dda0c(0x18b)],'dryRun':_0x51f0de?.[_0x5dda0c(0x144)]}:_0x51f0de});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x5dda0c(0x16c),'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[_0x5dda0c(0x23a)](_0x5dda0c(0x226))&&!MORPH_API_KEY['startsWith'](_0x5dda0c(0x1cf)))return{'content':[{'type':'text','text':_0x5dda0c(0x218)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0xde66b7))return{'content':[{'type':_0x5dda0c(0x16c),'text':'Tool\x20\x22'+_0xde66b7+_0x5dda0c(0x1ac)}],'isError':![]};switch(_0xde66b7){case TOOL_NAMES[_0x5dda0c(0x22b)]:{let _0x536a95=_0x51f0de;_0x536a95&&typeof _0x536a95===_0x5dda0c(0x141)&&('target_file'in _0x536a95&&!('path'in _0x536a95)&&(_0x536a95={..._0x536a95,'path':_0x536a95['target_file'],'target_file':undefined}),'instructions'in _0x536a95&&!(_0x5dda0c(0x1c4)in _0x536a95)&&(_0x536a95={..._0x536a95,'instruction':_0x536a95[_0x5dda0c(0x18b)],'instructions':undefined}));const _0x313d99=MorphEditFileArgsSchema[_0x5dda0c(0x1d3)](_0x536a95);if(!_0x313d99['success'])throw new Error(_0x5dda0c(0x15f)+_0x313d99[_0x5dda0c(0x1c9)]);const _0x88513e=await validatePath(_0x313d99[_0x5dda0c(0x225)]['path']);let _0x4404a9=null,_0x4e365c=!![],_0x4740af=null;try{_0x4404a9=await a0_0x17617d['readFile'](_0x88513e,_0x5dda0c(0x17e)),logger[_0x5dda0c(0x1cc)](_0x5dda0c(0x203),_0x5dda0c(0x21d),{'path':_0x88513e,'size_bytes':_0x4404a9['length']});}catch(_0x3884b1){const _0x16f2e6=_0x3884b1['code'];_0x16f2e6===_0x5dda0c(0x161)?(_0x4e365c=![],_0x4404a9='',logger['debug']('MCP','file_read_complete',{'path':_0x88513e,'exists':![]})):(_0x4740af=_0x5dda0c(0x13e)+(_0x16f2e6||'unknown')+_0x5dda0c(0x1b8)+(_0x3884b1 instanceof Error?_0x3884b1[_0x5dda0c(0x1cb)]:String(_0x3884b1)),logger[_0x5dda0c(0x1c9)](_0x5dda0c(0x203),_0x5dda0c(0x210),{'path':_0x88513e,'error':_0x4740af}),logMcpStderr('Warning:\x20'+_0x4740af));}let _0x7d3e6e;try{const _0x3cd08a=MORPH_API_KEY;if(!_0x3cd08a)throw new Error(_0x5dda0c(0x154));const _0x4f71d5=a0_0x1b597d[_0x5dda0c(0x220)](_0x88513e),_0x266a50=a0_0x1b597d[_0x5dda0c(0x1a8)](_0x88513e);logger[_0x5dda0c(0x1cc)]('MCP',_0x5dda0c(0x18d),{'model':_0x5dda0c(0x143),'path':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x230)],'instruction_len':_0x313d99['data']['instruction']['length'],'code_edit_len':_0x313d99[_0x5dda0c(0x225)]['code_edit']['length'],'original_code_len':_0x4404a9?.['length']??0x0,'dry_run':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x144)]});const _0x3aadcd=Date[_0x5dda0c(0x167)](),_0x3d00f7=await executeEditFile({'target_filepath':_0x266a50,'code_edit':_0x313d99['data'][_0x5dda0c(0x19b)],'instruction':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x1c4)]},{'morphApiKey':_0x3cd08a,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x4f71d5,'autoWrite':!_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x144)],'generateUdiff':![],'debug':![]}),_0x3791af=Date[_0x5dda0c(0x167)]()-_0x3aadcd;_0x7d3e6e=_0x3d00f7[_0x5dda0c(0x1b0)];if(!_0x3d00f7[_0x5dda0c(0x17d)])throw new Error(_0x3d00f7[_0x5dda0c(0x1c9)]||_0x5dda0c(0x247));const _0x2cb330=_0x3d00f7[_0x5dda0c(0x16b)],_0x25ce8e=_0x5dda0c(0x159)+_0x2cb330[_0x5dda0c(0x1f2)]+_0x5dda0c(0x1d0)+_0x2cb330[_0x5dda0c(0x19a)]+_0x5dda0c(0x1ff)+_0x2cb330[_0x5dda0c(0x188)];logger['debug'](_0x5dda0c(0x203),_0x5dda0c(0x15d),{'tool':_0x5dda0c(0x192),'success':!![],'latency_ms':Date[_0x5dda0c(0x167)]()-_0x22e089,'edit_latency_ms':_0x3791af,'changes':{'added':_0x2cb330[_0x5dda0c(0x1f2)],'removed':_0x2cb330['linesRemoved'],'modified':_0x2cb330[_0x5dda0c(0x188)]},'completion_id':_0x7d3e6e});if(_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x144)])return{'content':[{'type':_0x5dda0c(0x16c),'text':_0x5dda0c(0x185)+(_0x4e365c?'':'\x20(new\x20file)')+':\x20'+_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x1c4)]+_0x5dda0c(0x23c)+_0x25ce8e+_0x5dda0c(0x197)+_0x313d99[_0x5dda0c(0x225)]['path']+'.'}]};return{'content':[{'type':'text','text':_0x5dda0c(0x1f8)+(_0x4e365c?'Applied':_0x5dda0c(0x19c))+':\x20'+_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x1c4)]+'.\x20Changes:\x20'+_0x25ce8e+_0x5dda0c(0x197)+_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x230)]+'.'}]};}catch(_0x124792){const _0x4f0e86=handleMorphAPIError(_0x124792);if(_0x4f0e86)return logger['error'](_0x5dda0c(0x203),_0x5dda0c(0x160),{'tool':_0x5dda0c(0x192),'error':_0x5dda0c(0x133),'latency_ms':Date[_0x5dda0c(0x167)]()-_0x22e089}),_0x4f0e86;const _0x51d28c=_0x124792 instanceof Error?_0x124792[_0x5dda0c(0x1cb)]:String(_0x124792);return logger[_0x5dda0c(0x1c9)]('MCP',_0x5dda0c(0x160),{'tool':_0x5dda0c(0x192),'error':_0x51d28c,'path':_0x313d99['data'][_0x5dda0c(0x230)],'validated_path':_0x88513e,'latency_ms':Date[_0x5dda0c(0x167)]()-_0x22e089,'stack':_0x124792 instanceof Error?_0x124792[_0x5dda0c(0x240)]:undefined}),reportMorphError({'error_message':_0x51d28c,'error_type':_0x124792 instanceof Error?_0x124792[_0x5dda0c(0x145)][_0x5dda0c(0x20f)]:_0x5dda0c(0x1fd),'context':{'tool':_0x5dda0c(0x192),'completion_id':_0x7d3e6e,'file_path':_0x313d99['data'][_0x5dda0c(0x230)],'validated_path':_0x88513e,'instruction':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x1c4)],'model':MORPH_LARGE_APPLY?_0x5dda0c(0x241):'morph-v3-fast','dry_run':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x144)],'file_exists':_0x4e365c,'file_read_error':_0x4740af,'file_readable':_0x4404a9!==null,'request_content':{'path':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x230)],'code_edit':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x19b)],'instruction':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x1c4)],'original_code':_0x4404a9!==null?_0x4404a9[_0x5dda0c(0x22a)]>0xc350?_0x4404a9[_0x5dda0c(0x152)](0x0,0xc350)+_0x5dda0c(0x1a7)+_0x4404a9[_0x5dda0c(0x22a)]+_0x5dda0c(0x1f4):_0x4404a9:_0x5dda0c(0x151)+(_0x4740af||_0x5dda0c(0x14e))+']','original_code_length':_0x4404a9?.[_0x5dda0c(0x22a)]??0x0,'model':MORPH_LARGE_APPLY?_0x5dda0c(0x241):'morph-v3-fast','dry_run':_0x313d99[_0x5dda0c(0x225)][_0x5dda0c(0x144)]}},'stack_trace':_0x124792 instanceof Error?_0x124792[_0x5dda0c(0x240)]:undefined,'source':_0x5dda0c(0x1b2)})['catch'](()=>{}),{'content':[{'type':_0x5dda0c(0x16c),'text':_0x5dda0c(0x1a2)+_0x51d28c}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x547322=WarpGrepArgsSchema[_0x5dda0c(0x1d3)](_0x51f0de);if(!_0x547322[_0x5dda0c(0x17d)])return{'content':[{'type':_0x5dda0c(0x16c),'text':'Invalid\x20arguments:\x20'+_0x547322[_0x5dda0c(0x1c9)]}],'isError':!![]};const _0x1a7867=_0x5b8b7c=>{const _0x50a8e8=_0x5dda0c,_0x396781=[];for(const _0x574042 of _0x5b8b7c||[]){if(_0x574042[_0x50a8e8(0x166)]===_0x50a8e8(0x1a9)&&Array[_0x50a8e8(0x23b)](_0x574042['tool_calls']))for(const _0x2f5e23 of _0x574042[_0x50a8e8(0x1f3)]){try{const _0x10faf4=_0x2f5e23['function']?.[_0x50a8e8(0x20f)],_0x169f86=JSON[_0x50a8e8(0x1ba)](_0x2f5e23['function']?.['arguments']||'{}');if(_0x10faf4===_0x50a8e8(0x1d4))_0x396781['push'](_0x50a8e8(0x201)+_0x169f86[_0x50a8e8(0x13b)]+'\x27\x20'+(_0x169f86[_0x50a8e8(0x230)]||'.'));else{if(_0x10faf4===_0x50a8e8(0x245))_0x396781[_0x50a8e8(0x1bb)](_0x50a8e8(0x1ab)+_0x169f86['path']);else{if(_0x10faf4===_0x50a8e8(0x138))_0x396781[_0x50a8e8(0x1bb)](_0x50a8e8(0x20e)+(_0x169f86['command']||'.'));else{if(_0x10faf4===_0x50a8e8(0x137))_0x396781[_0x50a8e8(0x1bb)]('glob\x20\x27'+_0x169f86[_0x50a8e8(0x13b)]+'\x27\x20'+(_0x169f86[_0x50a8e8(0x230)]||'.'));else _0x10faf4===_0x50a8e8(0x1c6)&&_0x396781[_0x50a8e8(0x1bb)](_0x50a8e8(0x1c6));}}}}catch{}}}return _0x396781;},_0x42bc16=_0x15e544=>{const _0x2a39e4=_0x5dda0c,_0x41f010=[];if(!_0x15e544||!Array[_0x2a39e4(0x23b)](_0x15e544))return _0x41f010;const _0x30beea=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x2a39e4(0x1e1),'tool':_0x2a39e4(0x245)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x2a39e4(0x165),'tool':_0x2a39e4(0x245)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x2a39e4(0x245)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x2a39e4(0x156),'tool':_0x2a39e4(0x245)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x2a39e4(0x21c),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x2a39e4(0x1bc)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x2a39e4(0x156),'tool':_0x2a39e4(0x245)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':'read'},{'pattern':/not a text file/,'error_type':_0x2a39e4(0x156),'tool':_0x2a39e4(0x245)},{'pattern':/symbolic link/,'error_type':_0x2a39e4(0x1a6),'tool':_0x2a39e4(0x245)},{'pattern':/Error reading file:/,'error_type':_0x2a39e4(0x1ce),'tool':_0x2a39e4(0x245)},{'pattern':/status="error"/,'error_type':_0x2a39e4(0x1a5),'tool':_0x2a39e4(0x1a0)}];let _0x500acf=0x0;for(const _0x2d45b6 of _0x15e544){_0x2d45b6[_0x2a39e4(0x166)]==='assistant'&&Array[_0x2a39e4(0x23b)](_0x2d45b6[_0x2a39e4(0x1f3)])&&_0x500acf++;const _0x413bcc=_0x2d45b6['content'];if((_0x2d45b6[_0x2a39e4(0x166)]===_0x2a39e4(0x237)||_0x2d45b6['role']==='user')&&_0x413bcc&&typeof _0x413bcc===_0x2a39e4(0x135))for(const {pattern:_0x586c67,error_type:_0x24a40d,tool:_0x35effc}of _0x30beea){const _0x7a5653=_0x413bcc[_0x2a39e4(0x250)](new RegExp(_0x586c67[_0x2a39e4(0x1a3)],'g'));if(_0x7a5653)for(const _0xfb113d of _0x7a5653){const _0x5b57ef=_0x413bcc[_0x2a39e4(0x123)](_0xfb113d),_0x161373=_0x413bcc[_0x2a39e4(0x152)](_0x5b57ef,Math[_0x2a39e4(0x1aa)](_0x5b57ef+0xc8,_0x413bcc[_0x2a39e4(0x22a)]));_0x41f010['push']({'tool':_0x35effc,'error_type':_0x24a40d,'error_message':_0x161373[_0x2a39e4(0x132)]('\x0a')[0x0],'turn':_0x500acf});}}}return _0x41f010;};try{const _0x20bba4=a0_0x1b597d[_0x5dda0c(0x243)](_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)]),_0x445fa7=_0x547322[_0x5dda0c(0x225)]['search_type'],_0x8d7f4f=_0x445fa7===_0x5dda0c(0x235)?{'allowNames':[_0x5dda0c(0x235)]}:undefined,_0x1c719b=new LocalRipgrepProvider(_0x20bba4,undefined,_0x8d7f4f);logger[_0x5dda0c(0x1cc)](_0x5dda0c(0x203),_0x5dda0c(0x12d),{'type':_0x5dda0c(0x206),'repo_root':_0x20bba4,'search_type':_0x445fa7||_0x5dda0c(0x228)}),logger[_0x5dda0c(0x1cc)]('MCP',_0x5dda0c(0x227),{'query':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'repo_root':_0x20bba4,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x5ed3c6=Date[_0x5dda0c(0x167)](),_0x17f073=await runWarpGrep({'searchTerm':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'repoRoot':_0x20bba4,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1c719b,'search_type':_0x445fa7}),_0x3fe47a=Date[_0x5dda0c(0x167)]()-_0x5ed3c6,_0x35cf77=_0x17f073[_0x5dda0c(0x1c6)]?.[_0x5dda0c(0x1b9)]?.[_0x5dda0c(0x1c8)]?.['length']??0x0;logger[_0x5dda0c(0x1cc)]('MCP',_0x5dda0c(0x246),{'termination':_0x17f073['terminationReason'],'turns':_0x17f073[_0x5dda0c(0x184)]?.[_0x5dda0c(0x234)]??0x0,'files_found':_0x35cf77,'latency_ms':_0x3fe47a});const _0x189f34=_0x42bc16(_0x17f073[_0x5dda0c(0x21e)]);_0x189f34[_0x5dda0c(0x22a)]>0x0&&reportMorphError({'error_message':_0x5dda0c(0x173)+_0x189f34['length']+_0x5dda0c(0x1e5),'error_type':_0x5dda0c(0x1fb),'level':_0x5dda0c(0x223),'tool':_0x5dda0c(0x1e2),'context':{'repo_path':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],'query':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'model':_0x5dda0c(0x146),'termination_reason':_0x17f073['terminationReason'],'sub_tool_errors':_0x189f34,'timings':_0x17f073[_0x5dda0c(0x184)],'tool_calls':_0x1a7867(_0x17f073[_0x5dda0c(0x21e)]),'messages':_0x17f073[_0x5dda0c(0x21e)]?.[_0x5dda0c(0x215)](_0x1d568e=>({'role':_0x1d568e[_0x5dda0c(0x166)],'content':_0x1d568e[_0x5dda0c(0x1f7)],..._0x1d568e[_0x5dda0c(0x1f3)]?{'tool_calls':_0x1d568e[_0x5dda0c(0x1f3)][_0x5dda0c(0x22a)]}:{},..._0x1d568e['tool_call_id']?{'tool_call_id':_0x1d568e['tool_call_id']}:{}}))},'source':'mcp-filesystem'})[_0x5dda0c(0x199)](()=>{});let _0x39d96a='';if(_0x17f073[_0x5dda0c(0x190)]===_0x5dda0c(0x213)&&_0x17f073[_0x5dda0c(0x1c6)]?.['metadata']?.[_0x5dda0c(0x1c8)]){const _0x1d43e4=_0x17f073[_0x5dda0c(0x1c6)][_0x5dda0c(0x1b9)]['files'];if(_0x1d43e4['length']===0x0)return _0x39d96a=_0x17f073[_0x5dda0c(0x1c6)][_0x5dda0c(0x221)]||'No\x20relevant\x20code\x20found\x20for\x20the\x20query.',{'content':[{'type':_0x5dda0c(0x16c),'text':_0x39d96a}]};const _0x5b70b0=[],_0x56775b=['Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:'];for(const _0x18838f of _0x17f073[_0x5dda0c(0x21e)]){if(_0x18838f['role']==='assistant'&&Array[_0x5dda0c(0x23b)](_0x18838f['tool_calls']))for(const _0x5aaf3f of _0x18838f[_0x5dda0c(0x1f3)]){try{const _0xdede92=_0x5aaf3f[_0x5dda0c(0x194)]?.['name'],_0x3394f4=JSON[_0x5dda0c(0x1ba)](_0x5aaf3f[_0x5dda0c(0x194)]?.['arguments']||'{}');if(_0xdede92===_0x5dda0c(0x1d4))_0x56775b[_0x5dda0c(0x1bb)](_0x5dda0c(0x208)+_0x3394f4[_0x5dda0c(0x13b)]+_0x5dda0c(0x238)+(_0x3394f4[_0x5dda0c(0x230)]||'.')+'`');else{if(_0xdede92===_0x5dda0c(0x245))_0x56775b[_0x5dda0c(0x1bb)](_0x5dda0c(0x171)+_0x3394f4[_0x5dda0c(0x230)]+'`');else{if(_0xdede92===_0x5dda0c(0x138))_0x56775b[_0x5dda0c(0x1bb)](_0x5dda0c(0x207)+(_0x3394f4[_0x5dda0c(0x17b)]||'.')+'`');else _0xdede92==='glob'&&_0x56775b[_0x5dda0c(0x1bb)](_0x5dda0c(0x175)+_0x3394f4[_0x5dda0c(0x13b)]+'`\x20in\x20`'+(_0x3394f4[_0x5dda0c(0x230)]||'.')+'`');}}}catch{}}}_0x5b70b0[_0x5dda0c(0x1bb)](_0x56775b[_0x5dda0c(0x222)]('\x0a'));const _0x5129fc=['',_0x5dda0c(0x1ae)];for(const _0x19dd37 of _0x1d43e4){if(_0x19dd37[_0x5dda0c(0x1d2)]==='*')_0x5129fc[_0x5dda0c(0x1bb)]('-\x20'+_0x19dd37[_0x5dda0c(0x230)]+':*');else{if(Array[_0x5dda0c(0x23b)](_0x19dd37[_0x5dda0c(0x1d2)])){const _0x22ded0=_0x19dd37[_0x5dda0c(0x1d2)][_0x5dda0c(0x215)](([_0x312b38,_0x506d0d])=>{if(_0x312b38===_0x506d0d)return''+_0x312b38;return _0x312b38+'-'+_0x506d0d;});_0x5129fc[_0x5dda0c(0x1bb)]('-\x20'+_0x19dd37['path']+':'+_0x22ded0[_0x5dda0c(0x222)](','));}else _0x5129fc[_0x5dda0c(0x1bb)]('-\x20'+_0x19dd37['path']+':*');}}_0x5129fc[_0x5dda0c(0x1bb)](''),_0x5b70b0['push'](_0x5129fc[_0x5dda0c(0x222)]('\x0a')),_0x5b70b0[_0x5dda0c(0x1bb)](_0x5dda0c(0x248));const _0x21c854=[],_0x25ca8b=[];for(const _0x43ac63 of _0x1d43e4){let _0x12e25f=a0_0x1b597d['resolve'](_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],_0x43ac63[_0x5dda0c(0x230)]),_0x269461=null,_0x4a2b7c=null;try{_0x269461=await a0_0x17617d[_0x5dda0c(0x1b3)](_0x12e25f,{'encoding':_0x5dda0c(0x17e)});}catch(_0x4d7dff){const _0x2ce003=fixPathRepetition(_0x12e25f);if(_0x2ce003)try{_0x269461=await a0_0x17617d[_0x5dda0c(0x1b3)](_0x2ce003,{'encoding':'utf-8'}),_0x12e25f=_0x2ce003;}catch{_0x4a2b7c=_0x4d7dff instanceof Error?_0x4d7dff:new Error(String(_0x4d7dff));}else _0x4a2b7c=_0x4d7dff instanceof Error?_0x4d7dff:new Error(String(_0x4d7dff));}if(_0x269461!==null){const _0x381e92=_0x269461[_0x5dda0c(0x132)](/\r?\n/),_0x35d747=[];if(_0x43ac63[_0x5dda0c(0x1d2)]==='*'||!Array[_0x5dda0c(0x23b)](_0x43ac63[_0x5dda0c(0x1d2)]))for(let _0x5d0104=0x1;_0x5d0104<=_0x381e92[_0x5dda0c(0x22a)];_0x5d0104++){const _0x389cc8=_0x381e92[_0x5d0104-0x1];_0x35d747[_0x5dda0c(0x1bb)](_0x5d0104+'|\x20'+_0x389cc8);}else for(const [_0x11df1b,_0x4bc554]of _0x43ac63[_0x5dda0c(0x1d2)]){_0x35d747[_0x5dda0c(0x22a)]>0x0&&_0x35d747[_0x5dda0c(0x1bb)]('');for(let _0x409a72=_0x11df1b;_0x409a72<=_0x4bc554&&_0x409a72<=_0x381e92[_0x5dda0c(0x22a)];_0x409a72++){const _0x4f54ce=_0x381e92[_0x409a72-0x1];_0x35d747['push'](_0x409a72+'|\x20'+_0x4f54ce);}}_0x25ca8b[_0x5dda0c(0x1bb)]({'path':_0x43ac63[_0x5dda0c(0x230)],'content':_0x35d747[_0x5dda0c(0x222)]('\x0a')});}else _0x21c854['push'](_0x5dda0c(0x212)+_0x43ac63[_0x5dda0c(0x230)]+_0x5dda0c(0x1f1)+(_0x4a2b7c?.[_0x5dda0c(0x1cb)]||_0x5dda0c(0x128))+_0x5dda0c(0x182));}try{const _0x112031=await compactFileContexts(_0x25ca8b,_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],MORPH_API_KEY,MORPH_API_URL);for(const _0x36f7a7 of _0x112031){_0x21c854[_0x5dda0c(0x1bb)]('<file\x20path=\x22'+_0x36f7a7['path']+_0x5dda0c(0x1af)+_0x36f7a7[_0x5dda0c(0x1f7)]+_0x5dda0c(0x182));}}catch(_0x214808){logger[_0x5dda0c(0x223)]('MCP',_0x5dda0c(0x242),{'error':_0x214808 instanceof Error?_0x214808[_0x5dda0c(0x1cb)]:String(_0x214808),'files_count':_0x25ca8b[_0x5dda0c(0x22a)]});for(const _0x27f310 of _0x25ca8b){_0x21c854['push'](_0x5dda0c(0x212)+_0x27f310['path']+'\x22>\x0a'+_0x27f310[_0x5dda0c(0x1f7)]+_0x5dda0c(0x182));}}_0x5b70b0[_0x5dda0c(0x1bb)](_0x21c854[_0x5dda0c(0x222)]('\x0a\x0a')),_0x39d96a=_0x5b70b0[_0x5dda0c(0x222)]('\x0a');const _0x172984=_0x17f073['errors']?.[_0x5dda0c(0x148)](_0xbe28c5=>_0xbe28c5[_0x5dda0c(0x1cb)]?.[_0x5dda0c(0x23a)](_0x5dda0c(0x1c1)))||[];if(_0x172984[_0x5dda0c(0x22a)]>0x0){const _0x36f7b1=_0x172984['map'](_0x2da691=>_0x2da691['message'])[_0x5dda0c(0x222)](';\x20');reportMorphError({'error_message':_0x36f7b1,'error_type':'FileReadError','context':{'tool':'codebase_search','repo_path':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],'query':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'model':'morph-warp-grep-v2.1','termination_reason':_0x5dda0c(0x1b5),'error_count':_0x172984[_0x5dda0c(0x22a)],'is_timeout':![],'timings':_0x17f073['timings'],'files_attempted':_0x1d43e4[_0x5dda0c(0x215)](_0x484432=>({'path':_0x484432[_0x5dda0c(0x230)],'lines':_0x484432[_0x5dda0c(0x1d2)]})),'tool_calls':_0x1a7867(_0x17f073[_0x5dda0c(0x21e)]),'messages':_0x17f073[_0x5dda0c(0x21e)]?.[_0x5dda0c(0x215)](_0x6244db=>({'role':_0x6244db[_0x5dda0c(0x166)],'content':_0x6244db[_0x5dda0c(0x1f7)],..._0x6244db[_0x5dda0c(0x1f3)]?{'tool_calls':_0x6244db['tool_calls']['length']}:{},..._0x6244db[_0x5dda0c(0x12b)]?{'tool_call_id':_0x6244db[_0x5dda0c(0x12b)]}:{}})),'request_content':{'query':_0x547322['data']['search_string'],'repo_path':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],'repoRoot':a0_0x1b597d['resolve'](_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)]),'model':_0x5dda0c(0x146)}},'source':'mcp-filesystem'})[_0x5dda0c(0x199)](()=>{});}}else{if(_0x17f073[_0x5dda0c(0x190)]==='terminated'&&_0x17f073[_0x5dda0c(0x1b7)][_0x5dda0c(0x22a)]>0x0){const _0x5d4223=_0x17f073[_0x5dda0c(0x1b7)]['map'](_0x35e289=>_0x35e289[_0x5dda0c(0x1cb)])[_0x5dda0c(0x222)](';\x20');_0x39d96a=_0x5dda0c(0x20c)+_0x5d4223;const _0x706b9=_0x5d4223[_0x5dda0c(0x1fc)]()['includes']('timeout')||_0x5d4223['toLowerCase']()['includes'](_0x5dda0c(0x130))||_0x5d4223[_0x5dda0c(0x1fc)]()[_0x5dda0c(0x131)]('etimedout'),_0x1ac23a=_0x17f073[_0x5dda0c(0x1c6)]?.[_0x5dda0c(0x1b9)]?.['files'],_0x64998c=_0x17f073[_0x5dda0c(0x1b7)][0x0];reportMorphError({'error_message':_0x5d4223,'error_type':_0x706b9?_0x5dda0c(0x252):_0x64998c?.[_0x5dda0c(0x145)]?.[_0x5dda0c(0x20f)]||_0x5dda0c(0x1b6),'context':{'tool':'codebase_search','repo_path':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],'query':_0x547322[_0x5dda0c(0x225)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x17f073[_0x5dda0c(0x190)],'error_count':_0x17f073[_0x5dda0c(0x1b7)][_0x5dda0c(0x22a)],'is_timeout':_0x706b9,'timings':_0x17f073[_0x5dda0c(0x184)],'files_attempted':_0x1ac23a?.[_0x5dda0c(0x215)](_0x15e877=>({'path':_0x15e877[_0x5dda0c(0x230)],'lines':_0x15e877[_0x5dda0c(0x1d2)]})),'tool_calls':_0x1a7867(_0x17f073['messages']),'messages':_0x17f073[_0x5dda0c(0x21e)]?.[_0x5dda0c(0x215)](_0x5e2af0=>({'role':_0x5e2af0[_0x5dda0c(0x166)],'content':_0x5e2af0['content'],..._0x5e2af0[_0x5dda0c(0x1f3)]?{'tool_calls':_0x5e2af0[_0x5dda0c(0x1f3)][_0x5dda0c(0x22a)]}:{},..._0x5e2af0[_0x5dda0c(0x12b)]?{'tool_call_id':_0x5e2af0[_0x5dda0c(0x12b)]}:{}})),'request_content':{'query':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'repo_path':_0x547322['data'][_0x5dda0c(0x198)],'repoRoot':a0_0x1b597d[_0x5dda0c(0x243)](_0x547322[_0x5dda0c(0x225)]['repo_path']),'model':_0x5dda0c(0x146)}},'stack_trace':_0x64998c?.[_0x5dda0c(0x240)]||undefined,'source':_0x5dda0c(0x1b2)})[_0x5dda0c(0x199)](()=>{});}else _0x39d96a=_0x5dda0c(0x1e0);}return{'content':[{'type':'text','text':_0x39d96a}]};}catch(_0x6112bd){const _0x151242=handleMorphAPIError(_0x6112bd);if(_0x151242)return logger[_0x5dda0c(0x1c9)](_0x5dda0c(0x203),_0x5dda0c(0x160),{'tool':_0x5dda0c(0x1e2),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date['now']()-_0x22e089}),_0x151242;const _0x5e7b0b=_0x6112bd instanceof Error?_0x6112bd['message']:String(_0x6112bd);logger[_0x5dda0c(0x1c9)](_0x5dda0c(0x203),'tool_call_error',{'tool':'codebase_search','error':_0x5e7b0b,'repo_path':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],'query':_0x547322['data'][_0x5dda0c(0x217)],'latency_ms':Date[_0x5dda0c(0x167)]()-_0x22e089});const _0x4ad93b=_0x5e7b0b[_0x5dda0c(0x1fc)]()['includes'](_0x5dda0c(0x127))||_0x5e7b0b[_0x5dda0c(0x1fc)]()[_0x5dda0c(0x131)](_0x5dda0c(0x130))||_0x5e7b0b[_0x5dda0c(0x1fc)]()[_0x5dda0c(0x131)](_0x5dda0c(0x1b1))||_0x6112bd instanceof Error&&_0x6112bd[_0x5dda0c(0x20f)]===_0x5dda0c(0x252);return reportMorphError({'error_message':_0x5e7b0b,'error_type':_0x4ad93b?'TimeoutError':_0x6112bd instanceof Error?_0x6112bd['constructor'][_0x5dda0c(0x20f)]:_0x5dda0c(0x1fd),'context':{'tool':_0x5dda0c(0x1e2),'repo_path':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x198)],'query':_0x547322[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'model':_0x5dda0c(0x146),'is_timeout':_0x4ad93b,'exception_phase':_0x5dda0c(0x155),'request_content':{'query':_0x547322['data'][_0x5dda0c(0x217)],'repo_path':_0x547322['data'][_0x5dda0c(0x198)],'repoRoot':a0_0x1b597d[_0x5dda0c(0x243)](_0x547322[_0x5dda0c(0x225)]['repo_path']),'model':_0x5dda0c(0x146)}},'stack_trace':_0x6112bd instanceof Error?_0x6112bd['stack']:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':'text','text':_0x5dda0c(0x169)+_0x5e7b0b}],'isError':![]};}}case TOOL_NAMES[_0x5dda0c(0x22e)]:{const _0x1d4481=WarpGrepGitHubArgsSchema[_0x5dda0c(0x1d3)](_0x51f0de);if(!_0x1d4481['success'])return{'content':[{'type':_0x5dda0c(0x16c),'text':_0x5dda0c(0x142)+_0x1d4481['error']}],'isError':!![]};const _0x7c3039=_0x1d4481[_0x5dda0c(0x225)][_0x5dda0c(0x1ea)]||_0x1d4481['data']['owner_repo'];if(!_0x7c3039)return{'content':[{'type':'text','text':_0x5dda0c(0x23e)}],'isError':!![]};const _0xeab9f4=MORPH_API_KEY;if(!_0xeab9f4)throw new Error(_0x5dda0c(0x154));const _0x549ac7=Date[_0x5dda0c(0x167)]();logger[_0x5dda0c(0x1cc)](_0x5dda0c(0x203),_0x5dda0c(0x24f),{'identifier':_0x7c3039,'query':_0x1d4481[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'branch':_0x1d4481[_0x5dda0c(0x225)][_0x5dda0c(0x162)]});try{const _0xdf097c=new WarpGrepClient({'morphApiKey':_0xeab9f4,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4217e8=await _0xdf097c[_0x5dda0c(0x12e)]({'searchTerm':_0x1d4481[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'github':_0x7c3039,'branch':_0x1d4481[_0x5dda0c(0x225)][_0x5dda0c(0x162)]}),_0x15be92=Date[_0x5dda0c(0x167)]()-_0x549ac7;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x15be92+_0x5dda0c(0x1e7)+_0x4217e8['success']);const _0x666534=formatResult(_0x4217e8);return{'content':[{'type':'text','text':_0x666534}]};}catch(_0x530f35){const _0x198d63=handleMorphAPIError(_0x530f35);if(_0x198d63)return _0x198d63;const _0x3094fa=Date[_0x5dda0c(0x167)]()-_0x549ac7,_0x28b98f=_0x530f35 instanceof Error?_0x530f35[_0x5dda0c(0x1cb)]:String(_0x530f35);return logMcpStderr(_0x5dda0c(0x19f)+_0x3094fa+_0x5dda0c(0x126),_0x28b98f),reportMorphError({'error_message':_0x28b98f,'error_type':_0x530f35 instanceof Error?_0x530f35[_0x5dda0c(0x145)][_0x5dda0c(0x20f)]:'UnknownError','context':{'tool':_0x5dda0c(0x229),'github_url':_0x7c3039,'search_string':_0x1d4481[_0x5dda0c(0x225)][_0x5dda0c(0x217)],'branch':_0x1d4481['data']['branch']},'stack_trace':_0x530f35 instanceof Error?_0x530f35[_0x5dda0c(0x240)]:undefined,'source':'mcp-filesystem','tool':_0x5dda0c(0x229),'latency_ms':_0x3094fa})[_0x5dda0c(0x199)](()=>{}),{'content':[{'type':_0x5dda0c(0x16c),'text':'GitHub\x20search\x20failed:\x20'+_0x28b98f}],'isError':![]};}}default:throw new Error(_0x5dda0c(0x1bd)+_0xde66b7);}}catch(_0x1ec0d5){const _0x3c18fe=_0x1ec0d5 instanceof Error?_0x1ec0d5[_0x5dda0c(0x1cb)]:String(_0x1ec0d5);return reportMorphError({'error_message':_0x3c18fe,'error_type':_0x1ec0d5 instanceof Error?_0x1ec0d5[_0x5dda0c(0x145)]['name']:_0x5dda0c(0x1fd),'context':{'tool':_0xde66b7,'arguments':_0x51f0de?JSON['stringify'](_0x51f0de)[_0x5dda0c(0x152)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x1ec0d5 instanceof Error?_0x1ec0d5[_0x5dda0c(0x240)]:undefined,'source':'mcp-filesystem'})[_0x5dda0c(0x199)](()=>{}),{'content':[{'type':_0x5dda0c(0x16c),'text':_0x5dda0c(0x20c)+_0x3c18fe}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x5bc894){const _0x39326c=a0_0x5c9100,_0x4ff2e5=await getValidRootDirectories(_0x5bc894);if(_0x4ff2e5[_0x39326c(0x22a)]>0x0)allowedDirectories=[..._0x4ff2e5],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x4ff2e5[_0x39326c(0x22a)]+_0x39326c(0x19d));else{logMcpStderr(_0x39326c(0x211));if(ENABLE_WORKSPACE_MODE)try{const _0x23a4fb=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x23a4fb&&(allowedDirectories=[_0x23a4fb],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x23a4fb));}catch(_0x2fa38e){logMcpStderr(_0x39326c(0x13a)+_0x2fa38e);}}}server[a0_0x5c9100(0x202)](RootsListChangedNotificationSchema,async()=>{const _0x4677a9=a0_0x5c9100;try{const _0x5b3d52=await server[_0x4677a9(0x216)]();_0x5b3d52&&_0x4677a9(0x15e)in _0x5b3d52&&await updateAllowedDirectoriesFromRoots(_0x5b3d52['roots']);}catch(_0x5907c4){logMcpStderr(_0x4677a9(0x1d5),_0x5907c4 instanceof Error?_0x5907c4[_0x4677a9(0x1cb)]:String(_0x5907c4));}}),server[a0_0x5c9100(0x124)]=async()=>{const _0x4d0e86=a0_0x5c9100,_0x24f6dc=server[_0x4d0e86(0x236)]();if(_0x24f6dc?.[_0x4d0e86(0x15e)])try{const _0x2b9283=await server[_0x4d0e86(0x216)]();_0x2b9283&&_0x4d0e86(0x15e)in _0x2b9283?await updateAllowedDirectoriesFromRoots(_0x2b9283[_0x4d0e86(0x15e)]):logMcpStderr(_0x4d0e86(0x139));}catch(_0x5dea58){logMcpStderr(_0x4d0e86(0x129),_0x5dea58 instanceof Error?_0x5dea58['message']:String(_0x5dea58));}else{if(allowedDirectories[_0x4d0e86(0x22a)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x4d0e86(0x172));else throw new Error(_0x4d0e86(0x16e));}}};async function runServer(){const _0x4b5d0c=a0_0x5c9100,_0x363140=new StdioServerTransport();await server[_0x4b5d0c(0x18a)](_0x363140),logMcpStderr(_0x4b5d0c(0x12f)),allowedDirectories[_0x4b5d0c(0x22a)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x2d9fd4=>{const _0x2b88f2=a0_0x5c9100;logMcpStderr(_0x2b88f2(0x1d1),_0x2d9fd4),process['exit'](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- function a1_0x3220(_0x5a8a19,_0x59f819){_0x5a8a19=_0x5a8a19-0xcb;var _0x30d6f2=a1_0x30d6();var _0x322082=_0x30d6f2[_0x5a8a19];return _0x322082;}var a1_0x3ee94b=a1_0x3220;(function(_0xb9b13,_0x2d0a7d){var _0x26c6b7=a1_0x3220,_0x2e5fcf=_0xb9b13();while(!![]){try{var _0x4c5696=parseInt(_0x26c6b7(0xda))/0x1*(parseInt(_0x26c6b7(0xcb))/0x2)+-parseInt(_0x26c6b7(0xd8))/0x3*(parseInt(_0x26c6b7(0xdf))/0x4)+-parseInt(_0x26c6b7(0xcc))/0x5+-parseInt(_0x26c6b7(0xd2))/0x6*(-parseInt(_0x26c6b7(0xcf))/0x7)+-parseInt(_0x26c6b7(0xdd))/0x8*(-parseInt(_0x26c6b7(0xd9))/0x9)+-parseInt(_0x26c6b7(0xdb))/0xa*(parseInt(_0x26c6b7(0xd1))/0xb)+parseInt(_0x26c6b7(0xd3))/0xc;if(_0x4c5696===_0x2d0a7d)break;else _0x2e5fcf['push'](_0x2e5fcf['shift']());}catch(_0x7438a3){_0x2e5fcf['push'](_0x2e5fcf['shift']());}}}(a1_0x30d6,0x4087f));import a1_0x2b0a04 from'os';import{logger}from'./logger.js';function a1_0x30d6(){var _0x3f1f88=['length','7wrizvQ','darwin','3374503EPCwqj','1073742OdkFkV','9932448SajPRg','map','error','Windows','Linux','12930cxEMuQ','971037ojXfvt','120187UcBRNb','10wRduTd','win32','16ZTFcMN','Unknown','424rDKcRV','2IifGpK','1573410yrzpgU','platform'];a1_0x30d6=function(){return _0x3f1f88;};return a1_0x30d6();}export function getOperatingSystemType(_0xa947=a1_0x2b0a04['platform']()){var _0x363f82=a1_0x3220;switch(_0xa947){case _0x363f82(0xd0):return'macOS';case _0x363f82(0xdc):return _0x363f82(0xd6);case'linux':return _0x363f82(0xd7);default:return _0x363f82(0xde);}}export function formatMcpLogMessage(_0x481438,_0x1acb9e=a1_0x2b0a04[a1_0x3ee94b(0xcd)]()){return'[os='+getOperatingSystemType(_0x1acb9e)+']\x20'+_0x481438;}export function logMcpStderr(_0x673e91,..._0x40c161){var _0x16a915=a1_0x3ee94b;console[_0x16a915(0xd5)](formatMcpLogMessage(_0x673e91),..._0x40c161),logger['info']('MCP',_0x673e91,_0x40c161[_0x16a915(0xce)]?{'args':_0x40c161[_0x16a915(0xd4)](_0x456c25=>String(_0x456c25))}:undefined);}
1
+ var a1_0x408969=a1_0x4476;(function(_0x47e8a6,_0x4bd106){var _0x363418=a1_0x4476,_0x574ed6=_0x47e8a6();while(!![]){try{var _0x4d4109=parseInt(_0x363418(0xdf))/0x1+parseInt(_0x363418(0xd5))/0x2+parseInt(_0x363418(0xd1))/0x3*(parseInt(_0x363418(0xd7))/0x4)+parseInt(_0x363418(0xe1))/0x5+-parseInt(_0x363418(0xe0))/0x6*(-parseInt(_0x363418(0xd9))/0x7)+-parseInt(_0x363418(0xdb))/0x8+-parseInt(_0x363418(0xe3))/0x9;if(_0x4d4109===_0x4bd106)break;else _0x574ed6['push'](_0x574ed6['shift']());}catch(_0x242e54){_0x574ed6['push'](_0x574ed6['shift']());}}}(a1_0x260d,0x7e85a));import a1_0x567d2c from'os';import{logger}from'./logger.js';function a1_0x4476(_0x53802d,_0x27bc76){_0x53802d=_0x53802d-0xd0;var _0x260dc2=a1_0x260d();var _0x4476a5=_0x260dc2[_0x53802d];return _0x4476a5;}export function getOperatingSystemType(_0x3dbf7d=a1_0x567d2c['platform']()){var _0x179aa1=a1_0x4476;switch(_0x3dbf7d){case _0x179aa1(0xd4):return _0x179aa1(0xe2);case'win32':return _0x179aa1(0xe4);case _0x179aa1(0xda):return _0x179aa1(0xdd);default:return _0x179aa1(0xd6);}}function a1_0x260d(){var _0x20b198=['map','3DXpmfZ','error','info','darwin','1351196XHBWvc','Unknown','1303580AjVfwh','MCP','22757yLhKdb','linux','7697168LGWbuL','[os=','Linux','platform','306982kFgEko','1854zdcuKR','5028310JZeqCu','macOS','16544844rSdXdc','Windows'];a1_0x260d=function(){return _0x20b198;};return a1_0x260d();}export function formatMcpLogMessage(_0x427a96,_0xfe2e5c=a1_0x567d2c[a1_0x408969(0xde)]()){var _0x4216ff=a1_0x408969;return _0x4216ff(0xdc)+getOperatingSystemType(_0xfe2e5c)+']\x20'+_0x427a96;}export function logMcpStderr(_0x5dc3cc,..._0x164ea2){var _0x412c27=a1_0x408969;console[_0x412c27(0xd2)](formatMcpLogMessage(_0x5dc3cc),..._0x164ea2),logger[_0x412c27(0xd3)](_0x412c27(0xd8),_0x5dc3cc,_0x164ea2['length']?{'args':_0x164ea2[_0x412c27(0xd0)](_0x38096f=>String(_0x38096f))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- function a2_0x4199(_0x1addbf,_0x1b40d9){_0x1addbf=_0x1addbf-0x1e7;const _0x445acf=a2_0x445a();let _0x4199c0=_0x445acf[_0x1addbf];return _0x4199c0;}const a2_0x529b57=a2_0x4199;(function(_0x421cc5,_0x1d9089){const _0x5b2b6f=a2_0x4199,_0x28c714=_0x421cc5();while(!![]){try{const _0x2c5b35=parseInt(_0x5b2b6f(0x1f2))/0x1*(-parseInt(_0x5b2b6f(0x1e8))/0x2)+parseInt(_0x5b2b6f(0x1ea))/0x3*(-parseInt(_0x5b2b6f(0x200))/0x4)+parseInt(_0x5b2b6f(0x1fb))/0x5*(-parseInt(_0x5b2b6f(0x1f9))/0x6)+parseInt(_0x5b2b6f(0x1fa))/0x7+-parseInt(_0x5b2b6f(0x1ee))/0x8+-parseInt(_0x5b2b6f(0x1f1))/0x9*(-parseInt(_0x5b2b6f(0x1fd))/0xa)+parseInt(_0x5b2b6f(0x1f5))/0xb;if(_0x2c5b35===_0x1d9089)break;else _0x28c714['push'](_0x28c714['shift']());}catch(_0x357dfe){_0x28c714['push'](_0x28c714['shift']());}}}(a2_0x445a,0x7a2b6));import{createWriteStream}from'fs';function a2_0x445a(){const _0x42abfc=['warn','6822ISlITi','13583tGGNPX','debug','env','9624417AMqnej','enabled','info','stringify','21342MgJgiv','6180377Eivurb','605edbeCf','MORPH_LOG_FILE','7780WbnYie','enable','isEnabled','16fOFKXm','error','54STrXwT','fileStream','717321EPSAnn','write','MORPH_DEBUG','_log','748880qwrcJN',']\x20['];a2_0x445a=function(){return _0x42abfc;};return a2_0x445a();}class MorphLogger{[a2_0x529b57(0x1f6)];[a2_0x529b57(0x1e9)];constructor(){const _0x2f1c51=a2_0x529b57;this['enabled']=process['env'][_0x2f1c51(0x1ec)]==='1'||!!process[_0x2f1c51(0x1f4)][_0x2f1c51(0x1fc)];const _0x3e6017=process[_0x2f1c51(0x1f4)][_0x2f1c51(0x1fc)];this[_0x2f1c51(0x1e9)]=_0x3e6017?createWriteStream(_0x3e6017,{'flags':'a'}):null;}[a2_0x529b57(0x1f3)](_0x80af72,_0x39d119,_0x4c924e){const _0x157295=a2_0x529b57;this[_0x157295(0x1ed)](_0x157295(0x1f3),_0x80af72,_0x39d119,_0x4c924e);}['info'](_0x366143,_0x2eb046,_0x6510bb){const _0x19367a=a2_0x529b57;this[_0x19367a(0x1ed)](_0x19367a(0x1f7),_0x366143,_0x2eb046,_0x6510bb);}[a2_0x529b57(0x1f0)](_0xbd46bb,_0x5471be,_0x316f3c){const _0x1479b3=a2_0x529b57;this[_0x1479b3(0x1ed)](_0x1479b3(0x1f0),_0xbd46bb,_0x5471be,_0x316f3c);}[a2_0x529b57(0x1e7)](_0x3b8bfc,_0x31f132,_0x330a08){const _0x368180=a2_0x529b57;this[_0x368180(0x1ed)](_0x368180(0x1e7),_0x3b8bfc,_0x31f132,_0x330a08);}[a2_0x529b57(0x1fe)](){const _0x40d248=a2_0x529b57;this[_0x40d248(0x1f6)]=!![];}get[a2_0x529b57(0x1ff)](){const _0x3bcb11=a2_0x529b57;return this[_0x3bcb11(0x1f6)];}['_log'](_0x35e7ed,_0x57124d,_0x32caef,_0x58c730){const _0x4f2e26=a2_0x529b57;if(_0x35e7ed!==_0x4f2e26(0x1e7)&&!this['enabled'])return;const _0x42667f=new Date()['toISOString'](),_0x18ccdd='['+_0x42667f+']\x20['+_0x35e7ed['toUpperCase']()+_0x4f2e26(0x1ef)+_0x57124d+']';console['error'](_0x58c730?_0x18ccdd+'\x20'+_0x32caef+'\x20'+JSON['stringify'](_0x58c730):_0x18ccdd+'\x20'+_0x32caef),this[_0x4f2e26(0x1e9)]?.[_0x4f2e26(0x1eb)](JSON[_0x4f2e26(0x1f8)]({'ts':_0x42667f,'level':_0x35e7ed,'component':_0x57124d,'msg':_0x32caef,..._0x58c730&&{'data':_0x58c730}})+'\x0a');}}export const logger=new MorphLogger();
1
+ const a2_0x3d4878=a2_0x52e2;(function(_0x5df58e,_0x538115){const _0x173dc6=a2_0x52e2,_0x1edd8a=_0x5df58e();while(!![]){try{const _0x5659fc=-parseInt(_0x173dc6(0x91))/0x1+-parseInt(_0x173dc6(0x95))/0x2+parseInt(_0x173dc6(0x87))/0x3+-parseInt(_0x173dc6(0x96))/0x4+parseInt(_0x173dc6(0x8b))/0x5*(-parseInt(_0x173dc6(0x9b))/0x6)+-parseInt(_0x173dc6(0x84))/0x7*(parseInt(_0x173dc6(0x90))/0x8)+parseInt(_0x173dc6(0x88))/0x9;if(_0x5659fc===_0x538115)break;else _0x1edd8a['push'](_0x1edd8a['shift']());}catch(_0x52da0f){_0x1edd8a['push'](_0x1edd8a['shift']());}}}(a2_0x4c38,0xe22a9));function a2_0x4c38(){const _0x1a76a3=['error','info','MORPH_DEBUG','876BOYWDJ',']\x20[','enable','6587oSpuwf','_log','stringify','3089436axqCRN','35519571DgkroY','debug','toISOString','61235AVvgEl','write','warn','isEnabled','fileStream','2528JXLJam','633043ASpyai','toUpperCase','MORPH_LOG_FILE','env','747348aenAqN','3831676WaZDGz','enabled'];a2_0x4c38=function(){return _0x1a76a3;};return a2_0x4c38();}import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x3d4878(0x8f)];constructor(){const _0x292356=a2_0x3d4878;this['enabled']=process[_0x292356(0x94)][_0x292356(0x9a)]==='1'||!!process['env']['MORPH_LOG_FILE'];const _0x44e328=process['env'][_0x292356(0x93)];this[_0x292356(0x8f)]=_0x44e328?createWriteStream(_0x44e328,{'flags':'a'}):null;}[a2_0x3d4878(0x89)](_0x40c229,_0x1c18e8,_0x30a0c5){const _0x4a5d85=a2_0x3d4878;this[_0x4a5d85(0x85)](_0x4a5d85(0x89),_0x40c229,_0x1c18e8,_0x30a0c5);}['info'](_0x56c6ce,_0x8918c7,_0x1dcaaa){const _0x42139d=a2_0x3d4878;this[_0x42139d(0x85)](_0x42139d(0x99),_0x56c6ce,_0x8918c7,_0x1dcaaa);}['warn'](_0x21ebcb,_0x85bead,_0x5287d2){const _0x568234=a2_0x3d4878;this[_0x568234(0x85)](_0x568234(0x8d),_0x21ebcb,_0x85bead,_0x5287d2);}[a2_0x3d4878(0x98)](_0x26f260,_0x532e10,_0xd82400){const _0x4c48ef=a2_0x3d4878;this[_0x4c48ef(0x85)](_0x4c48ef(0x98),_0x26f260,_0x532e10,_0xd82400);}[a2_0x3d4878(0x9d)](){const _0x7af70a=a2_0x3d4878;this[_0x7af70a(0x97)]=!![];}get[a2_0x3d4878(0x8e)](){return this['enabled'];}[a2_0x3d4878(0x85)](_0x309dad,_0x1096d3,_0x132310,_0x252926){const _0x26c167=a2_0x3d4878;if(_0x309dad!=='error'&&!this[_0x26c167(0x97)])return;const _0x290f6=new Date()[_0x26c167(0x8a)](),_0x2e0542='['+_0x290f6+_0x26c167(0x9c)+_0x309dad[_0x26c167(0x92)]()+_0x26c167(0x9c)+_0x1096d3+']';console[_0x26c167(0x98)](_0x252926?_0x2e0542+'\x20'+_0x132310+'\x20'+JSON[_0x26c167(0x86)](_0x252926):_0x2e0542+'\x20'+_0x132310),this[_0x26c167(0x8f)]?.[_0x26c167(0x8c)](JSON[_0x26c167(0x86)]({'ts':_0x290f6,'level':_0x309dad,'component':_0x1096d3,'msg':_0x132310,..._0x252926&&{'data':_0x252926}})+'\x0a');}}function a2_0x52e2(_0x98fad3,_0x59fb60){_0x98fad3=_0x98fad3-0x84;const _0x4c3858=a2_0x4c38();let _0x52e29e=_0x4c3858[_0x98fad3];return _0x52e29e;}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0x27a666,_0x228d7e){const _0x40ca60=a3_0x58e2,_0x2f9592=_0x27a666();while(!![]){try{const _0x1fa8a1=-parseInt(_0x40ca60(0x169))/0x1+parseInt(_0x40ca60(0x16e))/0x2*(-parseInt(_0x40ca60(0x178))/0x3)+parseInt(_0x40ca60(0x179))/0x4+parseInt(_0x40ca60(0x173))/0x5*(-parseInt(_0x40ca60(0x17a))/0x6)+-parseInt(_0x40ca60(0x172))/0x7*(-parseInt(_0x40ca60(0x17b))/0x8)+parseInt(_0x40ca60(0x16d))/0x9*(parseInt(_0x40ca60(0x168))/0xa)+parseInt(_0x40ca60(0x170))/0xb;if(_0x1fa8a1===_0x228d7e)break;else _0x2f9592['push'](_0x2f9592['shift']());}catch(_0x223318){_0x2f9592['push'](_0x2f9592['shift']());}}}(a3_0x5824,0x5973a));function a3_0x5824(){const _0x2a9a2f=['2456180CqxcyW','6kaMKBz','420008kTcGiT','toUpperCase','homedir','20gFTxUH','663368MOEpgc','trim','charAt','replace','1935459USFJSk','445868NnkMAS','/mnt/','7487678xSHGyZ','startsWith','7arfQTB','393910qBCDfF','match','slice','substring','join','9VjSelM'];a3_0x5824=function(){return _0x2a9a2f;};return a3_0x5824();}import a3_0x3f6fa7 from'path';import a3_0x12dff7 from'os';export function convertToWindowsPath(_0x389280){const _0x302129=a3_0x58e2;if(_0x389280[_0x302129(0x171)](_0x302129(0x16f))){const _0x270cb2=_0x389280[_0x302129(0x16b)](0x5)[_0x302129(0x17c)](),_0x5c1760=_0x389280[_0x302129(0x175)](0x6)['replace'](/\//g,'\x5c');return _0x270cb2+':'+_0x5c1760;}if(_0x389280[_0x302129(0x174)](/^\/[a-zA-Z]\//)){const _0x328f5d=_0x389280[_0x302129(0x16b)](0x1)[_0x302129(0x17c)](),_0x2a717e=_0x389280['slice'](0x2)[_0x302129(0x16c)](/\//g,'\x5c');return _0x328f5d+':'+_0x2a717e;}if(_0x389280[_0x302129(0x174)](/^[a-zA-Z]:/))return _0x389280[_0x302129(0x16c)](/\//g,'\x5c');return _0x389280;}function a3_0x58e2(_0x176b01,_0x33a666){_0x176b01=_0x176b01-0x168;const _0x5824a2=a3_0x5824();let _0x58e29b=_0x5824a2[_0x176b01];return _0x58e29b;}export function normalizePath(_0x493539){const _0x402616=a3_0x58e2;_0x493539=_0x493539[_0x402616(0x16a)]()[_0x402616(0x16c)](/^["']|["']$/g,'');const _0x1c7bad=_0x493539[_0x402616(0x171)]('/')&&!_0x493539[_0x402616(0x174)](/^\/mnt\/[a-z]\//i)&&!_0x493539['match'](/^\/[a-zA-Z]\//);if(_0x1c7bad)return _0x493539[_0x402616(0x16c)](/\/+/g,'/')[_0x402616(0x16c)](/\/+$/,'');_0x493539=convertToWindowsPath(_0x493539);if(_0x493539[_0x402616(0x171)]('\x5c\x5c')){let _0x47ba1f=_0x493539;_0x47ba1f=_0x47ba1f[_0x402616(0x16c)](/^\\{2,}/,'\x5c\x5c');const _0x1f0c65=_0x47ba1f[_0x402616(0x176)](0x2)[_0x402616(0x16c)](/\\\\/g,'\x5c');_0x493539='\x5c\x5c'+_0x1f0c65;}else _0x493539=_0x493539['replace'](/\\\\/g,'\x5c');let _0xb2fa72=a3_0x3f6fa7['normalize'](_0x493539);_0x493539['startsWith']('\x5c\x5c')&&!_0xb2fa72[_0x402616(0x171)]('\x5c\x5c')&&(_0xb2fa72='\x5c'+_0xb2fa72);if(_0xb2fa72[_0x402616(0x174)](/^[a-zA-Z]:/)){let _0x5098f6=_0xb2fa72[_0x402616(0x16c)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x5098f6)&&(_0x5098f6=_0x5098f6[_0x402616(0x16b)](0x0)[_0x402616(0x17c)]()+_0x5098f6[_0x402616(0x175)](0x1)),_0x5098f6;}return _0xb2fa72['replace'](/\//g,'\x5c');}export function expandHome(_0x5ebbe0){const _0x42cf13=a3_0x58e2;if(_0x5ebbe0['startsWith']('~/')||_0x5ebbe0==='~')return a3_0x3f6fa7[_0x42cf13(0x177)](a3_0x12dff7[_0x42cf13(0x17d)](),_0x5ebbe0[_0x42cf13(0x175)](0x1));return _0x5ebbe0;}
1
+ (function(_0x30228f,_0x19b3d3){const _0x3b6a2c=a3_0x19d3,_0x44c43e=_0x30228f();while(!![]){try{const _0x78068d=-parseInt(_0x3b6a2c(0x1e8))/0x1+-parseInt(_0x3b6a2c(0x1e3))/0x2+-parseInt(_0x3b6a2c(0x1ec))/0x3+-parseInt(_0x3b6a2c(0x1e2))/0x4+parseInt(_0x3b6a2c(0x1e6))/0x5*(parseInt(_0x3b6a2c(0x1f0))/0x6)+parseInt(_0x3b6a2c(0x1f3))/0x7+parseInt(_0x3b6a2c(0x1f2))/0x8;if(_0x78068d===_0x19b3d3)break;else _0x44c43e['push'](_0x44c43e['shift']());}catch(_0x1997a4){_0x44c43e['push'](_0x44c43e['shift']());}}}(a3_0x3f53,0xa1449));import a3_0x4cbc0b from'path';import a3_0x5d4405 from'os';function a3_0x3f53(){const _0x309b09=['startsWith','832530PjpUpT','toUpperCase','replace','match','2710869RRjSwF','normalize','slice','/mnt/','18RDQJPg','substring','19283824fjMRSt','5606251FPuCss','charAt','2995320vBUbsn','661008kJBcKL','test','trim','441115MYhLpf'];a3_0x3f53=function(){return _0x309b09;};return a3_0x3f53();}export function convertToWindowsPath(_0x1cfb7a){const _0x3ef1c6=a3_0x19d3;if(_0x1cfb7a[_0x3ef1c6(0x1e7)](_0x3ef1c6(0x1ef))){const _0x1508a3=_0x1cfb7a[_0x3ef1c6(0x1e1)](0x5)['toUpperCase'](),_0x27f936=_0x1cfb7a[_0x3ef1c6(0x1ee)](0x6)[_0x3ef1c6(0x1ea)](/\//g,'\x5c');return _0x1508a3+':'+_0x27f936;}if(_0x1cfb7a[_0x3ef1c6(0x1eb)](/^\/[a-zA-Z]\//)){const _0x35ef10=_0x1cfb7a[_0x3ef1c6(0x1e1)](0x1)[_0x3ef1c6(0x1e9)](),_0xebc99a=_0x1cfb7a[_0x3ef1c6(0x1ee)](0x2)[_0x3ef1c6(0x1ea)](/\//g,'\x5c');return _0x35ef10+':'+_0xebc99a;}if(_0x1cfb7a[_0x3ef1c6(0x1eb)](/^[a-zA-Z]:/))return _0x1cfb7a[_0x3ef1c6(0x1ea)](/\//g,'\x5c');return _0x1cfb7a;}export function normalizePath(_0x3cedc6){const _0x41301a=a3_0x19d3;_0x3cedc6=_0x3cedc6[_0x41301a(0x1e5)]()[_0x41301a(0x1ea)](/^["']|["']$/g,'');const _0x5ec9ce=_0x3cedc6[_0x41301a(0x1e7)]('/')&&!_0x3cedc6[_0x41301a(0x1eb)](/^\/mnt\/[a-z]\//i)&&!_0x3cedc6['match'](/^\/[a-zA-Z]\//);if(_0x5ec9ce)return _0x3cedc6[_0x41301a(0x1ea)](/\/+/g,'/')[_0x41301a(0x1ea)](/\/+$/,'');_0x3cedc6=convertToWindowsPath(_0x3cedc6);if(_0x3cedc6[_0x41301a(0x1e7)]('\x5c\x5c')){let _0x42f3b9=_0x3cedc6;_0x42f3b9=_0x42f3b9[_0x41301a(0x1ea)](/^\\{2,}/,'\x5c\x5c');const _0x595b5a=_0x42f3b9[_0x41301a(0x1f1)](0x2)['replace'](/\\\\/g,'\x5c');_0x3cedc6='\x5c\x5c'+_0x595b5a;}else _0x3cedc6=_0x3cedc6[_0x41301a(0x1ea)](/\\\\/g,'\x5c');let _0x130e5a=a3_0x4cbc0b[_0x41301a(0x1ed)](_0x3cedc6);_0x3cedc6['startsWith']('\x5c\x5c')&&!_0x130e5a[_0x41301a(0x1e7)]('\x5c\x5c')&&(_0x130e5a='\x5c'+_0x130e5a);if(_0x130e5a['match'](/^[a-zA-Z]:/)){let _0x2a0d41=_0x130e5a[_0x41301a(0x1ea)](/\//g,'\x5c');return/^[a-z]:/[_0x41301a(0x1e4)](_0x2a0d41)&&(_0x2a0d41=_0x2a0d41[_0x41301a(0x1e1)](0x0)[_0x41301a(0x1e9)]()+_0x2a0d41[_0x41301a(0x1ee)](0x1)),_0x2a0d41;}return _0x130e5a[_0x41301a(0x1ea)](/\//g,'\x5c');}function a3_0x19d3(_0x4e3fc6,_0x5ee99d){_0x4e3fc6=_0x4e3fc6-0x1e1;const _0x3f53c2=a3_0x3f53();let _0x19d349=_0x3f53c2[_0x4e3fc6];return _0x19d349;}export function expandHome(_0x409c84){const _0x5cd1e0=a3_0x19d3;if(_0x409c84['startsWith']('~/')||_0x409c84==='~')return a3_0x4cbc0b['join'](a3_0x5d4405['homedir'](),_0x409c84[_0x5cd1e0(0x1ee)](0x1));return _0x409c84;}
@@ -1 +1 @@
1
- (function(_0x34dbd7,_0x589eed){const _0x402715=a4_0x12df,_0x5a492f=_0x34dbd7();while(!![]){try{const _0x4cf983=parseInt(_0x402715(0xdd))/0x1+parseInt(_0x402715(0xd5))/0x2*(-parseInt(_0x402715(0xdc))/0x3)+parseInt(_0x402715(0xcc))/0x4*(parseInt(_0x402715(0xcb))/0x5)+parseInt(_0x402715(0xcd))/0x6+-parseInt(_0x402715(0xd1))/0x7+-parseInt(_0x402715(0xd0))/0x8+-parseInt(_0x402715(0xd3))/0x9;if(_0x4cf983===_0x589eed)break;else _0x5a492f['push'](_0x5a492f['shift']());}catch(_0x33efb0){_0x5a492f['push'](_0x5a492f['shift']());}}}(a4_0x560e,0x380d8));import a4_0x413d88 from'path';export function isPathWithinAllowedDirectories(_0x5e5330,_0x536835){const _0x5901e8=a4_0x12df;if(typeof _0x5e5330!==_0x5901e8(0xd9)||!Array['isArray'](_0x536835))return![];if(!_0x5e5330||_0x536835[_0x5901e8(0xcf)]===0x0)return![];if(_0x5e5330[_0x5901e8(0xd7)]('\x00'))return![];let _0x42b75c;try{_0x42b75c=a4_0x413d88[_0x5901e8(0xdb)](a4_0x413d88[_0x5901e8(0xce)](_0x5e5330));}catch{return![];}if(!a4_0x413d88[_0x5901e8(0xda)](_0x42b75c))throw new Error(_0x5901e8(0xd4));return _0x536835[_0x5901e8(0xde)](_0x1bbf19=>{const _0x6a33a3=_0x5901e8;if(typeof _0x1bbf19!==_0x6a33a3(0xd9)||!_0x1bbf19)return![];if(_0x1bbf19[_0x6a33a3(0xd7)]('\x00'))return![];let _0x5bbaf7;try{_0x5bbaf7=a4_0x413d88[_0x6a33a3(0xdb)](a4_0x413d88['normalize'](_0x1bbf19));}catch{return![];}if(!a4_0x413d88[_0x6a33a3(0xda)](_0x5bbaf7))throw new Error(_0x6a33a3(0xd6));if(_0x42b75c===_0x5bbaf7)return!![];if(_0x5bbaf7===a4_0x413d88[_0x6a33a3(0xd8)])return _0x42b75c[_0x6a33a3(0xd2)](a4_0x413d88['sep']);return _0x42b75c[_0x6a33a3(0xd2)](_0x5bbaf7+a4_0x413d88['sep']);});}function a4_0x12df(_0x3a3039,_0x1ee842){_0x3a3039=_0x3a3039-0xcb;const _0x560e1d=a4_0x560e();let _0x12df7f=_0x560e1d[_0x3a3039];return _0x12df7f;}function a4_0x560e(){const _0x64b5cb=['2906337zgaWaz','startsWith','47385SaiFxs','Path\x20must\x20be\x20absolute\x20after\x20normalization','532GjnLiR','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','includes','sep','string','isAbsolute','resolve','972qSwzGr','265269vGbfpn','some','345xopbZP','10492UWLtjH','2707860DSAxgw','normalize','length','1290672xlpFTj'];a4_0x560e=function(){return _0x64b5cb;};return a4_0x560e();}
1
+ function a4_0x5e88(_0x25b98a,_0x4e9426){_0x25b98a=_0x25b98a-0x1f1;const _0x5f3c0b=a4_0x5f3c();let _0x5e88a8=_0x5f3c0b[_0x25b98a];return _0x5e88a8;}(function(_0x3366f1,_0x53d00e){const _0x3fb213=a4_0x5e88,_0x1bea63=_0x3366f1();while(!![]){try{const _0x1b7ef4=-parseInt(_0x3fb213(0x1fb))/0x1+-parseInt(_0x3fb213(0x1fc))/0x2+-parseInt(_0x3fb213(0x1f3))/0x3*(parseInt(_0x3fb213(0x203))/0x4)+-parseInt(_0x3fb213(0x1f2))/0x5+parseInt(_0x3fb213(0x1f8))/0x6*(-parseInt(_0x3fb213(0x202))/0x7)+parseInt(_0x3fb213(0x1fe))/0x8+parseInt(_0x3fb213(0x1f9))/0x9;if(_0x1b7ef4===_0x53d00e)break;else _0x1bea63['push'](_0x1bea63['shift']());}catch(_0x401eda){_0x1bea63['push'](_0x1bea63['shift']());}}}(a4_0x5f3c,0xb1f37));import a4_0x217776 from'path';function a4_0x5f3c(){const _0x4361a6=['2411630xJdxtg','string','5503056cNtDWC','Path\x20must\x20be\x20absolute\x20after\x20normalization','isAbsolute','isArray','4739SiIINC','4073816DYCbTM','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','resolve','3964025qcXnXY','3hDgfrp','length','startsWith','sep','normalize','5976fDxGsQ','38467809YwkFBz','includes','541830dTqluj'];a4_0x5f3c=function(){return _0x4361a6;};return a4_0x5f3c();}export function isPathWithinAllowedDirectories(_0x4740f3,_0x45bd37){const _0x6d1728=a4_0x5e88;if(typeof _0x4740f3!=='string'||!Array[_0x6d1728(0x201)](_0x45bd37))return![];if(!_0x4740f3||_0x45bd37[_0x6d1728(0x1f4)]===0x0)return![];if(_0x4740f3[_0x6d1728(0x1fa)]('\x00'))return![];let _0x4ef80e;try{_0x4ef80e=a4_0x217776[_0x6d1728(0x1f1)](a4_0x217776[_0x6d1728(0x1f7)](_0x4740f3));}catch{return![];}if(!a4_0x217776[_0x6d1728(0x200)](_0x4ef80e))throw new Error(_0x6d1728(0x1ff));return _0x45bd37['some'](_0x14438a=>{const _0x474abc=_0x6d1728;if(typeof _0x14438a!==_0x474abc(0x1fd)||!_0x14438a)return![];if(_0x14438a[_0x474abc(0x1fa)]('\x00'))return![];let _0x5b83aa;try{_0x5b83aa=a4_0x217776[_0x474abc(0x1f1)](a4_0x217776[_0x474abc(0x1f7)](_0x14438a));}catch{return![];}if(!a4_0x217776[_0x474abc(0x200)](_0x5b83aa))throw new Error(_0x474abc(0x204));if(_0x4ef80e===_0x5b83aa)return!![];if(_0x5b83aa===a4_0x217776[_0x474abc(0x1f6)])return _0x4ef80e[_0x474abc(0x1f5)](a4_0x217776[_0x474abc(0x1f6)]);return _0x4ef80e[_0x474abc(0x1f5)](_0x5b83aa+a4_0x217776['sep']);});}
@@ -1 +1 @@
1
- (function(_0x34f2b5,_0x4369a0){const _0x220930=a5_0x3db3,_0x3d17a8=_0x34f2b5();while(!![]){try{const _0x59980e=parseInt(_0x220930(0x110))/0x1*(-parseInt(_0x220930(0x11c))/0x2)+-parseInt(_0x220930(0x118))/0x3*(parseInt(_0x220930(0x107))/0x4)+-parseInt(_0x220930(0x114))/0x5*(parseInt(_0x220930(0x10e))/0x6)+parseInt(_0x220930(0x11a))/0x7+parseInt(_0x220930(0x105))/0x8+-parseInt(_0x220930(0x10f))/0x9*(parseInt(_0x220930(0x109))/0xa)+parseInt(_0x220930(0x108))/0xb;if(_0x59980e===_0x4369a0)break;else _0x3d17a8['push'](_0x3d17a8['shift']());}catch(_0x3e8c72){_0x3d17a8['push'](_0x3d17a8['shift']());}}}(a5_0x2317,0xa9c6d));function a5_0x3db3(_0x459d2e,_0x526525){_0x459d2e=_0x459d2e-0x105;const _0x231775=a5_0x2317();let _0x3db375=_0x231775[_0x459d2e];return _0x3db375;}import{promises as a5_0x97da67}from'fs';function a5_0x2317(){const _0x591c82=['\x20due\x20to\x20error:\x20','realpath','362150jVqYNj','startsWith','slice','Skipping\x20invalid\x20directory:\x20','2019057yWlOav','join','738689WTfcWi','invalid\x20path\x20or\x20inaccessible','760uAscqh','774464jkddkE','stat','4BwAzjD','26084795aEtOMu','19340bJdcWL','file://','isDirectory','uri','message','60myERdT','1476igLygc','431ZRimKR','Skipping\x20'];a5_0x2317=function(){return _0x591c82;};return a5_0x2317();}import a5_0x578faf from'path';import a5_0x39e5be from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x399979){const _0x5a1031=a5_0x3db3;try{const _0x1d3fe5=_0x399979[_0x5a1031(0x115)](_0x5a1031(0x10a))?_0x399979['slice'](0x7):_0x399979,_0x46d5ca=_0x1d3fe5[_0x5a1031(0x115)]('~/')||_0x1d3fe5==='~'?a5_0x578faf[_0x5a1031(0x119)](a5_0x39e5be['homedir'](),_0x1d3fe5[_0x5a1031(0x116)](0x1)):_0x1d3fe5,_0x3bb172=a5_0x578faf['resolve'](_0x46d5ca),_0x46bead=await a5_0x97da67[_0x5a1031(0x113)](_0x3bb172);return normalizePath(_0x46bead);}catch{return null;}}function formatDirectoryError(_0x25e63f,_0x52fef1,_0x1ff071){const _0xbc7fff=a5_0x3db3;if(_0x1ff071)return _0xbc7fff(0x111)+_0x1ff071+':\x20'+_0x25e63f;const _0x1861ba=_0x52fef1 instanceof Error?_0x52fef1[_0xbc7fff(0x10d)]:String(_0x52fef1);return _0xbc7fff(0x117)+_0x25e63f+_0xbc7fff(0x112)+_0x1861ba;}export async function getValidRootDirectories(_0x59a2cc){const _0x325a32=a5_0x3db3,_0x509a36=[];for(const _0x4560a2 of _0x59a2cc){const _0x4aa09b=await parseRootUri(_0x4560a2[_0x325a32(0x10c)]);if(!_0x4aa09b){logMcpStderr(formatDirectoryError(_0x4560a2[_0x325a32(0x10c)],undefined,_0x325a32(0x11b)));continue;}try{const _0x2dec91=await a5_0x97da67[_0x325a32(0x106)](_0x4aa09b);_0x2dec91[_0x325a32(0x10b)]()?_0x509a36['push'](_0x4aa09b):logMcpStderr(formatDirectoryError(_0x4aa09b,undefined,'non-directory\x20root'));}catch(_0x7b8af5){logMcpStderr(formatDirectoryError(_0x4aa09b,_0x7b8af5));}}return _0x509a36;}
1
+ (function(_0x10e590,_0x2cd1fe){const _0x6bb557=a5_0x4e45,_0x42eed0=_0x10e590();while(!![]){try{const _0x2e2eab=-parseInt(_0x6bb557(0x94))/0x1+parseInt(_0x6bb557(0x9f))/0x2+-parseInt(_0x6bb557(0x9e))/0x3*(parseInt(_0x6bb557(0xa2))/0x4)+parseInt(_0x6bb557(0xa3))/0x5+-parseInt(_0x6bb557(0x9a))/0x6*(parseInt(_0x6bb557(0x92))/0x7)+parseInt(_0x6bb557(0x96))/0x8+parseInt(_0x6bb557(0xa1))/0x9;if(_0x2e2eab===_0x2cd1fe)break;else _0x42eed0['push'](_0x42eed0['shift']());}catch(_0x379721){_0x42eed0['push'](_0x42eed0['shift']());}}}(a5_0x5f04,0x52429));import{promises as a5_0x1f39be}from'fs';import a5_0x5615eb from'path';function a5_0x5f04(){const _0x24675c=['2109145qAFsKm','stat','slice','isDirectory','\x20due\x20to\x20error:\x20','196889UjPEZH','homedir','160178ZcQsnf','uri','200448bkCtQK','message','startsWith','file://','132LGSqkK','resolve','Skipping\x20','non-directory\x20root','47919IalKHa','1135842LiqwOn','invalid\x20path\x20or\x20inaccessible','1628712akoWIB','20uzTcog'];a5_0x5f04=function(){return _0x24675c;};return a5_0x5f04();}import a5_0x8aa98a from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0xdac0a8){const _0x5c6325=a5_0x4e45;try{const _0x4453ee=_0xdac0a8[_0x5c6325(0x98)](_0x5c6325(0x99))?_0xdac0a8['slice'](0x7):_0xdac0a8,_0x358e54=_0x4453ee[_0x5c6325(0x98)]('~/')||_0x4453ee==='~'?a5_0x5615eb['join'](a5_0x8aa98a[_0x5c6325(0x93)](),_0x4453ee[_0x5c6325(0xa5)](0x1)):_0x4453ee,_0x4e8ee3=a5_0x5615eb[_0x5c6325(0x9b)](_0x358e54),_0x543565=await a5_0x1f39be['realpath'](_0x4e8ee3);return normalizePath(_0x543565);}catch{return null;}}function formatDirectoryError(_0x4e49d5,_0xeba73f,_0x10ba56){const _0x1380ea=a5_0x4e45;if(_0x10ba56)return _0x1380ea(0x9c)+_0x10ba56+':\x20'+_0x4e49d5;const _0x265059=_0xeba73f instanceof Error?_0xeba73f[_0x1380ea(0x97)]:String(_0xeba73f);return'Skipping\x20invalid\x20directory:\x20'+_0x4e49d5+_0x1380ea(0xa7)+_0x265059;}function a5_0x4e45(_0x2a16eb,_0x2c1cac){_0x2a16eb=_0x2a16eb-0x92;const _0x5f04f2=a5_0x5f04();let _0x4e4593=_0x5f04f2[_0x2a16eb];return _0x4e4593;}export async function getValidRootDirectories(_0x1d67bc){const _0x55cd12=a5_0x4e45,_0xa4401c=[];for(const _0x513ee9 of _0x1d67bc){const _0x4b4ce0=await parseRootUri(_0x513ee9[_0x55cd12(0x95)]);if(!_0x4b4ce0){logMcpStderr(formatDirectoryError(_0x513ee9['uri'],undefined,_0x55cd12(0xa0)));continue;}try{const _0x11a025=await a5_0x1f39be[_0x55cd12(0xa4)](_0x4b4ce0);_0x11a025[_0x55cd12(0xa6)]()?_0xa4401c['push'](_0x4b4ce0):logMcpStderr(formatDirectoryError(_0x4b4ce0,undefined,_0x55cd12(0x9d)));}catch(_0x402e58){logMcpStderr(formatDirectoryError(_0x4b4ce0,_0x402e58));}}return _0xa4401c;}
@@ -1 +1 @@
1
- const a6_0x534819=a6_0x36fd;(function(_0x286685,_0x5d3c17){const _0x197518=a6_0x36fd,_0x1afe3b=_0x286685();while(!![]){try{const _0xd6e2dd=parseInt(_0x197518(0x139))/0x1+parseInt(_0x197518(0x13d))/0x2*(-parseInt(_0x197518(0x135))/0x3)+-parseInt(_0x197518(0x138))/0x4+parseInt(_0x197518(0x137))/0x5+parseInt(_0x197518(0x13b))/0x6*(-parseInt(_0x197518(0x136))/0x7)+-parseInt(_0x197518(0x13c))/0x8+parseInt(_0x197518(0x134))/0x9*(parseInt(_0x197518(0x13a))/0xa);if(_0xd6e2dd===_0x5d3c17)break;else _0x1afe3b['push'](_0x1afe3b['shift']());}catch(_0x3a7aa8){_0x1afe3b['push'](_0x1afe3b['shift']());}}}(a6_0x2414,0x21238));function a6_0x36fd(_0x5cb83e,_0x216364){_0x5cb83e=_0x5cb83e-0x133;const _0x24149e=a6_0x2414();let _0x36fdc9=_0x24149e[_0x5cb83e];return _0x36fdc9;}function a6_0x2414(){const _0x4c6e4f=['129290nFevHe','256900kOlxJI','1042632wLbhgB','103522YjNwmX','10WULaqf','42BtnEmr','2074328HvuGDy','2408tELgcD','github_codebase_search','7631973kZYPIM','543VIaCvq'];a6_0x2414=function(){return _0x4c6e4f;};return a6_0x2414();}export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x534819(0x133)};export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ function a6_0x57f3(_0x276486,_0xd3d328){_0x276486=_0x276486-0xef;const _0x86a5e9=a6_0x86a5();let _0x57f314=_0x86a5e9[_0x276486];return _0x57f314;}const a6_0x2b1b8f=a6_0x57f3;(function(_0x486069,_0x2bb2c7){const _0x529379=a6_0x57f3,_0xdd9a8e=_0x486069();while(!![]){try{const _0x485f0b=-parseInt(_0x529379(0xfd))/0x1*(-parseInt(_0x529379(0xf8))/0x2)+-parseInt(_0x529379(0xf4))/0x3*(parseInt(_0x529379(0xf6))/0x4)+-parseInt(_0x529379(0xef))/0x5*(parseInt(_0x529379(0xf3))/0x6)+parseInt(_0x529379(0xfa))/0x7+parseInt(_0x529379(0xf7))/0x8*(parseInt(_0x529379(0xfb))/0x9)+-parseInt(_0x529379(0xfc))/0xa*(-parseInt(_0x529379(0xf5))/0xb)+-parseInt(_0x529379(0xf9))/0xc;if(_0x485f0b===_0x2bb2c7)break;else _0xdd9a8e['push'](_0xdd9a8e['shift']());}catch(_0x5f4d8f){_0xdd9a8e['push'](_0xdd9a8e['shift']());}}}(a6_0x86a5,0x1ec69));export const TOOL_NAMES={'EDIT_FILE':a6_0x2b1b8f(0xf0),'CODEBASE_SEARCH':a6_0x2b1b8f(0xf2),'GITHUB_CODEBASE_SEARCH':a6_0x2b1b8f(0xf1)};export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);function a6_0x86a5(){const _0x7bb18b=['github_codebase_search','codebase_search','10662NqZPJw','92409ushdPQ','69707SKCLTG','8EcqJcj','432dLiyLu','2ZxKjmi','5559000JzcPhZ','1287440ftYoST','35073jpzOam','230pyPGHQ','190769rdvUHV','225MiUFQC','edit_file'];a6_0x86a5=function(){return _0x7bb18b;};return a6_0x86a5();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.169",
3
+ "version": "0.8.170",
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)",