@morphllm/morphmcp 0.8.202 → 0.8.203

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_0x181a2a=a0_0x5b32;(function(_0x3d5885,_0x47dff3){const _0x284841=a0_0x5b32,_0x3b3458=_0x3d5885();while(!![]){try{const _0x4c57ae=parseInt(_0x284841(0xdb))/0x1+parseInt(_0x284841(0x185))/0x2+-parseInt(_0x284841(0xe8))/0x3*(parseInt(_0x284841(0x18a))/0x4)+parseInt(_0x284841(0x16f))/0x5*(-parseInt(_0x284841(0x19e))/0x6)+parseInt(_0x284841(0x91))/0x7+parseInt(_0x284841(0xd4))/0x8*(parseInt(_0x284841(0x15d))/0x9)+-parseInt(_0x284841(0x153))/0xa;if(_0x4c57ae===_0x47dff3)break;else _0x3b3458['push'](_0x3b3458['shift']());}catch(_0x536cb1){_0x3b3458['push'](_0x3b3458['shift']());}}}(a0_0x5383,0xc1757));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_0x34bf37 from'fs/promises';import a0_0x46f789 from'path';import a0_0x517fde 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_0x54f02f from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function fixPathRepetition(_0x20add0){const _0x592a82=a0_0x5b32,_0x5b0499=_0x20add0['split'](a0_0x46f789['sep'])[_0x592a82(0xe7)](Boolean);if(_0x5b0499[_0x592a82(0xa3)]<0x2)return null;for(let _0x4303d5=Math[_0x592a82(0xb1)](_0x5b0499[_0x592a82(0xa3)]/0x2);_0x4303d5>=0x1;_0x4303d5--){for(let _0xdb268=0x0;_0xdb268<=_0x5b0499['length']-0x2*_0x4303d5;_0xdb268++){const _0x5d22d2=_0x5b0499[_0x592a82(0xc1)](_0xdb268,_0xdb268+_0x4303d5),_0x256702=_0x5b0499['slice'](_0xdb268+_0x4303d5,_0xdb268+0x2*_0x4303d5);if(_0x5d22d2[_0x592a82(0x15c)]((_0x4d5485,_0x5816a7)=>_0x4d5485===_0x256702[_0x5816a7])){const _0xa5ccb2=[..._0x5b0499[_0x592a82(0xc1)](0x0,_0xdb268),..._0x5b0499['slice'](_0xdb268+_0x4303d5)];return a0_0x46f789[_0x592a82(0x94)]+_0xa5ccb2[_0x592a82(0x16b)](a0_0x46f789[_0x592a82(0x94)]);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x26fd28=a0_0x5b32;try{const _0x5ca227=require(_0x26fd28(0xc0));return _0x5ca227[_0x26fd28(0x13a)]??'unknown';}catch(_0xfd651e){return logMcpStderr('Warning:\x20Unable\x20to\x20determine\x20package\x20version:',_0xfd651e),_0x26fd28(0x102);}}function printHelp(){const _0xe7f11c=a0_0x5b32;console[_0xe7f11c(0xca)](_0xe7f11c(0xf8)+getPackageVersion()),console['log'](_0xe7f11c(0x19c)),console[_0xe7f11c(0xca)](_0xe7f11c(0x13f)),console[_0xe7f11c(0xca)](_0xe7f11c(0x1b1)),console[_0xe7f11c(0xca)](_0xe7f11c(0x191)),console['log'](_0xe7f11c(0xd3)),console[_0xe7f11c(0xca)](_0xe7f11c(0x115)),console[_0xe7f11c(0xca)](_0xe7f11c(0xbf)),console[_0xe7f11c(0xca)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process[a0_0x181a2a(0x112)][a0_0x181a2a(0xc1)](0x2),VERSION_FLAGS=new Set([a0_0x181a2a(0xc9),'-v','-V']),HELP_FLAGS=new Set([a0_0x181a2a(0xe0),'-h']);cliArgs['some'](_0x2533a4=>VERSION_FLAGS[a0_0x181a2a(0x142)](_0x2533a4))&&(console[a0_0x181a2a(0xca)](a0_0x181a2a(0xf8)+getPackageVersion()),process[a0_0x181a2a(0x14e)](0x0));cliArgs[a0_0x181a2a(0x10a)](_0x471fba=>HELP_FLAGS[a0_0x181a2a(0x142)](_0x471fba))&&(printHelp(),process[a0_0x181a2a(0x14e)](0x0));function getCliArg(_0x190946){const _0x22615f=a0_0x181a2a;for(let _0xc52008=0x0;_0xc52008<cliArgs['length'];_0xc52008++){const _0xb398a0=cliArgs[_0xc52008];if(_0xb398a0[_0x22615f(0x196)]('--'+_0x190946+'='))return _0xb398a0['slice'](('--'+_0x190946+'=')[_0x22615f(0xa3)]);if(_0xb398a0==='--'+_0x190946&&_0xc52008+0x1<cliArgs[_0x22615f(0xa3)])return cliArgs[_0xc52008+0x1];}return undefined;}const args=[];function a0_0x5383(){const _0x109bfa=['Applied','basename','floor','\x0a</file>','GITHUB_CODEBASE_SEARCH','\x20is\x20not\x20a\x20directory','all','Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol','payload','\x22>\x0a','target_file','LocalRipgrepProvider','split','WarpGrep\x20sub-tool\x20errors:\x20','[github_codebase_search]\x20Failed\x20in\x20','text','\x20\x20morph-mcp','../package.json','slice','error','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','Here\x20is\x20the\x20content\x20of\x20files:\x0a','searchGitHub','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','indexOf','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.','--version','log','-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a','Invalid\x20arguments:\x20','assistant','name','post','instruction','github_url','constructor','\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit','8wxNbrM','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','string','warp_grep_start','❌\x20Morph\x20Edit\x20Failed:\x20','path','[could\x20not\x20read\x20file:\x20','169037ukAoVW','Specific\x20commit\x20hash\x20to\x20search','file_path','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','push','--help','Parent\x20directory\x20does\x20not\x20exist:\x20','completed_with_file_errors','compaction_failed','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','path_validation_resolved','TimeoutError','filter','3671970Gumgrg','Error:\x20','completionId','linesRemoved','Morph\x20Edit\x20Preview','enum','ENOENT','env','getClientCapabilities','Cargo.toml','Workspace\x20mode\x20enabled:\x20Using\x20','tool','\x20chars)','morph-mcp','params','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','@morphllm/morphmcp\x20','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','isArray','grep_search','.\x20Path:\x20','stat','Failed\x20to\x20request\x20roots\x20from\x20client:','file','Error\x20accessing\x20directory\x20','etimedout','unknown','context','warp_grep_complete','Relevant\x20context\x20found:','files','<file\x20path=\x22','tool_call_complete','0.2.0','some','BinaryFile','`\x20in\x20`',',\x20modified\x20','command','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','FileReadError','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','argv','dirname','false','\x0aExamples:','function','changes','glob','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','.vscode','Created\x20File','owner_repo','warn','FileNotFound','timed\x20out','Failed\x20to\x20read\x20file:\x20','tool_call_received','\x27\x20in\x20`','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','linesAdded','edit_file','https://morphllm.com/api/error-report','morph-v3-fast','messages','composer.json','array','list_directory\x20','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','requiresApiKey','MORPH_WARP_GREP_TIMEOUT','roots','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','size','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','data','version','toLowerCase','search_string','tsconfig.json','content','\x0aOptions:','now','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','has','morph-warp-grep-v2.1','timeout','describe','--api-key=','listRoots','No\x20Morph\x20API\x20key\x20configured.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20an\x20API\x20key,\x20then\x20set\x20MORPH_API_KEY\x20in\x20your\x20MCP\x20configuration.','go.mod','min','repo_path','code','SymlinkError','exit','MCP','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','dryRun','RipgrepError','5769960MxwBmo','Error\x20running\x20fast\x20context\x20search:\x20','substring','\x20error(s)','default','access','code_edit','PathError','readFile','every','5241285pdRbMi','new_string','list_directory','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.','Rules:\x0a','.\x20Changes:\x20','morph-','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','arguments','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','Morph\x20FastApply\x20failed\x20without\x20error\x20message','EDIT_FILE','-\x20Grepped\x20\x27','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.','join','MORPH_LARGE_APPLY','read','branch','145IsOZRe','source','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','parse','tool_call_id','File\x20read\x20error:','mcp-filesystem','SubToolError','completed','\x0a...\x20(truncated,\x20total:\x20','added\x20','stack','includes','timings','homedir','turns','user','ENABLE_WORKSPACE_MODE','Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20','grep\x20\x27','glob\x20\x27','oninitialized','1093254lpzqwe','\x20(new\x20file)','resolve','terminated','message','4nFYsGi','Repository\x20identifier','lines','safeParse','Tool\x20\x22','isDirectory','map','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','filePath','github_search_start','search_type','linesModified','startsWith','object','realpath','unknown\x20error','--api-key','finish','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','morph-v3-large','52098OHtDGv','tool_calls','errors','success','target_filepath','WarpGrepError','application/json','setRequestHandler','Max\x20results\x20to\x20return','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.','\x20as\x20allowed\x20directory','catch','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','ToolException','status','\x20valid\x20directories','Fallback:\x20Using\x20workspace\x20root\x20','role','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','boolean','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.','UnknownError','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','node_modules','DISABLED_TOOLS','pattern','.cursor','instructions','Tool\x20','10830197OXPBgX','api-key','read\x20','sep','match','package.json','CODEBASE_SEARCH','stringify','\x22.\x20Known\x20tools:\x20','debug','PWD','toISOString','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:','-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','file_read_failed','provider_created','\x20disabled\x20via\x20DISABLED_TOOLS','codebase_search','length','terminationReason','\x22>\x0aError\x20reading\x20file:\x20','path_validation_failed','metadata','API\x20error\x20(auth/rate-limit)','Warning:\x20','ReadError','path_validation_start','tool_call_error','sk-','optional'];a0_0x5383=function(){return _0x109bfa;};return a0_0x5383();}for(let i=0x0;i<cliArgs[a0_0x181a2a(0xa3)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x181a2a(0x142)](arg)||HELP_FLAGS[a0_0x181a2a(0x142)](arg))continue;if(arg[a0_0x181a2a(0x196)](a0_0x181a2a(0x146)))continue;if(arg===a0_0x181a2a(0x19a)){i++;continue;}args[a0_0x181a2a(0xdf)](arg);}const WORKSPACE_ROOT=process[a0_0x181a2a(0xef)]['WORKSPACE_ROOT']||process['env'][a0_0x181a2a(0x9b)]||process['cwd'](),ENABLE_WORKSPACE_MODE=process[a0_0x181a2a(0xef)][a0_0x181a2a(0x180)]!==a0_0x181a2a(0x114),MORPH_API_KEY=getCliArg(a0_0x181a2a(0x92))??process[a0_0x181a2a(0xef)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x181a2a(0xef)]['MORPH_API_URL'],MORPH_LARGE_APPLY=process[a0_0x181a2a(0xef)][a0_0x181a2a(0x16c)]!=='false',MORPH_WARP_GREP_TIMEOUT=process['env'][a0_0x181a2a(0x12e)]?parseInt(process['env'][a0_0x181a2a(0x12e)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x181a2a(0xef)][a0_0x181a2a(0x1b8)]?new Set(process[a0_0x181a2a(0xef)][a0_0x181a2a(0x1b8)][a0_0x181a2a(0xbb)](',')[a0_0x181a2a(0x190)](_0xe12b7c=>_0xe12b7c['trim']())[a0_0x181a2a(0xe7)](_0xfbc190=>_0xfbc190[a0_0x181a2a(0xa3)]>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x181a2a(0x135)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES[a0_0x181a2a(0x142)](tool)&&console[a0_0x181a2a(0xc2)](a0_0x181a2a(0xc3)+tool+a0_0x181a2a(0x99)+[...KNOWN_TOOL_NAMES][a0_0x181a2a(0x16b)](',\x20'));}console['error']('Disabled\x20tools:\x20'+[...DISABLED_TOOLS][a0_0x181a2a(0x16b)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY[a0_0x181a2a(0x196)]('sk-')&&!MORPH_API_KEY['startsWith'](a0_0x181a2a(0x163))&&logMcpStderr(a0_0x181a2a(0x10f));async function reportMorphError(_0x5209ed){const _0x333000=a0_0x181a2a;try{await a0_0x54f02f[_0x333000(0xcf)](_0x333000(0x126),{..._0x5209ed,'timestamp':new Date()[_0x333000(0x9c)](),'source':_0x5209ed[_0x333000(0x170)]||_0x333000(0x175),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x5209ed[_0x333000(0x103)]}},{'timeout':0x1388,'headers':{'Content-Type':_0x333000(0x1a4),'Authorization':'Bearer\x20'+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x1fb794,_0x18ecfa){const _0x2b6430=a0_0x181a2a;if(_0x1fb794&&typeof _0x1fb794===_0x2b6430(0x197)&&_0x2b6430(0x1ad)in _0x1fb794)return _0x1fb794[_0x2b6430(0x1ad)];if(_0x1fb794&&typeof _0x1fb794===_0x2b6430(0x197)&&'response'in _0x1fb794)return _0x1fb794['response']?.[_0x2b6430(0x1ad)];const _0x55efe7=_0x18ecfa[_0x2b6430(0x95)](/\b(401|429)\b/);return _0x55efe7?parseInt(_0x55efe7[0x1],0xa):null;}function handleMorphAPIError(_0x2e560b){const _0xaa335d=a0_0x181a2a,_0x51d6ef=_0x2e560b instanceof Error?_0x2e560b[_0xaa335d(0x189)]:String(_0x2e560b),_0x2dcca4=extractStatusCode(_0x2e560b,_0x51d6ef);switch(_0x2dcca4){case 0x191:return{'content':[{'type':'text','text':_0xaa335d(0xc8)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0xaa335d(0xbe),'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_0x181a2a(0xa3)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x181a2a(0x130)),logMcpStderr('Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:'),logMcpStderr('\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)'),logMcpStderr(a0_0x181a2a(0xde)),logMcpStderr(a0_0x181a2a(0x138)),logMcpStderr(a0_0x181a2a(0x134)));function a0_0x5b32(_0x20fbee,_0x573024){_0x20fbee=_0x20fbee-0x8e;const _0x53835f=a0_0x5383();let _0x5b3206=_0x53835f[_0x20fbee];return _0x5b3206;}function normalizePath(_0x44d515){return a0_0x46f789['normalize'](_0x44d515);}function expandHome(_0x3aa7bb){const _0x32384c=a0_0x181a2a;if(_0x3aa7bb[_0x32384c(0x196)]('~/')||_0x3aa7bb==='~')return a0_0x46f789[_0x32384c(0x16b)](a0_0x517fde[_0x32384c(0x17d)](),_0x3aa7bb[_0x32384c(0xc1)](0x1));return _0x3aa7bb;}let allowedDirectories=await Promise['all'](args['map'](async _0x63901d=>{const _0x38288b=a0_0x181a2a,_0x58cd70=expandHome(_0x63901d),_0x180e47=a0_0x46f789[_0x38288b(0x187)](_0x58cd70);try{const _0x4d78c0=await a0_0x34bf37['realpath'](_0x180e47);return normalizePath(_0x4d78c0);}catch(_0x57f178){return normalizePath(_0x180e47);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories[a0_0x181a2a(0xdf)](workspaceDir),logMcpStderr(a0_0x181a2a(0xf2)+workspaceDir+a0_0x181a2a(0x1a9)));}catch(a0_0x201819){logMcpStderr(a0_0x181a2a(0x12c)+a0_0x201819);}async function detectWorkspaceRoot(_0x40a245){const _0x2f9aed=a0_0x181a2a;let _0x20b151=a0_0x46f789[_0x2f9aed(0x187)](_0x40a245);const _0xf7b742=['.git',_0x2f9aed(0x11a),_0x2f9aed(0x96),_0x2f9aed(0xf1),'pyproject.toml',_0x2f9aed(0x149),_0x2f9aed(0x8e),_0x2f9aed(0x13d),_0x2f9aed(0x129)];while(_0x20b151!==a0_0x46f789[_0x2f9aed(0x113)](_0x20b151)){for(const _0x3b8dd5 of _0xf7b742){const _0xcc8969=a0_0x46f789[_0x2f9aed(0x16b)](_0x20b151,_0x3b8dd5);try{return await a0_0x34bf37[_0x2f9aed(0x158)](_0xcc8969),normalizePath(_0x20b151);}catch{}}_0x20b151=a0_0x46f789[_0x2f9aed(0x113)](_0x20b151);}return normalizePath(_0x40a245);}await Promise[a0_0x181a2a(0xb5)](args[a0_0x181a2a(0x190)](async _0x17570a=>{const _0x4a6cc9=a0_0x181a2a;try{const _0x5e28a7=await a0_0x34bf37[_0x4a6cc9(0xfd)](expandHome(_0x17570a));!_0x5e28a7[_0x4a6cc9(0x18f)]()&&(logMcpStderr('Error:\x20'+_0x17570a+_0x4a6cc9(0xb4)),process[_0x4a6cc9(0x14e)](0x1));}catch(_0x416a2d){logMcpStderr(_0x4a6cc9(0x100)+_0x17570a+':',_0x416a2d),process['exit'](0x1);}}));async function validatePath(_0x2ebe5d){const _0x2c950f=a0_0x181a2a,_0x21081c=expandHome(_0x2ebe5d),_0x3e0b6e=a0_0x46f789[_0x2c950f(0x187)](_0x21081c);logger['debug'](_0x2c950f(0x14f),_0x2c950f(0xab),{'raw_path':_0x2ebe5d,'absolute':_0x3e0b6e});try{const _0x8136f9=await a0_0x34bf37['realpath'](_0x3e0b6e);return logger[_0x2c950f(0x9a)](_0x2c950f(0x14f),_0x2c950f(0xe5),{'resolved':_0x8136f9,'symlink':_0x8136f9!==_0x3e0b6e}),_0x8136f9;}catch(_0x495615){if(_0x495615[_0x2c950f(0x14c)]===_0x2c950f(0xee)){const _0x32d95a=a0_0x46f789['dirname'](_0x3e0b6e);try{const _0x48846b=await a0_0x34bf37[_0x2c950f(0x198)](_0x32d95a),_0x14cd8f=a0_0x46f789[_0x2c950f(0x16b)](_0x48846b,a0_0x46f789[_0x2c950f(0xb0)](_0x3e0b6e));return logger[_0x2c950f(0x9a)](_0x2c950f(0x14f),_0x2c950f(0xe5),{'resolved':_0x14cd8f,'new_file':!![]}),_0x14cd8f;}catch{logger[_0x2c950f(0xc2)](_0x2c950f(0x14f),'path_validation_failed',{'raw_path':_0x2ebe5d,'error':_0x2c950f(0xe1)+_0x32d95a});throw new Error('Parent\x20directory\x20does\x20not\x20exist:\x20'+_0x32d95a);}}logger['error'](_0x2c950f(0x14f),_0x2c950f(0xa6),{'raw_path':_0x2ebe5d,'error':_0x495615[_0x2c950f(0x189)]});throw _0x495615;}}const MorphEditFileArgsSchema=z['object']({'path':z[a0_0x181a2a(0xd6)](),'code_edit':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0x145)](a0_0x181a2a(0x132)),'instruction':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0x145)](a0_0x181a2a(0xc6)),'dryRun':z[a0_0x181a2a(0x1b3)]()[a0_0x181a2a(0x157)](![])[a0_0x181a2a(0x145)]('Preview\x20changes\x20without\x20applying\x20them.')}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x181a2a(0x160),WarpGrepArgsSchema=z[a0_0x181a2a(0x197)]({'search_string':z['string']()[a0_0x181a2a(0x145)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0x145)](a0_0x181a2a(0x1b6)),'search_type':z[a0_0x181a2a(0xed)]([a0_0x181a2a(0x157),'node_modules'])['optional']()[a0_0x181a2a(0x145)](a0_0x181a2a(0x133))}),WarpGrepGitHubArgsSchema=z[a0_0x181a2a(0x197)]({'search_string':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0x145)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0xae)]()[a0_0x181a2a(0x145)](a0_0x181a2a(0x1b4)),'owner_repo':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0xae)]()[a0_0x181a2a(0x145)]('Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'branch':z[a0_0x181a2a(0xd6)]()['optional']()[a0_0x181a2a(0x145)](a0_0x181a2a(0x137))}),CodebaseSearchArgsSchema=z[a0_0x181a2a(0x197)]({'query':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0x145)](a0_0x181a2a(0x18b)),'branch':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0xae)]()[a0_0x181a2a(0x145)]('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x181a2a(0xd6)]()[a0_0x181a2a(0xae)]()['describe'](a0_0x181a2a(0xdc)),'targetDirectories':z[a0_0x181a2a(0x12a)](z[a0_0x181a2a(0xd6)]())['default']([])['describe']('Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all'),'limit':z['number']()['optional']()[a0_0x181a2a(0x157)](0xa)['describe'](a0_0x181a2a(0x1a6))}),server=new Server({'name':a0_0x181a2a(0xf5),'version':'0.2.0'},{'capabilities':{'tools':{}}});server[a0_0x181a2a(0x1a5)](ListToolsRequestSchema,async()=>{const _0xc0c9ef=a0_0x181a2a,_0x2598cf=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0xc0c9ef(0x1a7)+_0xc0c9ef(0x164)+'Parameters:\x0a'+_0xc0c9ef(0xcb)+_0xc0c9ef(0x1ab)+_0xc0c9ef(0xf7)+_0xc0c9ef(0x141)+'Example\x20format:\x0a'+_0xc0c9ef(0x136)+_0xc0c9ef(0x161)+'-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a'+'-\x20Preserve\x20exact\x20indentation\x0a'+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+_0xc0c9ef(0x9e),'inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES[_0xc0c9ef(0x97)],'description':_0xc0c9ef(0x150)+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'+_0xc0c9ef(0x1b2)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x58078c=_0x2598cf[_0xc0c9ef(0xe7)](_0x56adb2=>{const _0x512b44=_0xc0c9ef;if(DISABLED_TOOLS[_0x512b44(0x142)](_0x56adb2['name']))return console[_0x512b44(0xc2)](_0x512b44(0x90)+_0x56adb2['name']+_0x512b44(0xa1)),![];if(_0x512b44(0x12d)in _0x56adb2&&_0x56adb2['requiresApiKey']&&!MORPH_API_KEY)return logMcpStderr(_0x512b44(0xa9)+_0x56adb2[_0x512b44(0xce)]+_0x512b44(0x123)),![];return!![];});return{'tools':_0x58078c['map'](_0x3947b0=>({'name':_0x3947b0[_0xc0c9ef(0xce)],'description':_0x3947b0['description'],'inputSchema':_0x3947b0['inputSchema']}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x488cb5=>{const _0x5671a4=a0_0x181a2a,{name:_0x3ee19b,arguments:_0x5e398b}=_0x488cb5[_0x5671a4(0xf6)],_0x47fae7=Date[_0x5671a4(0x140)]();logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),_0x5671a4(0x121),{'tool':_0x3ee19b,'args':_0x3ee19b===_0x5671a4(0x125)?{'path':_0x5e398b?.['path'],'instruction':_0x5e398b?.['instruction']||_0x5e398b?.[_0x5671a4(0x8f)],'dryRun':_0x5e398b?.['dryRun']}:_0x5e398b});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0x148)}],'isError':!![]};if(!MORPH_API_KEY['startsWith'](_0x5671a4(0xad))&&!MORPH_API_KEY[_0x5671a4(0x196)]('morph-'))return{'content':[{'type':'text','text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x5671a4(0x142)](_0x3ee19b))return{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0x18e)+_0x3ee19b+_0x5671a4(0x1a8)}],'isError':![]};switch(_0x3ee19b){case TOOL_NAMES[_0x5671a4(0x168)]:{let _0x43a62a=_0x5e398b;if(_0x43a62a&&typeof _0x43a62a==='object'){if(!('path'in _0x43a62a)){const _0x75ac6b=_0x43a62a[_0x5671a4(0xb9)]??_0x43a62a[_0x5671a4(0x192)]??_0x43a62a[_0x5671a4(0x1a2)]??_0x43a62a[_0x5671a4(0xdd)]??_0x43a62a[_0x5671a4(0xff)];if(_0x75ac6b)_0x43a62a={..._0x43a62a,'path':_0x75ac6b};}_0x5671a4(0x8f)in _0x43a62a&&!(_0x5671a4(0xd0)in _0x43a62a)&&(_0x43a62a={..._0x43a62a,'instruction':_0x43a62a[_0x5671a4(0x8f)]});if(!(_0x5671a4(0x159)in _0x43a62a)){const _0x325036=_0x43a62a['code']??_0x43a62a[_0x5671a4(0x15e)]??_0x43a62a['content']??_0x43a62a['edit'];if(_0x325036)_0x43a62a={..._0x43a62a,'code_edit':_0x325036};}}const _0x1e7d79=MorphEditFileArgsSchema[_0x5671a4(0x18d)](_0x43a62a);if(!_0x1e7d79[_0x5671a4(0x1a1)])throw new Error(_0x5671a4(0x111)+_0x1e7d79[_0x5671a4(0xc2)]);const _0x518766=await validatePath(_0x1e7d79['data']['path']);let _0x5bccaa=null,_0x2dc740=!![],_0x191178=null;try{_0x5bccaa=await a0_0x34bf37[_0x5671a4(0x15b)](_0x518766,'utf-8'),logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),'file_read_complete',{'path':_0x518766,'size_bytes':_0x5bccaa[_0x5671a4(0xa3)]});}catch(_0x1db97e){const _0x4eb3d5=_0x1db97e[_0x5671a4(0x14c)];_0x4eb3d5==='ENOENT'?(_0x2dc740=![],_0x5bccaa='',logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),'file_read_complete',{'path':_0x518766,'exists':![]})):(_0x191178=_0x5671a4(0x120)+(_0x4eb3d5||_0x5671a4(0x102))+'\x20-\x20'+(_0x1db97e instanceof Error?_0x1db97e[_0x5671a4(0x189)]:String(_0x1db97e)),logger[_0x5671a4(0xc2)]('MCP',_0x5671a4(0x9f),{'path':_0x518766,'error':_0x191178}),logMcpStderr('Warning:\x20'+_0x191178));}let _0x5b18c9;try{const _0x241f44=MORPH_API_KEY;if(!_0x241f44)throw new Error(_0x5671a4(0xf9));const _0x2c0481=a0_0x46f789[_0x5671a4(0x113)](_0x518766),_0x4b5039=a0_0x46f789[_0x5671a4(0xb0)](_0x518766);logger[_0x5671a4(0x9a)]('MCP','api_request_start',{'model':_0x5671a4(0x127),'path':_0x1e7d79['data']['path'],'instruction_len':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd0)]['length'],'code_edit_len':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0x159)]['length'],'original_code_len':_0x5bccaa?.[_0x5671a4(0xa3)]??0x0,'dry_run':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0x151)]});const _0x1464d8=Date[_0x5671a4(0x140)](),_0x19736a=await executeEditFile({'target_filepath':_0x4b5039,'code_edit':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0x159)],'instruction':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd0)]},{'morphApiKey':_0x241f44,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x2c0481,'autoWrite':!_0x1e7d79[_0x5671a4(0x139)]['dryRun'],'generateUdiff':![],'debug':![]}),_0x31151f=Date[_0x5671a4(0x140)]()-_0x1464d8;_0x5b18c9=_0x19736a[_0x5671a4(0xea)];if(!_0x19736a['success'])throw new Error(_0x19736a[_0x5671a4(0xc2)]||_0x5671a4(0x167));const _0x7c9dc0=_0x19736a[_0x5671a4(0x117)],_0x3eb706=_0x5671a4(0x179)+_0x7c9dc0['linesAdded']+',\x20removed\x20'+_0x7c9dc0['linesRemoved']+_0x5671a4(0x10d)+_0x7c9dc0[_0x5671a4(0x195)];logger['debug'](_0x5671a4(0x14f),_0x5671a4(0x108),{'tool':_0x5671a4(0x125),'success':!![],'latency_ms':Date['now']()-_0x47fae7,'edit_latency_ms':_0x31151f,'changes':{'added':_0x7c9dc0[_0x5671a4(0x124)],'removed':_0x7c9dc0[_0x5671a4(0xeb)],'modified':_0x7c9dc0[_0x5671a4(0x195)]},'completion_id':_0x5b18c9});if(_0x1e7d79[_0x5671a4(0x139)]['dryRun'])return{'content':[{'type':'text','text':_0x5671a4(0xec)+(_0x2dc740?'':_0x5671a4(0x186))+':\x20'+_0x1e7d79[_0x5671a4(0x139)]['instruction']+_0x5671a4(0x162)+_0x3eb706+_0x5671a4(0xfc)+_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd9)]+'.'}]};return{'content':[{'type':_0x5671a4(0xbe),'text':'Morph\x20Edit\x20'+(_0x2dc740?_0x5671a4(0xaf):_0x5671a4(0x11b))+':\x20'+_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd0)]+_0x5671a4(0x162)+_0x3eb706+_0x5671a4(0xfc)+_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd9)]+'.'}]};}catch(_0x2416a4){const _0xd7776f=handleMorphAPIError(_0x2416a4);if(_0xd7776f)return logger['error']('MCP',_0x5671a4(0xac),{'tool':_0x5671a4(0x125),'error':_0x5671a4(0xa8),'latency_ms':Date[_0x5671a4(0x140)]()-_0x47fae7}),_0xd7776f;const _0x783242=_0x2416a4 instanceof Error?_0x2416a4[_0x5671a4(0x189)]:String(_0x2416a4);return logger[_0x5671a4(0xc2)](_0x5671a4(0x14f),_0x5671a4(0xac),{'tool':_0x5671a4(0x125),'error':_0x783242,'path':_0x1e7d79[_0x5671a4(0x139)]['path'],'validated_path':_0x518766,'latency_ms':Date['now']()-_0x47fae7,'stack':_0x2416a4 instanceof Error?_0x2416a4[_0x5671a4(0x17a)]:undefined}),reportMorphError({'error_message':_0x783242,'error_type':_0x2416a4 instanceof Error?_0x2416a4[_0x5671a4(0xd2)]['name']:'UnknownError','context':{'tool':_0x5671a4(0x125),'completion_id':_0x5b18c9,'file_path':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd9)],'validated_path':_0x518766,'instruction':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd0)],'model':MORPH_LARGE_APPLY?_0x5671a4(0x19d):'morph-v3-fast','dry_run':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0x151)],'file_exists':_0x2dc740,'file_read_error':_0x191178,'file_readable':_0x5bccaa!==null,'request_content':{'path':_0x1e7d79[_0x5671a4(0x139)]['path'],'code_edit':_0x1e7d79[_0x5671a4(0x139)]['code_edit'],'instruction':_0x1e7d79[_0x5671a4(0x139)][_0x5671a4(0xd0)],'original_code':_0x5bccaa!==null?_0x5bccaa[_0x5671a4(0xa3)]>0xc350?_0x5bccaa[_0x5671a4(0x155)](0x0,0xc350)+_0x5671a4(0x178)+_0x5bccaa[_0x5671a4(0xa3)]+_0x5671a4(0xf4):_0x5bccaa:_0x5671a4(0xda)+(_0x191178||_0x5671a4(0x199))+']','original_code_length':_0x5bccaa?.['length']??0x0,'model':MORPH_LARGE_APPLY?_0x5671a4(0x19d):_0x5671a4(0x127),'dry_run':_0x1e7d79['data'][_0x5671a4(0x151)]}},'stack_trace':_0x2416a4 instanceof Error?_0x2416a4[_0x5671a4(0x17a)]:undefined,'source':'mcp-filesystem'})[_0x5671a4(0x1aa)](()=>{}),{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0xd8)+_0x783242}],'isError':!![]};}}case TOOL_NAMES['CODEBASE_SEARCH']:{const _0x5eb29d=WarpGrepArgsSchema[_0x5671a4(0x18d)](_0x5e398b);if(!_0x5eb29d[_0x5671a4(0x1a1)])return{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0xcc)+_0x5eb29d[_0x5671a4(0xc2)]}],'isError':!![]};const _0x326cf3=_0x5d0133=>{const _0xaa9158=_0x5671a4,_0x4ab384=[];for(const _0x118ccb of _0x5d0133||[]){if(_0x118ccb['role']===_0xaa9158(0xcd)&&Array['isArray'](_0x118ccb[_0xaa9158(0x19f)]))for(const _0x358cf2 of _0x118ccb[_0xaa9158(0x19f)]){try{const _0x4ed7b0=_0x358cf2[_0xaa9158(0x116)]?.['name'],_0x5936a4=JSON[_0xaa9158(0x172)](_0x358cf2[_0xaa9158(0x116)]?.[_0xaa9158(0x165)]||'{}');if(_0x4ed7b0===_0xaa9158(0xfb))_0x4ab384['push'](_0xaa9158(0x182)+_0x5936a4['pattern']+'\x27\x20'+(_0x5936a4['path']||'.'));else{if(_0x4ed7b0===_0xaa9158(0x16d))_0x4ab384[_0xaa9158(0xdf)](_0xaa9158(0x93)+_0x5936a4[_0xaa9158(0xd9)]);else{if(_0x4ed7b0===_0xaa9158(0x15f))_0x4ab384[_0xaa9158(0xdf)](_0xaa9158(0x12b)+(_0x5936a4[_0xaa9158(0x10e)]||'.'));else{if(_0x4ed7b0===_0xaa9158(0x118))_0x4ab384[_0xaa9158(0xdf)](_0xaa9158(0x183)+_0x5936a4['pattern']+'\x27\x20'+(_0x5936a4['path']||'.'));else _0x4ed7b0===_0xaa9158(0x19b)&&_0x4ab384['push'](_0xaa9158(0x19b));}}}}catch{}}}return _0x4ab384;},_0x4ed05e=_0x5bd462=>{const _0x33968e=_0x5671a4,_0x12125f=[];if(!_0x5bd462||!Array[_0x33968e(0xfa)](_0x5bd462))return _0x12125f;const _0x28a804=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x33968e(0x11e),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x33968e(0x15a),'tool':_0x33968e(0x16d)},{'pattern':/\[READ ERROR\]/,'error_type':_0x33968e(0xaa),'tool':_0x33968e(0x16d)},{'pattern':/\[UNREADABLE FILE\]/,'error_type':'BinaryFile','tool':_0x33968e(0x16d)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x33968e(0x152),'tool':'grep'},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':'grep'},{'pattern':/\[BINARY FILE\]/,'error_type':_0x33968e(0x10b),'tool':'read'},{'pattern':/\[SYMLINK\]/,'error_type':_0x33968e(0x14d),'tool':_0x33968e(0x16d)},{'pattern':/not a text file/,'error_type':_0x33968e(0x10b),'tool':_0x33968e(0x16d)},{'pattern':/symbolic link/,'error_type':_0x33968e(0x14d),'tool':'read'},{'pattern':/Error reading file:/,'error_type':'ReadError','tool':_0x33968e(0x16d)},{'pattern':/status="error"/,'error_type':_0x33968e(0x1ac),'tool':_0x33968e(0x102)}];let _0x569752=0x0;for(const _0x3a30f4 of _0x5bd462){_0x3a30f4[_0x33968e(0x1b0)]===_0x33968e(0xcd)&&Array[_0x33968e(0xfa)](_0x3a30f4['tool_calls'])&&_0x569752++;const _0x2f5184=_0x3a30f4[_0x33968e(0x13e)];if((_0x3a30f4[_0x33968e(0x1b0)]===_0x33968e(0xf3)||_0x3a30f4[_0x33968e(0x1b0)]===_0x33968e(0x17f))&&_0x2f5184&&typeof _0x2f5184===_0x33968e(0xd6))for(const {pattern:_0x4dd28d,error_type:_0x1e585c,tool:_0x1f639c}of _0x28a804){const _0x40e0df=_0x2f5184['match'](new RegExp(_0x4dd28d[_0x33968e(0x170)],'g'));if(_0x40e0df)for(const _0x55cae2 of _0x40e0df){const _0x2dfaf6=_0x2f5184[_0x33968e(0xc7)](_0x55cae2),_0x3de66b=_0x2f5184[_0x33968e(0x155)](_0x2dfaf6,Math[_0x33968e(0x14a)](_0x2dfaf6+0xc8,_0x2f5184['length']));_0x12125f[_0x33968e(0xdf)]({'tool':_0x1f639c,'error_type':_0x1e585c,'error_message':_0x3de66b[_0x33968e(0xbb)]('\x0a')[0x0],'turn':_0x569752});}}}return _0x12125f;};try{const _0x46b5f9=a0_0x46f789['resolve'](_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)]),_0x42a825=_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x194)],_0xaaf5f=_0x42a825==='node_modules'?{'allowNames':[_0x5671a4(0x1b7)]}:undefined,_0x5dfac0=new LocalRipgrepProvider(_0x46b5f9,undefined,_0xaaf5f);logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),_0x5671a4(0xa0),{'type':_0x5671a4(0xba),'repo_root':_0x46b5f9,'search_type':_0x42a825||'default'}),logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),_0x5671a4(0xd7),{'query':_0x5eb29d[_0x5671a4(0x139)]['search_string'],'repo_root':_0x46b5f9,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0xf170d9=Date[_0x5671a4(0x140)](),_0x83fb48=await runWarpGrep({'searchTerm':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x13c)],'repoRoot':_0x46b5f9,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x5dfac0,'search_type':_0x42a825}),_0xa48b4=Date[_0x5671a4(0x140)]()-_0xf170d9,_0x28e743=_0x83fb48[_0x5671a4(0x19b)]?.[_0x5671a4(0xa7)]?.[_0x5671a4(0x106)]?.[_0x5671a4(0xa3)]??0x0;logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),_0x5671a4(0x104),{'termination':_0x83fb48[_0x5671a4(0xa4)],'turns':_0x83fb48[_0x5671a4(0x17c)]?.[_0x5671a4(0x17e)]??0x0,'files_found':_0x28e743,'latency_ms':_0xa48b4});const _0x21b6ed=_0x4ed05e(_0x83fb48[_0x5671a4(0x128)]);_0x21b6ed['length']>0x0&&reportMorphError({'error_message':_0x5671a4(0xbc)+_0x21b6ed[_0x5671a4(0xa3)]+_0x5671a4(0x156),'error_type':_0x5671a4(0x176),'level':'warn','tool':'codebase_search','context':{'repo_path':_0x5eb29d['data']['repo_path'],'query':_0x5eb29d['data']['search_string'],'model':_0x5671a4(0x143),'termination_reason':_0x83fb48[_0x5671a4(0xa4)],'sub_tool_errors':_0x21b6ed,'timings':_0x83fb48[_0x5671a4(0x17c)],'tool_calls':_0x326cf3(_0x83fb48[_0x5671a4(0x128)]),'messages':_0x83fb48[_0x5671a4(0x128)]?.[_0x5671a4(0x190)](_0x2818db=>({'role':_0x2818db[_0x5671a4(0x1b0)],'content':_0x2818db[_0x5671a4(0x13e)],..._0x2818db[_0x5671a4(0x19f)]?{'tool_calls':_0x2818db['tool_calls'][_0x5671a4(0xa3)]}:{},..._0x2818db['tool_call_id']?{'tool_call_id':_0x2818db[_0x5671a4(0x173)]}:{}}))},'source':'mcp-filesystem'})[_0x5671a4(0x1aa)](()=>{});let _0x11d1c0='';if(_0x83fb48['terminationReason']===_0x5671a4(0x177)&&_0x83fb48[_0x5671a4(0x19b)]?.[_0x5671a4(0xa7)]?.[_0x5671a4(0x106)]){const _0x494234=_0x83fb48[_0x5671a4(0x19b)][_0x5671a4(0xa7)][_0x5671a4(0x106)];if(_0x494234[_0x5671a4(0xa3)]===0x0)return _0x11d1c0=_0x83fb48['finish'][_0x5671a4(0xb7)]||_0x5671a4(0xe4),{'content':[{'type':'text','text':_0x11d1c0}]};const _0x46514a=[],_0x18cd53=[_0x5671a4(0xd5)];for(const _0x47f309 of _0x83fb48['messages']){if(_0x47f309[_0x5671a4(0x1b0)]===_0x5671a4(0xcd)&&Array[_0x5671a4(0xfa)](_0x47f309['tool_calls']))for(const _0x17cfef of _0x47f309[_0x5671a4(0x19f)]){try{const _0x41139c=_0x17cfef[_0x5671a4(0x116)]?.[_0x5671a4(0xce)],_0x5cb945=JSON['parse'](_0x17cfef['function']?.[_0x5671a4(0x165)]||'{}');if(_0x41139c===_0x5671a4(0xfb))_0x18cd53[_0x5671a4(0xdf)](_0x5671a4(0x169)+_0x5cb945[_0x5671a4(0x1b9)]+_0x5671a4(0x122)+(_0x5cb945['path']||'.')+'`');else{if(_0x41139c==='read')_0x18cd53[_0x5671a4(0xdf)]('-\x20Read\x20file\x20`'+_0x5cb945[_0x5671a4(0xd9)]+'`');else{if(_0x41139c===_0x5671a4(0x15f))_0x18cd53[_0x5671a4(0xdf)]('-\x20Listed\x20directory\x20`'+(_0x5cb945[_0x5671a4(0x10e)]||'.')+'`');else _0x41139c===_0x5671a4(0x118)&&_0x18cd53[_0x5671a4(0xdf)]('-\x20Glob\x20search\x20`'+_0x5cb945[_0x5671a4(0x1b9)]+_0x5671a4(0x10c)+(_0x5cb945['path']||'.')+'`');}}}catch{}}}_0x46514a[_0x5671a4(0xdf)](_0x18cd53[_0x5671a4(0x16b)]('\x0a'));const _0x1d8206=['',_0x5671a4(0x105)];for(const _0x21ba72 of _0x494234){if(_0x21ba72[_0x5671a4(0x18c)]==='*')_0x1d8206[_0x5671a4(0xdf)]('-\x20'+_0x21ba72[_0x5671a4(0xd9)]+':*');else{if(Array[_0x5671a4(0xfa)](_0x21ba72[_0x5671a4(0x18c)])){const _0x37baaf=_0x21ba72[_0x5671a4(0x18c)][_0x5671a4(0x190)](([_0x5c5e19,_0x1a67de])=>{if(_0x5c5e19===_0x1a67de)return''+_0x5c5e19;return _0x5c5e19+'-'+_0x1a67de;});_0x1d8206[_0x5671a4(0xdf)]('-\x20'+_0x21ba72[_0x5671a4(0xd9)]+':'+_0x37baaf['join'](','));}else _0x1d8206['push']('-\x20'+_0x21ba72['path']+':*');}}_0x1d8206['push'](''),_0x46514a['push'](_0x1d8206['join']('\x0a')),_0x46514a[_0x5671a4(0xdf)](_0x5671a4(0xc4));const _0x1d8ca7=[],_0x37c8fc=[];for(const _0x53209c of _0x494234){let _0x15dcd1=a0_0x46f789[_0x5671a4(0x187)](_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)],_0x53209c['path']),_0x1c1bcb=null,_0x2dbfa7=null;try{_0x1c1bcb=await a0_0x34bf37[_0x5671a4(0x15b)](_0x15dcd1,{'encoding':'utf-8'});}catch(_0x433c60){const _0x54265b=fixPathRepetition(_0x15dcd1);if(_0x54265b)try{_0x1c1bcb=await a0_0x34bf37[_0x5671a4(0x15b)](_0x54265b,{'encoding':'utf-8'}),_0x15dcd1=_0x54265b;}catch{_0x2dbfa7=_0x433c60 instanceof Error?_0x433c60:new Error(String(_0x433c60));}else _0x2dbfa7=_0x433c60 instanceof Error?_0x433c60:new Error(String(_0x433c60));}if(_0x1c1bcb!==null){const _0x371da3=_0x1c1bcb['split'](/\r?\n/),_0x183280=[];if(_0x53209c[_0x5671a4(0x18c)]==='*'||!Array[_0x5671a4(0xfa)](_0x53209c[_0x5671a4(0x18c)]))for(let _0x3568df=0x1;_0x3568df<=_0x371da3[_0x5671a4(0xa3)];_0x3568df++){const _0x338652=_0x371da3[_0x3568df-0x1];_0x183280[_0x5671a4(0xdf)](_0x3568df+'|\x20'+_0x338652);}else for(const [_0x1db68d,_0x474999]of _0x53209c[_0x5671a4(0x18c)]){_0x183280[_0x5671a4(0xa3)]>0x0&&_0x183280[_0x5671a4(0xdf)]('');for(let _0x30ad64=_0x1db68d;_0x30ad64<=_0x474999&&_0x30ad64<=_0x371da3['length'];_0x30ad64++){const _0x44e00d=_0x371da3[_0x30ad64-0x1];_0x183280[_0x5671a4(0xdf)](_0x30ad64+'|\x20'+_0x44e00d);}}_0x37c8fc[_0x5671a4(0xdf)]({'path':_0x53209c['path'],'content':_0x183280[_0x5671a4(0x16b)]('\x0a')});}else _0x1d8ca7[_0x5671a4(0xdf)]('<file\x20path=\x22'+_0x53209c[_0x5671a4(0xd9)]+_0x5671a4(0xa5)+(_0x2dbfa7?.['message']||'Unknown\x20error')+_0x5671a4(0xb2));}try{const _0x46debe=await compactFileContexts(_0x37c8fc,_0x5eb29d['data'][_0x5671a4(0x13c)],MORPH_API_KEY,MORPH_API_URL);for(const _0xa3512e of _0x46debe){_0x1d8ca7[_0x5671a4(0xdf)](_0x5671a4(0x107)+_0xa3512e[_0x5671a4(0xd9)]+_0x5671a4(0xb8)+_0xa3512e[_0x5671a4(0x13e)]+_0x5671a4(0xb2));}}catch(_0x424d8c){logger[_0x5671a4(0x11d)](_0x5671a4(0x14f),_0x5671a4(0xe3),{'error':_0x424d8c instanceof Error?_0x424d8c[_0x5671a4(0x189)]:String(_0x424d8c),'files_count':_0x37c8fc[_0x5671a4(0xa3)]});for(const _0x23b655 of _0x37c8fc){_0x1d8ca7[_0x5671a4(0xdf)](_0x5671a4(0x107)+_0x23b655[_0x5671a4(0xd9)]+_0x5671a4(0xb8)+_0x23b655[_0x5671a4(0x13e)]+_0x5671a4(0xb2));}}_0x46514a[_0x5671a4(0xdf)](_0x1d8ca7[_0x5671a4(0x16b)]('\x0a\x0a')),_0x11d1c0=_0x46514a[_0x5671a4(0x16b)]('\x0a');const _0x9fd78d=_0x83fb48[_0x5671a4(0x1a0)]?.['filter'](_0x399035=>_0x399035['message']?.[_0x5671a4(0x196)](_0x5671a4(0x174)))||[];if(_0x9fd78d[_0x5671a4(0xa3)]>0x0){const _0x2e8247=_0x9fd78d[_0x5671a4(0x190)](_0x3d918a=>_0x3d918a[_0x5671a4(0x189)])['join'](';\x20');reportMorphError({'error_message':_0x2e8247,'error_type':_0x5671a4(0x110),'context':{'tool':'codebase_search','repo_path':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)],'query':_0x5eb29d[_0x5671a4(0x139)]['search_string'],'model':_0x5671a4(0x143),'termination_reason':_0x5671a4(0xe2),'error_count':_0x9fd78d['length'],'is_timeout':![],'timings':_0x83fb48['timings'],'files_attempted':_0x494234[_0x5671a4(0x190)](_0x38aab2=>({'path':_0x38aab2['path'],'lines':_0x38aab2['lines']})),'tool_calls':_0x326cf3(_0x83fb48['messages']),'messages':_0x83fb48[_0x5671a4(0x128)]?.[_0x5671a4(0x190)](_0xc7b6b9=>({'role':_0xc7b6b9['role'],'content':_0xc7b6b9[_0x5671a4(0x13e)],..._0xc7b6b9[_0x5671a4(0x19f)]?{'tool_calls':_0xc7b6b9['tool_calls'][_0x5671a4(0xa3)]}:{},..._0xc7b6b9[_0x5671a4(0x173)]?{'tool_call_id':_0xc7b6b9[_0x5671a4(0x173)]}:{}})),'request_content':{'query':_0x5eb29d['data']['search_string'],'repo_path':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)],'repoRoot':a0_0x46f789[_0x5671a4(0x187)](_0x5eb29d[_0x5671a4(0x139)]['repo_path']),'model':_0x5671a4(0x143)}},'source':_0x5671a4(0x175)})[_0x5671a4(0x1aa)](()=>{});}}else{if(_0x83fb48[_0x5671a4(0xa4)]===_0x5671a4(0x188)&&_0x83fb48[_0x5671a4(0x1a0)][_0x5671a4(0xa3)]>0x0){const _0x38c23c=_0x83fb48[_0x5671a4(0x1a0)][_0x5671a4(0x190)](_0x1beefc=>_0x1beefc[_0x5671a4(0x189)])[_0x5671a4(0x16b)](';\x20');_0x11d1c0=_0x5671a4(0xe9)+_0x38c23c;const _0x3b900c=_0x38c23c[_0x5671a4(0x13b)]()[_0x5671a4(0x17b)](_0x5671a4(0x144))||_0x38c23c[_0x5671a4(0x13b)]()[_0x5671a4(0x17b)](_0x5671a4(0x11f))||_0x38c23c[_0x5671a4(0x13b)]()['includes']('etimedout'),_0x1adee3=_0x83fb48[_0x5671a4(0x19b)]?.[_0x5671a4(0xa7)]?.[_0x5671a4(0x106)],_0xa1d6fc=_0x83fb48[_0x5671a4(0x1a0)][0x0];reportMorphError({'error_message':_0x38c23c,'error_type':_0x3b900c?'TimeoutError':_0xa1d6fc?.[_0x5671a4(0xd2)]?.[_0x5671a4(0xce)]||_0x5671a4(0x1a3),'context':{'tool':_0x5671a4(0xa2),'repo_path':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)],'query':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x13c)],'model':_0x5671a4(0x143),'termination_reason':_0x83fb48[_0x5671a4(0xa4)],'error_count':_0x83fb48['errors'][_0x5671a4(0xa3)],'is_timeout':_0x3b900c,'timings':_0x83fb48[_0x5671a4(0x17c)],'files_attempted':_0x1adee3?.[_0x5671a4(0x190)](_0x550de3=>({'path':_0x550de3[_0x5671a4(0xd9)],'lines':_0x550de3[_0x5671a4(0x18c)]})),'tool_calls':_0x326cf3(_0x83fb48[_0x5671a4(0x128)]),'messages':_0x83fb48[_0x5671a4(0x128)]?.[_0x5671a4(0x190)](_0x553cbd=>({'role':_0x553cbd['role'],'content':_0x553cbd[_0x5671a4(0x13e)],..._0x553cbd[_0x5671a4(0x19f)]?{'tool_calls':_0x553cbd[_0x5671a4(0x19f)][_0x5671a4(0xa3)]}:{},..._0x553cbd[_0x5671a4(0x173)]?{'tool_call_id':_0x553cbd['tool_call_id']}:{}})),'request_content':{'query':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x13c)],'repo_path':_0x5eb29d['data']['repo_path'],'repoRoot':a0_0x46f789[_0x5671a4(0x187)](_0x5eb29d['data'][_0x5671a4(0x14b)]),'model':_0x5671a4(0x143)}},'stack_trace':_0xa1d6fc?.[_0x5671a4(0x17a)]||undefined,'source':_0x5671a4(0x175)})[_0x5671a4(0x1aa)](()=>{});}else _0x11d1c0='Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.';}return{'content':[{'type':'text','text':_0x11d1c0}]};}catch(_0x17ce4b){const _0x54e9af=handleMorphAPIError(_0x17ce4b);if(_0x54e9af)return logger['error']('MCP','tool_call_error',{'tool':_0x5671a4(0xa2),'error':_0x5671a4(0xa8),'latency_ms':Date[_0x5671a4(0x140)]()-_0x47fae7}),_0x54e9af;const _0xa5c2aa=_0x17ce4b instanceof Error?_0x17ce4b[_0x5671a4(0x189)]:String(_0x17ce4b);logger[_0x5671a4(0xc2)](_0x5671a4(0x14f),_0x5671a4(0xac),{'tool':_0x5671a4(0xa2),'error':_0xa5c2aa,'repo_path':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)],'query':_0x5eb29d[_0x5671a4(0x139)]['search_string'],'latency_ms':Date[_0x5671a4(0x140)]()-_0x47fae7});const _0x5b85dc=_0xa5c2aa[_0x5671a4(0x13b)]()['includes']('timeout')||_0xa5c2aa['toLowerCase']()[_0x5671a4(0x17b)](_0x5671a4(0x11f))||_0xa5c2aa[_0x5671a4(0x13b)]()['includes'](_0x5671a4(0x101))||_0x17ce4b instanceof Error&&_0x17ce4b[_0x5671a4(0xce)]==='TimeoutError';return reportMorphError({'error_message':_0xa5c2aa,'error_type':_0x5b85dc?_0x5671a4(0xe6):_0x17ce4b instanceof Error?_0x17ce4b[_0x5671a4(0xd2)][_0x5671a4(0xce)]:'UnknownError','context':{'tool':_0x5671a4(0xa2),'repo_path':_0x5eb29d['data'][_0x5671a4(0x14b)],'query':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x13c)],'model':'morph-warp-grep-v2.1','is_timeout':_0x5b85dc,'exception_phase':'runWarpGrep_call','request_content':{'query':_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x13c)],'repo_path':_0x5eb29d[_0x5671a4(0x139)]['repo_path'],'repoRoot':a0_0x46f789[_0x5671a4(0x187)](_0x5eb29d[_0x5671a4(0x139)][_0x5671a4(0x14b)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x17ce4b instanceof Error?_0x17ce4b[_0x5671a4(0x17a)]:undefined,'source':'mcp-filesystem'})['catch'](()=>{}),{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0x154)+_0xa5c2aa}],'isError':![]};}}case TOOL_NAMES[_0x5671a4(0xb3)]:{const _0x2bc6cb=WarpGrepGitHubArgsSchema[_0x5671a4(0x18d)](_0x5e398b);if(!_0x2bc6cb['success'])return{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0xcc)+_0x2bc6cb[_0x5671a4(0xc2)]}],'isError':!![]};const _0x1f6438=_0x2bc6cb[_0x5671a4(0x139)][_0x5671a4(0xd1)]||_0x2bc6cb['data'][_0x5671a4(0x11c)];if(!_0x1f6438)return{'content':[{'type':_0x5671a4(0xbe),'text':'Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id'}],'isError':!![]};const _0x502413=MORPH_API_KEY;if(!_0x502413)throw new Error(_0x5671a4(0xf9));const _0x23c005=Date[_0x5671a4(0x140)]();logger[_0x5671a4(0x9a)](_0x5671a4(0x14f),_0x5671a4(0x193),{'identifier':_0x1f6438,'query':_0x2bc6cb['data'][_0x5671a4(0x13c)],'branch':_0x2bc6cb[_0x5671a4(0x139)]['branch']});try{const _0x5a8f4f=new WarpGrepClient({'morphApiKey':_0x502413,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x4f4d9a=await _0x5a8f4f[_0x5671a4(0xc5)]({'searchTerm':_0x2bc6cb[_0x5671a4(0x139)][_0x5671a4(0x13c)],'github':_0x1f6438,'branch':_0x2bc6cb[_0x5671a4(0x139)][_0x5671a4(0x16e)]}),_0x256d31=Date[_0x5671a4(0x140)]()-_0x23c005;logMcpStderr('[github_codebase_search]\x20Done\x20in\x20'+_0x256d31+'ms.\x20Success:\x20'+_0x4f4d9a['success']);const _0x749b6=formatResult(_0x4f4d9a);return{'content':[{'type':'text','text':_0x749b6}]};}catch(_0x439d74){const _0xf0ddf8=handleMorphAPIError(_0x439d74);if(_0xf0ddf8)return _0xf0ddf8;const _0x2236d1=Date[_0x5671a4(0x140)]()-_0x23c005,_0x284777=_0x439d74 instanceof Error?_0x439d74[_0x5671a4(0x189)]:String(_0x439d74);return logMcpStderr(_0x5671a4(0xbd)+_0x2236d1+'ms:',_0x284777),reportMorphError({'error_message':_0x284777,'error_type':_0x439d74 instanceof Error?_0x439d74[_0x5671a4(0xd2)][_0x5671a4(0xce)]:_0x5671a4(0x1b5),'context':{'tool':'github_codebase_search','github_url':_0x1f6438,'search_string':_0x2bc6cb['data'][_0x5671a4(0x13c)],'branch':_0x2bc6cb[_0x5671a4(0x139)]['branch']},'stack_trace':_0x439d74 instanceof Error?_0x439d74[_0x5671a4(0x17a)]:undefined,'source':_0x5671a4(0x175),'tool':'github_codebase_search','latency_ms':_0x2236d1})[_0x5671a4(0x1aa)](()=>{}),{'content':[{'type':_0x5671a4(0xbe),'text':'GitHub\x20search\x20failed:\x20'+_0x284777}],'isError':![]};}}default:throw new Error('Unknown\x20tool:\x20'+_0x3ee19b);}}catch(_0x41ae87){const _0x1053b6=_0x41ae87 instanceof Error?_0x41ae87['message']:String(_0x41ae87);return reportMorphError({'error_message':_0x1053b6,'error_type':_0x41ae87 instanceof Error?_0x41ae87['constructor'][_0x5671a4(0xce)]:_0x5671a4(0x1b5),'context':{'tool':_0x3ee19b,'arguments':_0x5e398b?JSON[_0x5671a4(0x98)](_0x5e398b)[_0x5671a4(0x155)](0x0,0x1f4):undefined,'mcp_server_version':_0x5671a4(0x109)},'stack_trace':_0x41ae87 instanceof Error?_0x41ae87[_0x5671a4(0x17a)]:undefined,'source':_0x5671a4(0x175)})['catch'](()=>{}),{'content':[{'type':_0x5671a4(0xbe),'text':_0x5671a4(0xe9)+_0x1053b6}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x3629f8){const _0x1ca21d=a0_0x181a2a,_0xe88740=await getValidRootDirectories(_0x3629f8);if(_0xe88740[_0x1ca21d(0xa3)]>0x0)allowedDirectories=[..._0xe88740],logMcpStderr(_0x1ca21d(0x181)+_0xe88740['length']+_0x1ca21d(0x1ae));else{logMcpStderr(_0x1ca21d(0x119));if(ENABLE_WORKSPACE_MODE)try{const _0x26d3cb=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x26d3cb&&(allowedDirectories=[_0x26d3cb],logMcpStderr(_0x1ca21d(0x1af)+_0x26d3cb));}catch(_0x463039){logMcpStderr('Warning:\x20Workspace\x20fallback\x20failed:\x20'+_0x463039);}}}server['setNotificationHandler'](RootsListChangedNotificationSchema,async()=>{const _0x212e10=a0_0x181a2a;try{const _0x5e25dc=await server[_0x212e10(0x147)]();_0x5e25dc&&_0x212e10(0x12f)in _0x5e25dc&&await updateAllowedDirectoriesFromRoots(_0x5e25dc[_0x212e10(0x12f)]);}catch(_0x26065f){logMcpStderr(_0x212e10(0xfe),_0x26065f instanceof Error?_0x26065f[_0x212e10(0x189)]:String(_0x26065f));}}),server[a0_0x181a2a(0x184)]=async()=>{const _0x1c8cac=a0_0x181a2a,_0x47ed86=server[_0x1c8cac(0xf0)]();if(_0x47ed86?.[_0x1c8cac(0x12f)])try{const _0x1d73e5=await server[_0x1c8cac(0x147)]();_0x1d73e5&&'roots'in _0x1d73e5?await updateAllowedDirectoriesFromRoots(_0x1d73e5[_0x1c8cac(0x12f)]):logMcpStderr('Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings');}catch(_0x356b5e){logMcpStderr(_0x1c8cac(0x171),_0x356b5e instanceof Error?_0x356b5e[_0x1c8cac(0x189)]:String(_0x356b5e));}else{if(allowedDirectories['length']>0x0)logMcpStderr(_0x1c8cac(0x9d),allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x1c8cac(0x131));else throw new Error(_0x1c8cac(0x16a));}}};async function runServer(){const _0x125eb8=a0_0x181a2a,_0x5706aa=new StdioServerTransport();await server['connect'](_0x5706aa),logMcpStderr(_0x125eb8(0x166)),allowedDirectories[_0x125eb8(0xa3)]===0x0&&logMcpStderr(_0x125eb8(0xb6));}runServer()[a0_0x181a2a(0x1aa)](_0x3412cb=>{logMcpStderr('Fatal\x20error\x20running\x20server:',_0x3412cb),process['exit'](0x1);});
2
+ const a0_0x2a3250=a0_0x3b4c;(function(_0x3276d0,_0x1a27a2){const _0xb0fe13=a0_0x3b4c,_0x416e47=_0x3276d0();while(!![]){try{const _0xa31551=parseInt(_0xb0fe13(0x24e))/0x1*(-parseInt(_0xb0fe13(0x1cf))/0x2)+parseInt(_0xb0fe13(0x16a))/0x3*(parseInt(_0xb0fe13(0x18d))/0x4)+-parseInt(_0xb0fe13(0x219))/0x5*(-parseInt(_0xb0fe13(0x1d5))/0x6)+parseInt(_0xb0fe13(0x22f))/0x7+-parseInt(_0xb0fe13(0x211))/0x8+parseInt(_0xb0fe13(0x23a))/0x9*(parseInt(_0xb0fe13(0x23c))/0xa)+-parseInt(_0xb0fe13(0x273))/0xb;if(_0xa31551===_0x1a27a2)break;else _0x416e47['push'](_0x416e47['shift']());}catch(_0x3b6dbd){_0x416e47['push'](_0x416e47['shift']());}}}(a0_0x292b,0x881c9));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_0x5e0960 from'fs/promises';import a0_0x5373b1 from'path';import a0_0x43429b from'os';import{createRequire}from'module';import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{getValidRootDirectories}from'./roots-utils.js';import{getOperatingSystemType,logMcpStderr}from'./log-utils.js';import{logger}from'./logger.js';import{executeEditFile}from'@morphllm/morphsdk/tools/fastapply';import{runWarpGrep,LocalRipgrepProvider,GITHUB_SEARCH_TOOL_NAME,GITHUB_SEARCH_DESCRIPTION}from'@morphllm/morphsdk/tools/warp-grep';function a0_0x3b4c(_0x2cfc27,_0x4d9484){_0x2cfc27=_0x2cfc27-0x165;const _0x292bdd=a0_0x292b();let _0x3b4c7f=_0x292bdd[_0x2cfc27];return _0x3b4c7f;}import{WarpGrepClient,formatResult}from'@morphllm/morphsdk/tools/warp-grep/client';import{compactFileContexts}from'@morphllm/morphsdk/tools/compact';import a0_0x533768 from'axios';import{KNOWN_TOOL_NAMES,TOOL_NAMES}from'./tool-definitions.js';function a0_0x292b(){const _0x25c457=['sk-','MORPH_API_URL','-\x20Grepped\x20\x27','File\x20read\x20error:','false','Use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code\x20blocks.\x20Include\x20just\x20enough\x20surrounding\x20context\x20to\x20locate\x20each\x20edit\x20precisely.\x0a\x0a','finish','github_url','937978ZGIEoA','-\x20Listed\x20directory\x20`','listRoots','Parent\x20directory\x20does\x20not\x20exist:\x20','length','ENABLE_WORKSPACE_MODE','768VlPyUw','SymlinkError','Parameters:\x0a','files','status','At\x20least\x20one\x20directory\x20must\x20be\x20provided\x20by\x20EITHER\x20method\x20for\x20the\x20server\x20to\x20operate.','file_read_failed','basename','[github_codebase_search]\x20Done\x20in\x20','tool_calls','added\x20','timeout','BinaryFile','Applied','Secure\x20MCP\x20Filesystem\x20Server\x20running\x20on\x20stdio','https://morphllm.com/api/error-report','-\x20instruction:\x20Brief\x20first-person\x20description\x20of\x20what\x20you\x27re\x20changing\x0a','tool_call_complete','default','env','stack','safeParse','`\x20in\x20`','slice','PathError','repo_path','MCP','indexOf','code_edit','\x0aUsage:\x20morph-mcp\x20[options]\x20[allowed-directory\x20...]','\x20tool\x20unavailable\x20-\x20MORPH_API_KEY\x20not\x20provided\x20in\x20MCP\x20config','Fill\x20out\x20extra\x20details\x20that\x20you\x20as\x20a\x20smart\x20model\x20can\x20infer\x20in\x20the\x20question\x20to\x20aid\x20the\x20toolin\x20its\x20search.\x20','\x20\x201.\x20Command-line\x20arguments\x20(shown\x20above)','tool_call_error','number','WarpGrepError','Unknown\x20tool:\x20','text','Failed\x20to\x20request\x20roots\x20from\x20client:','-\x20Read\x20file\x20`','errors','\x22>\x0a','map','readFile','target_filepath','source','sep','join','access','MORPH_API_KEY\x20environment\x20variable\x20must\x20be\x20set\x20in\x20MCP\x20config.\x20Check\x20your\x20global\x20MCP\x20configuration.','Search\x20type\x20hint.\x20Use\x20\x27node_modules\x27\x20when\x20searching\x20inside\x20node_modules\x20or\x20other\x20dependency\x20directories\x20that\x20are\x20normally\x20excluded.','Morph\x20FastApply\x20failed\x20without\x20error\x20message','Morph\x20Edit\x20','Warning:\x20','isArray','pyproject.toml','-\x20code_edit:\x20Only\x20the\x20changed\x20lines\x20with\x20//\x20...\x20existing\x20code\x20...\x20markers\x0a\x0a','warn','lines','constructor','4405408UXmaWB','.vscode','Disabled\x20tools:\x20','SubToolError','command','\x20\x202.\x20MCP\x20roots\x20protocol\x20(if\x20client\x20supports\x20it)','\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x20and\x20exit','-\x20ALWAYS\x20use\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20for\x20unchanged\x20sections\x20(omitting\x20this\x20marker\x20will\x20cause\x20deletions)\x0a','40720YlUOsi','now','name','resolve','No\x20valid\x20root\x20directories\x20provided\x20by\x20client','Error\x20running\x20fast\x20context\x20search:\x20','morph-warp-grep-v2.1','stat','file','A\x20brief\x20single\x20first-person\x20sentence\x20instruction\x20describing\x20changes\x20being\x20made\x20to\x20this\x20file.\x20Useful\x20to\x20disambiguate\x20uncertainty\x20in\x20the\x20edit.','requiresApiKey','glob','branch','path_validation_resolved','Unknown\x20error','search_string','Example\x20format:\x0a','unknown','You\x20should\x20ALWAYS\x20use\x20this\x20tool\x20to\x20start\x20your\x20search.\x20','message','Error:\x20','.\x20Changes:\x20','3157070RNoUic','morph-v3-fast','<file\x20path=\x22','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.','instructions','toLowerCase','0.2.0','role','UnknownError','payload','code','950688cTieTf','stringify','20NmOyJT','composer.json','EDIT_FILE','includes','substring','searchGitHub','terminationReason','every','completionId','Fatal\x20error\x20running\x20server:','Rate\x20limited:\x20You\x27ve\x20exceeded\x20your\x20Morph\x20API\x20usage\x20limits.\x20Please\x20visit\x20https://morphllm.com\x20to\x20check\x20your\x20plan\x20and\x20purchase\x20additional\x20credits.','list_directory','//\x20...\x20existing\x20code\x20...\x0aFIRST_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0aSECOND_EDIT\x0a//\x20...\x20existing\x20code\x20...\x0a\x0a','\x20\x20morph-mcp','Repository\x20owner/repo\x20shorthand\x20(e.g.\x20\x27vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.','Please\x20provide\x20github\x20search\x20url\x20or\x20owner/repo\x20id','grep_search','Fallback:\x20Using\x20workspace\x20root\x20','2ZcsJKa','tsconfig.json','edit','has','\x20\x203.\x20Workspace\x20mode\x20(default\x20behavior,\x20set\x20ENABLE_WORKSPACE_MODE=false\x20to\x20disable)','error','tool_call_received','metadata','Specific\x20commit\x20hash\x20to\x20search','TimeoutError','instruction','Morph\x20Edit\x20Preview','log','version','ENOENT','provider_created','inputSchema','messages','Preview\x20changes\x20without\x20applying\x20them.','some','data','search_type','setNotificationHandler','Created\x20File','\x20as\x20allowed\x20directory','Changed\x20lines\x20with\x20minimal\x20context.\x20Use\x20placeholders\x20intelligently\x20like\x20\x22//\x20...\x20existing\x20code\x20...\x22\x20to\x20represent\x20unchanged\x20code.','filePath','GITHUB_CODEBASE_SEARCH','package.json','arguments','compaction_failed','RipgrepError','linesRemoved','Client\x20returned\x20no\x20roots\x20set,\x20keeping\x20current\x20settings','warp_grep_start','path','.git','6332392IkRBiE','optional','Repository\x20identifier','dryRun','object','getClientCapabilities','read\x20','Branch\x20to\x20search\x20(defaults\x20to\x20repo\x27s\x20default\x20branch)','\x20\x20--api-key\x20<key>\x20\x20Morph\x20API\x20key\x20(takes\x20priority\x20over\x20MORPH_API_KEY\x20env\x20var)','github_codebase_search','Error\x20accessing\x20directory\x20','match','array','node_modules','codebase_search','\x0aExamples:','path_validation_failed','parse','application/json','WarpGrep\x20sub-tool\x20errors:\x20','\x20chars)','\x0aOptions:','Agent\x20completed\x20but\x20did\x20not\x20call\x20finish\x20tool.','post','Warning:\x20Could\x20not\x20initialize\x20workspace\x20mode:\x20','No\x20relevant\x20code\x20found\x20for\x20the\x20query.','file_read_complete','new_string','startsWith','Failed\x20to\x20read\x20file:\x20','realpath','MORPH_WARP_GREP_TIMEOUT','The\x20absolute\x20path\x20of\x20the\x20folder\x20where\x20the\x20search\x20should\x20be\x20performed.\x20In\x20multi-repo\x20workspaces,\x20you\x20have\x20to\x20specify\x20a\x20subfolder\x20where\x20the\x20search\x20should\x20be\x20performed,\x20to\x20avoid\x20searching\x20across\x20all\x20repos','read','mcp-filesystem','edit_file','filter','1071cdEygv','\x0a</file>','dirname','toISOString','ms:','etimedout','LocalRipgrepProvider','--help','turns','floor','exit','PWD','changes','Tool\x20\x22','string','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.','**PRIMARY\x20TOOL\x20FOR\x20EDITING\x20FILES.**\x20Fast,\x20accurate,\x20and\x20prevents\x20context\x20pollution.\x20Especially\x20useful\x20when\x20making\x20multiple\x20edits\x20in\x20one\x20file:\x20describe\x20all\x20changes\x20in\x20a\x20single\x20call\x20and\x20the\x20semantic\x20edit\x20applies\x20them\x20all\x20at\x20once,\x20more\x20accurately\x20and\x20faster\x20than\x20sequential\x20edits.\x20Unlike\x20search-and-replace\x20or\x20patch\x20edits\x20which\x20do\x20narrow\x20edits\x20one\x20at\x20a\x20time,\x20with\x20this\x20tool\x20you\x20should\x20do\x20all\x20your\x20code\x20changes\x20in\x20one\x20go\x20separated\x20by\x20`//\x20...\x20existing\x20code\x20...`\x20markers.\x20This\x20saves\x20tokens\x20and\x20improves\x20performance\x20because\x20you\x20do\x20not\x20need\x20to\x20reread\x20files\x20before\x20edits.\x20All\x20three\x20parameters\x20are\x20required.\x0a\x0a','\x20is\x20not\x20a\x20directory','ReadError','runWarpGrep_call','linesModified','pattern','assistant','catch','timings','Warning:\x20Workspace\x20fallback\x20failed:\x20','homedir','Here\x20is\x20the\x20content\x20of\x20files:\x0a','morph-mcp','DISABLED_TOOLS','warp_grep_complete','user','morph-v3-large','split','go.mod','10276wQNgsm','debug','describe','connect','Failed\x20to\x20request\x20initial\x20roots\x20from\x20client:','Warning:\x20DISABLED_TOOLS\x20contains\x20unknown\x20tool\x20\x22','API\x20error\x20(auth/rate-limit)','Filter\x20to\x20specific\x20directories,\x20empty\x20for\x20all','Max\x20results\x20to\x20return','\x20valid\x20directories','\x20-\x20','ToolException','\x22>\x0aError\x20reading\x20file:\x20','params','utf-8','grep','Note:\x20Allowed\x20directories\x20can\x20be\x20provided\x20via:','response','Cargo.toml','[could\x20not\x20read\x20file:\x20','Bearer\x20','CODEBASE_SEARCH','Warning:\x20Unable\x20to\x20determine\x20package\x20version:','Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20workspace\x20mode','oninitialized','--api-key=','description','success','.\x20Path:\x20','api-key','roots','function','\x20disabled\x20via\x20DISABLED_TOOLS','size','WHEN\x20TO\x20USE\x20vs\x20native\x20edit/patch\x20tools:\x20prefer\x20this\x20tool\x20for\x20large\x20files,\x20multiple\x20or\x20scattered\x20edits,\x20refactors,\x20and\x20whitespace-sensitive\x20changes.\x20A\x20single\x20tiny\x20exact-string\x20replacement\x20can\x20use\x20the\x20native\x20edit/patch\x20tool.\x20If\x20this\x20tool\x20errors\x20or\x20times\x20out,\x20fall\x20back\x20to\x20native\x20edit\x20with\x20exact\x20string\x20matching.\x0a\x0a','Warning:\x20API\x20key\x20format\x20may\x20be\x20incorrect.\x20Morph\x20API\x20keys\x20typically\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27','../package.json','grep\x20\x27','all','content','Invalid\x20arguments\x20for\x20morph_edit_file:\x20','FileNotFound','boolean','path_validation_start','@morphllm/morphmcp\x20','tool_call_id','push','Usage:\x20mcp-server-filesystem\x20[allowed-directory]\x20[additional-directories...]','unknown\x20error','Morph\x20Fast\x20Context\x20subagent\x20performed\x20search\x20on\x20repository:','github_search_start','target_file','glob\x20\x27','linesAdded','completed','\x20error(s)','cwd','-\x20Glob\x20search\x20`'];a0_0x292b=function(){return _0x25c457;};return a0_0x292b();}function fixPathRepetition(_0x40d33b){const _0x158137=a0_0x3b4c,_0x167aa2=_0x40d33b[_0x158137(0x18b)](a0_0x5373b1[_0x158137(0x203)])[_0x158137(0x169)](Boolean);if(_0x167aa2['length']<0x2)return null;for(let _0x94e8aa=Math[_0x158137(0x173)](_0x167aa2[_0x158137(0x1d3)]/0x2);_0x94e8aa>=0x1;_0x94e8aa--){for(let _0x223c59=0x0;_0x223c59<=_0x167aa2[_0x158137(0x1d3)]-0x2*_0x94e8aa;_0x223c59++){const _0x410778=_0x167aa2[_0x158137(0x1ec)](_0x223c59,_0x223c59+_0x94e8aa),_0x46bb36=_0x167aa2[_0x158137(0x1ec)](_0x223c59+_0x94e8aa,_0x223c59+0x2*_0x94e8aa);if(_0x410778[_0x158137(0x243)]((_0x35410c,_0x51dabe)=>_0x35410c===_0x46bb36[_0x51dabe])){const _0x4c05d1=[..._0x167aa2[_0x158137(0x1ec)](0x0,_0x223c59),..._0x167aa2[_0x158137(0x1ec)](_0x223c59+_0x94e8aa)];return a0_0x5373b1[_0x158137(0x203)]+_0x4c05d1[_0x158137(0x204)](a0_0x5373b1['sep']);}}}return null;}const require=createRequire(import.meta.url);function getPackageVersion(){const _0x7a9c37=a0_0x3b4c;try{const _0x19bf7a=require(_0x7a9c37(0x1b1));return _0x19bf7a[_0x7a9c37(0x25b)]??'unknown';}catch(_0x36b3a9){return logMcpStderr(_0x7a9c37(0x1a3),_0x36b3a9),_0x7a9c37(0x22a);}}function printHelp(){const _0x5e8292=a0_0x3b4c;console[_0x5e8292(0x25a)](_0x5e8292(0x1b9)+getPackageVersion()),console[_0x5e8292(0x25a)](_0x5e8292(0x1f2)),console[_0x5e8292(0x25a)](_0x5e8292(0x288)),console['log'](_0x5e8292(0x27b)),console[_0x5e8292(0x25a)](_0x5e8292(0x217)),console['log']('\x20\x20-v,\x20--version\x20\x20\x20\x20Print\x20version\x20and\x20exit'),console[_0x5e8292(0x25a)](_0x5e8292(0x282)),console[_0x5e8292(0x25a)](_0x5e8292(0x249)),console[_0x5e8292(0x25a)]('\x20\x20morph-mcp\x20--api-key\x20sk-xxx\x20~/repo');}const cliArgs=process['argv'][a0_0x2a3250(0x1ec)](0x2),VERSION_FLAGS=new Set(['--version','-v','-V']),HELP_FLAGS=new Set([a0_0x2a3250(0x171),'-h']);cliArgs['some'](_0x226aa0=>VERSION_FLAGS['has'](_0x226aa0))&&(console[a0_0x2a3250(0x25a)](a0_0x2a3250(0x1b9)+getPackageVersion()),process[a0_0x2a3250(0x174)](0x0));cliArgs[a0_0x2a3250(0x261)](_0x5e0a89=>HELP_FLAGS[a0_0x2a3250(0x251)](_0x5e0a89))&&(printHelp(),process[a0_0x2a3250(0x174)](0x0));function getCliArg(_0x1ec5f8){const _0x5d5b8d=a0_0x2a3250;for(let _0x4ad9d6=0x0;_0x4ad9d6<cliArgs[_0x5d5b8d(0x1d3)];_0x4ad9d6++){const _0x4110ee=cliArgs[_0x4ad9d6];if(_0x4110ee[_0x5d5b8d(0x28f)]('--'+_0x1ec5f8+'='))return _0x4110ee[_0x5d5b8d(0x1ec)](('--'+_0x1ec5f8+'=')[_0x5d5b8d(0x1d3)]);if(_0x4110ee==='--'+_0x1ec5f8&&_0x4ad9d6+0x1<cliArgs[_0x5d5b8d(0x1d3)])return cliArgs[_0x4ad9d6+0x1];}return undefined;}const args=[];for(let i=0x0;i<cliArgs[a0_0x2a3250(0x1d3)];i++){const arg=cliArgs[i];if(VERSION_FLAGS[a0_0x2a3250(0x251)](arg)||HELP_FLAGS[a0_0x2a3250(0x251)](arg))continue;if(arg[a0_0x2a3250(0x28f)](a0_0x2a3250(0x1a6)))continue;if(arg==='--api-key'){i++;continue;}args['push'](arg);}const WORKSPACE_ROOT=process['env']['WORKSPACE_ROOT']||process['env'][a0_0x2a3250(0x175)]||process[a0_0x2a3250(0x1c5)](),ENABLE_WORKSPACE_MODE=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x1d4)]!==a0_0x2a3250(0x1cb),MORPH_API_KEY=getCliArg(a0_0x2a3250(0x1aa))??process[a0_0x2a3250(0x1e8)]['MORPH_API_KEY'],MORPH_API_URL=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x1c8)],MORPH_LARGE_APPLY=process[a0_0x2a3250(0x1e8)]['MORPH_LARGE_APPLY']!=='false',MORPH_WARP_GREP_TIMEOUT=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x292)]?parseInt(process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x292)],0xa):undefined,OPERATING_SYSTEM_TYPE=getOperatingSystemType(),DEFAULT_DISABLED_TOOLS=new Set(),DISABLED_TOOLS=process[a0_0x2a3250(0x1e8)][a0_0x2a3250(0x187)]?new Set(process['env'][a0_0x2a3250(0x187)][a0_0x2a3250(0x18b)](',')['map'](_0x469eb5=>_0x469eb5['trim']())['filter'](_0x2bfbb1=>_0x2bfbb1['length']>0x0)):DEFAULT_DISABLED_TOOLS;if(DISABLED_TOOLS[a0_0x2a3250(0x1ae)]>0x0){for(const tool of DISABLED_TOOLS){!KNOWN_TOOL_NAMES['has'](tool)&&console[a0_0x2a3250(0x253)](a0_0x2a3250(0x192)+tool+'\x22.\x20Known\x20tools:\x20'+[...KNOWN_TOOL_NAMES]['join'](',\x20'));}console[a0_0x2a3250(0x253)](a0_0x2a3250(0x213)+[...DISABLED_TOOLS][a0_0x2a3250(0x204)](',\x20'));}MORPH_API_KEY&&!MORPH_API_KEY['startsWith'](a0_0x2a3250(0x1c7))&&!MORPH_API_KEY[a0_0x2a3250(0x28f)]('morph-')&&logMcpStderr(a0_0x2a3250(0x1b0));async function reportMorphError(_0x38d631){const _0x41aac5=a0_0x2a3250;try{await a0_0x533768[_0x41aac5(0x28a)](_0x41aac5(0x1e4),{..._0x38d631,'timestamp':new Date()[_0x41aac5(0x16d)](),'source':_0x38d631[_0x41aac5(0x202)]||_0x41aac5(0x167),'os_type':OPERATING_SYSTEM_TYPE,'context':{'os_type':OPERATING_SYSTEM_TYPE,..._0x38d631['context']}},{'timeout':0x1388,'headers':{'Content-Type':_0x41aac5(0x285),'Authorization':_0x41aac5(0x1a1)+MORPH_API_KEY}});}catch{}}function extractStatusCode(_0x23c9a7,_0x36d804){const _0x4a7743=a0_0x2a3250;if(_0x23c9a7&&typeof _0x23c9a7==='object'&&_0x4a7743(0x1d9)in _0x23c9a7)return _0x23c9a7[_0x4a7743(0x1d9)];if(_0x23c9a7&&typeof _0x23c9a7===_0x4a7743(0x277)&&_0x4a7743(0x19e)in _0x23c9a7)return _0x23c9a7[_0x4a7743(0x19e)]?.[_0x4a7743(0x1d9)];const _0x4251f1=_0x36d804[_0x4a7743(0x27e)](/\b(401|429)\b/);return _0x4251f1?parseInt(_0x4251f1[0x1],0xa):null;}function handleMorphAPIError(_0x17e063){const _0x2784eb=a0_0x2a3250,_0x2fc4cd=_0x17e063 instanceof Error?_0x17e063[_0x2784eb(0x22c)]:String(_0x17e063),_0x132c01=extractStatusCode(_0x17e063,_0x2fc4cd);switch(_0x132c01){case 0x191:return{'content':[{'type':_0x2784eb(0x1fa),'text':_0x2784eb(0x232)}],'isError':!![]};case 0x1ad:return{'content':[{'type':_0x2784eb(0x1fa),'text':_0x2784eb(0x246)}],'isError':!![]};default:return null;}}args[a0_0x2a3250(0x1d3)]===0x0&&!ENABLE_WORKSPACE_MODE&&(logMcpStderr(a0_0x2a3250(0x1bc)),logMcpStderr(a0_0x2a3250(0x19d)),logMcpStderr(a0_0x2a3250(0x1f5)),logMcpStderr(a0_0x2a3250(0x216)),logMcpStderr(a0_0x2a3250(0x252)),logMcpStderr(a0_0x2a3250(0x1da)));function normalizePath(_0xf5f9dd){return a0_0x5373b1['normalize'](_0xf5f9dd);}function expandHome(_0x466452){const _0xc77507=a0_0x2a3250;if(_0x466452[_0xc77507(0x28f)]('~/')||_0x466452==='~')return a0_0x5373b1[_0xc77507(0x204)](a0_0x43429b[_0xc77507(0x184)](),_0x466452[_0xc77507(0x1ec)](0x1));return _0x466452;}let allowedDirectories=await Promise[a0_0x2a3250(0x1b3)](args['map'](async _0x21bc2c=>{const _0x2a5a1d=a0_0x2a3250,_0x1a3b0e=expandHome(_0x21bc2c),_0x44ed7a=a0_0x5373b1[_0x2a5a1d(0x21c)](_0x1a3b0e);try{const _0x17c965=await a0_0x5e0960['realpath'](_0x44ed7a);return normalizePath(_0x17c965);}catch(_0x2bf26b){return normalizePath(_0x44ed7a);}}));if(ENABLE_WORKSPACE_MODE&&args['length']===0x0)try{const workspaceDir=await detectWorkspaceRoot(WORKSPACE_ROOT);workspaceDir&&(allowedDirectories['push'](workspaceDir),logMcpStderr('Workspace\x20mode\x20enabled:\x20Using\x20'+workspaceDir+a0_0x2a3250(0x266)));}catch(a0_0x5a2e43){logMcpStderr(a0_0x2a3250(0x28b)+a0_0x5a2e43);}async function detectWorkspaceRoot(_0x4ff7f4){const _0x5e3a6f=a0_0x2a3250;let _0x880647=a0_0x5373b1[_0x5e3a6f(0x21c)](_0x4ff7f4);const _0x30a591=[_0x5e3a6f(0x272),_0x5e3a6f(0x212),_0x5e3a6f(0x26a),_0x5e3a6f(0x19f),_0x5e3a6f(0x20c),_0x5e3a6f(0x18c),'.cursor',_0x5e3a6f(0x24f),_0x5e3a6f(0x23d)];while(_0x880647!==a0_0x5373b1[_0x5e3a6f(0x16c)](_0x880647)){for(const _0x30ab5e of _0x30a591){const _0x14e7bc=a0_0x5373b1[_0x5e3a6f(0x204)](_0x880647,_0x30ab5e);try{return await a0_0x5e0960[_0x5e3a6f(0x205)](_0x14e7bc),normalizePath(_0x880647);}catch{}}_0x880647=a0_0x5373b1['dirname'](_0x880647);}return normalizePath(_0x4ff7f4);}await Promise[a0_0x2a3250(0x1b3)](args[a0_0x2a3250(0x1ff)](async _0x4e3c8f=>{const _0x328bec=a0_0x2a3250;try{const _0x7dc7a=await a0_0x5e0960[_0x328bec(0x220)](expandHome(_0x4e3c8f));!_0x7dc7a['isDirectory']()&&(logMcpStderr('Error:\x20'+_0x4e3c8f+_0x328bec(0x17b)),process[_0x328bec(0x174)](0x1));}catch(_0x36624b){logMcpStderr(_0x328bec(0x27d)+_0x4e3c8f+':',_0x36624b),process[_0x328bec(0x174)](0x1);}}));async function validatePath(_0x160c0f){const _0x19b7d6=a0_0x2a3250,_0x57b8c3=expandHome(_0x160c0f),_0x437fbf=a0_0x5373b1[_0x19b7d6(0x21c)](_0x57b8c3);logger[_0x19b7d6(0x18e)](_0x19b7d6(0x1ef),_0x19b7d6(0x1b8),{'raw_path':_0x160c0f,'absolute':_0x437fbf});try{const _0x497705=await a0_0x5e0960[_0x19b7d6(0x291)](_0x437fbf);return logger[_0x19b7d6(0x18e)](_0x19b7d6(0x1ef),_0x19b7d6(0x226),{'resolved':_0x497705,'symlink':_0x497705!==_0x437fbf}),_0x497705;}catch(_0x185d7e){if(_0x185d7e[_0x19b7d6(0x239)]===_0x19b7d6(0x25c)){const _0x318fc5=a0_0x5373b1[_0x19b7d6(0x16c)](_0x437fbf);try{const _0x1535b1=await a0_0x5e0960['realpath'](_0x318fc5),_0x37073b=a0_0x5373b1['join'](_0x1535b1,a0_0x5373b1['basename'](_0x437fbf));return logger[_0x19b7d6(0x18e)](_0x19b7d6(0x1ef),_0x19b7d6(0x226),{'resolved':_0x37073b,'new_file':!![]}),_0x37073b;}catch{logger['error']('MCP',_0x19b7d6(0x283),{'raw_path':_0x160c0f,'error':_0x19b7d6(0x1d2)+_0x318fc5});throw new Error(_0x19b7d6(0x1d2)+_0x318fc5);}}logger['error']('MCP',_0x19b7d6(0x283),{'raw_path':_0x160c0f,'error':_0x185d7e[_0x19b7d6(0x22c)]});throw _0x185d7e;}}const MorphEditFileArgsSchema=z[a0_0x2a3250(0x277)]({'path':z[a0_0x2a3250(0x178)](),'code_edit':z[a0_0x2a3250(0x178)]()['describe'](a0_0x2a3250(0x267)),'instruction':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x222)),'dryRun':z[a0_0x2a3250(0x1b7)]()[a0_0x2a3250(0x1e7)](![])[a0_0x2a3250(0x18f)](a0_0x2a3250(0x260))}),CODEBASE_SEARCH_QUERY_DESCRIPTION=a0_0x2a3250(0x179),WarpGrepArgsSchema=z['object']({'search_string':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repo_path':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x165)),'search_type':z['enum']([a0_0x2a3250(0x1e7),a0_0x2a3250(0x280)])[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x207))}),WarpGrepGitHubArgsSchema=z[a0_0x2a3250(0x277)]({'search_string':z['string']()['describe'](CODEBASE_SEARCH_QUERY_DESCRIPTION),'github_url':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)]('GitHub\x20repository\x20URL\x20to\x20search\x20(e.g.\x20\x27https://github.com/vercel/next.js\x27).\x20You\x20must\x20provide\x20either\x20github_url\x20or\x20owner_repo.'),'owner_repo':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x24a)),'branch':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x27a))}),CodebaseSearchArgsSchema=z[a0_0x2a3250(0x277)]({'query':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x18f)](CODEBASE_SEARCH_QUERY_DESCRIPTION),'repoId':z['string']()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x275)),'branch':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()['describe']('Branch\x20to\x20search\x20(uses\x20latest\x20commit)'),'commitHash':z[a0_0x2a3250(0x178)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x18f)](a0_0x2a3250(0x256)),'targetDirectories':z[a0_0x2a3250(0x27f)](z[a0_0x2a3250(0x178)]())[a0_0x2a3250(0x1e7)]([])[a0_0x2a3250(0x18f)](a0_0x2a3250(0x194)),'limit':z[a0_0x2a3250(0x1f7)]()[a0_0x2a3250(0x274)]()[a0_0x2a3250(0x1e7)](0xa)[a0_0x2a3250(0x18f)](a0_0x2a3250(0x195))}),server=new Server({'name':a0_0x2a3250(0x186),'version':a0_0x2a3250(0x235)},{'capabilities':{'tools':{}}});server['setRequestHandler'](ListToolsRequestSchema,async()=>{const _0x439013=a0_0x2a3250,_0x1ad444=[{'name':TOOL_NAMES['EDIT_FILE'],'description':_0x439013(0x17a)+_0x439013(0x1af)+_0x439013(0x1d7)+'-\x20path:\x20Absolute\x20file\x20path\x20to\x20edit\x0a'+_0x439013(0x1e5)+_0x439013(0x20d)+_0x439013(0x1cc)+_0x439013(0x229)+_0x439013(0x248)+'Rules:\x0a'+_0x439013(0x218)+'-\x20Preserve\x20exact\x20indentation\x0a'+'-\x20For\x20deletions:\x20show\x20context\x20before\x20and\x20after,\x20omit\x20the\x20deleted\x20lines\x0a'+'-\x20Batch\x20multiple\x20edits\x20to\x20the\x20same\x20file\x20in\x20one\x20call\x0a','inputSchema':zodToJsonSchema(MorphEditFileArgsSchema),'requiresApiKey':!![]},{'name':TOOL_NAMES['CODEBASE_SEARCH'],'description':'A\x20code\x20exploration\x20tool,\x20use\x20this\x20tool\x20when\x20exploring\x20an\x20unfamiliar\x20codebase,\x20and\x20you\x27re\x20unsure\x20of\x20the\x20exact\x20file\x20or\x20string\x20to\x20look\x20for.\x20This\x20tool\x20will\x20find\x20all\x20relevant\x20bits\x20of\x20code\x20given\x20a\x20natural\x20lanugage\x20description,\x20or\x20questin\x20of\x20the\x20thing\x20you\x27re\x20looking\x20for.\x20'+CODEBASE_SEARCH_QUERY_DESCRIPTION+'\x20'+_0x439013(0x1f4)+_0x439013(0x22b)+'','inputSchema':zodToJsonSchema(WarpGrepArgsSchema),'requiresApiKey':!![]},{'name':GITHUB_SEARCH_TOOL_NAME,'description':GITHUB_SEARCH_DESCRIPTION,'inputSchema':zodToJsonSchema(WarpGrepGitHubArgsSchema),'requiresApiKey':!![]}],_0x321b29=_0x1ad444[_0x439013(0x169)](_0x58673f=>{const _0x4e1da7=_0x439013;if(DISABLED_TOOLS[_0x4e1da7(0x251)](_0x58673f['name']))return console[_0x4e1da7(0x253)]('Tool\x20'+_0x58673f[_0x4e1da7(0x21b)]+_0x4e1da7(0x1ad)),![];if('requiresApiKey'in _0x58673f&&_0x58673f[_0x4e1da7(0x223)]&&!MORPH_API_KEY)return logMcpStderr(_0x4e1da7(0x20a)+_0x58673f[_0x4e1da7(0x21b)]+_0x4e1da7(0x1f3)),![];return!![];});return{'tools':_0x321b29['map'](_0x164967=>({'name':_0x164967['name'],'description':_0x164967[_0x439013(0x1a7)],'inputSchema':_0x164967[_0x439013(0x25e)]}))};}),server['setRequestHandler'](CallToolRequestSchema,async _0x5cb12a=>{const _0x2bf1b8=a0_0x2a3250,{name:_0x3208b7,arguments:_0x4fb7d9}=_0x5cb12a[_0x2bf1b8(0x19a)],_0x4a2180=Date[_0x2bf1b8(0x21a)]();logger[_0x2bf1b8(0x18e)]('MCP',_0x2bf1b8(0x254),{'tool':_0x3208b7,'args':_0x3208b7==='edit_file'?{'path':_0x4fb7d9?.[_0x2bf1b8(0x271)],'instruction':_0x4fb7d9?.[_0x2bf1b8(0x258)]||_0x4fb7d9?.[_0x2bf1b8(0x233)],'dryRun':_0x4fb7d9?.[_0x2bf1b8(0x276)]}:_0x4fb7d9});try{if(!MORPH_API_KEY)return{'content':[{'type':_0x2bf1b8(0x1fa),'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[_0x2bf1b8(0x28f)](_0x2bf1b8(0x1c7))&&!MORPH_API_KEY['startsWith']('morph-'))return{'content':[{'type':_0x2bf1b8(0x1fa),'text':'Invalid\x20Morph\x20API\x20key\x20format.\x20API\x20keys\x20start\x20with\x20\x27sk-\x27\x20or\x20\x27morph-\x27.\x20Please\x20visit\x20https://morphllm.com\x20to\x20get\x20a\x20valid\x20API\x20key.'}],'isError':!![]};if(DISABLED_TOOLS[_0x2bf1b8(0x251)](_0x3208b7))return{'content':[{'type':'text','text':_0x2bf1b8(0x177)+_0x3208b7+'\x22\x20is\x20disabled\x20via\x20the\x20DISABLED_TOOLS\x20environment\x20variable\x20in\x20your\x20MCP\x20configuration.\x20Please\x20use\x20an\x20alternative\x20approach.'}],'isError':![]};switch(_0x3208b7){case TOOL_NAMES[_0x2bf1b8(0x23e)]:{let _0x9a4886=_0x4fb7d9;if(_0x9a4886&&typeof _0x9a4886===_0x2bf1b8(0x277)){if(!(_0x2bf1b8(0x271)in _0x9a4886)){const _0x17966c=_0x9a4886[_0x2bf1b8(0x1c0)]??_0x9a4886[_0x2bf1b8(0x268)]??_0x9a4886[_0x2bf1b8(0x201)]??_0x9a4886['file_path']??_0x9a4886[_0x2bf1b8(0x221)];if(_0x17966c)_0x9a4886={..._0x9a4886,'path':_0x17966c};}_0x2bf1b8(0x233)in _0x9a4886&&!(_0x2bf1b8(0x258)in _0x9a4886)&&(_0x9a4886={..._0x9a4886,'instruction':_0x9a4886['instructions']});if(!(_0x2bf1b8(0x1f1)in _0x9a4886)){const _0x5edcd0=_0x9a4886[_0x2bf1b8(0x239)]??_0x9a4886[_0x2bf1b8(0x28e)]??_0x9a4886[_0x2bf1b8(0x1b4)]??_0x9a4886[_0x2bf1b8(0x250)];if(_0x5edcd0)_0x9a4886={..._0x9a4886,'code_edit':_0x5edcd0};}}const _0x1531e5=MorphEditFileArgsSchema[_0x2bf1b8(0x1ea)](_0x9a4886);if(!_0x1531e5['success'])throw new Error(_0x2bf1b8(0x1b5)+_0x1531e5[_0x2bf1b8(0x253)]);const _0x21adee=await validatePath(_0x1531e5[_0x2bf1b8(0x262)]['path']);let _0x4f023f=null,_0x17f74e=!![],_0x2990a7=null;try{_0x4f023f=await a0_0x5e0960['readFile'](_0x21adee,_0x2bf1b8(0x19b)),logger[_0x2bf1b8(0x18e)]('MCP','file_read_complete',{'path':_0x21adee,'size_bytes':_0x4f023f[_0x2bf1b8(0x1d3)]});}catch(_0x2fd173){const _0x38e345=_0x2fd173[_0x2bf1b8(0x239)];_0x38e345===_0x2bf1b8(0x25c)?(_0x17f74e=![],_0x4f023f='',logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x28d),{'path':_0x21adee,'exists':![]})):(_0x2990a7=_0x2bf1b8(0x290)+(_0x38e345||'unknown')+_0x2bf1b8(0x197)+(_0x2fd173 instanceof Error?_0x2fd173[_0x2bf1b8(0x22c)]:String(_0x2fd173)),logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1db),{'path':_0x21adee,'error':_0x2990a7}),logMcpStderr('Warning:\x20'+_0x2990a7));}let _0x2cf959;try{const _0x5367e3=MORPH_API_KEY;if(!_0x5367e3)throw new Error(_0x2bf1b8(0x206));const _0x55768a=a0_0x5373b1['dirname'](_0x21adee),_0x29b140=a0_0x5373b1[_0x2bf1b8(0x1dc)](_0x21adee);logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),'api_request_start',{'model':_0x2bf1b8(0x230),'path':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x271)],'instruction_len':_0x1531e5['data'][_0x2bf1b8(0x258)][_0x2bf1b8(0x1d3)],'code_edit_len':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x1f1)][_0x2bf1b8(0x1d3)],'original_code_len':_0x4f023f?.[_0x2bf1b8(0x1d3)]??0x0,'dry_run':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x276)]});const _0x160914=Date[_0x2bf1b8(0x21a)](),_0x3ffb8c=await executeEditFile({'target_filepath':_0x29b140,'code_edit':_0x1531e5['data'][_0x2bf1b8(0x1f1)],'instruction':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x258)]},{'morphApiKey':_0x5367e3,'morphApiUrl':MORPH_API_URL,'large':MORPH_LARGE_APPLY,'baseDir':_0x55768a,'autoWrite':!_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x276)],'generateUdiff':![],'debug':![]}),_0x5873ec=Date[_0x2bf1b8(0x21a)]()-_0x160914;_0x2cf959=_0x3ffb8c[_0x2bf1b8(0x244)];if(!_0x3ffb8c[_0x2bf1b8(0x1a8)])throw new Error(_0x3ffb8c['error']||_0x2bf1b8(0x208));const _0x3ccbc8=_0x3ffb8c[_0x2bf1b8(0x176)],_0x34c5ee=_0x2bf1b8(0x1df)+_0x3ccbc8[_0x2bf1b8(0x1c2)]+',\x20removed\x20'+_0x3ccbc8['linesRemoved']+',\x20modified\x20'+_0x3ccbc8[_0x2bf1b8(0x17e)];logger['debug']('MCP',_0x2bf1b8(0x1e6),{'tool':'edit_file','success':!![],'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180,'edit_latency_ms':_0x5873ec,'changes':{'added':_0x3ccbc8[_0x2bf1b8(0x1c2)],'removed':_0x3ccbc8[_0x2bf1b8(0x26e)],'modified':_0x3ccbc8['linesModified']},'completion_id':_0x2cf959});if(_0x1531e5[_0x2bf1b8(0x262)]['dryRun'])return{'content':[{'type':'text','text':_0x2bf1b8(0x259)+(_0x17f74e?'':'\x20(new\x20file)')+':\x20'+_0x1531e5['data'][_0x2bf1b8(0x258)]+_0x2bf1b8(0x22e)+_0x34c5ee+_0x2bf1b8(0x1a9)+_0x1531e5[_0x2bf1b8(0x262)]['path']+'.'}]};return{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x2bf1b8(0x209)+(_0x17f74e?_0x2bf1b8(0x1e2):_0x2bf1b8(0x265))+':\x20'+_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x258)]+'.\x20Changes:\x20'+_0x34c5ee+_0x2bf1b8(0x1a9)+_0x1531e5['data'][_0x2bf1b8(0x271)]+'.'}]};}catch(_0x5bea91){const _0x160eef=handleMorphAPIError(_0x5bea91);if(_0x160eef)return logger[_0x2bf1b8(0x253)]('MCP','tool_call_error',{'tool':_0x2bf1b8(0x168),'error':_0x2bf1b8(0x193),'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180}),_0x160eef;const _0x18416d=_0x5bea91 instanceof Error?_0x5bea91['message']:String(_0x5bea91);return logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1f6),{'tool':'edit_file','error':_0x18416d,'path':_0x1531e5['data'][_0x2bf1b8(0x271)],'validated_path':_0x21adee,'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180,'stack':_0x5bea91 instanceof Error?_0x5bea91[_0x2bf1b8(0x1e9)]:undefined}),reportMorphError({'error_message':_0x18416d,'error_type':_0x5bea91 instanceof Error?_0x5bea91[_0x2bf1b8(0x210)][_0x2bf1b8(0x21b)]:_0x2bf1b8(0x237),'context':{'tool':_0x2bf1b8(0x168),'completion_id':_0x2cf959,'file_path':_0x1531e5[_0x2bf1b8(0x262)]['path'],'validated_path':_0x21adee,'instruction':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x258)],'model':MORPH_LARGE_APPLY?'morph-v3-large':_0x2bf1b8(0x230),'dry_run':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x276)],'file_exists':_0x17f74e,'file_read_error':_0x2990a7,'file_readable':_0x4f023f!==null,'request_content':{'path':_0x1531e5['data']['path'],'code_edit':_0x1531e5[_0x2bf1b8(0x262)][_0x2bf1b8(0x1f1)],'instruction':_0x1531e5[_0x2bf1b8(0x262)]['instruction'],'original_code':_0x4f023f!==null?_0x4f023f[_0x2bf1b8(0x1d3)]>0xc350?_0x4f023f[_0x2bf1b8(0x240)](0x0,0xc350)+'\x0a...\x20(truncated,\x20total:\x20'+_0x4f023f[_0x2bf1b8(0x1d3)]+_0x2bf1b8(0x287):_0x4f023f:_0x2bf1b8(0x1a0)+(_0x2990a7||_0x2bf1b8(0x1bd))+']','original_code_length':_0x4f023f?.[_0x2bf1b8(0x1d3)]??0x0,'model':MORPH_LARGE_APPLY?_0x2bf1b8(0x18a):_0x2bf1b8(0x230),'dry_run':_0x1531e5['data'][_0x2bf1b8(0x276)]}},'stack_trace':_0x5bea91 instanceof Error?_0x5bea91[_0x2bf1b8(0x1e9)]:undefined,'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':'❌\x20Morph\x20Edit\x20Failed:\x20'+_0x18416d}],'isError':!![]};}}case TOOL_NAMES[_0x2bf1b8(0x1a2)]:{const _0x1efd85=WarpGrepArgsSchema[_0x2bf1b8(0x1ea)](_0x4fb7d9);if(!_0x1efd85[_0x2bf1b8(0x1a8)])return{'content':[{'type':'text','text':'Invalid\x20arguments:\x20'+_0x1efd85[_0x2bf1b8(0x253)]}],'isError':!![]};const _0x10e56f=_0x5e6bfb=>{const _0x1d7c58=_0x2bf1b8,_0x2ebdc7=[];for(const _0x27be34 of _0x5e6bfb||[]){if(_0x27be34[_0x1d7c58(0x236)]==='assistant'&&Array[_0x1d7c58(0x20b)](_0x27be34[_0x1d7c58(0x1de)]))for(const _0x2eb91a of _0x27be34[_0x1d7c58(0x1de)]){try{const _0x4af098=_0x2eb91a[_0x1d7c58(0x1ac)]?.[_0x1d7c58(0x21b)],_0xbb19b1=JSON[_0x1d7c58(0x284)](_0x2eb91a[_0x1d7c58(0x1ac)]?.[_0x1d7c58(0x26b)]||'{}');if(_0x4af098===_0x1d7c58(0x24c))_0x2ebdc7[_0x1d7c58(0x1bb)](_0x1d7c58(0x1b2)+_0xbb19b1[_0x1d7c58(0x17f)]+'\x27\x20'+(_0xbb19b1[_0x1d7c58(0x271)]||'.'));else{if(_0x4af098===_0x1d7c58(0x166))_0x2ebdc7['push'](_0x1d7c58(0x279)+_0xbb19b1[_0x1d7c58(0x271)]);else{if(_0x4af098===_0x1d7c58(0x247))_0x2ebdc7[_0x1d7c58(0x1bb)]('list_directory\x20'+(_0xbb19b1['command']||'.'));else{if(_0x4af098==='glob')_0x2ebdc7[_0x1d7c58(0x1bb)](_0x1d7c58(0x1c1)+_0xbb19b1[_0x1d7c58(0x17f)]+'\x27\x20'+(_0xbb19b1[_0x1d7c58(0x271)]||'.'));else _0x4af098===_0x1d7c58(0x1cd)&&_0x2ebdc7[_0x1d7c58(0x1bb)](_0x1d7c58(0x1cd));}}}}catch{}}}return _0x2ebdc7;},_0x2b29be=_0x5db2df=>{const _0x5e32ba=_0x2bf1b8,_0x48a1a8=[];if(!_0x5db2df||!Array[_0x5e32ba(0x20b)](_0x5db2df))return _0x48a1a8;const _0x5c1a3b=[{'pattern':/\[FILE NOT FOUND\]/,'error_type':_0x5e32ba(0x1b6),'tool':'read'},{'pattern':/\[PATH ERROR\]/,'error_type':_0x5e32ba(0x1ed),'tool':_0x5e32ba(0x166)},{'pattern':/\[READ ERROR\]/,'error_type':_0x5e32ba(0x17c),'tool':'read'},{'pattern':/\[UNREADABLE FILE\]/,'error_type':_0x5e32ba(0x1e1),'tool':_0x5e32ba(0x166)},{'pattern':/\[RIPGREP ERROR\]/,'error_type':_0x5e32ba(0x26d),'tool':_0x5e32ba(0x19c)},{'pattern':/\[RIPGREP NOT AVAILABLE\]/,'error_type':'RipgrepNotAvailable','tool':_0x5e32ba(0x19c)},{'pattern':/\[BINARY FILE\]/,'error_type':_0x5e32ba(0x1e1),'tool':_0x5e32ba(0x166)},{'pattern':/\[SYMLINK\]/,'error_type':_0x5e32ba(0x1d6),'tool':_0x5e32ba(0x166)},{'pattern':/not a text file/,'error_type':_0x5e32ba(0x1e1),'tool':_0x5e32ba(0x166)},{'pattern':/symbolic link/,'error_type':'SymlinkError','tool':_0x5e32ba(0x166)},{'pattern':/Error reading file:/,'error_type':_0x5e32ba(0x17c),'tool':'read'},{'pattern':/status="error"/,'error_type':_0x5e32ba(0x198),'tool':'unknown'}];let _0x2a7e9c=0x0;for(const _0x192625 of _0x5db2df){_0x192625['role']==='assistant'&&Array['isArray'](_0x192625[_0x5e32ba(0x1de)])&&_0x2a7e9c++;const _0x3d0689=_0x192625['content'];if((_0x192625[_0x5e32ba(0x236)]==='tool'||_0x192625[_0x5e32ba(0x236)]===_0x5e32ba(0x189))&&_0x3d0689&&typeof _0x3d0689===_0x5e32ba(0x178))for(const {pattern:_0x725cbc,error_type:_0x3ad4cd,tool:_0x5a9da5}of _0x5c1a3b){const _0x50248f=_0x3d0689[_0x5e32ba(0x27e)](new RegExp(_0x725cbc[_0x5e32ba(0x202)],'g'));if(_0x50248f)for(const _0x46309d of _0x50248f){const _0x15f9b2=_0x3d0689[_0x5e32ba(0x1f0)](_0x46309d),_0x3e04af=_0x3d0689[_0x5e32ba(0x240)](_0x15f9b2,Math['min'](_0x15f9b2+0xc8,_0x3d0689[_0x5e32ba(0x1d3)]));_0x48a1a8[_0x5e32ba(0x1bb)]({'tool':_0x5a9da5,'error_type':_0x3ad4cd,'error_message':_0x3e04af[_0x5e32ba(0x18b)]('\x0a')[0x0],'turn':_0x2a7e9c});}}}return _0x48a1a8;};try{const _0x4ffaf3=a0_0x5373b1[_0x2bf1b8(0x21c)](_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)]),_0x170448=_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x263)],_0x56d277=_0x170448===_0x2bf1b8(0x280)?{'allowNames':[_0x2bf1b8(0x280)]}:undefined,_0x1e1044=new LocalRipgrepProvider(_0x4ffaf3,undefined,_0x56d277);logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x25d),{'type':_0x2bf1b8(0x170),'repo_root':_0x4ffaf3,'search_type':_0x170448||_0x2bf1b8(0x1e7)}),logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x270),{'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repo_root':_0x4ffaf3,'timeout_ms':MORPH_WARP_GREP_TIMEOUT});const _0x5f38f9=Date[_0x2bf1b8(0x21a)](),_0x16c16a=await runWarpGrep({'searchTerm':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repoRoot':_0x4ffaf3,'morphApiKey':MORPH_API_KEY,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT,'provider':_0x1e1044,'search_type':_0x170448}),_0x451726=Date[_0x2bf1b8(0x21a)]()-_0x5f38f9,_0x454b3f=_0x16c16a['finish']?.[_0x2bf1b8(0x255)]?.[_0x2bf1b8(0x1d8)]?.[_0x2bf1b8(0x1d3)]??0x0;logger[_0x2bf1b8(0x18e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x188),{'termination':_0x16c16a[_0x2bf1b8(0x242)],'turns':_0x16c16a[_0x2bf1b8(0x182)]?.[_0x2bf1b8(0x172)]??0x0,'files_found':_0x454b3f,'latency_ms':_0x451726});const _0x4e9933=_0x2b29be(_0x16c16a[_0x2bf1b8(0x25f)]);_0x4e9933['length']>0x0&&reportMorphError({'error_message':_0x2bf1b8(0x286)+_0x4e9933['length']+_0x2bf1b8(0x1c4),'error_type':_0x2bf1b8(0x214),'level':'warn','tool':_0x2bf1b8(0x281),'context':{'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'model':_0x2bf1b8(0x21f),'termination_reason':_0x16c16a['terminationReason'],'sub_tool_errors':_0x4e9933,'timings':_0x16c16a[_0x2bf1b8(0x182)],'tool_calls':_0x10e56f(_0x16c16a[_0x2bf1b8(0x25f)]),'messages':_0x16c16a[_0x2bf1b8(0x25f)]?.['map'](_0x36c6b5=>({'role':_0x36c6b5['role'],'content':_0x36c6b5[_0x2bf1b8(0x1b4)],..._0x36c6b5['tool_calls']?{'tool_calls':_0x36c6b5['tool_calls'][_0x2bf1b8(0x1d3)]}:{},..._0x36c6b5[_0x2bf1b8(0x1ba)]?{'tool_call_id':_0x36c6b5[_0x2bf1b8(0x1ba)]}:{}}))},'source':'mcp-filesystem'})[_0x2bf1b8(0x181)](()=>{});let _0xf95e62='';if(_0x16c16a[_0x2bf1b8(0x242)]===_0x2bf1b8(0x1c3)&&_0x16c16a[_0x2bf1b8(0x1cd)]?.['metadata']?.['files']){const _0x4e963e=_0x16c16a[_0x2bf1b8(0x1cd)][_0x2bf1b8(0x255)][_0x2bf1b8(0x1d8)];if(_0x4e963e['length']===0x0)return _0xf95e62=_0x16c16a[_0x2bf1b8(0x1cd)][_0x2bf1b8(0x238)]||_0x2bf1b8(0x28c),{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0xf95e62}]};const _0x5f599d=[],_0x22ff45=[_0x2bf1b8(0x1be)];for(const _0x29b6ac of _0x16c16a[_0x2bf1b8(0x25f)]){if(_0x29b6ac[_0x2bf1b8(0x236)]===_0x2bf1b8(0x180)&&Array[_0x2bf1b8(0x20b)](_0x29b6ac['tool_calls']))for(const _0x5e9191 of _0x29b6ac[_0x2bf1b8(0x1de)]){try{const _0x38f0d8=_0x5e9191['function']?.['name'],_0x330c7d=JSON['parse'](_0x5e9191[_0x2bf1b8(0x1ac)]?.[_0x2bf1b8(0x26b)]||'{}');if(_0x38f0d8==='grep_search')_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1c9)+_0x330c7d[_0x2bf1b8(0x17f)]+'\x27\x20in\x20`'+(_0x330c7d[_0x2bf1b8(0x271)]||'.')+'`');else{if(_0x38f0d8===_0x2bf1b8(0x166))_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1fc)+_0x330c7d[_0x2bf1b8(0x271)]+'`');else{if(_0x38f0d8===_0x2bf1b8(0x247))_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1d0)+(_0x330c7d[_0x2bf1b8(0x215)]||'.')+'`');else _0x38f0d8===_0x2bf1b8(0x224)&&_0x22ff45[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x1c6)+_0x330c7d[_0x2bf1b8(0x17f)]+_0x2bf1b8(0x1eb)+(_0x330c7d['path']||'.')+'`');}}}catch{}}}_0x5f599d[_0x2bf1b8(0x1bb)](_0x22ff45[_0x2bf1b8(0x204)]('\x0a'));const _0x16bf28=['','Relevant\x20context\x20found:'];for(const _0x51f4fd of _0x4e963e){if(_0x51f4fd[_0x2bf1b8(0x20f)]==='*')_0x16bf28[_0x2bf1b8(0x1bb)]('-\x20'+_0x51f4fd[_0x2bf1b8(0x271)]+':*');else{if(Array[_0x2bf1b8(0x20b)](_0x51f4fd[_0x2bf1b8(0x20f)])){const _0x7d5759=_0x51f4fd[_0x2bf1b8(0x20f)]['map'](([_0x4a13a6,_0x1251dc])=>{if(_0x4a13a6===_0x1251dc)return''+_0x4a13a6;return _0x4a13a6+'-'+_0x1251dc;});_0x16bf28['push']('-\x20'+_0x51f4fd[_0x2bf1b8(0x271)]+':'+_0x7d5759[_0x2bf1b8(0x204)](','));}else _0x16bf28[_0x2bf1b8(0x1bb)]('-\x20'+_0x51f4fd['path']+':*');}}_0x16bf28[_0x2bf1b8(0x1bb)](''),_0x5f599d[_0x2bf1b8(0x1bb)](_0x16bf28[_0x2bf1b8(0x204)]('\x0a')),_0x5f599d[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x185));const _0x5cccce=[],_0x86d90d=[];for(const _0x437b66 of _0x4e963e){let _0x1f7677=a0_0x5373b1['resolve'](_0x1efd85[_0x2bf1b8(0x262)]['repo_path'],_0x437b66[_0x2bf1b8(0x271)]),_0x6043e2=null,_0x533010=null;try{_0x6043e2=await a0_0x5e0960[_0x2bf1b8(0x200)](_0x1f7677,{'encoding':_0x2bf1b8(0x19b)});}catch(_0x34c85d){const _0x51f6b0=fixPathRepetition(_0x1f7677);if(_0x51f6b0)try{_0x6043e2=await a0_0x5e0960[_0x2bf1b8(0x200)](_0x51f6b0,{'encoding':_0x2bf1b8(0x19b)}),_0x1f7677=_0x51f6b0;}catch{_0x533010=_0x34c85d instanceof Error?_0x34c85d:new Error(String(_0x34c85d));}else _0x533010=_0x34c85d instanceof Error?_0x34c85d:new Error(String(_0x34c85d));}if(_0x6043e2!==null){const _0x5049af=_0x6043e2['split'](/\r?\n/),_0x5cbe35=[];if(_0x437b66[_0x2bf1b8(0x20f)]==='*'||!Array[_0x2bf1b8(0x20b)](_0x437b66['lines']))for(let _0xede4e5=0x1;_0xede4e5<=_0x5049af[_0x2bf1b8(0x1d3)];_0xede4e5++){const _0x5c4b1c=_0x5049af[_0xede4e5-0x1];_0x5cbe35[_0x2bf1b8(0x1bb)](_0xede4e5+'|\x20'+_0x5c4b1c);}else for(const [_0x4fb071,_0x2b2e76]of _0x437b66[_0x2bf1b8(0x20f)]){_0x5cbe35[_0x2bf1b8(0x1d3)]>0x0&&_0x5cbe35['push']('');for(let _0x186122=_0x4fb071;_0x186122<=_0x2b2e76&&_0x186122<=_0x5049af['length'];_0x186122++){const _0x5517c8=_0x5049af[_0x186122-0x1];_0x5cbe35['push'](_0x186122+'|\x20'+_0x5517c8);}}_0x86d90d[_0x2bf1b8(0x1bb)]({'path':_0x437b66[_0x2bf1b8(0x271)],'content':_0x5cbe35['join']('\x0a')});}else _0x5cccce[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x231)+_0x437b66[_0x2bf1b8(0x271)]+_0x2bf1b8(0x199)+(_0x533010?.[_0x2bf1b8(0x22c)]||_0x2bf1b8(0x227))+'\x0a</file>');}try{const _0xf9ce4b=await compactFileContexts(_0x86d90d,_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],MORPH_API_KEY,MORPH_API_URL);for(const _0x57930b of _0xf9ce4b){_0x5cccce[_0x2bf1b8(0x1bb)](_0x2bf1b8(0x231)+_0x57930b[_0x2bf1b8(0x271)]+_0x2bf1b8(0x1fe)+_0x57930b[_0x2bf1b8(0x1b4)]+'\x0a</file>');}}catch(_0x2508b1){logger[_0x2bf1b8(0x20e)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x26c),{'error':_0x2508b1 instanceof Error?_0x2508b1[_0x2bf1b8(0x22c)]:String(_0x2508b1),'files_count':_0x86d90d['length']});for(const _0x4fa556 of _0x86d90d){_0x5cccce[_0x2bf1b8(0x1bb)]('<file\x20path=\x22'+_0x4fa556['path']+'\x22>\x0a'+_0x4fa556['content']+_0x2bf1b8(0x16b));}}_0x5f599d[_0x2bf1b8(0x1bb)](_0x5cccce[_0x2bf1b8(0x204)]('\x0a\x0a')),_0xf95e62=_0x5f599d[_0x2bf1b8(0x204)]('\x0a');const _0x3a4006=_0x16c16a[_0x2bf1b8(0x1fd)]?.[_0x2bf1b8(0x169)](_0x50d1aa=>_0x50d1aa[_0x2bf1b8(0x22c)]?.[_0x2bf1b8(0x28f)](_0x2bf1b8(0x1ca)))||[];if(_0x3a4006['length']>0x0){const _0x22e635=_0x3a4006[_0x2bf1b8(0x1ff)](_0x53b41f=>_0x53b41f['message'])['join'](';\x20');reportMorphError({'error_message':_0x22e635,'error_type':'FileReadError','context':{'tool':_0x2bf1b8(0x281),'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85[_0x2bf1b8(0x262)]['search_string'],'model':_0x2bf1b8(0x21f),'termination_reason':'completed_with_file_errors','error_count':_0x3a4006[_0x2bf1b8(0x1d3)],'is_timeout':![],'timings':_0x16c16a[_0x2bf1b8(0x182)],'files_attempted':_0x4e963e[_0x2bf1b8(0x1ff)](_0xdd245c=>({'path':_0xdd245c[_0x2bf1b8(0x271)],'lines':_0xdd245c['lines']})),'tool_calls':_0x10e56f(_0x16c16a[_0x2bf1b8(0x25f)]),'messages':_0x16c16a[_0x2bf1b8(0x25f)]?.['map'](_0x4da5cd=>({'role':_0x4da5cd['role'],'content':_0x4da5cd[_0x2bf1b8(0x1b4)],..._0x4da5cd['tool_calls']?{'tool_calls':_0x4da5cd[_0x2bf1b8(0x1de)][_0x2bf1b8(0x1d3)]}:{},..._0x4da5cd[_0x2bf1b8(0x1ba)]?{'tool_call_id':_0x4da5cd[_0x2bf1b8(0x1ba)]}:{}})),'request_content':{'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repo_path':_0x1efd85['data'][_0x2bf1b8(0x1ee)],'repoRoot':a0_0x5373b1['resolve'](_0x1efd85['data'][_0x2bf1b8(0x1ee)]),'model':'morph-warp-grep-v2.1'}},'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{});}}else{if(_0x16c16a[_0x2bf1b8(0x242)]==='terminated'&&_0x16c16a[_0x2bf1b8(0x1fd)][_0x2bf1b8(0x1d3)]>0x0){const _0x4eac79=_0x16c16a['errors'][_0x2bf1b8(0x1ff)](_0x649925=>_0x649925[_0x2bf1b8(0x22c)])[_0x2bf1b8(0x204)](';\x20');_0xf95e62=_0x2bf1b8(0x22d)+_0x4eac79;const _0x288fa6=_0x4eac79[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x1e0))||_0x4eac79[_0x2bf1b8(0x234)]()['includes']('timed\x20out')||_0x4eac79[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x16f)),_0x571e90=_0x16c16a[_0x2bf1b8(0x1cd)]?.[_0x2bf1b8(0x255)]?.[_0x2bf1b8(0x1d8)],_0xf5c9a6=_0x16c16a['errors'][0x0];reportMorphError({'error_message':_0x4eac79,'error_type':_0x288fa6?_0x2bf1b8(0x257):_0xf5c9a6?.[_0x2bf1b8(0x210)]?.[_0x2bf1b8(0x21b)]||_0x2bf1b8(0x1f8),'context':{'tool':'codebase_search','repo_path':_0x1efd85[_0x2bf1b8(0x262)]['repo_path'],'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'model':_0x2bf1b8(0x21f),'termination_reason':_0x16c16a[_0x2bf1b8(0x242)],'error_count':_0x16c16a[_0x2bf1b8(0x1fd)]['length'],'is_timeout':_0x288fa6,'timings':_0x16c16a[_0x2bf1b8(0x182)],'files_attempted':_0x571e90?.[_0x2bf1b8(0x1ff)](_0x221d36=>({'path':_0x221d36[_0x2bf1b8(0x271)],'lines':_0x221d36[_0x2bf1b8(0x20f)]})),'tool_calls':_0x10e56f(_0x16c16a[_0x2bf1b8(0x25f)]),'messages':_0x16c16a[_0x2bf1b8(0x25f)]?.['map'](_0x100fa1=>({'role':_0x100fa1['role'],'content':_0x100fa1[_0x2bf1b8(0x1b4)],..._0x100fa1[_0x2bf1b8(0x1de)]?{'tool_calls':_0x100fa1[_0x2bf1b8(0x1de)]['length']}:{},..._0x100fa1[_0x2bf1b8(0x1ba)]?{'tool_call_id':_0x100fa1[_0x2bf1b8(0x1ba)]}:{}})),'request_content':{'query':_0x1efd85['data'][_0x2bf1b8(0x228)],'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'repoRoot':a0_0x5373b1[_0x2bf1b8(0x21c)](_0x1efd85[_0x2bf1b8(0x262)]['repo_path']),'model':_0x2bf1b8(0x21f)}},'stack_trace':_0xf5c9a6?.['stack']||undefined,'source':'mcp-filesystem'})['catch'](()=>{});}else _0xf95e62=_0x2bf1b8(0x289);}return{'content':[{'type':'text','text':_0xf95e62}]};}catch(_0x24fd81){const _0x405a37=handleMorphAPIError(_0x24fd81);if(_0x405a37)return logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1f6),{'tool':_0x2bf1b8(0x281),'error':_0x2bf1b8(0x193),'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180}),_0x405a37;const _0x4c8e76=_0x24fd81 instanceof Error?_0x24fd81[_0x2bf1b8(0x22c)]:String(_0x24fd81);logger[_0x2bf1b8(0x253)](_0x2bf1b8(0x1ef),_0x2bf1b8(0x1f6),{'tool':_0x2bf1b8(0x281),'error':_0x4c8e76,'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'latency_ms':Date[_0x2bf1b8(0x21a)]()-_0x4a2180});const _0x3c7016=_0x4c8e76[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x1e0))||_0x4c8e76[_0x2bf1b8(0x234)]()['includes']('timed\x20out')||_0x4c8e76[_0x2bf1b8(0x234)]()[_0x2bf1b8(0x23f)](_0x2bf1b8(0x16f))||_0x24fd81 instanceof Error&&_0x24fd81[_0x2bf1b8(0x21b)]===_0x2bf1b8(0x257);return reportMorphError({'error_message':_0x4c8e76,'error_type':_0x3c7016?_0x2bf1b8(0x257):_0x24fd81 instanceof Error?_0x24fd81['constructor'][_0x2bf1b8(0x21b)]:_0x2bf1b8(0x237),'context':{'tool':_0x2bf1b8(0x281),'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'query':_0x1efd85['data'][_0x2bf1b8(0x228)],'model':_0x2bf1b8(0x21f),'is_timeout':_0x3c7016,'exception_phase':_0x2bf1b8(0x17d),'request_content':{'query':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'repo_path':_0x1efd85[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ee)],'repoRoot':a0_0x5373b1[_0x2bf1b8(0x21c)](_0x1efd85['data'][_0x2bf1b8(0x1ee)]),'model':'morph-warp-grep-v2.1'}},'stack_trace':_0x24fd81 instanceof Error?_0x24fd81[_0x2bf1b8(0x1e9)]:undefined,'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x2bf1b8(0x21e)+_0x4c8e76}],'isError':![]};}}case TOOL_NAMES[_0x2bf1b8(0x269)]:{const _0x3f7e8a=WarpGrepGitHubArgsSchema[_0x2bf1b8(0x1ea)](_0x4fb7d9);if(!_0x3f7e8a['success'])return{'content':[{'type':_0x2bf1b8(0x1fa),'text':'Invalid\x20arguments:\x20'+_0x3f7e8a[_0x2bf1b8(0x253)]}],'isError':!![]};const _0x3499be=_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x1ce)]||_0x3f7e8a[_0x2bf1b8(0x262)]['owner_repo'];if(!_0x3499be)return{'content':[{'type':'text','text':_0x2bf1b8(0x24b)}],'isError':!![]};const _0x11b3de=MORPH_API_KEY;if(!_0x11b3de)throw new Error(_0x2bf1b8(0x206));const _0x173aeb=Date[_0x2bf1b8(0x21a)]();logger[_0x2bf1b8(0x18e)]('MCP',_0x2bf1b8(0x1bf),{'identifier':_0x3499be,'query':_0x3f7e8a['data'][_0x2bf1b8(0x228)],'branch':_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x225)]});try{const _0x3688f9=new WarpGrepClient({'morphApiKey':_0x11b3de,'morphApiUrl':MORPH_API_URL,'timeout':MORPH_WARP_GREP_TIMEOUT}),_0x5e1ac1=await _0x3688f9[_0x2bf1b8(0x241)]({'searchTerm':_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x228)],'github':_0x3499be,'branch':_0x3f7e8a[_0x2bf1b8(0x262)][_0x2bf1b8(0x225)]}),_0x4cef6f=Date[_0x2bf1b8(0x21a)]()-_0x173aeb;logMcpStderr(_0x2bf1b8(0x1dd)+_0x4cef6f+'ms.\x20Success:\x20'+_0x5e1ac1[_0x2bf1b8(0x1a8)]);const _0x3a9397=formatResult(_0x5e1ac1);return{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x3a9397}]};}catch(_0xde95c2){const _0x3780fc=handleMorphAPIError(_0xde95c2);if(_0x3780fc)return _0x3780fc;const _0x4f5f35=Date[_0x2bf1b8(0x21a)]()-_0x173aeb,_0xefd03a=_0xde95c2 instanceof Error?_0xde95c2[_0x2bf1b8(0x22c)]:String(_0xde95c2);return logMcpStderr('[github_codebase_search]\x20Failed\x20in\x20'+_0x4f5f35+_0x2bf1b8(0x16e),_0xefd03a),reportMorphError({'error_message':_0xefd03a,'error_type':_0xde95c2 instanceof Error?_0xde95c2[_0x2bf1b8(0x210)][_0x2bf1b8(0x21b)]:'UnknownError','context':{'tool':_0x2bf1b8(0x27c),'github_url':_0x3499be,'search_string':_0x3f7e8a[_0x2bf1b8(0x262)]['search_string'],'branch':_0x3f7e8a['data'][_0x2bf1b8(0x225)]},'stack_trace':_0xde95c2 instanceof Error?_0xde95c2[_0x2bf1b8(0x1e9)]:undefined,'source':'mcp-filesystem','tool':_0x2bf1b8(0x27c),'latency_ms':_0x4f5f35})['catch'](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':'GitHub\x20search\x20failed:\x20'+_0xefd03a}],'isError':![]};}}default:throw new Error(_0x2bf1b8(0x1f9)+_0x3208b7);}}catch(_0xba8649){const _0x594a3d=_0xba8649 instanceof Error?_0xba8649[_0x2bf1b8(0x22c)]:String(_0xba8649);return reportMorphError({'error_message':_0x594a3d,'error_type':_0xba8649 instanceof Error?_0xba8649[_0x2bf1b8(0x210)]['name']:_0x2bf1b8(0x237),'context':{'tool':_0x3208b7,'arguments':_0x4fb7d9?JSON[_0x2bf1b8(0x23b)](_0x4fb7d9)[_0x2bf1b8(0x240)](0x0,0x1f4):undefined,'mcp_server_version':_0x2bf1b8(0x235)},'stack_trace':_0xba8649 instanceof Error?_0xba8649[_0x2bf1b8(0x1e9)]:undefined,'source':_0x2bf1b8(0x167)})[_0x2bf1b8(0x181)](()=>{}),{'content':[{'type':_0x2bf1b8(0x1fa),'text':_0x2bf1b8(0x22d)+_0x594a3d}],'isError':!![]};}});async function updateAllowedDirectoriesFromRoots(_0x38355b){const _0x1f2c1b=a0_0x2a3250,_0x2e88f8=await getValidRootDirectories(_0x38355b);if(_0x2e88f8[_0x1f2c1b(0x1d3)]>0x0)allowedDirectories=[..._0x2e88f8],logMcpStderr('Updated\x20allowed\x20directories\x20from\x20MCP\x20roots:\x20'+_0x2e88f8[_0x1f2c1b(0x1d3)]+_0x1f2c1b(0x196));else{logMcpStderr(_0x1f2c1b(0x21d));if(ENABLE_WORKSPACE_MODE)try{const _0x37b8a3=await detectWorkspaceRoot(WORKSPACE_ROOT);_0x37b8a3&&(allowedDirectories=[_0x37b8a3],logMcpStderr(_0x1f2c1b(0x24d)+_0x37b8a3));}catch(_0x8deba9){logMcpStderr(_0x1f2c1b(0x183)+_0x8deba9);}}}server[a0_0x2a3250(0x264)](RootsListChangedNotificationSchema,async()=>{const _0x3ca3d7=a0_0x2a3250;try{const _0x4219e0=await server[_0x3ca3d7(0x1d1)]();_0x4219e0&&_0x3ca3d7(0x1ab)in _0x4219e0&&await updateAllowedDirectoriesFromRoots(_0x4219e0[_0x3ca3d7(0x1ab)]);}catch(_0x5e5139){logMcpStderr(_0x3ca3d7(0x1fb),_0x5e5139 instanceof Error?_0x5e5139[_0x3ca3d7(0x22c)]:String(_0x5e5139));}}),server[a0_0x2a3250(0x1a5)]=async()=>{const _0x5e1795=a0_0x2a3250,_0x1de2d0=server[_0x5e1795(0x278)]();if(_0x1de2d0?.[_0x5e1795(0x1ab)])try{const _0x36f47d=await server[_0x5e1795(0x1d1)]();_0x36f47d&&_0x5e1795(0x1ab)in _0x36f47d?await updateAllowedDirectoriesFromRoots(_0x36f47d[_0x5e1795(0x1ab)]):logMcpStderr(_0x5e1795(0x26f));}catch(_0xba802a){logMcpStderr(_0x5e1795(0x191),_0xba802a instanceof Error?_0xba802a[_0x5e1795(0x22c)]:String(_0xba802a));}else{if(allowedDirectories[_0x5e1795(0x1d3)]>0x0)logMcpStderr('Client\x20does\x20not\x20support\x20MCP\x20Roots,\x20using\x20allowed\x20directories\x20set\x20from\x20server\x20args:',allowedDirectories);else{if(ENABLE_WORKSPACE_MODE)logMcpStderr(_0x5e1795(0x1a4));else throw new Error('Server\x20cannot\x20operate:\x20No\x20allowed\x20directories\x20available.\x20Server\x20was\x20started\x20without\x20command-line\x20directories\x20and\x20client\x20either\x20does\x20not\x20support\x20MCP\x20roots\x20protocol\x20or\x20provided\x20empty\x20roots.\x20Please\x20either:\x201)\x20Start\x20server\x20with\x20directory\x20arguments,\x202)\x20Use\x20a\x20client\x20that\x20supports\x20MCP\x20roots\x20protocol\x20and\x20provides\x20valid\x20root\x20directories,\x20or\x203)\x20Enable\x20workspace\x20mode\x20with\x20ENABLE_WORKSPACE_MODE=true.');}}};async function runServer(){const _0x2821e4=a0_0x2a3250,_0x2fa0ed=new StdioServerTransport();await server[_0x2821e4(0x190)](_0x2fa0ed),logMcpStderr(_0x2821e4(0x1e3)),allowedDirectories[_0x2821e4(0x1d3)]===0x0&&logMcpStderr('Started\x20without\x20allowed\x20directories\x20-\x20waiting\x20for\x20client\x20to\x20provide\x20roots\x20via\x20MCP\x20protocol');}runServer()['catch'](_0x27df6b=>{const _0xb1395c=a0_0x2a3250;logMcpStderr(_0xb1395c(0x245),_0x27df6b),process[_0xb1395c(0x174)](0x1);});
package/dist/log-utils.js CHANGED
@@ -1 +1 @@
1
- var a1_0x50a085=a1_0x57a3;(function(_0x2d1836,_0x27aaa6){var _0x3e316e=a1_0x57a3,_0x2643a8=_0x2d1836();while(!![]){try{var _0x57308b=-parseInt(_0x3e316e(0x98))/0x1*(-parseInt(_0x3e316e(0x8e))/0x2)+-parseInt(_0x3e316e(0x8b))/0x3+parseInt(_0x3e316e(0x97))/0x4+parseInt(_0x3e316e(0x89))/0x5+parseInt(_0x3e316e(0x8c))/0x6*(-parseInt(_0x3e316e(0x8a))/0x7)+-parseInt(_0x3e316e(0x84))/0x8+parseInt(_0x3e316e(0x96))/0x9;if(_0x57308b===_0x27aaa6)break;else _0x2643a8['push'](_0x2643a8['shift']());}catch(_0x3830ae){_0x2643a8['push'](_0x2643a8['shift']());}}}(a1_0x2de4,0x63015));import a1_0x1cb1fb from'os';function a1_0x2de4(){var _0x3e2ea3=['1bqcRqu','platform','5345168HoUGeq','[os=','MCP','macOS','Windows','190265nTVZkd','14yWXHQn','1962519bUzAVx','1836114IBgEFH','Unknown','1564378AKVrPA','map','error','length','Linux','win32','linux','info','12625155udiGyh','467380dNWTsS'];a1_0x2de4=function(){return _0x3e2ea3;};return a1_0x2de4();}import{logger}from'./logger.js';export function getOperatingSystemType(_0x58ff00=a1_0x1cb1fb[a1_0x50a085(0x83)]()){var _0x38edb4=a1_0x50a085;switch(_0x58ff00){case'darwin':return _0x38edb4(0x87);case _0x38edb4(0x93):return _0x38edb4(0x88);case _0x38edb4(0x94):return _0x38edb4(0x92);default:return _0x38edb4(0x8d);}}export function formatMcpLogMessage(_0x1f0d00,_0x2dec83=a1_0x1cb1fb[a1_0x50a085(0x83)]()){var _0x1fcbb2=a1_0x50a085;return _0x1fcbb2(0x85)+getOperatingSystemType(_0x2dec83)+']\x20'+_0x1f0d00;}function a1_0x57a3(_0x135de4,_0xb8d9aa){_0x135de4=_0x135de4-0x83;var _0x2de476=a1_0x2de4();var _0x57a33e=_0x2de476[_0x135de4];return _0x57a33e;}export function logMcpStderr(_0x352271,..._0x1c5a3f){var _0x16a149=a1_0x50a085;console[_0x16a149(0x90)](formatMcpLogMessage(_0x352271),..._0x1c5a3f),logger[_0x16a149(0x95)](_0x16a149(0x86),_0x352271,_0x1c5a3f[_0x16a149(0x91)]?{'args':_0x1c5a3f[_0x16a149(0x8f)](_0x496ecb=>String(_0x496ecb))}:undefined);}
1
+ var a1_0x253c07=a1_0x260d;function a1_0x4dcd(){var _0x5801d8=['macOS','MCP','90352qkqWDz','length','6904345NoAgnr','info','linux','10qsccau','map','4737572aKZojl','5996154jmONUL','win32','error','1412776FmNDOv','Unknown','Windows','3818613IxqusY','9998968toQuAA','platform'];a1_0x4dcd=function(){return _0x5801d8;};return a1_0x4dcd();}(function(_0x2ad0b3,_0x2f2a11){var _0x4c0ac4=a1_0x260d,_0x3859a3=_0x2ad0b3();while(!![]){try{var _0x189676=-parseInt(_0x4c0ac4(0x198))/0x1*(parseInt(_0x4c0ac4(0x19d))/0x2)+-parseInt(_0x4c0ac4(0x1a6))/0x3+-parseInt(_0x4c0ac4(0x1a3))/0x4+parseInt(_0x4c0ac4(0x19a))/0x5+parseInt(_0x4c0ac4(0x1a0))/0x6+-parseInt(_0x4c0ac4(0x19f))/0x7+parseInt(_0x4c0ac4(0x194))/0x8;if(_0x189676===_0x2f2a11)break;else _0x3859a3['push'](_0x3859a3['shift']());}catch(_0x4060c3){_0x3859a3['push'](_0x3859a3['shift']());}}}(a1_0x4dcd,0xd5bd6));import a1_0x708f6a from'os';import{logger}from'./logger.js';export function getOperatingSystemType(_0x5baf4a=a1_0x708f6a[a1_0x253c07(0x195)]()){var _0x3c9af8=a1_0x253c07;switch(_0x5baf4a){case'darwin':return _0x3c9af8(0x196);case _0x3c9af8(0x1a1):return _0x3c9af8(0x1a5);case _0x3c9af8(0x19c):return'Linux';default:return _0x3c9af8(0x1a4);}}function a1_0x260d(_0x29f899,_0x4935a3){_0x29f899=_0x29f899-0x194;var _0x4dcd45=a1_0x4dcd();var _0x260dc0=_0x4dcd45[_0x29f899];return _0x260dc0;}export function formatMcpLogMessage(_0x56be43,_0x110a9f=a1_0x708f6a[a1_0x253c07(0x195)]()){return'[os='+getOperatingSystemType(_0x110a9f)+']\x20'+_0x56be43;}export function logMcpStderr(_0x33ccea,..._0x3a076d){var _0x22e841=a1_0x253c07;console[_0x22e841(0x1a2)](formatMcpLogMessage(_0x33ccea),..._0x3a076d),logger[_0x22e841(0x19b)](_0x22e841(0x197),_0x33ccea,_0x3a076d[_0x22e841(0x199)]?{'args':_0x3a076d[_0x22e841(0x19e)](_0x3a401a=>String(_0x3a401a))}:undefined);}
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- const a2_0xf6b6a3=a2_0x2e52;(function(_0x1816cf,_0x237d57){const _0x5c4d1e=a2_0x2e52,_0x512e62=_0x1816cf();while(!![]){try{const _0x37364f=-parseInt(_0x5c4d1e(0x1d4))/0x1+parseInt(_0x5c4d1e(0x1d5))/0x2*(-parseInt(_0x5c4d1e(0x1bd))/0x3)+-parseInt(_0x5c4d1e(0x1c9))/0x4*(parseInt(_0x5c4d1e(0x1be))/0x5)+-parseInt(_0x5c4d1e(0x1d6))/0x6+parseInt(_0x5c4d1e(0x1ca))/0x7*(-parseInt(_0x5c4d1e(0x1d0))/0x8)+-parseInt(_0x5c4d1e(0x1ce))/0x9*(-parseInt(_0x5c4d1e(0x1d3))/0xa)+-parseInt(_0x5c4d1e(0x1c2))/0xb*(-parseInt(_0x5c4d1e(0x1c1))/0xc);if(_0x37364f===_0x237d57)break;else _0x512e62['push'](_0x512e62['shift']());}catch(_0x2a5dee){_0x512e62['push'](_0x512e62['shift']());}}}(a2_0x4037,0x876b7));function a2_0x2e52(_0x55994c,_0x1b5219){_0x55994c=_0x55994c-0x1bd;const _0x40372e=a2_0x4037();let _0x2e521d=_0x40372e[_0x55994c];return _0x2e521d;}import{createWriteStream}from'fs';class MorphLogger{['enabled'];[a2_0xf6b6a3(0x1c8)];constructor(){const _0x18eb74=a2_0xf6b6a3;this['enabled']=process['env']['MORPH_DEBUG']==='1'||!!process[_0x18eb74(0x1cf)][_0x18eb74(0x1c3)];const _0x1619ff=process[_0x18eb74(0x1cf)][_0x18eb74(0x1c3)];this[_0x18eb74(0x1c8)]=_0x1619ff?createWriteStream(_0x1619ff,{'flags':'a'}):null;}[a2_0xf6b6a3(0x1d2)](_0xed90d8,_0x304648,_0x22bc33){const _0x579d2c=a2_0xf6b6a3;this[_0x579d2c(0x1d7)](_0x579d2c(0x1d2),_0xed90d8,_0x304648,_0x22bc33);}[a2_0xf6b6a3(0x1c5)](_0xb9f389,_0x537416,_0x52d220){const _0x2788ef=a2_0xf6b6a3;this[_0x2788ef(0x1d7)](_0x2788ef(0x1c5),_0xb9f389,_0x537416,_0x52d220);}[a2_0xf6b6a3(0x1cd)](_0x330b63,_0x40f437,_0x2a1bf3){const _0x512044=a2_0xf6b6a3;this[_0x512044(0x1d7)](_0x512044(0x1cd),_0x330b63,_0x40f437,_0x2a1bf3);}[a2_0xf6b6a3(0x1d1)](_0x4c5886,_0x15e17a,_0x15fe7b){const _0x5af581=a2_0xf6b6a3;this[_0x5af581(0x1d7)](_0x5af581(0x1d1),_0x4c5886,_0x15e17a,_0x15fe7b);}[a2_0xf6b6a3(0x1c4)](){const _0x587f65=a2_0xf6b6a3;this[_0x587f65(0x1c7)]=!![];}get['isEnabled'](){const _0x30f060=a2_0xf6b6a3;return this[_0x30f060(0x1c7)];}['_log'](_0x59aa7f,_0x2df737,_0x2a6a41,_0x3c093a){const _0x5221be=a2_0xf6b6a3;if(_0x59aa7f!=='error'&&!this['enabled'])return;const _0x643eec=new Date()[_0x5221be(0x1cc)](),_0x286888='['+_0x643eec+_0x5221be(0x1c0)+_0x59aa7f[_0x5221be(0x1cb)]()+']\x20['+_0x2df737+']';console[_0x5221be(0x1d1)](_0x3c093a?_0x286888+'\x20'+_0x2a6a41+'\x20'+JSON[_0x5221be(0x1bf)](_0x3c093a):_0x286888+'\x20'+_0x2a6a41),this[_0x5221be(0x1c8)]?.[_0x5221be(0x1c6)](JSON[_0x5221be(0x1bf)]({'ts':_0x643eec,'level':_0x59aa7f,'component':_0x2df737,'msg':_0x2a6a41,..._0x3c093a&&{'data':_0x3c093a}})+'\x0a');}}function a2_0x4037(){const _0x272475=['stringify',']\x20[','14277252yilSmE','33UekKMZ','MORPH_LOG_FILE','enable','info','write','enabled','fileStream','4hLtQId','7vKWlDu','toUpperCase','toISOString','warn','9QphbUg','env','6919048WShkOE','error','debug','3660530vEoByL','132523cGgbut','2jHyYjf','6083346OdtctR','_log','3066711NaSAgW','1735775DEtFrK'];a2_0x4037=function(){return _0x272475;};return a2_0x4037();}export const logger=new MorphLogger();
1
+ const a2_0x44a080=a2_0x4a66;(function(_0x13a59d,_0x16abc6){const _0x235103=a2_0x4a66,_0x126d60=_0x13a59d();while(!![]){try{const _0x31a537=-parseInt(_0x235103(0x1d5))/0x1+-parseInt(_0x235103(0x1e7))/0x2+-parseInt(_0x235103(0x1dc))/0x3*(-parseInt(_0x235103(0x1d6))/0x4)+parseInt(_0x235103(0x1d9))/0x5+parseInt(_0x235103(0x1dd))/0x6*(-parseInt(_0x235103(0x1e8))/0x7)+parseInt(_0x235103(0x1d4))/0x8*(-parseInt(_0x235103(0x1d2))/0x9)+parseInt(_0x235103(0x1db))/0xa;if(_0x31a537===_0x16abc6)break;else _0x126d60['push'](_0x126d60['shift']());}catch(_0xa2c741){_0x126d60['push'](_0x126d60['shift']());}}}(a2_0x46d9,0x89d84));import{createWriteStream}from'fs';function a2_0x4a66(_0x387fa6,_0x477beb){_0x387fa6=_0x387fa6-0x1d0;const _0x46d90f=a2_0x46d9();let _0x4a66c4=_0x46d90f[_0x387fa6];return _0x4a66c4;}function a2_0x46d9(){const _0x1a7087=['enable','26012150mhZGHn','138ylmSYc','6UlettO','fileStream','env','warn','MORPH_DEBUG','stringify','enabled',']\x20[','info','error','1065350SujojB','6188861XEGGxI','isEnabled','MORPH_LOG_FILE','7407NFgJns','write','5288wrWCVp','486367kROCPS','2364loPugU','debug','_log','1916895bcmUMG'];a2_0x46d9=function(){return _0x1a7087;};return a2_0x46d9();}class MorphLogger{[a2_0x44a080(0x1e3)];[a2_0x44a080(0x1de)];constructor(){const _0x3efc16=a2_0x44a080;this[_0x3efc16(0x1e3)]=process['env'][_0x3efc16(0x1e1)]==='1'||!!process['env']['MORPH_LOG_FILE'];const _0x3e6691=process[_0x3efc16(0x1df)][_0x3efc16(0x1d1)];this[_0x3efc16(0x1de)]=_0x3e6691?createWriteStream(_0x3e6691,{'flags':'a'}):null;}['debug'](_0x586c3b,_0x499969,_0xaef994){const _0x259629=a2_0x44a080;this['_log'](_0x259629(0x1d7),_0x586c3b,_0x499969,_0xaef994);}[a2_0x44a080(0x1e5)](_0x284b43,_0x123970,_0x4df55c){const _0x43b805=a2_0x44a080;this[_0x43b805(0x1d8)](_0x43b805(0x1e5),_0x284b43,_0x123970,_0x4df55c);}[a2_0x44a080(0x1e0)](_0x430727,_0x6ccb99,_0x458a56){const _0x12c977=a2_0x44a080;this['_log'](_0x12c977(0x1e0),_0x430727,_0x6ccb99,_0x458a56);}['error'](_0x458c98,_0x259b1f,_0xd5b2f2){this['_log']('error',_0x458c98,_0x259b1f,_0xd5b2f2);}[a2_0x44a080(0x1da)](){const _0x4b68e0=a2_0x44a080;this[_0x4b68e0(0x1e3)]=!![];}get[a2_0x44a080(0x1d0)](){const _0x1ed4f2=a2_0x44a080;return this[_0x1ed4f2(0x1e3)];}[a2_0x44a080(0x1d8)](_0x8f25dc,_0x560f35,_0x455685,_0x3de7dd){const _0x413bce=a2_0x44a080;if(_0x8f25dc!==_0x413bce(0x1e6)&&!this[_0x413bce(0x1e3)])return;const _0x568ccc=new Date()['toISOString'](),_0x44a0d5='['+_0x568ccc+_0x413bce(0x1e4)+_0x8f25dc['toUpperCase']()+']\x20['+_0x560f35+']';console[_0x413bce(0x1e6)](_0x3de7dd?_0x44a0d5+'\x20'+_0x455685+'\x20'+JSON[_0x413bce(0x1e2)](_0x3de7dd):_0x44a0d5+'\x20'+_0x455685),this[_0x413bce(0x1de)]?.[_0x413bce(0x1d3)](JSON['stringify']({'ts':_0x568ccc,'level':_0x8f25dc,'component':_0x560f35,'msg':_0x455685,..._0x3de7dd&&{'data':_0x3de7dd}})+'\x0a');}}export const logger=new MorphLogger();
@@ -1 +1 @@
1
- (function(_0x2efb35,_0x17006b){const _0x16dcac=a3_0x2417,_0xcb760f=_0x2efb35();while(!![]){try{const _0x18cbdc=-parseInt(_0x16dcac(0xff))/0x1+-parseInt(_0x16dcac(0x10a))/0x2*(-parseInt(_0x16dcac(0x112))/0x3)+parseInt(_0x16dcac(0x113))/0x4*(parseInt(_0x16dcac(0x108))/0x5)+parseInt(_0x16dcac(0x110))/0x6*(-parseInt(_0x16dcac(0x10f))/0x7)+-parseInt(_0x16dcac(0x10c))/0x8+-parseInt(_0x16dcac(0x10d))/0x9*(-parseInt(_0x16dcac(0x107))/0xa)+parseInt(_0x16dcac(0x102))/0xb;if(_0x18cbdc===_0x17006b)break;else _0xcb760f['push'](_0xcb760f['shift']());}catch(_0x1380b4){_0xcb760f['push'](_0xcb760f['shift']());}}}(a3_0x413c,0x29f66));function a3_0x413c(){const _0x30da0b=['toUpperCase','startsWith','50qIvENt','110FjlVLa','trim','2JJoLpt','test','3752FGEAig','29034uYtZEH','replace','35973rWHGDp','18isWsQr','join','579873ZoGpRw','2920FLHfgO','normalize','slice','52422kFOEzl','substring','charAt','161755ukotrZ','match','homedir'];a3_0x413c=function(){return _0x30da0b;};return a3_0x413c();}import a3_0x49a5d8 from'path';import a3_0x21abfc from'os';function a3_0x2417(_0x1f1ba6,_0x26fb83){_0x1f1ba6=_0x1f1ba6-0xfe;const _0x413c12=a3_0x413c();let _0x2417f0=_0x413c12[_0x1f1ba6];return _0x2417f0;}export function convertToWindowsPath(_0x55807c){const _0x244d1c=a3_0x2417;if(_0x55807c[_0x244d1c(0x106)]('/mnt/')){const _0xd95427=_0x55807c['charAt'](0x5)[_0x244d1c(0x105)](),_0x615376=_0x55807c[_0x244d1c(0xfe)](0x6)[_0x244d1c(0x10e)](/\//g,'\x5c');return _0xd95427+':'+_0x615376;}if(_0x55807c[_0x244d1c(0x103)](/^\/[a-zA-Z]\//)){const _0x434c37=_0x55807c[_0x244d1c(0x101)](0x1)[_0x244d1c(0x105)](),_0xf4f5e1=_0x55807c['slice'](0x2)[_0x244d1c(0x10e)](/\//g,'\x5c');return _0x434c37+':'+_0xf4f5e1;}if(_0x55807c[_0x244d1c(0x103)](/^[a-zA-Z]:/))return _0x55807c[_0x244d1c(0x10e)](/\//g,'\x5c');return _0x55807c;}export function normalizePath(_0x3a8b8b){const _0x2e40e6=a3_0x2417;_0x3a8b8b=_0x3a8b8b[_0x2e40e6(0x109)]()[_0x2e40e6(0x10e)](/^["']|["']$/g,'');const _0x486f70=_0x3a8b8b[_0x2e40e6(0x106)]('/')&&!_0x3a8b8b[_0x2e40e6(0x103)](/^\/mnt\/[a-z]\//i)&&!_0x3a8b8b[_0x2e40e6(0x103)](/^\/[a-zA-Z]\//);if(_0x486f70)return _0x3a8b8b[_0x2e40e6(0x10e)](/\/+/g,'/')[_0x2e40e6(0x10e)](/\/+$/,'');_0x3a8b8b=convertToWindowsPath(_0x3a8b8b);if(_0x3a8b8b[_0x2e40e6(0x106)]('\x5c\x5c')){let _0x16360c=_0x3a8b8b;_0x16360c=_0x16360c[_0x2e40e6(0x10e)](/^\\{2,}/,'\x5c\x5c');const _0x2d406c=_0x16360c[_0x2e40e6(0x100)](0x2)[_0x2e40e6(0x10e)](/\\\\/g,'\x5c');_0x3a8b8b='\x5c\x5c'+_0x2d406c;}else _0x3a8b8b=_0x3a8b8b[_0x2e40e6(0x10e)](/\\\\/g,'\x5c');let _0x20ff94=a3_0x49a5d8[_0x2e40e6(0x114)](_0x3a8b8b);_0x3a8b8b[_0x2e40e6(0x106)]('\x5c\x5c')&&!_0x20ff94['startsWith']('\x5c\x5c')&&(_0x20ff94='\x5c'+_0x20ff94);if(_0x20ff94[_0x2e40e6(0x103)](/^[a-zA-Z]:/)){let _0x13e0e1=_0x20ff94['replace'](/\//g,'\x5c');return/^[a-z]:/[_0x2e40e6(0x10b)](_0x13e0e1)&&(_0x13e0e1=_0x13e0e1['charAt'](0x0)[_0x2e40e6(0x105)]()+_0x13e0e1[_0x2e40e6(0xfe)](0x1)),_0x13e0e1;}return _0x20ff94[_0x2e40e6(0x10e)](/\//g,'\x5c');}export function expandHome(_0x28786d){const _0x262942=a3_0x2417;if(_0x28786d['startsWith']('~/')||_0x28786d==='~')return a3_0x49a5d8[_0x262942(0x111)](a3_0x21abfc[_0x262942(0x104)](),_0x28786d[_0x262942(0xfe)](0x1));return _0x28786d;}
1
+ (function(_0x2f4bc8,_0x5c10ae){const _0x488b84=a3_0x41b1,_0x35912f=_0x2f4bc8();while(!![]){try{const _0x10f8ae=parseInt(_0x488b84(0x100))/0x1*(parseInt(_0x488b84(0x112))/0x2)+-parseInt(_0x488b84(0x107))/0x3+-parseInt(_0x488b84(0x113))/0x4*(parseInt(_0x488b84(0x102))/0x5)+parseInt(_0x488b84(0x104))/0x6+-parseInt(_0x488b84(0x115))/0x7*(parseInt(_0x488b84(0x110))/0x8)+parseInt(_0x488b84(0x109))/0x9*(parseInt(_0x488b84(0x103))/0xa)+parseInt(_0x488b84(0x10f))/0xb*(parseInt(_0x488b84(0x10a))/0xc);if(_0x10f8ae===_0x5c10ae)break;else _0x35912f['push'](_0x35912f['shift']());}catch(_0x5650d4){_0x35912f['push'](_0x35912f['shift']());}}}(a3_0x5aaf,0xf1cbf));import a3_0x2acd69 from'path';function a3_0x41b1(_0x175090,_0x2a5d94){_0x175090=_0x175090-0xff;const _0x5aafcc=a3_0x5aaf();let _0x41b156=_0x5aafcc[_0x175090];return _0x41b156;}import a3_0x16b75e from'os';export function convertToWindowsPath(_0x576ea1){const _0x1ea20d=a3_0x41b1;if(_0x576ea1[_0x1ea20d(0x111)](_0x1ea20d(0x10b))){const _0x419be9=_0x576ea1[_0x1ea20d(0x10d)](0x5)[_0x1ea20d(0x10c)](),_0x4d70f0=_0x576ea1[_0x1ea20d(0x106)](0x6)[_0x1ea20d(0x10e)](/\//g,'\x5c');return _0x419be9+':'+_0x4d70f0;}if(_0x576ea1[_0x1ea20d(0x114)](/^\/[a-zA-Z]\//)){const _0x1c76c9=_0x576ea1[_0x1ea20d(0x10d)](0x1)['toUpperCase'](),_0x5dd9b7=_0x576ea1[_0x1ea20d(0x106)](0x2)['replace'](/\//g,'\x5c');return _0x1c76c9+':'+_0x5dd9b7;}if(_0x576ea1[_0x1ea20d(0x114)](/^[a-zA-Z]:/))return _0x576ea1[_0x1ea20d(0x10e)](/\//g,'\x5c');return _0x576ea1;}export function normalizePath(_0x4412dc){const _0x2d6cc3=a3_0x41b1;_0x4412dc=_0x4412dc[_0x2d6cc3(0x108)]()['replace'](/^["']|["']$/g,'');const _0x315209=_0x4412dc[_0x2d6cc3(0x111)]('/')&&!_0x4412dc['match'](/^\/mnt\/[a-z]\//i)&&!_0x4412dc[_0x2d6cc3(0x114)](/^\/[a-zA-Z]\//);if(_0x315209)return _0x4412dc[_0x2d6cc3(0x10e)](/\/+/g,'/')['replace'](/\/+$/,'');_0x4412dc=convertToWindowsPath(_0x4412dc);if(_0x4412dc[_0x2d6cc3(0x111)]('\x5c\x5c')){let _0x2c2c0b=_0x4412dc;_0x2c2c0b=_0x2c2c0b['replace'](/^\\{2,}/,'\x5c\x5c');const _0x2355c5=_0x2c2c0b[_0x2d6cc3(0xff)](0x2)['replace'](/\\\\/g,'\x5c');_0x4412dc='\x5c\x5c'+_0x2355c5;}else _0x4412dc=_0x4412dc[_0x2d6cc3(0x10e)](/\\\\/g,'\x5c');let _0x5f8117=a3_0x2acd69[_0x2d6cc3(0x116)](_0x4412dc);_0x4412dc[_0x2d6cc3(0x111)]('\x5c\x5c')&&!_0x5f8117['startsWith']('\x5c\x5c')&&(_0x5f8117='\x5c'+_0x5f8117);if(_0x5f8117[_0x2d6cc3(0x114)](/^[a-zA-Z]:/)){let _0x18d464=_0x5f8117[_0x2d6cc3(0x10e)](/\//g,'\x5c');return/^[a-z]:/['test'](_0x18d464)&&(_0x18d464=_0x18d464['charAt'](0x0)[_0x2d6cc3(0x10c)]()+_0x18d464[_0x2d6cc3(0x106)](0x1)),_0x18d464;}return _0x5f8117[_0x2d6cc3(0x10e)](/\//g,'\x5c');}export function expandHome(_0xc6e9fd){const _0x4ee83e=a3_0x41b1;if(_0xc6e9fd[_0x4ee83e(0x111)]('~/')||_0xc6e9fd==='~')return a3_0x2acd69[_0x4ee83e(0x101)](a3_0x16b75e[_0x4ee83e(0x105)](),_0xc6e9fd[_0x4ee83e(0x106)](0x1));return _0xc6e9fd;}function a3_0x5aaf(){const _0x205bef=['322245nSOJEo','trim','36bYrkmy','5220oOzeKa','/mnt/','toUpperCase','charAt','replace','23584neAgXv','64KIsaVE','startsWith','397024SrXJnz','1156GrEcZF','match','895559vaKsyC','normalize','substring','6doqEWK','join','20665vMxWif','1598920tQEDfc','3314802SVXkCt','homedir','slice'];a3_0x5aaf=function(){return _0x205bef;};return a3_0x5aaf();}
@@ -1 +1 @@
1
- function a4_0xf991(_0x78fb85,_0x5deb64){_0x78fb85=_0x78fb85-0xe9;const _0x131035=a4_0x1310();let _0xf99109=_0x131035[_0x78fb85];return _0xf99109;}(function(_0x557039,_0x478c12){const _0x7574d=a4_0xf991,_0x2f4145=_0x557039();while(!![]){try{const _0x5d99a0=parseInt(_0x7574d(0xf7))/0x1+parseInt(_0x7574d(0xec))/0x2+parseInt(_0x7574d(0xfa))/0x3+parseInt(_0x7574d(0xf8))/0x4+-parseInt(_0x7574d(0xf3))/0x5*(-parseInt(_0x7574d(0xe9))/0x6)+-parseInt(_0x7574d(0xf0))/0x7+-parseInt(_0x7574d(0xf1))/0x8;if(_0x5d99a0===_0x478c12)break;else _0x2f4145['push'](_0x2f4145['shift']());}catch(_0x5e775e){_0x2f4145['push'](_0x2f4145['shift']());}}}(a4_0x1310,0x67fc7));import a4_0x22cd80 from'path';export function isPathWithinAllowedDirectories(_0x1f0497,_0x41b254){const _0x338223=a4_0xf991;if(typeof _0x1f0497!==_0x338223(0xf9)||!Array[_0x338223(0xfb)](_0x41b254))return![];if(!_0x1f0497||_0x41b254[_0x338223(0xeb)]===0x0)return![];if(_0x1f0497['includes']('\x00'))return![];let _0x190e4c;try{_0x190e4c=a4_0x22cd80[_0x338223(0xf5)](a4_0x22cd80[_0x338223(0xea)](_0x1f0497));}catch{return![];}if(!a4_0x22cd80[_0x338223(0xf4)](_0x190e4c))throw new Error(_0x338223(0xf6));return _0x41b254[_0x338223(0xf2)](_0x1592ab=>{const _0x4e7bc8=_0x338223;if(typeof _0x1592ab!==_0x4e7bc8(0xf9)||!_0x1592ab)return![];if(_0x1592ab[_0x4e7bc8(0xef)]('\x00'))return![];let _0x3ccb88;try{_0x3ccb88=a4_0x22cd80[_0x4e7bc8(0xf5)](a4_0x22cd80[_0x4e7bc8(0xea)](_0x1592ab));}catch{return![];}if(!a4_0x22cd80[_0x4e7bc8(0xf4)](_0x3ccb88))throw new Error(_0x4e7bc8(0xed));if(_0x190e4c===_0x3ccb88)return!![];if(_0x3ccb88===a4_0x22cd80['sep'])return _0x190e4c[_0x4e7bc8(0xee)](a4_0x22cd80[_0x4e7bc8(0xfc)]);return _0x190e4c[_0x4e7bc8(0xee)](_0x3ccb88+a4_0x22cd80[_0x4e7bc8(0xfc)]);});}function a4_0x1310(){const _0x3e5aba=['sep','1248ogvIBh','normalize','length','364722faabOa','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','startsWith','includes','3648540fKtptb','8688848nTtEYq','some','10820uuAIWE','isAbsolute','resolve','Path\x20must\x20be\x20absolute\x20after\x20normalization','658830Poyula','211328WycDVR','string','2067354GiztDV','isArray'];a4_0x1310=function(){return _0x3e5aba;};return a4_0x1310();}
1
+ function a4_0x5267(_0x1042f2,_0x19c663){_0x1042f2=_0x1042f2-0xc7;const _0x5bdeed=a4_0x5bde();let _0x526757=_0x5bdeed[_0x1042f2];return _0x526757;}(function(_0x56ad9a,_0x46d0b4){const _0x4fe317=a4_0x5267,_0x3070f2=_0x56ad9a();while(!![]){try{const _0x174f4a=-parseInt(_0x4fe317(0xcc))/0x1*(parseInt(_0x4fe317(0xd1))/0x2)+-parseInt(_0x4fe317(0xdc))/0x3*(parseInt(_0x4fe317(0xd4))/0x4)+-parseInt(_0x4fe317(0xca))/0x5*(parseInt(_0x4fe317(0xcd))/0x6)+parseInt(_0x4fe317(0xd6))/0x7+-parseInt(_0x4fe317(0xcb))/0x8*(-parseInt(_0x4fe317(0xd9))/0x9)+-parseInt(_0x4fe317(0xce))/0xa*(-parseInt(_0x4fe317(0xd3))/0xb)+parseInt(_0x4fe317(0xcf))/0xc;if(_0x174f4a===_0x46d0b4)break;else _0x3070f2['push'](_0x3070f2['shift']());}catch(_0x4482ea){_0x3070f2['push'](_0x3070f2['shift']());}}}(a4_0x5bde,0x3b15b));import a4_0x4587c4 from'path';export function isPathWithinAllowedDirectories(_0xe1dd56,_0x45357c){const _0x1f658a=a4_0x5267;if(typeof _0xe1dd56!==_0x1f658a(0xd0)||!Array[_0x1f658a(0xdb)](_0x45357c))return![];if(!_0xe1dd56||_0x45357c['length']===0x0)return![];if(_0xe1dd56[_0x1f658a(0xd5)]('\x00'))return![];let _0x86b745;try{_0x86b745=a4_0x4587c4['resolve'](a4_0x4587c4[_0x1f658a(0xc9)](_0xe1dd56));}catch{return![];}if(!a4_0x4587c4[_0x1f658a(0xc8)](_0x86b745))throw new Error(_0x1f658a(0xd2));return _0x45357c[_0x1f658a(0xd8)](_0x2673e6=>{const _0x205e3b=_0x1f658a;if(typeof _0x2673e6!=='string'||!_0x2673e6)return![];if(_0x2673e6['includes']('\x00'))return![];let _0x64a6d0;try{_0x64a6d0=a4_0x4587c4['resolve'](a4_0x4587c4[_0x205e3b(0xc9)](_0x2673e6));}catch{return![];}if(!a4_0x4587c4['isAbsolute'](_0x64a6d0))throw new Error(_0x205e3b(0xc7));if(_0x86b745===_0x64a6d0)return!![];if(_0x64a6d0===a4_0x4587c4[_0x205e3b(0xd7)])return _0x86b745[_0x205e3b(0xda)](a4_0x4587c4[_0x205e3b(0xd7)]);return _0x86b745[_0x205e3b(0xda)](_0x64a6d0+a4_0x4587c4[_0x205e3b(0xd7)]);});}function a4_0x5bde(){const _0x5ad2df=['235188SQcDcm','startsWith','isArray','207vBGtXJ','Allowed\x20directories\x20must\x20be\x20absolute\x20paths\x20after\x20normalization','isAbsolute','normalize','344545UCbDwH','16YhynIl','436364MqnKkE','30bfVgdL','20bmVAhj','13637472xZFmcc','string','2aeIGsQ','Path\x20must\x20be\x20absolute\x20after\x20normalization','1173172yRIsIm','22956IRZOuj','includes','118209keDfwj','sep','some'];a4_0x5bde=function(){return _0x5ad2df;};return a4_0x5bde();}
@@ -1 +1 @@
1
- (function(_0x5f5416,_0x5ed252){const _0x46c5ef=a5_0x4476,_0x11fdf1=_0x5f5416();while(!![]){try{const _0x30561d=-parseInt(_0x46c5ef(0x126))/0x1+-parseInt(_0x46c5ef(0x112))/0x2+-parseInt(_0x46c5ef(0x11b))/0x3*(parseInt(_0x46c5ef(0x115))/0x4)+parseInt(_0x46c5ef(0x123))/0x5+parseInt(_0x46c5ef(0x118))/0x6*(parseInt(_0x46c5ef(0x124))/0x7)+parseInt(_0x46c5ef(0x121))/0x8+-parseInt(_0x46c5ef(0x11c))/0x9;if(_0x30561d===_0x5ed252)break;else _0x11fdf1['push'](_0x11fdf1['shift']());}catch(_0x3dcdf5){_0x11fdf1['push'](_0x11fdf1['shift']());}}}(a5_0x4727,0x7eaf7));function a5_0x4727(){const _0x26f799=['uri','3734776WcChNB','realpath','4283985dlrcVa','5691021AePDZL','Skipping\x20invalid\x20directory:\x20','753551lOmZyw','\x20due\x20to\x20error:\x20','resolve','file://','161480dmWWUp','isDirectory','join','747364IsipXS','invalid\x20path\x20or\x20inaccessible','slice','6mymTFC','push','startsWith','9XowkCo','2006370tffvRI','non-directory\x20root','stat','message'];a5_0x4727=function(){return _0x26f799;};return a5_0x4727();}import{promises as a5_0x3f29f1}from'fs';import a5_0x376a89 from'path';function a5_0x4476(_0x1a819a,_0x1af76f){_0x1a819a=_0x1a819a-0x112;const _0x4727ce=a5_0x4727();let _0x4476a8=_0x4727ce[_0x1a819a];return _0x4476a8;}import a5_0x5d6bb5 from'os';import{normalizePath}from'./path-utils.js';import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x1e6628){const _0x1d8422=a5_0x4476;try{const _0x4357a1=_0x1e6628[_0x1d8422(0x11a)](_0x1d8422(0x129))?_0x1e6628['slice'](0x7):_0x1e6628,_0x14d71a=_0x4357a1[_0x1d8422(0x11a)]('~/')||_0x4357a1==='~'?a5_0x376a89[_0x1d8422(0x114)](a5_0x5d6bb5['homedir'](),_0x4357a1[_0x1d8422(0x117)](0x1)):_0x4357a1,_0x391def=a5_0x376a89[_0x1d8422(0x128)](_0x14d71a),_0x5e474f=await a5_0x3f29f1[_0x1d8422(0x122)](_0x391def);return normalizePath(_0x5e474f);}catch{return null;}}function formatDirectoryError(_0xcfc213,_0x5a3d61,_0xa4a03c){const _0x314f1a=a5_0x4476;if(_0xa4a03c)return'Skipping\x20'+_0xa4a03c+':\x20'+_0xcfc213;const _0x66dc06=_0x5a3d61 instanceof Error?_0x5a3d61[_0x314f1a(0x11f)]:String(_0x5a3d61);return _0x314f1a(0x125)+_0xcfc213+_0x314f1a(0x127)+_0x66dc06;}export async function getValidRootDirectories(_0x19e1dd){const _0x45ddb1=a5_0x4476,_0x280639=[];for(const _0x5cee3d of _0x19e1dd){const _0x206bfe=await parseRootUri(_0x5cee3d[_0x45ddb1(0x120)]);if(!_0x206bfe){logMcpStderr(formatDirectoryError(_0x5cee3d[_0x45ddb1(0x120)],undefined,_0x45ddb1(0x116)));continue;}try{const _0x19d04c=await a5_0x3f29f1[_0x45ddb1(0x11e)](_0x206bfe);_0x19d04c[_0x45ddb1(0x113)]()?_0x280639[_0x45ddb1(0x119)](_0x206bfe):logMcpStderr(formatDirectoryError(_0x206bfe,undefined,_0x45ddb1(0x11d)));}catch(_0x13ce70){logMcpStderr(formatDirectoryError(_0x206bfe,_0x13ce70));}}return _0x280639;}
1
+ (function(_0x4a3313,_0x341382){const _0x4c69c1=a5_0x4cae,_0x2b1128=_0x4a3313();while(!![]){try{const _0x3178fb=parseInt(_0x4c69c1(0x13b))/0x1*(-parseInt(_0x4c69c1(0x145))/0x2)+parseInt(_0x4c69c1(0x13a))/0x3*(parseInt(_0x4c69c1(0x14c))/0x4)+parseInt(_0x4c69c1(0x142))/0x5*(parseInt(_0x4c69c1(0x147))/0x6)+parseInt(_0x4c69c1(0x137))/0x7*(-parseInt(_0x4c69c1(0x138))/0x8)+parseInt(_0x4c69c1(0x143))/0x9+-parseInt(_0x4c69c1(0x146))/0xa*(parseInt(_0x4c69c1(0x14b))/0xb)+parseInt(_0x4c69c1(0x13c))/0xc*(-parseInt(_0x4c69c1(0x14e))/0xd);if(_0x3178fb===_0x341382)break;else _0x2b1128['push'](_0x2b1128['shift']());}catch(_0x2e653c){_0x2b1128['push'](_0x2b1128['shift']());}}}(a5_0x3d8e,0x1f1d8));import{promises as a5_0x4c099e}from'fs';function a5_0x3d8e(){const _0x33c442=['970aRsNvK','24uyklTy','slice','join','startsWith','resolve','realpath','305dcyiuv','2039310wBHZGc','push','440fleZGN','5160xzMYgm','18312BYdBiN','isDirectory','invalid\x20path\x20or\x20inaccessible','non-directory\x20root','660ATPBWE','522692odxbyU','uri','840086yQkjKQ','Skipping\x20invalid\x20directory:\x20','stat','7JKwOIo','339064cvYKYY','homedir','3tGDCTP'];a5_0x3d8e=function(){return _0x33c442;};return a5_0x3d8e();}import a5_0x284afc from'path';import a5_0x578116 from'os';import{normalizePath}from'./path-utils.js';function a5_0x4cae(_0x35d927,_0x5ad5bd){_0x35d927=_0x35d927-0x137;const _0x3d8e02=a5_0x3d8e();let _0x4cae9a=_0x3d8e02[_0x35d927];return _0x4cae9a;}import{logMcpStderr}from'./log-utils.js';async function parseRootUri(_0x2960a6){const _0x37a74a=a5_0x4cae;try{const _0xff38f8=_0x2960a6[_0x37a74a(0x13f)]('file://')?_0x2960a6[_0x37a74a(0x13d)](0x7):_0x2960a6,_0xa54110=_0xff38f8['startsWith']('~/')||_0xff38f8==='~'?a5_0x284afc[_0x37a74a(0x13e)](a5_0x578116[_0x37a74a(0x139)](),_0xff38f8[_0x37a74a(0x13d)](0x1)):_0xff38f8,_0x31dfc4=a5_0x284afc[_0x37a74a(0x140)](_0xa54110),_0x2050aa=await a5_0x4c099e[_0x37a74a(0x141)](_0x31dfc4);return normalizePath(_0x2050aa);}catch{return null;}}function formatDirectoryError(_0x1f19a7,_0x236637,_0x90e300){const _0x3470e1=a5_0x4cae;if(_0x90e300)return'Skipping\x20'+_0x90e300+':\x20'+_0x1f19a7;const _0x38a65e=_0x236637 instanceof Error?_0x236637['message']:String(_0x236637);return _0x3470e1(0x14f)+_0x1f19a7+'\x20due\x20to\x20error:\x20'+_0x38a65e;}export async function getValidRootDirectories(_0x3f5afa){const _0x501c6f=a5_0x4cae,_0xc68329=[];for(const _0x15df94 of _0x3f5afa){const _0x57aaff=await parseRootUri(_0x15df94[_0x501c6f(0x14d)]);if(!_0x57aaff){logMcpStderr(formatDirectoryError(_0x15df94[_0x501c6f(0x14d)],undefined,_0x501c6f(0x149)));continue;}try{const _0x386249=await a5_0x4c099e[_0x501c6f(0x150)](_0x57aaff);_0x386249[_0x501c6f(0x148)]()?_0xc68329[_0x501c6f(0x144)](_0x57aaff):logMcpStderr(formatDirectoryError(_0x57aaff,undefined,_0x501c6f(0x14a)));}catch(_0x5d00d7){logMcpStderr(formatDirectoryError(_0x57aaff,_0x5d00d7));}}return _0xc68329;}
@@ -1 +1 @@
1
- const a6_0x1d3873=a6_0x216e;(function(_0x4d8db6,_0xd30f91){const _0xd39da8=a6_0x216e,_0x28bb54=_0x4d8db6();while(!![]){try{const _0x394ca8=parseInt(_0xd39da8(0x89))/0x1+parseInt(_0xd39da8(0x8b))/0x2+parseInt(_0xd39da8(0x8f))/0x3*(-parseInt(_0xd39da8(0x94))/0x4)+parseInt(_0xd39da8(0x93))/0x5*(parseInt(_0xd39da8(0x92))/0x6)+-parseInt(_0xd39da8(0x91))/0x7+parseInt(_0xd39da8(0x90))/0x8*(-parseInt(_0xd39da8(0x8a))/0x9)+parseInt(_0xd39da8(0x8c))/0xa;if(_0x394ca8===_0xd30f91)break;else _0x28bb54['push'](_0x28bb54['shift']());}catch(_0x4e970f){_0x28bb54['push'](_0x28bb54['shift']());}}}(a6_0x5ddf,0xc9602));export const TOOL_NAMES={'EDIT_FILE':a6_0x1d3873(0x8d),'CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x1d3873(0x8e)};export const ALL_TOOL_NAMES=Object['values'](TOOL_NAMES);function a6_0x216e(_0x35c87e,_0x2978fc){_0x35c87e=_0x35c87e-0x89;const _0x5ddf73=a6_0x5ddf();let _0x216e4e=_0x5ddf73[_0x35c87e];return _0x216e4e;}function a6_0x5ddf(){const _0x212952=['635145iDDizS','9YacHMJ','1345160OwgSKC','15425730yDgqWC','edit_file','github_codebase_search','531pwloLU','10499528OhidOZ','1915599ahgzLw','2504946ZNUGyV','5uOPLGT','19364zpHgRv'];a6_0x5ddf=function(){return _0x212952;};return a6_0x5ddf();}export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
1
+ function a6_0x6800(){const _0x89c1ed=['171820sbBjwy','6532386uYutfX','121QVfgpa','11512278QeYXoH','github_codebase_search','18182DdAQFI','8RkmpUl','48tLvzzK','values','43kwixAx','517275NSviVk','3974499BaXSVq','2479680aUoGXJ'];a6_0x6800=function(){return _0x89c1ed;};return a6_0x6800();}const a6_0x1737b6=a6_0x7fa9;(function(_0x3cb4b4,_0x50d5cb){const _0x4c345a=a6_0x7fa9,_0x3b9c43=_0x3cb4b4();while(!![]){try{const _0x2e919a=parseInt(_0x4c345a(0xa8))/0x1*(parseInt(_0x4c345a(0xa4))/0x2)+parseInt(_0x4c345a(0xaa))/0x3+parseInt(_0x4c345a(0xab))/0x4+parseInt(_0x4c345a(0xa9))/0x5*(parseInt(_0x4c345a(0xa6))/0x6)+-parseInt(_0x4c345a(0xad))/0x7+-parseInt(_0x4c345a(0xa5))/0x8*(parseInt(_0x4c345a(0xa2))/0x9)+parseInt(_0x4c345a(0xac))/0xa*(-parseInt(_0x4c345a(0xae))/0xb);if(_0x2e919a===_0x50d5cb)break;else _0x3b9c43['push'](_0x3b9c43['shift']());}catch(_0x7f4939){_0x3b9c43['push'](_0x3b9c43['shift']());}}}(a6_0x6800,0xba06c));function a6_0x7fa9(_0x5f344a,_0x3089dc){_0x5f344a=_0x5f344a-0xa2;const _0x6800dc=a6_0x6800();let _0x7fa9dd=_0x6800dc[_0x5f344a];return _0x7fa9dd;}export const TOOL_NAMES={'EDIT_FILE':'edit_file','CODEBASE_SEARCH':'codebase_search','GITHUB_CODEBASE_SEARCH':a6_0x1737b6(0xa3)};export const ALL_TOOL_NAMES=Object[a6_0x1737b6(0xa7)](TOOL_NAMES);export const KNOWN_TOOL_NAMES=new Set(ALL_TOOL_NAMES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morphllm/morphmcp",
3
- "version": "0.8.202",
3
+ "version": "0.8.203",
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.190",
38
+ "@morphllm/morphsdk": "0.2.191",
39
39
  "@vscode/ripgrep": "^1.15.14",
40
40
  "axios": "^1.6.0",
41
41
  "chalk": "^5.3.0",