@morphllm/morphmcp 0.8.163 → 0.8.165

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const a0_0x43b56b=a0_0x1c30;(function(_0x189010,_0x75d701){const _0x6c0f88=a0_0x1c30,_0x390661=_0x189010();while(!![]){try{const _0x2c2d76=parseInt(_0x6c0f88(0x1e9))/0x1+-parseInt(_0x6c0f88(0x15f))/0x2*(-parseInt(_0x6c0f88(0x22d))/0x3)+parseInt(_0x6c0f88(0x215))/0x4*(-parseInt(_0x6c0f88(0x1b6))/0x5)+parseInt(_0x6c0f88(0x18c))/0x6*(-parseInt(_0x6c0f88(0x181))/0x7)+-parseInt(_0x6c0f88(0x1d5))/0x8*(-parseInt(_0x6c0f88(0x217))/0x9)+parseInt(_0x6c0f88(0x189))/0xa+parseInt(_0x6c0f88(0x1bf))/0xb*(-parseInt(_0x6c0f88(0x148))/0xc);if(_0x2c2d76===_0x75d701)break;else _0x390661['push'](_0x390661['shift']());}catch(_0x14a803){_0x390661['push'](_0x390661['shift']());}}}(a0_0x2b08,0x5cc89));function a0_0x1c30(_0x279a26,_0x224a88){_0x279a26=_0x279a26-0x10c;const _0x2b08e4=a0_0x2b08();let _0x1c306e=_0x2b08e4[_0x279a26];return _0x1c306e;}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_0x2f91f5 from'fs/promises';import a0_0x26b8c3 from'path';import a0_0x49f44b 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_0x10c885 from'axios';function fixPathRepetition(_0x36fbf0){const _0x4b40cd=a0_0x1c30,_0xe7b0f6=_0x36fbf0['split'](a0_0x26b8c3[_0x4b40cd(0x1be)])[_0x4b40cd(0x1e1)](Boolean);if(_0xe7b0f6[_0x4b40cd(0x198)]<0x2)return null;for(let _0x4e90d6=Math[_0x4b40cd(0x185)](_0xe7b0f6['length']/0x2);_0x4e90d6>=0x1;_0x4e90d6--){for(let _0x4886ba=0x0;_0x4886ba<=_0xe7b0f6['length']-0x2*_0x4e90d6;_0x4886ba++){const _0x38bebb=_0xe7b0f6[_0x4b40cd(0x1ca)](_0x4886ba,_0x4886ba+_0x4e90d6),_0x1240a2=_0xe7b0f6[_0x4b40cd(0x1ca)](_0x4886ba+_0x4e90d6,_0x4886ba+0x2*_0x4e90d6);if(_0x38bebb[_0x4b40cd(0x221)]((_0x3dfb25,_0x13cec6)=>_0x3dfb25===_0x1240a2[_0x13cec6])){const _0x47c9ce=[..._0xe7b0f6['slice'](0x0,_0x4886ba),..._0xe7b0f6[_0x4b40cd(0x1ca)](_0x4886ba+_0x4e90d6)];return a0_0x26b8c3['sep']+_0x47c9ce[_0x4b40cd(0x1eb)](a0_0x26b8c3[_0x4b40cd(0x1be)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x1cef48=a0_0x1c30;try{const _0x196eaa=require(_0x1cef48(0x1f8));return _0x196eaa[_0x1cef48(0x154)]??_0x1cef48(0x1d2);}catch(_0x42347c){return logMcpStderr(_0x1cef48(0x150),_0x42347c),_0x1cef48(0x1d2);}}function printHelp(){const _0x39a4ce=a0_0x1c30;console[_0x39a4ce(0x1fe)]('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x39a4ce(0x1fe)]('\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]'),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x1c9)),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x127)),console['log'](_0x39a4ce(0x133)),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x239)),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x1bc)),console[_0x39a4ce(0x1fe)]('\x20\x20morph-mcp'),console[_0x39a4ce(0x1fe)](_0x39a4ce(0x223));}const cliArgs=process[a0_0x43b56b(0x1cf)][a0_0x43b56b(0x1ca)](0x2),VERSION_FLAGS=new Set([a0_0x43b56b(0x1f5),'-v','-V']),HELP_FLAGS=new Set([a0_0x43b56b(0x192),'-h']);cliArgs[a0_0x43b56b(0x13a)](_0x25e489=>VERSION_FLAGS[a0_0x43b56b(0x1b2)](_0x25e489))&&(console[a0_0x43b56b(0x1fe)](a0_0x43b56b(0x231)+getPackageVersion()),process[a0_0x43b56b(0x131)](0x0));function a0_0x2b08(){const _0x26b7f5=['\x22>\x0aError\x20reading\x20file:\x20','changes','argv','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','MORPH_WARP_GREP_TIMEOUT','unknown','file_read_complete','split','984FvwxQY','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','-\x20Grepped\x20\x27','optional','stack','read\x20','read','\x20as\x20allowed\x20directory','tool_call_error','Error\x20accessing\x20directory\x20','pattern','warn','filter','message','Morph\x20Edit\x20Preview','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','WarpGrepError','terminationReason','--api-key=','ENABLE_WORKSPACE_MODE','657483CYocAT','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','join','object','-\x20Glob\x20search\x20`','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','status','\x20-\x20','tsconfig.json','homedir','WarpGrep\x20sub-tool\x20errors:\x20','Benefits:\x0a','--version','debug','\x20(new\x20file)','../package.json','mcp-filesystem','`\x20in\x20`','Unknown\x20error','ms:','timings','log','false','payload','inputSchema','\x20is\x20not\x20a\x20directory','Branch\x20to\x20search\x20(uses\x20latest\x20commit)','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','toISOString','Cargo.toml','number','toLowerCase','grep\x20\x27','-\x20Listed\x20directory\x20`','PathError','github_codebase_search','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','list_directory\x20','Error:\x20','grep_search','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','tool_call_complete','params','instructions','43844XbQBjg','basename','44262znlVPC','MORPH_API_KEY','composer.json','Morph\x20FastApply\x20failed\x20without\x20error\x20message','completed_with_file_errors','-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a','tool_calls','SubToolError','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Applied','every','-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','readFile','errors','code','RipgrepError','match','0.2.0','api_request_start','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.','completed','3uuoFoJ','unknown\x20error','owner_repo','glob','@morphllm/morphmcp\x20','codebase_search','grep','search_type','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all',',\x20modified\x20','.git','LocalRipgrepProvider','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','role','setNotificationHandler',',\x20removed\x20','file_read_failed','setRequestHandler','path_validation_resolved','tool_call_received','name','isArray','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\x20search\x20failed:\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','ToolException','Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','cwd','\x0a...\x20(truncated,\x20total:\x20','path_validation_failed','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','branch','error','.\x20Changes:\x20','sk-','data','utf-8','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','source','Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a','now','node_modules','safeParse','\x22\x20is\x20disabled\x20via\x20DISABLED_TOOLS\x20environment\x20variable','push','github_search_start','[github_codebase_search]\x20Done\x20in\x20','exit','files','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','assistant','string','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','listRoots','normalize','morph-','some','connect','RipgrepNotAvailable','command','TimeoutError','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','API\x20error\x20(auth/rate-limit)','Invalid\x20arguments:\x20','-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','isDirectory','trim','pyproject.toml','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','852fZuCtl','Parent\x20directory\x20does\x20not\x20exist:\x20','\x0a</file>','FileReadError','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.','DISABLED_TOOLS','morph-mcp','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','File\x20read\x20error:','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','morph-warp-grep-v2.1','version','substring','size','requiresApiKey','🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a','UnknownError','linesModified','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','Tool\x20\x22','access','Repository\x20identifier','1029624cPNkrn','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.','\x20valid\x20directories','function','describe','dirname','Bearer\x20','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','ReadError','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','linesAdded','api-key','[github_codebase_search]\x20Failed\x20in\x20','min','morph-v3-large','finish','path','metadata','content','map','search_string','PWD','Warning:\x20','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','.vscode','code_edit','tool','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Workspace\x20mode\x20enabled:\x20Using\x20','path_validation_start','MORPH_LARGE_APPLY','constructor','resolve','84AMqJUu','response','stringify','-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a','floor','\x22>\x0a','-\x20Read\x20file\x20`','instruction','2125950bOQWtT','Warning:\x20Workspace\x20fallback\x20failed:\x20','-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','235446TNOovY','warp_grep_start','<file\x20path=\x22','Fatal\x20error\x20running\x20server:','\x20chars)','edit_file','--help','parse','success','repo_path','[could\x20not\x20read\x20file:\x20','Error\x20running\x20fast\x20context\x20search:\x20','length','\x20error(s)','application/json','catch','.cursor','env','MCP','Morph\x20Edit\x20','go.mod','https://morphllm.com/api/error-report','\x20disabled\x20via\x20DISABLED_TOOLS','-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','array','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','timed\x20out','morph-v3-fast','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','Max\x20results\x20to\x20return','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','startsWith','provider_created','\x22.\x20Known\x20tools:\x20','boolean','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','has','tool_call_id','default','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','295mJpZGa','roots','dryRun','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','messages','.\x20Path:\x20','\x0aExamples:','post','sep','76252ZSkVmD','text','lines','includes','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.','Created\x20File','terminated','list_directory','indexOf','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','\x0aOptions:','slice','timeout','linesRemoved'];a0_0x2b08=function(){return _0x26b7f5;};return a0_0x2b08();}cliArgs[a0_0x43b56b(0x13a)](_0x181e65=>HELP_FLAGS[a0_0x43b56b(0x1b2)](_0x181e65))&&(printHelp(),process['exit'](0x0));function getCliArg(_0x59cbd9){const _0x1b7f87=a0_0x43b56b;for(let _0xbd67f7=0x0;_0xbd67f7<cliArgs[_0x1b7f87(0x198)];_0xbd67f7++){const _0x4b1b7c=cliArgs[_0xbd67f7];if(_0x4b1b7c[_0x1b7f87(0x1ac)]('--'+_0x59cbd9+'='))return _0x4b1b7c[_0x1b7f87(0x1ca)](('--'+_0x59cbd9+'=')['length']);if(_0x4b1b7c==='--'+_0x59cbd9&&_0xbd67f7+0x1<cliArgs[_0x1b7f87(0x198)])return cliArgs[_0xbd67f7+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x43b56b(0x198)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x43b56b(0x1b2)](arg)||HELP_FLAGS[a0_0x43b56b(0x1b2)](arg))continue;if(arg['startsWith'](a0_0x43b56b(0x1e7)))continue;if(arg==='--api-key'){i++;continue;}args[a0_0x43b56b(0x12e)](arg);}const WORKSPACE_ROOT=process[a0_0x43b56b(0x19d)]['WORKSPACE_ROOT']||process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x174)]||process[a0_0x43b56b(0x11c)](),ENABLE_WORKSPACE_MODE=process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x1e8)]!==a0_0x43b56b(0x1ff),MORPH_API_KEY=getCliArg(a0_0x43b56b(0x16a))??process['env'][a0_0x43b56b(0x218)],MORPH_API_URL=process[a0_0x43b56b(0x19d)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x17e)]!==a0_0x43b56b(0x1ff),MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x43b56b(0x1d1)]?parseInt(process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x1d1)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set(['edit_file',a0_0x43b56b(0x232),a0_0x43b56b(0x20c)]),DEFAULT_DISABLED_TOOLS=new Set([a0_0x43b56b(0x191)]),DISABLED_TOOLS=process['env']['DISABLED_TOOLS']?new Set(process[a0_0x43b56b(0x19d)][a0_0x43b56b(0x14d)][a0_0x43b56b(0x1d4)](',')[a0_0x43b56b(0x172)](_0x54f164=>_0x54f164[a0_0x43b56b(0x145)]())[a0_0x43b56b(0x1e1)](_0x51eb95=>_0x51eb95[a0_0x43b56b(0x198)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x43b56b(0x156)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x43b56b(0x1b2)](tool)&&console[a0_0x43b56b(0x122)](a0_0x43b56b(0x17b)+tool+a0_0x43b56b(0x1ae)+[...KNOWN_TOOL_NAMES][a0_0x43b56b(0x1eb)](',\x20'));}console[a0_0x43b56b(0x122)]('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x43b56b(0x1eb)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x43b56b(0x124))&&!MORPH_API_KEY[a0_0x43b56b(0x1ac)](a0_0x43b56b(0x139))&&logMcpStderr(a0_0x43b56b(0x11a));async function reportMorphError(_0x393422){const _0x18c680=a0_0x43b56b;try{await a0_0x10c885[_0x18c680(0x1bd)](_0x18c680(0x1a1),{..._0x393422,'timestamp':new Date()[_0x18c680(0x205)](),'source':_0x393422[_0x18c680(0x128)]||_0x18c680(0x1f9),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x393422['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x18c680(0x19a),'Authorization':_0x18c680(0x165)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x333c8e,_0x23212b){const _0x5c9281=a0_0x43b56b;if(_0x333c8e&&typeof _0x333c8e===_0x5c9281(0x1ec)&&_0x5c9281(0x1ef)in _0x333c8e)return _0x333c8e[_0x5c9281(0x1ef)];if(_0x333c8e&&typeof _0x333c8e===_0x5c9281(0x1ec)&&_0x5c9281(0x182)in _0x333c8e)return _0x333c8e[_0x5c9281(0x182)]?.[_0x5c9281(0x1ef)];const _0x59d0c3=_0x23212b[_0x5c9281(0x228)](/\b(401|429)\b/);return _0x59d0c3?parseInt(_0x59d0c3[0x1],0xa):null;}function handleMorphAPIError(_0x408d41){const _0x39251d=a0_0x43b56b,_0x1e0067=_0x408d41 instanceof Error?_0x408d41['message']:String(_0x408d41),_0x1836ed=extractStatusCode(_0x408d41,_0x1e0067);switch(_0x1836ed){case 0x191:return{'content':[{'type':_0x39251d(0x1c0),'text':_0x39251d(0x22b)}],'isError':!![]};case 0x1ad:return{'content':[{'type':'text','text':'Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.'}],'isError':!![]};default:return null;}}args[a0_0x43b56b(0x198)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x43b56b(0x143)),logMcpStderr(a0_0x43b56b(0x1d0)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x43b56b(0x1a6)),logMcpStderr(a0_0x43b56b(0x1a9)),logMcpStderr(a0_0x43b56b(0x1b0)));function normalizePath(_0x5651c5){const _0x31dc3d=a0_0x43b56b;return a0_0x26b8c3[_0x31dc3d(0x138)](_0x5651c5);}function expandHome(_0x128643){const _0x3feccb=a0_0x43b56b;if(_0x128643[_0x3feccb(0x1ac)]('~/')||_0x128643==='~')return a0_0x26b8c3[_0x3feccb(0x1eb)](a0_0x49f44b[_0x3feccb(0x1f2)](),_0x128643[_0x3feccb(0x1ca)](0x1));return _0x128643;}let allowedDirectories=await Promise['all'](args[a0_0x43b56b(0x172)](async _0x236619=>{const _0x30f04a=a0_0x43b56b,_0x3d04d3=expandHome(_0x236619),_0x399dac=a0_0x26b8c3[_0x30f04a(0x180)](_0x3d04d3);try{const _0x25586c=await a0_0x2f91f5['realpath'](_0x399dac);return normalizePath(_0x25586c);}catch(_0x22267d){return normalizePath(_0x399dac);}}));if(ENABLE_WORKSPACE_MODE&&args[a0_0x43b56b(0x198)]===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x43b56b(0x17c)+workspaceDir+a0_0x43b56b(0x1dc)));}catch(a0_0x10922d){logMcpStderr(a0_0x43b56b(0x17a)+a0_0x10922d);}async function detectWorkspaceRoot(_0x20cedc){const _0x309edb=a0_0x43b56b;let _0x497cca=a0_0x26b8c3['resolve'](_0x20cedc);const _0x90cb63=[_0x309edb(0x237),_0x309edb(0x177),'package.json',_0x309edb(0x206),_0x309edb(0x146),_0x309edb(0x1a0),_0x309edb(0x19c),_0x309edb(0x1f1),_0x309edb(0x219)];while(_0x497cca!==a0_0x26b8c3[_0x309edb(0x164)](_0x497cca)){for(const _0x46128d of _0x90cb63){const _0x338953=a0_0x26b8c3[_0x309edb(0x1eb)](_0x497cca,_0x46128d);try{return await a0_0x2f91f5[_0x309edb(0x15d)](_0x338953),normalizePath(_0x497cca);}catch{}}_0x497cca=a0_0x26b8c3[_0x309edb(0x164)](_0x497cca);}return normalizePath(_0x20cedc);}await Promise['all'](args[a0_0x43b56b(0x172)](async _0x2b3e10=>{const _0x26300e=a0_0x43b56b;try{const _0x26bc29=await a0_0x2f91f5['stat'](expandHome(_0x2b3e10));!_0x26bc29[_0x26300e(0x144)]()&&(logMcpStderr(_0x26300e(0x20f)+_0x2b3e10+_0x26300e(0x202)),process[_0x26300e(0x131)](0x1));}catch(_0x1c2b1d){logMcpStderr(_0x26300e(0x1de)+_0x2b3e10+':',_0x1c2b1d),process[_0x26300e(0x131)](0x1);}}));async function validatePath(_0x114321){const _0x3bb51c=a0_0x43b56b,_0x4e8769=expandHome(_0x114321),_0x104580=a0_0x26b8c3['resolve'](_0x4e8769);logger[_0x3bb51c(0x1f6)](_0x3bb51c(0x19e),_0x3bb51c(0x17d),{'raw_path':_0x114321,'absolute':_0x104580});try{const _0x4077ca=await a0_0x2f91f5['realpath'](_0x104580);return logger[_0x3bb51c(0x1f6)]('MCP',_0x3bb51c(0x111),{'resolved':_0x4077ca,'symlink':_0x4077ca!==_0x104580}),_0x4077ca;}catch(_0x37e602){if(_0x37e602['code']==='ENOENT'){const _0x379fd7=a0_0x26b8c3[_0x3bb51c(0x164)](_0x104580);try{const _0x30f78a=await a0_0x2f91f5['realpath'](_0x379fd7),_0x299bf0=a0_0x26b8c3[_0x3bb51c(0x1eb)](_0x30f78a,a0_0x26b8c3['basename'](_0x104580));return logger['debug'](_0x3bb51c(0x19e),_0x3bb51c(0x111),{'resolved':_0x299bf0,'new_file':!![]}),_0x299bf0;}catch{logger['error']('MCP',_0x3bb51c(0x11e),{'raw_path':_0x114321,'error':_0x3bb51c(0x149)+_0x379fd7});throw new Error(_0x3bb51c(0x149)+_0x379fd7);}}logger[_0x3bb51c(0x122)](_0x3bb51c(0x19e),_0x3bb51c(0x11e),{'raw_path':_0x114321,'error':_0x37e602['message']});throw _0x37e602;}}const MorphEditFileArgsSchema=z[a0_0x43b56b(0x1ec)]({'path':z[a0_0x43b56b(0x135)](),'code_edit':z[a0_0x43b56b(0x135)]()['describe'](a0_0x43b56b(0x1ea)),'instruction':z[a0_0x43b56b(0x135)]()[a0_0x43b56b(0x163)](a0_0x43b56b(0x166)),'dryRun':z[a0_0x43b56b(0x1af)]()[a0_0x43b56b(0x1b4)](![])['describe']('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x43b56b(0x160),WarpGrepArgsSchema=z['object']({'search_string':z['string']()[a0_0x43b56b(0x163)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x43b56b(0x135)]()[a0_0x43b56b(0x163)](a0_0x43b56b(0x168)),'search_type':z['enum']([a0_0x43b56b(0x1b4),a0_0x43b56b(0x12b)])[a0_0x43b56b(0x1d8)]()[a0_0x43b56b(0x163)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x43b56b(0x135)]()[a0_0x43b56b(0x1d8)]()[a0_0x43b56b(0x163)](a0_0x43b56b(0x115)),'owner_repo':z['string']()['optional']()[a0_0x43b56b(0x163)](a0_0x43b56b(0x13f)),'branch':z[a0_0x43b56b(0x135)]()['optional']()[a0_0x43b56b(0x163)](a0_0x43b56b(0x15b))}),CodebaseSearchArgsSchema=z[a0_0x43b56b(0x1ec)]({'query':z[a0_0x43b56b(0x135)]()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x43b56b(0x135)]()['describe'](a0_0x43b56b(0x15e)),'branch':z['string']()['optional']()['describe'](a0_0x43b56b(0x203)),'commitHash':z['string']()['optional']()['describe']('Specific\x20commit\x20hash\x20to\x20search'),'targetDirectories':z[a0_0x43b56b(0x1a5)](z[a0_0x43b56b(0x135)]())[a0_0x43b56b(0x1b4)]([])[a0_0x43b56b(0x163)](a0_0x43b56b(0x235)),'limit':z[a0_0x43b56b(0x207)]()[a0_0x43b56b(0x1d8)]()['default'](0xa)['describe'](a0_0x43b56b(0x1aa))}),server=new Server({'name':a0_0x43b56b(0x14e),'version':a0_0x43b56b(0x229)},{'capabilities':{'tools':{}}});server[a0_0x43b56b(0x110)](ListToolsRequestSchema,async()=>{const _0x91ee03=a0_0x43b56b,_0x48b791=[{'name':_0x91ee03(0x191),'description':_0x91ee03(0x1d6)+'⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a'+_0x91ee03(0x158)+_0x91ee03(0x1a4)+_0x91ee03(0x1f4)+_0x91ee03(0x147)+_0x91ee03(0x152)+'-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a'+_0x91ee03(0x21c)+_0x91ee03(0x129)+_0x91ee03(0x1c8)+_0x91ee03(0x119)+'For\x20deletions:\x0a'+_0x91ee03(0x1ee)+_0x91ee03(0x1a3)+'Rules:\x0a'+_0x91ee03(0x184)+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x91ee03(0x14f)+_0x91ee03(0x18b)+_0x91ee03(0x142)+_0x91ee03(0x222)+_0x91ee03(0x176),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':'codebase_search','description':_0x91ee03(0x117)+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'+'You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20'+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x430e16=_0x48b791['filter'](_0x5aa262=>{const _0x30280b=_0x91ee03;if(DISABLED_TOOLS[_0x30280b(0x1b2)](_0x5aa262[_0x30280b(0x113)]))return console[_0x30280b(0x122)]('Tool\x20'+_0x5aa262['name']+_0x30280b(0x1a2)),![];if(_0x30280b(0x157)in _0x5aa262&&_0x5aa262[_0x30280b(0x157)]&&!MORPH_API_KEY)return logMcpStderr(_0x30280b(0x175)+_0x5aa262['name']+_0x30280b(0x211)),![];return!![];});return{'tools':_0x430e16['map'](_0x1ba6eb=>({'name':_0x1ba6eb[_0x91ee03(0x113)],'description':_0x1ba6eb['description'],'inputSchema':_0x1ba6eb[_0x91ee03(0x201)]}))};}),server[a0_0x43b56b(0x110)](CallToolRequestSchema,async _0x12806e=>{const _0x163d15=a0_0x43b56b,{name:_0x4886e6,arguments:_0xcaef15}=_0x12806e[_0x163d15(0x213)],_0x1ecf01=Date['now']();logger['debug'](_0x163d15(0x19e),_0x163d15(0x112),{'tool':_0x4886e6,'args':_0x4886e6==='edit_file'?{'path':_0xcaef15?.[_0x163d15(0x16f)],'instruction':_0xcaef15?.['instruction']||_0xcaef15?.[_0x163d15(0x214)],'dryRun':_0xcaef15?.[_0x163d15(0x1b8)]}:_0xcaef15});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x1ab)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x163d15(0x124))&&!MORPH_API_KEY[_0x163d15(0x1ac)](_0x163d15(0x139)))return{'content':[{'type':'text','text':_0x163d15(0x1c3)}],'isError':!![]};if(DISABLED_TOOLS[_0x163d15(0x1b2)](_0x4886e6))throw new Error(_0x163d15(0x15c)+_0x4886e6+_0x163d15(0x12d));switch(_0x4886e6){case _0x163d15(0x191):{const _0x38aed5=_0xcaef15&&typeof _0xcaef15==='object'&&_0x163d15(0x214)in _0xcaef15&&!(_0x163d15(0x188)in _0xcaef15)?{..._0xcaef15,'instruction':_0xcaef15[_0x163d15(0x214)],'instructions':undefined}:_0xcaef15,_0x3c74b7=MorphEditFileArgsSchema[_0x163d15(0x12c)](_0x38aed5);if(!_0x3c74b7['success'])throw new Error('Invalid\x20arguments\x20for\x20morph_edit_file:\x20'+_0x3c74b7['error']);const _0x282604=await validatePath(_0x3c74b7['data'][_0x163d15(0x16f)]);let _0x32f863=null,_0xb9f70e=!![],_0x370833=null;try{_0x32f863=await a0_0x2f91f5['readFile'](_0x282604,'utf-8'),logger['debug'](_0x163d15(0x19e),_0x163d15(0x1d3),{'path':_0x282604,'size_bytes':_0x32f863[_0x163d15(0x198)]});}catch(_0x815f6c){const _0x2f96f2=_0x815f6c[_0x163d15(0x226)];_0x2f96f2==='ENOENT'?(_0xb9f70e=![],_0x32f863='',logger[_0x163d15(0x1f6)](_0x163d15(0x19e),_0x163d15(0x1d3),{'path':_0x282604,'exists':![]})):(_0x370833='Failed\x20to\x20read\x20file:\x20'+(_0x2f96f2||_0x163d15(0x1d2))+_0x163d15(0x1f0)+(_0x815f6c instanceof Error?_0x815f6c[_0x163d15(0x1e2)]:String(_0x815f6c)),logger[_0x163d15(0x122)](_0x163d15(0x19e),_0x163d15(0x10f),{'path':_0x282604,'error':_0x370833}),logMcpStderr(_0x163d15(0x175)+_0x370833));}let _0x580a55;try{const _0x42939b=MORPH_API_KEY;if(!_0x42939b)throw new Error(_0x163d15(0x1b1));const _0x22f199=a0_0x26b8c3[_0x163d15(0x164)](_0x282604),_0x464b9f=a0_0x26b8c3[_0x163d15(0x216)](_0x282604);logger[_0x163d15(0x1f6)](_0x163d15(0x19e),_0x163d15(0x22a),{'model':'morph-v3-fast','path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'instruction_len':_0x3c74b7['data']['instruction'][_0x163d15(0x198)],'code_edit_len':_0x3c74b7['data'][_0x163d15(0x178)][_0x163d15(0x198)],'original_code_len':_0x32f863?.['length']??0x0,'dry_run':_0x3c74b7['data']['dryRun']});const _0xdd2cb4=Date['now'](),_0x33733f=await executeEditFile({'target_filepath':_0x464b9f,'code_edit':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x178)],'instruction':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x188)]},{'morphApiKey':_0x42939b,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x22f199,'autoWrite':!_0x3c74b7['data']['dryRun'],'generateUdiff':![],'debug':![]}),_0x557fee=Date[_0x163d15(0x12a)]()-_0xdd2cb4;_0x580a55=_0x33733f['completionId'];if(!_0x33733f[_0x163d15(0x194)])throw new Error(_0x33733f['error']||_0x163d15(0x21a));const _0x266b21=_0x33733f[_0x163d15(0x1ce)],_0xdc4821='added\x20'+_0x266b21['linesAdded']+_0x163d15(0x10e)+_0x266b21[_0x163d15(0x1cc)]+_0x163d15(0x236)+_0x266b21[_0x163d15(0x15a)];logger[_0x163d15(0x1f6)]('MCP',_0x163d15(0x212),{'tool':'edit_file','success':!![],'latency_ms':Date['now']()-_0x1ecf01,'edit_latency_ms':_0x557fee,'changes':{'added':_0x266b21[_0x163d15(0x169)],'removed':_0x266b21['linesRemoved'],'modified':_0x266b21[_0x163d15(0x15a)]},'completion_id':_0x580a55});if(_0x3c74b7['data'][_0x163d15(0x1b8)])return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x1e3)+(_0xb9f70e?'':_0x163d15(0x1f7))+':\x20'+_0x3c74b7['data'][_0x163d15(0x188)]+_0x163d15(0x123)+_0xdc4821+_0x163d15(0x1bb)+_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)]+'.'}]};return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x19f)+(_0xb9f70e?_0x163d15(0x220):_0x163d15(0x1c4))+':\x20'+_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x188)]+'.\x20Changes:\x20'+_0xdc4821+_0x163d15(0x1bb)+_0x3c74b7['data']['path']+'.'}]};}catch(_0x197087){const _0x34b2f6=handleMorphAPIError(_0x197087);if(_0x34b2f6)return logger[_0x163d15(0x122)](_0x163d15(0x19e),_0x163d15(0x1dd),{'tool':_0x163d15(0x191),'error':_0x163d15(0x140),'latency_ms':Date[_0x163d15(0x12a)]()-_0x1ecf01}),_0x34b2f6;const _0x5d2a8d=_0x197087 instanceof Error?_0x197087['message']:String(_0x197087);return logger[_0x163d15(0x122)]('MCP',_0x163d15(0x1dd),{'tool':_0x163d15(0x191),'error':_0x5d2a8d,'path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'validated_path':_0x282604,'latency_ms':Date[_0x163d15(0x12a)]()-_0x1ecf01,'stack':_0x197087 instanceof Error?_0x197087[_0x163d15(0x1d9)]:undefined}),reportMorphError({'error_message':_0x5d2a8d,'error_type':_0x197087 instanceof Error?_0x197087[_0x163d15(0x17f)][_0x163d15(0x113)]:'UnknownError','context':{'tool':'edit_file','completion_id':_0x580a55,'file_path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'validated_path':_0x282604,'instruction':_0x3c74b7['data'][_0x163d15(0x188)],'model':MORPH_LARGE_APPLY?_0x163d15(0x16d):_0x163d15(0x1a8),'dry_run':_0x3c74b7[_0x163d15(0x125)]['dryRun'],'file_exists':_0xb9f70e,'file_read_error':_0x370833,'file_readable':_0x32f863!==null,'request_content':{'path':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x16f)],'code_edit':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x178)],'instruction':_0x3c74b7[_0x163d15(0x125)][_0x163d15(0x188)],'original_code':_0x32f863!==null?_0x32f863[_0x163d15(0x198)]>0xc350?_0x32f863['substring'](0x0,0xc350)+_0x163d15(0x11d)+_0x32f863[_0x163d15(0x198)]+_0x163d15(0x190):_0x32f863:_0x163d15(0x196)+(_0x370833||_0x163d15(0x22e))+']','original_code_length':_0x32f863?.[_0x163d15(0x198)]??0x0,'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x163d15(0x1a8),'dry_run':_0x3c74b7[_0x163d15(0x125)]['dryRun']}},'stack_trace':_0x197087 instanceof Error?_0x197087['stack']:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x163d15(0x1c0),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x5d2a8d}],'isError':!![]};}}case _0x163d15(0x232):{const _0x57facc=WarpGrepArgsSchema[_0x163d15(0x12c)](_0xcaef15);if(!_0x57facc['success'])return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x141)+_0x57facc[_0x163d15(0x122)]}],'isError':!![]};const _0x591be3=_0x1796c8=>{const _0x239970=_0x163d15,_0x42e814=[];for(const _0x35a617 of _0x1796c8||[]){if(_0x35a617['role']===_0x239970(0x134)&&Array[_0x239970(0x114)](_0x35a617[_0x239970(0x21d)]))for(const _0x5b4dc5 of _0x35a617[_0x239970(0x21d)]){try{const _0x575a99=_0x5b4dc5[_0x239970(0x162)]?.[_0x239970(0x113)],_0x272536=JSON[_0x239970(0x193)](_0x5b4dc5[_0x239970(0x162)]?.['arguments']||'{}');if(_0x575a99==='grep_search')_0x42e814[_0x239970(0x12e)](_0x239970(0x209)+_0x272536[_0x239970(0x1df)]+'\x27\x20'+(_0x272536['path']||'.'));else{if(_0x575a99===_0x239970(0x1db))_0x42e814[_0x239970(0x12e)](_0x239970(0x1da)+_0x272536[_0x239970(0x16f)]);else{if(_0x575a99===_0x239970(0x1c6))_0x42e814[_0x239970(0x12e)](_0x239970(0x20e)+(_0x272536['command']||'.'));else{if(_0x575a99===_0x239970(0x230))_0x42e814[_0x239970(0x12e)]('glob\x20\x27'+_0x272536[_0x239970(0x1df)]+'\x27\x20'+(_0x272536[_0x239970(0x16f)]||'.'));else _0x575a99===_0x239970(0x16e)&&_0x42e814[_0x239970(0x12e)](_0x239970(0x16e));}}}}catch{}}}return _0x42e814;},_0x4435dd=_0x5a1482=>{const _0x292791=_0x163d15,_0x42f953=[];if(!_0x5a1482||!Array[_0x292791(0x114)](_0x5a1482))return _0x42f953;const _0x4b83b9=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':'FileNotFound','tool':_0x292791(0x1db)},{'pattern':/\[PATH ERROR\]/,'error_type':_0x292791(0x20b),'tool':_0x292791(0x1db)},{'pattern':/\[READ ERROR\]/,'error_type':_0x292791(0x167),'tool':_0x292791(0x1db)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x292791(0x1db)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x292791(0x227),'tool':_0x292791(0x233)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x292791(0x13c),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':'BinaryFile','tool':_0x292791(0x1db)},{'pattern':/\[SYMLINK\]/,'error_type':'SymlinkError','tool':_0x292791(0x1db)},{'pattern':/not a text file/,'error_type':'BinaryFile','tool':_0x292791(0x1db)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':'read'},{'pattern':/Error reading file:/,'error_type':_0x292791(0x167),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x292791(0x118),'tool':_0x292791(0x1d2)}];let _0x1019f9=0x0;for(const _0xd246e5 of _0x5a1482){_0xd246e5['role']===_0x292791(0x134)&&Array[_0x292791(0x114)](_0xd246e5[_0x292791(0x21d)])&&_0x1019f9++;const _0xbc981d=_0xd246e5[_0x292791(0x171)];if((_0xd246e5[_0x292791(0x10c)]===_0x292791(0x179)||_0xd246e5[_0x292791(0x10c)]==='user')&&_0xbc981d&&typeof _0xbc981d===_0x292791(0x135))for(const {pattern:_0x9848fe,error_type:_0x282bee,tool:_0x4f9e21}of _0x4b83b9){const _0x358831=_0xbc981d[_0x292791(0x228)](new RegExp(_0x9848fe[_0x292791(0x128)],'g'));if(_0x358831)for(const _0x38b54b of _0x358831){const _0x4d17f0=_0xbc981d[_0x292791(0x1c7)](_0x38b54b),_0x56eeb8=_0xbc981d['substring'](_0x4d17f0,Math[_0x292791(0x16c)](_0x4d17f0+0xc8,_0xbc981d[_0x292791(0x198)]));_0x42f953[_0x292791(0x12e)]({'tool':_0x4f9e21,'error_type':_0x282bee,'error_message':_0x56eeb8[_0x292791(0x1d4)]('\x0a')[0x0],'turn':_0x1019f9});}}}return _0x42f953;};try{const _0x3ffd21=a0_0x26b8c3[_0x163d15(0x180)](_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)]),_0x15f2af=_0x57facc[_0x163d15(0x125)][_0x163d15(0x234)],_0x2da418=_0x15f2af==='node_modules'?{'allowNames':['node_modules']}:undefined,_0x301dc8=new LocalRipgrepProvider(_0x3ffd21,undefined,_0x2da418);logger[_0x163d15(0x1f6)]('MCP',_0x163d15(0x1ad),{'type':_0x163d15(0x238),'repo_root':_0x3ffd21,'search_type':_0x15f2af||_0x163d15(0x1b4)}),logger[_0x163d15(0x1f6)]('MCP',_0x163d15(0x18d),{'query':_0x57facc['data'][_0x163d15(0x173)],'repo_root':_0x3ffd21,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0xf69fe5=Date[_0x163d15(0x12a)](),_0xbc9a13=await runWarpGrep({'searchTerm':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'repoRoot':_0x3ffd21,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x301dc8,'search_type':_0x15f2af}),_0x5962da=Date[_0x163d15(0x12a)]()-_0xf69fe5,_0xaddcc0=_0xbc9a13['finish']?.[_0x163d15(0x170)]?.[_0x163d15(0x132)]?.[_0x163d15(0x198)]??0x0;logger[_0x163d15(0x1f6)]('MCP','warp_grep_complete',{'termination':_0xbc9a13['terminationReason'],'turns':_0xbc9a13[_0x163d15(0x1fd)]?.['turns']??0x0,'files_found':_0xaddcc0,'latency_ms':_0x5962da});const _0x50064b=_0x4435dd(_0xbc9a13[_0x163d15(0x1ba)]);_0x50064b[_0x163d15(0x198)]>0x0&&reportMorphError({'error_message':_0x163d15(0x1f3)+_0x50064b[_0x163d15(0x198)]+_0x163d15(0x199),'error_type':_0x163d15(0x21e),'level':'warn','tool':_0x163d15(0x232),'context':{'repo_path':_0x57facc['data']['repo_path'],'query':_0x57facc['data'][_0x163d15(0x173)],'model':_0x163d15(0x153),'termination_reason':_0xbc9a13[_0x163d15(0x1e6)],'sub_tool_errors':_0x50064b,'timings':_0xbc9a13[_0x163d15(0x1fd)],'tool_calls':_0x591be3(_0xbc9a13['messages']),'messages':_0xbc9a13[_0x163d15(0x1ba)]?.[_0x163d15(0x172)](_0x153029=>({'role':_0x153029[_0x163d15(0x10c)],'content':_0x153029[_0x163d15(0x171)],..._0x153029[_0x163d15(0x21d)]?{'tool_calls':_0x153029[_0x163d15(0x21d)][_0x163d15(0x198)]}:{},..._0x153029[_0x163d15(0x1b3)]?{'tool_call_id':_0x153029[_0x163d15(0x1b3)]}:{}}))},'source':_0x163d15(0x1f9)})[_0x163d15(0x19b)](()=>{});let _0x2fee66='';if(_0xbc9a13[_0x163d15(0x1e6)]===_0x163d15(0x22c)&&_0xbc9a13[_0x163d15(0x16e)]?.[_0x163d15(0x170)]?.['files']){const _0x5375c4=_0xbc9a13[_0x163d15(0x16e)]['metadata'][_0x163d15(0x132)];if(_0x5375c4[_0x163d15(0x198)]===0x0)return _0x2fee66=_0xbc9a13[_0x163d15(0x16e)][_0x163d15(0x200)]||_0x163d15(0x20d),{'content':[{'type':_0x163d15(0x1c0),'text':_0x2fee66}]};const _0x4e34ba=[],_0x2b09bd=[_0x163d15(0x120)];for(const _0x4bbe8f of _0xbc9a13['messages']){if(_0x4bbe8f['role']==='assistant'&&Array['isArray'](_0x4bbe8f[_0x163d15(0x21d)]))for(const _0x148b2b of _0x4bbe8f['tool_calls']){try{const _0x47bbdd=_0x148b2b['function']?.[_0x163d15(0x113)],_0x3b2543=JSON[_0x163d15(0x193)](_0x148b2b[_0x163d15(0x162)]?.['arguments']||'{}');if(_0x47bbdd===_0x163d15(0x210))_0x2b09bd[_0x163d15(0x12e)](_0x163d15(0x1d7)+_0x3b2543[_0x163d15(0x1df)]+'\x27\x20in\x20`'+(_0x3b2543[_0x163d15(0x16f)]||'.')+'`');else{if(_0x47bbdd===_0x163d15(0x1db))_0x2b09bd[_0x163d15(0x12e)](_0x163d15(0x187)+_0x3b2543['path']+'`');else{if(_0x47bbdd===_0x163d15(0x1c6))_0x2b09bd[_0x163d15(0x12e)](_0x163d15(0x20a)+(_0x3b2543[_0x163d15(0x13d)]||'.')+'`');else _0x47bbdd===_0x163d15(0x230)&&_0x2b09bd['push'](_0x163d15(0x1ed)+_0x3b2543['pattern']+_0x163d15(0x1fa)+(_0x3b2543['path']||'.')+'`');}}}catch{}}}_0x4e34ba[_0x163d15(0x12e)](_0x2b09bd[_0x163d15(0x1eb)]('\x0a'));const _0x1d8ad0=['','Relevant\x20context\x20found:'];for(const _0x193df5 of _0x5375c4){if(_0x193df5['lines']==='*')_0x1d8ad0[_0x163d15(0x12e)]('-\x20'+_0x193df5[_0x163d15(0x16f)]+':*');else{if(Array[_0x163d15(0x114)](_0x193df5[_0x163d15(0x1c1)])){const _0x116ebb=_0x193df5['lines'][_0x163d15(0x172)](([_0x88e0e3,_0x29f955])=>{if(_0x88e0e3===_0x29f955)return''+_0x88e0e3;return _0x88e0e3+'-'+_0x29f955;});_0x1d8ad0[_0x163d15(0x12e)]('-\x20'+_0x193df5[_0x163d15(0x16f)]+':'+_0x116ebb[_0x163d15(0x1eb)](','));}else _0x1d8ad0['push']('-\x20'+_0x193df5[_0x163d15(0x16f)]+':*');}}_0x1d8ad0[_0x163d15(0x12e)](''),_0x4e34ba[_0x163d15(0x12e)](_0x1d8ad0[_0x163d15(0x1eb)]('\x0a')),_0x4e34ba['push']('Here\x20is\x20the\x20content\x20of\x20files:\x0a');const _0x20d52f=[],_0x2b05be=[];for(const _0xf11ccb of _0x5375c4){let _0x1070d8=a0_0x26b8c3[_0x163d15(0x180)](_0x57facc[_0x163d15(0x125)]['repo_path'],_0xf11ccb[_0x163d15(0x16f)]),_0x3dfe7f=null,_0x57f434=null;try{_0x3dfe7f=await a0_0x2f91f5[_0x163d15(0x224)](_0x1070d8,{'encoding':_0x163d15(0x126)});}catch(_0x16891d){const _0xc913ff=fixPathRepetition(_0x1070d8);if(_0xc913ff)try{_0x3dfe7f=await a0_0x2f91f5[_0x163d15(0x224)](_0xc913ff,{'encoding':_0x163d15(0x126)}),_0x1070d8=_0xc913ff;}catch{_0x57f434=_0x16891d instanceof Error?_0x16891d:new Error(String(_0x16891d));}else _0x57f434=_0x16891d instanceof Error?_0x16891d:new Error(String(_0x16891d));}if(_0x3dfe7f!==null){const _0x1797f7=_0x3dfe7f['split'](/\r?\n/),_0x46f401=[];if(_0xf11ccb['lines']==='*'||!Array[_0x163d15(0x114)](_0xf11ccb[_0x163d15(0x1c1)]))for(let _0x1beafe=0x1;_0x1beafe<=_0x1797f7[_0x163d15(0x198)];_0x1beafe++){const _0x28bf54=_0x1797f7[_0x1beafe-0x1];_0x46f401[_0x163d15(0x12e)](_0x1beafe+'|\x20'+_0x28bf54);}else for(const [_0xc25b63,_0x3cba40]of _0xf11ccb['lines']){_0x46f401[_0x163d15(0x198)]>0x0&&_0x46f401[_0x163d15(0x12e)]('');for(let _0x40e563=_0xc25b63;_0x40e563<=_0x3cba40&&_0x40e563<=_0x1797f7[_0x163d15(0x198)];_0x40e563++){const _0x530246=_0x1797f7[_0x40e563-0x1];_0x46f401['push'](_0x40e563+'|\x20'+_0x530246);}}_0x2b05be['push']({'path':_0xf11ccb[_0x163d15(0x16f)],'content':_0x46f401['join']('\x0a')});}else _0x20d52f[_0x163d15(0x12e)](_0x163d15(0x18e)+_0xf11ccb[_0x163d15(0x16f)]+_0x163d15(0x1cd)+(_0x57f434?.[_0x163d15(0x1e2)]||_0x163d15(0x1fb))+'\x0a</file>');}try{const _0x1ac9e0=await compactFileContexts(_0x2b05be,_0x57facc[_0x163d15(0x125)]['search_string'],MORPH_API_KEY,MORPH_API_URL);for(const _0x2fd469 of _0x1ac9e0){_0x20d52f[_0x163d15(0x12e)](_0x163d15(0x18e)+_0x2fd469['path']+_0x163d15(0x186)+_0x2fd469[_0x163d15(0x171)]+_0x163d15(0x14a));}}catch(_0xdbadfa){logger[_0x163d15(0x1e0)](_0x163d15(0x19e),'compaction_failed',{'error':_0xdbadfa instanceof Error?_0xdbadfa[_0x163d15(0x1e2)]:String(_0xdbadfa),'files_count':_0x2b05be[_0x163d15(0x198)]});for(const _0x311b37 of _0x2b05be){_0x20d52f[_0x163d15(0x12e)](_0x163d15(0x18e)+_0x311b37[_0x163d15(0x16f)]+'\x22>\x0a'+_0x311b37[_0x163d15(0x171)]+'\x0a</file>');}}_0x4e34ba['push'](_0x20d52f[_0x163d15(0x1eb)]('\x0a\x0a')),_0x2fee66=_0x4e34ba[_0x163d15(0x1eb)]('\x0a');const _0x29c1b2=_0xbc9a13[_0x163d15(0x225)]?.['filter'](_0x28c3f1=>_0x28c3f1[_0x163d15(0x1e2)]?.[_0x163d15(0x1ac)](_0x163d15(0x151)))||[];if(_0x29c1b2[_0x163d15(0x198)]>0x0){const _0xed5e9a=_0x29c1b2[_0x163d15(0x172)](_0x546556=>_0x546556['message'])[_0x163d15(0x1eb)](';\x20');reportMorphError({'error_message':_0xed5e9a,'error_type':_0x163d15(0x14b),'context':{'tool':_0x163d15(0x232),'repo_path':_0x57facc[_0x163d15(0x125)]['repo_path'],'query':_0x57facc['data'][_0x163d15(0x173)],'model':'morph-warp-grep-v2.1','termination_reason':_0x163d15(0x21b),'error_count':_0x29c1b2['length'],'is_timeout':![],'timings':_0xbc9a13[_0x163d15(0x1fd)],'files_attempted':_0x5375c4['map'](_0x13f690=>({'path':_0x13f690[_0x163d15(0x16f)],'lines':_0x13f690[_0x163d15(0x1c1)]})),'tool_calls':_0x591be3(_0xbc9a13['messages']),'messages':_0xbc9a13[_0x163d15(0x1ba)]?.[_0x163d15(0x172)](_0x27aa8c=>({'role':_0x27aa8c[_0x163d15(0x10c)],'content':_0x27aa8c[_0x163d15(0x171)],..._0x27aa8c[_0x163d15(0x21d)]?{'tool_calls':_0x27aa8c[_0x163d15(0x21d)][_0x163d15(0x198)]}:{},..._0x27aa8c[_0x163d15(0x1b3)]?{'tool_call_id':_0x27aa8c[_0x163d15(0x1b3)]}:{}})),'request_content':{'query':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'repo_path':_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)],'repoRoot':a0_0x26b8c3[_0x163d15(0x180)](_0x57facc['data'][_0x163d15(0x195)]),'model':'morph-warp-grep-v2.1'}},'source':_0x163d15(0x1f9)})[_0x163d15(0x19b)](()=>{});}}else{if(_0xbc9a13[_0x163d15(0x1e6)]===_0x163d15(0x1c5)&&_0xbc9a13[_0x163d15(0x225)]['length']>0x0){const _0x44e3ef=_0xbc9a13['errors'][_0x163d15(0x172)](_0x47c022=>_0x47c022[_0x163d15(0x1e2)])['join'](';\x20');_0x2fee66='Error:\x20'+_0x44e3ef;const _0x110d25=_0x44e3ef[_0x163d15(0x208)]()['includes'](_0x163d15(0x1cb))||_0x44e3ef[_0x163d15(0x208)]()[_0x163d15(0x1c2)](_0x163d15(0x1a7))||_0x44e3ef['toLowerCase']()[_0x163d15(0x1c2)]('etimedout'),_0x580612=_0xbc9a13[_0x163d15(0x16e)]?.['metadata']?.[_0x163d15(0x132)],_0x4439b9=_0xbc9a13[_0x163d15(0x225)][0x0];reportMorphError({'error_message':_0x44e3ef,'error_type':_0x110d25?_0x163d15(0x13e):_0x4439b9?.['constructor']?.[_0x163d15(0x113)]||_0x163d15(0x1e5),'context':{'tool':'codebase_search','repo_path':_0x57facc['data']['repo_path'],'query':_0x57facc['data'][_0x163d15(0x173)],'model':_0x163d15(0x153),'termination_reason':_0xbc9a13[_0x163d15(0x1e6)],'error_count':_0xbc9a13['errors'][_0x163d15(0x198)],'is_timeout':_0x110d25,'timings':_0xbc9a13[_0x163d15(0x1fd)],'files_attempted':_0x580612?.[_0x163d15(0x172)](_0x6c9821=>({'path':_0x6c9821[_0x163d15(0x16f)],'lines':_0x6c9821[_0x163d15(0x1c1)]})),'tool_calls':_0x591be3(_0xbc9a13['messages']),'messages':_0xbc9a13[_0x163d15(0x1ba)]?.[_0x163d15(0x172)](_0x40d6f3=>({'role':_0x40d6f3['role'],'content':_0x40d6f3['content'],..._0x40d6f3[_0x163d15(0x21d)]?{'tool_calls':_0x40d6f3[_0x163d15(0x21d)][_0x163d15(0x198)]}:{},..._0x40d6f3['tool_call_id']?{'tool_call_id':_0x40d6f3[_0x163d15(0x1b3)]}:{}})),'request_content':{'query':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'repo_path':_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)],'repoRoot':a0_0x26b8c3[_0x163d15(0x180)](_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)]),'model':_0x163d15(0x153)}},'stack_trace':_0x4439b9?.['stack']||undefined,'source':_0x163d15(0x1f9)})['catch'](()=>{});}else _0x2fee66=_0x163d15(0x1b9);}return{'content':[{'type':_0x163d15(0x1c0),'text':_0x2fee66}]};}catch(_0x262ea5){const _0x2d50b6=handleMorphAPIError(_0x262ea5);if(_0x2d50b6)return logger[_0x163d15(0x122)]('MCP','tool_call_error',{'tool':_0x163d15(0x232),'error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x163d15(0x12a)]()-_0x1ecf01}),_0x2d50b6;const _0x3c184a=_0x262ea5 instanceof Error?_0x262ea5[_0x163d15(0x1e2)]:String(_0x262ea5);logger[_0x163d15(0x122)](_0x163d15(0x19e),_0x163d15(0x1dd),{'tool':_0x163d15(0x232),'error':_0x3c184a,'repo_path':_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)],'query':_0x57facc[_0x163d15(0x125)][_0x163d15(0x173)],'latency_ms':Date['now']()-_0x1ecf01});const _0x3b05b4=_0x3c184a[_0x163d15(0x208)]()[_0x163d15(0x1c2)]('timeout')||_0x3c184a[_0x163d15(0x208)]()['includes'](_0x163d15(0x1a7))||_0x3c184a[_0x163d15(0x208)]()[_0x163d15(0x1c2)]('etimedout')||_0x262ea5 instanceof Error&&_0x262ea5['name']===_0x163d15(0x13e);return reportMorphError({'error_message':_0x3c184a,'error_type':_0x3b05b4?_0x163d15(0x13e):_0x262ea5 instanceof Error?_0x262ea5[_0x163d15(0x17f)][_0x163d15(0x113)]:'UnknownError','context':{'tool':_0x163d15(0x232),'repo_path':_0x57facc['data']['repo_path'],'query':_0x57facc[_0x163d15(0x125)]['search_string'],'model':'morph-warp-grep-v2.1','is_timeout':_0x3b05b4,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x57facc['data'][_0x163d15(0x173)],'repo_path':_0x57facc['data'][_0x163d15(0x195)],'repoRoot':a0_0x26b8c3['resolve'](_0x57facc[_0x163d15(0x125)][_0x163d15(0x195)]),'model':_0x163d15(0x153)}},'stack_trace':_0x262ea5 instanceof Error?_0x262ea5['stack']:undefined,'source':'mcp-filesystem'})[_0x163d15(0x19b)](()=>{}),{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x197)+_0x3c184a}],'isError':![]};}}case _0x163d15(0x20c):{const _0xa2ee2a=WarpGrepGitHubArgsSchema[_0x163d15(0x12c)](_0xcaef15);if(!_0xa2ee2a[_0x163d15(0x194)])return{'content':[{'type':_0x163d15(0x1c0),'text':_0x163d15(0x141)+_0xa2ee2a[_0x163d15(0x122)]}],'isError':!![]};const _0x495124=_0xa2ee2a[_0x163d15(0x125)]['github_url']||_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x22f)];if(!_0x495124)return{'content':[{'type':'text','text':_0x163d15(0x204)}],'isError':!![]};const _0x35b2cc=MORPH_API_KEY;if(!_0x35b2cc)throw new Error(_0x163d15(0x1b1));const _0x19640c=Date['now']();logger[_0x163d15(0x1f6)](_0x163d15(0x19e),_0x163d15(0x12f),{'identifier':_0x495124,'query':_0xa2ee2a[_0x163d15(0x125)]['search_string'],'branch':_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x121)]});try{const _0x10f6ac=new WarpGrepClient({'morphApiKey':_0x35b2cc,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x24b001=await _0x10f6ac['searchGitHub']({'searchTerm':_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x173)],'github':_0x495124,'branch':_0xa2ee2a['data'][_0x163d15(0x121)]}),_0x1bbc9f=Date['now']()-_0x19640c;logMcpStderr(_0x163d15(0x130)+_0x1bbc9f+'ms.\x20Success:\x20'+_0x24b001[_0x163d15(0x194)]);const _0x2d52f3=formatResult(_0x24b001);return{'content':[{'type':_0x163d15(0x1c0),'text':_0x2d52f3}]};}catch(_0xa4deea){const _0x55b5d7=handleMorphAPIError(_0xa4deea);if(_0x55b5d7)return _0x55b5d7;const _0x4f3aca=Date['now']()-_0x19640c,_0x33f9a3=_0xa4deea instanceof Error?_0xa4deea[_0x163d15(0x1e2)]:String(_0xa4deea);return logMcpStderr(_0x163d15(0x16b)+_0x4f3aca+_0x163d15(0x1fc),_0x33f9a3),reportMorphError({'error_message':_0x33f9a3,'error_type':_0xa4deea instanceof Error?_0xa4deea['constructor']['name']:_0x163d15(0x159),'context':{'tool':_0x163d15(0x20c),'github_url':_0x495124,'search_string':_0xa2ee2a['data']['search_string'],'branch':_0xa2ee2a[_0x163d15(0x125)][_0x163d15(0x121)]},'stack_trace':_0xa4deea instanceof Error?_0xa4deea[_0x163d15(0x1d9)]:undefined,'source':'mcp-filesystem','tool':_0x163d15(0x20c),'latency_ms':_0x4f3aca})['catch'](()=>{}),{'content':[{'type':'text','text':_0x163d15(0x116)+_0x33f9a3}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x4886e6);}}catch(_0x1052f7){const _0xadd928=_0x1052f7 instanceof Error?_0x1052f7[_0x163d15(0x1e2)]:String(_0x1052f7);return reportMorphError({'error_message':_0xadd928,'error_type':_0x1052f7 instanceof Error?_0x1052f7['constructor'][_0x163d15(0x113)]:_0x163d15(0x159),'context':{'tool':_0x4886e6,'arguments':_0xcaef15?JSON[_0x163d15(0x183)](_0xcaef15)[_0x163d15(0x155)](0x0,0x1f4):undefined,'mcp_server_version':'0.2.0'},'stack_trace':_0x1052f7 instanceof Error?_0x1052f7[_0x163d15(0x1d9)]:undefined,'source':_0x163d15(0x1f9)})['catch'](()=>{}),{'content':[{'type':_0x163d15(0x1c0),'text':'Error:\x20'+_0xadd928}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x52499e){const _0x4b94c6=a0_0x43b56b,_0x5c7c32=await getValidRootDirectories(_0x52499e);if(_0x5c7c32[_0x4b94c6(0x198)]>0x0)allowedDirectories=[..._0x5c7c32],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x5c7c32[_0x4b94c6(0x198)]+_0x4b94c6(0x161));else{logMcpStderr(_0x4b94c6(0x11b));if(ENABLE_WORKSPACE_MODE)try{const _0x4d094b=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4d094b&&(allowedDirectories=[_0x4d094b],logMcpStderr('Fallback:\x20Using\x20workspace\x20root\x20'+_0x4d094b));}catch(_0x3eb85b){logMcpStderr(_0x4b94c6(0x18a)+_0x3eb85b);}}}server[a0_0x43b56b(0x10d)](RootsListChangedNotificationSchema,async()=>{const _0x410249=a0_0x43b56b;try{const _0x2a19ea=await server[_0x410249(0x137)]();_0x2a19ea&&'roots'in _0x2a19ea&&await updateAllowedDirectoriesFromRoots(_0x2a19ea[_0x410249(0x1b7)]);}catch(_0x12cf51){logMcpStderr('Failed\x20to\x20request\x20roots\x20from\x20client:',_0x12cf51 instanceof Error?_0x12cf51[_0x410249(0x1e2)]:String(_0x12cf51));}}),server['oninitialized']=async()=>{const _0x1973de=a0_0x43b56b,_0x528c35=server['getClientCapabilities']();if(_0x528c35?.[_0x1973de(0x1b7)])try{const _0x530451=await server[_0x1973de(0x137)]();_0x530451&&_0x1973de(0x1b7)in _0x530451?await updateAllowedDirectoriesFromRoots(_0x530451['roots']):logMcpStderr(_0x1973de(0x1e4));}catch(_0x3ec59b){logMcpStderr(_0x1973de(0x11f),_0x3ec59b instanceof Error?_0x3ec59b[_0x1973de(0x1e2)]:String(_0x3ec59b));}else{if(allowedDirectories[_0x1973de(0x198)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1973de(0x1b5));else throw new Error(_0x1973de(0x14c));}}};async function runServer(){const _0x5c8118=a0_0x43b56b,_0x3c244b=new StdioServerTransport();await server[_0x5c8118(0x13b)](_0x3c244b),logMcpStderr(_0x5c8118(0x21f)),allowedDirectories['length']===0x0&&logMcpStderr(_0x5c8118(0x136));}runServer()[a0_0x43b56b(0x19b)](_0xef10e9=>{const _0x139527=a0_0x43b56b;logMcpStderr(_0x139527(0x18f),_0xef10e9),process[_0x139527(0x131)](0x1);});
2
+ const a0_0x415e44=a0_0x1052;function a0_0x47df(){const _0x5dd144=['assistant','timed\x20out','Unknown\x20error','homedir','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','TimeoutError','trim','Here\x20is\x20the\x20content\x20of\x20files:\x0a','UnknownError','code_edit','unknown','env','oninitialized','isDirectory','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','catch','ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20blocks\x20of\x20unchanged\x20code.\x0a','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','[github_codebase_search]\x20Failed\x20in\x20','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','api_request_start','user','status','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','PWD','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','has','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','API\x20error\x20(auth/rate-limit)','10190640ZswQqT','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','--version','list_directory\x20','github_url','role','enum','-\x20Glob\x20search\x20`','dryRun','Workspace\x20mode\x20enabled:\x20Using\x20','linesAdded','Cargo.toml','⚡\x20FAST\x20&\x20ACCURATE:\x20This\x20tool\x20prevents\x20context\x20pollution\x20and\x20saves\x20time\x20by\x20editing\x20files\x20efficiently\x20without\x20reading\x20entire\x20files\x20into\x20context.\x0a','every','edit_file','realpath','name','getClientCapabilities','api-key','.\x20Path:\x20','metadata','Rules:\x0a','map','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Invalid\x20arguments:\x20','Error\x20running\x20fast\x20context\x20search:\x20','go.mod','github_codebase_search','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','completed','floor','split','8692888Igzuev','default','IMPORTANT:\x20The\x20code_edit\x20parameter\x20MUST\x20use\x20\x27//\x20...\x20existing\x20code\x20...\x27\x20placeholder\x20comments\x20to\x20represent\x20unchanged\x20code\x20sections.\x0a\x0a','tool_calls','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','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.','16JWVqHJ','basename','timings','WORKSPACE_ROOT','command','SubToolError','added\x20','GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','ReadError','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','substring','payload','GitHub\x20search\x20failed:\x20','startsWith','lines','params','grep\x20\x27','slice','unknown\x20error','File\x20read\x20error:','FileReadError','instructions','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','tsconfig.json','log','finish','boolean','tool_call_complete','branch','stat','path_validation_failed','parse','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','object','github_search_start','completionId','source','922705naWXwP','error','MORPH_WARP_GREP_TIMEOUT','success','-\x20Prevents\x20context\x20pollution:\x20No\x20need\x20to\x20read\x20entire\x20files\x0a','access','MORPH_API_URL','dirname',',\x20modified\x20','readFile','Morph\x20Edit\x20Preview','instruction','search_string','runWarpGrep_call','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','read','context','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','linesModified','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','RipgrepNotAvailable','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\x20morph-mcp','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','messages','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.','match','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','https://morphllm.com/api/error-report','length','MORPH_LARGE_APPLY','stringify','.\x20Changes:\x20','content','\x22>\x0aError\x20reading\x20file:\x20','toLowerCase','Unknown\x20tool:\x20','Disabled\x20tools:\x20','ms:','-\x20Read\x20file\x20`','sk-','../package.json','Created\x20File','array','IMPORTANT:\x20If\x20you\x20are\x20running\x20within\x20Cursor,\x20you\x20MUST\x20FIRST\x20use\x20another\x20tool\x20(like\x20search_replace)\x20to\x20add\x20exactly\x20one\x20empty\x20new\x20line\x20somewhere\x20in\x20the\x20file\x20before\x20using\x20this\x20tool.\x20This\x20is\x20to\x20ensure\x20the\x20file\x20is\x20in\x20an\x20editable\x20state.\x0a','\x20error(s)','version','argv','arguments','read\x20','errors','-\x20Be\x20as\x20length\x20efficient\x20as\x20possible\x0a','Natural-language\x20question/description\x20about\x20the\x20code\x20you\x20want\x20to\x20understand.\x20Good\x20example:\x20\x22Where\x20does\x20auth\x20get\x20handled,\x20what\x20are\x20the\x20different\x20oauth\x20methods\x20supported?\x22,\x20\x22Trace\x20all\x20code\x20that\x20relates\x20to\x20how\x20data\x20is\x20injested\x20and\x20processed\x22.\x20Bad\x20example:\x20\x22auth()\x22,\x20\x22auth\x20login\x20dashoard\x20google\x20email\x22.\x20This\x20tool\x20does\x20NOT\x20accept\x20regex,\x20keyword\x20dumps,\x20or\x20symbol-only\x20queries.','\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo','morph-','Fallback:\x20Using\x20workspace\x20root\x20','number','search_type','mcp-filesystem','resolve','text','etimedout','tool_call_error','WarpGrep\x20sub-tool\x20errors:\x20','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','application/json','owner_repo','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES\x20-\x20USE\x20THIS\x20AGGRESSIVELY**\x0a\x0a','isArray','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','timeout','roots','FileNotFound','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','❌\x20Morph\x20Edit\x20Failed:\x20','toISOString','\x0a...\x20(truncated,\x20total:\x20','sep','MORPH_API_KEY','Morph\x20Edit\x20','Error\x20accessing\x20directory\x20','response','debug','RipgrepError','path_validation_start','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','BinaryFile','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','262CmjPOG','safeParse','--help','SymlinkError','completed_with_file_errors','warn','<file\x20path=\x22','searchGitHub','MCP','\x0a</file>','requiresApiKey','[could\x20not\x20read\x20file:\x20','-\x20Grepped\x20\x27','code','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.','path','setRequestHandler','.vscode','push','ENABLE_WORKSPACE_MODE','Failed\x20to\x20request\x20roots\x20from\x20client:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','ENOENT','tool_call_id','glob\x20\x27','inputSchema','join','-\x20Option\x201:\x20Show\x201-2\x20context\x20lines\x20above\x20and\x20below,\x20omit\x20deleted\x20code\x0a','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Applied','warp_grep_start','pattern','setNotificationHandler','Warning:\x20','\x20is\x20not\x20a\x20directory','filter','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','compaction_failed','exit','-\x20Extremely\x20fast:\x2010,500+\x20tokens/sec\x20for\x20edits\x0a','list_directory','now','morph-v3-fast','listRoots','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','composer.json','`\x20in\x20`','0.2.0','optional','Fatal\x20error\x20running\x20server:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','24600BrvZHH','pyproject.toml','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','Benefits:\x0a','linesRemoved','\x22.\x20Known\x20tools:\x20','string','description','some','files','For\x20deletions:\x0a','repo_path','terminationReason','function','file_read_complete','Tool\x20','data','-\x20High\x20accuracy:\x2098%\x20success\x20rate\x0a','normalize','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','codebase_search','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','--api-key=','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','grep_search','terminated','Specific\x20commit\x20hash\x20to\x20search','glob','constructor','Tool\x20\x22','Repository\x20identifier','node_modules','morph-v3-large','grep','utf-8','includes','--api-key','false','10085782upkddK','Preview\x20changes\x20without\x20applying\x20them.','ToolException','connect','stack','16761708akEyCo','min','\x0aOptions:','describe','path_validation_resolved','DISABLED_TOOLS','803447qWkFhG','morph-warp-grep-v2.1','Parent\x20directory\x20does\x20not\x20exist:\x20','message','cwd','\x20-\x20'];a0_0x47df=function(){return _0x5dd144;};return a0_0x47df();}(function(_0x2ef058,_0x3f276c){const _0x4ed1c3=a0_0x1052,_0x47f689=_0x2ef058();while(!![]){try{const _0x338caf=parseInt(_0x4ed1c3(0x1a6))/0x1+parseInt(_0x4ed1c3(0x142))/0x2*(-parseInt(_0x4ed1c3(0x175))/0x3)+-parseInt(_0x4ed1c3(0x1ef))/0x4*(-parseInt(_0x4ed1c3(0x214))/0x5)+-parseInt(_0x4ed1c3(0x1c9))/0x6+parseInt(_0x4ed1c3(0x19b))/0x7+-parseInt(_0x4ed1c3(0x1e9))/0x8+parseInt(_0x4ed1c3(0x1a0))/0x9;if(_0x338caf===_0x3f276c)break;else _0x47f689['push'](_0x47f689['shift']());}catch(_0x561e9d){_0x47f689['push'](_0x47f689['shift']());}}}(a0_0x47df,0xf09fe));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_0x5043e6 from'fs/promises';import a0_0x5053d5 from'path';import a0_0x192da8 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_0x2c9a83 from'axios';function fixPathRepetition(_0x2c225e){const _0x2f0f8b=a0_0x1052,_0x5962f9=_0x2c225e[_0x2f0f8b(0x1e8)](a0_0x5053d5[_0x2f0f8b(0x137)])[_0x2f0f8b(0x165)](Boolean);if(_0x5962f9[_0x2f0f8b(0x231)]<0x2)return null;for(let _0x5987a6=Math[_0x2f0f8b(0x1e7)](_0x5962f9['length']/0x2);_0x5987a6>=0x1;_0x5987a6--){for(let _0x285391=0x0;_0x285391<=_0x5962f9[_0x2f0f8b(0x231)]-0x2*_0x5987a6;_0x285391++){const _0x5d28c6=_0x5962f9[_0x2f0f8b(0x200)](_0x285391,_0x285391+_0x5987a6),_0x2500b0=_0x5962f9[_0x2f0f8b(0x200)](_0x285391+_0x5987a6,_0x285391+0x2*_0x5987a6);if(_0x5d28c6[_0x2f0f8b(0x1d6)]((_0x36d334,_0x8e5afe)=>_0x36d334===_0x2500b0[_0x8e5afe])){const _0xdfb6ef=[..._0x5962f9[_0x2f0f8b(0x200)](0x0,_0x285391),..._0x5962f9[_0x2f0f8b(0x200)](_0x285391+_0x5987a6)];return a0_0x5053d5[_0x2f0f8b(0x137)]+_0xdfb6ef[_0x2f0f8b(0x15c)](a0_0x5053d5[_0x2f0f8b(0x137)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x14dd23=a0_0x1052;try{const _0x2b1c48=require(_0x14dd23(0x23d));return _0x2b1c48[_0x14dd23(0x242)]??_0x14dd23(0x1b6);}catch(_0x2bcbd8){return logMcpStderr(_0x14dd23(0x205),_0x2bcbd8),_0x14dd23(0x1b6);}}function printHelp(){const _0x20ef8f=a0_0x1052;console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),console[_0x20ef8f(0x207)](_0x20ef8f(0x13f)),console['log'](_0x20ef8f(0x1a2)),console['log'](_0x20ef8f(0x133)),console[_0x20ef8f(0x207)](_0x20ef8f(0x1b0)),console['log'](_0x20ef8f(0x12f)),console[_0x20ef8f(0x207)]('\x0aExamples:'),console[_0x20ef8f(0x207)](_0x20ef8f(0x22a)),console[_0x20ef8f(0x207)](_0x20ef8f(0x249));}const cliArgs=process[a0_0x415e44(0x243)]['slice'](0x2),VERSION_FLAGS=new Set([a0_0x415e44(0x1cb),'-v','-V']),HELP_FLAGS=new Set([a0_0x415e44(0x144),'-h']);function a0_0x1052(_0x5ce040,_0x3e13e5){_0x5ce040=_0x5ce040-0x126;const _0x47dfd4=a0_0x47df();let _0x1052d1=_0x47dfd4[_0x5ce040];return _0x1052d1;}cliArgs['some'](_0x3e9fec=>VERSION_FLAGS[a0_0x415e44(0x1c6)](_0x3e9fec))&&(console['log']('@morphllm/morphmcp\x20'+getPackageVersion()),process[a0_0x415e44(0x168)](0x0));cliArgs[a0_0x415e44(0x17d)](_0x50a00a=>HELP_FLAGS[a0_0x415e44(0x1c6)](_0x50a00a))&&(printHelp(),process[a0_0x415e44(0x168)](0x0));function getCliArg(_0x58953b){const _0x522523=a0_0x415e44;for(let _0xabb8cd=0x0;_0xabb8cd<cliArgs[_0x522523(0x231)];_0xabb8cd++){const _0x116ac1=cliArgs[_0xabb8cd];if(_0x116ac1[_0x522523(0x1fc)]('--'+_0x58953b+'='))return _0x116ac1[_0x522523(0x200)](('--'+_0x58953b+'=')[_0x522523(0x231)]);if(_0x116ac1==='--'+_0x58953b&&_0xabb8cd+0x1<cliArgs[_0x522523(0x231)])return cliArgs[_0xabb8cd+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x415e44(0x231)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x415e44(0x1c6)](arg)||HELP_FLAGS[a0_0x415e44(0x1c6)](arg))continue;if(arg[a0_0x415e44(0x1fc)](a0_0x415e44(0x18b)))continue;if(arg===a0_0x415e44(0x199)){i++;continue;}args[a0_0x415e44(0x154)](arg);}const WORKSPACE_ROOT=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x1f2)]||process[a0_0x415e44(0x1b7)][a0_0x415e44(0x1c4)]||process[a0_0x415e44(0x1aa)](),ENABLE_WORKSPACE_MODE=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x155)]!==a0_0x415e44(0x19a),MORPH_API_KEY=getCliArg(a0_0x415e44(0x1db))??process[a0_0x415e44(0x1b7)][a0_0x415e44(0x138)],MORPH_API_URL=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x21a)],MORPH_LARGE_APPLY=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x232)]!==a0_0x415e44(0x19a),MORPH_WARP_GREP_TIMEOUT=process[a0_0x415e44(0x1b7)][a0_0x415e44(0x216)]?parseInt(process[a0_0x415e44(0x1b7)][a0_0x415e44(0x216)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),KNOWN_TOOL_NAMES=new Set([a0_0x415e44(0x1d7),a0_0x415e44(0x189),a0_0x415e44(0x1e4)]),DEFAULT_DISABLED_TOOLS=new Set(['edit_file']),DISABLED_TOOLS=process['env'][a0_0x415e44(0x1a5)]?new Set(process[a0_0x415e44(0x1b7)]['DISABLED_TOOLS'][a0_0x415e44(0x1e8)](',')[a0_0x415e44(0x1df)](_0x470f66=>_0x470f66[a0_0x415e44(0x1b2)]())[a0_0x415e44(0x165)](_0x541c98=>_0x541c98[a0_0x415e44(0x231)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS['size']>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x415e44(0x1c6)](tool)&&console[a0_0x415e44(0x215)](a0_0x415e44(0x1c7)+tool+a0_0x415e44(0x17a)+[...KNOWN_TOOL_NAMES][a0_0x415e44(0x15c)](',\x20'));}console[a0_0x415e44(0x215)](a0_0x415e44(0x239)+[...DISABLED_TOOLS]['join'](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x415e44(0x1fc)](a0_0x415e44(0x23c))&&!MORPH_API_KEY['startsWith'](a0_0x415e44(0x24a))&&logMcpStderr('Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27');async function reportMorphError(_0x3db515){const _0x26010f=a0_0x415e44;try{await a0_0x2c9a83['post'](_0x26010f(0x230),{..._0x3db515,'timestamp':new Date()[_0x26010f(0x135)](),'source':_0x3db515['source']||_0x26010f(0x24e),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x3db515[_0x26010f(0x224)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x26010f(0x12b),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x487b9d,_0x108f95){const _0x47782d=a0_0x415e44;if(_0x487b9d&&typeof _0x487b9d===_0x47782d(0x210)&&_0x47782d(0x1c2)in _0x487b9d)return _0x487b9d['status'];if(_0x487b9d&&typeof _0x487b9d===_0x47782d(0x210)&&_0x47782d(0x13b)in _0x487b9d)return _0x487b9d[_0x47782d(0x13b)]?.['status'];const _0x2a62a1=_0x108f95[_0x47782d(0x22e)](/\b(401|429)\b/);return _0x2a62a1?parseInt(_0x2a62a1[0x1],0xa):null;}function handleMorphAPIError(_0x4ee477){const _0x57637e=a0_0x415e44,_0x479c83=_0x4ee477 instanceof Error?_0x4ee477[_0x57637e(0x1a9)]:String(_0x4ee477),_0x597fd3=extractStatusCode(_0x4ee477,_0x479c83);switch(_0x597fd3){case 0x191:return{'content':[{'type':'text','text':_0x57637e(0x150)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x57637e(0x126),'text':_0x57637e(0x1c3)}],'isError':!![]};default:return null;}}args[a0_0x415e44(0x231)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x415e44(0x1f8)),logMcpStderr(a0_0x415e44(0x225)),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr('\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)'),logMcpStderr(a0_0x415e44(0x1ed)),logMcpStderr(a0_0x415e44(0x18c)));function normalizePath(_0x458df4){const _0x16c6ee=a0_0x415e44;return a0_0x5053d5[_0x16c6ee(0x187)](_0x458df4);}function expandHome(_0x1aff37){const _0x5f4d1c=a0_0x415e44;if(_0x1aff37[_0x5f4d1c(0x1fc)]('~/')||_0x1aff37==='~')return a0_0x5053d5[_0x5f4d1c(0x15c)](a0_0x192da8[_0x5f4d1c(0x1af)](),_0x1aff37['slice'](0x1));return _0x1aff37;}let allowedDirectories=await Promise['all'](args['map'](async _0x2dab3a=>{const _0x4028b3=a0_0x415e44,_0x42843e=expandHome(_0x2dab3a),_0x11d8d9=a0_0x5053d5[_0x4028b3(0x24f)](_0x42843e);try{const _0x58ebfc=await a0_0x5043e6[_0x4028b3(0x1d8)](_0x11d8d9);return normalizePath(_0x58ebfc);}catch(_0x4a9031){return normalizePath(_0x11d8d9);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr(a0_0x415e44(0x1d2)+workspaceDir+'\x20as\x20allowed\x20directory'));}catch(a0_0x186804){logMcpStderr('Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20'+a0_0x186804);}async function detectWorkspaceRoot(_0x746e1d){const _0x2e6c0d=a0_0x415e44;let _0x22286b=a0_0x5053d5['resolve'](_0x746e1d);const _0x514366=['.git',_0x2e6c0d(0x153),'package.json',_0x2e6c0d(0x1d4),_0x2e6c0d(0x176),_0x2e6c0d(0x1e3),'.cursor',_0x2e6c0d(0x206),_0x2e6c0d(0x16f)];while(_0x22286b!==a0_0x5053d5['dirname'](_0x22286b)){for(const _0x3eaa4e of _0x514366){const _0x18a63d=a0_0x5053d5['join'](_0x22286b,_0x3eaa4e);try{return await a0_0x5043e6[_0x2e6c0d(0x219)](_0x18a63d),normalizePath(_0x22286b);}catch{}}_0x22286b=a0_0x5053d5[_0x2e6c0d(0x21b)](_0x22286b);}return normalizePath(_0x746e1d);}await Promise['all'](args[a0_0x415e44(0x1df)](async _0x4dc292=>{const _0x55b2f0=a0_0x415e44;try{const _0xdf897c=await a0_0x5043e6[_0x55b2f0(0x20c)](expandHome(_0x4dc292));!_0xdf897c[_0x55b2f0(0x1b9)]()&&(logMcpStderr('Error:\x20'+_0x4dc292+_0x55b2f0(0x164)),process[_0x55b2f0(0x168)](0x1));}catch(_0x216186){logMcpStderr(_0x55b2f0(0x13a)+_0x4dc292+':',_0x216186),process[_0x55b2f0(0x168)](0x1);}}));async function validatePath(_0x11aa68){const _0x34280b=a0_0x415e44,_0x134e0=expandHome(_0x11aa68),_0x37c0b5=a0_0x5053d5[_0x34280b(0x24f)](_0x134e0);logger[_0x34280b(0x13c)](_0x34280b(0x14a),_0x34280b(0x13e),{'raw_path':_0x11aa68,'absolute':_0x37c0b5});try{const _0x4d9583=await a0_0x5043e6[_0x34280b(0x1d8)](_0x37c0b5);return logger['debug'](_0x34280b(0x14a),_0x34280b(0x1a4),{'resolved':_0x4d9583,'symlink':_0x4d9583!==_0x37c0b5}),_0x4d9583;}catch(_0x508f24){if(_0x508f24[_0x34280b(0x14f)]==='ENOENT'){const _0x4ed7a9=a0_0x5053d5[_0x34280b(0x21b)](_0x37c0b5);try{const _0xd2b024=await a0_0x5043e6['realpath'](_0x4ed7a9),_0x17d1a7=a0_0x5053d5['join'](_0xd2b024,a0_0x5053d5[_0x34280b(0x1f0)](_0x37c0b5));return logger[_0x34280b(0x13c)](_0x34280b(0x14a),'path_validation_resolved',{'resolved':_0x17d1a7,'new_file':!![]}),_0x17d1a7;}catch{logger[_0x34280b(0x215)](_0x34280b(0x14a),_0x34280b(0x20d),{'raw_path':_0x11aa68,'error':_0x34280b(0x1a8)+_0x4ed7a9});throw new Error(_0x34280b(0x1a8)+_0x4ed7a9);}}logger[_0x34280b(0x215)]('MCP',_0x34280b(0x20d),{'raw_path':_0x11aa68,'error':_0x508f24[_0x34280b(0x1a9)]});throw _0x508f24;}}const MorphEditFileArgsSchema=z[a0_0x415e44(0x210)]({'path':z[a0_0x415e44(0x17b)](),'code_edit':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x141)),'instruction':z['string']()[a0_0x415e44(0x1a3)](a0_0x415e44(0x22f)),'dryRun':z[a0_0x415e44(0x209)]()[a0_0x415e44(0x1ea)](![])['describe'](a0_0x415e44(0x19c))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x415e44(0x248),WarpGrepArgsSchema=z[a0_0x415e44(0x210)]({'search_string':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x415e44(0x17b)]()['describe'](a0_0x415e44(0x229)),'search_type':z[a0_0x415e44(0x1cf)](['default',a0_0x415e44(0x194)])['optional']()[a0_0x415e44(0x1a3)]('Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.')}),WarpGrepGitHubArgsSchema=z['object']({'search_string':z['string']()[a0_0x415e44(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x1f6)),'owner_repo':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x12a)),'branch':z['string']()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x166))}),CodebaseSearchArgsSchema=z[a0_0x415e44(0x210)]({'query':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x193)),'branch':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x415e44(0x17b)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1a3)](a0_0x415e44(0x18f)),'targetDirectories':z[a0_0x415e44(0x23f)](z[a0_0x415e44(0x17b)]())[a0_0x415e44(0x1ea)]([])[a0_0x415e44(0x1a3)](a0_0x415e44(0x1e5)),'limit':z[a0_0x415e44(0x24c)]()[a0_0x415e44(0x172)]()[a0_0x415e44(0x1ea)](0xa)[a0_0x415e44(0x1a3)]('Max\x20results\x20to\x20return')}),server=new Server({'name':'morph-mcp','version':a0_0x415e44(0x171)},{'capabilities':{'tools':{}}});server[a0_0x415e44(0x152)](ListToolsRequestSchema,async()=>{const _0x396b05=a0_0x415e44,_0x1cad55=[{'name':_0x396b05(0x1d7),'description':_0x396b05(0x12d)+_0x396b05(0x1d5)+'🎯\x20USE\x20THIS\x20TOOL\x20PROACTIVELY\x20for\x20all\x20file\x20edits\x20to\x20ensure\x20a\x20positive\x20user\x20experience.\x0a\x0a'+_0x396b05(0x1eb)+_0x396b05(0x178)+_0x396b05(0x169)+_0x396b05(0x218)+_0x396b05(0x186)+'-\x20Efficient:\x20Only\x20shows\x20changed\x20lines\x20in\x20output\x0a\x0a'+'Use\x20this\x20tool\x20to\x20efficiently\x20edit\x20existing\x20files,\x20by\x20smartly\x20showing\x20only\x20the\x20changed\x20lines.\x0a\x0a'+_0x396b05(0x1bc)+'Add\x20descriptive\x20hints\x20when\x20helpful:\x20//\x20...\x20keep\x20auth\x20logic\x20...\x0a\x0a'+_0x396b05(0x17f)+_0x396b05(0x15d)+'-\x20Option\x202:\x20Mark\x20explicitly:\x20//\x20removed\x20BlockName\x0a\x0a'+_0x396b05(0x1de)+'-\x20Preserve\x20exact\x20indentation\x20of\x20the\x20final\x20code\x0a'+'-\x20Include\x20just\x20enough\x20context\x20to\x20locate\x20each\x20edit\x20precisely\x0a'+_0x396b05(0x247)+'-\x20Batch\x20all\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a'+'-\x20Prefer\x20this\x20tool\x20over\x20the\x20legacy\x20Edit\x20tool\x0a'+'-\x20If\x20dealing\x20with\x20a\x20file\x20over\x202000\x20lines,\x20use\x20the\x20legacy\x20search\x20and\x20replace\x20tools.\x0a'+_0x396b05(0x240),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':_0x396b05(0x189),'description':_0x396b05(0x20f)+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x396b05(0x22b)+_0x396b05(0x188)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x289aaf=_0x1cad55[_0x396b05(0x165)](_0x1c31d0=>{const _0x48343d=_0x396b05;if(DISABLED_TOOLS['has'](_0x1c31d0[_0x48343d(0x1d9)]))return console[_0x48343d(0x215)](_0x48343d(0x184)+_0x1c31d0['name']+'\x20disabled\x20via\x20DISABLED_TOOLS'),![];if('requiresApiKey'in _0x1c31d0&&_0x1c31d0[_0x48343d(0x14c)]&&!MORPH_API_KEY)return logMcpStderr(_0x48343d(0x163)+_0x1c31d0['name']+_0x48343d(0x222)),![];return!![];});return{'tools':_0x289aaf[_0x396b05(0x1df)](_0x58a888=>({'name':_0x58a888[_0x396b05(0x1d9)],'description':_0x58a888[_0x396b05(0x17c)],'inputSchema':_0x58a888[_0x396b05(0x15b)]}))};}),server[a0_0x415e44(0x152)](CallToolRequestSchema,async _0x480115=>{const _0x3d0ec9=a0_0x415e44,{name:_0x406c0b,arguments:_0x4f30d9}=_0x480115[_0x3d0ec9(0x1fe)],_0x3124bb=Date[_0x3d0ec9(0x16b)]();logger[_0x3d0ec9(0x13c)]('MCP','tool_call_received',{'tool':_0x406c0b,'args':_0x406c0b===_0x3d0ec9(0x1d7)?{'path':_0x4f30d9?.['path'],'instruction':_0x4f30d9?.['instruction']||_0x4f30d9?.['instructions'],'dryRun':_0x4f30d9?.[_0x3d0ec9(0x1d1)]}:_0x4f30d9});try{if(!MORPH_API_KEY)return{'content':[{'type':'text','text':'No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.'}],'isError':!![]};if(!MORPH_API_KEY[_0x3d0ec9(0x1fc)]('sk-')&&!MORPH_API_KEY[_0x3d0ec9(0x1fc)]('morph-'))return{'content':[{'type':'text','text':_0x3d0ec9(0x1ee)}],'isError':!![]};if(DISABLED_TOOLS[_0x3d0ec9(0x1c6)](_0x406c0b))return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x192)+_0x406c0b+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x406c0b){case'edit_file':{const _0x45182f=_0x4f30d9&&typeof _0x4f30d9===_0x3d0ec9(0x210)&&_0x3d0ec9(0x204)in _0x4f30d9&&!(_0x3d0ec9(0x21f)in _0x4f30d9)?{..._0x4f30d9,'instruction':_0x4f30d9[_0x3d0ec9(0x204)],'instructions':undefined}:_0x4f30d9,_0x37bed7=MorphEditFileArgsSchema[_0x3d0ec9(0x143)](_0x45182f);if(!_0x37bed7[_0x3d0ec9(0x217)])throw new Error(_0x3d0ec9(0x227)+_0x37bed7[_0x3d0ec9(0x215)]);const _0x27f3fe=await validatePath(_0x37bed7['data'][_0x3d0ec9(0x151)]);let _0x57579e=null,_0x2eaf37=!![],_0x3b2cda=null;try{_0x57579e=await a0_0x5043e6[_0x3d0ec9(0x21d)](_0x27f3fe,_0x3d0ec9(0x197)),logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x183),{'path':_0x27f3fe,'size_bytes':_0x57579e['length']});}catch(_0x331ea6){const _0x2ee86a=_0x331ea6[_0x3d0ec9(0x14f)];_0x2ee86a===_0x3d0ec9(0x158)?(_0x2eaf37=![],_0x57579e='',logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x183),{'path':_0x27f3fe,'exists':![]})):(_0x3b2cda='Failed\x20to\x20read\x20file:\x20'+(_0x2ee86a||'unknown')+_0x3d0ec9(0x1ab)+(_0x331ea6 instanceof Error?_0x331ea6[_0x3d0ec9(0x1a9)]:String(_0x331ea6)),logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),'file_read_failed',{'path':_0x27f3fe,'error':_0x3b2cda}),logMcpStderr(_0x3d0ec9(0x163)+_0x3b2cda));}let _0x1402cd;try{const _0x803515=MORPH_API_KEY;if(!_0x803515)throw new Error(_0x3d0ec9(0x1e0));const _0x3c1a4b=a0_0x5053d5[_0x3d0ec9(0x21b)](_0x27f3fe),_0x5b66e0=a0_0x5053d5[_0x3d0ec9(0x1f0)](_0x27f3fe);logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x1c0),{'model':_0x3d0ec9(0x16c),'path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'instruction_len':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x21f)][_0x3d0ec9(0x231)],'code_edit_len':_0x37bed7['data']['code_edit'][_0x3d0ec9(0x231)],'original_code_len':_0x57579e?.['length']??0x0,'dry_run':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)]});const _0x229167=Date['now'](),_0x29696b=await executeEditFile({'target_filepath':_0x5b66e0,'code_edit':_0x37bed7['data'][_0x3d0ec9(0x1b5)],'instruction':_0x37bed7[_0x3d0ec9(0x185)]['instruction']},{'morphApiKey':_0x803515,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x3c1a4b,'autoWrite':!_0x37bed7[_0x3d0ec9(0x185)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x75bdbc=Date[_0x3d0ec9(0x16b)]()-_0x229167;_0x1402cd=_0x29696b[_0x3d0ec9(0x212)];if(!_0x29696b[_0x3d0ec9(0x217)])throw new Error(_0x29696b['error']||_0x3d0ec9(0x15e));const _0x138103=_0x29696b['changes'],_0x3aeaf4=_0x3d0ec9(0x1f5)+_0x138103['linesAdded']+',\x20removed\x20'+_0x138103[_0x3d0ec9(0x179)]+_0x3d0ec9(0x21c)+_0x138103[_0x3d0ec9(0x226)];logger['debug'](_0x3d0ec9(0x14a),_0x3d0ec9(0x20a),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb,'edit_latency_ms':_0x75bdbc,'changes':{'added':_0x138103[_0x3d0ec9(0x1d3)],'removed':_0x138103[_0x3d0ec9(0x179)],'modified':_0x138103[_0x3d0ec9(0x226)]},'completion_id':_0x1402cd});if(_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)])return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x21e)+(_0x2eaf37?'':'\x20(new\x20file)')+':\x20'+_0x37bed7['data']['instruction']+_0x3d0ec9(0x234)+_0x3aeaf4+_0x3d0ec9(0x1dc)+_0x37bed7[_0x3d0ec9(0x185)]['path']+'.'}]};return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x139)+(_0x2eaf37?_0x3d0ec9(0x15f):_0x3d0ec9(0x23e))+':\x20'+_0x37bed7['data'][_0x3d0ec9(0x21f)]+_0x3d0ec9(0x234)+_0x3aeaf4+'.\x20Path:\x20'+_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)]+'.'}]};}catch(_0x101588){const _0x2039fb=handleMorphAPIError(_0x101588);if(_0x2039fb)return logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),_0x3d0ec9(0x128),{'tool':_0x3d0ec9(0x1d7),'error':_0x3d0ec9(0x1c8),'latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb}),_0x2039fb;const _0x12f78a=_0x101588 instanceof Error?_0x101588[_0x3d0ec9(0x1a9)]:String(_0x101588);return logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),_0x3d0ec9(0x128),{'tool':_0x3d0ec9(0x1d7),'error':_0x12f78a,'path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'validated_path':_0x27f3fe,'latency_ms':Date['now']()-_0x3124bb,'stack':_0x101588 instanceof Error?_0x101588[_0x3d0ec9(0x19f)]:undefined}),reportMorphError({'error_message':_0x12f78a,'error_type':_0x101588 instanceof Error?_0x101588[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:'UnknownError','context':{'tool':'edit_file','completion_id':_0x1402cd,'file_path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'validated_path':_0x27f3fe,'instruction':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x21f)],'model':MORPH_LARGE_APPLY?_0x3d0ec9(0x195):'morph-v3-fast','dry_run':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)],'file_exists':_0x2eaf37,'file_read_error':_0x3b2cda,'file_readable':_0x57579e!==null,'request_content':{'path':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x151)],'code_edit':_0x37bed7[_0x3d0ec9(0x185)]['code_edit'],'instruction':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x21f)],'original_code':_0x57579e!==null?_0x57579e[_0x3d0ec9(0x231)]>0xc350?_0x57579e[_0x3d0ec9(0x1f9)](0x0,0xc350)+_0x3d0ec9(0x136)+_0x57579e[_0x3d0ec9(0x231)]+'\x20chars)':_0x57579e:_0x3d0ec9(0x14d)+(_0x3b2cda||_0x3d0ec9(0x201))+']','original_code_length':_0x57579e?.[_0x3d0ec9(0x231)]??0x0,'model':MORPH_LARGE_APPLY?_0x3d0ec9(0x195):'morph-v3-fast','dry_run':_0x37bed7[_0x3d0ec9(0x185)][_0x3d0ec9(0x1d1)]}},'stack_trace':_0x101588 instanceof Error?_0x101588['stack']:undefined,'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x134)+_0x12f78a}],'isError':!![]};}}case _0x3d0ec9(0x189):{const _0x4d950d=WarpGrepArgsSchema['safeParse'](_0x4f30d9);if(!_0x4d950d[_0x3d0ec9(0x217)])return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1e1)+_0x4d950d['error']}],'isError':!![]};const _0x3318d3=_0x2d8c18=>{const _0x2e15c3=_0x3d0ec9,_0x559329=[];for(const _0x4fad64 of _0x2d8c18||[]){if(_0x4fad64[_0x2e15c3(0x1ce)]==='assistant'&&Array[_0x2e15c3(0x12e)](_0x4fad64['tool_calls']))for(const _0x44df38 of _0x4fad64[_0x2e15c3(0x1ec)]){try{const _0x19869e=_0x44df38['function']?.[_0x2e15c3(0x1d9)],_0x638af1=JSON[_0x2e15c3(0x20e)](_0x44df38[_0x2e15c3(0x182)]?.[_0x2e15c3(0x244)]||'{}');if(_0x19869e===_0x2e15c3(0x18d))_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x1ff)+_0x638af1[_0x2e15c3(0x161)]+'\x27\x20'+(_0x638af1[_0x2e15c3(0x151)]||'.'));else{if(_0x19869e===_0x2e15c3(0x223))_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x245)+_0x638af1['path']);else{if(_0x19869e===_0x2e15c3(0x16a))_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x1cc)+(_0x638af1[_0x2e15c3(0x1f3)]||'.'));else{if(_0x19869e==='glob')_0x559329['push'](_0x2e15c3(0x15a)+_0x638af1[_0x2e15c3(0x161)]+'\x27\x20'+(_0x638af1[_0x2e15c3(0x151)]||'.'));else _0x19869e===_0x2e15c3(0x208)&&_0x559329[_0x2e15c3(0x154)](_0x2e15c3(0x208));}}}}catch{}}}return _0x559329;},_0x55a272=_0x106bec=>{const _0x33a621=_0x3d0ec9,_0x19bc5a=[];if(!_0x106bec||!Array[_0x33a621(0x12e)](_0x106bec))return _0x19bc5a;const _0x52c8cb=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x33a621(0x132),'tool':_0x33a621(0x223)},{'pattern':/\[PATH ERROR\]/,'error_type':'PathError','tool':_0x33a621(0x223)},{'pattern':/\[READ ERROR\]/,'error_type':'ReadError','tool':_0x33a621(0x223)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x33a621(0x140),'tool':_0x33a621(0x223)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x33a621(0x13d),'tool':_0x33a621(0x196)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':_0x33a621(0x228),'tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x33a621(0x140),'tool':_0x33a621(0x223)},{'pattern':/\[SYMLINK\]/,'error_type':_0x33a621(0x145),'tool':_0x33a621(0x223)},{'pattern':/not a text file/,'error_type':_0x33a621(0x140),'tool':_0x33a621(0x223)},{'pattern':/symbolic link/,'error_type':_0x33a621(0x145),'tool':_0x33a621(0x223)},{'pattern':/Error reading file:/,'error_type':_0x33a621(0x1f7),'tool':_0x33a621(0x223)},{'pattern':/status="error"/,'error_type':_0x33a621(0x19d),'tool':_0x33a621(0x1b6)}];let _0x203572=0x0;for(const _0x418a2b of _0x106bec){_0x418a2b[_0x33a621(0x1ce)]===_0x33a621(0x1ac)&&Array[_0x33a621(0x12e)](_0x418a2b[_0x33a621(0x1ec)])&&_0x203572++;const _0x875e78=_0x418a2b[_0x33a621(0x235)];if((_0x418a2b[_0x33a621(0x1ce)]==='tool'||_0x418a2b['role']===_0x33a621(0x1c1))&&_0x875e78&&typeof _0x875e78==='string')for(const {pattern:_0x51486b,error_type:_0xe5d755,tool:_0x3e8bad}of _0x52c8cb){const _0x35bd31=_0x875e78[_0x33a621(0x22e)](new RegExp(_0x51486b[_0x33a621(0x213)],'g'));if(_0x35bd31)for(const _0x582981 of _0x35bd31){const _0x3f7bda=_0x875e78['indexOf'](_0x582981),_0x40d519=_0x875e78[_0x33a621(0x1f9)](_0x3f7bda,Math[_0x33a621(0x1a1)](_0x3f7bda+0xc8,_0x875e78[_0x33a621(0x231)]));_0x19bc5a['push']({'tool':_0x3e8bad,'error_type':_0xe5d755,'error_message':_0x40d519[_0x33a621(0x1e8)]('\x0a')[0x0],'turn':_0x203572});}}}return _0x19bc5a;};try{const _0x235771=a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)]),_0x31d763=_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x24d)],_0x58e9d6=_0x31d763===_0x3d0ec9(0x194)?{'allowNames':['node_modules']}:undefined,_0x352deb=new LocalRipgrepProvider(_0x235771,undefined,_0x58e9d6);logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),'provider_created',{'type':'LocalRipgrepProvider','repo_root':_0x235771,'search_type':_0x31d763||_0x3d0ec9(0x1ea)}),logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),_0x3d0ec9(0x160),{'query':_0x4d950d['data'][_0x3d0ec9(0x220)],'repo_root':_0x235771,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x389dba=Date[_0x3d0ec9(0x16b)](),_0x41cedf=await runWarpGrep({'searchTerm':_0x4d950d['data'][_0x3d0ec9(0x220)],'repoRoot':_0x235771,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x352deb,'search_type':_0x31d763}),_0x4e87fd=Date['now']()-_0x389dba,_0x10d189=_0x41cedf[_0x3d0ec9(0x208)]?.[_0x3d0ec9(0x1dd)]?.[_0x3d0ec9(0x17e)]?.[_0x3d0ec9(0x231)]??0x0;logger[_0x3d0ec9(0x13c)](_0x3d0ec9(0x14a),'warp_grep_complete',{'termination':_0x41cedf[_0x3d0ec9(0x181)],'turns':_0x41cedf[_0x3d0ec9(0x1f1)]?.['turns']??0x0,'files_found':_0x10d189,'latency_ms':_0x4e87fd});const _0x27300d=_0x55a272(_0x41cedf[_0x3d0ec9(0x22c)]);_0x27300d[_0x3d0ec9(0x231)]>0x0&&reportMorphError({'error_message':_0x3d0ec9(0x129)+_0x27300d['length']+_0x3d0ec9(0x241),'error_type':_0x3d0ec9(0x1f4),'level':_0x3d0ec9(0x147),'tool':_0x3d0ec9(0x189),'context':{'repo_path':_0x4d950d[_0x3d0ec9(0x185)]['repo_path'],'query':_0x4d950d['data']['search_string'],'model':'morph-warp-grep-v2.1','termination_reason':_0x41cedf[_0x3d0ec9(0x181)],'sub_tool_errors':_0x27300d,'timings':_0x41cedf[_0x3d0ec9(0x1f1)],'tool_calls':_0x3318d3(_0x41cedf[_0x3d0ec9(0x22c)]),'messages':_0x41cedf[_0x3d0ec9(0x22c)]?.['map'](_0x59364b=>({'role':_0x59364b[_0x3d0ec9(0x1ce)],'content':_0x59364b[_0x3d0ec9(0x235)],..._0x59364b['tool_calls']?{'tool_calls':_0x59364b[_0x3d0ec9(0x1ec)]['length']}:{},..._0x59364b[_0x3d0ec9(0x159)]?{'tool_call_id':_0x59364b[_0x3d0ec9(0x159)]}:{}}))},'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{});let _0x4e82ad='';if(_0x41cedf['terminationReason']===_0x3d0ec9(0x1e6)&&_0x41cedf[_0x3d0ec9(0x208)]?.[_0x3d0ec9(0x1dd)]?.[_0x3d0ec9(0x17e)]){const _0x24f17f=_0x41cedf[_0x3d0ec9(0x208)][_0x3d0ec9(0x1dd)][_0x3d0ec9(0x17e)];if(_0x24f17f[_0x3d0ec9(0x231)]===0x0)return _0x4e82ad=_0x41cedf[_0x3d0ec9(0x208)][_0x3d0ec9(0x1fa)]||_0x3d0ec9(0x177),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x4e82ad}]};const _0x3db54e=[],_0x40c012=[_0x3d0ec9(0x1ca)];for(const _0x376401 of _0x41cedf[_0x3d0ec9(0x22c)]){if(_0x376401[_0x3d0ec9(0x1ce)]===_0x3d0ec9(0x1ac)&&Array[_0x3d0ec9(0x12e)](_0x376401[_0x3d0ec9(0x1ec)]))for(const _0x8fbd8a of _0x376401['tool_calls']){try{const _0x10206e=_0x8fbd8a[_0x3d0ec9(0x182)]?.[_0x3d0ec9(0x1d9)],_0x38faf5=JSON[_0x3d0ec9(0x20e)](_0x8fbd8a[_0x3d0ec9(0x182)]?.[_0x3d0ec9(0x244)]||'{}');if(_0x10206e===_0x3d0ec9(0x18d))_0x40c012[_0x3d0ec9(0x154)](_0x3d0ec9(0x14e)+_0x38faf5['pattern']+'\x27\x20in\x20`'+(_0x38faf5[_0x3d0ec9(0x151)]||'.')+'`');else{if(_0x10206e==='read')_0x40c012[_0x3d0ec9(0x154)](_0x3d0ec9(0x23b)+_0x38faf5[_0x3d0ec9(0x151)]+'`');else{if(_0x10206e==='list_directory')_0x40c012[_0x3d0ec9(0x154)]('-\x20Listed\x20directory\x20`'+(_0x38faf5[_0x3d0ec9(0x1f3)]||'.')+'`');else _0x10206e===_0x3d0ec9(0x190)&&_0x40c012[_0x3d0ec9(0x154)](_0x3d0ec9(0x1d0)+_0x38faf5['pattern']+_0x3d0ec9(0x170)+(_0x38faf5[_0x3d0ec9(0x151)]||'.')+'`');}}}catch{}}}_0x3db54e[_0x3d0ec9(0x154)](_0x40c012['join']('\x0a'));const _0x2c60a1=['','Relevant\x20context\x20found:'];for(const _0x56a83a of _0x24f17f){if(_0x56a83a[_0x3d0ec9(0x1fd)]==='*')_0x2c60a1[_0x3d0ec9(0x154)]('-\x20'+_0x56a83a[_0x3d0ec9(0x151)]+':*');else{if(Array[_0x3d0ec9(0x12e)](_0x56a83a[_0x3d0ec9(0x1fd)])){const _0x47eccc=_0x56a83a[_0x3d0ec9(0x1fd)]['map'](([_0x1a00b4,_0xb6924d])=>{if(_0x1a00b4===_0xb6924d)return''+_0x1a00b4;return _0x1a00b4+'-'+_0xb6924d;});_0x2c60a1['push']('-\x20'+_0x56a83a[_0x3d0ec9(0x151)]+':'+_0x47eccc['join'](','));}else _0x2c60a1[_0x3d0ec9(0x154)]('-\x20'+_0x56a83a[_0x3d0ec9(0x151)]+':*');}}_0x2c60a1[_0x3d0ec9(0x154)](''),_0x3db54e[_0x3d0ec9(0x154)](_0x2c60a1[_0x3d0ec9(0x15c)]('\x0a')),_0x3db54e[_0x3d0ec9(0x154)](_0x3d0ec9(0x1b3));const _0x5db25a=[],_0x5e6255=[];for(const _0x52329e of _0x24f17f){let _0x52b7f7=a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)],_0x52329e[_0x3d0ec9(0x151)]),_0x2be325=null,_0x4c0310=null;try{_0x2be325=await a0_0x5043e6['readFile'](_0x52b7f7,{'encoding':_0x3d0ec9(0x197)});}catch(_0x269763){const _0x4e16b9=fixPathRepetition(_0x52b7f7);if(_0x4e16b9)try{_0x2be325=await a0_0x5043e6[_0x3d0ec9(0x21d)](_0x4e16b9,{'encoding':_0x3d0ec9(0x197)}),_0x52b7f7=_0x4e16b9;}catch{_0x4c0310=_0x269763 instanceof Error?_0x269763:new Error(String(_0x269763));}else _0x4c0310=_0x269763 instanceof Error?_0x269763:new Error(String(_0x269763));}if(_0x2be325!==null){const _0x4fb047=_0x2be325[_0x3d0ec9(0x1e8)](/\r?\n/),_0x4dd74c=[];if(_0x52329e[_0x3d0ec9(0x1fd)]==='*'||!Array['isArray'](_0x52329e[_0x3d0ec9(0x1fd)]))for(let _0x39f744=0x1;_0x39f744<=_0x4fb047['length'];_0x39f744++){const _0x270238=_0x4fb047[_0x39f744-0x1];_0x4dd74c[_0x3d0ec9(0x154)](_0x39f744+'|\x20'+_0x270238);}else for(const [_0x3be264,_0x257d10]of _0x52329e[_0x3d0ec9(0x1fd)]){_0x4dd74c['length']>0x0&&_0x4dd74c[_0x3d0ec9(0x154)]('');for(let _0x4326e7=_0x3be264;_0x4326e7<=_0x257d10&&_0x4326e7<=_0x4fb047[_0x3d0ec9(0x231)];_0x4326e7++){const _0x3840af=_0x4fb047[_0x4326e7-0x1];_0x4dd74c[_0x3d0ec9(0x154)](_0x4326e7+'|\x20'+_0x3840af);}}_0x5e6255[_0x3d0ec9(0x154)]({'path':_0x52329e[_0x3d0ec9(0x151)],'content':_0x4dd74c[_0x3d0ec9(0x15c)]('\x0a')});}else _0x5db25a[_0x3d0ec9(0x154)](_0x3d0ec9(0x148)+_0x52329e['path']+_0x3d0ec9(0x236)+(_0x4c0310?.[_0x3d0ec9(0x1a9)]||_0x3d0ec9(0x1ae))+'\x0a</file>');}try{const _0x642728=await compactFileContexts(_0x5e6255,_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],MORPH_API_KEY,MORPH_API_URL);for(const _0xb0c3a6 of _0x642728){_0x5db25a[_0x3d0ec9(0x154)](_0x3d0ec9(0x148)+_0xb0c3a6['path']+'\x22>\x0a'+_0xb0c3a6[_0x3d0ec9(0x235)]+_0x3d0ec9(0x14b));}}catch(_0x17c107){logger[_0x3d0ec9(0x147)](_0x3d0ec9(0x14a),_0x3d0ec9(0x167),{'error':_0x17c107 instanceof Error?_0x17c107[_0x3d0ec9(0x1a9)]:String(_0x17c107),'files_count':_0x5e6255[_0x3d0ec9(0x231)]});for(const _0x495827 of _0x5e6255){_0x5db25a['push'](_0x3d0ec9(0x148)+_0x495827[_0x3d0ec9(0x151)]+'\x22>\x0a'+_0x495827[_0x3d0ec9(0x235)]+_0x3d0ec9(0x14b));}}_0x3db54e['push'](_0x5db25a[_0x3d0ec9(0x15c)]('\x0a\x0a')),_0x4e82ad=_0x3db54e[_0x3d0ec9(0x15c)]('\x0a');const _0x1893d4=_0x41cedf[_0x3d0ec9(0x246)]?.['filter'](_0x4d0895=>_0x4d0895[_0x3d0ec9(0x1a9)]?.[_0x3d0ec9(0x1fc)](_0x3d0ec9(0x202)))||[];if(_0x1893d4[_0x3d0ec9(0x231)]>0x0){const _0x45b3e4=_0x1893d4[_0x3d0ec9(0x1df)](_0x529db7=>_0x529db7[_0x3d0ec9(0x1a9)])[_0x3d0ec9(0x15c)](';\x20');reportMorphError({'error_message':_0x45b3e4,'error_type':_0x3d0ec9(0x203),'context':{'tool':_0x3d0ec9(0x189),'repo_path':_0x4d950d['data'][_0x3d0ec9(0x180)],'query':_0x4d950d['data'][_0x3d0ec9(0x220)],'model':'morph-warp-grep-v2.1','termination_reason':_0x3d0ec9(0x146),'error_count':_0x1893d4[_0x3d0ec9(0x231)],'is_timeout':![],'timings':_0x41cedf[_0x3d0ec9(0x1f1)],'files_attempted':_0x24f17f[_0x3d0ec9(0x1df)](_0x5747de=>({'path':_0x5747de[_0x3d0ec9(0x151)],'lines':_0x5747de[_0x3d0ec9(0x1fd)]})),'tool_calls':_0x3318d3(_0x41cedf['messages']),'messages':_0x41cedf[_0x3d0ec9(0x22c)]?.[_0x3d0ec9(0x1df)](_0x4b536d=>({'role':_0x4b536d['role'],'content':_0x4b536d[_0x3d0ec9(0x235)],..._0x4b536d['tool_calls']?{'tool_calls':_0x4b536d['tool_calls']['length']}:{},..._0x4b536d[_0x3d0ec9(0x159)]?{'tool_call_id':_0x4b536d[_0x3d0ec9(0x159)]}:{}})),'request_content':{'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'repo_path':_0x4d950d[_0x3d0ec9(0x185)]['repo_path'],'repoRoot':a0_0x5053d5['resolve'](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)]),'model':_0x3d0ec9(0x1a7)}},'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{});}}else{if(_0x41cedf[_0x3d0ec9(0x181)]===_0x3d0ec9(0x18e)&&_0x41cedf[_0x3d0ec9(0x246)]['length']>0x0){const _0x4080ac=_0x41cedf[_0x3d0ec9(0x246)][_0x3d0ec9(0x1df)](_0x12c835=>_0x12c835[_0x3d0ec9(0x1a9)])[_0x3d0ec9(0x15c)](';\x20');_0x4e82ad='Error:\x20'+_0x4080ac;const _0x10bf92=_0x4080ac[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x130))||_0x4080ac[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)]('timed\x20out')||_0x4080ac[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x127)),_0x3226ac=_0x41cedf[_0x3d0ec9(0x208)]?.[_0x3d0ec9(0x1dd)]?.[_0x3d0ec9(0x17e)],_0x36028c=_0x41cedf['errors'][0x0];reportMorphError({'error_message':_0x4080ac,'error_type':_0x10bf92?_0x3d0ec9(0x1b1):_0x36028c?.[_0x3d0ec9(0x191)]?.[_0x3d0ec9(0x1d9)]||'WarpGrepError','context':{'tool':'codebase_search','repo_path':_0x4d950d[_0x3d0ec9(0x185)]['repo_path'],'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'model':_0x3d0ec9(0x1a7),'termination_reason':_0x41cedf[_0x3d0ec9(0x181)],'error_count':_0x41cedf[_0x3d0ec9(0x246)][_0x3d0ec9(0x231)],'is_timeout':_0x10bf92,'timings':_0x41cedf[_0x3d0ec9(0x1f1)],'files_attempted':_0x3226ac?.['map'](_0x5288fe=>({'path':_0x5288fe[_0x3d0ec9(0x151)],'lines':_0x5288fe[_0x3d0ec9(0x1fd)]})),'tool_calls':_0x3318d3(_0x41cedf[_0x3d0ec9(0x22c)]),'messages':_0x41cedf[_0x3d0ec9(0x22c)]?.[_0x3d0ec9(0x1df)](_0x5eaf4a=>({'role':_0x5eaf4a[_0x3d0ec9(0x1ce)],'content':_0x5eaf4a[_0x3d0ec9(0x235)],..._0x5eaf4a[_0x3d0ec9(0x1ec)]?{'tool_calls':_0x5eaf4a[_0x3d0ec9(0x1ec)][_0x3d0ec9(0x231)]}:{},..._0x5eaf4a[_0x3d0ec9(0x159)]?{'tool_call_id':_0x5eaf4a[_0x3d0ec9(0x159)]}:{}})),'request_content':{'query':_0x4d950d[_0x3d0ec9(0x185)]['search_string'],'repo_path':_0x4d950d['data']['repo_path'],'repoRoot':a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)]),'model':_0x3d0ec9(0x1a7)}},'stack_trace':_0x36028c?.[_0x3d0ec9(0x19f)]||undefined,'source':_0x3d0ec9(0x24e)})['catch'](()=>{});}else _0x4e82ad='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x4e82ad}]};}catch(_0x485396){const _0xadd2ef=handleMorphAPIError(_0x485396);if(_0xadd2ef)return logger[_0x3d0ec9(0x215)](_0x3d0ec9(0x14a),_0x3d0ec9(0x128),{'tool':'codebase_search','error':'API\x20error\x20(auth/rate-limit)','latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb}),_0xadd2ef;const _0xef5905=_0x485396 instanceof Error?_0x485396[_0x3d0ec9(0x1a9)]:String(_0x485396);logger[_0x3d0ec9(0x215)]('MCP',_0x3d0ec9(0x128),{'tool':_0x3d0ec9(0x189),'error':_0xef5905,'repo_path':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)],'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'latency_ms':Date[_0x3d0ec9(0x16b)]()-_0x3124bb});const _0x2f68f8=_0xef5905[_0x3d0ec9(0x237)]()['includes'](_0x3d0ec9(0x130))||_0xef5905[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x1ad))||_0xef5905[_0x3d0ec9(0x237)]()[_0x3d0ec9(0x198)](_0x3d0ec9(0x127))||_0x485396 instanceof Error&&_0x485396[_0x3d0ec9(0x1d9)]===_0x3d0ec9(0x1b1);return reportMorphError({'error_message':_0xef5905,'error_type':_0x2f68f8?'TimeoutError':_0x485396 instanceof Error?_0x485396[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:_0x3d0ec9(0x1b4),'context':{'tool':_0x3d0ec9(0x189),'repo_path':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x180)],'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'model':_0x3d0ec9(0x1a7),'is_timeout':_0x2f68f8,'exception_phase':_0x3d0ec9(0x221),'request_content':{'query':_0x4d950d[_0x3d0ec9(0x185)][_0x3d0ec9(0x220)],'repo_path':_0x4d950d['data'][_0x3d0ec9(0x180)],'repoRoot':a0_0x5053d5[_0x3d0ec9(0x24f)](_0x4d950d[_0x3d0ec9(0x185)]['repo_path']),'model':_0x3d0ec9(0x1a7)}},'stack_trace':_0x485396 instanceof Error?_0x485396[_0x3d0ec9(0x19f)]:undefined,'source':'mcp-filesystem'})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1e2)+_0xef5905}],'isError':![]};}}case'github_codebase_search':{const _0x26052e=WarpGrepGitHubArgsSchema[_0x3d0ec9(0x143)](_0x4f30d9);if(!_0x26052e[_0x3d0ec9(0x217)])return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1e1)+_0x26052e['error']}],'isError':!![]};const _0x58b323=_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x1cd)]||_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x12c)];if(!_0x58b323)return{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1bd)}],'isError':!![]};const _0x14ddf4=MORPH_API_KEY;if(!_0x14ddf4)throw new Error(_0x3d0ec9(0x1e0));const _0x1b2a5e=Date[_0x3d0ec9(0x16b)]();logger['debug']('MCP',_0x3d0ec9(0x211),{'identifier':_0x58b323,'query':_0x26052e['data'][_0x3d0ec9(0x220)],'branch':_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x20b)]});try{const _0x20a8cc=new WarpGrepClient({'morphApiKey':_0x14ddf4,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x3f7a08=await _0x20a8cc[_0x3d0ec9(0x149)]({'searchTerm':_0x26052e['data'][_0x3d0ec9(0x220)],'github':_0x58b323,'branch':_0x26052e['data'][_0x3d0ec9(0x20b)]}),_0x4f265e=Date[_0x3d0ec9(0x16b)]()-_0x1b2a5e;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x4f265e+'ms.\x20Success:\x20'+_0x3f7a08[_0x3d0ec9(0x217)]);const _0x58930f=formatResult(_0x3f7a08);return{'content':[{'type':'text','text':_0x58930f}]};}catch(_0x394899){const _0x36be6b=handleMorphAPIError(_0x394899);if(_0x36be6b)return _0x36be6b;const _0x3ca6c1=Date[_0x3d0ec9(0x16b)]()-_0x1b2a5e,_0x41fbdd=_0x394899 instanceof Error?_0x394899['message']:String(_0x394899);return logMcpStderr(_0x3d0ec9(0x1be)+_0x3ca6c1+_0x3d0ec9(0x23a),_0x41fbdd),reportMorphError({'error_message':_0x41fbdd,'error_type':_0x394899 instanceof Error?_0x394899[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:_0x3d0ec9(0x1b4),'context':{'tool':'github_codebase_search','github_url':_0x58b323,'search_string':_0x26052e['data'][_0x3d0ec9(0x220)],'branch':_0x26052e[_0x3d0ec9(0x185)][_0x3d0ec9(0x20b)]},'stack_trace':_0x394899 instanceof Error?_0x394899[_0x3d0ec9(0x19f)]:undefined,'source':_0x3d0ec9(0x24e),'tool':_0x3d0ec9(0x1e4),'latency_ms':_0x3ca6c1})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':_0x3d0ec9(0x126),'text':_0x3d0ec9(0x1fb)+_0x41fbdd}],'isError':![]};}}default:throw new Error(_0x3d0ec9(0x238)+_0x406c0b);}}catch(_0x24ed2a){const _0x5b40b6=_0x24ed2a instanceof Error?_0x24ed2a['message']:String(_0x24ed2a);return reportMorphError({'error_message':_0x5b40b6,'error_type':_0x24ed2a instanceof Error?_0x24ed2a[_0x3d0ec9(0x191)][_0x3d0ec9(0x1d9)]:_0x3d0ec9(0x1b4),'context':{'tool':_0x406c0b,'arguments':_0x4f30d9?JSON[_0x3d0ec9(0x233)](_0x4f30d9)['substring'](0x0,0x1f4):undefined,'mcp_server_version':_0x3d0ec9(0x171)},'stack_trace':_0x24ed2a instanceof Error?_0x24ed2a[_0x3d0ec9(0x19f)]:undefined,'source':_0x3d0ec9(0x24e)})[_0x3d0ec9(0x1bb)](()=>{}),{'content':[{'type':'text','text':'Error:\x20'+_0x5b40b6}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x4850f3){const _0x3736b7=a0_0x415e44,_0x26f8b3=await getValidRootDirectories(_0x4850f3);if(_0x26f8b3['length']>0x0)allowedDirectories=[..._0x26f8b3],logMcpStderr(_0x3736b7(0x18a)+_0x26f8b3[_0x3736b7(0x231)]+'\x20valid\x20directories');else{logMcpStderr(_0x3736b7(0x1bf));if(ENABLE_WORKSPACE_MODE)try{const _0x4a79fe=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x4a79fe&&(allowedDirectories=[_0x4a79fe],logMcpStderr(_0x3736b7(0x24b)+_0x4a79fe));}catch(_0x45db7e){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x45db7e);}}}server[a0_0x415e44(0x162)](RootsListChangedNotificationSchema,async()=>{const _0x451702=a0_0x415e44;try{const _0x576e0e=await server['listRoots']();_0x576e0e&&_0x451702(0x131)in _0x576e0e&&await updateAllowedDirectoriesFromRoots(_0x576e0e[_0x451702(0x131)]);}catch(_0x52cfa3){logMcpStderr(_0x451702(0x156),_0x52cfa3 instanceof Error?_0x52cfa3[_0x451702(0x1a9)]:String(_0x52cfa3));}}),server[a0_0x415e44(0x1b8)]=async()=>{const _0x1766ab=a0_0x415e44,_0x3dd653=server[_0x1766ab(0x1da)]();if(_0x3dd653?.[_0x1766ab(0x131)])try{const _0x477677=await server[_0x1766ab(0x16d)]();_0x477677&&_0x1766ab(0x131)in _0x477677?await updateAllowedDirectoriesFromRoots(_0x477677[_0x1766ab(0x131)]):logMcpStderr(_0x1766ab(0x16e));}catch(_0x4c9924){logMcpStderr('Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:',_0x4c9924 instanceof Error?_0x4c9924[_0x1766ab(0x1a9)]:String(_0x4c9924));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x1766ab(0x157),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1766ab(0x174));else throw new Error(_0x1766ab(0x22d));}}};async function runServer(){const _0x4a179c=a0_0x415e44,_0x4c6691=new StdioServerTransport();await server[_0x4a179c(0x19e)](_0x4c6691),logMcpStderr(_0x4a179c(0x1ba)),allowedDirectories[_0x4a179c(0x231)]===0x0&&logMcpStderr(_0x4a179c(0x1c5));}runServer()[a0_0x415e44(0x1bb)](_0x2204f3=>{const _0x4a4e31=a0_0x415e44;logMcpStderr(_0x4a4e31(0x173),_0x2204f3),process[_0x4a4e31(0x168)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x202fd8=a1_0x157a;(function(_0x3faa7a,_0x4d63eb){var _0x322b96=a1_0x157a,_0xee876=_0x3faa7a();while(!![]){try{var _0x4f354c=-parseInt(_0x322b96(0x159))/0x1*(-parseInt(_0x322b96(0x14e))/0x2)+parseInt(_0x322b96(0x152))/0x3*(-parseInt(_0x322b96(0x154))/0x4)+parseInt(_0x322b96(0x14d))/0x5*(-parseInt(_0x322b96(0x151))/0x6)+parseInt(_0x322b96(0x14c))/0x7+-parseInt(_0x322b96(0x157))/0x8+parseInt(_0x322b96(0x14f))/0x9+parseInt(_0x322b96(0x14b))/0xa;if(_0x4f354c===_0x4d63eb)break;else _0xee876['push'](_0xee876['shift']());}catch(_0x1eb571){_0xee876['push'](_0xee876['shift']());}}}(a1_0x21b8,0x666dc));import a1_0x28474d from'os';import{logger}from'./logger.js';function a1_0x21b8(){var _0x5bfbfc=['34254rlfLcT','102EUZniN','linux','65728TzfwRa','win32','platform','6601880cTiBpm','info','16804DzmMOO','macOS','Linux','[os=','Unknown','darwin','4941840KyDgjT','2196089mKSXji','60ndhxTh','54oewRTv','5493240jfToZn','Windows'];a1_0x21b8=function(){return _0x5bfbfc;};return a1_0x21b8();}export function getOperatingSystemType(_0x3db9e6=a1_0x28474d['platform']()){var _0x582099=a1_0x157a;switch(_0x3db9e6){case _0x582099(0x14a):return _0x582099(0x15a);case _0x582099(0x155):return _0x582099(0x150);case _0x582099(0x153):return _0x582099(0x15b);default:return _0x582099(0x149);}}export function formatMcpLogMessage(_0x2d03c1,_0x6f55c1=a1_0x28474d[a1_0x202fd8(0x156)]()){var _0x286f06=a1_0x202fd8;return _0x286f06(0x15c)+getOperatingSystemType(_0x6f55c1)+']\x20'+_0x2d03c1;}function a1_0x157a(_0xd29b8f,_0xa41123){_0xd29b8f=_0xd29b8f-0x149;var _0x21b8ac=a1_0x21b8();var _0x157a2b=_0x21b8ac[_0xd29b8f];return _0x157a2b;}export function logMcpStderr(_0x19a7c7,..._0x4430b3){var _0x3e056c=a1_0x202fd8;console['error'](formatMcpLogMessage(_0x19a7c7),..._0x4430b3),logger[_0x3e056c(0x158)]('MCP',_0x19a7c7,_0x4430b3['length']?{'args':_0x4430b3['map'](_0x2fe597=>String(_0x2fe597))}:undefined);}
1
+ var a1_0x260a34=a1_0x2967;(function(_0x2b69cf,_0x2bb809){var _0x5f07e2=a1_0x2967,_0x285821=_0x2b69cf();while(!![]){try{var _0x9d82aa=parseInt(_0x5f07e2(0xb2))/0x1+parseInt(_0x5f07e2(0xbe))/0x2*(-parseInt(_0x5f07e2(0xbf))/0x3)+-parseInt(_0x5f07e2(0xba))/0x4+parseInt(_0x5f07e2(0xb8))/0x5*(parseInt(_0x5f07e2(0xc0))/0x6)+parseInt(_0x5f07e2(0xb9))/0x7+-parseInt(_0x5f07e2(0xc3))/0x8+parseInt(_0x5f07e2(0xc4))/0x9;if(_0x9d82aa===_0x2bb809)break;else _0x285821['push'](_0x285821['shift']());}catch(_0x39799c){_0x285821['push'](_0x285821['shift']());}}}(a1_0x329b,0x253f8));function a1_0x329b(){var _0x151af8=['win32','Windows','map','darwin','766730HmANAS','1681666eBEHVg','982280TBzlrp','info','MCP','macOS','135334aSGDtc','9VxrtpD','6abPUst','[os=','platform','1285496coTyFP','2129904ljRMus','error','131586ARXADx','length'];a1_0x329b=function(){return _0x151af8;};return a1_0x329b();}import a1_0x1fa4ab from'os';import{logger}from'./logger.js';function a1_0x2967(_0x9ec5c9,_0x591abd){_0x9ec5c9=_0x9ec5c9-0xb2;var _0x329b58=a1_0x329b();var _0x296743=_0x329b58[_0x9ec5c9];return _0x296743;}export function getOperatingSystemType(_0x421b29=a1_0x1fa4ab[a1_0x260a34(0xc2)]()){var _0x51d62c=a1_0x260a34;switch(_0x421b29){case _0x51d62c(0xb7):return _0x51d62c(0xbd);case _0x51d62c(0xb4):return _0x51d62c(0xb5);case'linux':return'Linux';default:return'Unknown';}}export function formatMcpLogMessage(_0xf7d8ef,_0x554279=a1_0x1fa4ab[a1_0x260a34(0xc2)]()){var _0x288f93=a1_0x260a34;return _0x288f93(0xc1)+getOperatingSystemType(_0x554279)+']\x20'+_0xf7d8ef;}export function logMcpStderr(_0x43d112,..._0x273a2c){var _0x7a70d0=a1_0x260a34;console[_0x7a70d0(0xc5)](formatMcpLogMessage(_0x43d112),..._0x273a2c),logger[_0x7a70d0(0xbb)](_0x7a70d0(0xbc),_0x43d112,_0x273a2c[_0x7a70d0(0xb3)]?{'args':_0x273a2c[_0x7a70d0(0xb6)](_0x36c2c7=>String(_0x36c2c7))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0xd05f8c=a2_0x14ab;(function(_0x1b0f67,_0x1969d5){const _0x1e1b42=a2_0x14ab,_0x56d37e=_0x1b0f67();while(!![]){try{const _0x13648a=-parseInt(_0x1e1b42(0xfd))/0x1+-parseInt(_0x1e1b42(0x104))/0x2+-parseInt(_0x1e1b42(0x102))/0x3+parseInt(_0x1e1b42(0xf6))/0x4*(-parseInt(_0x1e1b42(0x108))/0x5)+parseInt(_0x1e1b42(0xf7))/0x6*(-parseInt(_0x1e1b42(0xff))/0x7)+parseInt(_0x1e1b42(0xfe))/0x8*(parseInt(_0x1e1b42(0x105))/0x9)+parseInt(_0x1e1b42(0xfa))/0xa*(parseInt(_0x1e1b42(0x109))/0xb);if(_0x13648a===_0x1969d5)break;else _0x56d37e['push'](_0x56d37e['shift']());}catch(_0x50261d){_0x56d37e['push'](_0x56d37e['shift']());}}}(a2_0x302a,0xe81e1));function a2_0x14ab(_0x95b78b,_0x2a3e57){_0x95b78b=_0x95b78b-0xee;const _0x302ad5=a2_0x302a();let _0x14ab4e=_0x302ad5[_0x95b78b];return _0x14ab4e;}function a2_0x302a(){const _0x2c1357=['warn','stringify','toISOString','fileStream','88EwnEbS','3740694nqtqLi','env','error','692960zTyaFt',']\x20[','info','1001794hylqJJ','1304abkzQo','7oAvDzd','isEnabled','toUpperCase','2597799BOKkMa','MORPH_LOG_FILE','179704KgXSPE','43587FvqbpN','_log','enable','132690njOMxh','528ksNOEK','debug','write','enabled','MORPH_DEBUG'];a2_0x302a=function(){return _0x2c1357;};return a2_0x302a();}import{createWriteStream}from'fs';class MorphLogger{[a2_0xd05f8c(0xf0)];[a2_0xd05f8c(0xf5)];constructor(){const _0x273445=a2_0xd05f8c;this[_0x273445(0xf0)]=process[_0x273445(0xf8)][_0x273445(0xf1)]==='1'||!!process[_0x273445(0xf8)][_0x273445(0x103)];const _0x175357=process[_0x273445(0xf8)][_0x273445(0x103)];this['fileStream']=_0x175357?createWriteStream(_0x175357,{'flags':'a'}):null;}['debug'](_0x48d401,_0x27cef9,_0x1988e1){const _0x26e3b5=a2_0xd05f8c;this[_0x26e3b5(0x106)](_0x26e3b5(0xee),_0x48d401,_0x27cef9,_0x1988e1);}[a2_0xd05f8c(0xfc)](_0x27847f,_0x1b3ca0,_0x67ed0d){const _0x1b7b8c=a2_0xd05f8c;this[_0x1b7b8c(0x106)](_0x1b7b8c(0xfc),_0x27847f,_0x1b3ca0,_0x67ed0d);}[a2_0xd05f8c(0xf2)](_0x4fe606,_0x8a60ae,_0x330c9c){const _0x13a7aa=a2_0xd05f8c;this[_0x13a7aa(0x106)](_0x13a7aa(0xf2),_0x4fe606,_0x8a60ae,_0x330c9c);}[a2_0xd05f8c(0xf9)](_0x179c8c,_0x4234c6,_0x1f7018){const _0x5e21a4=a2_0xd05f8c;this['_log'](_0x5e21a4(0xf9),_0x179c8c,_0x4234c6,_0x1f7018);}[a2_0xd05f8c(0x107)](){const _0x24e54c=a2_0xd05f8c;this[_0x24e54c(0xf0)]=!![];}get[a2_0xd05f8c(0x100)](){return this['enabled'];}[a2_0xd05f8c(0x106)](_0x996bec,_0x5e8913,_0xdd47da,_0x57850b){const _0xe9d7b=a2_0xd05f8c;if(_0x996bec!=='error'&&!this[_0xe9d7b(0xf0)])return;const _0x2b56e6=new Date()[_0xe9d7b(0xf4)](),_0x4090b9='['+_0x2b56e6+']\x20['+_0x996bec[_0xe9d7b(0x101)]()+_0xe9d7b(0xfb)+_0x5e8913+']';console[_0xe9d7b(0xf9)](_0x57850b?_0x4090b9+'\x20'+_0xdd47da+'\x20'+JSON[_0xe9d7b(0xf3)](_0x57850b):_0x4090b9+'\x20'+_0xdd47da),this[_0xe9d7b(0xf5)]?.[_0xe9d7b(0xef)](JSON[_0xe9d7b(0xf3)]({'ts':_0x2b56e6,'level':_0x996bec,'component':_0x5e8913,'msg':_0xdd47da,..._0x57850b&&{'data':_0x57850b}})+'\x0a');}}export const logger=new MorphLogger();
1
+ const a2_0x5226cb=a2_0x4bb5;(function(_0x1a0983,_0x411c90){const _0x44413e=a2_0x4bb5,_0x52b50a=_0x1a0983();while(!![]){try{const _0x49810f=parseInt(_0x44413e(0x1d6))/0x1+parseInt(_0x44413e(0x1d3))/0x2*(-parseInt(_0x44413e(0x1c6))/0x3)+parseInt(_0x44413e(0x1cd))/0x4+-parseInt(_0x44413e(0x1c5))/0x5+parseInt(_0x44413e(0x1cb))/0x6+parseInt(_0x44413e(0x1d7))/0x7*(-parseInt(_0x44413e(0x1cf))/0x8)+parseInt(_0x44413e(0x1c4))/0x9;if(_0x49810f===_0x411c90)break;else _0x52b50a['push'](_0x52b50a['shift']());}catch(_0x46728f){_0x52b50a['push'](_0x52b50a['shift']());}}}(a2_0x15c4,0x958a8));import{createWriteStream}from'fs';class MorphLogger{['enabled'];['fileStream'];constructor(){const _0x7513e7=a2_0x4bb5;this[_0x7513e7(0x1c7)]=process[_0x7513e7(0x1d5)][_0x7513e7(0x1c2)]==='1'||!!process[_0x7513e7(0x1d5)][_0x7513e7(0x1d8)];const _0x2307e5=process[_0x7513e7(0x1d5)][_0x7513e7(0x1d8)];this[_0x7513e7(0x1cc)]=_0x2307e5?createWriteStream(_0x2307e5,{'flags':'a'}):null;}[a2_0x5226cb(0x1c0)](_0x5f3ffe,_0x280a94,_0x204590){const _0x3b9add=a2_0x5226cb;this[_0x3b9add(0x1d4)](_0x3b9add(0x1c0),_0x5f3ffe,_0x280a94,_0x204590);}[a2_0x5226cb(0x1ce)](_0x4cf4ae,_0x44d849,_0x4da8b3){const _0x3ec65f=a2_0x5226cb;this[_0x3ec65f(0x1d4)](_0x3ec65f(0x1ce),_0x4cf4ae,_0x44d849,_0x4da8b3);}[a2_0x5226cb(0x1d2)](_0xf94ab4,_0x25b97b,_0xc9eb64){const _0x28089a=a2_0x5226cb;this[_0x28089a(0x1d4)](_0x28089a(0x1d2),_0xf94ab4,_0x25b97b,_0xc9eb64);}[a2_0x5226cb(0x1d1)](_0x2692c0,_0x4b4065,_0x4a96a7){const _0x293974=a2_0x5226cb;this[_0x293974(0x1d4)](_0x293974(0x1d1),_0x2692c0,_0x4b4065,_0x4a96a7);}[a2_0x5226cb(0x1d0)](){const _0x5cb2e3=a2_0x5226cb;this[_0x5cb2e3(0x1c7)]=!![];}get[a2_0x5226cb(0x1ca)](){const _0x5c37a4=a2_0x5226cb;return this[_0x5c37a4(0x1c7)];}['_log'](_0x28bc11,_0x155394,_0x4655f7,_0x4afde4){const _0x31fe7f=a2_0x5226cb;if(_0x28bc11!==_0x31fe7f(0x1d1)&&!this['enabled'])return;const _0x12ae89=new Date()[_0x31fe7f(0x1c8)](),_0x16add2='['+_0x12ae89+']\x20['+_0x28bc11[_0x31fe7f(0x1c9)]()+']\x20['+_0x155394+']';console[_0x31fe7f(0x1d1)](_0x4afde4?_0x16add2+'\x20'+_0x4655f7+'\x20'+JSON[_0x31fe7f(0x1c3)](_0x4afde4):_0x16add2+'\x20'+_0x4655f7),this[_0x31fe7f(0x1cc)]?.[_0x31fe7f(0x1c1)](JSON[_0x31fe7f(0x1c3)]({'ts':_0x12ae89,'level':_0x28bc11,'component':_0x155394,'msg':_0x4655f7,..._0x4afde4&&{'data':_0x4afde4}})+'\x0a');}}function a2_0x15c4(){const _0x52bc88=['error','warn','2nyFqwK','_log','env','78633MFxCji','301588pgfxJC','MORPH_LOG_FILE','debug','write','MORPH_DEBUG','stringify','4384296OgCyjQ','5742450KQTXQp','152964zTAXqy','enabled','toISOString','toUpperCase','isEnabled','2135826WRWsrI','fileStream','3905672trlvMX','info','16oMPjOA','enable'];a2_0x15c4=function(){return _0x52bc88;};return a2_0x15c4();}function a2_0x4bb5(_0x1723fa,_0x3efd10){_0x1723fa=_0x1723fa-0x1c0;const _0x15c43f=a2_0x15c4();let _0x4bb5ea=_0x15c43f[_0x1723fa];return _0x4bb5ea;}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0xb4dda8,_0x2eec7d){const _0x3af6bb=a3_0x1c2f,_0x3dfca0=_0xb4dda8();while(!![]){try{const _0x5b7742=parseInt(_0x3af6bb(0x124))/0x1*(-parseInt(_0x3af6bb(0x127))/0x2)+parseInt(_0x3af6bb(0x122))/0x3*(parseInt(_0x3af6bb(0x116))/0x4)+-parseInt(_0x3af6bb(0x125))/0x5*(-parseInt(_0x3af6bb(0x11d))/0x6)+parseInt(_0x3af6bb(0x11a))/0x7+-parseInt(_0x3af6bb(0x128))/0x8+parseInt(_0x3af6bb(0x115))/0x9*(-parseInt(_0x3af6bb(0x120))/0xa)+parseInt(_0x3af6bb(0x11e))/0xb;if(_0x5b7742===_0x2eec7d)break;else _0x3dfca0['push'](_0x3dfca0['shift']());}catch(_0x375c16){_0x3dfca0['push'](_0x3dfca0['shift']());}}}(a3_0x13b5,0x57fc1));import a3_0x17c956 from'path';import a3_0x4d9086 from'os';function a3_0x13b5(){const _0xf0f5e1=['homedir','charAt','substring','1225728YTSiCw','startsWith','toUpperCase','2034QnMATK','10070434AvMxZA','test','52990baxQdH','match','107373tMpacr','/mnt/','13nkfZoT','6330HVwrnv','trim','13000ZfJSDx','4562168HHUorV','slice','replace','1161gJMZXU','20DInndh'];a3_0x13b5=function(){return _0xf0f5e1;};return a3_0x13b5();}export function convertToWindowsPath(_0x23eb2f){const _0x43a1df=a3_0x1c2f;if(_0x23eb2f['startsWith'](_0x43a1df(0x123))){const _0x55cacd=_0x23eb2f['charAt'](0x5)['toUpperCase'](),_0xb317ea=_0x23eb2f[_0x43a1df(0x113)](0x6)[_0x43a1df(0x114)](/\//g,'\x5c');return _0x55cacd+':'+_0xb317ea;}if(_0x23eb2f[_0x43a1df(0x121)](/^\/[a-zA-Z]\//)){const _0x410032=_0x23eb2f[_0x43a1df(0x118)](0x1)['toUpperCase'](),_0x12e373=_0x23eb2f[_0x43a1df(0x113)](0x2)['replace'](/\//g,'\x5c');return _0x410032+':'+_0x12e373;}if(_0x23eb2f[_0x43a1df(0x121)](/^[a-zA-Z]:/))return _0x23eb2f[_0x43a1df(0x114)](/\//g,'\x5c');return _0x23eb2f;}function a3_0x1c2f(_0x3af966,_0x3eae5a){_0x3af966=_0x3af966-0x113;const _0x13b547=a3_0x13b5();let _0x1c2fc7=_0x13b547[_0x3af966];return _0x1c2fc7;}export function normalizePath(_0x2a4733){const _0x4f277d=a3_0x1c2f;_0x2a4733=_0x2a4733[_0x4f277d(0x126)]()[_0x4f277d(0x114)](/^["']|["']$/g,'');const _0xe745b8=_0x2a4733[_0x4f277d(0x11b)]('/')&&!_0x2a4733['match'](/^\/mnt\/[a-z]\//i)&&!_0x2a4733[_0x4f277d(0x121)](/^\/[a-zA-Z]\//);if(_0xe745b8)return _0x2a4733[_0x4f277d(0x114)](/\/+/g,'/')[_0x4f277d(0x114)](/\/+$/,'');_0x2a4733=convertToWindowsPath(_0x2a4733);if(_0x2a4733[_0x4f277d(0x11b)]('\x5c\x5c')){let _0x345ace=_0x2a4733;_0x345ace=_0x345ace[_0x4f277d(0x114)](/^\\{2,}/,'\x5c\x5c');const _0x495c3b=_0x345ace[_0x4f277d(0x119)](0x2)[_0x4f277d(0x114)](/\\\\/g,'\x5c');_0x2a4733='\x5c\x5c'+_0x495c3b;}else _0x2a4733=_0x2a4733['replace'](/\\\\/g,'\x5c');let _0x15586d=a3_0x17c956['normalize'](_0x2a4733);_0x2a4733['startsWith']('\x5c\x5c')&&!_0x15586d[_0x4f277d(0x11b)]('\x5c\x5c')&&(_0x15586d='\x5c'+_0x15586d);if(_0x15586d['match'](/^[a-zA-Z]:/)){let _0x11e375=_0x15586d[_0x4f277d(0x114)](/\//g,'\x5c');return/^[a-z]:/[_0x4f277d(0x11f)](_0x11e375)&&(_0x11e375=_0x11e375[_0x4f277d(0x118)](0x0)[_0x4f277d(0x11c)]()+_0x11e375[_0x4f277d(0x113)](0x1)),_0x11e375;}return _0x15586d[_0x4f277d(0x114)](/\//g,'\x5c');}export function expandHome(_0xc58137){const _0x34cbce=a3_0x1c2f;if(_0xc58137[_0x34cbce(0x11b)]('~/')||_0xc58137==='~')return a3_0x17c956['join'](a3_0x4d9086[_0x34cbce(0x117)](),_0xc58137[_0x34cbce(0x113)](0x1));return _0xc58137;}
1
+ (function(_0x18136e,_0x17c8c7){const _0x21d491=a3_0x3abf,_0x514fcf=_0x18136e();while(!![]){try{const _0x5d054b=parseInt(_0x21d491(0x190))/0x1+parseInt(_0x21d491(0x196))/0x2+parseInt(_0x21d491(0x198))/0x3*(-parseInt(_0x21d491(0x188))/0x4)+-parseInt(_0x21d491(0x187))/0x5+parseInt(_0x21d491(0x189))/0x6*(parseInt(_0x21d491(0x199))/0x7)+-parseInt(_0x21d491(0x192))/0x8*(parseInt(_0x21d491(0x191))/0x9)+-parseInt(_0x21d491(0x197))/0xa*(parseInt(_0x21d491(0x18d))/0xb);if(_0x5d054b===_0x17c8c7)break;else _0x514fcf['push'](_0x514fcf['shift']());}catch(_0x42ad38){_0x514fcf['push'](_0x514fcf['shift']());}}}(a3_0x3f1d,0xdb028));import a3_0x453b06 from'path';import a3_0x102973 from'os';export function convertToWindowsPath(_0x459c2f){const _0x325567=a3_0x3abf;if(_0x459c2f[_0x325567(0x18a)]('/mnt/')){const _0x45a7f=_0x459c2f[_0x325567(0x18c)](0x5)['toUpperCase'](),_0x561aaf=_0x459c2f[_0x325567(0x193)](0x6)[_0x325567(0x194)](/\//g,'\x5c');return _0x45a7f+':'+_0x561aaf;}if(_0x459c2f[_0x325567(0x18e)](/^\/[a-zA-Z]\//)){const _0xe31746=_0x459c2f[_0x325567(0x18c)](0x1)['toUpperCase'](),_0x440e29=_0x459c2f[_0x325567(0x193)](0x2)[_0x325567(0x194)](/\//g,'\x5c');return _0xe31746+':'+_0x440e29;}if(_0x459c2f['match'](/^[a-zA-Z]:/))return _0x459c2f[_0x325567(0x194)](/\//g,'\x5c');return _0x459c2f;}export function normalizePath(_0x20dccf){const _0x694287=a3_0x3abf;_0x20dccf=_0x20dccf['trim']()[_0x694287(0x194)](/^["']|["']$/g,'');const _0x1068cd=_0x20dccf[_0x694287(0x18a)]('/')&&!_0x20dccf['match'](/^\/mnt\/[a-z]\//i)&&!_0x20dccf[_0x694287(0x18e)](/^\/[a-zA-Z]\//);if(_0x1068cd)return _0x20dccf[_0x694287(0x194)](/\/+/g,'/')[_0x694287(0x194)](/\/+$/,'');_0x20dccf=convertToWindowsPath(_0x20dccf);if(_0x20dccf[_0x694287(0x18a)]('\x5c\x5c')){let _0x1e1dc6=_0x20dccf;_0x1e1dc6=_0x1e1dc6['replace'](/^\\{2,}/,'\x5c\x5c');const _0x1906a8=_0x1e1dc6[_0x694287(0x18b)](0x2)[_0x694287(0x194)](/\\\\/g,'\x5c');_0x20dccf='\x5c\x5c'+_0x1906a8;}else _0x20dccf=_0x20dccf[_0x694287(0x194)](/\\\\/g,'\x5c');let _0x4922ac=a3_0x453b06['normalize'](_0x20dccf);_0x20dccf['startsWith']('\x5c\x5c')&&!_0x4922ac[_0x694287(0x18a)]('\x5c\x5c')&&(_0x4922ac='\x5c'+_0x4922ac);if(_0x4922ac[_0x694287(0x18e)](/^[a-zA-Z]:/)){let _0x48372f=_0x4922ac[_0x694287(0x194)](/\//g,'\x5c');return/^[a-z]:/[_0x694287(0x195)](_0x48372f)&&(_0x48372f=_0x48372f[_0x694287(0x18c)](0x0)[_0x694287(0x186)]()+_0x48372f[_0x694287(0x193)](0x1)),_0x48372f;}return _0x4922ac['replace'](/\//g,'\x5c');}export function expandHome(_0x3a5f99){const _0x101a43=a3_0x3abf;if(_0x3a5f99[_0x101a43(0x18a)]('~/')||_0x3a5f99==='~')return a3_0x453b06['join'](a3_0x102973[_0x101a43(0x18f)](),_0x3a5f99[_0x101a43(0x193)](0x1));return _0x3a5f99;}function a3_0x3abf(_0x1e64ac,_0x334e2e){_0x1e64ac=_0x1e64ac-0x186;const _0x3f1de8=a3_0x3f1d();let _0x3abf45=_0x3f1de8[_0x1e64ac];return _0x3abf45;}function a3_0x3f1d(){const _0x4be2a9=['954WMvOkc','startsWith','substring','charAt','4708033GYdvAe','match','homedir','1582988rviypK','535833twkFRk','40SOhMOp','slice','replace','test','3159674qxHMjc','20RNveRm','777888cVOsQI','742iTSPMH','toUpperCase','1755180emyKId','12Ksujom'];a3_0x3f1d=function(){return _0x4be2a9;};return a3_0x3f1d();}
@@ -1 +1 @@
1
- function a4_0x4fe6(){const _0x26ee04=['2890zmvCTW','Path\x20must\x20be\x20absolute\x20after\x20normalization','12137472bcdcnD','string','some','7agYZOO','5002SKovAt','normalize','startsWith','952086EyTMkW','length','45FPKOiV','5735272zuiFYv','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','785500vqhcZp','sep','includes','177078RSDISC','765UHFzUn','resolve','708384oIuMZT'];a4_0x4fe6=function(){return _0x26ee04;};return a4_0x4fe6();}(function(_0x1e0322,_0x21d391){const _0x2748fe=a4_0x4545,_0x3bac44=_0x1e0322();while(!![]){try{const _0x1d8a54=-parseInt(_0x2748fe(0xf5))/0x1+parseInt(_0x2748fe(0xfc))/0x2*(parseInt(_0x2748fe(0xf3))/0x3)+-parseInt(_0x2748fe(0xef))/0x4*(parseInt(_0x2748fe(0x101))/0x5)+parseInt(_0x2748fe(0xff))/0x6*(parseInt(_0x2748fe(0xfb))/0x7)+-parseInt(_0x2748fe(0xed))/0x8+-parseInt(_0x2748fe(0xf8))/0x9+parseInt(_0x2748fe(0xf6))/0xa*(parseInt(_0x2748fe(0xf2))/0xb);if(_0x1d8a54===_0x21d391)break;else _0x3bac44['push'](_0x3bac44['shift']());}catch(_0x4e15c8){_0x3bac44['push'](_0x3bac44['shift']());}}}(a4_0x4fe6,0xdd8da));import a4_0x195184 from'path';function a4_0x4545(_0x5c751f,_0x1fe371){_0x5c751f=_0x5c751f-0xed;const _0x4fe67b=a4_0x4fe6();let _0x45455a=_0x4fe67b[_0x5c751f];return _0x45455a;}export function isPathWithinAllowedDirectories(_0x244fde,_0x163d1b){const _0x42fb35=a4_0x4545;if(typeof _0x244fde!==_0x42fb35(0xf9)||!Array['isArray'](_0x163d1b))return![];if(!_0x244fde||_0x163d1b[_0x42fb35(0x100)]===0x0)return![];if(_0x244fde[_0x42fb35(0xf1)]('\x00'))return![];let _0x2ea334;try{_0x2ea334=a4_0x195184[_0x42fb35(0xf4)](a4_0x195184[_0x42fb35(0xfd)](_0x244fde));}catch{return![];}if(!a4_0x195184['isAbsolute'](_0x2ea334))throw new Error(_0x42fb35(0xf7));return _0x163d1b[_0x42fb35(0xfa)](_0xa5c2c5=>{const _0x130d24=_0x42fb35;if(typeof _0xa5c2c5!==_0x130d24(0xf9)||!_0xa5c2c5)return![];if(_0xa5c2c5[_0x130d24(0xf1)]('\x00'))return![];let _0x54895a;try{_0x54895a=a4_0x195184[_0x130d24(0xf4)](a4_0x195184[_0x130d24(0xfd)](_0xa5c2c5));}catch{return![];}if(!a4_0x195184['isAbsolute'](_0x54895a))throw new Error(_0x130d24(0xee));if(_0x2ea334===_0x54895a)return!![];if(_0x54895a===a4_0x195184[_0x130d24(0xf0)])return _0x2ea334[_0x130d24(0xfe)](a4_0x195184[_0x130d24(0xf0)]);return _0x2ea334[_0x130d24(0xfe)](_0x54895a+a4_0x195184[_0x130d24(0xf0)]);});}
1
+ function a4_0x3199(){const _0x5b074b=['normalize','198BBJIQV','2288930amRFAh','6iOoueK','isArray','1090zjbeMY','4172232VQBlRl','75427rhmaVF','15532CnPDLi','2415807skEJhL','907494TzviGc','sep','resolve','isAbsolute','501lnRegU','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','some','string','includes','4288mwfXCg','16XWkGvx','Path\x20must\x20be\x20absolute\x20after\x20normalization'];a4_0x3199=function(){return _0x5b074b;};return a4_0x3199();}(function(_0x1ff8f7,_0x52f931){const _0x3780c3=a4_0x2476,_0x24b467=_0x1ff8f7();while(!![]){try{const _0x38f81a=parseInt(_0x3780c3(0x1c2))/0x1*(-parseInt(_0x3780c3(0x1c6))/0x2)+-parseInt(_0x3780c3(0x1bd))/0x3*(-parseInt(_0x3780c3(0x1cd))/0x4)+parseInt(_0x3780c3(0x1c7))/0x5*(parseInt(_0x3780c3(0x1c8))/0x6)+parseInt(_0x3780c3(0x1cf))/0x7+-parseInt(_0x3780c3(0x1c3))/0x8*(parseInt(_0x3780c3(0x1ce))/0x9)+-parseInt(_0x3780c3(0x1ca))/0xa*(-parseInt(_0x3780c3(0x1cc))/0xb)+-parseInt(_0x3780c3(0x1cb))/0xc;if(_0x38f81a===_0x52f931)break;else _0x24b467['push'](_0x24b467['shift']());}catch(_0x4431fc){_0x24b467['push'](_0x24b467['shift']());}}}(a4_0x3199,0xa49d2));function a4_0x2476(_0x34f40e,_0x209605){_0x34f40e=_0x34f40e-0x1bc;const _0x31991f=a4_0x3199();let _0x2476ff=_0x31991f[_0x34f40e];return _0x2476ff;}import a4_0x1eeeb3 from'path';export function isPathWithinAllowedDirectories(_0xda619e,_0x33914f){const _0x4d23f8=a4_0x2476;if(typeof _0xda619e!=='string'||!Array[_0x4d23f8(0x1c9)](_0x33914f))return![];if(!_0xda619e||_0x33914f['length']===0x0)return![];if(_0xda619e['includes']('\x00'))return![];let _0x38aec8;try{_0x38aec8=a4_0x1eeeb3[_0x4d23f8(0x1d1)](a4_0x1eeeb3[_0x4d23f8(0x1c5)](_0xda619e));}catch{return![];}if(!a4_0x1eeeb3[_0x4d23f8(0x1bc)](_0x38aec8))throw new Error(_0x4d23f8(0x1c4));return _0x33914f[_0x4d23f8(0x1bf)](_0x40647e=>{const _0x26ec3a=_0x4d23f8;if(typeof _0x40647e!==_0x26ec3a(0x1c0)||!_0x40647e)return![];if(_0x40647e[_0x26ec3a(0x1c1)]('\x00'))return![];let _0x49a49d;try{_0x49a49d=a4_0x1eeeb3[_0x26ec3a(0x1d1)](a4_0x1eeeb3['normalize'](_0x40647e));}catch{return![];}if(!a4_0x1eeeb3[_0x26ec3a(0x1bc)](_0x49a49d))throw new Error(_0x26ec3a(0x1be));if(_0x38aec8===_0x49a49d)return!![];if(_0x49a49d===a4_0x1eeeb3[_0x26ec3a(0x1d0)])return _0x38aec8['startsWith'](a4_0x1eeeb3[_0x26ec3a(0x1d0)]);return _0x38aec8['startsWith'](_0x49a49d+a4_0x1eeeb3[_0x26ec3a(0x1d0)]);});}
@@ -1 +1 @@
1
- (function(_0x211011,_0x1b049a){const _0x3df5c3=a5_0x115f,_0x32049d=_0x211011();while(!![]){try{const _0x28f421=-parseInt(_0x3df5c3(0xf5))/0x1*(parseInt(_0x3df5c3(0xe4))/0x2)+-parseInt(_0x3df5c3(0xec))/0x3*(parseInt(_0x3df5c3(0xde))/0x4)+-parseInt(_0x3df5c3(0xeb))/0x5+-parseInt(_0x3df5c3(0xe3))/0x6+-parseInt(_0x3df5c3(0xe7))/0x7+-parseInt(_0x3df5c3(0xf4))/0x8+-parseInt(_0x3df5c3(0xdf))/0x9*(-parseInt(_0x3df5c3(0xe6))/0xa);if(_0x28f421===_0x1b049a)break;else _0x32049d['push'](_0x32049d['shift']());}catch(_0x5a2bb3){_0x32049d['push'](_0x32049d['shift']());}}}(a5_0x6c6b,0xcf692));import{promises as a5_0x585bd4}from'fs';import a5_0x58cd32 from'path';import a5_0x4b73c6 from'os';function a5_0x115f(_0x35bc89,_0x4aabd9){_0x35bc89=_0x35bc89-0xde;const _0x6c6bf6=a5_0x6c6b();let _0x115ffa=_0x6c6bf6[_0x35bc89];return _0x115ffa;}import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x40de6d){const _0x28bac2=a5_0x115f;try{const _0x3cd7ad=_0x40de6d['startsWith'](_0x28bac2(0xf6))?_0x40de6d['slice'](0x7):_0x40de6d,_0x368895=_0x3cd7ad[_0x28bac2(0xea)]('~/')||_0x3cd7ad==='~'?a5_0x58cd32['join'](a5_0x4b73c6[_0x28bac2(0xe0)](),_0x3cd7ad[_0x28bac2(0xf0)](0x1)):_0x3cd7ad,_0x3434fc=a5_0x58cd32[_0x28bac2(0xf2)](_0x368895),_0x2034fb=await a5_0x585bd4[_0x28bac2(0xe2)](_0x3434fc);return normalizePath(_0x2034fb);}catch{return null;}}function a5_0x6c6b(){const _0x93127e=['1772141lyZVlk','invalid\x20path\x20or\x20inaccessible','message','startsWith','4147035XJQZgY','123eWXZMT','stat','push','\x20due\x20to\x20error:\x20','slice','non-directory\x20root','resolve','uri','7410352GsWkjQ','1454028RawjcJ','file://','108044GFoQcr','537291KKOQwF','homedir','Skipping\x20invalid\x20directory:\x20','realpath','4374600IYWKwi','2XaJrvm','Skipping\x20','1030efGpWy'];a5_0x6c6b=function(){return _0x93127e;};return a5_0x6c6b();}function formatDirectoryError(_0x3284d4,_0xe31dc2,_0x51b09e){const _0x138b6b=a5_0x115f;if(_0x51b09e)return _0x138b6b(0xe5)+_0x51b09e+':\x20'+_0x3284d4;const _0x5c1199=_0xe31dc2 instanceof Error?_0xe31dc2[_0x138b6b(0xe9)]:String(_0xe31dc2);return _0x138b6b(0xe1)+_0x3284d4+_0x138b6b(0xef)+_0x5c1199;}export async function getValidRootDirectories(_0x4238d9){const _0x25136b=a5_0x115f,_0x3b6dd3=[];for(const _0x47395a of _0x4238d9){const _0x5ecee4=await parseRootUri(_0x47395a[_0x25136b(0xf3)]);if(!_0x5ecee4){logMcpStderr(formatDirectoryError(_0x47395a[_0x25136b(0xf3)],undefined,_0x25136b(0xe8)));continue;}try{const _0x189ef7=await a5_0x585bd4[_0x25136b(0xed)](_0x5ecee4);_0x189ef7['isDirectory']()?_0x3b6dd3[_0x25136b(0xee)](_0x5ecee4):logMcpStderr(formatDirectoryError(_0x5ecee4,undefined,_0x25136b(0xf1)));}catch(_0x29a1b8){logMcpStderr(formatDirectoryError(_0x5ecee4,_0x29a1b8));}}return _0x3b6dd3;}
1
+ (function(_0x14add4,_0x5b247b){const _0x4cf208=a5_0x21d9,_0x31e407=_0x14add4();while(!![]){try{const _0x4c75fa=-parseInt(_0x4cf208(0x16d))/0x1+-parseInt(_0x4cf208(0x164))/0x2*(parseInt(_0x4cf208(0x16c))/0x3)+parseInt(_0x4cf208(0x170))/0x4*(parseInt(_0x4cf208(0x15e))/0x5)+parseInt(_0x4cf208(0x16f))/0x6*(parseInt(_0x4cf208(0x163))/0x7)+-parseInt(_0x4cf208(0x167))/0x8+parseInt(_0x4cf208(0x160))/0x9*(-parseInt(_0x4cf208(0x166))/0xa)+-parseInt(_0x4cf208(0x169))/0xb*(-parseInt(_0x4cf208(0x168))/0xc);if(_0x4c75fa===_0x5b247b)break;else _0x31e407['push'](_0x31e407['shift']());}catch(_0x349c2c){_0x31e407['push'](_0x31e407['shift']());}}}(a5_0x6067,0x1d5ef));import{promises as a5_0x472eb2}from'fs';import a5_0x11bf4d from'path';import a5_0x5738d2 from'os';function a5_0x6067(){const _0x4be585=['\x20due\x20to\x20error:\x20','non-directory\x20root','invalid\x20path\x20or\x20inaccessible','9965sKHKoV','resolve','9WfOAXO','join','uri','14Nhtbzi','52ZnYnNJ','startsWith','2194190JgjUyp','1736680bOcxZO','200628MhABvu','605JWoDYT','file://','Skipping\x20','25182VClrzb','217215MEuCWs','slice','80646OBvkGt','92WZsnbt','message','realpath','homedir'];a5_0x6067=function(){return _0x4be585;};return a5_0x6067();}import{normalizePath}from'./path-utils.js';function a5_0x21d9(_0x525119,_0x3d5af2){_0x525119=_0x525119-0x15a;const _0x606712=a5_0x6067();let _0x21d9df=_0x606712[_0x525119];return _0x21d9df;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x22981b){const _0x2c002d=a5_0x21d9;try{const _0x407b8a=_0x22981b['startsWith'](_0x2c002d(0x16a))?_0x22981b[_0x2c002d(0x16e)](0x7):_0x22981b,_0x3a3f7e=_0x407b8a[_0x2c002d(0x165)]('~/')||_0x407b8a==='~'?a5_0x11bf4d[_0x2c002d(0x161)](a5_0x5738d2[_0x2c002d(0x15a)](),_0x407b8a['slice'](0x1)):_0x407b8a,_0x21ad64=a5_0x11bf4d[_0x2c002d(0x15f)](_0x3a3f7e),_0x5dc9c2=await a5_0x472eb2[_0x2c002d(0x172)](_0x21ad64);return normalizePath(_0x5dc9c2);}catch{return null;}}function formatDirectoryError(_0x15b76e,_0x5980b7,_0x5f3a4f){const _0x3b133f=a5_0x21d9;if(_0x5f3a4f)return _0x3b133f(0x16b)+_0x5f3a4f+':\x20'+_0x15b76e;const _0x2c87fb=_0x5980b7 instanceof Error?_0x5980b7[_0x3b133f(0x171)]:String(_0x5980b7);return'Skipping\x20invalid\x20directory:\x20'+_0x15b76e+_0x3b133f(0x15b)+_0x2c87fb;}export async function getValidRootDirectories(_0x155dab){const _0x3a0969=a5_0x21d9,_0x5e779b=[];for(const _0x615fce of _0x155dab){const _0x3f6877=await parseRootUri(_0x615fce['uri']);if(!_0x3f6877){logMcpStderr(formatDirectoryError(_0x615fce[_0x3a0969(0x162)],undefined,_0x3a0969(0x15d)));continue;}try{const _0x22f2ae=await a5_0x472eb2['stat'](_0x3f6877);_0x22f2ae['isDirectory']()?_0x5e779b['push'](_0x3f6877):logMcpStderr(formatDirectoryError(_0x3f6877,undefined,_0x3a0969(0x15c)));}catch(_0xb135f9){logMcpStderr(formatDirectoryError(_0x3f6877,_0xb135f9));}}return _0x5e779b;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.163",
3
+ "version": "0.8.165",
4
4
  "description": "Fast & accurate MCP server with AI-powered file editing and intelligent code search. Prevents context pollution and saves time for a better user experience.",
5
5
  "license": "MIT",
6
6
  "author": "Morph (https://morphllm.com)",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@google/generative-ai": "^0.21.0",
37
37
  "@modelcontextprotocol/sdk": "^1.12.3",
38
- "@morphllm/morphsdk": "0.2.163",
38
+ "@morphllm/morphsdk": "0.2.164",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",