Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@morphllm/morphmcp

Package Overview
Dependencies
Maintainers
2
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morphllm/morphmcp - npm Package Compare versions

Comparing version
0.8.181
to
0.8.182
+1
-1
dist/index.js
#!/usr/bin/env node
const a0_0x231f6c=a0_0x2218;(function(_0x101d3d,_0x14fc74){const _0x4947c8=a0_0x2218,_0x36b4bd=_0x101d3d();while(!![]){try{const _0x12a916=parseInt(_0x4947c8(0x1e2))/0x1+parseInt(_0x4947c8(0x293))/0x2*(parseInt(_0x4947c8(0x29b))/0x3)+-parseInt(_0x4947c8(0x1ac))/0x4+parseInt(_0x4947c8(0x1b9))/0x5+parseInt(_0x4947c8(0x1a2))/0x6*(-parseInt(_0x4947c8(0x262))/0x7)+parseInt(_0x4947c8(0x219))/0x8*(parseInt(_0x4947c8(0x2b2))/0x9)+-parseInt(_0x4947c8(0x27b))/0xa;if(_0x12a916===_0x14fc74)break;else _0x36b4bd['push'](_0x36b4bd['shift']());}catch(_0x1c4159){_0x36b4bd['push'](_0x36b4bd['shift']());}}}(a0_0x57ec,0x6520d));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_0x3ed385 from'fs/promises';import a0_0x146359 from'path';import a0_0x1d7b4c 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';function a0_0x2218(_0x508a99,_0x50fef7){_0x508a99=_0x508a99-0x194;const _0x57ec87=a0_0x57ec();let _0x22189a=_0x57ec87[_0x508a99];return _0x22189a;}function a0_0x57ec(){const _0x2de968=['\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','listRoots','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','split','dryRun','terminated','\x22>\x0aError\x20reading\x20file:\x20','code','normalize','assistant','github_url','lines','trim','toLowerCase','setRequestHandler','warp_grep_start','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','warp_grep_complete','user','optional','context','sep','mcp-filesystem','slice','cwd','indexOf','Tool\x20\x22','role','argv','[github_codebase_search]\x20Done\x20in\x20','Created\x20File','some','floor','code_edit','errors','MORPH_LARGE_APPLY','metadata','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','grep_search','setNotificationHandler','WORKSPACE_ROOT','❌\x20Morph\x20Edit\x20Failed:\x20','min','map','SubToolError','filter','completionId','\x20error(s)','target_filepath','.\x20Path:\x20','error','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.','version','provider_created','Workspace\x20mode\x20enabled:\x20Using\x20','size','github_codebase_search','morph-','1001GRtAAG','enum','morph-warp-grep-v2.1','name','Applied','grep\x20\x27','env','MORPH_WARP_GREP_TIMEOUT','pattern','Unknown\x20error','.git','--api-key','tsconfig.json','boolean','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','linesAdded','roots','includes','repo_path','file_read_complete','\x20disabled\x20via\x20DISABLED_TOOLS','@morphllm/morphmcp\x20','Morph\x20Edit\x20Preview','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','unknown','202270eREpru','`\x20in\x20`','exit','timeout','grep','homedir','getClientCapabilities','Cargo.toml','new_string','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a',',\x20modified\x20','text','-\x20Listed\x20directory\x20`','MCP','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','Fallback:\x20Using\x20workspace\x20root\x20','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','stringify','Warning:\x20','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','../package.json','tool_call_received','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','package.json','16918mJiwor','turns','-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a','Failed\x20to\x20request\x20roots\x20from\x20client:','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','path_validation_failed','access','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','54tuttOm','false','ENOENT','file','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Rules:\x0a','linesModified','\x20-\x20','search_string','read','glob\x20\x27','tool_call_error','<file\x20path=\x22','CODEBASE_SEARCH','completed_with_file_errors','function','DISABLED_TOOLS','timed\x20out','\x20as\x20allowed\x20directory','basename','morph-v3-large','-\x20Grepped\x20\x27','.\x20Changes:\x20','2462931KAaXFJ','catch','default','RipgrepNotAvailable','source','\x20(new\x20file)','instruction','0.2.0','data','Morph\x20FastApply\x20failed\x20without\x20error\x20message','API\x20error\x20(auth/rate-limit)','now','GitHub\x20search\x20failed:\x20','TimeoutError','substring','Unknown\x20tool:\x20','object','morph-mcp','content','readFile','list_directory','owner_repo','instructions','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','-\x20Preserve\x20exact\x20indentation\x0a','params','pyproject.toml','glob','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','etimedout','describe','Error:\x20','description','15432ZMUNfn','MORPH_API_KEY','path_validation_resolved','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','match','node_modules','\x20\x20morph-mcp','WarpGrepError','path','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','2989108xvzCUG','completed','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','parse','EDIT_FILE','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','.cursor','message','warn','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','-\x20Glob\x20search\x20`','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','4037350ryKZuF','success','linesRemoved','\x20chars)','join','tool_calls','files','Repository\x20identifier','all','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','BinaryFile','tool_call_id','status','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','\x22.\x20Known\x20tools:\x20','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','\x0aOptions:','push','dirname','edit','string','application/json','File\x20read\x20error:','Max\x20results\x20to\x20return','Morph\x20Edit\x20','Bearer\x20','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','timings','runWarpGrep_call','oninitialized','post','Disabled\x20tools:\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Error\x20accessing\x20directory\x20','arguments','ENABLE_WORKSPACE_MODE','debug','Fatal\x20error\x20running\x20server:','constructor','42471oNhDbA','target_file','codebase_search','Specific\x20commit\x20hash\x20to\x20search','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','MORPH_API_URL','resolve','\x0aExamples:','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','branch','searchGitHub','edit_file','\x20valid\x20directories','search_type','terminationReason','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','startsWith','has',',\x20removed\x20','Preview\x20changes\x20without\x20applying\x20them.','compaction_failed','go.mod','LocalRipgrepProvider','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','github_search_start','utf-8','messages','command','\x22>\x0a','safeParse','--api-key=','Relevant\x20context\x20found:','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','log','Parent\x20directory\x20does\x20not\x20exist:\x20','Tool\x20','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','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.','file_path','composer.json','realpath','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','-\x20Read\x20file\x20`','stack','PWD','Invalid\x20arguments:\x20','isArray','sk-','UnknownError','every','finish','list_directory\x20','length','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','16LNujRe','unknown\x20error','filePath','GITHUB_CODEBASE_SEARCH','morph-v3-fast','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','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.','[could\x20not\x20read\x20file:\x20','\x0a</file>','changes','FileReadError','Warning:\x20Workspace\x20fallback\x20failed:\x20','requiresApiKey','ms:'];a0_0x57ec=function(){return _0x2de968;};return a0_0x57ec();}import a0_0x2590e9 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x40c9d3){const _0x8f9f7e=a0_0x2218,_0x324a98=_0x40c9d3[_0x8f9f7e(0x22b)](a0_0x146359[_0x8f9f7e(0x23d)])[_0x8f9f7e(0x255)](Boolean);if(_0x324a98['length']<0x2)return null;for(let _0x156ce8=Math[_0x8f9f7e(0x248)](_0x324a98['length']/0x2);_0x156ce8>=0x1;_0x156ce8--){for(let _0x50a1e0=0x0;_0x50a1e0<=_0x324a98['length']-0x2*_0x156ce8;_0x50a1e0++){const _0x5894c4=_0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0,_0x50a1e0+_0x156ce8),_0x18b795=_0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0+_0x156ce8,_0x50a1e0+0x2*_0x156ce8);if(_0x5894c4[_0x8f9f7e(0x214)]((_0x513950,_0x2bcf53)=>_0x513950===_0x18b795[_0x2bcf53])){const _0x4ad43f=[..._0x324a98['slice'](0x0,_0x50a1e0),..._0x324a98[_0x8f9f7e(0x23f)](_0x50a1e0+_0x156ce8)];return a0_0x146359[_0x8f9f7e(0x23d)]+_0x4ad43f['join'](a0_0x146359[_0x8f9f7e(0x23d)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x6d2e5b=a0_0x2218;try{const _0x56d369=require(_0x6d2e5b(0x28f));return _0x56d369[_0x6d2e5b(0x25c)]??'unknown';}catch(_0x2865d2){return logMcpStderr(_0x6d2e5b(0x1c2),_0x2865d2),_0x6d2e5b(0x27a);}}function printHelp(){const _0x5b9b33=a0_0x2218;console['log'](_0x5b9b33(0x277)+getPackageVersion()),console[_0x5b9b33(0x203)](_0x5b9b33(0x21e)),console['log'](_0x5b9b33(0x1cb)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1f1)),console[_0x5b9b33(0x203)](_0x5b9b33(0x228)),console[_0x5b9b33(0x203)](_0x5b9b33(0x21f)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1e9)),console[_0x5b9b33(0x203)](_0x5b9b33(0x1a8)),console['log'](_0x5b9b33(0x1c9));}const cliArgs=process[a0_0x231f6c(0x244)][a0_0x231f6c(0x23f)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x231f6c(0x247)](_0x1a307f=>VERSION_FLAGS[a0_0x231f6c(0x1f3)](_0x1a307f))&&(console[a0_0x231f6c(0x203)]('@morphllm/morphmcp\x20'+getPackageVersion()),process['exit'](0x0));cliArgs['some'](_0x19915b=>HELP_FLAGS['has'](_0x19915b))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x421452){const _0x23fb11=a0_0x231f6c;for(let _0x3706c6=0x0;_0x3706c6<cliArgs[_0x23fb11(0x217)];_0x3706c6++){const _0x2f478d=cliArgs[_0x3706c6];if(_0x2f478d[_0x23fb11(0x1f2)]('--'+_0x421452+'='))return _0x2f478d['slice'](('--'+_0x421452+'=')[_0x23fb11(0x217)]);if(_0x2f478d==='--'+_0x421452&&_0x3706c6+0x1<cliArgs[_0x23fb11(0x217)])return cliArgs[_0x3706c6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs['length'];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x231f6c(0x1f3)](arg)||HELP_FLAGS[a0_0x231f6c(0x1f3)](arg))continue;if(arg[a0_0x231f6c(0x1f2)](a0_0x231f6c(0x200)))continue;if(arg===a0_0x231f6c(0x26d)){i++;continue;}args[a0_0x231f6c(0x1cc)](arg);}const WORKSPACE_ROOT=process[a0_0x231f6c(0x268)][a0_0x231f6c(0x250)]||process['env'][a0_0x231f6c(0x20f)]||process[a0_0x231f6c(0x240)](),ENABLE_WORKSPACE_MODE=process[a0_0x231f6c(0x268)][a0_0x231f6c(0x1de)]!==a0_0x231f6c(0x29c),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x231f6c(0x268)][a0_0x231f6c(0x1a3)],MORPH_API_URL=process['env'][a0_0x231f6c(0x1e7)],MORPH_LARGE_APPLY=process['env'][a0_0x231f6c(0x24b)]!==a0_0x231f6c(0x29c),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x231f6c(0x269)]?parseInt(process[a0_0x231f6c(0x268)][a0_0x231f6c(0x269)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x231f6c(0x268)]['DISABLED_TOOLS']?new Set(process[a0_0x231f6c(0x268)][a0_0x231f6c(0x2ab)][a0_0x231f6c(0x22b)](',')[a0_0x231f6c(0x253)](_0x288027=>_0x288027[a0_0x231f6c(0x234)]())['filter'](_0x58a5d2=>_0x58a5d2[a0_0x231f6c(0x217)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x231f6c(0x25f)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x231f6c(0x1f3)](tool)&&console[a0_0x231f6c(0x25a)](a0_0x231f6c(0x198)+tool+a0_0x231f6c(0x1c8)+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console['error'](a0_0x231f6c(0x1da)+[...DISABLED_TOOLS][a0_0x231f6c(0x1bd)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY['startsWith'](a0_0x231f6c(0x261))&&logMcpStderr(a0_0x231f6c(0x1b1));async function reportMorphError(_0xe94246){const _0x4c2e75=a0_0x231f6c;try{await a0_0x2590e9[_0x4c2e75(0x1d9)]('https://morphllm.com/api/error-report',{..._0xe94246,'timestamp':new Date()['toISOString'](),'source':_0xe94246['source']||_0x4c2e75(0x23e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0xe94246[_0x4c2e75(0x23c)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x4c2e75(0x1d0),'Authorization':_0x4c2e75(0x1d4)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x49cea8,_0x38b268){const _0xd589c=a0_0x231f6c;if(_0x49cea8&&typeof _0x49cea8===_0xd589c(0x2c2)&&_0xd589c(0x1c5)in _0x49cea8)return _0x49cea8['status'];if(_0x49cea8&&typeof _0x49cea8===_0xd589c(0x2c2)&&'response'in _0x49cea8)return _0x49cea8['response']?.[_0xd589c(0x1c5)];const _0x35be96=_0x38b268[_0xd589c(0x1a6)](/\b(401|429)\b/);return _0x35be96?parseInt(_0x35be96[0x1],0xa):null;}function handleMorphAPIError(_0xcd63a8){const _0x38f9cf=a0_0x231f6c,_0x190a72=_0xcd63a8 instanceof Error?_0xcd63a8[_0x38f9cf(0x1b3)]:String(_0xcd63a8),_0x2ba529=extractStatusCode(_0xcd63a8,_0x190a72);switch(_0x2ba529){case 0x191:return{'content':[{'type':_0x38f9cf(0x286),'text':_0x38f9cf(0x220)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x38f9cf(0x286),'text':_0x38f9cf(0x202)}],'isError':!![]};default:return null;}}args['length']===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x231f6c(0x20c)),logMcpStderr(a0_0x231f6c(0x1c7)),logMcpStderr(a0_0x231f6c(0x238)),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x231f6c(0x1ab)),logMcpStderr(a0_0x231f6c(0x207)));function normalizePath(_0x5c28b1){const _0x39d877=a0_0x231f6c;return a0_0x146359[_0x39d877(0x230)](_0x5c28b1);}function expandHome(_0x3977ee){const _0x1bc4ed=a0_0x231f6c;if(_0x3977ee[_0x1bc4ed(0x1f2)]('~/')||_0x3977ee==='~')return a0_0x146359['join'](a0_0x1d7b4c[_0x1bc4ed(0x280)](),_0x3977ee[_0x1bc4ed(0x23f)](0x1));return _0x3977ee;}let allowedDirectories=await Promise[a0_0x231f6c(0x1c1)](args['map'](async _0x11b605=>{const _0x18c26f=a0_0x231f6c,_0x418256=expandHome(_0x11b605),_0x224b5b=a0_0x146359[_0x18c26f(0x1e8)](_0x418256);try{const _0x27bc6c=await a0_0x3ed385[_0x18c26f(0x20b)](_0x224b5b);return normalizePath(_0x27bc6c);}catch(_0x48495f){return normalizePath(_0x224b5b);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x231f6c(0x217)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x231f6c(0x1cc)](workspaceDir),logMcpStderr(a0_0x231f6c(0x25e)+workspaceDir+a0_0x231f6c(0x2ad)));}catch(a0_0x10bc0e){logMcpStderr(a0_0x231f6c(0x19d)+a0_0x10bc0e);}async function detectWorkspaceRoot(_0x44068c){const _0x4aed0=a0_0x231f6c;let _0x51fed3=a0_0x146359[_0x4aed0(0x1e8)](_0x44068c);const _0x502396=[_0x4aed0(0x26c),'.vscode',_0x4aed0(0x292),_0x4aed0(0x282),_0x4aed0(0x19b),_0x4aed0(0x1f7),_0x4aed0(0x1b2),_0x4aed0(0x26e),_0x4aed0(0x20a)];while(_0x51fed3!==a0_0x146359[_0x4aed0(0x1cd)](_0x51fed3)){for(const _0x3780d1 of _0x502396){const _0x1ec5b1=a0_0x146359['join'](_0x51fed3,_0x3780d1);try{return await a0_0x3ed385[_0x4aed0(0x299)](_0x1ec5b1),normalizePath(_0x51fed3);}catch{}}_0x51fed3=a0_0x146359[_0x4aed0(0x1cd)](_0x51fed3);}return normalizePath(_0x44068c);}await Promise[a0_0x231f6c(0x1c1)](args['map'](async _0xa03992=>{const _0x50d8f7=a0_0x231f6c;try{const _0xf89f8a=await a0_0x3ed385['stat'](expandHome(_0xa03992));!_0xf89f8a['isDirectory']()&&(logMcpStderr(_0x50d8f7(0x1a0)+_0xa03992+'\x20is\x20not\x20a\x20directory'),process[_0x50d8f7(0x27d)](0x1));}catch(_0x40959f){logMcpStderr(_0x50d8f7(0x1dc)+_0xa03992+':',_0x40959f),process['exit'](0x1);}}));async function validatePath(_0x4cbf84){const _0x27c2ed=a0_0x231f6c,_0x56c840=expandHome(_0x4cbf84),_0x510c56=a0_0x146359[_0x27c2ed(0x1e8)](_0x56c840);logger[_0x27c2ed(0x1df)]('MCP','path_validation_start',{'raw_path':_0x4cbf84,'absolute':_0x510c56});try{const _0x14591d=await a0_0x3ed385['realpath'](_0x510c56);return logger[_0x27c2ed(0x1df)]('MCP',_0x27c2ed(0x1a4),{'resolved':_0x14591d,'symlink':_0x14591d!==_0x510c56}),_0x14591d;}catch(_0x3587a4){if(_0x3587a4[_0x27c2ed(0x22f)]===_0x27c2ed(0x29d)){const _0x1718a2=a0_0x146359['dirname'](_0x510c56);try{const _0x4c39c8=await a0_0x3ed385[_0x27c2ed(0x20b)](_0x1718a2),_0x108cff=a0_0x146359[_0x27c2ed(0x1bd)](_0x4c39c8,a0_0x146359[_0x27c2ed(0x2ae)](_0x510c56));return logger[_0x27c2ed(0x1df)](_0x27c2ed(0x288),'path_validation_resolved',{'resolved':_0x108cff,'new_file':!![]}),_0x108cff;}catch{logger[_0x27c2ed(0x25a)]('MCP',_0x27c2ed(0x298),{'raw_path':_0x4cbf84,'error':_0x27c2ed(0x204)+_0x1718a2});throw new Error(_0x27c2ed(0x204)+_0x1718a2);}}logger[_0x27c2ed(0x25a)](_0x27c2ed(0x288),_0x27c2ed(0x298),{'raw_path':_0x4cbf84,'error':_0x3587a4['message']});throw _0x3587a4;}}const MorphEditFileArgsSchema=z[a0_0x231f6c(0x2c2)]({'path':z[a0_0x231f6c(0x1cf)](),'code_edit':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x270)),'instruction':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1b8)),'dryRun':z[a0_0x231f6c(0x26f)]()['default'](![])[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1f5))}),CODEBASE_SEARCH_QUERY_DESCRIPTION='Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.',WarpGrepArgsSchema=z[a0_0x231f6c(0x2c2)]({'search_string':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)]('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'),'search_type':z[a0_0x231f6c(0x263)]([a0_0x231f6c(0x2b4),'node_modules'])[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1c6))}),WarpGrepGitHubArgsSchema=z[a0_0x231f6c(0x2c2)]({'search_string':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z['string']()['optional']()['describe'](a0_0x231f6c(0x25b)),'owner_repo':z['string']()[a0_0x231f6c(0x23b)]()['describe'](a0_0x231f6c(0x1ae)),'branch':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x23b)]()['describe'](a0_0x231f6c(0x1db))}),CodebaseSearchArgsSchema=z[a0_0x231f6c(0x2c2)]({'query':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1c0)),'branch':z[a0_0x231f6c(0x1cf)]()[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x297)),'commitHash':z['string']()[a0_0x231f6c(0x23b)]()[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1e5)),'targetDirectories':z['array'](z[a0_0x231f6c(0x1cf)]())[a0_0x231f6c(0x2b4)]([])['describe']('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()[a0_0x231f6c(0x23b)]()['default'](0xa)[a0_0x231f6c(0x19f)](a0_0x231f6c(0x1d2))}),server=new Server({'name':a0_0x231f6c(0x2c3),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x231f6c(0x236)](ListToolsRequestSchema,async()=>{const _0x362509=a0_0x231f6c,_0x36731e=[{'name':TOOL_NAMES[_0x362509(0x1b0)],'description':'**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a'+'Parameters:\x0a'+_0x362509(0x206)+'-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a'+'-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a'+_0x362509(0x1f9)+'Example\x20format:\x0a'+_0x362509(0x284)+_0x362509(0x2a0)+_0x362509(0x1b5)+_0x362509(0x199)+_0x362509(0x295)+_0x362509(0x279),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x362509(0x2a8)],'description':_0x362509(0x28e)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x362509(0x22a)+_0x362509(0x1b6)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x11ddf5=_0x36731e[_0x362509(0x255)](_0x2e0805=>{const _0x1df734=_0x362509;if(DISABLED_TOOLS[_0x1df734(0x1f3)](_0x2e0805[_0x1df734(0x265)]))return console[_0x1df734(0x25a)](_0x1df734(0x205)+_0x2e0805[_0x1df734(0x265)]+_0x1df734(0x276)),![];if(_0x1df734(0x226)in _0x2e0805&&_0x2e0805[_0x1df734(0x226)]&&!MORPH_API_KEY)return logMcpStderr(_0x1df734(0x28d)+_0x2e0805[_0x1df734(0x265)]+_0x1df734(0x29f)),![];return!![];});return{'tools':_0x11ddf5[_0x362509(0x253)](_0xac4d80=>({'name':_0xac4d80[_0x362509(0x265)],'description':_0xac4d80[_0x362509(0x1a1)],'inputSchema':_0xac4d80['inputSchema']}))};}),server[a0_0x231f6c(0x236)](CallToolRequestSchema,async _0x986cf2=>{const _0x5e3def=a0_0x231f6c,{name:_0x150814,arguments:_0x17d255}=_0x986cf2[_0x5e3def(0x19a)],_0x4722eb=Date[_0x5e3def(0x2bd)]();logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x290),{'tool':_0x150814,'args':_0x150814===_0x5e3def(0x1ed)?{'path':_0x17d255?.['path'],'instruction':_0x17d255?.[_0x5e3def(0x2b8)]||_0x17d255?.[_0x5e3def(0x197)],'dryRun':_0x17d255?.[_0x5e3def(0x22c)]}:_0x17d255});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':_0x5e3def(0x24d)}],'isError':!![]};if(!MORPH_API_KEY[_0x5e3def(0x1f2)](_0x5e3def(0x212))&&!MORPH_API_KEY[_0x5e3def(0x1f2)](_0x5e3def(0x261)))return{'content':[{'type':_0x5e3def(0x286),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x5e3def(0x1f3)](_0x150814))return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x242)+_0x150814+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x150814){case TOOL_NAMES[_0x5e3def(0x1b0)]:{let _0x56b691=_0x17d255;if(_0x56b691&&typeof _0x56b691===_0x5e3def(0x2c2)){if(!(_0x5e3def(0x1aa)in _0x56b691)){const _0x347eba=_0x56b691[_0x5e3def(0x1e3)]??_0x56b691[_0x5e3def(0x21b)]??_0x56b691[_0x5e3def(0x258)]??_0x56b691[_0x5e3def(0x209)]??_0x56b691[_0x5e3def(0x29e)];if(_0x347eba)_0x56b691={..._0x56b691,'path':_0x347eba};}'instructions'in _0x56b691&&!(_0x5e3def(0x2b8)in _0x56b691)&&(_0x56b691={..._0x56b691,'instruction':_0x56b691['instructions']});if(!(_0x5e3def(0x249)in _0x56b691)){const _0x267cb5=_0x56b691['code']??_0x56b691[_0x5e3def(0x283)]??_0x56b691['content']??_0x56b691[_0x5e3def(0x1ce)];if(_0x267cb5)_0x56b691={..._0x56b691,'code_edit':_0x267cb5};}}const _0x2a0b34=MorphEditFileArgsSchema[_0x5e3def(0x1ff)](_0x56b691);if(!_0x2a0b34[_0x5e3def(0x1ba)])throw new Error(_0x5e3def(0x1ca)+_0x2a0b34[_0x5e3def(0x25a)]);const _0x56c068=await validatePath(_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)]);let _0xec2481=null,_0x5a687a=!![],_0x519e46=null;try{_0xec2481=await a0_0x3ed385[_0x5e3def(0x194)](_0x56c068,_0x5e3def(0x1fb)),logger[_0x5e3def(0x1df)]('MCP','file_read_complete',{'path':_0x56c068,'size_bytes':_0xec2481['length']});}catch(_0x2a39e4){const _0x42d2d5=_0x2a39e4[_0x5e3def(0x22f)];_0x42d2d5==='ENOENT'?(_0x5a687a=![],_0xec2481='',logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x275),{'path':_0x56c068,'exists':![]})):(_0x519e46='Failed\x20to\x20read\x20file:\x20'+(_0x42d2d5||_0x5e3def(0x27a))+_0x5e3def(0x2a2)+(_0x2a39e4 instanceof Error?_0x2a39e4[_0x5e3def(0x1b3)]:String(_0x2a39e4)),logger[_0x5e3def(0x25a)](_0x5e3def(0x288),'file_read_failed',{'path':_0x56c068,'error':_0x519e46}),logMcpStderr(_0x5e3def(0x28d)+_0x519e46));}let _0x50de33;try{const _0x74b61f=MORPH_API_KEY;if(!_0x74b61f)throw new Error(_0x5e3def(0x29a));const _0x30f222=a0_0x146359[_0x5e3def(0x1cd)](_0x56c068),_0x530ff9=a0_0x146359['basename'](_0x56c068);logger[_0x5e3def(0x1df)]('MCP','api_request_start',{'model':_0x5e3def(0x21d),'path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'instruction_len':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)][_0x5e3def(0x217)],'code_edit_len':_0x2a0b34[_0x5e3def(0x2ba)]['code_edit']['length'],'original_code_len':_0xec2481?.[_0x5e3def(0x217)]??0x0,'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)]});const _0x3cdd2b=Date[_0x5e3def(0x2bd)](),_0x577326=await executeEditFile({'target_filepath':_0x530ff9,'code_edit':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x249)],'instruction':_0x2a0b34['data'][_0x5e3def(0x2b8)]},{'morphApiKey':_0x74b61f,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x30f222,'autoWrite':!_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)],'generateUdiff':![],'debug':![]}),_0x5da451=Date[_0x5e3def(0x2bd)]()-_0x3cdd2b;_0x50de33=_0x577326[_0x5e3def(0x256)];if(!_0x577326[_0x5e3def(0x1ba)])throw new Error(_0x577326[_0x5e3def(0x25a)]||_0x5e3def(0x2bb));const _0x3ebb72=_0x577326[_0x5e3def(0x223)],_0x5ebbf0='added\x20'+_0x3ebb72[_0x5e3def(0x271)]+_0x5e3def(0x1f4)+_0x3ebb72[_0x5e3def(0x1bb)]+_0x5e3def(0x285)+_0x3ebb72[_0x5e3def(0x2a1)];logger[_0x5e3def(0x1df)](_0x5e3def(0x288),'tool_call_complete',{'tool':_0x5e3def(0x1ed),'success':!![],'latency_ms':Date['now']()-_0x4722eb,'edit_latency_ms':_0x5da451,'changes':{'added':_0x3ebb72[_0x5e3def(0x271)],'removed':_0x3ebb72[_0x5e3def(0x1bb)],'modified':_0x3ebb72['linesModified']},'completion_id':_0x50de33});if(_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)])return{'content':[{'type':'text','text':_0x5e3def(0x278)+(_0x5a687a?'':_0x5e3def(0x2b7))+':\x20'+_0x2a0b34['data'][_0x5e3def(0x2b8)]+_0x5e3def(0x2b1)+_0x5ebbf0+_0x5e3def(0x259)+_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)]+'.'}]};return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x1d3)+(_0x5a687a?_0x5e3def(0x266):_0x5e3def(0x246))+':\x20'+_0x2a0b34['data'][_0x5e3def(0x2b8)]+'.\x20Changes:\x20'+_0x5ebbf0+'.\x20Path:\x20'+_0x2a0b34['data']['path']+'.'}]};}catch(_0x2d6fdc){const _0x525417=handleMorphAPIError(_0x2d6fdc);if(_0x525417)return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':'edit_file','error':_0x5e3def(0x2bc),'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb}),_0x525417;const _0x2c0638=_0x2d6fdc instanceof Error?_0x2d6fdc['message']:String(_0x2d6fdc);return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1ed),'error':_0x2c0638,'path':_0x2a0b34[_0x5e3def(0x2ba)]['path'],'validated_path':_0x56c068,'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb,'stack':_0x2d6fdc instanceof Error?_0x2d6fdc['stack']:undefined}),reportMorphError({'error_message':_0x2c0638,'error_type':_0x2d6fdc instanceof Error?_0x2d6fdc[_0x5e3def(0x1e1)]['name']:'UnknownError','context':{'tool':'edit_file','completion_id':_0x50de33,'file_path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'validated_path':_0x56c068,'instruction':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)],'model':MORPH_LARGE_APPLY?_0x5e3def(0x2af):_0x5e3def(0x21d),'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)],'file_exists':_0x5a687a,'file_read_error':_0x519e46,'file_readable':_0xec2481!==null,'request_content':{'path':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x1aa)],'code_edit':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x249)],'instruction':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x2b8)],'original_code':_0xec2481!==null?_0xec2481['length']>0xc350?_0xec2481['substring'](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0xec2481[_0x5e3def(0x217)]+_0x5e3def(0x1bc):_0xec2481:_0x5e3def(0x221)+(_0x519e46||_0x5e3def(0x21a))+']','original_code_length':_0xec2481?.[_0x5e3def(0x217)]??0x0,'model':MORPH_LARGE_APPLY?_0x5e3def(0x2af):_0x5e3def(0x21d),'dry_run':_0x2a0b34[_0x5e3def(0x2ba)][_0x5e3def(0x22c)]}},'stack_trace':_0x2d6fdc instanceof Error?_0x2d6fdc['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':'text','text':_0x5e3def(0x251)+_0x2c0638}],'isError':!![]};}}case TOOL_NAMES[_0x5e3def(0x2a8)]:{const _0x3e1cba=WarpGrepArgsSchema['safeParse'](_0x17d255);if(!_0x3e1cba[_0x5e3def(0x1ba)])return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x210)+_0x3e1cba[_0x5e3def(0x25a)]}],'isError':!![]};const _0x354e70=_0x4e9df8=>{const _0x5e9832=_0x5e3def,_0x4ff32e=[];for(const _0x40e0d5 of _0x4e9df8||[]){if(_0x40e0d5['role']===_0x5e9832(0x231)&&Array[_0x5e9832(0x211)](_0x40e0d5[_0x5e9832(0x1be)]))for(const _0x555f59 of _0x40e0d5['tool_calls']){try{const _0x1ec239=_0x555f59[_0x5e9832(0x2aa)]?.[_0x5e9832(0x265)],_0x151d03=JSON[_0x5e9832(0x1af)](_0x555f59[_0x5e9832(0x2aa)]?.[_0x5e9832(0x1dd)]||'{}');if(_0x1ec239===_0x5e9832(0x24e))_0x4ff32e[_0x5e9832(0x1cc)](_0x5e9832(0x267)+_0x151d03[_0x5e9832(0x26a)]+'\x27\x20'+(_0x151d03['path']||'.'));else{if(_0x1ec239==='read')_0x4ff32e[_0x5e9832(0x1cc)]('read\x20'+_0x151d03['path']);else{if(_0x1ec239===_0x5e9832(0x195))_0x4ff32e[_0x5e9832(0x1cc)](_0x5e9832(0x216)+(_0x151d03[_0x5e9832(0x1fd)]||'.'));else{if(_0x1ec239==='glob')_0x4ff32e['push'](_0x5e9832(0x2a5)+_0x151d03[_0x5e9832(0x26a)]+'\x27\x20'+(_0x151d03[_0x5e9832(0x1aa)]||'.'));else _0x1ec239==='finish'&&_0x4ff32e['push']('finish');}}}}catch{}}}return _0x4ff32e;},_0x1be310=_0x3cdbc5=>{const _0x52bcd0=_0x5e3def,_0x3752de=[];if(!_0x3cdbc5||!Array[_0x52bcd0(0x211)](_0x3cdbc5))return _0x3752de;const _0x54b28d=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x52bcd0(0x2a4)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x52bcd0(0x2a4)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x52bcd0(0x1c3),'tool':'read'},{'pattern':/\[RIPGREP ERROR\]/,'error_type':'RipgrepError','tool':_0x52bcd0(0x27f)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x52bcd0(0x2b5),'tool':_0x52bcd0(0x27f)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x52bcd0(0x1c3),'tool':_0x52bcd0(0x2a4)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x52bcd0(0x2a4)},{'pattern':/not a text file/,'error_type':_0x52bcd0(0x1c3),'tool':_0x52bcd0(0x2a4)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x52bcd0(0x2a4)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x52bcd0(0x2a4)},{'pattern':/status="error"/,'error_type':'ToolException','tool':'unknown'}];let _0x323080=0x0;for(const _0x1f88ea of _0x3cdbc5){_0x1f88ea[_0x52bcd0(0x243)]===_0x52bcd0(0x231)&&Array[_0x52bcd0(0x211)](_0x1f88ea[_0x52bcd0(0x1be)])&&_0x323080++;const _0x3d9d28=_0x1f88ea['content'];if((_0x1f88ea[_0x52bcd0(0x243)]==='tool'||_0x1f88ea['role']===_0x52bcd0(0x23a))&&_0x3d9d28&&typeof _0x3d9d28==='string')for(const {pattern:_0x765f10,error_type:_0x2a71e4,tool:_0x2f8d24}of _0x54b28d){const _0x548d32=_0x3d9d28[_0x52bcd0(0x1a6)](new RegExp(_0x765f10[_0x52bcd0(0x2b6)],'g'));if(_0x548d32)for(const _0x1e4ef6 of _0x548d32){const _0x38fd11=_0x3d9d28[_0x52bcd0(0x241)](_0x1e4ef6),_0x3b5757=_0x3d9d28['substring'](_0x38fd11,Math[_0x52bcd0(0x252)](_0x38fd11+0xc8,_0x3d9d28[_0x52bcd0(0x217)]));_0x3752de['push']({'tool':_0x2f8d24,'error_type':_0x2a71e4,'error_message':_0x3b5757[_0x52bcd0(0x22b)]('\x0a')[0x0],'turn':_0x323080});}}}return _0x3752de;};try{const _0x12f3f8=a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)]['repo_path']),_0x1d85bc=_0x3e1cba['data'][_0x5e3def(0x1ef)],_0x3d99af=_0x1d85bc===_0x5e3def(0x1a7)?{'allowNames':[_0x5e3def(0x1a7)]}:undefined,_0xf86700=new LocalRipgrepProvider(_0x12f3f8,undefined,_0x3d99af);logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x25d),{'type':_0x5e3def(0x1f8),'repo_root':_0x12f3f8,'search_type':_0x1d85bc||_0x5e3def(0x2b4)}),logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x237),{'query':_0x3e1cba[_0x5e3def(0x2ba)]['search_string'],'repo_root':_0x12f3f8,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x3c7643=Date['now'](),_0x596820=await runWarpGrep({'searchTerm':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repoRoot':_0x12f3f8,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0xf86700,'search_type':_0x1d85bc}),_0x3aae5a=Date[_0x5e3def(0x2bd)]()-_0x3c7643,_0x213dcf=_0x596820[_0x5e3def(0x215)]?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)]?.[_0x5e3def(0x217)]??0x0;logger[_0x5e3def(0x1df)]('MCP',_0x5e3def(0x239),{'termination':_0x596820[_0x5e3def(0x1f0)],'turns':_0x596820[_0x5e3def(0x1d6)]?.[_0x5e3def(0x294)]??0x0,'files_found':_0x213dcf,'latency_ms':_0x3aae5a});const _0x5a0a0f=_0x1be310(_0x596820[_0x5e3def(0x1fc)]);_0x5a0a0f[_0x5e3def(0x217)]>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x5a0a0f[_0x5e3def(0x217)]+_0x5e3def(0x257),'error_type':_0x5e3def(0x254),'level':_0x5e3def(0x1b4),'tool':'codebase_search','context':{'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'model':_0x5e3def(0x264),'termination_reason':_0x596820[_0x5e3def(0x1f0)],'sub_tool_errors':_0x5a0a0f,'timings':_0x596820[_0x5e3def(0x1d6)],'tool_calls':_0x354e70(_0x596820[_0x5e3def(0x1fc)]),'messages':_0x596820[_0x5e3def(0x1fc)]?.[_0x5e3def(0x253)](_0x2b698f=>({'role':_0x2b698f[_0x5e3def(0x243)],'content':_0x2b698f[_0x5e3def(0x2c4)],..._0x2b698f[_0x5e3def(0x1be)]?{'tool_calls':_0x2b698f[_0x5e3def(0x1be)][_0x5e3def(0x217)]}:{},..._0x2b698f[_0x5e3def(0x1c4)]?{'tool_call_id':_0x2b698f[_0x5e3def(0x1c4)]}:{}}))},'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{});let _0x291421='';if(_0x596820[_0x5e3def(0x1f0)]===_0x5e3def(0x1ad)&&_0x596820[_0x5e3def(0x215)]?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)]){const _0x5d70b5=_0x596820[_0x5e3def(0x215)]['metadata'][_0x5e3def(0x1bf)];if(_0x5d70b5['length']===0x0)return _0x291421=_0x596820[_0x5e3def(0x215)]['payload']||_0x5e3def(0x1a5),{'content':[{'type':_0x5e3def(0x286),'text':_0x291421}]};const _0x97cb89=[],_0x4545d3=[_0x5e3def(0x28b)];for(const _0x5197ca of _0x596820[_0x5e3def(0x1fc)]){if(_0x5197ca[_0x5e3def(0x243)]===_0x5e3def(0x231)&&Array[_0x5e3def(0x211)](_0x5197ca['tool_calls']))for(const _0x2e7713 of _0x5197ca[_0x5e3def(0x1be)]){try{const _0x38c924=_0x2e7713[_0x5e3def(0x2aa)]?.['name'],_0x5b8332=JSON[_0x5e3def(0x1af)](_0x2e7713[_0x5e3def(0x2aa)]?.[_0x5e3def(0x1dd)]||'{}');if(_0x38c924==='grep_search')_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x2b0)+_0x5b8332[_0x5e3def(0x26a)]+'\x27\x20in\x20`'+(_0x5b8332[_0x5e3def(0x1aa)]||'.')+'`');else{if(_0x38c924==='read')_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x20d)+_0x5b8332[_0x5e3def(0x1aa)]+'`');else{if(_0x38c924===_0x5e3def(0x195))_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x287)+(_0x5b8332[_0x5e3def(0x1fd)]||'.')+'`');else _0x38c924===_0x5e3def(0x19c)&&_0x4545d3[_0x5e3def(0x1cc)](_0x5e3def(0x1b7)+_0x5b8332['pattern']+_0x5e3def(0x27c)+(_0x5b8332[_0x5e3def(0x1aa)]||'.')+'`');}}}catch{}}}_0x97cb89[_0x5e3def(0x1cc)](_0x4545d3[_0x5e3def(0x1bd)]('\x0a'));const _0x57e931=['',_0x5e3def(0x201)];for(const _0x44c374 of _0x5d70b5){if(_0x44c374[_0x5e3def(0x233)]==='*')_0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374['path']+':*');else{if(Array[_0x5e3def(0x211)](_0x44c374[_0x5e3def(0x233)])){const _0x70b752=_0x44c374[_0x5e3def(0x233)][_0x5e3def(0x253)](([_0x38d49f,_0x364940])=>{if(_0x38d49f===_0x364940)return''+_0x38d49f;return _0x38d49f+'-'+_0x364940;});_0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374[_0x5e3def(0x1aa)]+':'+_0x70b752[_0x5e3def(0x1bd)](','));}else _0x57e931[_0x5e3def(0x1cc)]('-\x20'+_0x44c374[_0x5e3def(0x1aa)]+':*');}}_0x57e931[_0x5e3def(0x1cc)](''),_0x97cb89[_0x5e3def(0x1cc)](_0x57e931[_0x5e3def(0x1bd)]('\x0a')),_0x97cb89[_0x5e3def(0x1cc)]('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x6b2e2d=[],_0x574496=[];for(const _0x322db2 of _0x5d70b5){let _0x4fbeed=a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)]['repo_path'],_0x322db2['path']),_0x543c7c=null,_0x211b93=null;try{_0x543c7c=await a0_0x3ed385[_0x5e3def(0x194)](_0x4fbeed,{'encoding':'utf-8'});}catch(_0x43837d){const _0xd5ac3b=fixPathRepetition(_0x4fbeed);if(_0xd5ac3b)try{_0x543c7c=await a0_0x3ed385[_0x5e3def(0x194)](_0xd5ac3b,{'encoding':'utf-8'}),_0x4fbeed=_0xd5ac3b;}catch{_0x211b93=_0x43837d instanceof Error?_0x43837d:new Error(String(_0x43837d));}else _0x211b93=_0x43837d instanceof Error?_0x43837d:new Error(String(_0x43837d));}if(_0x543c7c!==null){const _0x2b6da9=_0x543c7c[_0x5e3def(0x22b)](/\r?\n/),_0x51ae93=[];if(_0x322db2[_0x5e3def(0x233)]==='*'||!Array['isArray'](_0x322db2[_0x5e3def(0x233)]))for(let _0x43651b=0x1;_0x43651b<=_0x2b6da9['length'];_0x43651b++){const _0x29b4ac=_0x2b6da9[_0x43651b-0x1];_0x51ae93[_0x5e3def(0x1cc)](_0x43651b+'|\x20'+_0x29b4ac);}else for(const [_0x4d5e4a,_0x4bcde4]of _0x322db2['lines']){_0x51ae93[_0x5e3def(0x217)]>0x0&&_0x51ae93['push']('');for(let _0x2b00a1=_0x4d5e4a;_0x2b00a1<=_0x4bcde4&&_0x2b00a1<=_0x2b6da9[_0x5e3def(0x217)];_0x2b00a1++){const _0x314a40=_0x2b6da9[_0x2b00a1-0x1];_0x51ae93['push'](_0x2b00a1+'|\x20'+_0x314a40);}}_0x574496[_0x5e3def(0x1cc)]({'path':_0x322db2[_0x5e3def(0x1aa)],'content':_0x51ae93[_0x5e3def(0x1bd)]('\x0a')});}else _0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x322db2[_0x5e3def(0x1aa)]+_0x5e3def(0x22e)+(_0x211b93?.['message']||_0x5e3def(0x26b))+_0x5e3def(0x222));}try{const _0x41a2a2=await compactFileContexts(_0x574496,_0x3e1cba['data'][_0x5e3def(0x2a3)],MORPH_API_KEY,MORPH_API_URL);for(const _0x3760d3 of _0x41a2a2){_0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x3760d3['path']+'\x22>\x0a'+_0x3760d3[_0x5e3def(0x2c4)]+_0x5e3def(0x222));}}catch(_0x259409){logger[_0x5e3def(0x1b4)](_0x5e3def(0x288),_0x5e3def(0x1f6),{'error':_0x259409 instanceof Error?_0x259409['message']:String(_0x259409),'files_count':_0x574496['length']});for(const _0x2ab428 of _0x574496){_0x6b2e2d[_0x5e3def(0x1cc)](_0x5e3def(0x2a7)+_0x2ab428['path']+_0x5e3def(0x1fe)+_0x2ab428[_0x5e3def(0x2c4)]+_0x5e3def(0x222));}}_0x97cb89[_0x5e3def(0x1cc)](_0x6b2e2d[_0x5e3def(0x1bd)]('\x0a\x0a')),_0x291421=_0x97cb89['join']('\x0a');const _0x427881=_0x596820[_0x5e3def(0x24a)]?.[_0x5e3def(0x255)](_0x1cb76c=>_0x1cb76c[_0x5e3def(0x1b3)]?.[_0x5e3def(0x1f2)](_0x5e3def(0x1d1)))||[];if(_0x427881[_0x5e3def(0x217)]>0x0){const _0x2028cc=_0x427881['map'](_0xb3f112=>_0xb3f112[_0x5e3def(0x1b3)])['join'](';\x20');reportMorphError({'error_message':_0x2028cc,'error_type':_0x5e3def(0x224),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba['data'][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'model':'morph-warp-grep-v2.1','termination_reason':_0x5e3def(0x2a9),'error_count':_0x427881[_0x5e3def(0x217)],'is_timeout':![],'timings':_0x596820[_0x5e3def(0x1d6)],'files_attempted':_0x5d70b5['map'](_0x2f7642=>({'path':_0x2f7642[_0x5e3def(0x1aa)],'lines':_0x2f7642[_0x5e3def(0x233)]})),'tool_calls':_0x354e70(_0x596820[_0x5e3def(0x1fc)]),'messages':_0x596820['messages']?.[_0x5e3def(0x253)](_0x23be47=>({'role':_0x23be47[_0x5e3def(0x243)],'content':_0x23be47[_0x5e3def(0x2c4)],..._0x23be47[_0x5e3def(0x1be)]?{'tool_calls':_0x23be47['tool_calls'][_0x5e3def(0x217)]}:{},..._0x23be47[_0x5e3def(0x1c4)]?{'tool_call_id':_0x23be47['tool_call_id']}:{}})),'request_content':{'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':_0x5e3def(0x264)}},'source':_0x5e3def(0x23e)})['catch'](()=>{});}}else{if(_0x596820['terminationReason']===_0x5e3def(0x22d)&&_0x596820[_0x5e3def(0x24a)][_0x5e3def(0x217)]>0x0){const _0x4e16f3=_0x596820['errors'][_0x5e3def(0x253)](_0x58cf8d=>_0x58cf8d[_0x5e3def(0x1b3)])[_0x5e3def(0x1bd)](';\x20');_0x291421=_0x5e3def(0x1a0)+_0x4e16f3;const _0x430324=_0x4e16f3['toLowerCase']()[_0x5e3def(0x273)](_0x5e3def(0x27e))||_0x4e16f3[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x2ac))||_0x4e16f3[_0x5e3def(0x235)]()[_0x5e3def(0x273)]('etimedout'),_0x2ff7be=_0x596820['finish']?.[_0x5e3def(0x24c)]?.[_0x5e3def(0x1bf)],_0x41ce65=_0x596820['errors'][0x0];reportMorphError({'error_message':_0x4e16f3,'error_type':_0x430324?'TimeoutError':_0x41ce65?.[_0x5e3def(0x1e1)]?.[_0x5e3def(0x265)]||_0x5e3def(0x1a9),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)]['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x596820[_0x5e3def(0x1f0)],'error_count':_0x596820['errors']['length'],'is_timeout':_0x430324,'timings':_0x596820['timings'],'files_attempted':_0x2ff7be?.[_0x5e3def(0x253)](_0x4b8077=>({'path':_0x4b8077[_0x5e3def(0x1aa)],'lines':_0x4b8077[_0x5e3def(0x233)]})),'tool_calls':_0x354e70(_0x596820['messages']),'messages':_0x596820[_0x5e3def(0x1fc)]?.[_0x5e3def(0x253)](_0x5577bc=>({'role':_0x5577bc[_0x5e3def(0x243)],'content':_0x5577bc['content'],..._0x5577bc['tool_calls']?{'tool_calls':_0x5577bc['tool_calls']['length']}:{},..._0x5577bc[_0x5e3def(0x1c4)]?{'tool_call_id':_0x5577bc[_0x5e3def(0x1c4)]}:{}})),'request_content':{'query':_0x3e1cba['data'][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':_0x5e3def(0x264)}},'stack_trace':_0x41ce65?.['stack']||undefined,'source':_0x5e3def(0x23e)})['catch'](()=>{});}else _0x291421=_0x5e3def(0x218);}return{'content':[{'type':'text','text':_0x291421}]};}catch(_0x5e710e){const _0x59e9c4=handleMorphAPIError(_0x5e710e);if(_0x59e9c4)return logger[_0x5e3def(0x25a)](_0x5e3def(0x288),_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1e4),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb}),_0x59e9c4;const _0x4afad4=_0x5e710e instanceof Error?_0x5e710e[_0x5e3def(0x1b3)]:String(_0x5e710e);logger[_0x5e3def(0x25a)]('MCP',_0x5e3def(0x2a6),{'tool':_0x5e3def(0x1e4),'error':_0x4afad4,'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'latency_ms':Date[_0x5e3def(0x2bd)]()-_0x4722eb});const _0x50bfe7=_0x4afad4['toLowerCase']()[_0x5e3def(0x273)]('timeout')||_0x4afad4[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x2ac))||_0x4afad4[_0x5e3def(0x235)]()[_0x5e3def(0x273)](_0x5e3def(0x19e))||_0x5e710e instanceof Error&&_0x5e710e[_0x5e3def(0x265)]===_0x5e3def(0x2bf);return reportMorphError({'error_message':_0x4afad4,'error_type':_0x50bfe7?_0x5e3def(0x2bf):_0x5e710e instanceof Error?_0x5e710e[_0x5e3def(0x1e1)][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x5e3def(0x1e4),'repo_path':_0x3e1cba['data'][_0x5e3def(0x274)],'query':_0x3e1cba['data']['search_string'],'model':_0x5e3def(0x264),'is_timeout':_0x50bfe7,'exception_phase':_0x5e3def(0x1d7),'request_content':{'query':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'repo_path':_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)],'repoRoot':a0_0x146359[_0x5e3def(0x1e8)](_0x3e1cba[_0x5e3def(0x2ba)][_0x5e3def(0x274)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x5e710e instanceof Error?_0x5e710e['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':_0x5e3def(0x286),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x4afad4}],'isError':![]};}}case TOOL_NAMES[_0x5e3def(0x21c)]:{const _0x364373=WarpGrepGitHubArgsSchema[_0x5e3def(0x1ff)](_0x17d255);if(!_0x364373[_0x5e3def(0x1ba)])return{'content':[{'type':_0x5e3def(0x286),'text':'Invalid\x20arguments:\x20'+_0x364373[_0x5e3def(0x25a)]}],'isError':!![]};const _0x29a3e7=_0x364373['data'][_0x5e3def(0x232)]||_0x364373['data'][_0x5e3def(0x196)];if(!_0x29a3e7)return{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x289)}],'isError':!![]};const _0x414d5a=MORPH_API_KEY;if(!_0x414d5a)throw new Error(_0x5e3def(0x29a));const _0x44d2e7=Date[_0x5e3def(0x2bd)]();logger[_0x5e3def(0x1df)](_0x5e3def(0x288),_0x5e3def(0x1fa),{'identifier':_0x29a3e7,'query':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'branch':_0x364373['data'][_0x5e3def(0x1eb)]});try{const _0x531bcf=new WarpGrepClient({'morphApiKey':_0x414d5a,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x20b161=await _0x531bcf[_0x5e3def(0x1ec)]({'searchTerm':_0x364373[_0x5e3def(0x2ba)]['search_string'],'github':_0x29a3e7,'branch':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x1eb)]}),_0x3cacdc=Date[_0x5e3def(0x2bd)]()-_0x44d2e7;logMcpStderr(_0x5e3def(0x245)+_0x3cacdc+'ms.\x20Success:\x20'+_0x20b161[_0x5e3def(0x1ba)]);const _0x578200=formatResult(_0x20b161);return{'content':[{'type':'text','text':_0x578200}]};}catch(_0x5193d6){const _0x283217=handleMorphAPIError(_0x5193d6);if(_0x283217)return _0x283217;const _0x1c92c4=Date[_0x5e3def(0x2bd)]()-_0x44d2e7,_0x41c5bc=_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x1b3)]:String(_0x5193d6);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x1c92c4+_0x5e3def(0x227),_0x41c5bc),reportMorphError({'error_message':_0x41c5bc,'error_type':_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x1e1)][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x5e3def(0x260),'github_url':_0x29a3e7,'search_string':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x2a3)],'branch':_0x364373[_0x5e3def(0x2ba)][_0x5e3def(0x1eb)]},'stack_trace':_0x5193d6 instanceof Error?_0x5193d6[_0x5e3def(0x20e)]:undefined,'source':_0x5e3def(0x23e),'tool':_0x5e3def(0x260),'latency_ms':_0x1c92c4})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':_0x5e3def(0x286),'text':_0x5e3def(0x2be)+_0x41c5bc}],'isError':![]};}}default:throw new Error(_0x5e3def(0x2c1)+_0x150814);}}catch(_0x38fb77){const _0x5975c8=_0x38fb77 instanceof Error?_0x38fb77[_0x5e3def(0x1b3)]:String(_0x38fb77);return reportMorphError({'error_message':_0x5975c8,'error_type':_0x38fb77 instanceof Error?_0x38fb77['constructor'][_0x5e3def(0x265)]:_0x5e3def(0x213),'context':{'tool':_0x150814,'arguments':_0x17d255?JSON[_0x5e3def(0x28c)](_0x17d255)[_0x5e3def(0x2c0)](0x0,0x1f4):undefined,'mcp_server_version':_0x5e3def(0x2b9)},'stack_trace':_0x38fb77 instanceof Error?_0x38fb77['stack']:undefined,'source':_0x5e3def(0x23e)})[_0x5e3def(0x2b3)](()=>{}),{'content':[{'type':'text','text':_0x5e3def(0x1a0)+_0x5975c8}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x569828){const _0x34ea3b=a0_0x231f6c,_0x4c4568=await getValidRootDirectories(_0x569828);if(_0x4c4568[_0x34ea3b(0x217)]>0x0)allowedDirectories=[..._0x4c4568],logMcpStderr(_0x34ea3b(0x1d5)+_0x4c4568[_0x34ea3b(0x217)]+_0x34ea3b(0x1ee));else{logMcpStderr(_0x34ea3b(0x291));if(ENABLE_WORKSPACE_MODE)try{const _0x62e1f4=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x62e1f4&&(allowedDirectories=[_0x62e1f4],logMcpStderr(_0x34ea3b(0x28a)+_0x62e1f4));}catch(_0x5cabd2){logMcpStderr(_0x34ea3b(0x225)+_0x5cabd2);}}}server[a0_0x231f6c(0x24f)](RootsListChangedNotificationSchema,async()=>{const _0x1da150=a0_0x231f6c;try{const _0x1e72a8=await server[_0x1da150(0x229)]();_0x1e72a8&&'roots'in _0x1e72a8&&await updateAllowedDirectoriesFromRoots(_0x1e72a8['roots']);}catch(_0x10ae8e){logMcpStderr(_0x1da150(0x296),_0x10ae8e instanceof Error?_0x10ae8e[_0x1da150(0x1b3)]:String(_0x10ae8e));}}),server[a0_0x231f6c(0x1d8)]=async()=>{const _0x3fa1c2=a0_0x231f6c,_0x4e661a=server[_0x3fa1c2(0x281)]();if(_0x4e661a?.[_0x3fa1c2(0x272)])try{const _0x540d01=await server[_0x3fa1c2(0x229)]();_0x540d01&&_0x3fa1c2(0x272)in _0x540d01?await updateAllowedDirectoriesFromRoots(_0x540d01[_0x3fa1c2(0x272)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x1d088d){logMcpStderr(_0x3fa1c2(0x1ea),_0x1d088d instanceof Error?_0x1d088d[_0x3fa1c2(0x1b3)]:String(_0x1d088d));}else{if(allowedDirectories[_0x3fa1c2(0x217)]>0x0)logMcpStderr(_0x3fa1c2(0x1e6),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode');else throw new Error(_0x3fa1c2(0x208));}}};async function runServer(){const _0x5aa2c4=a0_0x231f6c,_0x52bdab=new StdioServerTransport();await server['connect'](_0x52bdab),logMcpStderr('Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio'),allowedDirectories[_0x5aa2c4(0x217)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x220812=>{const _0x5414e6=a0_0x231f6c;logMcpStderr(_0x5414e6(0x1e0),_0x220812),process[_0x5414e6(0x27d)](0x1);});
const a0_0x240656=a0_0x1a82;(function(_0x43a044,_0x3fc623){const _0x530a01=a0_0x1a82,_0x54915c=_0x43a044();while(!![]){try{const _0x3019d0=parseInt(_0x530a01(0x232))/0x1+parseInt(_0x530a01(0x19e))/0x2+-parseInt(_0x530a01(0x196))/0x3+-parseInt(_0x530a01(0x249))/0x4*(-parseInt(_0x530a01(0x1a3))/0x5)+-parseInt(_0x530a01(0x24c))/0x6*(-parseInt(_0x530a01(0x299))/0x7)+parseInt(_0x530a01(0x1f6))/0x8+-parseInt(_0x530a01(0x1c6))/0x9*(parseInt(_0x530a01(0x25c))/0xa);if(_0x3019d0===_0x3fc623)break;else _0x54915c['push'](_0x54915c['shift']());}catch(_0x26494d){_0x54915c['push'](_0x54915c['shift']());}}}(a0_0x4719,0x19445));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_0x5207e6 from'fs/promises';import a0_0x4c88d7 from'path';import a0_0x1ee4d4 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_0x4832c4 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x4a222b){const _0x3e8997=a0_0x1a82,_0x40ea2e=_0x4a222b[_0x3e8997(0x296)](a0_0x4c88d7['sep'])['filter'](Boolean);if(_0x40ea2e[_0x3e8997(0x19a)]<0x2)return null;for(let _0x539993=Math[_0x3e8997(0x1bd)](_0x40ea2e['length']/0x2);_0x539993>=0x1;_0x539993--){for(let _0x50f340=0x0;_0x50f340<=_0x40ea2e[_0x3e8997(0x19a)]-0x2*_0x539993;_0x50f340++){const _0xbb88d5=_0x40ea2e[_0x3e8997(0x199)](_0x50f340,_0x50f340+_0x539993),_0x14d241=_0x40ea2e['slice'](_0x50f340+_0x539993,_0x50f340+0x2*_0x539993);if(_0xbb88d5[_0x3e8997(0x23f)]((_0x564552,_0x4fe823)=>_0x564552===_0x14d241[_0x4fe823])){const _0x472d4b=[..._0x40ea2e[_0x3e8997(0x199)](0x0,_0x50f340),..._0x40ea2e[_0x3e8997(0x199)](_0x50f340+_0x539993)];return a0_0x4c88d7[_0x3e8997(0x27c)]+_0x472d4b[_0x3e8997(0x20e)](a0_0x4c88d7['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x25929f=a0_0x1a82;try{const _0x5e2d13=require(_0x25929f(0x263));return _0x5e2d13['version']??_0x25929f(0x1af);}catch(_0x4406aa){return logMcpStderr(_0x25929f(0x29e),_0x4406aa),_0x25929f(0x1af);}}function printHelp(){const _0x19ed23=a0_0x1a82;console[_0x19ed23(0x292)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x19ed23(0x292)](_0x19ed23(0x293)),console[_0x19ed23(0x292)]('\x0aOptions:'),console[_0x19ed23(0x292)](_0x19ed23(0x1e8)),console['log'](_0x19ed23(0x298)),console[_0x19ed23(0x292)](_0x19ed23(0x262)),console[_0x19ed23(0x292)](_0x19ed23(0x1ab)),console[_0x19ed23(0x292)](_0x19ed23(0x1bf)),console['log'](_0x19ed23(0x1b7));}const cliArgs=process[a0_0x240656(0x1a9)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x240656(0x18b),'-v','-V']),HELP_FLAGS=new Set(['--help','-h']);cliArgs[a0_0x240656(0x1c3)](_0x247935=>VERSION_FLAGS['has'](_0x247935))&&(console[a0_0x240656(0x292)](a0_0x240656(0x193)+getPackageVersion()),process['exit'](0x0));cliArgs[a0_0x240656(0x1c3)](_0x564fed=>HELP_FLAGS['has'](_0x564fed))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x2f90d0){const _0x1cf539=a0_0x240656;for(let _0x5953a3=0x0;_0x5953a3<cliArgs[_0x1cf539(0x19a)];_0x5953a3++){const _0xf0309f=cliArgs[_0x5953a3];if(_0xf0309f[_0x1cf539(0x1c4)]('--'+_0x2f90d0+'='))return _0xf0309f[_0x1cf539(0x199)](('--'+_0x2f90d0+'=')[_0x1cf539(0x19a)]);if(_0xf0309f==='--'+_0x2f90d0&&_0x5953a3+0x1<cliArgs[_0x1cf539(0x19a)])return cliArgs[_0x5953a3+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x240656(0x19a)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x240656(0x204)](arg)||HELP_FLAGS[a0_0x240656(0x204)](arg))continue;if(arg['startsWith'](a0_0x240656(0x267)))continue;if(arg===a0_0x240656(0x22b)){i++;continue;}args[a0_0x240656(0x1a2)](arg);}const WORKSPACE_ROOT=process['env'][a0_0x240656(0x184)]||process[a0_0x240656(0x190)]['PWD']||process[a0_0x240656(0x197)](),ENABLE_WORKSPACE_MODE=process[a0_0x240656(0x190)][a0_0x240656(0x1d7)]!==a0_0x240656(0x28f),MORPH_API_KEY=getCliArg('api-key')??process[a0_0x240656(0x190)][a0_0x240656(0x1a1)],MORPH_API_URL=process[a0_0x240656(0x190)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x240656(0x190)][a0_0x240656(0x244)]!==a0_0x240656(0x28f),MORPH_WARP_GREP_TIMEOUT=process[a0_0x240656(0x190)][a0_0x240656(0x24b)]?parseInt(process[a0_0x240656(0x190)]['MORPH_WARP_GREP_TIMEOUT'],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x240656(0x190)][a0_0x240656(0x1b1)]?new Set(process[a0_0x240656(0x190)]['DISABLED_TOOLS']['split'](',')[a0_0x240656(0x185)](_0x5b25cd=>_0x5b25cd[a0_0x240656(0x17f)]())['filter'](_0x31ad5f=>_0x31ad5f[a0_0x240656(0x19a)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x240656(0x269)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x240656(0x29c)](a0_0x240656(0x243)+tool+a0_0x240656(0x17e)+[...KNOWN_TOOL_NAMES][a0_0x240656(0x20e)](',\x20'));}console[a0_0x240656(0x29c)](a0_0x240656(0x210)+[...DISABLED_TOOLS][a0_0x240656(0x20e)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x240656(0x219))&&!MORPH_API_KEY[a0_0x240656(0x1c4)](a0_0x240656(0x19d))&&logMcpStderr(a0_0x240656(0x29a));async function reportMorphError(_0x144b41){const _0x2e95d2=a0_0x240656;try{await a0_0x4832c4['post'](_0x2e95d2(0x1ac),{..._0x144b41,'timestamp':new Date()[_0x2e95d2(0x1db)](),'source':_0x144b41[_0x2e95d2(0x1e0)]||'mcp-filesystem','os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x144b41[_0x2e95d2(0x257)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x2e95d2(0x1c1),'Authorization':_0x2e95d2(0x226)+MORPH_API_KEY}});}catch{}}function a0_0x1a82(_0x42a8f6,_0x233d48){_0x42a8f6=_0x42a8f6-0x17d;const _0x4719ac=a0_0x4719();let _0x1a8236=_0x4719ac[_0x42a8f6];return _0x1a8236;}function extractStatusCode(_0x3820d7,_0x4c92f5){const _0x3ee3ad=a0_0x240656;if(_0x3820d7&&typeof _0x3820d7===_0x3ee3ad(0x286)&&'status'in _0x3820d7)return _0x3820d7[_0x3ee3ad(0x18c)];if(_0x3820d7&&typeof _0x3820d7==='object'&&_0x3ee3ad(0x291)in _0x3820d7)return _0x3820d7[_0x3ee3ad(0x291)]?.[_0x3ee3ad(0x18c)];const _0x2630e8=_0x4c92f5[_0x3ee3ad(0x2a4)](/\b(401|429)\b/);return _0x2630e8?parseInt(_0x2630e8[0x1],0xa):null;}function handleMorphAPIError(_0x5d8342){const _0x3f1a55=a0_0x240656,_0x489dbc=_0x5d8342 instanceof Error?_0x5d8342[_0x3f1a55(0x282)]:String(_0x5d8342),_0x1b92d8=extractStatusCode(_0x5d8342,_0x489dbc);switch(_0x1b92d8){case 0x191:return{'content':[{'type':_0x3f1a55(0x23e),'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':_0x3f1a55(0x23e),'text':_0x3f1a55(0x295)}],'isError':!![]};default:return null;}}args[a0_0x240656(0x19a)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x240656(0x29d)),logMcpStderr(a0_0x240656(0x283)),logMcpStderr(a0_0x240656(0x2a0)),logMcpStderr(a0_0x240656(0x297)),logMcpStderr('\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)'),logMcpStderr(a0_0x240656(0x1a8)));function normalizePath(_0x31a301){const _0x25a908=a0_0x240656;return a0_0x4c88d7[_0x25a908(0x273)](_0x31a301);}function expandHome(_0x346f65){const _0x4cbc47=a0_0x240656;if(_0x346f65[_0x4cbc47(0x1c4)]('~/')||_0x346f65==='~')return a0_0x4c88d7[_0x4cbc47(0x20e)](a0_0x1ee4d4['homedir'](),_0x346f65[_0x4cbc47(0x199)](0x1));return _0x346f65;}let allowedDirectories=await Promise[a0_0x240656(0x1f8)](args['map'](async _0x31d402=>{const _0x2c9171=a0_0x240656,_0x5091d6=expandHome(_0x31d402),_0x416676=a0_0x4c88d7[_0x2c9171(0x24a)](_0x5091d6);try{const _0x2edc74=await a0_0x5207e6[_0x2c9171(0x26c)](_0x416676);return normalizePath(_0x2edc74);}catch(_0x35da41){return normalizePath(_0x416676);}}));function a0_0x4719(){const _0x3bd627=['now','tool_call_id','description','\x22>\x0a','1457152PyXnbT','assistant','all','changes','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.','github_search_start','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','repo_path','go.mod','compaction_failed','stringify','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Invalid\x20arguments:\x20','has','Error\x20accessing\x20directory\x20','Preview\x20changes\x20without\x20applying\x20them.','linesRemoved','new_string','catch','etimedout','metadata','parse','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','join','\x20as\x20allowed\x20directory','Disabled\x20tools:\x20','ReadError','Failed\x20to\x20read\x20file:\x20','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','-\x20Read\x20file\x20`','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','runWarpGrep_call','warn','errors','sk-','content','list_directory\x20','Error:\x20','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','\x20-\x20','owner_repo','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','search_string','github_url','array','composer.json','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.','Bearer\x20','Specific\x20commit\x20hash\x20to\x20search','includes','Unknown\x20error','-\x20Preserve\x20exact\x20indentation\x0a','--api-key','read\x20','\x0a</file>','tool_call_error','number','Repository\x20identifier','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','60682WMICZA','readFile','path_validation_start','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','command','role','grep_search','.\x20Changes:\x20','lines','boolean',',\x20removed\x20','code','text','every','FileNotFound','package.json','list_directory','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','MORPH_LARGE_APPLY','instructions','Relevant\x20context\x20found:','code_edit','Workspace\x20mode\x20enabled:\x20Using\x20','18788nqsmuH','resolve','MORPH_WARP_GREP_TIMEOUT','18rRmwVp','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','path_validation_failed','path_validation_resolved','file_read_failed','setRequestHandler','safeParse','Parent\x20directory\x20does\x20not\x20exist:\x20','RipgrepNotAvailable','Here\x20is\x20the\x20content\x20of\x20files:\x0a','substring','context','connect','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','branch','API\x20error\x20(auth/rate-limit)','30JIxvQG','FileReadError','timings','Warning:\x20Workspace\x20fallback\x20failed:\x20','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','../package.json','searchGitHub','provider_created','describe','--api-key=','filter','size','ms:','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','realpath','Max\x20results\x20to\x20return','[github_codebase_search]\x20Failed\x20in\x20','path','Unknown\x20tool:\x20','[could\x20not\x20read\x20file:\x20','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','normalize','roots','messages','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','\x0a...\x20(truncated,\x20total:\x20','tool_calls','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','tool_call_received','`\x20in\x20`','sep','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','.\x20Path:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','enum','message','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','dryRun','MCP','object','files','morph-v3-fast','constructor','default','grep\x20\x27','toLowerCase','RipgrepError','.git','false','isArray','response','log','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','Cargo.toml','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','split','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','271285AKedCS','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','github_codebase_search','error','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','timeout','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','\x27\x20in\x20`','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','completed','match','edit_file','added\x20','timed\x20out','completionId','user','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','edit','ENOENT','PathError','SubToolError','\x20valid\x20directories','\x22.\x20Known\x20tools:\x20','trim','debug','ms.\x20Success:\x20','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','access','WORKSPACE_ROOT','map','SymlinkError','ToolException','BinaryFile','LocalRipgrepProvider','function','--version','status','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','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.','oninitialized','env','linesModified','finish','@morphllm/morphmcp\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','inputSchema','230178uDlQqK','cwd','completed_with_file_errors','slice','length','mcp-filesystem','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','morph-','155738mrQHtn','\x20disabled\x20via\x20DISABLED_TOOLS','data','MORPH_API_KEY','push','80PFUbXa','basename','Morph\x20FastApply\x20failed\x20without\x20error\x20message','string','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','argv','grep','\x0aExamples:','https://morphllm.com/api/error-report','TimeoutError','-\x20Listed\x20directory\x20`','unknown','CODEBASE_SEARCH','DISABLED_TOOLS','stack','target_file','Tool\x20','Fatal\x20error\x20running\x20server:','terminated','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','read','Failed\x20to\x20request\x20roots\x20from\x20client:','tool','tool_call_complete','glob\x20\x27','floor','UnknownError','\x20\x20morph-mcp','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','application/json','Fallback:\x20Using\x20workspace\x20root\x20','some','startsWith','requiresApiKey','995679vOhSjR','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.','params','Example\x20format:\x0a','dirname','morph-mcp','node_modules','EDIT_FILE','exit','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','glob','isDirectory',',\x20modified\x20','<file\x20path=\x22','file_read_complete','success','indexOf','ENABLE_WORKSPACE_MODE','warp_grep_complete','arguments','optional','toISOString','payload','Parameters:\x0a','Tool\x20\x22','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','source','codebase_search','unknown\x20error','pattern','search_type','Morph\x20Edit\x20','linesAdded','morph-warp-grep-v2.1','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','GITHUB_CODEBASE_SEARCH','\x20(new\x20file)','instruction','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','name','-\x20Glob\x20search\x20`','listRoots','terminationReason','File\x20read\x20error:'];a0_0x4719=function(){return _0x3bd627;};return a0_0x4719();}if(ENABLE_WORKSPACE_MODE&&args[a0_0x240656(0x19a)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x240656(0x248)+workspaceDir+a0_0x240656(0x20f)));}catch(a0_0x4d6634){logMcpStderr(a0_0x240656(0x279)+a0_0x4d6634);}async function detectWorkspaceRoot(_0x58c676){const _0x255f3d=a0_0x240656;let _0x55cda6=a0_0x4c88d7[_0x255f3d(0x24a)](_0x58c676);const _0x383395=[_0x255f3d(0x28e),'.vscode',_0x255f3d(0x241),_0x255f3d(0x294),'pyproject.toml',_0x255f3d(0x1fe),'.cursor','tsconfig.json',_0x255f3d(0x224)];while(_0x55cda6!==a0_0x4c88d7['dirname'](_0x55cda6)){for(const _0x521827 of _0x383395){const _0x1823aa=a0_0x4c88d7[_0x255f3d(0x20e)](_0x55cda6,_0x521827);try{return await a0_0x5207e6[_0x255f3d(0x183)](_0x1823aa),normalizePath(_0x55cda6);}catch{}}_0x55cda6=a0_0x4c88d7[_0x255f3d(0x1ca)](_0x55cda6);}return normalizePath(_0x58c676);}await Promise[a0_0x240656(0x1f8)](args[a0_0x240656(0x185)](async _0x434d89=>{const _0x54ba0a=a0_0x240656;try{const _0x30aeec=await a0_0x5207e6['stat'](expandHome(_0x434d89));!_0x30aeec[_0x54ba0a(0x1d1)]()&&(logMcpStderr(_0x54ba0a(0x21c)+_0x434d89+'\x20is\x20not\x20a\x20directory'),process[_0x54ba0a(0x1ce)](0x1));}catch(_0x537a6c){logMcpStderr(_0x54ba0a(0x205)+_0x434d89+':',_0x537a6c),process['exit'](0x1);}}));async function validatePath(_0x4fb9ea){const _0x35f60f=a0_0x240656,_0x47c244=expandHome(_0x4fb9ea),_0x550569=a0_0x4c88d7['resolve'](_0x47c244);logger[_0x35f60f(0x180)](_0x35f60f(0x285),_0x35f60f(0x234),{'raw_path':_0x4fb9ea,'absolute':_0x550569});try{const _0x3a4b76=await a0_0x5207e6[_0x35f60f(0x26c)](_0x550569);return logger[_0x35f60f(0x180)](_0x35f60f(0x285),'path_validation_resolved',{'resolved':_0x3a4b76,'symlink':_0x3a4b76!==_0x550569}),_0x3a4b76;}catch(_0x1e7816){if(_0x1e7816[_0x35f60f(0x23d)]===_0x35f60f(0x2ac)){const _0x2b2205=a0_0x4c88d7[_0x35f60f(0x1ca)](_0x550569);try{const _0x4940a6=await a0_0x5207e6[_0x35f60f(0x26c)](_0x2b2205),_0x21ba7b=a0_0x4c88d7[_0x35f60f(0x20e)](_0x4940a6,a0_0x4c88d7[_0x35f60f(0x1a4)](_0x550569));return logger[_0x35f60f(0x180)](_0x35f60f(0x285),_0x35f60f(0x24f),{'resolved':_0x21ba7b,'new_file':!![]}),_0x21ba7b;}catch{logger['error']('MCP',_0x35f60f(0x24e),{'raw_path':_0x4fb9ea,'error':_0x35f60f(0x253)+_0x2b2205});throw new Error(_0x35f60f(0x253)+_0x2b2205);}}logger[_0x35f60f(0x29c)]('MCP',_0x35f60f(0x24e),{'raw_path':_0x4fb9ea,'error':_0x1e7816[_0x35f60f(0x282)]});throw _0x1e7816;}}const MorphEditFileArgsSchema=z[a0_0x240656(0x286)]({'path':z[a0_0x240656(0x1a6)](),'code_edit':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x202)),'instruction':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x194)),'dryRun':z[a0_0x240656(0x23b)]()[a0_0x240656(0x28a)](![])['describe'](a0_0x240656(0x206))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x240656(0x225),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x240656(0x1a6)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x21d)),'search_type':z[a0_0x240656(0x281)](['default',a0_0x240656(0x1cc)])[a0_0x240656(0x1da)]()['describe'](a0_0x240656(0x27d))}),WarpGrepGitHubArgsSchema=z[a0_0x240656(0x286)]({'search_string':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x1da)]()['describe'](a0_0x240656(0x1fa)),'owner_repo':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x1da)]()[a0_0x240656(0x266)](a0_0x240656(0x280)),'branch':z['string']()[a0_0x240656(0x1da)]()[a0_0x240656(0x266)](a0_0x240656(0x27e))}),CodebaseSearchArgsSchema=z[a0_0x240656(0x286)]({'query':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x240656(0x1a6)]()[a0_0x240656(0x266)](a0_0x240656(0x230)),'branch':z['string']()['optional']()[a0_0x240656(0x266)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z['string']()['optional']()[a0_0x240656(0x266)](a0_0x240656(0x227)),'targetDirectories':z[a0_0x240656(0x223)](z[a0_0x240656(0x1a6)]())[a0_0x240656(0x28a)]([])[a0_0x240656(0x266)](a0_0x240656(0x259)),'limit':z[a0_0x240656(0x22f)]()[a0_0x240656(0x1da)]()[a0_0x240656(0x28a)](0xa)['describe'](a0_0x240656(0x26d))}),server=new Server({'name':a0_0x240656(0x1cb),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x240656(0x251)](ListToolsRequestSchema,async()=>{const _0x596c63=a0_0x240656,_0x5c3978=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x596c63(0x261)+_0x596c63(0x1dd)+_0x596c63(0x1df)+_0x596c63(0x235)+_0x596c63(0x2a2)+_0x596c63(0x260)+_0x596c63(0x1c9)+_0x596c63(0x1a7)+'Rules:\x0a'+_0x596c63(0x18d)+_0x596c63(0x22a)+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0x596c63(0x213),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0x596c63(0x1b0)],'description':_0x596c63(0x272)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+'Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20'+_0x596c63(0x26b)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x3fc4ca=_0x5c3978[_0x596c63(0x268)](_0x38ae22=>{const _0x499db5=_0x596c63;if(DISABLED_TOOLS[_0x499db5(0x204)](_0x38ae22[_0x499db5(0x1ed)]))return console[_0x499db5(0x29c)](_0x499db5(0x1b4)+_0x38ae22[_0x499db5(0x1ed)]+_0x499db5(0x19f)),![];if(_0x499db5(0x1c5)in _0x38ae22&&_0x38ae22[_0x499db5(0x1c5)]&&!MORPH_API_KEY)return logMcpStderr('Warning:\x20'+_0x38ae22[_0x499db5(0x1ed)]+_0x499db5(0x1cf)),![];return!![];});return{'tools':_0x3fc4ca['map'](_0x2a7b33=>({'name':_0x2a7b33[_0x596c63(0x1ed)],'description':_0x2a7b33[_0x596c63(0x1f4)],'inputSchema':_0x2a7b33[_0x596c63(0x195)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x26e4a5=>{const _0x426f0e=a0_0x240656,{name:_0x5e3c72,arguments:_0x4aeb44}=_0x26e4a5[_0x426f0e(0x1c8)],_0x19a68a=Date[_0x426f0e(0x1f2)]();logger[_0x426f0e(0x180)]('MCP',_0x426f0e(0x27a),{'tool':_0x5e3c72,'args':_0x5e3c72==='edit_file'?{'path':_0x4aeb44?.[_0x426f0e(0x26f)],'instruction':_0x4aeb44?.['instruction']||_0x4aeb44?.[_0x426f0e(0x245)],'dryRun':_0x4aeb44?.[_0x426f0e(0x284)]}:_0x4aeb44});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x20d)}],'isError':!![]};if(!MORPH_API_KEY['startsWith']('sk-')&&!MORPH_API_KEY[_0x426f0e(0x1c4)](_0x426f0e(0x19d)))return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x18e)}],'isError':!![]};if(DISABLED_TOOLS['has'](_0x5e3c72))return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x1de)+_0x5e3c72+_0x426f0e(0x1c0)}],'isError':![]};switch(_0x5e3c72){case TOOL_NAMES[_0x426f0e(0x1cd)]:{let _0x347b27=_0x4aeb44;if(_0x347b27&&typeof _0x347b27==='object'){if(!(_0x426f0e(0x26f)in _0x347b27)){const _0x2be5e3=_0x347b27[_0x426f0e(0x1b3)]??_0x347b27['filePath']??_0x347b27['target_filepath']??_0x347b27['file_path']??_0x347b27['file'];if(_0x2be5e3)_0x347b27={..._0x347b27,'path':_0x2be5e3};}_0x426f0e(0x245)in _0x347b27&&!(_0x426f0e(0x1eb)in _0x347b27)&&(_0x347b27={..._0x347b27,'instruction':_0x347b27[_0x426f0e(0x245)]});if(!(_0x426f0e(0x247)in _0x347b27)){const _0x232689=_0x347b27[_0x426f0e(0x23d)]??_0x347b27[_0x426f0e(0x208)]??_0x347b27['content']??_0x347b27[_0x426f0e(0x2ab)];if(_0x232689)_0x347b27={..._0x347b27,'code_edit':_0x232689};}}const _0x29e50c=MorphEditFileArgsSchema[_0x426f0e(0x252)](_0x347b27);if(!_0x29e50c[_0x426f0e(0x1d5)])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x29e50c[_0x426f0e(0x29c)]);const _0x44db33=await validatePath(_0x29e50c['data'][_0x426f0e(0x26f)]);let _0x2a806c=null,_0x4721f4=!![],_0x552c58=null;try{_0x2a806c=await a0_0x5207e6[_0x426f0e(0x233)](_0x44db33,'utf-8'),logger['debug'](_0x426f0e(0x285),_0x426f0e(0x1d4),{'path':_0x44db33,'size_bytes':_0x2a806c[_0x426f0e(0x19a)]});}catch(_0x5caa45){const _0x23f4dd=_0x5caa45[_0x426f0e(0x23d)];_0x23f4dd===_0x426f0e(0x2ac)?(_0x4721f4=![],_0x2a806c='',logger['debug'](_0x426f0e(0x285),'file_read_complete',{'path':_0x44db33,'exists':![]})):(_0x552c58=_0x426f0e(0x212)+(_0x23f4dd||_0x426f0e(0x1af))+_0x426f0e(0x21e)+(_0x5caa45 instanceof Error?_0x5caa45[_0x426f0e(0x282)]:String(_0x5caa45)),logger[_0x426f0e(0x29c)](_0x426f0e(0x285),_0x426f0e(0x250),{'path':_0x44db33,'error':_0x552c58}),logMcpStderr('Warning:\x20'+_0x552c58));}let _0x57c52a;try{const _0x467539=MORPH_API_KEY;if(!_0x467539)throw new Error('MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.');const _0x434b46=a0_0x4c88d7[_0x426f0e(0x1ca)](_0x44db33),_0xba21c=a0_0x4c88d7[_0x426f0e(0x1a4)](_0x44db33);logger[_0x426f0e(0x180)](_0x426f0e(0x285),'api_request_start',{'model':_0x426f0e(0x288),'path':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)],'instruction_len':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x1eb)]['length'],'code_edit_len':_0x29e50c['data'][_0x426f0e(0x247)][_0x426f0e(0x19a)],'original_code_len':_0x2a806c?.['length']??0x0,'dry_run':_0x29e50c[_0x426f0e(0x1a0)]['dryRun']});const _0x67ddb8=Date[_0x426f0e(0x1f2)](),_0x23f2bd=await executeEditFile({'target_filepath':_0xba21c,'code_edit':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x247)],'instruction':_0x29e50c['data'][_0x426f0e(0x1eb)]},{'morphApiKey':_0x467539,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x434b46,'autoWrite':!_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x284)],'generateUdiff':![],'debug':![]}),_0x221939=Date[_0x426f0e(0x1f2)]()-_0x67ddb8;_0x57c52a=_0x23f2bd[_0x426f0e(0x2a8)];if(!_0x23f2bd['success'])throw new Error(_0x23f2bd[_0x426f0e(0x29c)]||_0x426f0e(0x1a5));const _0x4fa55d=_0x23f2bd[_0x426f0e(0x1f9)],_0x1a42e0=_0x426f0e(0x2a6)+_0x4fa55d[_0x426f0e(0x1e6)]+_0x426f0e(0x23c)+_0x4fa55d[_0x426f0e(0x207)]+_0x426f0e(0x1d2)+_0x4fa55d[_0x426f0e(0x191)];logger[_0x426f0e(0x180)](_0x426f0e(0x285),_0x426f0e(0x1bb),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a,'edit_latency_ms':_0x221939,'changes':{'added':_0x4fa55d[_0x426f0e(0x1e6)],'removed':_0x4fa55d[_0x426f0e(0x207)],'modified':_0x4fa55d[_0x426f0e(0x191)]},'completion_id':_0x57c52a});if(_0x29e50c[_0x426f0e(0x1a0)]['dryRun'])return{'content':[{'type':'text','text':'Morph\x20Edit\x20Preview'+(_0x4721f4?'':_0x426f0e(0x1ea))+':\x20'+_0x29e50c['data'][_0x426f0e(0x1eb)]+_0x426f0e(0x239)+_0x1a42e0+_0x426f0e(0x27f)+_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)]+'.'}]};return{'content':[{'type':'text','text':_0x426f0e(0x1e5)+(_0x4721f4?'Applied':'Created\x20File')+':\x20'+_0x29e50c[_0x426f0e(0x1a0)]['instruction']+_0x426f0e(0x239)+_0x1a42e0+_0x426f0e(0x27f)+_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)]+'.'}]};}catch(_0x1a6928){const _0x3cd8a9=handleMorphAPIError(_0x1a6928);if(_0x3cd8a9)return logger[_0x426f0e(0x29c)]('MCP',_0x426f0e(0x22e),{'tool':_0x426f0e(0x2a5),'error':_0x426f0e(0x25b),'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a}),_0x3cd8a9;const _0x58c548=_0x1a6928 instanceof Error?_0x1a6928['message']:String(_0x1a6928);return logger[_0x426f0e(0x29c)](_0x426f0e(0x285),_0x426f0e(0x22e),{'tool':_0x426f0e(0x2a5),'error':_0x58c548,'path':_0x29e50c[_0x426f0e(0x1a0)]['path'],'validated_path':_0x44db33,'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a,'stack':_0x1a6928 instanceof Error?_0x1a6928[_0x426f0e(0x1b2)]:undefined}),reportMorphError({'error_message':_0x58c548,'error_type':_0x1a6928 instanceof Error?_0x1a6928[_0x426f0e(0x289)][_0x426f0e(0x1ed)]:_0x426f0e(0x1be),'context':{'tool':_0x426f0e(0x2a5),'completion_id':_0x57c52a,'file_path':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)],'validated_path':_0x44db33,'instruction':_0x29e50c[_0x426f0e(0x1a0)]['instruction'],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x426f0e(0x288),'dry_run':_0x29e50c['data']['dryRun'],'file_exists':_0x4721f4,'file_read_error':_0x552c58,'file_readable':_0x2a806c!==null,'request_content':{'path':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x26f)],'code_edit':_0x29e50c[_0x426f0e(0x1a0)][_0x426f0e(0x247)],'instruction':_0x29e50c['data'][_0x426f0e(0x1eb)],'original_code':_0x2a806c!==null?_0x2a806c[_0x426f0e(0x19a)]>0xc350?_0x2a806c[_0x426f0e(0x256)](0x0,0xc350)+_0x426f0e(0x277)+_0x2a806c[_0x426f0e(0x19a)]+'\x20chars)':_0x2a806c:_0x426f0e(0x271)+(_0x552c58||_0x426f0e(0x1e2))+']','original_code_length':_0x2a806c?.['length']??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x426f0e(0x288),'dry_run':_0x29e50c['data'][_0x426f0e(0x284)]}},'stack_trace':_0x1a6928 instanceof Error?_0x1a6928[_0x426f0e(0x1b2)]:undefined,'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x58c548}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x16d1c7=WarpGrepArgsSchema[_0x426f0e(0x252)](_0x4aeb44);if(!_0x16d1c7['success'])return{'content':[{'type':'text','text':_0x426f0e(0x203)+_0x16d1c7[_0x426f0e(0x29c)]}],'isError':!![]};const _0x2f695c=_0x2ca39e=>{const _0x2e5e51=_0x426f0e,_0x4af8cd=[];for(const _0x3b0a94 of _0x2ca39e||[]){if(_0x3b0a94[_0x2e5e51(0x237)]===_0x2e5e51(0x1f7)&&Array['isArray'](_0x3b0a94[_0x2e5e51(0x278)]))for(const _0x3098a2 of _0x3b0a94[_0x2e5e51(0x278)]){try{const _0x3222af=_0x3098a2[_0x2e5e51(0x18a)]?.[_0x2e5e51(0x1ed)],_0x170498=JSON['parse'](_0x3098a2['function']?.[_0x2e5e51(0x1d9)]||'{}');if(_0x3222af==='grep_search')_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x28b)+_0x170498['pattern']+'\x27\x20'+(_0x170498[_0x2e5e51(0x26f)]||'.'));else{if(_0x3222af==='read')_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x22c)+_0x170498[_0x2e5e51(0x26f)]);else{if(_0x3222af===_0x2e5e51(0x242))_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x21b)+(_0x170498['command']||'.'));else{if(_0x3222af===_0x2e5e51(0x1d0))_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x1bc)+_0x170498['pattern']+'\x27\x20'+(_0x170498['path']||'.'));else _0x3222af===_0x2e5e51(0x192)&&_0x4af8cd[_0x2e5e51(0x1a2)](_0x2e5e51(0x192));}}}}catch{}}}return _0x4af8cd;},_0x5a292d=_0x4c581a=>{const _0x510d34=_0x426f0e,_0x3df306=[];if(!_0x4c581a||!Array[_0x510d34(0x290)](_0x4c581a))return _0x3df306;const _0x3db5d3=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x510d34(0x240),'tool':_0x510d34(0x1b8)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x510d34(0x2ad),'tool':_0x510d34(0x1b8)},{'pattern':/\[READ ERROR\]/,'error_type':_0x510d34(0x211),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x510d34(0x188),'tool':_0x510d34(0x1b8)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x510d34(0x28d),'tool':_0x510d34(0x1aa)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x510d34(0x254),'tool':_0x510d34(0x1aa)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x510d34(0x188),'tool':_0x510d34(0x1b8)},{'pattern':/\[SYMLINK\]/,'error_type':_0x510d34(0x186),'tool':_0x510d34(0x1b8)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':'read'},{'pattern':/symbolic link/,'error_type':_0x510d34(0x186),'tool':_0x510d34(0x1b8)},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x510d34(0x1b8)},{'pattern':/status="error"/,'error_type':_0x510d34(0x187),'tool':'unknown'}];let _0x1bc69a=0x0;for(const _0x4e136f of _0x4c581a){_0x4e136f[_0x510d34(0x237)]===_0x510d34(0x1f7)&&Array[_0x510d34(0x290)](_0x4e136f['tool_calls'])&&_0x1bc69a++;const _0x3084fa=_0x4e136f[_0x510d34(0x21a)];if((_0x4e136f[_0x510d34(0x237)]===_0x510d34(0x1ba)||_0x4e136f[_0x510d34(0x237)]===_0x510d34(0x2a9))&&_0x3084fa&&typeof _0x3084fa===_0x510d34(0x1a6))for(const {pattern:_0x460bc5,error_type:_0x10b821,tool:_0x5285c6}of _0x3db5d3){const _0x1e1117=_0x3084fa[_0x510d34(0x2a4)](new RegExp(_0x460bc5['source'],'g'));if(_0x1e1117)for(const _0x45e74c of _0x1e1117){const _0x591753=_0x3084fa[_0x510d34(0x1d6)](_0x45e74c),_0x410df5=_0x3084fa[_0x510d34(0x256)](_0x591753,Math['min'](_0x591753+0xc8,_0x3084fa[_0x510d34(0x19a)]));_0x3df306['push']({'tool':_0x5285c6,'error_type':_0x10b821,'error_message':_0x410df5[_0x510d34(0x296)]('\x0a')[0x0],'turn':_0x1bc69a});}}}return _0x3df306;};try{const _0xf48624=a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)]['repo_path']),_0x2357ff=_0x16d1c7['data'][_0x426f0e(0x1e4)],_0xa86b20=_0x2357ff===_0x426f0e(0x1cc)?{'allowNames':[_0x426f0e(0x1cc)]}:undefined,_0x4892d1=new LocalRipgrepProvider(_0xf48624,undefined,_0xa86b20);logger['debug'](_0x426f0e(0x285),_0x426f0e(0x265),{'type':_0x426f0e(0x189),'repo_root':_0xf48624,'search_type':_0x2357ff||_0x426f0e(0x28a)}),logger['debug'](_0x426f0e(0x285),'warp_grep_start',{'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'repo_root':_0xf48624,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x1171c3=Date[_0x426f0e(0x1f2)](),_0x2f776b=await runWarpGrep({'searchTerm':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'repoRoot':_0xf48624,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x4892d1,'search_type':_0x2357ff}),_0x5b637c=Date['now']()-_0x1171c3,_0x38b456=_0x2f776b[_0x426f0e(0x192)]?.['metadata']?.[_0x426f0e(0x287)]?.[_0x426f0e(0x19a)]??0x0;logger[_0x426f0e(0x180)](_0x426f0e(0x285),_0x426f0e(0x1d8),{'termination':_0x2f776b[_0x426f0e(0x1f0)],'turns':_0x2f776b[_0x426f0e(0x25e)]?.['turns']??0x0,'files_found':_0x38b456,'latency_ms':_0x5b637c});const _0x429363=_0x5a292d(_0x2f776b['messages']);_0x429363['length']>0x0&&reportMorphError({'error_message':'WarpGrep\x20sub-tool\x20errors:\x20'+_0x429363['length']+'\x20error(s)','error_type':_0x426f0e(0x2ae),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x16d1c7['data'][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'model':'morph-warp-grep-v2.1','termination_reason':_0x2f776b['terminationReason'],'sub_tool_errors':_0x429363,'timings':_0x2f776b[_0x426f0e(0x25e)],'tool_calls':_0x2f695c(_0x2f776b[_0x426f0e(0x275)]),'messages':_0x2f776b[_0x426f0e(0x275)]?.['map'](_0x4e9a15=>({'role':_0x4e9a15[_0x426f0e(0x237)],'content':_0x4e9a15[_0x426f0e(0x21a)],..._0x4e9a15['tool_calls']?{'tool_calls':_0x4e9a15[_0x426f0e(0x278)][_0x426f0e(0x19a)]}:{},..._0x4e9a15['tool_call_id']?{'tool_call_id':_0x4e9a15[_0x426f0e(0x1f3)]}:{}}))},'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{});let _0x2e9d71='';if(_0x2f776b['terminationReason']===_0x426f0e(0x2a3)&&_0x2f776b['finish']?.[_0x426f0e(0x20b)]?.['files']){const _0x5dde31=_0x2f776b[_0x426f0e(0x192)][_0x426f0e(0x20b)][_0x426f0e(0x287)];if(_0x5dde31[_0x426f0e(0x19a)]===0x0)return _0x2e9d71=_0x2f776b[_0x426f0e(0x192)][_0x426f0e(0x1dc)]||_0x426f0e(0x231),{'content':[{'type':_0x426f0e(0x23e),'text':_0x2e9d71}]};const _0x4bca2e=[],_0xc53af1=[_0x426f0e(0x1fc)];for(const _0xc90277 of _0x2f776b[_0x426f0e(0x275)]){if(_0xc90277[_0x426f0e(0x237)]===_0x426f0e(0x1f7)&&Array[_0x426f0e(0x290)](_0xc90277[_0x426f0e(0x278)]))for(const _0x296f07 of _0xc90277['tool_calls']){try{const _0x4c06c9=_0x296f07['function']?.['name'],_0x4d8d3b=JSON[_0x426f0e(0x20c)](_0x296f07[_0x426f0e(0x18a)]?.[_0x426f0e(0x1d9)]||'{}');if(_0x4c06c9===_0x426f0e(0x238))_0xc53af1[_0x426f0e(0x1a2)]('-\x20Grepped\x20\x27'+_0x4d8d3b['pattern']+_0x426f0e(0x2a1)+(_0x4d8d3b[_0x426f0e(0x26f)]||'.')+'`');else{if(_0x4c06c9===_0x426f0e(0x1b8))_0xc53af1[_0x426f0e(0x1a2)](_0x426f0e(0x214)+_0x4d8d3b['path']+'`');else{if(_0x4c06c9==='list_directory')_0xc53af1[_0x426f0e(0x1a2)](_0x426f0e(0x1ae)+(_0x4d8d3b[_0x426f0e(0x236)]||'.')+'`');else _0x4c06c9==='glob'&&_0xc53af1[_0x426f0e(0x1a2)](_0x426f0e(0x1ee)+_0x4d8d3b[_0x426f0e(0x1e3)]+_0x426f0e(0x27b)+(_0x4d8d3b[_0x426f0e(0x26f)]||'.')+'`');}}}catch{}}}_0x4bca2e['push'](_0xc53af1['join']('\x0a'));const _0x13788c=['',_0x426f0e(0x246)];for(const _0x18dae2 of _0x5dde31){if(_0x18dae2['lines']==='*')_0x13788c['push']('-\x20'+_0x18dae2[_0x426f0e(0x26f)]+':*');else{if(Array['isArray'](_0x18dae2[_0x426f0e(0x23a)])){const _0x4a4963=_0x18dae2['lines']['map'](([_0xc04d59,_0xd17907])=>{if(_0xc04d59===_0xd17907)return''+_0xc04d59;return _0xc04d59+'-'+_0xd17907;});_0x13788c[_0x426f0e(0x1a2)]('-\x20'+_0x18dae2[_0x426f0e(0x26f)]+':'+_0x4a4963[_0x426f0e(0x20e)](','));}else _0x13788c[_0x426f0e(0x1a2)]('-\x20'+_0x18dae2[_0x426f0e(0x26f)]+':*');}}_0x13788c['push'](''),_0x4bca2e['push'](_0x13788c[_0x426f0e(0x20e)]('\x0a')),_0x4bca2e[_0x426f0e(0x1a2)](_0x426f0e(0x255));const _0x132000=[],_0x21b1a1=[];for(const _0x55adf9 of _0x5dde31){let _0xd86ef=a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)]['repo_path'],_0x55adf9[_0x426f0e(0x26f)]),_0x1c0122=null,_0x3a3cb2=null;try{_0x1c0122=await a0_0x5207e6[_0x426f0e(0x233)](_0xd86ef,{'encoding':'utf-8'});}catch(_0x118fcb){const _0x3246ee=fixPathRepetition(_0xd86ef);if(_0x3246ee)try{_0x1c0122=await a0_0x5207e6[_0x426f0e(0x233)](_0x3246ee,{'encoding':'utf-8'}),_0xd86ef=_0x3246ee;}catch{_0x3a3cb2=_0x118fcb instanceof Error?_0x118fcb:new Error(String(_0x118fcb));}else _0x3a3cb2=_0x118fcb instanceof Error?_0x118fcb:new Error(String(_0x118fcb));}if(_0x1c0122!==null){const _0x553f07=_0x1c0122[_0x426f0e(0x296)](/\r?\n/),_0xcba27d=[];if(_0x55adf9[_0x426f0e(0x23a)]==='*'||!Array['isArray'](_0x55adf9['lines']))for(let _0x46f4b1=0x1;_0x46f4b1<=_0x553f07[_0x426f0e(0x19a)];_0x46f4b1++){const _0x1f16c3=_0x553f07[_0x46f4b1-0x1];_0xcba27d[_0x426f0e(0x1a2)](_0x46f4b1+'|\x20'+_0x1f16c3);}else for(const [_0x4f1697,_0x2a8ea5]of _0x55adf9['lines']){_0xcba27d[_0x426f0e(0x19a)]>0x0&&_0xcba27d[_0x426f0e(0x1a2)]('');for(let _0x3573c3=_0x4f1697;_0x3573c3<=_0x2a8ea5&&_0x3573c3<=_0x553f07[_0x426f0e(0x19a)];_0x3573c3++){const _0x16fbe7=_0x553f07[_0x3573c3-0x1];_0xcba27d[_0x426f0e(0x1a2)](_0x3573c3+'|\x20'+_0x16fbe7);}}_0x21b1a1[_0x426f0e(0x1a2)]({'path':_0x55adf9[_0x426f0e(0x26f)],'content':_0xcba27d[_0x426f0e(0x20e)]('\x0a')});}else _0x132000[_0x426f0e(0x1a2)](_0x426f0e(0x1d3)+_0x55adf9[_0x426f0e(0x26f)]+'\x22>\x0aError\x20reading\x20file:\x20'+(_0x3a3cb2?.[_0x426f0e(0x282)]||_0x426f0e(0x229))+_0x426f0e(0x22d));}try{const _0x2625aa=await compactFileContexts(_0x21b1a1,_0x16d1c7['data'][_0x426f0e(0x221)],MORPH_API_KEY,MORPH_API_URL);for(const _0x33ea4f of _0x2625aa){_0x132000[_0x426f0e(0x1a2)](_0x426f0e(0x1d3)+_0x33ea4f[_0x426f0e(0x26f)]+'\x22>\x0a'+_0x33ea4f['content']+'\x0a</file>');}}catch(_0x2ae193){logger[_0x426f0e(0x217)](_0x426f0e(0x285),_0x426f0e(0x1ff),{'error':_0x2ae193 instanceof Error?_0x2ae193[_0x426f0e(0x282)]:String(_0x2ae193),'files_count':_0x21b1a1[_0x426f0e(0x19a)]});for(const _0x3f9c3 of _0x21b1a1){_0x132000[_0x426f0e(0x1a2)](_0x426f0e(0x1d3)+_0x3f9c3[_0x426f0e(0x26f)]+_0x426f0e(0x1f5)+_0x3f9c3[_0x426f0e(0x21a)]+_0x426f0e(0x22d));}}_0x4bca2e[_0x426f0e(0x1a2)](_0x132000[_0x426f0e(0x20e)]('\x0a\x0a')),_0x2e9d71=_0x4bca2e[_0x426f0e(0x20e)]('\x0a');const _0x5e85e8=_0x2f776b[_0x426f0e(0x218)]?.[_0x426f0e(0x268)](_0x4d3762=>_0x4d3762[_0x426f0e(0x282)]?.['startsWith'](_0x426f0e(0x1f1)))||[];if(_0x5e85e8['length']>0x0){const _0x44a081=_0x5e85e8[_0x426f0e(0x185)](_0x44f1ea=>_0x44f1ea[_0x426f0e(0x282)])[_0x426f0e(0x20e)](';\x20');reportMorphError({'error_message':_0x44a081,'error_type':_0x426f0e(0x25d),'context':{'tool':_0x426f0e(0x1e1),'repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'model':'morph-warp-grep-v2.1','termination_reason':_0x426f0e(0x198),'error_count':_0x5e85e8[_0x426f0e(0x19a)],'is_timeout':![],'timings':_0x2f776b['timings'],'files_attempted':_0x5dde31[_0x426f0e(0x185)](_0x3dd36a=>({'path':_0x3dd36a[_0x426f0e(0x26f)],'lines':_0x3dd36a[_0x426f0e(0x23a)]})),'tool_calls':_0x2f695c(_0x2f776b[_0x426f0e(0x275)]),'messages':_0x2f776b['messages']?.[_0x426f0e(0x185)](_0x30d88f=>({'role':_0x30d88f[_0x426f0e(0x237)],'content':_0x30d88f['content'],..._0x30d88f[_0x426f0e(0x278)]?{'tool_calls':_0x30d88f[_0x426f0e(0x278)][_0x426f0e(0x19a)]}:{},..._0x30d88f[_0x426f0e(0x1f3)]?{'tool_call_id':_0x30d88f[_0x426f0e(0x1f3)]}:{}})),'request_content':{'query':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'repo_path':_0x16d1c7['data'][_0x426f0e(0x1fd)],'repoRoot':a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)]['repo_path']),'model':_0x426f0e(0x1e7)}},'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{});}}else{if(_0x2f776b[_0x426f0e(0x1f0)]===_0x426f0e(0x1b6)&&_0x2f776b[_0x426f0e(0x218)][_0x426f0e(0x19a)]>0x0){const _0x38ef2f=_0x2f776b[_0x426f0e(0x218)][_0x426f0e(0x185)](_0x1a34a4=>_0x1a34a4['message'])[_0x426f0e(0x20e)](';\x20');_0x2e9d71='Error:\x20'+_0x38ef2f;const _0x9daf02=_0x38ef2f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x29f))||_0x38ef2f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)]('timed\x20out')||_0x38ef2f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x20a)),_0x59290c=_0x2f776b[_0x426f0e(0x192)]?.[_0x426f0e(0x20b)]?.[_0x426f0e(0x287)],_0x434b84=_0x2f776b[_0x426f0e(0x218)][0x0];reportMorphError({'error_message':_0x38ef2f,'error_type':_0x9daf02?_0x426f0e(0x1ad):_0x434b84?.[_0x426f0e(0x289)]?.['name']||'WarpGrepError','context':{'tool':_0x426f0e(0x1e1),'repo_path':_0x16d1c7['data']['repo_path'],'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'model':_0x426f0e(0x1e7),'termination_reason':_0x2f776b[_0x426f0e(0x1f0)],'error_count':_0x2f776b[_0x426f0e(0x218)][_0x426f0e(0x19a)],'is_timeout':_0x9daf02,'timings':_0x2f776b['timings'],'files_attempted':_0x59290c?.[_0x426f0e(0x185)](_0x11adc7=>({'path':_0x11adc7[_0x426f0e(0x26f)],'lines':_0x11adc7['lines']})),'tool_calls':_0x2f695c(_0x2f776b['messages']),'messages':_0x2f776b['messages']?.[_0x426f0e(0x185)](_0x36bcd2=>({'role':_0x36bcd2['role'],'content':_0x36bcd2['content'],..._0x36bcd2['tool_calls']?{'tool_calls':_0x36bcd2[_0x426f0e(0x278)][_0x426f0e(0x19a)]}:{},..._0x36bcd2[_0x426f0e(0x1f3)]?{'tool_call_id':_0x36bcd2[_0x426f0e(0x1f3)]}:{}})),'request_content':{'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'repoRoot':a0_0x4c88d7[_0x426f0e(0x24a)](_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)]),'model':_0x426f0e(0x1e7)}},'stack_trace':_0x434b84?.[_0x426f0e(0x1b2)]||undefined,'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{});}else _0x2e9d71=_0x426f0e(0x2aa);}return{'content':[{'type':_0x426f0e(0x23e),'text':_0x2e9d71}]};}catch(_0x2ecf41){const _0xf8af4e=handleMorphAPIError(_0x2ecf41);if(_0xf8af4e)return logger[_0x426f0e(0x29c)](_0x426f0e(0x285),_0x426f0e(0x22e),{'tool':_0x426f0e(0x1e1),'error':_0x426f0e(0x25b),'latency_ms':Date['now']()-_0x19a68a}),_0xf8af4e;const _0x4a223f=_0x2ecf41 instanceof Error?_0x2ecf41[_0x426f0e(0x282)]:String(_0x2ecf41);logger[_0x426f0e(0x29c)]('MCP',_0x426f0e(0x22e),{'tool':_0x426f0e(0x1e1),'error':_0x4a223f,'repo_path':_0x16d1c7['data'][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'latency_ms':Date[_0x426f0e(0x1f2)]()-_0x19a68a});const _0x2fe6db=_0x4a223f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x29f))||_0x4a223f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x2a7))||_0x4a223f[_0x426f0e(0x28c)]()[_0x426f0e(0x228)](_0x426f0e(0x20a))||_0x2ecf41 instanceof Error&&_0x2ecf41[_0x426f0e(0x1ed)]===_0x426f0e(0x1ad);return reportMorphError({'error_message':_0x4a223f,'error_type':_0x2fe6db?_0x426f0e(0x1ad):_0x2ecf41 instanceof Error?_0x2ecf41[_0x426f0e(0x289)]['name']:_0x426f0e(0x1be),'context':{'tool':'codebase_search','repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'query':_0x16d1c7[_0x426f0e(0x1a0)]['search_string'],'model':_0x426f0e(0x1e7),'is_timeout':_0x2fe6db,'exception_phase':_0x426f0e(0x216),'request_content':{'query':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'repo_path':_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)],'repoRoot':a0_0x4c88d7['resolve'](_0x16d1c7[_0x426f0e(0x1a0)][_0x426f0e(0x1fd)]),'model':_0x426f0e(0x1e7)}},'stack_trace':_0x2ecf41 instanceof Error?_0x2ecf41[_0x426f0e(0x1b2)]:undefined,'source':_0x426f0e(0x19b)})[_0x426f0e(0x209)](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':'Error\x20running\x20fast\x20context\x20search:\x20'+_0x4a223f}],'isError':![]};}}case TOOL_NAMES[_0x426f0e(0x1e9)]:{const _0x59c49a=WarpGrepGitHubArgsSchema[_0x426f0e(0x252)](_0x4aeb44);if(!_0x59c49a[_0x426f0e(0x1d5)])return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x203)+_0x59c49a[_0x426f0e(0x29c)]}],'isError':!![]};const _0x5ed080=_0x59c49a['data'][_0x426f0e(0x222)]||_0x59c49a['data'][_0x426f0e(0x21f)];if(!_0x5ed080)return{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x182)}],'isError':!![]};const _0x2de418=MORPH_API_KEY;if(!_0x2de418)throw new Error(_0x426f0e(0x19c));const _0x32b20d=Date[_0x426f0e(0x1f2)]();logger[_0x426f0e(0x180)](_0x426f0e(0x285),_0x426f0e(0x1fb),{'identifier':_0x5ed080,'query':_0x59c49a[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'branch':_0x59c49a[_0x426f0e(0x1a0)]['branch']});try{const _0x1c5e93=new WarpGrepClient({'morphApiKey':_0x2de418,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x484191=await _0x1c5e93[_0x426f0e(0x264)]({'searchTerm':_0x59c49a['data'][_0x426f0e(0x221)],'github':_0x5ed080,'branch':_0x59c49a[_0x426f0e(0x1a0)][_0x426f0e(0x25a)]}),_0x5e6a5c=Date['now']()-_0x32b20d;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x5e6a5c+_0x426f0e(0x181)+_0x484191['success']);const _0x376aa2=formatResult(_0x484191);return{'content':[{'type':'text','text':_0x376aa2}]};}catch(_0x42fee7){const _0x5117e9=handleMorphAPIError(_0x42fee7);if(_0x5117e9)return _0x5117e9;const _0x2d9692=Date['now']()-_0x32b20d,_0x5dceb3=_0x42fee7 instanceof Error?_0x42fee7['message']:String(_0x42fee7);return logMcpStderr(_0x426f0e(0x26e)+_0x2d9692+_0x426f0e(0x26a),_0x5dceb3),reportMorphError({'error_message':_0x5dceb3,'error_type':_0x42fee7 instanceof Error?_0x42fee7[_0x426f0e(0x289)][_0x426f0e(0x1ed)]:_0x426f0e(0x1be),'context':{'tool':_0x426f0e(0x29b),'github_url':_0x5ed080,'search_string':_0x59c49a[_0x426f0e(0x1a0)][_0x426f0e(0x221)],'branch':_0x59c49a[_0x426f0e(0x1a0)]['branch']},'stack_trace':_0x42fee7 instanceof Error?_0x42fee7[_0x426f0e(0x1b2)]:undefined,'source':'mcp-filesystem','tool':'github_codebase_search','latency_ms':_0x2d9692})[_0x426f0e(0x209)](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':'GitHub\x20search\x20failed:\x20'+_0x5dceb3}],'isError':![]};}}default:throw new Error(_0x426f0e(0x270)+_0x5e3c72);}}catch(_0x3f68ce){const _0x3b344f=_0x3f68ce instanceof Error?_0x3f68ce[_0x426f0e(0x282)]:String(_0x3f68ce);return reportMorphError({'error_message':_0x3b344f,'error_type':_0x3f68ce instanceof Error?_0x3f68ce['constructor']['name']:_0x426f0e(0x1be),'context':{'tool':_0x5e3c72,'arguments':_0x4aeb44?JSON[_0x426f0e(0x200)](_0x4aeb44)['substring'](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x3f68ce instanceof Error?_0x3f68ce['stack']:undefined,'source':_0x426f0e(0x19b)})['catch'](()=>{}),{'content':[{'type':_0x426f0e(0x23e),'text':_0x426f0e(0x21c)+_0x3b344f}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x54321f){const _0x258869=a0_0x240656,_0x2a9324=await getValidRootDirectories(_0x54321f);if(_0x2a9324[_0x258869(0x19a)]>0x0)allowedDirectories=[..._0x2a9324],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x2a9324['length']+_0x258869(0x17d));else{logMcpStderr(_0x258869(0x24d));if(ENABLE_WORKSPACE_MODE)try{const _0x1f74dc=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x1f74dc&&(allowedDirectories=[_0x1f74dc],logMcpStderr(_0x258869(0x1c2)+_0x1f74dc));}catch(_0x94dbaf){logMcpStderr(_0x258869(0x25f)+_0x94dbaf);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x345da7=a0_0x240656;try{const _0x549c5d=await server[_0x345da7(0x1ef)]();_0x549c5d&&'roots'in _0x549c5d&&await updateAllowedDirectoriesFromRoots(_0x549c5d['roots']);}catch(_0x56a4ea){logMcpStderr(_0x345da7(0x1b9),_0x56a4ea instanceof Error?_0x56a4ea[_0x345da7(0x282)]:String(_0x56a4ea));}}),server[a0_0x240656(0x18f)]=async()=>{const _0x2170ec=a0_0x240656,_0x8fb490=server['getClientCapabilities']();if(_0x8fb490?.[_0x2170ec(0x274)])try{const _0x2a7957=await server['listRoots']();_0x2a7957&&_0x2170ec(0x274)in _0x2a7957?await updateAllowedDirectoriesFromRoots(_0x2a7957[_0x2170ec(0x274)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x327325){logMcpStderr(_0x2170ec(0x1ec),_0x327325 instanceof Error?_0x327325[_0x2170ec(0x282)]:String(_0x327325));}else{if(allowedDirectories[_0x2170ec(0x19a)]>0x0)logMcpStderr(_0x2170ec(0x201),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x2170ec(0x276));else throw new Error(_0x2170ec(0x1c7));}}};async function runServer(){const _0x59153a=a0_0x240656,_0x25aecc=new StdioServerTransport();await server[_0x59153a(0x258)](_0x25aecc),logMcpStderr(_0x59153a(0x215)),allowedDirectories[_0x59153a(0x19a)]===0x0&&logMcpStderr(_0x59153a(0x220));}runServer()[a0_0x240656(0x209)](_0x2eaf9d=>{const _0x2f9cad=a0_0x240656;logMcpStderr(_0x2f9cad(0x1b5),_0x2eaf9d),process['exit'](0x1);});

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

var a1_0x14162f=a1_0x9ec8;(function(_0x53e503,_0x103f9c){var _0x59187e=a1_0x9ec8,_0x1311ae=_0x53e503();while(!![]){try{var _0x38cccd=parseInt(_0x59187e(0x79))/0x1+parseInt(_0x59187e(0x74))/0x2+parseInt(_0x59187e(0x87))/0x3*(parseInt(_0x59187e(0x88))/0x4)+-parseInt(_0x59187e(0x85))/0x5+-parseInt(_0x59187e(0x7a))/0x6*(parseInt(_0x59187e(0x7b))/0x7)+-parseInt(_0x59187e(0x7c))/0x8*(-parseInt(_0x59187e(0x7e))/0x9)+-parseInt(_0x59187e(0x7d))/0xa*(parseInt(_0x59187e(0x77))/0xb);if(_0x38cccd===_0x103f9c)break;else _0x1311ae['push'](_0x1311ae['shift']());}catch(_0x384238){_0x1311ae['push'](_0x1311ae['shift']());}}}(a1_0x46dc,0x883dc));import a1_0x3ccd86 from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0xcb0c92=a1_0x3ccd86[a1_0x14162f(0x86)]()){var _0x24dd3f=a1_0x14162f;switch(_0xcb0c92){case _0x24dd3f(0x7f):return _0x24dd3f(0x80);case'win32':return _0x24dd3f(0x78);case'linux':return _0x24dd3f(0x75);default:return _0x24dd3f(0x76);}}function a1_0x9ec8(_0x877ac5,_0x4980e6){_0x877ac5=_0x877ac5-0x73;var _0x46dc9b=a1_0x46dc();var _0x9ec87a=_0x46dc9b[_0x877ac5];return _0x9ec87a;}export function formatMcpLogMessage(_0x3794f2,_0x245a0d=a1_0x3ccd86['platform']()){var _0x50c657=a1_0x14162f;return _0x50c657(0x83)+getOperatingSystemType(_0x245a0d)+']\x20'+_0x3794f2;}function a1_0x46dc(){var _0x1c3cee=['538777cWZNNj','2441958rILkhM','7dpaIOE','345480kWtgFZ','6910jxiezx','153Adjsht','darwin','macOS','length','info','[os=','MCP','11330sVNvJS','platform','3YfoyIP','3465184RTTSXY','error','834770yDCqKV','Linux','Unknown','25300AYejpk','Windows'];a1_0x46dc=function(){return _0x1c3cee;};return a1_0x46dc();}export function logMcpStderr(_0x95e4fd,..._0x5b9036){var _0xa0ec25=a1_0x14162f;console[_0xa0ec25(0x73)](formatMcpLogMessage(_0x95e4fd),..._0x5b9036),logger[_0xa0ec25(0x82)](_0xa0ec25(0x84),_0x95e4fd,_0x5b9036[_0xa0ec25(0x81)]?{'args':_0x5b9036['map'](_0x30bb23=>String(_0x30bb23))}:undefined);}
var a1_0x144558=a1_0x2aa2;(function(_0x1c5d7b,_0xafa634){var _0x307f33=a1_0x2aa2,_0x1ff498=_0x1c5d7b();while(!![]){try{var _0x95e60b=-parseInt(_0x307f33(0x14c))/0x1+parseInt(_0x307f33(0x15c))/0x2+parseInt(_0x307f33(0x151))/0x3*(-parseInt(_0x307f33(0x150))/0x4)+-parseInt(_0x307f33(0x156))/0x5+-parseInt(_0x307f33(0x14f))/0x6*(-parseInt(_0x307f33(0x14d))/0x7)+parseInt(_0x307f33(0x15e))/0x8*(parseInt(_0x307f33(0x14b))/0x9)+parseInt(_0x307f33(0x153))/0xa;if(_0x95e60b===_0xafa634)break;else _0x1ff498['push'](_0x1ff498['shift']());}catch(_0x3368f5){_0x1ff498['push'](_0x1ff498['shift']());}}}(a1_0xb580,0x8c3d8));function a1_0x2aa2(_0x34332a,_0x260b67){_0x34332a=_0x34332a-0x14b;var _0xb580c=a1_0xb580();var _0x2aa24a=_0xb580c[_0x34332a];return _0x2aa24a;}import a1_0x3df17b from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x637548=a1_0x3df17b['platform']()){var _0x1b50c1=a1_0x2aa2;switch(_0x637548){case'darwin':return _0x1b50c1(0x158);case _0x1b50c1(0x154):return _0x1b50c1(0x15a);case _0x1b50c1(0x15d):return _0x1b50c1(0x157);default:return'Unknown';}}export function formatMcpLogMessage(_0x4904ba,_0x224533=a1_0x3df17b[a1_0x144558(0x155)]()){return'[os='+getOperatingSystemType(_0x224533)+']\x20'+_0x4904ba;}export function logMcpStderr(_0x2ce46d,..._0x1f25ba){var _0x1ca646=a1_0x144558;console[_0x1ca646(0x152)](formatMcpLogMessage(_0x2ce46d),..._0x1f25ba),logger[_0x1ca646(0x15b)](_0x1ca646(0x14e),_0x2ce46d,_0x1f25ba[_0x1ca646(0x159)]?{'args':_0x1f25ba['map'](_0x420ca5=>String(_0x420ca5))}:undefined);}function a1_0xb580(){var _0x17460f=['MCP','6751314pRsXor','77416zhNmxp','45MhwmNG','error','3217300wibDQj','win32','platform','331420fAacHM','Linux','macOS','length','Windows','info','535224gZXZiC','linux','1492880UJFwBD','9qrFXAO','970153KAIhbh','7jwryBY'];a1_0xb580=function(){return _0x17460f;};return a1_0xb580();}

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

function a2_0x14ef(){const _0x2a2494=['1WTSDqT','63NSPhEB','toUpperCase','error','6928OhQDaN','4298UTmsuW','isEnabled','1941366xfuHgU',']\x20[','enable','stringify','env','24047716cmyffe','834550ZTHxTp','enabled','debug','fileStream','3118095TbIoge','warn','12brxwqT','_log','1154434bjDeGr','MORPH_LOG_FILE','MORPH_DEBUG','write','508884HjSCGe','info'];a2_0x14ef=function(){return _0x2a2494;};return a2_0x14ef();}const a2_0x412cae=a2_0x54fd;(function(_0x5678b3,_0x3540d8){const _0x517885=a2_0x54fd,_0x9d9109=_0x5678b3();while(!![]){try{const _0x3dbc8b=parseInt(_0x517885(0xb8))/0x1*(parseInt(_0x517885(0xb2))/0x2)+parseInt(_0x517885(0xb0))/0x3*(parseInt(_0x517885(0xb6))/0x4)+parseInt(_0x517885(0xae))/0x5+-parseInt(_0x517885(0xbf))/0x6+-parseInt(_0x517885(0xbd))/0x7*(-parseInt(_0x517885(0xbc))/0x8)+-parseInt(_0x517885(0xb9))/0x9*(-parseInt(_0x517885(0xaa))/0xa)+-parseInt(_0x517885(0xc4))/0xb;if(_0x3dbc8b===_0x3540d8)break;else _0x9d9109['push'](_0x9d9109['shift']());}catch(_0x28e704){_0x9d9109['push'](_0x9d9109['shift']());}}}(a2_0x14ef,0x4d208));import{createWriteStream}from'fs';function a2_0x54fd(_0x37b61f,_0x34a80b){_0x37b61f=_0x37b61f-0xaa;const _0x14ef34=a2_0x14ef();let _0x54fdfc=_0x14ef34[_0x37b61f];return _0x54fdfc;}class MorphLogger{[a2_0x412cae(0xab)];['fileStream'];constructor(){const _0xda4fa3=a2_0x412cae;this[_0xda4fa3(0xab)]=process[_0xda4fa3(0xc3)][_0xda4fa3(0xb4)]==='1'||!!process[_0xda4fa3(0xc3)][_0xda4fa3(0xb3)];const _0x2f3e05=process[_0xda4fa3(0xc3)][_0xda4fa3(0xb3)];this[_0xda4fa3(0xad)]=_0x2f3e05?createWriteStream(_0x2f3e05,{'flags':'a'}):null;}['debug'](_0x3b90d6,_0x3eae38,_0xb44cb8){const _0x578af7=a2_0x412cae;this[_0x578af7(0xb1)](_0x578af7(0xac),_0x3b90d6,_0x3eae38,_0xb44cb8);}[a2_0x412cae(0xb7)](_0x2cae50,_0x11b4aa,_0x3045ef){const _0x2504d=a2_0x412cae;this['_log'](_0x2504d(0xb7),_0x2cae50,_0x11b4aa,_0x3045ef);}[a2_0x412cae(0xaf)](_0x55407d,_0x20fcef,_0x45bd8e){const _0xf712c5=a2_0x412cae;this['_log'](_0xf712c5(0xaf),_0x55407d,_0x20fcef,_0x45bd8e);}[a2_0x412cae(0xbb)](_0x211ebd,_0xb6564f,_0x152ced){const _0x480e72=a2_0x412cae;this[_0x480e72(0xb1)](_0x480e72(0xbb),_0x211ebd,_0xb6564f,_0x152ced);}[a2_0x412cae(0xc1)](){const _0x1fa57c=a2_0x412cae;this[_0x1fa57c(0xab)]=!![];}get[a2_0x412cae(0xbe)](){return this['enabled'];}[a2_0x412cae(0xb1)](_0x5f0756,_0x4c3fe9,_0x5e742a,_0x472ac9){const _0x2ac966=a2_0x412cae;if(_0x5f0756!=='error'&&!this[_0x2ac966(0xab)])return;const _0x4484ef=new Date()['toISOString'](),_0x21bb51='['+_0x4484ef+_0x2ac966(0xc0)+_0x5f0756[_0x2ac966(0xba)]()+_0x2ac966(0xc0)+_0x4c3fe9+']';console[_0x2ac966(0xbb)](_0x472ac9?_0x21bb51+'\x20'+_0x5e742a+'\x20'+JSON[_0x2ac966(0xc2)](_0x472ac9):_0x21bb51+'\x20'+_0x5e742a),this[_0x2ac966(0xad)]?.[_0x2ac966(0xb5)](JSON[_0x2ac966(0xc2)]({'ts':_0x4484ef,'level':_0x5f0756,'component':_0x4c3fe9,'msg':_0x5e742a,..._0x472ac9&&{'data':_0x472ac9}})+'\x0a');}}export const logger=new MorphLogger();
function a2_0x4a0a(_0x4fbb5b,_0x296cc1){_0x4fbb5b=_0x4fbb5b-0x140;const _0x4f7219=a2_0x4f72();let _0x4a0a14=_0x4f7219[_0x4fbb5b];return _0x4a0a14;}const a2_0x10925a=a2_0x4a0a;(function(_0x2854e2,_0x5150a5){const _0x2bd8f2=a2_0x4a0a,_0x250f24=_0x2854e2();while(!![]){try{const _0x55f75e=-parseInt(_0x2bd8f2(0x153))/0x1+parseInt(_0x2bd8f2(0x14d))/0x2+parseInt(_0x2bd8f2(0x154))/0x3*(parseInt(_0x2bd8f2(0x14e))/0x4)+parseInt(_0x2bd8f2(0x152))/0x5+-parseInt(_0x2bd8f2(0x157))/0x6+parseInt(_0x2bd8f2(0x148))/0x7*(-parseInt(_0x2bd8f2(0x147))/0x8)+-parseInt(_0x2bd8f2(0x151))/0x9*(-parseInt(_0x2bd8f2(0x155))/0xa);if(_0x55f75e===_0x5150a5)break;else _0x250f24['push'](_0x250f24['shift']());}catch(_0x35e288){_0x250f24['push'](_0x250f24['shift']());}}}(a2_0x4f72,0x9a553));function a2_0x4f72(){const _0x16e255=['toISOString','fileStream',']\x20[','debug','5440RVOEVI','4179kferBq','warn','enabled','stringify','toUpperCase','1584624WyFJPU','1320INTOkc','env','info','9TLqvLV','1761150gUOFjI','911175JVjNuP','7347eQnOke','9375830uoKXsu','enable','5646078MGscHU','error','MORPH_DEBUG','MORPH_LOG_FILE','_log'];a2_0x4f72=function(){return _0x16e255;};return a2_0x4f72();}import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0x10925a(0x144)];constructor(){const _0x24409a=a2_0x10925a;this['enabled']=process[_0x24409a(0x14f)][_0x24409a(0x140)]==='1'||!!process[_0x24409a(0x14f)][_0x24409a(0x141)];const _0x5a5973=process[_0x24409a(0x14f)]['MORPH_LOG_FILE'];this[_0x24409a(0x144)]=_0x5a5973?createWriteStream(_0x5a5973,{'flags':'a'}):null;}[a2_0x10925a(0x146)](_0x5860d4,_0x59af30,_0x484170){const _0x1aa8ad=a2_0x10925a;this['_log'](_0x1aa8ad(0x146),_0x5860d4,_0x59af30,_0x484170);}[a2_0x10925a(0x150)](_0x1dfb47,_0x4c2276,_0xa3eeeb){const _0x2ae03f=a2_0x10925a;this[_0x2ae03f(0x142)](_0x2ae03f(0x150),_0x1dfb47,_0x4c2276,_0xa3eeeb);}['warn'](_0x1eba7f,_0x2e1294,_0x54a6c0){const _0x479d93=a2_0x10925a;this[_0x479d93(0x142)](_0x479d93(0x149),_0x1eba7f,_0x2e1294,_0x54a6c0);}[a2_0x10925a(0x158)](_0x2be30a,_0x1d8717,_0x4a0074){const _0x5a4824=a2_0x10925a;this[_0x5a4824(0x142)](_0x5a4824(0x158),_0x2be30a,_0x1d8717,_0x4a0074);}[a2_0x10925a(0x156)](){const _0x53be0b=a2_0x10925a;this[_0x53be0b(0x14a)]=!![];}get['isEnabled'](){const _0x26674d=a2_0x10925a;return this[_0x26674d(0x14a)];}['_log'](_0x3600a0,_0x35c607,_0xca7f4c,_0x8c6bd4){const _0x397c61=a2_0x10925a;if(_0x3600a0!==_0x397c61(0x158)&&!this[_0x397c61(0x14a)])return;const _0x38eb0b=new Date()[_0x397c61(0x143)](),_0x1323cc='['+_0x38eb0b+_0x397c61(0x145)+_0x3600a0[_0x397c61(0x14c)]()+_0x397c61(0x145)+_0x35c607+']';console[_0x397c61(0x158)](_0x8c6bd4?_0x1323cc+'\x20'+_0xca7f4c+'\x20'+JSON[_0x397c61(0x14b)](_0x8c6bd4):_0x1323cc+'\x20'+_0xca7f4c),this['fileStream']?.['write'](JSON[_0x397c61(0x14b)]({'ts':_0x38eb0b,'level':_0x3600a0,'component':_0x35c607,'msg':_0xca7f4c,..._0x8c6bd4&&{'data':_0x8c6bd4}})+'\x0a');}}export const logger=new MorphLogger();

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

(function(_0x15a3fd,_0x1aa299){const _0x296ac5=a3_0x3639,_0x197a93=_0x15a3fd();while(!![]){try{const _0x258abe=-parseInt(_0x296ac5(0x6f))/0x1+parseInt(_0x296ac5(0x73))/0x2*(-parseInt(_0x296ac5(0x6b))/0x3)+-parseInt(_0x296ac5(0x6c))/0x4*(-parseInt(_0x296ac5(0x78))/0x5)+parseInt(_0x296ac5(0x66))/0x6*(-parseInt(_0x296ac5(0x65))/0x7)+-parseInt(_0x296ac5(0x75))/0x8+parseInt(_0x296ac5(0x69))/0x9*(parseInt(_0x296ac5(0x70))/0xa)+parseInt(_0x296ac5(0x72))/0xb;if(_0x258abe===_0x1aa299)break;else _0x197a93['push'](_0x197a93['shift']());}catch(_0x387153){_0x197a93['push'](_0x197a93['shift']());}}}(a3_0x45fe,0x5dbb2));function a3_0x3639(_0x29c628,_0x1517dc){_0x29c628=_0x29c628-0x64;const _0x45fed9=a3_0x45fe();let _0x363925=_0x45fed9[_0x29c628];return _0x363925;}import a3_0x51aee4 from'path';import a3_0x469a8c from'os';export function convertToWindowsPath(_0x28e1e6){const _0x359f2b=a3_0x3639;if(_0x28e1e6['startsWith'](_0x359f2b(0x64))){const _0x3d06e=_0x28e1e6[_0x359f2b(0x74)](0x5)[_0x359f2b(0x67)](),_0x18f1cc=_0x28e1e6[_0x359f2b(0x71)](0x6)[_0x359f2b(0x68)](/\//g,'\x5c');return _0x3d06e+':'+_0x18f1cc;}if(_0x28e1e6[_0x359f2b(0x77)](/^\/[a-zA-Z]\//)){const _0x93cb02=_0x28e1e6[_0x359f2b(0x74)](0x1)['toUpperCase'](),_0x4354c5=_0x28e1e6[_0x359f2b(0x71)](0x2)['replace'](/\//g,'\x5c');return _0x93cb02+':'+_0x4354c5;}if(_0x28e1e6[_0x359f2b(0x77)](/^[a-zA-Z]:/))return _0x28e1e6[_0x359f2b(0x68)](/\//g,'\x5c');return _0x28e1e6;}export function normalizePath(_0x24f235){const _0x4b1c37=a3_0x3639;_0x24f235=_0x24f235[_0x4b1c37(0x76)]()[_0x4b1c37(0x68)](/^["']|["']$/g,'');const _0x51aa4c=_0x24f235['startsWith']('/')&&!_0x24f235[_0x4b1c37(0x77)](/^\/mnt\/[a-z]\//i)&&!_0x24f235[_0x4b1c37(0x77)](/^\/[a-zA-Z]\//);if(_0x51aa4c)return _0x24f235['replace'](/\/+/g,'/')[_0x4b1c37(0x68)](/\/+$/,'');_0x24f235=convertToWindowsPath(_0x24f235);if(_0x24f235[_0x4b1c37(0x6d)]('\x5c\x5c')){let _0x135fee=_0x24f235;_0x135fee=_0x135fee[_0x4b1c37(0x68)](/^\\{2,}/,'\x5c\x5c');const _0xd4c412=_0x135fee[_0x4b1c37(0x79)](0x2)[_0x4b1c37(0x68)](/\\\\/g,'\x5c');_0x24f235='\x5c\x5c'+_0xd4c412;}else _0x24f235=_0x24f235[_0x4b1c37(0x68)](/\\\\/g,'\x5c');let _0x11272f=a3_0x51aee4['normalize'](_0x24f235);_0x24f235[_0x4b1c37(0x6d)]('\x5c\x5c')&&!_0x11272f[_0x4b1c37(0x6d)]('\x5c\x5c')&&(_0x11272f='\x5c'+_0x11272f);if(_0x11272f[_0x4b1c37(0x77)](/^[a-zA-Z]:/)){let _0x922950=_0x11272f['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x4b1c37(0x6e)](_0x922950)&&(_0x922950=_0x922950[_0x4b1c37(0x74)](0x0)['toUpperCase']()+_0x922950[_0x4b1c37(0x71)](0x1)),_0x922950;}return _0x11272f['replace'](/\//g,'\x5c');}export function expandHome(_0x5dca1d){const _0x279e61=a3_0x3639;if(_0x5dca1d[_0x279e61(0x6d)]('~/')||_0x5dca1d==='~')return a3_0x51aee4[_0x279e61(0x6a)](a3_0x469a8c['homedir'](),_0x5dca1d[_0x279e61(0x71)](0x1));return _0x5dca1d;}function a3_0x45fe(){const _0x166f4f=['charAt','734464KELybu','trim','match','5nmnBWq','substring','/mnt/','336MfbiwS','65424GJliwU','toUpperCase','replace','9qsRMjN','join','844161AURwki','616876agxReA','startsWith','test','317294ILiIau','2739650KNfDiw','slice','12865809wIUnWO','2OhFVZw'];a3_0x45fe=function(){return _0x166f4f;};return a3_0x45fe();}
(function(_0x38ba32,_0x396db9){const _0x494d06=a3_0x570e,_0x18658a=_0x38ba32();while(!![]){try{const _0x2d44f7=-parseInt(_0x494d06(0xa1))/0x1+parseInt(_0x494d06(0x96))/0x2+-parseInt(_0x494d06(0x99))/0x3+parseInt(_0x494d06(0x9d))/0x4+-parseInt(_0x494d06(0xa6))/0x5*(parseInt(_0x494d06(0xa2))/0x6)+parseInt(_0x494d06(0x9a))/0x7+-parseInt(_0x494d06(0x9e))/0x8*(-parseInt(_0x494d06(0x95))/0x9);if(_0x2d44f7===_0x396db9)break;else _0x18658a['push'](_0x18658a['shift']());}catch(_0x14b44e){_0x18658a['push'](_0x18658a['shift']());}}}(a3_0x48bf,0xae490));function a3_0x570e(_0x383dad,_0x6cf6b){_0x383dad=_0x383dad-0x95;const _0x48bfa2=a3_0x48bf();let _0x570ea2=_0x48bfa2[_0x383dad];return _0x570ea2;}import a3_0x4fc87b from'path';import a3_0x31372e from'os';export function convertToWindowsPath(_0x3a22cc){const _0x38ac21=a3_0x570e;if(_0x3a22cc['startsWith']('/mnt/')){const _0x2ce60d=_0x3a22cc[_0x38ac21(0x9b)](0x5)[_0x38ac21(0xa3)](),_0x49b037=_0x3a22cc['slice'](0x6)[_0x38ac21(0x97)](/\//g,'\x5c');return _0x2ce60d+':'+_0x49b037;}if(_0x3a22cc[_0x38ac21(0xa4)](/^\/[a-zA-Z]\//)){const _0x2c11c8=_0x3a22cc[_0x38ac21(0x9b)](0x1)[_0x38ac21(0xa3)](),_0x116e0c=_0x3a22cc['slice'](0x2)[_0x38ac21(0x97)](/\//g,'\x5c');return _0x2c11c8+':'+_0x116e0c;}if(_0x3a22cc[_0x38ac21(0xa4)](/^[a-zA-Z]:/))return _0x3a22cc[_0x38ac21(0x97)](/\//g,'\x5c');return _0x3a22cc;}export function normalizePath(_0x4f2b9c){const _0x5c3c57=a3_0x570e;_0x4f2b9c=_0x4f2b9c[_0x5c3c57(0xa5)]()['replace'](/^["']|["']$/g,'');const _0xccef89=_0x4f2b9c[_0x5c3c57(0x9f)]('/')&&!_0x4f2b9c[_0x5c3c57(0xa4)](/^\/mnt\/[a-z]\//i)&&!_0x4f2b9c['match'](/^\/[a-zA-Z]\//);if(_0xccef89)return _0x4f2b9c[_0x5c3c57(0x97)](/\/+/g,'/')[_0x5c3c57(0x97)](/\/+$/,'');_0x4f2b9c=convertToWindowsPath(_0x4f2b9c);if(_0x4f2b9c[_0x5c3c57(0x9f)]('\x5c\x5c')){let _0x18e48c=_0x4f2b9c;_0x18e48c=_0x18e48c[_0x5c3c57(0x97)](/^\\{2,}/,'\x5c\x5c');const _0x28fae0=_0x18e48c['substring'](0x2)['replace'](/\\\\/g,'\x5c');_0x4f2b9c='\x5c\x5c'+_0x28fae0;}else _0x4f2b9c=_0x4f2b9c['replace'](/\\\\/g,'\x5c');let _0x5da78b=a3_0x4fc87b[_0x5c3c57(0x9c)](_0x4f2b9c);_0x4f2b9c['startsWith']('\x5c\x5c')&&!_0x5da78b[_0x5c3c57(0x9f)]('\x5c\x5c')&&(_0x5da78b='\x5c'+_0x5da78b);if(_0x5da78b['match'](/^[a-zA-Z]:/)){let _0xe830b3=_0x5da78b[_0x5c3c57(0x97)](/\//g,'\x5c');return/^[a-z]:/[_0x5c3c57(0x98)](_0xe830b3)&&(_0xe830b3=_0xe830b3['charAt'](0x0)[_0x5c3c57(0xa3)]()+_0xe830b3[_0x5c3c57(0xa7)](0x1)),_0xe830b3;}return _0x5da78b[_0x5c3c57(0x97)](/\//g,'\x5c');}export function expandHome(_0x5170d5){const _0x5118a1=a3_0x570e;if(_0x5170d5[_0x5118a1(0x9f)]('~/')||_0x5170d5==='~')return a3_0x4fc87b[_0x5118a1(0xa0)](a3_0x31372e['homedir'](),_0x5170d5['slice'](0x1));return _0x5170d5;}function a3_0x48bf(){const _0xde3b85=['5OQGOgl','slice','18435969hPbcEw','1811450HwajUn','replace','test','4250400pArNJT','3302306SzLgdf','charAt','normalize','2352904HIZznr','8sdQckg','startsWith','join','767554HQsKDP','6695544lIlZZc','toUpperCase','match','trim'];a3_0x48bf=function(){return _0xde3b85;};return a3_0x48bf();}

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

(function(_0xc56a2c,_0x5c1286){const _0x3e0e7b=a4_0x3ace,_0x278a9f=_0xc56a2c();while(!![]){try{const _0x19a658=parseInt(_0x3e0e7b(0x127))/0x1+-parseInt(_0x3e0e7b(0x121))/0x2+-parseInt(_0x3e0e7b(0x12a))/0x3+-parseInt(_0x3e0e7b(0x124))/0x4+-parseInt(_0x3e0e7b(0x128))/0x5+-parseInt(_0x3e0e7b(0x12f))/0x6+parseInt(_0x3e0e7b(0x12c))/0x7*(parseInt(_0x3e0e7b(0x125))/0x8);if(_0x19a658===_0x5c1286)break;else _0x278a9f['push'](_0x278a9f['shift']());}catch(_0x4c3a05){_0x278a9f['push'](_0x278a9f['shift']());}}}(a4_0x33b2,0xd83c6));function a4_0x3ace(_0x24d1d1,_0x4621e3){_0x24d1d1=_0x24d1d1-0x11e;const _0x33b201=a4_0x33b2();let _0x3ace13=_0x33b201[_0x24d1d1];return _0x3ace13;}import a4_0x4a1cd4 from'path';function a4_0x33b2(){const _0x487d5c=['startsWith','includes','594452CSPuHz','40adDFeE','isArray','1262292jMDBEn','3119855ivWbWZ','Path\x20must\x20be\x20absolute\x20after\x20normalization','2529699XydWlh','resolve','3616991urihlN','some','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','1889034eluZJZ','isAbsolute','sep','length','normalize','string','2058998XcIjTy'];a4_0x33b2=function(){return _0x487d5c;};return a4_0x33b2();}export function isPathWithinAllowedDirectories(_0x4ad033,_0x2b604a){const _0xaa7a=a4_0x3ace;if(typeof _0x4ad033!==_0xaa7a(0x120)||!Array[_0xaa7a(0x126)](_0x2b604a))return![];if(!_0x4ad033||_0x2b604a[_0xaa7a(0x11e)]===0x0)return![];if(_0x4ad033[_0xaa7a(0x123)]('\x00'))return![];let _0x1ecb5e;try{_0x1ecb5e=a4_0x4a1cd4[_0xaa7a(0x12b)](a4_0x4a1cd4[_0xaa7a(0x11f)](_0x4ad033));}catch{return![];}if(!a4_0x4a1cd4[_0xaa7a(0x130)](_0x1ecb5e))throw new Error(_0xaa7a(0x129));return _0x2b604a[_0xaa7a(0x12d)](_0x21179b=>{const _0x57f04e=_0xaa7a;if(typeof _0x21179b!==_0x57f04e(0x120)||!_0x21179b)return![];if(_0x21179b[_0x57f04e(0x123)]('\x00'))return![];let _0x3968f2;try{_0x3968f2=a4_0x4a1cd4[_0x57f04e(0x12b)](a4_0x4a1cd4['normalize'](_0x21179b));}catch{return![];}if(!a4_0x4a1cd4[_0x57f04e(0x130)](_0x3968f2))throw new Error(_0x57f04e(0x12e));if(_0x1ecb5e===_0x3968f2)return!![];if(_0x3968f2===a4_0x4a1cd4['sep'])return _0x1ecb5e[_0x57f04e(0x122)](a4_0x4a1cd4[_0x57f04e(0x131)]);return _0x1ecb5e[_0x57f04e(0x122)](_0x3968f2+a4_0x4a1cd4[_0x57f04e(0x131)]);});}
(function(_0x44d4a6,_0x239c07){const _0x4a89d6=a4_0x4044,_0x45a028=_0x44d4a6();while(!![]){try{const _0xab00d5=parseInt(_0x4a89d6(0x10e))/0x1+parseInt(_0x4a89d6(0x10d))/0x2*(parseInt(_0x4a89d6(0x109))/0x3)+parseInt(_0x4a89d6(0x113))/0x4+parseInt(_0x4a89d6(0x115))/0x5*(parseInt(_0x4a89d6(0x10f))/0x6)+parseInt(_0x4a89d6(0x104))/0x7*(-parseInt(_0x4a89d6(0x108))/0x8)+-parseInt(_0x4a89d6(0x111))/0x9*(-parseInt(_0x4a89d6(0x10c))/0xa)+-parseInt(_0x4a89d6(0x105))/0xb;if(_0xab00d5===_0x239c07)break;else _0x45a028['push'](_0x45a028['shift']());}catch(_0x45f071){_0x45a028['push'](_0x45a028['shift']());}}}(a4_0x2de3,0x94f16));import a4_0x18f966 from'path';export function isPathWithinAllowedDirectories(_0x2dd783,_0x21fcc9){const _0x5c76f9=a4_0x4044;if(typeof _0x2dd783!=='string'||!Array[_0x5c76f9(0x10b)](_0x21fcc9))return![];if(!_0x2dd783||_0x21fcc9[_0x5c76f9(0x110)]===0x0)return![];if(_0x2dd783[_0x5c76f9(0x103)]('\x00'))return![];let _0x16ae00;try{_0x16ae00=a4_0x18f966[_0x5c76f9(0x10a)](a4_0x18f966['normalize'](_0x2dd783));}catch{return![];}if(!a4_0x18f966[_0x5c76f9(0x107)](_0x16ae00))throw new Error(_0x5c76f9(0x112));return _0x21fcc9[_0x5c76f9(0x114)](_0x5f42de=>{const _0x54ed39=_0x5c76f9;if(typeof _0x5f42de!=='string'||!_0x5f42de)return![];if(_0x5f42de[_0x54ed39(0x103)]('\x00'))return![];let _0x30a9ad;try{_0x30a9ad=a4_0x18f966[_0x54ed39(0x10a)](a4_0x18f966['normalize'](_0x5f42de));}catch{return![];}if(!a4_0x18f966['isAbsolute'](_0x30a9ad))throw new Error(_0x54ed39(0x106));if(_0x16ae00===_0x30a9ad)return!![];if(_0x30a9ad===a4_0x18f966['sep'])return _0x16ae00[_0x54ed39(0x102)](a4_0x18f966[_0x54ed39(0x101)]);return _0x16ae00[_0x54ed39(0x102)](_0x30a9ad+a4_0x18f966[_0x54ed39(0x101)]);});}function a4_0x4044(_0x4e2791,_0x50fcb6){_0x4e2791=_0x4e2791-0x101;const _0x2de382=a4_0x2de3();let _0x40440=_0x2de382[_0x4e2791];return _0x40440;}function a4_0x2de3(){const _0x5cb1bd=['includes','7LQjWWy','12816760dgyMNB','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute','1024056XjcNCO','12EEBfdu','resolve','isArray','6965690pHTPcu','46390sDzwJd','30782hIQrIg','35202GkdXhs','length','9giyjkk','Path\x20must\x20be\x20absolute\x20after\x20normalization','3440640UOLuwo','some','190MLxFHd','sep','startsWith'];a4_0x2de3=function(){return _0x5cb1bd;};return a4_0x2de3();}

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

(function(_0x4783da,_0x1c4ed2){const _0x22c928=a5_0x5dbf,_0x7a3cd6=_0x4783da();while(!![]){try{const _0x380c09=parseInt(_0x22c928(0x98))/0x1*(parseInt(_0x22c928(0x9b))/0x2)+parseInt(_0x22c928(0x91))/0x3*(-parseInt(_0x22c928(0x8c))/0x4)+parseInt(_0x22c928(0xa0))/0x5*(-parseInt(_0x22c928(0x93))/0x6)+parseInt(_0x22c928(0x9c))/0x7*(parseInt(_0x22c928(0x9a))/0x8)+parseInt(_0x22c928(0x9f))/0x9+parseInt(_0x22c928(0x94))/0xa*(-parseInt(_0x22c928(0x96))/0xb)+-parseInt(_0x22c928(0xa1))/0xc;if(_0x380c09===_0x1c4ed2)break;else _0x7a3cd6['push'](_0x7a3cd6['shift']());}catch(_0x3c984d){_0x7a3cd6['push'](_0x7a3cd6['shift']());}}}(a5_0x2f6f,0xe04ec));import{promises as a5_0x2cf053}from'fs';function a5_0x5dbf(_0x37464c,_0x3fe048){_0x37464c=_0x37464c-0x8a;const _0x2f6f4c=a5_0x2f6f();let _0x5dbf39=_0x2f6f4c[_0x37464c];return _0x5dbf39;}import a5_0x38ed9d from'path';function a5_0x2f6f(){const _0x4a6357=['2064PvVVuj','2gHkgEH','43393JDjivf','resolve','isDirectory','13859154MvZvzX','20bTUcGO','14778348NWapwF','realpath','Skipping\x20invalid\x20directory:\x20','invalid\x20path\x20or\x20inaccessible','stat','3520lzGMzk','slice','push','uri','join','1041QiAeim','message','1694724JLspox','310CtCsHu','startsWith','78298fbHIwH','Skipping\x20','666879YcdZqi','file://'];a5_0x2f6f=function(){return _0x4a6357;};return a5_0x2f6f();}import a5_0x262723 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x6ef63d){const _0x3c86b4=a5_0x5dbf;try{const _0x1b6a0a=_0x6ef63d[_0x3c86b4(0x95)](_0x3c86b4(0x99))?_0x6ef63d['slice'](0x7):_0x6ef63d,_0x4c48d4=_0x1b6a0a[_0x3c86b4(0x95)]('~/')||_0x1b6a0a==='~'?a5_0x38ed9d[_0x3c86b4(0x90)](a5_0x262723['homedir'](),_0x1b6a0a[_0x3c86b4(0x8d)](0x1)):_0x1b6a0a,_0xda8079=a5_0x38ed9d[_0x3c86b4(0x9d)](_0x4c48d4),_0x595796=await a5_0x2cf053[_0x3c86b4(0xa2)](_0xda8079);return normalizePath(_0x595796);}catch{return null;}}function formatDirectoryError(_0x113101,_0x522bb0,_0x3e93cc){const _0x44d2a3=a5_0x5dbf;if(_0x3e93cc)return _0x44d2a3(0x97)+_0x3e93cc+':\x20'+_0x113101;const _0x919858=_0x522bb0 instanceof Error?_0x522bb0[_0x44d2a3(0x92)]:String(_0x522bb0);return _0x44d2a3(0xa3)+_0x113101+'\x20due\x20to\x20error:\x20'+_0x919858;}export async function getValidRootDirectories(_0x400539){const _0x1545d=a5_0x5dbf,_0x4e0063=[];for(const _0x4345c7 of _0x400539){const _0x50d16c=await parseRootUri(_0x4345c7['uri']);if(!_0x50d16c){logMcpStderr(formatDirectoryError(_0x4345c7[_0x1545d(0x8f)],undefined,_0x1545d(0x8a)));continue;}try{const _0x4e5ca6=await a5_0x2cf053[_0x1545d(0x8b)](_0x50d16c);_0x4e5ca6[_0x1545d(0x9e)]()?_0x4e0063[_0x1545d(0x8e)](_0x50d16c):logMcpStderr(formatDirectoryError(_0x50d16c,undefined,'non-directory\x20root'));}catch(_0x1ac2bd){logMcpStderr(formatDirectoryError(_0x50d16c,_0x1ac2bd));}}return _0x4e0063;}
(function(_0x24c67d,_0x5a37b2){const _0x2869fd=a5_0x3866,_0x39ac81=_0x24c67d();while(!![]){try{const _0x30b305=-parseInt(_0x2869fd(0x10e))/0x1+parseInt(_0x2869fd(0x11d))/0x2*(-parseInt(_0x2869fd(0x10b))/0x3)+-parseInt(_0x2869fd(0x107))/0x4*(-parseInt(_0x2869fd(0x10d))/0x5)+-parseInt(_0x2869fd(0x11b))/0x6+parseInt(_0x2869fd(0x10c))/0x7*(parseInt(_0x2869fd(0x114))/0x8)+-parseInt(_0x2869fd(0x106))/0x9+-parseInt(_0x2869fd(0x11e))/0xa*(-parseInt(_0x2869fd(0x112))/0xb);if(_0x30b305===_0x5a37b2)break;else _0x39ac81['push'](_0x39ac81['shift']());}catch(_0x505c0b){_0x39ac81['push'](_0x39ac81['shift']());}}}(a5_0x3778,0xeea45));import{promises as a5_0x1adc2d}from'fs';import a5_0x3d8a44 from'path';import a5_0x552569 from'os';function a5_0x3866(_0x310679,_0x25c23a){_0x310679=_0x310679-0x106;const _0x37784a=a5_0x3778();let _0x38669b=_0x37784a[_0x310679];return _0x38669b;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x1130e0){const _0x20e210=a5_0x3866;try{const _0x5dcb2a=_0x1130e0[_0x20e210(0x117)](_0x20e210(0x10f))?_0x1130e0[_0x20e210(0x119)](0x7):_0x1130e0,_0x5eb71a=_0x5dcb2a['startsWith']('~/')||_0x5dcb2a==='~'?a5_0x3d8a44['join'](a5_0x552569[_0x20e210(0x11c)](),_0x5dcb2a[_0x20e210(0x119)](0x1)):_0x5dcb2a,_0x401131=a5_0x3d8a44['resolve'](_0x5eb71a),_0x41ebf7=await a5_0x1adc2d[_0x20e210(0x116)](_0x401131);return normalizePath(_0x41ebf7);}catch{return null;}}function formatDirectoryError(_0x474e6d,_0x389f05,_0x2e8eae){const _0x4a798f=a5_0x3866;if(_0x2e8eae)return _0x4a798f(0x113)+_0x2e8eae+':\x20'+_0x474e6d;const _0x3b21ec=_0x389f05 instanceof Error?_0x389f05[_0x4a798f(0x11a)]:String(_0x389f05);return _0x4a798f(0x10a)+_0x474e6d+_0x4a798f(0x108)+_0x3b21ec;}function a5_0x3778(){const _0x88318a=['536374eqUkoj','file://','non-directory\x20root','uri','8076464HiOvMZ','Skipping\x20','26152UKbKvG','stat','realpath','startsWith','invalid\x20path\x20or\x20inaccessible','slice','message','5633394hENDOZ','homedir','8iJvhfK','40stsXFr','16999938luzJFm','4594588qzFEvA','\x20due\x20to\x20error:\x20','push','Skipping\x20invalid\x20directory:\x20','957804ekbSKR','3283xMpdHN','5bzBQTt'];a5_0x3778=function(){return _0x88318a;};return a5_0x3778();}export async function getValidRootDirectories(_0x2f74a0){const _0xed7f47=a5_0x3866,_0x456a1f=[];for(const _0x4de639 of _0x2f74a0){const _0x12cdbd=await parseRootUri(_0x4de639[_0xed7f47(0x111)]);if(!_0x12cdbd){logMcpStderr(formatDirectoryError(_0x4de639[_0xed7f47(0x111)],undefined,_0xed7f47(0x118)));continue;}try{const _0x923d76=await a5_0x1adc2d[_0xed7f47(0x115)](_0x12cdbd);_0x923d76['isDirectory']()?_0x456a1f[_0xed7f47(0x109)](_0x12cdbd):logMcpStderr(formatDirectoryError(_0x12cdbd,undefined,_0xed7f47(0x110)));}catch(_0x13e959){logMcpStderr(formatDirectoryError(_0x12cdbd,_0x13e959));}}return _0x456a1f;}

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

const a6_0x2b9c34=a6_0x1718;(function(_0x281d16,_0x55aba0){const _0x517849=a6_0x1718,_0x3d0172=_0x281d16();while(!![]){try{const _0x4a9447=parseInt(_0x517849(0x19b))/0x1*(parseInt(_0x517849(0x199))/0x2)+-parseInt(_0x517849(0x1a1))/0x3+-parseInt(_0x517849(0x19e))/0x4*(-parseInt(_0x517849(0x1a3))/0x5)+-parseInt(_0x517849(0x198))/0x6*(-parseInt(_0x517849(0x1a4))/0x7)+parseInt(_0x517849(0x19f))/0x8+parseInt(_0x517849(0x1a2))/0x9+-parseInt(_0x517849(0x197))/0xa*(parseInt(_0x517849(0x1a0))/0xb);if(_0x4a9447===_0x55aba0)break;else _0x3d0172['push'](_0x3d0172['shift']());}catch(_0x41ab8f){_0x3d0172['push'](_0x3d0172['shift']());}}}(a6_0x113e,0x47a8d));export const TOOL_NAMES={'EDIT_FILE':a6_0x2b9c34(0x19c),'CODEBASE_SEARCH':a6_0x2b9c34(0x19a),'GITHUB_CODEBASE_SEARCH':'github_codebase_search'};function a6_0x113e(){const _0x79f768=['1727VcqRdX','1249560PZVtRO','3591549NLvzsJ','30575iHImTK','7vJexTg','75880XpVcDv','1031736VteCje','694994QyxNpr','codebase_search','1UmVAsy','edit_file','values','268XWmEZS','4585072lBbuFS'];a6_0x113e=function(){return _0x79f768;};return a6_0x113e();}export const ALL_TOOL_NAMES=Object[a6_0x2b9c34(0x19d)](TOOL_NAMES);function a6_0x1718(_0x11134f,_0x4d674f){_0x11134f=_0x11134f-0x197;const _0x113e09=a6_0x113e();let _0x171867=_0x113e09[_0x11134f];return _0x171867;}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
const a6_0xf86421=a6_0x436a;function a6_0x436a(_0x1eeb75,_0x469b4d){_0x1eeb75=_0x1eeb75-0xa7;const _0x3b0d07=a6_0x3b0d();let _0x436a30=_0x3b0d07[_0x1eeb75];return _0x436a30;}(function(_0x73b749,_0x152f44){const _0xd8f950=a6_0x436a,_0x35f1c0=_0x73b749();while(!![]){try{const _0x3326c9=parseInt(_0xd8f950(0xb1))/0x1+parseInt(_0xd8f950(0xad))/0x2+parseInt(_0xd8f950(0xa9))/0x3*(parseInt(_0xd8f950(0xaa))/0x4)+parseInt(_0xd8f950(0xaf))/0x5+-parseInt(_0xd8f950(0xab))/0x6*(-parseInt(_0xd8f950(0xb2))/0x7)+parseInt(_0xd8f950(0xae))/0x8+parseInt(_0xd8f950(0xb4))/0x9*(-parseInt(_0xd8f950(0xa8))/0xa);if(_0x3326c9===_0x152f44)break;else _0x35f1c0['push'](_0x35f1c0['shift']());}catch(_0x1038bc){_0x35f1c0['push'](_0x35f1c0['shift']());}}}(a6_0x3b0d,0xc3aba));export const TOOL_NAMES={'EDIT_FILE':a6_0xf86421(0xb3),'CODEBASE_SEARCH':a6_0xf86421(0xb0),'GITHUB_CODEBASE_SEARCH':a6_0xf86421(0xa7)};function a6_0x3b0d(){const _0x1634ad=['45303250fBKDkH','159CtoCeM','66188CWbIGN','121938AzOJSP','values','737148IVnmCO','11895816VXEhWb','3085265KmYIrZ','codebase_search','783139TMygvv','413EBgwts','edit_file','9QtLhBJ','github_codebase_search'];a6_0x3b0d=function(){return _0x1634ad;};return a6_0x3b0d();}export const ALL_TOOL_NAMES=Object[a6_0xf86421(0xac)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
{
"name": "@morphllm/morphmcp",
"version": "0.8.181",
"version": "0.8.182",
"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.",

@@ -38,3 +38,3 @@ "license": "MIT",

"@modelcontextprotocol/sdk": "^1.12.3",
"@morphllm/morphsdk": "0.2.171",
"@morphllm/morphsdk": "0.2.172",
"@vscode/ripgrep": "^1.15.14",

@@ -41,0 +41,0 @@ "axios": "^1.6.0",